Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Schala Zeal

Pages: [1] 2 3 ... 12
1
Chrono Cross Modification / LZSS decompression... am I doing it right?
« on: September 21, 2017, 07:18:56 pm »
So I recently got into a programming language called Rust which is a systems language that's supposed to strongly prevent any possibility of memory leaks, data races, etc. Out of just randomness, I followed the wiki explanation of Chrono Cross's LZSS algorithm, and used the '2540.out' file from the CD to test this on.

I compared it to decompression via Purple Cat Tools and the decompressed files don't match. The decompressed file mine outputs is 4765 bytes  as opposed to PCT's 2160 bytes, where the decompressed size info in the file header says 2048. The contents of my file are mostly null (0 value) bytes with some data here and there while PCT outputs a file filled with data.

I noticed PCT also bitswaps in 512-byte chunks (512 * 8 = 4096, so I'm guessing the data following header is the initial buffer content?), which wasn't mentioned on the wiki, so I did the same, with... not much luck. Below is the entire code for the decode function + the test. It should be similar to C/C++.

Code: [Select]
extern crate bitstream_io;
extern crate bit_reverse;

use bitstream_io::{BitReader,LE};
use bit_reverse::ParallelReverse;
use std::io::Cursor;

pub const BUFFER_SIZE: usize = 4096;
pub const LIT_SIZE: u32 = 8;
pub const PTR_SIZE: u32 = 12;
pub const VAL_SIZE: usize = 4;
pub const VAL_ADD: isize = 2;

pub fn decode(data: &[u8]) -> Vec<u8> {
let mut ic = Cursor::new(&data);
let mut br = BitReader::<LE>::new(&mut ic);

let mut header: [u8; 4] = [0; 4];
let _ = br.read_bytes(&mut header);
assert_eq!(&header, b"sszl");

let dsize = br.read::<u32>(32).unwrap_or(0) as usize;
assert!(dsize != 0);

let unknown = br.read::<u32>(32).unwrap_or(0);

        // bitswap every byte past the header
let mut rdata = vec![0u8; data.len()-12];
rdata.copy_from_slice(&data[12..]);
for i in rdata.iter_mut() {
*i = i.swap_bits();
}
let mut ic = Cursor::new(&rdata);
let mut br = BitReader::<LE>::new(&mut ic);

let mut outbuf = vec![0u8; dsize];
let mut buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE];
let mut idx: usize = 0;
while let Ok(is_val) = br.read_bit() { // TL;DR: while not end of the data
if is_val == true {
buf[idx % BUFFER_SIZE] = br.read::<u8>(LIT_SIZE).unwrap();
idx += 1;
} else {
if let Ok(offs) = br.read::<u16>(PTR_SIZE) { // compiler tends to choke without the if-let guard on this part
if let Ok(size) = br.read::<u8>(VAL_SIZE as u32) {
let sz = (size as isize) + VAL_ADD;
for i in 0..sz {
outbuf.push(buf[(offs as usize)+(i as usize)]);
}
}
}
}
}

outbuf
}

#[test]
fn dec_test() {
use std::fs::File;
use std::io::prelude::*;

let test_data = include_bytes!("2540.out");
let mut f = File::create("test.dat").unwrap();
let ucmp = decode(&test_data[..]);
f.write_all(&ucmp).unwrap();
}

3
General Discussion / Any Blender experts here?
« on: February 18, 2017, 11:19:14 pm »
I'm having some problems with a freshly imported model from Steam.

4
So, the other day the Twitch streamer Vinesauce introduced 'Kronos Trigger.' Apparently, one of his fans took the English version of the rom, ran it through several different language translations, then back to English. The result is an absolute gem! IPS patch attached

https://www.youtube.com/watch?v=GT56EERg8q0


5
Fan Art / Went all out for mother's 57th this year
« on: July 06, 2016, 11:39:57 pm »
Not sure how I would model Halation, so I just used a glossy torus with rainbow blur texture.

https://youtu.be/Sw9R77URzkk

6
Kajar Laboratories / Squaresoft MDL format Assimp extension
« on: June 25, 2016, 01:48:55 am »
Well lately I've been working hard on what I dub the Kajar Engine, which is a reimplementation of the Chrono Cross game engine similar to how there's open 3rd party engines of Doom, Morrowind, etc. It occurred to me while I was writing to code for parsing the model files that perhaps I could make a subproject: an extension for Assimp that gives it the ability to load these models. Assimp is a C/C++ code library that can import/export a couple dozen 3D model formats (FBX, OBJ, Blender, etc etc) that I was delighted to find out has an API for writing additional format loaders.

I'm currently using both the Chrono Cross MDL wiki page and MDL Blender import Python script as a reference, along with learning how to extend Assimp by studying its Valve model import code. I might do the .MESH file format as well. That looks simpler.

7
Chrono Compendium Discussion / Cleaning up spam
« on: June 19, 2016, 05:48:39 pm »
I've seen a huge rise in spambots on the forum, and seeing as hardly anyone's around, I was hoping, given my almost decade-long residency here, to apply for mod position? I have a big OCD about cleaning up spam. I used to do it on wikis all the the time

8
Chrono Cross Modification / Chrono Cross engine reimplementation?
« on: June 18, 2016, 12:11:32 pm »
So I've been noting the various "open source engine implementations" for various retro games like Doom, Quake, ES3, etc and it made me consider that the Chrono Cross game discs essentially have the script, dialogue, model, texture etc data in readable formats. Of course, there remains various bits and pieces of unknown data, particularly in the ATIM texture format and 4 bytes of the LZSS compression format.

My C++ skills have vastly improved these past months, and so after studing the OpenMW source code, I'm eager to put it to the test and perhaps learn more in the process, particularly in the area of OpenGL or perhaps the new Vulkan API.

From what I've gathered, I think so far these libraries/dependencies will help:

- SDL 2: For video, audio management
- OpenSceneGraph: For its higher level OpenGL components
- Boost: Endianness management, cyclic buffers, dynamic bitset, etc

If successful, this engine may allow for modding the game in a way similar to Bethesda games or Doom. Perhaps a Radical Dreamers mod using CC data? Of course, a copy of Chrono Cross will be required on the end user's part. This is, after all, just an engine that makes use of it.

9
General Discussion / Legality of game engine rewrites?
« on: June 17, 2016, 09:19:31 pm »
I've been playing ES3: Morrowind for a bit via OpenMW, an open source reimplementation of the Morrowind game engine. It requires a copy of the purchased game itself, and uses the retail data to reconstruct the game. I'm confused about legality because you need to still buy the game itself, and it's otherwise nothing Bethesda worked on.

Given that emulators and engine reimplementations don't provide any IP material, I was thinking perhaps instead of a remake of CC or something, glance at the resources and what not and try to code an engine that reuses the files of a retail CC copy, possibly with or without some graphic enhancements, but definitely with things like mods or something, so you needn't even touch the original game files.

10
General Discussion / Chrono Trigger spiritual successor
« on: June 01, 2015, 03:59:20 pm »
With the sudden rise in spiritual successors (Yooka-Laylee, Mighty No. 9, Bloodstained, Axiom Verge, etc) I think it would be the perfect opportunity to make a spiritual successor to Chrono. I've been burying myself deep in Unreal Engine 4, and I think I know enough about the Blueprint system and their Paper2D mode to try and make this happen. However, I don't believe I can do spriting that well, so I'm looking for assistance in that area.

I remember seeing a Chrono remix on YouTube playing over 2.5D gameplay footage (HD sprites and a 3D environment) which I thought looked pretty sweet. I was hoping to model the environments in 3D, with high def 2D sprites just like that. I don't want to divulge story or characters because they're still being thought up and I don't want my idea stolen. Cross platform will be attempted, but as far as Mac goes, I need a Mac to build for that platform or iOS, so I need someone trustworthy with said computer in that regard when the time comes. Android, too, is a possibility but I'm not fond of touch controls, so I'd need testers telling me what's up.

TL;DR:

- HD 2D sprites in 3D environments
- Original battle system that borrows concepts from other games
- Powered by Unreal Engine 4
- Available for Windows and Linux
- Possible Mac, iOS, and Android ports in the future
- Original story inspired by tried and true JRPGs of ages past. It will involve time travel and, like Crimson Echoes, show the after effects of altering history.
- 7 different eras with their own themes
- Possible DLC that adds to this

11
Kajar Laboratories / "Yoko Ono Trigger" game corruption
« on: April 23, 2015, 08:49:57 pm »
Was able to come across a copy of the "Yoko Ono Trigger" corruption rom hack. To avoid a C&D, I've made a patch file for an unheadered CT rom.

A few things to note about this corruption/hack:
- I advise you to see the title screen intro and opening first of all. Some very hilarious stuff happens!
- If you have epilepsy or seizures brought on by flashing colours, DO NOT play this rom
- Mind your volume, because there's frequently an ear piercing tone you'll want to turn the volume down a bit on. Although, do still keep the volume on because there are parts where it adds to the hilarity (ie. game cycling through battle sound effects while credits roll)
- Avoid battles! Enemies have massive (infinite?) health, and their first hit will knock you down to 1 HP, with subsequent attacks doing no damage at all, forever.
- If dialogue gets distorted beyond the ability to advance it, fast forward.
- Likely to crash when transitioning maps if using a battery save of original game to move forward (was the case for me, but got some hilarity)

Footage: https://www.youtube.com/watch?v=pzAvVxY7R6E

12
Chrono / Gameplay Casual Discussion / Chrono corruptions (big lolz)
« on: April 13, 2015, 02:16:36 am »
Vinesauce is a major entertainment when it comes to f*ing up games

today's stream: https://www.youtube.com/watch?v=pzAvVxY7R6E
my highlights vid of a past stream: https://www.youtube.com/watch?v=yizW7o_iAGk

13
Kajar Laboratories / Trying to implement a TIM image plugin for Qt 5
« on: April 12, 2015, 05:19:43 am »
Qt 5 is a modular C++ framework I find very useful. It has an API for plugin development to extend its capabilities in the areas of image format handling, GUI skins, etc.

I've been spending about a week developing a Qt 5 image handling plugin that allows it to read PlayStation TIM images (with write support being considered but not yet implemented). There's not a lot of open source TIM reader/writer programs out there so I thought, with a Qt TIM handling plugin, any program made with Qt that makes use of the image API only needs to drop in the TIM plugin DLL/dylib/so to have such capabilities.

The plugin code itself is nearly done, but there's a major problem I'm facing. I'm using Serge's Chrono Cross menu portrait's TIM file to test the plugin by having it converted to a PNG file. It spits out a readable image, but something is very wrong with the pixels. Every 2 lines is another 2 lines of what seems to be garbage:



Code: [Select]
#define SCALE5TO8(c) (((c) << 3) | ((c) >> 2))
#define SCALE8TO5(c) (((c) & 0xf8) >> 3)

static inline quint32 rgba5551ToArgb32(quint16 c)
{
quint32 r = SCALE5TO8(c & 0x1f);
quint32 g = SCALE5TO8((c >> 5) & 0x1f);
quint32 b = SCALE5TO8((c >> 10) & 0x1f);
quint32 a = ~SCALE5TO8((c >> 15) & 0x1f);

return ((a << 24) | (r << 16) | (g << 8) | b);
}

bool QTimHandler::read(QImage *img)
{
QDataStream ds(device());
ds.setByteOrder(QDataStream::LittleEndian);
quint32 magic, flags;

ds >> magic >> flags;

if (ds.status() != QDataStream::Ok || magic != 0x10)
return false;
bool hasClut = flags & 0x8 ? true : false;
quint8 pxlMode = flags & 0x7;

quint8 bpp;
switch (pxlMode)
{
case 0: bpp = 4; break;
case 1: bpp = 8; break;
case 2: bpp = 16; break;
case 3: bpp = 24; break;
default: bpp = 4;
}

QVector<QRgb> clut;
if (hasClut)
{
quint16 colors, npals;
ds.skipRawData(8);
ds >> colors >> npals;

for (quint16 i = 0; i < (colors*npals); i++)
{
quint16 c;
ds >> c;
clut.append(rgba5551ToArgb32(c));
}
}

ds.skipRawData(8);
quint16 w, h;
ds >> w >> h;

switch (bpp)
{
case 4: w /= 4; break;
case 8: w /= 2; break;
default: ;
}

QImage result;
m_size = QSize(w, h);

switch (bpp)
{
case 4:
case 8:
result = QImage(w, h, QImage::Format_Indexed8);
result.setColorTable(clut);
break;
default:
result = QImage(w, h, QImage::Format_ARGB32);
}

for (quint16 y = 0; y < h; y++)
{
for (quint16 x = 0; x < w; x++)
{
switch (bpp)
{
case 4:
{
quint8 p;
ds >> p;
result.setPixel(x, y, p & 0xf0);
result.setPixel(x++, y, p & 0xf);
}
break;
case 8:
{
quint8 p;
ds >> p;
result.setPixel(x, y, p);
}
break;
case 16:
{
quint16 p;
ds >> p;
result.setPixel(x, y, rgba5551ToArgb32(p));
}
break;
}
}
}

*img = result;
return ds.status() == QDataStream::Ok;
}

14
Kajar Laboratories / Important things have surfaced, please read
« on: January 06, 2015, 06:27:36 am »
Hello everyone, PSZ here.

Over the last few days, I've come across an important opportunity I hope to pursue vigorously regarding future projects. I cannot go into detail about it out of respect for the privacy of those it concerns. No one is in trouble, don't worry. I would like to get in touch with FaustWolf, Zeality, or somebody regarding this, ASAP. What I have to discuss with them is a matter of enormous significance.

Pages: [1] 2 3 ... 12