Savestate format and Lunar too

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

Post Reply
tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Savestate format and Lunar too

Post by tomaitheous » Wed Feb 09, 2011 4:46 am

I'm working on RE'ing and ripping assets from Lunar CD game. Currently, the only emulator with any sort of debug features I can use is GEN GS. Kmod gens locks up after the initial WD logo. Anyway, I was looking at the save state file and it has the GST tag at the beginning. Anyone have information for the CD part of this format? I found an old site with the layout, but it only covered carts.

Also, Is Lunar (US version) and Kmod gens a known issue? Are there any other debugger options available for SegaCD work?

I'm currently working on decoding the overworld map. I've located the map and figured out the format. It's a two layer interleaved metatile format. Paired bytes per entry. One byte for the scroll A and one byte for scroll B, but the bytes are an index into a set of 2x2 metatile system (16x16 pixels). Without a proper debugger, it's a pain trying to track down where in ram the metatile table is located. Actually, two tables - one for each layer. As of now, I'm brute forcing it (modifying the map, reloading the save state, trying to identify the tiles on screen to the vram tile dump, etc).

Any suggestions/help is much appreciated. :)

-Tom

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Feb 09, 2011 8:19 am

Use the perfect sync option to make this game working in Gens. I guess Gens GS enabled it by default (not Gens).

tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Post by tomaitheous » Wed Feb 09, 2011 8:40 am

Hey Stef,

I enabled it, but it didn't change anything.

Edit: If I press start and a bunch of other buttons while the intro is loading, I can get it to skip to the title screen and enter the game. But once it enters the game and after the dialog text, glitches from there (can't control the main character). This is in Kmod Gens only.

TascoDLX
Very interested
Posts: 262
Joined: Tue Feb 06, 2007 8:18 pm

Re: Savestate format and Lunar too

Post by TascoDLX » Wed Feb 09, 2011 9:09 am

If the CD audio tracks are not loaded, it won't work. Shouldn't be any problem if all the files are named correctly, though.
tomaitheous wrote:Anyway, I was looking at the save state file and it has the GST tag at the beginning. Anyone have information for the CD part of this format?
For Fusion? I have this:

Code: Select all

0x22478: SUBCPU REGS
0x224F2: MAINCPU GATE ARRAY
0x226F2: SUBCPU GATE ARRAY
0x228F2: PRG-RAM
0xA28F2: WORDRAM
0xE28F2: PCM-RAM
0xF28F2: CD BUFFER
Hope that helps. :wink:

tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Re: Savestate format and Lunar too

Post by tomaitheous » Wed Feb 09, 2011 6:29 pm

TascoDLX wrote:If the CD audio tracks are not loaded, it won't work. Shouldn't be any problem if all the files are named correctly, though.
Thank you. That was the problem. I had the file names correct (and no other files in the directory), but that didn't seem to work. Kmod doesn't support CUE loading. I just downloaded forceaspi and boot from a virtual drive. Now the game works.
tomaitheous wrote:Anyway, I was looking at the save state file and it has the GST tag at the beginning. Anyone have information for the CD part of this format?
For Fusion? I have this:

Code: Select all

0x22478: SUBCPU REGS
0x224F2: MAINCPU GATE ARRAY
0x226F2: SUBCPU GATE ARRAY
0x228F2: PRG-RAM
0xA28F2: WORDRAM
0xE28F2: PCM-RAM
0xF28F2: CD BUFFER
Hope that helps. :wink:
Not fusion. Gens (different builds of it). Is it the same GST format for Fusion?

Btw - I found a few other version of Gens over at RHDN. Gonna try those out as well. If I can't get a decent break on read/write of an address and cpu stepping, maybe a logger will help. Brute force altering , load, saving, reading is pretty slow method. Plus, I'd like to see what compression scheme was used for this game (not needed, but for my own personal entertainment. To decode it without stepping through the 68k code. And just to document it). I thought I had located a compressed stream of the overworld map in ram, but I couldn't find that chunk of data anywhere in the ISO files. Unless there's an endian issue from the ISO file to CD RAM, but I didn't think that would be so.


Edit: Looks like Gens 2.12a R2 tracer might just do the job :D

TascoDLX
Very interested
Posts: 262
Joined: Tue Feb 06, 2007 8:18 pm

Re: Savestate format and Lunar too

Post by TascoDLX » Thu Feb 10, 2011 3:14 am

tomaitheous wrote:Not fusion. Gens (different builds of it). Is it the same GST format for Fusion?
Not quite.

For Gens Tracer (and probably others):

Code: Select all

0x25550: SUBCPU REGS
0x25950: GATE ARRAY (COMM...)
0x26550: PRG-RAM (BYTESWAPPED)
0xA6550: WORDRAM (BYTESWAPPED)
0xE6550: PCM-RAM
The byteswap is a bit of a nuisance, but you could easily modify it to store the other way around. Not to say that compiling Gens is a walk in the park, but....

Post Reply