Cxbx-Reloaded / Cxbx-Reloaded

Xbox (Original) Emulator
https://cxbx-reloaded.co.uk
GNU General Public License v2.0
2.2k stars 257 forks source link

[Linux/Wine] Problem with saving game data in more recent Wine versions #2314

Open lorn10 opened 2 years ago

lorn10 commented 2 years ago

Quick summary

Currently it is not always possible in newer Wine versions (since around 6.7) to save game data in CXBX-R. I can confirm this for Crash Tag Team Racing. There appears at the CLI an error NtCreateFile alloc_size not supported when a saving attempt is processed.

Originally I thought that this is a Wine related problem so I have opened at the Wine Bugzilla a bug report (see link below). However, thanks to Wine developer Stefan Dösinger @stefand it looks (for me) that this problem could be fixed also in CXBX-R.

He was so kind to offer a possible hack (to workaround this in Wine). More information can be found here.

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a29b5cbb980..530039b75ef 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4295,6 +4295,12 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
                 info->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
         }
         break;
+    case FileAllocationInformation:
+        {
+            FILE_ALLOCATION_INFORMATION *info = ptr;
+            info->AllocationSize.QuadPart = 0;
+            break;
+        }
     default:
         FIXME("Unsupported class (%d)\n", class);
         status = STATUS_NOT_IMPLEMENTED;

I personally simply don't understand this stuff, I am here just a beta-tester, so it would be GREAT if a dev could look into this. Thanks! :+1:

PS Other than that, CXBX-R runs awesome in later Wine versions! (Especially in conjunction with Gallium Nine or probably also DXVK.)

Details

In Crash Tag Team Racing, when a new user is created and the game data is saved to the virtual Xbox HDD it doesn't work and fails. At the same time there appears on the CLI an error NtCreateFile alloc_size not supported. This behavior is for me 100% reproducible in Crash Tag Team Racing.

But it should be mentioned that this is not always the case in regard to other games. So I can save for example in Baldur's Gate Dark Alliance to an empty save slot but when I try to overwrite it with a new one CXBX-R simply crashes.

System Configuration:

test@test-iMac:~$ inxi -b
System:    Host: test-iMac Kernel: 5.13.0-27-generic x86_64 bits: 64 Desktop: KDE Plasma 5.18.5 
           Distro: Ubuntu 20.04.3 LTS (Focal Fossa) 
Machine:   Type: Desktop System: Apple product: iMac12,2 v: 1.0 serial: <superuser/root required> 
           Mobo: Apple model: Mac-942B59F58194171B v: iMac12,2 serial: <superuser/root required> UEFI: Apple 
           v: IM121.88Z.0047.B1F.1201241648 date: 01/24/12 
CPU:       Quad Core: Intel Core i5-2500S type: MCP speed: 1620 MHz min/max: 1600/3700 MHz 
Graphics:  Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics driver: i915 v: kernel 
           Device-2: Advanced Micro Devices [AMD/ATI] Whistler [Radeon HD 6730M/6770M/7690M XT] driver: radeon v: kernel 
           Display: x11 server: X.Org 1.20.13 driver: modesetting,radeon FAILED: ati unloaded: fbdev,vesa 
           resolution: 2560x1440~60Hz 
           OpenGL: renderer: AMD TURKS (DRM 2.50.0 / 5.13.0-27-generic LLVM 13.0.0) 
           v: 3.3 Mesa 22.0.0-devel (git-ae32c62 2022-01-27 focal-oibaf-ppa) 
Network:   Device-1: Broadcom and subsidiaries NetXtreme BCM57765 Gigabit Ethernet PCIe driver: tg3 
           Device-2: Qualcomm Atheros AR93xx Wireless Network Adapter driver: ath9k 
Drives:    Local Storage: total: 931.51 GiB used: 94.07 GiB (10.1%) 
Info:      Processes: 214 Uptime: 7d 6h 59m Memory: 7.74 GiB used: 3.34 GiB (43.2%) Shell: bash inxi: 3.0.38 

Additional Information (if any):

The corresponding Wine bug is available here: https://bugs.winehq.org/show_bug.cgi?id=52171

LukeUsher commented 2 years ago

It's worth noting that that code you posted as a possible hack is for Wine code, not Cxbx-R

Cxbx-R doesn't have the code files that are referenced.

lorn10 commented 2 years ago

Thanks Luke Usher for yours answer. Yes, I assumed that... :wink:

However, if Wine doesn't have currently the corresponding function implemented can this be "workarounded" in CXBX-R?

As said, everything other runs really good so this is out of mine view the only big stumbling block regarding the use of CXBX-R in newer Wine versions.

lorn10 commented 1 year ago

A short status update regarding the upcoming Wine 8.0 release.

I can confirm that this bug still exist also for Wine devel 8.0-rc2. This was tested with the CXBX-R November build 0b69563 and Crash Tag Team Racing. The error output is still:

0310:fixme:file:NtCreateFile alloc_size not supported
0310:fixme:file:NtSetInformationFile Unsupported class (19)

Other games like Baldur's Gate Dark Alliance seems to work until a saving point is deleted within the game. Usually CXBX-R is crashing a that point. As a result I have started to delete the corresponding save states outside of the game.

So unfortunately there hasn't changed anything in this topic here. But other than that CXBX-R build 0b69563 is running again almost perfectly well under Wine. This is even more true when Gallium Nine is installed. :+1: The strange C++20 semaphore issue and the crash-problem when ending the emulation are gone.

Note, also for the upcoming Wine 8.0 branch it can be said that CXBX-R is running better with the built-in Visual C++ 2022 support. At least in my case the built-in Visual C++ support works rock solid.

So I had to install through winetricks only:

winetricks -q d3dcompiler_47

winetricks -q galliumnine

Maybe some CXBX-R devs find in the new year some time to check the above suggested Wine code and post a commit to Wine. :wink: And maybe it should be added here that Wine has finally also a GiLlab page.

lorn10 commented 1 year ago

Again a small status update, - the problem described here is present also in all later releases up to Wine 8.4.

However, it looks that this topic will be finally resolved with the refactoring of the Xbox I/O File System support in CXBX-R, see issue report #2361 for more information.

A first step was done in #2365, - but that PR was closed again because of unknown reasons. Eventually there were too much regressions. Whatever, it would be cool to have some information about the current state in this matter @RadWolfie. (Sorry to bother.)

For Linux/Wine users it can be said that this bug here is effectively the sole and only reason why games like Crash Tag Team Racing aren't fully playable.