From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:3DSX" |
|---|
| claim | "3DSX relocation entries are pairs of u16 (skip words, patch words); a patched word's top 4 bits are a sub-type and low 28 bits an unrelocated image offset: the absolute table requires sub-type 0, the relative table stores target minus word address (sub-type 1 also clears bit 31)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "3DSX loaders as implemented in azahar; writer in 3dsxtool" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "loading a 3DSX" |
|---|
| effect | "For each of the three segments and each relocation table (only the first two tables are applied), walk the segment as u32 words: advance by skip, patch the following patch words. Address translation: offsets below the aligned code size map into the code segment, below code+rodata into rodata, otherwise into data; segment sizes are rounded up to 0x1000." |
|---|
| condition | "tables 2 and above are skipped by azahar" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Relocation loop, sub_type = word >> 28, TranslateAddr, absolute table sub_type must be 0, relative table sub-types 0 and 1" |
|---|
| repo | "https://github.com/azahar-emu/azahar" |
|---|
| commit | "987f18405073960622e1043bb44005989135c6e1" |
|---|
| path | "src/core/loader/3dsx.cpp" |
|---|
| lines | "91-97,157-215" |
|---|
|
| type | "source" |
|---|
| detail | "Writer splits long runs into entries of at most 0xFFFF" |
|---|
| repo | "https://github.com/devkitPro/3dstools" |
|---|
| commit | "718d6f2330dbef9dd5726573392425dcbd451677" |
|---|
| path | "src/3dsxtool.cpp" |
|---|
| lines | "283-287" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Relocation tables" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T23:55:02.174Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:40:13.709Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read azahar src/core/loader/3dsx.cpp lines 85-240 at 987f1840: TranslateAddr with offsets = {aligned code size, code+rodata}, segment sizes rounded up to 0x1000, tables with index >= 2 skipped by seeking, sub_type = word >> 28, table 0 requires sub_type 0, table 1 stores addr - in_addr (sub-type 1 clears bit 31, other sub-types are errors), pos reset per table." |
|---|
|
|
|---|