mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(PSP1) Now sets up paths correctly and more or less fleshed out
main.c
This commit is contained in:
parent
a697b562f6
commit
4b3ac3c04e
@ -8,7 +8,7 @@ INCDIR =
|
||||
CFLAGS = -O2 -G0 -Wall -g -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_GETOPT_LONG -DHAVE_FILEBROWSER -DHAVE_RARCH_MAIN_WRAP -DHAVE_ZLIB -DWANT_RZLIB -DHAVE_CONFIGFILE=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main
|
||||
RARCH_DEFINES = -DPSP -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_GETOPT_LONG -DHAVE_FILEBROWSER -DHAVE_RARCH_MAIN_WRAP -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_ZLIB -DWANT_RZLIB -DHAVE_CONFIGFILE=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -Dmain=rarch_main
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
|
@ -77,17 +77,17 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
|
||||
switch (status)
|
||||
{
|
||||
case CELL_SYSUTIL_REQUEST_EXITGAME:
|
||||
gl->quitting = true;
|
||||
gl->quitting = true;
|
||||
rarch_settings_change(S_QUIT);
|
||||
break;
|
||||
break;
|
||||
#ifdef HAVE_OSKUTIL
|
||||
case CELL_SYSUTIL_OSKDIALOG_FINISHED:
|
||||
oskutil_close(osk);
|
||||
oskutil_finished(osk);
|
||||
break;
|
||||
oskutil_close(osk);
|
||||
oskutil_finished(osk);
|
||||
break;
|
||||
case CELL_SYSUTIL_OSKDIALOG_UNLOADED:
|
||||
oskutil_unload(osk);
|
||||
break;
|
||||
oskutil_unload(osk);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ void menu_init (void)
|
||||
|
||||
void menu_loop (void)
|
||||
{
|
||||
rarch_console_load_game_wrap("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
|
||||
rarch_console_load_game_wrap("/dev_hdd0/game/SSNE10000/USRDIR/mm3.nes", 0, 0);
|
||||
}
|
||||
|
||||
void menu_free (void)
|
||||
@ -134,7 +134,7 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
#ifdef HAVE_MULTIMAN
|
||||
/* not launched from external launcher, set default path */
|
||||
strlcpy(default_paths.multiman_self_file, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
||||
sizeof(default_paths.multiman_self_file));
|
||||
sizeof(default_paths.multiman_self_file));
|
||||
|
||||
if(path_file_exists(default_paths.multiman_self_file) && argc > 1 && path_file_exists(argv[1]))
|
||||
{
|
||||
@ -165,10 +165,10 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
{
|
||||
case CELL_GAME_GAMETYPE_DISC:
|
||||
RARCH_LOG("RetroArch was launched on Optical Disc Drive.\n");
|
||||
break;
|
||||
case CELL_GAME_GAMETYPE_HDD:
|
||||
RARCH_LOG("RetroArch was launched on HDD.\n");
|
||||
break;
|
||||
break;
|
||||
case CELL_GAME_GAMETYPE_HDD:
|
||||
RARCH_LOG("RetroArch was launched on HDD.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if((get_attributes & CELL_GAME_ATTRIBUTE_APP_HOME) == CELL_GAME_ATTRIBUTE_APP_HOME)
|
||||
@ -180,7 +180,7 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
if(g_extern.console.external_launch.support == EXTERN_LAUNCHER_MULTIMAN)
|
||||
{
|
||||
snprintf(contentInfoPath, sizeof(contentInfoPath), "/dev_hdd0/game/%s", EMULATOR_CONTENT_DIR);
|
||||
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
||||
snprintf(default_paths.port_dir, sizeof(default_paths.port_dir), "/dev_hdd0/game/%s/USRDIR", EMULATOR_CONTENT_DIR);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -191,8 +191,8 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
RARCH_LOG("cellGameContentPermit() OK.\n");
|
||||
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
||||
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
|
||||
RARCH_LOG("contentInfoPath : [%s].\n", contentInfoPath);
|
||||
RARCH_LOG("usrDirPath : [%s].\n", default_paths.port_dir);
|
||||
}
|
||||
|
||||
#ifdef HAVE_HDD_CACHE_PARTITION
|
||||
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
bool find_libretro_file = rarch_configure_libretro_core(core_exe_path, path_prefix, path_prefix,
|
||||
default_paths.config_file, extension);
|
||||
default_paths.config_file, extension);
|
||||
#else
|
||||
bool find_libretro_file = false;
|
||||
#endif
|
||||
@ -328,14 +328,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
case EXTERN_LAUNCHER_SALAMANDER:
|
||||
g_extern.console.rmenu.mode = MODE_MENU;
|
||||
break;
|
||||
break;
|
||||
#ifdef HAVE_MULTIMAN
|
||||
case EXTERN_LAUNCHER_MULTIMAN:
|
||||
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
||||
strlcpy(g_extern.file_state.rom_path, argv[1], sizeof(g_extern.file_state.rom_path));
|
||||
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
||||
strlcpy(g_extern.file_state.rom_path, argv[1], sizeof(g_extern.file_state.rom_path));
|
||||
rarch_settings_change(S_START_RARCH);
|
||||
rarch_startup(default_paths.config_file);
|
||||
break;
|
||||
rarch_startup(default_paths.config_file);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@ -387,7 +387,7 @@ begin_shutdown:
|
||||
|
||||
#if defined(HAVE_SYSMODULES)
|
||||
|
||||
/* Freetype font PRX */
|
||||
/* Freetype font PRX */
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
cellSysmoduleLoadModule(CELL_SYSMODULE_FONTFT);
|
||||
@ -395,7 +395,7 @@ begin_shutdown:
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_FONT);
|
||||
#endif
|
||||
|
||||
/* screenshot PRX */
|
||||
/* screenshot PRX */
|
||||
|
||||
#ifndef __PSL1GHT__
|
||||
if(g_extern.console.screen.state.screenshots.enable)
|
||||
@ -405,7 +405,7 @@ begin_shutdown:
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);
|
||||
|
||||
/* system game utility PRX */
|
||||
/* system game utility PRX */
|
||||
#ifndef __PSL1GHT__
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT);
|
||||
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
|
||||
|
@ -33,14 +33,32 @@ int rarch_main(int argc, char *argv[]);
|
||||
|
||||
static int exit_callback(int arg1, int arg2, void *common)
|
||||
{
|
||||
sceKernelExitGame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_environment_settings(int argc, char *argv[])
|
||||
{
|
||||
g_extern.verbose = true;
|
||||
fill_pathname_basedir(default_paths.port_dir, argv[0], sizeof(default_paths.port_dir));
|
||||
RARCH_LOG("port dir: [%s]\n", default_paths.port_dir);
|
||||
|
||||
g_extern.verbose = false;
|
||||
snprintf(default_paths.core_dir, sizeof(default_paths.core_dir), "%s/cores", default_paths.port_dir);
|
||||
snprintf(default_paths.executable_extension, sizeof(default_paths.executable_extension), ".SELF");
|
||||
snprintf(default_paths.savestate_dir, sizeof(default_paths.savestate_dir), "%s/savestates", default_paths.core_dir);
|
||||
snprintf(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.sram_dir, sizeof(default_paths.sram_dir), "%s/sram", default_paths.core_dir);
|
||||
|
||||
snprintf(default_paths.system_dir, sizeof(default_paths.system_dir), "%s/system", default_paths.core_dir);
|
||||
|
||||
/* now we fill in all the variables */
|
||||
snprintf(default_paths.border_file, sizeof(default_paths.border_file), "%s/borders/Centered-1080p/mega-man-2.png", default_paths.core_dir);
|
||||
snprintf(default_paths.menu_border_file, sizeof(default_paths.menu_border_file), "%s/borders/Menu/main-menu.png", default_paths.core_dir);
|
||||
snprintf(default_paths.cgp_dir, sizeof(default_paths.cgp_dir), "%s/presets", default_paths.core_dir);
|
||||
snprintf(default_paths.input_presets_dir, sizeof(default_paths.input_presets_dir), "%s/input", default_paths.cgp_dir);
|
||||
snprintf(default_paths.border_dir, sizeof(default_paths.border_dir), "%s/borders", default_paths.core_dir);
|
||||
snprintf(default_paths.config_file, sizeof(default_paths.config_file), "%s/retroarch.cfg", default_paths.port_dir);
|
||||
snprintf(default_paths.salamander_file, sizeof(default_paths.salamander_file), "EBOOT.BIN");
|
||||
}
|
||||
|
||||
int callback_thread(SceSize args, void *argp)
|
||||
@ -62,6 +80,24 @@ static int setup_callback(void)
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
void menu_init (void)
|
||||
{
|
||||
g_extern.console.rmenu.mode = MODE_MENU;
|
||||
}
|
||||
|
||||
void menu_loop (void)
|
||||
{
|
||||
char game_rom[256];
|
||||
snprintf(game_rom, sizeof(game_rom), "%s%s", default_paths.port_dir, "dkc.sfc");
|
||||
RARCH_LOG("game ROM: %s\n", game_rom);
|
||||
rarch_console_load_game_wrap(game_rom, 0, 0);
|
||||
g_extern.console.rmenu.mode = MODE_EMULATION;
|
||||
}
|
||||
|
||||
void menu_free (void)
|
||||
{
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//initialize debug screen
|
||||
@ -70,22 +106,81 @@ int main(int argc, char *argv[])
|
||||
|
||||
setup_callback();
|
||||
|
||||
get_environment_settings(argc, argv);
|
||||
rarch_main_clear_state();
|
||||
|
||||
g_extern.verbose = true;
|
||||
|
||||
#ifdef HAVE_FILE_LOGGER
|
||||
log_fp = fopen("ms0:/retroarch-log.txt", "w");
|
||||
#endif
|
||||
|
||||
g_extern.verbose = true;
|
||||
get_environment_settings(argc, argv);
|
||||
|
||||
RARCH_LOG("TEST...\n");
|
||||
config_set_defaults();
|
||||
input_psp.init();
|
||||
|
||||
sceDisplayWaitVblankStart();
|
||||
pspDebugScreenClear();
|
||||
pspDebugScreenSetXY(0, 0);
|
||||
RARCH_LOG("RetroArch PSP test.\n");
|
||||
char tmp_path[PATH_MAX];
|
||||
snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
|
||||
const char *path_prefix = tmp_path;
|
||||
const char *extension = default_paths.executable_extension;
|
||||
const input_driver_t *input = &input_psp;
|
||||
|
||||
rarch_sleep(20);
|
||||
char core_exe_path[1024];
|
||||
snprintf(core_exe_path, sizeof(core_exe_path), "%sCORE%s", path_prefix, extension);
|
||||
|
||||
#ifdef HAVE_LIBRETRO_MANAGEMENT
|
||||
bool find_libretro_file = rarch_configure_libretro_core(core_exe_path, path_prefix, path_prefix,
|
||||
default_paths.config_file, extension);
|
||||
#else
|
||||
bool find_libretro_file = false;
|
||||
#endif
|
||||
|
||||
rarch_settings_set_default();
|
||||
rarch_input_set_controls_default(input);
|
||||
rarch_config_load(default_paths.config_file, find_libretro_file);
|
||||
init_libretro_sym();
|
||||
|
||||
input_psp.post_init();
|
||||
|
||||
video_psp1.start();
|
||||
driver.video = &video_psp1;
|
||||
|
||||
menu_init();
|
||||
|
||||
begin_loop:
|
||||
if(g_extern.console.rmenu.mode == MODE_EMULATION)
|
||||
{
|
||||
bool repeat = false;
|
||||
|
||||
input_psp.poll(NULL);
|
||||
|
||||
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
|
||||
|
||||
do{
|
||||
repeat = rarch_main_iterate();
|
||||
}while(repeat && !g_extern.console.screen.state.frame_advance.enable);
|
||||
}
|
||||
else if(g_extern.console.rmenu.mode == MODE_MENU)
|
||||
{
|
||||
menu_loop();
|
||||
|
||||
if (g_extern.console.rmenu.mode != MODE_EXIT)
|
||||
rarch_startup(default_paths.config_file);
|
||||
}
|
||||
else
|
||||
goto begin_shutdown;
|
||||
|
||||
goto begin_loop;
|
||||
|
||||
begin_shutdown:
|
||||
rarch_config_save(default_paths.config_file);
|
||||
|
||||
if(g_extern.console.emulator_initialized)
|
||||
rarch_main_deinit();
|
||||
|
||||
input_psp.free(NULL);
|
||||
video_psp1.stop();
|
||||
menu_free();
|
||||
|
||||
g_extern.verbose = false;
|
||||
|
||||
|
@ -170,6 +170,8 @@ static bool psp_key_pressed(void *data, int key)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case RARCH_QUIT_KEY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ static void *psp_gfx_init(const video_info_t *video,
|
||||
psp1_video_t *vid = (psp1_video_t*)driver.video_data;
|
||||
|
||||
/* Reinitialize textures here */
|
||||
init_texture(vid, video);
|
||||
//init_texture(vid, video);
|
||||
|
||||
return driver.video_data;
|
||||
}
|
||||
@ -134,10 +134,13 @@ static bool psp_gfx_frame(void *data, const void *frame,
|
||||
sceGuFinish();
|
||||
|
||||
sceDisplayWaitVblankStart();
|
||||
|
||||
#if 0
|
||||
void *frame_ptr = &frame;
|
||||
DisplaySetFrameBuf(frame_ptr, pitch,
|
||||
vid->rgb32 ? PSP_DISPLAY_PIXEL_FORMAT_8888 : PSP_DISPLAY_PIXEL_FORMAT_565,
|
||||
PSP_DISPLAY_SETBUF_IMMEDIATE);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user