XJDHDR / impressions-resolution-customiser

Programs used to turn the 1024x768 resolution option in the various isometric Impressions Studios City Building series games and allow the user to define a resolution different from the default.
Other
32 stars 1 forks source link

Zeus/Poseidon german version. How to find offsets? #6

Open GothicIII opened 1 year ago

GothicIII commented 1 year ago

Hello,

a really useful tool! Thanks!

I bought the original discs and could contribute to the following german versions of Zeus:

Zeus v1.0.0.0 Zeus v1.1.0.0 Zeus v1.0.0.0 - Magazine version=NoCD Poseidon v2.0.0.2 Poseidon v2.1.4.0 Poseidon v2.0.0.2 - Magazine version=NoCD

Of course most do only work on Windows XP because they are copy protected.

I looked into the tables at /non-UI_code and the offsets match exactly for the english gog version I have. But nothing matches for the german versions. I tried to search for the little endian words for d1024 and d768 but I didn't find any offset where 'width' and 'height' are close to each other. The readme at the bottom of ZeusResolutionEdits.cs is not helpful either since the bytes next to 'width'/'height' are also different. It seems like those versions have a complete different file structure. They are also much bigger (~30%) in size.

How should I proceed to get all the offsets for the patches? With a debugger? Any hints in how to approach this?

EDIT:

After I slept a bit I managed to find most offsets using pattern coloring for 0x2003 (d800) and 0x0004 (d1024). Since both resolution modes seem to be always close to each other and have a very similar data structure, I looked for those values and changed them if the data area looked the same for both values. It was not that easy since the data structure is different compared to the english version. e.g. the distance between 800w and 1024w is often larger and offsets between functions are not static.

Here are my findings:

Poseidon German v2.1.4.0 patched from v2.0.0.2 CD-Version
Resolution:
w 0x10BA29:d1024 -> 0x17cccd:d2560
h 0x10BA2E:d 768 -> 0x17ccd7:d1440

Unknown:
0x030F50:d1024?
0x04BB21:d1024?
0x04BB2D:d 768?
0x17C955:d1024?
0x17C95F:d 768?
0x191468:d1024
0x21D365:d1024
0x21D49E:d1024
0x2DCB7B:d1024

Viewpoint Menu:
0x1051FA:d1024 -> 0x170289:d2560
0x105212:d 768 -> 0x1702A5:d1440

NameList:
LeftEdge:     0x114634:0x2E01 -> 0x187279:0x2E04
TopEdge:      0x114639:0xAE00 -> 0x18727F:0xFC01
LeftEdgeUiBg: 0x19038C:0x2E01   NOT FOUND! Neither 0x15EF8F nor 0x283B0E nor 0x283B26
TopEdgeUiBg:  0x190391:0xAE00  NOT FOUND! Neither 0x15F1B6 nor 0x283A2E nor 0x283A46

Viewpoint:
w      0x11CC1E:d1024 -> 0x19150F:d2560
multih 0x11CC29:0x32  -> 0x19151A:0x5F
multiw 0x11CC2B:0x0E  -> 0x19151C:0x27

Sidebar:
w       0x18E2BE:d1024 -> 0x21D32C:d2560
start pos x 0x18E2CA:0x4609-> 0x21D338:0x2209

Menubar (Top):
Text 0x18EF7C:d1024 -> 0x21E19C:d2560
Bar  0x19EBFB:d1024 -> 0x230D46:d2560

Other notes: The german No-CD (magazine) versions are not patchable to 1.1.0.0/2.1.4.0. But they have a similar data structure like the english gog version. I didn't check everything but the few things I checked like resolution and viewpoint seem to be only a few bytes off.

I still need to fix the gaps between borders and the bottom right corner. I know nothing about assembler, though. But I'll try later again. Also I couldn't find the Namelist GUI background boundaries. I verified them with an image and they appear to be at pos 301x174 but I did not find the correct values in the .exe.

EDIT2: It is too hard for me to hack in a new pointer and add machine code to the new address to execute an instruction and jump back. I think I'll skip this small optical patch.

EDIT3: Oh boy, oh boy... The implementation of the animation fixes will be hard. I definitely need help for this. The AnimHexOffsetTable is way off and I can only search for 0x64, because the prior/next bytes are completely different. This results in over 11000 numbers to check. No thanks.

I also have no clue how to correctly calculate the used CRC32 hash. I tried dd if=Zeus.exe skip=1 bs=4096 of=/tmp/test && crc32 /tmp/test but this generates different CRC32 hashes.

To summerize:

+ working / - not working

+ Custom resolution change
+ Translation of the resolution option (I patched the german .eng with this tool and terminated the shorter translated string with a 0x00) 
+ Menu/Loading screens (I used the centered versions for menus were the text relies on the menu bars to fit in. The rest is stretched)
+ Namelist activation area is centered, like it should.

- Animation fix (AnimHexOffsetTable does not apply to the CD-Version)
- Windowed mode (it may be fixed by reversing the edits in the unknown section)
- Black holes for menu bar and right lower corner (I need more skills to do this)
- Namelist menu background is off center (I cannot find the correct offset, the x/y coordinates are the same as in the english version, though) 
hackgrid commented 9 months ago

Nice work, thanks for your findings! I am interested in this as well :-) Do you have any updates?