Pages: 1
Posted on 10-07-16, 05:00 pm (rev. 1 by  Shadey on 10-07-16, 05:06 pm)
Flurry


Karma: 724
Posts: 216/258
Since: 10-14-11
So I've been messing around with a bit of ASM and everything has been fine. For example:

int *lives = (int*)(0x0208B364); //Lives
int *player = (int*)(0x02085A50); //Player number
void hook_02020354() //getCoin function
{
if(*player == 0)
{
*lives = 99;
}
}

So if Player 0 (Mario) gets a coin, his lives are turned to 99. However, I'd like to define my own condition. For example, such as if Mario was to jump, touch a fireflower, or even if the player pressed a certain button on the DS, THEN his lives would turn to 99.
I've looked around the board but can't seem to find out how to do this. I've even downloaded other .cpp files but just can't figure out how they are working. Sorry if this question has been asked already but I'd love to know!
Thanks.
Posted on 10-07-16, 05:09 pm
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 201/328
Since: 08-20-16
Simply replace
void hook_02020354()
with a function in the game that checks for what certain condition you want.
I however do not know anything about the game's functions nor know how to create custom ones in case the condition check you want does not exist (well actually i might, because i've programmed in C# before and C++ is pretty similar, but i haven't fiddled around with anything yet.)
rip signature
Posted on 10-07-16, 05:20 pm
Mariomaster

Karma: 8528
Posts: 671/1681
Since: 06-09-12
You can use the IDA database in combination with no$gba debugger's breakpoint feature to locate functions you are looking for.

For things like detecting jumping, you could run a check everytime the player actor updates:

void hook_addressOfMarioActorUpdate(mA* MarioActor) { if (!mA->isOnGround) { // Whatever } }


Btw that layout is eye-hurting  MarioKart7z.
Also C# simmilar to C++? ugh, I wouldn't say so. Especially the most important thing in NSMB hacking: pointers.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 10-07-16, 05:27 pm
Flurry


Karma: 724
Posts: 217/258
Since: 10-14-11
Ahhh alright. What about stuff like the pressing of a button? How would I go about doing that?
Posted on 10-07-16, 05:34 pm
Mariomaster

Karma: 8528
Posts: 672/1681
Since: 06-09-12
You could do that as well in the MarioActorUpdate loop:

#include "nsmb.h" void hook_addressOfMarioActorUpdate() { if (pressedKeys & A) { // Whatever } }


pressedKeys and and all button codes are defined in nsmb.h.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 10-07-16, 05:47 pm
Flurry


Karma: 724
Posts: 218/258
Since: 10-14-11
Yep, that worked. Completely forgot about nsmb.h. Thanks!
Posted on 10-07-16, 08:26 pm (rev. 1 by  MarioKart7z on 10-08-16, 01:58 pm)
Panser
I AM DERP INCARNATE

Karma: 503
Posts: 202/328
Since: 08-20-16
Posted by Mariomaster
Btw that layout is eye-hurting  MarioKart7z.

Sorry about the layout, will change tomorrow once i'm on my PC again
/offtopic
rip signature
Posted on 10-08-16, 02:03 am (rev. 1 by  cros107 on 10-08-16, 02:18 am)
Fuzzy
Will never finish a hack

Karma: 1843
Posts: 337/778
Since: 03-25-16
I think you can use worded functions, as long as they are listed in arenaoffsets. Otherwise, as mariomaster said, you'll have to use the nocash debugger to find the offsets yourself.
_________________________
hey look, I did a thing
Posted on 10-08-16, 12:09 pm


Karma: 19752
Posts: 741/1100
Since: 04-02-13
I think you can use worded functions, as long as they are listed in symbols.x.
Pages: 1