Load non-printable or non-ASCII characters as '?'.

This commit is contained in:
unknown 2015-03-01 22:52:51 -05:00
parent 47b7e30c23
commit 16117e0e4c
1 changed files with 12 additions and 2 deletions

View File

@ -1732,8 +1732,18 @@ void CALL RomOpen (void)
// get the name of the ROM
for (int i=0; i<20; i++)
name[i] = gfx.HEADER[(32+i)^3];
name[20] = 0;
{
char ch;
const char invalid_ch = '?'; /* Some Japanese games use wide chars. */
ch = (char)gfx.HEADER[(32 + i) ^ 3];
if (ch < ' ')
ch = invalid_ch;
if (ch > '~')
ch = invalid_ch;
name[i] = ch;
}
name[20] = '\0';
// remove all trailing spaces
while (name[strlen(name)-1] == ' ')