+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Shinseiki Odysselya 2 compression help.
Pages: [1]
Author Topic: Shinseiki Odysselya 2 compression help.  (Read 663 times)
DaMarsMan
Guest
« on: December 26, 2006, 12:21:35 am »

I have a complete table for Shinseiki Odysselya 2 now and I can't seem to figure out the games script compression. I don't really know what it's doing. Here is a trace. If anyone knows about this game let me know.

The game decompresses to 7F:0400 in this example.

Code:
$80/C5EE E2 20       SEP #$20                A:0000 X:0154 Y:0004 P:envmxdiZc
$80/C5F0 8B          PHB                     A:0000 X:0154 Y:0004 P:envMxdiZc
$80/C5F1 A5 84       LDA $84    [$00:1D84]   A:0000 X:0154 Y:0004 P:envMxdiZc
$80/C5F3 48          PHA                     A:00AD X:0154 Y:0004 P:eNvMxdizc
$80/C5F4 AB          PLB                     A:00AD X:0154 Y:0004 P:eNvMxdizc
$80/C5F5 C2 30       REP #$30                A:00AD X:0154 Y:0004 P:eNvMxdizc
$80/C5F7 A9 00 00    LDA #$0000              A:00AD X:0154 Y:0004 P:eNvmxdizc
$80/C5FA A2 DE 0F    LDX #$0FDE              A:0000 X:0154 Y:0004 P:envmxdiZc
$80/C5FD 9F 00 F0 7F STA $7FF000,x[$7F:FFDE] A:0000 X:0FDE Y:0004 P:envmxdizc
$80/C601 E8          INX                     A:0000 X:0FDE Y:0004 P:envmxdizc
$80/C602 E8          INX                     A:0000 X:0FDF Y:0004 P:envmxdizc
$80/C603 E0 00 10    CPX #$1000              A:0000 X:0FE0 Y:0004 P:envmxdizc
$80/C606 D0 F5       BNE $F5    [$C5FD]      A:0000 X:0FE0 Y:0004 P:eNvmxdizc
$80/C608 A0 04 00    LDY #$0004              A:0000 X:1000 Y:0004 P:envmxdiZC
$80/C60B B1 82       LDA ($82),y[$AD:F1D7]   A:0000 X:1000 Y:0004 P:envmxdizC
$80/C60D 85 88       STA $88    [$00:1D88]   A:1511 X:1000 Y:0004 P:envmxdizC
$80/C60F C8          INY                     A:1511 X:1000 Y:0004 P:envmxdizC
$80/C610 C8          INY                     A:1511 X:1000 Y:0005 P:envmxdizC
$80/C611 A9 01 00    LDA #$0001              A:1511 X:1000 Y:0006 P:envmxdizC
$80/C614 85 8A       STA $8A    [$00:1D8A]   A:0001 X:1000 Y:0006 P:envmxdizC
$80/C616 64 8C       STZ $8C    [$00:1D8C]   A:0001 X:1000 Y:0006 P:envmxdizC
$80/C618 A2 00 00    LDX #$0000              A:0001 X:1000 Y:0006 P:envmxdizC
$80/C61B A5 88       LDA $88    [$00:1D88]   A:0001 X:0000 Y:0006 P:envmxdiZC
$80/C61D D0 02       BNE $02    [$C621]      A:1511 X:0000 Y:0006 P:envmxdizC
$80/C621 A5 8A       LDA $8A    [$00:1D8A]   A:1511 X:0000 Y:0006 P:envmxdizC
$80/C623 3A          DEC A                   A:0001 X:0000 Y:0006 P:envmxdizC
$80/C624 D0 0B       BNE $0B    [$C631]      A:0000 X:0000 Y:0006 P:envmxdiZC
$80/C626 B1 82       LDA ($82),y[$AD:F1D9]   A:0000 X:0000 Y:0006 P:envmxdiZC
$80/C628 C8          INY                     A:37BF X:0000 Y:0006 P:envmxdizC
$80/C629 29 FF 00    AND #$00FF              A:37BF X:0000 Y:0007 P:envmxdizC
$80/C62C 09 00 01    ORA #$0100              A:00BF X:0000 Y:0007 P:envmxdizC
$80/C62F 85 8A       STA $8A    [$00:1D8A]   A:01BF X:0000 Y:0007 P:envmxdizC
$80/C631 46 8A       LSR $8A    [$00:1D8A]   A:01BF X:0000 Y:0007 P:envmxdizC
$80/C633 90 1E       BCC $1E    [$C653]      A:01BF X:0000 Y:0007 P:envmxdizC
$80/C635 E2 20       SEP #$20                A:01BF X:0000 Y:0007 P:envmxdizC
$80/C637 B1 82       LDA ($82),y[$AD:F1DA]   A:01BF X:0000 Y:0007 P:envMxdizC
$80/C639 5A          PHY                     A:0137 X:0000 Y:0007 P:envMxdizC
$80/C63A A4 8C       LDY $8C    [$00:1D8C]   A:0137 X:0000 Y:0007 P:envMxdizC
$80/C63C 97 85       STA [$85],y[$7F:0400]   A:0137 X:0000 Y:0000 P:envMxdiZC
$80/C63E C8          INY                     A:0137 X:0000 Y:0000 P:envMxdiZC
$80/C63F 84 8C       STY $8C    [$00:1D8C]   A:0137 X:0000 Y:0001 P:envMxdizC
$80/C641 7A          PLY                     A:0137 X:0000 Y:0001 P:envMxdizC
$80/C642 9F 00 F0 7F STA $7FF000,x[$7F:F000] A:0137 X:0000 Y:0007 P:envMxdizC
$80/C646 C2 20       REP #$20                A:0137 X:0000 Y:0007 P:envMxdizC
$80/C648 8A          TXA                     A:0137 X:0000 Y:0007 P:envmxdizC
$80/C649 1A          INC A                   A:0000 X:0000 Y:0007 P:envmxdiZC
$80/C64A 29 FF 0F    AND #$0FFF              A:0001 X:0000 Y:0007 P:envmxdizC
$80/C64D AA          TAX                     A:0001 X:0000 Y:0007 P:envmxdizC
$80/C64E C6 88       DEC $88    [$00:1D88]   A:0001 X:0001 Y:0007 P:envmxdizC
$80/C650 C8          INY                     A:0001 X:0001 Y:0007 P:envmxdizC
$80/C651 80 C8       BRA $C8    [$C61B]      A:0001 X:0001 Y:0008 P:envmxdizC
$80/C653 B1 82       LDA ($82),y[$AD:F1E0]   A:0005 X:0006 Y:000D P:envmxdizc
$80/C655 29 FF 0F    AND #$0FFF              A:1002 X:0006 Y:000D P:envmxdizc
$80/C658 85 8E       STA $8E    [$00:1D8E]   A:0002 X:0006 Y:000D P:envmxdizc
$80/C65A B1 82       LDA ($82),y[$AD:F1E0]   A:0002 X:0006 Y:000D P:envmxdizc
$80/C65C EB          XBA                     A:1002 X:0006 Y:000D P:envmxdizc
$80/C65D 4A          LSR A                   A:0210 X:0006 Y:000D P:envmxdizc
$80/C65E 4A          LSR A                   A:0108 X:0006 Y:000D P:envmxdizc
$80/C65F 4A          LSR A                   A:0084 X:0006 Y:000D P:envmxdizc
$80/C660 29 1E 00    AND #$001E              A:0042 X:0006 Y:000D P:envmxdizc
$80/C663 18          CLC                     A:0002 X:0006 Y:000D P:envmxdizc
$80/C664 69 03 00    ADC #$0003              A:0002 X:0006 Y:000D P:envmxdizc
$80/C667 85 90       STA $90    [$00:1D90]   A:0005 X:0006 Y:000D P:envmxdizc
$80/C669 5A          PHY                     A:0005 X:0006 Y:000D P:envmxdizc
$80/C66A A4 8C       LDY $8C    [$00:1D8C]   A:0005 X:0006 Y:000D P:envmxdizc
$80/C66C E2 20       SEP #$20                A:0005 X:0006 Y:0006 P:envmxdizc
$80/C66E DA          PHX                     A:0005 X:0006 Y:0006 P:envMxdizc
$80/C66F A6 8E       LDX $8E    [$00:1D8E]   A:0005 X:0006 Y:0006 P:envMxdizc
$80/C671 BF 00 F0 7F LDA $7FF000,x[$7F:F002] A:0005 X:0002 Y:0006 P:envMxdizc
$80/C675 FA          PLX                     A:0001 X:0002 Y:0006 P:envMxdizc
$80/C676 9F 00 F0 7F STA $7FF000,x[$7F:F006] A:0001 X:0006 Y:0006 P:envMxdizc
$80/C67A 97 85       STA [$85],y[$7F:0406]   A:0001 X:0006 Y:0006 P:envMxdizc
$80/C67C C8          INY                     A:0001 X:0006 Y:0006 P:envMxdizc
$80/C67D C2 20       REP #$20                A:0001 X:0006 Y:0007 P:envMxdizc
$80/C67F 8A          TXA                     A:0001 X:0006 Y:0007 P:envmxdizc
$80/C680 1A          INC A                   A:0006 X:0006 Y:0007 P:envmxdizc
$80/C681 29 FF 0F    AND #$0FFF              A:0007 X:0006 Y:0007 P:envmxdizc
$80/C684 AA          TAX                     A:0007 X:0006 Y:0007 P:envmxdizc
$80/C685 A5 8E       LDA $8E    [$00:1D8E]   A:0007 X:0007 Y:0007 P:envmxdizc
$80/C687 1A          INC A                   A:0002 X:0007 Y:0007 P:envmxdizc
$80/C688 29 FF 0F    AND #$0FFF              A:0003 X:0007 Y:0007 P:envmxdizc
$80/C68B 85 8E       STA $8E    [$00:1D8E]   A:0003 X:0007 Y:0007 P:envmxdizc
$80/C68D C6 88       DEC $88    [$00:1D88]   A:0003 X:0007 Y:0007 P:envmxdizc
$80/C68F C6 90       DEC $90    [$00:1D90]   A:0003 X:0007 Y:0007 P:envmxdizc
$80/C691 D0 D9       BNE $D9    [$C66C]      A:0003 X:0007 Y:0007 P:envmxdizc
$80/C693 84 8C       STY $8C    [$00:1D8C]   A:0007 X:000B Y:000B P:envmxdiZc
$80/C695 7A          PLY                     A:0007 X:000B Y:000B P:envmxdiZc
$80/C696 C8          INY                     A:0007 X:000B Y:000D P:envmxdizc
$80/C697 C8          INY                     A:0007 X:000B Y:000E P:envmxdizc
$80/C698 82 80 FF    BRL $FF80  [$C61B]      A:0007 X:000B Y:000F P:envmxdizc
$80/C61F AB          PLB                     A:0000 X:0511 Y:07B2 P:envmxdiZC
$80/C620 6B          RTL                     A:0000 X:0511 Y:07B2 P:eNvmxdizC

Edit: Here is the compressed and uncompressed data. The first couple bytes of the compressed on the left are for size and stuff. Where you see E4 is where it starts with the uncompressed.




Edit 2: This is starting to look like RLE.

Edit 3: Nevermind...I'm an idiot. It's LZSS, and I see what it's doing now.
« Last Edit: December 26, 2006, 11:13:56 am by DaMarsMan »
Ryusui
Guest
« Reply #1 on: December 26, 2006, 01:24:33 am »

Where does it load from?

Could you provide an example of compressed data vs. uncompressed output?

*whips out his chainsaw*
DaMarsMan
Guest
« Reply #2 on: December 27, 2006, 01:34:44 am »

Ok got all the blocks dumped. All 47 of them. Now how to figure out how these crazy pointers are working so I can get a clean script dump.
Ryusui
Guest
« Reply #3 on: December 27, 2006, 03:16:08 am »

I love LZ compression. It's freakin' classic. Every game I've encountered compression in uses some flavor of LZ.

The best part is - and this is something I originally didn't get - you get RLE as part of the package. A sequence of distance 1 and arbitrary length is as good as an RLE instruction to repeat X number of bytes.
Kojiro
Guest
« Reply #4 on: December 29, 2006, 10:47:30 pm »

comment to edit 3, your not an idiot... noone always notices everything right away and no one is perfect, your very skilled, no reason to throw such a negative opinion towards yourself. You've probably gotten farther than I could already by myself in this amount of time with any game  Tongue
Nightcrawler
Guest
« Reply #5 on: December 31, 2006, 04:42:06 pm »

Ok, so is this resolved now? I've worked on Shinseiki Odysselya 2 in some detail before. I'm happy to see it's being actively worked on again by someone. I would offer some assistance if necessary.
DaMarsMan
Guest
« Reply #6 on: January 01, 2007, 11:34:46 pm »

Yeah I figured out how the text is stored inside the blocks so I'm coding a custom script dumper. I think I'm going to do a workaround for loading the text in. Load the english text straight from the rom instead from within the compressed blocks.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC