Pages: 1
Posted on 08-15-17, 03:58 pm (rev. 2 by RicBent on 08-15-17, 04:03 pm)
Administrator

Karma: 6749
Posts: 952/1374
Since: 06-09-12
If you are working on a long level or an advanced asm hack it might be annoying to go through the main menu and the worldmap every single time you want to test something.
Let's bring that to an end!

This hack instantly loads any level you want! You can also specify to load a different level if a specific button is pressed (Look at the "Conditional Overwrites" section of the code). If you press Start while the game boots or you die the hack will disable itself and you can test whatever else.

Be sure to remove "nonintendo.cpp" from your patch template as it might clash with this hack.

#include "nsmb.h"
#include "keys.h"

void QuickLoad()
{
    u32 *lives = (u32*) (0x0208B364);
    *lives = 99;

    // Default (1-1, Area 1, Entrance 0)
    u32 world = 0;
    u32 level = 0;
    u32 area = 0;
    s8 entranceId = 0xFF;   // 0xFF = Start Entrance set in Level

    u32* keysDw = (u32*)(0x02087650);
   
    // Conditional Overwrites
    if (*keysDw & KEY_A)
    {
        // If A is pressed go to 8-2, Area 1, Entrance 1
        world = 7;
        level = 1;
        area = 0;
        entranceId = 1;        
    }
    else if (*keysDw & KEY_X)
    {
        // If X is pressed go to 1-3, Area 1, Entrance 0
        level = 2;
    }

    loadLevel(0xD, false, world, level, area, 0, 1, 0, 0, true, entranceId, 1);
}


bool kill = false;

// Instantly load MainMenu
void hook_0200089c()
{
        (*(vu32*)0x023FFC20) = 0x100;
}

// MainMenu -> LoadLevel
void hook_020D339C_ov_09()
{
    if (kill)
        return;

    u32* keysDw = (u32*)(0x02087650);
    if (*keysDw & KEY_START)
    {
        kill = true;
        return;
    }

    loadSave(0, (void*)(0x02088BDC));
    QuickLoad();
}

// Worldmap -> LoadLevel
void hook_020CF108_ov_08()
{
    if (kill)
        return;

    u32* keysDw = (u32*)(0x02087650);

    if (!(*keysDw & KEY_START))
        QuickLoad();
    else
        kill = true;
}

I know that this is very hacky, but it's only for testing anyways
_________________________
GitHub - Kuribo64 - YouTube
Posted on 08-16-17, 08:14 am (rev. 1 by Thierry on 08-16-17, 08:16 am)
Morton Koopa
Once upon a time there was a tiger.

Karma: 4328
Posts: 2231/2472
Since: 01-17-13
neat, that will make things much quicker. can't rely on savestates for everything.

random question, is there any way to load unused levels? iirc those don't have IDs or something.
Posted on 08-16-17, 01:14 pm
Administrator

Karma: 6749
Posts: 953/1374
Since: 06-09-12
Yeah savestates mess up frequently when doin asm stuff.

And nope, the unused levels are not in the level tables and cannot be loaded without further hacks.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 08-16-17, 10:20 pm
Cobrat
That MvL Hacker

Karma: 1149
Posts: 481/655
Since: 04-11-15
Can you make it once you press a button it loads the level or does it require it to be upon boot...or am i not understanding
_________________________
I'm the only person on this board that hacked MvL before it was cool.

Here's my MvL Hacking thread | Here's the MvL Community Hack!

If you hack NSMB, consider joining my Discord Server!

#HakingNoMore
Posted on 08-17-17, 07:28 am
Administrator

Karma: 6749
Posts: 954/1374
Since: 06-09-12
You have to press the specified button on boot yeah. Otherwise it loads the default option.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 08-19-17, 01:05 pm
Birdo


Karma: 2504
Posts: 1989/2048
Since: 06-26-11
Are any of the Mario Vs Luigi levels in the level tables?
_________________________
Will pay unspecified $ for NSMB beta.
Posted on 08-19-17, 01:57 pm


Karma: 18234
Posts: 1019/1084
Since: 04-02-13
All the 5.
Posted on 08-19-17, 04:34 pm
Birdo


Karma: 2504
Posts: 1990/2048
Since: 06-26-11
The ones in the course folder or the archived ones?
_________________________
Will pay unspecified $ for NSMB beta.
Posted on 08-19-17, 05:03 pm (rev. 2 by  skawo on 08-19-17, 05:04 pm)


Karma: 18234
Posts: 1020/1084
Since: 04-02-13
main0:0203CC44 DCD 0xC202041C ; 180
main0:0203CC44 DCD 0xC103041E ; 181
main0:0203CC44 DCD 0xC4020420 ; 182
main0:0203CC44 DCD 0xC6010422 ; 183
main0:0203CC44 DCD 0xC3020424 ; 184
main0:0203CC44 DCD 0 ; 185
main0:0203CC44 DCD 0 ; 186

i.e... Both.


As you can see, there's what looks to be two empty slots, too.
Posted on 10-21-17, 02:17 am (rev. 2 by RicBent on 10-22-17, 10:39 am)
Newcomer
Dank Memes are Dank.

Karma: 1
Posts: 1/1
Since: 10-21-17
When I try to do the make thing it gives me an error:

quickTest.cpp
arm-none-eabi-g++ -MMD -MP -MF /c/Users/crust/Documents/Bady/SMB/ASMPatchTemplate-master/build/quickTest.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -iquote /c/Users/crust/Documents/Bady/SMB/ASMPatchTemplate-master/include -I/c/devkitPro/libnds/include -I/c/devkitPro/devkitARM/include -I/c/devkitPro/devkitARM/arm-none-eabi/include -I/c/Users/crust/Documents/Bady/SMB/ASMPatchTemplate-master/build -DARM9 -nodefaultlibs -I. -fno-builtin -c -fno-rtti -fno-exceptions -c /c/Users/crust/Documents/Bady/SMB/ASMPatchTemplate-master/source/quickTest.cpp -o quickTest.o
c:/Users/crust/Documents/Bady/SMB/ASMPatchTemplate-master/source/quickTest.cpp:2:10: fatal error: keys.h: No such file or directory
#include "keys.h"
^~~~~~~~
compilation terminated.
make[1]: *** [quickTest.o] Error 1
make: *** [build] Error 2
Press any key to continue . . .

I don't know what to do, I have a keys.cpp file but there isn't a keys.h but I don't know how to get it or whatever.

Thanks.
Posted on 10-22-17, 02:38 am (rev. 1 by  newluigidev on 10-22-17, 02:49 am)
Mole


Karma: 1617
Posts: 289/369
Since: 08-17-15
Just remove the keys.cpp, and remove the "#include "keys.h"" at the top of this code.
_________________________
I hack games, then I play them!
Posted on 05-14-18, 05:10 pm
Newcomer


Karma: 5
Posts: 3/8
Since: 05-11-18
Sorry for being so dumb, but where do I put this is NSMBE?
_________________________
Posted on 05-14-18, 06:59 pm (rev. 1 by  Ndymario on 05-15-18, 01:47 am)
Cobrat
That MvL Hacker

Karma: 1149
Posts: 625/655
Since: 04-11-15
This is an ASM hack, so you'll need to save the code as something.cpp, then include that file in the sources folder in the ASM Hack template. If you don't understand, just look here. Feel free to ask another question if you're still confused
_________________________
I'm the only person on this board that hacked MvL before it was cool.

Here's my MvL Hacking thread | Here's the MvL Community Hack!

If you hack NSMB, consider joining my Discord Server!

#HakingNoMore
Posted on 05-14-18, 07:40 pm
Mole


Karma: 1617
Posts: 349/369
Since: 08-17-15
Nope, actually it needs to be in a CPP file, since it's C++ code. S files are only needed when it's assembly code.
_________________________
I hack games, then I play them!
Posted on 05-18-18, 09:38 pm
Newcomer


Karma: 5
Posts: 7/8
Since: 05-11-18
(Once again sorry for being dumb, but) Which parts of this code do I copy? And I can't seem to get any of the codes from https://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/ to work either, please help!
_________________________
Posted on 05-18-18, 09:45 pm
Administrator

Karma: 6749
Posts: 1223/1374
Since: 06-09-12
You copy the entire code in the black box and paste it in a .cpp file inside the source folder of the patch template.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-19-18, 10:22 pm
Newcomer


Karma: 5
Posts: 8/8
Since: 05-11-18
'make' is not recognized as an internal or external command, operable program or batch file.
Press any key to continue . . .

I just keep getting this error when I try to insert it.
_________________________
Posted on 05-19-18, 10:29 pm
Administrator

Karma: 6749
Posts: 1227/1374
Since: 06-09-12
Aka you didn't read any thread on how to setup asm hacks. Won't explain that here all over again as you can find it in this forum already far too often...
_________________________
GitHub - Kuribo64 - YouTube
Pages: 1