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");
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
Update to v106r09 release.
byuu says:
Changelog:
- higan, icarus, genius: new manifest syntax (work in progress)
Pretty much only LoROM and HiROM SNES games will load right now, and RAM
will only work right if the save.ram file already exists to pull its
file size from (a temporary cheap hack was used.)
Basically, I'm just getting this out there for evaluation.
One minor errata is that I switched icarus to using “memory/battery” to
indicate battery-backed RAM, whereas genius still uses “memory/volatile”
to indicate non-battery-backed RAM.
I intend to make it “memory/battery” in genius, and have the field
auto-enable when RAM or RTC is selected for type (obviously allowing it
to be unchecked for volatile memory.)
I need to update all 64 production boards, and 25 of 29 generic boards,
to use the new slot syntax; and I also need to update every single core
in higan to use the new manifest game syntax. I want to build out a
generic manifest game parser that all emulation cores will use.
Once I finish this, I'll also need to write a database converter to
update all of my licensed game dumps to the new database syntax.
I also need to write up something for doc.byuu.org explaining the new
manifest game syntax. The manifest board syntax will still be “internal”
and subject to revisions, but once v107 is out, the gamepak manifest
format will be set in stone sans extensions.
2018-03-05 04:34:07 +00:00
|
|
|
if(prgrom) output.append(Memory{}.type("ROM").size(prgrom).category("Program").text());
|
|
|
|
if(prgram) output.append(Memory{}.type("RAM").size(prgram).category("Save").battery().text());
|
2018-02-21 00:12:09 +00:00
|
|
|
|
Update to v106r09 release.
byuu says:
Changelog:
- higan, icarus, genius: new manifest syntax (work in progress)
Pretty much only LoROM and HiROM SNES games will load right now, and RAM
will only work right if the save.ram file already exists to pull its
file size from (a temporary cheap hack was used.)
Basically, I'm just getting this out there for evaluation.
One minor errata is that I switched icarus to using “memory/battery” to
indicate battery-backed RAM, whereas genius still uses “memory/volatile”
to indicate non-battery-backed RAM.
I intend to make it “memory/battery” in genius, and have the field
auto-enable when RAM or RTC is selected for type (obviously allowing it
to be unchecked for volatile memory.)
I need to update all 64 production boards, and 25 of 29 generic boards,
to use the new slot syntax; and I also need to update every single core
in higan to use the new manifest game syntax. I want to build out a
generic manifest game parser that all emulation cores will use.
Once I finish this, I'll also need to write a database converter to
update all of my licensed game dumps to the new database syntax.
I also need to write up something for doc.byuu.org explaining the new
manifest game syntax. The manifest board syntax will still be “internal”
and subject to revisions, but once v107 is out, the gamepak manifest
format will be set in stone sans extensions.
2018-03-05 04:34:07 +00:00
|
|
|
if(chrrom) output.append(Memory{}.type("ROM").size(chrrom).category("Character").text());
|
|
|
|
if(chrram) output.append(Memory{}.type("RAM").size(chrram).category("Character").text());
|
2018-02-21 00:12:09 +00:00
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
2015-08-21 11:29:53 +00:00
|
|
|
|
|
|
|
}
|