Posted on 06-12-16, 10:36 pm
Super Koopa
That MvL Hacker

Karma: 1701
Posts: 44/833
Since: 04-11-15
Posted by skawo
Move Petey Piranha and Mummypokey bosses to different worlds

There's some absolutely retarded code that deletes Peach if Worlds 2 and 5 are cleared when you enter the boss battles with Mummypokey and Petey Piranha. If this code isn't adjusted and you move the bosses to a different world, this happens if you try battling them again:

https://www.youtube.com/watch?v=q_zleiDDP6Y

Hooray. Here's the fix;

-------
010050E30C00001A7C009FE5 -> 0X0050E30C00001A7C009FE5
040050E30B00001A48009FE5 -> 0X0050E30B00001A48009FE5
-------
010050E30300001A34009FE50010A0E3 -> 0X0050E30300001A34009FE50010A0E3
040050E30200001A20009FE50010A0E3 -> 0X0050E30200001A20009FE50010A0E3
-------
94009FE5200090E5010050E30100000A040050E3 -> 94009FE5200090E50X0050E30100000A0X0050E3

200090E5010050E30100000A040050E31B00001A9F3AFBEB -> 200090E50X0050E30100000A0X0050E31B00001A9F3AFBEB

200090E5010050E30100000A040050E31C00001A0000A0E34571FBEB -> 200090E50X0050E30100000A0X0050E31C00001A0000A0E34571FBEB

200090E5010050E30100000A040050E31C00001A0000A0E3BB6EFBEB -> 200090E50X0050E30100000A0X0050E31C00001A0000A0E3BB6EFBEB

Replace the Xes with the world numbers your relocated bosses appear in. The first two patches go together, so put the Mummypokey boss in the first one and then the Petey boss in the second one.


Out of curiosity, could this work in MvL?
_________________________
Here's my MvL Hacking thread

Consider joining the NSMB DS Hacking Discord Server! Also, be sure to check out the new wiki!

#HakingNoMore
Posted on 06-12-16, 10:50 pm


Karma: 19807
Posts: 358/1100
Since: 04-02-13
Probably not
Posted on 06-18-16, 04:53 pm
Death by cuteness

Karma: 6589
Posts: 412/598
Since: 05-01-13
Not content with my latest code, I decided to upgrade the mod so that you no longer have to use Sprite 231 (Water):


Wavy backgrounds:
repl_020B181C_ov_00: MOV R10, #0 @Assigns a value of 0 to R10 BX LR @Returns repl_0215E9E8_ov_36: STMFD SP!,{R1-R3,R12,LR} @Pushs R1, R2, R3, R12 and R14 in the stack STR R0, [R4] @Stores the Level Actor BL 0x20B163C @Calls the function that allows the backgrounds to move in a wavy fashion LDMFD SP!,{R1-R3,R12,PC} @Pops R1, R2, R3, R12 and R15 from the stack


For those who are not familiar with the ASM-Template:
_In Notepad++, create a new file
_Copy/paste the code above
_Save the file with an extension .s (for example wavebg.s)
_The file must be located in the Source folder of the ASM-template
_In NSMBe, click 'Run make and insert'

You can also read this thread that explain what is the ASM-template and how to use it:
http://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/


If someone wants the code without having to use the ASM-Template, I can post it too.
Posted on 06-19-16, 04:54 pm
Death by cuteness

Karma: 6589
Posts: 413/598
Since: 05-01-13
Improved Blue Shell for ASM-Template:
repl_021111DC_ov_0A: STMFD SP!, {R6-R7} ADD R7, PC, #0x164 ADD LR, PC, #0 BX R7 CMP R1, R6 ADDLT PC, PC, #0x14 CMP R0, #0 MOVLT R0, R6 RSBLT R0, R0, #0 MOVGE R0, R6 LDMFD SP!, {R6-R7} B 0x21111F4 LDMFD SP!, {R6-R7} B 0x21111FC repl_021114D8_ov_0A: STMFD SP!, {R6-R7} LDR R6, =0x203A784 LDR R6, [R6] LDR R6, [R6, #0x2F8] LDR R6, [R6, #0x7B0] TST R6, #0x80 MOVEQ R0, #0 ADDNE R0, R0, #0x80 CMP R0, #0 ADDNE PC, PC, #4 LDMFD SP!, {R6-R7} B 0x21114E0 ADD R7, PC, #0x100 ADD LR, PC, #0 BX R7 LDR R7, =0x203A784 LDR R7, [R7] LDR R7, [R7, #0x2F8] LDR R1, [R7, #0xC4] LDR R2, [R7, #0xC8] CMP R1, R2 MOVEQ R1, #1 MOVNE R1, #0 CMP R2, #0 RSBLT R6, R6, #0 CMP R1, #0 STRNE R6, [R7, #0xC4] STR R6, [R7, #0xC8] LDMFD SP!, {R6-R7} B 0x2111528 repl_0211162C_ov_0A: TST R2, #0x80 @Check if D-Pad_Down is pressed ADDNE R0, R0, #0x80 CMP R0, #0 BNE 0x2111634 B 0x211169C repl_02111874_ov_0A: STMFD SP!, {R6-R7} ADD R7, PC, #0xA0 ADD LR, PC, #0 BX R7 MOV R1, R6 LDMFD SP!, {R6-R7} B 0x2111878 repl_021122E8_ov_0A: STMFD SP!, {R6-R7} ADD R7, PC, #0x84 ADD LR, PC, #0 BX R7 CMP R0, #0 MOVLT R0, R6 RSBLT R0, R0, #0 MOVGE R0, R6 LDMFD SP!, {R6-R7} B 0x21122F8 repl_02112574_ov_0A: STMFD SP!, {R6-R7} ADD R7, PC, #0x5C ADD LR, PC, #0 BX R7 CMP R0, #0 MOVLT R0, R6 RSBLT R0, R0, #0 MOVGE R0, R6 LDMFD SP!, {R6-R7} B 0x2112584 repl_02115D14_ov_0A: STMFD SP!, {R6-R7} ADD R7, PC, #0x34 ADD LR, PC, #0 BX R7 CMP R0, R6 ADDGE PC, PC, #4 LDMFD SP!, {R6-R7} B 0x2115D40 LDMFD SP!, {R6-R7} LDR R0, =0x203A784 LDR R0, [R0] LDR R0, [R0, #0x2F8] LDR R0, [R0, #0x7B0] TST R0, #0x80 BNE 0x2115D18 B 0x2115D40 @Relative function STMFD SP!, {LR} LDR R6, =0x203A784 LDR R7, =0x208B350 @Pointer for Starman duration counter LDR R7, [R7] @Get Starman remaining time CMP R7, #0 @Check if Starman counter is 0 MOVNE R7, #4 LDR R6, [R6] LDR R6, [R6, #0x2F8] LDR R6, [R6, #0x264] @Get Mario's current action CMP R6, #0 @Check if Mario is airborne MOVEQ R7, #0 LDR R6, =0x212E344 @Pointer for running speed LDR R6, [R6, R7] @Get max speed LDMFD SP!, {PC}


Copy/paste in an empty file in Notepad++ and save as ****.s (for example blueshell.s).

Basically if you run at max speed, you have to press (and maintain) D-Pad_Down to get Mario rolling in his shell, otherwise he runs as he would without a shell.
Also Blue Shell's speed is increased under the effects of a Starman.
Posted on 06-19-16, 05:41 pm (rev. 1 by  KingYoshi on 06-19-16, 06:09 pm)
Fire Snake
Eugene

Karma: 3810
Posts: 835/1156
Since: 11-29-11
Posted by MeroMero
Copy/paste in an empty file in Notepad++ and save as ****.s (for example blueshell.s).


Actually, you can also just use Windows Notepad :')

EDIT:



This is how it'll look in-game.
Posted on 06-19-16, 09:22 pm
Death by cuteness

Karma: 6589
Posts: 414/598
Since: 05-01-13
Posted by skawo
On the topic of codes, however, they do also stop functioning - well, some of them -- after my ASM is applied. So there's that. Applying the template moves something.

Actually the answer is quite simple:

At offset 0×2065F10, you get the arena starting offset, which is normally 0×21901F8.
At offset 0×203A784 (which is the one I use for consistency), you get the first arena item offset, which is normally 0×2190200.
Custom ASM Hacks from the ASM-Template begin at offset 0×21901E0, thus shifting the arena offset further.
The more ASM hacks you put in, the more that address will be put higher and higher.

In other words, if one of your mods needs to fetch something at an offset above 0×21901E0, chances are you will need more LDR Rx, [Rx] than expected.

The latest Blue Shell code I did take into account that particularity.
You shouldn't have any problem now porting this into Newer Super Mario Bros,  skawo.
Posted on 06-22-16, 09:39 am (rev. 1 by Sherry_ on 06-22-16, 09:39 am)


Karma: 1430
Posts: 283/355
Since: 05-26-15
Thanks for these, MeroMero. In particular, the second will be very useful.

Here are the files *.s, you can use these instead of creating one .
wavebg.s
blueshell.s

Posted on 06-22-16, 01:07 pm
Fire Snake
Eugene

Karma: 3810
Posts: 839/1156
Since: 11-29-11
Posted by Sherry
Thanks for these, MeroMero. In particular, the second will be very useful.

Here are the files *.s, you can use these instead of creating one .
wavebg.s
blueshell.s



I don't think those download URLs were really needed. I mean, if you don't know how to make a text doc and change the extention, you shouldn't even try inserting an ASM Hack in NSMBe, using the Template.
Posted on 06-22-16, 01:37 pm


Karma: 1430
Posts: 285/355
Since: 05-26-15
Well, the files *.s were not only for those who did not know how to create one.
They served, too, for someone who did not want to create your own ...
Posted on 06-22-16, 02:28 pm


Karma: 19807
Posts: 383/1100
Since: 04-02-13
Posted by MeroMero
You shouldn't have any problem now porting this into Newer Super Mario Bros,  skawo.


Very, very nice.
Could you do the mini mushroom gravity thing like this too?
Posted on 06-22-16, 02:36 pm
Death by cuteness

Karma: 6589
Posts: 417/598
Since: 05-01-13
For some reason I thought I had posted it already but no, so here it is:

Light gravity fix for ASM-Template:
nsub_02106514_ov_0A: LDRSB R1, [R1, #0xAC] STMFD SP!, {R1} LDR R1, =0x208B168 LDR R1, [R1] LDRB R1, [R1, #2] TST R1, #2 ADDNE PC, PC, #4 LDMFD SP!, {R1} B 0x2106518 LDMFD SP!, {R1} B 0x210658C

Posted on 06-22-16, 02:45 pm


Karma: 19807
Posts: 384/1100
Since: 04-02-13
*bows*
Posted on 06-22-16, 02:50 pm
Death by cuteness

Karma: 6589
Posts: 418/598
Since: 05-01-13
Wait before bowing down, otherwise that would be awkward for both of us if it happens to not work
Posted on 06-22-16, 02:55 pm


Karma: 19807
Posts: 385/1100
Since: 04-02-13
It appears to work.
Posted on 06-22-16, 03:03 pm
Death by cuteness

Karma: 6589
Posts: 419/598
Since: 05-01-13
Awesome!

I'm also porting the pipe fix, that's what I have so far:
nsub_021175B0_ov_0A: MOV R12, LR MOV R2, R12 CMP R3, R12 BLT 0x21175C0 B 0x21175E4 nsub_0211761C_ov_0A: LDRH R2, [R0, #0x64] CMP R2, #0xB000 @Check if Mario stands atop a World-Cannon LDRGTH R3, [R0, #0x66] ADDGT R3, R3, #1 STRGTH R3, [R0, #0x66] MOVLT R3, #0x2000 STRLTH R3, [R0, #0x64] LDR R3, [R0, #0x930] B 0x2117620


The second one is still WIP but you can use the first one already.
What the first patch does is that it calibrates Mario's position upon entering a vertical pipe to be exactly at the center, every time without fail. Mostly useful to hide the Blue Shell.
Posted on 06-22-16, 04:15 pm


Karma: 19807
Posts: 386/1100
Since: 04-02-13
Do you have a patch like this for horizontal pipes?
Posted on 06-22-16, 04:17 pm
Death by cuteness

Karma: 6589
Posts: 420/598
Since: 05-01-13
This is what the second patch is supposed to fix once done.
Posted on 06-22-16, 04:18 pm (rev. 1 by  skawo on 06-22-16, 04:18 pm)


Karma: 19807
Posts: 387/1100
Since: 04-02-13
Ah, OK. Noted.
I'm thinking we should split ASM template patches from this thread, perhaps.
Posted on 06-24-16, 08:12 pm (rev. 2 by  MeroMero on 06-27-16, 10:49 am)
Death by cuteness

Karma: 6589
Posts: 426/598
Since: 05-01-13
Pipe fix for ASM-Template:
nsub_021175B0_ov_0A: MOV R12, LR @Center Mario upon entering a vertical pipe MOV R2, R12 CMP R3, R12 BLT 0x21175C0 B 0x21175E4 repl_0211D0A4_ov_0A: STMFD SP!, {R0,LR} ADD R1, PC, #0x30 ADD LR, PC, #0 BX R1 LDR R1, [R5, #0x64] ADD R1, R1, R0 @Begin level from pipe at Start or Midway STR R1, [R5, #0x64] LDMFD SP!, {R0,PC} repl_021189F8_ov_0A: STMFD SP!, {LR} ADD R1, PC, #0x10 ADD LR, PC, #0 BX R1 LDR R1, [SP, #0x10] ADD R1, R1, R0 @Load new area from pipe entrance LDMFD SP!, {PC} @relative function: STMFD SP!, {LR} LDR R0, =0x20CA8FE LDRB R1, [R0] @Load current entrance (not always equal to Entrance ID) from placeholder entrance MOV R0, #0x14 MUL R1, R0, R1 LDR R0, =0x208B144 LDR R0, [R0, #0x38] ADD R0, R0, R1 LDRB R1, [R0, #0xE] MOV R0, #0 CMP R1, #5 @Check if entrance is from left pipe ADDEQ PC, PC, #0x20 CMP R1, #6 @Check if entrance is from right pipe ADDEQ PC, PC, #0x18 CMP R1, #0x12 @Check if entrance is from left mini-pipe ADDEQ PC, PC, #0x10 CMP R1, #0x13 @Check if entrance is from right mini-pipe ADDEQ PC, PC, #8 CMP R1, #0x18 @Check if entrance is from left connected mini-pipe ADDEQ PC, PC, #0 CMP R1, #0x19 @Check if entrance is from right connected mini-pipe MOVEQ R0, #0x2000 @If one of the 6 conditions is true, elevate Mario by 1/8th of a tile LDMFD SP!, {PC} repl_0215E8E0_ov_36: LDRB R1, [R0, #8] LDR R2, =0x2085A30 LDRB R2, [R2] CMP R2, #0xFF @Check if midway is set LDRNEB R1, [R0, #9] @If yes then later overwrite Start entrance with Midway entrance BX LR repl_0201E998: LDR R12, =0x208B090 LDRB R9, [R4, #0xF] TST R9, #8 @Check if Connected Pipe flag is set LDRNEB R9, [R4, #0xA] @If true then load Connected Pipe ID for this entrance MOVEQ R9, #0 @Else force Connected Pipe ID checker to 0 STR R9, [R12] @Write Connected Pipe ID for easier Pipe ID checking (Mostly to write a Pipe ID of 0) LDR R12, =0x20CA8FE STRB R3, [R12] @Set placeholder entrance for easier entrance checking upon entry LDRH R9, [R4] BX LR repl_0201E668: LDR R3, =0x20CA8FE STRB R2, [R3] @Set placeholder entrance for easier entrance checking upon exit MOV R2, #0 BX LR repl_02117308_ov_0A: STMFD SP!, {R0,LR} LDRH R0, [R7, #0xE] AND R0, R0, #1 CMP R0, #1 @Check if the connected pipe exit is facing right or left MOVEQ R0, #0x2000 @If true elevate Mario by 1/8th of a tile ADDEQ R3, R3, R0 STR R3, [R6, #0x64] CMP R4, #1 LDMFD SP!, {R0,PC} nsub_0211761C_ov_0A: ADD R2, R0, #0x700 LDRB R3, [R2, #0xB2] CMP R3, #2 @Check if Mario goes inside a Pipe Cannon or World-Cannon ADDEQ PC, PC, #0x64 @If true return ADD R2, R2, #0x400 LDRB R2, [R2, #0xAD] CMP R2, #1 @Check if Mario is not (completely) inside a pipe ADDEQ PC, PC, #0xC @If true jump to main calculation LDR R2, =0x208B090 LDRB R2, [R2] CMP R2, #0 @Check if Connected Pipe ID is set ADDNE PC, PC, #0x44 @If true return LDR R2, =0x20CA8FE LDRB R3, [R2] @Load current entrance from placeholder entrance MOV R2, #0x14 MUL R3, R2, R3 LDR R2, =0x208B144 LDR R2, [R2, #0x38] ADD R2, R2, R3 LDRB R3, [R2, #0xE] LDRH R2, [R2, #2] @Get entrance vertical coordinate CMP R3, #0x10 @Check if Mario is gunning for a Mini-Pipe MOVGE R3, #0x10 @If true then add 16 to get bottom position MOVLT R3, #0x20 @Else add 32 ADD R2, R2, R3 @Calculate Mario bottom vertical position MOV R2, R2, LSL #0xC @Change the vertical value to the right format RSB R2, R2, #0 @" STR R2, [R0, #0x64] @Store Mario vertical position MOV R3, #0x2000 STRH R3, [R0, #0x64] @Elevate further Mario by 1/8th of a tile LDR R3, [R0, #0x930] B 0x2117620

Posted on 06-24-16, 08:50 pm


Karma: 19807
Posts: 390/1100
Since: 04-02-13
There seems to be some sort of a problem in this instance:
https://www.youtube.com/watch?v=6dWpJens-8k