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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 546
» Latest member: Fishyyyy
» Forum threads: 1,666
» Forum posts: 12,021

Full Statistics

Online Users
There are currently 103 online users.
» 0 Member(s) | 99 Guest(s)
Bing, Discord, Google, Yandex

Latest Threads
Make it to 10,000
Forum: General Discussion
Last Post: Fifty
1 hour ago
» Replies: 5,754
» Views: 4,227,361
Connect to AltWFC again
Forum: Incomplete & Outdated Codes
Last Post: marito_yo
05-03-2024, 06:27 AM
» Replies: 0
» Views: 75
Request: Mission Mode - P...
Forum: Code Support / Help / Requests
Last Post: Wingcapman
05-02-2024, 08:54 PM
» Replies: 0
» Views: 79
Custom Kart Working on Do...
Forum: Code Support / Help / Requests
Last Post: CorvoPSY
04-27-2024, 01:14 PM
» Replies: 1
» Views: 153
Boot into TT cup selectio...
Forum: Misc/Other
Last Post: Vega
04-26-2024, 08:27 PM
» Replies: 3
» Views: 2,954
Request: Custom brsars pe...
Forum: Code Support / Help / Requests
Last Post: lschlick
04-25-2024, 05:45 PM
» Replies: 0
» Views: 66
E-mails not working on th...
Forum: General Discussion
Last Post: Fifty
04-19-2024, 04:56 AM
» Replies: 3
» Views: 428
More missing info from Br...
Forum: Coding & Hacking General Discussion
Last Post: Vega
04-15-2024, 10:04 PM
» Replies: 0
» Views: 269
Request: Custom music vol...
Forum: Code Support / Help / Requests
Last Post: lschlick
04-15-2024, 06:13 PM
» Replies: 0
» Views: 232
Request: Additional sound...
Forum: Code Support / Help / Requests
Last Post: _Ro
04-15-2024, 01:50 AM
» Replies: 6
» Views: 283

 
  Permanently Hex-Edit ASM Codes onto an ISO/WBFS
Posted by: Vega - 12-24-2018, 02:42 AM - Forum: PowerPC Assembly - No Replies

Permanently Hex-Edit ASM Codes onto an ISO/WBFS



This guide will teach you how to perma-edit your ISO/WBFS file with ASM code(s).

This guide is directed towards Linux users. If you are an experienced Wiimm's Tool User on Windows, you should be able to 'convert' the WIT commands to work on your Windows machine.




Chapter 1. Requirements

Basically, you need to be a veteran ASM code creator already. This tutorial will not baby step the 'noobs'. You must already know how to perma edit '04/single line' code types into an ISO already. Thread for that is HERE.

Other requirements:
Have Wiimm Tools installed and know how to run basic wit/szs commands
Have a Hex editor installed (I recommend running HxD via Wine emulation) and know how to use it.




Chapter 2. ISO/WBFS Extraction

Make a copy of your iso/wbfs. Let's assume your copy is at your main user account directory. Also for this guide, we will be using the NTSC-U/RMCE01 game (wbfs file type).

First, extract the ISO/WBFS..

wit extract nameofyourgame.wbfs /home/yourusername/newfolder

NOTE: Don't create the 'newfolder' directory beforehand. Wit tools will create it for you.




Chapter 3. Overview Of What Actions Will Be Done

For this tutorial we will use just one ASM code. Keep in mind, doing this sort of ISO/WBFS editing is very tedious. The more ASM codes you add, the longer and more tedious this will be. For every ASM code you have, you will have to make a separate branch. These branches will branch to a empty spot in RAM (on the main.dol). The actual assembly instructions of your code(s) will be there. After the ASM instructions are executed, there will be more branches to branch back to where you started. Basically, you create your own subroutine via hex edits.

With this method, there's no need for code handlers. You are adding new ASM instructions to the game manually. By the way, using codes with activators and deactivators will be even more tedious to do. First you need to reconfigure your current ASM code(s) to have full ASM act/deacts (no gecko 2833/2834 type stuff). Then you need a code such as THIS to hold 'status' numbers. Obviously, this code to set these 'status numbers' must be able to set a Breakpoint anywhere at any time in the game. This will add more and more branches/subroutines to add after all the other branches that already exist. Once again, this is tedious as f**k..




Chapter 4. Finding The Spot In Main.dol and/or StaticR.rel Where Our Code is

Our first code we want to 'hex edit' in is my first ever revision of my original version of the Air-O-Meter code (NTSC-U version).

Code we will be working with (NTSC-U):
C2576FBC 00000003
8003001C 3D808053
3D6038A0 7D6B0214
916C10A0 00000000

If you are using your own ASM Code, you will want to view this thread . This thread HERE will let you know (via your Code's address) whether or not your code is at the main.dol or StaticR.rel. If its not in either of them, then you cannot use that code for this tutorial unfortunately.

Back to the Air-O-Meter code... It's code address is 0x80576FBC, so it resides in the StaticR.rel. You will also need are RAM Dumps of MKWii. If you have Dolphin Emulator, look at this thread HERE. If not, run this code HERE on your Wii.

Open up your Hex Editor. Open the NTSC-U RAM dump. Press CTRL+G and enter in 576FBC. The word (default ASM hex value) at the address will be 8003001C. Copy the first 3 words (12 bytes) starting at the address.  (80 03 00 1C 90 1D 02 18 7F A3 EB 78). In a new tab on your Hex editor, open up the StaticR.rel file of your extracted ISO/wbfs. 

If your iso/wbfs is not scrubbed, it will be in the /home/yourusername/newfolder/DATA/files/rel/
If your iso/wbfs is scrubbed, it will be in /home/yourusername/newfolder/files/rel

Now on the StaticR.rel file within your Hex editor. Press CTRL+F. In the Search For field, paste in the string of bytes you copied. Change Datatype is Hex. Change Search Direction to 'All'. Run the search.

Keep in mind you may get no results for the codes you are using. But you should already know this is a possibility. If needed, edit your search string accordingly so you can get some results to work with.

So for the Air-O-Meter code, our string is found on the StaticR.rel at first attempt. The address on the StaticR.rel is 0x0006B05C.




Chapter 5. Finding Empty Spot in Main.dol for ASM Functions to reside in

Alright what we want to do is have an empty unused spot in the Main.dol where we will branch too and hex edit in our assembly instructions. This will be sort of hard to figure out what the corresponding live RAM address will be... Open up the iso's main.dol on another tab on your Hex Editor.

At main.dol's address 0x00000100 we see the ascii text for the Metroworks signature. Let's copy the first 4 words (16 bytes). The string will be (4D 65 74 72 6F 77 65 72 6B 73 20 54 61 72 67 65).

Go back to the tab where your NTSC-U RAM Dump is. Press CTRL+F and run a search for the new copied string. Use the same settings as in the 1st search we did from previous chapter.

You will find the string at address 0x00004000. This is where the Metrowerks signature of the main.dol starts on the game's RAM. Let's say we want to use the empty space at 0x00004260. Keep in mind that the further down you go to find an empty space, the more the chances increase of that space actually not being empty and will be used by the game for various functions later on... Be sure your empty space is actually never used by the game!!!

Obviously using search strings for a bunch of zeros to find our empty space is not very practical. For the empty space we are using in this guide, we will do a simple Hex equation to find its spot in main.dol. 0x4260 minus 0x4000 is 0x0260. Go back to your main.dol... 

So we know the Metroworks sig starts at 0x00000100 (which is 0x00004000 in the RAM dump). Now just add 0x260 to 0x100. Our spot in main.dol is address 0x00000360. If you compare the main.dol location and RAM location, you can see we found the right corresponding spots.




Chapter 6. Setting our branch (jumping backwards in memory)

Alright, now we need to write a basic branch. We will need to jump from the StaticR.rel RAM location to the RAM location of our empty space on the main.dol. So take the normal code address for NTSC-U Air-O-Meter (576FBC) and subtract is by our empty space RAM location (4260). Use any handy hex calculator.

576FBC - 4260

The result will be 572D5C. Now do a simple minus one..

Now the result will be 572D5B. Going back to your hex calculator, do this equation...

FFFFFFFF - 572D5B

Now the result will be FFA8D2A4. We now have our branch ASM function to first branch from the StaticR to our empty RAM space. Just add the branch ASM function and use our finalized result as the hex amount for the branch. Like this...

b 0xFFA8D2A4

Open up any ASM compiler. Simply use that instruction and compile it. If you using Python compiler, you can select the RAW ASM option so the basic hex byte instruction gets compiled (not as a whole code). On something like WiiRD GUI. You get a whole (2 line) code compiled. Just grab the hex-byte code of the compiled branch instruction.

The compiled byte code of the branch function is 4BA8D2A4.

Go to the address on the StaticR.rel that we found way back earlier. (0x0006B05C). Replace the word at that address (8003001C) with our new compiled branch word (4BA8D2A4). Save the file. You can close the tab of the StaticR.rel on the Hex Editor, we no longer need it. Nice work, we've created the branch to our empty space. I told you this would be tedious. Onto next chapter...




Chapter 7. Plugging in ASM instructions at Empty Space

Let's take a quick look at the NTSC-U Air-O-Meter code

C2576FBC 00000003
8003001C 3D808053
3D6038A0 7D6B0214
916C10A0 00000000

We don't need to do any decompiling. What we do is just take the compiled hex-byte ASM instructions and plug them in order on our empty space.

NOTE: You don't need to include the '00000000' at the end of the code. In fact, if you do, you will cause the game to freeze. So yea, don't include it.

Another NOTE: If you are using an ASM that ends in a nop (60000000 00000000). You do NOT need the nop, and you obviously don't need the '00000000' after the nop. The nop is there only for Gecko code handler reasons.

Alright on the main.dol file, at the address 0x0360, we will write in the word 8003001C. The next address 0x364, will be written with 3D808053. Just repeat this til you have done all the compiled byte code of the ASM code. Here's an overview of what our empty space within the main.dol...

Address ByteCode:
0x360 8003001C
0x364 3D808053
0x368 3D6038A0
0x36C 7D6B0214
0x370 916C10A0

Alrighty nice work. We got our ASM instructions filled in for our made up subroutine. All we need do now is branch back....




Chapter 8. Branching back (jumping forward in memory)

The formula to calculate the branch back will be similar to how we did the first branch.

So if we look back at the list of our newly written empty space, we see our last instruction was main.dol's address of 0x0370 (which would be the RAM's address of 0x4270). If we were to continue stepping thru the game, the next address (in RAM) will be 0x4274. That spot will contain the next compiled byte code of the branch back ASM.

For branching back after our code is done executing, we do NOT want to branch back to our exact starting address (0x80576FBC). If we do that, the game will result in an infinite loop (game will freeze). We need to branch just one step after that. That RAM Address will be 0x80576FC0. Let's do the formula..

Take the value 576FC0 and subtract is by the value 4274...

The result will be 572D4C. Do the minus one...
Now the result will be 572D4B.

FFFFFFFF - 572D4B is FFA8D2B4.

Alright now the difference here is that when we write the branch instruction for compiling, we put our result as a NEGATIVE number. Like this...

b -0xFFA8D2B4

That is our ASM function to branch back. Put that into your compiler, and the compiled byte code is...

48572D4C

As you can see, you actually don't need this formula for the branch back. Just take your initial result when you first subbed the two address values and add a '48' in front of the result. Simple.

Ok, now going back to your main.dol file on the Hex Editor. Now just write in the value 48572D4C at address 0x0374.

Nice job. You did it! Save the changes. Close your Hex Editor.




Chapter 9. Rebuilding ISO & Testing

First, there are .bak extensions of the main.dol and StaticR that are in their respective directories. Move them to a safe place for backup. After testing, you can delete them if you want.

Open a terminal in your main user directory. run this command...

wit copy ./newfolder nameofNEWgame.wbfs

Command will take about 5 minutes or so...

WBFS/ISO is now rebuilt with the Air-O-Meter! Plug in the WBFS/ISO on USB for the Wii. Test your ISO. If you did everything correctly, the Air-O-Meter code will be working. Keep in mind this version of Air-O-Meter only works for Solo Racing in TT mode.

Side NOTE: This version of Air-O-Meter code doesn't work on Dolphin.




Chapter 10. Troubleshooting

Even if you used a code for this guide that doesn't work in Dolphin, you can still run it in Dolphin to see if your branches are correct.

Apply the cheat to your Dolphin (however you prefer to do it). Set an Instruction Breakpoint with the Memory Address of your Code. Once the Breakpoint 'break's, bring up your Code view tab. Use the "Step" function (while looking at the Code view), and step thru the game one ASM function at a time.

You should first navigate to the RAM address 0x4260. After the ASM functions are executed, you will hit another branch function and branch to right after your Code's address (0x4 beyond).




Chapter 11. Conclusion 

I told you this would be tedious. It's a lot of work. Especially dealing with more than one ASM code. And it's insanely tedious if you are working with codes that are using activators + de-activators.

Print this item

  Advantageous Character/Vehicle Selection [Vega]
Posted by: Vega - 12-22-2018, 08:30 PM - Forum: Incomplete & Outdated Codes - No Replies

Advantageous Character/Vehicle Selection [Vega]

NOTE: Outdated by my Perfect Character/Vehicle Selection code which also selects combos based on CC.

This code will select the 'best' character/vehicle combination for whatever track is chosen in the lottery for the race. Everything is done automatically. Whatever character you choose to start the WW/Room with is what will be shown during every track vote. Be sure to choose Manual when starting the WW/Room.

If you pick Battle with this code on, you will be given Funky Kong w/ Standard Kart.

NOTE about using this in Wiimmfi WW's: This code will get you banned on Wiimmfi.

Tracks that use Daisy w/ Mach:
rDKJP
rDKM

Tracks that use Toadette w/ Magi:
rSL
rSGB

Tracks that use Funky w/ Spear:
LC
MC
rPB
rYF

All other tracks will use Funky w/ Flame Runner

NTSC-U
C2659400 00000011
899C003C 2C0C00FF
41820074 280C0020
41A0000C 39801602
48000060 2C0C0000
4182004C 2C0C0008
41820044 2C0C0010
4182003C 2C0C0013
4182002C 2C0C0014
4182002C 2C0C001B
4182002C 2C0C001D
41820014 2C0C001F
4182001C 39801617
48000018 39800F16
48000010 39801620
48000008 39800D1E
B19C001C 909C000C
60000000 00000000

PAL
C266133C 00000011
899C003C 2C0C00FF
41820074 280C0020
41A0000C 39801602
48000060 2C0C0000
4182004C 2C0C0008
41820044 2C0C0010
4182003C 2C0C0013
4182002C 2C0C0014
4182002C 2C0C001B
4182002C 2C0C001D
41820014 2C0C001F
4182001C 39801617
48000018 39800F16
48000010 39801620
48000008 39800D1E
B19C001C 909C000C
60000000 00000000

NTSC-J
C26609A8 00000011
899C003C 2C0C00FF
41820074 280C0020
41A0000C 39801602
48000060 2C0C0000
4182004C 2C0C0008
41820044 2C0C0010
4182003C 2C0C0013
4182002C 2C0C0014
4182002C 2C0C001B
4182002C 2C0C001D
41820014 2C0C001F
4182001C 39801617
48000018 39800F16
48000010 39801620
48000008 39800D1E
B19C001C 909C000C
60000000 00000000

NTSC-K
C264F654 00000011
899C003C 2C0C00FF
41820074 280C0020
41A0000C 39801602
48000060 2C0C0000
4182004C 2C0C0008
41820044 2C0C0010
4182003C 2C0C0013
4182002C 2C0C0014
4182002C 2C0C001B
4182002C 2C0C001D
41820014 2C0C001F
4182001C 39801617
48000018 39800F16
48000010 39801620
48000008 39800D1E
B19C001C 909C000C
60000000 00000000



Source:

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

#

#~~~~~~~~~~~~~~~~~~#
# Load Track Value #
#~~~~~~~~~~~~~~~~~~#

lbz r12, 0x003C (r28) #Load the byte from address of 28 plus offset 0x3C into r12. This is the lottery selected track byte.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Check If Track Has Been Picked Yet #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpwi r12, 0xFF #Compare r12 to value of 0xFF
beq- tracknot_pickedyet #If value in r12 is equal to 0xFF, then we know the lottery hasn't been initiated yet. Skip entire code.

cmplwi r12, 0x20 #Compare r12 to value of 0x20
blt+ vs_tracks #Battles Tracks are values 0x20 thru 0x29, if less than 0x20, we know we are in VS Race

li r12, 0x1602 #Set Funky w/ Standard kart for all Battle tracks

b the_end

#~~~~~~~~~~~~~~~~~~~~~~~#
# Check VS Track Values #
#~~~~~~~~~~~~~~~~~~~~~~~#

vs_tracks:
cmpwi r12, 0x00 #Mario Circuit
beq- fk_spear
cmpwi r12, 0x08 #Luigi Circuit
beq- fk_spear
cmpwi r12, 0x10 #GCN Peach Beach
beq- fk_spear
cmpwi r12, 0x13 #GCN DK Mountain
beq- daisy_mach
cmpwi r12, 0x14 #DS Yoshi Falls
beq- fk_spear
cmpwi r12, 0x1B #N64 Sherbet Land
beq- toadette_magi
cmpwi r12, 0x1D #N64 DK's Jungle Parkway
beq- daisy_mach
cmpwi r12, 0x1F #GBA Shy Guy Beach
beq- toadette_magi

li r12, 0x1617 #Load 0x1617 into r12. This will set Funky Kong w/ Flame Runner for any other track

b the_end #Jump to the_end label

#~~~~~~~~~~~~~~~~~~~~~~~#
# Daisy Mach Bike Label #
#~~~~~~~~~~~~~~~~~~~~~~~#

daisy_mach:
li r12, 0x0F16 #Load 0x0F16 into r12. This will set Daisy w/ Mach Bike.
b the_end #Jump to the_end label

#~~~~~~~~~~~~~~~~~~~~~~~~#
# Funky Kong Spear Label #
#~~~~~~~~~~~~~~~~~~~~~~~~#

fk_spear:
li r12, 0x1620 #Load 0x1620 into r12. This will set Funky w/ Spear.
b the_end #Jump to the_end label

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Toadette Magikruiser Label #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

toadette_magi:
li r12, 0x0D1E #Load 0D1E into r12. This will set Toadette w/ Magi.

#~~~~~~~~~~~~~~~#
# The_End Label #
#~~~~~~~~~~~~~~~#

the_end:
sth r12, 0x001C (r28) #Store the character/vehicle halfword value to the address of r28 plus offset 0x1C.

#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Tracknot_Pickedyet Label #
#~~~~~~~~~~~~~~~~~~~~~~~~~~#

tracknot_pickedyet:
stw r4, 0x000C (r28) #Default Instruction

#

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



Code creator: Vega

Print this item

  Remove Worldwide Option [Chadderz]
Posted by: Vega - 12-19-2018, 08:07 PM - Forum: Online Non-Item - No Replies

Remove Worldwide Option [Chadderz]

Also known as Disable WW Button. This code will completely remove the Worldwide option at the WiFi main menu.

NTSC-U
0261866E 00000005
046186FC 60000000
04618724 60000000
0461873C 60000000
04618748 60000000
026188FE 00000001
0261892A 00000484
0261893A 000010D7
026189A2 00000484
026189AE 000010D7

PAL
0264B982 00000005
0464BA10 60000000
0464BA38 60000000
0464BA50 60000000
0464BA5C 60000000
0264BC12 00000001
0264BC3E 00000484
0264BC4E 000010D7
0264BCB6 00000484
0264BCC2 000010D7

NTSC-J
0264AFEE 00000005
0464B07C 60000000
0464B0A4 60000000
0464B0BC 60000000
0464B0C8 60000000
0264B27E 00000001
0264B2AA 00000484
0264B2BA 000010D7
0264B322 00000484
0264B32E 000010D7

NTSC-K
02639C9A 00000005
04639D28 60000000
04639D50 60000000
04639D68 60000000
04639D74 60000000
02639F2A 00000001
02639F56 00000484
02639F66 000010D7
02639FCE 00000484
02639FDA 000010D7

Code creator: Chadderz

Print this item

  Change Background Color [RiiDefi]
Posted by: Vega - 12-19-2018, 07:35 PM - Forum: Visual & Sound Effects - No Replies

Change Background Color [RiiDefi]

The colors of any voids in the game will change you what is set in the code.

NTSC-U
044250E0 XXYYZZ00

PAL
04429460 XXYYZZ00

NTSC-J
04428DE0 XXYYZZ00

NTSC-K
04417480 XXYYZZ00

XXYYZZ = Hex Color Code
XX = Amount of Red
YY = Amount of Green
ZZ = Amount of Blue

Code creator: RiiDefi

Print this item

  Some Useful Memory Strings
Posted by: Vega - 12-19-2018, 07:15 PM - Forum: Coding & Hacking General Discussion - No Replies

If you are using a live RAM viewer (such as Aldelaro5's dolphin-memory-engine) on Dolphin. You can use the following strings below to look at certain useful regions of memory that can assist you for making codes, or just understanding how certain modes in MKWii work.



55441000 00001458 = IP Address Packet

This string will lead you a bit before the spot in dynamic memory that holds all the IP Addresses of a Room/WW. Take the memory address of where this string is exactly at, then add 0x03CC to it. That value will be the exact memory address for Player slot 0's IP Address. Then just add 0x30 every time for the location of the next slot's IP Address.

Note about IP listing: If there are guests in the room, it will mess up where the IP addresses are slotted. The game doesn't store duplicate IP Addresses when guests are present.

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 for you...
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)



5544000D 00000184 = ITEM SPY Packet

This string will lead to to ITEM SPY Packet. Everybody's items will be shown in an organized listing along with their trailing/circling item plus tail_mode.



55440006 000003F8 = SELECT Packet

This string will lead to the beginning of the SELECT Packet. This packet of information shows everybody's character with vehicle they are using. It also shows what track everybody has voted (including random). The track that is picked by the lottery, along with client slot is also in this packet. Keep in mind this info will only show during track voting.

Here are some offset values (take the address where you found the beginning of the string and add the offset value to it)
0x28 = Halfword for your Position of Previous Race
0x2A = Halfword for your current amount of GP points achieved
0x2C = Your Character (will be 0x30 until you have selected a track)
0x2D = Your Vehicle (will be 0x24 until you have selected a track)
0x2E = What Track you picked (will be 0x43 until you have selected a track, FF designates that you chose random)
0x4C = Track Selected (will be 0xFF until the lottery sequence begins)
0x4D = Lottery Status (0x1 = Waiting, 0x2 = Lottery occuring)
0x4E = Player Slot Who Won Track Pick
0x4F = CC of Race/Room-GP

Your info will always be listed first. You will see this information listed for every other player as well that are in the room/WW.



5544000C 000001C8 (2nd one listed on search results) = Current Item Probability Table for VS

This string will lead to the beginning of your current Item Probability Table in Race for non-battle modes. The table pretty much remains static once it is loaded when the race begins unless someone DC's during the race. When that occurs, the item table will modify itself accordingly once you pick up your next box. This info (plus string) will only appear in memory during live racing.



5544000D 000009F0 = USER Packet

This is a very powerful packet to observe. The packet of information for USER packet will only be shown when you are connected in a WW/Battle.

Here are some offset values (take the address where you found the beginning of the string and add the offset value to it)

0x22 thru 0x35 = Your Mii Name
0x38 = Your Mii's Avatar ID (word)
0x3C = Your Mii's Client ID (word); if Mii made on your Wii, this can be used to get your MAC Address
0xB8 = Your Wii ID (double-word)
0xC0 = Your FC (double-word)
0xC8 = Country Code (will be 0xFF if not set)
0xC9 = Region Residence Code (will be 0xFF if not set)
0xCA = Will be Halfword of zeros if country+residence was set. If not it will be 0xFFFF
0xCC = Globe Location (word)
0xD0 = VR (halfword)
0xD2 = BR (halfword)
0xD4 = Region/Language Code of Game ID
0xD5 = Region ID

What's powerful about this packet is that it will also show this info for everybody else! Your information will always be listed first.



55440006 000001EC (the only result within Mem90) = Client Sided Mii Display Data

This packet will show your Mii Name Data that is displayed for you when viewing your Mii when online. Manipulating this data will NOT be shown to other people's screens.

Print this item

  Universal Meter [SwareJonge]
Posted by: SwareJonge - 12-16-2018, 10:47 PM - Forum: Time Trials & Battle - Replies (9)

Universal Meter [SwareJonge]

Works everywhere.

Instead of having separate codes/threads for Air, Mini-Turbo Charge, Shroom Boost, etc. This code will allow you to choose one of those options to use within one whole code. The Universal Meter can be broken up with the following...

Air-O-Meter
Boost from MT Release Meter
Boost from both MT & Stand Still Release Meter
Blue Mini Turbo Only Charge Meter**
Orange Mini Turbo Only Charge Meter**
Mushroom/Zipper Boost Meter
Stand Still Charge Meter
Trick Boost Meter

**If you are looking for the MT Charge Meter that reads both Blue & Orange levels, that is HERE.
***If you are looking for the Speed-O-Meter, that is HERE.
This code will read the output value of the selected option on the millisecond section of your timer.

XXX Values:
0FE = Blue Mini Turbo Only Charge Meter
100 = Orange Mini Turbo Only Charge Meter
102 = Boost from Mini Turbo Release Meter
10C = Boost from Both MT and Stand Still Release Meter
110 = Mushroom/Zipper Boost Meter
114 = Trick Boost Meter
14C = Stand Still Charge Meter
21A = Air Time Meter
There are more to find here: https://github.com/SeekyCt/mkw-structure...ayer.h#L16

(NTSC-U)
047ED9F8 48D12608
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 60638F68
38800000 4B02D415
7C641B78 3C60809C
8063D110 4B0898B9
4B089F31 A3830XXX
7D635B78 7D846378
4B2ED9C4 00000000

(PAL)
047F84F8 48D07B08
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063D728
38800000 4B031F5D
7C641B78 3C60809C
806318F8 4B0900DD
4B090755 A3830XXX
7D635B78 7D846378
4B2F84C4 00000000

(NTSC-J)
047F7B64 48D0849C
07500000 00000040
7C6B1B78 7C8E2378
3C60809B 6063C788
38800000 4B0318DD
7C641B78 3C60809C
80630958 4B08FA5D
4B0900D5 A3830XXX
7D635B78 7D846378
4B2F7B30 00000000

(NTSC-K)
047E68B8 48D19748
07500000 00000040
7C6B1B78 7C8E2378
3C60809A 6063BD68
38800000 4B01FFB5
7C641B78 3C60809B
8063FF38 4B07E135
4B07E7AD A3830XXX
7D635B78 7D846378
4B2E6884 00000000



Code Creator: SwareJonge
Code Contributor: JoshuaMK(Miliseconds Display Modifier)
Code Credits: Seeky, Stebler, 1superchip(https://github.com/SeekyCt/mkw-structures)



Code:
# First ASM(04)
.set region, ' ' #Use E/P/J/K, lowercase letters can be used too.

.if    (region == 'E' || region == 'e') # RMCE
.set miliSecondsModifier, 0x807ED9F8
.elseif (region == 'P' || region == 'p') # RMCP
.set miliSecondsModifier, 0x807F84F8
.elseif (region == 'J' || region == 'j') # RMCJ
.set miliSecondsModifier, 0x807F7B64
.elseif (region == 'K' || region == 'k') # RMCK
.set miliSecondsModifier, 0x807E68B8
.else # Invalid Region
    .err
.endif

b (0x81500000 - miliSecondsModifier) # branch to the 06 code

Code:
# Second ASM(06)
.set region, ' ' #Use E/P/J/K, lowercase letters can be used too.

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

.set codePosition, 0x81500000

.if (region == 'E' || region == 'e') # RMCE
.set getHudSlotPlayerId, 0x8052D428
.set getPlayerByID, 0x805898DC # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x80589F58 # returns pointer to PlayerSub10

.set raceData, 0x809B8F68
.set PlayerHolder, 0x809BD110
.set returnBranch, 0x807ED9FC

.elseif (region == 'P' || region == 'p') # RMCP
.set getHudSlotPlayerId, 0x80531f70
.set getPlayerByID, 0x80590100 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x8059077c # returns pointer to PlayerSub10

.set raceData, 0x809BD728
.set PlayerHolder, 0x809C18F8
.set returnBranch, 0x807F84FC

.elseif (region == 'J' || region == 'j') # RMCJ
.set getHudSlotPlayerId, 0x805318F0
.set getPlayerByID, 0x8058FA80 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x805900FC # returns pointer to PlayerSub10

.set raceData, 0x809BC788
.set PlayerHolder, 0x809C0958
.set returnBranch, 0x807F7B68

.elseif (region == 'K' || region == 'k') # RMCK
.set getHudSlotPlayerId, 0x8051FFC8
.set getPlayerByID, 0x8057E158 # returns pointer to PlayerHolderPlayer
.set getPlayerSub10, 0x8057E7D4 # returns pointer to PlayerSub10

.set raceData, 0x809ABD68
.set PlayerHolder, 0x809AFF38
.set returnBranch, 0x807E68BC
.else # Invalid Region
    .err
.endif

.set _mtc , 0xFE #MT Charge
.set _omtc, 0x100 #Kart Only Orange MT Charge
.set _mtb, 0x102 #Boost from MT Release
.set _ssmtb, 0x10C #Boost from both Stand Still Charge & MT's
.set _mushb, 0x110 #Mushroom/Zipper Boost
.set _trikb, 0x114 #Trick Boost
.set _ssc, 0x14C #Stand Still Charge
.set _air, 0x21A #Air Time

  mr r11, r3 # backup r3 and r4
  mr r12, r4
  lis r3, raceData@h
  ori r3, r3, raceData@l
  li r4, 0x0 # set Playerslot to 0
  bl -((codePosition + 0x14) - getHudSlotPlayerId)
  mr r4, r3 # copy r3 to r4 because we need the slot in the second argument
  lis r3, PlayerHolder@ha
  lwz r3, PlayerHolder@l(r3)
  bl -((codePosition + 0x24) - getPlayerByID)
  bl -((codePosition + 0x28) - getPlayerSub10)
  lhz r28, _XXX(r3) # set this to one of the value mentioned above
  mr r3, r11 # restore registers we've messed with
  mr r4, r12
  b -((codePosition + 0x38) - returnBranch)

TODO: perhaps find the function that returns raceData and PlayerHolder to save some lines of code

Print this item

  Universal Meter [Vega]
Posted by: Vega - 12-16-2018, 09:59 PM - Forum: Incomplete & Outdated Codes - No Replies

Universal Meter [Vega]

NOTE: Outdated by SwareJonge's version. Jonge's version also works in ghost TTs, Offline VS, and Grand Prix.

Works in Online VS and in TT's. When in TT mode, only do Solo Racing. Does NOT work in Grand Prix, Offline VS, or any type of Battle.

Instead of having separate codes/threads for Air, Mini-Turbo Charge, Shroom Boost, etc. This code will allow you to choose one of those options to use within one whole code. The Universal Meter can be broken up with the following...

Air-O-Meter
Boost from MT Release Meter
Boost from both MT & Stand Still Release Meter
Blue Mini Turbo Only Charge Meter**
Orange Mini Turbo Only Charge Meter**
Mushroom/Zipper Boost Meter
Stand Still Charge Meter
Trick Boost Meter

**If you are looking for the MT Charge Meter that reads both Blue & Orange levels, that is HERE.
***If you are looking for the Speed-O-Meter, that is HERE.

This code will read the output value of the selected option on the millisecond section of your timer.

XXX Values:
0FE = Blue Mini Turbo Only Charge Meter
100 = Orange Mini Turbo Only Charge Meter
102 = Boost from Mini Turbo Release Meter
10C = Boost from Both MT and Stand Still Release Meter
110 = Mushroom/Zipper Boost Meter
114 = Trick Boost Meter
14C = Stand Still Charge Meter
21A = Air Time Meter

NTSC-U
C2590F20 00000003
B36300C8 A1630XXX
3D808053 3D6B38A0
916C10A0 00000000

PAL
C2597744 00000003
B36300C8 A1630XXX
3D808053 3D6B38A0
916C5BE8 00000000

NTSC-J
C25970C4 00000003
B36300C8 A1630XXX
3D808053 3D6B38A0
916C5568 00000000

NTSC-K
C258579C 00000003
B36300C8 A1630XXX
3D808052 3D6B38A0
916C3C40 00000000



Source:
#Values per Region

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

.if (region == 'E' || region == 'e') # RMCE
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x10A0
.elseif (region == 'P' || region == 'p') # RMCP
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5BE8
.elseif (region == 'J' || region == 'j') # RMCJ
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5568
.elseif (region == 'K' || region == 'k') # RMCK
    .set _1sthalf, 0x8052
    .set _2ndhalf, 0x3C40
.else # Invalid Region
    .abort
.endif

.set _mtc , 0xFE #MT Charge
.set _omtc, 0x100 #Kart Only Orange MT Charge
.set _mtb, 0x102 #Boost from MT Release
.set _ssmtb, 0x10C #Boost from both Stand Still Charge & MT's
.set _mushb, 0x110 #Mushroom/Zipper Boost
.set _trikb, 0x114 #Trick Boost
.set _ssc, 0x14C #Stand Still Charge
.set _air, 0x21A #Air Time

sth r27, 0x00C8 (r3) #Default Instruction

lhz r11, _air (r3) #Air Time used just for compilation, use whatever value/label you want

lis r12, _1sthalf #Set 1st half address of Millisecond Display Mod
addis r11, r11, 0x38A0 #Add 0x38A00000 to value of r11
stw r11, _2ndhalf (r12) #Replace instruction at address of Millisecond Display Mod



Code creator: Vega
Code credits: Bully (Millisecond Display Modifier Code creator); mdmwii (subroutine founder for Millisecond Display)

Print this item

  Lagometer [Riidefi]
Posted by: Star - 12-16-2018, 09:51 PM - Forum: Misc/Other - No Replies

Lagometer [Riidefi]

This code measures how long it took the last frame to complete. It renders the bar after the global scene director has completed rendering.

(NTSC-U)
04238B90 4E800020
040095C0 48238284
04241860 4BDC7D6C
0400975C 482382B0
04241A28 4BDC7D40

(PAL)
04238F14 4E800020
04009600 48239100
0424271C 4BDC6EF0
0400979C 4823912C
042428E4 4BDC6EC4

(NTSC-J)
04238E34 4E800020
0400955C 482390C4
0424263C 4BDC6F2C
040096F8 482390F0
04242804 4BDC6F00

(NTSC-K)
04239288 4E800020
04009708 4823936C
04242A90 4BDC6C84
040098A4 48239398
04242C58 4BDC6C58

Code Creator: Riidefi

Print this item

  Mini Turbo Charge Meter [Vega]
Posted by: Vega - 12-16-2018, 07:20 PM - Forum: Incomplete & Outdated Codes - Replies (8)

Mini Turbo Charge Meter [Vega]

NOTE: Outdated by my version in main codes forum. The version in main forum works everywhere except Battle.

Works in TT mode, and in any VS type Online Racing. When in TT mode, only do Solo Racing. Does NOT work in Grand Prix, Offline VS, or any type of Battle.

This code will read the output value of your MT charge (including Orange MT for Karts) on the millisecond section of your timer. Works for all vehicles.

For Bike Usage: A reading of '270' indicates MT is fully charged ready for boost.
For Kart Usage: Once the first/initial reading reaches 270 (blue MT is fully charged), the milliseconds recycle. Then a reading of '300' indicates the Orange MT is fully charged ready for boost.

NTSC-U
C2590F20 00000005
B36300C8 A1630100
2C0B0000 40820008
A16300FE 3D808053
3D6B38A0 916C10A0
60000000 00000000

PAL
C2597744 00000005
B36300C8 A1630100
2C0B0000 40820008
A16300FE 3D808053
3D6B38A0 916C5BE8
60000000 00000000

NTSC-J
C25970C4 00000005
B36300C8 A1630100
2C0B0000 40820008
A16300FE 3D808053
3D6B38A0 916C5568
60000000 00000000

NTSC-K
C258579C 00000005
B36300C8 A1630100
2C0B0000 40820008
A16300FE 3D808052
3D6B38A0 916C3C40
60000000 00000000



Source:
#Values per Region

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

.if (region == 'E' || region == 'e') # RMCE
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x10A0
.elseif (region == 'P' || region == 'p') # RMCP
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5BE8
.elseif (region == 'J' || region == 'j') # RMCJ
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5568
.elseif (region == 'K' || region == 'k') # RMCK
    .set _1sthalf, 0x8052
    .set _2ndhalf, 0x3C40
.else # Invalid Region
    .abort
.endif

sth r27, 0x00C8 (r3) #Default Instruction

lhz r11, 0x0100 (r3) #Load Orange MT. If Zero, load Blue MT instead.
cmpwi r11, 0x0
bne- skip_blue

lhz r11, 0x00FE (r3) #Load Blue MT

skip_blue: #Replace Instruction, which contains MT value, at address of Millisecond Display Mod
lis r12, _1sthalf
addis r11, r11, 0x38A0 #Add 0x38A00000 to r11
stw r11, _2ndhalf (r12)



Code creator: Vega
Code credits: Bully (Millisecond Display Modifier Code creator); mdmwii (subroutine founder for Millisecond Display)

Print this item

  Speed-O-Meter [mdmwii]
Posted by: Vega - 12-16-2018, 04:50 PM - Forum: Time Trials & Battle - Replies (2)

Speed-O-Meter [mdmwii]

Works everywhere.

This code will put your current vehicle speed in the milliseconds section of your timer.

NTSC-U
C27ED9F8 00000008
3F80809C 839CD110
839C0020 541A103A
7F9CD02E 839C0010
839C0010 839C0024
9381FFFC C1A1FFFC
FDA06A10 FDA0681C
D9A1FFF8 8381FFFC
60000000 00000000

PAL
C27F84F8 00000008
3F80809C 839C18F8
839C0020 541A103A
7F9CD02E 839C0010
839C0010 839C0024
9381FFFC C1A1FFFC
FDA06A10 FDA0681C
D9A1FFF8 8381FFFC
60000000 00000000

NTSC-J
C27F7B64 00000008
3F80809C 839C0958
839C0020 541A103A
7F9CD02E 839C0010
839C0010 839C0024
9381FFFC C1A1FFFC
FDA06A10 FDA0681C
D9A1FFF8 8381FFFC
60000000 00000000

NTSC-K
C27E68B8 00000008
3F80809B 839CFF38
839C0020 541A103A
7F9CD02E 839C0010
839C0010 839C0024
9381FFFC C1A1FFFC
FDA06A10 FDA0681C
D9A1FFF8 8381FFFC
60000000 00000000



Code creator: mdmwii
Code credits: JoshuaMK (millisecond display modifier that works everywhere), Vega (improvements to source), Chadderz (fixes to mdmwii's original pointer loads so the speedometer can work on any kart+character combination)



Source:
#START ASSEMBLY

#Address Ports
#807ED9F8 NTSC-U
#807F84F8 PAL
#807F7B64 NTSC-J
#807E68B8 NTSC-K

#Source Compilation Region
.set region, '' #Use E/P/J/K. Lowercase letters work too.

#Macros & Statements
.if (region == 'E' || region == 'e') # RMCE
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0xFFFFD110 (r28)
.endm
.elseif (region == 'P' || region == 'p') # RMCP
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0x18F8 (r28)
.endm
.elseif (region == 'J' || region == 'j') # RMCJ
.macro set_playerbase
lis r28, 0x809C
lwz r28, 0x0958 (r28)
.endm
.elseif (region == 'K' || region == 'k') # RMCK
.macro set_playerbase
lis r28, 0x809B
lwz r28, 0xFFFFFF38 (r28)
.endm
.else # Invalid Region
.err
.endif

#Register Notes
#r26 = safe
#r28 = safe

#Set Region-Specific Player-Base
set_playerbase

#Pointer Level Loading
lwz r28, 0x0020 (r28) #Load Word from 1st Level Pointer
slwi r26, r0, 2 #Shift the bits of r0 by 2 to the left, result in r11. This is the same as multiplying by 0x4. r0 is current player slot.
lwzx r28, r28, r26 #Load into 2nd Level Pointer
lwz r28, 0x0010 (r28) #Load into 3rd Level Pointer
lwz r28, 0x0010 (r28) #Load into 4th Level Pointer
lwz r28, 0x0024 (r28) #Load into 5th Level Pointer, r12 now contains the float (single precision) word for your Vehicle Speed

#Convert Vehicle Float Speed; account for negative speed, use standard rounding
stw r28, -0x4 (sp)
lfs f13, -0x4 (sp)
fabs f13, f13
fctiw f13, f13

#Replace Default Instruction (set r28's value for timer)
stfd f13, -0x8 (sp)
lwz r28, -0x4 (sp)

#END ASSEMBLY

Print this item