09-21-2019, 10:09 PM
This was a code I was wanting to keep to myself until completed, but I just simply can't figure out why the camera's params are corrupting when the camera's angleĀ float values are subtracted from. If I or some other person can figure this out, I can continue with this code. Currently only tilting up or right works. Down and left corrupt everything.
Free Look [JoshuaMK]
28343E80 F7FF0800
C2597F54 0000002A
3D808034 618CC202
3FA08145 8BFD01FF
281F0000 40A20014
999D01FF D05D0200
D01D0204 D03D0208
C05D0200 C01D0204
C03D0208 A3CCFFFE
892C0000 888C0001
886C0002 88AC0003
3929FF80 3884FF80
3863FF80 38A5FF80
2C090041 41810014
2C09FFBF 41810010
3920FFBF 48000008
39200041 2C040041
41810014 2C04FFBF
41810010 3880FFBF
48000008 38800041
2C030041 41810014
2C03FFBF 41810010
3860FFBF 48000008
38600041 2C030041
4181FFF8 2C05FFBF
41810010 38A0FFBF
48000008 38A00041
993D020C 989D0210
987D0214 98BD0218
2C03000F 41810010
2C03FFF1 41800008
4800000C C3FD0214
EC42F82A 2C05000F
41810010 2C05FFF1
41800008 4800000C
C3DD0218 EC00F02A
2C1E0090 40820020
2C05000F 41810010
2C05FFF1 41800008
4800000C C3BD0218
EC21E82A D05D0200
D01D0204 D03D0208
D05C00AC D03C00B4
D01C00B0 00000000
CC000000 00000000
04597F54 D01C00B0
054501FF 00000000
E0000000 80008000
#ASM
#~~~~~~~~~~~#
#Inject > 80597F54#
#~~~~~~~~~~~#
#PARAMS for camera angle
#--------------------------
#f2 = X Axis Position
#f1 = Z Axis Position
#f0 = Y Axis Position
.macro grab_controller_address
lis r12, 0x8034
ori r12, r12, 0xC202
.endm
.macro grab_camera_params
lis r29, 0x8145
lbz r31, 0x01FF (r29)
cmplwi r31, 0
bne+ params_set
stb r12, 0x01FF (r29)
stfs f2, 0x0200 (r29)
stfs f0, 0x0204 (r29)
stfs f1, 0x0208 (r29)
params_set:
lfs f2, 0x0200 (r29)
lfs f0, 0x0204 (r29)
lfs f1, 0x0208 (r29)
.endm
.macro store_floats
stfs f2, 0x0200 (r29)
stfs f0, 0x0204 (r29)
stfs f1, 0x0208 (r29)
stfs f2, 0x00AC (r28)
stfs f1, 0x00B4 (r28)
stfs f0, 0x00B0 (r28)
.endm
.macro subtract
subi r9, r9, 0x80
subi r4, r4, 0x80
subi r3, r3, 0x80
subi r5, r5, 0x80
.endm
.macro divide
li r11, 0x4
divw r9, r9, r11
divw r4, r4, r11
divw r3, r3, r11
divw r5, r5, r11
.endm
.macro multiply
mulli r9, r9, 3
mulli r4, r4, 3
mulli r3, r3, 3
mulli r5, r5, 3
.endm
.macro compare_statements
cmpwi r9, 0x41
bgt shrink_r9
cmpwi r9, -0x41
bgt continue
li r9, -0x41
b continue
shrink_r9:
li r9, 0x41
continue:
cmpwi r4, 0x41
bgt shrink_r4
cmpwi r4, -0x41
bgt continue_1
li r4, -0x41
b continue_1
shrink_r4:
li r4, 0x41
continue_1:
cmpwi r3, 0x41
bgt shrink_r3
cmpwi r3, -0x41
bgt continue_2
li r3, -0x41
b continue_2
shrink_r3:
li r3, 0x41
continue_2:
cmpwi r5, 0x41
bgt shrink_r5
cmpwi r5, -0x41
bgt continue_3
li r5, -0x41
b continue_3
shrink_r5:
li r5, 0x41
continue_3:
.endm
.macro figure_controller_values
lhz r30, -0x2 (r12)
lbz r9, 0 (r12)
lbz r4, 0x1 (r12)
lbz r3, 0x2 (r12)
lbz r5, 0x3 (r12)
subtract
compare_statements
stb r9, 0x020C (r29)
stb r4, 0x0210 (r29)
stb r3, 0x0214 (r29)
stb r5, 0x0218 (r29)
.endm
.macro compare_and_add
cmpwi r3, 15
bgt add_f31
cmpwi r3, -15
blt add_f31
b check_vertical
add_f31:
lfs f31, 0x0214 (r29)
fadds f2, f2, f31
check_vertical:
cmpwi r5, 15
bgt add_f30
cmpwi r5, -15
blt add_f30
b check_z
add_f30:
lfs f30, 0x0218 (r29)
fadds f0, f0, f30
check_z:
cmpwi r30, 0x0090
bne the_end
cmpwi r5, 15
bgt add_f29
cmpwi r5, -15
blt add_f29
b the_end
add_f29:
lfs f29, 0x0218 (r29)
fadds f1, f1, f29
the_end:
.endm
grab_controller_address
grab_camera_params
figure_controller_values
compare_and_add
store_floats
I don't expect anything to come from this, but I wanted to try all options.
Free Look [JoshuaMK]
28343E80 F7FF0800
C2597F54 0000002A
3D808034 618CC202
3FA08145 8BFD01FF
281F0000 40A20014
999D01FF D05D0200
D01D0204 D03D0208
C05D0200 C01D0204
C03D0208 A3CCFFFE
892C0000 888C0001
886C0002 88AC0003
3929FF80 3884FF80
3863FF80 38A5FF80
2C090041 41810014
2C09FFBF 41810010
3920FFBF 48000008
39200041 2C040041
41810014 2C04FFBF
41810010 3880FFBF
48000008 38800041
2C030041 41810014
2C03FFBF 41810010
3860FFBF 48000008
38600041 2C030041
4181FFF8 2C05FFBF
41810010 38A0FFBF
48000008 38A00041
993D020C 989D0210
987D0214 98BD0218
2C03000F 41810010
2C03FFF1 41800008
4800000C C3FD0214
EC42F82A 2C05000F
41810010 2C05FFF1
41800008 4800000C
C3DD0218 EC00F02A
2C1E0090 40820020
2C05000F 41810010
2C05FFF1 41800008
4800000C C3BD0218
EC21E82A D05D0200
D01D0204 D03D0208
D05C00AC D03C00B4
D01C00B0 00000000
CC000000 00000000
04597F54 D01C00B0
054501FF 00000000
E0000000 80008000
#ASM
#~~~~~~~~~~~#
#Inject > 80597F54#
#~~~~~~~~~~~#
#PARAMS for camera angle
#--------------------------
#f2 = X Axis Position
#f1 = Z Axis Position
#f0 = Y Axis Position
.macro grab_controller_address
lis r12, 0x8034
ori r12, r12, 0xC202
.endm
.macro grab_camera_params
lis r29, 0x8145
lbz r31, 0x01FF (r29)
cmplwi r31, 0
bne+ params_set
stb r12, 0x01FF (r29)
stfs f2, 0x0200 (r29)
stfs f0, 0x0204 (r29)
stfs f1, 0x0208 (r29)
params_set:
lfs f2, 0x0200 (r29)
lfs f0, 0x0204 (r29)
lfs f1, 0x0208 (r29)
.endm
.macro store_floats
stfs f2, 0x0200 (r29)
stfs f0, 0x0204 (r29)
stfs f1, 0x0208 (r29)
stfs f2, 0x00AC (r28)
stfs f1, 0x00B4 (r28)
stfs f0, 0x00B0 (r28)
.endm
.macro subtract
subi r9, r9, 0x80
subi r4, r4, 0x80
subi r3, r3, 0x80
subi r5, r5, 0x80
.endm
.macro divide
li r11, 0x4
divw r9, r9, r11
divw r4, r4, r11
divw r3, r3, r11
divw r5, r5, r11
.endm
.macro multiply
mulli r9, r9, 3
mulli r4, r4, 3
mulli r3, r3, 3
mulli r5, r5, 3
.endm
.macro compare_statements
cmpwi r9, 0x41
bgt shrink_r9
cmpwi r9, -0x41
bgt continue
li r9, -0x41
b continue
shrink_r9:
li r9, 0x41
continue:
cmpwi r4, 0x41
bgt shrink_r4
cmpwi r4, -0x41
bgt continue_1
li r4, -0x41
b continue_1
shrink_r4:
li r4, 0x41
continue_1:
cmpwi r3, 0x41
bgt shrink_r3
cmpwi r3, -0x41
bgt continue_2
li r3, -0x41
b continue_2
shrink_r3:
li r3, 0x41
continue_2:
cmpwi r5, 0x41
bgt shrink_r5
cmpwi r5, -0x41
bgt continue_3
li r5, -0x41
b continue_3
shrink_r5:
li r5, 0x41
continue_3:
.endm
.macro figure_controller_values
lhz r30, -0x2 (r12)
lbz r9, 0 (r12)
lbz r4, 0x1 (r12)
lbz r3, 0x2 (r12)
lbz r5, 0x3 (r12)
subtract
compare_statements
stb r9, 0x020C (r29)
stb r4, 0x0210 (r29)
stb r3, 0x0214 (r29)
stb r5, 0x0218 (r29)
.endm
.macro compare_and_add
cmpwi r3, 15
bgt add_f31
cmpwi r3, -15
blt add_f31
b check_vertical
add_f31:
lfs f31, 0x0214 (r29)
fadds f2, f2, f31
check_vertical:
cmpwi r5, 15
bgt add_f30
cmpwi r5, -15
blt add_f30
b check_z
add_f30:
lfs f30, 0x0218 (r29)
fadds f0, f0, f30
check_z:
cmpwi r30, 0x0090
bne the_end
cmpwi r5, 15
bgt add_f29
cmpwi r5, -15
blt add_f29
b the_end
add_f29:
lfs f29, 0x0218 (r29)
fadds f1, f1, f29
the_end:
.endm
grab_controller_address
grab_camera_params
figure_controller_values
compare_and_add
store_floats
I don't expect anything to come from this, but I wanted to try all options.
Super Mario Eclipse, what Super Mario Sunshine could've been.