Added the ROM class to manage the state of the users ROMs

This commit is contained in:
scawful
2022-06-09 18:00:02 -04:00
parent d11d7c8ef7
commit b800c6721b
2 changed files with 68 additions and 0 deletions

View File

@@ -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<char> contents((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
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);
}
}
}
}