Kuribo64
Views: 20,053,041 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
04-25-24 02:33 PM
Guest:

Main - Posts by dy

Pages: 1 2
dy
Posted on 04-24-18 09:54 AM, in Start game as Mario? Link | #94176
To change the starting character:
1. Open the ROM in a hex editor and go to offset 0x13DDC (for EUR ROM)
2. Change the "03" to the character of your choice (00: Mario, 01: Luigi, 02: Wario, 03: Yoshi)

Makes the intro cutscene a little glitchy, but you're probably going to want to apply the Skip Intro patch anyway if you're changing starting characters.



____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 04-24-18 10:05 AM, in First Person View [v0.1 RELEASED] Link | #94177
Fair enough. Look forward to seeing the end result. Limiting turning speed sounds good. Only other thing that jumps to mind is to think about what to do during star cutscenes (like when you step on star switch or the star disappears) - I anticipate it might feel jarring if everything just freezes suddenly without a star camera. Good luck!

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 04-24-18 11:53 PM, in SM64DS Editor Help Thread - Post your questions here (rev. 3 of 04-24-18 11:56 PM) Link | #94180
Good job.

Also, I'm a bit late to the party, but just found out for myself there's a way to narrow down which overlays to look in. arm9ovt.bin (you'll need NSMBe to extract it) tells the game where to load the various overlays, and it's also how NSMBe knows where to insert ASM hooks without being told the overlay offset.

[thumbnail]

Overlays have overlapping memory addresses, so you'll still need to search a couple to confirm, but this should help quickly narrow down which overlays to look in.


____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 04-26-18 10:56 AM, in SM64DS ASM Hacking Template (rev. 13 of 05-10-18 07:56 AM) Link | #94188
I've created a small tweak to NSMBe which allows you to directly overwrite code or data in the ROM/overlays (rather than inserting a branch to new code).
It's useful for:
  1. Changing data tables and pointers (which you can't do with the standard hooks)
  2. Replacing code without introducing unnecessary jumps (might be useful in core loops, like the draw distance check which is run once for every object every frame)

The code gets compiled with correct relative branch opcodes and inserted directly at the address specified. This allows you to directly overwrite code as well as data without hex editing, and helps you keep everything in the same place and with the same syntax.


How to Use

Overwrites must be contained in ".s" files. They follow the NSMBe syntax but using the "ovr_" keyword.
Here's an example:

    source\example.s

    ovr_02013DDC: @ change starting character
    .byte 0x01 @ Luigi

    ovr_020FF176_ov_02: @ change character speeds
    .hword 0x1000 @ Yoshi

    ovr_02128D18_ov_51: @ change Ice Block vtable pointers
    .word 0x020B382C @ onGroundPounded: change to BrickBlock:onGroundPounded
    .word new_IceBlockExploded @ onHitByExplosion: change to new_IceBlockExploded

    .align @ return to 4 byte alignment for below instructions

    new_IceBlockExploded: @ do nothing and return because lazy example
    bx r14


Usage Notes
  • Can only be used in ".s" files

  • You can have several "ovr_" blocks in a single file, but each block must be self-contained (each block is compiled separately for its specified code address, to ensure correct relative branch opcodes are generated). The only exception is the ability to reference labels with a "new_" prefix, as shown in the above example.

  • Do not use "ldr rX, =0xXXXXXXXX" instructions in overwrites unless you really know what you are doing (they can take up 8 bytes, but not always).

  • Overwrites are now compiled and inserted after standard hooks.

  • Everything in the \source folder (not including subfolders) is compiled and inserted into unused ROM space, specifically the old "arena" (this is default NSMBe behaviour). Overwrites are therefore also compiled and duplicated here. This shouldn't be a problem, as it is just unused code, but if you have large overwrites and don't want to waste arena space, you can wrap your overwrites inside a special block like so:

      /*overwrite

      ovr_02013DDC: @ change starting character
      .byte 0x01 @ Luigi

      ovr_020FF176_ov_02: @ change character speeds
      .hword 0x1000 @ Yoshi

      overwrite*/

    The hook compiler treats this as a multi-line comment block (so it is not compiled), but the overwrite parser will still compile and insert it. Note however that you cannot nest comment blocks, so you would not be able to use any multi-line comments inside the "/*overwrite" block.


Download

Executable: here
Modified source files: here (based on the latest official NSMBe source code from github)

Backup version of official NSMBe source code (unmodified): here

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 04-26-18 02:12 PM, in [ASM Resource] Customising behaviour of player/objects/levels (rev. 2 of 04-26-18 02:56 PM) Link | #94190
Added above some ways to change the type of pause screen and text you get when exiting a level with a star in the above post. I've also realised that Black Brick Blocks share the same vtable and callbacks as orange Brick Blocks - the onAttacked callbacks checks the ActorID to determine what type of brick block it is and therefore whether it should break. The first post has been updated to reflect this.

Also, I've discovered that you can make Ice Blocks breakable by making the various onAttacked callbacks point to the corresponding callbacks for Brick Blocks instead (they normally point to dummy functions, so aren't breakable). Correct particle effects and everything!

    Ice Blocks: breakability when attacked

    To make them breakable: here
    To change which characters can break them, see "Brick Blocks / Black Brick Blocks: who can break" in the first post

For replacing the vtable pointers, you can use my modified version of NSMBe (which allows you to directly overwrite code using the same syntax as when creating standard hooks).

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 05-01-18 09:58 AM, in SM64DS ASM Hacking Template (rev. 3 of 05-01-18 10:08 AM) Link | #94215
Above post has been updated with an improved version of the direct overwrite feature.

Changes in v1.1:
  • Fixed crash bug when trying to overwrite an address in ARM9.
  • No longer spams multiple console windows, output from all compiles appear in the same console window.
  • No need for separate \overwrites folder and files anymore. Use "ovr_" just like you would standard hooks, including in the same file as other hooks (but still only in ".s" files).
  • Can now overwrite single bytes or any number of bytes (no longer needs to be in 4-byte multiples)
  • Now recognise /* multi-line comment blocks */.

Download link in above post.

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 05-01-18 12:49 PM, in [ASM Resource] Customising behaviour of player/objects/levels (rev. 2 of 05-01-18 12:49 PM) Link | #94218
Posted by Hiccup
The reason the ice block breaking works with the shards may be because you technically can break them if you hack Giant Mario into the level and walk into one.

Yep, you're probably right. If you look at all the onKicked(), onPunched(), onGroundPounded(), etc functions for the Brick Block, you'll see that basically all they're doing is returning a pointer in r1 if the object should be broken. It gets that pointer by getting the address of the vtable for that object (the first four bytes at the object's address), adding 0x7C to that address, then getting the value from there. Looking at the commented out vtable structure in SM64DS_2.h, offset 0x7C would be the 31st function (InitResources being the 0th), which is the Kill() function.

So looks like all it does is check whether the object should break, and if so, return the address of the object's Kill() function in r1. So yeah, they must have programmed IceBlock::Kill() to break with shards for if hit by Mega Mario.

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 05-06-18 02:22 PM, in [ASM Resource] Customising behaviour of player/objects/levels (rev. 5 of 05-08-18 12:07 AM) Link | #94246
Thanks StarPants - good to see others doing ASM research as well!

There is a 4 halfword data table which sets out the speed multiplier for each character, which affects both walk and run speeds (I found it earlier today but had been planning to look into how it interacts with carry speed and swim speed as well before I posted). Unfortunately not in front of my PC now, but will try post tomorrow (just a heads up so other people don't spend time unnecessarily trying to find it as well - this one was tricky).


UPDATE

Heh, StarPants - you actually got really close to finding the data table for movement speed. If you look at 0x020BF30C (just a few lines above the address you found), you'll see it gets the player charID, then loads r2 with a value from 0x020FF170 (plus an offset depending on the charID). The function at 0x020BF30C gets called a lot, with a different multiplier in r1 depending on whether it's determining the speed for running, walking, crawling, etc. This isn't character dependent, so if a character has a faster walking speed, it will have a faster running speed.

Anyway, without further ado...

    Player: move speed and acceleration

    See here (including ceiling hang and slippery slide)

    Despite what many game guides say, all characters have the exact same acceleration and deceleration (and no, Luigi does not have a faster top speed than Mario).
    Also, thanks to Skelux's "Increase Acceleration" additional patch for the memory address re ground acceleration.


    Player: carry speed

    Regular and heavy objects: here


    Player: swim speed

    See here


    Player: jump power

    See here (including back flip, side flip and long jump)

I've also figured out how to change the player's attack knockback power and throwing power, but these are all hardcoded differently for different objects - will upload these once I've finished looking into the different objects.

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 05-08-18 12:06 AM, in [ASM Resource] Customising behaviour of player/objects/levels (rev. 2 of 05-08-18 12:09 AM) Link | #94255
Posted by StarPants
I saw there was something going on in the registers but couldn't analyse it any further. I'm glad you got it.

unrelatedly: If anyone's doing a kaizo they can try to nop at 0x020BF330. I tried in first person and it felt pretty much like a motorbike without breaks. Never rode one irl though.

Oops, I meant a few lines above at 0x20BF30C (I'll fix my above post). Took me a while to work out too - I find that using F7 in no$gba debugger to step through line by line and look at what's happening to the registers after each line, can help make sense of things when I'm struggling.

Essentially this is what it's doing:
    ldr r2, [r0, 0x8] // r2 = 4 bytes at address (r0 + 0x8) = charID (0:M, 1:L, 2:W, 3:Y)
    ldr r0, =0x020FF170 // r0 = 0x020FF170
    and r2, r2, 0xFF // r2 = r2 bitwise AND 0xFF (seems unnecessary?)
    mov r2, r2, lsl 0x1 // r2 *= r2 (left shift 1 bit is effectively x2) = charID x2
    ldrh r2, [r0, r2] // r2 = 2 bytes at address (0x020FF170 + charID x2)

After that it gets to some mathsy stuff which I didn't really follow either. But yeah, nop'ing at 0x020BF330 stops it dividing the top speed (by what, something like 2^12?) but without changing acceleration/deceleration. So yeah... (It looks even funnier in 3rd person btw, because it speeds up some of the animations as well.)

Also FYI - you can change data values in no$gba debugger by changing the instruction to "dcd 0xXXXXXXXX" (took me a while to work out), so you can test things like changing the speed table values on the fly. Don't use "dcd" with ASMPatchTemplate / devkitARM though - use ".word", ".hword", or ".byte" instead.

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature

dy
Posted on 05-10-18 07:43 AM, in SM64DS ASM Hacking Template Link | #94265
A new version of the modified NSMBe (with direct overwrite) has been uploaded, with an important bug fix.

Changes in v1.2:
  • Bug fix: overwrite parser no longer stops looking for "ovr_" blocks once it finds a non ".s" file.
  • New feature: can now refer to "new_" labels inside overwrite blocks - this allows you to insert pointers or branches to new code (where address is unknown prior to compile). Please note that overwrites are now parsed and inserted AFTER standard hooks as a result.

Download link and updated example in this post.

____________________

- ASM resource for customising behaviour of player/objects/levels
- NSMBe with direct overwrite feature
Pages: 1 2

Main - Posts by dy

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