Kuribo64
Views: 7,617,596 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
10-23-17 03:08 PM
Guest:

0 users reading Launch Stars (and Totally Not Breaking the Game's Code) | 1 bot

Main - General SM64DS hacking - Launch Stars (and Totally Not Breaking the Game's Code) New reply


mibts
Posted on 11-26-16 07:31 PM (rev. 2 of 11-26-16 07:36 PM) Link | #79976
[image]

Guess what? Now this game has launch stars! Just press A when you're near one and BOOM, the character is launched along a path.

The big question is: What do they replace?
The answer, however, is nothing! They are a completely new object with an object ID of 0x146 and an actor ID of 0x168. So how did this happen?

List of Edits
  • There is a table that maps object IDs to actor IDs. Said table was moved to 0x4b00 in the ROM for expansion. 3 edits were made in overlay 2 to reflect that move.
  • There is a table that maps actor IDs to function pointers to spawn the actors. Said table was moved to 0x6590 in the ROM for expansion. An edit was made in arm9.bin to reflect that move.
  • The FAT, FNT, and overlay 0 were modified to add a new directory with 4 new files: lstar.bin, lstar.bmd, ls_wait.bca, and ls_launch.bca.
  • Code to initialize and cleanup the code for new objects (lstar.bin only in this case) has been added at 0x90864 and 0x90b2c. Branches to each of these have been added in the main code
  • The interpolation and cubic interpolation functions were added at 0x8f670 and 0x8f840, overwriting some of the object names, but the game didn't need those anyway.
  • And maybe some more...

You would notice the new lstar.bin file, which is an experiment on elegantly adding new code to the game.
Documentation
Offset
Size
Description
Notes

0x00
0x02
Actor ID

0x02
0x02
Offset to array of pointers to fix
This is in here to avoid lots of offsets to individual pointers in the vtable

0x04
0x02
Number of pointers in said array
For each pointer, if the most significant nybble is not 0, treat the pointer as an offset from the start of the file instead of an absolute position in RAM

0x06
0x02
Offset to array of offsets from the start of the file to other pointers to fix

0x08
0x02
Number of offsets in said array
Each offset is a 2-byte offset from the start of the file to a pointer to fix. For each pointer referenced, if the most significant nybble is 0, treat it as an offset from the start of the file. If the nybble is 1, treat it as a branch to an absolute location in RAM. If the nybble is 2, treat it as a branch link to an absolute location in RAM.

0x10
0x02
Offset to object spawn function

0x12
Whatever!
The actual data and code


The launch stars have been added in:
  • Bob-Omb Battlefield (you'll see where :)): A multi-Bezier-curve spline
  • Jolly Roger Bay: At the start of the level, a test path that takes the player through invisible walls.
  • Jolly Roger Bay: On one of the wooden planks, a test path through water
  • Rainbow Ride: At the start of the level, a straight-line path

How to add a launch star:
  • Add one with the parameters:
    Parameter 1: Path ID
    Parameter 2: Speed (1 unit here = 0x1000 units in game)
  • Add a path made of Bezier curves: Every 3rd point starting from the first one is a vertex, and the others are the control points between them. The first one should be in the same position as the launch star.
  • Enjoy!

Here's the xDelta:
Launch Star xDelta

Oh, and before I forget, this does not work with the current SM64DSe. You need a new version of SM64DSe to add the launch stars:
SM64DSe Patched

____________________
Current hack: Excerpt from Super Mario 256

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

StapleButter
Posted on 11-26-16 07:34 PM (rev. 2 of 11-26-16 07:39 PM) Link | #79977
Hey, that's pretty cool! The star looks neat, too.

____________________
NSMBHD - Kafuka - Jul

bolts

poudink
Posted on 11-26-16 10:10 PM Link | #79979
Cool to see that some fancy ASM hacks are being made! It's kinda the last thing I expected to see since I thought that SM64DS hacking was dead :P

____________________
Nothing to say, so jadnjkfmnjamnfjkldnajfnjkanfjdksan jsdnvj m.

[insert quote here]

Hiccup
Posted on 11-27-16 06:54 AM Link | #79981
Nice work! Btw, are you going to add your SM64DSe changes to the git? https://github.com/StapleButter/SM64DSe

mibts
Posted on 11-27-16 04:52 PM Link | #80006
Not yet, because I want to completely get rid of the hardcoded number-of-objects constant (327). But this is an unofficial release, so ask Fiachra first.

____________________
Current hack: Excerpt from Super Mario 256

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

MK7tester
Posted on 11-27-16 07:43 PM Link | #80015
That looks way cool. I would like to see them in action though, so I hope someone makes a video.

pacmainia&luigi
Posted on 11-28-16 03:44 PM Link | #80021
Can you make it so that you can place them in castle grounds?

____________________
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.........

mibts
Posted on 11-28-16 05:48 PM Link | #80028
You can place it anywhere.

____________________
Current hack: Excerpt from Super Mario 256

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

poudink
Posted on 11-28-16 08:22 PM Link | #80029
Tested it and it's surprising to see how well it works! Good job!

____________________
Nothing to say, so jadnjkfmnjamnfjkldnajfnjkanfjdksan jsdnvj m.

[insert quote here]

TheKoopaKingdom
Posted on 11-29-16 04:39 PM Link | #80054
I don't know if this is a DeSmuMe error or just intentional, but the moving tower seems to disappear when I get close to it, with no collision either.
[thumbnail]
[thumbnail]

____________________
Website | Twitter


mibts
Posted on 11-29-16 08:51 PM (rev. 2 of 11-29-16 08:52 PM) Link | #80069
That had nothing to do with the launch star. :P

Yes, the moving tower is legitimately glitched. It is, first of all, not supposed to move until a switch is hit. I know how to fix the collision and draw-distance issue, but am saving that for later because I want to add a system for creating new level-specific objects.

____________________
Current hack: Excerpt from Super Mario 256

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

FireMario74
Posted on 11-30-16 04:52 PM (rev. 2 of 11-30-16 04:52 PM) Link | #80084
This is flat out amazing! I want to test this and maybe use this for a hack if that's alright with you(Of course I'll credit you). Unfortunately when I went to patch it I got an error. What version of the rom did you patch this to? Thanks in advance, and thank you for making this!

poudink
Posted on 11-30-16 05:22 PM Link | #80085
0022 Super Mario 64 DS (EU)(M5)

____________________
Nothing to say, so jadnjkfmnjamnfjkldnajfnjkanfjdksan jsdnvj m.

[insert quote here]

mibts
Posted on 12-01-16 07:28 AM Link | #80095
And make sure it hasn't been patched with SM64DSe.

____________________
Current hack: Excerpt from Super Mario 256

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

pacmainia&luigi
Posted on 12-01-16 05:32 PM Link | #80097
Posted by FireMario74
This is flat out amazing! I want to test this and maybe use this for a hack if that's alright with you(Of course I'll credit you). Unfortunately when I went to patch it I got an error. What version of the rom did you patch this to? Thanks in advance, and thank you for making this!

Patch with a clean Rom (I get mine from emuparadise)

____________________
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.........

ThatZeroFrozn
Posted on 03-08-17 03:45 PM Link | #81840
This look extremly awesome!
Good job mibts!
I got 2 questions:
1.Are we allowed to use it in our own rom hack (And then of course credit you)?
2.Is a SM64DS version with a launch star patch still possible to be played on a Nintendo DS/i (XL)?

mibts
Posted on 03-09-17 10:27 AM Link | #81865
1. Yes, and actually, I have a better version that doesn't spawn a new particle system every time a sparkle appears.
2. Not sure.
(Look out for a showcase of some other new stuff coming soon!)

____________________
Current hack: Excerpt from Super Mario 256

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

ThatZeroFrozn
Posted on 03-09-17 04:42 PM Link | #81885
Too bad I dont have a Flashcard or something like that ;_; i'd love to try that
When will the new version be for download
(Or did you actually update your top post)?

Shilz
Posted on 03-24-17 09:19 AM Link | #82112
I have a flashcard (R4i Gold). It works like a charm.


Main - General SM64DS hacking - Launch Stars (and Totally Not Breaking the Game's Code) New reply

Page rendered in 0.054 seconds. (2048KB of memory used)
MySQL - queries: 27, rows: 230/230, time: 0.031 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2015-10-07)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.