Memory Editor [Vega]
#1
Memory Editor [Vega]

This code will allow you to view and edit any section of Memory. In regards to editing Memory, only word writes can be done. Once the game loads past the Boot Strap screen, the Memory Editor will appear.

The top word field is the location in Memory that you are currently viewing. Starts at 0x80000000.
The word field below that is your temp field to edit in a value to navigate to Memory or write in to Memory. Starts as 0x80000000.
Once you have navigated to a new spot, the top field will auto update. View the button keymap below for instructions on how to fill out your controller values.

Button Keymap:
XXXX = Controller Address
RRRR = Button to increase digit in temp field
SSSS = Button to decrease digit in temp field
TTTT = Button to move left on temp field
UUUU = Button to move right on temp field
YYYY = Button to use value in temp field to navigate to new spot in Memory
ZZZZ = Button to use value in temp field to write to Memory.

For safety reasons, you must release all other buttons when using a button in the keymap.

The code makes use of the follow memory addresses:
0x800003B0 thru 0x800003BF
0x80000DD0 thru 0x80000E7A

Make sure no other codes in your GCT/Cheat-Manager are using those addresses!

Video demo - https://www.youtube.com/watch?v=_wu6zjNX-GE

NTSC-U
C20221C8 00000004
3D80CC00 8ACC201D
56D6801E A18C201E
7D8CB378 558C2834
658C8000 00000000
C200A3F0 00000007
9421FF80 BC610008
806DA358 80630044
80630000 3D808002
618C23E0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009640 0000004C
9421FF80 BC610008
3FA08000 3F802020
639C2020 3B60005E
881D03B8 2C000000
40A20020 93BD03B0
93BD03B4 939D0DE2
939D0DE6 9B7D0DE2
38000001 981D03B8
3C608034 6063XXXX
A0030000 2800RRRR
4182003C 2800SSSS
41820040 2800TTTT
41820080 2800UUUU
4182008C 2800YYYY
418200D4 2800ZZZZ
418200EC 38000000
901D03BA B01D03BE
4800010C 386003BA
38800001 4800000C
386003BB 38800000
7C03E8AE 2C000001
41820094 38000001
88BD03B9 80DD03B4
3CE01000 54A5103A
7CE52C30 2C040001
40A2000C 7CC53214
48000008 7CC53050
90DD03B4 48000060
386003BC 3880FFFF
38A0FFFF 38C00000
48000014 386003BD
38800001 38A00008
38C00007 7C03E8AE
2C000001 41820030
38000001 88FD03B9
7CE72214 7C072800
40A20008 7CC73378
98FD03B9 939D0DE2
939D0DE6 38E70DE2
7F67E9AE 7C03E9AE
48000054 881D03BE
2C000001 41820010
38000001 807D03B4
907D03B0 981D03BE
48000034 881D03BF
2C000001 41820024
38000001 807D03B0
809D03B4 90830000
7C00186C 7C0004AC
7C001FAC 4C00012C
981D03BF 387D0DD0
48000011 25303858
0A253038 580A0000
7C8802A6 80BD03B0
80DD03B4 8B5D0DE2
3D808001 618C0ECC
7D8803A6 4E800021
9B5D0DE2 3B3D0DC6
835D03B0 3B5AFFF0
3B000004 3B390024
7F23CB78 3B5A0010
7CBA84AA 4800001D
0A253038 58202530
38582025 30385820
25303858 00000000
7C8802A6 3D808001
618C0ECC 7D8803A6
4E800021 3718FFFF
4082FFBC 38600005
38800090 38A00001
63A60DD0 3FE08002
63FE1DF0 7FC803A6
4E800021 63FE1DD0
7FC803A6 4E800021
B8610008 38210080
81830000 00000000

PAL
C2022268 00000004
3D80CC00 8ACC201D
56D6801E A18C201E
7D8CB378 558C2834
658C8000 00000000
C200A430 00000007
9421FF80 BC610008
806DA360 80630044
80630000 3D808002
618C2480 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009680 0000004C
9421FF80 BC610008
3FA08000 3F802020
639C2020 3B60005E
881D03B8 2C000000
40A20020 93BD03B0
93BD03B4 939D0DE2
939D0DE6 9B7D0DE2
38000001 981D03B8
3C608034 6063XXXX
A0030000 2800RRRR
4182003C 2800SSSS
41820040 2800TTTT
41820080 2800UUUU
4182008C 2800YYYY
418200D4 2800ZZZZ
418200EC 38000000
901D03BA B01D03BE
4800010C 386003BA
38800001 4800000C
386003BB 38800000
7C03E8AE 2C000001
41820094 38000001
88BD03B9 80DD03B4
3CE01000 54A5103A
7CE52C30 2C040001
40A2000C 7CC53214
48000008 7CC53050
90DD03B4 48000060
386003BC 3880FFFF
38A0FFFF 38C00000
48000014 386003BD
38800001 38A00008
38C00007 7C03E8AE
2C000001 41820030
38000001 88FD03B9
7CE72214 7C072800
40A20008 7CC73378
98FD03B9 939D0DE2
939D0DE6 38E70DE2
7F67E9AE 7C03E9AE
48000054 881D03BE
2C000001 41820010
38000001 807D03B4
907D03B0 981D03BE
48000034 881D03BF
2C000001 41820024
38000001 807D03B0
809D03B4 90830000
7C00186C 7C0004AC
7C001FAC 4C00012C
981D03BF 387D0DD0
48000011 25303858
0A253038 580A0000
7C8802A6 80BD03B0
80DD03B4 8B5D0DE2
3D808001 618C1A2C
7D8803A6 4E800021
9B5D0DE2 3B3D0DC6
835D03B0 3B5AFFF0
3B000004 3B390024
7F23CB78 3B5A0010
7CBA84AA 4800001D
0A253038 58202530
38582025 30385820
25303858 00000000
7C8802A6 3D808001
618C1A2C 7D8803A6
4E800021 3718FFFF
4082FFBC 38600005
38800090 38A00001
63A60DD0 3FE08002
63FE1E90 7FC803A6
4E800021 63FE1E70
7FC803A6 4E800021
B8610008 38210080
81830000 00000000

NTSC-J
C2022188 00000004
3D80CC00 8ACC201D
56D6801E A18C201E
7D8CB378 558C2834
658C8000 00000000
C200A38C 00000007
9421FF80 BC610008
806DA360 80630044
80630000 3D808002
618C23A0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C20095DC 0000004C
9421FF80 BC610008
3FA08000 3F802020
639C2020 3B60005E
881D03B8 2C000000
40A20020 93BD03B0
93BD03B4 939D0DE2
939D0DE6 9B7D0DE2
38000001 981D03B8
3C608034 6063XXXX
A0030000 2800RRRR
4182003C 2800SSSS
41820040 2800TTTT
41820080 2800UUUU
4182008C 2800YYYY
418200D4 2800ZZZZ
418200EC 38000000
901D03BA B01D03BE
4800010C 386003BA
38800001 4800000C
386003BB 38800000
7C03E8AE 2C000001
41820094 38000001
88BD03B9 80DD03B4
3CE01000 54A5103A
7CE52C30 2C040001
40A2000C 7CC53214
48000008 7CC53050
90DD03B4 48000060
386003BC 3880FFFF
38A0FFFF 38C00000
48000014 386003BD
38800001 38A00008
38C00007 7C03E8AE
2C000001 41820030
38000001 88FD03B9
7CE72214 7C072800
40A20008 7CC73378
98FD03B9 939D0DE2
939D0DE6 38E70DE2
7F67E9AE 7C03E9AE
48000054 881D03BE
2C000001 41820010
38000001 807D03B4
907D03B0 981D03BE
48000034 881D03BF
2C000001 41820024
38000001 807D03B0
809D03B4 90830000
7C00186C 7C0004AC
7C001FAC 4C00012C
981D03BF 387D0DD0
48000011 25303858
0A253038 580A0000
7C8802A6 80BD03B0
80DD03B4 8B5D0DE2
3D808001 618C1950
7D8803A6 4E800021
9B5D0DE2 3B3D0DC6
835D03B0 3B5AFFF0
3B000004 3B390024
7F23CB78 3B5A0010
7CBA84AA 4800001D
0A253038 58202530
38582025 30385820
25303858 00000000
7C8802A6 3D808001
618C1950 7D8803A6
4E800021 3718FFFF
4082FFBC 38600005
38800090 38A00001
63A60DD0 3FE08002
63FE1DB0 7FC803A6
4E800021 63FE1D90
7FC803A6 4E800021
B8610008 38210080
81830000 00000000

NTSC-K
C20222C8 00000004
3D80CC00 8ACC201D
56D6801E A18C201E
7D8CB378 558C2834
658C8000 00000000
C200A538 00000007
9421FF80 BC610008
806DA380 80630044
80630000 3D808002
618C24E0 7D8803A6
4E800021 B8610008
38210080 80010014
60000000 00000000
C2009788 0000004C
9421FF80 BC610008
3FA08000 3F802020
639C2020 3B60005E
881D03B8 2C000000
40A20020 93BD03B0
93BD03B4 939D0DE2
939D0DE6 9B7D0DE2
38000001 981D03B8
3C608033 6063XXXX
A0030000 2800RRRR
4182003C 2800SSSS
41820040 2800TTTT
41820080 2800UUUU
4182008C 2800YYYY
418200D4 2800ZZZZ
418200EC 38000000
901D03BA B01D03BE
4800010C 386003BA
38800001 4800000C
386003BB 38800000
7C03E8AE 2C000001
41820094 38000001
88BD03B9 80DD03B4
3CE01000 54A5103A
7CE52C30 2C040001
40A2000C 7CC53214
48000008 7CC53050
90DD03B4 48000060
386003BC 3880FFFF
38A0FFFF 38C00000
48000014 386003BD
38800001 38A00008
38C00007 7C03E8AE
2C000001 41820030
38000001 88FD03B9
7CE72214 7C072800
40A20008 7CC73378
98FD03B9 939D0DE2
939D0DE6 38E70DE2
7F67E9AE 7C03E9AE
48000054 881D03BE
2C000001 41820010
38000001 807D03B4
907D03B0 981D03BE
48000034 881D03BF
2C000001 41820024
38000001 807D03B0
809D03B4 90830000
7C00186C 7C0004AC
7C001FAC 4C00012C
981D03BF 387D0DD0
48000011 25303858
0A253038 580A0000
7C8802A6 80BD03B0
80DD03B4 8B5D0DE2
3D808001 618C1A94
7D8803A6 4E800021
9B5D0DE2 3B3D0DC6
835D03B0 3B5AFFF0
3B000004 3B390024
7F23CB78 3B5A0010
7CBA84AA 4800001D
0A253038 58202530
38582025 30385820
25303858 00000000
7C8802A6 3D808001
618C1A94 7D8803A6
4E800021 3718FFFF
4082FFBC 38600005
38800090 38A00001
63A60DD0 3FE08002
63FE1EF0 7FC803A6
4E800021 63FE1ED0
7FC803A6 4E800021
B8610008 38210080
81830000 00000000



Code creator: Vega
Code credits: Star & RiiDefi (Draw code), _tZ (No Flicker), Unnamed (Logical comparison fix to account for >=0x8000 button values)



List of Sources:

1st ASM (No Flickering)

#Address Ports
#800221C8 = NTSC-U
#80022268 = PAL
#80022188 = NTSC-J
#800222C8 = NTSC-K

lis r12,-13312
lbz r22,8221(r12)
rlwinm r22,r22,16,0,15
lhz r12,8222(r12)
or r12,r12,r22
rlwinm r12,r12,5,0,26
oris r12,r12,32768

================================

2nd ASM (When Game loads StaticR.rel, Get Render Mode & Call Direct Print Setup Frame Buffer)

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~#
# Address Ports #
#~~~~~~~~~~~~~~~#

#NTSC-U = 0x8000A3F0
#PAL = 0x8000A430
#NTSC-J = 0x8000A38C
#NTSC-K = 0x8000A538

#~~~~~~~~~~~~~~~~#
# Register Notes #
#~~~~~~~~~~~~~~~~#

#No need to backup r0 or LR

#~~~~~~~~~~~~~~~~~~~~~#
# Macros & Statements #
#~~~~~~~~~~~~~~~~~~~~~#

.macro push_stack
    stwu r1, -0x80 (sp)
    stmw r3, 0x8 (sp)
.endm

.macro pop_stack
    lmw r3, 0x8 (sp)
    addi r1, r1, 0x80
.endm

.macro call_link address
    lis r12, \address@h
    ori r12, r12, \address@l
    mtlr r12
    blrl
.endm

.macro default_instruction
    lwz r0, 0x0014 (sp)
.endm

.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE
    .set nw4r_db_DirectPrint_SetupFB, 0x800223E0
.elseif (region == 'P' || region == 'p') # RMCP
    .set nw4r_db_DirectPrint_SetupFB, 0x80022480
.elseif (region == 'J' || region == 'j') # RMCJ
    .set nw4r_db_DirectPrint_SetupFB, 0x800223A0
.elseif (region == 'K' || region == 'k') # RMCK
    .set nw4r_db_DirectPrint_SetupFB, 0x800224E0
.else # Invalid Region
    .err
.endif

#~~~~~~~~~~~~~~~~~~~~~~~#
# Start Register Safety #
#~~~~~~~~~~~~~~~~~~~~~~~#

push_stack

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Get Render Mode (RKSystem->mpVideo()->pRenderMode) #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
    lwz r3, -0x5CA8 (r13)
.elseif (region == 'P' || region == 'p') # RMCP
    lwz r3, -0x5CA0 (r13)
.elseif (region == 'J' || region == 'j') # RMCJ
    lwz r3, -0x5CA0 (r13)
.elseif (region == 'K' || region == 'k') # RMCK
    lwz r3, -0x5C80 (r13)
.else # Invalid Region
    .err
.endif

lwz r3, 0x0044(r3)
lwz r3, 0 (r3)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Call nw4r::db: DirectPrint_SetupFB #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#r3 = Render Mode

call_link nw4r_db_DirectPrint_SetupFB

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# End Register Safety; Default Instruction #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

pop_stack
default_instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#

===============================

3rd ASM (Grab RAM Data, Convert it all to ASCII, Handle Button Statuses, Draw RAM on Screen)

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~#
# Address Ports #
#~~~~~~~~~~~~~~~#

#NTSC-U = 80009640
#PAL = 80009680
#NTSC-J = 800095DC
#NTSC-K = 80009788

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Compilation Region Setting #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

.set region, '' #Set this to e,p,j, or k

#~~~~~~~~#
# Macros #
#~~~~~~~~#

.macro push_stack
    stwu sp, -0x80 (sp)
    stmw r3, 0x8 (sp)
.endm

.macro pop_stack
    lmw r3, 0x8 (sp)
    addi sp, sp, 0x80
.endm

.macro call_link address
    lis r12, \address@h
    ori r12, r12, \address@l
    mtlr r12
    blrl
.endm

.macro call_nw4r address
    ori r30, r31, \address@l
    mtlr r30
    blrl
.endm

.macro default_instruction
    lwz r12, 0 (r3)
.endm

#~~~~~~~~~~~~#
# Statements #
#~~~~~~~~~~~~#

.if (region == 'E' || region == 'e') # RMCE
    .set nw4r_db_DirectPrint_Printf, 0x1DF0
    .set nw4r_db_DirectPrint_StoreCache, 0x1DD0
    .set sprintf, 0x80010ECC
.elseif (region == 'P' || region == 'p') # RMCP
    .set nw4r_db_DirectPrint_Printf, 0x1E90
    .set nw4r_db_DirectPrint_StoreCache, 0x1E70
    .set sprintf, 0x80011A2C
.elseif (region == 'J' || region == 'j') # RMCJ
    .set nw4r_db_DirectPrint_Printf, 0x1DB0
    .set nw4r_db_DirectPrint_StoreCache, 0x1D90
    .set sprintf, 0x80011950
.elseif (region == 'K' || region == 'k') # RMCK
    .set nw4r_db_DirectPrint_Printf, 0x1EF0
    .set nw4r_db_DirectPrint_StoreCache, 0x1ED0
    .set sprintf, 0x80011A94
.else # Invalid Region
    .err
.endif

#~~~~~~~~~~~~~~~~~~~~~~~~~#
# Register & Memory Notes #
#~~~~~~~~~~~~~~~~~~~~~~~~~#

#No need to backup r0 or LR
#r31 = Part of nw4r macro
#r30 = Part of nw4r macro
#r29 = 0x80000000
#r28 = 0x20202020 #ASCII spaces
#r27 = 0x5E #ASCII "^"

#0x800003B0 = Address for start of RAM being displayed
#0x800003B4 = Temp Value field
#0x800003B8 = Byte to indicate if code has been executed after first time
#0x800003B9 = Left/Right Digit Max/Min Checker
#0x800003BA = Up Status
#0x800003BB = Down Status
#0x800003BC = Left Status
#0x800003BD = Right Status
#0x800003BE = RAM Address Enter Status
#0x800003BF = Write Value Enter Status

#0x80000DD0 (double word) = Current Viewing memory address
#0x80000DD8 (byte) = ASCII enter (0xA)
#0x80000DD9 (double word) = Temp Value field for writing values or updating viewing address
#0x80000DE1 (byte) = ASCII enter (0xA)
#0x80000DE2 (word) = The space field where the ASCII "^" (0x5E) is contained at
#0x80000DEA (byte) = ASCII enter (0xA)
#0x80000DEB thru 0x80000E7A = Contents of 4 rows of RAM in ASCII, appeneded with null byte

#~~~~~~~~~~~~~~~~~~~~~~#
# Push Stack, Set GPRs #
#~~~~~~~~~~~~~~~~~~~~~~#

push_stack
lis r29, 0x8000
lis r28, 0x2020
ori r28, r28, 0x2020
li r27, 0x5E #"^"

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Check If First Run Thru Of Code Has Been Done #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lbz r0, 0x03B8 (r29)
cmpwi r0, 0
bne+ skip_initial_setup

#fyi: 0x800003B9 digit slot left/right tracker already set to 0
stw r29, 0x03B0 (r29) #Store 0x80000000 to both RAM Address and Tep Value
stw r29, 0x03B4 (r29)
stw r28, 0xDE2 (r29) #Setup the space field
stw r28, 0xDE6 (r29)
stb r27, 0xDE2 (r29) #place "^" at beginning of space field (to represent digit slot tracker value of 0)

li r0, 1
stb r0, 0x03B8 (r29) #Now write flag to make sure first time setup isn't ran again

skip_initial_setup:

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set Controller Address & Load Inputs #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

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

ori r3, r3, 0x8200 #XXXX Controller Address; GCN PAL Port 1 used just for compilation
lhz r0, 0x0 (r3)

#~~~~~~~~~~~~~~#
# Check Inputs #
#~~~~~~~~~~~~~~#

cmplwi r0, 0x88 #Up #GCN Up used just for compilation
beq- up
cmplwi r0, 0x84 #Down #GCN Down used just for compilation
beq- down
cmplwi r0, 0x81 #Left #GCN Left used just for compilation
beq- left
cmplwi r0, 0x82 #Right #GCN Right used just for compilation
beq- right
cmplwi r0, 0x0480 #RAM Address Enter GCN X used just for compilation
beq- enter
cmplwi r0, 0x0880 #Write Value Enter; GCN Y used just for compilation
beq- write

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Nothing Pressed, Set Null on All Button Statuses #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r0, 0
stw r0, 0x03BA (r29)
sth r0, 0x03BE (r29)
b real_temp_sprintf

#~~~~~~~~~~~~~~~~~~~~~~#
# Button Status Checks #
#~~~~~~~~~~~~~~~~~~~~~~#

#r0 = Status
#0 = Not Pressed
#1 = Pressed

#~~~~~~~~~~~#
# Up / Down #
#~~~~~~~~~~~#

up:
li r3, 0x03BA #Offset
li r4, 1 #Flag for adding

b up_down

down:
li r3, 0x03BB #Offset
li r4, 0 #Flag for subtracting

up_down:
lbzx r0, r3, r29 #Load Up/Down Status, 0x998 for Up, 0x0999 for Down
cmpwi r0, 1
beq- store_updownleftright

li r0, 1

lbz r5, 0x03B9 (r29) #Load left/right digit slot tracker
lwz r6, 0x03B4 (r29) #Load Temp Value for Temp Display

lis r7, 0x1000 #Set Digit 1 on far left digit of register, this will be moved according to bits later calculated on the slwi instruction
slwi r5, r5, 2 #Multiply digit slot tracker by 4. This will give up amount of total bits to shift right the digit "1" by
srw r5, r7, r5 #Now shift right the digit '1' by the bit amount in r5. This setup the 'column' to add/subtract on

cmpwi r4, 1
bne+ decrement_down

add r6, r5, r6 #Increment Temp Value
b update_fake

decrement_down:
subf r6, r5, r6 #Decrement Temp Value

update_fake:
stw r6, 0x03B4 (r29) #Store updated Temp Value, NO Update on digit slot tracker, that covers left/right pos

b store_updownleftright

#~~~~~~~~~~~~~~#
# Left / Right #
#~~~~~~~~~~~~~~#

left:
li r3, 0x03BC #Offset
li r4, -1 #Amount to subtract (move the "^" left)
li r5, -1 #1 Below Lower bound for subtracting
li r6, 0 #Lower Bound reset
b left_right

right:
li r3, 0x03BD #Offset
li r4, 1 #Amount to add (move the "^" right)
li r5, 8 #1 Above Upper bound for adding
li r6, 7 #Upper Bound reset

left_right:
lbzx r0, r3, r29 #Load Left/Right Status, 0x3BC for left, 0x3BD for right
cmpwi r0, 1
beq- store_updownleftright

li r0, 1

lbz r7, 0x03B9 (r29) #Load digit slot tracker
add r7, r7, r4 #r4 is -1 for left, is 1 for right

cmpw r7, r5 #r5 is -1 for left, is 8 for right, 0 - 7 is digit slot tracker range
bne+ store_digit_slot_tracker

mr r7, r6 #Set r7 to 0 for left, set it to 7 for right

store_digit_slot_tracker:
stb r7, 0x03B9 (r29) #Store the updated digit slot tracker value

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Write ASCII "^" based on digit slot tracker value #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#0x80000DE2 = start of space field for arrow
stw r28, 0xDE2 (r29)
stw r28, 0xDE6 (r29)
addi r7, r7, 0xDE2 #r7 (digit left/right value) + Space field offset = spot to write the "^"
stbx r27, r7, r29 #Write the "^"!

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Update Up/Down/Left/Right Status #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

store_updownleftright:
stbx r0, r3, r29 #Update Up/DownLeft/Right Status
b real_temp_sprintf

#~~~~~~~#
# Enter #
#~~~~~~~#

enter:
lbz r0, 0x03BE (r29) #Load Enter Status
cmpwi r0, 1
beq- store_enter

li r0, 1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Update [REAL] Address Value since Status Byte = 1 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r3, 0x03B4 (r29) #Load Temp Value
stw r3, 0x03B0 (r29) #Update [REAL] address value with Temp Value!

store_enter:
stb r0, 0x03BE (r29) #Update Enter Status
b real_temp_sprintf

#~~~~~~~#
# Write #
#~~~~~~~#

write:
lbz r0, 0x03BF (r29) #Load Write Status
cmpwi r0, 1
beq- store_write

li r0, 1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Write new word value at [REAL] Address; Status Byte = 1 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r3, 0x03B0 (r29) #Load current start [REAL] RAM Address
lwz r4, 0x03B4 (r29) #Load Temp Value
stw r4, 0 (r3) #WRITE IT!
dcbst 0, r3 #Cache update
sync
icbi 0, r3 #Just incase an executable instruction is being overwritten
isync

store_write:
stb r0, 0x03BF (r29)

#~~~~~~~~~~~~~~~~~~~#
# real_temp_sprintf #
#~~~~~~~~~~~~~~~~~~~#

#sprintf
#r3 = spot to dump converted contents
#r4 = spot where unconverted contents is at
#r5 = printf args

real_temp_sprintf:
addi r3, r29, 0xDD0
bl real_temp_string
.string "%08X\n%08X\n"
.align 2
real_temp_string:
mflr r4

lwz r5, 0x3B0 (r29)
lwz r6, 0x3B4 (r29)

#Since sprintf will write a null byte at the end, that means the first byte ofthe space field will be overwritten. back it up in r26 temporarily
lbz r26, 0xDE2 (r29)

call_link sprintf

#Restore 1st byte of space field
stb r26, 0xDE2 (r29)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Mega sprintf loop for RAM contents in ASCII #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Initial Loop setup
ram_sprintf:
addi r25, r29, 0xDC6 #-0x24 away from start of where ASCII dump will go to, dump will start with an ASCII enter; end in null ofc
lwz r26, 0x3B0 (r29) #Load Pointer to start of RAM conents

#Only doing 4 words at a time for ease of step-by-step analysis and alignment so only one mega sprintf routine is needed
addi r26, r26, -0x10

#Set Loop Amount
li r24, 4

loop_sprintf:
addi r25, r25, 0x24 #Move onto next row in ASCII ram dump
mr r3, r25
addi r26, r26, 0x10 #Save in GVR for next incrementation
lswi r5, r26, 16 #String load 16 bytes starting at r5. Thus r5 thru r8 are loaded; I love this instruction! More people need to use it!

bl string_ram_contents
.string "\n%08X %08X %08X %08X"
.align 2
string_ram_contents:
mflr r4

call_link sprintf
subic. r24, r24, 1
bne+ loop_sprintf

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# DirectPrint Printf & Store Cache #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r3, 0x5 #X coordinate (starts far left)
li r4, 0x90 #Y coordinate (starts at very top)
li r5, 0x1 #0 = No wrap, 1 = wrap
ori r6, r29, 0x0DD0

#r7 thru r10 = standard prtinf format args
#f1 thru f13 = standard printf float format args

lis r31, 0x8002 #For nw4r macro

call_nw4r nw4r_db_DirectPrint_Printf
call_nw4r nw4r_db_DirectPrint_StoreCache

#~~~~~~~~~#
# The End #
#~~~~~~~~~#

the_end:
pop_stack
default_instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#
Reply
#2
If this ends up working on a real Wii, I will use this as a base for the Code Patcher and rewrite the whole thing Tongue
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#3
Got a homie testing it on a WIi for me. Im out of town atm.

Btw you will find a few optimization issues. Coding late at night before work is not really optimal lmao.
Reply
#4
Tongue Haha
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#5
Welp it appears it doesn't work on the Wii (same issue as your code)

There is a way around it, but the code will be near the GCT limit.

Easy Extender ofc. If you want, you only need to mod a few things to make this work with the Easy Extender. You can also change it to a C0 Codetype. And if it works, then it will also work for every wii game.


EDIT: Crashes on Easy Extender too. Can't figure out why.
Reply
#6
I will consider it, but what issue is it? Is everything being caused during the direct print, or is it the code itself? Also, I was planning this exact code to go with the code patcher, but I didn't want to start until the issue was resolved. Btw, how does Easy Extender work anyway?
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#7
deleted
Reply
#8
I don't think he would give us that code handler, and I seriously doubt he would go out of his way to help us create our own Tongue
Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply
#9
@Joshua Nothing wrong with the code itself. It's something with the Draw functions. Code works 100% on Dolphin.

@Cameron it's easy to make a code handler extender for mkwii. The issue is making one work for every Wii game. The main dev of usbloader gx won't bother adding a game specific one. Regardless I'm sure I won't hit the GCT limit
Reply
#10
Anyway, I updated the title of the code, and moved the thread.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)