Created
February 7, 2025 18:18
-
-
Save RomanHargrave/9b7a194ee166972b3c21b892df126bf5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------ | |
//--- 010 Editor v15.0.1 Binary Template | |
// | |
// File: Backup.bin | |
// Authors: Roman Hargrave <[email protected]> | |
// Version: | |
// Purpose: Diadem/etc... (Sony ILCE) Settings file v4 parser | |
// Category: | |
// File Mask: | |
// ID Bytes: 00 00 EC 82 | |
// History: | |
//------------------------------------------------ | |
// notes from backup.ko | |
// - per Data_SearchId, parameter ids are a 32-bit number where | |
// the upper 16 bits is the subsystem ID and the lower 16 the parameter. | |
// | |
typedef uint8 bool8; | |
typedef struct { | |
uint32 magic <bgcolor=cBlack,fgcolor=cDkRed>; | |
uint32 cookie <bgcolor=cBlack,fgcolor=cDkBlue>; | |
uint32 writecomp; | |
char revision[4] <bgcolor=cBlack,fgcolor=cDkYellow>; | |
uint32 numSubsystems; | |
uint32 numProperties; | |
uint32 dataOffset <bgcolor=cDkBlue,fgcolor=cYellow>; | |
uint32 dataSize <bgcolor=cDkBlue,fgcolor=cLtBlue>; | |
uint32 checksum <fgcolor=cAqua>; | |
uint32 __void0 <fgcolor=cDkGray>; | |
uint32 id1; | |
uint8 __void2[20] <fgcolor=cDkGray>; | |
char version[128] <fgcolor=cDkYellow>; | |
char region[64] <fgcolor=cLtBlue>; | |
} Header; | |
typedef struct { | |
uint16 pteCount <fgcolor=cDkYellow>; | |
uint32 pteStart <fgcolor=cDkAqua>; | |
} SubsystemEntry; | |
typedef struct { | |
enum PropertyFlags flags <fgcolor=cDkGreen>; | |
BitfieldDisablePadding(); | |
uint32 address : 24 <fgcolor=cDkPurple>; | |
uint8 size <fgcolor=cLtPurple>; | |
BitfieldEnablePadding(); | |
local bool8 invalid = (address == 0xFFFFFF); | |
local bool8 huge = size == 0xFF; | |
local bool8 vsp = size == 0; | |
} PropertyEntry; | |
enum <uint16> PropertyFlags { | |
PF_READ_ONLY = 0b00000001, | |
PF_PROTECTED = 0b00000010, | |
PF_CALLBACK = 0b00001000, | |
PF_RESETABLE = 0b01110100, // odd | |
PF_ARRAY = 0b10000000, | |
}; | |
uint32 NSPID(uint32 sid, uint32 pid) { | |
return (sid << 16) | (pid & 0xFFFF); | |
} | |
// uint32 for convenience | |
enum <uint32> Subsystem { | |
SS_CAMUSER = 0x0002, | |
SS_RENDERER = 0x0029, | |
SS_DISPLAY = 0x002A, | |
SS_SOUND = 0x002B, | |
SS_EFFECT = 0x0035, | |
SS_DEVICE_INFO = 0x003E, | |
SS_SENSER_UDTR = 0x004B, | |
SS_INFRAINPUT = 0x007A, | |
SS_INFRATP = 0x007B, // probably touch panel | |
SS_INFRAHOTSHOE = 0x007C, | |
SS_INFRASIRCS = 0x007D, | |
SS_FONT = 0x0081, | |
SS_UDATE = 0x0090, | |
// these all seem to be gps/compass related | |
SS_PSM0 = 0x00A1, | |
SS_PSM1 = 0x00A2, | |
SS_PSM2 = 0x00A4, | |
SS_NET_SEND = 0x00FD, | |
SS_TESTING = 0x0105, | |
SS_PARAMS = 0x0107, // maybe user configuration??? | |
SS_CONFIGS = 0x0112, | |
SS_KIKILOG = SS_CONFIGS, // no clue why overloaded | |
SS_INFRALANC = 0x0119, // service utils???? | |
SS_INFRADIAL = 0x011B, | |
SS_FACIAL_REC = 0x0138, | |
SS_REMOTE_NET = 0x0169, | |
SS_MAX = 65535 | |
}; | |
enum <uint32> Property { | |
// Subsustim: CAMUSER/CamStateMgr (0x02) | |
P_EXC_CONF = NSPID(SS_CAMUSER, 0x8), // some blob??? | |
// Subsystem 0x0028 ====================== | |
P_DATETIME = NSPID(0x28, 0x14), | |
// Subsystem: ObjRenderer (0x29) | |
// there are SO many. see libObj.so::ExecCommandInitParam for all... | |
P_RENDERER_PRM_OPEN_MODE_EE_GOLFSHOT = NSPID(SS_RENDERER, 0x18), | |
P_RENDERER_PRM_OPEN_MODE_EE_HS_MOVIE = NSPID(SS_RENDERER, 0x19), | |
P_RENDERER_PRM_OPEN_MODE_EE_MOVIE = NSPID(SS_RENDERER, 0x1A), | |
P_RENDERER_PRM_OPEN_MODE_EE_PANORAMA = NSPID(SS_RENDERER, 0x1B), | |
P_RENDERER_PRM_OPEN_MODE_EE_STILL = NSPID(SS_RENDERER, 0x1C), | |
P_RENDERER_PRM_OPEN_MODE_IDLE = NSPID(SS_RENDERER, 0x1D), | |
P_RENDERER_YUV_CAUTION_LOWER_GREY = NSPID(SS_RENDERER, 0x27), | |
P_RENDERER_YUV_CAUTION_LOWER_THRESH = NSPID(SS_RENDERER, 0x28), | |
P_RENDERER_YUV_CAUTION_UPPER_GREY = NSPID(SS_RENDERER, 0x29), | |
P_RENDERER_YUV_CAUTION_UPPER_THRESH = NSPID(SS_RENDERER, 0x2A), | |
P_RENDERER_YUV_CAUTION_PERIOD = NSPID(SS_RENDERER, 0x2B), | |
P_DELIVER_MODE_STILL_PLAY_SLIDESHOW = NSPID(SS_RENDERER, 0x6B), | |
P_DELIVER_MODE_STILL_PLAY_MULTI_LAYOUT = NSPID(SS_RENDERER, 0x76), | |
P_RENDERER_DEFAULT_LATENCY = NSPID(SS_RENDERER, 0x8A), | |
P_RENDERER_EE_MOVIE_LATENCY = NSPID(SS_RENDERER, 0x8B), | |
P_RENDERER_EE_STILL_LATENCY = NSPID(SS_RENDERER, 0x8C), | |
P_DELIVER_MODE_AUTOREVIEW_SINGLE_IMG = NSPID(SS_RENDERER, 0x91), | |
// Subsystem: ObjDisplay (0x2A) | |
P_DISPLAY_HDMI_DEVICE = NSPID(SS_DISPLAY, 0x09), | |
// Subsystem: ObjEffect (0x35) | |
P_PAINT_DRAW_WIN_Y = NSPID(SS_EFFECT, 0x27), | |
P_PAINT_DRAW_WIN_X = NSPID(SS_EFFECT, 0x28), | |
P_PAINT_MAX_IMAGE_PIXELS = NSPID(SS_EFFECT, 0x29), | |
P_BIG_IMAGE_MAX_ZOOM_MAG_RATIO = NSPID(SS_EFFECT, 0x2A), | |
P_BIG_IMAGE_MIN_ZOOM_MAG_RATIO = NSPID(SS_EFFECT, 0x2B), | |
// Subsystem: Device Information (0x3E) | |
P_MODELNUM = NSPID(SS_DEVICE_INFO, 0x05), | |
/// "BKID_UNIFIED_SO" in ModelIdSoTable | |
P_UNIFIED_SO = NSPID(SS_DEVICE_INFO, 0x0B), | |
// Subsystem: INFRAINPUT (0x7A) | |
P_INFRAINPUT_KEY_CONF = NSPID(SS_INFRAINPUT, 0x1), | |
P_INFRAINPUT_POSITION = NSPID(SS_INFRAINPUT, 0x4), | |
P_INFRAINPUT_ILOGREBOOT_TIME = NSPID(SS_INFRAINPUT, 0x6), | |
P_INFRAINPUT_ILOGREBOOT_TYPES = NSPID(SS_INFRAINPUT, 0x7), | |
// Subsystem: Touch panel (0x7B) (from ILCE6000, may have changed) | |
P_TP_PANEL_HEIGHT = NSPID(SS_INFRATP, 0x04), | |
P_TP_PANEL_WIDTH = NSPID(SS_INFRATP, 0x05), | |
P_TP_LEFT_UP_PHX = NSPID(SS_INFRATP, 0x06), | |
P_TP_LEFT_UP_PHY = NSPID(SS_INFRATP, 0x07), | |
P_TP_RIGHT_DN_PHX = NSPID(SS_INFRATP, 0x08), | |
P_TP_RIGHT_DN_PHY = NSPID(SS_INFRATP, 0x09), | |
P_TP_LEFT_UP_X = NSPID(SS_INFRATP, 0x0E), | |
P_TP_LEFT_UP_Y = NSPID(SS_INFRATP, 0x0F), | |
// Subsystem: Hotshoe (0x7C) | |
/// appears to enable hotshoe control threads | |
P_HOTSHOE_ATTACH = NSPID(SS_INFRAHOTSHOE, 0x00), | |
/// true/false, probably selects between iISO/MIS | |
P_HOTSHOE_INFRA_KIND = NSPID(SS_INFRAHOTSHOE, 0x10), | |
/// true/false, enables external EVF off of MIS power? | |
P_HOTSHOE_EVF_NONBATTERY = NSPID(SS_INFRAHOTSHOE, 0x13), | |
P_HOTSHOE_KEYCONFIG = NSPID(SS_CONFIGS, 4), | |
// Subsystem: SIRCS (0x7D) | |
P_SIRCS_PAYLOAD = NSPID(SS_INFRASIRCS, 0), | |
// it looks like other panels may have further or different setting IDs | |
P_TP_PANEL_TYPE = NSPID(SS_INFRATP, 0x24), | |
// Subsystem: Font (0x81) | |
P_FONTLIST = NSPID(SS_FONT, 0), | |
// Subsystem: UDATE (0x90) | |
P_UDATE_AUTOCRCT_LOCK_INIT = NSPID(SS_UDATE, 0x2), | |
P_UDATE_ENABLE_AUTOCRCT_UNSET = NSPID(SS_UDATE, 0x3), | |
P_UDATE_INIT_DAY = NSPID(SS_UDATE, 0x4), | |
P_UDATE_INIT_DST = NSPID(SS_UDATE, 0x5), | |
P_UDATE_INIT_HOUR = NSPID(SS_UDATE, 0x6), | |
P_UDATE_INIT_MINUTE = NSPID(SS_UDATE, 0x7), | |
P_UDATE_INIT_MONTH = NSPID(SS_UDATE, 0x8), | |
P_UDATE_INIT_SECOND = NSPID(SS_UDATE, 0x9), | |
P_UDATE_INIT_TD = NSPID(SS_UDATE, 0xA), | |
P_UDATE_AUTOCRCT_AREA = NSPID(SS_UDATE, 0xC), | |
P_UDATE_RESET_TIME = NSPID(SS_UDATE, 0xD), | |
P_UDATE_INIT_YEAR_BASE = NSPID(SS_UDATE, 0xE), | |
P_UDATE_INIT_YEAR_OFFSET = NSPID(SS_UDATE, 0xF), | |
// Subsystem 0x0093 ====================== | |
P_MAYBE_WIDIRECT_IP = NSPID(0x93, 0x0C), | |
// Subsystem: PSM (0xA1, 0xA2) | |
P_PSM_DEBUG_THREAD = NSPID(SS_PSM1, 0x26), | |
// Subsystem 0x00BD ====================== | |
P_MYSTERY_BIN_LIST_2 = 0x00BD0006, | |
// Subsystem 0x00CA ====================== | |
P_REGI_HUB_URL = NSPID(0xCA, 0x03), | |
P_REGI_PRM_CHECKCODE = NSPID(0xCA, 0x04), | |
P_REGI_PRM_CLIENTVER = NSPID(0xCA, 0x05), | |
P_REGI_PRM_PRODSERIAL = NSPID(0xCA, 0x06), | |
// Subsystem: Network Sharing Limits (0x00FD) | |
P_SEND_TIMEOUT_USEC = NSPID(SS_NET_SEND, 0x0), | |
P_SEND_MAX_NUM = NSPID(SS_NET_SEND, 0x1), | |
P_SEND_TYPE_AVC_FLAG = NSPID(SS_NET_SEND, 0x2), | |
P_SEND_TYPE_AVC_SIZE_LIMIT = NSPID(SS_NET_SEND, 0x3), | |
P_SEND_TYPE_JPG_FLAG = NSPID(SS_NET_SEND, 0x4), | |
P_SEND_TYPE_JPG_SIZE_LIMIT = NSPID(SS_NET_SEND, 0x5), | |
P_SEND_TYPE_MP3_FLAG = NSPID(SS_NET_SEND, 0x6), | |
P_SEND_TYPE_MP3_SIZE_LIMIT = NSPID(SS_NET_SEND, 0x7), | |
P_SEND_TYPE_MP4_FLAG = NSPID(SS_NET_SEND, 0x8), | |
P_SEND_TYPE_MP4_SIZE_LIMIT = NSPID(SS_NET_SEND, 0x9), | |
P_SEND_TYPE_MPO_FLAG = NSPID(SS_NET_SEND, 0xA), | |
P_SEND_TYPE_MPO_SIZE_LIMIT = NSPID(SS_NET_SEND, 0xB), | |
P_SEND_TYPE_RAW_FLAG = NSPID(SS_NET_SEND, 0xC), | |
P_SEND_TYPE_RAW_SIZE_LIMIT = NSPID(SS_NET_SEND, 0xD), | |
P_UNKNOWN_USECS_102 = NSPID(0x0102, 0), | |
// Subsystem: 0x0105 (test automation???) | |
P_TEST_SCENARIO_NAME = NSPID(0x0105, 1), // string "sample", ILCE6000, ILCE7RM2 | |
// Subsystem: User Settings (0x0107) | |
P_AF_AREA_MODE = NSPID(SS_PARAMS, 0x0002), | |
P_STILLFORMAT_ASPECT = NSPID(SS_PARAMS, 0x0012), | |
P_STILLFORMAT_TYPE = NSPID(SS_PARAMS, 0x0013), | |
P_STILLFORMAT_QUALITY = NSPID(SS_PARAMS, 0x0014), | |
P_STILLFORMAT_SIZE = NSPID(SS_PARAMS, 0x0015), | |
P_BEEP_TYPE = NSPID(SS_PARAMS, 0x0026), | |
P_TMP_DPS_SEC = NSPID(SS_PARAMS, 0x0029), | |
P_TMP_APO_SEC = NSPID(SS_PARAMS, 0x002C), | |
P_AUTO_POWER_OFF_SEC = NSPID(SS_PARAMS, 0x0030), | |
P_AUTO_POWER_OFF = NSPID(SS_PARAMS, 0x0031), | |
P_DPS_SEC = NSPID(SS_PARAMS, 0x0032), | |
P_DPS = NSPID(SS_PARAMS, 0x0033), // related to suspend | |
P_LANGUAGE = NSPID(SS_PARAMS, 0x0076), | |
P_WIDEZOOM = NSPID(SS_PARAMS, 0x0114), | |
P_TP_TYPE = NSPID(SS_PARAMS, 0x0171), | |
P_AUDIO_LV_DETECT_1 = NSPID(SS_PARAMS, 0x01B4), | |
P_AUDIO_LV_DETECT_2 = NSPID(SS_PARAMS, 0x01BA), | |
P_AUDIO_LV_DETECT_3 = NSPID(SS_PARAMS, 0x01BB), | |
/// enables debug print when != 0xFF and the low bit is 1 | |
P_DEBUG_PRINT = NSPID(SS_PARAMS, 0x03FF), | |
P_PEAKING_COLORMTRY_1 = NSPID(SS_PARAMS, 0x0419), | |
P_PEAKING_COLORMTRY_2 = NSPID(SS_PARAMS, 0x041A), | |
P_PEAKING_COLORMTRY_3 = NSPID(SS_PARAMS, 0x041B), | |
P_TP_PERIOD = NSPID(SS_PARAMS, 0x04CB), // odd, read when 105::2 is set | |
P_FLAG_04FD = NSPID(SS_PARAMS, 0x04FD), | |
P_FACEREC_ENABLE = NSPID(SS_PARAMS, 0x08BD), | |
P_DEVICE_NAME = NSPID(SS_PARAMS, 0x094E), | |
/// when set to some value other than 'MODEL-NAME', loads a different camera profile (??) | |
/// see libInfraCameraProfile... | |
P_USE_PROFILE_DIR = NSPID(SS_PARAMS, 0x0C11), | |
/// when != 0, draws bounding boxes around all UI elements | |
P_UIDBG_DRAW_BOUNDS = NSPID(SS_PARAMS, 0x0CC7), | |
P_UNCOMPRESSED_RAW = NSPID(SS_PARAMS, 0x154F), | |
// Subsystem 0x010D | |
/// 1=Video, 2=Still | |
P_CAMERA_TYPE = NSPID(0x010D, 0x8D), | |
// Subsystem 0x0111 ====================== | |
P_MAYBE_CONFIG_DATA = 0x0111000B, | |
// Subsystem 0x0112 ====================== | |
P_KIKILOG_CONFIG = NSPID(SS_KIKILOG, 3), | |
// Subsystem: Dial (0x011B) | |
P_DIAL_MAX_INTERVAL = NSPID(SS_INFRADIAL, 0), // scaled 10x | |
P_DIAL_MIN_INTERVAL = NSPID(SS_INFRADIAL, 1), // scaled 10x | |
P_DIAL_RESPONSE_CURVE = NSPID(SS_INFRADIAL, 2), // scaled 5x | |
// Subsystem 0x0125 ====================== | |
P_MYSTERY_LENS_DATA = 0x01250005, | |
// Subsystem 0x0138 ====================== | |
// Facial Recognition | |
// - libObj | |
P_FR_FACES = NSPID(SS_FACIAL_REC, 0), | |
// Subsystem 0x013C ====================== | |
P_DEVICE_NAME_13C = 0x013C0005, | |
// Subsystem 0x013E ====================== | |
P_WIFI_DIRECT_NAME = 0x013E0006, | |
P_MAYBE_WIDIRECT_KEY0 = 0x013E0014, | |
P_MAYBE_WIDIRECT_KEY1 = 0x013E0016, | |
P_MAYBE_WIDIRECT_KEY2 = 0x013E0017, | |
P_WIFI_DIRECT_NAME_OTHER = 0x013E0018, | |
// Subsystem 0x0166 ====================== | |
P_MYSTERY_HEX = 0x01660024, // lots more like this... | |
P_MYSTERY_DIMENSIONS = 0x01660027, | |
P_MYSTERY_PRODUCTCODE = 0x01660031, // "ILDCSC_MUSASHI8Gb" - board code?? | |
P_APO_TIMEOUT_MODE = NSPID(SS_REMOTE_NET, 0), | |
P_REMOTE_PANEL_LUMINANCE = NSPID(SS_REMOTE_NET, 1), | |
}; | |
typedef struct (PropertyEntry& pte, uint32 p_sid, uint32 p_pid) { | |
local enum PropertyFlags flags = pte.flags; | |
local bool8 isArray <hidden=true> = flags & PF_ARRAY; | |
local bool8 isResetable <hidden=true> = flags & PF_RESETABLE; | |
local uint32 pid <hidden=true> = p_pid; | |
local enum Property gpid <read=Str("%08x", this)> = NSPID(p_sid, p_pid); | |
if (pte.huge) { | |
uint16 size <bgcolor=cDkBlue>; | |
local uint16 maxSize = size; | |
} else if (pte.vsp) { | |
uint16 size <bgcolor=cDkBlue>; | |
uint16 maxSize <bgcolor=cDkPurple>; | |
} else { | |
local uint16 size = pte.size; | |
local uint16 maxSize = size; | |
} | |
local bool8 empty <hidden=true> = size == 0; | |
if (size == 0) { | |
return; | |
} else if (isArray) { | |
uint8 arrayData[size] <bgcolor=cDkGray,fgcolor=cGray>; | |
} else { | |
uint8 data[size] <fgcolor=cDkGreen>; | |
} | |
if (isResetable && !isArray) { | |
// it looks like array properties which are resettable only contain one entry? | |
// need to figure out how arrays are sized... | |
uint8 defaultValue[size] <fgcolor=cDkYellow>; | |
} | |
} PropertyValue <name=PropertyValue_Read>; | |
string PropertyValue_Read(PropertyValue& pv) { | |
string pname = EnumToString(pv.gpid); | |
string result; | |
if (pname[0] == 0) { | |
SPrintf(result, "%04x", pv.pid); | |
} else { | |
SPrintf(result, "%s (%04x)", pname, pv.pid); | |
} | |
return result; | |
} | |
void PropertyValue_Template(PropertyEntry& pte, uint64 sid, uint64 pid) { | |
if (!pte.invalid) { | |
FSeek(pte.address); | |
PropertyValue property(pte, sid, pid); | |
} | |
} | |
// Template Starts ============================= | |
Header hdr <name="Header">; | |
SubsystemEntry ssTbl[hdr.numSubsystems] <hidden=true>; | |
PropertyEntry propTbl[hdr.numProperties] <optimize=false, hidden=true>; | |
// logical subsystem OU for template var tree | |
typedef struct (SubsystemEntry& ste, uint32 p_sid) { | |
local enum Subsystem sid <hidden=true> = p_sid; | |
local uint32 pid <hidden=true>; | |
for (pid = 0; pid < ste.pteCount; ++pid) { | |
PropertyValue_Template(propTbl[ste.pteStart + pid], sid, pid); | |
} | |
} _SYNTH_Subsystem <name=_SYNTH_Subsystem_Read>; | |
string _SYNTH_Subsystem_Read(_SYNTH_Subsystem& ss) { | |
local string ssname = EnumToString(ss.sid); | |
local string dispname; | |
if (ssname[0] != 0) { | |
SPrintf(dispname, "Subsystem %s (%04x)", ssname, ss.sid); | |
} else { | |
SPrintf(dispname, "Subsystem %04x", ss.sid); | |
} | |
return dispname; | |
} | |
local uint32 sid <hidden=true>; | |
for (sid = 0; sid < hdr.numSubsystems; ++sid) { | |
if (ssTbl[sid].pteCount > 0) { | |
_SYNTH_Subsystem subsystem(ssTbl[sid], sid); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment