From 201f5fd135f5566d215e2fb157bb7072e849a51f Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 11 Sep 2012 12:33:46 +0200 Subject: [PATCH] (PSL1GHT) More PSL1GHT work --- Makefile.psl1ght | 6 +++--- console/griffin/griffin.c | 5 +---- general.h | 4 ++-- gfx/context/ps3_ctx.c | 20 ++++++++++++++++---- ps3/frontend/main.c | 35 ++++++++++++++++++++++++++++------- ps3/ps3_input.c | 4 ++-- ps3/ps3_input.h | 2 +- ps3/sdk_defines.h | 10 ++++++++++ 8 files changed, 63 insertions(+), 23 deletions(-) diff --git a/Makefile.psl1ght b/Makefile.psl1ght index 55a2c88886..1a6acfed4a 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -22,7 +22,7 @@ LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L. MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ CFLAGS += -Wall $(MACHDEP) $(INCLUDE) LDFLAGS := $(MACHDEP) -LIBS := -lretro_psl1ght -laudio -lEGL -lGL -lio -lm -ljpgdec -lpngdec -lsysutil +LIBS := -lretro_psl1ght -laudio -lGL -lEGL -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 OBJ = console/griffin/griffin.o console/rzlib/rzlib.o @@ -38,7 +38,7 @@ endif RSXGL_DEFINES = -D__RSX__ -DGL3_PROTOTYPES -SHARED_FLAGS := -DHAVE_FILEBROWSER $(RSXGL_DEFINES) -DHAVE_OSKUTIL -DHAVE_OPENGL -DHAVE_OPENGL_MODERN -DHAVE_FBO -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7\" -Dmain=rarch_main -Wno-char-subscripts +SHARED_FLAGS := -DHAVE_FILEBROWSER $(RSXGL_DEFINES) -DHAVE_OSKUTIL -DHAVE_OPENGL -DHAVE_OPENGL_MODERN -DHAVE_VID_CONTEXT -DHAVE_FBO -DHAVE_MOUSE -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.7\" -Dmain=rarch_main -Wno-char-subscripts CFLAGS += -std=gnu99 $(SHARED_FLAGS) CXXFLAGS += $(SHARED_FLAGS) @@ -52,7 +52,7 @@ endif all: $(ELF_TARGET) $(ELF_TARGET): $(OBJ) - $(CC) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS) + $(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS) %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index ce319b3f32..d8b0d5d841 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -127,11 +127,8 @@ VIDEO IMAGE VIDEO DRIVER ============================================================ */ -#if defined(__CELLOS_LV2__) -#include "../../gfx/math/matrix.c" -#endif - #if defined(HAVE_OPENGL) +#include "../../gfx/math/matrix.c" #include "../../gfx/gl.c" #elif defined(GEKKO) #ifdef HW_RVL diff --git a/general.h b/general.h index 67ff83fac6..967b4e7412 100644 --- a/general.h +++ b/general.h @@ -265,8 +265,8 @@ struct console_settings char default_sram_dir[PATH_MAX]; char launch_app_on_exit[PATH_MAX]; float menu_font_size; -#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) - oskutil_params oskutil_handle; +#ifdef HAVE_OSKUTIL + void *oskutil_handle; #endif }; #endif diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 0239158063..706b9bb7c1 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -15,11 +15,10 @@ */ #include "../../driver.h" +#include "../../ps3/sdk_defines.h" #include -#include - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -34,8 +33,11 @@ #endif static struct texture_image menu_texture; + +#if defined(HAVE_PSGL) static PSGLdevice* gl_device; static PSGLcontext* gl_context; +#endif int gfx_ctx_check_resolution(unsigned resolution_id) { @@ -135,13 +137,15 @@ void gfx_ctx_set_swap_interval(unsigned interval, bool inited) { (void)inited; +#if defined(HAVE_PSGL) if (gl_context) { if (interval) - glEnable(GL_VSYNC_SCE); + glEnable(GL_VSYNC); else - glDisable(GL_VSYNC_SCE); + glDisable(GL_VSYNC); } +#endif } void gfx_ctx_check_window(bool *quit, @@ -171,7 +175,9 @@ bool gfx_ctx_window_has_focus(void) void gfx_ctx_swap_buffers(void) { +#if defined(HAVE_PSGL) psglSwap(); +#endif } void gfx_ctx_clear(void) @@ -231,11 +237,14 @@ void gfx_ctx_update_window_title(bool reset) { } void gfx_ctx_get_video_size(unsigned *width, unsigned *height) { +#if defined(HAVE_PSGL) psglGetDeviceDimensions(gl_device, width, height); +#endif } bool gfx_ctx_init(void) { +#if defined(HAVE_PSGL) PSGLinitOptions options = { .enable = PSGL_INIT_MAX_SPUS | PSGL_INIT_INITIALIZE_SPUS, .maxSPUs = 1, @@ -276,6 +285,7 @@ bool gfx_ctx_init(void) psglMakeCurrent(gl_context, gl_device); psglResetCurrentContext(); +#endif return true; } @@ -289,10 +299,12 @@ bool gfx_ctx_set_video_mode( void gfx_ctx_destroy(void) { +#if defined(HAVE_PSGL) psglDestroyContext(gl_context); psglDestroyDevice(gl_device); psglExit(); +#endif } void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { } diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c index dd52c1e2f7..1174a516bf 100644 --- a/ps3/frontend/main.c +++ b/ps3/frontend/main.c @@ -52,7 +52,9 @@ #include "../../console/rarch_console.h" #include "../../console/rarch_console_exec.h" + #include "../../console/rarch_console_libretro_mgmt.h" + #include "../../console/rarch_console_input.h" #include "../../console/rarch_console_config.h" #include "../../console/rarch_console_settings.h" @@ -67,10 +69,14 @@ #define EMULATOR_CONTENT_DIR "SSNE10000" +#ifdef HAVE_HDD_CACHE_PARTITION #define CACHE_ID "ABCD12345" -#define NP_POOL_SIZE (128*1024) +#endif +#ifndef __PSL1GHT__ +#define NP_POOL_SIZE (128*1024) static uint8_t np_pool[NP_POOL_SIZE]; +#endif int rarch_main(int argc, char *argv[]); @@ -83,6 +89,9 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat { (void) param; (void) userdata; +#ifdef HAVE_OSKUTIL + oskutil_params *osk = g_console.oskutil_handle; +#endif gl_t *gl = driver.video_data; switch (status) @@ -93,11 +102,11 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat break; #ifdef HAVE_OSKUTIL case CELL_SYSUTIL_OSKDIALOG_FINISHED: - oskutil_close(&g_console.oskutil_handle); - oskutil_finished(&g_console.oskutil_handle); + oskutil_close(osk); + oskutil_finished(osk); break; case CELL_SYSUTIL_OSKDIALOG_UNLOADED: - oskutil_unload(&g_console.oskutil_handle); + oskutil_unload(osk); break; #endif } @@ -239,13 +248,17 @@ int main(int argc, char *argv[]) cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP); #endif +#ifndef __PSL1GHT__ sys_net_initialize_network(); +#endif #ifdef HAVE_LOGGER logger_init(); #endif +#ifndef __PSL1GHT__ sceNpInit(NP_POOL_SIZE, np_pool); +#endif rarch_main_clear_state(); get_environment_settings(argc, argv); @@ -262,8 +275,12 @@ int main(int argc, char *argv[]) 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); @@ -297,7 +314,8 @@ int main(int argc, char *argv[]) driver.video = &video_gl; #ifdef HAVE_OSKUTIL - oskutil_init(&g_console.oskutil_handle, 0); + oskutil_params *osk = g_console.oskutil_handle; + oskutil_init(osk, 0); #endif menu_init(); @@ -355,8 +373,11 @@ begin_shutdown: menu_free(); #ifdef HAVE_OSKUTIL - if(g_console.oskutil_handle.is_running) - oskutil_unload(&g_console.oskutil_handle); + if(g_console.oskutil_handle) + { + oskutil_params *osk = g_console.oskutil_handle; + oskutil_unload(osk); + } #endif #ifdef HAVE_LOGGER diff --git a/ps3/ps3_input.c b/ps3/ps3_input.c index 767b9d1b03..447f2135f6 100644 --- a/ps3/ps3_input.c +++ b/ps3/ps3_input.c @@ -129,7 +129,7 @@ const struct platform_bind platform_keys[] = { { PS3_GAMEPAD_DPAD_DOWN | PS3_GAMEPAD_RSTICK_DOWN_MASK, "RStick D-Pad Down" }, }; -const unsigned int platform_keys_size = sizeof(platform_keys); +const unsigned platform_keys_size = sizeof(platform_keys); static uint64_t state[MAX_PADS]; static unsigned pads_connected; @@ -270,7 +270,7 @@ static int16_t ps3_input_state(void *data, const struct retro_keybind **binds, #define OSK_IN_USE 1 -void oskutil_init(oskutil_params *params, unsigned int containersize) +void oskutil_init(oskutil_params *params, unsigned containersize) { params->flags = 0; params->is_running = false; diff --git a/ps3/ps3_input.h b/ps3/ps3_input.h index 3d47fefd3a..8fa4ed5d37 100644 --- a/ps3/ps3_input.h +++ b/ps3/ps3_input.h @@ -130,7 +130,7 @@ typedef struct void oskutil_write_message(oskutil_params *params, const wchar_t* msg); void oskutil_write_initial_message(oskutil_params *params, const wchar_t* msg); -void oskutil_init(oskutil_params *params, unsigned int containersize); +void oskutil_init(oskutil_params *params, unsigned containersize); bool oskutil_start(oskutil_params *params); void oskutil_stop(oskutil_params *params); void oskutil_finished(oskutil_params *params); diff --git a/ps3/sdk_defines.h b/ps3/sdk_defines.h index cce5665313..c6ec2dd899 100644 --- a/ps3/sdk_defines.h +++ b/ps3/sdk_defines.h @@ -324,6 +324,7 @@ ============================================================ */ #ifdef __PSL1GHT__ +#include #define CELL_GCM_FALSE GCM_FALSE #define CELL_GCM_TRUE GCM_TRUE @@ -491,6 +492,7 @@ #define cellVideoOutConfigure videoConfigure #define cellVideoOutGetState videoGetState #define cellVideoOutGetResolution videoGetResolution +#define cellVideoOutGetResolutionAvailability videoGetResolutionAvailability #define cellGcmSetViewportInline rsxSetViewport #define cellGcmSetReferenceCommandInline rsxSetReferenceCommand @@ -545,4 +547,12 @@ #define cellGameBootCheck sysGameBootCheck #define CELL_GAME_ATTRIBUTE_APP_HOME (1 <<1) /* boot from / app_home/PS3_GAME */ +#define CELL_GAME_DIRNAME_SIZE 32 + +#define CELL_GAME_GAMETYPE_SYS 0 +#define CELL_GAME_GAMETYPE_DISC 1 +#define CELL_GAME_GAMETYPE_HDD 2 +#define CELL_GAME_GAMETYPE_GAMEDATA 3 +#define CELL_GAME_GAMETYPE_HOME 4 + #endif