diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-02-18 16:23:12 -0600 |
|---|---|---|
| committer | KiritoDv <kiritodev01@gmail.com> | 2024-02-18 16:23:12 -0600 |
| commit | 510ffd4710b805a0240594a71f44520dc43206fc (patch) | |
| tree | e45712c0e55bfa82d23088709cdc2790c2cbb286 | |
| parent | 752c6a2ac06106996c4182e651eaa695a9f211b8 (diff) | |
Removed unnecesary TranslateAddrs
| -rw-r--r-- | src/factories/DisplayListFactory.cpp | 19 | ||||
| -rw-r--r-- | src/factories/DisplayListOverrides.cpp | 25 | ||||
| -rw-r--r-- | src/factories/TextureFactory.cpp | 2 |
3 files changed, 21 insertions, 25 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp index d7eb844..ff38bf1 100644 --- a/src/factories/DisplayListFactory.cpp +++ b/src/factories/DisplayListFactory.cpp @@ -166,7 +166,7 @@ void DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat if(opcode == GBI(G_VTX)) { auto nvtx = (C0(0, 16)) / sizeof(Vtx); auto didx = C0(16, 4); - auto ptr = Decompressor::TranslateAddr(w1); + auto ptr = w1; auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ @@ -192,7 +192,7 @@ void DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat } if(opcode == GBI(G_DL)) { - auto ptr = Decompressor::TranslateAddr(w1); + auto ptr = w1; auto dec = Companion::Instance->GetNodeByAddr(ptr); Gfx value = gsSPDisplayListOTRHash(ptr); @@ -213,7 +213,7 @@ void DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat } if(opcode == GBI(G_MOVEMEM)) { - auto ptr = Decompressor::TranslateAddr(w1); + auto ptr = w1; auto dec = Companion::Instance->GetNodeByAddr(ptr); w0 &= 0x00FFFFFF; @@ -234,7 +234,7 @@ void DListBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat } if(opcode == GBI(G_SETTIMG)) { - auto ptr = Decompressor::TranslateAddr(w1); + auto ptr = w1; auto dec = Companion::Instance->GetNodeByAddr(ptr); Gfx value = gsDPSetTextureOTRImage(C0(21, 3), C0(19, 2), C0(0, 10), ptr); @@ -295,15 +295,14 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint std::string output; YAML::Node dl; - uint32_t ptr = Decompressor::TranslateAddr(w1); + uint32_t ptr = w1; if(Decompressor::IsSegmented(w1)){ SPDLOG_INFO("Found segmented display list at 0x{:X}", w1); - ptr = w1; - output = Companion::Instance->NormalizeAsset("seg" + std::to_string(SEGMENT_NUMBER(w1)) +"_dl_" + Torch::to_hex(SEGMENT_OFFSET(ptr), false)); + output = Companion::Instance->NormalizeAsset("seg" + std::to_string(SEGMENT_NUMBER(ptr)) +"_dl_" + Torch::to_hex(SEGMENT_OFFSET(ptr), false)); } else { SPDLOG_INFO("Found display list at 0x{:X}", ptr); - output = Companion::Instance->NormalizeAsset("dl_" + Torch::to_hex(w1, false)); + output = Companion::Instance->NormalizeAsset("dl_" + Torch::to_hex(ptr, false)); } Decompressor::CopyCompression(node, dl); @@ -353,7 +352,7 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint std::string output; YAML::Node light; - uint32_t ptr = Decompressor::TranslateAddr(w1); + uint32_t ptr = w1; if(Decompressor::IsSegmented(w1)){ SPDLOG_INFO("Found segmented lights at 0x{:X}", w1); @@ -396,7 +395,7 @@ std::optional<std::shared_ptr<IParsedData>> DListFactory::parse(std::vector<uint if(const auto decl = Companion::Instance->GetNodeByAddr(w1); !decl.has_value()){ SPDLOG_INFO("Addr to Vtx array at 0x{:X} not in yaml, autogenerating it", w1); - auto ptr = Decompressor::TranslateAddr(w1); + auto ptr = w1; auto rom = Companion::Instance->GetRomData(); auto factory = Companion::Instance->GetFactory("VTX")->get(); diff --git a/src/factories/DisplayListOverrides.cpp b/src/factories/DisplayListOverrides.cpp index 3af2f69..52a832d 100644 --- a/src/factories/DisplayListOverrides.cpp +++ b/src/factories/DisplayListOverrides.cpp @@ -46,8 +46,7 @@ void Quadrangle(const Gfx* gfx) { gfxd_puts(")"); } -int Vtx(uint32_t vtx, int32_t num) { - auto ptr = Decompressor::TranslateAddr(vtx); +int Vtx(uint32_t ptr, int32_t num) { auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ @@ -62,38 +61,37 @@ int Vtx(uint32_t vtx, int32_t num) { return 0; } -int Texture(uint32_t timg, int32_t fmt, int32_t siz, int32_t width, int32_t height, int32_t pal) { - auto dec = Companion::Instance->GetNodeByAddr(timg); +int Texture(uint32_t ptr, int32_t fmt, int32_t siz, int32_t width, int32_t height, int32_t pal) { + auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ auto node = std::get<1>(dec.value()); auto symbol = GetSafeNode<std::string>(node, "symbol"); - SPDLOG_INFO("Found Texture: 0x{:X} Symbol: {}", timg, symbol); + SPDLOG_INFO("Found Texture: 0x{:X} Symbol: {}", ptr, symbol); gfxd_puts(symbol.c_str()); return 1; } - SPDLOG_WARN("Could not find texture at 0x{:X}", timg); + SPDLOG_WARN("Could not find texture at 0x{:X}", ptr); return 0; } -int Palette(uint32_t tlut, int32_t idx, int32_t count) { - auto dec = Companion::Instance->GetNodeByAddr(tlut); +int Palette(uint32_t ptr, int32_t idx, int32_t count) { + auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ auto node = std::get<1>(dec.value()); auto symbol = GetSafeNode<std::string>(node, "symbol"); - SPDLOG_INFO("Found TLUT: 0x{:X} Symbol: {}", tlut, symbol); + SPDLOG_INFO("Found TLUT: 0x{:X} Symbol: {}", ptr, symbol); gfxd_puts(symbol.c_str()); return 1; } - SPDLOG_WARN("Could not find tlut at 0x{:X}", tlut); + SPDLOG_WARN("Could not find tlut at 0x{:X}", ptr); return 0; } -int Light(uint32_t lightsn, int32_t count) { - auto ptr = Decompressor::TranslateAddr(lightsn); +int Light(uint32_t ptr, int32_t count) { auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ @@ -108,8 +106,7 @@ int Light(uint32_t lightsn, int32_t count) { return 0; } -int DisplayList(uint32_t dl) { - auto ptr = Decompressor::TranslateAddr(dl); +int DisplayList(uint32_t ptr) { auto dec = Companion::Instance->GetNodeByAddr(ptr); if(dec.has_value()){ diff --git a/src/factories/TextureFactory.cpp b/src/factories/TextureFactory.cpp index 420d8d8..e5b8caa 100644 --- a/src/factories/TextureFactory.cpp +++ b/src/factories/TextureFactory.cpp @@ -143,7 +143,7 @@ std::optional<std::shared_ptr<IParsedData>> TextureFactory::parse(std::vector<ui uint32_t width; uint32_t height; uint32_t size; - auto offset = Decompressor::TranslateAddr(GetSafeNode<uint32_t>(node, "offset")); + auto offset = GetSafeNode<uint32_t>(node, "offset"); if (format.empty()) { SPDLOG_ERROR("Texture entry at {:X} in yaml missing format node\n\ |
