forked from Popn_Tools/popnhax
Compare commits
3 Commits
a3c05cb55f
...
adc18fcc35
Author | SHA1 | Date | |
---|---|---|---|
adc18fcc35 | |||
f75be601d0 | |||
f0bca1515d |
12
dist/popnhax/popnhax.xml
vendored
12
dist/popnhax/popnhax.xml
vendored
@ -33,18 +33,22 @@
|
|||||||
<!-- Bring back score challenge in the game for servers supporting it (only for kaimei onwards) -->
|
<!-- Bring back score challenge in the game for servers supporting it (only for kaimei onwards) -->
|
||||||
<score_challenge __type="bool">0</score_challenge>
|
<score_challenge __type="bool">0</score_challenge>
|
||||||
|
|
||||||
|
<!-- Audio offset -->
|
||||||
|
<!-- Offset the audio by x ms (negative plays audio earlier). This will disable keysounds -->
|
||||||
|
<audio_offset __type="s8">0</audio_offset>
|
||||||
|
|
||||||
<!-- Visual offset -->
|
<!-- Visual offset -->
|
||||||
<!-- Hidden+ setting (press 0 for advanced options) is now a visual offset adjust (negative means you have to hit earlier) -->
|
<!-- Hidden+ setting (press 0 for advanced options) is now a visual 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>
|
||||||
<!-- Display offset adjust value on score result screen (requires hidden_is_offset, won't be sent over network) -->
|
<!-- Display offset adjust value on score result screen (requires hidden_is_offset, won't be sent over network) -->
|
||||||
<show_offset __type="bool">0</show_offset>
|
<show_offset __type="bool">0</show_offset>
|
||||||
|
|
||||||
|
<!-- Result screen display patches -->
|
||||||
|
<!-- Display details on result screen by default (no need to press yellow button) -->
|
||||||
|
<show_details __type="bool">0</show_details>
|
||||||
<!-- Display fast/slow counter on result screen even on judge+ off/lost/panic -->
|
<!-- Display fast/slow counter on result screen even on judge+ off/lost/panic -->
|
||||||
<show_fast_slow __type="bool">0</show_fast_slow>
|
<show_fast_slow __type="bool">0</show_fast_slow>
|
||||||
|
|
||||||
<!-- Audio offset -->
|
|
||||||
<!-- Offset the audio by x ms (negative plays audio earlier). This will disable keysounds -->
|
|
||||||
<audio_offset __type="s8">0</audio_offset>
|
|
||||||
|
|
||||||
<!-- Input polling -->
|
<!-- Input polling -->
|
||||||
<!-- 1000Hz polling rate (no more shifting timing windows/magic bpm, consistent scoring independently of framerate) -->
|
<!-- 1000Hz polling rate (no more shifting timing windows/magic bpm, consistent scoring independently of framerate) -->
|
||||||
<enhanced_polling __type="bool">0</enhanced_polling>
|
<enhanced_polling __type="bool">0</enhanced_polling>
|
||||||
|
@ -8,6 +8,7 @@ struct popnhax_config {
|
|||||||
bool hidden_is_offset;
|
bool hidden_is_offset;
|
||||||
bool show_offset;
|
bool show_offset;
|
||||||
bool show_fast_slow;
|
bool show_fast_slow;
|
||||||
|
bool show_details;
|
||||||
bool pfree;
|
bool pfree;
|
||||||
bool quick_retire;
|
bool quick_retire;
|
||||||
bool back_to_song_select;
|
bool back_to_song_select;
|
||||||
|
@ -92,6 +92,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, show_fast_slow,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_fast_slow,
|
||||||
"/popnhax/show_fast_slow")
|
"/popnhax/show_fast_slow")
|
||||||
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_details,
|
||||||
|
"/popnhax/show_details")
|
||||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_offset,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_offset,
|
||||||
"/popnhax/show_offset")
|
"/popnhax/show_offset")
|
||||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree,
|
||||||
@ -270,8 +272,10 @@ uint32_t g_transition_addr = 0;
|
|||||||
uint32_t g_stage_addr = 0;
|
uint32_t g_stage_addr = 0;
|
||||||
uint32_t g_score_addr = 0;
|
uint32_t g_score_addr = 0;
|
||||||
bool g_pfree_mode = false;
|
bool g_pfree_mode = false;
|
||||||
|
bool g_end_session = false;
|
||||||
bool g_return_to_options = false;
|
bool g_return_to_options = false;
|
||||||
bool g_return_to_song_select = false;
|
bool g_return_to_song_select = false;
|
||||||
|
bool g_return_to_song_select_num9 = false;
|
||||||
void (*real_screen_transition)();
|
void (*real_screen_transition)();
|
||||||
void quickexit_screen_transition()
|
void quickexit_screen_transition()
|
||||||
{
|
{
|
||||||
@ -287,6 +291,7 @@ void quickexit_screen_transition()
|
|||||||
g_return_to_song_select = false;
|
g_return_to_song_select = false;
|
||||||
//flag is set back to false in hook_stage_increment otherwise
|
//flag is set back to false in hook_stage_increment otherwise
|
||||||
}
|
}
|
||||||
|
g_end_session = false;
|
||||||
real_screen_transition();
|
real_screen_transition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,12 +382,24 @@ void backtosongselect_option_screen()
|
|||||||
__asm("cmp bl, 8\n");
|
__asm("cmp bl, 8\n");
|
||||||
__asm("jne exit_back_select\n");
|
__asm("jne exit_back_select\n");
|
||||||
g_return_to_song_select = true;
|
g_return_to_song_select = true;
|
||||||
|
g_return_to_song_select_num9 = true;
|
||||||
|
|
||||||
__asm("exit_back_select:\n");
|
__asm("exit_back_select:\n");
|
||||||
|
|
||||||
real_option_screen_later();
|
real_option_screen_later();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void (*real_backtosongselect_option_screen_auto_leave)();
|
||||||
|
void backtosongselect_option_screen_auto_leave()
|
||||||
|
{
|
||||||
|
if ( g_return_to_song_select_num9 )
|
||||||
|
{
|
||||||
|
g_return_to_song_select_num9 = false;
|
||||||
|
__asm("mov al, 1\n");
|
||||||
|
}
|
||||||
|
real_backtosongselect_option_screen_auto_leave();
|
||||||
|
}
|
||||||
|
|
||||||
void (*real_option_screen_yellow)();
|
void (*real_option_screen_yellow)();
|
||||||
void backtosongselect_option_yellow()
|
void backtosongselect_option_yellow()
|
||||||
{
|
{
|
||||||
@ -399,11 +416,25 @@ void backtosongselect_option_yellow()
|
|||||||
__asm("jne exit_back_select_yellow\n");
|
__asm("jne exit_back_select_yellow\n");
|
||||||
|
|
||||||
g_return_to_song_select = true;
|
g_return_to_song_select = true;
|
||||||
|
g_return_to_song_select_num9 = true;
|
||||||
|
|
||||||
__asm("exit_back_select_yellow:\n");
|
__asm("exit_back_select_yellow:\n");
|
||||||
real_option_screen_yellow();
|
real_option_screen_yellow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t g_option_yellow_leave_addr = 0;
|
||||||
|
void (*real_backtosongselect_option_screen_yellow_auto_leave)();
|
||||||
|
void backtosongselect_option_screen_yellow_auto_leave()
|
||||||
|
{
|
||||||
|
if ( g_return_to_song_select_num9 )
|
||||||
|
{
|
||||||
|
g_return_to_song_select_num9 = false;
|
||||||
|
__asm("push %0\n": :"m"(g_option_yellow_leave_addr));
|
||||||
|
__asm("ret\n");
|
||||||
|
}
|
||||||
|
real_backtosongselect_option_screen_yellow_auto_leave();
|
||||||
|
}
|
||||||
|
|
||||||
static bool r_ran;
|
static bool r_ran;
|
||||||
static bool regul_flg;
|
static bool regul_flg;
|
||||||
//static bool dj_auto;
|
//static bool dj_auto;
|
||||||
@ -519,6 +550,7 @@ void quickexit_result_loop()
|
|||||||
__asm("jmp call_real_result\n");
|
__asm("jmp call_real_result\n");
|
||||||
|
|
||||||
__asm("quit_session:\n");
|
__asm("quit_session:\n");
|
||||||
|
g_end_session = true;
|
||||||
g_return_to_options = false;
|
g_return_to_options = false;
|
||||||
/* set value 5 in g_stage_addr and -4 in g_transition_addr (to get fade to black transition) */
|
/* set value 5 in g_stage_addr and -4 in g_transition_addr (to get fade to black transition) */
|
||||||
__asm("mov ebx, %0\n": :"b"(g_stage_addr));
|
__asm("mov ebx, %0\n": :"b"(g_stage_addr));
|
||||||
@ -534,6 +566,17 @@ void quickexit_result_loop()
|
|||||||
real_result_loop();
|
real_result_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void (*real_result_button_loop)();
|
||||||
|
void quickexit_result_button_loop()
|
||||||
|
{
|
||||||
|
if ( g_end_session || g_return_to_options )
|
||||||
|
{
|
||||||
|
//g_return_to_options is reset in quickexit_option_screen_cleanup(), g_end_session is reset in quickexit_screen_transition()
|
||||||
|
__asm("mov al, 1\n");
|
||||||
|
}
|
||||||
|
real_result_button_loop();
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t g_timing_addr = 0;
|
uint32_t g_timing_addr = 0;
|
||||||
bool g_timing_require_update = false;
|
bool g_timing_require_update = false;
|
||||||
|
|
||||||
@ -1711,6 +1754,62 @@ static bool force_show_fast_slow() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void (*real_show_detail_result)();
|
||||||
|
void hook_show_detail_result()
|
||||||
|
{
|
||||||
|
static uint32_t last_call = 0;
|
||||||
|
|
||||||
|
__asm("push eax\n");
|
||||||
|
__asm("push edx\n");
|
||||||
|
|
||||||
|
uint32_t curr_time = timeGetTime(); //will clobber eax
|
||||||
|
if ( curr_time - last_call > 10000 ) //will clobber edx
|
||||||
|
{
|
||||||
|
last_call = curr_time;
|
||||||
|
__asm("pop edx\n");
|
||||||
|
__asm("pop eax\n");
|
||||||
|
//force press yellow button
|
||||||
|
__asm("mov al, 1\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last_call = curr_time;
|
||||||
|
__asm("pop edx\n");
|
||||||
|
__asm("pop eax\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
real_show_detail_result();
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool force_show_details_result() {
|
||||||
|
DWORD dllSize = 0;
|
||||||
|
char *data = getDllData(g_game_dll_fn, &dllSize);
|
||||||
|
|
||||||
|
int64_t first_loc = search(data, dllSize, "\x8B\x45\x48\x8B\x58\x0C\x6A\x09\x68\x80\x00\x00\x00", 13, 0);
|
||||||
|
if (first_loc == -1) {
|
||||||
|
LOG("popnhax: show details: cannot find result screen button check (1)\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//+0x26
|
||||||
|
{
|
||||||
|
int64_t pattern_offset = search(data, 0x50, "\x84\xC0", 2, first_loc);
|
||||||
|
if (pattern_offset == -1) {
|
||||||
|
LOG("popnhax: show details: cannot find result screen button check (2)\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t patch_addr = (int64_t)data + pattern_offset;
|
||||||
|
|
||||||
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_show_detail_result,
|
||||||
|
(void **)&real_show_detail_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG("popnhax: force show details on result screen\n");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool patch_pfree() {
|
static bool patch_pfree() {
|
||||||
DWORD dllSize = 0;
|
DWORD dllSize = 0;
|
||||||
char *data = getDllData(g_game_dll_fn, &dllSize);
|
char *data = getDllData(g_game_dll_fn, &dllSize);
|
||||||
@ -1901,6 +2000,21 @@ static bool patch_quick_retire(bool pfree)
|
|||||||
(void **)&real_result_loop);
|
(void **)&real_result_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no need to press red button when numpad 8 or 9 is pressed on result screen */
|
||||||
|
{
|
||||||
|
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x0F\x8B\x8D\x1C\x0A\x00\x00\xE8", 11, 0);
|
||||||
|
|
||||||
|
if (pattern_offset == -1) {
|
||||||
|
LOG("popnhax: cannot retrieve result screen button check\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t patch_addr = (int64_t)data + pattern_offset + 0x1D;
|
||||||
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_result_button_loop,
|
||||||
|
(void **)&real_result_button_loop);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LOG("popnhax: quick retire enabled\n");
|
LOG("popnhax: quick retire enabled\n");
|
||||||
|
|
||||||
/* retrieve songstart function pointer for quick retry */
|
/* retrieve songstart function pointer for quick retry */
|
||||||
@ -1970,7 +2084,7 @@ static bool patch_quick_retire(bool pfree)
|
|||||||
int64_t pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x34\x00\x75", 11, 0);
|
int64_t pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x34\x00\x75", 11, 0);
|
||||||
|
|
||||||
if (pattern_offset == -1) {
|
if (pattern_offset == -1) {
|
||||||
LOG("popnhax: quick retry: cannot retrieve option screen loop function\n");
|
LOG("popnhax: back to song select: cannot retrieve option screen loop function\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1978,6 +2092,19 @@ static bool patch_quick_retire(bool pfree)
|
|||||||
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen,
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen,
|
||||||
(void **)&real_option_screen_later);
|
(void **)&real_option_screen_later);
|
||||||
}
|
}
|
||||||
|
/* automatically leave option screen after numpad 9 press */
|
||||||
|
{
|
||||||
|
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x63\x8B\x85\x10\x0A\x00\x00\x83\xC0\x04\xBF\x0C\x00\x00\x00", 18, 0);
|
||||||
|
|
||||||
|
if (pattern_offset == -1) {
|
||||||
|
LOG("popnhax: back to song select: cannot retrieve option screen loop function\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t patch_addr = (int64_t)data + pattern_offset;
|
||||||
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen_auto_leave,
|
||||||
|
(void **)&real_backtosongselect_option_screen_auto_leave);
|
||||||
|
}
|
||||||
|
|
||||||
/* go back to song select with numpad 9 on song option screen (after pressing yellow) */
|
/* go back to song select with numpad 9 on song option screen (after pressing yellow) */
|
||||||
{
|
{
|
||||||
@ -1992,7 +2119,29 @@ static bool patch_quick_retire(bool pfree)
|
|||||||
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_yellow,
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_yellow,
|
||||||
(void **)&real_option_screen_yellow);
|
(void **)&real_option_screen_yellow);
|
||||||
}
|
}
|
||||||
LOG("popnhax: quick retry: return to song select enabled\n");
|
/* automatically leave after numpad 9 press */
|
||||||
|
{
|
||||||
|
int64_t pattern_offset = search(data, dllSize, "\x8B\x55\x00\x8B\x82\x9C\x00\x00\x00\x6A\x01\x8B\xCD\xFF\xD0\x80\xBD", 17, 0);
|
||||||
|
|
||||||
|
if (pattern_offset == -1) {
|
||||||
|
LOG("popnhax: back to song select: cannot retrieve option screen yellow leave addr\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_option_yellow_leave_addr = (int32_t)data + pattern_offset - 0x05;
|
||||||
|
pattern_offset = search(data, dllSize, "\x84\xC0\x0F\x84\xF1\x00\x00\x00\x8B\xC5", 10, 0);
|
||||||
|
|
||||||
|
if (pattern_offset == -1) {
|
||||||
|
LOG("popnhax: back to song select: cannot retrieve option screen yellow button check function\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t patch_addr = (int64_t)data + pattern_offset;
|
||||||
|
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen_yellow_auto_leave,
|
||||||
|
(void **)&real_backtosongselect_option_screen_yellow_auto_leave);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG("popnhax: quick retire: return to song select enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfree)
|
if (pfree)
|
||||||
@ -4029,6 +4178,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||||||
force_show_fast_slow();
|
force_show_fast_slow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.show_details){
|
||||||
|
force_show_details_result();
|
||||||
|
}
|
||||||
|
|
||||||
if (config.audio_offset){
|
if (config.audio_offset){
|
||||||
if (config.keysound_offset)
|
if (config.keysound_offset)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user