diff --git a/gfx/drivers_context/orbis_ctx.c b/gfx/drivers_context/orbis_ctx.c index d3413cc798..812fea4982 100644 --- a/gfx/drivers_context/orbis_ctx.c +++ b/gfx/drivers_context/orbis_ctx.c @@ -67,33 +67,36 @@ static void orbis_ctx_get_video_size(void *data, static void *orbis_ctx_init(void *video_driver) { +#if defined(HAVE_OOSDK) + const char *shdr_cache_dir; +#endif #ifdef HAVE_EGL - int ret; - EGLint n; - EGLint major, minor; - static const EGLint attribs[] = { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 16, - EGL_STENCIL_SIZE, 0, - EGL_SAMPLE_BUFFERS, 0, - EGL_SAMPLES, 0, + int ret; + EGLint n; + EGLint major, minor; + static const EGLint attribs[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 16, + EGL_STENCIL_SIZE, 0, + EGL_SAMPLE_BUFFERS, 0, + EGL_SAMPLES, 0, #if defined(HAVE_OPENGLES3) - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, #else - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, #endif - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_NONE}; + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE}; #endif - orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *) - calloc(1, sizeof(*ctx_orbis)); + orbis_ctx_data_t *ctx_orbis = (orbis_ctx_data_t *) + calloc(1, sizeof(*ctx_orbis)); - if (!ctx_orbis) - return NULL; + if (!ctx_orbis) + return NULL; #ifdef HAVE_EGL @@ -103,7 +106,7 @@ static void *orbis_ctx_init(void *video_driver) ctx_orbis->pgl_config.size = sizeof(ctx_orbis->pgl_config); ctx_orbis->pgl_config.flags = - SCE_PGL_FLAGS_USE_COMPOSITE_EXT + SCE_PGL_FLAGS_USE_COMPOSITE_EXT | SCE_PGL_FLAGS_USE_FLEXIBLE_MEMORY | 0x60; ctx_orbis->pgl_config.processOrder = 1; @@ -118,43 +121,36 @@ static void *orbis_ctx_init(void *video_driver) ctx_orbis->pgl_config.dbgPosCmd_0x4C = 0; ctx_orbis->pgl_config.unk_0x5C = 2; } - ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config); - if (!ret) - { - printf("[ORBISGL] scePigletSetConfigurationVSH failed 0x%08X.\n",ret); - goto error; - } + ret = scePigletSetConfigurationVSH(&ctx_orbis->pgl_config); + if (!ret) + goto error; #if defined(HAVE_OOSDK) - const char *shdr_cache_dir = "/data/retroarch/temp/"; - memset(&ctx_orbis->shdr_cache_config, 0, sizeof(ctx_orbis->shdr_cache_config)); - { - ctx_orbis->shdr_cache_config.ver = 0x00010064; - snprintf(ctx_orbis->shdr_cache_config.cache_dir, strlen(shdr_cache_dir) + 1, "%s", shdr_cache_dir); - } + shdr_cache_dir = "/data/retroarch/temp/"; + memset(&ctx_orbis->shdr_cache_config, 0, sizeof(ctx_orbis->shdr_cache_config)); + ctx_orbis->shdr_cache_config.ver = 0x00010064; + snprintf(ctx_orbis->shdr_cache_config.cache_dir, + strlen(shdr_cache_dir) + 1, "%s", + shdr_cache_dir); - ret = scePigletSetShaderCacheConfiguration(&ctx_orbis->shdr_cache_config); - if (!ret) - { - printf("[ORBISGL] scePigletSetShaderCacheConfiguration failed 0x%08X.\n",ret); - goto error; - } + if (!(ret = + scePigletSetShaderCacheConfiguration(&ctx_orbis->shdr_cache_config))) + goto error; #endif - if (!egl_init_context(&ctx_orbis->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, - &major, &minor, &n, attribs, NULL)) - { - egl_report_error(); - printf("[ORBIS]: EGL error: %d.\n", eglGetError()); - goto error; - } + if (!egl_init_context(&ctx_orbis->egl, EGL_NONE, EGL_DEFAULT_DISPLAY, + &major, &minor, &n, attribs, NULL)) + { + egl_report_error(); + goto error; + } #endif - return ctx_orbis; + return ctx_orbis; error: - orbis_ctx_destroy(video_driver); - return NULL; + orbis_ctx_destroy(video_driver); + return NULL; } static void orbis_ctx_check_window(void *data, bool *quit, diff --git a/input/drivers/ps4_input.c b/input/drivers/ps4_input.c index 4a1df49378..a665bc5754 100644 --- a/input/drivers/ps4_input.c +++ b/input/drivers/ps4_input.c @@ -91,8 +91,10 @@ int16_t ps4_input_state(void *data, } break; case RETRO_DEVICE_ANALOG: - // if (retro_keybinds[port]) - // return input_joypad_analog(ps4->joypad, joypad_info, port, idx, id, retro_keybinds[port]); +#if 0 + if (retro_keybinds[port]) + return input_joypad_analog(ps4->joypad, joypad_info, port, idx, id, retro_keybinds[port]); +#endif break; } @@ -142,4 +144,4 @@ input_driver_t input_ps4 = { "ps4", NULL, /* grab_mouse */ NULL -}; \ No newline at end of file +}; diff --git a/input/drivers_joypad/ps4_joypad.c b/input/drivers_joypad/ps4_joypad.c index 8cc780d220..4e3beef75f 100644 --- a/input/drivers_joypad/ps4_joypad.c +++ b/input/drivers_joypad/ps4_joypad.c @@ -19,14 +19,14 @@ #include #include +#include +#include + #include "../input_driver.h" #include "../../tasks/tasks_internal.h" #include "../../verbosity.h" -#include -#include - #define LERP(p, f, t) ((((p * 10) * (t * 10)) / (f * 10)) / 10) #if defined(ORBIS) @@ -74,52 +74,57 @@ static const char *ps4_joypad_name(unsigned pad) static void *ps4_joypad_init(void *data) { int result, handle; - SceUserServiceLoginUserIdList userIdList; + SceUserServiceLoginUserIdList user_id_list; num_players = 0; scePadInit(); - confPad=orbisPadGetConf(); - result = sceUserServiceGetLoginUserIdList(&userIdList); + + confPad = orbisPadGetConf(); + result = sceUserServiceGetLoginUserIdList(&user_id_list); if (result == 0) { unsigned i; for (i = 0; i < SCE_USER_SERVICE_MAX_LOGIN_USERS; i++) { - SceUserServiceUserId userId = userIdList.userId[i]; + SceUserServiceUserId user_id = user_id_list.userId[i]; - if (userId != SCE_USER_SERVICE_USER_ID_INVALID) + if (user_id != SCE_USER_SERVICE_USER_ID_INVALID) { int index = 0; while (index < num_players) { - ds_joypad_states[index].userId = userId; + ds_joypad_states[index].userId = user_id; index++; } if (index == num_players) { - ds_joypad_states[num_players].handle[0] = scePadOpen(userId, SCE_PAD_PORT_TYPE_STANDARD, 0, NULL); + ds_joypad_states[num_players].handle[0] = scePadOpen(user_id, SCE_PAD_PORT_TYPE_STANDARD, 0, NULL); if (ds_joypad_states[num_players].handle[0] == SCE_ORBISPAD_ERROR_ALREADY_OPENED) - ds_joypad_states[num_players].handle[0] = confPad->padHandle;//scePadGetHandle(userId, SCE_PAD_PORT_TYPE_STANDARD, 0); + ds_joypad_states[num_players].handle[0] = confPad->padHandle; +#if 0 + scePadGetHandle(user_id, SCE_PAD_PORT_TYPE_STANDARD, 0); - //ds_joypad_states[num_players].handle[1] = scePadOpen(userId, SCE_PAD_PORT_TYPE_SPECIAL, 0, NULL); - // if (ds_joypad_states[num_players].handle[1] == SCE_ORBISPAD_ERROR_ALREADY_OPENED) - // ds_joypad_states[num_players].handle[1] = scePadGetHandle(userId, SCE_PAD_PORT_TYPE_SPECIAL, 0); + ds_joypad_states[num_players].handle[1] = scePadOpen(user_id, SCE_PAD_PORT_TYPE_SPECIAL, 0, NULL); + if (ds_joypad_states[num_players].handle[1] == SCE_ORBISPAD_ERROR_ALREADY_OPENED) + ds_joypad_states[num_players].handle[1] = + scePadGetHandle(user_id, SCE_PAD_PORT_TYPE_SPECIAL, 0); - //ds_joypad_states[num_players].handle[2] = scePadOpen(userId, SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0, NULL); - // if (ds_joypad_states[num_players].handle[2] == SCE_ORBISPAD_ERROR_ALREADY_OPENED) - // ds_joypad_states[num_players].handle[2] = scePadGetHandle(userId, SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0); + ds_joypad_states[num_players].handle[2] = scePadOpen(user_id, SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0, NULL); + if (ds_joypad_states[num_players].handle[2] == SCE_ORBISPAD_ERROR_ALREADY_OPENED) + ds_joypad_states[num_players].handle[2] = + scePadGetHandle(user_id, SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0); +#endif - RARCH_LOG("USER %x HANDLE %x\n", userId, handle); - if (ds_joypad_states[num_players].handle[0] > 0 || - ds_joypad_states[num_players].handle[1] > 0 || - ds_joypad_states[num_players].handle[2] > 0) + if ( ds_joypad_states[num_players].handle[0] > 0 || + ds_joypad_states[num_players].handle[1] > 0 || + ds_joypad_states[num_players].handle[2] > 0) { ds_joypad_states[num_players].connected = true; - ds_joypad_states[num_players].userId = userId; + ds_joypad_states[num_players].userId = user_id; input_autoconfigure_connect( ps4_joypad_name(num_players), @@ -230,23 +235,24 @@ static void ps4_joypad_get_buttons(unsigned port_num, input_bits_t *state) static void ps4_joypad_poll(void) { unsigned player; - unsigned players_count = num_players; ScePadData buttons; + unsigned players_count = num_players; for (player = 0; player < SCE_USER_SERVICE_MAX_LOGIN_USERS; player++) { + int ret; unsigned j, k; unsigned i = player; if (ds_joypad_states[player].connected == false) - continue; + continue; - int ret = scePadReadState(ds_joypad_states[player].handle[0],&buttons); + ret = scePadReadState(ds_joypad_states[player].handle[0],&buttons); - if (buttons.connected == false) + if (!~buttons.connected) { - ds_joypad_states[player].connected = false; - continue; + ds_joypad_states[player].connected = false; + continue; } if (ret == 0) @@ -276,9 +282,9 @@ static void ps4_joypad_poll(void) analog_state[i][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = convert_u8_to_s16(buttons.ry); } for (j = 0; j < 2; j++) - for (k = 0; k < 2; k++) - if (analog_state[i][j][k] == -0x8000) - analog_state[i][j][k] = -0x7fff; + for (k = 0; k < 2; k++) + if (analog_state[i][j][k] == -0x8000) + analog_state[i][j][k] = -0x7fff; } } @@ -288,49 +294,56 @@ static bool ps4_joypad_query_pad(unsigned pad) } static bool ps4_joypad_rumble(unsigned pad, - enum retro_rumble_effect effect, uint16_t strength) { return false; } - // ScePadVibrationParam params; + enum retro_rumble_effect effect, uint16_t strength) +{ +#if 0 + ScePadVibrationParam params; - // switch (effect) - // { - // case RETRO_RUMBLE_WEAK: - // params.smallMotor = LERP(strength, 0xffff, 0xff); - // break; - // case RETRO_RUMBLE_STRONG: - // params.largeMotor = LERP(strength, 0xffff, 0xff); - // break; - // } + switch (effect) + { + case RETRO_RUMBLE_WEAK: + params.smallMotor = LERP(strength, 0xffff, 0xff); + break; + case RETRO_RUMBLE_STRONG: + params.largeMotor = LERP(strength, 0xffff, 0xff); + break; + } - // scePadSetVibration(ds_joypad_states[pad].handle[0], ¶ms); + scePadSetVibration(ds_joypad_states[pad].handle[0], ¶ms); - // return true; + return true; +#else + return false; +#endif +} -static void ps4_joypad_destroy(void) { } -// int result, handle; -// SceUserServiceLoginUserIdList userIdList; -// SceUserServiceUserId userId; - -// result = sceUserServiceGetLoginUserIdList(&userIdList); -// if (result == 0) -// { -// unsigned i; -// for (i = 0; i < SCE_USER_SERVICE_MAX_LOGIN_USERS; i++) -// { -// userId = userIdList.userId[i]; -// if (userId != SCE_USER_SERVICE_USER_ID_INVALID) -// { - // handle = scePadGetHandle(userId, SCE_PAD_PORT_TYPE_STANDARD, 0); - // if (handle > 0) - // scePadClose(handle); - // handle = scePadGetHandle(userId, SCE_PAD_PORT_TYPE_SPECIAL, 0); - // if (handle > 0) - // scePadClose(handle); - // handle = scePadGetHandle(userId, SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0); - // if (handle > 0) - // scePadClose(handle); -// } -// } -// } +static void ps4_joypad_destroy(void) +{ +#if 0 + SceUserServiceUserId user_id; + SceUserServiceLoginUserIdList user_id_list; + if (sceUserServiceGetLoginUserIdList(&user_id_list) == 0) + { + unsigned i; + for (i = 0; i < SCE_USER_SERVICE_MAX_LOGIN_USERS; i++) + { + user_id = user_id_list.userId[i]; + if (user_id != SCE_USER_SERVICE_USER_ID_INVALID) + { + int handle = scePadGetHandle(user_id, SCE_PAD_PORT_TYPE_STANDARD, 0); + if (handle > 0) + scePadClose(handle); + if ((handle = scePadGetHandle(user_id, SCE_PAD_PORT_TYPE_SPECIAL, 0)) + > 0) + scePadClose(handle); + if ((handle = scePadGetHandle(user_id, + SCE_PAD_PORT_TYPE_REMOTE_CONTROL, 0)) > 0) + scePadClose(handle); + } + } + } +#endif +} input_device_driver_t ps4_joypad = { ps4_joypad_init, diff --git a/network/net_logger.c b/network/net_logger.c index 776ebd05cd..1db55038b4 100644 --- a/network/net_logger.c +++ b/network/net_logger.c @@ -41,8 +41,8 @@ void logger_init(void) { debugNetInit(PC_DEVELOPMENT_IP_ADDRESS,PC_DEVELOPMENT_UDP_PORT,3); - } + void logger_shutdown(void) { debugNetFinish(); @@ -59,10 +59,7 @@ void logger_init(void) unsigned port = PC_DEVELOPMENT_UDP_PORT; if (!network_init()) - { - printf("Could not initialize network logger interface.\n"); return; - } g_sid = socket_create( "ra_netlogger", @@ -79,8 +76,7 @@ void logger_init(void) void logger_shutdown(void) { - if (socket_close(g_sid) < 0) - printf("Could not close socket.\n"); + if (socket_close(g_sid) < 0) { } network_deinit(); }