Bugs in Carnivores 1, 2 and Ice Age
raptor264 opened this issue · comments
It mostly presents errors in the landscape (terrain).
DDrawCompat-CARN2.log
DDrawCompat-HuntD3D Carn1.log
DDrawCompat-IceAge.log
DDrawCompat-v_d3d.ren Carn2.log
DDrawCompat-v_d3d.ren CarnIceAge.log
I tested the first game briefly but didn't notice any graphical issues. Could you take a screenshot to show what it looks like?
What is your GPU model? Is it an integrated GPU?
How do I get that information? Doesn't it appear in the logs?
I can only tell from the logs that it's some kind of AMD GPU.
In the Start menu, type dxdiag and press enter. Go to the Display tab and either take a screenshot of it, or press the "Save All Information..." button and upload the resulting text file.
here is the screenshot.
That's very strange. Does it appear correctly if you don't use DDrawCompat?
Does the black pattern move as you move your character, or does it stay in the same location always?
Also, what are your in-game videos settings? Have you tried turning off fog and shadows, or changing the other video settings to see if it fixes the problem?
Are there any mods or patches installed, besides the "Carnivores Direct3D patch (beta 1.5)"?
I tested 3 different GPUs (AMD, Intel and NVIDIA) and none of them have this issue. Yours seems to be an integrated AMD GPU. Unfortunately I can only test a dedicated one at the moment.
But I was finally able to reproduce it by using D3D9On12 instead of a native driver. With that, it can also be reproduced without using DDrawCompat, so at least it's not a bug in DDrawCompat itself. It must be some driver issue. Maybe I'll be able to figure it out now that I can reproduce it.
Ok, I'll be attentive to a possible fix.
I found the issue, at least as far as D3D9On12 is concerned, but since the symptoms are the same, I assume it's the same issue as with your GPU.
The game uses texture sizes of 64x64, 128x128 and 256x256. The problem with D3D9on12 is that when a texture of size 64x64 is locked for CPU access, the surface pitch becomes the same as for textures of size 128x128. This makes the game not fill the texture with any data, so it remains pitch black.
It's simple enough to fix in DDrawCompat, since it already has optimizations to replace the usual surface lock mechanism by copying the surface between a system memory surface and the video memory surface. In this case, the game will see the pitch of the system memory surface, which always matches the expected pitch, irrespective of GPU drivers.
This optimization was so far not enabled for textures, as I thought it was unnecessary, and it might actually impair performance in some cases. But I enabled it for now in this patch:
ddraw.zip (diff.txt compared to v0.5.2)
Now on to the bad news. This exposes another bug in the game. When you enter a hunt, it attempts to measure some "texture transfer speed", which is visible in carnivor.log. But with the above optimization enabled, this makes it look like texture transfer is almost instantaneous on fast CPUs, because it delays the actual upload of the texture data from system memory to video memory until the texture is actually referenced by a rendered triangle. This results in the texture transfer speed measurement pretty reliably crashing with an "integer division by zero" exception, as the game uses the timeGetTime Windows API function to measure the elapsed time in milliseconds, which will end up being zero.
There are at least two ways to get around the above crash. One is to use the Microsoft Application Compatibility Toolkit to enable the IgnoreException shim, with its command line parameter set to INT_DIVIDE_BY_ZERO:1
. Alternatively, the measurement could be patched out from the game executable. Let me know if you need more help with either method.
For the first one, you'll find some helpful instructions here: #313 (comment)
Some obvious differences: the program name should be "Carnivores" (or whatever you like), the executable should be HuntD3D.exe, and when selecting the IgnoreException shim, you should also click the Parameters button to enter the command line I mentioned earlier: INT_DIVIDE_BY_ZERO:1
.
I did it. That solved the graphical problem in Carnivores 1 (it doesn't works in Carnivores 2 and Ice age). thanks a lot! However now the problem is in the sound. does not start. It remains bugged in the sound of the menu and I am using Windows 95 compatibility and before it did not give me that problem in the sound in Carnivores 1.
![image](https://private-user-images.githubusercontent.com/153935043/335838849-5e596dbf-68f4-45cc-90ff-0a77c2e0e7e8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5MDkwMDEsIm5iZiI6MTcyNDkwODcwMSwicGF0aCI6Ii8xNTM5MzUwNDMvMzM1ODM4ODQ5LTVlNTk2ZGJmLTY4ZjQtNDVjYy05MGZmLTBhNzdjMmUwZTdlOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyOVQwNTE4MjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZTkxYzM2YzRjYTQzYTQxNDIzYTMwNWFkNmJhZDMwZDA0MjA4YzU1NTM1MzJkZTMwZjE4YWRjYmMyMTUyZDVjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.SJe0gmukd-aw9zXPo7A4cuTIjO20oLWu_-OoosR2mI8)
it's ok?
I don't know about the audio issues, it never worked correctly for me, even when using compatibility modes without DDrawCompat. Using Windows 98 compatibility mode, or just enabling the IgnoreScheduler shim in Compatibility Administrator fixes the menu sounds, but as soon as I enter a hunt, the last few milliseconds that were playing in the menu become looped until exiting to the menu again and pressing some button there. I'm afraid I can't really help with audio issues. DDrawCompat doesn't have any audio related fixes either.
It's possible that creating that compatibility setting in Compatibility Administrator somehow overrides Win95 compatibility mode, but it doesn't happen for me. You can try to enable it there too, or just use the IgnoreScheduler shim. If you use Win95 or Win98 compatibility mode, you'll have to set the IgnoreException parameter again, after deselecting it first and then selecting it again (otherwise the Parameters button will be greyed out).
okay. thanks a lot🙂. You are doing an amazing job.
it doesn't works in Carnivores 2 and Ice age
So what is the issue in those games? Please take a screenshot from each.
I'll see about that... another very useful thing I need is to know how to use the compatibility manager to make an application detect my operating system as 32-bit to allow me to install a plugin? I'm sorry for talking to you from here for this but I can't find this information on the internet, I don't know any other way to contact you and I think you know a lot about the subject. Then I return to Carnivores.
I don't know, your question doesn't make much sense to me. 32-bit application run fine on any 64-bit version of Windows. Only 16-bit applications don't, maybe you meant that? What plugin for what application? What is the actual error message?
Useful reading: https://xyproblem.info/
It doesn't matter. It was another separate application.
Going back to Carnivores 1 first, the 3D was solved but even though it is supposed to have nothing to do with audio, although it fixed the 3D graphics, the sound broke it into an infinite loop that it didn't do before. so it must have to do with ddraw in some way.
Are you saying that with DDrawCompat v0.5.2 you have working audio, and the sound loop only happens with the above patched version of DDrawCompat?
The ground texture issue was fixed in v0.5.3, along with a few other issues I encountered, e.g. ColorKeyMethod=alphatest not working correctly for some of the foliage, as well as some of the textures were using the wrong texture filter.