Kuribo64
Views: 23,105,723 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
12-06-24 09:06 PM
Guest:

0 users reading SM64DS ASM Hacking Template | 1 bot

Main - General SM64DS hacking - SM64DS ASM Hacking Template Hide post layouts | New reply

Pages: 1 2
Fiachra
Posted on 10-17-14 02:01 PM (rev. 6 of 03-18-15 11:29 AM) Link | #49792
I have created a SM64DS ASM Hacking Template, based on Dirbaio's ASM Hacking Template for NSMB for use with NSMBe.

A tutorial for using the original ASM Hacking Template can be found at:
http://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/

Required Tools:
  • Latest version of SM64DSe, available here
  • Latest version of NSMBe (important, older versions don't work), available (binary)here and (source)here
  • Latest version of SM64DS ASM Hacking Template, available here.
  • devkitPro to include devkitARM and associated NDS libraries: libnds, libfat, libfilesystem, dswifi, defaultarm7, maxmodds and MSys. For Windows you can use the automated installer available here.

Included features:
  • HoverWithLimit.cpp - Allows Mario to hover for a set time limit by pressing both B and L.
  • Helper.cpp - Currently saves the Player object's address for use in the project, more will be added in future.
  • SM64DS.h - Defines several useful functions from the game. Not complete at all, I've just added stuff as I needed it.

Compiling the example hover hack:
  • Download and install the above tools.
  • Unzip "SM64DS_ASMHackingTemplate.zip".
  • Open a clean European SM64DS ROM into SM64DSe.
  • Select "More" > "Toggle Suitability for NSMBe ASM Patching" and close SM64DSe.
  • Open MSys and cd into the folder to which the *.zip file above was extracted.
  • Type "make". The program should compile without any errors.
  • Place the patched SM64DS into the ASMHackingTemplate folder.
  • Open the patched ROM in NSMBe and select the "Tools/Options" tab.
  • Select "Run 'make' and insert". If needed the example will be compiled and the compiled code will be inserted into the ROM. Close NSMBe
  • The SM64DS ROM should now be patched with the provided example. To test the hover feature, press and hold 'B' and 'L' together. This will allow Mario to hover and move around in the air for several seconds before falling to the ground.

I won't go over how to create your own as the process is the same as for NSMB, covered in the tutorial in the first link.

MPG
Posted on 10-17-14 02:10 PM Link | #49793
Seeems pretty interesting. I may try it out in my spare time.

____________________
My unfinished forum:
http://mpgforums.freeforums.net/

Fiachra
Posted on 10-18-14 09:19 AM Link | #49826
Can someone please try the above steps and confirm whether it's working or not? It's working for me but not for Stomatol.

Ensure you use this version of SM64DSe and the linked version of NSMBe (the version from nsmbhd.net is not working as it quite outdated).

CodingKoopa
Posted on 01-02-15 09:08 PM (rev. 2 of 01-02-15 09:09 PM) Link | #53726
When I click Run 'make' and insert in NSMBe, it throws an unhandled exception:

[image]
(if the image isn't working, it says "Number was less than the array's lower bound in the first dimension.
Parameter name: srcIndex".
So far, I have tried different versions of NSMBe, clearing the source folder, and using different regions of roms. 'make clean' works normally with SM64DS, and both options work fine for me with NSMB.
Thanks for reading, help greatly appreciated!(Sorry if this should have been posted in NSMBHD)


____________________
Website | Twitter


Fiachra
Posted on 01-02-15 11:05 PM (rev. 2 of 01-02-15 11:07 PM) Link | #53732
Open your SM64DS ROM in SM64DSe and select 'More'>'Toggle Suitability for NSMBe ASM Patching' and then try patching with NSMBe. If you want your ROM to run on R4 and Acekard flashcarts you should select that option again after patching with NSMBe.

Also, you must use the version of NSMBe linked in the first post (or else check out and compile the latest version from github).

pacmainia&luigi
Posted on 07-09-16 02:30 AM (rev. 2 of 08-07-16 04:33 PM) Link | #73196
does mario get a hovering animation? If no, how can I give him one?

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Sparsite
Posted on 09-10-16 04:16 PM (rev. 6 of 09-10-16 04:19 PM) Link | #77094
You should add some sort of key reading function, it'd be very useful, something like this:
public void ReadKeyInput(unsigned int key)
{
unsigned int KeyPressed = 0;
asm
(
"ldr r0,=#0x4000130 \t\n"
"ldrh r0, [r0] \t\n"
"ldr r1,=key \t\n"
"and r0, r0, r1 \t\n"
"str r0,=KeyPressed \t\n"
);
}

then people could just go:
unsigned int AKey = 1;
ReadKeyInput(AKey);
if (KeyPressed == 0)
{
//code here
}


____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

Sparsite
Posted on 09-23-16 12:28 AM Link | #77811
How do all the data types work?

From what I can tell:
u8 is 1 byte
s16 is 2 bytes
u32 is 4 bytes

but what is u32*? I'm tryna check the players animation but it wont compile because of some integer pointer error or something like that

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

CodingKoopa
Posted on 09-23-16 01:17 AM Link | #77812
u32* is a pointer to a 4-byte number. I've also seen people use (vu32*), aka (volatile u32*) meaning a volatile pointer, meaning that it exists outside of your code, and that the compiler won't optimize it and screw things up.

Here's a better explanation.

Also, the u and s stand for signed and unsigned respectively.

____________________
Website | Twitter


Sparsite
Posted on 09-23-16 05:39 PM (rev. 2 of 09-23-16 05:59 PM) Link | #77848
Posted by TheKoopaKingdom
u32* is a pointer to a 4-byte number. I've also seen people use (vu32*), aka (volatile u32*) meaning a volatile pointer, meaning that it exists outside of your code, and that the compiler won't optimize it and screw things up.

Here's a better explanation.

Also, the u and s stand for signed and unsigned respectively.


ok, thanks, I understand the template addresses much more now. It was just me neglecting to learn more c++ as usual lol.

Problem is, I'm viewing the address as unsigned 4 bytes in desmume and I got the value I want to check and its still not letting me compile the code because of "ISO c++ forbids comparison between pointer and integer"

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

CodingKoopa
Posted on 09-23-16 07:26 PM Link | #77853
I think you're using pointers wrong. Consider the following code:
// create a u32 pointer
// it can now contain a hexadecimal value that is the address of an actual u32 variable
u32* coinsptr;
// assign it the address
coinsptr = 0x12345678;

// the integer/u32 we will be comparing against
// it can now contain an actual decimal value
u32 numcoins;
// assign it the value
u32 = 50;
This would be the wrong way of comparing the two variables:
if (coinsptr == numcoins)
blarg();
This is wrong, because pointers are just containers for hexadecimal addresses. If we were to output coinsptr, it would just say 0x12345678.

The right way to do it is to use the dereference operator, which is an asterisk (*). This gets the value AT an address.
if (*coinsptr == numcoins)
blarg();


____________________
Website | Twitter


Sparsite
Posted on 09-23-16 09:41 PM Link | #77867
Found out the real problem:
currentActionAddress_1 isn't a pointer, currentActionAddress_1 changes when the player changes animations. The real problem was that it was *u32 in the header files when it should've been just u32. Just changed it and my code compiles now.

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

Sparsite
Posted on 10-22-16 10:42 PM (rev. 5 of 10-22-16 10:44 PM) Link | #79044
How does the compiler know which offset is which in the player structure?

All you're typing is:

Struct {
void* vtable;
u32 Value1; //0x004
u32 Value2; //0x008
u32 Value3; //0x00C
};

How does it know that Value1 is 0x004, Value2 is 0x008, Value3 is 0x00C, etc.

I noticed that you missed several values, such as 0x6ED, would the structure not have some sort of desync if you didnt add those offsets?


____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

pacmainia&luigi
Posted on 10-30-16 04:10 PM Link | #79292
did you make hover with limit for your sunshine port?

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Sparsite
Posted on 10-30-16 04:45 PM Link | #79293
Posted by pacmainia&luigi
did you make hover with limit for your sunshine port?


Yes, obviously. The game would be completely broken otherwise.

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

pacmainia&luigi
Posted on 10-30-16 05:02 PM Link | #79296
Posted by Sparsite
Yes, obviously. The game would be completely broken otherwise.

no- I meant, "is the hover with limit patch the same as the hover nozzle in his sunshine hack?"

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Sparsite
Posted on 10-30-16 05:42 PM (rev. 3 of 10-30-16 05:43 PM) Link | #79307
Posted by pacmainia&luigi
no- I meant, "is the hover with limit patch the same as the hover nozzle in his sunshine hack?"


No. The one in his hack has to be refilled by standing in water after a while (you can see his fludd counter on the top screen in the bottom right). The patch example he released just lets you hover for a few seconds and there's no limit to it how much you can do it.

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

pacmainia&luigi
(post deleted) #82716

Gota7
Posted on 08-22-17 01:09 PM Link | #86957
Please fix the dead links in your main post.




Join the SM64DS Hacking Discord: https://discord.gg/PhpA9Wt

CodingKoopa
Posted on 08-23-17 06:05 PM Link | #87065
You can find the ASM hacking template here.

____________________
Website | Twitter

Pages: 1 2

Main - General SM64DS hacking - SM64DS ASM Hacking Template Hide post layouts | New reply

Page rendered in 0.080 seconds. (2048KB of memory used)
MySQL - queries: 27, rows: 235/235, time: 0.009 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.