Add support for ASIO audio mode
This commit is contained in:
parent
f2e789058b
commit
82101024d7
10
README.md
10
README.md
@ -36,11 +36,17 @@ res = { x = 1920, y = 1080 }
|
||||
windowed = false
|
||||
# vertical sync
|
||||
vsync = false
|
||||
# wasapi shared mode
|
||||
shared_audio = true
|
||||
# unlock all songs
|
||||
unlock_songs = true
|
||||
|
||||
[patches.audio]
|
||||
# wasapi shared mode
|
||||
wasapi_shared = true
|
||||
# use asio
|
||||
asio = false
|
||||
# asio driver name
|
||||
asio_driver = ""
|
||||
|
||||
[patches.cn_jun_2023]
|
||||
# sync test mode language to attract etc.
|
||||
fix_language = false
|
||||
|
6
dist/config.toml
vendored
6
dist/config.toml
vendored
@ -11,9 +11,13 @@ version = "auto"
|
||||
res = { x = 1920, y = 1080 }
|
||||
windowed = false
|
||||
vsync = false
|
||||
shared_audio = true
|
||||
unlock_songs = true
|
||||
|
||||
[patches.audio]
|
||||
wasapi_shared = true
|
||||
asio = false
|
||||
asio_driver = ""
|
||||
|
||||
[patches.cn_jun_2023]
|
||||
fix_language = false
|
||||
demo_movie = true
|
||||
|
@ -24,6 +24,25 @@ HOOK (i32, HaspRead, PROC_ADDRESS ("hasp_windows_x64.dll", "hasp_read"), i32, i3
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wasapiShared = true;
|
||||
bool asio = false;
|
||||
std::string asioDriver = "";
|
||||
HOOK (i64, NUSCDeviceInit, ASLR (0x140777F70), void *a1, void *a2, void *a3, void *a4) {
|
||||
*(u32 *)((u8 *)a2 + 0x8) = asio;
|
||||
*(const char **)((u8 *)a2 + 0x10) = asio ? asioDriver.c_str () : "";
|
||||
*(u16 *)((u8 *)a2 + 0x18) = (!asio && wasapiShared) ? 0 : 256;
|
||||
*(u16 *)((u8 *)a2 + 0x1C) = (!asio && wasapiShared) ? 0 : 256;
|
||||
return originalNUSCDeviceInit (a1, a2, a3, a4);
|
||||
}
|
||||
HOOK (bool, LoadASIODriver, ASLR (0x1407808C0), void *a1, const char *a2) {
|
||||
auto result = originalLoadASIODriver (a1, a2);
|
||||
if (!result) {
|
||||
MessageBoxA (0, "Failed to load ASIO driver", 0, MB_OK);
|
||||
ExitProcess (0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
i64 (__fastcall *lua_settop) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_settop");
|
||||
i64 (__fastcall *lua_pushboolean) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_pushboolean");
|
||||
i64 (__fastcall *lua_pushstring) (u64, u64) = (i64 (__fastcall *) (u64, u64))PROC_ADDRESS ("lua51.dll", "lua_pushstring");
|
||||
@ -100,7 +119,6 @@ Init () {
|
||||
i32 xRes = 1920;
|
||||
i32 yRes = 1080;
|
||||
bool vsync = false;
|
||||
bool sharedAudio = true;
|
||||
bool unlockSongs = true;
|
||||
bool fixLanguage = false;
|
||||
bool demoMovie = true;
|
||||
@ -135,9 +153,14 @@ Init () {
|
||||
xRes = readConfigInt (res, "x", xRes);
|
||||
yRes = readConfigInt (res, "y", yRes);
|
||||
}
|
||||
vsync = readConfigBool (patches, "vsync", vsync);
|
||||
sharedAudio = readConfigBool (patches, "shared_audio", sharedAudio);
|
||||
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
||||
vsync = readConfigBool (patches, "vsync", vsync);
|
||||
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
||||
auto audio = openConfigSection (patches, "audio");
|
||||
if (audio) {
|
||||
wasapiShared = readConfigBool (audio, "wasapi_shared", wasapiShared);
|
||||
asio = readConfigBool (audio, "asio", asio);
|
||||
asioDriver = readConfigString (audio, "asio_driver", asioDriver);
|
||||
}
|
||||
auto cn_jun_2023 = openConfigSection (patches, "cn_jun_2023");
|
||||
if (cn_jun_2023) {
|
||||
fixLanguage = readConfigBool (cn_jun_2023, "fix_language", fixLanguage);
|
||||
@ -152,9 +175,12 @@ Init () {
|
||||
WRITE_MEMORY (ASLR (0x1404A4ED3), i32, xRes);
|
||||
WRITE_MEMORY (ASLR (0x1404A4EDA), i32, yRes);
|
||||
if (!vsync) WRITE_MEMORY (ASLR (0x1405FC5B9), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90);
|
||||
if (sharedAudio) WRITE_MEMORY (ASLR (0x140777F87), u8, 0xEB);
|
||||
if (unlockSongs) WRITE_MEMORY (ASLR (0x140425BCD), u8, 0xB0, 0x01);
|
||||
|
||||
// Setting audio device
|
||||
INSTALL_HOOK (NUSCDeviceInit);
|
||||
INSTALL_HOOK (LoadASIODriver);
|
||||
|
||||
// Bypass errors
|
||||
WRITE_MEMORY (ASLR (0x14003F690), u8, 0xC3);
|
||||
|
||||
|
@ -4,6 +4,25 @@
|
||||
|
||||
namespace patches::JP_APR_2023 {
|
||||
|
||||
bool wasapiShared = true;
|
||||
bool asio = false;
|
||||
std::string asioDriver = "";
|
||||
HOOK (i64, NUSCDeviceInit, ASLR (0x1407C8620), void *a1, void *a2, void *a3, void *a4) {
|
||||
*(u32 *)((u8 *)a2 + 0x8) = asio;
|
||||
*(const char **)((u8 *)a2 + 0x10) = asio ? asioDriver.c_str () : "";
|
||||
*(u16 *)((u8 *)a2 + 0x18) = (!asio && wasapiShared) ? 0 : 256;
|
||||
*(u16 *)((u8 *)a2 + 0x1C) = (!asio && wasapiShared) ? 0 : 256;
|
||||
return originalNUSCDeviceInit (a1, a2, a3, a4);
|
||||
}
|
||||
HOOK (bool, LoadASIODriver, ASLR (0x1407D0F70), void *a1, const char *a2) {
|
||||
auto result = originalLoadASIODriver (a1, a2);
|
||||
if (!result) {
|
||||
MessageBoxA (0, "Failed to load ASIO driver", 0, MB_OK);
|
||||
ExitProcess (0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
HOOK_DYNAMIC (char, __fastcall, AMFWTerminate, i64) { return 0; }
|
||||
|
||||
HOOK_DYNAMIC (i64, __fastcall, curl_easy_setopt, i64 a1, i64 a2, i64 a3, i64 a4, i64 a5) {
|
||||
@ -45,7 +64,6 @@ Init () {
|
||||
i32 xRes = 1920;
|
||||
i32 yRes = 1080;
|
||||
bool vsync = false;
|
||||
bool sharedAudio = true;
|
||||
bool unlockSongs = true;
|
||||
|
||||
auto configPath = std::filesystem::current_path () / "config.toml";
|
||||
@ -60,8 +78,13 @@ Init () {
|
||||
yRes = readConfigInt (res, "y", yRes);
|
||||
}
|
||||
vsync = readConfigBool (patches, "vsync", vsync);
|
||||
sharedAudio = readConfigBool (patches, "shared_audio", sharedAudio);
|
||||
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
||||
auto audio = openConfigSection (patches, "audio");
|
||||
if (audio) {
|
||||
wasapiShared = readConfigBool (audio, "wasapi_shared", wasapiShared);
|
||||
asio = readConfigBool (audio, "asio", asio);
|
||||
asioDriver = readConfigString (audio, "asio_driver", asioDriver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,9 +92,12 @@ Init () {
|
||||
WRITE_MEMORY (ASLR (0x140494533), i32, xRes);
|
||||
WRITE_MEMORY (ASLR (0x14049453A), i32, yRes);
|
||||
if (!vsync) WRITE_MEMORY (ASLR (0x14064C7E9), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90);
|
||||
if (sharedAudio) WRITE_MEMORY (ASLR (0x1407C8637), u8, 0xEB);
|
||||
if (unlockSongs) WRITE_MEMORY (ASLR (0x1403F45CF), u8, 0xB0, 0x01);
|
||||
|
||||
// Setting audio device
|
||||
INSTALL_HOOK (NUSCDeviceInit);
|
||||
INSTALL_HOOK (LoadASIODriver);
|
||||
|
||||
// Bypass errors
|
||||
WRITE_MEMORY (ASLR (0x140041A00), u8, 0xC3);
|
||||
|
||||
|
@ -13,6 +13,25 @@ void *song_data;
|
||||
|
||||
namespace patches::JP_NOV_2020 {
|
||||
|
||||
bool wasapiShared = true;
|
||||
bool asio = false;
|
||||
std::string asioDriver = "";
|
||||
HOOK (i64, NUSCDeviceInit, ASLR (0x140692E00), void *a1, void *a2, void *a3, void *a4) {
|
||||
*(u32 *)((u8 *)a2 + 0x8) = asio;
|
||||
*(const char **)((u8 *)a2 + 0x10) = asio ? asioDriver.c_str () : "";
|
||||
*(u16 *)((u8 *)a2 + 0x18) = (!asio && wasapiShared) ? 0 : 256;
|
||||
*(u16 *)((u8 *)a2 + 0x1C) = (!asio && wasapiShared) ? 0 : 256;
|
||||
return originalNUSCDeviceInit (a1, a2, a3, a4);
|
||||
}
|
||||
HOOK (bool, LoadASIODriver, ASLR (0x14069B750), void *a1, const char *a2) {
|
||||
auto result = originalLoadASIODriver (a1, a2);
|
||||
if (!result) {
|
||||
MessageBoxA (0, "Failed to load ASIO driver", 0, MB_OK);
|
||||
ExitProcess (0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
HOOK_DYNAMIC (char, __fastcall, AMFWTerminate, i64) { return 0; }
|
||||
|
||||
const i32 datatableBufferSize = 1024 * 1024 * 12;
|
||||
@ -49,7 +68,6 @@ Init () {
|
||||
i32 xRes = 1920;
|
||||
i32 yRes = 1080;
|
||||
bool vsync = false;
|
||||
bool sharedAudio = true;
|
||||
bool unlockSongs = true;
|
||||
|
||||
auto configPath = std::filesystem::current_path () / "config.toml";
|
||||
@ -64,8 +82,13 @@ Init () {
|
||||
yRes = readConfigInt (res, "y", yRes);
|
||||
}
|
||||
vsync = readConfigBool (patches, "vsync", vsync);
|
||||
sharedAudio = readConfigBool (patches, "shared_audio", sharedAudio);
|
||||
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
|
||||
auto audio = openConfigSection (patches, "audio");
|
||||
if (audio) {
|
||||
wasapiShared = readConfigBool (audio, "wasapi_shared", wasapiShared);
|
||||
asio = readConfigBool (audio, "asio", asio);
|
||||
asioDriver = readConfigString (audio, "asio_driver", asioDriver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,9 +96,12 @@ Init () {
|
||||
WRITE_MEMORY (ASLR (0x14035FC5B), i32, xRes);
|
||||
WRITE_MEMORY (ASLR (0x14035FC62), i32, yRes);
|
||||
if (!vsync) WRITE_MEMORY (ASLR (0x140517339), u8, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x90);
|
||||
if (sharedAudio) WRITE_MEMORY (ASLR (0x140692E17), u8, 0xEB);
|
||||
if (unlockSongs) WRITE_MEMORY (ASLR (0x140314E8D), u8, 0xB0, 0x01);
|
||||
|
||||
// Setting audio device
|
||||
INSTALL_HOOK (NUSCDeviceInit);
|
||||
INSTALL_HOOK (LoadASIODriver);
|
||||
|
||||
// Bypass errors
|
||||
WRITE_MEMORY (ASLR (0x1400239C0), u8, 0xC3);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user