Jump to content


Photo

Qwinn is retire?


  • Please log in to reply
99 replies to this topic

#61 -maluco-

-maluco-
  • Guest

Posted 24 June 2011 - 02:33 PM

g4-Patch löschen funktioniert bei mir nicht.
Tja, schade. Welcome back Windows.

#62 maluco

maluco
  • Member
  • 3 posts

Posted 24 June 2011 - 02:40 PM

Whops, meant so say:
4g-snap didtn worked either.
Installing windows right now.

#63 Turambar

Turambar
  • Modder
  • 935 posts

Posted 25 June 2011 - 12:07 AM

Whops, meant so say:
4g-snap didtn worked either.
Installing windows right now.

What do you mean by didn't work? Was it still hanging at rest?
Are you sure you deactivated patch 4g, and not some other patch nearby? (All the output from your installation should be in setup-pst-fix.debug)

Some NPC's (base) morale starts at 10, but can be modified through dialogues; there are other things which can lower it temporarily.
I'm not sure of what the effects of morale are (that belongs to AD&D rules), and how they could have been modified in this particular game (in BG, morale has to do with creatures or NPCs running away in panic, but I've never seen anyone panicking in PS:T)

I thought:
find all: 83 F8 02 3B C2 0F 84
replace all with: 83 F8 02 90 90 0F 84
would solve it?
Anyway, will try your solution.
Just for the records, uninstall current patch, edit the file, install the patch - right?

The first solution (replace that string) doesn't work for me. Note that the string is written twice in enginefixes.tph: once as a comment, and once it is passed to the macro which actually changes the exe.
What I proposed was to just skip patch 4g, and install all other patches. Try commenting out all text between
SPRINT ...~[something with 4g]~
and
SPRINT ...~[something with 4h]~

Yes, uninstall, edit, save and reinstall is correct

Edited by Turambar, 25 June 2011 - 12:13 AM.

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#64 i30817

i30817
  • Member
  • 611 posts

Posted 25 June 2011 - 01:44 AM

Removing that patch from the tph worked in both cases.

#65 maluco

maluco
  • Member
  • 3 posts

Posted 27 June 2011 - 02:06 PM


Whops, meant so say:
4g-snap didtn worked either.
Installing windows right now.

What do you mean by didn't work? Was it still hanging at rest?
Are you sure you deactivated patch 4g, and not some other patch nearby? (All the output from your installation should be in setup-pst-fix.debug)

Some NPC's (base) morale starts at 10, but can be modified through dialogues; there are other things which can lower it temporarily.
I'm not sure of what the effects of morale are (that belongs to AD&D rules), and how they could have been modified in this particular game (in BG, morale has to do with creatures or NPCs running away in panic, but I've never seen anyone panicking in PS:T)

I thought:
find all: 83 F8 02 3B C2 0F 84
replace all with: 83 F8 02 90 90 0F 84
would solve it?
Anyway, will try your solution.
Just for the records, uninstall current patch, edit the file, install the patch - right?

The first solution (replace that string) doesn't work for me. Note that the string is written twice in enginefixes.tph: once as a comment, and once it is passed to the macro which actually changes the exe.
What I proposed was to just skip patch 4g, and install all other patches. Try commenting out all text between
SPRINT ...~[something with 4g]~
and
SPRINT ...~[something with 4h]~

Yes, uninstall, edit, save and reinstall is correct

It freezed every single time after resting (no matter where). The resting-video plays and exactly after that, the screen remains black and my CPU goes up to 100% and Wine freezes. I have to force-quit torment.exe in order to exit Wine.
First I tried to replace the strings, after that I enclosed the code with */ and then I deleted the whole 4g part in the tph.
I did it exactly as you said, uninstalled, edited, saved, reinstalled. Nothing worked, but I didnt checked setup-pst-fix.debug though.

I am doing a reinstall my Linux-system (not only because of PST though), after this I will try again with Wine (from ppa) and a new installation of PST without the 4g-part, exactly as you recommended.
Which windows should I emulate in Wine for PST? I used Win 98, since I read it somewhere it would be the best solution.

Anyway, I just want to play the game, because I never finished it when I first got it back then years ago. The blade of Dakkon isnt that important to me right now.

#66 i30817

i30817
  • Member
  • 611 posts

Posted 27 June 2011 - 06:05 PM

I used xp.

#67 maluco

maluco
  • Member
  • 3 posts

Posted 29 June 2011 - 07:29 AM

Okay, its working, even with the old savegames. Great!
Thank you for helping :)

#68 scient

scient
  • Modder
  • 1010 posts

Posted 11 July 2011 - 04:31 PM

That double compare is a mistake on my part. I dunno how I missed that. :x Basically, it's a mismatch between my initial morale system and my revised optimized one. The codes goal is to check the CRE id whether it's PC (2) or NPC (0x80), and then I inject some additional code to check for PC's in NPC state.

original code:
007378F4      8B8D 58FCFFFF       MOV ECX,DWORD PTR SS:[EBP-3A8]           ;  offset prt into CRE struct or something
007378FA      8A51 20             MOV DL,BYTE PTR DS:[ECX+20]              ;  CRE id
007378FD      8895 98FDFFFF       MOV BYTE PTR SS:[EBP-268],DL             ;  storing id into local var
00737903      8B85 98FDFFFF       MOV EAX,DWORD PTR SS:[EBP-268]
00737909      25 FF000000         AND EAX,0FF
0073790E      33C9                XOR ECX,ECX
00737910      8A0D 7DCA8D00       MOV CL,BYTE PTR DS:[8DCA7D]              ;  const value of 2
00737916      3BC1                CMP EAX,ECX                              ;  comparing current CRE id to 2
00737918      0F84 D5000000       JE Torment_.007379F3

Now I optimized this to an extent in my first version of morale system, forgot which fixpack version maybe v3? Anyway, here is asm for that section (glad I keep really good records of all my patches!). Pretty much only change was to use EDX so CRE struct ptr in ECX wouldn't get reset. This meant I didn't have to store it in ECX a 2nd time later on in code.

morale system v1:
007378F4      8B8D 58FCFFFF       MOV ECX,DWORD PTR SS:[EBP-3A8]           ;  offset prt into CRE struct or something
007378FA      8A51 20             MOV DL,BYTE PTR DS:[ECX+20]              ;  CRE id
007378FD      8895 98FDFFFF       MOV BYTE PTR SS:[EBP-268],DL             ;  storing id into local var
00737903      8B85 98FDFFFF       MOV EAX,DWORD PTR SS:[EBP-268]
00737909      25 FF000000         AND EAX,0FF
0073790E      33D2                XOR EDX,EDX                              ;  change to EDX
00737910      8A15 7DCA8D00       MOV DL,BYTE PTR DS:[8DCA7D]              ;  DL -> const value of 2
00737916      3BC2                CMP EAX,EDX                              ;  change to EDX -> comparing current CRE id to 2
00737918      0F84 D5000000       JE Torment_.007379F3

Now final version where I optimize out variable with the const value of 2 which is unnecessary. But, in process it looks like I accidentally left compare from v1. Opps!

morale system v2 (current part of v4.xx):
007378F4   .  8B8D 58FCFFFF MOV ECX,DWORD PTR SS:[EBP-3A8]
007378FA   .  8A51 20       MOV DL,BYTE PTR DS:[ECX+20]
007378FD   .  8895 98FDFFFF MOV BYTE PTR SS:[EBP-268],DL
00737903   .  8B85 98FDFFFF MOV EAX,DWORD PTR SS:[EBP-268]
00737909   .  25 FF000000   AND EAX,0FF
0073790E > .  83F8 02       CMP EAX,2
00737911      3BC2          CMP EAX,EDX                              ;  <- problem, should be removed
00737913   .  0F84 DB000000 JE Torment.007379F4

So, solution by aqrit of nopping that 2nd CMP is correct. This is actually causing incorrect behavior even in windows version, although it's really only NPC's (non-PC's) who might have their morale messed up. So this would be recommend patch for everyone, not just for linux users. Even though this is a bug, I dunno why linux can't handle two CMP in a row. It's not like first one does anything, 2nd should reset flags. :P

Anyway, it seems some folks were having issue even after nopping out that compare?

Pst-Fix 4g. causes a crash when a movie plays with x64 wine
I'm fairly confident that just nopping the bad cmp statement will fix everything.
So do a search and replace in the file "PST-Fix\tph\EngineFixes.tph"

find all:          83 F8 02 3B C2 0F 84
replace all with:  83 F8 02 90 90 0F 84


But does removing 4g solve it for everyone? If that's the case, might be some other issue with my patch beyond double compare. I did a quick look at rest of code and couldn't find any problems, going to do a more in-depth one now. I'm pretty much mirroring what original game does after I inject my additional checks and such. For a fix, I would pretty much do what aqrit recommended except shift NOP's down to dead space section and rebase all jumps. So, if this isn't working for folks I guess some other issue need to resolve.

So far my attempt to get PST installed on friends Fedora laptop failed (well, his attempt because I know nothing about linux). We got to point where game would launch in Wine but it would just show up as window with nothing in it in top left area. And there was command line window going crazy about some graphic library and that game would probably crash (but it didn't). It would start up but just not load into game. I can get more specific info later if someone has experience getting PST running under Wine in Fedora.

Edited by scient, 11 July 2011 - 04:37 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#69 scient

scient
  • Modder
  • 1010 posts

Posted 11 July 2011 - 08:38 PM

Here is revised patch data for 4g:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

I attached the edited tph file just with updated patch data above on lines 573 (comment) and 584 (patch). The best way to test this is in a zone with PC's, PC's as NPC's (say like Annah or Ignus as NPC) and regular NPC's. Preferably one where PC's have morale above or below 10 before resting. If someone knows how to use Near Infinity, they could modify cheat book to include inc/dec/set morale script commands for various PC's.

The only real change to code is that I removed that 2nd compare that was preventing NPC's morale getting reset when party slept. This might mean that NPC's who should of lost panic state didn't when party rested in zone. Not sure when this would of cropped up but still bug in my code that I'm surprised I overlooked. This affected all OS's. Just in case some of other optimizations I made in this function might be causing problems, I slightly revised asm (three places really). The core logic is the same (except for removal of erroneous cmp) just added few lines of asm to make things more "explicit". Hopefully game won't crash on linux anymore due to this code. :)

Edited by scient, 12 July 2011 - 02:02 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#70 Turambar

Turambar
  • Modder
  • 935 posts

Posted 12 July 2011 - 02:07 AM

Here is revised patch data for 4g:

8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

I attached the edited tph file just with updated patch data above on lines 573 (comment) and 584 (patch). The best way to test this is in a zone with PC's, PC's as NPC's (say like Annah or Ignus as NPC) and regular NPC's. Preferably one where PC's have morale above or below 10 before resting. If someone knows how to use Near Infinity, they could modify cheat book to include inc/dec/set morale script commands for various PC's.

The only real change to code is that I removed that 2nd compare that was preventing NPC's morale getting reset when party slept. This might mean that NPC's who should of lost panic state didn't when party rested in zone. Not sure when this would of cropped up but still bug in my code that I'm surprised I overlooked. This affected all OS's. Just in case some of other optimizations I made in this function might be causing problems, I slightly revised asm (three places really). The core logic is the same (except for removal of erroneous cmp) just added few lines of asm to make things more "explicit". Hopefully game won't crash on linux anymore due to this code. :)


Thanks for your interest, welcome back, and thanks for all you have done!!
Unfortunately, using the file you attached, the game still hangs after resting on linux; I confirm that removing patch 4g removes the hang (but causes the morale to be reset, obviously).

Could perhaps the first version of the patch work? Or has it other problems?
If you write the hex string from the first patch, I could try putting that in the tph, and see what happens.

BTW, I'm using ubuntu. I have great problems on one computer due to an ATI graphic card: the official drivers don't support that card anymore, and the xorg drivers don't really suport opengl.
Anyway, configuration hints to run ps:t on wine are enabling sound emulation, using a virtual desktop, and using d3d drivers (not opengl). For the first two things, I've prepared this script, which works for me:Attached File   torment.txt   298bytes   228 downloads
I had to change the extension in order to upload it; just edit the installation path after cd

Edited by Turambar, 12 July 2011 - 02:15 AM.

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#71 scient

scient
  • Modder
  • 1010 posts

Posted 12 July 2011 - 04:16 AM

Hmm ok, since I won't have access to linux laptop immediately to test so here are different sets of patches with certain sections of function removed/jumped over to hopefully narrow down code that's crashing. I also included the original version of this function although I'd be surprised if it works if above one causes freeze. It doesn't have any problems afaik, it was just optimized some. Not that that really matters for this particular function but I'd still like to know what lines of asm are causing freeze.

test 0 (version 3.02 of 4g patch):

2CD:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 FF 00 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 33 D2 8A 15 7D CA 8D 00 3B C2 0F 84 D5 00 00 00 81 C1 94 04 00 00 51 E8 84 55 08 00 83 F8 FF 8B 8D 58 FC FF FF 0F 85 BA 00 00 00 8B 45 08 D1 E8 8B 89 CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F BE 82 27 07 00 00 0F BE 8A 5C 05 00 00 90 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 65 7D 63 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 37 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 EB 0D 8A 91 5C 05 00 00 88 91 27 07 00 00 90

4CD:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 FF 00 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 33 D2 8A 15 6D BA 8D 00 3B C2 0F 84 D5 00 00 00 81 C1 94 04 00 00 51 E8 84 55 08 00 83 F8 FF 8B 8D 58 FC FF FF 0F 85 BA 00 00 00 8B 45 08 D1 E8 8B 89 CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F BE 82 27 07 00 00 0F BE 8A 5C 05 00 00 90 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 65 7D 63 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 37 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 EB 0D 8A 91 5C 05 00 00 88 91 27 07 00 00 90

test 1:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 E9 01 01 00 00 90 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 2:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 E9 DE 00 00 00 90 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 3:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF E9 C3 00 00 00 90 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 4:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

Edited by scient, 12 July 2011 - 04:46 AM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#72 i30817

i30817
  • Member
  • 611 posts

Posted 12 July 2011 - 12:02 PM

To run in linux you can use this. The GDI warning doesn't crash the game.

This script is in the folder above the "Torment" folder with the game (fully patched however you want).

#!/bin/bash
GAME_PATH=$(dirname "$(readlink -f "$0")")
cd "$GAME_PATH/Torment"
#bug on wine sound with torment
wine reg add "HKCU\\Software\\Wine\\Appdefaults\\Torment.exe\\DirectSound" /v "HardwareAcceleration" /t REG_SZ /d "Emulation"
#bug with resolutions and movies on torment - only works on virtual desktop, but without the resolution mod, it won't fil
#the screen, so i change and restore the resolution - if you use the resolution mod to set it to your habitual desktop
#resolution you don't need to change the normal resolution.

#set normal resolution to game resolution
xrandr -s 640x480

#set a virtual destop for the game (only) on the game resolution
wine reg add "HKCU\\Software\\Wine\\Appdefaults\\Torment.exe\\Explorer" /v "Desktop" /t REG_SZ /d "Torment.exe"
wine reg add "HKCU\\Software\\Wine\\Explorer\\Desktops" /v "Torment.exe" /t REG_SZ /d "640x480"

#run the game and restore the normal resolution after
wine "Torment.exe" && xrandr -s 1024x768


Wine doesn't like Torment resolution changes for some reason, but it can be worked around.

Anyway, after this, it starts here (fglrx driver).


About the 4g patch (i still haven't used your modifications yet, just talking about aqrit version):
1) using the binary patch that aqrit did (NOP of the double compare), it wouldn't crash if you used the rest button, but it would if you rested in a conversation - a example is the first time you talk to mebeth (sp) or convince the guy who buys rat tails to bore you, or go to a inn.
2) removing the whole 4g patch fixed it.

So i suspect something more - it IS weird that a double compare would crash wine compiled with a O2 optimization - hopefully the root is not a subtle bug in wine.

Edited by i30817, 12 July 2011 - 12:08 PM.


#73 Turambar

Turambar
  • Modder
  • 935 posts

Posted 12 July 2011 - 12:05 PM

Hmm ok, since I won't have access to linux laptop immediately to test so here are different sets of patches with certain sections of function removed/jumped over to hopefully narrow down code that's crashing. I also included the original version of this function although I'd be surprised if it works if above one causes freeze. It doesn't have any problems afaik, it was just optimized some. Not that that really matters for this particular function but I'd still like to know what lines of asm are causing freeze.

test 0 (version 3.02 of 4g patch):

2CD:

8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 FF 00 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 33 D2 8A 15 7D CA 8D 00 3B C2 0F 84 D5 00 00 00 81 C1 94 04 00 00 51 E8 84 55 08 00 83 F8 FF 8B 8D 58 FC FF FF 0F 85 BA 00 00 00 8B 45 08 D1 E8 8B 89 CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F BE 82 27 07 00 00 0F BE 8A 5C 05 00 00 90 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 65 7D 63 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 37 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 EB 0D 8A 91 5C 05 00 00 88 91 27 07 00 00 90

4CD:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 FF 00 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 33 D2 8A 15 6D BA 8D 00 3B C2 0F 84 D5 00 00 00 81 C1 94 04 00 00 51 E8 84 55 08 00 83 F8 FF 8B 8D 58 FC FF FF 0F 85 BA 00 00 00 8B 45 08 D1 E8 8B 89 CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F BE 82 27 07 00 00 0F BE 8A 5C 05 00 00 90 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 65 7D 63 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 37 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 EB 0D 8A 91 5C 05 00 00 88 91 27 07 00 00 90

test 1:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 E9 01 01 00 00 90 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 2:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 E9 DE 00 00 00 90 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF 0F 85 C2 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 3:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 8B 8D 58 FC FF FF 83 F8 FF E9 C3 00 00 00 90 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

test 4:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 7A 3B C1 7D 76 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 4A 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

I've tested all "test" code lines. If you need it, I was using wine 1.3, on kubuntu natty (11.04), 32 bit.
I can't test it on 64bit linux right now, due to the driver problems I wrote about above. But I don't think much chages between 32 and 64 bit wine.
I was using a saved game from the Outlands, where both annah and da'kkon had morale 20. I rested in fjhull's house, and re-checked their morale after resting (I didn't check anything else, so I don't know if anything else can have broken, but I think that would not be OS-dependant).
Apparently, the issue is in "test 3": here are my test results
test 0: as you said, it did hang.
test 1: ok
test 2: ok
test 3: hang
test 4: ok

By ok I mean: could rest, movie played correctly, after movie end or after clicking the game went on as usual; morale was not reset (remained at 20).
By hang I mean: as soon as the resting movie finished or was interrupted, the game hangs until I kill the process.

@i30817: aqrit's patch did not work as you write for me; I still had hangs after resting even with the resting button. What I suspect is that, as the problem has to do with 8 hours passing (in fact, I also had hangs when travelling through the worldmap), perhaps those particular 'rest' actions were scripted in such a way, that time didn't really pass when you were resting.

PS: a topic about this issue also exists on WineHQ; I linked it in case it might be useful.

Edited by Turambar, 12 July 2011 - 12:16 PM.

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#74 scient

scient
  • Modder
  • 1010 posts

Posted 12 July 2011 - 12:50 PM

Ah ha. I think I see problem. I'm not cleaning up stack properly, this is legit issue that I can see why linux crashes (unlike double CMP). Actually, double CMP might not be issue in first place but this stack issue def is. It may be that folks who thought removing double cmp fixed it weren't triggering code where it's checking if NPC is PC (although double CMP is valid bug). Basically, I call function and push ptr with CRE ascii name onto stack. This name is checked to see if it's PC. I should of rolled back ESP but forgot to in this instance. Going to double check my other uses of this function to make sure this was only case. I'll post updated patch data that SHOULD 100% work shortly. If it doesn't, nfi. :P

Edited by scient, 12 July 2011 - 12:58 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#75 i30817

i30817
  • Member
  • 611 posts

Posted 12 July 2011 - 12:56 PM

Test 4 worked in both cases.

Testing the others.

Edit: wow hah ninja'ed.

Edited by i30817, 12 July 2011 - 12:57 PM.


#76 scient

scient
  • Modder
  • 1010 posts

Posted 12 July 2011 - 01:12 PM

Ok, here is what should be final patch data. I could prob roll back a few of minor changes I made to asm but honestly there is plenty of extra space that 2-3 extra op codes aren't going to matter. So this sorts double CMP and fixed clean up of stack (most likely cause of crash).

4g fixed fin:
8B 8D 58 FC FF FF 83 B9 CA 0C 00 00 00 0F 84 00 01 00 00 8B 8D 58 FC FF FF 8A 51 20 88 95 98 FD FF FF 8B 85 98 FD FF FF 25 FF 00 00 00 83 F8 02 0F 84 DD 00 00 00 81 C1 94 04 00 00 51 E8 8B 55 08 00 83 C4 04 8B 8D 58 FC FF FF 83 F8 FF 0F 85 BF 00 00 00 8B D1 8B 45 08 D1 E8 8B 8A CA 0C 00 00 6B C9 0F 33 D2 F7 F1 89 45 D4 8B 95 58 FC FF FF 0F B6 82 27 07 00 00 0F B6 8A 5C 05 00 00 3B C1 7E 25 2B C1 25 FF 00 00 00 3B 45 D4 77 08 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 2A 45 D4 88 82 27 07 00 00 EB 77 3B C1 7D 73 2B C8 81 E1 FF 00 00 00 3B 4D D4 77 0E 8A 8A 5C 05 00 00 88 8A 27 07 00 00 EB 0F 8A 82 27 07 00 00 02 45 D4 88 82 27 07 00 00 EB 47 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8A 91 5C 05 00 00 88 91 27 07 00 00

Oh, and there was only one other instance where I don't explicitly clean up stack for function most likely causing crash in above code. However, this is in one of my injected morale sub-functions and shouldn't matter (where as above was me editing existing sleep/rest function). Going to double check to make sure.

Edited by scient, 12 July 2011 - 01:16 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#77 i30817

i30817
  • Member
  • 611 posts

Posted 12 July 2011 - 01:21 PM

Ok, crash fixed (don't know about morale since i had not yet got companions).

Edited by i30817, 12 July 2011 - 01:28 PM.


#78 scient

scient
  • Modder
  • 1010 posts

Posted 12 July 2011 - 01:49 PM

Well I make no changes to how morale is actually stored, just better stack handling (something I should of done in first place). Interesting how windows handles these problems ok but wine/linux crashes. As for other instance of call, the way function is working there isn't any issue. Also, if there was game would crash upon load because it's constantly called when game isn't paused. I scanned through other morale changes and few other patches and couldn't find any similar type oversight. Maybe with tweak for displaying GOOD/LAW and morale inside profile, however I think stack handling should be acceptable in this case.

So it looks like this bug has been quashed. Going to wait for Turambar to confirm and then will PM Qwinn about releasing minor update for fixpack. At some point I'll have to go through all my patches again and vet them for any kind of errors. Maybe once I've release update for SMAC/X project, will go back and look over existing PST patches as well as finish up some half worked on mechanics like exceptional str.

Oh, also I am going to make two minor tweaks to patch data above. Just two op code changes I forgot to roll back. To be honest, they don't really matter (treating morale var as signed vs unsigned) but I want to keep it in line with rest of code as well as my original patch.

Edited by scient, 12 July 2011 - 01:51 PM.

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#79 scient

scient
  • Modder
  • 1010 posts

Posted 12 July 2011 - 02:01 PM

Here is edited tph with final changes, two bytes different than on in post #76 where I changed back two op codes to my original version. This is what I'll be sending to Qwinn if Turambar says it doesn't crash.

Attached File  EngineFixes.tph   102.78K   422 downloads

Those interested in the classic TBS game Sid Meier's Alpha Centauri / Alien Crossover should check out the unofficial patch I work on here.


#80 i30817

i30817
  • Member
  • 611 posts

Posted 12 July 2011 - 04:46 PM

Just noticed that the update function for the WEIDU exe doesn't work on wine (wine bug this) - it doesn't matter if you extract and install the patches once at a time, but if you extract them all at once it flips out when copying. No big deal, i just upgraded weidu manually inside the zips, or you can install them once at a time (the older patches are fix, tweak and ub, the newer are the widescreen and aqrit ddraw fix).

Edit: also found another wine bug with the engine, even with the widescreen mod it needs the virtual desktop mode in wine because the mouse moves to center without it - it can be avoided easily with a virtual desktop to the same resolution than the game though.

Edited by i30817, 12 July 2011 - 05:24 PM.