1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-14 02:16:10 +00:00

add more FrameInput functionality; needs module func offsets to compile

This commit is contained in:
jugeeya 2019-07-26 15:39:14 -07:00
parent d3765f4779
commit bb19bfcb4d
3 changed files with 57 additions and 11 deletions

@ -1 +1 @@
Subproject commit 6c6af7e05215f2f1fc251bf109631a7d7200ff0f
Subproject commit 56727022bc471c02595554c129b90390d905906a

View file

@ -15,7 +15,7 @@ typedef struct FrameInput {
FrameInput frame_inputs[NUM_FRAME_INPUTS];
int curr_frame = 0;
#define NUM_PRE_FRAME 60
#define NUM_PRE_FRAME 90
int curr_pre_frame = 0;
#define INPUT_PRE_RECORDING 1
@ -37,15 +37,16 @@ int get_command_flag_cat(u64 module_accessor, int category, int flag, bool& repl
; // Set color overlay to blue
else {
; // Reset color overlay
replace = true;
if (category == 0)
return frame_inputs[curr_frame].cat1_flag;
else if (category == 1)
return frame_inputs[curr_frame].cat2_flag;
else if (category == 2)
return frame_inputs[curr_frame].cat3_flag;
else if (category == 3)
return frame_inputs[curr_frame].cat4_flag;
replace = true;
if (category == 0)
return frame_inputs[curr_frame].cat1_flag;
else if (category == 1)
return frame_inputs[curr_frame].cat2_flag;
else if (category == 2)
return frame_inputs[curr_frame].cat3_flag;
else if (category == 3)
return frame_inputs[curr_frame].cat4_flag;
}
}
} else {

View file

@ -86,6 +86,42 @@ int get_command_flag_cat_replace(u64 module_accessor, int category) {
return flag;
}
int get_pad_flag(u64 module_accessor) {
u64 control_module = load_module(module_accessor, 0x48);
int (*get_pad_flag)(u64) = (int (*)(u64)) load_module_impl(control_module, GET_PAD_FLAG_FUNC_OFFSET);
int pad_flag = get_pad_flag(control_module);
bool replace;
int ret = InputRecorder::get_pad_flag(module_accessor, replace);
if (replace) return ret;
return pad_flag;
}
float get_stick_x_replace(u64 module_accessor) {
u64 control_module = load_module(module_accessor, 0x48);
float (*get_stick_x)(u64) = (float (*)(u64)) load_module_impl(control_module, GET_STICK_X_FUNC_OFFSET);
float stick_x = get_stick_x(control_module);
bool replace;
float ret = InputRecorder::get_stick_x(module_accessor, replace);
if (replace) return ret;
return stick_x;
}
float get_stick_y_replace(u64 module_accessor) {
u64 control_module = load_module(module_accessor, 0x48);
float (*get_stick_y)(u64) = (float (*)(u64)) load_module_impl(control_module, GET_STICK_Y_FUNC_OFFSET);
float stick_y = get_stick_y(control_module);
bool replace;
float ret = InputRecorder::get_stick_y(module_accessor, replace);
if (replace) return ret;
return stick_y;
}
bool check_button_on_replace(u64 module_accessor, int button) {
bool replace;
bool ret = Shield::check_button_on(module_accessor, button, replace);
@ -155,6 +191,15 @@ void training_mods_main() {
"_ZN3app8lua_bind39ControlModule__get_attack_air_kind_implEPNS_26BattleObjectModuleAccessorE",
(u64)&ControlModule::get_attack_air_kind_replace);
// Input recorder
SaltySD_function_replace_sym(
"_ZN3app8lua_bind31ControlModule__get_stick_x_implEPNS_26BattleObjectModuleAccessorE",
(u64)&ControlModule::get_stick_x_replace);
SaltySD_function_replace_sym(
"_ZN3app8lua_bind31ControlModule__get_stick_y_implEPNS_26BattleObjectModuleAccessorE",
(u64)&ControlModule::get_stick_y_replace);
Selection::menu_replace();
}