3
0
mirror of https://github.com/CrazyRedMachine/popnhax.git synced 2025-02-25 21:58:17 +01:00

fix beatpop adjust, separate quick retire

This commit is contained in:
CrazyRedMachine 2023-02-18 10:25:17 +01:00
parent 3015bac381
commit 15b8274e98
3 changed files with 29 additions and 15 deletions

View File

@ -1,9 +1,11 @@
<?xml version='1.0' encoding='shift-jis'?> <?xml version='1.0' encoding='shift-jis'?>
<popnhax> <popnhax>
<!-- Hidden+ setting (press 0 for advanced options) is now an offset adjust (positive means you have to hit earlier) --> <!-- Hidden+ setting (press 0 for advanced options) is now an offset adjust (negative means you have to hit earlier) -->
<hidden_is_offset __type="bool">0</hidden_is_offset> <hidden_is_offset __type="bool">0</hidden_is_offset>
<!-- Premium free (unlimited stages per credit), press numpad 9 to exit song, or on result screen to exit pfree --> <!-- Premium free (unlimited stages per credit) -->
<pfree __type="bool">0</pfree> <pfree __type="bool">0</pfree>
<!-- Press numpad 9 to exit song, or on result screen to exit session (great for pfree!) -->
<quick_retire __type="bool">0</quick_retire>
<!-- HD timing for pcb_type=0 (0: no, 1: force HD timing offset (for SD cab with CRT), 2: also set resolution to 768p but center text (for SD cab with LCD mod)) --> <!-- HD timing for pcb_type=0 (0: no, 1: force HD timing offset (for SD cab with CRT), 2: also set resolution to 768p but center text (for SD cab with LCD mod)) -->
<hd_on_sd __type="u8">0</hd_on_sd> <hd_on_sd __type="u8">0</hd_on_sd>
<!-- Force unlock music, charts, characters, and deco parts --> <!-- Force unlock music, charts, characters, and deco parts -->

View File

@ -6,6 +6,7 @@
struct popnhax_config { struct popnhax_config {
bool hidden_is_offset; bool hidden_is_offset;
bool pfree; bool pfree;
bool quick_retire;
uint8_t hd_on_sd; uint8_t hd_on_sd;
bool force_unlocks; bool force_unlocks;
bool unset_volume; bool unset_volume;

View File

@ -80,6 +80,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, hidden_is_offs
"/popnhax/hidden_is_offset") "/popnhax/hidden_is_offset")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree,
"/popnhax/pfree") "/popnhax/pfree")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, quick_retire,
"/popnhax/quick_retire")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, hd_on_sd, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, hd_on_sd,
"/popnhax/hd_on_sd") "/popnhax/hd_on_sd")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, force_unlocks, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, force_unlocks,
@ -219,8 +221,8 @@ void hidden_is_offset_commit_options()
__asm("jne call_real_commit\n"); __asm("jne call_real_commit\n");
/* disable hidden ingame */ /* disable hidden ingame */
__asm("movzx ecx, cx\n"); // -kaimei __asm("and ecx, 0x00FFFFFF\n"); // -kaimei
__asm("movzx edx, dx\n"); // unilab __asm("and edx, 0x00FFFFFF\n"); // unilab
/* flag timing for update */ /* flag timing for update */
g_timing_require_update = true; g_timing_require_update = true;
@ -1508,6 +1510,16 @@ pfree_apply:
patch_memory(patch_addr, patch_str, 23); patch_memory(patch_addr, patch_str, 23);
} }
printf("popnhax: premium free enabled\n");
return true;
}
static bool patch_quick_retire()
{
DWORD dllSize = 0;
char *data = getDllData("popn22.dll", &dllSize);
/* hook numpad for instant quit song */ /* hook numpad for instant quit song */
{ {
fuzzy_search_task task; fuzzy_search_task task;
@ -1519,16 +1531,14 @@ pfree_apply:
if (pattern_offset == -1) { if (pattern_offset == -1) {
printf("popnhax: cannot retrieve song loop\n"); printf("popnhax: cannot retrieve song loop\n");
printf("popnhax: premium free enabled (no quick exit)\n"); return false;
return true;
} }
uint32_t addr_icca; uint32_t addr_icca;
if (!get_addr_icca(&addr_icca)) if (!get_addr_icca(&addr_icca))
{ {
printf("popnhax: cannot retrieve ICCA address for numpad hook\n"); printf("popnhax: cannot retrieve ICCA address for numpad hook\n");
printf("popnhax: premium free enabled (no quick exit)\n"); return false;
return true;
} }
int64_t quickexitaddr = (int64_t)&quickexit_game_loop; int64_t quickexitaddr = (int64_t)&quickexit_game_loop;
@ -1550,16 +1560,14 @@ pfree_apply:
if (pattern_offset == -1) { if (pattern_offset == -1) {
printf("popnhax: cannot retrieve result screen loop\n"); printf("popnhax: cannot retrieve result screen loop\n");
printf("popnhax: premium free enabled (no quick exit)\n"); return false;
return true;
} }
uint32_t addr_icca; uint32_t addr_icca;
if (!get_addr_icca(&addr_icca)) if (!get_addr_icca(&addr_icca))
{ {
printf("popnhax: cannot retrieve ICCA address for numpad hook\n"); printf("popnhax: cannot retrieve ICCA address for numpad hook\n");
printf("popnhax: premium free enabled (no quick exit)\n"); return false;
return true;
} }
int64_t quickexitaddr = (int64_t)&quickexit_result_loop; int64_t quickexitaddr = (int64_t)&quickexit_result_loop;
@ -1570,8 +1578,7 @@ pfree_apply:
(void **)&real_result_loop); (void **)&real_result_loop);
} }
printf("popnhax: premium free enabled (with quick exit)\n"); printf("popnhax: quick retire enabled\n");
return true; return true;
} }
@ -1652,6 +1659,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
patch_pfree(); patch_pfree();
} }
if (config.quick_retire) {
patch_quick_retire();
}
if (config.hd_on_sd) { if (config.hd_on_sd) {
patch_hd_on_sd(config.hd_on_sd); patch_hd_on_sd(config.hd_on_sd);
} }