diff options
| author | Archez <Archez@users.noreply.github.com> | 2024-03-26 23:23:53 -0400 |
|---|---|---|
| committer | louist103 <35883445+louist103@users.noreply.github.com> | 2025-03-29 13:50:21 -0400 |
| commit | 90d9bc3614636685817e9c2beceb86d760128e56 (patch) | |
| tree | 29cfce45df1450c9067b6b8d80320d5d51102484 | |
| parent | f6832e8698b1dfd18983ca46eb74e54d5dff65f8 (diff) | |
use custom opcode for non-zero DL segment offsets (#15)
| -rw-r--r-- | OTRExporter/DisplayListExporter.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/OTRExporter/DisplayListExporter.cpp b/OTRExporter/DisplayListExporter.cpp index 5d4b979..40bb779 100644 --- a/OTRExporter/DisplayListExporter.cpp +++ b/OTRExporter/DisplayListExporter.cpp @@ -435,12 +435,28 @@ void OTRExporter_DisplayList::Save(ZResource* res, const fs::path& outPath, Bina Gfx value; - u32 dListVal = (data & 0x0FFFFFFF) + 1; + u32 segNum = GETSEGNUM(data); + u32 segOffset = GETSEGOFFSET(data); + + // Use regular DL opcode for 0 offsets + if (segOffset == 0) { + u32 dListVal = (data & 0x0FFFFFFF) + 1; + + if (pp != 0) + value = {gsSPBranchList(dListVal)}; + else + value = {gsSPDisplayList(dListVal)}; + } else { + // Convert the offset value to an index value by diving by the original size for Gfx on hardware + // Adding 1 for seg addr flow will be handled on the renderer side + u32 dListVal = (segNum << 24) | (segOffset / (sizeof(u32) * 2)); + + if (pp != 0) + value = {gsSPBranchListIndex(dListVal)}; + else + value = {gsSPDisplayListIndex(dListVal)}; + } - if (pp != 0) - value = {gsSPBranchList(dListVal)}; - else - value = {gsSPDisplayList(dListVal)}; word0 = value.words.w0; word1 = value.words.w1; |
