diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 2c9568f6..29539ace 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -152,7 +152,7 @@ segments: - [0xF3F680, c, code_1D00] # NONMATCHING - [0xF40490, c, pimanager] - [0xF40650, c, defragmanager] - - [0xF40850, c, code_2FA0] + - [0xF40850, c, stub_2FA0] - [0xF40A70, c, initthread] - [0xF40B00, c, code_3250] - [0xF41320, c, code_3A70] @@ -365,7 +365,7 @@ segments: - [0xF74830, .data, code_660] - [0xF74930, .data, code_1D00] - [0xF74A10, bin, data_37E30] #unreferenced - - [0xF74A20, .data, code_2FA0] + - [0xF74A20, .data, stub_2FA0] - [0xF74A30, .data, code_3250] - [0xF74A40, .data, code_3A70] - [0xF74A80, .data, code_5650] diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index 9214e686..f38d2785 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -152,7 +152,7 @@ segments: - [0xF1AF50, c, code_1D00] #DONE - [0xF1BE20, c, pimanager] - [0xF1BFF0, c, defragmanager] #DONE - - [0xF1C1F0, c, code_2FA0] #DONE + - [0xF1C1F0, c, stub_2FA0] #DONE - [0xF1C410, c, initthread] #DONE - [0xF1C4A0, c, code_3250] #DONE - [0xF1CCC0, c, code_3A70] #DONE @@ -365,7 +365,7 @@ segments: - [0xF50EA0, .data, code_660] - [0xF50FA0, .data, code_1D00] - [0xF51080, bin, data_37E30] #unreferenced - - [0xF51090, .data, code_2FA0] + - [0xF51090, .data, stub_2FA0] - [0xF510A0, .data, code_3250] - [0xF510B0, .data, code_3A70] - [0xF510F0, .data, code_5650] diff --git a/src/core1/code_2FA0.c b/src/core1/code_2FA0.c deleted file mode 100644 index e64bc072..00000000 --- a/src/core1/code_2FA0.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include "core1/core1.h" -#include "functions.h" -#include "variables.h" - - - -s32 D_80275860 = 0; - -void func_802409C0(f32 arg0[3], f32 arg1){ - f32 vp_rotation[3]; - f32 sp30[3]; - f32 sp28[2]; - f32 dt; - - dt = time_getDelta()*arg1; - controller_getJoystick(0, sp28); - - sp30[0] = sp28[0] * dt; - sp30[1] = 0.0f; - sp30[2] = -(sp28[1] * dt); - - viewport_getRotation_vec3f(vp_rotation); - ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]); - - arg0[0] = arg0[0] + sp30[0]; - arg0[1] = arg0[1] + sp30[1]; - arg0[2] = arg0[2] + sp30[2]; -} - -void func_80240A74(f32 arg0[3]){ - func_802409C0(arg0, 400.0f); -} - -f32 func_80240A94(s32 arg0, f32 arg1){ - if(arg0 >= 0x29){ - arg0 = 0x28; - } - return arg1 + (f32)arg0*(arg1)/16 ; -} - -void func_80240AC8(f32 arg0[3], f32 arg1){ - f32 vp_rotation[3]; - f32 sp30[3]; - f32 sp28[2]; - f32 dt; - - dt = time_getDelta()*arg1; - controller_getJoystick(0, sp28); - - if(0.0f != sp28[0] || 0.0f != sp28[1]){ - D_80275860++; - if(D_80275860 >= 0x12D) - D_80275860 = 0x12C; - } - else{ - D_80275860 = 1; - } - - dt = func_80240A94(D_80275860, dt); - sp30[0] = sp28[0] * dt; - sp30[1] = 0.0f; - sp30[2] = -(sp28[1] * dt); - - viewport_getRotation_vec3f(vp_rotation); - ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]); - - arg0[0] = arg0[0] + sp30[0]; - arg0[1] = arg0[1] + sp30[1]; - arg0[2] = arg0[2] + sp30[2]; -} diff --git a/src/core1/stub_2FA0.c b/src/core1/stub_2FA0.c new file mode 100644 index 00000000..bf8b1e8a --- /dev/null +++ b/src/core1/stub_2FA0.c @@ -0,0 +1,75 @@ +#include +#include "core1/core1.h" +#include "functions.h" + +// all functions in this file are unsued + +void stub_802409C0(f32 position[3], f32 speed); +void stub_80240A74(f32 position[3]); +f32 stub_80240A94(s32 time_out, f32 arg1); +void stub_80240AC8(f32 position[3], f32 speed); + +static s32 sTimeout = 0; + +void stub_802409C0(f32 position[3], f32 speed) { + f32 vp_rotation[3]; + f32 delta_position[3]; + f32 joystick_data[2]; + f32 dt; + + dt = time_getDelta() * speed; + controller_getJoystick(0, joystick_data); + + delta_position[0] = joystick_data[0] * dt; + delta_position[1] = 0.0f; + delta_position[2] = -(joystick_data[1] * dt); + + viewport_getRotation_vec3f(vp_rotation); + ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]); + + position[0] = position[0] + delta_position[0]; + position[1] = position[1] + delta_position[1]; + position[2] = position[2] + delta_position[2]; +} + +void stub_80240A74(f32 position[3]) { + stub_802409C0(position, 400.0f); +} + +f32 stub_80240A94(s32 time_out, f32 delta_time) { + if (time_out > 40) + time_out = 40; + + return delta_time + (f32) time_out * delta_time / 16; +} + +void stub_80240AC8(f32 position[3], f32 speed) { + f32 vp_rotation[3]; + f32 delta_position[3]; + f32 joystick_data[2]; + f32 dt; + + dt = time_getDelta() * speed; + controller_getJoystick(0, joystick_data); + + if (0.0f != joystick_data[0] || 0.0f != joystick_data[1]) { + sTimeout++; + if (sTimeout > 300) + sTimeout = 300; + } else { + sTimeout = 1; + } + + dt = stub_80240A94(sTimeout, dt); + + delta_position[0] = joystick_data[0] * dt; + delta_position[1] = 0.0f; + delta_position[2] = -(joystick_data[1] * dt); + + viewport_getRotation_vec3f(vp_rotation); + ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]); + + position[0] = position[0] + delta_position[0]; + position[1] = position[1] + delta_position[1]; + position[2] = position[2] + delta_position[2]; +}