2018-02-21 00:12:09 +00:00
|
|
|
namespace Heuristics {
|
|
|
|
|
2018-03-05 22:42:10 +00:00
|
|
|
struct Famicom {
|
2018-02-21 00:12:09 +00:00
|
|
|
Famicom(vector<uint8_t>& data, string location);
|
|
|
|
explicit operator bool() const;
|
|
|
|
auto manifest() const -> string;
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<uint8_t>& data;
|
|
|
|
string location;
|
2015-08-21 11:29:53 +00:00
|
|
|
};
|
|
|
|
|
2018-02-21 00:12:09 +00:00
|
|
|
Famicom::Famicom(vector<uint8_t>& data, string location) : data(data), location(location) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Famicom::operator bool() const {
|
|
|
|
if(data.size() < 16) return false;
|
|
|
|
if(data[0] != 'N') return false;
|
|
|
|
if(data[1] != 'E') return false;
|
|
|
|
if(data[2] != 'S') return false;
|
|
|
|
if(data[3] != 26) return false;
|
|
|
|
return true;
|
|
|
|
}
|
2015-08-21 11:29:53 +00:00
|
|
|
|
2018-02-21 00:12:09 +00:00
|
|
|
auto Famicom::manifest() const -> string {
|
|
|
|
if(!operator bool()) return {};
|
2015-08-21 11:29:53 +00:00
|
|
|
|
2018-02-21 00:12:09 +00:00
|
|
|
uint mapper = ((data[7] >> 4) << 4) | (data[6] >> 4);
|
|
|
|
uint mirror = ((data[6] & 0x08) >> 2) | (data[6] & 0x01);
|
|
|
|
uint prgrom = data[4] * 0x4000;
|
|
|
|
uint chrrom = data[5] * 0x2000;
|
|
|
|
uint prgram = 0u;
|
|
|
|
uint chrram = chrrom == 0u ? 8192u : 0u;
|
|
|
|
|
|
|
|
string output;
|
|
|
|
output.append("game\n");
|
Update to v106r59 release.
byuu says:
Changelog:
- fixed bug in Emulator::Game::Memory::operator bool()
- nall: renamed view<string> back to `string_view`
- nall:: implemented `array_view`
- Game Boy: split cartridge-specific input mappings (rumble,
accelerometer) to their own separate ports
- Game Boy: fixed MBC7 accelerometer x-axis
- icarus: Game Boy, Super Famicom, Mega Drive cores output internal
header game titles to heuristics manifests
- higan, icarus, hiro/gtk: improve viewport geometry configuration;
fixed higan crashing bug with XShm driver
- higan: connect Video::poll(),update() functionality
- hiro, ruby: several compilation / bugfixes, should get the macOS
port compiling again, hopefully [Sintendo]
- ruby/video/xshm: fix crashing bug on window resize
- a bit hacky; it's throwing BadAccess Xlib warnings, but they're
not fatal, so I am catching and ignoring them
- bsnes: removed Application::Windows::onModalChange hook that's no
longer needed [Screwtape]
2018-08-26 06:49:54 +00:00
|
|
|
output.append(" sha256: ", Hash::SHA256({&data[16], data.size() - 16}).digest(), "\n");
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" label: ", Location::prefix(location), "\n");
|
|
|
|
output.append(" name: ", Location::prefix(location), "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
|
|
|
|
switch(mapper) {
|
|
|
|
default:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-NROM-256\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-SXROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=MMC1B2\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-UOROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-CNROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
//MMC3
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-TLROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=MMC3B\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
//MMC6
|
2018-03-14 03:51:35 +00:00
|
|
|
//output.append(" board: NES-HKROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
//output.append(" chip type=MMC6\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
//prgram = 1024;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-ELROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=MMC5\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 65536;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-AOROM\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 9:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-PNROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=MMC2\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-FKROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=MMC4\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: BANDAI-FCG\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=LZ93D50\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
|
|
|
case 23:
|
|
|
|
case 25:
|
|
|
|
//VRC4
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-4\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC4\n");
|
|
|
|
output.append(" pinout a0=1 a1=0\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 22:
|
|
|
|
//VRC2
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-2\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC2\n");
|
|
|
|
output.append(" pinout a0=0 a1=1\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 24:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-6\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC6\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 26:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-6\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC6\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 34:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-BNROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 66:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: NES-GNROM\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 69:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: SUNSOFT-5B\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=5B\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 73:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-3\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC3\n");
|
|
|
|
output.append(" mirror mode=", mirror == 0 ? "horizontal" : "vertical", "\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 75:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-1\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC1\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 85:
|
2018-03-14 03:51:35 +00:00
|
|
|
output.append(" board: KONAMI-VRC-7\n");
|
2018-02-21 00:12:09 +00:00
|
|
|
output.append(" chip type=VRC7\n");
|
2015-08-21 11:29:53 +00:00
|
|
|
prgram = 8192;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-08 23:50:42 +00:00
|
|
|
if(prgrom) output.append(Memory{}.type("ROM").size(prgrom).content("Program").text());
|
2018-04-15 05:49:53 +00:00
|
|
|
if(prgram) output.append(Memory{}.type("RAM").size(prgram).content("Save").text());
|
2018-02-21 00:12:09 +00:00
|
|
|
|
2018-04-08 23:50:42 +00:00
|
|
|
if(chrrom) output.append(Memory{}.type("ROM").size(chrrom).content("Character").text());
|
2018-04-15 05:49:53 +00:00
|
|
|
if(chrram) output.append(Memory{}.type("RAM").size(chrram).content("Character").isVolatile().text());
|
2018-02-21 00:12:09 +00:00
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
2015-08-21 11:29:53 +00:00
|
|
|
|
|
|
|
}
|