Skip to content

Commit

Permalink
Translated branch to dlist + end_dl
Browse files Browse the repository at this point in the history
  • Loading branch information
KiritoDv committed Jun 9, 2024
1 parent 966e5b3 commit 97b2fb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/factories/DisplayListFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,12 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
}

if(opcode == GBI(G_DL)) {
Gfx value;
auto ptr = w1;
auto dec = Companion::Instance->GetNodeByAddr(ptr);
auto branch = (w0 >> 16) & G_DL_NO_PUSH;

Gfx value = gsSPDisplayListOTRHash(ptr);
value = gsSPDisplayListOTRHash(ptr);
w0 = value.words.w0;
w1 = value.words.w1;

Expand All @@ -309,6 +311,15 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
} else {
SPDLOG_WARN("Could not find display list at 0x{:X}", ptr);
}

if(branch){
writer.Write(w0);
writer.Write(w1);

value = gsSPRawOpcode(GBI(G_ENDDL));
w0 = value.words.w0;
w1 = value.words.w1;
}
}

if(opcode == GBI(G_MOVEMEM)) {
Expand Down
5 changes: 4 additions & 1 deletion src/n64/gbi-otr.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ _DW({
#define gsSPVertexOTR(v, n, v0) \
{ (_SHIFTL(G_VTX_OTR_HASH, 24, 8) | _SHIFTL((n), 12, 8) | _SHIFTL((v0) + (n), 1, 7)), (uintptr_t)(v) }

#define gsSPRawOpcode(opcode) \
{ _SHIFTL(opcode, 24, 8), 0 }

#define gsDPSetTextureOTRImage(fmt, siz, width, i) \
{{ \
_SHIFTL(G_SETTIMG_OTR_HASH, 24, 8) | _SHIFTL(fmt, 21, 3) | \
Expand All @@ -141,7 +144,7 @@ _DW({
#define gsSPBranchListOTRHash(dl) \
{{ \
(_SHIFTL((G_DL_OTR_HASH), 24, 8) | _SHIFTL((0x01), 16, 8) | \
_SHIFTL((0), 0, 16)), \
_SHIFTL((0), 1, 16)), \
(uintptr_t)(dl) \
}}

Expand Down

0 comments on commit 97b2fb2

Please sign in to comment.