Skip to content

Reimport no longer fails when an overlay's function shares an address with the main code's - #123

Merged
ensapra merged 1 commit into
n-delic:mainfrom
tiredunc:fix/reimport-overlay-twins
Oct 26, 2026
Merged

ensapra merged 1 commit into
n-delic:mainfrom
tiredunc:fix/reimport-overlay-twins

Conversation

@tiredunc

Copy link
Copy Markdown

Related to #107 and #117. Reimporting a project made with an older version failed with UNIQUE constraint failed: functions.project_id, functions.name (in _import_split). Cause: reimport pairs each old function with a new one by address, using a lookup that holds one function per address. A game whose overlay puts a second function at an address the main code already uses (53 such addresses in one PS2 game) leaves the second twin unpaired, and its name, still held by the old twin, is inserted again. Fix: the pairing is now pair_old_functions: every function at an address is kept, each old function pairs once, matched by same name first, then address, then name. Tested: a new unit test (twins, a function renamed since the first import, a function new in the split); the existing reimport tests; the full suite, which passes except two tests that also fail on main (usage-limit time parsing, tray GTK check). Ran live: a PS2 project (18,335 functions) imported on 1.0.6-alpha.3 failed to reimport on 1.0.6-alpha.4 with the room fixes from #117, and now completes with 4,702 matched functions kept. Not tested on other consoles.

… with the main code's

Reimport paired each new function with the old one at its address using a lookup that holds one function per address. A game whose overlay puts a second function at an address the main code already has (PS2: 53 of them in one game) left the second twin unpaired, and its name, held by the old twin, was inserted again: UNIQUE constraint failed. Each address now keeps all its functions, and each old function pairs once, the one with the same name first.

@ensapra ensapra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and working

@ensapra
ensapra merged commit c6c16b1 into n-delic:main Oct 26, 2026
6 checks passed
@tiredunc
tiredunc deleted the fix/reimport-overlay-twins branch October 26, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants