fixed ROM file extension detection

This commit is contained in:
ekeeke31 2011-04-08 12:07:20 +00:00
parent cf7332859c
commit 8ef3139f9e
2 changed files with 8 additions and 3 deletions

View File

@ -291,8 +291,9 @@ int FileSelector(void)
{
/* get ROM filename without extension */
sprintf (text, "%s", filelist[selection].filename);
if (strlen(text) >= 4)
text[strlen(text) - 4] = 0;
int i = strlen(text) - 1;
while (i && (text[i] != '.')) i--;
if (i) text[i] = 0;
/* ROM database informations */
sprintf (fname, "%s/db/%s.xml", DEFAULT_PATH, text);
@ -471,6 +472,7 @@ int FileSelector(void)
/* clear selection by default */
selection = offset = 0;
old = -1;
/* select previous directory */
for (i=0; i<maxfiles; i++)
@ -534,6 +536,7 @@ int FileSelector(void)
/* clear selection by default */
selection = offset = 0;
old = -1;
}
else
{

View File

@ -218,7 +218,9 @@ void reloadrom (int size, char *name)
/* ROM filename without extension*/
sprintf(rom_filename,"%s",name);
rom_filename[strlen(rom_filename) - 4] = 0;
int i = strlen(rom_filename) - 1;
while (i && (rom_filename[i] != '.')) i--;
if (i) rom_filename[i] = 0;
if (hotswap)
{