Cleanups - 80-char limit

This commit is contained in:
twinaphex 2014-09-02 17:42:44 +02:00
parent 76591ecc9f
commit bee41d6416
8 changed files with 270 additions and 133 deletions

View File

@ -119,7 +119,10 @@ void engine_handle_cmd(void *data)
/* The window is being hidden or closed, clean it up. */
/* terminate display/EGL context here */
//RARCH_WARN("Window is terminated outside PAUSED state.\n");
#if 0
RARCH_WARN("Window is terminated outside PAUSED state.\n");
#endif
android_app->window = NULL;
scond_broadcast(android_app->cond);
@ -129,16 +132,22 @@ void engine_handle_cmd(void *data)
case APP_CMD_GAINED_FOCUS:
g_extern.is_paused = false;
if ((android_app->sensor_state_mask & (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE))
&& android_app->accelerometerSensor == NULL && driver.input_data)
android_input_set_sensor_state(driver.input_data, 0, RETRO_SENSOR_ACCELEROMETER_ENABLE,
if ((android_app->sensor_state_mask
& (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE))
&& android_app->accelerometerSensor == NULL
&& driver.input_data)
android_input_set_sensor_state(driver.input_data, 0,
RETRO_SENSOR_ACCELEROMETER_ENABLE,
android_app->accelerometer_event_rate);
break;
case APP_CMD_LOST_FOCUS:
// Avoid draining battery while app is not being used
if ((android_app->sensor_state_mask & (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE))
&& android_app->accelerometerSensor != NULL && driver.input_data)
android_input_set_sensor_state(driver.input_data, 0, RETRO_SENSOR_ACCELEROMETER_DISABLE,
/* Avoid draining battery while app is not being used. */
if ((android_app->sensor_state_mask
& (1ULL << RETRO_SENSOR_ACCELEROMETER_ENABLE))
&& android_app->accelerometerSensor != NULL
&& driver.input_data)
android_input_set_sensor_state(driver.input_data, 0,
RETRO_SENSOR_ACCELEROMETER_DISABLE,
android_app->accelerometer_event_rate);
break;
@ -205,7 +214,8 @@ static void android_app_set_activity_state(void *data, int8_t cmd)
slock_lock(android_app->mutex);
android_app_write_cmd(android_app, cmd);
while (android_app->activityState != cmd && android_app->activityState != APP_CMD_DEAD)
while (android_app->activityState != cmd
&& android_app->activityState != APP_CMD_DEAD)
scond_wait(android_app->cond, android_app->mutex);
slock_unlock(android_app->mutex);
@ -235,30 +245,35 @@ static void onDestroy(ANativeActivity* activity)
static void onStart(ANativeActivity* activity)
{
RARCH_LOG("Start: %p\n", activity);
android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_START);
android_app_set_activity_state((struct android_app*)
activity->instance, APP_CMD_START);
}
static void onResume(ANativeActivity* activity)
{
RARCH_LOG("Resume: %p\n", activity);
android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_RESUME);
android_app_set_activity_state((struct android_app*)
activity->instance, APP_CMD_RESUME);
}
static void onPause(ANativeActivity* activity)
{
RARCH_LOG("Pause: %p\n", activity);
android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_PAUSE);
android_app_set_activity_state((struct android_app*)
activity->instance, APP_CMD_PAUSE);
}
static void onStop(ANativeActivity* activity)
{
RARCH_LOG("Stop: %p\n", activity);
android_app_set_activity_state((struct android_app*)activity->instance, APP_CMD_STOP);
android_app_set_activity_state((struct android_app*)
activity->instance, APP_CMD_STOP);
}
static void onConfigurationChanged(ANativeActivity *activity)
{
struct android_app* android_app = (struct android_app*)activity->instance;
struct android_app* android_app = (struct android_app*)
activity->instance;
if (!android_app)
return;
@ -274,13 +289,15 @@ static void onWindowFocusChanged(ANativeActivity* activity, int focused)
focused ? APP_CMD_GAINED_FOCUS : APP_CMD_LOST_FOCUS);
}
static void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window)
static void onNativeWindowCreated(ANativeActivity* activity,
ANativeWindow* window)
{
RARCH_LOG("NativeWindowCreated: %p -- %p\n", activity, window);
android_app_set_window((struct android_app*)activity->instance, window);
}
static void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* window)
static void onNativeWindowDestroyed(ANativeActivity* activity,
ANativeWindow* window)
{
RARCH_LOG("NativeWindowDestroyed: %p -- %p\n", activity, window);
android_app_set_window((struct android_app*)activity->instance, NULL);
@ -292,7 +309,8 @@ static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue)
android_app_set_input((struct android_app*)activity->instance, queue);
}
static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue)
static void onInputQueueDestroyed(ANativeActivity* activity,
AInputQueue* queue)
{
RARCH_LOG("InputQueueDestroyed: %p -- %p\n", activity, queue);
android_app_set_input((struct android_app*)activity->instance, NULL);
@ -356,8 +374,10 @@ void ANativeActivity_onCreate(ANativeActivity* activity,
activity->callbacks->onInputQueueCreated = onInputQueueCreated;
activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed;
// these are set only for the native activity, and are reset when it ends
ANativeActivity_setWindowFlags(activity, AWINDOW_FLAG_KEEP_SCREEN_ON | AWINDOW_FLAG_FULLSCREEN, 0);
/* These are set only for the native activity,
* and are reset when it ends. */
ANativeActivity_setWindowFlags(activity, AWINDOW_FLAG_KEEP_SCREEN_ON
| AWINDOW_FLAG_FULLSCREEN, 0);
if (pthread_key_create(&thread_key, jni_thread_destruct))
RARCH_ERR("Error initializing pthread_key\n");
@ -385,7 +405,7 @@ void ANativeActivity_onCreate(ANativeActivity* activity,
android_app->thread = sthread_create(android_app_entry, android_app);
// Wait for thread to start.
/* Wait for thread to start. */
slock_lock(android_app->mutex);
while (!android_app->running)
scond_wait(android_app->cond, android_app->mutex);
@ -401,7 +421,7 @@ static bool android_run_events(void *data)
if (id == LOOPER_ID_MAIN)
engine_handle_cmd(driver.input_data);
// Check if we are exiting.
/* Check if we are exiting. */
if (g_extern.system.shutdown)
return false;
@ -443,8 +463,8 @@ static bool device_is_game_console(const char *name)
}
static void frontend_android_get_environment_settings(int *argc, char *argv[],
void *data, void *params_data)
static void frontend_android_get_environment_settings(int *argc,
char *argv[], void *data, void *params_data)
{
char device_model[PROP_VALUE_MAX], device_id[PROP_VALUE_MAX];
@ -474,7 +494,8 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
RARCH_LOG("Checking arguments passed from intent ...\n");
// Config file
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "CONFIGFILE"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "CONFIGFILE"));
if (android_app->getStringExtra && jstr)
{
@ -493,17 +514,22 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
}
// Current IME
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "IME"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "IME"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
strlcpy(android_app->current_ime, argv, sizeof(android_app->current_ime));
strlcpy(android_app->current_ime, argv,
sizeof(android_app->current_ime));
(*env)->ReleaseStringUTFChars(env, jstr, argv);
RARCH_LOG("Current IME: [%s].\n", android_app->current_ime);
}
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "USED"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "USED"));
if (android_app->getStringExtra && jstr)
{
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
@ -514,7 +540,8 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
}
// LIBRETRO
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "LIBRETRO"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "LIBRETRO"));
if (android_app->getStringExtra && jstr)
{
@ -532,7 +559,8 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
}
// Content
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "ROM"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "ROM"));
if (android_app->getStringExtra && jstr)
{
@ -554,7 +582,8 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
}
// Content
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra, (*env)->NewStringUTF(env, "DATADIR"));
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
(*env)->NewStringUTF(env, "DATADIR"));
if (android_app->getStringExtra && jstr)
{
@ -572,14 +601,22 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
RARCH_LOG("Data path: [%s].\n", path);
if (args && *path)
{
fill_pathname_join(g_defaults.savestate_dir, path, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, path, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, path, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.shader_dir, path, "shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, path, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.core_dir, path, "cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, path, "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.autoconfig_dir, path, "autoconfig", sizeof(g_defaults.autoconfig_dir));
fill_pathname_join(g_defaults.savestate_dir, path,
"savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, path,
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, path,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.shader_dir, path,
"shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, path,
"overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.core_dir, path,
"cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir,
path, "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.autoconfig_dir,
path, "autoconfig", sizeof(g_defaults.autoconfig_dir));
}
}
}
@ -603,9 +640,10 @@ static void frontend_android_get_environment_settings(int *argc, char *argv[],
else if (!strcmp(device_model, "JSS15J"))
g_defaults.settings.video_refresh_rate = 59.65;
//FIXME - needs to be refactored
/* FIXME - needs to be refactored */
#if 0
// Explicitly disable input overlay by default for gamepad-like/console devices
/* Explicitly disable input overlay by default
* for gamepad-like/console devices. */
if (device_is_game_console(device_model))
g_defaults.settings.input_overlay_enable = false;
#endif
@ -628,7 +666,9 @@ static void process_pending_intent(void *data)
return;
// Content
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz, android_app->getPendingIntentFullPath);
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz,
android_app->getPendingIntentFullPath);
JNI_EXCEPTION(env);
RARCH_LOG("Checking arguments passed from intent ...\n");
if (android_app->getPendingIntentFullPath && jstr)
@ -642,7 +682,9 @@ static void process_pending_intent(void *data)
}
// Config file
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz, android_app->getPendingIntentConfigPath);
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz,
android_app->getPendingIntentConfigPath);
JNI_EXCEPTION(env);
if (android_app->getPendingIntentConfigPath && jstr)
{
@ -654,7 +696,9 @@ static void process_pending_intent(void *data)
}
// Current IME
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz, android_app->getPendingIntentIME);
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz,
android_app->getPendingIntentIME);
JNI_EXCEPTION(env);
if (android_app->getPendingIntentIME && jstr)
{
@ -666,7 +710,9 @@ static void process_pending_intent(void *data)
}
//LIBRETRO
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz, android_app->getPendingIntentLibretroPath);
jstr = (*env)->CallObjectMethod(env, android_app->activity->clazz,
android_app->getPendingIntentLibretroPath);
JNI_EXCEPTION(env);
if (android_app->getPendingIntentLibretroPath && jstr)
{
@ -684,14 +730,17 @@ static void process_pending_intent(void *data)
rarch_main_command(RARCH_CMD_LOAD_CONTENT);
}
CALL_VOID_METHOD(env, android_app->activity->clazz, android_app->clearPendingIntent);
CALL_VOID_METHOD(env, android_app->activity->clazz,
android_app->clearPendingIntent);
}
#endif
static int frontend_android_process_events(void *data)
{
//jboolean hasPendingIntent;
//JNIEnv *env;
#if 0
jboolean hasPendingIntent;
JNIEnv *env;
#endif
struct android_app* android_app = (struct android_app*)data;
if (g_extern.is_paused)
@ -702,7 +751,9 @@ static int frontend_android_process_events(void *data)
if (!env)
return -1;
CALL_BOOLEAN_METHOD(env, hasPendingIntent, android_app->activity->clazz, android_app->hasPendingIntent);
CALL_BOOLEAN_METHOD(env, hasPendingIntent, android_app->activity->clazz,
android_app->hasPendingIntent);
if (hasPendingIntent)
process_pending_intent(android_app);
#endif
@ -722,7 +773,8 @@ static void frontend_android_init(void *data)
return;
looper = (ALooper*)ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL, NULL);
ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN,
ALOOPER_EVENT_INPUT, NULL, NULL);
android_app->looper = looper;
slock_lock(android_app->mutex);
@ -752,24 +804,34 @@ static void frontend_android_init(void *data)
return;
GET_OBJECT_CLASS(env, class, android_app->activity->clazz);
GET_METHOD_ID(env, android_app->getIntent, class, "getIntent", "()Landroid/content/Intent;");
GET_METHOD_ID(env, android_app->onRetroArchExit, class, "onRetroArchExit", "()V");
CALL_OBJ_METHOD(env, obj, android_app->activity->clazz, android_app->getIntent);
GET_METHOD_ID(env, android_app->getIntent, class,
"getIntent", "()Landroid/content/Intent;");
GET_METHOD_ID(env, android_app->onRetroArchExit, class,
"onRetroArchExit", "()V");
CALL_OBJ_METHOD(env, obj, android_app->activity->clazz,
android_app->getIntent);
#if 0
GET_METHOD_ID(env, android_app->hasPendingIntent, class, "hasPendingIntent", "()Z");
GET_METHOD_ID(env, android_app->clearPendingIntent, class, "clearPendingIntent", "()V");
GET_METHOD_ID(env, android_app->getPendingIntentConfigPath, class, "getPendingIntentConfigPath",
GET_METHOD_ID(env, android_app->hasPendingIntent, class,
"hasPendingIntent", "()Z");
GET_METHOD_ID(env, android_app->clearPendingIntent, class,
"clearPendingIntent", "()V");
GET_METHOD_ID(env, android_app->getPendingIntentConfigPath, class,
"getPendingIntentConfigPath",
"()Ljava/lang/String;");
GET_METHOD_ID(env, android_app->getPendingIntentLibretroPath, class, "getPendingIntentLibretroPath",
GET_METHOD_ID(env, android_app->getPendingIntentLibretroPath, class,
"getPendingIntentLibretroPath",
"()Ljava/lang/String;");
GET_METHOD_ID(env, android_app->getPendingIntentFullPath, class, "getPendingIntentFullPath",
GET_METHOD_ID(env, android_app->getPendingIntentFullPath, class,
"getPendingIntentFullPath",
"()Ljava/lang/String;");
GET_METHOD_ID(env, android_app->getPendingIntentIME, class, "getPendingIntentIME",
GET_METHOD_ID(env, android_app->getPendingIntentIME, class,
"getPendingIntentIME",
"()Ljava/lang/String;");
#endif
GET_OBJECT_CLASS(env, class, obj);
GET_METHOD_ID(env, android_app->getStringExtra, class, "getStringExtra", "(Ljava/lang/String;)Ljava/lang/String;");
GET_METHOD_ID(env, android_app->getStringExtra, class,
"getStringExtra", "(Ljava/lang/String;)Ljava/lang/String;");
}
static void frontend_android_deinit(void *data)
@ -784,7 +846,8 @@ static void frontend_android_deinit(void *data)
JNIEnv *env = jni_thread_getenv();
if (env && android_app->onRetroArchExit)
CALL_VOID_METHOD(env, android_app->activity->clazz, android_app->onRetroArchExit);
CALL_VOID_METHOD(env, android_app->activity->clazz,
android_app->onRetroArchExit);
if (android_app->inputQueue)
{

View File

@ -42,8 +42,10 @@ static void do_iteration(void)
void apple_start_iteration(void)
{
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting, true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes);
iterate_observer = CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting,
true, 0, (CFRunLoopObserverCallBack)do_iteration, 0);
CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer,
kCFRunLoopCommonModes);
}
void apple_stop_iteration(void)

View File

@ -38,7 +38,8 @@ int main(int argc, char *argv[])
{
emscripten_set_canvas_size(800, 600);
rarch_main(argc, argv);
emscripten_set_main_loop(emscripten_mainloop, g_settings.video.vsync ? 0 : INT_MAX, 1);
emscripten_set_main_loop(emscripten_mainloop,
g_settings.video.vsync ? 0 : INT_MAX, 1);
return 0;
}

View File

@ -110,7 +110,8 @@ static void *gx_devthread(void *a)
unsigned i;
for (i = 0; i < GX_DEVICE_END; i++)
{
if (gx_devices[i].mounted && !gx_devices[i].interface->isInserted())
if (gx_devices[i].mounted &&
!gx_devices[i].interface->isInserted())
{
gx_devices[i].mounted = false;
char n[8];
@ -181,14 +182,22 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
*last_slash = 0;
char *device_end = strchr(g_defaults.core_dir, '/');
if (device_end)
snprintf(g_defaults.port_dir, sizeof(g_defaults.port_dir), "%.*s/retroarch", device_end - g_defaults.core_dir, g_defaults.core_dir);
snprintf(g_defaults.port_dir, sizeof(g_defaults.port_dir),
"%.*s/retroarch", device_end - g_defaults.core_dir,
g_defaults.core_dir);
else
fill_pathname_join(g_defaults.port_dir, g_defaults.port_dir, "retroarch", sizeof(g_defaults.port_dir));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.system_dir, g_defaults.port_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.port_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.port_dir, "savefiles", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.port_dir, g_defaults.port_dir,
"retroarch", sizeof(g_defaults.port_dir));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir,
"overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir,
"retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.system_dir, g_defaults.port_dir,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.port_dir,
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.port_dir,
"savefiles", sizeof(g_defaults.savestate_dir));
#ifdef IS_SALAMANDER
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
@ -197,7 +206,8 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[],
gx_rom_path[0] = '\0';
#else
#ifdef HW_RVL
// needed on Wii; loaders follow a dumb standard where the path and filename are separate in the argument list
/* needed on Wii; loaders follow a dumb standard where the path and
* filename are separate in the argument list */
if (*argc > 2 && argv[1] != NULL && argv[2] != NULL)
{
static char path[PATH_MAX];
@ -239,7 +249,8 @@ static void frontend_gx_init(void *data)
VIDEO_Init();
GXRModeObj *rmode = VIDEO_GetPreferredMode(NULL);
void *xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
console_init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
console_init(xfb, 20, 20, rmode->fbWidth,
rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
VIDEO_Configure(rmode);
VIDEO_SetNextFramebuffer(xfb);
VIDEO_SetBlack(FALSE);
@ -268,10 +279,14 @@ static void frontend_gx_init(void *data)
OSThread gx_device_thread;
gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
gx_devices[GX_DEVICE_SD].name = "sd";
gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(gx_devices[GX_DEVICE_SD].name, gx_devices[GX_DEVICE_SD].interface);
gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(
gx_devices[GX_DEVICE_SD].name,
gx_devices[GX_DEVICE_SD].interface);
gx_devices[GX_DEVICE_USB].interface = &__io_usbstorage;
gx_devices[GX_DEVICE_USB].name = "usb";
gx_devices[GX_DEVICE_USB].mounted = fatMountSimple(gx_devices[GX_DEVICE_USB].name, gx_devices[GX_DEVICE_USB].interface);
gx_devices[GX_DEVICE_USB].mounted = fatMountSimple(
gx_devices[GX_DEVICE_USB].name,
gx_devices[GX_DEVICE_USB].interface);
OSInitMutex(&gx_device_cond_mutex);
OSInitCond(&gx_device_cond);
@ -294,9 +309,11 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
frontend_gx_exec(core_path, should_load_game);
// FIXME/TODO - hack
// direct loading failed (out of memory), try to jump to salamander then load the correct core
fill_pathname_join(core_path, g_defaults.core_dir, "boot.dol", sizeof_core_path);
/* FIXME/TODO - hack
* direct loading failed (out of memory), try to jump to Salamander,
* then load the correct core */
fill_pathname_join(core_path, g_defaults.core_dir,
"boot.dol", sizeof_core_path);
#endif
frontend_gx_exec(core_path, should_load_game);
}
@ -304,8 +321,9 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
static void frontend_gx_process_args(int *argc, char *argv[])
{
#ifndef IS_SALAMANDER
// a big hack: sometimes salamander doesn't save the new core it loads on first boot,
// so we make sure g_settings.libretro is set here
/* A big hack: sometimes Salamander doesn't save the new core
* it loads on first boot, so we make sure
* g_settings.libretro is set here. */
if (!g_settings.libretro[0] && *argc >= 1 && strrchr(argv[0], '/'))
{
char path[PATH_MAX];

View File

@ -30,7 +30,6 @@
static uint8_t np_pool[NP_POOL_SIZE];
#endif
//TODO - not sure if stack size needs to be lower for Salamander
#ifdef IS_SALAMANDER
SYS_PROCESS_PARAM(1001, 0x100000)
#else
@ -49,7 +48,8 @@ SYS_PROCESS_PARAM(1001, 0x200000)
#endif
#ifdef HAVE_SYSUTILS
static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdata)
static void callback_sysutil_exit(uint64_t status,
uint64_t param, void *userdata)
{
(void)param;
(void)userdata;
@ -101,7 +101,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
#ifdef HAVE_MULTIMAN
/* not launched from external launcher, set default path */
// second param is multiMAN SELF file
if(path_file_exists(argv[2]) && *argc > 1 && (strcmp(argv[2], EMULATOR_CONTENT_DIR) == 0))
if(path_file_exists(argv[2]) && *argc > 1
&& (strcmp(argv[2], EMULATOR_CONTENT_DIR) == 0))
{
g_extern.lifecycle_state |= (1ULL << MODE_EXTLAUNCH_MULTIMAN);
RARCH_LOG("Started from multiMAN, auto-game start enabled.\n");
@ -162,7 +163,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
break;
}
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME)
== CELL_GAME_ATTRIBUTE_APP_HOME)
RARCH_LOG("RetroArch was launched from host machine (APP_HOME).\n");
ret = cellGameContentPermit(contentInfoPath, g_defaults.port_dir);
@ -170,8 +172,10 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
#ifdef HAVE_MULTIMAN
if (g_extern.lifecycle_state & (1ULL << MODE_EXTLAUNCH_MULTIMAN))
{
fill_pathname_join(contentInfoPath, "/dev_hdd0/game/", EMULATOR_CONTENT_DIR, sizeof(contentInfoPath));
fill_pathname_join(g_defaults.port_dir, contentInfoPath, "USRDIR", sizeof(g_defaults.port_dir));
fill_pathname_join(contentInfoPath, "/dev_hdd0/game/",
EMULATOR_CONTENT_DIR, sizeof(contentInfoPath));
fill_pathname_join(g_defaults.port_dir, contentInfoPath,
"USRDIR", sizeof(g_defaults.port_dir));
}
#endif
@ -184,15 +188,24 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[],
RARCH_LOG("usrDirPath : [%s].\n", g_defaults.port_dir);
}
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.shader_dir, g_defaults.core_dir, "shaders", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir, "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.assets_dir, g_defaults.core_dir, "media", sizeof(g_defaults.assets_dir));
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir,
"cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir,
"cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir,
"savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir,
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.shader_dir, g_defaults.core_dir,
"shaders", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir,
"retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.overlay_dir, g_defaults.core_dir,
"overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.assets_dir, g_defaults.core_dir,
"media", sizeof(g_defaults.assets_dir));
}
#ifndef IS_SALAMANDER
@ -358,12 +371,15 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
#ifdef IS_SALAMANDER
const char * const spawn_argv[] = { NULL};
ret = sceNpDrmProcessExitSpawn2(k_licensee, path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
ret = sceNpDrmProcessExitSpawn2(k_licensee, path,
(const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data,
256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
if(ret < 0)
{
RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(path, (const char** const)spawn_argv, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
sys_game_process_exitspawn(path, (const char** const)spawn_argv,
NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
}
#else
if (should_load_game && g_extern.fullpath[0] != '\0')
@ -375,23 +391,30 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
NULL
};
ret = sceNpDrmProcessExitSpawn2(k_licensee, path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
ret = sceNpDrmProcessExitSpawn2(k_licensee, path,
(const char** const)spawn_argv, NULL,
(sys_addr_t)spawn_data, 256, 1000,
SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
if(ret < 0)
{
RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(path, (const char** const)spawn_argv, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
sys_game_process_exitspawn(path, (const char** const)spawn_argv,
NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
}
}
else
{
const char * const spawn_argv[] = {NULL};
ret = sceNpDrmProcessExitSpawn2(k_licensee, path, (const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data, 256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
ret = sceNpDrmProcessExitSpawn2(k_licensee, path,
(const char** const)spawn_argv, NULL, (sys_addr_t)spawn_data,
256, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
if(ret < 0)
{
RARCH_WARN("SELF file is not of NPDRM type, trying another approach to boot it...\n");
sys_game_process_exitspawn(path, (const char** const)spawn_argv, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
sys_game_process_exitspawn(path, (const char** const)spawn_argv,
NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M);
}
}
#endif

View File

@ -65,13 +65,20 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
fill_pathname_basedir(g_defaults.port_dir, argv[0], sizeof(g_defaults.port_dir));
RARCH_LOG("port dir: [%s]\n", g_defaults.port_dir);
fill_pathname_join(g_defaults.assets_dir, g_defaults.port_dir, "media", sizeof(g_defaults.assets_dir));
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir, "cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.assets_dir, g_defaults.port_dir,
"media", sizeof(g_defaults.assets_dir));
fill_pathname_join(g_defaults.core_dir, g_defaults.port_dir,
"cores", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, g_defaults.port_dir,
"cores", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir,
"savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir,
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.port_dir,
"retroarch.cfg", sizeof(g_defaults.config_path));
if (argv[1] && (argv[1][0] != '\0'))
{
@ -140,7 +147,8 @@ int callback_thread(SceSize args, void *argp)
static int setup_callback(void)
{
int thread_id = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
int thread_id = sceKernelCreateThread("update_thread",
callback_thread, 0x11, 0xFA0, 0, 0);
if (thread_id >= 0)
sceKernelStartThread(thread_id, 0, 0);

View File

@ -45,11 +45,16 @@ static int frontend_qnx_get_rating(void)
static void frontend_qnx_get_environment_settings(int *argc, char *argv[],
void *data, void *params_data)
{
fill_pathname_join(g_defaults.config_path, "app/native", "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.shader_dir, "app/native", "shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, "app/native", "overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.core_dir, "app/native", "lib", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, "app/native", "info", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.config_path, "app/native",
"retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.shader_dir, "app/native",
"shaders_glsl", sizeof(g_defaults.shader_dir));
fill_pathname_join(g_defaults.overlay_dir, "app/native",
"overlays", sizeof(g_defaults.overlay_dir));
fill_pathname_join(g_defaults.core_dir, "app/native",
"lib", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.core_info_dir, "app/native",
"info", sizeof(g_defaults.core_info_dir));
}
const frontend_ctx_driver_t frontend_ctx_qnx = {

View File

@ -41,10 +41,14 @@ static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
char szSourceDevice[48];
char szDestinationDrive[16];
snprintf(szSourceDevice, sizeof(szSourceDevice), "\\Device\\%s", szDevice);
snprintf(szDestinationDrive, sizeof(szDestinationDrive), "\\??\\%s", szDrive);
RARCH_LOG("xbox_io_mount() - source device: %s.\n", szSourceDevice);
RARCH_LOG("xbox_io_mount() - destination drive: %s.\n", szDestinationDrive);
snprintf(szSourceDevice, sizeof(szSourceDevice),
"\\Device\\%s", szDevice);
snprintf(szDestinationDrive, sizeof(szDestinationDrive),
"\\??\\%s", szDrive);
RARCH_LOG("xbox_io_mount() - source device: %s.\n",
szSourceDevice);
RARCH_LOG("xbox_io_mount() - destination drive: %s.\n",
szDestinationDrive);
STRING DeviceName =
{
@ -71,7 +75,8 @@ static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
static HRESULT xbox_io_unmount(char *szDrive)
{
char szDestinationDrive[16];
snprintf(szDestinationDrive, sizeof(szDestinationDrive), "\\??\\%s", szDrive);
snprintf(szDestinationDrive, sizeof(szDestinationDrive),
"\\??\\%s", szDrive);
STRING LinkName =
{
@ -137,19 +142,30 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
#if defined(_XBOX1)
strlcpy(g_defaults.core_dir, "D:", sizeof(g_defaults.core_dir));
strlcpy(g_defaults.core_info_dir, "D:", sizeof(g_defaults.core_info_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.core_dir, "retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir, "savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir, "savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir, "system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.screenshot_dir, g_defaults.core_dir, "screenshots", sizeof(g_defaults.screenshot_dir));
fill_pathname_join(g_defaults.config_path, g_defaults.core_dir,
"retroarch.cfg", sizeof(g_defaults.config_path));
fill_pathname_join(g_defaults.savestate_dir, g_defaults.core_dir,
"savestates", sizeof(g_defaults.savestate_dir));
fill_pathname_join(g_defaults.sram_dir, g_defaults.core_dir,
"savefiles", sizeof(g_defaults.sram_dir));
fill_pathname_join(g_defaults.system_dir, g_defaults.core_dir,
"system", sizeof(g_defaults.system_dir));
fill_pathname_join(g_defaults.screenshot_dir, g_defaults.core_dir,
"screenshots", sizeof(g_defaults.screenshot_dir));
#elif defined(_XBOX360)
strlcpy(g_defaults.core_dir, "game:", sizeof(g_defaults.core_dir));
strlcpy(g_defaults.core_info_dir, "game:", sizeof(g_defaults.core_info_dir));
strlcpy(g_defaults.config_path, "game:\\retroarch.cfg", sizeof(g_defaults.config_path));
strlcpy(g_defaults.screenshot_dir, "game:", sizeof(g_defaults.screenshot_dir));
strlcpy(g_defaults.savestate_dir, "game:\\savestates", sizeof(g_defaults.savestate_dir));
strlcpy(g_defaults.sram_dir, "game:\\savefiles", sizeof(g_defaults.sram_dir));
strlcpy(g_defaults.system_dir, "game:\\system", sizeof(g_defaults.system_dir));
strlcpy(g_defaults.core_info_dir,
"game:", sizeof(g_defaults.core_info_dir));
strlcpy(g_defaults.config_path,
"game:\\retroarch.cfg", sizeof(g_defaults.config_path));
strlcpy(g_defaults.screenshot_dir,
"game:", sizeof(g_defaults.screenshot_dir));
strlcpy(g_defaults.savestate_dir,
"game:\\savestates", sizeof(g_defaults.savestate_dir));
strlcpy(g_defaults.sram_dir,
"game:\\savefiles", sizeof(g_defaults.sram_dir));
strlcpy(g_defaults.system_dir,
"game:\\system", sizeof(g_defaults.system_dir));
#endif
#ifndef IS_SALAMANDER
@ -172,9 +188,9 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
char *extracted_path = (char*)&ptr.Data;
if (extracted_path && extracted_path[0] != '\0'
&& (strstr(extracted_path, "Pool") == NULL) /* Hack. Unknown problem */)
&& (strstr(extracted_path, "Pool") == NULL)
/* Hack. Unknown problem */)
{
RARCH_LOG("Gets here 3.\n");
strlcpy(path, extracted_path, sizeof(path));
RARCH_LOG("Auto-start game %s.\n", path);
}
@ -240,7 +256,8 @@ static void frontend_xdk_init(void *data)
static void frontend_xdk_exec(const char *path, bool should_load_game);
static void frontend_xdk_exitspawn(char *core_path, size_t sizeof_core_path)
static void frontend_xdk_exitspawn(char *core_path,
size_t sizeof_core_path)
{
bool should_load_game = false;
#ifndef IS_SALAMANDER