Sonic and Sega Retro Message Board: Chaotix Hacking (formerly Chaotix Level Editing) - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 10 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last ►
    Locked
    Locked Forum

Chaotix Hacking (formerly Chaotix Level Editing) In case you haven't noticed what I'm doing to the SCHG page...

#31 User is offline Andlabs 

Posted 15 February 2010 - 02:53 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
QUOTE (JJ-Fox @ Feb 14 2010, 01:00 AM)
I am also very interested in this research.

Could you, by chance, look into subroutines relating to character sprites and animations? I'd love to be able to implement a fully functioning Tails including hand/ring and tails objects.


This is the only relevant code I could find (changing a memory location corresponding to 4(a0) to set bit 0 made Knuckles disappear), though I'm not 100% sure if this actually does the rendering, since I got confused where the comments stop. I'll still pick at this; but if anyone wants to help me, I'd appreciate.

EDIT: lol I broke IPB with giant asm block, so pastebin

http://slexy.org/view/s201Zw2B98
This post has been edited by Andlabs: 15 February 2010 - 03:07 PM

#32 User is offline Andlabs 

Posted 24 February 2010 - 02:12 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
So I modified JJ-Fox's Chaotix Art Editor to show me all the art in the 32X art pointers list, and I found something interesting:



This art, shown with Mighty's palette, is loaded with the art for the score tally at the end of a level. Most of these seem to be related to the Time Attack feature that some of the early prototypes had, but that never made it into the final. So I wonder...

#33 User is offline Overbound 

Posted 25 February 2010 - 12:51 AM

  • Posts: 593
  • Joined: 09-July 08
  • Gender:Male
  • Location:Iowa
  • Project:Sonic Time Twisted Creator
  • Wiki edits:236
This might be slightly off topic but has anyone ever made a Chaotix hack where you play as only 1 character and lose the whole ring aspect?

#34 User is offline Andlabs 

Posted 25 February 2010 - 12:53 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
QUOTE (Overbound @ Feb 25 2010, 12:51 AM)
This might be slightly off topic but has anyone ever made a Chaotix hack where you play as only 1 character and lose the whole ring aspect?

I know someone's working on it, but that's about it. As for me, I'm really not all that interested in bigshot hacking like that; at least not now, anyway.

#35 User is offline MarkeyJester 

Posted 25 February 2010 - 11:30 AM

  • It's Saturday TV Toons!! (90's Style)
  • Posts: 1854
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
QUOTE (Andlabs @ Feb 24 2010, 07:12 PM)

Interesting stuff, are these uncompressed? (I'm asuming they are, but I've been proved wrong on many occasions that asuming doesn't work =%)

#36 User is offline Lostgame 

Posted 25 February 2010 - 11:34 AM

  • resident geek girl + record label manager
  • Posts: 4017
  • Joined: 02-December 03
  • Gender:Female
  • Location:Toronto, ON
  • Project:The O.I.C.
  • Wiki edits:2
Where's JJFtails when you need him?

#37 User is offline Andlabs 

Posted 25 February 2010 - 11:36 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
QUOTE (MarkeyJester @ Feb 25 2010, 11:30 AM)
Interesting stuff, are these uncompressed? (I'm asuming they are, but I've been proved wrong on many occasions that asuming doesn't work =%)

They're in the same format the character art is in. The pointer list with this stuff starts at ROM address $1CF048.

#38 User is offline Andlabs 

Posted 25 February 2010 - 03:32 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
So I found the code (SH-2 side) that actually draws graphics not stored in the same way as character sprites are... I'll figure it out and post what I can decipher soon.
This post has been edited by Andlabs: 25 February 2010 - 03:32 PM

#39 User is offline Andlabs 

Posted 27 February 2010 - 03:22 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
Okay, so I think I decompressed something compressed in this new format. The problem is that I want a way to make sure what I was doing was right. Is there a way I can load this data up into the 32X framebuffer without writing a new ROM and take a look? Or a software that will let me view the contents of this file? Or will I have to make one myself? Thanks.

#40 User is offline ICEknight 

Posted 27 February 2010 - 11:06 AM

  • Posts: 11005
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
QUOTE (Andlabs @ Feb 24 2010, 02:12 PM)
So I modified JJ-Fox's Chaotix Art Editor to show me all the art in the 32X art pointers list, and I found something interesting:



This art, shown with Mighty's palette, is loaded with the art for the score tally at the end of a level. Most of these seem to be related to the Time Attack feature that some of the early prototypes had, but that never made it into the final. So I wonder...

Ah, so that's the context where that "clock" word came from. Perhaps "Start the clock" was supposed to appear when you finished a level in Amazing Arena without doing so.

#41 User is offline Andlabs 

Posted 28 February 2010 - 01:14 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
Cool. The compression routine decompresses to... the same format used by the characters. The character art is written directly to the same output buffer, exactly to JJF's specification. I'll document this compression format over the next few hours and show you all what's involved.

#42 User is offline MarkeyJester 

Posted 28 February 2010 - 07:42 AM

  • It's Saturday TV Toons!! (90's Style)
  • Posts: 1854
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
First thing's first:

QUOTE
Syntax Highlighted Code: ASM
ROM:00891D2A ; =============== S U B R O U T I N E =======================================
ROM:00891D2A
ROM:00891D2A
ROM:00891D2A DoObjectActions: ; CODE XREF: DoGameMode+1AD4p
ROM:00891D2A ; sub_8B192A+14Ep ...
ROM:00891D2A clr.b ($FFFFFEC3).l
ROM:00891D30 lea ($FFFFE02C).w,a6
ROM:00891D34
ROM:00891D34 loc_891D34: ; CODE XREF: DoObjectActions+2Ej
ROM:00891D34 move.w 0(a6),d0
ROM:00891D38 bne.s loc_891D46
ROM:00891D3A move.b ($FFFFFEC3).l,($FFFFFEC2).l
ROM:00891D44 rts
ROM:00891D46 ; ---------------------------------------------------------------------------
ROM:00891D46
ROM:00891D46 loc_891D46: ; CODE XREF: DoObjectActions+Ej
ROM:00891D46 movea.w d0,a6
ROM:00891D48 moveq #0,d0
ROM:00891D4A move.w 6(a6),d0
ROM:00891D4E lea ObjectActions,a0
ROM:00891D52 adda.w d0,a0
ROM:00891D54 movea.l (a0),a0
ROM:00891D56 jsr (a0)
ROM:00891D58 bra.s loc_891D34
ROM:00891D58 ; End of function DoObjectActions

Snap! (From Crackers)

Syntax Highlighted Code: ASM
; ===========================================================================
; ---------------------------------------------------------------------------
; Subroutine to run object routines during the game
; ---------------------------------------------------------------------------
 
RunObjects:
lea ($FFFFD858).w,a6 ; load ram address of first object to run??
 
RO_NextObj:
move.w $00(a6),d0 ; load ram address of next object to d0
bne.s RO_ValidObj ; if not null, an object is in the slot, so branch
rts ; return
 
RO_ValidObj:
movea.w d0,a6 ; move ram address to a6
moveq #$00,d0 ; clear d0
move.w $06(a6),d0 ; load object's ID
jsr RO_Routines(pc,d0.w) ; jump to the correct object routine
bra.s RO_NextObj ; loop
 
; ===========================================================================

Also about that compression format, would it be possible to see the format algorithm routines? because I'm just wondering if...

Syntax Highlighted Code: ASM
; ===========================================================================
; ---------------------------------------------------------------------------
; Crackers Decompression Algorithm
; ---------------------------------------------------------------------------
 
CracDec:
movem.l d1-d7/a2,-(sp)
move.w (a0)+,d7
move.w d7,d2
andi.w #$3FFF,d7
eor.w d7,d2
rol.w #2,d2
moveq #4,d1
sub.w d2,d1
moveq #1,d2
lsl.w d1,d2
subq.w #1,d2
 
loc_8856:
move.b (a0)+,d5
moveq #7,d6
 
loc_885A:
add.b d5,d5
bcs.w loc_8870
move.b (a0)+,(a1)+
dbf d6,loc_885A
dbf d7,loc_8856
movem.l (sp)+,d1-d7/a2
rts
 
loc_8870:
moveq #0,d3
move.b (a0)+,d3
move.w d3,d4
lsr.w d1,d3
and.w d2,d4
neg.w d3
lea -1(a1,d3.w),a2
addq.w #1,d4
 
loc_8882:
move.b (a2)+,(a1)+
dbf d4,loc_8882
dbf d6,loc_885A
dbf d7,loc_8856
movem.l (sp)+,d1-d7/a2
rts
 
; ===========================================================================


#43 User is offline ICEknight 

Posted 28 February 2010 - 10:31 AM

  • Posts: 11005
  • Joined: 11-January 03
  • Gender:Male
  • Location:Spain
  • Wiki edits:18
Once you figure out these compression algorithms, please release something we can use to quickly check other games for this kind of data, like Nemesis did with that nemsrch.exe utility.

We might be able to find compressed graphics in games we hadn't thought of, or even within the leftovers in any prototypes.

#44 User is offline Andlabs 

Posted 28 February 2010 - 07:17 PM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061
CODE
THE BIT CYCLING ALGORITHM
=========================
The art compression revolves around a bit cycling algorithm that I don't understand:

    bitcycle(numbits):
        output = 0
        while numbits != 0 do
            if maxbits == 0 then
                maxbits = 8
                datum = next byte in file << 24
            counter = numbits
            if numbits > maxbits then
                counter = maxbits
            numbits = numbits - counter
            until counter == 0 do
                shift datum left, saving topmost bit in carry
                rotate (carry bit, output) left
                maxbits = maxbits - 1
                counter = counter - 1



HEADER FORMAT
=============
OFFSET    SIZE    NAME    DESCRIPTION
0    Word        Number of bytes in output data
2    Byte        Always 0x42 to identify input data as compressed
3    Byte        base x coordinate (x0)
4    Byte    r5    number of bits to cycle for x coordinates
5    Byte        base y coordinate (y0)
6    Byte    r7    number of bits to cycle for y coordinates
7    Byte        base color value (c0)
8    Byte    r9    number of bits to cycle for color value

I will use the name as a mnemonic throughout this specification. The name is the SH-2 register the value is assigned to in the original code.

The final x1 value is
    x1 = x0 + bitcycle(r5)
The final y1 value is
    y1 = (y0 + bitcycle(r6)) << 8

So the program beings with

    write word x0
    write word x1
    write word (y0 << 8)
    write word y1



DATA
====
Now begins each line:

    x0_line = bitcycle(r5) + x0
    x1_line = bitcycle(r5) + x0

If x1_line == x0_line then the art is fully decompressed. Otherwise processing continues:

    write byte x0_line
    write byte x1_line
    n_pixels_per_line = x1_line - x0_line
    y_line = (bitcycle(r7) + y0) << 8
    write word y_line
    until n_pixels_per_line == 0 do
        pixel_color_value = bitcycle(r9) + c0
        if pixel_color_value == 0 then
            pixel_color_value = fallback_pixel_color
        write byte pixel_color_value
        n_pixels_per_line = n_pixels_per_line - 1

The fallback pixel color is either 0x80 or another color determined at runtime by the drawing routine. After the loop terminates, we go back to the x0_line/x1_line calculations; we have finished processing this line.


I don't understand the bitcycle() routine, but there you have it. Here's the original SH-2 code:

CODE
ROM:0600075A
ROM:0600075A; =============== S U B R O U T I N E =======================================
ROM:0600075A
ROM:0600075A; r1 - input data
ROM:0600075A; r2 - output buffer
ROM:0600075A
ROM:0600075A DrawArt32X:                        ; CODE XREF: PossiblyDoTheDrawing+22p
ROM:0600075A                                    ; ROM:06000C0Ap
ROM:0600075A                 mov.b   @(2,r1), r0
ROM:0600075C                 cmp/eq  #h'42, r0; 'B'
ROM:0600075E                 bf      DrawUncompressedArt
ROM:06000760                 mov.l   r14, @-r15    ; Draws compressed art
ROM:06000762                 mov.l   r13, @-r15
ROM:06000764                 mov.l   r12, @-r15
ROM:06000766                 mov.l   r11, @-r15
ROM:06000768                 mov.l   r10, @-r15
ROM:0600076A                 mov.l   r9, @-r15
ROM:0600076C                 mov.l   r8, @-r15
ROM:0600076E                 mov.l   r7, @-r15
ROM:06000770                 mov.l   r6, @-r15
ROM:06000772                 mov.l   r5, @-r15
ROM:06000774                 mov.l   r4, @-r15
ROM:06000776                 mov.l   r2, @-r15
ROM:06000778                 mov.l   r1, @-r15
ROM:0600077A                 sts.l   pr, @-r15
ROM:0600077C                 mov.w   @r1+, r0
ROM:0600077E                 add     #1, r1
ROM:06000780                 extu.w  r0, r0
ROM:06000782                 mov.l   r0, @-r15
ROM:06000784                 mov.b   @r1+, r4
ROM:06000786                 mov.b   @r1+, r5
ROM:06000788                 mov.b   @r1+, r6
ROM:0600078A                 mov.b   @r1+, r7
ROM:0600078C                 mov.b   @r1+, r8
ROM:0600078E                 mov.b   @r1+, r9
ROM:06000790                 mov     #0, r14
ROM:06000792                 mov.w   r4, @r2
ROM:06000794                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:06000796                 mov     r5, r12
ROM:06000798                 add     r4, r0
ROM:0600079A                 mov.w   r0, @(2,r2)
ROM:0600079C                 add     #4, r2
ROM:0600079E                 mov     r6, r0
ROM:060007A0                 shll8   r0
ROM:060007A2                 mov.w   r0, @r2
ROM:060007A4                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:060007A6                 mov     r7, r12
ROM:060007A8                 add     r6, r0
ROM:060007AA                 shll8   r0
ROM:060007AC                 mov.w   r0, @(2,r2)
ROM:060007AE                 bra     loc_60007D6
ROM:060007B0                 add     #4, r2
ROM:060007B2; ---------------------------------------------------------------------------
ROM:060007B2
ROM:060007B2 loc_60007B2:                          ; CODE XREF: DrawArt32X+8Ej
ROM:060007B2                 sub     r10, r0
ROM:060007B4                 mov     r0, r10
ROM:060007B6                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:060007B8                 mov     r7, r12
ROM:060007BA                 add     r6, r0
ROM:060007BC                 shll8   r0
ROM:060007BE                 mov.w   r0, @(2,r2)
ROM:060007C0                 add     #4, r2
ROM:060007C2
ROM:060007C2 loc_60007C2:                          ; CODE XREF: DrawArt32X+78j
ROM:060007C2                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:060007C4                 mov     r9, r12
ROM:060007C6                 add     r8, r0
ROM:060007C8                 tst     r0, r0
ROM:060007CA                 bt/s    loc_60007D0
ROM:060007CC                 dt      r10
ROM:060007CE                 add     r3, r0
ROM:060007D0
ROM:060007D0 loc_60007D0:                          ; CODE XREF: DrawArt32X+70j
ROM:060007D0                 mov.b   r0, @r2
ROM:060007D2                 bf/s    loc_60007C2
ROM:060007D4                 add     #1, r2
ROM:060007D6
ROM:060007D6 loc_60007D6:                          ; CODE XREF: DrawArt32X+54j
ROM:060007D6                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:060007D8                 mov     r5, r12
ROM:060007DA                 add     r4, r0
ROM:060007DC                 mov.b   r0, @r2
ROM:060007DE                 mov     r0, r10
ROM:060007E0                 bsr     BitCycleForCompressedArt; r12 - number of bits to cycle
ROM:060007E2                 mov     r5, r12
ROM:060007E4                 add     r4, r0
ROM:060007E6                 cmp/eq  r10, r0
ROM:060007E8                 bf/s    loc_60007B2
ROM:060007EA                 mov.b   r0, @(1,r2)
ROM:060007EC                 mov     #0, r0
ROM:060007EE                 mov.w   r0, @r2
ROM:060007F0                 mov.l   @r15+, r0
ROM:060007F2                 lds.l   @r15+, pr
ROM:060007F4                 mov.l   @r15+, r1
ROM:060007F6                 mov.l   @r15+, r2
ROM:060007F8                 mov.l   @r15+, r4
ROM:060007FA                 mov.l   @r15+, r5
ROM:060007FC                 mov.l   @r15+, r6
ROM:060007FE                 mov.l   @r15+, r7
ROM:06000800                 mov.l   @r15+, r8
ROM:06000802                 mov.l   @r15+, r9
ROM:06000804                 mov.l   @r15+, r10
ROM:06000806                 mov.l   @r15+, r11
ROM:06000808                 mov.l   @r15+, r12
ROM:0600080A                 mov.l   @r15+, r13
ROM:0600080C                 rts
ROM:0600080E                 mov.l   @r15+, r14
ROM:06000810; ---------------------------------------------------------------------------
ROM:06000810
ROM:06000810 DrawUncompressedArt:                  ; CODE XREF: DrawArt32X+4j
ROM:06000810                                    ; ROM:06000AA8j ...
ROM:06000810                 mov.l   r4, @-r15
ROM:06000812                 mov.l   r2, @-r15
ROM:06000814                 mov.l   r1, @-r15
ROM:06000816                 mov     #4, r4
ROM:06000818
ROM:06000818 loc_6000818:                          ; CODE XREF: DrawArt32X+C4j
ROM:06000818                 mov.w   @r1+, r0
ROM:0600081A                 dt      r4
ROM:0600081C                 mov.w   r0, @r2
ROM:0600081E                 bf/s    loc_6000818
ROM:06000820                 add     #2, r2
ROM:06000822                 bt      loc_600083C
ROM:06000824
ROM:06000824 loc_6000824:                          ; CODE XREF: DrawArt32X+ECj
ROM:06000824                 sub     r4, r0
ROM:06000826                 mov.w   @r1+, r4
ROM:06000828                 mov.w   r4, @r2
ROM:0600082A                 add     #2, r2
ROM:0600082C
ROM:0600082C loc_600082C:                          ; CODE XREF: DrawArt32X+DEj
ROM:0600082C                 mov.b   @r1+, r4
ROM:0600082E                 tst     r4, r4
ROM:06000830                 bt/s    loc_6000836
ROM:06000832                 dt      r0
ROM:06000834                 add     r3, r4
ROM:06000836
ROM:06000836 loc_6000836:                          ; CODE XREF: DrawArt32X+D6j
ROM:06000836                 mov.b   r4, @r2
ROM:06000838                 bf/s    loc_600082C
ROM:0600083A                 add     #1, r2
ROM:0600083C
ROM:0600083C loc_600083C:                          ; CODE XREF: DrawArt32X+C8j
ROM:0600083C                 mov.b   @r1+, r4
ROM:0600083E                 mov.b   @r1+, r0
ROM:06000840                 mov.b   r4, @r2
ROM:06000842                 mov.b   r0, @(1,r2)
ROM:06000844                 cmp/eq  r4, r0
ROM:06000846                 bf/s    loc_6000824
ROM:06000848                 add     #2, r2
ROM:0600084A                 mov     r2, r0
ROM:0600084C                 mov.l   @r15+, r1
ROM:0600084E                 mov.l   @r15+, r2
ROM:06000850                 mov.l   @r15+, r4
ROM:06000852                 rts
ROM:06000854                 sub     r2, r0
ROM:06000854; End of function DrawArt32X
ROM:06000854
ROM:06000856
ROM:06000856; =============== S U B R O U T I N E =======================================
ROM:06000856
ROM:06000856; r12 - number of bits to cycle
ROM:06000856
ROM:06000856 BitCycleForCompressedArt:             ; CODE XREF: DrawArt32X+3Ap
ROM:06000856                                    ; DrawArt32X+4Ap ...
ROM:06000856                 mov     #0, r0
ROM:06000858                 cmp/pl  r12
ROM:0600085A                 bf      loc_6000880
ROM:0600085C
ROM:0600085C loc_600085C:                          ; CODE XREF: BitCycleForCompressedArt+28j
ROM:0600085C                 tst     r14, r14
ROM:0600085E                 bf      loc_6000868
ROM:06000860                 mov.b   @r1+, r13
ROM:06000862                 mov     #8, r14
ROM:06000864                 shll16  r13
ROM:06000866                 shll8   r13
ROM:06000868
ROM:06000868 loc_6000868:                          ; CODE XREF: BitCycleForCompressedArt+8j
ROM:06000868                 cmp/hi  r14, r12
ROM:0600086A                 bf/s    loc_6000870
ROM:0600086C                 mov     r12, r11
ROM:0600086E                 mov     r14, r11
ROM:06000870
ROM:06000870 loc_6000870:                          ; CODE XREF: BitCycleForCompressedArt+14j
ROM:06000870                 sub     r11, r12
ROM:06000872
ROM:06000872 loc_6000872:                          ; CODE XREF: BitCycleForCompressedArt+22j
ROM:06000872                 shll    r13
ROM:06000874                 rotcl   r0
ROM:06000876                 dt      r11
ROM:06000878                 bf/s    loc_6000872
ROM:0600087A                 add     #-1, r14
ROM:0600087C                 tst     r12, r12
ROM:0600087E                 bf      loc_600085C
ROM:06000880
ROM:06000880 loc_6000880:                          ; CODE XREF: BitCycleForCompressedArt+4j
ROM:06000880                 rts
ROM:06000882                 nop
ROM:06000882; End of function BitCycleForCompressedArt
ROM:06000882

This post has been edited by Andlabs: 28 February 2010 - 07:18 PM

#45 User is offline Andlabs 

Posted 02 March 2010 - 12:20 AM

  • 「いっきまーす」
  • Posts: 2175
  • Joined: 11-July 08
  • Gender:Male
  • Project:Writing my own MD/Genesis sound driver :D
  • Wiki edits:7,061

Heran Bago told me over AIM that modifying the object table gives you a monitor with this, and I have seen two chunks of unidentified code that modifies OST values in the monitor code, meaning that the initialization for whatever this monitor did is still intact, but the actual code isn't. The palette shown hers is arbitrary; I'll add a way to select palettes and show uncompressed art and release a viewer tomorrow or Wednesday.
This post has been edited by Andlabs: 02 March 2010 - 12:23 AM

  • 10 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last ►
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users