[Kernel/XMP] Add title-specific file I/O hooks for XMP volume sync

Some games persist BGM volume through their own save files but never
call XMPSetVolume. Add a TitlePatch system that intercepts NtReadFile/
NtWriteFile to apply game-specific logic as well as logic to identify
the memory location that the volume data is read into and monitor that
memory location for changes, updating XMP player volume if it changes
during gameplay.

Includes patches for known games with this issue:
Dead or Alive Xtreme 2 (544307D2), PGR4 (4D5307F9) and PGR3 (4D5307D1)
This commit is contained in:
Herman S.
2026-03-08 14:42:11 +09:00
parent 54400cbc2c
commit 02fccd9113
6 changed files with 246 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#include "xenia/kernel/util/kernel_fwd.h"
#include "xenia/kernel/util/native_list.h"
#include "xenia/kernel/util/object_table.h"
#include "xenia/kernel/util/xmp_volume_patch.h"
#include "xenia/kernel/xam/achievement_manager.h"
#include "xenia/kernel/xam/app_manager.h"
#include "xenia/kernel/xam/content_manager.h"
@@ -196,6 +197,9 @@ class KernelState {
return xam_state()->content_manager();
}
XmpVolumePatch* xmp_volume_patch() const { return xmp_volume_patch_.get(); }
void InitXmpVolumePatch();
std::bitset<4> GetConnectedUsers() const;
// Access must be guarded by the global critical region.
@@ -351,6 +355,7 @@ class KernelState {
vfs::VirtualFileSystem* file_system_;
std::unique_ptr<xam::XamState> xam_state_;
std::unique_ptr<SystemManagementController> smc_;
std::unique_ptr<XmpVolumePatch> xmp_volume_patch_;
KernelVersion kernel_version_;