FunkyFr3sh / cnc-ddraw

GDI, OpenGL and Direct3D 9 re-implementation of the DirectDraw API for classic 2D games for better compatibility with Windows 2000, XP, Vista, 7, 8, 10, 11, Wine (Linux/macOS/Android) and Virtual Machines
https://discord.gg/afWXJNDDF5
MIT License
2.21k stars 142 forks source link

Grand Theft Auto (GTA1) crashes on start #96

Closed universal963 closed 3 years ago

universal963 commented 3 years ago

Tested with latest release (4.4.0.0) of cnc-ddraw with the ini attached in the zip. It launched, but after a very brief black screen, it crashed and exited. Here are the log file and the dmp file created by the file in #44. cnc-ddraw.zip

FunkyFr3sh commented 3 years ago

The game has all kind of bugs, I have to do some research to find out which bugs are game bugs and which ones are maybe caused by cnc-ddraw before I can actually fix it.

If you change the resolution then the game will refuse to start the gameplay and you have to reinstall... I just switched to windowed mode with alt+enter and hit the X button in the window, this way it wouldn't save the resolution change and it started without having to re-install

Edit: included a .bat file to solve the problem with the game only starting once

Download: -removed download link- The game is now supported with the latest release: https://github.com/CnCNet/cnc-ddraw/releases

universal963 commented 3 years ago

Thank you, but with the cnc-ddraw attached above, it is still not working for me, keeping the same problem, even after reinstalling twice, and switching to windowed mode by editing ddraw.ini : ( Anyway, thank you in advance for your hard work.

FunkyFr3sh commented 3 years ago

How did you install the game?

I used this: Name: GTAINSTALLER.exe Size: 344338033 bytes (328 MiB) SHA1: 762E03126A226E92E2F6827CA0750489595B52B2

FunkyFr3sh commented 3 years ago

Just tested again on a fresh windows 10 20h1 virtual machine with no runtimes or anything installed on it and it worked fine there too.

I only had a popup about missing directplay but windows installed it automatically. You could try to download dplayx.dll here and place it into the same folder as cnc-ddraw: https://github.com/CnCNet/dummy-dplayx/releases This way we can find out if your problem is related to directplay or something else.

universal963 commented 3 years ago

I used the cd image version found here: https://archive.org/details/GrandTheftAuto_201903 What you've said is freeware version I think, which seems to have even more bugs than original cd one, and thus I don't like to play that version. As for directplay, I have installed it already and manually in control panel. Anyway, I will try the freeware version with your fix later, and see if it still crashes.

universal963 commented 3 years ago

I found it quite strange now. Neither cd version nor freeware version on my real Win10 machine worked, but on my virtual Win10 machine both version worked. I am kind of confused by this weird behavior. This is my real Win10 machine spec: CPU AMD FX(tm)-8300 Eight-Core Processor 3.30 GHz Memory 16.0 GB OS Windows 10 Pro 21H1 GPU AMD R9 370 4G Driver version is 27.20.1034.6 shown in Device Manager. The virtual Win10 machine one: OS Windows 10 Pro 20H2 VMware tools are used in the virtual machine. Hope these will help you find out the problem.

FunkyFr3sh commented 3 years ago

I just installed the cd version and checked your crash .dmp against it, the game is crashing because of a wndproc hook.

The bug isn't a cnc-ddraw bug, but I added a patch into cnc-ddraw to fix it anyways

-removed download link- The game is now supported with the latest release: https://github.com/CnCNet/cnc-ddraw/releases

``

universal963 commented 3 years ago

Thank you, both versions successfully launch now. Though it is far from really playable as it is very lagging during the gameplay. Hope for your later fixes! : )

Edit: My bad, after setting the singlecpu to false it seems to work very nice. Still hope for your later improvement!

FunkyFr3sh commented 3 years ago

You can try to change the renderer to direct3d9 or opengl, I had it set to gdi for testing and forgot to revert it. Probably not too much more I can do to improve it

universal963 commented 3 years ago

Tried the direct3d9 and opengl one, it is working with some tearing, but it can be fixed by setting vsync to true. Ok then, I wonder some little questions. Is it possible to fix the lightning fast animation in the main menu? This problem seems only appears in cd version.
And is it possible to set the resolution to 32 bit color? It is possible to set this when not using cnc-ddraw, but when using it, only 16 bit color resolution can be chosen. when using: mgl_fullscreen_application-2021-06-02-01_33_26 when not using: image

FunkyFr3sh commented 3 years ago

Looks like the freeware version got some bugs fixed but comes with a new bug as well, maybe it's better to just patch that one bug in the freeware version and use that one rather than the cd version?

About 32bit color: yeah, that's not supported right now. Is there actually a improvement in visual quality between 16 and 32bit? I would have to see some screenshots as comparision, if it's better I could add support for it. But I'm having my doubts about that...

elishacloud commented 3 years ago

Presumably, one of the advantages of using 32bit color is performance. There is a performance hit in Windows when it has to convert a 16bit surface to a 32bit display. It is now emulated in Windows 8 and newer. Though I don't know how much difference that makes on newer computers. Maybe only if you are running higher resolution like 4k, which some ddraw games can support.

Also, I think there are some ddraw games that only support 32bit color. In the case of GTA1 it may be ok, since it supports both 32bit and 16bit color. But for other games it might prevent them from running altogether.

FunkyFr3sh commented 3 years ago

Presumably, one of the advantages of using 32bit color is performance. There is a performance hit in Windows when it has to convert a 16bit surface to a 32bit display. It is now emulated in Windows 8 and newer. Though I don't know how much difference that makes on newer computers. Maybe only if you are running higher resolution like 4k, which some ddraw games can support.

Yeah that's normally the case, but with cnc-ddraw it's always 32bit and the color conversion is done with a shader so it would only get slower in this case. I don't really know what happens when you choose 32bit in this game, in the worst case the visual quality will be the same but the performance will be worse if the game does the color conversion on the CPU

Also, I think there are some ddraw games that only support 32bit color. In the case of GTA1 it may be ok, since it supports both 32bit and 16bit color. But for other games it might prevent them from running altogether.

Yeah that might be true, haven't seen one yet though

FunkyFr3sh commented 3 years ago

I think I just fixed the bug that was causing the freeware version to crash on the second start:

-removed- Check link below for the latest version

Edit: Just played a bit and the game is lagging randomly, will have to do some more patches i guess :(

universal963 commented 3 years ago

I am not very sensitive to the visual quality, so I don't see much difference between 16 bit and 32 bit mode in GTA1. Anyway, these are the cnc-ddraw ones: mgl_fullscreen_application-2021-06-02-14_05_04 mgl_fullscreen_application-2021-06-02-14_19_39 These are screenshots taken from my Winxp virtual machine without cnc-ddraw (since it is really not playable in Win10 without any wrapper, and my screen was flickering when switched to 32 bit mode in Win10, and the screenshots are always black) 1 2 I have not tested the freeware version though, these are all the cd version ones.

universal963 commented 3 years ago

Tried on the freeware version with the latest cnc-ddraw above, I have not experienced any lagging yet, at least I don't think I encountered any lagging. Maybe I need to do more testing.

FunkyFr3sh commented 3 years ago

Yeah I think it's both the same, the 32bit is probably just 16bit converted to 32bit so it might not be a good idea to use it. I made the 32bit now working with all renderers on cnc-ddraw anyways.

The lag only happened on a virtual machine, it does work well on my win 10 (with singlecpu=false) and also works well on my XP too, so maybe it's fine now.

I removed all the workarounds now and got all fixes pushed to github, does this one here still work for you? -removed download link- The game is now supported with the latest release: https://github.com/CnCNet/cnc-ddraw/releases

I can only test with the freeware version BTW, CD versions claims that I don't have the CD in my drive

universal963 commented 3 years ago

The CD version is working well on my Win10 real machine using latest cnc-ddraw above. It launched with no problem and no lagging was seen during my test. BTW, CD version of GTA only supports one CD drive with the first letter. For example, if you have D, E, F CD drives, only D drive will be recognized. Kinda like C&C DOS version I think.

FunkyFr3sh commented 3 years ago

Cool, thanks for testing! Will try to fix my CD version and do some tests there too just to be sure

universal963 commented 3 years ago

Just tested the expansion packs of GTA1, Grand Theft Auto: 1969 and Grand Theft Auto: 1961, both worked fine on my machine after copying the preset of GTA1 and editing the name to the main exe name of the expansion packs. Maybe you can just add the preset to the ddraw.ini. The main exe name of 1969 is gta_uk.exe, and the 1961 one is Gta_61.exe.

Edit: Sorry, I just found I have mistaken the name of expansion packs, they should be Grand Theft Auto: London 1969 and Grand Theft Auto: London 1961.

universal963 commented 3 years ago

I don't know if it is legal to share GTA London 1969 here, since only GTA1 is released before as freeware. But since London 1969 is actually abandonware now, I try to give the link where I found the game: https://www.myabandonware.com/game/grand-theft-auto-mission-pack-1-london-1969-7ps If anyone think it is illegal, tell me here and I will remove the link at once. As for London 1961, it is free, but it is just an addon to 1969 and thus depends upon 1969 to work. Link is here: https://web.archive.org/web/20200604172153/http://www.rockstargames.com:80/gtalondon/ftp/Gta1961/Gtal1961.exe

universal963 commented 3 years ago

Sorry to bother you, I haven't found I have mistaken the name of expansion packs until now, they should be Grand Theft Auto: London 1969 and Grand Theft Auto: London 1961. I apologize for my oversight.

FunkyFr3sh commented 3 years ago

Fixed the name of the presets and just made a new release that supports GTA: https://github.com/CnCNet/cnc-ddraw/releases

I'm closing this issue here now, if you should find any more bugs then please let me know (Create a new issue then!)