Kuribo64
Views: 23,103,643 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
12-05-24 07:45 AM
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
Hiccup
Posted on 08-23-17 07:39 PM Link | #87075
I saw printf was listed in symbols.x. Is that used by the game?

Gota7
Posted on 08-23-17 09:01 PM Link | #87078
How could this be ported to the US version 1 ROM?




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

mibts
Posted on 08-24-17 02:00 AM Link | #87083
By finding all the necessary function addresses in that version.

____________________
Current hack: Excerpt from Super Mario 256

Any map on a flat torus can be colored with at most 7 colors.

CodingKoopa
Posted on 08-27-17 03:29 PM Link | #87281
You might find this thread helpful in finding those.

____________________
Website | Twitter


mibts
Posted on 08-27-17 05:36 PM Link | #87286
Keep in mind that you also have to replace all the addresses in symbols.x because the functions may not be in the same places.

____________________
Current hack: Excerpt from Super Mario 256

Any map on a flat torus can be colored with at most 7 colors.

dy
Posted on 04-26-18 10:56 AM (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 05-01-18 09:58 AM (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-10-18 07:43 AM 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

pants64
Posted on 05-20-18 06:47 PM Link | #94372
Just in case anyone wonders how to use the header files of the v2 template in NSMBe hooks...

Pages: 1 2

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

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