Pages: 12 »
Posted on 12-10-12, 12:28 am (rev. 11 by  Dirbaio on 01-13-13, 01:19 am)
☭ coffee and cream


Karma: 10542
Posts: 828/2780
Since: 06-26-11
As title says. We take singleplayer 1-1 and import it into a MvsL level slot. We also apply Dirbaio's unlimited MvsL spriteset hack.

It is possible. Not exactly coop but more like a race.



Together with Dirbaio, we worked on getting past all the crashes encountered. The following ASM hack must be used:
repl_02009568:
        cmp r0, #20
        ADDEQ     SP, SP, #0x4C
        LDMEQFD   SP!, {R4-R11,PC}
        MOV R9, #0
        bx lr
       
repl_020B39C8:
        bx lr
       
repl_0209C4E0:
        bx lr

repl_02020738:
        bx lr

PLUS http://dirbaio.net/d/paste/afbKlaPl.txt
Credits go to Dirbaio who figured out most if not all of the above ASM hack.

You'll also need to remove certain troublecausing sprites from the level for it to work. Star coins and sprite 264 must be removed. I also removed the scroll stop sprites and invisible block sprites, but those should be fine.


Technical details

The first part of the above ASM hack causes overlay 20 to never be loaded.

Overlay 20 corresponds to sprite set 16-9 (battle stars and platforms). It is forcefully loaded right after two players connect for a MvsL game, which makes us unable to load any other sprite set in slot 16. Slot 16 is where we have the flagpole and bosses, so this is bad.

With this hack, we can load any sprite set in slot 16 without getting a crash. The downside of it is that sprite set 16-9 is unavailable, so no platform generator. But: there are TONS of references to loadOverlay(). If someone would find the one reference that calls it with a fixed ID of 20...

The other parts of the ASM hack mostly remove certain checks for the MvsL mode, that cause some required data to not be loaded. They also remove the code that separately spawns MvsL battle stars.


You then get to play 1-1 in MvsL mode.

When you reach the flagpole, you go down it as usual. Then, it says 'Mario Wins' (or 'Luigi Wins' if you're Luigi). The other player is told that they've lost.



Remaining issues:
* tileset 2 isn't loaded, which causes Mario to not end the level properly (and yet another lockup). Replacing the castle with a solid block fixes it temporarily. Dirbaio's latest ASM hack (the PLUS link) should fix it
* graphics that should show the number of points when using the flagpole, are instead garbled
* music and sound sets in MvsL mode are hardcoded
* no matter the parameters of the two first entrances, Mario and Luigi always start from pipes
* breaking the flagpole with Mega Mario causes the other player to not lose. The two players are then desynced. Even if you make the other player win and then make them play another game, they will stay desynced.

Because apparently lots of things aren't loaded in MvsL mode.

When Mario/Luigi ends the hacked level, oddly, no victory is counted at either side. Victory counts are likely related to the battle star sprites.


To be tested:
* the Mega Goomba boss fight. Mega Goomba is featured in the early videos, however there's only one player battling it. Perhaps it still has multiplayer code though? Also, given the sheer number of MvsL-mode checks and stuff in the code, and how boss sprites are crashy in abnormal conditions, would a boss room even work in MvsL mode?


This also gives us more insights on how NSMB has been programmed.
* the so-called coop mode was more like a race. Reaching the flagpole makes other players lose, unlike the NSMBWii flagpole.
* at that time, Mega Mario wasn't supposed to be able to break flagpoles. Breaking a flagpole doesn't make other players lose, which indicates that this feature was added after coop was scrapped.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-10-12, 12:29 am
Birdo


Karma: 3316
Posts: 1040/2026
Since: 06-28-11
Nice. I wonder if it can be reworked to make the level end. We could make some kind of race courses between player.

Good job  Dirbaio and  Arisotura!
_________________________

Posted on 12-10-12, 01:11 am
Roy Koopa
The guy who does things.

Karma: 12749
Posts: 627/2796
Since: 07-01-11
I wonder if there would be a way to exploit having 1-1 in Mario vs. Luigi where ending the level sends you to the World Map to activate some kind unused co-op function in the main game.

I highly doubt it would be possible, though.
New Super Mario Bros.: Clone Tag Team 1+2 / New Super Mario Advance + Take 2 / Super Mario: Endless Earth
My two greatest assets have been mental stability and being, like, really smart.
Posted on 12-10-12, 01:45 am
☭ coffee and cream


Karma: 10542
Posts: 829/2780
Since: 06-26-11
Considering the early builds with coop had no world maps yet, world maps most likely have no multiplayer support at all.

Adding support would be possible, but very hard. Nothing like the series of hacks Dirbaio and I came up with in this thread. It'd involve writing code from scratch.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-10-12, 01:52 am
Giant Red Koopa


Karma: 871
Posts: 179/1315
Since: 11-12-12
Mabey you can fix the mega mario glitch with haveing a "Fake" flagpole tower peice... (Another object with the same graphics but different behavior)

Well, Anyways great job you guys !
Posted on 12-10-12, 11:58 am (rev. 1 by  Shadey on 12-10-12, 11:58 am)
Flurry


Karma: 724
Posts: 153/258
Since: 10-14-11
Nice job. I highly doubt bosses would work because most bosses don't even work outside their original levels, maybe if their original levels were imported but I really don't think it would work. Some footage or pictures of this "co-op" mode would be great.

Seriously well done  Dirbaio and  Arisotura.
Posted on 12-10-12, 12:05 pm
☭ coffee and cream


Karma: 10542
Posts: 830/2780
Since: 06-26-11
I may record a video when I have the time to do so. I have never recorded from a DS so it'll take a while to set up.

Thanks
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-10-12, 12:07 pm
Flurry


Karma: 724
Posts: 154/258
Since: 10-14-11
Great, and i'm gonna assume this is multi-card only yeah?
Posted on 12-10-12, 12:16 pm
☭ coffee and cream


Karma: 10542
Posts: 831/2780
Since: 06-26-11
Right.

Not minding the signature check, making this work with DLP would require modifying the existing NARCs, making more of them, and generally it'd be a pain in the ass.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-10-12, 12:22 pm (rev. 1 by  Shadey on 12-10-12, 10:26 pm)
Flurry


Karma: 724
Posts: 155/258
Since: 10-14-11
Exactly.

And making it work on multi-card is already a big enough pain in the ass.

EDIT: Clones in Co-op would be interesting to see , you should see if that works
Posted on 12-11-12, 03:44 pm
☭ coffee and cream


Karma: 10542
Posts: 834/2780
Since: 06-26-11
Update. I recorded some footage of the whole thing. Video is on the first post.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-11-12, 04:22 pm
Flurry


Karma: 724
Posts: 156/258
Since: 10-14-11
Weird the way Mario doesn't shrink after destroying the flag in Mega Mode and the ds's de-sync.
What are you going to do next? Test a boss fight?
Posted on 12-11-12, 04:40 pm
☭ coffee and cream


Karma: 10542
Posts: 836/2780
Since: 06-26-11
Perhaps. But I think it'll be very glitchy, if we don't face yet another fuckload of crashes...

I have no idea if bosses even have multiplayer code. The only boss featured in the early videos is Mega Goomba, and Mario is always alone when battling him.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 12-11-12, 04:46 pm
Flurry


Karma: 724
Posts: 157/258
Since: 10-14-11
Maybe it does have code who knows, only one way to find out.
Even if it is extremely glitchy, it's a start.
Posted on 06-24-13, 08:06 am


Karma: 228
Posts: 6/22
Since: 10-18-12
Posted by Mega-Mario
Update. I recorded some footage of the whole thing. Video is on the first post.

The background clouds are not moving at different speeds. Is there any way you can make the HDMA work by hacking whatever code that rejects it. Then make a video to show how it looks like, because I am very interested in the outcome. In the end I want to know if HDMA line scrolling is possible during multiplayer gaming on the NDS.

Possible scenarios:
Background will flicker because HDMA is somewhat conflicting with NiFi communication.
Top scanline is not updating correctly or flickers.
Game hangs.
Game works fine except lag.
Game is desynced.
Posted on 06-24-13, 08:36 am
Super Mario
( ͡° ͜ʖ ͡°)

Karma: 10081
Posts: 3444/4458
Since: 06-08-11
I'm not sure with nifi.
But when I coded the music streaming from card for the community remix, I found out that enabling DMA to read the card would maje it much more fast and stable. But then the ROM would crash because of hdma. Specifically, Nintendo's devkit didn't allow starting the hdma if there was another DMA running in one of certain modes. I had to disable hdma to get it working.

Its interesting that they disable it too in multiplayer.
Posted on 06-25-13, 10:08 pm


Karma: 228
Posts: 10/22
Since: 10-18-12
Dirbaio, you have the tools for inserting your own code into the game, so I have an idea:

Writing your own H-Blank interrupt handler, a tiny function that takes the VCount register value as an index into the active page of the HDMA buffer, and copies (needs to be written the same way as the top scanline, because of CPU working with cached data) the value into the BG offset registers. Basically emulate the HDMA using H-Blank.
It should be a rather similar process as how the game sets up the HDMA (especially how it copies the top scanline in VBlank). I am just thinking how Mario Kart for GBA were able to do mode 7 during multiplayer connections, and H-Blank might be the answer.

The only tricky parts are:
1. Cache the values. libNDS has a way to read data uncached using a function memUncached(), but I think it is libNDS's own CPU settings.
2. Write as tiny and fast function as possible, so that it has the time to do the copy of the number of registers needed per scanline.
Posted on 06-26-13, 06:46 am
Cheep-cheep


Karma: 182
Posts: 1/190
Since: 06-13-13
Another normal levels are playable on multiplayer?
_________________________
My Youtube channel:
https://m.youtube.com/channel/UCnqXgHywVZoDlHNhFh5Ib3w
Layout by Tierage.

Posted on 06-26-13, 09:26 am


Karma: 228
Posts: 11/22
Since: 10-18-12
I checked how Mario Kart for GBA (supports 4 player multiplayer link) does the mode 7, and it did it by switching BG modes and turning on HDMA (channel 0) on V-Counter interrupt (that is mid screen). I initially hoped it would use H-Blank interrupt to keep my idea alive, but since it uses HDMA, the Nintendo DS might have different limits than the GBA. The H-Blank interrupt approach to emulate HDMA might still work though.
Posted on 08-18-15, 10:18 am
Fire Snake
Eugene

Karma: 3810
Posts: 519/1156
Since: 11-29-11
Sorry for the bump.

In regular MvsL some Mario animations don't work like the slide animation and the climbing-a-vine amimation. Do these things work with this ASM Hack?
Pages: 12 »