Jump to content

EXE editing & programming issues


MrFlibble

Recommended Posts

Not sure about concrete, but walls are side-specific by default in Dune II (they even have side colors on the minimap). The other thing is, that normally concrete has to be linked to any of the player's structures to place a building - if you have a patch of player-owned concrete isolated from any buildings, you can't place anything there. But for the Mercenaries and the sardaukar, one of this works at all: you can only place things next you your existing structures, no matter if there's concrete or not, so no gaps/spaces between them are allowed.

Link to comment
Share on other sites

Nyerguds, remember you mentioned the menu text in the European version of Dune II is not centered? Do you have any idea how this could be remedied? I'm asking because that particular version appears to be the latest official build of Dune II, and probably is (or is supposed to be) the best one (I'm talking about the EXE here - I don't like the narrowed fonts the devs had to use to accommodate text in other languages).

Link to comment
Share on other sites

It can only be remedied by adding spaces in the strings file, but that gives some odd behaviour when the same strings are used for stuff like the title of the game settings screen, and it probably also means that the menu keyboard shortcuts won't work because each option has the space a sfirst character. (mind you, if it works like the command shortcuts it might use the first usable char after the spaces for the options after the first one)

If the string ID numbers used on the menu are large enough I could probably look them up in the exe... it worked in C&C. But that's still no guarantee I'll find out how the game centers them in the English version.

Link to comment
Share on other sites

Yes, adding spaces is not worth considering, as it will disable keyboards shortcuts.

I have also tried finding the related part of the EXE by string references - it worked very well with the main menu items (I removed the "Replay Introduction" option from both Super Dune II: Classic Edition and Dune 2 eXtended). However, it didn't work so far with the in-game menu. With the main menu, it was quite easy: you get code like

[pre]1B 00 1C 00 5C 00 1D 00[/pre]which stands for "Play a Game", "Replay Introduction", "Load a game", "Exit Game". Mind that in the European version we're talking about, there's another string for "Load Game" used in the main menu, so it's not 5C, but a much larger number - 340-something in decimal.

I found a similar set of string references for the in-game menu:

[pre]5B 00 5C 00 5D 00[/pre] etc. etc., but changing it didn't have any effect on the menu itself. However, this section is followed by two sets of values where these 5C, 5D and so on have not 00's but some other values between them. Changing those didn't have any effect either, but I did not have the time to thoroughly test this at all.

Besides, comparing the aforementioned sections in the European version and other versions of Dune II also gave nothing yet, as they seem to be completely identical.

Link to comment
Share on other sites

Okay, here's a bit about the "Select your House" screen:

[pre]00 00 10 00 38 00 1F 00 70 00 38 00 19 00 D0 00 38 00 24 [/pre]It gets segmented as follows:

[pre]00 10 00 38 00 1F - A

00 70 00 38 00 19 - O

00 D0 00 38 00 24 - H[/pre]The first two double-bytes, as far as I can tell, are the (x,y) coordinates, probably of a predefined rectangular shape that marks the "clickable" area corresponding to each House herald. The last double-byte is a code of the key you press to select each House (I don't know how this is properly called, but 1F=A, 19=O and 24=H, which corresponds to their position on the keyboard if you count from left to right). But changing the keys doesn't affect the real House that is selected, while I hoped to find a way to make the new sides directly selectable, instead of having extra 1st missions that switch the original sides to the new ones.

Link to comment
Share on other sites

I doubt keyboard layout has anything to do with these values... programs don't even know that, they just get the ASCII codes. Besides, the distance between A snd H is only 5, while these values would make it 10. You're forgetting that that 19 and 24 are hexadecimal.  After 19 comes 1A, not 20.

Link to comment
Share on other sites

Hey guys,

Check my other 2 threads for the concrete and the vanishing houses fixes, but

In relation to the Atreides ending playing for all of the SD2 houses... This is why

(all references below are from battle for arrakis 1.07, but other versions are similar.. if not exactly the same

"gameEndingPlay" function

ovr185:0000 55                            push    bp

...

...

ovr185:0019 A1 2C 3A                      mov    ax, gameHumanTeamID

ovr185:001C 0B C0                          or      ax, ax

ovr185:001E 74 0C                          jz      short endHark

ovr185:0020 3D 01 00                      cmp    ax, 1

ovr185:0023 74 67                          jz      short endAtre

ovr185:0025 3D 02 00                      cmp    ax, 2

ovr185:0028 74 3D                          jz      short endOrdos

ovr185:002A EB 60                          jmp    short endAtre          <<<< If the teamID doesnt match 0,1,2... use Atreides

Starting at

File hex addr:  0x39BDC  is the table of movies? to play at the end

pointers to these strings begins at

Harkonnen: dseg:1A31 DC 1B 42 43    endingHark      dd aHfinala

Ordos:    dseg:1AFB F4 1B 42 43    endingOrdos    dd aOfinala

Atreides:  dseg:19A8 BC 1B 42 43    endingAtre      dd aAfinala

Link to comment
Share on other sites

ah yes... I've seen similar code in C&C1 when using multiplayer teams as human player in a mission, for the score screen code. Since C&C only has a specific score screen for GDI and Nod, and that score screen checks the player's side ID, it all went wrong. (I changed it to just skip the score screen entirely if the side is "illegal". See this neat lil' project)

Link to comment
Share on other sites

segra, mind if I ask you another question? Currently, in Super Dune II and Dune 2 eXtended, the "new" sides are not actually selected on the "Select your House" screen, but the following trick is used:

1) one of the original Houses is selected,

2) the game plays the original House intro from TEXTA.ENG/TEXTH.ENG/TEXTO.ENG,

3) the game loads the first mission for this House: SCENA001.INI, SCENH001.INI or SCENO001.INI,

4) in each of those missions, the Human player set to one of the "new" sides,

5) the game switches to the appropriate "new" side, using the corresponding Mentat image and database, briefing text etc.

6) after the completion/restarting of the first mission, all consecutive missions are loaded for the "new" side (e.g. SCENM002, SCENM003 etc. etc.).

The question is, could the game be modified to directly select the "new" sides right from the beginning?

I doubt keyboard layout has anything to do with these values... programs don't even know that, they just get the ASCII codes. Besides, the distance between A snd H is only 5, while these values would make it 10. You're forgetting that that 19 and 24 are hexadecimal.  After 19 comes 1A, not 20.

19 is O, not A. A is 1F and H is 24 - no problem here. I have counted the keys on the keyboard and have been able to correctly identify M (34), F (22) and S (20) that way.

Link to comment
Share on other sites

alright from what i can see here, this is because

the "mission ini loading" function, loops through each house listed in the internal house data, and attempts to load from the scenario files the [ATREIDES] [MERCENARY], etc sections.

Each time it loads the Brain= variable, it does this check

ovr188:0317 C4 5E F0                    les    bx, dword ptr [bp+teamHumanCpu]

ovr188:031A 26 80 3F 48                cmp    byte ptr es:[bx], 48h

ovr188:031E 75 23                      jnz    short notHuman

If the value it reads starts with H (Human),

ovr188:0320 C4 5E F8                    les    bx, [bp+unitGamePtr]

ovr188:0323 26 83 4F 04+                or      word ptr es:[bx+_unitGame.emcData], 2

ovr188:0328 89 36 2C 3A                mov    houseHumanTeamID, si                  << main internal houseid variable is set

The "SelectTeam" function on the otherhand, has this segment of code

ovr206:1156 3D 01 80                    cmp    ax, 8001h

ovr206:1159 74 0C                      jz      short Atreides

ovr206:115B 3D 02 80                    cmp    ax, 8002h

ovr206:115E 74 0C                      jz      short Ordos

ovr206:1160 3D 03 80                    cmp    ax, 8003h

ovr206:1163 74 0C                      jz      short Harkonnen

ovr206:1165 EB 0E                      jmp    short None

ovr206:1167            ; ---------------------------------------------------------------------------

ovr206:1167

ovr206:1167            Atreides:                              ; CODE XREF: selectTeam+1A9j

ovr206:1167 BE 01 00                    mov    si, 1

ovr206:116A EB 0B                      jmp    short loc_60B37

ovr206:116C            ; ---------------------------------------------------------------------------

ovr206:116C

ovr206:116C            Ordos:                                  ; CODE XREF: selectTeam+1AEj

ovr206:116C BE 02 00                    mov    si, 2

ovr206:116F EB 06                      jmp    short loc_60B37

ovr206:1171            ; ---------------------------------------------------------------------------

ovr206:1171

ovr206:1171            Harkonnen:                              ; CODE XREF: selectTeam+1B3j

ovr206:1171 33 F6                      xor    si, si

ovr206:1173 EB 02                      jmp    short loc_60B37

From there it goes to ask "are you sure" and then display the mentat, eventually setting AX to the value from SI and returning.

the value from SI is used for the rest of the "selecthouse" function, so it should select the correct TEXT%c file if you where to hack those values to 3,4,5

Search: BE 01 00 EB 0B BE 02 00 EB 06 33 F6

The only trouble is the harkonnen replacement, but luckily there is a useless jump there giving you two bytes ;)

replace the 33F6EB02 with BE040090 (04 for sardaukar)

Link to comment
Share on other sites

Cool, thanks a lot once again! ;D

I'll ask you about two more things, then ;)

First concerns the House heralds in the build screen and conquest map. For the build screen, the "new" sides have rubbish instead of heralds:

heraldplaceholderpl2.png

For comparison, here's House Atreides' menu:

heraldnormalhr2.png

Notice that the selection box on the unit list is blue for the Atreides, and it is flashing, whereas it stays white for the unused sides.

On the conquest map, the "new" sides always have the Atreides herald.

Would be very nice if you found out how to fix that - I've been unable to identify the code responsible for herald placement.

Another thing I'd also like to know is the choice of the Mentat used for House introduction. The Mercenary Mentat is used in the final version, however, it looks like in the earlier builds, each House was introduced by its own Mentat (see attached preview screenshot). This is a more theoretical question though, but it would be interesting to know that too :)

post-3074-12833239835263_thumb.gif

Link to comment
Share on other sites

Ill have to take a harder look at the build screen stuff first, only just started taking a peek at that earlier

but, do you know whats in the files FHARK.WSA, FORDOS.WSA, FARTR.WSA, FREMEN.WSA ?

XCC just gives me black

Link to comment
Share on other sites

Ill have to take a harder look at the build screen stuff first, only just started taking a peek at that earlier

Thanks a lot! :)

but, do you know whats in the files FHARK.WSA, FORDOS.WSA, FARTR.WSA, FREMEN.WSA ?

XCC just gives me black

It's the animated planet images for each House (FREMEN.WSA is just a picture of the Fremen). You need to select the appropriate palette in XCC Mixer (which is IBM.PAL for Dune 2) for them to display correctly (put the path of your Dune 2 directory in XCC Mixer's directories setup first, and it will automatically load all palettes it finds in the game PAK files).

Talking about different House endings, is it possible to play no ending at all (like the mid-game cutscenes with the Emperor are not played for the unused sides)?

There are other topics of interest about Dune 2 which you probably might shed some light onto (they are scattered throughout various threads here in the Dune Editing section):

1. The colors on the IX structure are wrong for all Houses except House Harkonnen. This happens because the game swaps certain colors (i.e. considers them remapable areas) that are actually not part of the remap scheme. More info here.

screwedixremapib1.png

Apparently, to solve this problem, the range of palette colors that the game considers remapable should be reduced to exclude these shades of blue that are on the IX structure ::)

2. There are three sound files within VOC.PAK that are never used in the game itself - BUTTON.VOC, POPPA.VOC and SANDBUG.VOC. Would be very interesting to know if their original purpose could be found out, and if they could be re-enabled for use once again. Here are more details about unused sounds in Dune 2.

3. Another thing concerning sound is the player-controlled sandworm's "yes sir!" etc. etc. quotes, which would be good to disable (for Super Dune 2). We have already determined that the set of unit quotes (which is different for vehicles and infantry) is defined by the unit movement type (Foot/Wheeled/Tracked/Slither etc.), and I even tried to locate this data using string references, but to no avail. On the other hand, unit speech might be defined within UNIT.EMC.

4. There has been much talk about unused Fremen and Sardaukar unit sidebar icons that are present in the game files. Apparently, the Fremen troopers summoned by the Atreides palace superweapon were supposed to have different icons (and maybe also different stats) than the regular troopers (probably the same for the Sardaukar troopers), but this feature was not enabled (the icon that depicts two Fremen units is used for the palace button though). Would be nice to know if this feature is still present and might be re-enabled.

5. The tech tree differences between the Houses are not all defined in the sections modifiable via Nyerguds' editor. In fact, there are certain deviations like the Harkonnen WOR accessible at level 2 (instead of 5) and not requiring the Barracks to be built first and the like, which are not reflected in the general unit/building data section at all (read the full list here). So far, we have been unable to locate related code parts in the EXE.

It would be very nice if you looked into any of this when you've got time, as solving some of these issues could enhance Dune 2 gameplay :) I also thought bringing these questions up at once in this thread would be interesting to other people as well.

Link to comment
Share on other sites

ok i found the location the team mentat screen is chosen, but i cant seem to find a version which uses those for the house introduction... which exe do you have?

Anyway,

The function this code is located in is called from the house selection, as well as the game briefing

ovr206:0E50 FF 36 2C 3A                push    houseHumanID    <<

ovr206:0E54 FF 76 0C                    push    [bp+arg_6]

ovr206:0E57 FF 76 0A                    push    [bp+arg_4]

ovr206:0E5A 9A 20 00 DD+                call    sub_42DF0

From the intro itself, the call is made at

ovr206:1363 E8 DE FA                    call    near ptr sub_60804

just prior to this,

ovr206:132C C7 06 2C 3A+                mov    houseHumanID, 5  <<

that line chooses which mentat screen should be shown, but changing it doesnt really help as the facial movements get all screwed up as soon as he talks

ill need to see that exe :)

post-5746-12833239835599_thumb.jpg

Link to comment
Share on other sites

Hm, looks like you've found the choice of the CPS image (e.g. MENTATA.CPS for the Atreides Mentat), but the facial animations SHP file (here still MENSHPM.SHP for the Mercenary Mentat) is defined separately somewhere else. Interesting.

Don't forget the Deviator only deviating units to the Ordos side instead of the side who owns the Deviator. :)

Right, I forgot about that. We also wanted to know whether it was possible to make the Deviator change the affected units' ownership to the player's and not always to Ordos.

BTW, the House selection changing solution you described did not work: when I change any of the House IDs the screeen just goes black when this House is selected :(

Oh, and yet another issue concerning Super Dune II: Classic Edition/Dune 2 eXtended: on the score screen, the score bars for the "new" sides always have the blue Atreides color, yet normal Houses have the bar colored in the appropriate House color - any way to fix that, too?

Link to comment
Share on other sites

ok i found the location the team mentat screen is chosen, but i cant seem to find a version which uses those for the house introduction... which exe do you have?

<...>

ill need to see that exe :)

That's a screenshot from the pre-release version. I took it from Westwood Studios FTP. But maybe the Dune 2 Demo EXE is worth looking into? There are definitely some things missing from the official releases (like LemonFactor, Voice, Special and other variables not being hard-coded)

In the meantime I've solved the problem with the facial animations: you've got to look for the C7 06 2C 3A a couple more times in the EXE (BTW, it's C7 06 9C 34 for the US release). For some reason, the facial animation SHP is defined twice: one time for the initial House selection when you start a game from the main menu, another for the House selection when you choose to "Pick another house" during a mission. Weird... Anyhoo, here's the result: the Bene Gesserit lady is back. She does not replace the actual Mercenary Mentat, but only appears on the introduction screen (I made her into the Atreides Mentat for this purpose).

However, I've noticed that no matter which side's Mentat introduces the Houses, the sound played when a House is selected (e.g. "House Atreides") still belongs to the Mercenaries - and it's not that the game always plays MATRE.VOC, MHARK.VOC, MORDOS.VOC etc. - it will play the files from the set which is currently assigned to the Mercenaries via the Voice parameter (in case of Super Dune II: Classic Edition, it's the Ordos voice set). Would be nice to have the ability to modify this too :)

Link to comment
Share on other sites

Yeah I know that variable,

Arrakis:

dseg:37A8 00 00      IntroSkip      dw 0 

Dynasty:

dseg:3218 00 00      IntroSkip      dw 0

But it doesnt get first checked until after the Westwood logo, its set to 1 if onetime.dat exists, or a savegame/highscore file

I also found this interesting variable...

Arrakis:

dseg:3794 00 00      gamePause? dw 0

Dyn:

dseg:3204 00 00      gamePause? dw 0 

Its not really a pause mode, in fact im not sure what to call it... but nothing in the game moves when its set

It also makes it so when u select a team on the house select screen, it skips the "are you sure" and the mission briefing

In game though, theres no fog, no units can move (but u can give them orders), and buildings dont build.

also notice, individual tiles can be selected on the ground and the building animations (flag flapping) still occurs

And one more,

Arrakis

dseg:3792 00 00      gameWin?        dw 0

Dyn

dseg:3202 00 00      gameWin?        dw 0

When set to 1, the mission will successfully complete immediately.. and all the following missions until u change it back to 0

post-5746-12833239837316_thumb.jpg

post-5746-12833239837841_thumb.jpg

Link to comment
Share on other sites

If u want to skip it completely though,

just 0x90 5 bytes from these addresses

Arrakis: File Address:  0x49D54

Dynasty: File Address:  0x48EF4

ovr189:1C54 9A 20 00 6F 42                    call    j_gameIntroPlay

if you do this, it wont play the intro from the menu either tho :(

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...