Chrono Compendium

Kajar Laboratories - Fan Works and Submissions => Chrono Cross Modification => Topic started by: FaustWolf on July 02, 2016, 02:21:04 pm

Title: Chrono Cross Toolsets
Post by: FaustWolf on July 02, 2016, 02:21:04 pm
way back in the day were the "R/Y Dumper" made by Yazoo and recompiled by Ramsus, and the Terminus Traductions suite. I have long since forgotten how these work exactly, and there are probably more advanced tools nowadays. But without further ado...


Everyone, please feel free to list your own tools or tools you know of here. I'll pop back in from time to time to add those to the first post.[/list]
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 03, 2016, 12:48:53 pm
Purple Cat Tools, the Perl-based dumper-builder I wrote some years ago. I've attached two versions.

0.3 was the last real release. There is reasonably complete documentation in the README file.

0.4_ALPHA contains most of what was supposed to be the next version.

Title: Re: Chrono Cross Toolsets
Post by: Schala Zeal on July 03, 2016, 03:11:28 pm
I am currently working on an Assimp (http://www.assimp.org/) plugin for MDL/MESH file support. It's coming along pretty good. I'll have a preliminary version soon enough. Blender CC import addon's code gives me a good reference since I know both Python and C++
Title: Re: Chrono Cross Toolsets
Post by: ZeaLitY on July 06, 2016, 04:06:52 am
I added this note to the Chrono Cross page: "Magil has compilers and decompilers for fieldscript and battlescript, a de-~LZSS-er, a de-~DRP-er, and a texture remapper (remaps 2-textured battle models to use a single texture, for improved Doppelgang compatibility), all (I think) in C# .Net. Unfortunately, due to proxy- and cheap-~BB-software-related problems, I can't determine the download ~URLs. "

Would a fieldscript decompiler be what's needed to examine the developer's ending rooms and figure out if that Kid outfit change legend is total nonsense?
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 06, 2016, 05:17:44 am
I added this note to the Chrono Cross page: "Magil has compilers and decompilers for fieldscript and battlescript, a de-~LZSS-er, a de-~DRP-er, and a texture remapper (remaps 2-textured battle models to use a single texture, for improved Doppelgang compatibility), all (I think) in C# .Net. Unfortunately, due to proxy- and cheap-~BB-software-related problems, I can't determine the download ~URLs. "

Would a fieldscript decompiler be what's needed to examine the developer's ending rooms and figure out if that Kid outfit change legend is total nonsense?


http://chronofan.com/Black/Other/utunnels_utils.zip

The tools mentioned above are already in this package, so you can delete that paragraph from the wiki.

The fieldscript decompiler was created by Yazoo's, and the decompiled scripts are in "CC Script Decompiler (by yaz0r).RAR".

As for Kid outfit change legend, I think people already checked the resource files of that room? If there's an alternate outfit, we should be able to find its textures. Can't find the topic about this legend though.
Title: Re: Chrono Cross Toolsets
Post by: ZeaLitY on July 06, 2016, 04:06:55 pm
Ah, cool; I'll remove that paragraph. I'm going to update the site today.

I can't believe I didn't move it to the Great To-Do List...it's this topic: https://www.chronocompendium.com/Forums/index.php?topic=4187.0

I completely forget about that screenshot in the first post, though. So maybe there is some merit to this legend.
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 06, 2016, 06:16:06 pm
My guess is that it's just a legend, invented by some kid wanting to make himself look important, but if anyone wants to follow up, I can provide the extracted and broken down room files from CD2. Kid is an NPC in these rooms, I believe, so her texture(s) would be stored inside the relevant room blob.
Title: Re: Chrono Cross Toolsets
Post by: ZeaLitY on July 06, 2016, 06:30:17 pm
Let's go ahead and do it, if you have time to extract them. This stupid thing is what has me concerned: https://www.chronocompendium.com/images/wiki/7/7d/Kidinorphanclothes.jpg
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 06, 2016, 08:11:14 pm
It isn't a problem--I just type a command and wait a few seconds. Question: in the interest of keeping the attachment size down, does anyone know whether this is the first or second room, or whether the screen capture is of the left, right, or center? Or do I need to dump all of 1718-1747 inclusive?
Title: Re: Chrono Cross Toolsets
Post by: Vehek on July 07, 2016, 12:33:42 am
Quote
I can't believe I didn't move it to the Great To-Do List
It was already (https://www.chronocompendium.com/Forums/index.php?topic=8088.0) in the Do-To List as a topic. So which one should we use?

Quote
Or do I need to dump all of 1718-1747 inclusive?
Just the last one (far right of second area).
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 07, 2016, 08:08:02 am
Okay, here we go. First attachment contains everything from the relevant room broken down as far as I can break it (some of the file extensions are missing--sorry about that). Second attachment is the three raw room files, in case someone wants to play with them in that format or it turns out my de-lzss'er screwed up.
Title: Re: Chrono Cross Toolsets
Post by: ZeaLitY on July 07, 2016, 09:10:08 pm
Looks like the only Kid-NPC texture loaded is the orphanage outfit. Schala's white gown from the Time Devourer is nowhere to be found. Am I correct in saying that her normal thief outfit would be loaded independently of the room (since it's a PC texture)?

In any event, I think the absence of Schala's gown nails it. Per that old FAQ, equipping the Spectra Swallow apparently changes her to the orphanage outfit, but after that...nothing. Per that FAQ, after the Schala outfit, a combination of songs will make her pickpocket a non-item "Key", but given that there's no text string for this in the script, nor is there likely to be any actual event code for this, I think the "mystery" is put to rest. I wonder if there's any merit to this, though:

Quote
...In all likelihood, the psychedelic effects on the [Spectra Swallow] probably messed with her shadow shader and caused it to bug out.

It'd be nice of course to have some kind of TF-esque view of all the event code, haha, but the absence of the Schala gown is pretty damning.
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 07, 2016, 09:45:10 pm
It's been a while, but if I recall correctly, her regular outfit's texture would be stored with the room data too if it were used in that room, even though it would duplicate her data as a PC elsewhere on the disc. My guess is that the original development team thought loading speed was more important than storage space, and/or wanted a uniform interface for NPC handling, which they couldn't get if they had to sometimes bail out to fetch models and textures from the PC storage sections.

I think the absence of any other Kid-suitable texture is probably as close to proof that this legend is bogus  as we're going to get, unless someone wants to work through the fieldscript. I don't know if the disc 2 scripts were included in the ones yaz0r decompiled or not.
Title: Re: Chrono Cross Toolsets
Post by: Schala Zeal on July 09, 2016, 12:00:43 am
Well Zeality, I've decompiled Temporal Flux to figure how its code works. I know C# so maybe I can take a look at that as well.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 15, 2016, 04:33:07 pm
...
  • Known problems: the README was only partly updated, filebuilder.pl was never actually written, relzss.pl never worked properly (it's okay for short files, IIRC, but I screwed up on "what you do when you hit the end of the buffer"), some scripts don't work properly on Windows even though they're okay on Linux. I have a set of corrections someone on Triple-Tech gave me that I never got around to incorporating.

One of the reasons this: the Windows version of Python in the output file adds extra bytes "0D" before each byte "0A"
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 15, 2016, 11:34:55 pm
Speaking of relzss, can the 4 bytes of unknown data be removed?

Quote from: https://www.chronocompendium.com/Term/Lzss.html
4. LZSS File Header

Chrono Cross presents LZSS files with a twelve-byte header, which can be divided into 4-byte sections.

The first four bytes are always 73 73 7A 6C—"sszl".

The next four bytes are the expected length in bytes of the decoded file, presented as a little-endian value. Experimentation suggests that this number may not be 100% accurate.

The purpose of the next four bytes is currently unknown.
Title: Re: Chrono Cross Toolsets
Post by: Schala Zeal on July 16, 2016, 03:51:06 am
I think the unknown 4 bytes may be a CRC32 sum
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 16, 2016, 04:04:54 am
It doesn't match any checksum or crc generated by hexworkshop.
But if so it is a good thing because none of the known mods have encountered a problem, means the game ignores the number.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 16, 2016, 05:08:55 am
It doesn't match any checksum or crc generated by hexworkshop.
But if so it is a good thing because none of the known mods have encountered a problem, means the game ignores the number.
About lzss. For example this file after delzss - relzss stops working
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 16, 2016, 05:58:12 am
About lzss. For example this file after delzss - relzss stops working
What if you add the original 4 bytes back?
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 16, 2016, 06:45:49 am
What if you add the original 4 bytes back?
The header of both files are the same, but the new file is 4 bytes longer than the original.
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 16, 2016, 07:29:20 am
Well if the length is changed, the cpt file and the cd need to be rebuild. A simple ppf may not work. Perhaps it is not just this file, when you edit a script, you can't grant it is smaller than original.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 16, 2016, 09:01:03 am
Well if the length is changed, the cpt file and the cd need to be rebuild. A simple ppf may not work. Perhaps it is not just this file, when you edit a script, you can't grant it is smaller than original.
I'm doing a full rebild iso, then prolblem in something else.
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 16, 2016, 10:16:27 am
That is strange. What relzss tool did you use?
Terminus Traduction should have their version. Mine were based on some generic lzss code found on internet.
Title: Re: Chrono Cross Toolsets
Post by: Danetta on July 16, 2016, 10:29:20 am
I saw tons of lzss variants and still have no idea how engine can unpack different lzss files even if they contain the same files inside. Sometimes it works, sometimes no, but seems to be okay with excuses for terrible design, lol.
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 16, 2016, 10:43:29 am
...
  • Known problems: the README was only partly updated, filebuilder.pl was never actually written, relzss.pl never worked properly (it's okay for short files, IIRC, but I screwed up on "what you do when you hit the end of the buffer"), some scripts don't work properly on Windows even though they're okay on Linux. I have a set of corrections someone on Triple-Tech gave me that I never got around to incorporating.

One of the reasons this: the Windows version of Python in the output file adds extra bytes "0D" before each byte "0A"

The problem here isn't the difference in line endings between *NIX and Windows (Perl redefines the bytewise representation of "\n", the end-of-line marker, according to the system it's running on)--it's file mode. Perl under Windows differentiates between opening files in "text mode" and opening them in "binary mode". Because I was working in Linux, I neglected to invoke the binmode (http://perldoc.perl.org/functions/binmode.html) command at any point.
Title: Re: Chrono Cross Toolsets
Post by: alfadorredux on July 16, 2016, 10:52:10 am
That is strange. What relzss tool did you use?
Terminus Traduction should have their version. Mine were based on some generic lzss code found on internet.

If he's using the one in Purple Cat Tools, it's likely to result in larger-than-original files even if the source file was small enough not to invoke the broken part of the script. I think it had to do with the script failing to backtrack into parts of the buffer that hadn't been written to yet. The resulting compression is still valid, it's just that it outputs literals rather than buffer pointers in that one particular case, making for a slightly bigger file.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 16, 2016, 11:01:56 am
That is strange. What relzss tool did you use?
Terminus Traduction should have their version. Mine were based on some generic lzss code found on internet.
Mostly I'll use your utility lzss and 95% of the cases it works without problems, although after repacking the files are noticeably different. A few files I failed to Repack any of the listed programs
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 16, 2016, 10:39:22 pm
The header of both files are the same, but the new file is 4 bytes longer than the original.

You can test this if you like, which one of them works (if any)?

z1.sszl - result after I changed the compress code slightly
z12.sszl  - remove last 4 bytes from z1.sszl
z13.sszl - remove last 4 bytes from old result
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 17, 2016, 05:51:50 pm

You can test this if you like, which one of them works (if any)?

z1.sszl - result after I changed the compress code slightly
z12.sszl  - remove last 4 bytes from z1.sszl
z13.sszl - remove last 4 bytes from old result


z1.sszl - work
z12.sszl  - work
z13.sszl - not work
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 17, 2016, 09:26:44 pm
OK, so it is not the size that matters.

This is the modified lzss tool (it has a cygwin dll because on current pc I don't have other compilers installed).
Title: Re: Chrono Cross Toolsets
Post by: prizvel on July 18, 2016, 05:08:48 pm
OK, so it is not the size that matters.

This is the modified lzss tool (it has a cygwin dll because on current pc I don't have other compilers installed).

This tool works perfect. Thank you.
Title: Re: Chrono Cross Toolsets
Post by: Schala Zeal on July 19, 2016, 03:23:14 am
What are the changes you made?
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 19, 2016, 03:50:53 am
Some unnecessary check for ring buffer length while searching the longest matching pattern.


while(l<LZSS_CHAINE && pos+l<LZSS_BUFFER && p%LZSS_BUFFER<LZSS_BUFFER-2
&& buffer[(p+l)%LZSS_BUFFER]==buffer[(pos+l)%LZSS_BUFFER]) {
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 31, 2016, 11:45:32 pm
Just wrote a tool that imports tim files into vram so you can use a vram viewer (http://www.romhacking.net/utilities/442/) to check their positions.

This was originally designed to construct battle field textures, but in theory it can be used for any tim files.

How?
Select all tim files and drag-drop them on the exe. The output file is vram.bin
Title: Re: Chrono Cross Toolsets
Post by: utunnels on July 31, 2016, 11:48:22 pm
Similar tool but imports egfx file int vram. Useful when finding element textures (for example, starky's mecha)
Title: Re: Chrono Cross Toolsets
Post by: prizvel on September 26, 2016, 04:31:08 am
utunnels If you have time, could you make a tool to pack/unpack drp? Your unpackdrp good, but it ignores unreadable characters. It would be nice if the name of the decompressed file looked like this: "01.000a.7A697A31.zip1" where:
01 - the number of the file
000a - file type
7A697A31 - file name byte(7A 69 7A 31 - for packing with the same name)
zip1 - file name

I'd love to do it myself, but I don't know any programming language :oops:
Title: Re: Chrono Cross Toolsets
Post by: utunnels on September 26, 2016, 05:37:03 am
I'll see what I can do when I get home.
Maybe files and list.txt is a better solution, if not all characters can be used to name a file.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on September 26, 2016, 05:53:51 am
I'll see what I can do when I get home.
Maybe files and list.txt is a better solution, if not all characters can be used to name a file.

Maybe. I recently came across a file named "1" (31 00 00 00)
Title: Re: Chrono Cross Toolsets
Post by: utunnels on September 26, 2016, 05:55:42 am
But "1" is legal file name.
Title: Re: Chrono Cross Toolsets
Post by: utunnels on September 26, 2016, 06:31:44 am
https://drive.google.com/open?id=0B5GvuiubpnUZYi1DMUk2R0pNZkk

By the way, I had a unpackcpt.exe and a cpt.exe in this folder, which I used to test the weapon pack (.weap files).

Usage:
Drag and drop the .weap (or maybe other cpt file) on unpackcpt.exe to unpack it.

Drag and drop all output files onto cpt.exe to repack it (the file will be save to outut.cpt).

Note, on windows, it seems the file order is determined by the first file you dragged, so it is safe to select the first one of all files.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on September 26, 2016, 06:47:13 am
https://drive.google.com/open?id=0B5GvuiubpnUZYi1DMUk2R0pNZkk

By the way, I had a unpackcpt.exe and a cpt.exe in this folder, which I used to test the weapon pack (.weap files).

Usage:
Drag and drop the .weap (or maybe other cpt file) on unpackcpt.exe to unpack it.

Drag and drop all output files onto cpt.exe to repack it (the file will be save to outut.cpt).

Note, on windows, it seems the file order is determined by the first file you dragged, so it is safe to select the first one of all files.

Oh, thank you, I'm tired of counting everything in the hex editor
Title: Re: Chrono Cross Toolsets
Post by: utunnels on September 26, 2016, 11:28:03 am
drp.exe has been added.
Usage is the same as cpt.exe
Title: Re: Chrono Cross Toolsets
Post by: prizvel on September 26, 2016, 12:28:29 pm
drp.exe has been added.
Usage is the same as cpt.exe

How to unpack? unpackdrp is not required?
Title: Re: Chrono Cross Toolsets
Post by: utunnels on September 26, 2016, 12:39:46 pm
It is needed.
Title: Re: Chrono Cross Toolsets
Post by: prizvel on September 26, 2016, 12:43:47 pm
I see, thank you very much. I'm trying to add animation in the room, but the animations in the DRP file. Later I will tell about the test result
Title: Re: Chrono Cross Toolsets
Post by: Heyds on January 31, 2022, 10:50:31 am
is there any tools to replace the original music? I want to replace the original music with the "cross symphonic" by John Paul Hayward