[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:
@@ -121,11 +121,22 @@ dword_result_t XamInputGetState_entry(dword_t user_index, dword_t flags,
|
||||
actual_user_index = 0;
|
||||
}
|
||||
|
||||
X_RESULT result;
|
||||
auto input_system = kernel_state()->emulator()->input_system();
|
||||
auto lock = input_system->lock();
|
||||
return input_system->GetState(
|
||||
user_index, !flags ? X_INPUT_FLAG::X_INPUT_FLAG_GAMEPAD : flags,
|
||||
input_state);
|
||||
{
|
||||
auto lock = input_system->lock();
|
||||
result = input_system->GetState(
|
||||
user_index, !flags ? X_INPUT_FLAG::X_INPUT_FLAG_GAMEPAD : flags,
|
||||
input_state);
|
||||
}
|
||||
|
||||
if (input_state && result == X_ERROR_SUCCESS) {
|
||||
if (auto patch = kernel_state()->xmp_volume_patch()) {
|
||||
patch->OnInputPoll(input_state->packet_number);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
DECLARE_XAM_EXPORT2(XamInputGetState, kInput, kImplemented, kHighFrequency);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user