mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
iidx: rework wasapi/asio detection for iidx33+ (#433)
## Link to GitHub Issue, if one exists Fixes #432 ## Description of change Newer versions of iidx33+ reintroduces `SOUND_OUTPUT_DEVICE` env var. iidx module must account for its return ## Testing
This commit is contained in:
@@ -813,7 +813,15 @@ namespace games::iidx {
|
|||||||
// <=24 : 32-bit only
|
// <=24 : 32-bit only
|
||||||
// 25-26: has neither (no patch needed - WASAPI Exclusive by default)
|
// 25-26: has neither (no patch needed - WASAPI Exclusive by default)
|
||||||
// 27-30: has both (envvar will be respected, ASIO or WASAPI)
|
// 27-30: has both (envvar will be respected, ASIO or WASAPI)
|
||||||
// 31+: only has XONAR (ASIO by default, signature patch can be used to force WASAPI - for now)
|
// 31-32: only has XONAR (ASIO by default, signature patch can be used to force WASAPI - for now)
|
||||||
|
// 33 : early versions only have XONAR, but later datecodes have both; SOUND_OUTPUT_DEVICE
|
||||||
|
// returned and it works again when set as env var
|
||||||
|
|
||||||
|
log_info(
|
||||||
|
"iidx",
|
||||||
|
"has_SOUND_OUTPUT_DEVICE: {}, has_XONAR_SOUND_CARD: {}",
|
||||||
|
(has_SOUND_OUTPUT_DEVICE != 0),
|
||||||
|
(has_XONAR_SOUND_CARD != 0));
|
||||||
|
|
||||||
if (!has_SOUND_OUTPUT_DEVICE && !has_XONAR_SOUND_CARD) {
|
if (!has_SOUND_OUTPUT_DEVICE && !has_XONAR_SOUND_CARD) {
|
||||||
// iidx 25-26
|
// iidx 25-26
|
||||||
@@ -821,16 +829,10 @@ namespace games::iidx {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_SOUND_OUTPUT_DEVICE && has_XONAR_SOUND_CARD) {
|
// if the game doesn't accept SOUND_OUTPUT_DEVICE, patch game to force wasapi
|
||||||
// iidx 27-30
|
if (!has_SOUND_OUTPUT_DEVICE &&
|
||||||
log_info("iidx", "This game accepts SOUND_OUTPUT_DEVICE environment variable");
|
SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() &&
|
||||||
return;
|
SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi") {
|
||||||
}
|
|
||||||
|
|
||||||
log_info("iidx", "This game supports ASIO but does not accept SOUND_OUTPUT_DEVICE environment variable");
|
|
||||||
|
|
||||||
// patch game to force wasapi
|
|
||||||
if (SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi") {
|
|
||||||
intptr_t result = replace_pattern(
|
intptr_t result = replace_pattern(
|
||||||
avs::game::DLL_INSTANCE,
|
avs::game::DLL_INSTANCE,
|
||||||
"FF5008E8??????FF83780803740D",
|
"FF5008E8??????FF83780803740D",
|
||||||
@@ -848,8 +850,6 @@ namespace games::iidx {
|
|||||||
"Successfully forced WASAPI as audio engine using signature matching @ 0x{:x}.",
|
"Successfully forced WASAPI as audio engine using signature matching @ 0x{:x}.",
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log_info("iidx", "Not applying force wasapi patch; game will use ASIO");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch iidx32+ for asio compatibility
|
// patch iidx32+ for asio compatibility
|
||||||
@@ -857,7 +857,8 @@ namespace games::iidx {
|
|||||||
// the patch is only really needed for (some) non-XONAR devices but since people sometimes disguise
|
// the patch is only really needed for (some) non-XONAR devices but since people sometimes disguise
|
||||||
// other devices as a XONAR, don't check for the exact string (common ASIO workaround for INF)
|
// other devices as a XONAR, don't check for the exact string (common ASIO workaround for INF)
|
||||||
if (avs::game::is_ext(2024090100, MAXINT) &&
|
if (avs::game::is_ext(2024090100, MAXINT) &&
|
||||||
!(SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() && SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi")) {
|
!(SOUND_OUTPUT_DEVICE_IN_EFFECT.has_value() &&
|
||||||
|
SOUND_OUTPUT_DEVICE_IN_EFFECT.value() == "wasapi")) {
|
||||||
|
|
||||||
// in iidx32 final:
|
// in iidx32 final:
|
||||||
// ff 50 08 call QWORD PTR [rax+0x8] ; ASIO instance AddRef
|
// ff 50 08 call QWORD PTR [rax+0x8] ; ASIO instance AddRef
|
||||||
|
|||||||
Reference in New Issue
Block a user