Files
Torch/lib/binarytools/BinaryWriter.h

50 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <array>
#include <memory>
#include <string>
#include <vector>
2024-05-25 16:31:32 -06:00
#include "lib/binarytools/endianness.h"
#include "lib/binarytools/Stream.h"
namespace LUS {
class BinaryWriter {
public:
BinaryWriter();
BinaryWriter(Stream* nStream);
BinaryWriter(std::shared_ptr<Stream> nStream);
2024-05-25 16:31:32 -06:00
void SetEndianness(Torch::Endianness endianness);
std::shared_ptr<Stream> GetStream();
uint64_t GetBaseAddress();
uint64_t GetLength();
void Seek(int32_t offset, SeekOffsetType seekType);
void Close();
void Write(int8_t value);
void Write(uint8_t value);
void Write(int16_t value);
void Write(uint16_t value);
void Write(int32_t value);
void Write(int32_t valueA, int32_t valueB);
void Write(uint32_t value);
void Write(int64_t value);
void Write(uint64_t value);
void Write(float value);
void Write(double value);
2023-09-03 20:11:35 -06:00
void Write(const std::string& str, bool writeLength = true);
void Write(char* srcBuffer, size_t length);
2023-09-03 20:11:35 -06:00
void WriteByte(char value);
std::vector<char> ToVector();
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>
2023-11-15 15:11:15 -06:00
void Finish(std::ostream &output);
protected:
std::shared_ptr<Stream> mStream;
2024-05-25 16:31:32 -06:00
Torch::Endianness mEndianness = Torch::Endianness::Native;
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>
2023-11-15 15:11:15 -06:00
};
} // namespace LUS