Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help with fixing swat 2 #45

Closed
Volcanotron opened this issue Oct 25, 2019 · 27 comments
Closed

help with fixing swat 2 #45

Volcanotron opened this issue Oct 25, 2019 · 27 comments

Comments

@Volcanotron
Copy link

I was wondering if you could give some advice with improving Swat 2's fps at higher resolutions.
it seems to be bound to the size of the playable viewport since i can resize to make it smaller to make the game playable again or make it larger to fit a modern resolution but it causes to be unplayable.

I've used dxwrapper,dgvoodoo and many other things

heres a video of it in action https://www.youtube.com/watch?v=j0UYJCSgN9M

@elishacloud
Copy link
Owner

I have never played this game but I picked it up from Steam. This game draws most of the screen using GDI, however the large map is drawn using ddraw. This mix of ddraw and GDI in the same screen is likely why most of the other wrappers don't work. SWAT 2 only uses a few ddraw features, mainly Blt. The performance issue seems to be some delay in the Blt calls. I tried sending the DDBLT_ASYNC flag to see if that would speed up the Blt's but it had no effect.

Next I tried using dd7to9 to convert ddraw into Direct3D9. That seemed to solve the performance issue, as expected. However, Direct3D9 does not play nice with GDI so the GDI parts of the screen simply turned black.

I tried using several other wrappers, such as dgVoodoo2, DDrawCompat and cnc-ddraw. Most of them just crashed. I was able to get older versions of DDrawCompat working, sort of. At least they did not crash. However, the map was not displayed at all.

So I turned to the next solution. I used the dd7to9 code, but output this to GDI. I had to hard code certain coordinates, and there are still minor glitches, but it seemed to work. You need to set the compatibility settings on the game to use Windows XP (Service Pack 2) and 16-bit Reduced color mode.

Download patch: dxwrapper.zip

image

@Volcanotron
Copy link
Author

dxwrapper-swat.log

your new fix doesn't seem to want to work on my end, it crashes when loading the mission. tried on both gog and steam versions.
I really appreciate the help

@elishacloud
Copy link
Owner

It looks like it is failing when trying to create the device context, but I am not sure why. I added some extra logging to help isolate the issue. Please try the build below and send me the log file.

Download patch: dxwrapper.zip

@Volcanotron
Copy link
Author

dxwrapper-swat.log
heres the new log

@elishacloud
Copy link
Owner

OK, I believe I see what the issue is. It will take longer for a generic fix, but this one should work for now.

Download patch: dxwrapper.zip

@Volcanotron
Copy link
Author

Untitled
seems to be working now
dxwrapper-swat.log
and heres the new log for it. the gog version seems to load into the level faster than the steam version

@elishacloud
Copy link
Owner

elishacloud commented Nov 2, 2019

@Volcanotron, here is my first attempt at a generic fix for one of the issues. Can you test this and let me know if it works for you?

Download patch: dxwrapper.zip

@Volcanotron
Copy link
Author

dxwrapper-swat.log
yep seems to working champ

@elishacloud
Copy link
Owner

Thanks @Volcanotron! Making the other part of this fix generic will take a bit longer, however I can test the rest of the fixes myself. This fix required help from you since I could not reproduce this issue.

@elishacloud
Copy link
Owner

Closing. If there is still an issue you can re-open.

@adamscoble
Copy link

Hey! Sorry to resurrect such an old thread. I came across this trying to get SWAT 2 to work on my PC. The fix you posted on Oct 28, 2019 seems to work great, but I have to drop my resolution to 1920x1080. If I play at 2560x1440, it crashes as soon as it tries to open the game. I can obviously live with the lower resolution if I have to, but I wanted to double check I'm not missing something! (Unfortunately the latest release of dxwrapper doesn't seem to fix the game.) Thanks very much! (It also seems to be running at a reasonably low FPS soon, but I'm not sure if that's just how the game is or not, hehe.)

@mirh
Copy link

mirh commented Jun 17, 2021

@elishacloud
Copy link
Owner

@adamscoble, if you are not already, try using the latest released build from here. Just extract the dxwrapper.dll and ddraw.dll files from the release and replace the old files. Also, make sure you have Dd7to9 and DdrawWriteToGDI options enabled in the ini file and set DdrawOverrideBitMode = 16. If you still have issues after that then send me your log file.

@mirh, this game does not use Direct3D so it should not have any issues with 4k. But it could be a bug in the game also.

@adamscoble
Copy link

adamscoble commented Jun 18, 2021

@elishacloud Thanks for the reply!

So downloading the latest version and changing just the settings you mentioned crashes when I try to start a campaign (when a video plays). Setting the .exe to run in Windows XP (Service Pack 2) compatibility mode results in:

2560x1440:
Crash when attempting to start the actual mission.
dxwrapper-swat-2560x1440.log

1920x1080
Very long load times (might not be able to do anything about this of course)
A blue screen in the actual gameplay area (which is I believe one of the original problems of the thread)
However weirdly it has stopped going through to gameplay now and is crashing the same way that 1440p did.
dxwrapper-swat-1920x1080.log
dxwrapper-swat-1920x1080-crash.log

1920x1440 (+ 16 bit reduced colour mode)
It actually started loading the gameplay, but crashed after a short while.
dxwrapper-swat-1920x1440.log

1920x1080 (ExcludeProcess = MapConstructor.exe)
I noticed this property was different from the earlier version in this thread, so I tried that and still saw a crash after loading but thought maybe the log was also useful.
dxwrapper-swat-1920x1080-exclude-map-constructor.log

Possibly unfixable
Cutscenes play in widescreen when the resolution is in widescreen (fill the window), it'd be great if they could play in 4:3 but I'm already incredibly thankful for your work! Haha.

@adamscoble
Copy link

adamscoble commented Jun 22, 2021

@elishacloud Sorry for the double message! Just confirming the above is what you meant by logs? (And if they're useful at all.) Absolutely zero pressure, just wanted to double check!

@elishacloud
Copy link
Owner

elishacloud commented Jul 1, 2021

Sorry for the delay in responding. I took at look at your logs and I believe the issue is the following items:

18840 17:12:35.384 m_IDirectDrawSurfaceX::CopySurface Error: not supported for specified source and destination formats! D3DFMT_X8R8G8B8-->D3DFMT_R5G6B5
13564 17:12:41.631 m_IDirectDrawSurfaceX::CreateDCSurface Error: failed to create compatible DC!

Neither of these should be happening with this game. I will need to add more logging into the module to figure out why that is happening. I will give you an update when I have time to create the additional logging.

@adamscoble
Copy link

That's great, thanks very much @elishacloud!

@elishacloud elishacloud reopened this Jul 1, 2021
@sbrohl3
Copy link

sbrohl3 commented Jul 9, 2021

Started playing this game after so long, and just wanted to say thanks for the up-to-date fixes! Dropping the resolution to 1920x1080 and installing your dxwrapper fix works!

The only bug keeping me from playing now is on "Riot in the Valley". The game attempts to load resources but then crashes to the desktop with a weird message saying something about the M40A1 sniper rifle being used by the United States Marine Corps.
Has anyone else seen this?

error

@adamscoble
Copy link

Hey @elishacloud! Just checking in to see if any recent releases address this or if you haven't had time to get to it? The latter is completely understandable, just making sure I didn't miss it!

@elishacloud
Copy link
Owner

elishacloud commented Oct 3, 2023

This issue is resolved with the latest release. Just enable Dd7to9. You should not need any other setting enabled.

Edit: this game only works on Windows 10 and older. Windows 11 causes this game to crash.

@elishacloud
Copy link
Owner

To get this game working in Windows 11 you can:

  1. Use dxwrapper with Dd7to9 enabled.
  2. Rename the "movies" directly or disable movies. The Movie codex causes a crash on Windows 11.

@mirh
Copy link

mirh commented Dec 12, 2023

Is replacing the movies also good enough?
(also.. maybe this is just autosuggestion, but could the issue have anything to do with the forced windowed optimizations?)

@elishacloud
Copy link
Owner

Presumably replacing the movies with new movies with the same file name encoded with a different AVI codex would work, though I did not test it.

The issue is a Windows memory error and has to do with memory management on Windows 11. Also, SWAT 2 only supports windowed mode, AFAIK. I don't think any kind of optimizations would help here.

@mirh
Copy link

mirh commented Dec 13, 2023

The optimizations kick in automatically AFAIK, and W11 specifically enrolled windowed apps.
But anyhow, if this isn't graphics-related.. I would have guessed that microsoft has a shim for every possible quirk of MM? Or is this specific to VBS/HVCI?

@elishacloud
Copy link
Owner

elishacloud commented Dec 13, 2023

I would have guessed that microsoft has a shim for every possible quirk of MM?

Yes, I tried a number of shims and could not find one that solves this. I do know that at least one of the memory shims (HeapEmulation) is broken on Windows 11. I searched and could not find anyone else who found a shim that solves this issue. Anyways, I did not want to spend anymore time on this because I have lots of other things to do.

Or is this specific to VBS/HVCI?

It could be. I did try and disable all the memory protection I could from the device Exploit Protection page and none of them helps. Anyways I had VBS enabled on Windows 10 without an issue. This issue is specific to Windows 11.

Edit: corrected.

@mirh
Copy link

mirh commented Dec 15, 2023

I see (even though I seemed to understand W10 was still good).

@elishacloud
Copy link
Owner

Yes, I think you are right that the HeapEmulation issue is only on Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants