Pages: 1
Posted on 06-25-14, 04:47 pm (rev. 1 by  Arisotura on 06-25-14, 04:48 pm)
☭ coffee and cream


Karma: 10398
Posts: 1442/2766
Since: 06-26-11
Here's a little proof of concept I put together in a few hours out of boredom.

It's meant to make testing levels easier, although it's barebones so for now that probably won't be the case. It basically lets you enter level/world numbers etc, and then launches the game in desmume, directly in that level.


I provided the source code of it. It's in C# so it could be built into NSMBe easily.

If you're not a programmer, you'll be more interested in the contents of the Release folder. Note that for it to work, you must put a NSMB ROM named nsmb.nds in there. It also has to be an USA ROM.

You can use another desmume instead of the one I provided, but it has to be named desmume.exe and (obviously) be recent enough to load the provided savestate.


How to use it

Launch nsmblaunch.exe and provide the needed details.
• World number goes from 0-9 (0-7 for worlds 1-8, 8 for Toad houses, 9 for MvsL levels and unused levels)
• Level number is the number of the level in the world, from 0 to whatever the max is
• Area number is the global number of the starting area of the level. 0 for 1-1, 3 for 1-2, 6 for 1-3, 7 for 1-4...

This is where the easiness breaks down. An easier version would allow for giving the level name in W-L format (1-1, 2-3) and automatically compute those parameters.

Upon loading, desmume will throw errors regarding the savestate, just ignore them. If everything works allright, you'll enter the level you selected.


Current issues

• the aforementioned errors desmume throws (I yet have to find why that happens)
• level name will be 1-2 no matter which level you choose
• after dying or completing the level, you'll return in World 1 on 1-2's spot
• this will not work if your ROM has ASM hacks
• this takes up savestate slot 9. Desmume doesn't support loading an arbitrary save file via command line.


How it works

The following RAM addresses control which level is loaded:
• 0x02088F3A (byte): world number
• 0x02085A14 (byte): level number in the world
• 0x02085A18 (byte): global area number

(those are set by the function loadLevel() at 0x0200696C)

I made a savestate during the transition when entering 1-2. Said savestate is the one provided in the package. nsmblaunch.exe modifies the savestate so that the RAM addresses above are changed to what the user entered. Once that is done, it launches desmume, passing the savestate and ROM to it via command line args.

The savestate slot used for this is slot 9. If you wish to reload the level from within desmume, you can press F9. Once again, ignore the errors, it works.


Download


Hoping it can be useful.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 06-25-14, 05:21 pm


Karma: 1733
Posts: 120/657
Since: 05-14-14
Doesn't work for me. I tried loading World 1 (0) level 1 (I think that's 1-2) in area 0 and it takes me to a white screen in DeSmuME with the FPS showing.
Posted on 06-25-14, 05:31 pm
☭ coffee and cream


Karma: 10398
Posts: 1443/2766
Since: 06-26-11
That isn't right. As I explained, area numbers are global. For 1-2, the area would be 3. 0 would be for 1-1.
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 06-26-14, 04:26 pm
Birdo


Karma: 2754
Posts: 857/2091
Since: 06-26-11
Does this mean an action replay code could be made to load levels?
Posted on 06-27-14, 10:47 am (rev. 1 by  Dirbaio on 06-27-14, 10:48 am)
Super Mario
( ͡° ͜ʖ ͡°)

Karma: 9979
Posts: 4043/4456
Since: 06-08-11
An action replay code, yes. Or even better, an ASM hack.

I actually did something similar to this for the NSMBCR ASM hacks.
This causes the game to instantly load Level 1-1 every time you press Select!
https://github.com/Dirbaio/NSMBCR/blob/master/source/panicOnSelect.cpp

Running this at ROM boot could allow us to do this without savestates, which is better because loading from a savestate won't reflect changes in ASM hacks for example.
Posted on 06-27-14, 12:17 pm
Birdo


Karma: 2754
Posts: 859/2091
Since: 06-26-11
I do remember using savestates to test some stuff, but the game did break sometimes that way, this would be much better and quicker.
Pages: 1