Pages: 1
Posted on 05-20-18, 04:40 pm
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 154/222
Since: 06-28-17
So, I would like to use this ASM hack in just selected levels, or when event ID 72 is active.
#include "nsmb.h"

void hook_0211F840()
{
        MarioActor* mario = (MarioActor*)getPtrToPlayerActor();
        mario->xVelocity = 0x2000; //Change this value to change how fast Mario/Luigi run.
}


I have found  MeroMero's Time Stop if ID 40 is active, but that is only applicable in .s format. I have also searched ASM Hacks with Switch Activation, but I do not understand what to do and how to add to the code in the code block provided above.

Any help would be appreciated. Thanks in advance.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Posted on 05-20-18, 05:58 pm (rev. 1 by RicBent on 05-20-18, 06:01 pm)
Mariomaster

Karma: 8528
Posts: 1234/1681
Since: 06-09-12
#include "nsmb.h"

void hook_0211F840()
{
    u32 id = 42;
    u64* activatorBitmask = (u64*)(0x0208AF3C);
   
    if (!(*activatorBitmask >> (id-1)) & 1))
        return;

    MarioActor* mario = (MarioActor*)getPtrToPlayerActor();
    mario->xVelocity = 0xBAD1DEA;
}

Not tested but it should work fine.

Edit: Nope, this won't work with any ID > 64 but should do it for all other ones.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-20-18, 06:04 pm (rev. 1 by  Dirbaio on 05-20-18, 06:05 pm)
Super Mario
( ͡° ͜ʖ ͡°)

Karma: 9979
Posts: 4425/4456
Since: 06-08-11
The activator bitmask is only 64 bits though. ID 72 cant work there...

I don't know if the bitmask is actually an array, or the IDs higher than 64 have special meanings that are calculated from other stuff iirc..?

Edit: you edit-ninja'd me lol.
Posted on 05-20-18, 09:22 pm
Nipper Plant


Karma: 2406
Posts: 352/417
Since: 08-17-15
Um, off-topic, but shouldn't the last 2 lines be in a else statement?
Posted on 05-20-18, 09:28 pm (rev. 1 by RicBent on 05-20-18, 09:30 pm)
Mariomaster

Karma: 8528
Posts: 1235/1681
Since: 06-09-12
No? The code just exits the function if the correct id is not activated. The rest of the code surely could go in an else block but there is no reason to really do that.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-21-18, 07:19 am (rev. 3 by  Helios on 05-21-18, 09:12 am)
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 155/222
Since: 06-28-17
Funnily, I do not get the original code given by newluigidev and the code modified by RicBent work for me.
However, I do get the code here to work, and it makes Mario run insanely fast, because of the BAD1DEA thing. Actually, why is it a bad idea?
I edited the code for it and now I get everything I wanted!
#include "nsmb.h"

void hook_0211F840(MarioActor* player)
{
        u32 id = 30;
        u64* activatorBitmask = (u64*)(0x0208AF3C);

        if (!(*activatorBitmask >> (id-1)) & 1)
                return;
       
        player->xVelocity = 0x2000;
}

Activate this using event ID 31. Also, if you use this, be sure to credit newluigidev and RicBent, not me.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Posted on 05-21-18, 09:01 am
Mariomaster

Karma: 8528
Posts: 1236/1681
Since: 06-09-12
That is proably caused by a fault in you nsmb.h or symbols.x.

Also I guess that joke was a BAD1DEA...
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-21-18, 10:43 am
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 156/222
Since: 06-28-17

I may sound very annoying, but... eh. I understand why you said BAD1DEA

So, I am asking (again) for a way to just make the game think the player is holding KEY_RIGHT, and blocks input of KEY_LEFT. I have searched for the myKeysDown function, but it is an integer... Weird.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Posted on 05-21-18, 11:45 am
Mariomaster

Karma: 8528
Posts: 1237/1681
Since: 06-09-12
Well, the myKeysDown function just returns a bitmask of the currently held keys. Also you can't simply reverse that function and write to these ram places as they are read only hardware registers.

If you wanted to force key inputs you'd have to intercept the code of the player actor that fetches the key input.
Though I have no idea where that is.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-21-18, 12:14 pm (rev. 2 by  Helios on 05-21-18, 12:30 pm)
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 157/222
Since: 06-28-17
Is it able to set the default bitmask to the one when RIGHT is pressed? If no then I will just give up this idea and use the 5 coin challenge instead.

Oops I thought you mean the code I inserted before. Now I see.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Posted on 05-21-18, 12:24 pm
Mariomaster

Karma: 8528
Posts: 1238/1681
Since: 06-09-12
"Also you can't simply reverse that function and write to these ram places as they are read only hardware registers."
_________________________
GitHub - Kuribo64 - YouTube
Posted on 05-21-18, 04:40 pm
Red Cheep-cheep
Beyond DS and Project Tape

Karma: 737
Posts: 158/222
Since: 06-28-17
Oh, the last thing, how about blocking inputs? Is it possible at this stage? If so, what is the code? Thanks.
_________________________
Check out these awesome hacks! Beyond DS is now my major hack!
Pages: 1