![]() | ||
Views: 24,256,382 |
Home
| Forums
| Uploader
| Wiki
| Object databases
| IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search |
03-18-25 05:10 PM |
Guest: |
0 users reading Custom behaviour? | 1 bot |
Main - General SM64DS hacking - Custom behaviour? | Hide post layouts | New reply |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 13/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
I'm starting to familiarize myself with arm asm, and I keep learning more. I want to start making some custom behaviours. Im just not sure where to start. I want to make it without overwriting the current behavior. I'm also not sure if this classifys as custom behavior, but I'm curious how I can make things happen to mario with a button press. Similar to fiachra's flood that lets you hover when you press a button. Thanks in advance. |
Fiachra |
| ||
Local moderator Level: 65 Posts: 914/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Have you looked at my examples here? |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 14/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
Thank you, those examples are very helpful. Does it matter where I write the behavior in the games rom? |
Fiachra |
| ||
Local moderator Level: 65 Posts: 916/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Yes, it does; if for example you wanted to set Mario's running speed to twice the current speed and the game calculated his speed at address 200, if you placed your hook at address 199 then your speed would be overwritten, rendering your hook useless. If however you placed it at address 201 then the original value gets ignored and yours used instead.
Usually it's not as simple as placing a single hook, there'll be several places where you need to modify the game's behaviour to allow your code to work as intended. Also there are certain instructions that you can't safely hook over: any branch instruction or "ldr rx =..." instructions. This is because these are relative to their current address and so break when NSMBe moves them. |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 15/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
Alright, im currently attempting to turn marios balloon power up into a fire flower. Do you think this will be very complicated, should I start off coding simpler stuff and work my way up to this? im very new to arm currently.
my theory is that when you press Y, one of the fire balls that bowser spits out will spawn, but im going to need to modify the fire balls behaviour to not target mario, and instead go in a straight line(in the players current facing direction when Y was pressing) |
Fiachra |
| ||
Local moderator Level: 65 Posts: 918/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Start with something much simpler, you'll need to understand the basics first. As an example exercise you could try the following:
- Find where the coin count is incremented upon collecting a coin. You can use DeSmuME's RAM search feature to find the (byte) memory location that increments by one each time you collect a coin. - Next, use No$gba to find the piece of code that sets that memory location using breakpoint: [00000000]! replacing the zeroes with the actual address. - Next, see if you can write a hook (in C) to spawn three new coins near where Mario is standing (use the SpawnActor method). |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 18/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
2 questions: 1. What program should i use to write C code in? I think on nsmbhd someone said something about using IDA Pro, but i'd rather confirm that its used for this purpose before installing it.
2. So this is what i should be using for step 2? https://gyazo.com/b4c1cb6757208fd686c9e385d89a603c because im very confused if so |
Fiachra |
| ||
Local moderator Level: 65 Posts: 920/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
1. Any text editor should be fine. I use Notepad++.
2. Yes, you can find a brief description of the interface here. Once you've completed step 1 and have your coin address: - File>Cartridge menu (FileName)>select your SM64DS ROM. - Let the game load and enter a level which has coins in it. - In the lower left portion of the window ("data window"), right-click and select "Goto". Enter your coin address - this will let you see its current value which you should see increment as you collect coins. - Debug>Define Break/Condition>enter "[XXXXXXXX]!" (without the quotes) where XXXXXXXX is your coin address. - Collect another coin, you should find that the game pauses and the left portion of the screen "code window" shows the instruction which updated the value in the coin address. |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 19/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
whenever i enter my address (0209F358) into the define break/condition it has some weird effects. First off, the game doesnt pause when i collect a coin, it either gives me 70 coins randomly, sets my coin count back to 0, and sometimes ill collect a coin and nothing will happen. |
Fiachra |
| ||
Local moderator Level: 65 Posts: 921/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Are you typing exactly:
[0209F358]! |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 20/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
im just stupid and didnt put the exclamation mark XD, thanks, i found the value, its 0202A7D4
what are the arguments for SpawnActor? I'm very confused as I dont know the syntax for C |
isceptul |
|
Fiachra |
| ||
Local moderator Level: 65 Posts: 922/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
It's explained in SM64DS.h; it needs to be called like:
short int TmpRot[3] = { 0x0000, 0x0000, 0x0000 }; // this will hold the X, Y and Z rotation of the spawned object int TmpPos[3] = { 0x0000, 0x0000, 0x0000 }; // this will hold the X, Y and Z position of the spawned object // Use the object DB to get the actor ID which corresponds to the // object ID of the object that you want to spawn const short int OBJ_ZZZ_ACTOR_ID = 0xFFFF; void hook_XXXXXXXX_ov_YY() { // calculate your desired rotation and position here, // assume they're stored in xRot, xPos etc. short int param01 = 0x0000; // parameter 1 as in SM64DSe TmpRot[0] = xRot; // ... TmpPos[0] = xPos; // ... unsigned int spawnedObject = SpawnActor(OBJ_ZZZ_ACTOR_ID, param01, TmpPos, TmpRot); } |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 24/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
so would this be correct?
short int TmpRot[3] = { 0x0000, 0x0000, 0x0000 }; // this will hold the X, Y and Z rotation of the spawned object int TmpPos[3] = { 0x0100, 0x0100, 0x0100 }; // this will hold the X, Y and Z position of the spawned object // Use the object DB to get the actor ID which corresponds to the // object ID of the object that you want to spawn const short int OBJ_ZZZ_ACTOR_ID = 0x0025; void hook_0202A7D4_ov_YY() { // calculate your desired rotation and position here, // assume they're stored in xRot, xPos etc. short int param01 = 0x0000; // parameter 1 as in SM64DSe TmpRot[0] = xRot; TmpRot[1] = yRot; TmpRot[2] = zRot; TmpPos[0] = xPos; TmpPos[1] = yPos; TmpPos[2] = zPos; unsigned int spawnedObject = SpawnActor(OBJ_ZZZ_ACTOR_ID, param01, TmpPos, TmpRot); |
Fiachra |
| ||
Local moderator Level: 65 Posts: 924/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Yes. |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 26/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
out of curiosity, how would i be able to find the instruction that tells mario to bonk when he hits a wall? with coins, its easy, because your coins go up by 1, and i assume its the same method for 1 ups, but what if i wanted to find the code that made mario bonk when he hit a wall? |
Fiachra |
| ||
Local moderator Level: 65 Posts: 927/1065 EXP: 2325213 Next: 10415 Since: 12-15-12 From: Ireland Last post: 2487 days ago Last view: 436 days ago |
Easiest way would probably be to perform a long jump against a wall but pause whilst midair and place a breakpoint on the method 0x020BEF2C. This method is called to change Mario's animation with r0 containing the action id eg. for walking it's 0x48 or for running it's 0x3F. I have documented most of them in SM64DS.h. Once the breakpoint is hit upon hitting the wall you can find where it's called from by looking at the value in r14. |
isceptul |
| ||
![]() Red Paragoomba Sparsite dupe Level: 17 Posts: 28/54 EXP: 23218 Next: 1525 Since: 11-03-15 Last post: 3222 days ago Last view: 3074 days ago |
So I could use this for any animation change such as ground pounding or ducking? This would actually be really cool to mess around with. Instead of ground pounding I could modify it to make mario spin mid air as if he bounced off a spin drift or something.
im just curious if i can put in cheat codes in no$gba debugger because i have a 100% cheat code that would make debugging a million times easier. (action replay) |
isceptul |
|
isceptul |
|
Main - General SM64DS hacking - Custom behaviour? | Hide post layouts | New reply |
Page rendered in 0.023 seconds. (2048KB of memory used) MySQL - queries: 28, rows: 232/232, time: 0.010 seconds. ![]() © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |