Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: String table haxoring  (Read 1399 times)

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
String table haxoring
« on: March 23, 2011, 09:26:20 pm »

Before I waste my time, I have a crazy idea.  Is it possible to hack the string table to change the messages you get when different events happen?

"Urist McLiason is dissapoint" when a diplomat leaves unhappy.
"Dumas McNotagoodswimmer has died" when they drown.

Like actually those phrases, not the real names XD
Logged
I like fortresses because they are still underground.

Aramco

  • Bay Watcher
    • View Profile
Re: String table haxoring
« Reply #1 on: March 23, 2011, 09:49:01 pm »

...


...


I hope so.
Logged
Or maybe there's a god who's just completely insane and sends you to Detroit, Michigan in a new body if you ever utter the name "Pat Sajak".

Andux

  • Bay Watcher
  • [PREFSTRING:semicolons]
    • View Profile
    • Andux's DFWiki page
Re: String table haxoring
« Reply #2 on: March 23, 2011, 10:58:01 pm »

"Urist McLiason is dissapoint" when a diplomat leaves unhappy.

Easy enough; that string is stored outside the executable. Drop this in your <DF install>\data\announcements folder.

No idea why all the all the announcement/dipscript strings are stored as compressed binaries ??? but whatever.

"Dumas McNotagoodswimmer has died" when they drown.

I think that one is hardcoded; it could be replaced, but only with some heavy-duty memory-hacking code-injection voodoo.
Logged
(Do not sign anything.) -- Fell, Planescape: Torment

MADMAN · Save Tools · WTF Tools · Generated Raws Extractor · Tweak for 0.31–34.xx

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: String table haxoring
« Reply #3 on: March 23, 2011, 11:07:57 pm »

Wait so they're in external files but compressed? Can I run these through unzip or something to crack them open?
Logged
I like fortresses because they are still underground.

Andux

  • Bay Watcher
  • [PREFSTRING:semicolons]
    • View Profile
    • Andux's DFWiki page
Re: String table haxoring
« Reply #4 on: March 23, 2011, 11:38:34 pm »

The compression seems to be the same as what 40d used for saves (zlib-compressed blocks), so my old .dat tools should work.

http://meepo.dnsalias.org/files/DwF_dat-tools.zip

... I should probably think about folding those in with the rest of my save tools on DFFD. {edit: Done.}

Uncompressed struct looks like:
Code: [Select]
LineCount: int32
Line: array[1..LineCount] of struct:
LineLen32: int32 (same as LineLen)
LineLen: int16
Text: array[1..LineLen] of char
« Last Edit: March 26, 2011, 02:48:46 am by Andux »
Logged
(Do not sign anything.) -- Fell, Planescape: Torment

MADMAN · Save Tools · WTF Tools · Generated Raws Extractor · Tweak for 0.31–34.xx

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: String table haxoring
« Reply #5 on: March 24, 2011, 12:20:33 am »

Slick.  Thanks muchly.
Logged
I like fortresses because they are still underground.

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: String table haxoring
« Reply #6 on: March 24, 2011, 08:52:36 pm »

"Dumas McNotagoodswimmer has died" when they drown.

I think that one is hardcoded; it could be replaced, but only with some heavy-duty memory-hacking code-injection voodoo.

Data injection, really.  You use a weird API call to allocate a chunk of memory in the DF process, put your new string in there, find the reference to the old string in the DF code segment, and patch that to point to the new string.

I've played with this a little bit, a few versions ago, and can contribute sample source code and some technical help if someone wants to try.  Reply to this thread or PM me.
Logged

RenoFox

  • Bay Watcher
    • View Profile
Re: String table haxoring
« Reply #7 on: July 11, 2011, 06:58:38 pm »

Is the DwF_dat-tools.zip still available somewhere? The old links dont work.

Andux

  • Bay Watcher
  • [PREFSTRING:semicolons]
    • View Profile
    • Andux's DFWiki page
Re: String table haxoring
« Reply #8 on: July 12, 2011, 12:14:55 am »

Is the DwF_dat-tools.zip still available somewhere? The old links dont work.

Undat2 and redat2 can now do the same thing with the -x switch; also, there's WTFTools for dealing with string table type stuff.
Logged
(Do not sign anything.) -- Fell, Planescape: Torment

MADMAN · Save Tools · WTF Tools · Generated Raws Extractor · Tweak for 0.31–34.xx

RenoFox

  • Bay Watcher
    • View Profile
Re: String table haxoring
« Reply #9 on: July 12, 2011, 06:33:05 am »

Thanks, although after unpacking and repacking fortressintro file, it gives an error if even a single character was changed in the file. Unpacking and repacking the file without changes doesn't seem to affect it though.