Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 82
» Latest member: saradk
» Forum threads: 1,023
» Forum posts: 1,707

Full Statistics

Online Users
There are currently 34 online users.
» 0 Member(s) | 32 Guest(s)
Bing, Google

Latest Threads
Automated Perfect License...
Forum: Cheat Codes
Last Post: zak
04-18-2019, 09:43 PM
» Replies: 2
» Views: 66
Timer Clock Display Modif...
Forum: DBZ BT3
Last Post: zak
04-18-2019, 01:03 PM
» Replies: 0
» Views: 18
480p Graphics Fix
Forum: Cheat Codes
Last Post: zak
04-16-2019, 05:51 PM
» Replies: 1
» Views: 120
Random Track Selection Fo...
Forum: Cheat Codes
Last Post: zak
04-14-2019, 02:37 PM
» Replies: 0
» Views: 80
Annoucements/Updates
Forum: Site Advancement
Last Post: zak
04-12-2019, 08:21 PM
» Replies: 36
» Views: 7,461
TAS BKT Sheet
Forum: TAS
Last Post: Cameron_MKW
04-07-2019, 12:13 PM
» Replies: 3
» Views: 1,028
List of Certain Functions...
Forum: Hacking General
Last Post: zak
04-05-2019, 06:23 PM
» Replies: 0
» Views: 106
Graphical In-Game Item Sp...
Forum: Cheat Codes
Last Post: zak
03-31-2019, 09:12 PM
» Replies: 0
» Views: 164
Graphical In-Game Item Sp...
Forum: Cheat Codes
Last Post: zak
03-31-2019, 09:10 PM
» Replies: 0
» Views: 76
Go From Complete Noob to ...
Forum: Guides/How-To's
Last Post: Cameron_MKW
03-31-2019, 02:29 PM
» Replies: 1
» Views: 165

 
  SSQW01 Map Modifier/Temp Unlock
Posted by: zak - 03-13-2019, 03:56 PM - Forum: NTSC-T (Taiwan) Games - No Replies

SSQW01 Map Modifier/Temp Unlock

This code will force you to play the map you have set on the code regardless of what you select on the menu. You can set the value to something such as 6 to unlock the DK's Jungle Ruins.

NTSC-T
C268E3A8 00000002
3860000X 9064000C
60000000 00000000

X = Map

X Values
0 = Toad Road
1 = Bob-omb Factory
2 = Boo's Horror Castle
3 = Blooper Beach
4 = Magma Mine
5 = Bowser Station
6 = DK's Jungle Ruins

Source:
li r3, 0xX #Load Map Value into Register 3
stw r3, 0x000C (r4) Store word of r3 at address of r4 plus offset 0x000C
nop #Nop for odd amount of ASM instructions

Code creator: zak

Print this item

  SSQW01 Character Modifier/Temp Unlock
Posted by: zak - 03-13-2019, 03:55 PM - Forum: NTSC-T (Taiwan) Games - No Replies

SSQW01 Character Modifier/Temp Unlock

This code will force you to select the character you have set on this code regardless of what you select on the menu. When you first select the CPUs, they will also be auto selected to the desired character value. If you back out, and repeat this process, the CPUs (all 3) will now be auto selected in a split second.

You can also set the character value to something such as A to temp unlock Shy Guy.

NTSC-T
C2698E78 00000002
3800000X B010003C
60000000 00000000

X = Character

X Values:
0 = Mario
1 = Luigi
2 = Peach
3 = Daisy
4 = Wario
5 = Waluigi
6 = Yoshi
7 = Birdo
8 = Toad
9 = Koopa
A = Shy Guy
B = Kamek

Source:
li r0, 0xX #Load Character Value in Register 0
sth r0, 0x003C (r16) #Store halfword of Register 0 to address of Register 16 plus offset 0x3C
nop #Nop for odd amount of ASM instructions

Code creator: zak

Print this item

  RFNW01 Change First Mii's Name
Posted by: zak - 03-13-2019, 03:53 PM - Forum: NTSC-T (Taiwan) Games - No Replies

RFNW01 Change First Mii's Name

This code will allow you to temporarily change the name of the First Mii listed on screen.

NTSC-T
42000000 90000000
05B7E0A4 ppppqqqq
05B7E0A8 rrrrtttt
05B7E0AC uuuuvvvv
05B7E0B0 wwwwxxxx
05B7E0B4 yyyyzzzz
E0000000 80008000

Mii Name Symbol Map:
pppp = 1st character
qqqq = 2nd
rrrr = 3rd
tttt = 4th
uuuu = 5th
vvvv = 6th
wwww = 7th
xxxx = 8th
yyyy = 9th
zzzz = 10th

Example Values:
0020 = Space
0041 = A
0061 = a
E017 = DSi Heart

Use 0000 for unfilled values if you don't want to use the full length of 10 characters.

Code creator: zak

Print this item

  Infinite Health All Players; DBZ BT3
Posted by: zak - 03-13-2019, 03:49 PM - Forum: DBZ BT3 - No Replies

DBZ BT3 Infinite Health All Players

Health Bar for both players will never be effected, thus nobody can be defeated. If used online, you will blackscreen the opponent after the match, and you will freeze yourself.

NTSC-U
C20F341C 00000002
3BC00000 7C7E1850
60000000 00000000

Source:
li r30, 0x0
sub r3, r3, r30 #Default instruction
nop

Code creator: Hawkeye2777

Print this item

  Dump All Opponents' IP Address & Important USER Record Info to NAND
Posted by: zak - 03-08-2019, 09:43 PM - Forum: Cheat Codes - No Replies

Dump All Opponents' IP Address & Important USER Record Info to NAND

NOTE: Does NOT work on Wiimmfi (due to their security patches).

This code will create a new file on your NAND called "openme" within the /shared2 directory. The openme file will contain the following info from all opponents (your info will NOT be included)...

Mii Name
Client ID
Wii ID
Friend Code
Slot in Last Race
IPv4 Address

The openme file will contain info from the last race of when it was updated. The file gets updated at the start of each race, replacing the previous race info with the updated info. If you have the info you want after the race starts and don't want the file updated again next race, leave the WW/Room once the current race is over.

How to extract the openme file from your NAND:

You can use the WiiXplorer app or the FSToolBox app. I personally prefer WiiXplorer. You can find either of those HBC apps via a quick Google Search. You will need some experience with HBC and using HBC apps as the following steps will not be a full 'baby-you-step-by-step' guide.

Mini Guide (WiiXplorer)
1. Launch WiiXplorer, go to Settings, then Boot Settings.
2. Turn on NAND Access/Permissions (must be done every time you boot the app)
3. Go to NAND root, go into the shared2 folder. Copy paste the openme file anywhere to your SD/USB.
4. Put SD/USB into computer. Use any Hex Editor to view the file (I recommend HxD). Congratz

openme Overall Player Address Values
0x00 -p1 (slot 0)
0x40 -p2 (slot 1, etc etc)
0x80 - p3
0xC0 - p4
0x100 - p5
0x140 - p6
0x180 - p7
0x1C0 - p8
0x200 - p9
0x240 - p9
0x280 - p10
0x2C0 - p11
0x300 - p12

openme Specific Player Address Offsets (add the players Overall Address value to this value to find it on the Hex Editor. Example you want to see Player 5's FC. Add 0x100 plus 0x20. At address 0x120 on the file will be the FC value of Player 5):
0x0 Mii Name (5 words)
0x14 Client ID (word)
0x18 Wii ID (double word)
0x20 FC (double word)
0x28 Player slot (byte)
0x2C IPv4 Address (word)

Note about IP slotting: If there are guests in the room, it will mess up where the IP addresses are slotted. Not much I can do about this (without making the code way longer than it already is) because the game doesn't repeat a persons' IP in RAM if that person has a guest.

For example--
If there are 6 players in the room and 2 of those have guests, then there are only 4 total IP addresses. So let's say we have these 4 IP Addresses (hex) 
11223344 (slot 0 w/ guest slot 1)
99887755 (slot 2)
10101010 (slot 3 w/ guest slot 4)
22224444 (slot 5)

This is how those IP Addresses would be listed on openme
slot 0 ip's 11223344
slot 1 ip's 99887755
slot 2 ip's 10101010
slot 3 ip's 22224444
slot 4 ip's none (all zeros)
slot 5 ip's none (all zeros)

Instead of making the code way longer than what it is, I decided to leave this up to the end user to manually adjust if they dump the info of a WW that has guests.

Final Important NOTE: This code makes use of memory addresses 0x800015A0 thru 0x800015D3, and 0x81490000 thru 0x81490003. Make sure no other codes you have on, are using those addresses!!!

NTSC-U
C20DB29C 00000003
9B440014 3984003C
3D608000 918B15D0
60000000 00000000
C261E0C8 00000003
7C630214 1C910004
3C848000 906415A0
60000000 00000000
C27AC3BC 00000031
3D808149 816C0000
2C0B0000 40A20174
908C0000 7C0B0378
7D8802A6 9421FF80
BC610008 38600340
38800020 80ADA358
80A50024 7CBA2B78
3D808022 618C9490
7D8803A6 4E800021
7C7B1B78 3F208000
632C159C 39C0000C
856C0004 2C0B0000
40A20011 35CEFFFF
4082FFF0 48000054
7D4802A6 558F063E
39EFFF60 55EFF0BE
1E0F0040 7E3B8214
91F10028 825915D0
1E0F0030 7E50902E
9251002C 392B00D2
7E69A4AA 7E71A5AA
83EB00EC 93F10014
BB8B0168 BF910018
7D4803A6 4E800020
3FA08016 48000015
2F736861 72656432
2F6F7065 6E6D6500
7C6802A6 7C7E1B78
38800000 38A00003
7CA62B78 7CA72B78
63BCABD4 7F8803A6
4E800021 2C03FF97
41A2000C 2C030000
40820050 7FC3F378
38800002 63BCADBC
7F8803A6 4E800021
2C030000 41800034
7C7F1B78 7F64DB78
38A00340 63BCB220
7F8803A6 4E800021
2C030340 40820014
7FE3FB78 63BCB2E4
7F8803A6 4E800021
7F63DB78 7F44D378
3D808022 618C9800
7D8803A6 4E800021
B8610008 38210080
7D8803A6 7D605B78
7C0903A6 00000000

PAL
C20DB33C 00000003
9B440014 3984003C
3D608000 918B15D0
60000000 00000000
C26513DC 00000003
7C630214 1C910004
3C848000 906415A0
60000000 00000000
C27BAE1C 00000031
3D808149 816C0000
2C0B0000 40A20174
908C0000 7C0B0378
7D8802A6 9421FF80
BC610008 38600340
38800020 80ADA360
80A50024 7CBA2B78
3D808022 618C9814
7D8803A6 4E800021
7C7B1B78 3F208000
632C159C 39C0000C
856C0004 2C0B0000
40A20011 35CEFFFF
4082FFF0 48000054
7D4802A6 558F063E
39EFFF60 55EFF0BE
1E0F0040 7E3B8214
91F10028 825915D0
1E0F0030 7E50902E
9251002C 392B00D2
7E69A4AA 7E71A5AA
83EB00EC 93F10014
BB8B0168 BF910018
7D4803A6 4E800020
3FA08016 48000015
2F736861 72656432
2F6F7065 6E6D6500
7C6802A6 7C7E1B78
38800000 38A00003
7CA62B78 7CA72B78
63BCAC74 7F8803A6
4E800021 2C03FF97
41A2000C 2C030000
40820050 7FC3F378
38800002 63BCAE5C
7F8803A6 4E800021
2C030000 41800034
7C7F1B78 7F64DB78
38A00340 63BCB2C0
7F8803A6 4E800021
2C030340 40820014
7FE3FB78 63BCB384
7F8803A6 4E800021
7F63DB78 7F44D378
3D808022 618C9B84
7D8803A6 4E800021
B8610008 38210080
7D8803A6 7D605B78
7C0903A6 00000000

NTSC-J
C20DB25C 00000003
9B440014 3984003C
3D608000 918B15D0
60000000 00000000
C2650A48 00000003
7C630214 1C910004
3C848000 906415A0
60000000 00000000
C27BA488 00000031
3D808149 816C0000
2C0B0000 40A20174
908C0000 7C0B0378
7D8802A6 9421FF80
BC610008 38600340
38800020 80ADA360
80A50024 7CBA2B78
3D808022 618C9734
7D8803A6 4E800021
7C7B1B78 3F208000
632C159C 39C0000C
856C0004 2C0B0000
40A20011 35CEFFFF
4082FFF0 48000054
7D4802A6 558F063E
39EFFF60 55EFF0BE
1E0F0040 7E3B8214
91F10028 825915D0
1E0F0030 7E50902E
9251002C 392B00D2
7E69A4AA 7E71A5AA
83EB00EC 93F10014
BB8B0168 BF910018
7D4803A6 4E800020
3FA08016 48000015
2F736861 72656432
2F6F7065 6E6D6500
7C6802A6 7C7E1B78
38800000 38A00003
7CA62B78 7CA72B78
63BCAB94 7F8803A6
4E800021 2C03FF97
41A2000C 2C030000
40820050 7FC3F378
38800002 63BCAD7C
7F8803A6 4E800021
2C030000 41800034
7C7F1B78 7F64DB78
38A00340 63BCB1E0
7F8803A6 4E800021
2C030340 40820014
7FE3FB78 63BCB2A4
7F8803A6 4E800021
7F63DB78 7F44D378
3D808022 618C9AA4
7D8803A6 4E800021
B8610008 38210080
7D8803A6 7D605B78
7C0903A6 00000000

NTSC-K
C20DB39C 00000003
9B440014 3984003C
3D608000 918B15D0
60000000 00000000
C263F6F4 00000003
7C630214 1C910004
3C848000 906415A0
60000000 00000000
C27A91DC 00000031
3D808149 816C0000
2C0B0000 40A20174
908C0000 7C0B0378
7D8802A6 9421FF80
BC610008 38600340
38800020 80ADA380
80A50024 7CBA2B78
3D808022 618C9B88
7D8803A6 4E800021
7C7B1B78 3F208000
632C159C 39C0000C
856C0004 2C0B0000
40A20011 35CEFFFF
4082FFF0 48000054
7D4802A6 558F063E
39EFFF60 55EFF0BE
1E0F0040 7E3B8214
91F10028 825915D0
1E0F0030 7E50902E
9251002C 392B00D2
7E69A4AA 7E71A5AA
83EB00EC 93F10014
BB8B0168 BF910018
7D4803A6 4E800020
3FA08016 48000015
2F736861 72656432
2F6F7065 6E6D6500
7C6802A6 7C7E1B78
38800000 38A00003
7CA62B78 7CA72B78
63BCAD10 7F8803A6
4E800021 2C03FF97
41A2000C 2C030000
40820050 7FC3F378
38800002 63BCAEF8
7F8803A6 4E800021
2C030000 41800034
7C7F1B78 7F64DB78
38A00340 63BCB35C
7F8803A6 4E800021
2C030340 40820014
7FE3FB78 63BCB420
7F8803A6 4E800021
7F63DB78 7F44D378
3D808022 618C9EF8
7D8803A6 4E800021
B8610008 38210080
7D8803A6 7D605B78
7C0903A6 00000000



List of Sources:

Source for IP Dynamic Word Location ('Pointer') Storage (1st ASM):

stb r26, 0x0014 (r4) #Default Instruction
addi r12, r4, 0x3C #Add 0x3C to r4. Store result to r12. r12's memory location is now exactly at player slot 0's IP
lis r11, 0x8000 #Set 1st half address of where in memory we are storing the word of r12 to
stw r12, 0x15D0 (r11) #Store the word of r12 to 0x800015D0

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

Source for USER Record Pointers Storage (2nd ASM):

#r4 safe for use, gets written to by following address instruction#
#this code address never gets called for your slot#

add r3, r3, r0 #Default Instruction; r3 is player USER pointer
mulli r4, r17, 0x4 #r17 is player slot value
addis r4, r4, 0x8000
stw r3, 0x15A0 (r4)

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

Source of NAND Writes (3rd ASM):

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

#

#~~~~~~~~~~~~~~~~~~~~#
# Macros & Variables #
#~~~~~~~~~~~~~~~~~~~~#

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

.macro call_isfs address
    ori r28, r29, \address@l
    mtlr r28
    blrl
.endm

.macro push_stack #No need to backup CTR as it gets written to by default instruction at end of code
    mr r11, r0
    mflr r12
    stwu r1, -0x80 (r1)
    stmw r3, 0x8 (r1)
.endm

.macro pop_stack
    lmw r3, 0x8 (r1)
    addi r1, r1, 0x80
    mtlr r12
    mr r0, r11
.endm

.macro default_instruction
    mtctr r0
.endm

.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
    .set ISFS_CreateFile, 0xABD4
    .set ISFS_Open, 0xADBC
    .set ISFS_Write, 0xB220
    .set ISFS_Close, 0xB2E4
    .set Egg_Alloc, 0x80229490
    .set Egg_Free, 0x80229800
.elseif (region == 'P' || region == 'p') # RMCP
    .set ISFS_CreateFile, 0xAC74
    .set ISFS_Open, 0xAE5C
    .set ISFS_Write, 0xB2C0
    .set ISFS_Close, 0xB384
    .set Egg_Alloc, 0x80229814
    .set Egg_Free, 0x80229B84
.elseif (region == 'J' || region == 'j') # RMCJ
    .set ISFS_CreateFile, 0xAB94
    .set ISFS_Open, 0xAD7C
    .set ISFS_Write, 0xB1E0
    .set ISFS_Close, 0xB2A4
    .set Egg_Alloc, 0x80229734
    .set Egg_Free, 0x80229AA4
.elseif (region == 'K' || region == 'k') # RMCK
    .set ISFS_CreateFile, 0xAD10
    .set ISFS_Open, 0xAEF8
    .set ISFS_Write, 0xB35C
    .set ISFS_Close, 0xB420
    .set Egg_Alloc, 0x80229B88
    .set Egg_Free, 0x80229EF8
.else # Invalid Region
        .abort
.endif

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#        Memory Address & Register Notes      #
#   0x800015A0 = Slot 0 User Pointer (Word)   #
#         0x800015A4 = Slot 1, etc etc        #
#          0x800015CC = Slot 11 (0xB)         #
# 0x800015D0 = Pointer to IP Address Mem Area #
#          0x81490000 = Status Word           #
# r25 = Exeception Vector First Half Address  #
#    r26 = System Heap Calc Address Pointer   #
#          r27 = Heap Address Pointer         #
#           r28 = Part of ISFS Macro          #
#          r29 = 0x8016 for ISFS Calls        #
#       r30 = File Path Address Pointer       #
#             r31 = File Descriptor           #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#     Status Word Check:    #
#   We don't want the code  #
# to execute more than once #
#  per race. Hence why this #
#          is done.         #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r12, 0x8149
lwz r11, 0x0 (r12)
cmpwi r11, 0x0
bne+ dont_execute

#~~~~~~~~~~~~~~~~~~~~#
# Update Status Word #
#~~~~~~~~~~~~~~~~~~~~#

stw r4, 0x0 (r12) #We need anything not zero for storage, r4 always has a value. Store it

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Start Register Safety/Backup #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

push_stack

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#          EGG::Heap:alloc         #
#        r3 = Size of Heap         #
#          r4 = Alignment          #
#      r5 = System Heap Calc       #
# Return r3 = Heap Address Pointer #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r3, 0x340
li r4, 0x20 #32-bit

.if     (region == 'E' || region == 'e')
        lwz r5, -0x5CA8(r13)
.elseif (region == 'P' || region == 'p')
        lwz r5, -0x5CA0(r13)
.elseif (region == 'J' || region == 'j')
        lwz r5, -0x5CA0(r13)
.elseif (region == 'K' || region == 'k')
        lwz r5, -0x5C80(r13)
.endif 

lwz r5, 0x24 (r5)
mr r26, r5 #Backup System Heap Calc Address

call_link Egg_Alloc

mr r27, r3 #Backup Heap Address Pointer

#~~~~~~~~~~~~~~~~~#
# Pre-Loop Config #
#~~~~~~~~~~~~~~~~~#

lis r25, 0x8000
ori r12, r25, 0x159C #Set r12 to 0x8000159C
li r14, 0xC

#~~~~~~#
# Loop #
#~~~~~~#

the_loop:
lwzu r11, 0x4 (r12) #r11 contains current Player's USER Record Pointer
cmpwi r11, 0x0 #Your own slot will never be available for loading (zero)
bnel+ sub_routine
subic. r14, r14, 1
bne+ the_loop
b loop_done

#~~~~~~~~~~~~#
# Subroutine #
#~~~~~~~~~~~~#

sub_routine:
mflr r10 #Backup LR due to later use of memcpy

#~~~~~~~~~~~~~~~~~~~~~~~~#
# Player Slot Value Calc #
#~~~~~~~~~~~~~~~~~~~~~~~~#

clrlwi r15, r12, 24 #Clear out first 3 bytes (24bits) of r12's value, r12 always updated due to the loop.
addi r15, r15, -0xA0 #Subtract 0xA0 from leftover value
srwi r15, r15, 2 #Shift the word by 2 bits. Final result is the slot value. This is the same as dividing r15 by 0x4.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Calculate Player's Exact Address in the Heap #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mulli r16, r15, 0x40
add r17, r27, r16

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store Player's Slot Value to Heap #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

stw r15, 0x28 (r17)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Player's IP Address Calculation & Store to Heap #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r18, 0x15D0 (r25) #Grab IP Address Slot 0 Address Pointer from 0x800015D0
mulli r16, r15, 0x30 #Each Slot's IP Address is gapped by 0x30 in Memory
lwzx r18, r16, r18
stw r18, 0x2C (r17)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Store Player's Mii Name #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

addi r9, r11, 0xD2 #Set up r4 as the loading address for the following lswi instruction
lswi r19, r9, 20 #Load the 20 byte string at address of r9 into starting register 19 (r19 thru r23 are written)
stswi r19, r17, 20 #Store the 20 byte string of r19 thru r23 to address of r17 (player's beginning heap spot)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Store Player's Client ID #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lwz r31, 0xEC (r11)
stw r31, 0x14 (r17)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load & Store Player's Wii ID + FC #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lmw r28, 0x168 (r11)
stmw r28, 0x18 (r17)

#~~~~~~~~~~~~~~~~#
# Return to Loop #
#~~~~~~~~~~~~~~~~#

mtlr r10
blr

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Setup 1st Half Address of ISFS Functions #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

loop_done:
lis r29, 0x8016

#~~~~~~~~~~~~~~~~~~~~~~~~#
#     ISFS_CreateFile    #
# r3 = File Path Address #
#   r4 = u8 attributes   #
# r5 = Owner permission  #
# r6 = Group permission  #
# r7 = Other permission  #
#~~~~~~~~~~~~~~~~~~~~~~~~#

bl create_file

.llong 0x2F73686172656432 #String for "/shared2/openme"
.llong 0x2F6F70656E6D6500

create_file:
mflr r3
mr r30, r3 #Backup File Path Address

li r4, 0x0
li r5, 0x3
mr r6, r5
mr r7, r5

call_isfs ISFS_CreateFile

cmpwi r3, -105
beq+ file_alreadymade
cmpwi r3, 0x0
bne- free_egg

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#           ISFS_Open           #
#     r3 = File Path Address    #
# r4 = 0x2 for Write Permission #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

file_alreadymade:
mr r3, r30
li r4, 0x2

call_isfs ISFS_Open

cmpwi r3, 0x0
blt- free_egg

mr r31, r3 #Backup file descriptor

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                     ISFS_Write                      #
#                r3 = File descriptor                 #
# r4 = Address that Points to String of Data to Write #
#    r5 = Amount of Bytes to Write from the String    #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r4, r27
li r5, 0x340

call_isfs ISFS_Write

cmpwi r3, 0x340
bne- free_egg

#~~~~~~~~~~~~~~~~~~~~~~#
#      ISFS_Close      #
# r3 = File descriptor #
#~~~~~~~~~~~~~~~~~~~~~~#

mr r3, r31

call_isfs ISFS_Close

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#      EGG::Heap::free      #
# r3 = Heap Address Pointer #
#   r4 = System Heap Calc   #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#

free_egg:
mr r3, r27
mr r4, r26

call_link Egg_Free

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

pop_stack

dont_execute:
default_instruction

#

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



Code creator: zak

Code credits: Megazig (ISFS Functions), Star (address founder for 2nd ASM), RiiDefi (EGG Functions)

Print this item

  Performance Bar
Posted by: Star - 03-04-2019, 03:59 PM - Forum: Cheat Codes - No Replies

Performance Bar

(NTSC-U)
C20095CC 00000006
81950000 7EA3AB78
818C0018 7D8903A6
4E800421 81830000
818C0008 7D8903A6
4E800421 81950000
60000000 00000000
C20095EC 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0010
7D8903A6 4E800421
60000000 00000000
C200964C 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0014
7D8903A6 4E800421
60000000 00000000
C2009764 00000007
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
39800001 9983010A
81830000 818C000C
7D8903A6 4E800421
60000000 00000000

(PAL)
C200960C 00000006
81950000 7EA3AB78
818C0018 7D8903A6
4E800421 81830000
818C0008 7D8903A6
4E800421 81950000
60000000 00000000
C200962C 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0010
7D8903A6 4E800421
60000000 00000000
C200968C 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0014
7D8903A6 4E800421
60000000 00000000
C20097A4 00000007
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
39800001 9983010A
81830000 818C000C
7D8903A6 4E800421
60000000 00000000

(NTSC-J)
C2009568 00000006
81950000 7EA3AB78
818C0018 7D8903A6
4E800421 81830000
818C0008 7D8903A6
4E800421 81950000
60000000 00000000
C2009588 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0010
7D8903A6 4E800421
60000000 00000000
C20095E8 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0014
7D8903A6 4E800421
60000000 00000000
C2009700 00000007
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
39800001 9983010A
81830000 818C000C
7D8903A6 4E800421
60000000 00000000

(NTSC-K)
C2009714 00000006
81950000 7EA3AB78
818C0018 7D8903A6
4E800421 81830000
818C0008 7D8903A6
4E800421 81950000
60000000 00000000
C2009734 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0010
7D8903A6 4E800421
60000000 00000000
C2009794 00000006
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
81830000 818C0014
7D8903A6 4E800421
60000000 00000000
C20098AC 00000007
4E800421 81950000
7EA3AB78 818C0018
7D8903A6 4E800421
39800001 9983010A
81830000 818C000C
7D8903A6 4E800421
60000000 00000000

Code Creator: MrBean35000vr

Print this item

  Using Macros & Statements for Ease of Compilation (ASM)
Posted by: zak - 03-03-2019, 07:53 PM - Forum: Guides/How-To's - No Replies

Using Macros & Statements for Ease of Compilation (ASM)






Are your ASM codes getting complex enough where you need to use macros and statements? This tutorial is for you. Once ASM codes get large enough, you will start using values multiple times, or a set/list of instructions over and over again. No sense typing those instructions/values out when you can just use a label name like you do for branches. Also, if your ASM is using addresses that differ per region and you are tired of manually porting those addresses within the ASM on compiled byte code, I will also cover how to get rid of this nuisance.



Setting Label Names via Statements (.set)

.set _Amount, 0x100

Very simple statement that you should already understand. Any time you type _Amount in your source, the value 0x100 is used.

.set _Offset, 0x00C0

Another simple Macro. Let's combine the two simple Macros to show you a quick demo...

li r4, _Amount
stw r4, _Offset (r31)

As you can see we utilized these two Macros to store _Amount to a Memory address based off of r31.



Setting a Simple Macro

You have the following list of instructions...

lis r12, 0x8000
ori r12, r12, 0x1500

And you use this set of instructions a multitude of times in your code. Instead of writing it out every time, use a Macro instead! Like this....

.macro _setTheAddress
lis r12, 0x8000
ori r12, r12, 0x1500
.endm

Very simple Macro. The ".macro" starts the Macro followed by the Macro's label name. The next two 'tabbed' lines are the macro contents. Finally the ".endm" tells the compiler that it is the end of that specific Macro. If you put _setTheAddress in your source, the above lis & ori instructions via r12 will be used.



Getting More Complex with Macros

So now you know how to use a basic macro for a list of instructions. But what if we don't wanna use the same register (r12) every time for the macro we just made? Simple, like this...

.macro _setTheAddress register
lis \register, 0x8000
ori \register, \register, 0x1500
.endm

The term 'register' after the Macro's label name tells the compiler that a register value must be applied for the macro. The macro contents are adjusted to the take that designated register and use it for the lis and ori instructions. Like in this provided snippet of compilable source...


Code:
.macro _setTheAddress register
    lis \register, 0x8000
    ori \register, \register, 0x1500
.endm

.set _theValue, 0x4 #Set label name for 0x4

addi r19, r19, _theValue #Instruction utilizing the label name for 0x4
_setTheAddress r11 #lis r11, 0x8000 with ori r11, r11, 0x1500 is preformed
stw r19, 0 (r11)


Alright great, this allows you to use any register you want for the macro _setTheAddress. Let's go one step further....Let's change the macro to allow the use of any address plus register...


Code:
.macro _setTheAddress register, address
    lis \register, \address@h
    ori \register, \register, \address@l
.endm

.set _theValue, 0x4 #Set label name for 0x4

addi r19, r19, _theValue #Instruction utilizing the label name for 0x4
_setTheAddress r11, 0x81458000 #lis r11, 0x8000 with ori r11, r11, 0x1500 is preformed
stw r19, 0 (r11)

The "@h" after the first use of address represents the upper 16 bits while the "@l" for the second use of address represents the lower 16 bits.



Using Labels with Address Values and Macros Together

Now you know how to change up the macros a bit, we can now use the .set function to set Memory Address values to use with address term of our Macros... Here's a snippet of code demonstrating that:


Code:
.macro _setTheAddress register, address
    lis \register, \address@h
    ori \register, \register, \address@l
.endm

.set _theValue, 0x4 #Set label name for 0x4
.set _theAddress, 0x8042BABC

addi r19, r19, _theValue #Instruction utilizing the label name for 0x4
_setTheAddress r11, _theAddress
stw r19, 0 (r11)




Getting a Bit More Complex with .set

While .set can establish simple values, you use basic equations too.

.set _basevalue, 6

.set plus_2, _basevalue+2 #6 plus 2 = 8
.set times_8, _basevalue*8 #6 times 8 = 48 (0x30 in Hex)
.set divide_3, _basevalue/3 #6 divided by 3 = 2
.set subtract_5, _basevalue-5 #6 minus 5 = 1

This can come in handy for basic equations.



Using .set and if statements to compile different versions of source based on region.

For example, let's say you have an ASM code, and in it is a stw instruction that stores to this address 0x80421500. Like this....

li r4, 0x5
lis r5, 0x8042
ori r5, r5, 0x1500
stw 4, 0 (r5)

But the address in r5 is for NTSC-U only. It differs slightly for every region of MKWii. Instead of writing the specific source for NTSC-U, compiling it, then finding the compiled hex byte code instruction to manually change.... You can instead use a fancy trick with .set and if/end-if statements to get around this nuisance. 

.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
        .set The_Addr, 0x80421500
.elseif (region == 'P' || region == 'p') # RMCP
        .set The_Addr, 0x8042BCCC
.elseif (region == 'J' || region == 'j') # RMCJ
        .set The_Addr, 0x8042A074
.elseif (region == 'K' || region == 'k') # RMCK
        .set The_Addr, 0x8041FFF0
.else # Invalid Region
        .abort
.endif

As you can see we use multiple different address values for the label of The_Addr. The if/else-if statements were put in to only use one of those versions of the label name depending on the alphabetical letter used in the ".set region" statement. The if/else-if statements read the value for the label "region" and if one of the values is found, the label name will be given the corresponding address for compilation. If the value for the ".set region" statement is left blank, or an invalid value is used, the compiler will abort the compilation and notify you that compilation could not be done. This is accomplished via the use of .else and .abort.

This saves a lot of headaches for codes that have varying address instructions due to the version/region of the code.



Macros within If/Else-If statements

If desired, you can put whole macros within the if/else if statements.... Take a look at this snippet of compilable source


Code:
.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
        .macro _setTheAddress register
        lis \register, 0x8000
        ori \register, \register, 0x1500
        .endm
.elseif (region == 'P' || region == 'p') # RMCP
        .macro _setTheAddress register
        lis \register, 0x8000
        ori \register, \register, 0x1504
        .endm
.elseif (region == 'J' || region == 'j') # RMCJ
        .macro _setTheAddress register
        lis \register, 0x8000
        ori \register, \register, 0x1508
        .endm
.elseif (region == 'K' || region == 'k') # RMCK
        .macro _setTheAddress register
        lis \register, 0x8000
        ori \register, \register, 0x150C
        .endm
.else # Invalid Region
        .abort
.endif

add r3, r3, r14 #Random instruction
_setTheAddress r11 #Set up r11 address
stw r3, 0 (r11) #store word of r3 to r11's address


To test out the compilation of this small source, throw this into your compiler and use E/P/J/K for the region value. You will notice the compiled code will slightly differ per region. If an invalid or missing value is used for region, the source will not compile.



Conclusion

Remember, the goal of these macros is to make it easier & more convenient to compile/modify your source. If the macros and/or statements are not helping, then don't use them. For an actual real word code that uses some good macros plus statements, check out Star's Screenshot code - http://mkwii.org/showthread.php?tid=1080

Print this item

  SYSCONF MKW Region Settings NAND Editor
Posted by: zak - 02-25-2019, 06:58 PM - Forum: Cheat Codes - No Replies

SYSCONF MKW Region Settings NAND Editor

This code will allow you to make permanent changes to your SYSCONF file regarding your country code, region residence code (set Flag), and globe location. I made this so you wouldn't need to use an HBC application to extract the SYSCONF file from the NAND to later Hex-edit it on a computer. Ofc, you could use some other Country/Globe Changer code, but all of those are temporary. This code makes permanent edits to your NAND.

You only need to run this code once.

XX = Country Code

YY values:
00 = No Flag, use Default Region ID Globe Location
01 = Flag On

ZZZZZZZZ = Globe Location, YY value must be 01 for this to take effect

Instructions:
Simply boot MKWii. After a split second, the TV screen will flicker a bit, then you will automatically be navigated to the Wii Main Menu. And that's it. SYSCONF edits have been made.

If using this code on Dolphin, the navigation to the Wii Menu will fail, but the SYSCONF edits will still be successful. 

NTSC-U
C20095F4 00000027
38604000 38800020
80ADA358 80A50024
7CBA2B78 3D808022
618C9490 7D8803A6
4E800021 7C7E1B78
3F808016 4800001D
2F736861 72656432
2F737973 2F535953
434F4E46 00000000
7C6802A6 7C7D1B78
38800001 639BADBC
7F6803A6 4E800021
2C030000 418000C0
7C7F1B78 7FC4F378
38A04000 639BB15C
7F6803A6 4E800021
2C034000 408200A0
7FE3FB78 639BB2E4
7F6803A6 4E800021
387EFFFF 38A04000
8C830001 2C040007
41820011 34A5FFFF
4082FFF0 48000070
88C3FFFF 2C060010
4C820020 3C80XXYY
90830001 3C80ZZZZ
6084ZZZZ 90831005
7FA3EB78 38800002
639BADBC 7F6803A6
4E800021 2C030000
41800034 7C7F1B78
7FC4F378 38A04000
639BB220 7F6803A6
4E800021 2C034000
40820014 7FE3FB78
639BB2E4 7F6803A6
4E800021 3D80801A
618C87B8 7D8803A6
4E800020 00000000

PAL
C2009634 00000027
38604000 38800020
80ADA360 80A50024
7CBA2B78 3D808022
618C9814 7D8803A6
4E800021 7C7E1B78
3F808016 4800001D
2F736861 72656432
2F737973 2F535953
434F4E46 00000000
7C6802A6 7C7D1B78
38800001 639BAE5C
7F6803A6 4E800021
2C030000 418000C0
7C7F1B78 7FC4F378
38A04000 639BB1FC
7F6803A6 4E800021
2C034000 408200A0
7FE3FB78 639BB384
7F6803A6 4E800021
387EFFFF 38A04000
8C830001 2C040007
41820011 34A5FFFF
4082FFF0 48000070
88C3FFFF 2C060010
4C820020 3C80XXYY
90830001 3C80ZZZZ
6084ZZZZ 90831005
7FA3EB78 38800002
639BAE5C 7F6803A6
4E800021 2C030000
41800034 7C7F1B78
7FC4F378 38A04000
639BB2C0 7F6803A6
4E800021 2C034000
40820014 7FE3FB78
639BB384 7F6803A6
4E800021 3D80801A
618C8858 7D8803A6
4E800020 00000000

NTSC-J
C2009590 00000027
38604000 38800020
80ADA360 80A50024
7CBA2B78 3D808022
618C9734 7D8803A6
4E800021 7C7E1B78
3F808016 4800001D
2F736861 72656432
2F737973 2F535953
434F4E46 00000000
7C6802A6 7C7D1B78
38800001 639BAD7C
7F6803A6 4E800021
2C030000 418000C0
7C7F1B78 7FC4F378
38A04000 639BB11C
7F6803A6 4E800021
2C034000 408200A0
7FE3FB78 639BB2A4
7F6803A6 4E800021
387EFFFF 38A04000
8C830001 2C040007
41820011 34A5FFFF
4082FFF0 48000070
88C3FFFF 2C060010
4C820020 3C80XXYY
90830001 3C80ZZZZ
6084ZZZZ 90831005
7FA3EB78 38800002
639BAD7C 7F6803A6
4E800021 2C030000
41800034 7C7F1B78
7FC4F378 38A04000
639BB1E0 7F6803A6
4E800021 2C034000
40820014 7FE3FB78
639BB2A4 7F6803A6
4E800021 3D80801A
618C8778 7D8803A6
4E800020 00000000

NTSC-K
C200973C 00000027
38604000 38800020
80ADA380 80A50024
7CBA2B78 3D808022
618C9B88 7D8803A6
4E800021 7C7E1B78
3F808016 4800001D
2F736861 72656432
2F737973 2F535953
434F4E46 00000000
7C6802A6 7C7D1B78
38800001 639BAEF8
7F6803A6 4E800021
2C030000 418000C0
7C7F1B78 7FC4F378
38A04000 639BB298
7F6803A6 4E800021
2C034000 408200A0
7FE3FB78 639BB420
7F6803A6 4E800021
387EFFFF 38A04000
8C830001 2C040007
41820011 34A5FFFF
4082FFF0 48000070
88C3FFFF 2C060010
4C820020 3C80XXYY
90830001 3C80ZZZZ
6084ZZZZ 90831005
7FA3EB78 38800002
639BAEF8 7F6803A6
4E800021 2C030000
41800034 7C7F1B78
7FC4F378 38A04000
639BB35C 7F6803A6
4E800021 2C034000
40820014 7FE3FB78
639BB420 7F6803A6
4E800021 3D80801A
618C8BB4 7D8803A6
4E800020 00000000



Source:

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

#

#~~~~~~~~~~~~~~~~~~~~~~#
# Macros and Variables #
#~~~~~~~~~~~~~~~~~~~~~~#

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

.macro call_isfs address
   ori r27, r28, \address@l
   mtlr r27
   blrl
.endm

.macro call_nolink address
   lis r12, \address@h
   ori r12, r12, \address@l
   mtlr r12
   blr
.endm

.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
       .set ISFS_Open, 0xADBC
       .set ISFS_Read, 0xB15C
       .set ISFS_Write, 0xB220
       .set ISFS_Close, 0xB2E4
       .set Wii_Menu, 0x801A87B8
       .set Egg_Alloc, 0x80229490
.elseif (region == 'P' || region == 'p') # RMCP
       .set ISFS_Open, 0xAE5C
       .set ISFS_Read, 0xB1FC
       .set ISFS_Write, 0xB2C0
       .set ISFS_Close, 0xB384
       .set Wii_Menu, 0x801A8858
       .set Egg_Alloc, 0x80229814
.elseif (region == 'J' || region == 'j') # RMCJ
       .set ISFS_Open, 0xAD7C
       .set ISFS_Read, 0xB11C
       .set ISFS_Write, 0xB1E0
       .set ISFS_Close, 0xB2A4
       .set Wii_Menu, 0x801A8778
       .set Egg_Alloc, 0x80229734
.elseif (region == 'K' || region == 'k') # RMCK
       .set ISFS_Open, 0xAEF8
       .set ISFS_Read, 0xB298
       .set ISFS_Write, 0xB35C
       .set ISFS_Close, 0xB420
       .set Wii_Menu, 0x801A8BB4
       .set Egg_Alloc, 0x80229B88
.else # Invalid Region
       .abort
.endif

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                         Register Notes:                        #
# No need to backup anything as final function is OSReturnToMenu #
#        r31 = Backup Register for File Descriptor Values        #
#         r30 = Backup Register for Heap Address Pointer         #
#       r29 = Backup Register for File Path for ISFS_Open        #
#                   r28 = Used for ISFS Macros                   #
#                   r27 = Used for ISFS Macros                   #
#           r26 = Backup for System Heap Calc Address            #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~#
#    Egg::Heap::alloc   #
#   r3 = Size of Heap   #
#     r4 = Alignment    #
# r5 = System Heap Calc #
#~~~~~~~~~~~~~~~~~~~~~~~#

li r3, 0x4000 #Size of SYSCONF is 0x4000
li r4, 0x20 #32 bit alignment

.if     (region == 'E' || region == 'e')
       lwz r5, -0x5CA8(r13)
.elseif (region == 'P' || region == 'p')
       lwz r5, -0x5CA0(r13)
.elseif (region == 'J' || region == 'j')
       lwz r5, -0x5CA0(r13)
.elseif (region == 'K' || region == 'k')
       lwz r5, -0x5C80(r13)
.endif

lwz r5, 0x0024 (r5)
mr r26, r5 #Backup System Heap Calc Address

call_link Egg_Alloc

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Backup Heap Pointer; Set ISFS Function 1st Half Address #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r30, r3
lis r28, 0x8016

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#     ISFS_Open (#1) Arguments      #
# r3 = Address Pointer To File Path #
# r4 = 0x1 for ISFS_Read Permission #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

bl file_path

.llong 0x2F73686172656432 #String for /shared2/sys/SYSCONF
.llong 0x2F7379732F535953
.long 0x434F4E46
.space 4 #4 bytes of zeros added for alignment

file_path:
mflr r3
mr r29, r3 #Backup File Path Address Pointer to r29 for later 2nd use of ISFS_Open
li r4, 0x1

call_isfs ISFS_Open

cmpwi r3, 0x0
blt- the_end
mr r31, r3 #Backup file descriptor

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                      ISFS_Read Arguments                        #
#                      r3 = File Descriptor                       #            
# r4 = Address Pointer to Dump Data from File to (32 bit aligned) #
#                 r5 = Amount of Bytes to Dump                    #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r4, r30
li r5, 0x4000

call_isfs ISFS_Read
cmpwi r3, 0x4000
bne- the_end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# ISFS_Close (#1) Arguments #
#    r3 = File Descriptor   #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r3, r31 #Move backed up file descriptor to r3
call_isfs ISFS_Close

#~~~~~~~~~~~~~~~~~#
# Pre-Loop Config #
#~~~~~~~~~~~~~~~~~#

addi r3, r30, -0x1 #Minus one from the heap address pointer, result in r3
li r5, 0x4000

#~~~~~~~~~~#
# the_loop #
#~~~~~~~~~~#

the_loop:
lbzu r4, 0x1 (r3) #Every time this instruction is executed, r3 increases by 0x1
cmpwi r4, 0x7 #The value after the byte 0x07 is usually the country code, but we have to double check
beql- double_check #If equal to 0x7 branch to double_check label and link
subic. r5, r5, 0x1 #Every time this instruction is executed, subtract 1 from r5. Update the Condition Register (cmpwi r5, 0x0)
bne+ the_loop #If not equal to 0x0, run the loop again

b the_end

double_check:
lbz r6, -0x1 (r3) #Load Byte value that is -0x1 away from 0x7 (have to do offset of -0x2 because of the lbzu instruction)
cmpwi r6, 0x10 #Compare Byte to 0x10
bnelr- #If not equal to 0x10, we are still not in the correct spot of SYSCONF, jump to the Link Register. If equal, we are good to proceed.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Write New Values to Temp SYSCONF #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r4, 0x8801 #Country Code followed by Region Residence Code (set flag); Korea w/ Flag On used purely for Compilation!
stw r4, 0x1 (r3) #Store Country Code and Region Residence Code to our temp SYSCONF file
lis r4, 0x3FFF #Set 1st half Globe Location (north pole with slight spin used purely for Compilation!)
ori r4, r4, 0x7500 #Set 2nd half Globe Location
stw r4, 0x1005 (r3) #Store Globe Location to our temp SYSCONF file

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#           ISFS_Open (2nd time)           #
# r4 is now 0x2 for ISFS_Write Permissions #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r3, r29 #Move backed up file path address pointer to r3
li r4, 0x2

call_isfs ISFS_Open

cmpwi r3, 0x0
blt- the_end
mr r31, r3 #Back up file descriptor

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                  ISFS_Write Arguments                     #
#                  r3 = File Descriptor                     #
# r4 = Address Pointer to Data that will be Written to File #
#             r5 = Amount of Bytes to Write                 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mr r4, r30 #Move backed up Heap Address Pointer to r4
li r5, 0x4000

call_isfs ISFS_Write

cmpwi r3, 0x4000
bne- the_end

#~~~~~~~~~~~~~~~~~~~~~~~#
# ISFS_Close (2nd time) #
#~~~~~~~~~~~~~~~~~~~~~~~#

mr r3, r31 #Move backed up file descriptor to r3
call_isfs ISFS_Close

#~~~~~~~~~~~~~~~~#
# OSReturnToMenu #
#~~~~~~~~~~~~~~~~#

the_end:
call_nolink Wii_Menu

#

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



Code creator: zak    Big Grin 

Code credits: Megazig (ISFS functions founder, _OSShutdownToSBY), RiiDefi (EGG functions founder), Star (Helped with Source, and provided info for certain Arguments of certain Functions)

Print this item

  Screenshot
Posted by: Star - 02-23-2019, 06:14 PM - Forum: Cheat Codes - No Replies

Screenshot

This code will allow you to take a screenshot, anytime, at the press of a button. The steps below illustrate the process of converting the file to a viewable .png file:

Wii:
1) Press the button activator to take a screenshot.
2) Navigate to /screenshots directory on your NAND (I recommend using the homebrew application "WiiXplorer" for this).
3) Find the screenshot file (The file naming convention is YYMMDDHHMMSS according to the date and time the screenshot was taken at).
4) Copy the file onto your SD Card / USB.

Computer:
5) Insert the SD Card / USB into your computer.
6) Move the file into the same directory as the "Screenshot Converter" program (Which can be downloaded here: https://mkwii.org/downloads/ScreenshotCodeConverter.zip).
7) Run the program.

Following this, a viewable .png file of the screenshot will be created in the same directory as the executable.

(NTSC-U)
04009644 818C0020
2834XXXX YYYYZZZZ
C2009644 0000004A
818C0020 9421FF30
BC410008 48000015
2F736372 65656E73
686F7473 00000000
7C6802A6 38800000
38A00003 38C00003
38E00003 3FE08016
63EC9DD4 7D8903A6
4E800421 2C03FF97
41A2000C 2C030000
408201F0 3D80801A
618CACBC 7D8903A6
4E800421 38A10080
3D80801A 618CAF08
7D8903A6 4E800421
386100A8 4800002D
2F736372 65656E73
686F7473 2F253032
64253032 64253032
64253032 64253032
64253032 64000000
7C8802A6 80A10094
38C00064 7CE533D6
7CC731D6 7CA62850
80C10090 38C60001
80E1008C 81010088
81210084 81410080
4CC63182 3D808001
618C0ECC 7D8903A6
4E800421 2C030019
40820150 386100A8
38800000 38A00003
38C00003 38E00003
63ECABD4 7D8903A6
4E800421 2C030000
40820128 386100A8
38800002 63ECADBC
7D8903A6 4E800421
2C030000 4180010C
7C7E1B78 3FA0CD80
807D00C0 60630020
907D00C0 38600080
38800020 80ADA358
80A50024 7CBC2B78
3D808022 618C9490
7D8903A6 4E800421
2C030000 418200B0
7C7B1B78 3C80CC00
60842000 38A00080
3D808000 618C5F34
7D8903A6 4E800421
7FC3F378 7F64DB78
38A00080 63ECB220
7D8903A6 4E800421
2C030080 40820058
7FC3F378 809B001C
74851000 41820008
54842834 3C848000
88BB0000 54A52834
88DB0001 54C6E8FE
7CA53378 70A507FE
88DB0049 54C61838
7CA629D6 54A5083C
7CA52214 7CA42850
63ECB220 7D8903A6
4E800421 7F63DB78
7F84E378 3D808022
618C9800 7D8903A6
4E800421 807D00C0
546306F2 907D00C0
7FC3F378 63ECB2E4
7D8903A6 4E800421
B8410008 382100D0
60000000 00000000
E0000000 80008000

(PAL)
04009684 818C0020
2834XXXX YYYYZZZZ
C2009684 0000004A
818C0020 9421FF30
BC410008 48000015
2F736372 65656E73
686F7473 00000000
7C6802A6 38800000
38A00003 38C00003
38E00003 3FE08016
63EC9E74 7D8903A6
4E800421 2C03FF97
41A2000C 2C030000
408201F0 3D80801A
618CAD5C 7D8903A6
4E800421 38A10080
3D80801A 618CAFA8
7D8903A6 4E800421
386100A8 4800002D
2F736372 65656E73
686F7473 2F253032
64253032 64253032
64253032 64253032
64253032 64000000
7C8802A6 80A10094
38C00064 7CE533D6
7CC731D6 7CA62850
80C10090 38C60001
80E1008C 81010088
81210084 81410080
4CC63182 3D808001
618C1A2C 7D8903A6
4E800421 2C030019
40820150 386100A8
38800000 38A00003
38C00003 38E00003
63ECAC74 7D8903A6
4E800421 2C030000
40820128 386100A8
38800002 63ECAE5C
7D8903A6 4E800421
2C030000 4180010C
7C7E1B78 3FA0CD80
807D00C0 60630020
907D00C0 38600080
38800020 80ADA360
80A50024 7CBC2B78
3D808022 618C9814
7D8903A6 4E800421
2C030000 418200B0
7C7B1B78 3C80CC00
60842000 38A00080
3D808000 618C5F34
7D8903A6 4E800421
7FC3F378 7F64DB78
38A00080 63ECB2C0
7D8903A6 4E800421
2C030080 40820058
7FC3F378 809B001C
74851000 41820008
54842834 3C848000
88BB0000 54A52834
88DB0001 54C6E8FE
7CA53378 70A507FE
88DB0049 54C61838
7CA629D6 54A5083C
7CA52214 7CA42850
63ECB2C0 7D8903A6
4E800421 7F63DB78
7F84E378 3D808022
618C9B84 7D8903A6
4E800421 807D00C0
546306F2 907D00C0
7FC3F378 63ECB384
7D8903A6 4E800421
B8410008 382100D0
60000000 00000000
E0000000 80008000

(NTSC-J)
040095E0 818C0020
2834XXXX YYYYZZZZ
C20095E0 0000004A
818C0020 9421FF30
BC410008 48000015
2F736372 65656E73
686F7473 00000000
7C6802A6 38800000
38A00003 38C00003
38E00003 3FE08016
63EC9D94 7D8903A6
4E800421 2C03FF97
41A2000C 2C030000
408201F0 3D80801A
618CAC7C 7D8903A6
4E800421 38A10080
3D80801A 618CAEC8
7D8903A6 4E800421
386100A8 4800002D
2F736372 65656E73
686F7473 2F253032
64253032 64253032
64253032 64253032
64253032 64000000
7C8802A6 80A10094
38C00064 7CE533D6
7CC731D6 7CA62850
80C10090 38C60001
80E1008C 81010088
81210084 81410080
4CC63182 3D808001
618C1950 7D8903A6
4E800421 2C030019
40820150 386100A8
38800000 38A00003
38C00003 38E00003
63ECAB94 7D8903A6
4E800421 2C030000
40820128 386100A8
38800002 63ECAD7C
7D8903A6 4E800421
2C030000 4180010C
7C7E1B78 3FA0CD80
807D00C0 60630020
907D00C0 38600080
38800020 80ADA360
80A50024 7CBC2B78
3D808022 618C9734
7D8903A6 4E800421
2C030000 418200B0
7C7B1B78 3C80CC00
60842000 38A00080
3D808000 618C5F34
7D8903A6 4E800421
7FC3F378 7F64DB78
38A00080 63ECB1E0
7D8903A6 4E800421
2C030080 40820058
7FC3F378 809B001C
74851000 41820008
54842834 3C848000
88BB0000 54A52834
88DB0001 54C6E8FE
7CA53378 70A507FE
88DB0049 54C61838
7CA629D6 54A5083C
7CA52214 7CA42850
63ECB1E0 7D8903A6
4E800421 7F63DB78
7F84E378 3D808022
618C9AA4 7D8903A6
4E800421 807D00C0
546306F2 907D00C0
7FC3F378 63ECB2A4
7D8903A6 4E800421
B8410008 382100D0
60000000 00000000
E0000000 80008000

(NTSC-K)
0400978C 818C0020
2833XXXX YYYYZZZZ
C200978C 0000004A
818C0020 9421FF30
BC410008 48000015
2F736372 65656E73
686F7473 00000000
7C6802A6 38800000
38A00003 38C00003
38E00003 3FE08016
63EC9F10 7D8903A6
4E800421 2C03FF97
41A2000C 2C030000
408201F0 3D80801A
618CB0B8 7D8903A6
4E800421 38A10080
3D80801A 618CB304
7D8903A6 4E800421
386100A8 4800002D
2F736372 65656E73
686F7473 2F253032
64253032 64253032
64253032 64253032
64253032 64000000
7C8802A6 80A10094
38C00064 7CE533D6
7CC731D6 7CA62850
80C10090 38C60001
80E1008C 81010088
81210084 81410080
4CC63182 3D808001
618C1A94 7D8903A6
4E800421 2C030019
40820150 386100A8
38800000 38A00003
38C00003 38E00003
63ECAD10 7D8903A6
4E800421 2C030000
40820128 386100A8
38800002 63ECAEF8
7D8903A6 4E800421
2C030000 4180010C
7C7E1B78 3FA0CD80
807D00C0 60630020
907D00C0 38600080
38800020 80ADA380
80A50024 7CBC2B78
3D808022 618C9B88
7D8903A6 4E800421
2C030000 418200B0
7C7B1B78 3C80CC00
60842000 38A00080
3D808000 618C5F34
7D8903A6 4E800421
7FC3F378 7F64DB78
38A00080 63ECB35C
7D8903A6 4E800421
2C030080 40820058
7FC3F378 809B001C
74851000 41820008
54842834 3C848000
88BB0000 54A52834
88DB0001 54C6E8FE
7CA53378 70A507FE
88DB0049 54C61838
7CA629D6 54A5083C
7CA52214 7CA42850
63ECB35C 7D8903A6
4E800421 7F63DB78
7F84E378 3D808022
618C9EF8 7D8903A6
4E800421 807D00C0
546306F2 907D00C0
7FC3F378 63ECB420
7D8903A6 4E800421
B8410008 382100D0
60000000 00000000
E0000000 80008000

Code:
#============================================================#
#                           Source                           #
#------------------------------------------------------------#
# Draw Debug Bar Call Address Ports:                         #
# RMCE - 0x80009644                                          #
# RMCP - 0x80009684                                          #
# RMCJ - 0x800095E0                                          #
# RMCK - 0x8000978C                                          #
#============================================================#

#============================================================#
#                    Assembler Directives                    #
#============================================================#

.macro push_stack length, registers
       stwu r1, -\length(r1)
       stmw \registers, 8(r1)
.endm

.macro ISFS_absolute_bl register, address
       ori \register, r31, \address@l
       mtctr \register
       bctrl
.endm

.macro absolute_bl register, address
       lis \register, \address@h
       ori \register, \register, \address@l
       mtctr \register
       bctrl
.endm

.macro pop_stack registers, length
       lmw \registers, 8(r1)
       addi r1, r1, \length
.endm

.set region, ''

.if     (region == 'E' || region == 'e') # RMCE
        .set memcpy, 0x80005F34
        .set sprintf, 0x80010ECC
        .set ISFS_CreateDir, 0x80169DD4
        .set ISFS_CreateFile, 0x8016ABD4
        .set ISFS_Open, 0x8016ADBC
        .set ISFS_Write, 0x8016B220
        .set ISFS_Close, 0x8016B2E4
        .set OSGetTime, 0x801AACBC
        .set OSTicksToCalendarTime, 0x801AAF08
        .set EGG_Heap_alloc, 0x80229490
        .set EGG_Heap_free, 0x80229800
.elseif (region == 'P' || region == 'p') # RMCP
        .set memcpy, 0x80005F34
        .set sprintf, 0x80011A2C
        .set ISFS_CreateDir, 0x80169E74
        .set ISFS_CreateFile, 0x8016AC74
        .set ISFS_Open, 0x8016AE5C
        .set ISFS_Write, 0x8016B2C0
        .set ISFS_Close, 0x8016B384
        .set OSGetTime, 0x801AAD5C
        .set OSTicksToCalendarTime, 0x801AAFA8
        .set EGG_Heap_alloc, 0x80229814
        .set EGG_Heap_free, 0x80229B84
.elseif (region == 'J' || region == 'j') # RMCJ
        .set memcpy, 0x80005F34
        .set sprintf, 0x80011950
        .set ISFS_CreateDir, 0x80169D94
        .set ISFS_CreateFile, 0x8016AB94
        .set ISFS_Open, 0x8016AD7C
        .set ISFS_Write, 0x8016B1E0
        .set ISFS_Close, 0x8016B2A4
        .set OSGetTime, 0x801AAC7C
        .set OSTicksToCalendarTime, 0x801AAEC8
        .set EGG_Heap_alloc, 0x80229734
        .set EGG_Heap_free, 0x80229AA4
.elseif (region == 'K' || region == 'k') # RMCK
        .set memcpy, 0x80005F34
        .set sprintf, 0x80011A94
        .set ISFS_CreateDir, 0x80169F10
        .set ISFS_CreateFile, 0x8016AD10
        .set ISFS_Open, 0x8016AEF8
        .set ISFS_Write, 0x8016B35C
        .set ISFS_Close, 0x8016B420
        .set OSGetTime, 0x801AB0B8
        .set OSTicksToCalendarTime, 0x801AB304
        .set EGG_Heap_alloc, 0x80229B88
        .set EGG_Heap_free, 0x80229EF8
.else # Invalid Region
        .abort
.endif

.set NULL, 0

.set STACK_FRAME_LENGTH, 0xD0
.set STACK_FRAME_PRESERVED_REGISTERS_OFFSET, 0
.set STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET, 0x80
.set STACK_FRAME_SCREENSHOT_FILEPATH_BUFFER_OFFSET, 0xA8

.set OSTICKSTOCALENDARTIME_STRUCT_SECONDS_OFFSET, 0x0
.set OSTICKSTOCALENDARTIME_STRUCT_MINUTES_OFFSET, 0x4
.set OSTICKSTOCALENDARTIME_STRUCT_HOURS_OFFSET, 0x8
.set OSTICKSTOCALENDARTIME_STRUCT_DAY_OFFSET, 0xC
.set OSTICKSTOCALENDARTIME_STRUCT_MONTH_OFFSET, 0x10
.set OSTICKSTOCALENDARTIME_STRUCT_YEAR_OFFSET, 0x14

.set ISFS_EOK, 0
.set ISFS_EEXIST, -105

.set ISFS_MAX_PATHNAMELEN, 64
.set ISFS_MAX_FILENAMELEN, 12

.set SCREENSHOT_FILE_PATHNAMELEN, 25

.set ISFS_OPEN_READ, 0x1
.set ISFS_OPEN_WRITE, 0x02
.set ISFS_OPEN_RW, (ISFS_OPEN_READ | ISFS_OPEN_WRITE)

.set SLOT_LED_ON_BITS, 0x20

.set HOLLYWOOD_REGISTERS_BASE, 0xCD800000
.set HOLLYWOOD_GPIOB_OUT_OFFSET, 0xC0

.set VI_REGISTERS_BASE, 0xCC002000
.set VI_REGISTERS_LENGTH, 0x80

#============================================================#
#                            Start                           #
#============================================================#

.globl screenshot
screenshot:

# Original Instruction
lwz r12, 0x20(r12)

# Function Prologue...
push_stack STACK_FRAME_LENGTH, r2

# ISFS_CreateDir arguments
bl branch_link_write_screenshot_directory
.string "/screenshots\0\0\0"
branch_link_write_screenshot_directory:
mflr r3 # Pointer to the filepath
li r4, 0 # attributes
li r5, 3 # owner_perm
li r6, 3 # group_perm
li r7, 3 # other_perm

lis r31, 0x8016

ISFS_absolute_bl r12, ISFS_CreateDir
cmpwi r3, ISFS_EEXIST
beq+ branch_screenshot_directory_already_exists
cmpwi r3, ISFS_EOK
bne- branch_isfs_createdir_failed

branch_screenshot_directory_already_exists:
# OSTicksToCalendarTime arguments
absolute_bl r12, OSGetTime
addi r5, r1, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET

absolute_bl r12, OSTicksToCalendarTime

# sprintf arguments
addi r3, r1, STACK_FRAME_SCREENSHOT_FILEPATH_BUFFER_OFFSET

bl branch_link_write_screenshot_filepath
#                       YY  MM  DD  HH  MM  SS
.string "/screenshots/%02d%02d%02d%02d%02d%02d\0\0"
branch_link_write_screenshot_filepath:
mflr r4 # Pointer to format String

lwz r5, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_YEAR_OFFSET(r1)

# Derive the last two digits from the year
li r6, 100
divw r7, r5, r6
mullw r6, r7, r6
subf r5, r6, r5

lwz r6, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_MONTH_OFFSET(r1)
addi r6, r6, 1
lwz r7, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_DAY_OFFSET(r1)
lwz r8, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_HOURS_OFFSET(r1)
lwz r9, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_MINUTES_OFFSET(r1)
lwz r10, STACK_FRAME_OSTICKSTOCALENDARTIME_STRUCT_OFFSET + OSTICKSTOCALENDARTIME_STRUCT_SECONDS_OFFSET(r1)

crclr 4*cr1+eq
absolute_bl r12, sprintf
cmpwi r3, SCREENSHOT_FILE_PATHNAMELEN
bne- branch_sprintf_failed

# ISFS_CreateFile arguments
addi r3, r1, STACK_FRAME_SCREENSHOT_FILEPATH_BUFFER_OFFSET # Pointer to the filepath
li r4, 0 # attributes
li r5, 3 # owner_perm
li r6, 3 # group_perm
li r7, 3 # other_perm

ISFS_absolute_bl r12, ISFS_CreateFile
cmpwi r3, ISFS_EOK
bne- branch_isfs_createfile_failed

# ISFS_Open arguments
addi r3, r1, STACK_FRAME_SCREENSHOT_FILEPATH_BUFFER_OFFSET # Pointer to the filepath
li r4, ISFS_OPEN_WRITE # Mode

ISFS_absolute_bl r12, ISFS_Open
cmpwi r3, 0 # if (fd < 0)
blt- branch_isfs_open_failed
mr r30, r3 # Preserve the fd in r30

lis r29, HOLLYWOOD_REGISTERS_BASE@h

# Turn on the Wii's Disc Slot LED
lwz r3, HOLLYWOOD_GPIOB_OUT_OFFSET(r29)
ori r3, r3, SLOT_LED_ON_BITS
stw r3, HOLLYWOOD_GPIOB_OUT_OFFSET(r29)

# EGG::Heap::alloc arguments
li r3, VI_REGISTERS_LENGTH # Length of the memory block
li r4, 32 # Alignment of the memory block

# Get the pointer to the System Heap (RKSystem->mpSystemHeap)
.if     (region == 'E' || region == 'e') # RMCE
        lwz r5, -0x5CA8(r13)
.elseif (region == 'P' || region == 'p') # RMCP
        lwz r5, -0x5CA0(r13)
.elseif (region == 'J' || region == 'j') # RMCJ
        lwz r5, -0x5CA0(r13)
.elseif (region == 'K' || region == 'k') # RMCK
        lwz r5, -0x5C80(r13)
.endif

lwz r5, 0x24(r5) # Pointer to the heap to allocate the memory block in
mr r28, r5 # Preserve the pointer to the System Heap in r28

absolute_bl r12, EGG_Heap_alloc
cmpwi r3, NULL
beq- branch_isfs_write_egg_heap_alloc_failed

# memcpy arguments
mr r27, r3 # Preserve the pointer to the allocated memory block in r27
lis r4, VI_REGISTERS_BASE@h # Pointer to the buffer to copy from
ori r4, r4, VI_REGISTERS_BASE@l
li r5, VI_REGISTERS_LENGTH # Number of bytes to copy

absolute_bl r12, memcpy

# ISFS_Write arguments
mr r3, r30 # fd
mr r4, r27 # Pointer to the buffer to write from
li r5, VI_REGISTERS_LENGTH # Number of bytes to write

ISFS_absolute_bl r12, ISFS_Write
cmpwi r3, VI_REGISTERS_LENGTH
bne- branch_isfs_write_failed

# ISFS_Write arguments
mr r3, r30 # fd

# Calculate the address of XFB1
lwz r4, 0x1C(r27)
andis. r5, r4, 0x1000
beq- branch_page_offset_bit_not_set
slwi r4, r4, 5
branch_page_offset_bit_not_set:
addis r4, r4, 0x8000

# Calculate the Screen Height
# uint32 sheight = (uint32)(((viregs[0] << 5) | (viregs[1] >> 3)) & 0x07FE);
lbz r5, 0(r27)
slwi r5, r5, 5
lbz r6, 1(r27)
srwi r6, r6, 3
or r5, r5, r6
andi. r5, r5, 0x7FE

# Calculate the Screen Width
# uint32 swidth = (uint32)(viregs[0x49] << 3);
lbz r6, 0x49(r27)
slwi r6, r6, 3

# Calculate the length of XFB1
# (XFB1 Address + Screen Height * Screen Width * 2) - XFB1 Address
mullw r5, r6, r5
slwi r5, r5, 1
add r5, r5, r4

subf r5, r4, r5 # Number of bytes to write

ISFS_absolute_bl r12, ISFS_Write

branch_isfs_write_failed:
# EGG::Heap::free arguments
mr r3, r27 # Pointer to the block of memory to free
mr r4, r28 # Pointer to the heap where the block of memory to free is located

absolute_bl r12, EGG_Heap_free

branch_isfs_write_egg_heap_alloc_failed:
# Turn off the Wii's Disc Slot LED
lwz r3, HOLLYWOOD_GPIOB_OUT_OFFSET(r29)
rlwinm r3, r3, 0, 27, 25
stw r3, HOLLYWOOD_GPIOB_OUT_OFFSET(r29)

# ISFS_Close argument
mr r3, r30 # fd

ISFS_absolute_bl r12, ISFS_Close

branch_isfs_createdir_failed:
branch_sprintf_failed:
branch_isfs_createfile_failed:
branch_isfs_open_failed:
# Function Epilogue...
pop_stack r2, STACK_FRAME_LENGTH

Notes:
- Extreme overuse of this code may cause wear to the Wii's NAND memory. As per the NAND Manual:

"Wear on Wii Console NAND Memory

Write operations will wear out Wii console NAND memory, so please avoid frequent writing. (Use as virtual memory is prohibited.)
Please limit its average frequency to less than once per minute."

- Screenshot files are not automatically deleted, you are responsible for maintaining them.
- The Wii's Disc Slot LED will turn on when the code is attempting to write the file.

Code Creator: Star
Code Credits: Link and dcx2 (Gecko dotNet Screenshot Code), Chadderz (wii-ct-code), Riidefi (RKSystem Structure and EGG Methods)

Print this item

  Future Fly (Wii Chuck)
Posted by: zak - 02-18-2019, 09:07 PM - Forum: Incomplete/Outdated Codes - No Replies

Future Fly (Wii Chuck)

For Wii Chuck only.

This code is an enhancement of the original Free Fly Code. When the race/battle starts, press your button activate to turn on the code. Use the analog stick to navigate your direction of flight, it has complete range of motion. Press the A button to accelerate when in flight, and B to reverse. Press your button activator again to turn the code off.

This code makes use of memory addresses 0x80001600 thru 0x80001617, make sure no other codes in your GCT/Cheat-Manager are using those addresses!

NTSC-U
04001600 43700000
04001604 42F00000
04001608 43400000
0400160C 43700000
04001610 BD500000
04001614 BD800000
C27E4C9A 00000003
3DE08000 5460063E
1E600004 926F1534
60000000 00000000
2834XXXX YYYYZZZZ
C25AA6FC 0000001B
EC7A01F2 3E408000
3DE08034 3DC0809C
81CED110 81CE0020
82721534 7DCE9A14
81CE0000 81CE0024
81CEFFF8 81CE0008
81CE0008 39CE0010
7C0EF000 40820098
C03E0068 C33E006C
C2FE0070 3DC0808B
C20E053C A1CF1462
C2521610 FE209050
FE508CAE C2321600
71D30400 2C130400
40820014 C2321604
FE208850 FE409050
48000010 71D30800
2C130800 40820028
C27EFF94 EE730472
EC21982A C27EFFA4
EE730472 EF39982A
C27EFFB4 EE730472
EEF7982A C26F14C0
EE5204F2 D25E00E8
C26F14C4 FE609850
C2321614 EE3104F2
D23E00E4 00000000
CC000000 00000000
045AA6FC EC7A01F2
E0000000 80008000

PAL
Needs porting

NTSC-J
Needs porting

NTSC-K
Needs porting

Code creator: mdmwii

Print this item