2013-02-20 19:52:52 -05:00
/ * RetroArch - A frontend for libretro .
2014-01-01 01:50:59 +01:00
* Copyright ( C ) 2013 -2014 - Jason Fetters
* Copyright ( C ) 2011 -2014 - Daniel De Matteis
2013-02-20 19:52:52 -05:00
*
* RetroArch is free software : you can redistribute it and / or modify it under the terms
* of the GNU General Public License as published by the Free Software Found -
* ation , either version 3 of the License , or ( at your option ) any later version .
*
* RetroArch is distributed in the hope that it will be useful , but WITHOUT ANY WARRANTY ;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE . See the GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along with RetroArch .
* If not , see < http : // www . gnu . org / licenses / > .
* /
2013-02-06 09:54:15 -05:00
2013-06-11 06:07:09 -04:00
# include < string . h >
2013-04-04 07:54:33 +02:00
2013-07-06 18:24:25 -04:00
# import "RetroArch_Apple.h"
2013-12-28 21:08:30 +01:00
# include "../../frontend/frontend.h"
2014-02-11 19:03:38 +11:00
# include "../../file.h"
2013-02-10 19:32:22 -05:00
2013-07-07 17:50:17 -04:00
id < RetroArch_Platform > apple_platform ;
2013-07-06 18:24:25 -04:00
2014-05-03 07:17:59 +02:00
void apple_rarch _exited ( void )
2013-12-24 14:21:57 -05:00
{
2014-07-20 07:00:02 +02:00
[ apple_platform unloadingCore ] ;
2013-12-24 14:21:57 -05:00
}
2014-07-24 04:32:46 +02:00
void apple_run _core ( int argc , char * * argv , const char * core ,
2014-07-24 03:42:03 +02:00
const char * file )
2013-07-06 18:24:25 -04:00
{
2014-07-24 03:42:03 +02:00
static char core_path [ PATH_MAX ] , file_path [ PATH_MAX ] ,
config_path [ PATH_MAX ] ;
2014-01-03 17:16:02 -05:00
2014-07-24 04:32:46 +02:00
[ apple_platform loadingCore : BOXSTRING ( core ) withFile : file ] ;
2014-07-24 03:42:03 +02:00
if ( file )
2014-01-03 17:16:02 -05:00
strlcpy ( file_path , file , sizeof ( file_path ) ) ;
2014-07-24 03:42:03 +02:00
if ( core )
2014-07-24 04:32:46 +02:00
strlcpy ( core_path , core , sizeof ( core_path ) ) ;
2014-07-24 03:42:03 +02:00
strlcpy ( config_path , g_defaults . config_path , sizeof ( config_path ) ) ;
2014-07-24 04:32:46 +02:00
if ( core_info _has _custom _config ( core ) )
core_info _get _custom _config ( core , config_path , sizeof ( config_path ) ) ;
2014-01-03 17:16:02 -05:00
2014-07-24 03:42:03 +02:00
static const char * const argv_game [ ] = { "retroarch" , "-c" , config_path , "-L" , core_path , file_path , 0 } ;
static const char * const argv_menu [ ] = { "retroarch" , "-c" , config_path , "--menu" , 0 } ;
if ( argc = = 0 )
argc = ( file && core ) ? 6 : 4 ;
if ( ! argv )
argv = ( char * * ) ( ( file && core ) ? argv_game : argv_menu ) ;
if ( rarch_main ( argc , argv ) )
{
char basedir [ 256 ] ;
fill_pathname _basedir ( basedir , file ? file : "" , sizeof ( basedir ) ) ;
if ( file && access ( basedir , R_OK | W_OK | X_OK ) )
apple_display _alert ( "The directory containing the selected file must have write permissions. This will prevent zipped content from loading, and will cause some cores to not function." , "Warning" ) ;
else
apple_display _alert ( "Failed to load content." , "Error" ) ;
apple_rarch _exited ( ) ;
}
2013-07-06 18:24:25 -04:00
}