#include #include Cartridge::Cartridge(std::ifstream& file) { _size = file.seekg(0, std::ios_base::end).tellg(); file.seekg(0, std::ios_base::beg); _data = new u8[_size]; file.read(reinterpret_cast(_data), _size); std::strncpy(_title, (char*)&_data[TITLE], 16); _title[16] = '\0'; } u8 Cartridge::operator[](size_t addr) { if(addr >= _size) return 0xFFu; return _data[addr]; }