iidx_hard_gauge shortcut

This commit is contained in:
CrazyRedMachine 2023-09-03 13:35:34 +02:00
parent 9c744c295a
commit 848105eb27
3 changed files with 48 additions and 18 deletions

View File

@ -51,12 +51,9 @@
<hispeed_default_bpm __type="u16">0</hispeed_default_bpm>
<!-- Gauge options -->
<!-- Turn hard gauge into survival gauge (1: former COURSE gauge (-3.42%), 2: NORMAL gauge decrease rate (-4.99%), 3: IIDX HARD gauge decrease rate (-9%), 4: HARD gauge decrease rate (-19.94%)) -->
<survival_gauge __type="u8">0</survival_gauge>
<!-- Survival gauge has IIDX-like decrease rate adjustment (decrease amount halved when gauge is at 33.3% or less) -->
<survival_iidx __type="bool">0</survival_iidx>
<!-- Set survival gauge increase rate to spicy (+01/+01 instead of +02/+01) -->
<survival_spicy __type="bool">0</survival_spicy>
<!-- IIDX-like hard gauge (start with full gauge, instant fail if gauge drops to 0) -->
<!-- Gauge details: increment: +0.1% for each cool/great/good (like spicy gauge), decrement: -9% for each bad, or -4.5% if gauge <=30% ) -->
<iidx_hard_gauge __type="bool">0</iidx_hard_gauge>
<!-- Result screen display patches -->
<!-- Display details on result screen by default (no need to press yellow button) -->
@ -137,4 +134,12 @@
<!-- Dump applied translations and dll runtime data to help debug translation -->
<translation_debug __type="bool">0</translation_debug>
<!-- HARD Gauge alteration modes -->
<!-- Turn hard gauge into survival gauge (1: former COURSE gauge (-3.42%), 2: NORMAL gauge decrease rate (-4.99%), 3: IIDX HARD gauge decrease rate (-9%), 4: HARD gauge decrease rate (-19.94%)) -->
<survival_gauge __type="u8">0</survival_gauge>
<!-- Survival gauge has IIDX-like decrease rate adjustment (decrease amount halved when gauge is at 30% or less) -->
<survival_iidx __type="bool">0</survival_iidx>
<!-- Set survival gauge increase rate to spicy (+01/+01 instead of +02/+01) -->
<survival_spicy __type="bool">0</survival_spicy>
</popnhax>

View File

@ -6,9 +6,7 @@
struct popnhax_config {
bool practice_mode;
bool hidden_is_offset;
uint8_t survival_gauge;
bool survival_iidx;
bool survival_spicy;
bool iidx_hard_gauge;
bool show_offset;
bool show_fast_slow;
bool show_details;
@ -48,6 +46,9 @@ struct popnhax_config {
int8_t enhanced_polling_priority;
uint8_t hispeed_auto;
uint16_t hispeed_default_bpm;
uint8_t survival_gauge;
bool survival_iidx;
bool survival_spicy;
};
#endif

View File

@ -90,6 +90,8 @@ struct popnhax_config config = {};
PSMAP_BEGIN(config_psmap, static)
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, hidden_is_offset,
"/popnhax/hidden_is_offset")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, iidx_hard_gauge,
"/popnhax/iidx_hard_gauge")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, survival_gauge,
"/popnhax/survival_gauge")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, survival_iidx,
@ -4505,7 +4507,8 @@ bool patch_hard_gauge_survival(uint8_t severity)
}
}
LOG("popnhax: hard gauge into survival (decrease rate : %s)\n", severity_str[severity]);
if (!config.iidx_hard_gauge)
LOG("popnhax: survival_gauge debug: enabled (decrease rate : %s)\n", severity_str[severity]);
return true;
}
@ -4530,8 +4533,8 @@ void hook_survival_iidx_apply_gauge()
__asm("cmp ecx, 2\n");
__asm("jb skip_iidx_apply_gauge\n"); //skip if gauge is not decreasing
__asm("mov ecx, 3\n");
__asm("cmp ax, 342\n");
__asm("jge skip_iidx_apply_gauge\n"); //skip if gauge is above 33.3%
__asm("cmp ax, 308\n");
__asm("jge skip_iidx_apply_gauge\n"); //skip if gauge is above 30%
__asm("mov ecx, 2\n");
__asm("skip_iidx_apply_gauge:\n");
@ -4557,7 +4560,7 @@ bool patch_survival_iidx()
(void **)&real_survival_iidx_prepare_gauge);
}
/* switch slot depending on gauge value (get halved value when 33.3% or less) */
/* switch slot depending on gauge value (get halved value when 30% or less) */
{
int64_t pattern_offset = search(data, dllSize, "\x66\x83\xF8\x01\x75\x5E\x66\xA1", 8, 0);
if (pattern_offset == -1) {
@ -4571,7 +4574,9 @@ bool patch_survival_iidx()
(void **)&real_survival_iidx_apply_gauge);
}
LOG("popnhax: survival gauge has IIDX-like adjustment\n");
if (!config.iidx_hard_gauge)
LOG("popnhax: survival_gauge debug: IIDX-like <=30%% adjustment\n");
return true;
}
@ -4584,7 +4589,8 @@ bool patch_survival_spicy()
return false;
}
LOG("popnhax: survival gauge is SPICY\n");
if (!config.iidx_hard_gauge)
LOG("popnhax: survival_gauge debug: spicy gauge\n");
return true;
}
@ -4780,16 +4786,34 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
patch_hd_resolution(config.force_hd_resolution);
}
if (config.iidx_hard_gauge){
if (config.survival_gauge || config.survival_spicy || config.survival_iidx)
{
LOG("popnhax: iidx_hard_gauge cannot be used when other survival options are already set\n");
config.iidx_hard_gauge = false;
}
else
{
config.survival_gauge = 3;
config.survival_spicy = true;
config.survival_iidx = true;
}
}
if (config.survival_gauge) {
patch_hard_gauge_survival(config.survival_gauge);
bool res = true;
res &= patch_hard_gauge_survival(config.survival_gauge);
if (config.survival_spicy) {
patch_survival_spicy();
res &= patch_survival_spicy();
}
if (config.survival_iidx) {
patch_survival_iidx();
res &= patch_survival_iidx();
}
if (config.iidx_hard_gauge && res)
LOG("popnhax: iidx_hard_gauge: HARD gauge is now IIDX-like\n");
}
if (config.hidden_is_offset){