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

Hack to allow Capitalism2/CapLab's custom double-buffer system to draw. #91

Closed
wants to merge 1 commit into from

Conversation

Kevok93
Copy link

@Kevok93 Kevok93 commented May 5, 2021

Caplab seems to use some non-standard double-buffering system, wherein the dev creates three surfaces, one presentation surface and two working surfaces (call them A and B). The two working surfaces are Attached together, and the game will blit into surface B, then when the frame is done blit A into the presentation surface. It seems that this system relies on some arcane property of Surface Attachments to copy or rotate from B into A, but afaict only the official windows ddraw.dll actually works this way, and this has been a complaint on Wine for years. When debugging the issue, I was able to get the rendering system working by making AddAttachSurface link both surfaces to the same backend buffer, thus """"fixing"""" the bug, but I can't fathom all the potential damage this would cause, so I'm leaving this here with a massive asterisk and a request to maybe find a better way to do this, or at least gate it behind a config option.

…o draw.

Do not accept as is, please gate this in a config option
@FunkyFr3sh
Copy link
Owner

Could you upload a log file? Would like to have a look into it.

You can use the DebugLog build in visual studio or this one here: #44

@Kevok93
Copy link
Author

Kevok93 commented May 5, 2021

In this example, 020a9290 is the rendering surface, 020ad9d8 is the surface that (correctly) gets blitted to render, and 020ae378 is the surface that gets all the actual drawing done on, but doesn't actually get read from (With the exception of the cursor rect, which does actually bleed through somehow.)

cnc-ddraw.log.gz

@FunkyFr3sh
Copy link
Owner

Thanks! I pushed some changes, could you try if it works now?

ddraw.zip

@Kevok93
Copy link
Author

Kevok93 commented May 5, 2021

This one works exactly as it should

@FunkyFr3sh
Copy link
Owner

nice 👍

I guess I can close this now, thanks for the log/research!

@FunkyFr3sh FunkyFr3sh closed this May 5, 2021
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

Successfully merging this pull request may close these issues.

2 participants