mirror of
https://github.com/libretro/beetle-saturn-libretro.git
synced 2024-11-23 09:19:49 +00:00
Standardize some more
This commit is contained in:
parent
7b56be1118
commit
d5e357b9c9
20
disc.cpp
20
disc.cpp
@ -285,7 +285,7 @@ void disc_init( retro_environment_t environ_cb )
|
||||
environ_cb( RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_interface );
|
||||
}
|
||||
|
||||
void disc_calcgameid( uint8* id_out16, uint8* fd_id_out16, char* sgid )
|
||||
static void CalcGameID( uint8* id_out16, uint8* fd_id_out16, char* sgid )
|
||||
{
|
||||
md5_context mctx;
|
||||
uint8_t buf[2048];
|
||||
@ -347,7 +347,7 @@ void disc_calcgameid( uint8* id_out16, uint8* fd_id_out16, char* sgid )
|
||||
mctx.finish(id_out16);
|
||||
}
|
||||
|
||||
void disc_cleanup()
|
||||
void disc_cleanup(void)
|
||||
{
|
||||
for(unsigned i = 0; i < CDInterfaces.size(); i++) {
|
||||
delete CDInterfaces[i];
|
||||
@ -357,7 +357,7 @@ void disc_cleanup()
|
||||
g_current_disc = 0;
|
||||
}
|
||||
|
||||
bool disc_detect_region( unsigned* region )
|
||||
bool DetectRegion( unsigned* region )
|
||||
{
|
||||
uint8_t *buf = new uint8[2048 * 16];
|
||||
uint64 possible_regions = 0;
|
||||
@ -400,7 +400,7 @@ bool disc_detect_region( unsigned* region )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool disc_test()
|
||||
bool DiscSanityChecks(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -481,9 +481,9 @@ bool disc_test()
|
||||
|
||||
break;
|
||||
|
||||
}; // for each track
|
||||
} // for each track
|
||||
|
||||
}; // for each disc
|
||||
} // for each disc
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -500,9 +500,8 @@ bool disc_load_content( MDFNGI* game_interface, const char* content_name, uint8*
|
||||
{
|
||||
disc_cleanup();
|
||||
|
||||
if ( !content_name ) {
|
||||
if ( !content_name )
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 LayoutMD5[ 16 ];
|
||||
|
||||
@ -510,8 +509,7 @@ bool disc_load_content( MDFNGI* game_interface, const char* content_name, uint8*
|
||||
|
||||
try
|
||||
{
|
||||
size_t content_name_len;
|
||||
content_name_len = strlen( content_name );
|
||||
size_t content_name_len = strlen( content_name );
|
||||
if ( content_name_len > 4 )
|
||||
{
|
||||
const char* content_ext = content_name + content_name_len - 4;
|
||||
@ -586,7 +584,7 @@ bool disc_load_content( MDFNGI* game_interface, const char* content_name, uint8*
|
||||
|
||||
memcpy( game_interface->MD5, LayoutMD5, 16 );
|
||||
|
||||
disc_calcgameid( game_interface->MD5, fd_id, sgid );
|
||||
CalcGameID( game_interface->MD5, fd_id, sgid );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
4
disc.h
4
disc.h
@ -11,9 +11,9 @@ void disc_init( retro_environment_t environ_cb );
|
||||
|
||||
void disc_cleanup(void);
|
||||
|
||||
bool disc_detect_region( unsigned* region );
|
||||
bool DetectRegion( unsigned* region );
|
||||
|
||||
bool disc_test();
|
||||
bool DiscSanityChecks(void);
|
||||
|
||||
void disc_select( unsigned disc_num );
|
||||
|
||||
|
61
libretro.cpp
61
libretro.cpp
@ -436,15 +436,11 @@ static void check_variables(bool startup)
|
||||
|
||||
static bool MDFNI_LoadGame( const char *name )
|
||||
{
|
||||
unsigned cpucache_emumode;
|
||||
unsigned horrible_hacks = 0;
|
||||
int cart_type;
|
||||
unsigned region;
|
||||
|
||||
unsigned horrible_hacks = 0;
|
||||
// .. safe defaults
|
||||
region = SMPC_AREA_NA;
|
||||
cart_type = CART_BACKUP_MEM;
|
||||
cpucache_emumode = CPUCACHE_EMUMODE_DATA;
|
||||
unsigned region = SMPC_AREA_NA;
|
||||
int cart_type = CART_BACKUP_MEM;
|
||||
unsigned cpucache_emumode = CPUCACHE_EMUMODE_DATA;
|
||||
|
||||
// always set this.
|
||||
MDFNGameInfo = &EmulatedSS;
|
||||
@ -471,56 +467,51 @@ static bool MDFNI_LoadGame( const char *name )
|
||||
log_cb(RETRO_LOG_INFO, "Game ID is: %s\n", sgid );
|
||||
|
||||
// test discs?
|
||||
bool discs_ok;
|
||||
if ( setting_disc_test ) {
|
||||
discs_ok = disc_test();
|
||||
} else {
|
||||
discs_ok = true; // OK!
|
||||
}
|
||||
bool discs_ok = true;
|
||||
if ( setting_disc_test )
|
||||
discs_ok = DiscSanityChecks();
|
||||
|
||||
if ( discs_ok )
|
||||
{
|
||||
disc_detect_region( ®ion );
|
||||
DetectRegion( ®ion );
|
||||
|
||||
DB_Lookup(nullptr, sgid, fd_id, ®ion, &cart_type, &cpucache_emumode );
|
||||
horrible_hacks = DB_LookupHH(sgid, fd_id);
|
||||
|
||||
// forced region setting?
|
||||
if ( setting_region != 0 ) {
|
||||
if ( setting_region != 0 )
|
||||
region = setting_region;
|
||||
}
|
||||
|
||||
// forced cartridge setting?
|
||||
if ( setting_cart != CART__RESERVED ) {
|
||||
if ( setting_cart != CART__RESERVED )
|
||||
cart_type = setting_cart;
|
||||
}
|
||||
|
||||
// GO!
|
||||
if ( InitCommon( cpucache_emumode, horrible_hacks, cart_type, region ) )
|
||||
if ( InitCommon( cpucache_emumode,
|
||||
horrible_hacks, cart_type, region ) )
|
||||
{
|
||||
MDFN_LoadGameCheats(NULL);
|
||||
MDFNMP_InstallReadPatches();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// OK it's really bad. Probably don't have a BIOS if InitCommon
|
||||
// fails. We can't continue as an emulator and will show a blank
|
||||
// screen.
|
||||
|
||||
disc_cleanup();
|
||||
// OK it's really bad. Probably don't
|
||||
// have a BIOS if InitCommon
|
||||
// fails. We can't continue as an
|
||||
// emulator and will show a blank
|
||||
// screen.
|
||||
|
||||
return false;
|
||||
}
|
||||
disc_cleanup();
|
||||
|
||||
}; // discs okay?
|
||||
return false;
|
||||
} // discs okay?
|
||||
|
||||
}; // load content
|
||||
} // load content
|
||||
|
||||
}; // supported extension?
|
||||
} // supported extension?
|
||||
|
||||
}; // valid name?
|
||||
} // valid name?
|
||||
|
||||
//
|
||||
// Drop to BIOS
|
||||
@ -528,14 +519,12 @@ static bool MDFNI_LoadGame( const char *name )
|
||||
disc_cleanup();
|
||||
|
||||
// forced region setting?
|
||||
if ( setting_region != 0 ) {
|
||||
if ( setting_region != 0 )
|
||||
region = setting_region;
|
||||
}
|
||||
|
||||
// forced cartridge setting?
|
||||
if ( setting_cart != CART__RESERVED ) {
|
||||
if ( setting_cart != CART__RESERVED )
|
||||
cart_type = setting_cart;
|
||||
}
|
||||
|
||||
// Initialise with safe parameters
|
||||
InitCommon( cpucache_emumode, horrible_hacks, cart_type, region );
|
||||
|
Loading…
Reference in New Issue
Block a user