summaryrefslogtreecommitdiff
path: root/src/factories/DisplayListFactory.cpp
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-04-07 18:02:18 -0600
committerLywx <kiritodev01@gmail.com>2024-04-08 18:09:34 -0600
commit39478397ee83b07390a1cec98aeea242911b33ef (patch)
tree798d47de973727b2aaba962dd59ad0da091574f9 /src/factories/DisplayListFactory.cpp
parentd9852bb3ef28d0e197a9ea0543c744622f35aac6 (diff)
Changed offset to vtx but we need to revert it
Diffstat (limited to 'src/factories/DisplayListFactory.cpp')
-rw-r--r--src/factories/DisplayListFactory.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index 02df2a5..2781821 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -235,13 +235,18 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
auto ovnode = std::get<1>(overlap.value());
auto path = Companion::Instance->RelativePath(std::get<0>(overlap.value()));
uint64_t hash = CRC64(path.c_str());
+
+ if(hash == 0) {
+ throw std::runtime_error("Vtx hash is 0 for " + std::get<0>(overlap.value()));
+ }
+
SPDLOG_INFO("Found vtx: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, path);
auto offset = GetSafeNode<uint32_t>(ovnode, "offset");
auto count = GetSafeNode<uint32_t>(ovnode, "count");
auto diff = ASSET_PTR(ptr) - ASSET_PTR(offset);
- Gfx value = gsSPVertexOTR(diff, nvtx, didx);
+ Gfx value = gsSPVertexOTR(diff / sizeof(Vtx_t), nvtx, didx);
SPDLOG_INFO("gsSPVertexOTR({}, {}, {})", diff, nvtx, didx);
@@ -261,6 +266,10 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
if(dec.has_value()){
uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
+ if(hash == 0) {
+ throw std::runtime_error("Vtx hash is 0 for " + std::get<0>(dec.value()));
+ }
+
SPDLOG_INFO("Found vtx: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
// TODO: Find a better way to do this because its going to break on other games
@@ -350,6 +359,11 @@ ExportResult DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IP
if(dec.has_value()){
uint64_t hash = CRC64(std::get<0>(dec.value()).c_str());
+
+ if(hash == 0){
+ throw std::runtime_error("Texture hash is 0 for " + std::get<0>(dec.value()));
+ }
+
SPDLOG_INFO("Found texture: 0x{:X} Hash: 0x{:X} Path: {}", ptr, hash, std::get<0>(dec.value()));
w0 = hash >> 32;
w1 = hash & 0xFFFFFFFF;