Commit c16abcfb authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Add TODO/FIXME and cleanup handleInputFile

parent a266b4d5
Pipeline #52969 passed with stages
in 1 minute and 39 seconds
......@@ -224,6 +224,8 @@ void setupNGFfilename(void)
}
/* write all the dirty blocks out to a file */
/* TODO/FIXME - shouldn't this just go through libretro's get_memory_data
* interface instead? */
void writeSaveGameFile(void)
{
/* find the dirty blocks and write them to the .NGF file */
......
......@@ -213,38 +213,49 @@ static int strrchr2(const char *src, int c)
return 0;
}
#ifdef LOW_MEMORY
int handleInputFile(const char *romName,
const unsigned char *romData, int romSize)
{
FILE *romFile = NULL;
initSysInfo(); //initialize it all
if (romData)
//get ROM from binary ROM file
romFile = fopen(romName, "rb");
if(!romFile)
{
int size = romSize > MAINROM_SIZE_MAX ?
MAINROM_SIZE_MAX : romSize;
m_emuInfo.romSize = size;
memcpy(mainrom, romData, size);
strcpy(m_emuInfo.RomFileName, romName);
log_cb(RETRO_LOG_ERROR, "Couldn't open %s file\n", romName);
return 0;
}
else
{
FILE *romFile = NULL;
//get ROM from binary ROM file
romFile = fopen(romName, "rb");
if(!romFile)
{
log_cb(RETRO_LOG_ERROR, "Couldn't open %s file\n", romName);
return 0;
}
m_emuInfo.romSize = fread(mainrom, 1, MAINROM_SIZE_MAX, romFile);
strcpy(m_emuInfo.RomFileName, romName);
m_emuInfo.romSize = fread(mainrom, 1, MAINROM_SIZE_MAX, romFile);
strcpy(m_emuInfo.RomFileName, romName);
fclose(romFile);
fclose(romFile);
if (!initRom())
{
log_cb(RETRO_LOG_ERROR, "initRom couldn't handle %s file\n", romName);
return 0;
}
setFlashSize(m_emuInfo.romSize);
return 1;
}
#else
int handleInputFile(const char *romName,
const unsigned char *romData, int romSize)
{
int size;
initSysInfo(); //initialize it all
size = romSize > MAINROM_SIZE_MAX ?
MAINROM_SIZE_MAX : romSize;
m_emuInfo.romSize = size;
memcpy(mainrom, romData, size);
strcpy(m_emuInfo.RomFileName, romName);
if (!initRom())
{
log_cb(RETRO_LOG_ERROR, "initRom couldn't handle %s file\n", romName);
......@@ -254,3 +265,4 @@ int handleInputFile(const char *romName,
setFlashSize(m_emuInfo.romSize);
return 1;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment