[CRO] Offset the old data address by the start of the CRO

The old logic caused bad data relocations
This commit is contained in:
PSI-Rockin 2024-04-22 18:17:58 -04:00
parent 466e67a2fd
commit b797c92b2e
2 changed files with 2 additions and 1 deletions

1
.gitignore vendored
View file

@ -65,3 +65,4 @@ fb.bat
*.smdh
config.toml
CMakeSettings.json

View file

@ -437,7 +437,7 @@ public:
const u32 segmentID = mem.read32(segmentTable.offset + 12 * segment + SegmentTable::ID);
switch (segmentID) {
case SegmentTable::SegmentID::DATA:
*oldDataVaddr = segmentOffset + dataVaddr; oldDataSegmentOffset = segmentOffset; segmentOffset = dataVaddr; break;
*oldDataVaddr = segmentOffset + croPointer; oldDataSegmentOffset = segmentOffset; segmentOffset = dataVaddr; break;
case SegmentTable::SegmentID::BSS: segmentOffset = bssVaddr; break;
case SegmentTable::SegmentID::TEXT:
case SegmentTable::SegmentID::RODATA: