crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
880 stars 78 forks source link

Star Wars: Republic Commando crash #66

Closed NikoofDeath closed 6 years ago

NikoofDeath commented 6 years ago

Using d3d8to9 with Republic Commando causes a crash after a brief white screen.

d3d8.log gives me this:

Redirecting 'Direct3DCreate8(220)' ...
> Passing on to 'Direct3DCreate9':
Redirecting 'IDirect3D8::CreateDevice(0270E010, 0, 1, 000D0F4E, 32, 005FF3B8, 005FF510)' ...
Redirecting 'Direct3DCreate8(220)' ...
> Passing on to 'Direct3DCreate9':
Redirecting 'Direct3DCreate8(220)' ...
> Passing on to 'Direct3DCreate9':
Redirecting 'IDirect3D8::CreateDevice(0270E010, 0, 1, 00120DE4, 70, 0D21FF98, 0D21FF94)' ...

I tried on a fresh install, as I was initially using the Republic Commando Graphics Fix, but this did not change anything. I also disabled driver-level graphics settings, as well as RTSS.

CookiePLMonster commented 6 years ago

Note to self (and the others): game seems to be available on Steam.

http://store.steampowered.com/app/6000/STAR_WARS_Republic_Commando/

elishacloud commented 6 years ago

I am using the GOG version. It is on sale this week for only $3.39. I have done a number of fixes (here and here) on Star Wars Republic Commando. It works great for me.

Can you tell me the following:

  1. What version of the game are you using?
  2. What operating system are you using?
  3. Is it 32bit or 64bit?
  4. What video card do you have?
  5. Also tell me at what point the game crashes. What do you do to cause the crash?
metallicafan212 commented 6 years ago

Did you disable FSAA? It crashes the game on startup if it's enabled. To disable it in the ini, go to "Star Wars Republic Commando\GameData\Save", open system.ini in a text editor, under [WinDrv.WindowsClient] there will be a line called FSAA= with a value. If it's not 0, set it to 0. image

NikoofDeath commented 6 years ago

Disabling FSAA fixed it, thanks!

elishacloud commented 6 years ago

Interesting. I can reproduce the crash now. I wonder if this is the same thing that is talked about in #63.

metallicafan212 commented 6 years ago

Yeah, I tried fixing it in the source, but it seems that if MultiSampleType isn't D3DMULTISAMPLE_NONE or D3DMULTISAMPLE_NONMASKABLE, it'll crash. I even was going to make an issue about this until this showed up.

metallicafan212 commented 6 years ago

I'm going to open an new issue with the information I know.

elishacloud commented 6 years ago

It looks like the issue is that the D3DPRESENTFLAG_LOCKABLE_BACKBUFFER flag is set which is not supported in Direct3D9 when using multisampling. See here

Once I remove this flag everything works fine. I also noticed that multisampling is not fully supported in d3d8to9 yet. I have a pull request almost ready that will fully fix this issue. I just want to test it on a few more games.

BTW: I should mention that the crash is a bug in the game. The game never checks the return value of the CreateDevice function and just assumes it is successful. Then it starts to use the returned pointer which is not valid.

elishacloud commented 6 years ago

Attached is a fixed dll for this. This will allow you to use anti-aliasing: d3d8.zip