Compare commits

..

2 Commits

Author SHA1 Message Date
5073cbaa9a wip fix auto hispeed soflan retry 2024-01-03 02:31:22 +01:00
2514f4c741 auto hispeed soflan retry 2024-01-03 02:14:48 +01:00
3 changed files with 4 additions and 39 deletions

View File

@ -104,8 +104,6 @@
<disable_multiboot __type="bool">0</disable_multiboot>
<!-- Timing and lanes -->
<!-- Base visual offset (value will be added to the base SD (-60) and base HD (-76) values) -->
<base_offset __type="s8">0</base_offset>
<!-- Automatically play keysounds during songs -->
<disable_keysounds __type="bool">0</disable_keysounds>
<!-- Offset the keysounds by x ms (negative is earlier). With disable_keysounds, becomes an audio offset -->

View File

@ -51,7 +51,6 @@ struct popnhax_config {
uint8_t survival_gauge;
bool survival_iidx;
bool survival_spicy;
int8_t base_offset;
};
#endif

View File

@ -31,7 +31,7 @@
#include "SearchFile.h"
#define PROGRAM_VERSION "1.10.dev"
#define PROGRAM_VERSION "1.9c_rc2"
const char *g_game_dll_fn = NULL;
const char *g_config_fn = NULL;
@ -182,8 +182,6 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, hispeed_auto,
"/popnhax/hispeed_auto")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U16, struct popnhax_config, hispeed_default_bpm,
"/popnhax/hispeed_default_bpm")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_S8, struct popnhax_config, base_offset,
"/popnhax/base_offset")
PSMAP_END
enum BufferIndexes {
@ -454,13 +452,13 @@ void hook_read_hispeed()
__asm("add cx, 2\n");
__asm __volatile__("mov %0, byte ptr [ecx]\n":"=a"(g_mystery_bpm): :);
if (g_soflan_retry && ( g_mystery_bpm || g_low_bpm != g_hi_bpm ))
if (g_soflan_retry)
{
g_hispeed = g_soflan_retry_hispeed;
__asm("jmp apply_hispeed\n");
}
if ( g_bypass_hispeed || g_target_bpm == 0 ) //bypass for mystery BPM and soflan songs once hispeed has been manually changed (to avoid hi-speed being locked since target won't change)
if ( g_bypass_hispeed || g_target_bpm == 0 ) //bypass for mystery BPM and soflan songs (to avoid hi-speed being locked since target won't change)
{
__asm("jmp leave_read_hispeed\n");
}
@ -572,13 +570,6 @@ void hook_decrease_hispeed()
real_decrease_hispeed();
}
void (*real_leave_options)();
void retry_soflan_reset()
{
g_soflan_retry = false;
real_leave_options();
}
bool patch_hispeed_auto(uint8_t mode, uint16_t default_bpm)
{
DWORD dllSize = 0;
@ -659,25 +650,6 @@ bool patch_hispeed_auto(uint8_t mode, uint16_t default_bpm)
(void **)&real_decrease_hispeed);
}
/* set g_soflan_retry back to false when leaving options */
{
int64_t first_loc = search(data, dllSize, "\x0A\x00\x00\x83\xC0\x04\xBF\x0C\x00\x00\x00\xE8", 12, 0);
if (first_loc == -1) {
LOG("popnhax: auto hi-speed: cannot retrieve option screen loop function\n");
return false;
}
int64_t pattern_offset = search(data, 1000, "\x33\xC9\x51\x50\x8B", 5, first_loc);
if (pattern_offset == -1) {
LOG("popnhax: auto hi-speed: cannot retrieve option screen leave\n");
return false;
}
uint64_t patch_addr = (int64_t)data + pattern_offset;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)retry_soflan_reset,
(void **)&real_leave_options);
}
/* compute longest bpm for mode 3 */
if (mode == 3)
{
@ -5487,12 +5459,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
patch_disable_keysound();
}
if (config.base_offset){
patch_add_to_base_offset(config.base_offset);
}
if (config.keysound_offset){
/* must be called _after_ force_hd_timing and base_offset */
/* must be called _after_ force_hd_timing */
patch_keysound_offset(config.keysound_offset);
}