diff --git a/src/Application/Utils/ROM.cc b/src/Application/Utils/ROM.cc new file mode 100644 index 00000000..a782589f --- /dev/null +++ b/src/Application/Utils/ROM.cc @@ -0,0 +1,34 @@ +#include "ROM.h" + +namespace yaze { +namespace Application { +namespace Utils { + +void ROM::LoadFromFile(const std::string & path) { + + std::cout << "filename: " << path << std::endl; + std::ifstream stream(path, std::ios::in | std::ios::binary); + + if (!stream.good()) { + std::cout << "failure reading file" << std::endl; + return; + } + + std::vector contents((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); + + for(auto i: contents) { + int value = i; + std::cout << "data: " << value << std::endl; + } + + std::cout << "file size: " << contents.size() << std::endl; + + unsigned int uncompressed_data_size = 0; + unsigned int compressed_length = 0; + auto gfx_decompressed_data = alttp_compressor_.DecompressGfx(contents.data(), 0, contents.size(), &uncompressed_data_size, &compressed_length); + auto overworld_decompressed = alttp_compressor_.DecompressOverworld(contents.data(), 0, contents.size(), &uncompressed_data_size, &compressed_length); +} + +} +} +} \ No newline at end of file diff --git a/src/Application/Utils/ROM.h b/src/Application/Utils/ROM.h new file mode 100644 index 00000000..074a0f40 --- /dev/null +++ b/src/Application/Utils/ROM.h @@ -0,0 +1,34 @@ +#ifndef YAZE_APPLICATION_UTILS_ROM_H +#define YAZE_APPLICATION_UTILS_ROM_H + +#include +#include +#include +#include +#include +#include +#include + +#include "Compression.h" +#include "Core/Constants.h" + +namespace yaze { +namespace Application { +namespace Utils { + +class ROM { + public: + void LoadFromFile(const std::string & path); + + private: + std::vector original_rom_; + std::vector> working_rom_; + + ALTTPCompression alttp_compressor_; +}; + +} +} +} + +#endif \ No newline at end of file