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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 404
» Latest member: Shutaura
» Forum threads: 1,418
» Forum posts: 7,578

Full Statistics

Online Users
There are currently 55 online users.
» 2 Member(s) | 51 Guest(s)
Bing, Google

Latest Threads
Make it to 10,000
Forum: General Discussion
Last Post: Fzerowii
1 hour ago
» Replies: 2,263
» Views: 1,181,491
Wii & Dolphin Desync
Forum: Code Support / Help / Requests
Last Post: Seeky
1 hour ago
» Replies: 1
» Views: 10
Battle Scorestreaks [Shut...
Forum: Incomplete & Outdated Codes
Last Post: Shutaura
5 hours ago
» Replies: 0
» Views: 12
POW Graphic Mode Modifier...
Forum: Visual & Sound Effects
Last Post: Jerma
Yesterday, 04:26 AM
» Replies: 3
» Views: 1,934
Change combo after track ...
Forum: Code Support / Help / Requests
Last Post: Jerma
Yesterday, 01:10 AM
» Replies: 7
» Views: 3,595
Allow THP 1.0 [TheLordScr...
Forum: Misc/Other
Last Post: TheLordScruffy
11-26-2021, 09:35 PM
» Replies: 0
» Views: 77
I make a wave with the ca...
Forum: Hacking General Discussion
Last Post: WhatisLoaf
11-25-2021, 03:33 PM
» Replies: 2
» Views: 95
Hello !
Forum: Introductions
Last Post: Fzerowii
11-25-2021, 03:20 PM
» Replies: 2
» Views: 143
Pretty Speedometer [stebl...
Forum: Visual & Sound Effects
Last Post: stebler
11-23-2021, 07:03 AM
» Replies: 64
» Views: 33,897
Guide For Calling Functio...
Forum: Power PC Assembly
Last Post: Vega
11-22-2021, 11:02 PM
» Replies: 6
» Views: 6,277

 
  How to overwrite a function; for example memcpy?
Posted by: jawa - 08-29-2021, 07:11 PM - Forum: Code Support / Help / Requests - Replies (2)

Cool Cool

Print this item

  Hello!
Posted by: Takamura - 08-19-2021, 03:32 PM - Forum: Introductions - Replies (8)

Hello! I would like to make various codes for NSMBWii and MKWii. I will post using Google Translate, which can be annoying, but thank you!

Print this item

  Mario Kart 7/8 Style Item Distributions [Sioist]
Posted by: sioist - 08-14-2021, 02:37 AM - Forum: Online; Item - No Replies

This code builds upon XeR's Item Probability Modifier (original post here) for 10 player rooms to now include item tables for all 12 players. This code also now has 11 customizable tiers to simulate the way Mario Kart 7/8 determine item probabilities. This code also works offline.

NTSC-U:
C27ACBC4 00000052
7D8802A6 480001F9
00410000 004B0028
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00140023
00320028 000F0019
00000000 00000000
00000000 00000000
00000000 0000000A
00000019 001E0032
000F000A 00230000
00050000 00000000
00000000 00000000
00050000 0014000A
0014000A 001E0000
0000001E 0014000F
000A0000 00000000
000F000A 000A000F
0000000F 00140000
00000014 00000000
0019001E 000F000F
00000000 00050014
000F000A 000F0000
000A0014 00000000
000A0000 00000014
0032000A 000F0000
00000014 000F000F
000F000A 00000005
000F0000 00000005
00000000 00000041
0000000A 00000019
002D000A 000A000A
000A0000 0000000A
00000000 00000000
00000000 003C0000
00000000 00370046
00000000 00000000
000F0000 00000000
00000000 00000000
00000019 00000000
000F0037 003C0000
00000000 0000002D
00000000 00000000
00000000 00000000
000A0000 00000028
0023002D 00000000
00000000 00460000
00000000 00000000
00000000 00000000
00000000 00F00000
00000000 00000000
000000F0 00000000
00000000 00000000
00000000 00000000
000000F0 00000000
00000000 00000000
00F00000 00000000
PPPPPPPP QQQQQQQQ
RRRRRRRR SSSSSSSS
TTTTTTTT UUUUUUUU
VVVVVVVV WWWWWWWW
XXXXXXXX YYYYYYYY
ZZZZZZZZ 7C8802A6
7D8803A6 3D60809B
616B8F70 816B0000
816B000C 816B0000
396B000C 3980000C
7D8903A6 89970070
1D8C00C4 7D6C5C2E
EDAD6828 C18B0000
FC8C6840 41840008
FDA06090 396B00C4
4200FFEC EDAD5828
ED8C6028 38600000
FC8D6040 41860028
7C8C2378 398C01C8
3960000B 7D6903A6
7D83642E 38630004
FC8D6040 41840008
4200FFF0 5463F0BE
1C630026 00000000

PAL:
C27BB624 00000052
7D8802A6 480001F9
00410000 004B0028
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00140023
00320028 000F0019
00000000 00000000
00000000 00000000
00000000 0000000A
00000019 001E0032
000F000A 00230000
00050000 00000000
00000000 00000000
00050000 0014000A
0014000A 001E0000
0000001E 0014000F
000A0000 00000000
000F000A 000A000F
0000000F 00140000
00000014 00000000
0019001E 000F000F
00000000 00050014
000F000A 000F0000
000A0014 00000000
000A0000 00000014
0032000A 000F0000
00000014 000F000F
000F000A 00000005
000F0000 00000005
00000000 00000041
0000000A 00000019
002D000A 000A000A
000A0000 0000000A
00000000 00000000
00000000 003C0000
00000000 00370046
00000000 00000000
000F0000 00000000
00000000 00000000
00000019 00000000
000F0037 003C0000
00000000 0000002D
00000000 00000000
00000000 00000000
000A0000 00000028
0023002D 00000000
00000000 00460000
00000000 00000000
00000000 00000000
00000000 00F00000
00000000 00000000
000000F0 00000000
00000000 00000000
00000000 00000000
000000F0 00000000
00000000 00000000
00F00000 00000000
PPPPPPPP QQQQQQQQ
RRRRRRRR SSSSSSSS
TTTTTTTT UUUUUUUU
VVVVVVVV WWWWWWWW
XXXXXXXX YYYYYYYY
ZZZZZZZZ 7C8802A6
7D8803A6 3D60809B
616BD730 816B0000
816B000C 816B0000
396B000C 3980000C
7D8903A6 89970070
1D8C00C4 7D6C5C2E
EDAD6828 C18B0000
FC8C6840 41840008
FDA06090 396B00C4
4200FFEC EDAD5828
ED8C6028 38600000
FC8D6040 41860028
7C8C2378 398C01C8
3960000B 7D6903A6
7D83642E 38630004
FC8D6040 41840008
4200FFF0 5463F0BE
1C630026 00000000

NTSC-J:

C27BAC90 00000052
7D8802A6 480001F9
00410000 004B0028
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00140023
00320028 000F0019
00000000 00000000
00000000 00000000
00000000 0000000A
00000019 001E0032
000F000A 00230000
00050000 00000000
00000000 00000000
00050000 0014000A
0014000A 001E0000
0000001E 0014000F
000A0000 00000000
000F000A 000A000F
0000000F 00140000
00000014 00000000
0019001E 000F000F
00000000 00050014
000F000A 000F0000
000A0014 00000000
000A0000 00000014
0032000A 000F0000
00000014 000F000F
000F000A 00000005
000F0000 00000005
00000000 00000041
0000000A 00000019
002D000A 000A000A
000A0000 0000000A
00000000 00000000
00000000 003C0000
00000000 00370046
00000000 00000000
000F0000 00000000
00000000 00000000
00000019 00000000
000F0037 003C0000
00000000 0000002D
00000000 00000000
00000000 00000000
000A0000 00000028
0023002D 00000000
00000000 00460000
00000000 00000000
00000000 00000000
00000000 00F00000
00000000 00000000
000000F0 00000000
00000000 00000000
00000000 00000000
000000F0 00000000
00000000 00000000
00F00000 00000000
PPPPPPPP QQQQQQQQ
RRRRRRRR SSSSSSSS
TTTTTTTT UUUUUUUU
VVVVVVVV WWWWWWWW
XXXXXXXX YYYYYYYY
ZZZZZZZZ 7C8802A6
7D8803A6 3D60809B
616BC790 816B0000
816B000C 816B0000
396B000C 3980000C
7D8903A6 89970070
1D8C00C4 7D6C5C2E
EDAD6828 C18B0000
FC8C6840 41840008
FDA06090 396B00C4
4200FFEC EDAD5828
ED8C6028 38600000
FC8D6040 41860028
7C8C2378 398C01C8
3960000B 7D6903A6
7D83642E 38630004
FC8D6040 41840008
4200FFF0 5463F0BE
1C630026 00000000

NTSC-K:

C27A99E4 00000052
7D8802A6 480001F9
00410000 004B0028
00000000 00000000
00000000 00000000
00000000 00000000
00000000 00140023
00320028 000F0019
00000000 00000000
00000000 00000000
00000000 0000000A
00000019 001E0032
000F000A 00230000
00050000 00000000
00000000 00000000
00050000 0014000A
0014000A 001E0000
0000001E 0014000F
000A0000 00000000
000F000A 000A000F
0000000F 00140000
00000014 00000000
0019001E 000F000F
00000000 00050014
000F000A 000F0000
000A0014 00000000
000A0000 00000014
0032000A 000F0000
00000014 000F000F
000F000A 00000005
000F0000 00000005
00000000 00000041
0000000A 00000019
002D000A 000A000A
000A0000 0000000A
00000000 00000000
00000000 003C0000
00000000 00370046
00000000 00000000
000F0000 00000000
00000000 00000000
00000019 00000000
000F0037 003C0000
00000000 0000002D
00000000 00000000
00000000 00000000
000A0000 00000028
0023002D 00000000
00000000 00460000
00000000 00000000
00000000 00000000
00000000 00F00000
00000000 00000000
000000F0 00000000
00000000 00000000
00000000 00000000
000000F0 00000000
00000000 00000000
00F00000 00000000
PPPPPPPP QQQQQQQQ
RRRRRRRR SSSSSSSS
TTTTTTTT UUUUUUUU
VVVVVVVV WWWWWWWW
XXXXXXXX YYYYYYYY
ZZZZZZZZ 7C8802A6
7D8803A6 3D60809A
616BBD70 816B0000
816B000C 816B0000
396B000C 3980000C
7D8903A6 89970070
1D8C00C4 7D6C5C2E
EDAD6828 C18B0000
FC8C6840 41840008
FDA06090 396B00C4
4200FFEC EDAD5828
ED8C6028 38600000
FC8D6040 41860028
7C8C2378 398C01C8
3960000B 7D6903A6
7D83642E 38630004
FC8D6040 41840008
4200FFF0 5463F0BE
1C630026 00000000

Similar to XeR's code, fill in the item probability weightings as half-words. For 1st place's items, fill in values in the first purple color group. The next color group down (red) is 2nd place's items, then 3rd, then 4th, etc all the way to 12th places items in the final green color group. 


The order of the items is the index of each item, so the first half-word (aka 4 digits) is the weighting for green shells, then red shells, bananas, mushrooms, etc.

When you get an item box, your position no longer matters (unless you are in 1st) for which place box you get. It is dependent on your distance to 1st place. There are 11 different tiers of distances, each one corresponding to 2nd place through 12th place boxes. The distance from 1st place is measured by subtracting your race completion from 1st place's. 

For example, if the first tier is set at a value of 0.10 (0x3DCCCCCD in hex), you will receive 2nd place boxes if, at the time of pulling the item box, your race completion is within 0.10 of first place. This means that you need to be within 10% of a lap on any track to receive 2nd place boxes. Then if the next tier is set at 0.20 (0x3E4CCCCD in hex), your race completion must be within 0.1 and 0.2 to receive 3rd place boxes. Continue with subsequent tiers until last place.

For the last tier, it is recommended you set a large value (at least 3) so that a player doesn't fall so far behind that they exceed the last tier's value.

PPPPPPPP - Tier 1, 2nd place boxes
QQQQQQQQ - Tier 2, 3rd place boxes
.
.
YYYYYYYY - Tier 10, 11th place boxes
ZZZZZZZZ - Tier 11, 12th place boxes


Here is a decimal to float conversion calculator to translate the race completion values into floats to put into the code.

ASM Source:

Code:
.set ptr_playerData, 0x809b8f70

set_up:
  mflr r12
  bl the_code
  # 1st place
  .long 0x00410000
  .long 0x004b0028
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  # 2nd place, lower halfword
  .long 0x00140023
  .long 0x00320028
  .long 0x000f0019
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x0000000a
  .long 0x00000019
  # 3rd place
  .long 0x001e0032
  .long 0x000f000a
  .long 0x00230000
  .long 0x00050000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00050000
  .long 0x0014000a
  # 4th place, lower halfword
  .long 0x0014000a
  .long 0x001e0000
  .long 0x0000001e
  .long 0x0014000f
  .long 0x000a0000
  .long 0x00000000
  .long 0x000f000a
  .long 0x000a000f
  .long 0x0000000f
  .long 0x00140000
  # 5th place
  .long 0x00000014
  .long 0x00000000
  .long 0x0019001e
  .long 0x000f000f
  .long 0x00000000
  .long 0x00050014
  .long 0x000f000a
  .long 0x000f0000
  .long 0x000a0014
  # 6th place, lower halfword
  .long 0x00000000
  .long 0x000a0000
  .long 0x00000014
  .long 0x0032000a
  .long 0x000f0000
  .long 0x00000014
  .long 0x000f000f
  .long 0x000f000a
  .long 0x00000005
  .long 0x000f0000
  # 7th place
  .long 0x00000005
  .long 0x00000000
  .long 0x00000041
  .long 0x0000000a
  .long 0x00000019
  .long 0x002d000a
  .long 0x000a000a
  .long 0x000a0000
  .long 0x0000000a
  # 8th place, lower halfword
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x003c0000
  .long 0x00000000
  .long 0x00370046
  .long 0x00000000
  .long 0x00000000
  .long 0x000f0000
  .long 0x00000000
  # 9th place
  .long 0x00000000
  .long 0x00000000
  .long 0x00000019
  .long 0x00000000
  .long 0x000f0037
  .long 0x003c0000
  .long 0x00000000
  .long 0x0000002d
  .long 0x00000000
  # 10th place, lower halfword
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x000a0000
  .long 0x00000028
  .long 0x0023002d
  .long 0x00000000
  .long 0x00000000
  .long 0x00460000
  .long 0x00000000
  # 11th place
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00f00000
  .long 0x00000000
  .long 0x00000000
  .long 0x000000f0
  .long 0x00000000
  # 12th place, lower halfword
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x000000f0
  .long 0x00000000
  .long 0x00000000
  .long 0x00000000
  .long 0x00f00000
  .long 0x00000000
  # tier data
  .long 0x3d23d70a # 4%
  .long 0x3da3d70a # 8%
  .long 0x3e19999a # 15%
  .long 0x3e4ccccd # 20%
  .long 0x3e800000 # 25%
  .long 0x3eb33333 # 35%
  .long 0x3ee66666 # 45%
  .long 0x3f19999a # 60%
  .long 0x3f4ccccd # 80%
  .long 0x3f8ccccd # 110%
  .long 0x42000000 # 3200%

the_code:
  mflr r4
  mtlr r12

# get player race completion pointer
lis r11, ptr_playerData@h
ori r11, r11, ptr_playerData@l
lwz r11, 0 (r11)
lwz r11, 12 (r11)
lwz r11, 0 (r11)
addi r11, r11, 12

li r12, 12
mtctr r12

# get player index and race completion
lbz r12, 0x70 (r23)
mulli r12, r12, 0xc4
lfsx f11, r12, r11

fsubs f13, f13, f13

# find 1st place's race completion
max_loop:
  lfs f12, 0 (r11)
  fcmpo cr1, f12, f13
  blt cr1, 0x8
  fmr f13, f12
  addi r11, r11, 0xc4
  bdnz+ max_loop

# difference in race completion
fsubs f13, f13, f11
fsubs f12, f12, f12 # set to 0

# if player is in 1st
li r3, 0
fcmpo cr1, f13, f12
beq cr1, the_end

mr r12, r4
addi r12, r12, 456

li r11, 11
mtctr r11

# loop through tiers to decide
# what place item box to give
tiers_loop:
  lfsx f12, r3, r12
  addi r3, r3, 4
  fcmpo cr1, f13, f12
  blt cr1, the_end
  bdnz+ tiers_loop

# multiply to point to correct
# place in probability table
the_end:
  srwi r3, r3, 2 # divide by 4
  mulli r3, r3, 38

Code created by: Sioist
Code credits: XeR

Print this item

  Accurate CPU Finish Times [CLF78]
Posted by: CLF78 - 08-13-2021, 11:07 AM - Forum: Offline Non-Item - No Replies

Makes the CPU's finish times more realistic. This change also affects players not reaching the finish in online races.

NTSC-U
C252F844 00000006
C003000C 38600004
64630004 7C72E3A6
E061A03F 106318D4
EC630028 3C603F60
90610044 C0810044
EC03013A 00000000

PAL
C253438C 00000006
C003000C 38600004
64630004 7C72E3A6
E061A03F 106318D4
EC630028 3C603F60
90610044 C0810044
EC03013A 00000000

NTSC-J
C2533D0C 00000006
C003000C 38600004
64630004 7C72E3A6
E061A03F 106318D4
EC630028 3C603F60
90610044 C0810044
EC03013A 00000000

NTSC-K
C25223E4 00000006
C003000C 38600004
64630004 7C72E3A6
E061A03F 106318D4
EC630028 3C603F60
90610044 C0810044
EC03013A 00000000

Source:

Code:
# Original instruction
lfs f0, 0xC(r3)

# Setup GQR2 for u8
li r3, 4
oris r3, r3, 4
mtspr 914, r3

# Load lap count and convert it
psq_l f3, 0x3F(r1), 1, 2

# Add 1 to it
ps_sum0 f3, f3, f3, f3

# Subtract raceCompletion from it
fsubs f3, f3, f0

# Load multiplier
lis r3, 0x3F60
stw r3, 0x44(r1)
lfs f4, 0x44(r1)

# Multiply and add raceCompletion back
fmadds f0, f3, f4, f0

Code created by: CLF78

Print this item

  Demonstrating the mishandling of FPRs by Dolphin
Posted by: Vega - 08-13-2021, 12:16 AM - Forum: Hacking General Discussion - Replies (2)



Below is a code that will show an output on your screen. Due to how Dolphin doesn't utilize the FPRs 100% correctly compared to how real hardware utilizes them, the code will produce different results on console vs Dolphin. If you are familiar with floating point and paired single stuff in PPC ASM, read the included source below to understand what this code is doing in technical terms.

Code is PAL only, start a race, pick up a box.

C27BA164 00000013
3FA08000 3C00BB0F
6000B824 9001FFFC
C001FFFC 3FC03FD5
63DE5555 3FE05555
63FF5555 BFC1FFF8
C821FFF8 FC000890
100004A0 D81D1500
80BD1500 80DD1504
48000011 25303858
20253038 58000000
7C8802A6 387D1540
4CC63182 3D808001
618C1A2C 7D8903A6
4E800421 4800000D
FFFFFFFF 000000FF
7C6802A6 38830004
38BD1540 3D80801A
618C4EC4 7D8903A6
4E800420 00000000

The code manipulates a simple bug of dolphin leaving 'leftovers' in ps1 in the destination register during the execution of an fmr instruction if the source register contains a double precision float. 

Whenever a float is double precision in the source register of an fmr instruction, Broadway will copy the entire fpr over to the destination register. But because Dolphin runs FPRs as a two 64-bit segments, this does not exactly occur. Thus, we get 'leftovers' in ps1 which we can then manipulate.

Nothing to be concerned about as this bug can only botch poorly handwritten assembly. Thus it won't effect how Wii games run on Dolphin. You can also reproduce this bug with some other instructions as well such as lfd.

Source:

Code:
#PAL = 807BA164


#BF61F70480000000 #Value being placed into f0
#3FD5555555555555 #Value being placed into f1

#Set r29 as 0x8000 for eva usage
lis r29, 0x8000

#Write the single precision float
lis r0, 0xBB0F
ori r0, r0, 0xB824
stw r0, -0x4 (sp)

#place it in f0 (lfs places it in both ps segments)
lfs f0, -0x4 (sp)

#Write the double precision float; use r30 so we can use stmw
lis r30, 0x3FD5
ori r30, r30, 0x5555
lis r31, 0x5555
ori r31, r31, 0x5555
stmw r30, -0x8 (sp)

#Load the double float into f1
lfd f1, -0x8 (sp)

#On real hardware the entire f1 will simply copy over to f0, but on dolphin (due to having fprs as two 64-bit segments) this will not occcur and ps0 of f0 will be a double float while preserving ps1 of f0 from earlier (what was loaded from the lfs instruction)
fmr f0, f1

#Swap the ps segments to show dolphin will utilize the leftover ps1 of f0 which it shouldnt.
ps_merge10 f0, f0, f0

#Store the entire fpr to memory
stfd f0, 0x1500 (r29)

#Load the words into r5 and r6 for sprintf args
lwz r5, 0x1500 (r29)
lwz r6, 0x1504 (r29)

#Set r4 arg of sprintf
bl setupsprintf
.string "%08X %08X"
.align 2
setupsprintf:
mflr r4

#Set r3 arg of sprintf
addi r3, r29, 0x1540

#Clear cr1's eq bit to tell sprintf there are no args in the fprs to use
crclr 6

#Call sprintf
lis r12, 0x8001
ori r12, r12, 0x1A2C
mtctr r12
bctrl

#Setup OSFatal args
bl setupfatal
.long 0xFFFFFFFF #text color; white
.long 0x000000FF #bg color; black
setupfatal:
mflr r3
addi r4, r3, 4
addi r5, r29, 0x1540

#Call OS Fatal
lis r12, 0x801A
ori r12, r12, 0x4EC4
mtctr r12
bctr

Screen results
What shows up on screen on Dolphin (incorrect) - BF61F704 80000000
What shows up on console (correct) - 3FE00000 00000000

I have no idea how the value of 0.5 shows for the console, I was expecting some crazy value or NaN since a double float is being ps swapped. If anybody knows why, please let me know. Couldn't find any info with a quick glance into the Broadway manual. It's definitely some sort of deliberate mechanism the Float Point Unit (FPU) is doing.

Print this item

  USB Geckos for sale
Posted by: KartPlayer - 08-12-2021, 07:00 PM - Forum: Resources and References - No Replies

Wasn't sure where to post this but felt this was the most relevant.

If anyone is interested, a user of the gc-forever forums by the name of webhdx is selling USB Geckos he created using the shuriken gecko clones design. If you are interested send him a PM - https://www.gc-forever.com/forums/member...file&u=701. He is based in Poland. 3D printed cases are included.

Print this item

  Show Quit Confirmation Screen in Single Player [CLF78]
Posted by: CLF78 - 08-12-2021, 10:33 AM - Forum: Offline Non-Item - No Replies

Title is self-explanatory.

NTSC-U
C25FB7B8 00000004
7FE3FB78 3880002C
3D80805F 618C1E54
7D8903A6 4E800421
7FE3FB78 00000000
C25FB8FC 00000004
7FE3FB78 3880002C
3D80805F 618C1E54
7D8903A6 4E800421
7FE3FB78 00000000

PAL
C262C66C 00000004
7FE3FB78 3880002C
3D808062 618C2D08
7D8903A6 4E800421
7FE3FB78 00000000
C262C7B0 00000004
7FE3FB78 3880002C
3D808062 618C2D08
7D8903A6 4E800421
7FE3FB78 00000000

NTSC-J
C262BDB8 00000004
7FE3FB78 3880002C
3D808062 618C2454
7D8903A6 4E800421
7FE3FB78 00000000
C262BEFC 00000004
7FE3FB78 3880002C
3D808062 618C2454
7D8903A6 4E800421
7FE3FB78 00000000

NTSC-K
C261AA64 00000004
7FE3FB78 3880002C
3D808061 618C1100
7D8903A6 4E800421
7FE3FB78 00000000
C261ABA8 00000004
7FE3FB78 3880002C
3D808061 618C1100
7D8903A6 4E800421
7FE3FB78 00000000

Source:

Code:
# Address ports
.set region, ''
.if (region == 'P' || region == 'p')
    .set CreateScreen, 0x80622D08
.elseif (region == 'U' || region == 'u' || region == 'E' || region == 'e')
    .set CreateScreen, 0x805F1E54
.elseif (region == 'J' || region == 'j')
    .set CreateScreen, 0x80622454
.elseif (region == 'K' || region == 'k')
    .set CreateScreen, 0x80611100
.else
    .err
.endif

# Create the screen, the game handles the rest by itself
mr r3, r31
li r4, 0x2C
lis r12, CreateScreen@h
ori r12, r12, CreateScreen@l
mtctr r12
bctrl

# Original instruction
mr r3, r31

Code created by: CLF78

Print this item

  CPUs Always Get Startup Boost [1superchip]
Posted by: 1superchip - 08-12-2021, 01:37 AM - Forum: Offline Non-Item - No Replies

CPUs Always Get Startup Boost [1superchip]

This code causes all CPUs in a race to get the starting boost during the countdown.

NTSC-U:
0472f044 60000000

PAL:
0473ef10 60000000

NTSC-J:
0473e57c 60000000

NTSC-K:
0472d2b8 60000000

Code Creator: 1superchip

Print this item

  Custom Item Probability Distribution Offline [Sioist]
Posted by: sioist - 08-12-2021, 12:25 AM - Forum: Offline; Item - Replies (1)

This code allows you to set custom probabilities for each item in offline VS mode and battle. These probabilities will apply regardless of what position you are in, and also applies to all the CPUs. 

Note: This code uses memory addresses from 0x800007b4 to 0x800007c8.

NTSC-U: 
040007B4 HHIIJJKK
040007B8 LLMMNNOO
040007BC PPQQRRSS
040007C0 TTUUVVWW
040007C4 XXYYZZ00
C27AB704 00000010
3D808000 618C07B4
39600013 7D6903A6
39400000 398CFFFF
8D6C0001 7D4A5A14
4200FFF8 7C8B2378
38600000 7D445378
3D40800F 614A2E40
7D4903A6 4E800421
7D645B78 398CFFED
39600013 7D6903A6
39600000 8D4C0001
7D6B5214 7C035800
41800008 4200FFF0
7D6902A6 39400013
7D6B5050 7D635B78
90770020 00000000


PAL:
040007B4 HHIIJJKK
040007B8 LLMMNNOO
040007BC PPQQRRSS
040007C0 TTUUVVWW
040007C4 XXYYZZ00
C27BA164 00000010
3D808000 618C07B4
39600013 7D6903A6
39400000 398CFFFF
8D6C0001 7D4A5A14
4200FFF8 7C8B2378
38600000 7D445378
3D40800F 614A2EE0
7D4903A6 4E800421
7D645B78 398CFFED
39600013 7D6903A6
39600000 8D4C0001
7D6B5214 7C035800
41800008 4200FFF0
7D6902A6 39400013
7D6B5050 7D635B78
90770020 00000000

NTSC-J:
040007B4 HHIIJJKK
040007B8 LLMMNNOO
040007BC PPQQRRSS
040007C0 TTUUVVWW
040007C4 XXYYZZ00
C27B97D0 00000010
3D808000 618C07B4
39600013 7D6903A6
39400000 398CFFFF
8D6C0001 7D4A5A14
4200FFF8 7C8B2378
38600000 7D445378
3D40800F 614A2E00
7D4903A6 4E800421
7D645B78 398CFFED
39600013 7D6903A6
39600000 8D4C0001
7D6B5214 7C035800
41800008 4200FFF0
7D6902A6 39400013
7D6B5050 7D635B78
90770020 00000000

NTSC-K:
040007B4 HHIIJJKK
040007B8 LLMMNNOO
040007BC PPQQRRSS
040007C0 TTUUVVWW
040007C4 XXYYZZ00
C27AE524 00000010
3D808000 618C07B4
39600013 7D6903A6
39400000 398CFFFF
8D6C0001 7D4A5A14
4200FFF8 7C8B2378
38600000 7D445378
3D40800F 614A2F58
7D4903A6 4E800421
7D645B78 398CFFED
39600013 7D6903A6
39600000 8D4C0001
7D6B5214 7C035800
41800008 4200FFF0
7D6902A6 39400013
7D6B5050 7D635B78
90770020 00000000

Legend:
HH - Green Shell
II - Red Shell
JJ - Banana 
KK - Fake Item Box
LL - Mushroom
MM - Triple Mushrooms
NN - Bomb-ombs
OO - Blue Shell
PP - Lightning
QQ - Star
RR - Golden Mushroom
SS - Mega Mushroom
TT - Blooper
UU - Pow Block
VV - Thunder Cloud
WW - Bullet Bill
XX - Triple Green Shell
YY - Triple Red Shell
ZZ - Triple Banana

Enter in a byte value from 00 to FF for each item. Each value is a weighting for how likely that item is to be pulled, relative to the other item values. For example, to have a 25% chance of pulling a Green Shell, a 75% chance of pulling a Red Shell, and a 0% chance for every other item, the first line would become 040007B4 01030000, with the subsequent lines filled in with zeros. The code will sum the values you entered, which in this case is 4. Now Green Shells have a 1/4 chance of being pulled, and Red Shells have a 3/4 chance. 

If an item is pulled that cannot be pulled because of item limits (such as pulling a Bullet Bill when another player/CPU already has a Bullet Bill) you will receive a mushroom by default. To increase these limits, check the two links below.

https://mkwii.com/showthread.php?tid=242
https://mkwii.com/showthread.php?tid=405

ASM Source:

Code:
.set base, 0x800007B4 # address where values are stored
.set randomizer, 0x800F2E40

lis r12, base@h
ori r12, r12, base@l

# grab sum of weights
li r11, 19
mtctr r11

li r10, 0
subi r12, r12, 0x1

sum_loop:
lbzu r11, 0x1 (r12)
add r10, r10, r11
bdnz+ sum_loop

# --------------

mr r11, r4 # save r4 value

# setup args
li r3, 0
mr r4, r10
lis r10, randomizer@h
ori r10, r10, randomizer@l
mtctr r10
bctrl
mr r4, r11 # restore r4

subi r12, r12, 0x13

li r11, 19
mtctr r11

li r11, 0

weights_loop:
lbzu r10, 0x1 (r12)
add r11, r11, r10
cmpw r3, r11
blt the_end
bdnz+ weights_loop

the_end:
mfctr r11
li r10, 0x13
sub r11, r10, r11
mr r3, r11
stw r3, 0x0020 (r23)

Code Created by: Sioist
Code Credits: Guru, CLF78


I hope to extend this code to allow probability distributions for each separate position, similar to XeR's God code.

Print this item

  Track Music Expander [CLF78]
Posted by: CLF78 - 08-09-2021, 09:09 AM - Forum: Visual & Sound Effects - Replies (2)

This code lets you apply different music for each track (including Nintendo tracks) on CT-CODE and LE-CODE based distributions. Simply place two BRSTMs named SLOT.brstm and SLOT_F.brstm (where SLOT is the track slot in hex) in the "strm" folder. If the file cannot be found, the game will fall back to the original music file(s).

NOTE: LE-CODE support will be redundant from the next build onwards, said version is only posted for packs that use older versions of LE-CODE.

NTSC-U - CT-CODE
C209E01C 00000015
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
40820088 3CC08000
80C60DF4 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C0ECC 7D8903A6
4E800421 38610024
3D808015 618CDEAC
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C270A5F0 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

NTSC-U - LE-CODE
C209E01C 00000018
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
408200A0 3C608054
6063DDE8 80830000
548401BA 7C632214
7C6903A6 4E800421
7C862378 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C0ECC 7D8903A6
4E800421 38610024
3D808015 618CDEAC
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C270A5F0 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

PAL - CT-CODE
C209E0BC 00000015
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
40820088 3CC08000
80C60DF4 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1A2C 7D8903A6
4E800421 38610024
3D808015 618CDF4C
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C2712094 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

PAL - LE-CODE
C209E0BC 00000018
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
408200A0 3C608055
60633E08 80830000
548401BA 7C632214
7C6903A6 4E800421
7C862378 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1A2C 7D8903A6
4E800421 38610024
3D808015 618CDF4C
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C2712094 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

NTSC-J - CT-CODE
C209DFDC 00000015
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
40820088 3CC08000
80C60DF4 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1950 7D8903A6
4E800421 38610024
3D808015 618CDE6C
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C2711700 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

NTSC-J - LE-CODE
C209DFDC 00000018
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
408200A0 3C608055
60633788 80830000
548401BA 7C632214
7C6903A6 4E800421
7C862378 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1950 7D8903A6
4E800421 38610024
3D808015 618CDE6C
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C2711700 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

NTSC-K - CT-CODE
C209E11C 00000015
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
40820088 3CC08000
80C60DF4 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1A94 7D8903A6
4E800421 38610024
3D808015 618CDFC4
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C270043C 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

NTSC-K - LE-CODE
C209E11C 00000018
8861015C 2C03006E
41A20014 2C030053
41A2000C 2C030072
408200A0 3C608054
60631E60 80830000
548401BA 7C632214
7C6903A6 4E800421
7C862378 4800001D
25737374 726D2F25
30337825 732E6272
73746D00 5F460000
7C8802A6 38BD0008
38E40014 391C0150
7D0808AE 2C080066
41820010 2C080046
41820008 38E70002
38610024 3D808001
618C1A94 7D8903A6
4E800421 38610024
3D808015 618CDFC4
7D8903A6 4E800421
2C03FFFF 4182000C
3B410024 48000008
3B410150 00000000
C270043C 00000003
2C000036 40A20008
38800094 38A00000
60000000 00000000

Source 1:

Code:
# Hook = 0x8009E0BC PAL, 0x8009E01C NTSC-U, 0x8009DFDC NTSC-J, 0x8009E11C NTSC-K

# Address Ports
.set region, ''
.if (region == 'P' || region == 'p')
.set ctcodething, 0x80000DF4
.set sprintf, 0x80011A2C
.set DVDConvertPathToEntrynum, 0x8015DF4C
.set lecodething, 0x80553E08
.elseif (region == 'U' || region == 'u' || region == 'E' || region == 'e')
.set ctcodething, 0x80000DF4
.set sprintf, 0x80010ECC
.set DVDConvertPathToEntrynum, 0x8015DEAC
.set lecodething, 0x8054DDE8
.elseif (region == 'J' || region == 'j')
.set ctcodething, 0x80000DF4
.set sprintf, 0x80011950
.set DVDConvertPathToEntrynum, 0x8015DE6C
.set lecodething, 0x80553788
.elseif (region == 'K' || region == 'k')
.set ctcodething, 0x80000DF4
.set sprintf, 0x80011A94
.set DVDConvertPathToEntrynum, 0x8015DFC4
.set lecodething, 0x80541E60
.else
.err
.endif

# Track Expansion Mod Type (c = CT-CODE, l = LE-CODE)
.set game, ''
.if (game != 'l' && game != 'c')
.err
.endif

# Check if we are loading a track song by checking the file's first character
lbz r3, 0x15C(r1)

cmpwi r3, 'n'
beq+ isTrack

cmpwi r3, 'S'
beq+ isTrack

cmpwi r3, 'r'
bne originalTrack

# Get the track slot from the exception vector
isTrack:
.if (game == 'c')
lis r6, ctcodething@ha
lwz r6, ctcodething@l(r6)

# Get the instruction from the lecode address and branch to it, slot is returned in r4
.elseif (game == 'l')
lis r3, lecodething@h
ori r3, r3, lecodething@l
lwz r4, 0(r3)
rlwinm r4, r4, 0, 6, 29
add r3, r3, r4
mtctr r3
bctrl
mr r6, r4
.endif

# Do bl trick
bl trick

# Main format string
.string "%sstrm/%03x%s.brstm"

# Last lap string
.string "_F"
.align 2

# Set main format string
trick:
mflr r4

# Set root path
addi r5, r29, 0x8

# Set last lap string
addi r7, r4, 0x14

# Load last character of filename before the extension
addi r8, r28, 0x150
lbzx r8, r8, r1

# Check for an F either lower or uppercase
cmpwi r8, 'f'
beq isFast

cmpwi r8, 'F'
beq isFast

# Add two to fast lap string if not fast
addi r7, r7, 2

# String buffer (this part of the stack is no longer used at this point in the function)
isFast:
addi r3, r1, 0x24

# Call sprintf
lis r12, sprintf@h
ori r12, r12, sprintf@l
mtctr r12
bctrl

# Call DVDConvertPathToEntrynum
addi r3, r1, 0x24
lis r12, DVDConvertPathToEntrynum@h
ori r12, r12, DVDConvertPathToEntrynum@l
mtctr r12
bctrl

# Check if file exists
cmpwi r3, -1
beq originalTrack

# It does, we can use this path!
addi r26, r1, 0x24
b end

# Original instruction
originalTrack:
addi r26, r1, 0x150

# Return
end:

Source 2:
Code:
# Hook 0x80712094 PAL, 0x8070A5F0 NTSC-U, 0x80711700 NTSC-J, 0x8070043C NTSC-K

# Check if special slot is Galaxy Arena
cmpwi r0, 0x36
bne+ end

# If so replace final lap music with Rainbow Road's
li r4, 0x94

# Original instruction
end:
li r5, 0

Code created by: CLF78

Print this item