mirror of
https://github.com/libretro/beetle-gba-libretro.git
synced 2024-11-23 16:30:11 +00:00
Make need_fullpath = false
This commit is contained in:
parent
105c84037c
commit
345cde451e
67
libretro.cpp
67
libretro.cpp
@ -713,27 +713,7 @@ static void RedoColorMap(const MDFN_PixelFormat &format)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool TestMagic(const char *name, MDFNFILE *fp) MDFN_COLD;
|
||||
static bool TestMagic(const char *name, MDFNFILE *fp)
|
||||
{
|
||||
if(!memcmp(GET_FDATA_PTR(fp), "PSF\x22", 4))
|
||||
return(TRUE);
|
||||
|
||||
if(!strcasecmp(GET_FEXTS_PTR(fp), "gba") || !strcasecmp(GET_FEXTS_PTR(fp), "agb"))
|
||||
return(TRUE);
|
||||
|
||||
if(GET_FSIZE_PTR(fp) >= 192 && !strcasecmp(GET_FEXTS_PTR(fp), "bin"))
|
||||
{
|
||||
if((GET_FDATA_PTR(fp)[0xb2] == 0x96 && GET_FDATA_PTR(fp)[0xb3] == 0x00) ||
|
||||
(GET_FDATA_PTR(fp)[0] == 0x2E && GET_FDATA_PTR(fp)[3] == 0xEA))
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
static int Load(const char *name, MDFNFILE *fp) MDFN_COLD;
|
||||
static int Load(const char *name, MDFNFILE *fp)
|
||||
static int Load(const uint8_t *data, size_t size)
|
||||
{
|
||||
layerSettings = 0xFF00;
|
||||
|
||||
@ -750,7 +730,6 @@ static int Load(const char *name, MDFNFILE *fp)
|
||||
|
||||
|
||||
{
|
||||
uint32 size = GET_FSIZE_PTR(fp);
|
||||
uint8 *whereToLoad;
|
||||
|
||||
if(cpuIsMultiBoot)
|
||||
@ -766,15 +745,15 @@ static int Load(const char *name, MDFNFILE *fp)
|
||||
size = 0x2000000;
|
||||
}
|
||||
|
||||
memcpy(whereToLoad, GET_FDATA_PTR(fp), size);
|
||||
memcpy(whereToLoad, data, size);
|
||||
|
||||
md5_context md5;
|
||||
md5.starts();
|
||||
md5.update(GET_FDATA_PTR(fp), size);
|
||||
md5.update(data, size);
|
||||
md5.finish(MDFNGameInfo->MD5);
|
||||
|
||||
MDFN_printf(_("ROM: %dKiB\n"), (size + 1023) / 1024);
|
||||
MDFN_printf(_("ROM CRC32: 0x%08x\n"), (unsigned int)crc32(0, GET_FDATA_PTR(fp), size));
|
||||
MDFN_printf(_("ROM CRC32: 0x%08x\n"), (unsigned int)crc32(0, data, size));
|
||||
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
|
||||
|
||||
uint16 *temp = (uint16 *)(rom+((size+1)&~1));
|
||||
@ -3623,7 +3602,8 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
|
||||
check_variables();
|
||||
|
||||
game = MDFNI_LoadGame(MEDNAFEN_CORE_NAME_MODULE, info->path);
|
||||
MDFN_printf("Loading %s\n", info->path);
|
||||
game = MDFNI_LoadGame(MEDNAFEN_CORE_NAME_MODULE, (const uint8_t *)info->data, info->size);
|
||||
if (!game)
|
||||
return false;
|
||||
|
||||
@ -3828,7 +3808,7 @@ void retro_get_system_info(struct retro_system_info *info)
|
||||
#define GIT_VERSION ""
|
||||
#endif
|
||||
info->library_version = MEDNAFEN_CORE_VERSION GIT_VERSION;
|
||||
info->need_fullpath = true;
|
||||
info->need_fullpath = false;
|
||||
info->valid_extensions = MEDNAFEN_CORE_EXTENSIONS;
|
||||
info->block_extract = false;
|
||||
}
|
||||
@ -4071,44 +4051,15 @@ void MDFN_ResetMessages(void)
|
||||
}
|
||||
|
||||
|
||||
MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name)
|
||||
MDFNGI *MDFNI_LoadGame(const char *force_module, const uint8_t *data, size_t size)
|
||||
{
|
||||
MDFNFILE GameFile;
|
||||
std::vector<FileExtensionSpecStruct> valid_iae;
|
||||
MDFNGameInfo = &EmulatedGBA;
|
||||
|
||||
MDFN_printf(_("Loading %s...\n"),name);
|
||||
|
||||
MDFN_indent(1);
|
||||
|
||||
// Construct a NULL-delimited list of known file extensions for MDFN_fopen()
|
||||
const FileExtensionSpecStruct *curexts = KnownExtensions;
|
||||
|
||||
while(curexts->extension && curexts->description)
|
||||
{
|
||||
valid_iae.push_back(*curexts);
|
||||
curexts++;
|
||||
}
|
||||
|
||||
if(!GameFile.Open(name, &valid_iae[0], _("game")))
|
||||
{
|
||||
MDFNGameInfo = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MDFN_printf(_("Using module: gba\n\n"));
|
||||
MDFN_indent(1);
|
||||
|
||||
//
|
||||
// Load per-game settings
|
||||
//
|
||||
// Maybe we should make a "pgcfg" subdir, and automatically load all files in it?
|
||||
// End load per-game settings
|
||||
//
|
||||
|
||||
if(Load(name, &GameFile) <= 0)
|
||||
if(Load(data, size) <= 0)
|
||||
{
|
||||
GameFile.Close();
|
||||
MDFN_indent(-2);
|
||||
MDFNGameInfo = NULL;
|
||||
return(0);
|
||||
|
@ -23,7 +23,7 @@ uint32 MDFND_GetTime(void);
|
||||
void MDFND_Sleep(uint32 ms);
|
||||
|
||||
/* path = path of game/file to load. returns NULL on failure. */
|
||||
MDFNGI *MDFNI_LoadGame(const char *force_module, const char *path);
|
||||
MDFNGI *MDFNI_LoadGame(const char *force_module, const uint8_t *data, size_t size);
|
||||
|
||||
MDFNGI *MDFNI_LoadCD(const char *sysname, const char *devicename);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user