bs-memory.cpp 903 B

1234567891011121314151617181920212223242526272829
  1. struct BSMemory : Cartridge {
  2. auto name() -> string override { return "BS Memory"; }
  3. auto extensions() -> vector<string> override { return {"bs"}; }
  4. auto export(string location) -> vector<uint8_t> override;
  5. auto heuristics(vector<uint8_t>& data, string location) -> string override;
  6. };
  7. auto BSMemory::export(string location) -> vector<uint8_t> {
  8. vector<uint8_t> data;
  9. append(data, {location, "program.rom"});
  10. append(data, {location, "program.flash"});
  11. return data;
  12. }
  13. auto BSMemory::heuristics(vector<uint8_t>& data, string location) -> string {
  14. if(data.size() < 0x8000) return {};
  15. string s;
  16. s += "game\n";
  17. s +={" name: ", Media::name(location), "\n"};
  18. s +={" label: ", Media::name(location), "\n"};
  19. s += " board\n";
  20. s += " memory\n";
  21. s += " type: Flash\n";
  22. s +={" size: 0x", hex(data.size()), "\n"};
  23. s += " content: Program\n";
  24. return s;
  25. }