diff --git a/source/fatmounter.c b/source/fatmounter.c index 6c87894d..f0858100 100644 --- a/source/fatmounter.c +++ b/source/fatmounter.c @@ -130,6 +130,7 @@ int isInserted( const char *path ) return __io_sdhc.isInserted() || __io_wiisd.isInserted(); } +static u8 sdIsInited = 0; int SDCard_Init() { #ifdef DEBUG_FAT @@ -142,6 +143,7 @@ int SDCard_Init() { fat_sd_mount = MOUNT_SD; fat_sd_sec = _FAT_startSector; + sdIsInited = 1; #ifdef DEBUG_FAT gprintf( ":1\n" ); #endif @@ -151,6 +153,7 @@ int SDCard_Init() { fat_sd_mount = MOUNT_SDHC; fat_sd_sec = _FAT_startSector; + sdIsInited = 1; #ifdef DEBUG_FAT gprintf( ":1\n" ); #endif @@ -165,13 +168,17 @@ int SDCard_Init() void SDCard_deInit() { #ifdef DEBUG_FAT - gprintf( "SDCard_deInit(): " ); + gprintf( "SDCard_deInit( %d ): ", sdIsInited ); #endif //closing all open Files write back the cache and then shutdown em! - fatUnmount( "SD:/" ); + if( sdIsInited ) + { + fatUnmount( "SD:/" ); - fat_sd_mount = MOUNT_NONE; - fat_sd_sec = 0; + fat_sd_mount = MOUNT_NONE; + fat_sd_sec = 0; + sdIsInited = 0; + } #ifdef DEBUG_FAT gprintf( "ok\n" ); #endif diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 4aed72c6..8f222366 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -1726,7 +1726,10 @@ void game_set( char *name, char *val ) } if ( strcmp( "returnTo", opt_name ) == 0 ) { - strlcpy( game->returnTo, opt_val, sizeof( game->returnTo ) ); + if ( sscanf( opt_val, "%hd", &opt_c ) == 1 ) + { + game->returnTo = opt_c; + } } } // next opt @@ -1893,7 +1896,7 @@ bool cfg_save_games() fprintf( f, "loadalternatedol:%d;", cfg_game[i].loadalternatedol ); fprintf( f, "alternatedolstart:%d;", cfg_game[i].alternatedolstart ); fprintf( f, "alternatedolname:%s;\n", cfg_game[i].alternatedolname ); - fprintf( f, "returnTo:%s;\n", cfg_game[i].returnTo ); + fprintf( f, "returnTo:%d;\n", cfg_game[i].returnTo ); } fprintf( f, "# END\n" ); fclose( f ); diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index c44bcdc9..4bd0d386 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -298,6 +298,7 @@ s32 Disc_IsWii( void ) s32 Disc_BootPartition( u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset, u32 returnTo ) { + gprintf("booting partition IOS %u v%u\n", IOS_GetVersion(), IOS_GetRevision() ); entry_point p_entry; s32 ret;