mirror of
https://github.com/CrazyRedMachine/popnhax.git
synced 2024-11-23 22:00:57 +01:00
audio source fix
This commit is contained in:
parent
3018d9ac2d
commit
f59de4f8fa
2
dist/popnhax/popnhax.xml
vendored
2
dist/popnhax/popnhax.xml
vendored
@ -20,6 +20,8 @@
|
||||
<!-- Force unlock deco parts (avoid using this on later games without deco) -->
|
||||
<force_unlock_deco __type="bool">0</force_unlock_deco>
|
||||
|
||||
<!-- Prevent crash on boot when using a different default audio source (aka HDMI audio patch) -->
|
||||
<audio_source_fix __type="bool">0</audio_source_fix>
|
||||
<!-- Prevent Windows volume from being reset on boot -->
|
||||
<unset_volume __type="bool">0</unset_volume>
|
||||
<!-- Force booting directly into event mode -->
|
||||
|
@ -12,6 +12,7 @@ struct popnhax_config {
|
||||
uint8_t force_hd_resolution;
|
||||
bool force_unlocks;
|
||||
bool force_unlock_deco;
|
||||
bool audio_source_fix;
|
||||
bool unset_volume;
|
||||
bool event_mode;
|
||||
bool remove_timer;
|
||||
|
@ -96,6 +96,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, force_unlocks,
|
||||
"/popnhax/force_unlocks")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, force_unlock_deco,
|
||||
"/popnhax/force_unlock_deco")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, audio_source_fix,
|
||||
"/popnhax/audio_source_fix")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, unset_volume,
|
||||
"/popnhax/unset_volume")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, event_mode, "/popnhax/event_mode")
|
||||
@ -1055,6 +1057,30 @@ static bool patch_database(uint8_t force_unlocks) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool patch_audio_source_fix() {
|
||||
DWORD dllSize = 0;
|
||||
char *data = getDllData(g_game_dll_fn, &dllSize);
|
||||
|
||||
{
|
||||
fuzzy_search_task task;
|
||||
|
||||
FUZZY_START(task, 1)
|
||||
FUZZY_CODE(task, 0, "\x85\xC0\x75\x96\x8D\x70\x7F\xE8\xF8\x2B\x00\x00", 12)
|
||||
|
||||
int64_t pattern_offset = find_block(data, dllSize, &task, 0);
|
||||
if (pattern_offset == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t patch_addr = (int64_t)data + pattern_offset;
|
||||
patch_memory(patch_addr, (char *)"\x90\x90\x90\x90", 4);
|
||||
}
|
||||
|
||||
printf("popnhax: audio source fixed\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool patch_unset_volume() {
|
||||
DWORD dllSize = 0;
|
||||
char *data = getDllData(g_game_dll_fn, &dllSize);
|
||||
@ -3020,6 +3046,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
patch_practice_mode();
|
||||
}
|
||||
|
||||
if (config.audio_source_fix) {
|
||||
patch_audio_source_fix();
|
||||
}
|
||||
|
||||
if (config.unset_volume) {
|
||||
patch_unset_volume();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user