Jump to content

EXE editing & programming issues


MrFlibble

Recommended Posts

I noticed something odd... during my editing of the Dune 2 exe file I screwed up code on several ocasions.

One of these screwups had to do with adapting the tiles placed on the border of a spice field when spice is harvested. It placed random pieces of structures and such. I noticed right away that sometimes it spawned thick spice again, which really acted as thick spice too and could be harvested.

Now here's the odd part... from time to time it also spawned a pre-spice mound. And when I either shot these or moved a unit on them, they ALWAYS SPAWNED AN ENEMY (Ordos) INFANTRY SQUAD.

If this sounds familiar, spice blooms spawning units is a listed feature in the manual, which never actually appears ingame.

Link to comment
Share on other sites

Now here's the odd part... from time to time it also spawned a pre-spice mound. And when I either shot these or moved a unit on them, they ALWAYS SPAWNED AN ENEMY (Ordos) INFANTRY SQUAD.

All I can say is WOW! :O This is a very cool find. Can you trace this bug and determine the exact circumstances when it happens?

Link to comment
Share on other sites

No, sorry... I can't debug 16-bit programs with this. I was kinda randomly changing loops from 4 to 6 (or 3 to 5, not sure... many loops start from 0) to see if they'd have any effect on the concrete bug, so I made it place down tiles that were calculated using a corrupted method. At first (from changing a different loop) I had a similar encounter with the shadow edges which got corrupted as I revealed more terrain.

So all I really know is that it randomly placed tiles, so the unit-spawning spice bloom is probably defined as a tile internally but not used (probably because it never got any real random unit spawning logic and always gives the Ordos infantry squad). Other tiles included building rubble and single cells of existing buildings. Not sure which colour they were though.

Link to comment
Share on other sites

Did you notice if this unit-spawning bloom was graphically different from the spice-spawning one? If you noticed, there, in fact, are two different bloom tiles in Dune 2 (you can see 'em both here), and I think only the first one is used for the regular blooms placeable in the scenarios (although I'm not sure about it).

Link to comment
Share on other sites

Get the X and Y coordinates for each of them. The Ordos one should give a very nice indication.

Hm, I searched for the Ordos herald top left coordinate (80,30 hex = 128,48 decimal), but to no avail. The bytes just aren't there in the EXE. Am I doing something wrong? I tried 80 30, 80 00 30 and even 80 00 00 00 30. Perhaps the cut-and-paste procedure within CPS operates on some different terms? There's one 30,80 there (if I'm not mistaken), but I didn't examine that thoroughly.

BTW won't editing that cps give the no-remap bug again?

The CPS files don't have it, luckily. Both the paletted CPS files generated by XCC Mixer and the unpaletted ones by Ultraq's tool work fine.

Side note: Does anyone know why CnC Tech Center shut down? A new version of Ultraq's tool could be very useful :)

Link to comment
Share on other sites

The actual dimensions of the image in your original post are wrong; it should be 56x40 pixels, not 55.

I haven't found em yet though, even when looking through the actual game code.

btw, you could try switching them around :P

The Tech Center was shut down due to some hacker using it to send out spam. It was supposed to be cleaned and restored but apparently something went wrong along the way. We contacted the Gamespy admins responsible for the hosting, but got no reply...

Link to comment
Share on other sites

Hm, nothing I've tried with the x,z, coordinates of the heralds works. Maybe the program uses a different method to handle parts of a CPS image? 'Cause the x,y, coordinates were offsets of SHP sprites imposed on a screen. What if with the CPS, it counts pixels in a row (like the cells on a map)? E.g. the pixel with coordinates 0,1 would be #320 and so on? Is it a possibility or am I just fantasizing?

Another semi-crazy idea I got is to convert the music from the Genesis Dune: The Battle for Arrakis to a format recognized by the PC version (XMI if I'm not mistaken). Do you think it's possible to do?

And yet one more question, not related directly to SD2SE. I've mentioned before that the US version 1.07 has rudimentary French and German support - only for text files and graphical text like the "Select your House" or "Select your next conquest" screens. In French, the House name goes after the unit name (e.g. "Trooper Harkonnen"), and in the normal three-language releases this is also true for the high scores screen (e.g. "Empereur Harkonnen"), but in the US v1.07 release (in case you're wondering, you can shift to French/German using a tree-language setup and using the FRENCH.PAK/GERMAN.PAK supplied with any tree-language version) the House name precedes the rank earned by the payer. I wish to change that, 'cause I'm working on a Russian version, and the French word-order is very useful for me (I added Russian genitive case inflections to the House names to have grammatically correct phrases). If you can suggest anything on this issue, that'd be very good. I've tried searching for the string references in the EXE ("s%" symbols), but it didn't help. There are no internal references to the 0-terminated strings (ENG, FRE, GER) in the EXE as well.

Link to comment
Share on other sites

Ah no, you won't find that... the string would be "%s %s" (which I found quite quickly), but the way to change it is to find the code that pushes the arguments in there and reverse their order.

Problem is, as I said before, due to Dune II's memory manager, the data sections are not linked to the code sections as they should be. In C&C95 I'd just get a handy link to any code that references it, but here, I don't know where that code is. I might get to it using the same system used for string references in the editor though.

Also, um, which exe is it you want changed then?

Link to comment
Share on other sites

The US 1.07 one. You see, I try to improve on an unofficial Russian Dune II which was made back in 1994. It had all voice stuff and strings translated (including changing the fonts), but not the graphics (CPS and SHP), and besides, it was based on the US 1.0 version. The US 1.07 is good because it still uses the English voices with other languages, as opposed to the later three-language releases which have limited sets of voices in French and German.

As a side note, the people who did that Russian localization actually created functional tools to edit compressed ENG files (both TEXT#.ENG and MENTAT#.ENG types), and the edited MENTAT#.ENG do not crash US and HS releases if placed within ENGLISH.PAK (as opposed to those created by the current version of SSTEditor). Sadly I've no idea how to contact those people...

Any ideas about the CPS fragment replacement?

Link to comment
Share on other sites

about the CPS... nope, sorry, my guess is that it's all done in code, without using external coordinate lists. Very hard to find.

As for the exe... is it already edited or only the files around it? If it's already edited it's easier if you provide me with the one you got.

Link to comment
Share on other sites

As for the exe... is it already edited or only the files around it? If it's already edited it's easier if you provide me with the one you got.

Don't bother with that. I think I'll switch to the HitSquad release - the Russian voiceover ain't that good, I'll use some of it for the limited quotes in the French/German versions. BTW, in both HS and EU releases, the sound clip with the Mentat saying "4" during the missile launch countdown doesn't play in both French and German because the file name #FOUR.VOC (where # is either F or G) is misspelled as #FOURE.VOC, and the game can't find it within FRENCH.PAK or GERMAN.PAK.

But it'd be really nice if you made that US version of SETUP.EXE that sets the game to French I asked you some time ago.

Another semi-crazy idea I got is to convert the music from the Genesis Dune: The Battle for Arrakis to a format recognized by the PC version (XMI if I'm not mistaken). Do you think it's possible to do?

Nema, perhaps you know something about this?

Link to comment
Share on other sites

But it'd be really nice if you made that US version of SETUP.EXE that sets the game to French I asked you some time ago.

Eh? I thought you asked for a US 1.07 setup.exe that had full sound control... can you point me to that post again? I can't seem to find it.

Link to comment
Share on other sites

Eh? I thought you asked for a US 1.07 setup.exe that had full sound control... can you point me to that post again? I can't seem to find it.

I sent you an e-mail with that request some time ago... I asked for both, actually (the US 1.07 setup with full sound control would be used in the patch).

As for the Genesis music, I've found the following stuff. The entire soundtrack for the Sega Genesis version of Dune can be downloaded here: http://www.zophar.net/music/gym/dune-the-battle-for-arrakis.html. It is in a special Genesis format (GYM) though. At the same site, there are tools for playback and conversion of the files in this format. However, when converted to MIDI (I used this tool), the files sound differently. However, perhaps this can be remedied by tweaking some conversion presets, I haven't had the time to thoroughly study this issue.

Perhaps the Miles Sound System tools will allow to convert the resulting MIDIs into a compatible XMI format recognized by the game. I haven't yet tested that one as well.

Link to comment
Share on other sites

  • 1 month later...

You never know where you can find stuff. Remember this?

[pre]Harkonnen

34 3C F0 32 C8 00 55 00 02 00 90 00 58 02 0A 00

48 00 01 00 06 00 03 00 18 00 3E 3C F0 32

Atreides

48 3C F0 32 4D 00 00 00 00 00 A0 00 2C 01 0A 00

41 00 02 00 07 00 04 00 19 00 51 3C F0 32

Ordos

5B 3C F0 32 80 00 0A 00 01 00 B0 00 2C 01 0A 00

4F 00 03 00 05 00 02 00 1A 00 61 3C F0 32

Fremen

6B 3C F0 32 0A 00 00 00 00 00 C0 00 2C 01 00 00

4F 00 02 00 05 00 02 00 FF FF 72 3C F0 32

Sardaukar

7E 3C F0 32 0A 00 00 00 00 00 D0 00 58 02 00 00

48 00 01 00 06 00 03 00 FF FF 88 3C F0 32

Mercenary

92 3C F0 32 00 00 00 00 00 00 E0 00 2C 01 00 00

4D 00 03 00 07 00 04 00 FF FF 9C 3C F0 32 [/pre]

So far I have been able to identify some values:

[pre]34 3C F0 32 C8 00 55 00 02 00 90 00 58 02 0A 00

                                           |

                                  Frigate delay time

48 00 01 00 06 00 03 00 18 00 3E 3C F0 32

|     |

| Superweapon type

Mentat voice [/pre]

And this:

BTW, there's a file called HOUSE.INI in the DUNE2.EXE internal game file list, but no such file is found in the actual PAKs. Might be something obsolete, but maybe it could still affect certain House-specific aspects, if only its structure could be somehow made known...

Well, I found the contents of this file... inside the Dune: The Battle fro Arrakis Genesis ROM. Here goes:

[pre][Harkonnen]

Decay=2

Special=Missile

Recharge=60

Weakness=89

LemonFactor=33

Voice=H

Frigate=10

[Atreides]

LemonFactor=0

Special=Fremen

Decay=0

Recharge=60

Weakness=60

Voice=A

Frigate=10

[Ordos]

Decay=1

Special=Saboteur

Recharge=60

Weakness=50

LemonFactor=4

Voice=O

Frigate=10

[Fremen]

Decay=0

Special=Fremen

LemonFactor=0

Recharge=3

Weakness=4

Voice=O

Frigate=10

[sardaukar]

Decay=0

Special=Missile

LemonFactor=0

Recharge=3

Weakness=4

Voice=H

Frigate=10

[Mercenary]

Decay=0

Special=Saboteur

Weakness=0

LemonFactor=0

Recharge=3

Voice=M

Frigate=10[/pre]

These parameters are obviously no longer used in Dune 2 (beginning from v1.0), but are mentioned within the Dune 2 demo EXE. Apparently, these were later hardcoded. I wonder what the "LemonFactor", "Weakness" and "Decay" parameters may mean (others are self-explanatory I guess). Perhaps "Decay" is the rate at which buildings decay from "harsh conditions"?

Link to comment
Share on other sites

lol, LemonFactor. Reminds me of a recent conversation with Hyper. He found the names of all funtions and classes in RA1; they were apparently left behind somewhere in the 2.00 version. He showed me stuff like "Find_Juicy_Target" and "IsTanyaDead" :D

Link to comment
Share on other sites

OK, I think I've identified 'em all:

[pre]34 3C F0 32 C8 00 55 00 02 00 90 00 58 02 0A 00

            |    |    |    |    |    |

        Weakness LF  Decay Color Rechrg Frigate

48 00 01 00 06 00 03 00 18 00 3E 3C F0 32

|    |    |    |    |

|  Special Win  Lose  Mentat

Voice[/pre]The Weakness parameter defines the sides' units' susceptibility to Deviator attacks - most probably it's the percent chance of a unit being deviated when hit by the gas missile. By default, the Fremen and the Sardaukar are virtually un-deviatable, and the Mercenaries are completely immune to deviation.

The last three bytes after Special are the Win, Lose and Mentat music themes. The music bytes are as follows:

[pre]01 Ambient 1

02 Ordos Defeat

03 Harkonnen Defeat

04 Atreides Defeat

05 Ordos Win

06 Harkonnen Win

07 Atreides Win

08 Ambient 2

09 Ambient 3

(...)

15 Attack 5

16 Attack 6

17 (unused)

18 Harkonnen Mentat

19 Atreides Mentat

1A Ordos Mentat

1B Intro

1C Main Menu

1D Map Select

1E Harkonnen Ending

1F Atreides Ending

20 Ordos Ending

21 Ending Credits

22 Interlude

23 (unused)

24 Westwood Logo[/pre]

I still have no idea what LemonFactor and Decay are responsible for...

Link to comment
Share on other sites

I think I've found something. Look for this piece of code (any version of the EXE):

[pre]53 00 00 10 00 38 00 1F 00 70 00 38 00 19 00 D0 00 38 [/pre]

This is the definition of what parts of the HERALD.CPS/HERALD.ENG "Select your House" screen can be clicked:

Atreides[pre]53 00 00 10 00 38 [/pre]Ordos[pre]00 1F 00 70 00 38 [/pre]Harkonnen[pre]00 19 00 D0 00 38 [/pre]I cannot figure out how it corresponds to the actual areas of the CPS, but I think this might help to find out how the game handles House heralds on build and map select screens.

For those who're wondering, I tested this stuff by rejuggling the code in several ways, which made some House heralds unclickable or wired them to wrong Houses.

Link to comment
Share on other sites

About concrete/building bug: Did you try filling everywhere around start point with concrete of the problematic house with an editor and try buildig over them in game? I know that would be very cheese solution even if it worked; but i guess its worth a try.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...