summaryrefslogtreecommitdiff
path: root/lib/binarytools
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 /lib/binarytools
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 'lib/binarytools')
-rw-r--r--lib/binarytools/BinaryReader.cpp4
-rw-r--r--lib/binarytools/BinaryReader.h1
-rw-r--r--lib/binarytools/BinaryWriter.cpp6
-rw-r--r--lib/binarytools/BinaryWriter.h5
4 files changed, 15 insertions, 1 deletions
diff --git a/lib/binarytools/BinaryReader.cpp b/lib/binarytools/BinaryReader.cpp
index f802885..4afeb17 100644
--- a/lib/binarytools/BinaryReader.cpp
+++ b/lib/binarytools/BinaryReader.cpp
@@ -8,6 +8,10 @@ LUS::BinaryReader::BinaryReader(char* nBuffer, size_t nBufferSize) {
mStream = std::make_shared<MemoryStream>(nBuffer, nBufferSize);
}
+LUS::BinaryReader::BinaryReader(uint8_t* nBuffer, size_t nBufferSize) {
+ mStream = std::make_shared<MemoryStream>((char*) nBuffer, nBufferSize);
+}
+
LUS::BinaryReader::BinaryReader(Stream* nStream) {
mStream.reset(nStream);
}
diff --git a/lib/binarytools/BinaryReader.h b/lib/binarytools/BinaryReader.h
index 02e65cc..a98742f 100644
--- a/lib/binarytools/BinaryReader.h
+++ b/lib/binarytools/BinaryReader.h
@@ -13,6 +13,7 @@ namespace LUS {
class BinaryReader {
public:
BinaryReader(char* nBuffer, size_t nBufferSize);
+ BinaryReader(uint8_t* nBuffer, size_t nBufferSize);
BinaryReader(Stream* nStream);
BinaryReader(std::shared_ptr<Stream> nStream);
diff --git a/lib/binarytools/BinaryWriter.cpp b/lib/binarytools/BinaryWriter.cpp
index 6e0140f..4d48a0e 100644
--- a/lib/binarytools/BinaryWriter.cpp
+++ b/lib/binarytools/BinaryWriter.cpp
@@ -1,5 +1,6 @@
#include "BinaryWriter.h"
#include "MemoryStream.h"
+#include <iostream>
LUS::BinaryWriter::BinaryWriter() {
mStream = std::make_shared<MemoryStream>();
@@ -153,3 +154,8 @@ void LUS::BinaryWriter::WriteByte(char value) {
std::vector<char> LUS::BinaryWriter::ToVector() {
return mStream->ToVector();
}
+
+void LUS::BinaryWriter::Finish(std::ostream& output) {
+ auto data = mStream->ToVector();
+ output.write(data.data(), data.size());
+} \ No newline at end of file
diff --git a/lib/binarytools/BinaryWriter.h b/lib/binarytools/BinaryWriter.h
index dca683f..28fdd09 100644
--- a/lib/binarytools/BinaryWriter.h
+++ b/lib/binarytools/BinaryWriter.h
@@ -39,8 +39,11 @@ class BinaryWriter {
std::vector<char> ToVector();
- protected:
+ void Finish(std::ostream &output);
+
+protected:
std::shared_ptr<Stream> mStream;
Endianness mEndianness = Endianness::Native;
+
};
} // namespace LUS