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

[Dd7to9] Tonic Trouble #357

Open
RibShark opened this issue Mar 17, 2025 · 11 comments
Open

[Dd7to9] Tonic Trouble #357

RibShark opened this issue Mar 17, 2025 · 11 comments

Comments

@RibShark
Copy link

RibShark commented Mar 17, 2025

Tonic Trouble (which uses the same engine as Rayman 2) shows a black screen on launch with Dd7to9 enabled. In the log I get these errors:

12116 17:21:06.115 Creating interface m_IDirect3DVertexBuffer9::m_IDirect3DVertexBuffer9 (0B4801A0)
12116 17:21:06.127 m_IDirectDrawSurfaceX::SetSurfaceDesc2 Warning: lpSurface not fully Implemented.
12116 17:21:06.127 m_IDirectDrawSurfaceX::SetSurfaceDesc2 Error: flags not implemented 0xe
12116 17:21:06.158 m_IDirectDrawSurfaceX::Flip Error: surface is busy: 1 DC: 0 Blt: 0
12116 17:21:06.158 m_IDirectDrawX::CopyPrimarySurface Error: failed to copy primary render target!
12116 17:21:06.158 m_IDirectDrawX::PresentScene Error: failed to draw primary surface!
12116 17:21:06.158 m_IDirectDrawSurfaceX::PresentSurface Error: failed to present 2D scene!

Additionally, when running GXSetup.exe, the resolution is changed to 640x480; this doesn't happen with system ddraw or any other wrappers.

@elishacloud
Copy link
Owner

I added support for Width, Height and Pitch flags for SetSurfaceDesc(). However, I don't have the ability to test it right now. Hopefully this will solve at least some of the problems with this game.

@RibShark
Copy link
Author

Now the game crashes shortly after launching (still with just black); only errors/warnings in the logs are the expected

31072 18:51:01.550 m_IDirectDrawSurfaceX::SetSurfaceDesc2 Warning: lpSurface not fully Implemented.
31072 18:51:01.550 m_IDirectDrawSurfaceX::SetSurfaceDesc2 Warning: surfaceDesc flags being updated: 0xe

@elishacloud
Copy link
Owner

The crash could be related to another issue. What build number did you test in your first test?

@RibShark
Copy link
Author

In both tests I compiled from the latest available commit.

@elishacloud
Copy link
Owner

Just by chance, try enabling the DdrawEmulateLock option. This will help if games attempt to remember the surface address. Since it will change with dxwrapper, but may not change with the native ddraw.

@RibShark
Copy link
Author

RibShark commented Mar 17, 2025

Unfortunately it still seems to crash with DdrawEmulateLock = 1

@elishacloud
Copy link
Owner

Ok, if you can get me the full debug log I can take a look at it when I have some time.

@RibShark
Copy link
Author

RibShark commented Mar 17, 2025

I have found the issue; ddraw is reporting too many texture formats and overflowing a fixed-size buffer created by the game to store all enumerated formats. This is a common problem with games from this era; DxWnd, ddrawcompat and even Windows itself (DirectXTrimTextureFormats shim) have fixes for this, I think it would be a good idea to have one here too.

Only other problem I have seen so far is that the blue background behind text dialogue is invisible, making it very hard to read some text:

Image

This also happens on some PCs from the time too, but not all of them; DDrawCompat and dgVoodoo both fix the issue (though it was broken on one dgVoodoo build, dege claims it is undefined behaviour)

@RibShark RibShark changed the title [Dd7to9] Tonic Trouble Black Screen [Dd7to9] Tonic Trouble Mar 17, 2025
elishacloud added a commit that referenced this issue Mar 17, 2025
@elishacloud
Copy link
Owner

I have found the issue; ddraw is reporting too many texture formats and overflowing a fixed-size buffer created by the game to store all enumerated formats. This is a common problem with games from this era;

Oh, very good. Thanks for tracking this down. I added an option for DdrawLimitTextureFormats. Hopefully that will solve this issue.

Only other problem I have seen so far is that the blue background behind text dialogue is invisible, making it very hard to read some text:

Interesting. I will have to look at this later. It looks like it is caused by "out-of-range z-coordinates".

@RibShark
Copy link
Author

RibShark commented Mar 18, 2025

Oh, very good. Thanks for tracking this down. I added an option for DdrawLimitTextureFormats. Hopefully that will solve this issue.

Can confirm this fixes the issue! Thanks for adding this option so quickly.

@elishacloud
Copy link
Owner

Thanks for testing! I did not have any good way to test this as I have no games that crash like this.

As far as the "out-of-range z-coordinates", that requires a lot more work. I have to decode all the vertexes to find the z coordinates. dgVoodoo2 probably already does that. But dxwrapper just passes the vertexes to d3d9 as they are without decoding them.

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

2 participants