It's possible to replace the strings with new ones, though the order in which the data is presented is fixed." a écrit : - And about some lines in baldur.exe, BaldursGateII, SiegeOfDragonspear.exe, SiegeOfDragonspear...
Roll:%d +Luck:%d +SpecialAC:%d +HitMod:%d +Attack of Opportunity:4 +Attack of Opportunity:0 +Berserk:2 +Berserk:0 +Left:%d +Right:%d +Invisible:%d +Invisible Target:%d +Range:%d +Hated Race:%d +Special Target:%d +Protections:%d Roll:%d +DamageMod:%d +Hand bonus:%d *Backstab:%d +Berserk:%d +Strength:%d +Special Bonus:%d +Min Damage:%d
Here a screenshot in-game...
Do you think it's possible to translate them, and / or, make the text more reader-friendly, without causing problems with the executables ? And do you have any hints on the method to follow ?► Afficher le texte
There's two ways to change the string:
1) Replace the strings in-place. As long as the new format string is shorter than or equal to the length of the old one you can simply overwrite the contents, making sure to place a null byte ('\0') at the end.
2) Allocate a new string at runtime and patch the code to refer to it. For example, to replace " +Luck:%d":
- Find every location that references the string, you'll have to use Ghidra / IDA Freeware / x64dbg for this. Then come up with a pattern for each address; I get:
Put that in InfinityLoader.db. Now we have to patch the location, (put this in a M_*.lua file):
Code : Tout sélectionner
[B3LuckStringRef] Pattern=660F4CC8 Operations=ADD -10
where B3ReplaceString(<pattern name>, <size of existing instruction>, <destination register>, <new string>)Code : Tout sélectionner
(function() local B3ReplaceString = function(pattern, existingInstructionSize, destRegister, newString) if existingInstructionSize < 5 then EEex_Error("Existing instruction too small to replace") end EEex_HookNOPs(EEex_Label(pattern), existingInstructionSize - 5, {[[ lea #$(1), qword ptr ds:[#$(2)] ]], {destRegister, EEex_WriteStringAuto(newString)}, [[ #ENDL jmp #L(return) ]]}) end EEex_DisableCodeProtection() B3ReplaceString("B3LuckStringRef", 7, "rdx", " +Lucky Mod:%d") EEex_EnableCodeProtection() end)()
For example, using x64dbg:
The characters on the left are the instruction bytes. So <size of existing instruction> = 7, (two characters make one byte), <destination register> = "rdx".
And for our troubles:► Afficher le texte