mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Replaced displaylists and vertices with size:, and added debug for textures
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user