Author Topic: Help needed - manually changing an event  (Read 1458 times)

PowerPanda

  • Guru of Time
  • Earthbound (+15)
  • *
  • Posts: 43
    • View Profile
Help needed - manually changing an event
« on: November 14, 2022, 01:21:47 am »
This requires a bit of an in-depth explanation. First, what I'm trying to do: In the opening of the game, when Taban and Lucca display the Telepod, the cutscene just uses the standard music that plays on the map (Millenial Fair). I want to keep the Millenial Fair music for the rest of the game, but in that specific cutscene, insert a "Play song" command to change the music. Luckily, there's a dummied-out textbox 4 bytes earlier ("TABAN: Don't worry, we tried it on our pets!..."). I want to change those 2 bytes to a Play Song command (EA xx), then shift that to the beginning of Taban's explanation. I also want to do this in a hex editor, and not in Temporal Flux, because Temporal Flux re-arranges parts of the rom when you make even a single change to an event.

If you open up a clean rom in Temporal Flux, and go to map 008 (Telepod Exhibit), open up the event packet (1C), and scroll down to Object A, Taban (057C), you'll see where all of the action happens. The dummied-out textbox is at [05AB]. I want to shift that to the beginning of the "Arbitrary 0" section. That means that it will go from this:

(Rom address: DB/102B)
05AB:   Textbox
05AD:   Return
--Touch
05AE:   Return
--Arbitrary0
05AF:  Textbox

To this:

(Rom address: DB/102B)
05AB:  Return
--Touch
05AC: Return
--Arbitrary0
05AD:  Textbox
05AF:  Textbox

(Note: I have taken care of the "Goto" commands at 0599, 05A2, and 05A9. Those were no concern)

However, there is something else that is telling the game where "Touch" and "Arbitrary0" begin, and I can't figure out what. No matter what, the scene always starts from 05AF (rom address: DB/1031). Any tips or pointers?

Reld

  • Guru of Time
  • Porrean (+50)
  • *
  • Posts: 63
    • View Profile
Re: Help needed - manually changing an event
« Reply #1 on: November 14, 2022, 02:22:34 am »
If you're doing it in a hex editor the pointer for touch is at $0145 (value = $AD05), and the one for Arbitrary0 is at $0147 (value = $AE05) in the decompressed event packet. If you change those to $AB05 and $AC05 (1 less than the address Temporal Flux shows) it should work.

IHBP

  • Architect of Kajar
  • Chronopolitan (+300)
  • *
  • Posts: 379
    • View Profile
Re: Help needed - manually changing an event
« Reply #2 on: November 14, 2022, 10:11:27 am »
Why would you not just insert a new command in Temporal Flux.

PowerPanda

  • Guru of Time
  • Earthbound (+15)
  • *
  • Posts: 43
    • View Profile
Re: Help needed - manually changing an event
« Reply #3 on: November 14, 2022, 11:48:15 am »
Why would you not just insert a new command in Temporal Flux.

That would work well if I were doing a "complete" project, unconcerned with compatibility with other projects. From what I can tell though (and this is just an observation), when you edit a compressed event packet with Temporal Flux, rather than making edits to the event itself, it instead abandons the original code (leaving it in its usual place in the rom) and creates an uncompressed copy in the rom's free space.

For example, when I was working on adding new music to CT+, I found 2 copies of the Truce Inn Piano Player code in the rom. One was the original, abandoned event, and one was your new, edited event.

For the Chrono Trigger Soundtrack Expansion, I'm working to make it as compatible as possible, so that people can stack it on top of other changes. The best way to ensure that I accomplish that is to edit the original event code in a hex editor.

Reld

  • Guru of Time
  • Porrean (+50)
  • *
  • Posts: 63
    • View Profile
Re: Help needed - manually changing an event
« Reply #4 on: November 14, 2022, 11:59:20 am »
Quote
when you edit a compressed event packet with Temporal Flux, rather than making edits to the event itself, it instead abandons the original code (leaving it in its usual place in the rom) and creates an uncompressed copy in the rom's free space

As far as I'm aware the new copy of the events should still end up compressed, although there might be little chunks of identifiable raw event data within the compressed packet.. Probably what happened with that Piano Player event was that the modified packet ended up slightly larger than the original when recompressed, so TF moved it to somewhere it would fit. If it didn't have anything else to stick in the old space at the time you'd end up with an abandoned old copy. I don't know exactly how TF decides when and where to move stuff .though
« Last Edit: November 14, 2022, 12:00:10 pm by Reld »

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Help needed - manually changing an event
« Reply #5 on: November 14, 2022, 04:54:55 pm »
Temporal Flux's compression does not come to the same size as the original compression routine - it ends up slightly larger. For this reason editing compressed data will often be moved even if the size wasn't increased.

Temporal Flux will take the first available known free space for whatever's being saved.

ZeaLitY

  • Entity
  • End of Timer (+10000)
  • *
  • Posts: 10795
  • Spring Breeze Dancin'
    • View Profile
    • My Compendium Staff Profile
Re: Help needed - manually changing an event
« Reply #6 on: November 14, 2022, 05:43:12 pm »
Would TF still flag the abandoned packet as free game? If you were cramming enough stuff into a 6 MB ROM that space became a priority, I mean...

IHBP

  • Architect of Kajar
  • Chronopolitan (+300)
  • *
  • Posts: 379
    • View Profile
Re: Help needed - manually changing an event
« Reply #7 on: November 14, 2022, 07:48:34 pm »
Even if you don't expand the rom it takes a while to fill.

PowerPanda

  • Guru of Time
  • Earthbound (+15)
  • *
  • Posts: 43
    • View Profile
Re: Help needed - manually changing an event
« Reply #8 on: November 15, 2022, 12:51:58 am »
After manually repointing everything, the game was crashing. I bit the stick and just made the updates in Temporal Flux. I kept the event the same size, and it did everything within the bounds of the event code.

The line that I thought was unused actually isn't; I had just never thought to talk to Taban between talking to Lucca and getting in the telepod. Taban's line is funny, and also out of place once you've already agreed to do it, so I have decided to use that line as the main one, and have him not talk to you at all once you've agreed to step into the telepod.