Improper handling of corrupt .cht files

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
-_pentium5.1_-
Lurker
Posts: 110
Joined: Sat Sep 04, 2004 7:55 pm
Location: USA

Improper handling of corrupt .cht files

Post by -_pentium5.1_- »

I discovered that my previous "Yoshi's Cookie causes unexpected exit" problem was actually caused by a zero-length .cht file. I have no idea how the .cht file became zero-length in the first place (probably corruption by another emulator, maybe Super Sleuth). Deleting the config files appeared to fix the problem only because it reset the "Auto-load .cht file on game startup" preference to off.

Steps to reproduce given a ROM file NameOfGame.smc:
1. Use a hex editor to create a zero-length file named NameOfGame.cht in the location where cheat files are supposed to be.
2. Load NameOfGame.smc in ZSNES. If the preference for .cht auto-loading is on, then ZSNES will unexpectedly exit with no error message. If not...
3. Open the cheat dialog and click Load. ZSNES will unexpectedly exit with no error message.

I noticed this bug in the 05/27 WIP. I still need to check the latest SVN.

I will come back in a few hours to make this a proper bug report. Please do not complain about this post or lock the thread yet.
This signature intentionally contains no text other than this sentence.
byuu

Post by byuu »

Speaking of which, my emu outputs .cht files as well, but mine are stored in plaintext format. I'm wondering if I should change my file extension for the sake of oldschool binary-format cht files :/
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

-_pentium5.1_- wrote: I will come back in a few hours to make this a proper bug report. Please do not complain about this post or lock the thread yet.
Don't worry about it, we are moving cheats to a PSR system soon so this will no longer be a problem.
byuu

Post by byuu »

You are? Can we agree on a simple format for the .cht files, then?

Right now I'm using :

Code: Select all

+c92a-cfed, "Infinite energy (3)"
+cb69-cd57, "Infinite lives (3)"
+c9a7-c757, "Almost infinite ninja power (3)"
+c9bb-441f, "Infinite energy (2)"
+c96f-1fc7, "Infinite time (2)"
+dfc4-1f47, "Throwing stars use no energy (2)"
-8896ea08, "Start with 1 life (2)"
But I'm totally fine with changing things around a little. Having a compatible format between all emulators would definitely be a good thing.

We could change to something like :

Code: Select all

c92a-cfed: on, "Infinite Energy"

Code: Select all

c92a-cfed, on, "Infinite Energy"
Or whatever. And obviously it'd be best to put no formatting limits on the description. Just handle that when loading the cht files into the emulators, truncating in the display and not in the file itself.

Or if you still want to use that mirroring thing you have for whatever reason, maybe something like :

Code: Select all

7e2000: on, mirror:7e4000
But, open to negotiations at this point, obviously.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

You will have to talk to Nach about it, it is his baby.
-_pentium5.1_-
Lurker
Posts: 110
Joined: Sat Sep 04, 2004 7:55 pm
Location: USA

Post by -_pentium5.1_- »

Okay, here's the update I promised: The problem still occurs in the SVN that I compiled this morning with the aid of ZGet. NSRT info is as follows (any ROM is potentially affected):

Code: Select all

NSRT v3.3 - Nach's SNES ROM Tools

---------------------Internal ROM Info----------------------
       File: Super Mario World (US).smc
       Name: SUPER MARIOWORLD       Company: Nintendo
     Header: Exists (type?)            Bank: LoROM
Interleaved: No                        SRAM: 16 Kb
       Type: Normal + Batt              ROM: 4 Mb
    Country: USA                      Video: NTSC
  ROM Speed: 200ns (SlowROM)       Revision: 1.0
   Checksum: Good 0xA0DA              CRC32: B19ED489
        MD5: CDD3C8C37322978CA8669B34BC89C804
--------------------------Database--------------------------
   Name: Super Mario World
Country: USA                    Revision: 1.0
 Port 1: Gamepad                  Port 2: Gamepad
Genre 1: Platform                Genre 2: Side Scrolling

NSRT v3.3 - Nach's SNES ROM Tools

---------------------Internal ROM Info----------------------
       File: Yoshi's Cookie (US).smc
       Name: YOSHI'S COOKIE         Company: Bullet-Proof Software
     Header: SWC                       Bank: LoROM
Interleaved: No                        SRAM: 0 Kb
       Type: Normal                     ROM: 4 Mb
    Country: USA                      Video: NTSC
  ROM Speed: 200ns (SlowROM)       Revision: 1.0
   Checksum: Good 0x92FE              CRC32: EF15F4C3
        MD5: B08D6DC455CBED53799C7495EA71B08C
--------------------------Database--------------------------
   Name: Yoshi's Cookie
Country: USA                    Revision: 1.0
 Port 1: Gamepad                  Port 2: Gamepad
Genre 1: Puzzle                  Genre 2: Matching
An user-interface consideration: What kind of error message should be displayed if the .cht file is corrupt? Make sure that the message is handled correctly with auto-loading.
Another consideration: Currently, ZSNES only seems to allow capital letters for the cheat descriptions. (Look at a ZSNES-created cheat file in Snes9x and you'll see what I mean.) I know the GUI can't display lowercase, but I believe that ZSNES should remember in the .cht file the case of each letter entered by the user.
This signature intentionally contains no text other than this sentence.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Thanks i'll see about fixing the zero-length problem. Since our GUI only currently has fonts for uppercase characters I think they will continue to be saved in upper-case. We have no control over what other emulators save to our format.
-_pentium5.1_-
Lurker
Posts: 110
Joined: Sat Sep 04, 2004 7:55 pm
Location: USA

Post by -_pentium5.1_- »

Okay, sorry for the poorly thought-out request.
This signature intentionally contains no text other than this sentence.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

pagefault wrote:Since our GUI only currently has fonts for uppercase characters I think they will continue to be saved in upper-case. We have no control over what other emulators save to our format.
So all input is internally immediately converted to upper case? You might want to do that step only in the font drawing routines, eventually.

Otherwise, another thing to check for would be that the CHT loader converts the descriptions to upper case. It probably does that already though.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Post Reply