Edit avanced Trade

rhaul

Warlord
Joined
Mar 25, 2010
Messages
221
Location
Madrid
After @darkpanda 's detailed and magnificent explanation, I decided to try my luck with the trade technology edition:

Trade:
07 00 B2 and 00 0F 00 B0
Add +1 character (byte)
08 00 B2 and 00 10 00 B0

Ceremonial Burial:
21 00 B2 and 00 0B 00 B0
and remove -1 character (byte)
20 00 B2 and 00 0A 00 B0

I have to say that I don't change the entire string completely, I just change the bytes in orange and then cut and paste the character to add with the editor. Theoretically it would have to be the same as if I changed all the bytes of trade and ceremonial burial

The result is that effectively trade (Treade) appears with one more character but Burial Ceremonial disappears

 
Last edited:

darkpanda

Dark Prince
Joined
Oct 28, 2007
Messages
768
Yeah I think you got it wrong: when you add to B2, you must substract to B0.

In original compressed CIV.EXE, you have this hex at address 248F2h:

T_ r_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ ...
54 72 61 64 65 07 00 B2 00 0F 00 B0 02 01 43 65 72 65 6D 6F 6E 69 61 6C ...

When this gets uncompressed, it becomes as follows:

T_ r_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ ...
54 72 61 64 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01 43 65 72 65 6D 6F 6E 69 61 6C ...


In un compressed version you want to get the following:
add 1 char to tech name
beacue "Ceremonial..." must not move, you need to remove 1 byte "00" before Ceremonial:​

T_ r_ e_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ ...
54 72 65 61 64 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 01 43 65 72 65 6D 6F 6E 69 61 6C ...

So back to compressed version, the B2 instruction has 1 more byte, so 08 instead of 07 to copy as-is, and the B0 instruction has 1 less "00" byte, so 0E instead of 0F:

T_ r_ e_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ ...
54 72 65 61 64 65 08 00 B2 00 0E 00 B0 02 01 43 65 72 65 6D 6F 6E 69 61 6C ...


But HA ! Here's your problem: compressed version is now 1 char too long after modding, so we need to find another place where 1 char can be removed to spare it...

In fact for Ceremonial Burial, the name is so long that there is no compression between Cerem.Bur and the following Mysticism, because there aren't enough 00 bytes between them to justify compression, so here are the bytes we have:


C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ __ B_ u_ r_ i_ a_ l_ ._ ._ ._ ._ ._ M_ y_ s_ t_ i_ c_ i_ s_ m_ ._ ._ ._ ._ ._ ._ ._
43 65 72 65 6D 6F 6E 69 61 6C 20 42 75 72 69 61 6C 00 00 00 FF FF 4D 79 73 74 69 63 69 73 6D 21 00 B2 00 0B 00 B0

Here we are simply going to remove the "blank space" char between "Ceremonial" and "Burial", and adjust the B2 instruction after "Mysticism", to copy as-is 1 less char, so 20 instead of 21 (the B0 instruction afterwards does NOT change):

C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ B_ u_ r_ i_ a_ l_ ._ ._ ._ ._ ._ M_ y_ s_ t_ i_ c_ i_ s_ m_ ._ ._ ._ ._ ._ ._ ._
43 65 72 65 6D 6F 6E 69 61 6C 42 75 72 69 61 6C 00 00 00 FF FF 4D 79 73 74 69 63 69 73 6D 20 00 B2 00 0B 00 B0

So finally here is our patch at 248F2h:

Before:

T_ r_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ __ B_ u_ r_ i_ a_ l_ ._ ._ ._ ._ ._ M_ y_ s_ t_ i_ c_ i_ s_ m_ ._ ._ ._ ._ ._ ._ ._
54 72 61 64 65 07 00 B2 00 0F 00 B0 02 01 43 65 72 65 6D 6F 6E 69 61 6C 20 42 75 72 69 61 6C 00 00 00 FF FF 4D 79 73 74 69 63 69 73 6D 21 00 B2 00 0B 00 B0

After:
T_ r_ e_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ B_ u_ r_ i_ a_ l_ ._ ._ ._ ._ ._ M_ y_ s_ t_ i_ c_ i_ s_ m_ ._ ._ ._ ._ ._ ._ ._
54 72 65 61 64 65 08 00 B2 00 0E 00 B0 02 01 43 65 72 65 6D 6F 6E 69 61 6C 42 75 72 69 61 6C 00 00 00 FF FF 4D 79 73 74 69 63 69 73 6D 20 00 B2 00 0B 00 B0


Now you see both byte sequences have the same length.

Also remember as told in the other thread, the start position of strings in uncompressed version should not be moved, because CIV.EXE points to them for internel reference, otherwise everything gets screwed up.
 

rhaul

Warlord
Joined
Mar 25, 2010
Messages
221
Location
Madrid
Después:
T_ r_ e_ a_ d_ e_ ._ ._ ._ ._ ._ ._ ._ ._ ._ C_ e_ r_ e_ m_ o_ n_ i_ a_ l_ B_ u_ r_ i_ a_ l_ ._ ._ ._ ._ ._ M_ y_ s_ t_ i_ c_ i_ s_ m_ ._ ._ ._ ._ ._ ._ ._
54 72 65 61 64 65 08 00 B2 00 0E 00 B0 02 01 43 65 72 65 6D 6F 6E 69 61 6C 42 75 72 69 61 6C 00 00 00 FF FF 4D 79 73 74 69 7 0 3 0 6 B9 2 00B0

the game does not start.

I know I've been told that in Ceremonial Burial (and mysticim) there are no compressed bytes so no need to add in this case, but added 1 byte and now it works but eats the first "m" of mysticism.

00 0C 00 B0

EDIT: In the end he used the gunpower and everything seems to be going perfectly, but the previous attempt is still a mystery. (perhaps that's why you told me not to move the beginning of the chain, in this case it would be the Mysticism one)
 
Last edited:

darkpanda

Dark Prince
Joined
Oct 28, 2007
Messages
768
EDIT: In the end he used the gunpower and everything seems to be going perfectly, but the previous attempt is still a mystery. (perhaps that's why you told me not to move the beginning of the chain, in this case it would be the Mysticism one)

Damn ! Of course you're right, when removing the blank space in Ceremonial Burial, we also shifted Mysticism by one char to the left....

All in all, this one is tricky, I don't see how to modify it without more investigation about where to spare more chars, etc.
 
Top Bottom