summaryrefslogtreecommitdiff
path: root/src/factories/DisplayListFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
-rw-r--r--src/factories/DisplayListFactory.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index 11bc7f8..faf6a67 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -315,15 +315,15 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
SPDLOG_WARN("Could not find vtx at 0x{:X}", ptr);
}
- auto dec = Companion::Instance->GetNodeByAddr(ptr);
+ auto dec = Companion::Instance->GetSafeStringByAddr(ptr, "VTX");
if(dec.has_value()){
- uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
+ uint64_t hash = CRC64(dec.value().c_str());
if(hash == 0) {
- throw std::runtime_error("Vtx hash is 0 for " + std::get<0>(dec.value()));
+ throw std::runtime_error("Vtx hash is 0 for " + dec.value());
}
- SPDLOG_INFO("Found vtx: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
+ SPDLOG_INFO("Found vtx: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, dec.value());
N64Gfx value = gsSPVertexOTR(0, nvtx, didx);
@@ -345,7 +345,7 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
if(opcode == GBI(G_DL)) {
N64Gfx value;
auto ptr = w1;
- auto dec = Companion::Instance->GetNodeByAddr(ptr);
+ auto dec = Companion::Instance->GetSafeStringByAddr(ptr, "GFX");
auto branch = (w0 >> 16) & G_DL_NO_PUSH;
// Export displaylist segment addresses as an index into a buffer of gfx
@@ -363,8 +363,8 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
writer.Write(w1);
if(dec.has_value()){
- uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
- SPDLOG_INFO("Found display list: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
+ uint64_t hash = CRC64(dec.value().c_str());
+ SPDLOG_INFO("Found display list: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, dec.value());
w0 = hash >> 32;
w1 = hash & 0xFFFFFFFF;
} else {
@@ -404,10 +404,10 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
break;
}
- auto res = Companion::Instance->GetNodeByAddr(ptr);
+ auto res = Companion::Instance->GetStringByAddr(ptr);
if(!res.has_value()){
- res = Companion::Instance->GetNodeByAddr(ptr - 0x8);
+ res = Companion::Instance->GetStringByAddr(ptr - 0x8);
hasOffset = res.has_value();
if(!hasOffset){
@@ -424,8 +424,8 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
writer.Write(w1);
if(res.has_value()){
- uint64_t hash = CRC64(std::get<0>(res.value()).c_str());
- SPDLOG_INFO("Found movemem: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(res.value()));
+ uint64_t hash = CRC64(res.value().c_str());
+ SPDLOG_INFO("Found movemem: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, res.value());
w0 = hash >> 32;
w1 = hash & 0xFFFFFFFF;
} else {
@@ -435,14 +435,15 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
if(opcode == GBI(G_SETTIMG)) {
auto ptr = w1;
- auto dec = Companion::Instance->GetNodeByAddr(ptr);
+ auto dec = Companion::Instance->GetSafeStringByAddr(ptr, "TEXTURE");
// Export texture segment addresses as segmented addresses
- if ((Companion::Instance->GetGBIMinorVersion() == GBIMinorVersion::Mk64) && ((SEGMENT_NUMBER(w1) == 0x03) || (SEGMENT_NUMBER(w1) == 0x05))) {
- w1 |= 1;
- writer.Write(w0);
- writer.Write(w1);
- } else {
+ // if ((Companion::Instance->GetGBIMinorVersion() == GBIMinorVersion::Mk64) && ((SEGMENT_NUMBER(w1) == 0x03) || (SEGMENT_NUMBER(w1) == 0x05))) {
+ // w1 |= 1;
+ // writer.Write(w0);
+ // writer.Write(w1);
+ // } else
+ {
N64Gfx value = gsDPSetTextureOTRImage(C0(21, 3), C0(19, 2), C0(0, 10), ptr);
w0 = value.words.w0;
w1 = value.words.w1;
@@ -451,13 +452,13 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
writer.Write(w1);
if(dec.has_value()){
- uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
+ uint64_t hash = CRC64(dec.value().c_str());
if(hash == 0){
- throw std::runtime_error("Texture hash is 0 for " + std::get<0>(dec.value()));
+ throw std::runtime_error("Texture hash is 0 for " + dec.value());
}
- SPDLOG_INFO("Found texture: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
+ SPDLOG_INFO("Found texture: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, dec.value());
w0 = hash >> 32;
w1 = hash & 0xFFFFFFFF;
} else {
@@ -468,7 +469,7 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
if(opcode == GBI(G_MTX)) {
auto ptr = w1;
- auto dec = Companion::Instance->GetNodeByAddr(ptr);
+ auto dec = Companion::Instance->GetSafeStringByAddr(ptr, "MTX");
w0 &= 0x00FFFFFF;
w0 += G_MTX_OTR << 24;
@@ -478,13 +479,13 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
writer.Write(w1);
if(dec.has_value()){
- uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
+ uint64_t hash = CRC64(dec.value().c_str());
if(hash == 0){
- throw std::runtime_error("Matrix hash is 0 for " + std::get<0>(dec.value()));
+ throw std::runtime_error("Matrix hash is 0 for " + dec.value());
}
- SPDLOG_INFO("Found matrix: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
+ SPDLOG_INFO("Found matrix: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, dec.value());
w0 = hash >> 32;
w1 = hash & 0xFFFFFFFF;
} else {