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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 646
» Latest member: Luca1337
» Forum threads: 1,815
» Forum posts: 14,000

Full Statistics

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

Latest Threads
Allow Pausing Before Race...
Forum: Offline Non-Item
Last Post: Vega
8 hours ago
» Replies: 0
» Views: 17
Top 10 Most Influential C...
Forum: Coding & Hacking General Discussion
Last Post: Vega
Yesterday, 03:27 PM
» Replies: 2
» Views: 7,355
Show Ice Cube on Online P...
Forum: Online Non-Item
Last Post: _Ro
Yesterday, 08:23 AM
» Replies: 0
» Views: 35
CPU Control Cycler [Ro]
Forum: Offline Non-Item
Last Post: _Ro
Yesterday, 07:56 AM
» Replies: 7
» Views: 1,013
Thunder Cloud Effect Modi...
Forum: Offline; Item
Last Post: JerryHatrick
01-10-2025, 11:13 PM
» Replies: 11
» Views: 1,096
MKW Coder/Developer of th...
Forum: Coding & Hacking General Discussion
Last Post: Vega
01-10-2025, 09:10 PM
» Replies: 10
» Views: 13,848
Make it to 10,000
Forum: General Discussion
Last Post: Vega
01-10-2025, 08:15 PM
» Replies: 7,338
» Views: 5,671,776
Miniturbos and Inside Dri...
Forum: Coding & Hacking General Discussion
Last Post: JerryHatrick
01-10-2025, 09:54 AM
» Replies: 1
» Views: 859
Code request???
Forum: Code Support / Help / Requests
Last Post: DrTap
01-09-2025, 06:06 PM
» Replies: 3
» Views: 4,959
CPUs/Online Players Have ...
Forum: Visual & Sound Effects
Last Post: Zeraora
01-09-2025, 02:26 AM
» Replies: 2
» Views: 516

 
  Room Message Expander [CLF78]
Posted by: CLF78 - 05-03-2021, 01:14 PM - Forum: Online Non-Item - Replies (6)

This code will let you add more room messages than the game normally allows (and also replace existing ones). Please check the Notes below before using this code.

NTSC-U
0262C906 0000XXXX
0262B956 0000XXXX
0262B95A 0000XXXX
0262B2F6 0000XXXX
C262B2FC 00000004
5400083C 3C60YYYY
6063YYYY 7C63022E
382101A0 4E800020
60000000 00000000
C262D06C 00000003
7C741B78 2C030000
40A20008 3A80FFFF
60000000 00000000

PAL
025DC3EA 0000XXXX
025DB3E2 0000XXXX
025DB3E6 0000XXXX
025DAD82 0000XXXX
C25DAD88 00000004
5400083C 3C60YYYY
6063YYYY 7C63022E
382101A0 4E800020
60000000 00000000
C25DCB50 00000003
7C741B78 2C030000
40A20008 3A80FFFF
60000000 00000000

NTSC-J
025DBCC6 0000XXXX
025DACBE 0000XXXX
025DACC2 0000XXXX
025DA65E 0000XXXX
C25DA664 00000004
5400083C 3C60YYYY
6063YYYY 7C63022E
382101A0 4E800020
60000000 00000000
C25DC42C 00000003
7C741B78 2C030000
40A20008 3A80FFFF
60000000 00000000

NTSC-K
025CA586 0000XXXX
025C957E 0000XXXX
025C9582 0000XXXX
025C8F1E 0000XXXX
C25C8F24 00000004
5400083C 3C60YYYY
6063YYYY 7C63022E
382101A0 4E800020
60000000 00000000
C25CACEC 00000003
7C741B78 2C030000
40A20008 3A80FFFF
60000000 00000000

Notes:

  • XXXX = Total amount of messages
  • YYYYYYYY = Address of the array of the BMG IDs (use a 06 code to store the BMG IDs as halfwords)
  • This does not allow adding more "room start" buttons (i haven't figured out how to make them work properly yet, besides removing existing ones).
  • All users must be running the code for it to take effect. Users without it will receive the original messages (or none at all if the message ID is bigger than the amount of original messages).
ASM Sources:

Load BMGs from custom array:
Code:
# Set array location here
.set BMGArray, 0xXXXXXXXX

# Modified original instruction
slwi r0, r0, 1

# Load the BMG ID
lis r3, BMGArray@h
ori r3, r3, BMGArray@l
lhzx r3, r3, r0

# Copy of the game's original instructions to return directly from here
addi r1, r1, 0x1A0
blr

Hide button if message doesn't exist:
Code:
# Original instruction
mr r20, r3

# Check if BMG is 0
cmpwi r3, 0
bne+ end

# Replace r20 with -1 to hide message button
li r20, -1

# Return
end:

Code created by: CLF78

Print this item

  Minimap Opacity Modifier [CLF78]
Posted by: CLF78 - 04-28-2021, 10:52 AM - Forum: Visual & Sound Effects - No Replies

Overrides the minimap's opacity.

NTSC-U
047E0BEC 380000XX

PAL
047EA498 380000XX

NTSC-J
047E9B04 380000XX

NTSC-K
047D8858 380000XX

XX = New opacity (original value is 0x64).

Code created by: CLF78

Print this item

  Porting Addresses
Posted by: Wiimm - 04-24-2021, 08:09 AM - Forum: Wiimm's Tools - Replies (2)

If you create a cheat for Mario Kart Wii and want to adapt it for all regions, then you have to adapt different addresses. With Wiimmfi and CTGPR this process is called porting. With the SZS tools since version 2.25a there are 2 new commands that support porting:

Command wstrt PORT

With this command it is possible to port addresses. To do this, you enter the region (PAL, USA, JAPAN or KOREA) and any number of addresses. The region can be changed in the middle of the command line. If the region is not specified, PAL is used. An attempt is made to port every given address to all other regions.

Further details: https://szs.wiimm.de/cmd/wstrt/port

Porting is still experimental. Therefore, please report errors or missing addresses here.


Command wstrt WHERE

This command is a by-product. This allows you to determine in which memory area the addresses are located. Here, among other things, the various DOL segments and staticR.rel are recognized.

Further details: https://szs.wiimm.de/cmd/wstrt/where

Print this item

  Logical Operations for PPC ASM
Posted by: Vega - 04-23-2021, 11:16 PM - Forum: PowerPC Assembly - No Replies

Logical Operations for PPC ASM

For ASM Coders who already know the basics.



Chapter 1: Fundamentals

Logical Operation Instructions are Instructions that compute a result using Binary/Bit operation. We need to go over some basic vocab first before diving into actual Instructions.

The term "high" or "true" refers to when a Bit has a value of 1.
The term "low" or "false" refers to when a Bit has a value of 0.

The far left-hand bit of any value in a register is known as the "Sign Bit" or the "Most Significant Bit" (aka MSB). The far right-hand bit of any value in a register is known as the "Least Significant Bit" (aka LSB).

Each Bit has an assigned number that we use for easy reference, so other coders can know which bit within a register we are talking about. The MSB is bit 0. The LSB is bit 31. The bit numbers ascend as you move from left to right within a register.

The far left hand bit (first bit) is bit 0. Next bit is bit 1. Then bit 2. All the way until you hit the LSB which is bit 31. Since bit numbering ascends from left to right, this is called "Big Endian" (there's more to the term Big Endian, we're just talking about the bit numbering system).

Logical Operations are done on a bit-by-bit basis! It's important to understand this.

Let's say we have a value in r3 and we preform a logical operation instruction with the value in r27. Bit 0 of r3 will have a logical operation done in reference to bit 0 of r27. Bit 1 of r3 will have an operation done in reference to bit 1 of r27. Bit 2 of r3 will have a logical operation done in reference to bit 3 of r27, and so on and so on.

There are a maximum of 6 types of Logical Operations, they are...
  • Logical OR
  • Logical AND
  • Logical XOR
  • Logical NOR (also known as Logical Not OR)
  • Logical NAND (also known as Logical Not AND)
  • Logical XNOR (also known as Logical EQV or as Logical Not XOR)

The easiest way to understand each Logical Operation is with its corresponding truth table. A truth table is a table/list of the results of all 4 combinations of possible bit operations for a Logical Operation. Each Logical Operation has a unique truth table. They are actually not too hard to remember. You simply need to remember or, and, & xor. After that the other 3 truth tables (nor, nand, xnor respectively) are the just the the flipped versions of the original 3.



Chapter 2: Logical OR

Logical ORing is one of the most commonly used logical operations. ORing means if at least value#1 or value#2 is true, then the result is true.

Truth Table:

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            0
0                1            1
1                0            1
1                1            1

Scaling up from binary to a hex word value, if r3 has a value of 0x00000001, and r27 has a value of 0x80000001, and these two values are OR'd together, it would produce a result of 0x80000001. Confused by this? let's break it down in binary view...

r3  - 0000 0000 0000 0000 0000 0000 0000 0001
r27 - 1000 0000 0000 0000 0000 0000 0000 0001

Remember Logical Operations are done on a per-bit basis. What occurs is this....
  • Bit 0 of r3 is Logically OR'd with Bit 0 of r27. 0 OR'd with 1 = 1.
  • Bit 1 of r3 is Logically OR'd with Bit 1 of r27. 0 OR'd with 0 = 0.
  • Bit 2 of r3 is Logically OR'd with Bit 2 of r27. 0 OR'd with 0 = 0.
  • etc... etc..
  • Bit 31 of r3 is Logically OR'd with Bit 31 or r27. 1 OR'd with 1 = 1.

Every bit in the Source Register will have the Logical Operation done with its corresponding bit in the other Source Register/Immediate Value. Okay let's look at the full result in Binary view...

1000 0000 0000 0000 0000 0000 0000 0001

Convert that to Hex and you get 0x80000001.

Broadway comes with the following Logical OR instructions:

Code:
or rD, rA, rB #rA is OR'd with rB, result placed in rD. This instruction comes with the ability to use the Record feature (free use of cmpwi rD, 0).

ori rD, rA, UIMM #rA is OR'd with 0x0000VVVV with VVVV being UIMM, the result is placed in rD.

oris rD, rA, UIMM #rA is OR'd with 0xVVVV0000 with VVVV being UIMM, the result is placed in rD.

Referring back from the beginner's Assembly Tutorial HERE, you should now have an understanding of why the usage of the lis and ori instructions are preformed to write entire 32-bit (word) values from scratch to a GPR.

You may find yourself in a scenario where you need set a bit high and not mess with the other bits in a register. Here's an example where we need load a value into a register, set its bit value high, then store the value back.

Code:
lwz rX, 0xZZZZ (rY)
oris rX, rX, 0x8000
stw rX, 0xZZZZ (rY)

Fyi: nop is a simplified mnemonic of ori r0, r0, 0x0000
Fyi: mr rD, rA is a simplified mnemonic of or rD, rA, rA #rA is logically OR'd with itself



Chapter 3: Logical AND

Another commonly used logical operation is AND. AND means if both inputs are true, then the result is true, otherwise the result is always false. Here is the Truth Table for AND~

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            0
0                1            0
1                0            0
1                1            1

ANDing operations for Broadway:

Code:
and rD, rA, rB #rA is AND'd with rB; result in rD. Comes with a Record feature if needed.

andi. rD, rA, UIMM #rA is AND'd with 0x0000VVVV with VVVV being UIMM, the result is placed in rD. A form of this instruction withOUT the Record feature does NOT exist. The upper 16 bits of rD will always result in 0x0000!

andis. rD, rA, UIMM #rA is AND'd with 0xVVVV0000 with VVVV being UIMM, the result is placed in rD. A form of this instruction withOUT the Record feature does NOT exist. The lower 16 bits of rD will always result in 0x0000!

ANDing can be a good way to check if certain bits are high. Let's say a r19 has a value and you want to check if bit 30 is high. If not, take the branch

Code:
andi. r0, r19, 0x0002 #Temporarily use r0 to place result in.
bne- some_label

If you were wanting to check if multiple bits are all high, you will need to add in a comparison instruction. Let's redo the same example as earlier but now check if BOTH bots 30 and 31 are high. If not, take branch.

Code:
andi. r0, r19, 0x0003
cmpwi r0, 0x0003
bne- some_label

If you only cared if either one was high, then you don't need the 'cmpwi r0, 0x0003' instruction.



Chapter 4: Logical XOR

XOR aka Exclusive OR is a logical operation that is also pretty common. Logical XOR's only produce a true result when the inputs are opposite values. If both inputs are the same bit value, then the result is always false.

Truth Table of XOR:

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            0
0                1            1
1                0            1
1                1            0

XORing operations for Broadway:

Code:
xor rD, rA, rB #rA is XOR'd with rB; result in rD. Comes with a Record feature if needed.

xori rD, rA, UIMM #rA is XOR'd with 0x0000VVVV with VVVV being UIMM, the result is placed in rD.

xoris rD, rA, UIMM #rA is XOR'd with 0xVVVV0000 with VVVV being UIMM, the result is placed in rD.

A handy trick with XOR is that it can be used to flip a bit value regardless of what the current bit value is. Let's say you are working on a code where r31 is either 0 or 1. For whatever reason, you need this value to flipped (0 to 1; 1 to 0) in your code. A beginner ASM Coder who isn't familiar with XORing might write a source like this..

Code:
#Check r31
cmpwi r31, 0

#Preset r31 to 1 before branch
li r31, 1

#Do branch. If branch is taken, r31 was originally 0 and is now 1, we're done
beq- done

#r31's original value was 1, make it 0
li r31, 0

#Done
done:

That source is frankly silly. Since r31's value (0 or 1) is determined by bit 31 alone, you can simply XOR bit 31 with the value of 1 to flip r31's value.

Code:
xori r31, r31, 0x0001 #Flip slot value. 0 = 1, 1 = 0. Place result in back in r31.

Another trick for XOR'ing is using it as a glorified bit 'subtraction' (removal) mechanism. Check out the source of this code (has logical AND, XOR, & OR) - https://mariokartwii.com/showthread.php?tid=48

What the source is doing is..
1. Checking if a button (key #1; XXXX value) was at least hit (notice the logical AND usage)
2. If so, flip that button's bit low (notice the XOR usage)
3. Make key #2 (YYYY value) button bit high (notice the OR usage)
4. End code with original/default instruction

In conclusion if you need to 'flip' a bit, logical XORing is what you need.



Chapter 5: Other Logical Operations

Broadway also comes with...
  • nor (includes Record feature)
  • nand (includes Record feature)
  • eqv #also known as xnor but you must use the operand eqv in the compiler (includes Record feature)

Logical NOR is the exact opposite of OR. So if any ORing result would be 0, then NOR's result would be 1 and vice versa.

Truth Table of NOR

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            1
0                1            0
1                0            0
1                1            0

If you logically NOR a value with itself, you will actually just flip every bit to it's opposite value. This is known as a logical NOT. You can use the simplified mnemonic 'not' to preform this type of operation.

Code:
not rD, rA #same this as nor rD, rA, rA

Logical NAND is the opposite of AND.

Truth Table of NAND

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            1
0                1            1
1                0            1
1                1            0

Truth Table of EQV aka XNOR (Exclusive NOR); it's the opposite of XOR.

Code:
Bit Value rA  Bit Value rB Bit Result rD
0                0            1
0                1            0
1                0            0
1                1            1



Chapter 6: Conclusion

Understanding logical operation instructions is a must if you are working on a code that has a value in a register that uses bits to represent something such as a characters, levels, maps, items, etc. Happy coding!

Print this item

  Roll Itembox Anytime [1superchip]
Posted by: 1superchip - 04-23-2021, 01:53 AM - Forum: Online; Item - Replies (1)

Roll Itembox Anytime [1superchip]

Allows user to roll item roulette anytime they press their chosen button activator, does not allow for hacked items unless probabilities are modified. Works everywhere.
This code can cause the mushroom bug.

XXXX = Controller Address
ZZZZ = Button Value

NTSC-U
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
8063EE20 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
80848F68 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808078
618CFC2C 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

PAL:
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
80633618 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
8084D728 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808079
618C8C38 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

NTSC-J:
C0000000 00000010
3C608034 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809C
80632678 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809C
8084C788 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808079
618C82A4 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000

NTSC-K:
C0000000 00000010
3C608033 6063XXXX
A0630000 3960ZZZZ
7D601838 7C005800
40A20060 3C60809B
80631C58 2C030000
41A20050 9421FF80
7D8802A6 BC610008
80630014 3C80809B
8084BD68 88840B84
1C840248 7C632214
38800000 38A00000
38C00000 3D808078
618C6FF8 7D8803A6
4E800021 B8610008
7D8803A6 38210080
4E800020 00000000


Source:


#C0 asm

.set region, ''

.if (region == 'E' || region == 'e') # RMCE
    .set ItemFunction, 0x8078fc2c
    .set ItemHolder, 0x809bee20
    .set Racedata, 0x809B8F68
    lis r3, 0x8034
.elseif (region == 'P' || region == 'p') # RMCP
    .set ItemFunction, 0x80798c38
    .set ItemHolder, 0x809C3618
    .set Racedata, 0x809BD728
    lis r3, 0x8034
.elseif (region == 'J' || region == 'j') # RMCJ
    .set ItemFunction, 0x807982a4
    .set ItemHolder, 0x809C2678
    .set Racedata, 0x809BC788
    lis r3, 0x8034
.elseif (region == 'K' || region == 'k') # RMCK
    .set ItemFunction, 0x80786ff8
    .set ItemHolder, 0x809B1C58
    .set Racedata, 0x809ABD68
    lis r3, 0x8033
.else # Invalid Region
    .err
.endif

ori r3, r3, 0xXXXX #controller address
lhz r3, 0 (r3)
li r11, 0xZZZZ #button value
and r0, r11, r3
cmpw r0, r11
bne+ end

lis r3, ItemHolder@ha
lwz r3, ItemHolder@l (r3)

cmpwi r3, 0
beq+ end

stwu sp, -0x0080 (sp) #Make stack frame
mflr r12 #Backup LR because C0
stmw r3, 0x8 (sp)

lwz r3, 0x14 (r3)
lis r4, Racedata@ha
lwz r4, Racedata@l (r4)
lbz r4, 0xb84 (r4) #get player id, will work everywhere
mulli r4, r4, 0x248
add r3, r3, r4

#set parameters as NTSC-U 0x8081527c
li r4, 0
li r5, 0
li r6, 0

lis r12, ItemFunction@h
ori r12, r12, ItemFunction@l
mtlr r12
blrl

lmw r3, 0x8 (sp) #Pop stack frame
mtlr r12 #Recover LR because c0
addi sp, sp, 0x0080

end:
blr


Code Creator: 1superchip
Code Credits: Seeky (RaceData player id)

Print this item

  Anyone got a CTWW Patch? Like in CTGP
Posted by: Fynn935083 - 04-22-2021, 07:46 AM - Forum: Code Support / Help / Requests - Replies (1)

The title explains everything

Print this item

  Always Get Respawn Boost [CLF78]
Posted by: CLF78 - 04-20-2021, 02:01 PM - Forum: Online Non-Item - Replies (2)

You will always get a boost when landing from a respawn.

NTSC-U
0457B4A0 60000000

PAL
04581D04 60000000

NTSC-J
04581684 60000000

NTSC-K
0456FD5C 60000000

Code created by: CLF78

Print this item

  How would i write "if x==some value and y==some value" in a gecko code?
Posted by: jawa - 04-19-2021, 10:50 AM - Forum: Code Support / Help / Requests - Replies (1)

The title explains everything.

Print this item

  Disable Luma [CLF78]
Posted by: CLF78 - 04-17-2021, 01:05 PM - Forum: Visual & Sound Effects - No Replies

This code disables the Luma for Rosalina.

NTSC-U
027B9F1C 00004800

PAL
027C897C 00004800

NTSC-J
027C7FE8 00004800

NTSC-K
027B6D3C 00004800

Note: Nop the address to enable Luma for every character. Change the cmpwi in the previous instruction to change the character that makes Luma load.

Code created by: CLF78

Print this item

  Position Graphic Modifier [1superchip]
Posted by: 1superchip - 04-14-2021, 01:39 AM - Forum: Visual & Sound Effects - No Replies

Position Graphic Modifier [1superchip]

This code forces the position tracker to show a specific rank. Actual position not affected. 

NTSC-U
047ea428 3BE0000X

PAL
047f4a50 3BE0000X

NTSC-J
047f40bc 3BE0000X

NTSC-K
047e2e10 3BE0000X

X Values:
1 = 1st
2 = 2nd
3 = 3rd
4 = 4th
5 = 5th
6 = 6th
7 = 7th
8 = 8th
9 = 9th
A = 10th
B = 11th
C = 12th

Code Creator: 1superchip

Print this item