News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Chrono Trigger Hacking  (Read 6097 times)

metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Chrono Trigger Hacking
« on: September 02, 2013, 02:08:28 am »
Hello. After looking at everything I could find about CT hacking on the net, there are some things I don't understand.

1-) We can edit events with Temporal Flux but what if I'm going to repeat some events in almost all maps/locations, is there a way to do so that wouldn't waste so much ROM space due to repeating the events on different locations? What this question boils down to is: is there a way to use something like "global variables/functions" or routines/subs (like a global Arbitrary in TF that could calculate its starting position based on player X and Y coords and then autoexec on touch)? I know there is at least 76 permanent bytes free without the expanded ROM but I don't know how to use it for this purpose.

2-) Although some tools can expand the original ROM, how can I use that space for original content beyond text or event commands? Originally, my intention was to replace Crono with an original character but it seems like lots of factors make this difficult, mainly Sprite/Animation/Palette limitations. Even if I do replace him, there won't be enough space for all custom sprites/animations.
 
Maybe my doubts come from a lack of understanding on how gfx are available for drawing on screen in CT. From what I've read, there is something like different "banks" or "packets" that must be loaded before drawing sprites and said banks are limited to a certain space inside the ROM (and file size?), making other ROM areas "out of range?" for this purpose.

If simply repointing works, how can I repoint Crono's gfx? If there is indeed a file size limitation to his sprites/animations unrelated to overwriting what comes next, how can I choose to load a second set of sprites/animations from another "bank"? And how to resume back to the original bank if needed?

From the SNES docs floating around, it seems like it's possible to force a VBlank (or HBlank) and then do it, is there something in TF that allows direct access to something like this?

Also, are there any free palette slots left (or it can be added)? I could edit some palette available, but even Crono's is shared with other sprites.

Oh, and what is the purpose of "Link" button on Location Events in TF?

Sry 4 the wall of text and I appreciate any help.

RedScorpion

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • Snes-Projects
Re: Chrono Trigger Hacking
« Reply #1 on: September 02, 2013, 02:55:21 am »
1)

If you want use some events in all/some map locations you have to edit all events from all maps.
You can create a single event file where you can add the event which should repeat in all/some maps.
The way to use this event is that you have to set a RAM value -> If you enter the map the event will change to your event file and after execution he set the value to for example to 1 and switch to the map which you have entered before.

Hope you understand: It is bad to explain:

Enter MAP -> Execute MAP Event -> Change to Standard Event Map -> Exexcute Standard Event -> Change back to original MAP and continue the Eventfile
During my work with TF I couldn’t find and differents between global and standard functions. You can set the player x and y cords to execute some events

2)

Check this: http://www.romhacking.net/documents/444/

You can set pointer to some address in expand area. Some changes need ASM.

All sprites have a pointer header where you can change informationa about spriteset, animations and techs.

The Link button is bad in TF because he has never worked if I want to use it.

In the original CT ROM the Link function was used to use one animation/action for all PC chars. For example the agree animation of chrono is animation 3 or 4. If you have a cut scene, you set only one time the animation and link all other PCs to this animation of chrono.
The other PCs will execute his animation 3or 4

I hope you could understand all.

Thanks

red



metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Chrono Trigger Hacking
« Reply #2 on: September 02, 2013, 01:24:03 pm »
I'm not sure I understood. The only thing mentioning multi-purpose events on TF is in the "help file" manual, a small line saying "Multiple locations may have the same event, if you want them to.", though it doesn't explain how. If the only way is by changing the assigned Location Event of each Location to point to the same one, it's kind of useless since it would override said Location events.

If I understood your explanation, you're saying that I could force every Location in the game to load my "general function map" (probably through "change location" command category), then warp back to the original map after execution. If this is really what you're saying, I don't think it will work because I need certain persistent loop active on all maps that will change states according to player input in real time.

Also, how can I be sure I'm not writing over something important/being used in RAM? There is a similar question on TF that was answered in some docs floating around (about value-to-mem) but the only answer given was that there are some bytes free due to unused item slots that gets saved on SRAM (so the question wasn't actually answered). Plus, even if it's possible to load gfx/sprites/animations from any bank at any time without problems (it isn't, right?), those free spaces mentioned aren't enough to store all custom sprites/animations (even the RAM, I suspect).

Well...there must be a way, otherwise the game wouldn't be able to load PC sprites from the same location without needing duplicates.

justin3009

  • Hero Member
  • *****
  • Posts: 1614
  • Welp
    • View Profile
Re: Chrono Trigger Hacking
« Reply #3 on: September 02, 2013, 02:10:35 pm »
There is well more than enough room for custom sprites and animations. You'd have to move his sprites to a new location and change the pointer. Then move animation data and change that pointer too, same thing with sprite assembly. Palettes aren't an issue as there's a horde of free data for pointers after its original spot and a mess of room everywhere else.


It's not really hard to do per se but rather incredibly time consuming.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

RedScorpion

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • Snes-Projects
Re: Chrono Trigger Hacking
« Reply #4 on: September 03, 2013, 05:03:45 am »
I'm not sure I understood. The only thing mentioning multi-purpose events on TF is in the "help file" manual, a small line saying "Multiple locations may have the same event, if you want them to.", though it doesn't explain how. If the only way is by changing the assigned Location Event of each Location to point to the same one, it's kind of useless since it would override said Location events.

If I understood your explanation, you're saying that I could force every Location in the game to load my "general function map" (probably through "change location" command category), then warp back to the original map after execution. If this is really what you're saying, I don't think it will work because I need certain persistent loop active on all maps that will change states according to player input in real time.

Also, how can I be sure I'm not writing over something important/being used in RAM? There is a similar question on TF that was answered in some docs floating around (about value-to-mem) but the only answer given was that there are some bytes free due to unused item slots that gets saved on SRAM (so the question wasn't actually answered). Plus, even if it's possible to load gfx/sprites/animations from any bank at any time without problems (it isn't, right?), those free spaces mentioned aren't enough to store all custom sprites/animations (even the RAM, I suspect).

Well...there must be a way, otherwise the game wouldn't be able to load PC sprites from the same location without needing duplicates.

okay... for some cases my post will work. But you could also set a SRAM value at the start of each location. If this value on start true the engine will execute your commands and settings.

For example: You have to find a special item to enter a specific location. If you doesn't have the item and enter the location a text dialog will execute and the PC will leave the area.

Thanks.

red

metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Chrono Trigger Hacking
« Reply #5 on: September 03, 2013, 11:32:47 am »
Hey, it's Justin! Hello there.

So, is that really it? All I have to do is repoint and insert my content somewhere available, including the expanded space? There isn't any problem of reading out of range/memory locations? I don't mind it being time consuming, but I'm worried if I'll be able to repoint Crono's sprite assembly pointers properly. I've read what I could gather about this but the info is incomplete (like always). However, I have the ChronoCharView program that allows animation/palette/assembly editing.

Since I'll be replacing Crono with a custom char that doesn't correspond to Crono's sprite assembly (and has more sprites/animations, not to mention I won't scramble the sprite to insert it - to make it easier to re-edit/replace again), could you please explain how to do this (If I move Crono's sprite in the ROM, ChronoCharView won't detect it, I think - and on a similar vein, wouldn't this break things like Animation event Command on TF? There's no index for + than 256 animations I think)?

The partial solution I can grasp is to first edit the exact space/size available to Crono with my new sprite with ChronoCharView(mainly assembly and animations) and then this data is ready to be moved. But what about the rest of my sprite that won't fit inside Crono's sheet? Wouldn't this require further edits to some sort of sprite assembly header (or wherever the data size of his sprite sheet/animation is specified) plus more pointers? If so, how can I create said pointers?   

 

Red, that's precisely how my custom events will work, by using free SRAM space. Unlike your "item required" example, I'll use this space again and again for semi-random purposes in almost all Locations.

But I'm thinking there must be a better way to use a huge custom event(or sets of conditional small events) besides copy/pasting them to every location (plus duplicating NPCs involved). That would waste lots of space too, right? I think this should be possible with an ASM routine (in this case it would be my custom event) activated from a jump call that could be triggered by some address I can work with in TF (like any free SRAM). But that would be difficult (impossible?) without disassembling and re-assembling the ROM. Isn't there anything in TF that can help me achieve this?

What about the MemCpy (Memory Copy) Command, how does it work? I've seen it mentioned to somehow assign a white/shadow effect on PCs and to get and apply a palette (from Ozzy statue?) to PCs.

I know your idea of using a map location as a buffer can at the very least alleviate some parts of the copy/paste needed since I know the player X and Y pos + his original location before going to another map (by deciding which parts of my event I need to load before loading the actual player location map, therefore making the repeated copy/paste part shorter on each map).

But this can't help me with NPCs. Originally, I wanted to use the Random Number command to load different NPCs/Events in almost all locations. What is the range of the random number generated? 0~256?

Also, under Sprite Drawing category, there's this "Status Drawing from mem" Command (Variants 7C,7D - Index up to FF). What is this? Can this help me in any way to achieve a similar effect to the random number example above?
« Last Edit: September 03, 2013, 11:40:31 am by metastase »

justin3009

  • Hero Member
  • *****
  • Posts: 1614
  • Welp
    • View Profile
Re: Chrono Trigger Hacking
« Reply #6 on: September 03, 2013, 12:37:24 pm »
Like you said, I don't think Temporal Flux would allow you to go beyond the natural limit of animations that there are.  I don't think you can do that regardless unless you do a huge ton of recoding in the game in general, so you'd probably have to simplify animations down or find a way to make them all fit.  It's a very difficult task.

As for ChronoCharView, yeah, you'd probably have to work on it there THEN move all his data out.  I haven't used that program much quite yet as I haven't had a need to, but for all the other sprites and stuff, yeah.. You'll have to try and fit it within the limit. (As far as I know of anyway).

If I remember right though, there's room for 255 sprites and such, but there's quite a few 'broken' sprites in general in Crono's original sheet.  So you SHOULD be able to fit all the sprites (Or so I hope anyway).

If there isn't enough room, the other shoddy method is to make a clone NPC of his data but have it read new animation/sprite assembly just for the rest of his animations.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Chrono Trigger Hacking
« Reply #7 on: September 04, 2013, 06:50:06 pm »
There is a fair amount of space spread between glitchy/unused animations when accounting all sprites, but when repointing Crono's data, shouldn't they be all allocated sequentially inside the ROM (forcing me to either break or repoint other animation data for unrelated NPCs)? Or each of his animations contain an independent pointer, allowing me to spread his animations through all unused/glitched space?

Using a NPC "fakie" is indeed my backup plan, but this is a huge problem because it would generate even more redundant event code in all maps (provided no one knows a way to create global functions/subroutines) where those expanded animations take place (to make a smooth transition when hiding the PC object, reading his X,Y pos, drawing the fake NPC and transitioning back to PC obj).

PCs sprite sheets don't have the same size so there must be a way to increase it (Roughly, Crono's is bigger than Magus by around 80 8x8 tiles).

How hard/glitchy would it be to include a new GFX pack for the custom sprite? The doc linked by Red says that Crono's header is composed of 5 indexes (5 bytes):GFX packet, assembly index, palette, animation and assembly size (what's this size measure? bytes? bits? tiles?).

His GFX pack contains pointers for GFX pack starting address and a sprite packet starting address (size is 31680 decimal - what's the measure again?). It's said that some pointers addresses are, in the ROM, as absolute pointers + 0xC00000 (I don't know what this means). Other pointers are said to be relative to certain addresses - some include a "correctional factor" - I don't know what to make of this either.

Generally, near pointers shouldn't be able to point outside their intended memory range, right? Then how come some small pointers in CT are able to do so through the whole game? The doc says sprite animation pointers are only 2 bytes long but we never see the game crashing due to pointing out of memory region. 

justin3009

  • Hero Member
  • *****
  • Posts: 1614
  • Welp
    • View Profile
Re: Chrono Trigger Hacking
« Reply #8 on: September 05, 2013, 01:45:26 am »
The animations are split between all characters *I THINK*  I haven't experimented much with actual animation editing only to know that it can be expanded.

The sprite sheet 'size' is purely based on Sprite Assembly.  Re-using same tiles is your best friend in that case.  It's an incredibly tediou stask.

And a new GFX pack?  I think that's basically just another 'PC/NPC' type thing.  It can become a real mess if you're trying to add another PC.  But replacing an existent one is no problem.

I can't remember exactly what the absolute pointer bit is.  It's been so long since I've actually viewed any of the graphics data, but I assume it's just talking about the normal pointer of the character.  I THINK though there's a hard-coded bank code that would need to be swapped if you moved Crono out of bounds.

And it's probably two byte pointers but there's a hard-coded bank being used for the prerequisite
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

Vehek

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Re: Chrono Trigger Hacking
« Reply #9 on: September 05, 2013, 02:31:33 am »
There is a fair amount of space spread between glitchy/unused animations when accounting all sprites, but when repointing Crono's data, shouldn't they be all allocated sequentially inside the ROM (forcing me to either break or repoint other animation data for unrelated NPCs)? Or each of his animations contain an independent pointer, allowing me to spread his animations through all unused/glitched space?

There are no pointers to individual animations. Unfortunately, due to the way the game loads animations, animation data offsets have to be sequential.

Quote
It's said that some pointers addresses are, in the ROM, as absolute pointers + 0xC00000 (I don't know what this means). Other pointers are said to be relative to certain addresses - some include a "correctional factor" - I don't know what to make of this either.
The "correctional factor" is only for palettes, and is there for loading palettes from ROM in Tile Molestor. You see, the sprite palettes in Chrono Trigger don't include the transparency color, and AFAIK Tile Molestor doesn't allow for missing colors in the palette. The "correctional factor" is just pretending the two bytes before are part of a particular palette.

metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Chrono Trigger Hacking
« Reply #10 on: September 06, 2013, 04:26:49 pm »
Even if animations are split, it seems like Crono have 255 animation slots for use, some are unused and some are glitched.

So by purely based on sprite assembly, you're saying that there isn't any problem in using a sheet whose size is greater than 64k for Crono as long as all assembly data is correct? If that's the case (I'm really hoping it is), re-using tiles is a secondary priority to me while making it easy to replace is a higher priority even at expense of ROM space. Also, if his size is only based on his assembly, why the 5th byte of his header is for sprite assembly size?

Yeah, what I meant by new GFX pack is to simply point Crono's GFX pack to another one (custom and bigger) in the expanded ROM space.

That hard-coded bank isn't precisely the GFX pack (and thus my question of whether 64k is the size limit or not)? After further research, it seems that the absolute pointer is used to point to an address while also including it's DB (data bank). That's why I'm asking first before attempting to include a sprite sheet bigger than 64k (mainly, is there a size limit to Crono's sprite data bank?).

Vehek, thx for explaining the palette thingy. I figured the 0xC00000 part. It just means that somehow, the game subtracts 0xC00000 from the sprite packet address to point to the real address.

So let's recap what I have to do to replace him to see if it's right: His GFX pack address is at 242000, which points to 1272C0 (after subtracting C00000), which starts with a bunch of 0's (why?). Whatever the meaning of these 0's are, I just need to make 242000 point to my new address and insert my sprite sheet there, right? 

Since his palette is shared and there are only 252 palettes, changing the value of 24F002 to FD will make it point to 242BFA, allowing my custom palette to be inserted at 2417B8. Does anybody knows what each of the 24 palette bytes mean (and their order needs to be reversed too in the ROM? if so, reversed only in pairs or totally reversed and inserted backwards, from the last of the 24 bytes up to the 1st?)?

Unfortunately, animation pointer is also relative to it's index bank so I can't change it without breaking the game. Plus, it seems like Crono already have 255 animations,although some are unused and others glitched and can be used elsewhere. Since there's not a single byte left to use at his original address, I'll be changing 242600 to 2417B8, providing 936 new bytes to use on top of what he have already (up to 241FFF). 

Then comes the real meat. Changing his sprite assembly pointer at 242300 to my new address with plenty of space (at which point I dunno if the limit is really 64k or doesn't exist).So far, so good. But this is where things gets messy. The doc says his assembly "size" (measuring what?) is 26C0 (9920 decimal). It can't be bytes, because the difference between his and the next assembly is 7328 hex or 29480 decimal. What gives?


Then comes the hardest part, figuring out sprite assembly and animation. Any help here? If I can figure out which parts of sprite assembly and animation points to actual sprite gfx address in the rom, I'm set (because I can create the rest of the content with CCV). But since I'll have to reallocate the gfx AFTER assembling/animating, I need to know which of those lines determine which position in the ROM, and how (it's relative to the sheet size? Since his GFX pack is 31,680kb and immediately followed by another, where 1 ends and another begins is something the game must know).

Any info on both is much appreciated (and if some CT guru is around, any way to do global routines for location events? And about the Random Number command on TF, what's the range of the random number generated so I can actually use it?)

Also, is there some tut on how to insert new gfx in the ROM while choosing a specific offset of my choice? Thx
« Last Edit: September 06, 2013, 04:32:30 pm by metastase »

Vehek

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Re: Chrono Trigger Hacking
« Reply #11 on: September 06, 2013, 09:11:11 pm »
Even if animations are split, it seems like Crono have 255 animation slots for use, some are unused and some are glitched.
He has nowhere near 255 animations. He only has 74 (animations 0x00 through 0x49). Don't mistake the game reading beyond the animation data for a particular direction for there being actual animations there.

Quote
Also, if his size is only based on his assembly, why the 5th byte of his header is for sprite assembly size?
That byte determines how many tiles will make up a single sprite frame.

Quote
Does anybody knows what each of the 24 palette bytes mean (and their order needs to be reversed too in the ROM? if so, reversed only in pairs or totally reversed and inserted backwards, from the last of the 24 bytes up to the 1st?)?
Get a palette-editing tool. For example, SNESPal

Quote
The doc says his assembly "size" (measuring what?) is 26C0 (9920 decimal). It can't be bytes, because the difference between his and the next assembly is 7328 hex or 29480 decimal. What gives?
Pay more attention. Sprite assembly pointers are not sequential. If you follow the offsets and rearrange them by increasing addresses, then the next sprite assembly is index 2, at 1C4E70. 1CE4E70 minus 1C27B0 is 26C0 hex.

Edit:
Repointing animation data is difficult. Each character's animation data is divided into 4 equal sections, one for each of the 4 directions they can face. The game knows where each section starts from the size of that sprite's animation data, which it determines by subtracting the current pointer from the next pointer.
« Last Edit: September 07, 2013, 03:49:34 am by Vehek »

metastase

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Chrono Trigger Hacking
« Reply #12 on: September 08, 2013, 12:17:41 pm »
If he doesn't have 255, then what is this?

http://web.archive.org/web/20080515135529/http://www.chronocompendium.com/Term/Character_Animations.html

I thought maybe he had 255 (or 256) animations, maybe for each direction (255x4?)?

Ok, so basically if my new sprite is roughly the same size as the other PCs, I shouldn't change that 5th byte, right?

I still need to know what those 24 bytes mean in order to change palettes through location events. I've always wondered how the game applied the Berserk effect (red) only to a certain part of the sprites (the skin) or how Safe/Haste/M.def effect were made.

So his spite assembly size is measured in bytes there.

Could you elaborate further on animation data? So you're saying that, although the game can read up to FF animations in any given facing direction, that's not Crono's case and they're all grouped together and are sequential inside the rom? So Crono's total animation are 74 x4 (296) and each animation at any given index is the same, but with 4 variations 4 each direction? What about certain animations exclusive to 1 direction, like Crono's death scene or beer drinking? Where does it fit? How Crono's animation directions are distributed, is there a specific order to it (like down, up, left then right)?

So the game knows what each direction is by dividing his animation data size by 4?

What is your suggestion on how to approach this, then? Let's say I have 1 animation meant to exist only 4 1 specific direction.Replicating that animation data 4 times 4 all directions will do the trick (since I'll never call those animations from any other direction facing)? Or losing all that space isn't needed at all?

justin3009

  • Hero Member
  • *****
  • Posts: 1614
  • Welp
    • View Profile
Re: Chrono Trigger Hacking
« Reply #13 on: September 09, 2013, 04:19:12 am »
Quote
If he doesn't have 255, then what is this?

http://web.archive.org/web/20080515135529/http://www.chronocompendium.com/Term/Character_Animations.html

I thought maybe he had 255 (or 256) animations, maybe for each direction (255x4?)?

I believe that was a list of just generically going through all the animations.  Not every single animation is used.  No character in game has 255 different animations (Pretty certain)

Quote
I still need to know what those 24 bytes mean in order to change palettes through location events. I've always wondered how the game applied the Berserk effect (red) only to a certain part of the sprites (the skin) or how Safe/Haste/M.def effect were made.

That's one of the mysteries.  I don't think we actually figured out what caused the colors (Well, kinda.  If I remember right, it was an annoyingly hard-coded table)
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'