Camera Toggle [JoshuaMK]
#4
First thing's first. I checked every port for every address (address of ASM, address of ur nop, address of camera height, address of camera distance), and they are all Good.

I did some changes to your source, and made it more organized. I also rerouted some non-optimized branch routes, and added branch hints. So when you compile this, you will need to change the region letter at the top for each version you compiled (it is left blank at the moment). They will all compile slightly different. Ofc, don't forget to remove the 0x3E80 & 0x0880 from the compiled code for the user's controller stuff, and don't forget to test this with your 32 bit nop.

I'm still out of town, so I can't actually test this in game.

If you want to change this to a C0 (assuming this new source works on all regions after tests), you just need to change your use of r4 to r5, then remove the vannila instruction (leave the label name there, you can end sources with a label name). For C0 codes, select the C0 option in PyiiASMH before compiling.

Anyway, here's the source...


.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.

.if (region == 'E' || region == 'e') # RMCE
lis r11, 0x8034
.elseif (region == 'P' || region == 'p') # RMCP
lis r11, 0x8034
.elseif (region == 'J' || region == 'j') # RMCJ
lis r11, 0x8034
.elseif (region == 'K' || region == 'k') # RMCK
lis r11, 0x8033
.else # Invalid Region
.abort
.endif

ori r11, r11, 0x3E80 #NTSC-U GCN used just for compilation
lhz r11, 0 (r11)

lis r12, 0x8170 #Set Mem81 address, 1st Half, used offset for 2nd half

andi. r0, r11, 0x0880 #Y button used just for compilation
cmpwi r0, 0x0880 #Check if button is at least pressed
bne+ reset_timer #Reset Timer Back to 0 if no Y Button Press

lbz r11, 0x0F00 (r12) #Load Timer Value
addi r11, r11, 1 #Increment Timer

cmplwi r11, 150
blt+ dont_reset_timer #If not greater than 150, do NOT reset timer

reset_timer:
li r11, 0 #Once timer goes pass 150, reset it

dont_reset_timer:
stb r11, 0x0F00 (r12) #Store updated Timer Value
cmpwi r11, 2 #Check if value is 2 (time to update camera)
bne- no_change #If not 2, skip already down to vannila instruction

#Set Camera Height Address

.if (region == 'E' || region == 'e') # RMCE
lis r12, 0x8088
ori r12, r12, 0xDBD0
.elseif (region == 'P' || region == 'p') # RMCP
lis r12, 0x8089
ori r12, r12, 0x2310
.elseif (region == 'J' || region == 'j') # RMCJ
lis r12, 0x8089
ori r12, r12, 0x1960
.elseif (region == 'K' || region == 'k') # RMCK
lis r12, 0x8088
ori r12, r12, 0x0718
.else # Invalid Region
.abort
.endif

lhz r11, 0 (r12)

cmpwi r11, 0x3f50 #Compare Camera Height to "Close Up" Setting
beq- far_out #If Equal, Set Camera to "Far Out"

cmpwi r11, 0x3fb0 #Compare Camera Height to "Far Out" Setting
beq- normal_value #If Equal, Set Camera to "Normal"

li r11, 0x3f50
li r4, 0x3ecd
b store_value

far_out:
li r11, 0x3fb0
li r4, 0x3f10
b store_value

normal_value:
li r11, 0x3f80
li r4, 0x3f00

store_value:
sth r11, 0 (r12) #Store New Camera Height to Proper RAM Address
sth r4, 0x0014 (r12) #Offset 0x0014 From Camera Height is Camera Distance. Store Camera Distance There.

no_change:
mr r30, r3 #Vannila Instruction

Reply


Messages In This Thread
Camera Toggle [JoshuaMK] - by JoshuaMK - 07-08-2019, 02:43 AM
RE: Camera Toggle - by Vega - 07-09-2019, 01:26 AM
RE: Camera Toggle - by JoshuaMK - 07-09-2019, 03:22 AM
RE: Camera Toggle - by Vega - 07-09-2019, 07:54 PM
RE: Camera Toggle - by JoshuaMK - 07-09-2019, 08:23 PM
RE: Camera Toggle - by Vega - 07-09-2019, 08:34 PM
RE: Camera Toggle - by JoshuaMK - 07-09-2019, 08:58 PM
RE: Camera Toggle - by JoshuaMK - 07-09-2019, 11:35 PM
RE: Camera Toggle - by Vega - 07-09-2019, 11:42 PM
RE: Camera Toggle - by JoshuaMK - 07-10-2019, 01:03 AM
RE: Camera Toggle - by Vega - 07-10-2019, 08:23 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)