Super Mario Galaxy 2 [SB4E01]

Started by wiiztec, May 21, 2010, 05:05:58 PM

Previous topic - Next topic

wiiztec

Because of the way gravity works in SMG2 it will probably be very difficult to create a flawless moonjump code,

someone should look into how the game determines what direction is away from the ground
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

wiiztec

brkirch's spin to fly code with the li r0,7 changed to 6 makes a pretty decent moon jump it always goes up no matter what direction up is, for some reason it eventually stops going up though

28750A02 F7FF0800
043EE754 38600006
28750A03 F7FF0000
043EE754 A06306F8
E0000000 80008000

also changing the value to 4 enables bee flight
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

Skiller

Quote from: wiiztec on May 26, 2010, 09:37:35 PM
brkirch's spin to fly code with the li r0,7 changed to 6 makes a pretty decent moon jump it always goes up no matter what direction up is, for some reason it eventually stops going up though

28750A02 F7FF0800
043EE754 38600006
28750A03 F7FF0000
043EE754 A06306F8
E0000000 80008000

also changing the value to 4 enables bee flight

Mainly because this address also changes the Powerups as well .
1 should do something as well that has to do with Power Star ..

wiiztec

Quote from: Skiller on May 26, 2010, 11:09:30 PM
Quote from: wiiztec on May 26, 2010, 09:37:35 PM
brkirch's spin to fly code with the li r0,7 changed to 6 makes a pretty decent moon jump it always goes up no matter what direction up is, for some reason it eventually stops going up though

28750A02 F7FF0800
043EE754 38600006
28750A03 F7FF0000
043EE754 A06306F8
E0000000 80008000

also changing the value to 4 enables bee flight

Mainly because this address also changes the Powerups as well .
1 should do something as well that has to do with Power Star ..

Actually I think it has to do only with power-ups that deal with arial momentum I tried a bunch of different values and bee & flying where the only power up effects I encountered
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

hetoan2

Its different fly types. Theres a different one for bee flight than there is for red star and such.


Check out my site with codes obviously...
http://hetoan2.com/

and youtube...
http://youtube.com/hetoan2

Skiller

Quote from: hetoan2 on May 27, 2010, 12:37:26 AM
Its different fly types. Theres a different one for bee flight than there is for red star and such.

i just know it was one of the Addresses that BP when i made the rainbow power one ..

i guessing red Star and Rainbow power are diffrent :P

i had like 32 addresses BPR for Rainbow powers and that was one :)

brkirch

Moon Jump
C23A2FE0 00000007
48000005 7C8802A6
807F02D4 90640024
807F02D8 90640028
807F02DC 9064002C
3C80806C 48000010
00000000 00000000
00000000 00000000
C2388E44 00000007
3C808075 80840A00
54840529 41820024
48000005 7C8802A6
8064FFD4 907F02D4
8064FFD8 907F02D8
8064FFDC 907F02DC
7FE3FB78 00000000

This moon jump code works by recording the initial jump velocity vector values and then setting Mario's velocity vector to those values whenever the A button is held down.

ZiT

#82
WOW Nice Code!!

It flies straight!!

I transplant this to a Japanese version O0

James0x57



wiiztec

#84
what's with the 2 rows of zero's?

Hmm I don't know what's with em but without em it freezes the game instantly

C23A2FE0 00000006
48000005 7C8802A6
807F02D4 90640024
807F02D8 90640028
807F02DC 9064002C
3C80806C 48000010
60000000 00000000
C2388E44 00000007
3C808075 80840A00
54840529 41820024
48000005 7C8802A6
8064FFD4 907F02D4
8064FFD8 907F02D8
8064FFDC 907F02DC
7FE3FB78 00000000
If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen

brkirch

#85
Quote from: wiiztec on May 27, 2010, 01:05:58 PM
what's with the 2 rows of zero's?

Hmm I don't know what's with em but without em it freezes the game instantly

When the first C2 code executes the zeroes are overwritten and the space is used for storing the initial jump velocity vector data.  If the zeroes are removed then the first C2 will overwrite the second C2 code and the corrupted code will cause the code handler to crash (although in the code you posted it looks like you also didn't correct the branch instruction after removing the zeroes so that probably crashed the game first).  For details on how it works see the commented disassembly of the code below.

The disassembly for the first C2 code:
bl 0x04 #move address of next instruction to LR (offsets off of that address will be used for storing initial jump velocity components within this code)
mflr r4 #move LR to r4
lwz r3,724(r31) #read initial jump velocity x component
stw r3,36(r4) #store a copy of initial jump velocity x component
lwz r3,728(r31) #read initial jump velocity y component
stw r3,40(r4) #store a copy of initial jump velocity y component
lwz r3,732(r31) #read initial jump velocity z component
stw r3,44(r4) #store a copy of initial jump velocity z component
lis r4,-32660 #execute instruction originally at this address
b 0x10 #skip section of code used for data
.word 0x00000000 #initial jump velocity x component is stored here
.word 0x00000000 #initial jump velocity y component is stored here
.word 0x00000000 #initial jump velocity z component is stored here

And the disassembly for the second C2 code:
lis r4,0x8075
lwz r4,0x0A00(r4) #read address 80750A00 (contains current pressed buttons) to r4
rlwinm. r4,r4,0,20,20 #check if button A is pressed
beq- endCode #if button A is not pressed, end code
bl 0x04 #move address of next instruction to LR (offsets off of that address will be used for reading initial jump velocity components contained within above C2 code)
mflr r4 #move LR to r4
lwz r3,-44(r4) #read initial jump velocity x component
stw r3,724(r31) #replace current velocity x component with initial jump velocity x component
lwz r3,-40(r4) #read initial jump velocity y component
stw r3,728(r31) #replace current velocity y component with initial jump velocity y component
lwz r3,-36(r4) #read initial jump velocity z component
stw r3,732(r31) #replace current velocity z component with initial jump velocity z component
endCode:
mr r3,r31 #execute instruction originally at this address

dcx2

#86
Quote from: brkirch on May 27, 2010, 03:07:57 PM
When the first C2 code executes the zeroes are overwritten and the space is used for storing the initial jump velocity vector data.

Brilliant!  Much cleaner solution than using a Gecko Register.  I also like bl 0x04 and mflr to get a pointer to the current area of memory and rlwinm. instead of andi./cmpwi to detect the button press.  (EDIT: Duh, I forgot the . in andi. makes cmpwi moot.) I just might have to change a few of my codes...

I was looking at that disassembly though.  For others who wish to learn from your technique, I would be careful with the bl in the first C2 code - a function that calls no other functions does not have to store LR on the stack, so the bl could break.  Though I'm sure you already took this into account when designing this code.

James0x57

A while ago I did a self-mutating asm hack who's goal was to load the current position of the ASM in RAM into a register. I did that fancy branch over words thing to store what I was searching for. It was 22 instructions..

This bl 0x04 and mflr that brkirch used to do the same thing just laughed in its face with middle fingers up. lol
Very glad to learn! ^_^

[spoiler]
b LOL
.word 0x04071987
.word 0x04071987
.word 0x04071987
/* what's found ^ */
LOL:
lis r11,0x8000
ori r11,r11,0x1000
/* ^ cur address */
lis r9,0x0
/* ^ counter */
lis r10,0x0407
ori r10,r10,0x1987
/* ^ thing to find */
Loop:
lwz r8,0x0(r11)
cmpw 0,r8,r10
bne Reset
addi r9,r9,0x1
b NoReset
Reset:
lis r9,0x0
NoReset:
cmpwi r9,0x3
addi r11,r11,0x4
bne Loop
/* Here r11 is address
of lable "LOL" */
/*------------------*/
sth r11,0x06(r11)
lis r9,0x4800
ori r9,r9,0x40
stw r9,0x08(r11)
/* next time code starts
here with r11 as "LOL" */
blr

Find itself code
C0000000 0000000C
48000010 04071987
04071987 04071987
3D608000 616B1000
3D200000 3D400407
614A1987 810B0000
7C085000 4082000C
39290001 48000008
3D200000 2C090003
396B0004 4082FFE0
B16B0006 3D204800
61290040 912B0008
4E800020 00000000
[/spoiler]


dcx2

#88
Invincibility [DCX2]
04393CC0 38800064
043C3BB8 3800001F
Mario may be slightly red.  You may need to change the 1F a little bit.

Infinite Yoshi Air Kicking (aka Yoshi Moon Jump) [DCX2]
0441BB0C 38000001
I highly suggest using this with wiiztec's no yoshi flutter recharge time

extremely large yellow yoshi light
042C4F0C 4800000C
C22C4EF4 00000002
3C00461C 90030008
38000000 00000000

It should be large enough to reveal the whole level

dcx2

Ground is always normal [DCX2]
04039884 38600000
Lava won't burn you.  Walking over sludge won't slow you down.  Sand won't push you along or drag your feet.  That kind of stuff.  There are probably other neat side effects...if you find some, post a note in this thread!