summaryrefslogtreecommitdiff
path: root/src/storm/SWrapper.cpp
diff options
context:
space:
mode:
authorLywx <kiritodev01@gmail.com>2023-11-15 15:11:15 -0600
committerGitHub <noreply@github.com>2023-11-15 15:11:15 -0600
commiteaddecd0b402c12a780831e3139d7a35e78322e6 (patch)
tree0c961e1ba2339f52892b54f44b8ff0018b77c382 /src/storm/SWrapper.cpp
parenta66b259d7c10c3367a04819c6b55d47fb9a99f5e (diff)
Torch v0.1 (#12)
* Splitted version yamls and implemented wip geo and dlist extraction * Fixed linux compilation * Added PoC WSL 2 detection * Add undefined behaviour * Added gfxdis as submodule * update * Removed gfxdis as a submodule * Code works * Replace ByteSwap with BSWAP * Cleanup vertice factory * readability * readability 2 * Cleanup gfxfactory * last one * Rename name to symbol * More implementation * Implemented first PoC of C file generation * Added output formatting on factories * changes * Moved generated dlists onto their respective folder * Migrated more factories onto the new extractor system * Fully ported all factories and added header generation * Some updates * Added Lights factory * fix * Fixed vtx extraction * Lights work now * delete old startup_logo yaml * Generate all sections in single file * Added support to generate header and code for textures * Added O3 for release builds * Added WIP dlist extraction and moved to use f3dold microcode * Added segment support, autogeneration and fixed C generation * Added symbol names on display list extraction * Removed warnings * Moved back to transform and replace * Removed unnecesary macros * Added extraction order and reversed vtx order * Implemented true backwards sort * [WIP] Implemented runtime gbi, more headers and a few config features * Fix CLI11 on WSL and variety of fixes * Fixes * Update DisplayListFactory.h * Update TextureFactory.cpp * wip lights * fix * Correct callback * Added waypoints * Update ceremony_data.yml * Changes * Update TextureFactory.cpp * Update commandline args * Update comment * Remove printf * Update couple commands * Renamed cubeos to torch * Removed unused stuff and added an example config file --------- Co-authored-by: KiritoDv <kiritodev01@gmail.com> Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/storm/SWrapper.cpp')
-rw-r--r--src/storm/SWrapper.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/storm/SWrapper.cpp b/src/storm/SWrapper.cpp
index d17042f..fbb2329 100644
--- a/src/storm/SWrapper.cpp
+++ b/src/storm/SWrapper.cpp
@@ -1,8 +1,12 @@
#include "SWrapper.h"
#include <filesystem>
#include <iostream>
+#include <fstream>
+
+#include "spdlog/spdlog.h"
namespace fs = std::filesystem;
+bool debugMode = true;
SWrapper::SWrapper(const std::string& path) {
if(fs::exists(path)) {
@@ -17,6 +21,17 @@ SWrapper::SWrapper(const std::string& path) {
}
bool SWrapper::CreateFile(const std::string& path, std::vector<char> data) {
+ if(debugMode){
+ SPDLOG_INFO("Creating debug file: debug/{}", path);
+ std::string dpath = "debug/" + path;
+ if(!fs::exists(fs::path(dpath).parent_path())){
+ fs::create_directories(fs::path(dpath).parent_path());
+ }
+ std::ofstream stream(dpath, std::ios::binary);
+ stream.write((char*)data.data(), data.size());
+ stream.close();
+ }
+
HANDLE hFile;
#ifdef _WIN32
SYSTEMTIME sysTime;
@@ -32,6 +47,11 @@ bool SWrapper::CreateFile(const std::string& path, std::vector<char> data) {
char* raw = (char*) data.data();
size_t size = data.size();
+ if(size == 0){
+ std::cout << "File empty: " << path << std::endl;
+ return false;
+ }
+
if(size >> 32){
std::cout << "File too large: " << path << std::endl;
return false;