Jump to content

Can WeiDU tell PS:T 2CD from PS:T 4CD?


the vanished one

Recommended Posts

Hi. I'm working on a UI mod for Planescape: Torment. It edits some offsets in the executable, but Torment.exe in the 4CD version of the game is different from the 2CD one.

What can I write in my .tp2 file so that Weidu edits certain offsets if the mod is installed on Torment 4CD, and other offsets if installed on Torment 2CD?

 

Example:

 

For Torment 4CD, it should execute: WRITE_SHORT "0x3cad81" "1024"

For Torment 2CD, it should execute: WRITE_SHORT "0x3cabc1" "1024"

 

Perhaps it has been asked before, but I can't find anything. I remember something about checking the size of the file, and there's a IF_SIZE_IS command in WeiDU, but I don't know how to use it.

Link to comment

Is it okay to COPY the same file twice? I can't find another way to READ from torment.exe. This is what I have now:

 

COPY ~Torment.exe~ ~Torment.exe~

READ_SHORT 0x00293a96 ~offset_0x00293a96~

ACTION_IF ~%offset_0x00293a96%~ = 20992 THEN

BEGIN
PRINT ~4CD version~
COPY ~Torment.exe~ ~Torment.exe~

WRITE_SHORT "0x3cad81" "1024"
WRITE_SHORT "0x3cad88" "768"
WRITE_SHORT "0x3caeac" "1024"
WRITE_SHORT "0x3caeb3" "1023"
WRITE_SHORT "0x3caed7" "695"
WRITE_SHORT "0x3caede" "695"
...
...
...

WRITE_SHORT "0x2ca70f" "512"
WRITE_SHORT "0x2ca716" "348"

END


ELSE

BEGIN
PRINT ~2CD version~
COPY ~Torment.exe~ ~Torment.exe~

WRITE_SHORT "0x3cabc1" "1024"
WRITE_SHORT "0x3cabc8" "768"
WRITE_SHORT "0x3cacec" "1024"
WRITE_SHORT "0x3cacf3" "1023"
WRITE_SHORT "0x3cad17" "695"
WRITE_SHORT "0x3cad1e" "695"
...
...
...

WRITE_SHORT "0x09a5cb" "512"
WRITE_SHORT "0x09a5d7" "294"

END

Link to comment

I'm not sure you even need to do that, just put the other fixes in another IF or ELSE instead of ENDing and COPYing again.

 

So your code would be

COPY ~Torment.exe~ ~Torment.exe~

READ_SHORT 0x00293a96 ~offset_0x00293a96~

ACTION_IF ~%offset_0x00293a96%~ = 20992 THEN

BEGIN
PRINT ~4CD version~
COPY ~Torment.exe~ ~Torment.exe~

 WRITE_SHORT "0x3cad81" "1024"
 WRITE_SHORT "0x3cad88" "768"
 WRITE_SHORT "0x3caeac" "1024"
 WRITE_SHORT "0x3caeb3" "1023"
 WRITE_SHORT "0x3caed7" "695"
 WRITE_SHORT "0x3caede" "695"
 ...
 ...
 ...

 WRITE_SHORT "0x2ca70f" "512" 
 WRITE_SHORT "0x2ca716" "348"

ELSE BEGIN

PRINT ~2CD version~

WRITE_SHORT "0x3cabc1" "1024"
WRITE_SHORT "0x3cabc8" "768"
WRITE_SHORT "0x3cacec" "1024"
WRITE_SHORT "0x3cacf3" "1023"
WRITE_SHORT "0x3cad17" "695"
WRITE_SHORT "0x3cad1e" "695"
...
...
...

WRITE_SHORT "0x09a5cb" "512"
WRITE_SHORT "0x09a5d7" "294"

END

 

Icen

Link to comment

I'm actually doing some engine tweaks for the next version of my Fixpack, so I'm pretty deep in this myself.

 

I wouldn't do a plain old "ELSE" if I were you. I'd put a condition on that "ELSE" to -verify- that it's the 2CD version (search differerent location for the same value, or same location for different value). Just to be safe. For example, I don't know yet if the german version of the game has a different .exe (something I'm trying to find out now). BG2 has a whole ton of different versions of their .exe.

 

I just don't think it's safe to say "if this value isn't here, it MUST be the 2cd version"... leave room for other possibilities. If it fails both your checks, then you can safely PRINT "Error: Can't identify PS:T version", dump out, and we'll all be better for identifying a third version of the .exe.

 

Qwinn

Link to comment

In case anyone is interested, here's the latest version. It could probably still be improved.

 

COPY ~Torment.exe~ ~Torment.exe~

SET ~failure~ = 0

READ_SHORT 0x00293a96 ~offset_0x00293a96~

PATCH_IF (~offset_0x00293a96~ = 20992) THEN BEGIN
 PATCH_PRINT ~4CD version~
 WRITE_SHORT "0x3cad81" "1024"
 ...
 ...
 WRITE_SHORT "0x2ca716" "348"
END

ELSE BEGIN
 READ_SHORT 0x0056da27 ~offset_0x0056da27~
PATCH_IF (~offset_0x0056da27~ = 20992) THEN BEGIN
  PATCH_PRINT ~2CD version~
  WRITE_SHORT "0x3cabc1" "1024"
  ...
  ...
  WRITE_SHORT "0x09a5d7" "294"
END
ELSE BEGIN
  PATCH_PRINT ~unsupported version~
  SET ~failure~ = 1
END
END

ACTION_IF (~failure~ = 1) THEN
BEGIN FAIL ~Error: your version of the game is not supported.~ END

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...