From e54509d7d5b240a28cde3d99bbdf4ebe9183b2c4 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 21:28:56 +0000 Subject: [PATCH] KPAD 19/29, kbd_lib 15/21 (objdiff) (worker 2ecd44fa) --- README.md | 4 +- libs/RVL_SDK/src/kbd/kbd_lib.c | 14 +- libs/RVL_SDK/src/kpad/KPAD.c | 2 +- .../decomp-assist/sol-low-leaves-attempts.md | 121 ++++++++++++++++++ .../sol-low-leaves-final-gate.txt | 55 ++++++++ tools/decomp-assist/sol-low-leaves-report.md | 48 +++++++ 6 files changed, 234 insertions(+), 10 deletions(-) create mode 100644 tools/decomp-assist/sol-low-leaves-attempts.md create mode 100644 tools/decomp-assist/sol-low-leaves-final-gate.txt create mode 100644 tools/decomp-assist/sol-low-leaves-report.md diff --git a/README.md b/README.md index 454f992f..14772929 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 99.37% | 87.42% | 61.64% | 91.14% | +| 99.37% | 87.47% | 61.64% | 91.14% | -units 915/1027 complete, functions 12201/12563 matched. +units 915/1027 complete, functions 12203/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data diff --git a/libs/RVL_SDK/src/kbd/kbd_lib.c b/libs/RVL_SDK/src/kbd/kbd_lib.c index e7a1a000..6513f43a 100644 --- a/libs/RVL_SDK/src/kbd/kbd_lib.c +++ b/libs/RVL_SDK/src/kbd/kbd_lib.c @@ -851,15 +851,15 @@ USBKBDErr KBDSetModState(u32 channel, u32 value) { } u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) { - KBDKeyMap* map; - u16* table; - u32 keyIndex; - u16 entry; s32 mask; + u16* table; + u16 activeFlag; + u16 entry; + KBDKeyMap* map; s32 offset; s32 group; u32 shiftFlag; - u16 activeFlag; + u32 keyIndex; if (kbdInitialized == FALSE) { return 0xFFFF; @@ -920,9 +920,9 @@ u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) { shiftFlag <<= offset; activeFlag = shiftFlag; - if (mask == 0 && (activeFlag & entry) != 0) { + if (mask == 0 && (entry & activeFlag) != 0) { offset = offset ^ ((modifiers >> 9) & 1); - } else if (mask == 0x8000 && (activeFlag & entry) != 0) { + } else if (mask == 0x8000 && (entry & activeFlag) != 0) { u32 numLockShift = 0; if ((s32)(modifiers & 0x100) == 0x100 && offset == 0) { numLockShift = 1; diff --git a/libs/RVL_SDK/src/kpad/KPAD.c b/libs/RVL_SDK/src/kpad/KPAD.c index abb67cd1..5ae0ed60 100644 --- a/libs/RVL_SDK/src/kpad/KPAD.c +++ b/libs/RVL_SDK/src/kpad/KPAD.c @@ -1607,8 +1607,8 @@ static void KPADiSamplingCallback(s32 chan) { u32 device; if (WPADProbe(chan, &device) != -1) { u8 index = kpad->ringIndex; - KPADSample* status; u32 tier; + KPADSample* status; u32 enabled; u32 tableIndex; if (index >= 16) { diff --git a/tools/decomp-assist/sol-low-leaves-attempts.md b/tools/decomp-assist/sol-low-leaves-attempts.md new file mode 100644 index 00000000..09e96bc6 --- /dev/null +++ b/tools/decomp-assist/sol-low-leaves-attempts.md @@ -0,0 +1,121 @@ +Baseline HEAD f4fd16f8. Current baseline report missing; nearest available ancestor 8e43db05 will be selected explicitly for gate, supplemented with current HEAD report /tmp/sol-low-start.json. +Structural diagnosis for every open function saved in /tmp/sol-low-diagnosis. +KPADGetProjectionPos | operand order: half height and pixel scale | structural/exact (0, 10) insns 19/19 | restored +KPADGetProjectionPos | target operand order: height first; pixel scale first | structural/exact (0, 10) insns 19/19 | restored +KPADGetProjectionPos | explicit double temporary initialized before products | structural/exact (0, 14) insns 19/19 | restored +reset_kpad | initialize reference distance before bounds | structural/exact (0, 10) insns 117/117 | restored +reset_kpad | expression temporary: retain numerator for both stores | structural/exact (0, 8) insns 117/117 | restored +reset_kpad | inline distance ratio and initialize reference distance | structural/exact (20, 95) insns 116/117 | restored +KPADSetSensorHeight | move channel pointer initialization ahead of constants | structural/exact (0, 7) insns 52/52 | restored +KPADSetSensorHeight | inline squares into sqrt argument | structural/exact (0, 7) insns 52/52 | restored +KPADSetSensorHeight | store center before squared intermediates | structural/exact (0, 7) insns 52/52 | restored +KPADGetProjectionPos | declaration-order search | declaration block:; f64 scaled;; f32 height = rect->bottom - rect->top;; f32 halfHeight = height * 0.5f;; f32 x = src->x * halfHeight;; f32 y = src->y * halfHeight;; start (0, 9); best (0, 9) after 23 builds; source restored; best order was:; f64 scaled;; f32 height = rect->bottom - rect->top;; f32 halfHeight = height * 0.5f;; f32 x = src->x * halfHeight;; f32 y = src->y * halfHeight;; +KPADSetSensorHeight | declaration-order search | declaration block:; KPADInside* kpad;; f32 halfHeight;; f32 barOffsetX;; f32 barDiagonal;; f32 halfWidthSquared;; f32 halfWidth;; f32 negativeSensorHeight;; f32 barDiagonalSquared;; f32 halfHeightSquared;; start (0, 7); best (0, 7) after 93 builds; source restored; best order was:; KPADInside* kpad;; f32 halfHeight;; f32 barOffsetX;; f32 barDiagonal;; f32 halfWidthSquared;; f32 halfWidth;; f32 negativeSensorHeight;; f32 barDiagonalSquared;; f32 halfHeightSquared;; +calc_acc_horizon | declaration-order search | declaration block:; f32 magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);; f32 normalizedX;; f32 normalizedY;; f32 targetY;; f32 targetX;; f32 productX;; f32 oldX;; f32 oldY;; f32 blend;; f32 projectedX;; f32 smoothing;; f32 deltaX;; f32 nextX;; f32 nextY;; f32 normalized;; f32 unitX;; f32 oldCircleX;; f32 oldCircleY;; f32 unitY;; f32 circleX;; f32 deltaCircleX;; f32 circleY;; f32 deltaCircleY;; start (2, 35); improved (0, 30); improved (0, 29); best (0, 29) after 100 builds; kept in source:; f32 productX;; f32 oldX;; f32 normalizedY;; f32 targetY;; f32 targetX;; f32 magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);; f32 normalizedX;; f32 oldY;; f32 blend;; f32 projectedX;; f32 smoothing;; f32 deltaX;; f32 nextX;; f32 nextY;; f32 normalized;; f32 unitX;; f32 oldCircleX;; f32 oldCircleY;; f32 unitY;; f32 circleX;; f32 deltaCircleX;; f32 circleY;; f32 deltaCircleY;; +select_1obj_first | declaration-order search | declaration block:; KPADDPDObject* object = kpad->dpdState.objects;; KPADDPDObject* end = kpad->dpdState.candidates;; f32 scale = kpad->dpdObjectScale;; f32 productX = kpad->horizonTangent.x * kpad->horizonAxis.x;; f32 productY = kpad->horizonTangent.y * kpad->horizonAxis.x;; f32 offsetX = productX + kpad->horizonTangent.y * kpad->horizonAxis.y;; f32 offsetY = productY - kpad->horizonTangent.x * kpad->horizonAxis.y;; start (2, 26); best (2, 26) after 52 builds; source restored; best order was:; KPADDPDObject* object = kpad->dpdState.objects;; KPADDPDObject* end = kpad->dpdState.candidates;; f32 scale = kpad->dpdObjectScale;; f32 productX = kpad->horizonTangent.x * kpad->horizonAxis.x;; f32 productY = kpad->horizonTangent.y * kpad->horizonAxis.x;; f32 offsetX = productX + kpad->horizonTangent.y * kpad->horizonAxis.y;; f32 offsetY = productY - kpad->horizonTangent.x * kpad->horizonAxis.y;; +kbdEventHandler | reuse report status temporary in comparisons | structural/exact (3, 148) insns 185/186 | restored +kbdEventHandler | initialize channel pointer in one expression | structural/exact (0, 6) insns 186/186 | restored +kbdEventHandler | declare report status with its first load | build failed .c -o build/43U/src/libs/RVL_SDK/src/kbd && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kbd/kbd_lib.d build/43U/src/libs/RVL_SDK/src/kbd/kbd_lib.d +### mwcceppc.exe Compiler: +# File: libs\RVL_SDK\src\kbd\kbd_lib.c +# --------------------------------------- +# 238: u8 status = bytes[2]; +# Error: ^^ +# (10141) expression syntax error +# Too many errors printed, aborting program + +User break, cancelled... +ninja: build stopped: subcommand failed. + | restored +KBDSetModState | typed channel pointer for load and store | structural/exact (0, 7) insns 42/42 | restored +KBDSetModState | physical modifier masked expression | structural/exact (3, 7) insns 42/42 | restored +KBDSetModState | single modifier state temporary | structural/exact (0, 4) insns 42/42 | restored +kbd_led_handler | load completion callback before releasing command | structural/exact (24, 19) insns 23/25 | restored +select_1obj_continue | declaration-order search | declaration block:; KPADDPDObject* candidates = kpad->dpdState.candidates;; KPADDPDObject* candidate;; KPADDPDObject* object;; KPADDPDObject* matchedCandidate;; KPADDPDObject* source;; f32 best = kp_err_near_pos * kp_err_near_pos;; start (0, 17); best (0, 17) after 36 builds; source restored; best order was:; KPADDPDObject* candidates = kpad->dpdState.candidates;; KPADDPDObject* candidate;; KPADDPDObject* object;; KPADDPDObject* matchedCandidate;; KPADDPDObject* source;; f32 best = kp_err_near_pos * kp_err_near_pos;; +KPADInit | declaration-order search | declaration block:; KPADInside* kpad;; f32 distanceValue;; f32 sensorDistance;; f32 rotationElement;; f32 referenceWidth;; f32 referenceHeight;; f32 objectInterval;; f32 zero;; f32 degreesToRadians;; f32 one;; f32* matrix;; u32 i;; s32 chan;; BOOL enabled;; start (9, 81); improved (8, 70); improved (8, 67); improved (8, 58); improved (8, 54); improved (8, 51); best (8, 51) after 100 builds; kept in source:; f32 referenceHeight;; f32 objectInterval;; f32 sensorDistance;; f32 rotationElement;; f32 referenceWidth;; KPADInside* kpad;; f32 distanceValue;; f32 zero;; f32 degreesToRadians;; f32 one;; u32 i;; f32* matrix;; s32 chan;; BOOL enabled;; +KPADRead | declaration-order search | declaration block:; KPADInside* kpad = &inside_kpads[chan];; s32 probe;; BOOL interruptState;; u32 available = 0;; u32 ringCount;; s32 start;; s32 sampleIndex;; u32 remaining;; u32 remainingSamples;; u32 buttons;; u16 previousButtons;; u32 changed;; u32 extensionButtons;; u32 coreButtons;; u8 device;; KPADSample latestSample;; KPADSample* sample;; KPADStatus* output;; start (11, 89); improved (11, 86); improved (11, 84); best (11, 84) after 100 builds; kept in source:; KPADInside* kpad = &inside_kpads[chan];; KPADStatus* output;; BOOL interruptState;; u32 available = 0;; u32 ringCount;; s32 start;; s32 sampleIndex;; u32 remaining;; u32 remainingSamples;; s32 probe;; u16 previousButtons;; u32 changed;; u32 extensionButtons;; u32 coreButtons;; u8 device;; KPADSample latestSample;; KPADSample* sample;; u32 buttons;; +kbdProcMod | pass modifier expression directly | structural/exact (0, 4) insns 256/256 | restored +kbdProcMod | local modifier scope around inline setter | structural/exact (0, 4) insns 256/256 | restored +kbdProcMod | channel argument recovered from typed channel | structural/exact (14, 88) insns 259/256 | restored +KBDSetModState | read old union through typed field pointer | structural/exact (0, 7) insns 42/42 | restored +KBDSetModState | write new union through typed field pointer | structural/exact (0, 4) insns 42/42 | restored +KBDSetModState | reverse union temporary declaration order | structural/exact (0, 4) insns 42/42 | restored +kbd_led_handler | null callback test after clear; conditional error code | structural/exact (23, 21) insns 22/25 | restored +kbd_led_handler | guard completion body with non-null callback | structural/exact (24, 19) insns 23/25 | restored +KBDSetLedsAsync | unsigned indexed struct command loop | structural/exact (19, 72) insns 79/81 | restored +KBDSetLedsAsync | unsigned indexed loop and direct channel flags | structural/exact (19, 72) insns 79/81 | restored +KBDSetLedsAsync | unsigned counted byte offset with typed struct access | structural/exact (19, 72) insns 79/81 | restored +KBDSetLeds | unsigned indexed struct command loop | structural/exact (19, 68) insns 78/79 | restored +KBDSetLeds | unsigned indexed loop and direct flags access | structural/exact (19, 68) insns 78/79 | restored +KBDSetLeds | unsigned indexed loop; preserve allocated command pointer | structural/exact (22, 69) insns 78/79 | restored +KPADGetProjectionPos | inline double scale and target operand order | structural/exact (0, 10) insns 19/19 | restored +KPADGetProjectionPos | reuse height temporary and inline final scale | build failed c/kpad/KPAD.c -o build/43U/src/libs/RVL_SDK/src/kpad && "/usr/bin/python3" tools/transform_dep.py build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d build/43U/src/libs/RVL_SDK/src/kpad/KPAD.d +### mwcceppc.exe Compiler: +# File: libs\RVL_SDK\src\kpad\KPAD.c +# ------------------------------------- +# 348: f32 x = src->x * height; +# Error: ^^^ +# (10141) expression syntax error +# Too many errors printed, aborting program + +User break, cancelled... +ninja: build stopped: subcommand failed. + | restored +TMCJPEGDEC_IFD1_tag_parse | ignored planar configuration and contiguous EXIF tags | structural/exact (14, 226) insns 239/242 | restored +TMCJPEGDEC_IFD1_tag_parse | ignored EXIF tag range only | structural/exact (57, 219) insns 239/242 | restored +TMCJPEGDEC_IFD1_tag_parse | unsigned tag selector and ignored EXIF range | structural/exact (57, 219) insns 239/242 | restored +TMCJPEGDEC_IFD0_tag_parse | unsigned widened tag selector | structural/exact (27, 446) insns 481/481 | restored +TMCJPEGDEC_IFD0_tag_parse | signed widened tag selector | structural/exact (27, 446) insns 481/481 | restored +TMCJPEGDEC_IFD0_tag_parse | swap initial tag/type local declarations | structural/exact (29, 446) insns 481/481 | restored +TMCJPEGDEC_exif_parse | read helper boundary: standard 16-bit helper | structural/exact (0, 46) insns 212/212 | restored +TMCJPEGDEC_exif_parse | declare IFD cursor before offset | structural/exact (0, 46) insns 212/212 | restored +TMCJPEGDEC_exif_parse | reverse byte order expression operands | structural/exact (0, 46) insns 212/212 | restored +calc_acc_horizon | operand order of acceleration dot products | structural/exact (4, 37) insns 101/101 | restored +calc_acc_horizon | reuse blend for quadratic smoothing | structural/exact (2, 35) insns 101/101 | restored +calc_acc_horizon | declare magnitude after scalar intermediates | structural/exact (2, 34) insns 101/101 | restored +read_kpad_acc | stack frame local declaration order | structural/exact (32, 82) insns 400/400 | restored +read_kpad_acc | scalar smoothing: explicit pre-update delta | structural/exact (16, 66) insns 400/400 | restored +read_kpad_acc | extension stack local moved to function scope | structural/exact (16, 66) insns 400/400 | restored +select_1obj_first | offset scale operand order | structural/exact (2, 26) insns 109/109 | restored +select_1obj_first | end pointer declared before object cursor | structural/exact (4, 27) insns 109/109 | restored +select_1obj_first | candidate positions declared before coordinates | structural/exact (2, 26) insns 109/109 | restored +select_1obj_continue | offset distance first as target operands | structural/exact (0, 17) insns 93/93 | restored +select_1obj_continue | direction block local declarations before initializers | structural/exact (0, 16) insns 93/93 | restored +select_1obj_continue | inline tangent product intermediates | structural/exact (0, 19) insns 93/93 | restored +calc_dpd_variable | explicit absolute-distance branch | structural/exact (14, 45) insns 250/250 | restored +calc_dpd_variable | vector stack declaration order | structural/exact (40, 71) insns 250/250 | restored +calc_dpd_variable | reuse distance smoothing magnitude for final displacement | structural/exact (14, 43) insns 250/250 | restored +KPADRead | gravity structures declaration order | structural/exact (15, 93) insns 459/459 | restored +KPADRead | ring count clear and cursor calculation order | structural/exact (14, 89) insns 459/459 | restored +KPADRead | explicit sample selection branch | structural/exact (11, 97) insns 459/459 | restored +KPADInit | matrix base declaration order | structural/exact (9, 65) insns 185/185 | restored +KPADInit | sensor diagonal operand order | structural/exact (9, 81) insns 185/185 | restored +KPADInit | rotation temporary separated for sine and cosine | structural/exact (9, 81) insns 185/185 | restored +KPADiSamplingCallback | status pointer declared before index | structural/exact (2, 28) insns 182/182 | restored +KPADiSamplingCallback | device declared before channel state pointer | structural/exact (2, 28) insns 182/182 | restored +KPADiSamplingCallback | sensor diagonal temporary local order | structural/exact (3, 39) insns 182/182 | restored +KBDTranslateHidCode | declaration-order search | declaration block:; KBDKeyMap* map;; u16* table;; u32 keyIndex;; u16 entry;; s32 mask;; s32 offset;; s32 group;; u32 shiftFlag;; u16 activeFlag;; ; if (kbdInitialized == FALSE) {; start (0, 9); improved (0, 3); improved (0, 2); best (0, 2) after 173 builds; kept in source:; s32 mask;; u16* table;; u16 activeFlag;; u16 entry;; KBDKeyMap* map;; s32 offset;; s32 group;; u32 shiftFlag;; u32 keyIndex;; ; if (kbdInitialized == FALSE) {; +KBDTranslateHidCode | target bit-test operand order | structural/exact (0, 1) insns 164/164 | restored +KBDTranslateHidCode | both target bit-test operand orders | structural/exact (0, 0) insns 164/164 | kept +reset_kpad | initialized declarations followed by declaration search | declaration block:; f32 upperY = 0.75f;; f32 distanceValue;; f32 zero = 0.0f;; f32 sensorDistance = kpad->referenceDistance;; f32 lowerY = -0.75f;; f32 one = 1.0f;; f32 negativeOne = -1.0f;; KPADDPDObject* object;; start (0, 10); best (0, 10) after 71 builds; source restored; best order was:; f32 upperY = 0.75f;; f32 distanceValue;; f32 zero = 0.0f;; f32 sensorDistance = kpad->referenceDistance;; f32 lowerY = -0.75f;; f32 one = 1.0f;; f32 negativeOne = -1.0f;; KPADDPDObject* object;; | restored no exact gain + +KBDTranslateHidCode accepted after full clean gate --base 8e43db05. Exact objdiff 100%, ctxdiff 164/164 diffs 0; kbd instruction-exact 13->14/21, objdiff functions 14->15/21, code 2432->3088/5764, data 5296/5296. Pools identical, regressions 0, forbidden 0, readability 0, target DOL SHA1 preserved. +KBDSetModState | single expression merging old physical modifiers | structural/exact (3, 7) insns 42/42 | restored +KBDSetModState | reverse physical merge operands | structural/exact (3, 7) insns 42/42 | restored +KBDSetModState | assign physical field directly from stored state | structural/exact (0, 4) insns 42/42 | restored +kbdEventHandler | remove redundant report status temporary | structural/exact (0, 5) insns 186/186 | restored +kbdEventHandler | load status before computing channel pointer | structural/exact (0, 5) insns 186/186 | restored +KPADGetProjectionPos | name pixel aspect multiplier as local | structural/exact (0, 10) insns 19/19 | restored +KPADGetProjectionPos | name both screen geometry constants | structural/exact (7, 11) insns 19/19 | restored +KPADGetProjectionPos | vector intermediate for projection scaled components | structural/exact (7, 19) insns 23/19 | restored +read_kpad_acc | final declaration search | declaration block:; Vec raw;; Vec previous;; start (16, 66); best (16, 66) after 2 builds; source restored; best order was:; Vec raw;; Vec previous;; +calc_dpd_variable | final declaration search | declaration block:; Vec2 point;; Vec2 delta;; start (14, 45); best (14, 45) after 2 builds; source restored; best order was:; Vec2 point;; Vec2 delta;; +KPADiSamplingCallback | final declaration search | declaration block:; u8 index = kpad->ringIndex;; KPADSample* status;; u32 tier;; u32 enabled;; u32 tableIndex;; start (2, 28); improved (0, 0); best (0, 0) after 6 builds; kept in source:; u8 index = kpad->ringIndex;; u32 tier;; KPADSample* status;; u32 enabled;; u32 tableIndex;; +KBDSetModState | final declaration search | declaration block:; KBDModifierState oldState;; KBDModifierState newState;; interrupts = OSDisableInterrupts();; start (0, 4); best (0, 4) after 6 builds; source restored; best order was:; KBDModifierState oldState;; KBDModifierState newState;; interrupts = OSDisableInterrupts();; +TMCJPEGDEC_exif_parse | final declaration search | declaration block:; u16 byteOrder;; u32 ifdOffset;; const u8* entries;; u16 remaining;; u16 count;; s32 entriesSize;; u16 index;; start (0, 46); improved (0, 43); best (0, 43) after 70 builds; kept in source:; u16 byteOrder;; u32 ifdOffset;; const u8* entries;; u16 remaining;; u16 index;; s32 entriesSize;; u16 count;; +kbdProcMod | register-only declaration search | declaration block:; KBDChannel* data;; u32 modState;; s32 delta;; u8 flags;; ; u32 finalState;; s8 value;; start (0, 4); best (0, 4) after 52 builds; source restored; best order was:; KBDChannel* data;; u32 modState;; s32 delta;; u8 flags;; ; u32 finalState;; s8 value;; | restored +KBDResetChannel | objdiff 100% and actual instructions identical. gate.py reports two cr1 branch differences because odiff.dis subtracts function position from the CR operand instead of the branch target; source untouched. This accounts for instruction-exact 13 versus objdiff-exact 14 at baseline, and 14 versus 15 after translation match. +KPADiSamplingCallback | accepted fresh full gate --base 8e43db05, objdiff 100%, ctxdiff 182/182 diffs 0. KPAD exact 18->19/29, matched code 5188->5916/13056, data 7912/8032 unchanged. Regressions 0, forbidden 0, readability 0, DOL SHA1 correct. +KPADInit | extract atomic object-interval update into a real inline helper before reset_kpad | 185/185 instructions, 81 differences unchanged; sdata2 order unchanged because MWCC emits helper constant at call | restored + +Final audit: all 19 remaining functions have >=3 logged distinct source-level trials. Full clean combined gate over all three units PASS (--base 8e43db05), DOL SHA1 correct; no baseline or tooling edits. Independent comparison to starting HEAD report: 0 regressions, only KPAD and kbd_lib report measures changed. See sol-low-leaves-report.md for percentages, structural differences, and pre-existing cr1 normalization caveat. diff --git a/tools/decomp-assist/sol-low-leaves-final-gate.txt b/tools/decomp-assist/sol-low-leaves-final-gate.txt new file mode 100644 index 00000000..f1486269 --- /dev/null +++ b/tools/decomp-assist/sol-low-leaves-final-gate.txt @@ -0,0 +1,55 @@ +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[libs/RVL_SDK/src/kpad/KPAD] pool: IDENTICAL +[libs/RVL_SDK/src/kpad/KPAD] objdiff: code 5916/13056 data 7912/8032 functions 19/29 fuzzy 98.5983 linked code 0 +[libs/RVL_SDK/src/kpad/KPAD] instruction-exact functions: 19/29 +[libs/RVL_SDK/src/kpad/KPAD] section .bss size 7680 match 100.0 +[libs/RVL_SDK/src/kpad/KPAD] section .data size 88 match 100.0 +[libs/RVL_SDK/src/kpad/KPAD] section .sbss size 32 match 100.0 +[libs/RVL_SDK/src/kpad/KPAD] section .sdata size 112 match 100.0 +[libs/RVL_SDK/src/kpad/KPAD] section .sdata2 size 120 match 93.333336 +[libs/RVL_SDK/src/kpad/KPAD] section .text size 13056 match 98.59834 +[libs/RVL_SDK/src/kpad/KPAD] below 100: reset_kpad 99.48718 +[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADGetProjectionPos 96.57895 +[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADSetSensorHeight 99.23077 +[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_acc_horizon 97.27723 +[libs/RVL_SDK/src/kpad/KPAD] below 100: read_kpad_acc 98.15 +[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_first 98.348625 +[libs/RVL_SDK/src/kpad/KPAD] below 100: select_1obj_continue 98.49462 +[libs/RVL_SDK/src/kpad/KPAD] below 100: calc_dpd_variable 94.82 +[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADRead 97.52723 +[libs/RVL_SDK/src/kpad/KPAD] below 100: KPADInit 96.51351 +[libs/RVL_SDK/src/kpad/KPAD] baseline: code 5188/13056 data 7912 functions 18 fuzzy 98.4972 +[libs/RVL_SDK/src/kbd/kbd_lib] pool: IDENTICAL +[libs/RVL_SDK/src/kbd/kbd_lib] objdiff: code 3088/5764 data 5296/5296 functions 15/21 fuzzy 97.6523 linked code 0 +[libs/RVL_SDK/src/kbd/kbd_lib] instruction-exact functions: 14/21 +[libs/RVL_SDK/src/kbd/kbd_lib] section .bss size 3968 match 100.0 +[libs/RVL_SDK/src/kbd/kbd_lib] section .data size 1304 match 100.0 +[libs/RVL_SDK/src/kbd/kbd_lib] section .sbss size 16 match 100.0 +[libs/RVL_SDK/src/kbd/kbd_lib] section .sdata size 8 match 100.0 +[libs/RVL_SDK/src/kbd/kbd_lib] section .text size 5764 match 97.65233 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbdEventHandler 99.83871 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbdProcMod 99.90234 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: kbd_led_handler 61.12 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetLedsAsync 86.234566 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetLeds 84.6076 +[libs/RVL_SDK/src/kbd/kbd_lib] below 100: KBDSetModState 99.40476 +[libs/RVL_SDK/src/kbd/kbd_lib] baseline: code 2432/5764 data 5296 functions 14 fuzzy 97.6176 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] pool: IDENTICAL +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] objdiff: code 1348/5088 data None/None functions 3/6 fuzzy 96.2893 linked code 0 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] instruction-exact functions: 3/6 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] section .text size 5088 match 96.28931 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] below 100: TMCJPEGDEC_exif_parse 98.679245 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] below 100: TMCJPEGDEC_IFD0_tag_parse 94.241165 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] below 100: TMCJPEGDEC_IFD1_tag_parse 93.099174 +[libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse] baseline: code 1348/5088 data None functions 3 fuzzy 96.2893 +regressions vs baseline: 0 +global matched_code_percent: 87.39812 -> 87.44433 +global fuzzy_match_percent: 99.36627 -> 99.36678 +global complete_code_percent: 61.40923 -> 61.64133 +global matched_data_percent: 91.13999 -> 91.13999 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +note: config touched: config/43U/splits.txt (orchestrator reviews every config/symbols change) +note: config touched: configure.py (orchestrator reviews every config/symbols change) +GATE PASS diff --git a/tools/decomp-assist/sol-low-leaves-report.md b/tools/decomp-assist/sol-low-leaves-report.md new file mode 100644 index 00000000..35c99b1e --- /dev/null +++ b/tools/decomp-assist/sol-low-leaves-report.md @@ -0,0 +1,48 @@ +# Leaf matching result + +Source commits: c012e880, 78a83518. + +Full final gate: sol-low-leaves-final-gate.txt, explicitly selecting --base 8e43db05. +The current HEAD f4fd16f8 baseline file is absent. 8e43db05 is the nearest ancestor with an existing baseline; the starting HEAD report was independently saved as /tmp/sol-low-start.json. No baseline or gate tool was modified. + +Before -> after: +- KPAD instruction-exact 18/29 -> 19/29; objdiff functions 18/29 -> 19/29; code 5188/13056 -> 5916/13056; data 7912/8032 -> 7912/8032. +- kbd_lib gate instruction-exact 13/21 -> 14/21; objdiff functions 14/21 -> 15/21; code 2432/5764 -> 3088/5764; data 5296/5296 -> 5296/5296. +- exif_parse instruction-exact 3/6 -> 3/6; code 1348/5088 -> 1348/5088; data 0/0 -> 0/0. + +KBDResetChannel remains objdiff 100% and its actual instructions are identical. The gate undercounts it because odiff.dis normalizes the CR operand rather than the branch destination for two cr1 branches. This pre-existing gate-tool issue is recorded without editing the tools. + +KPAD .sdata2 first divergence is the real 0.383864f constant: target offset 0x0c, source offset 0x60. Extracting the interval update into a meaningful inline helper did not change emission order and was restored. No dummy constant or forced placement was introduced. + +## Remaining functions + +- reset_kpad: 99.48718%; 117/117 instructions; 10 floating-register differences around reference distance and ratio temporaries. +- KPADGetProjectionPos: 96.57895%; 19/19 instructions; 9 floating-register and multiplication-operand differences. +- KPADSetSensorHeight: 99.23077%; 52/52 instructions; 7 base-pointer and square-result register differences. +- calc_acc_horizon: 97.27723%; 101/101 instructions; floating-register allocation and scheduling differ. +- read_kpad_acc: 98.15%; 400/400 instructions; smoothing helper expansion and floating-register allocation differ. +- select_1obj_first: 98.348625%; 109/109 instructions; end-pointer and floating temporary register allocation differ. +- select_1obj_continue: 98.49462%; 93/93 instructions; direction and offset temporaries use different registers and operand order. +- calc_dpd_variable: 94.82%; 250/250 instructions; distance magnitude and projected-coordinate temporaries differ. +- KPADRead: 97.52723%; 459/459 instructions; copy/gravity stack locals and inline expansion register scheduling differ. +- KPADInit: 96.51351%; 185/185 instructions; callee-saved integer and floating allocation, scheduling, and constant encounter order differ. +- kbdEventHandler: 99.83871%; 186/186 instructions; 5 report-byte and channel-base scratch-register differences. +- kbdProcMod: 99.90234%; 256/256 instructions; 4 pointer/value register differences in inlined modifier-state update. +- kbd_led_handler: 61.12%; 23/25 instructions; callback null-test/release ordering and scratch register allocation differ. +- KBDSetLedsAsync: 86.234566%; 80/81 instructions; channel offset rematerialization, signed loop index, and command addressing differ. +- KBDSetLeds: 84.6076%; 75/79 instructions; pointer induction versus target indexed command loop and channel offset rematerialization differ. +- KBDSetModState: 99.40476%; 42/42 instructions; 4 pointer/value register differences at physical-modifier insertion. +- TMCJPEGDEC_exif_parse: 98.679245%; 212/212 instructions; byte-reader temporaries and callee-saved parser cursor/count registers differ. +- TMCJPEGDEC_IFD0_tag_parse: 94.241165%; 481/481 instructions; decoded tag/type temporaries and switch default branch structure differ. +- TMCJPEGDEC_IFD1_tag_parse: 93.099174%; 239/242 instructions; switch decision tree/default-return structure and byte-reader temporary allocation differ. + +Every remaining function has at least three distinct source-level trials logged in sol-low-leaves-attempts.md. Unsuccessful experiments were restored. Declaration-search tool outputs and target/source ctxdiff diagnosis are recorded or referenced there. + +Changed files: +- libs/RVL_SDK/src/kpad/KPAD.c +- libs/RVL_SDK/src/kbd/kbd_lib.c +- tools/decomp-assist/sol-low-leaves-attempts.md +- tools/decomp-assist/sol-low-leaves-final-gate.txt +- tools/decomp-assist/sol-low-leaves-report.md + +No source change to exif_parse; no linking/configuration/header change. -- 2.49.1