summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-03-10 16:09:20 -0600
committerKiritoDv <kiritodev01@gmail.com>2024-03-10 16:09:20 -0600
commit951e84d97d15204bbae2fcb036dc57eaaf4039ae (patch)
treeed840cb04599e24c7e76130cd7495d22238ba1aa /src
parentef6befae9a18ff8bf10f34af205ba696cb50e921 (diff)
Replaced displaylists and vertices with size:, and added debug for textures
Diffstat (limited to 'src')
-rw-r--r--src/factories/DisplayListFactory.cpp7
-rw-r--r--src/factories/TextureFactory.cpp23
-rw-r--r--src/factories/VtxFactory.cpp2
3 files changed, 26 insertions, 6 deletions
diff --git a/src/factories/DisplayListFactory.cpp b/src/factories/DisplayListFactory.cpp
index 4d9360f..caaa87a 100644
--- a/src/factories/DisplayListFactory.cpp
+++ b/src/factories/DisplayListFactory.cpp
@@ -127,14 +127,13 @@ void DListCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData>
write << "};\n";
if (Companion::Instance->IsDebug()) {
+ const auto sz = (sizeof(uint32_t) * cmds.size());
- std::string str = ((sizeof(uint32_t) * cmds.size()) / 8) == 1 ? " displaylist" : " displaylists";
-
- write << "// " << std::hex << std::uppercase << ((sizeof(uint32_t) * cmds.size()) / 8) << str << "\n";
+ write << "// size: 0x" << std::hex << std::uppercase << (sz / 8) << "\n";
if (IS_SEGMENTED(offset)) {
offset = SEGMENT_OFFSET(offset);
}
- write << "// 0x" << std::hex << std::uppercase << (offset + (sizeof(uint32_t) * (cmds.size()))) << "\n";
+ write << "// 0x" << std::hex << std::uppercase << (offset + sz) << "\n";
}
write << "\n";
diff --git a/src/factories/TextureFactory.cpp b/src/factories/TextureFactory.cpp
index a9d0c44..7c9ec4f 100644
--- a/src/factories/TextureFactory.cpp
+++ b/src/factories/TextureFactory.cpp
@@ -6,6 +6,7 @@
extern "C" {
#include "n64graphics/n64graphics.h"
+#include "BaseFactory.h"
}
static const std::unordered_map <std::string, TextureFormat> gTextureFormats = {
@@ -95,6 +96,7 @@ void TextureHeaderExporter::Export(std::ostream &write, std::shared_ptr<IParsedD
void TextureCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
auto texture = std::static_pointer_cast<TextureData>(raw);
auto data = texture->mBuffer;
+ auto offset = GetSafeNode<uint32_t>(node, "offset");
auto symbol = GetSafeNode(node, "symbol", entryName);
auto format = GetSafeNode<std::string>(node, "format");
@@ -129,6 +131,13 @@ void TextureCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat
file.close();
+ if (Companion::Instance->IsDebug()) {
+ if (IS_SEGMENTED(offset)) {
+ offset = SEGMENT_OFFSET(offset);
+ }
+ write << "// 0x" << std::hex << std::uppercase << offset << "\n";
+ }
+
if (Companion::Instance->GetGBIMinorVersion() == GBIMinorVersion::Mk64) {
write << "u8 " << symbol << "[] = {\n";
} else {
@@ -139,7 +148,19 @@ void TextureCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedDat
}
}
write << tab << "#include \"" << Companion::Instance->GetOutputPath() + "/" << (*replacement) << ".inc.c\"\n";
- write << "};\n\n";
+ write << "};\n";
+
+ if (Companion::Instance->IsDebug()) {
+ const auto sz = data.size();
+
+ write << "// size: 0x" << std::hex << std::uppercase << sz << "\n";
+ if (IS_SEGMENTED(offset)) {
+ offset = SEGMENT_OFFSET(offset);
+ }
+ write << "// 0x" << std::hex << std::uppercase << (offset + sz) << "\n";
+ }
+
+ write << "\n";
}
void TextureBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement) {
diff --git a/src/factories/VtxFactory.cpp b/src/factories/VtxFactory.cpp
index 2c225f9..c0b06ea 100644
--- a/src/factories/VtxFactory.cpp
+++ b/src/factories/VtxFactory.cpp
@@ -61,7 +61,7 @@ void VtxCodeExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> r
write << "};\n";
if (Companion::Instance->IsDebug()) {
- write << "// " << vtx.size() << " vertices\n";
+ write << "// size: " << vtx.size() << "\n";
write << "// 0x" << std::hex << std::uppercase << (offset + (sizeof(VtxRaw) * vtx.size())) << "\n";
}