-Moved over LoadFirmware function from gtk code to emulator core. Yet another function that should be portable

This commit is contained in:
cyberwarriorx 2006-10-15 22:08:43 +00:00
parent b8a4e56b98
commit a193d47deb
2 changed files with 26 additions and 0 deletions

View File

@ -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;
}

View File

@ -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)
{