diff --git a/dist/popnhax/popnhax.xml b/dist/popnhax/popnhax.xml
index 0383cdb..eb7a0c0 100644
--- a/dist/popnhax/popnhax.xml
+++ b/dist/popnhax/popnhax.xml
@@ -20,6 +20,8 @@
0
+
+ 0
0
diff --git a/popnhax/config.h b/popnhax/config.h
index daea01f..86fc04b 100644
--- a/popnhax/config.h
+++ b/popnhax/config.h
@@ -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;
diff --git a/popnhax/dllmain.cc b/popnhax/dllmain.cc
index b7f216f..ffb0ccd 100644
--- a/popnhax/dllmain.cc
+++ b/popnhax/dllmain.cc
@@ -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();
}