Display internal ROM name in cover page

This commit is contained in:
Ilari Liusvaara 2013-01-08 06:56:11 +02:00
parent 97ceb2e3d0
commit 656df5d52c
2 changed files with 29 additions and 0 deletions

View file

@ -952,12 +952,25 @@ namespace
return r;
}
const char* hexes = "0123456789ABCDEF";
void redraw_cover_fbinfo()
{
for(size_t i = 0; i < sizeof(cover_fbmem) / sizeof(cover_fbmem[0]); i++)
cover_fbmem[i] = 0;
std::string ident = _bsnes_core.core_identifier();
cover_render_string(cover_fbmem, 0, 0, ident, 0x7FFFF, 0x00000, 512, 448, 2048, 4);
std::ostringstream name;
name << "Internal ROM name: ";
for(unsigned i = 0; i < 21; i++) {
unsigned busaddr = 0x00FFC0 + i;
unsigned char ch = SNES::bus.read(busaddr);
if(ch < 32 || ch > 126)
name << "<" << hexes[ch / 16] << hexes[ch % 16] << ">";
else
name << ch;
}
cover_render_string(cover_fbmem, 0, 16, name.str(), 0x7FFFF, 0x00000, 512, 448, 2048, 4);
}
/*

View file

@ -328,12 +328,28 @@ namespace
return s;
}
std::string get_cartridge_name()
{
std::ostringstream name;
if(romdata.size() < 0x200)
return ""; //Bad.
for(unsigned i = 0; i < 16; i++) {
if(romdata[0x134 + i])
name << (char)romdata[0x134 + i];
else
break;
}
return name.str();
}
void redraw_cover_fbinfo()
{
for(size_t i = 0; i < sizeof(cover_fbmem) / sizeof(cover_fbmem[0]); i++)
cover_fbmem[i] = 0x00000000;
std::string ident = _gambatte_core.core_identifier();
cover_render_string(cover_fbmem, 0, 0, ident, 0xFFFFFF, 0x00000, 480, 432, 1920, 4);
cover_render_string(cover_fbmem, 0, 16, "Internal ROM name: " + get_cartridge_name(),
0xFFFFFF, 0x00000, 480, 432, 1920, 4);
}
unsigned world_compatible[] = {0, UINT_MAX};