/mnt/data/System/System6.bin

From ArchosDocs

Jump to: navigation, search

This file holds a lot of the Archos's user settings. We can learn the position and name of all data fields by reverse engineering the params_SaveHdd() function. The function itself is pretty boring, so here's a brief summary.

  • The first 4 bytes are the magic: 0x5896117f
  • The next 16 bytes contain an md5 checksum of the file.
  • The rest of the file contains data blocks. Each block has the following structure:
    • 2 bytes containing the total block size
    • 2 bytes containing the block identifier
    • a data blob of length [block size minus 4] bytes.

Here's the contents of system6_parser.c.

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
 
#define ID_integer 0 // display as an integer value
#define ID_hex 1 // display as an hex string
#define ID_string 2 // display as a string
#define ID_bool 3 // display as true/false
#define ID_none 4 // do not display, because value is likely large
#define ID_timestamp 5 // display as unix timestamp
 
struct {
int id;
int type;
const char *name;
} fields[] = {
{ 0x0096, ID_string, "ISO_Lang" },
{ 0x0097, ID_integer, "USB2D_preferred_mode" },
{ 0x0002, ID_integer, "sound[0x00]" },
{ 0x0005, ID_integer, "sound[0x0c]+0x0a" },
{ 0x0006, ID_integer, "sound[0x28]" },
{ 0x0004, ID_integer, "sound[0x2c]" },
{ 0x0077, ID_none, "sound[0x30]" },
{ 0x00e7, ID_integer, "sound[0x44]" },
{ 0x00e8, ID_integer, "sound[0x48]" },
{ 0x00e9, ID_integer, "sound[0x4c]" },
{ 0x00e5, ID_integer, "sound[0x54]" },
{ 0x0136, ID_integer, "sound_events_state" },
{ 0x0082, ID_integer, "sound[0x20]" },
{ 0x0007, ID_integer, "audio_play_mode" },
{ 0x0009, ID_integer, "audio_nrs_mode" },
{ 0x0098,ID_integer , "audio_play_simple" },
{ 0x0099, ID_integer, "audio_nrs_simple" },
{ 0x0008, ID_integer, "video_play_mode" },
{ 0x000a, ID_integer, "video_nrs_mode" },
{ 0x0083,ID_integer , "video_display_format" },
{ 0x000b, ID_integer, "SCAN_time" },
{ 0x000c, ID_integer, "Batt_PowerOff_timeout" },
{ 0x000d, ID_integer, "Batt_BackLight_timeout" },
{ 0x000f, ID_integer, "Supply_PowerOff_timeout" },
{ 0x0010, ID_integer, "Supply_BackLight_timeout" },
{ 0x0012, ID_integer, "recording[0x110]" },
{ 0x0014, ID_integer, "recording[0x108]" },
{ 0x0015, ID_integer, "recording[0x000]" },
{ 0x0016, ID_integer, "recording[0x104]" },
{ 0x0067, ID_none, "recording[0x320]" },
{ 0x0068, ID_none, "recording[0x420]" },
{ 0x0069, ID_none, "recording[0x520]" },
{ 0x014a, ID_integer, "on_chip_tvout_settings[0x04]" },
{ 0x014c, ID_integer, "on_chip_tvout_settings[0x08]" },
{ 0x014e, ID_integer, "on_chip_tvout_settings[0x00]" },
{ 0x0150, ID_integer, "on_chip_tvout_settings[0x0c]" },
{ 0x014b, ID_integer, "ext_chip_tvout_settings[0x04]" },
{ 0x014d,ID_integer , "ext_chip_tvout_settings[0x08]" },
{ 0x014f, ID_integer, "ext_chip_tvout_settings[0x00]" },
{ 0x0151, ID_integer, "ext_chip_tvout_settings[0x0c]" },
{ 0x001b, ID_integer, "backlight_param" },
{ 0x001d, ID_integer, "sound[0x1C]" },
{ 0x001e, ID_bool, "wallpaper_active" },
{ 0x0021, ID_integer, "rgb32_to_rgb16(RGBA_THEMED)" },
{ 0x010f, ID_hex, "wallpaper_get_color" },
{ 0x0022, ID_string, "wallpaper_full_path" },
{ 0x0023, ID_integer, "CLOCK_timeFormat" },
{ 0x0133, ID_integer, "CLOCK_Standby_display" },
{ 0x010a, ID_integer, "resume_enabled" },
{ 0x010b, ID_none, "resume" },
{ 0x002c, ID_integer, "recording[0x04]" },
{ 0x0033, ID_integer, "slideshow_delay" },
{ 0x0032, ID_integer, "slideshow_transition" },
{ 0x0034, ID_integer, "slideshow_format" },
{ 0x0031, ID_integer, "slideshow_shuffle" },
{ 0x0030, ID_integer, "slideshow_blur" },
{ 0x00e6, ID_integer, "VIDEO_Storage" },
{ 0x0037, ID_integer, "VIDEO_Source" },
{ 0x0038, ID_integer, "VIDEO_RecRatio" },
{ 0x017c, ID_integer, "VIDEO_PalBrightness" },
{ 0x017d, ID_integer, "VIDEO_NtscBrightness" },
{ 0x017e, ID_integer, "VIDEO_PalContrast" },
{ 0x017f, ID_integer, "VIDEO_NtscContrast" },
{ 0x003b, ID_integer, "VIDEO_NtscSaturation" },
{ 0x003c, ID_integer, "VIDEO_PalSaturation" },
{ 0x003d, ID_integer, "VIDEO_SecamSaturation" },
{ 0x003e, ID_integer, "VIDEO_Hue+0x19" },
{ 0x0040, ID_integer, "VIDEO_Bitrate" },
{ 0x0041, ID_integer, "VIDEO_Samplingrate" },
{ 0x0036, ID_integer, "VIDEO_Widescreen" },
{ 0x00f0, ID_integer, "VIDEO_rgb_mode" },
{ 0x00f1, ID_integer, "VIDEO_rgb_r" },
{ 0x00f2, ID_integer, "VIDEO_rgb_g" },
{ 0x00f3, ID_integer, "VIDEO_rgb_b" },
{ 0x00f8, ID_integer, "VIDEO_PrSaturation" },
{ 0x00f9, ID_integer, "VIDEO_PbSaturation" },
{ 0x0042, ID_integer, "HELMETCORDER_source" },
{ 0x0044, ID_integer, "HELMETCORDER_Brightness" },
{ 0x0045, ID_integer, "HELMETCORDER_Contrast" },
{ 0x0046, ID_integer, "HELMETCORDER_NtscpalSaturation" },
{ 0x0047, ID_integer, "HELMETCORDER_Hue+0x19" },
{ 0x0049, ID_integer, "HELMETCORDER_bitrate" },
{ 0x004a, ID_integer, "HELMETCORDER_samplingrate" },
{ 0x004b, ID_integer, "HELMETCORDER_timestamp" },
{ 0x0051, ID_integer, "ARCLIB_mode" },
{ 0x0052, ID_integer, "ARCLIB_dirty" },
{ 0x0053, ID_hex, "IRBLASTER_code_save" },
{ 0x0054, ID_integer, "IRB_KeyDigitUsed" },
{ 0x0055, ID_integer, "unk_F83218" },
{ 0x0056, ID_integer, "IRB_KeyEnterUsed" },
{ 0x0057, ID_integer, "IRB_NbDelayStep" },
{ 0x0059, ID_integer, "DURATION_preconf" },
{ 0x005a, ID_integer, "DURATION_preconf[0x04]" },
{ 0x005d,ID_integer , "POS_isActive (?)" },
{ 0x005e, ID_integer, "EPG_prerecord[0x04]" },
{ 0x005f, ID_integer, "POS_isActive (?)" },
{ 0x0060, ID_integer, "EPG_postrecord" },
{ 0x006b, ID_string, "MTPDEV_FriendlyName" },
{ 0x006c, ID_string, "MTPDEV_SyncPartner" },
{ 0x0078, ID_hex, "mouse_transform" },
{ 0x007f, ID_hex, "network_setup_data" },
{ 0x0081, ID_hex, "network_setup_data[0x100]" },
{ 0x0080, ID_hex, "network_setup_data[0x110]" },
{ 0x008a, ID_hex, "network_setup_data[0x210]" },
{ 0x0090,ID_integer , "network_batt_opera_veto" },
{ 0x0091, ID_integer, "network_supply_opera_veto" },
{ 0x009a, ID_string, "Webbrowser_getParamHomepage" },
{ 0x00a6, ID_integer, "Webbrowser_getParamPopups" },
{ 0x00a7, ID_integer, "Webbrowser_getParamFlashPlugin" },
{ 0x00a8, ID_integer, "Webbrowser_getParamStartupHomepage" },
{ 0x00b5, ID_integer, "Webbrowser_getDefaultZoom" },
{ 0x00b6, ID_integer, "Webbrowser_getScrollbarMode" },
{ 0x00aa, ID_integer, "module_analog_recording_adapter_connected_once" },
{ 0x00dc, ID_integer, "module_dvr_cradle_connected_once" },
{ 0x00dd, ID_integer, "module_dvr_adapter_connected_once" },
{ 0x00de, ID_integer, "module_dvbt_adapter_connected_once" },
{ 0x0140, ID_integer, "module_dvr_cradle_tvout_configured_once" },
{ 0x0141, ID_integer, "module_mini_dock_tvout_configured_once" },
{ 0x00ab, ID_hex, "EPG_config[0x34]" },
{ 0x00ac, ID_hex, "EPG_config[0x38]" },
{ 0x00ad, ID_hex, "EPG_config[0x00]" },
{ 0x00ae, ID_hex, "EPG_config[0x1a]" },
{ 0x00af, ID_hex, "EPG_config[0x3c]" },
{ 0x00b3, ID_hex, "EPG_config[0x40]" },
{ 0x010e, ID_hex, "pos_password" },
{ 0x0186, ID_integer, "atv_display_format" },
{ 0x0094, ID_integer, "DVBT_last_channel_index" },
{ 0x00df, ID_integer, "DVBT_last_preset_index" },
{ 0x0095, ID_integer, "DVBT_set_clock_enable" },
{ 0x009d, ID_bool, "ATD_auto_sync" },
{ 0x009e, ID_timestamp, "ATD_last_sync" },
{ 0x009b, ID_string, "ATD_region" },
{ 0x009c, ID_string, "ATD_zone" },
{ 0x00b0, ID_string, "ATD_country" },
{ 0x008f, ID_integer, "wifi_selected_region" },
{ 0x0092, ID_integer, "wifi_region_locked" },
{ 0x00a2, ID_integer, "DAOS_check_failed" },
{ 0x00a3, ID_hex, "DAOS_update_url" },
{ 0x00a4, ID_hex, "DAOS_update_version" },
{ 0x00a5, ID_timestamp, "DAOS_last_check" },
{ 0x009f, ID_integer, "LCD_contrast" },
{ 0x00a0,ID_integer , "LCD_brightness" },
{ 0x00e1, ID_integer, "LCD_gamma" },
{ 0x00b1, ID_integer, "AcgWeb_getPreferredStore" },
{ 0x00b2, ID_integer, "AcgWeb_unitRegistered" },
{ 0x00b4, ID_integer, "AC_getCountryCode" },
{ 0x00be, ID_integer, "upnp_video_thumbnail" },
{ 0x00c8, ID_bool, "dont_show_me_again_charge_info_blinking" },
{ 0x00c9, ID_bool, "dont_show_me_again_upselling_dock" },
{ 0x00ea, ID_integer, "IRB_StartUpTime" },
{ 0x00eb, ID_integer, "IRB_UseKeyForWakeup" },
{ 0x00f6, ID_integer, "ACG_mtplib_dirty" },
{ 0x00f7, ID_integer, "SettingsWizard_GetBootFlag" },
{ 0x00fa, ID_integer, "user_network_type" },
{ 0x0105, ID_hex, "parental_params" },
{ 0x0110, ID_hex, "FMRadioSettings" },
{ 0x012c, ID_hex, "Alarm[0x000]" },
{ 0x012d, ID_hex, "Alarm[0x008]" },
{ 0x012e, ID_hex, "Alarm[0x00C]" },
{ 0x012f, ID_hex, "Alarm[0x004]" },
{ 0x0130, ID_hex, "Alarm[0x010]" },
{ 0x0132, ID_hex, "Alarm[0x110]" },
{ 0x0131, ID_hex, "Alarm[0x210]" },
{ 0x0109, ID_integer, "GadgetSource_getParamEnabledGadget" },
{ 0x0154, ID_bool, "netmanager_airplane_param" },
{ 0x0155, ID_bool, "netmanager_wifi_on" },
{ 0x0156, ID_bool, "netmanager_gsm_on" },
{ 0x015b, ID_bool, "MACHINE_has_wifi" },
{ 0x0190, ID_bool, "MACHINE_has_gsm" },
 
{ 0x00, NULL },
};
 
uint8_t *load(char *filename, unsigned int *_filesize)
{
FILE *file;
long filesize, readsize;
uint8_t *buffer;
 
file = fopen(filename, "r+b");
if(!file) {
printf("fopen: error opening file\n");
return NULL;
}
 
fseek(file, 0, SEEK_END);
filesize = ftell(file);
 
if(filesize <= 0) {
printf("filesize <= 0: filesize is %lu\n", filesize);
fclose(file);
return NULL;
}
 
buffer = malloc(filesize);
if(!buffer) {
printf("malloc: error allocating %lu bytes\n", filesize);
fclose(file);
return NULL;
}
 
fseek(file, 0, SEEK_SET);
readsize = fread(buffer, 1, filesize, file);
if(readsize != filesize) {
printf("fread: error reading file: wanted %lu bytes and got %lu bytes\n", filesize, readsize);
fclose(file);
return NULL;
}
fclose(file);
 
if(_filesize) *_filesize = (unsigned int)filesize;
 
return buffer;
}
 
void printf_bytes(const char *buffer, unsigned int size)
{
int i;
 
for(i=0;i<size;i++)
printf("%02x", buffer[i] & 0xff);
 
return;
}
 
const char *find_field_id(uint16_t id, int *type)
{
int i;
for(i=0;fields[i].name != NULL;i++) {
if(id == fields[i].id) {
if(type) *type = fields[i].type;
return fields[i].name;
}
}
 
return NULL;
}
 
int main(int argc, char *argv[])
{
uint8_t *buffer;
unsigned int i, filesize;
 
buffer = load("System6.bin", &filesize);
if(!buffer) {
printf("Error loading System6.bin!\n");
return 1;
}
 
printf("File Magic: %08x\n", *(uint32_t *)buffer);
 
printf("MD5 checksum: ");
printf_bytes(&buffer[4], 16);
printf("\n");
 
i = 20;
while(i<filesize) {
uint16_t size = *(uint16_t *)&buffer[i];
uint16_t id = *(uint16_t *)&buffer[i+2];
int type;
const char *name;
 
printf("%04x\t%04x\t", size, id);
 
name = find_field_id(id, &type);
if(name)
printf("%-50s ", name);
else
printf("%-50s ", "(Uh, oh! Unknown Param!)");
 
if(type == ID_string)
printf("%s", (const char *)&buffer[i+4]);
 
if(type == ID_bool) {
if(size-4 == 2)
printf("%s", *(uint16_t *)&buffer[i+4] ? "true" : "false");
else if(size-4 == 4)
printf("%s", *(uint32_t *)&buffer[i+4] ? "true" : "false");
else
type = ID_hex;
}
if(type == ID_timestamp) {
if(size-4 == 4)
printf("%u", *(uint32_t *)&buffer[i+4]);
else
type = ID_hex;
}
if(type == ID_integer) {
if(size-4 == 2)
printf("%u", *(uint16_t *)&buffer[i+4]);
else if(size-4 == 4)
printf("%u", *(uint32_t *)&buffer[i+4]);
else
type = ID_hex;
}
if(type == ID_hex) {
printf_bytes(&buffer[i+4], size-4);
}
if(type == ID_none)
printf("(not displayed)");
 
 
printf("\n");
 
i += size;
if(size == 0) break;
}
 
printf("\n");
 
return 0;
}

Compile it like this:

gcc -o ./system6_parser system6_parser.c
Personal tools