(GX) initial forwarder support, still needs work on returning to forwarder

This commit is contained in:
Toad King 2012-08-28 23:00:35 -04:00
parent c163d0a298
commit d87cb51848
5 changed files with 61 additions and 13 deletions

View File

@ -23,7 +23,10 @@ enum
{ {
EXTERN_LAUNCHER_SALAMANDER, EXTERN_LAUNCHER_SALAMANDER,
#ifdef HAVE_MULTIMAN #ifdef HAVE_MULTIMAN
EXTERN_LAUNCHER_MULTIMAN EXTERN_LAUNCHER_MULTIMAN,
#endif
#ifdef HW_RVL
EXTERN_LAUNCHER_CHANNEL,
#endif #endif
}; };

View File

@ -271,7 +271,7 @@ static void render_messagebox(rgui_handle_t *rgui, const char *message)
static void render_text(rgui_handle_t *rgui) static void render_text(rgui_handle_t *rgui)
{ {
if (rgui->need_refresh && g_console.mode_switch == MODE_MENU) if (rgui->need_refresh && g_console.mode_switch == MODE_MENU && !rgui->msg_force)
return; return;
size_t begin = rgui->directory_ptr >= TERM_HEIGHT / 2 ? size_t begin = rgui->directory_ptr >= TERM_HEIGHT / 2 ?
@ -776,6 +776,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
} }
driver.video->apply_state_changes(); driver.video->apply_state_changes();
break; break;
case RGUI_ACTION_DOWN: case RGUI_ACTION_DOWN:
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
{ {
@ -788,6 +789,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
} }
driver.video->apply_state_changes(); driver.video->apply_state_changes();
break; break;
case RGUI_ACTION_LEFT: case RGUI_ACTION_LEFT:
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
{ {
@ -800,6 +802,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
} }
driver.video->apply_state_changes(); driver.video->apply_state_changes();
break; break;
case RGUI_ACTION_RIGHT: case RGUI_ACTION_RIGHT:
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
{ {
@ -812,6 +815,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
} }
driver.video->apply_state_changes(); driver.video->apply_state_changes();
break; break;
case RGUI_ACTION_CANCEL: case RGUI_ACTION_CANCEL:
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT_2)
{ {
@ -823,6 +827,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui_list_pop(rgui->path_stack); rgui_list_pop(rgui->path_stack);
} }
break; break;
case RGUI_ACTION_OK: case RGUI_ACTION_OK:
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
{ {
@ -834,6 +839,7 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui_list_pop(rgui->path_stack); rgui_list_pop(rgui->path_stack);
} }
break; break;
case RGUI_ACTION_START: case RGUI_ACTION_START:
#ifdef GEKKO #ifdef GEKKO
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT) if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
@ -851,9 +857,15 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
#endif #endif
driver.video->apply_state_changes(); driver.video->apply_state_changes();
break; break;
case RGUI_ACTION_SETTINGS: case RGUI_ACTION_SETTINGS:
rgui_list_pop(rgui->path_stack); rgui_list_pop(rgui->path_stack);
break; break;
case RGUI_ACTION_MESSAGE:
rgui->msg_force = true;
break;
default: default:
break; break;
} }
@ -933,6 +945,10 @@ void rgui_settings_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui->need_refresh = true; rgui->need_refresh = true;
break; break;
case RGUI_ACTION_MESSAGE:
rgui->msg_force = true;
break;
default: default:
break; break;
} }
@ -964,7 +980,7 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
return rgui_settings_iterate(rgui, action); return rgui_settings_iterate(rgui, action);
else if (rgui_is_viewport_menu(menu_type)) else if (rgui_is_viewport_menu(menu_type))
return rgui_viewport_iterate(rgui, action); return rgui_viewport_iterate(rgui, action);
if (rgui->need_refresh) if (rgui->need_refresh && action != RGUI_ACTION_MESSAGE)
action = RGUI_ACTION_NOOP; action = RGUI_ACTION_NOOP;
switch (action) switch (action)
@ -1078,6 +1094,10 @@ void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action)
} }
return rgui_settings_iterate(rgui, RGUI_ACTION_REFRESH); return rgui_settings_iterate(rgui, RGUI_ACTION_REFRESH);
case RGUI_ACTION_MESSAGE:
rgui->msg_force = true;
break;
default: default:
break; break;
} }

View File

@ -90,6 +90,7 @@ typedef enum
RGUI_ACTION_REFRESH, RGUI_ACTION_REFRESH,
RGUI_ACTION_SETTINGS, RGUI_ACTION_SETTINGS,
RGUI_ACTION_START, RGUI_ACTION_START,
RGUI_ACTION_MESSAGE,
RGUI_ACTION_NOOP RGUI_ACTION_NOOP
} rgui_action_t; } rgui_action_t;

View File

@ -27,6 +27,7 @@
#include "../../console/rarch_console_exec.h" #include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_input.h" #include "../../console/rarch_console_input.h"
#include "../../console/rarch_console_main_wrap.h" #include "../../console/rarch_console_main_wrap.h"
#include "../../console/rarch_console_settings.h"
#include "../mem2_manager.h" #include "../mem2_manager.h"
@ -379,9 +380,9 @@ static void menu_init(void)
rgui = rgui_init("", rgui = rgui_init("",
menu_framebuf, RGUI_WIDTH * sizeof(uint32_t), menu_framebuf, RGUI_WIDTH * sizeof(uint32_t),
NULL /* _binary_console_font_bmp_start */, _binary_console_font_bin_start, folder_cb, NULL); NULL /* _binary_console_font_bmp_start */, _binary_console_font_bin_start, folder_cb, NULL);
rgui_iterate(rgui, RGUI_ACTION_REFRESH);
g_console.mode_switch = MODE_MENU; g_console.mode_switch = MODE_MENU;
rgui_iterate(rgui, RGUI_ACTION_REFRESH);
} }
static void menu_free(void) static void menu_free(void)
@ -401,16 +402,16 @@ static void get_environment_settings(void)
if (device_end) if (device_end)
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir); snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "%.*s/retroarch", device_end - default_paths.core_dir, default_paths.core_dir);
else else
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/retroarch"); strlcpy(default_paths.port_dir, "/retroarch", sizeof(default_paths.port_dir));
snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir); snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir);
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir); snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.port_dir);
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir); snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.port_dir);
snprintf(default_paths.filesystem_root_dir, sizeof(default_paths.filesystem_root_dir), "/"); strlcpy(default_paths.filesystem_root_dir, "/", sizeof(default_paths.filesystem_root_dir));
snprintf(default_paths.filebrowser_startup_dir, sizeof(default_paths.filebrowser_startup_dir), default_paths.filesystem_root_dir); snprintf(default_paths.filebrowser_startup_dir, sizeof(default_paths.filebrowser_startup_dir), default_paths.filesystem_root_dir);
snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.port_dir); snprintf(default_paths.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.port_dir);
snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.port_dir); snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.port_dir);
strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension)); strlcpy(default_paths.executable_extension, ".dol", sizeof(default_paths.executable_extension));
snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "boot.dol"); strlcpy(default_paths.salamander_file, "boot.dol", sizeof(default_paths.salamander_file));
} }
#define MAKE_FILE(x) {\ #define MAKE_FILE(x) {\
@ -448,7 +449,7 @@ static void make_directories(void)
MAKE_FILE(default_paths.config_file); MAKE_FILE(default_paths.config_file);
} }
int main(void) int main(int argc, char *argv[])
{ {
#ifdef HW_RVL #ifdef HW_RVL
IOS_ReloadIOS(IOS_GetVersion()); IOS_ReloadIOS(IOS_GetVersion());
@ -521,6 +522,26 @@ int main(void)
menu_init(); menu_init();
if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
{
char rom[PATH_MAX];
g_console.external_launcher_support = EXTERN_LAUNCHER_CHANNEL;
snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]);
g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE;
rarch_console_load_game_wrap(rom, g_console.zip_extract_mode, S_DELAY_1);
rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
gx->menu_render = true;
rarch_render_cached_frame();
gx->menu_render = false;
rarch_startup(default_paths.config_file);
}
else
{
g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
}
begin_loop: begin_loop:
if(g_console.mode_switch == MODE_EMULATION) if(g_console.mode_switch == MODE_EMULATION)
{ {
@ -551,6 +572,7 @@ begin_loop:
begin_shutdown: begin_shutdown:
rarch_config_save(default_paths.config_file); rarch_config_save(default_paths.config_file);
config_save_keybinds(input_path);
if(g_console.emulator_initialized) if(g_console.emulator_initialized)
rarch_main_deinit(); rarch_main_deinit();
@ -568,8 +590,7 @@ begin_shutdown:
if(g_console.return_to_launcher) if(g_console.return_to_launcher)
rarch_console_exec(g_console.launch_app_on_exit); rarch_console_exec(g_console.launch_app_on_exit);
config_save_keybinds(input_path);
return 1; exit(0);
} }

View File

@ -18,22 +18,25 @@ u32 MALLOC_MEM2 = 0;
static __inline__ heap_block *__lwp_heap_blockat(heap_block *block, u32 offset) static __inline__ heap_block *__lwp_heap_blockat(heap_block *block, u32 offset)
{ {
return (heap_block*) ((char*) block + offset); return (heap_block *) ((char *) block + offset);
} }
static __inline__ heap_block *__lwp_heap_usrblockat(void *ptr) static __inline__ heap_block *__lwp_heap_usrblockat(void *ptr)
{ {
u32 offset = *(((u32*) ptr) - 1); u32 offset = *(((u32 *) ptr) - 1);
return __lwp_heap_blockat(ptr, -offset + -HEAP_BLOCK_USED_OVERHEAD); return __lwp_heap_blockat(ptr, -offset + -HEAP_BLOCK_USED_OVERHEAD);
} }
static __inline__ bool __lwp_heap_blockin(heap_cntrl *heap, heap_block *block) static __inline__ bool __lwp_heap_blockin(heap_cntrl *heap, heap_block *block)
{ {
return ((u32) block >= (u32) heap->start && (u32) block <= (u32)heap->final); return ((u32) block >= (u32) heap->start && (u32) block <= (u32) heap->final);
} }
static __inline__ bool __lwp_heap_blockfree(heap_block *block) static __inline__ bool __lwp_heap_blockfree(heap_block *block)
{ {
return !(block->front_flag & HEAP_BLOCK_USED); return !(block->front_flag & HEAP_BLOCK_USED);
} }
static __inline__ u32 __lwp_heap_blocksize(heap_block *block) static __inline__ u32 __lwp_heap_blocksize(heap_block *block)
{ {
return (block->front_flag & ~HEAP_BLOCK_USED); return (block->front_flag & ~HEAP_BLOCK_USED);