Posted on 08-29-16, 09:41 pm (rev. 1 by  snake block on 08-29-16, 09:44 pm)
a

Karma: 1579
Posts: 1222/1290
Since: 02-12-13
I see what's going on... Well,  KingYoshi found this anyway. Arrow Signboards are available only if sprite set 16 is set to 1. And Lift Generators are only available if sprite set 16 is set to 9.

Mero adds something very specific to the level that wasn't originally in 5-C, which is Arrow Signboards. And 5-C also originally had Lift Generators, so... That would mean they're compatible now. So it's something with sprite sets.

Thanks  KingYoshi for this, mainly.
Posted on 08-29-16, 09:52 pm
Death by cuteness

Karma: 6554
Posts: 566/598
Since: 05-01-13
Indeed, this is what this hack is about.
More specifically, Arrow Signboard code was moved to offset 0x19C0 in the arm9 so that it would no longer be dependent on Overlay 12 (Sprite set 16-1).
This allows the Signboards to be used anywhere now.
But that's only the icing on the cake!


The cake itself is going to prove even tastier!
Remember about the hint I gave, you can easily picture it.
Posted on 08-29-16, 09:53 pm


Karma: 19752
Posts: 618/1100
Since: 04-02-13
So I guess you're entirely removing the sprite set restrictions?
Posted on 08-29-16, 09:55 pm
Death by cuteness

Karma: 6554
Posts: 567/598
Since: 05-01-13
Only for Sprite 93 (Actor 77).
Posted on 08-30-16, 10:24 am (rev. 1 by  Hiccup on 08-30-16, 04:08 pm)
Birdo


Karma: 2754
Posts: 1797/2091
Since: 06-26-11
I'm not entirely sure what this is, but being able to use the signboards anywhere is pretty neat. I wonder if this has something to do with custom models for the signboard? Maybe with a layer nybble? That'd let you spare up some tileset space and have "go behind tiles".
Posted on 08-30-16, 03:37 pm
Death by cuteness

Karma: 6554
Posts: 568/598
Since: 05-01-13
Choose which Actors to spare on Level completion:
repl_0209DF5C_ov_00: STMFD SP!, {R0-R1, R5, LR} STRB R3, [R4, #0x3E7] MOV R0, R7, LSR #3 MOV R1, R0, LSL #3 SUB R1, R7, R1 MOV R5, #1 .Division: CMP R1, #0 BEQ .ResultDivision MOV R5, R5, LSL #1 SUB R1, R1, #1 B .Division .ResultDivision: LDR R1, =ActorSpare LDRB R1, [R1, R0] TST R1, R5 BEQ .Return MOV R2, #1 .Return: LDMFD SP!, {R0-R1, R5, PC} .data .balign 1 ActorSpare: .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00100000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000


This ASM hack is read before the special cases, so Actors that weren't destroyed to begin with won't get destroyed regardless of their bit value.
Apart from that, you can choose which Actor you want to spare.

If you copy the ASM Hack on Notepad++, you'll see that the first .byte will be located on line 26.
To know which bit matches which Actor, you'll have to use a simple Euclidean division:
Actor Number / 8, which will net you the quotient and the remainder.
To get the line where will be located the bit you want to change, simply add 26 to the quotient.
Now if you look at the data, you'll see that they are in binary format, thus you only have to take into account the part after 0b.
To get the bit you want to set (bit=1), you have to count (beginning from 0) from right to left until you find the bit number that matches the remainder (which should be a number between 0 and 7 inclusive).

For example let's say Actor 77 (Signboards) mustn't be destroyed upon level completion.
Calculation:
77 / 8 = 9 with a remainder of 5.
Then 26 + 9 = 35, so go to line 35.
Since the remainder is 5, change bit 5 of line 35 to 1.
so 0b00000000 becomes 0b00100000 on line 35.

Notice that Actor 77 is already set to 1 in this ASM Hack, this is because it will be needed for the next ASM Hack of mine, which is already done, thus I only need to post the thread.
Posted on 08-30-16, 05:00 pm
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 53/328
Since: 08-20-16
Posted by MeroMero
Choose which Actors to spare on Level completion:
repl_0209DF5C_ov_00: STMFD SP!, {R0-R1, R5, LR} STRB R3, [R4, #0x3E7] MOV R0, R7, LSR #3 MOV R1, R0, LSL #3 SUB R1, R7, R1 MOV R5, #1 .Division: CMP R1, #0 BEQ .ResultDivision MOV R5, R5, LSL #1 SUB R1, R1, #1 B .Division .ResultDivision: LDR R1, =ActorSpare LDRB R1, [R1, R0] TST R1, R5 BEQ .Return MOV R2, #1 .Return: LDMFD SP!, {R0-R1, R5, PC} .data .balign 1 ActorSpare: .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00100000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000 .byte 0b00000000


This ASM hack is read before the special cases, so Actors that weren't destroyed to begin with won't get destroyed regardless of their bit value.
Apart from that, you can choose which Actor you want to spare.

If you copy the ASM Hack on Notepad++, you'll see that the first .byte will be located on line 26.
To know which bit matches which Actor, you'll have to use a simple Euclidean division:
Actor Number / 8, which will net you the quotient and the remainder.
To get the line where will be located the bit you want to change, simply add 26 to the quotient.
Now if you look at the data, you'll see that they are in binary format, thus you only have to take into account the part after 0b.
To get the bit you want to set (bit=1), you have to count (beginning from 0) from right to left until you find the bit number that matches the remainder (which should be a number between 0 and 7 inclusive).

For example let's say Actor 77 (Signboards) mustn't be destroyed upon level completion.
Calculation:
77 / 8 = 9 with a remainder of 5.
Then 26 + 9 = 35, so go to line 35.
Since the remainder is 5, change bit 5 of line 35 to 1.
so 0b00000000 becomes 0b00100000 on line 35.

Notice that Actor 77 is already set to 1 in this ASM Hack, this is because it will be needed for the next ASM Hack of mine, which is already done, thus I only need to post the thread.


YES!!!! Thank you! With this i can make the Zoom sprite not glitch out when you complete a level
rip signature
Posted on 08-30-16, 05:02 pm


Karma: 19752
Posts: 619/1100
Since: 04-02-13
No, that would still occur.
Posted on 08-30-16, 06:10 pm
Birdo


Karma: 2754
Posts: 1798/2091
Since: 06-26-11
But that can be prevented by zooming it back to normal with a zoom sprite.
Posted on 08-31-16, 11:11 am
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 55/328
Since: 08-20-16
Posted by Hiccup
But that can be prevented by zooming it back to normal with a zoom sprite.

Speaking of which, it's kinda hard to have precise areas with zoom instead of the entire level. Maybe someone could make a patch which makes it use zones? There's still a fair amount of nybbles left
rip signature
Posted on 08-31-16, 11:26 am
Birdo


Karma: 2754
Posts: 1799/2091
Since: 06-26-11
there is a visualization tool by MeroMero its pretty easy with that. Also, if you need zone activated zoom, you could use the actor spawner with the IF sprite
Posted on 08-31-16, 01:53 pm (rev. 9 by  skawo on 09-11-16, 04:03 pm)


Karma: 19752
Posts: 623/1100
Since: 04-02-13
Always load the correct boss particles if necessary:
nsub_02022D98_main: LDR R0, =0x208B19C @ Pointer to block 14 LDR R0, [R0] LDR R0, [R0, #0xF] CMP R0, #9 MOVEQ R0, #0x0 BXEQ LR CMP R0, #2 @ If Bowser MOVLT R0, #0x0 BXLT LR BEQ .Bowser LDR R1, =0x2026C88 @ Particle files array CMP R0, #3 @ If Giga Goomba ADDEQ R0, R1, #0x10 BXEQ LR CMP R0, #4 @ If Petey ADDEQ R0, R1, #0x18 BXEQ LR CMP R0, #5 @ If Mummipokey MOVEQ R0, R1 BXEQ LR CMP R0, #6 @ If Lakithunder ADDEQ R0, R1, #0x28 BXEQ LR CMP R0, #7 @ If Cheep Skipper ADDEQ R0, R1, #0x8 BXEQ LR ADD R0, R1, #0x20 @ Else, Monty Tank BX LR .Bowser: LDR R0, =0x208B180 @ Pointer to block 7 LDR R1, =0x208B184 @ Pointer to block 8 LDR R0, [R0] LDR R1, [R1] ADD R1, #4 @ Remove padding STMFD SP!, {R0,LR} SUB R0, R1, R0 @ Get size of block 7 LDR R1, =0xC BL FX_Div @ Get amount of sprites in level LDMFD SP!, {R0,LR} MOV R12, R1 LDR R3, =0x2026C80 .CheckWhichBowser: @ Determine which Bowser sprite is present MOV R1, R12 MOV R2, #0xC MUL R1, R2, R1 LDRH R2, [R0,R1] CMP R2, #0x3A @If Bowser MOVEQ R0, R3 BXEQ LR CMP R2, #0x3F @If Dry Bowser ADDEQ R0, R3,#0x38 BXEQ LR CMP R12, #0 SUBGT R12, #1 BGT .CheckWhichBowser ADD R0, R3,#0x40 @Else, Giant Bowser BX LR


In the original sub_02022D98, in a bout of awesomeness, Nintendo decided that the boss .spa files should be loaded by comparing the current Area number with a giant table and returning the pointer to the .spa File ID.

This is, of course, incredibly dumb. What this code will do instead, is check if you have one of the boss overlays loaded in sprite sets. If they are, the function will return the proper particle file ID pointer.

Since Bowsers are all in the same overlay, the code will also check just which Bowser sprite is used in the level.

This means you can put bosses /anywhere/ now.
Posted on 08-31-16, 02:23 pm
I Am Not Inteligent

Karma: 979
Posts: 196/380
Since: 03-04-14
Thank you so much,  skawo! This is very useful.
Posted on 08-31-16, 04:02 pm
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 58/328
Since: 08-20-16
Wow, NSMB had so many hard-coded crap in it that it almost hurts
Well i'm gonna slap this on my ROM despite the fact i'm not willing to move the bosses at all
'cuz why not, right?
rip signature
Posted on 08-31-16, 05:02 pm (rev. 2 by  skawo on 08-31-16, 05:55 pm)


Karma: 19752
Posts: 625/1100
Since: 04-02-13
Choose which levels load the boss music:
nsub_020AD01C_ov_00: LDR R0, =0x208B184 LDR R0, [R0] LDRB R0, [R0, #0xC] CMP R0, #0 @This is technically MOVNE R0, #1 @unnecessary, but just to be safe BX LR


Improvement over Mero's code, which makes the boss music load all the time, possibly cutting into your sound effects.

The original sub_020AD01C checks if the first area's bottom background is set to one that's present in a certain array. If so, it returns true, which makes whatever function calls it load the boss music. This is incredibly dumb.

What this does instead, is check if View 0 of the first area has its' Unknown 2(A) set, and if it does, it returns true. That particular unknown seems to do nothing, so it's a nice way to give it some function. And it's fifty times more efficient, to boot!

....Or, if you're scared that Unknown 2 does do something, then...

Boss music always loads in boss stages:
nsub_020AD01C_ov_00: LDR R0, =0x02085A9C LDR R0, [R0] CMP R0, #0xD BEQ .true CMP R0, #0xE BEQ .true CMP R0, #0x15 BEQ .true CMP R0, #0x16 BEQ .true MOV R0, #0 BX LR .true: MOV R0, #1 BX LR


This will instead simply check if the level is a Castle, Final Castle, Tower or a Tower-2 and load the music if it is.


EDIT: In other news, all patches are added to the topic now.
Posted on 09-01-16, 03:14 pm
Birdo


Karma: 2754
Posts: 1804/2091
Since: 06-26-11
Posted by skawo
If an overlay isn't listed, you have to decompress all overlays and search the entire ROM.

Does this mean literally clicking "decompress overlay" on every single overlay, individually and then opening the NDS up in a hex editor?
Posted on 09-01-16, 03:34 pm (rev. 1 by  skawo on 09-01-16, 03:35 pm)


Karma: 19752
Posts: 627/1100
Since: 04-02-13
Sadly, yes. Try searching the base rom first, though.
Posted on 09-03-16, 05:15 am
Fuzzy
That MvL Hacker

Karma: 1593
Posts: 66/787
Since: 04-11-15
Skawo I have a "suggestion". Could you make yoshi in nsmbds (if you really did that that would be awesome but I understand if that's too complicated)
_________________________
Here's my MvL Hacking thread

Consider joining the NSMB DS Hacking Discord Server!

#HakingNoMore
Posted on 09-03-16, 05:42 am (rev. 1 by Asprok on 09-03-16, 06:05 am)
I Am Not Inteligent

Karma: 979
Posts: 213/380
Since: 03-04-14
Also, swako, could you implement six more players, the Koopalings, the Falcon punch and a three-layer tileset mode?
Posted on 09-03-16, 08:19 am (rev. 1 by  MarioKart7z on 09-03-16, 08:20 am)
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 71/328
Since: 08-20-16
Posted by Asproek
Also, swako, could you implement six more players, the Koopalings, the Falcon punch and a three-layer tileset mode?

And also a super tilegod sprite which destroys every single tile and sprite in the level when activated
rip signature