XaiJu
LukeUsher
LukeUsher

patreon


Cxbx-Reloaded Progress Report (Dec 2020)

Progress Report (December 2020)

~ It's late again, I'm sorry. Between lockdown fatigue and being a new parent, posting this kind of slipped my mind. Strelok wrote this up way back on January 10th, so this report covers progress made in December 2020;

Strelok here with yet another report and Ho Ho Ho… a bit too late for this I guess? Late or not, a gift is a gift, and this is how I see the progress we’ve made in the last month of the year. Compatibility wise we had one of those months: 11 new playable games. For the sake of curiosity, I’ve also made a chart covering the numbers of the entire year, comparing our progress month by month (check below and prepare to be surprised). Outside of that, as always, we had improvements related to sound, performance, and rendering, let’s take a peek at our yearly numbers before going into details:


General Improvements

Another Round of DSound's Stream fixes [PR #2039]

After going through a series of hardware sampling tests with the DirectSoundStream class, both hardware and this pull request's log are exactly the same. With test case, Burnout 3, mentioned by @CookiePLMonster gives me a theory of what's happening inside the stream's internal flush function. I had to rerun the extended sampling test to fix the final expectation result from cxbxr's end.

Refactor D3D device creation [PR #2059]

This PR lays the foundation for migration to Direct3D9Ex by cleaning up and improving the correctness of D3D device creation:

● "Synchronization" via volatile bool variables has been completely removed - either by making it useless or by replacing it with an event.

● EmuCreateDeviceProxy has been removed - now the entire process of device creation is done inline, with the exception of a call to CreateDevice - as it must be done on a window message thread (see the link below), it is now sent to an appropriate thread (in a blocking manner) via a newly added RunOnWndMsgThread function.

On threading considerations when creating, releasing or resetting D3D devices:

https://docs.microsoft.com/en-us/windows/win32/direct3d9/multithreading-issues

No changes are expected, but since it makes D3D9 usage more correct anything can happen - performance improvements are nearly impossible, but it may fix e.g. some lockups on startup.

Fix incorrect flags in NtDuplicateObject [PR #2060]

The problem was that we were passing an access mask of zero to NtDuplicateObject, which meant that the duplicated handle would have no access rights at all, which explains why all subsequent file access operations on it would inevitably fail. With this change, both Fatal Frame 1 and 2 successfully reach in-game for the first time!

Fix Audio Overall Volume Not Included From Input Sets of Volume [PR #2067]

Since @CookiePLMonster noticed an issue with The Warrior's background music being missing from the main menu, after debugging and found the cause of the issue. Certain titles do input specific mixbins' volume, however, we exclude the other volumes for maximum volume result. With this fix, The Warrior's background music is back to audible.

Update Wine Usage [PR #2069]

Only two changes are relative to Wine's end.

● Move Wine relative into its own source file.

● Suppress admin privilege popup warning under Wine environment.

○ Plus remove the toggle option since it is not used in Wine environment.

Move to Direct3D 9Ex [PR #2104]

For a full list of improvements see:

https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements

For us, the most important aspect is no more device loss, which never existed on Xbox. This allows exclusive fullscreen to work properly. In the future might also potentially allow for resizing the backbuffer at runtime

Complete refactor of D3D8 LTCG patches calling conventions [PR #2108]

This PR modifies all LTCG patches for the correctness of the implementation. If any of our patches used incorrect calling conventions, it has not been changed, I only fixed the current code to properly implement the calling conventions we think are needed.

To put it simply, both styles of LTCG patches we've used have been wrong:

● Old style patches (without __declspec(naked)) could not ensure that the registers holding parameters were kept intact by the time we attempted to get their value. This could potentially lead to register poisoning inside the patch function, especially in Debug builds.

● New style patches (with __declspec(naked)) did not ensure that the persistent registers (in x86 calling convention, those are ESI, EDI, EBP, and EBX) were correctly preserved. This could potentially lead to register poisoning outside the patch function, possibly resulting in weird, hard-to debug "random" crashes in the game code.

To fix this, I introduced LTCG_PROLOGUE and LTCG_EPILOGUE macros which set up stack frames for naked functions and preserve persistent registers, then I went through every LTCG patch and adapted them to use a proper calling convention.

This PR can improve numerous LTCG games in unexpected ways, but most notably it should improve consistency between Debug and Release builds as now we have complete control over custom calling conventions.

Initialize vertex shader outputs to vertex shader attribute values [PR #2109]

Initialize vertex shader outputs to the current value of the vertex attributes, which by the sounds of it fixes some Halo demo graphics.

Remove debug console [PR #2110]

Nobody used it and it doesn't seem useful. If it's ever needed, it should be reimplemented with imgui or something like that.

Notable Game Improvements

Just like we did last month, I’ll cover only the new playable games… with 2 exceptions (being Fatal Frame 1 and 2).

Conspiracy: Weapons of Mass Destruction [PLAYABLE]

https://www.youtube.com/watch?v=12bncJkSvRo

The last game-breaking issue fixed, now you finish it properly. For anyone curious: the issue was that the game used to crash randomly after some seconds into any level.

Angelic Concert [PLAYABLE]

https://www.youtube.com/watch?v=GEX7VDWhEMo

Progressed from only booting to fully playable, including the music/sound working properly (wouldn’t be playable otherwise, it’s mostly a rhythm game).

Gauntlet Dark Legacy [PLAYABLE]

https://www.youtube.com/watch?v=xFZwrVqvVNg

With some of the rendering improvements, Gauntlet is back in-game and it’s playable for the first time. Please note that the level selection area (the tower) is much more demanding than any actual level in the game, so performance there is much worse than when you’re actually playing a level.

Rocky Legends [PLAYABLE]

From booting to fully playable, the game runs nicely even on my potato hardware (yeap, it’s a i3 @ 3.1 GHz…).

Shattered Union [PLAYABLE]

Probably playable for some time, only had time to finish the game this month (and I only had the time because performance improved enough to be comfortable to play). All game modes are working properly.

XGRA: Extreme G Racing Association [PLAYABLE]

https://www.youtube.com/watch?v=hXkacbByBOE

We had it in-game recently, but all the rendering wasn’t visible. With the latest fixes, you can now play it with good performance and almost no visual issues (even on the levels with a ton of visual effects covering the screen).

Pinball Hall of Fame [PLAYABLE]

https://www.youtube.com/watch?v=E0BSh29T7zk

In-game for some time, just recently got its hanging issues solved, all tables are playable.

Dark Summit [PLAYABLE]

https://www.youtube.com/watch?v=tyOV1YL-uWA

Another game we had in-game for some time, I took advantage of the latest performance improvements and gave it a much longer (some hours… ok, 4 days…) testing section to check its compatibility.

The Great Escape [PLAYABLE]

Verified as fully playable.

Bloodrayne [PLAYABLE]

https://www.youtube.com/watch?v=OEDyCxcUgBo

In-game for the longest time, but now fully playable. The last issue that was fixed for this was a random hang that you had after playing for more than 40 minutes.

Kill.Switch [PLAYABLE]

https://www.youtube.com/watch?v=yhQWUOa4Zr0

Another game that was plagued by random crashes, now fully playable with very good performance.

Fatal Frame [IN-GAME]

https://www.youtube.com/watch?v=Ji21jGZSSiI

Reaching in-game for the first time, but still sadly not playable (as you can notice on the footage above, it’s impossible to hurt ghosts for now).

Fatal Frame 2 [IN-GAME]

https://www.youtube.com/watch?v=HVhGEksON2w

Also reaching in-game for the first time, also has the same issue as the first game, can’t hurt ghosts so you can’t progress much).

Final Words

Taking a look here you can already notice some other rendering improvements incoming + some compatibility improvements as well (some already merged), so next month you can also expect more playable games and fewer visual issues on the games that already work. This year was hard on everyone but I hope at least some of these results can bring some joy for all the people supporting us, being with code, via Patreon, reporting results from tests, and even opinions. THANK YOU ALL AND HAVE A GREAT END OF THE YEAR!

PS: don’t forget to check the updated compatibility information in our new site ;) https://cxbx-reloaded.co.uk/compatibility

Comments

Keep it up my man. Slow and steady progress is all what matters, so don't go spinning too many plates at once!

Michael Harley

Congrats on being a new parent - It's the best experience in the world. Also, thanks for all the hard work you put into CXBX-R!

The Old Thaye


More Creators