Cxbx-Reloaded Progress Report (January - February 2021)
Added 2021-03-30 15:30:22 +0000 UTCThat’s right, this is our first report covering 2 months at once. Depending on how much work is made that can be actually visible to most people, it’s probably for the best to cover it this way. Compatibility wise we kept our average from the last year (5 new playable games per month) and if performance was a concern in some games I’m also happy to announce that this improved a lot with some rendering optimizations.
General Improvements
Fixed booting games from write-protected drives [PR #2112]
This fixes a bug that abused SHCreateDirectoryEx to use the return value ERROR_ALREADY_EXISTS to check if the directory already exists. The device \Device\CdRom0is used for registering the XBE file path and will usually exist. We have switched to check this using std::filesystem instead. On write-protected drives SHCreateDirectoryEx was returning ERROR_WRITE_PROTECT which caused the device to not register, and would stop games from booting.
Note "write-protected drives" are not the same as file permissions - on Windows, read-only folder permissions are ignored.
Split D3DDevice_LoadVertexShader_0 into two OOVPAs [PR #2118]
XDK-5849 version of this LTCG function passes arguments in EAX and EDX.
Fixes World Racing 2 crashing in menus. I know it fixes more XDK-5849 games using this function (including Project Zero 2 aka Fatal Frame 2, issue being present only in the PAL version).
Ensure the xbox viewport is applied when Clear is called [PR #2117]
The xbox viewport was applied in UpdateNativeD3DResources instead of the SetViewport patch, so wouldn't be applied until a Draw call. Crash Tag Team Racing graphics would be blacked out whenever the rear view mirror appeared on the screen.
Reduce the amount of work done per draw [PR #2123]
Certain titles split geometry into many small sections, and do a huge number of draws per frame. These are some optimizations and tweaks to code that runs per-draw.
Significantly increases performance in Crash Nitro Kart… and many other games, here some comparisons I’ve made:
Avg: 13.817 - Min: 2 - Max: 30 Dungeons and Dragons Heroes [BEFORE]
Avg: 35.750 - Min: 4 - Max: 60 Dungeons and Dragons Heroes [AFTER]
Avg: 179.333 - Min: 91 - Max: 532 KOF Neowave [BEFORE]
Avg: 225.367 - Min: 78 - Max: 949 KOF Neowave [AFTER]
Avg: 55.650 - Min: 25 - Max: 75 Manhunt [BEFORE]
Avg: 91.550 - Min: 41 - Max: 113 Manhunt [AFTER]
Avg: 39.317 - Min: 34 - Max: 48 Metal Slug 5 [BEFORE]
Avg: 71.450 - Min: 56 - Max: 164 Metal Slug 5 [AFTER]
Avg: 703.183 - Min: 95 - Max: 1998 Psyvariar 2 [BEFORE]
Avg: 813.750 - Min: 114 - Max: 2169 Psyvariar 2 [AFTER]
Avg: 18.883 - Min: 9 - Max: 33 Gauntlet Dark Legacy [BEFORE]
Avg: 21.633 - Min: 12 - Max: 33 Gauntlet Dark Legacy [AFTER]
Avg: 155.283 - Min: 4 - Max: 1498 Sonic Heroes [BEFORE]
Avg: 186.133 - Min: 4 - Max: 1557 Sonic Heroes [AFTER]
Avg: 12.467 - Min: 8 - Max: 18 Taz: Wanted [BEFORE]
Avg: 49.800 - Min: 38 - Max: 68 Taz: Wanted [AFTER]
Ensure WM_PAINT is handled correctly [PR #2126]
Otherwise, Windows will send WM_PAINT messages non-stop and burn CPU doing nothing.
This fixes an odd behaviour where moving the mouse over the window could increase FPS.
vs: use model 2.a primarily, with 3.0 fallback [PR #2127]
Based on conversations with @CookiePLMonster: This PR defaults to shader model 2.a for Vertex Shaders, rather than 3.0. Using Vertex Shader Model 3.0 with fixed-function or pixel shader model < 3 is undefined behavior and not supposed to work, yet Cxbx-R does this.
This PR avoids that undefined behavior in the default case, removing the need for the AMD hack, while still falling back to 3.0 in case of compilation failure, to allow large shaders to use their existing (undefined, but better than crashing) behavior. This may not have any impact whatsoever in most games, but it also has the potential to fix weird issues that have no obvious explanation (eg. World Racing 2 being able to reach in-game).
HLSL fixed function implementation [PR #2014]
Should behave more-or-less the same as D3D9 fixed function mode, but allow us to handle Xbox extensions and idiosyncrasies better (e.g. backface lighting).
F2 toggles back to D3D9 fixed function rendering.
Fix some AA scale issues [PR #2133]
● Fix Shenmue II rendering to half the screen. The title used SSAA with the fixed function passthrough mode. The code expected the title to scale its vertices, but apparently it doesn't have to.
● Fix Max Payne 2 bullet time graphics. The title uses the backbuffer with MSAA as a texture. When normalizing texture coordinates we need to use pixel dimensions instead of the raw subpixel dimensions of the texture.
Add Steel Battalion controller support to input GUI [PR #2134]
This PR builds upon #2068 and actually completes the implementation and adds support for the Steel Battalion controller to the input gui. I tested the functionality of the buttons with the controller test option available in the game itself and confirmed that they all work as expected and the toggle functionality of certain buttons is working as well. One thing I noticed: if you map the mouse axis to the controller sticks, they will re-center when the mouse stops moving. This is caused by the same issue that causes Virtua Cop 3 to do the same with the crosshair, and should/will be fixed in a future PR.
Add support for mouse input as cursor position relative to the rendering window [PR #2135]
This PR adds a new mouse input mode which reports its state as the cursor position relative to the rendering window, as opposed to mouse relative motion (the only mode available for the mouse right now). In the input GUI, this is represented with the "Cursor X/Y+/-" name when bound to a button, instead of the "Axis X/Y/Z+/-" name used otherwise. Users can toggle between the two modes by SHIFT - right clicking the corresponding button (will only work if the KeyboardMouse device is selected in the device list). Using this mode fixes the re-center issue of both the crosshair of Virtua Cop 3 and the sticks of Steel Battalion.
Implement IsEmuHandle by keeping a lookup of EmuHandle objects [PR #2146]
Fixes a crash in Amped on loading a map after having exited one. Amped requests an invalid handle 0xFDFDFDFD, IsEmuHandle return a false positive and we'd crash trying to call NtClose().
Handle game title strings that aren't null terminated [PR #2148]
Fixes instability in King Kong since its title name uses all 40 characters.
● Rename wszTitleName to wsTitleName
● Pass length to std::string constructor
● Ensure null termination when copying to m_szAsciiTitle
In King Kong the title would be something like this: Peter Jackson's King Kong official Game ÌÌÌÌÌÌÌÌ_0OÌÌÌÌ-c3c4e904.ini, which makes std::filesystem::exists throw due to invalid characters in the file name.
Notable Game Improvements
Just like our new found tradition, only playable games will be mentioned here:
Whacked! [PLAYABLE]
Last game breaking issues were fixed (menus were invisible), now the game can be played with a very good performance and only minor visual issues.
Ice Age 2 [PLAYABLE]
Both performance and rendering issues were fixed. Performance issue was related to the framerate going down to single digits when the player faces parts of a level that had too much geometry to render, making some parts of the game unbearable to play with slower CPUs (this includes my poor i3 3100 crying in pain). Rendering issues were related to geometry being unstable in pretty much any model on the screen (including the scenarios). While you’re still able to see this issue when you’ve just started to play, it gets stable after some time (less than a minute in my machine) and doesn’t come back unless you restart the emulation.
Road Kill [PLAYABLE]
Performance and stability improved. We had crashes and the game soft locking after a short amount of time (between 5 and 15 minutes in most tests), but now you can run it for hours (I had a long test close to 5 hours, so it’s safe to say it’s very stable now). Performance is much better as well, going from an avg that was always at single digit values to fullspeed most of the time with the latest improvements.
Breeders Cup [PLAYABLE]
Verified as fully playable.
Dakar 2: The World's Ultimate Rally [PLAYABLE]
Rendering and general compatibility issues fixed, the game can now be played till the very end.
Blowout - Military Fighting Unit [PLAYABLE]
Stability issues fixed, game no longer randomly crashes. Some visual issues are still present, but nothing game breaking (some of them being that the game is darker than it should and you can’t control the gamma with the in-game options, and some textures don’t show up).
Fantastic 4 [PLAYABLE]
This was one of those rare cases where the performance was the game breaking issue. This game suffers from an issue that when it’s running too slow, it frameskips a lot (not pretty, but nothing serious so far…), and this cuts your ability to input the correct buttons in some mandatory QTEs (almost like the game is ignoring the button being mashed). With a much better performance now this is no longer an issue, but stays as a warning if you plan to play this game on a very slow computer.
Simpsons - Road Rage [PLAYABLE]
Rendering regressions were fixed and the game was finally tested in every single mode possible.
Max Payne 2 [PLAYABLE]
Last visual issue fixed (only half screen being visible during the bullet time), making the game finally fully playable. Something that can annoy you for now is that dialog and some other sound effects will loop the wrong way or get cut, but nothing that blocks your progres.
Teen Titans [PLAYABLE]
Yet another game that had stability improved a lot and was very hard to test (you had to play for more than 1 hour nonstop to reach the part where this happens, no loading saves allowed!). Not only can you finish the entire game in one sit now (I honestly don’t recommend…), but it’s also much faster in the parts where it used to have some performance drops.
Final Words
There’s still a lot of testing needed to verify all the improvements made in the last months so our numbers aren’t exactly covering everything we could showcase (which is… probably good? Lot’s of surprises waiting for those brave enough to test the most obscure games. Our next step? This big guy here, enough to make a lot of games with serious visual issues becoming much closer to their correct rendering. See you all next month o/
PS: don’t forget to check the updated compatibility information in our new site ;) https://cxbx-reloaded.co.uk/compatibility
Comments
besides for the audio not working at all and some slight graphical glitches, the entire MVP baseball series is very close to being perfect. really looking forward to this!
James Spychalsky
2021-04-01 11:43:18 +0000 UTCWoo hop! Cant wait to see halo combat evolved becomes playable!
Dootuz
2021-03-30 15:32:33 +0000 UTC