mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 23:22:25 +01:00
byuu says: Basically just a project rename, with s/bsnes/higan and the new icon from lowkee added in. It won't compile on Windows because I forgot to update the resource.rc file, and a path transform command isn't working on Windows. It was really just meant as a starting point, so that v091 WIPs can flow starting from .00 with the new name (it overshadows bsnes v091, so publicly speaking this "shouldn't exist" and will probably be deleted from Google Code when v092 is ready.)
83 lines
1.5 KiB
C++
Executable File
83 lines
1.5 KiB
C++
Executable File
#include <fc/fc.hpp>
|
|
|
|
namespace Famicom {
|
|
|
|
#include "chip/chip.cpp"
|
|
#include "board/board.cpp"
|
|
Cartridge cartridge;
|
|
|
|
void Cartridge::Main() {
|
|
cartridge.main();
|
|
}
|
|
|
|
void Cartridge::main() {
|
|
board->main();
|
|
}
|
|
|
|
void Cartridge::load(const string &manifest) {
|
|
information.markup = manifest;
|
|
|
|
Board::load(manifest); //this call will set Cartridge::board if successful
|
|
if(board == nullptr) return;
|
|
|
|
sha256_ctx sha;
|
|
uint8 hash[32];
|
|
sha256_init(&sha);
|
|
sha256_chunk(&sha, board->prgrom.data, board->prgrom.size);
|
|
sha256_chunk(&sha, board->chrrom.data, board->chrrom.size);
|
|
sha256_final(&sha);
|
|
sha256_hash(&sha, hash);
|
|
string result;
|
|
for(auto &byte : hash) result.append(hex<2>(byte));
|
|
sha256 = result;
|
|
|
|
system.load();
|
|
loaded = true;
|
|
}
|
|
|
|
void Cartridge::unload() {
|
|
if(loaded == false) return;
|
|
loaded = false;
|
|
memory.reset();
|
|
}
|
|
|
|
void Cartridge::power() {
|
|
board->power();
|
|
}
|
|
|
|
void Cartridge::reset() {
|
|
create(Cartridge::Main, 21477272);
|
|
board->reset();
|
|
}
|
|
|
|
Cartridge::Cartridge() {
|
|
loaded = false;
|
|
}
|
|
|
|
uint8 Cartridge::prg_read(unsigned addr) {
|
|
return board->prg_read(addr);
|
|
}
|
|
|
|
void Cartridge::prg_write(unsigned addr, uint8 data) {
|
|
return board->prg_write(addr, data);
|
|
}
|
|
|
|
uint8 Cartridge::chr_read(unsigned addr) {
|
|
return board->chr_read(addr);
|
|
}
|
|
|
|
void Cartridge::chr_write(unsigned addr, uint8 data) {
|
|
return board->chr_write(addr, data);
|
|
}
|
|
|
|
void Cartridge::scanline(unsigned y) {
|
|
return board->scanline(y);
|
|
}
|
|
|
|
void Cartridge::serialize(serializer &s) {
|
|
Thread::serialize(s);
|
|
return board->serialize(s);
|
|
}
|
|
|
|
}
|