Jump to content


Photo

DDraw Fix (For Slowdowns/Stuttering)


  • Please log in to reply
117 replies to this topic

#41 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 24 July 2011 - 03:42 AM

Does anyone know why the Max fps for torment is recommend at 40?

The FPS is also the scripting speed at which the game responses to the stuff that's happening... so it creates huge lags if you put it too huge. #4.4 .

Deactivated account. The user today is known as The Imp.


#42 TormentStorm

TormentStorm
  • Member
  • 12 posts

Posted 28 July 2011 - 12:27 PM

Hello everyone, I just stumbled across this thread while searching for a way to fix PST's ddraw issue, and while everything is fine now (no mouse trails and spells don't freeze the game) I can't get vsync to work. I'm using win7 64 and 8800gt, so any help would be greatly appreciated. I'm also using the GoG version, with mods listed here:

http://www.gog.com/e...ent_mods_guide/

You could say this is my first time playing this gem, so I'd like to get the most out of it, and vsync turned off is just killing me :)

Also, huge thanks to the guy(s) that made this fix and all the other mods :)

Cheers!

Edited by TormentStorm, 28 July 2011 - 12:35 PM.


#43 -aqrit-

-aqrit-
  • Guest

Posted 28 July 2011 - 02:55 PM

How do you know vysnc isn't working?

I haven't test on win x64 yet
Assuming the function call isn't failing and you didn't get any errors when installing...

It is possible that the bitblt is occuring late, I suppose. But there isnt that much going on between the wait call and the bitblt.

The cursor trail fix puts all the drawing through the windowed mode's UpdateFrame function.
Which I think doesn't look as smooth as the fullscreen's method. (flip vs bitblt)

But the game hasn't ever run very smooth (AFAIK) and probably never will at 30 fps.

OTIX says d3dwindower produced smoother results, you may want to try that.
WineD3D is probably the best alternative though.

At some point I'll see if I can fix the cursor trail problem some other way.

#44 TormentStorm

TormentStorm
  • Member
  • 12 posts

Posted 28 July 2011 - 03:41 PM

It's just that the vsync is off (as visible from screen tearing), despite choosing the option to install the fix with vsync on. Also, I'm playing the game at 40 fps.

I've tried D3D windower, but I don't really like playing games in windowed mode. I'd rather stick with your fix and deal with screen tearing if there's no solution.

Edited by TormentStorm, 28 July 2011 - 03:49 PM.


#45 -Tanuki-

-Tanuki-
  • Guest

Posted 10 September 2011 - 05:47 PM

When using either version of the DDraw Fix I would get a black screen while the sound from the movies played. The game would CTD with an assertation error when the movies were skipped/done playing. I traced the problem to the higher than default DPI settings I was using in Windows 7(64).

Not wanting to lower the setting I discovered enabling "disable display scaling on high dpi settings" in the compatibility options for the Torment executable solved this problem. I didn't find this mentioned here so maybe this helps some user.

I am running 864x486 upscaled by the GPU to 1920x1080 and it is excellent. If only Creative would fix Alchemy the game would be near perfect. I appreciate the work everyone has put into these IE games.

#46 aqrit

aqrit
  • Member
  • 132 posts

Posted 11 September 2011 - 01:13 AM

Thanks for sharing Tanuki, I'll look into getting that turned on automatically.

---

In other news:

The mouse trails are caused by HEL's Flip method not flipping!
HEL's Flip (apparently) just Blts the back buffer to the front buffer,
The front buffer is discarded/overwritten and is never flipped/swapped to the back buffer.

The game tries to perform a minimum screen update by erasing the mouse cursor from the back buffer.
However the game doesn't realize that the front buffer isn't being returned to the back buffer...

A fix like the following seems like it would be slow because its copying the entire screen three times instead of once.
pDDSOffscreen->BltFast( 0, 0, pDDSFront, NULL, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );
pDDSFront->BltFast( 0, 0, pDDSBack, NULL, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT ); // <- basically what Flip is doing
pDDSBack->BltFast( 0, 0, pDDSOffscreen, NULL, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );

any ideas are welcome :)

#47 i30817

i30817
  • Member
  • 611 posts

Posted 11 September 2011 - 02:50 AM

Complain bitterly to microsoft?

Use wine?

#48 aqrit

aqrit
  • Member
  • 132 posts

Posted 11 September 2011 - 02:54 PM

The game must be storing the cursor position for each frame ( and possibly a cursor sized bitmap )
so modding it to always use the back buffer info will be my vector of attack

#49 i30817

i30817
  • Member
  • 611 posts

Posted 11 September 2011 - 06:44 PM

I don't think it's only the cursor. I recently had some trouble with areas missing (the uncompressor didn't work in the virtualbox bridge filesystem) so i saw a (bg2 version) of the infinity engine blitting it's way to nothing. Everything that moved left trails in this no background to blit condition.

Though maybe it's because BG2 engine is slightly different.

#50 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 12 September 2011 - 03:11 AM

I recently had some trouble with areas missing (the uncompressor didn't work in the virtualbox bridge filesystem) so i saw a (bg2 version) of the infinity engine blitting it's way to nothing. Everything that moved left trails in this no background to blit condition.

That's a problem with transparency, as there is and will never be anything to replace the transparent background, except the current one... just like if you install the Widescreen mod and then install one of the GUI mods... as the gui update leaves the extra spaces transparent... ok so the Ghostdog's PS:T UI is the only mod that doesn't, but nearly all the rest get sliced.

Deactivated account. The user today is known as The Imp.


#51 aqrit

aqrit
  • Member
  • 132 posts

Posted 13 September 2011 - 06:36 PM

Torment already has the needed code we just need to set the switch :)
; 4cd-v1.1 - sub_UpdateFrame_Fullscreen - 008300E4
00830363    CMP DWORD PTR DS:[ECX+14],0 ; Is primary surface in system memory (out_of_video_memory, 0x8876017c )
00830367    JE 00830410 ; cursor trails if followed && HEL 


#52 i30817

i30817
  • Member
  • 611 posts

Posted 13 September 2011 - 07:08 PM

So you fixed it?
Gotcha, found it.

I guess you'd want to test on a wide variety of machines before releasing something like that.

Edited by i30817, 13 September 2011 - 07:09 PM.


#53 aqrit

aqrit
  • Member
  • 132 posts

Posted 13 September 2011 - 09:02 PM

Actually I posted that because I plan on sitting on this until I can figure out what I'm going to do about vsync

I need to move the vsync stuff somewhere (~400 bytes)
I hope to add support for vsync under WinXP (+300 bytes maybe)
Although Torment had a terrible compiler...
I don't want to be rewriting huge portions of the code to make space

I cannot increase the size of the EXE because so many scripts check the file size to determine the version.
I suppose the code could be patched into smack.dll but that would be a odd play.
Which leaves shipping a dll and patching in a LoadLibrary call which might introduce some trust issues with anti-viruses

Deep thoughts on this topic welcome. Always.

Edited by aqrit, 13 September 2011 - 09:20 PM.


#54 i30817

i30817
  • Member
  • 611 posts

Posted 14 September 2011 - 10:11 AM

Doesn't TobEx do some in memory patching? How did it manage to do that while not tripping all over antivirus i don't know.

#55 ghostdog

ghostdog
  • Modder
  • 556 posts

Posted 15 September 2011 - 02:21 PM

Qwinn's latest patch had some engine tweaks that released space, I think. The tweaks were basically done by scient. If you could get hold of him maybe you could work something out.

#56 aqrit

aqrit
  • Member
  • 132 posts

Posted 18 September 2011 - 11:03 PM

Since this patch obsoletes the SolfBlt family of functions I could probably overwrite those.
However, I think I'll just drop the vsync stuff.

TormentStorm is correct, vsync isn't working.
The function calls all look okay but... the screen is still tearing and I don't know why.

The problem is very visible if I just swap between black and white backgrounds while using the hardware emulation layer
( Epileptic seizure warning... )
The problem doesn't occur when not using the hardware emulation layer
All function return values look the same regardless of whether I use HEL or HAL

edit:
when the HAL blitter finishes the monitor is around scanline 3...
but HEL finishes around ~7 with a spike every 7 frames where it jumps up to ~16
but... anything less than 20 is in vertical blank usually?
shouldn't the drawing issues be localized to the top couple lines of the screen?

Attached Files


Edited by aqrit, 18 September 2011 - 11:52 PM.


#57 aqrit

aqrit
  • Member
  • 132 posts

Posted 17 October 2011 - 03:54 PM

release v2.1

Disables high DPI scaling
Removed vsync hack
Improved the cursor trail fix
- eliminates previous issue with the widescreen mod
- possibly smoother scrolling in fullscreen mode
(internal) improved signature scanner

Not very exciting but there isn't much to pst-drawfix anyways
( change two bytes in the executable then drop a text file )

Have fun

#58 i30817

i30817
  • Member
  • 611 posts

Posted 17 October 2011 - 08:24 PM

Great, now it can be in the fixpack? Since there is no post-order requirement anymore.

#59 aqrit

aqrit
  • Member
  • 132 posts

Posted 18 October 2011 - 12:58 PM

yeah, but... probably the Flip() right above the "cursor trail fix" should be changed to a FastBlt()
so there aren't any problems if someone installs this fix while using Wine, or VirtualBox, or whatever

#60 i30817

i30817
  • Member
  • 611 posts

Posted 28 October 2011 - 05:46 AM

So, you want a tester or something? Problem is, i never had the cursor trail problem in wine (have a Ati mobile) so i wouldn't know.