Removed unnecesary TranslateAddrs

This commit is contained in:
KiritoDv
2024-02-18 16:23:12 -06:00
parent 752c6a2ac0
commit 510ffd4710
3 changed files with 21 additions and 25 deletions
+9 -10
View File
@@ -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();
+11 -14
View File
@@ -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()){
+1 -1
View File
@@ -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\