News:

11 March 2016 - Forum Rules

Main Menu

WonderSwan Color FF4 Debug Menu

Started by Everything, December 27, 2021, 11:07:15 PM

Previous topic - Next topic

Everything

I found a debug menu in the WonderSwan Color version of FF4. I think it's pretty interesting, so I'm sharing what I found in case anyone else wants to play around with it. I'm not sure if anyone has looked into this before. It's mentioned on this tcrf page, but only because some of the text was copied over into the GBA version. From what I can tell, the code for this menu was not included in the GBA version.

You can access the debug menu by applying this IPS Patch to a WonderSwan Color FF4 ROM (CRC: 0xF699D6D1). After applying the patch, you can open the debug menu by suspending your game (choose ちゅうだん and then はい in the main menu). Most of the menu text is in Japanese, so it might be difficult to navigate. Here are the top menu options translated to English (please correct me if I translated something incorrectly). Note that a few of the options will wipe your SRAM and/or cause the game to lock up.


  • マップ (Map): press left or right to select a map (the initial choice デバッグ is a debug room which can also be found in the GBA version), press A to go to the map's default entrance, or press B to choose specific coordinates
  • エフェクト (Effect): I think this was used to test battle animations, but it doesn't seem to work
  • バトル (Battle): test any battle, but the game will crash if you win
  • ショップ (Shop): opens any shop, but the game will crash when you exit
  • てきひょうじ (Enemy Display): display enemy graphics
  • キャラクタひょうじ (Character Display): display map character graphics
  • イベント (Event): jump to various stages of the game
  • サウンド (Sound): play any sound effect or song
  • フラグ (Flag): change game flags
  • さいかい (Resume): resume suspended game (doesn't work)
  • スイッチ (Switch): seems to let you enable some built-in cheat codes, not sure if they work
  • ステータス (Status): view and edit character status, including a "class change" option
  • SRAMはかい (Delete SRAM): self-explanatory

Debug Menu:


Character Display:


Flag Edit:


Character Status:

Gedankenschild

Very interesting! Thanks for this contribution (that I completely missed till now).
Would have been helpful to have back when I was ripping all the enemies from this version...
Do you have an idea what kind of compression they used for the graphics that can't be easily seen with tile editors?
And do you plan on including the WSC version in FF6Tools?

Everything

I started adding some basic support for this version to FF6Tools a while back, but it's not available in the live version. I figured the demand for it would be pretty low so I didn't sink too much time into it.

Here is a disassembled decompression routine from the WSC ROM. It uses both LZSS and RLE. It's definitely used for some graphics but I'm not sure if it's the only compression format in the game.

; [ decompress ]

; 00-7F: uncompressed string
; 80-FE: compressed string (next byte is lzss offset)
;    FF: end of compressed data

2000:3A50  56                push si
2000:3A51  8BF7              mov si,di
2000:3A53  1E                push ds
2000:3A54  06                push es
2000:3A55  1F                pop ds
2000:3A56  07                pop es
2000:3A57  8BFA              mov di,dx
2000:3A59  33ED              xor bp,bp
2000:3A5B  B500              mov ch,0x0
; start of decompression loop
2000:3A5D  AC                lodsb
2000:3A5E  A8FF              test al,0xff
2000:3A60  750C              jnz 0x3a6e
; end of compressed data
2000:3A62  33C0              xor ax,ax
2000:3A64  8ED8              mov ds,ax
2000:3A66  8BCD              mov cx,bp
2000:3A68  5E                pop si
2000:3A69  33C0              xor ax,ax
2000:3A6B  8ED8              mov ds,ax
2000:3A6D  CB                retf
2000:3A6E  32E4              xor ah,ah
2000:3A70  A880              test al,0x80
2000:3A72  7515              jnz 0x3a89                   ; branch if compressed
; uncompressed (first byte is run length)
2000:3A74  03E8              add bp,ax
2000:3A76  8BC8              mov cx,ax
2000:3A78  D1F9              sar cx,1
2000:3A7A  7409              jz 0x3a85
2000:3A7C  7205              jc 0x3a83
2000:3A7E  F3A5              rep movsw                    ; even run length
2000:3A80  E9DAFF            jmp 0x3a5d
2000:3A83  F3A5              rep movsw                    ; odd run length
2000:3A85  A4                movsb
2000:3A86  E9D4FF            jmp 0x3a5d
; compressed
2000:3A89  257F00            and ax,0x7f                  ; add 3 to get run length
2000:3A8C  050300            add ax,0x3
2000:3A8F  8BC8              mov cx,ax
2000:3A91  03E8              add bp,ax                    ; add to destination offset
2000:3A93  AC                lodsb                        ; get lzss offset
2000:3A94  8BDF              mov bx,di
2000:3A96  2BD8              sub bx,ax
2000:3A98  4B                dec bx
2000:3A99  0BC0              or ax,ax
2000:3A9B  7420              jz 0x3abd
; lzss
2000:3A9D  D1F9              sar cx,1
2000:3A9F  720C              jc 0x3aad
2000:3AA1  268B07            mov ax,[es:bx]               ; even run length
2000:3AA4  83C302            add bx,byte +0x2
2000:3AA7  AB                stosw
2000:3AA8  E2F7              loop 0x3aa1
2000:3AAA  E9B0FF            jmp 0x3a5d
2000:3AAD  268B07            mov ax,[es:bx]               ; odd run length
2000:3AB0  83C302            add bx,byte +0x2
2000:3AB3  AB                stosw
2000:3AB4  E2F7              loop 0x3aad
2000:3AB6  268A07            mov al,[es:bx]
2000:3AB9  AA                stosb
2000:3ABA  E9A0FF            jmp 0x3a5d
; rle (copy previous byte if lzss offset is zero)
2000:3ABD  268A07            mov al,[es:bx]
2000:3AC0  43                inc bx
2000:3AC1  AA                stosb
2000:3AC2  E2F9              loop 0x3abd
2000:3AC4  E996FF            jmp 0x3a5d

Gedankenschild

That does make sense, it's not exactly the most popular edition of the game, I guess. So certainly not a priority.

Though it's kind of funny they bothered with compressing certain parts of the game's graphics while being so wasteful with others. Anyone who's ever looked at the ROM just needs to think of the EvilWall tileset...