-Moved over LoadFirmware function from gtk code to emulator core. Yet another function that should be portable
This commit is contained in:
parent
b8a4e56b98
commit
a193d47deb
|
@ -413,3 +413,28 @@ int NDS_WriteBMP(const char *filename)
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int NDS_LoadFirmware(const char *filename)
|
||||
{
|
||||
int i;
|
||||
long size;
|
||||
FILE *file;
|
||||
|
||||
if ((file = fopen(filename, "rb")) == NULL)
|
||||
return -1;
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
if(size > MMU.fw.size)
|
||||
{
|
||||
fclose(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
i = fread(MMU.fw.data, size, 1, file);
|
||||
fclose(file);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -194,6 +194,7 @@ void NDS_FreeROM(void);
|
|||
void NDS_Reset(void);
|
||||
|
||||
int NDS_WriteBMP(const char *filename);
|
||||
int NDS_LoadFirmware(const char *filename);
|
||||
|
||||
static INLINE void NDS_ARM9HBlankInt(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue