Categories

New firmware feature: user config file

Little file, big difference

Little file, big difference


While doing some minor tweaking on the firmware, I almost accidentally came up with a nice and straightforward way of turning the Retrode to some extent user-configurable. The root directory now contains a plain text file named snega2usb.cfg retrode.cfg, something like the following:

[retrodeConfig]
; Remove first line for factory reset.
; Hex keycodes for (in this order) B Y SEL STA UP DN LFT RGT A X L R
; See usb.org/developers/devclass_docs/Hut1_11.pdf (pp.53ff)
[gamepad1] 06 1B 28 2C 52 51 50 4F 09 07 04 16
[gamepad2] 10 11 05 19 33 37 36 38 0E 0D 0A 0B
[filenameChksum] 1       ; checksum in filename?
[sramReadonly] 1         ; write protect SRAM by default
[segaRomExt] bin
[snesRomExt] sfc
[snesSramExt] srm

The file resides in the nonvolatile EEPROM and can be edited using any text editor. This is particularly neat for the gamepad keycode assignments, since saving the file will effectuate the changes immediately.

Implementing this (in particular, the parsing of the config file) may take a few hours, but this is actually so simple that I don’t see how it could possibly fail was actually more of a bitch than I thought it would be. Once I figured out that the C library comes with sscanf and the likes, things obviously got a lot easier :-D

EDIT: Added configurable file extensions.

3 comments to New firmware feature: user config file

  • In response to this:

    #snega2usb
    October 11th, 2009 at 1:06 am

    Thank you also for your comment on the file extensions. There exist indeed various suffixes but they also correspond to different file formats. However, there is only one that doesn’t involve weird interlacing business, and that is .BIN.

    I think you didn’t understand what I meant. The extension “.SGD” is the official extension SEGA used internally when handling what the internet knows as generic “.BIN” files. Both are the same thing, but SGD is the “proper” extension that nobody knew about, until some old, official SEGA ROMs were recently unveiled.

    In fact, some emus are starting to accomodate to this, and start supporting “.SGD” as a valid file type, since “.BIN” is too generic and can refer to any raw dump of anything.

  • Luke Johnson

    Cool!