From 8f1af4a2e63d847e722f358d52ad668a57903d1a Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Thu, 15 Dec 2022 14:34:05 +0100 Subject: [PATCH] (Frontend) Style nits/cleanups --- frontend/drivers/platform_ctr.c | 6 +- frontend/drivers/platform_darwin.m | 9 --- frontend/drivers/platform_dos.c | 3 +- frontend/drivers/platform_emscripten.c | 8 +-- frontend/drivers/platform_gx.c | 47 +++++++-------- frontend/drivers/platform_orbis.c | 2 +- frontend/drivers/platform_ps2.c | 18 +++--- frontend/drivers/platform_ps3.c | 6 +- frontend/drivers/platform_psp.c | 4 +- frontend/drivers/platform_qnx.c | 8 +-- frontend/drivers/platform_switch.c | 4 +- frontend/drivers/platform_unix.c | 34 +++++------ frontend/drivers/platform_uwp.c | 34 ++++------- frontend/drivers/platform_wii.c | 6 +- frontend/drivers/platform_wiiu.c | 12 ++-- frontend/drivers/platform_win32.c | 79 +++++++++++--------------- 16 files changed, 119 insertions(+), 161 deletions(-) diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 132bd70594..dede639d12 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -41,11 +41,11 @@ #endif #include "../frontend_driver.h" -#include "../../verbosity.h" +#include "../../file_path_special.h" #include "../../defaults.h" #include "../../paths.h" -#include "retroarch.h" -#include "file_path_special.h" +#include "../../retroarch.h" +#include "../../verbosity.h" #include "ctr/ctr_debug.h" #include "ctr/exec-3dsx/exec_3dsx.h" diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m index 1c6fb9f7c4..44f9cb95a1 100644 --- a/frontend/drivers/platform_darwin.m +++ b/frontend/drivers/platform_darwin.m @@ -70,10 +70,6 @@ #include "../../ui/ui_companion_driver.h" #include "../../paths.h" -#if 1 -#define RELEASE_BUILD -#endif - typedef enum { CFApplicationDirectory = 1, /* Supported applications (Applications) */ @@ -438,7 +434,6 @@ static void frontend_darwin_get_env(int *argc, char *argv[], fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_REMAP], g_defaults.dirs[DEFAULT_DIR_MENU_CONFIG], "remaps", sizeof(g_defaults.dirs[DEFAULT_DIR_REMAP])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], application_data, "downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT], application_data, "screenshots", sizeof(g_defaults.dirs[DEFAULT_DIR_SCREENSHOT])); -#if defined(RELEASE_BUILD) fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_SHADER], application_data, "shaders", sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], application_data, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], application_data, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO])); @@ -452,10 +447,6 @@ static void frontend_darwin_get_env(int *argc, char *argv[], fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CHEATS], application_data, "cht", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], application_data, "audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], application_data, "video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); -#else - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER], home_dir_buf, "audio_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER])); - fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER], home_dir_buf, "video_filters", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER])); -#endif #endif diff --git a/frontend/drivers/platform_dos.c b/frontend/drivers/platform_dos.c index 836449b296..b9a322ce24 100644 --- a/frontend/drivers/platform_dos.c +++ b/frontend/drivers/platform_dos.c @@ -18,13 +18,14 @@ #include #include #include + #include #include #include "../frontend_driver.h" +#include "../../command.h" #include "../../defaults.h" #include "../../paths.h" -#include "../command.h" static enum frontend_fork dos_fork_mode = FRONTEND_FORK_NONE; diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c index 617c4a2feb..2fba0868cf 100644 --- a/frontend/drivers/platform_emscripten.c +++ b/frontend/drivers/platform_emscripten.c @@ -38,14 +38,14 @@ #include "../frontend.h" #include "../frontend_driver.h" #include "../../configuration.h" -#include "../../defaults.h" #include "../../content.h" -#include "../../retroarch.h" -#include "../../verbosity.h" #include "../../command.h" -#include "../../tasks/tasks_internal.h" +#include "../../defaults.h" #include "../../file_path_special.h" #include "../../paths.h" +#include "../../retroarch.h" +#include "../../verbosity.h" +#include "../../tasks/tasks_internal.h" void dummyErrnoCodes(void); void emscripten_mainloop(void); diff --git a/frontend/drivers/platform_gx.c b/frontend/drivers/platform_gx.c index 271d0b2d8f..74651860b7 100644 --- a/frontend/drivers/platform_gx.c +++ b/frontend/drivers/platform_gx.c @@ -30,17 +30,9 @@ #include "../../config.h" #endif -#include -#include -#include -#include - -#if defined(HW_RVL) && !defined(IS_SALAMANDER) +#include +#include #include -#include "../../memory/wii/mem2_manager.h" -#endif - -#include #include #include @@ -51,12 +43,23 @@ #endif #include #include +#include #include "../frontend_driver.h" -#include "../../defaults.h" -#ifndef IS_SALAMANDER +#include "../../command.h" +#include "../../defaults.h" +#include "../../msg_hash.h" +#include "../../retroarch_types.h" +#include "../../verbosity.h" + +#if !defined(IS_SALAMANDER) +#include "../../paths.h" #include "../../menu/menu_entries.h" + +#if defined(HW_RVL) +#include "../../memory/wii/mem2_manager.h" +#endif #endif #ifdef HW_RVL @@ -65,9 +68,6 @@ #include extern void system_exec_wii(const char *path, bool should_load_game); #endif -#include -#include -#include #ifdef USBGECKO #include @@ -104,8 +104,6 @@ static devoptab_t dotab_stdout = { }; #ifndef IS_SALAMANDER -#include "../../paths.h" - enum { GX_DEVICE_SD = 0, @@ -129,7 +127,7 @@ static volatile bool gx_stop_dev_thread = false; static void gx_devthread(void *a) { - unsigned i; + int i; slock_lock(gx_device_cond_mutex); @@ -143,7 +141,7 @@ static void gx_devthread(void *a) { if (!gx_devices[i].interface->isInserted()) { - char n[8] = {0}; + char n[8]; gx_devices[i].mounted = false; strlcpy(n, gx_devices[i].name, sizeof(n)); strlcat(n, ":", sizeof(n)); @@ -333,7 +331,6 @@ extern void __exception_setreload(int t); static void frontend_gx_init(void *data) { - (void)data; #ifdef HW_RVL IOS_ReloadIOS(IOS_GetVersion()); L2Enhance(); @@ -391,8 +388,6 @@ static void frontend_gx_init(void *data) static void frontend_gx_deinit(void *data) { - (void)data; - #if defined(HW_RVL) && !defined(IS_SALAMANDER) slock_lock(gx_device_cond_mutex); gx_stop_dev_thread = true; @@ -447,7 +442,7 @@ static void frontend_gx_exitspawn(char *s, size_t len, char *args) break; } - frontend_gx_exec(s, should_load_game); + system_exec_wii(s, should_load_game); frontend_driver_get_salamander_basename(salamander_basename, sizeof(salamander_basename)); @@ -558,11 +553,11 @@ static void frontend_gx_shutdown(bool unused) static uint64_t frontend_gx_get_total_mem(void) { - uint64_t total = SYSMEM1_SIZE; #if defined(HW_RVL) && !defined(IS_SALAMANDER) - total += gx_mem2_total(); + return SYSMEM1_SIZE + gx_mem2_total(); +#else + return SYSMEM1_SIZE; #endif - return total; } static uint64_t frontend_gx_get_free_mem(void) diff --git a/frontend/drivers/platform_orbis.c b/frontend/drivers/platform_orbis.c index 85672ea258..8a247565af 100644 --- a/frontend/drivers/platform_orbis.c +++ b/frontend/drivers/platform_orbis.c @@ -64,8 +64,8 @@ #include "../frontend_driver.h" #include "../../defaults.h" #include "../../file_path_special.h" -#include "../../retroarch.h" #include "../../paths.h" +#include "../../retroarch.h" #include "../../verbosity.h" #define CONTENT_PATH_ARG_INDEX 1 diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index d89a52f054..fed56a68cb 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -43,8 +43,8 @@ #include "../frontend_driver.h" #include "../../defaults.h" #include "../../file_path_special.h" -#include "../../verbosity.h" #include "../../paths.h" +#include "../../verbosity.h" #if defined(DEBUG) #define DEFAULT_PARTITION "hdd0:__common:pfs" @@ -146,10 +146,8 @@ static void reset_IOP() bool getMountInfo(char *path, char *mountString, char *mountPoint, char *newCWD) { struct string_list *str_list = string_split(path, ":"); - if (str_list->size < 3 ) - { + if (str_list->size < 3) return false; - } sprintf(mountPoint, "%s:%s", str_list->elems[0].data, str_list->elems[1].data); sprintf(mountString, "%s:", str_list->elems[2].data); @@ -243,7 +241,8 @@ static void deinit_drivers(bool deinit_filesystem, bool deinit_powerOff) deinit_joystick_driver(false); #endif - if (deinit_filesystem) { + if (deinit_filesystem) + { umount_hdd_partition(mountString); deinit_hdd_driver(false); @@ -414,7 +413,7 @@ static void frontend_ps2_exitspawn(char *s, size_t len, char *args) frontend_ps2_exec(s, should_load_content); } -static int frontend_ps2_get_rating(void) { return 10; } +static int frontend_ps2_get_rating(void) { return 4; } enum frontend_architecture frontend_ps2_get_arch(void) { @@ -426,9 +425,9 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content) #ifndef IS_SALAMANDER char hdd[10]; file_list_t *list = (file_list_t*)data; - enum msg_hash_enums enum_idx = load_content ? - MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : - MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY; + enum msg_hash_enums enum_idx = load_content + ? MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR + : MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY; menu_entries_append(list, rootDevicePath(BOOT_DEVICE_MC0), @@ -450,6 +449,7 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content) msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), enum_idx, FILE_TYPE_DIRECTORY, 0, 0, NULL); + if (hddMountStatus == HDD_MOUNT_STATUS_OK) { size_t _len = strlcpy(hdd, mountString, sizeof(hdd)); diff --git a/frontend/drivers/platform_ps3.c b/frontend/drivers/platform_ps3.c index 5543cbaec0..7c80a76b4a 100644 --- a/frontend/drivers/platform_ps3.c +++ b/frontend/drivers/platform_ps3.c @@ -43,13 +43,13 @@ #ifndef IS_SALAMANDER #include #endif +#include #include "../frontend_driver.h" -#include "../../file_path_special.h" -#include #include "../../defaults.h" -#include "../../verbosity.h" +#include "../../file_path_special.h" #include "../../paths.h" +#include "../../verbosity.h" #if !defined(IS_SALAMANDER) && defined(HAVE_NETWORKING) #include "../../network/netplay/netplay.h" diff --git a/frontend/drivers/platform_psp.c b/frontend/drivers/platform_psp.c index 17b62216fc..086227ce18 100644 --- a/frontend/drivers/platform_psp.c +++ b/frontend/drivers/platform_psp.c @@ -47,6 +47,7 @@ #ifndef IS_SALAMANDER #include #endif +#include #ifdef HAVE_MENU #include "../../menu/menu_driver.h" @@ -55,9 +56,8 @@ #include "../frontend_driver.h" #include "../../defaults.h" #include "../../file_path_special.h" -#include -#include "../../retroarch.h" #include "../../paths.h" +#include "../../retroarch.h" #include "../../verbosity.h" #if !defined(IS_SALAMANDER) && defined(HAVE_NETWORKING) diff --git a/frontend/drivers/platform_qnx.c b/frontend/drivers/platform_qnx.c index da6a628fe4..5fe62680d5 100644 --- a/frontend/drivers/platform_qnx.c +++ b/frontend/drivers/platform_qnx.c @@ -29,19 +29,17 @@ #include "../../defaults.h" #include "../../dynamic.h" -#include "../../verbosity.h" #include "../../paths.h" +#include "../../verbosity.h" static void frontend_qnx_init(void *data) { - (void)data; verbosity_enable(); bps_initialize(); } static void frontend_qnx_shutdown(bool unused) { - (void)unused; bps_shutdown(); } @@ -65,7 +63,7 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[], getcwd(workdir, sizeof(workdir)); - if(!string_is_empty(workdir)) + if (!string_is_empty(workdir)) { assets_path[0] = '\0'; data_path[0] = '\0'; @@ -156,7 +154,7 @@ static void frontend_qnx_get_env_settings(int *argc, char *argv[], sizeof(copy_command), "cp -r %s/. %s", assets_path, data_path); - if(system(copy_command) == -1) + if (system(copy_command) == -1) RARCH_ERR("Asset copy failed: Shell could not be run.\n" ); else RARCH_LOG( "Asset copy successful.\n"); diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index a961d3effa..a6e8040be3 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -49,11 +49,11 @@ #include #include "../frontend_driver.h" -#include "../../verbosity.h" #include "../../defaults.h" +#include "../../file_path_special.h" #include "../../paths.h" #include "../../retroarch.h" -#include "../../file_path_special.h" +#include "../../verbosity.h" #ifndef IS_SALAMANDER #ifdef HAVE_MENU diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 15c047e5ad..4a3b928cb4 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -80,11 +79,10 @@ #include "../frontend.h" #include "../frontend_driver.h" #include "../../defaults.h" +#include "../../msg_hash.h" +#include "../../paths.h" #include "../../retroarch.h" #include "../../verbosity.h" -#include "../../paths.h" -#include "../../msg_hash.h" -#include "platform_unix.h" #ifdef HAVE_MENU #include "../../menu/menu_driver.h" @@ -93,6 +91,8 @@ #include "../../command.h" #endif +#include "platform_unix.h" + #ifdef ANDROID static void frontend_unix_set_sustained_performance_mode(bool on); @@ -233,11 +233,8 @@ void android_dpi_get_density(char *s, size_t len) void android_app_write_cmd(struct android_app *android_app, int8_t cmd) { - if (!android_app) - return; - - if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) - RARCH_ERR("Failure writing android_app cmd: %s\n", strerror(errno)); + if (android_app) + write(android_app->msgwrite, &cmd, sizeof(cmd)); } static void android_app_set_input(struct android_app *android_app, @@ -482,7 +479,6 @@ static struct android_app* android_app_create(ANativeActivity* activity, if (pipe(msgpipe)) { - RARCH_ERR("could not create pipe: %s.\n", strerror(errno)); if (android_app->savedState) free(android_app->savedState); free(android_app); @@ -1294,14 +1290,14 @@ static void frontend_unix_get_lakka_version(char *s, size_t len) { char version[128]; - size_t vlen; + size_t version_len; FILE *command_file = popen("cat /etc/release", "r"); fgets(version, sizeof(version), command_file); - vlen = strlen(version); + version_len = strlen(version); - if (vlen > 0 && version[vlen-1] == '\n') - version[--vlen] = '\0'; + if (version_len > 0 && version[version_len-1] == '\n') + version[--version_len] = '\0'; strlcpy(s, version, len); @@ -2677,8 +2673,7 @@ static bool frontend_unix_check_for_path_changes(path_change_data_t *change_data if (event->mask & inotify_data->flags) { - unsigned j; - + int j; /* A successful close does not guarantee that the * data has been successfully saved to disk, * as the kernel defers writes. It is @@ -2758,11 +2753,10 @@ enum retro_language frontend_unix_get_user_language(void) if (jstr) { - const char *langStr = (*env)->GetStringUTFChars(env, jstr, 0); + const char *lang_str = (*env)->GetStringUTFChars(env, jstr, 0); + lang = rarch_get_language_from_iso(lang_str); - lang = rarch_get_language_from_iso(langStr); - - (*env)->ReleaseStringUTFChars(env, jstr, langStr); + (*env)->ReleaseStringUTFChars(env, jstr, lang_str); } } #else diff --git a/frontend/drivers/platform_uwp.c b/frontend/drivers/platform_uwp.c index 7c5dcc44db..8d19eb9966 100644 --- a/frontend/drivers/platform_uwp.c +++ b/frontend/drivers/platform_uwp.c @@ -37,18 +37,19 @@ #endif #include "../frontend_driver.h" + #include "../../configuration.h" #include "../../defaults.h" +#include "../../paths.h" #include "../../retroarch.h" #include "../../verbosity.h" #include "../../ui/drivers/ui_win32.h" -#include "../../paths.h" #include "../../uwp/uwp_func.h" static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) { - char buildStr[11] = {0}; + char build_str[11] = {0}; bool server = false; const char *arch = ""; @@ -97,9 +98,9 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) *minor = vi.dwMinorVersion; if (vi.dwMajorVersion == 4 && vi.dwMinorVersion == 0) - snprintf(buildStr, sizeof(buildStr), "%lu", (DWORD)(LOWORD(vi.dwBuildNumber))); /* Windows 95 build number is in the low-order word only */ + snprintf(build_str, sizeof(build_str), "%lu", (DWORD)(LOWORD(vi.dwBuildNumber))); /* Windows 95 build number is in the low-order word only */ else - snprintf(buildStr, sizeof(buildStr), "%lu", vi.dwBuildNumber); + snprintf(build_str, sizeof(build_str), "%lu", vi.dwBuildNumber); switch (vi.dwMajorVersion) { @@ -152,7 +153,7 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) } strlcat(s, " Build ", len); - strlcat(s, buildStr, len); + strlcat(s, build_str, len); if (!string_is_empty(vi.szCSDVersion)) { @@ -167,9 +168,7 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) } } -static void frontend_uwp_init(void *data) -{ -} +static void frontend_uwp_init(void *data) { } enum frontend_powerstate frontend_uwp_get_powerstate( int *seconds, int *percent) @@ -231,18 +230,19 @@ enum frontend_architecture frontend_uwp_get_arch(void) static int frontend_uwp_parse_drive_list(void *data, bool load_content) { #ifdef HAVE_MENU + int i; char home_dir[PATH_MAX_LENGTH]; file_list_t *list = (file_list_t*)data; enum msg_hash_enums enum_idx = load_content ? MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : MENU_ENUM_LABEL_FILE_BROWSER_DIRECTORY; bool have_any_drives = false; + DWORD drives = GetLogicalDrives(); home_dir[0] = '\0'; fill_pathname_home_dir(home_dir, sizeof(home_dir)); - DWORD drives = GetLogicalDrives(); - for (int i = 0; i < 26; i++) + for (i = 0; i < 26; i++) { if (drives & (1 << i)) { @@ -394,16 +394,6 @@ static uint64_t frontend_uwp_get_free_mem(void) #endif } -enum retro_language frontend_uwp_get_user_language(void) -{ - return uwp_get_language(); -} - -static const char* frontend_uwp_get_cpu_model_name(void) -{ - return uwp_get_cpu_model_name(); -} - frontend_ctx_driver_t frontend_ctx_uwp = { frontend_uwp_env_get, /* env_get */ frontend_uwp_init, /* init */ @@ -433,8 +423,8 @@ frontend_ctx_driver_t frontend_ctx_uwp = { NULL, /* watch_path_for_changes */ NULL, /* check_for_path_changes */ NULL, /* set_sustained_performance_mode */ - frontend_uwp_get_cpu_model_name, /* get_cpu_model_name */ - frontend_uwp_get_user_language, /* get_user_language */ + uwp_get_cpu_model_name, /* get_cpu_model_name */ + uwp_get_language, /* get_user_language */ NULL, /* is_narrator_running */ NULL, /* accessibility_speak */ NULL, /* set_gamemode */ diff --git a/frontend/drivers/platform_wii.c b/frontend/drivers/platform_wii.c index 01e6f7ac08..45c7a0368c 100644 --- a/frontend/drivers/platform_wii.c +++ b/frontend/drivers/platform_wii.c @@ -30,18 +30,18 @@ #include #include #include -#include #ifdef HAVE_CONFIG_H #include "../../config.h" #endif -#include "../../verbosity.h" - #if !defined(IS_SALAMANDER) && defined(HAVE_NETWORKING) #include "../../network/netplay/netplay.h" #endif +#include "../../paths.h" +#include "../../verbosity.h" + #define EXECUTE_ADDR ((uint8_t *) 0x91800000) #define BOOTER_ADDR ((uint8_t *) 0x93000000) #define ARGS_ADDR ((uint8_t *) 0x93200000) diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index c6f3515d3e..c87607cd0b 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -39,19 +39,15 @@ #include #include -#include "file_path_special.h" #include "../frontend.h" #include "../frontend_driver.h" +#include "../../file_path_special.h" #include "../../defaults.h" #include "../../paths.h" #include "../../retroarch.h" #include "../../verbosity.h" - -#include "hbl.h" -#include "wiiu_dbg.h" -#include "system/exception_handler.h" -#include "tasks/tasks_internal.h" +#include "../../tasks/tasks_internal.h" #ifndef IS_SALAMANDER #ifdef HAVE_MENU @@ -63,6 +59,10 @@ #endif #endif +#include "hbl.h" +#include "wiiu_dbg.h" +#include "system/exception_handler.h" + #define WIIU_SD_PATH "sd:/" #define WIIU_USB_PATH "usb:/" #define WIIU_STORAGE_USB_PATH "storage_usb:/" diff --git a/frontend/drivers/platform_win32.c b/frontend/drivers/platform_win32.c index 16cb1246f4..28df117fdb 100644 --- a/frontend/drivers/platform_win32.c +++ b/frontend/drivers/platform_win32.c @@ -45,19 +45,12 @@ #include "../frontend_driver.h" #include "../../configuration.h" #include "../../defaults.h" -#include "../../verbosity.h" -#include "../../ui/drivers/ui_win32.h" #include "../../paths.h" #include "../../msg_hash.h" -#include "platform_win32.h" - #include "../../verbosity.h" +#include "../../ui/drivers/ui_win32.h" -/* -#ifdef HAVE_NVDA -#include "../../nvda_controller.h" -#endif -*/ +#include "platform_win32.h" #ifdef HAVE_SAPI #define COBJMACROS @@ -80,7 +73,7 @@ enum platform_win32_flags }; #ifdef HAVE_SAPI -static ISpVoice* pVoice = NULL; +static ISpVoice *voice_ptr = NULL; #endif #ifdef HAVE_NVDA static uint8_t g_plat_win32_flags = PLAT_WIN32_FLAG_USE_NVDA; @@ -123,32 +116,32 @@ const struct win32_lang_pair win32_lang_pairs[] = /* array order MUST be kept, always largest ID first */ {0x7c04, RETRO_LANGUAGE_CHINESE_TRADITIONAL}, /* neutral */ {0x1404, RETRO_LANGUAGE_CHINESE_TRADITIONAL}, /* MO */ - {0x1004, RETRO_LANGUAGE_CHINESE_SIMPLIFIED}, /* SG */ - {0xC04, RETRO_LANGUAGE_CHINESE_TRADITIONAL}, /* HK/PRC */ - {0x816, RETRO_LANGUAGE_PORTUGUESE_PORTUGAL}, - {0x416, RETRO_LANGUAGE_PORTUGUESE_BRAZIL}, - {0x2a, RETRO_LANGUAGE_VIETNAMESE}, - {0x19, RETRO_LANGUAGE_RUSSIAN}, - {0x16, RETRO_LANGUAGE_PORTUGUESE_PORTUGAL}, - {0x15, RETRO_LANGUAGE_POLISH}, - {0x13, RETRO_LANGUAGE_DUTCH}, - {0x12, RETRO_LANGUAGE_KOREAN}, - {0x11, RETRO_LANGUAGE_JAPANESE}, - {0x10, RETRO_LANGUAGE_ITALIAN}, - {0xc, RETRO_LANGUAGE_FRENCH}, - {0xa, RETRO_LANGUAGE_SPANISH}, - {0x9, RETRO_LANGUAGE_ENGLISH}, - {0x8, RETRO_LANGUAGE_GREEK}, - {0x7, RETRO_LANGUAGE_GERMAN}, - {0x4, RETRO_LANGUAGE_CHINESE_SIMPLIFIED}, /* neutral */ - {0x1, RETRO_LANGUAGE_ARABIC}, + {0x1004, RETRO_LANGUAGE_CHINESE_SIMPLIFIED}, /* SG */ + {0xC04, RETRO_LANGUAGE_CHINESE_TRADITIONAL}, /* HK/PRC */ + {0x816, RETRO_LANGUAGE_PORTUGUESE_PORTUGAL}, + {0x416, RETRO_LANGUAGE_PORTUGUESE_BRAZIL}, + {0x2a, RETRO_LANGUAGE_VIETNAMESE}, + {0x19, RETRO_LANGUAGE_RUSSIAN}, + {0x16, RETRO_LANGUAGE_PORTUGUESE_PORTUGAL}, + {0x15, RETRO_LANGUAGE_POLISH}, + {0x13, RETRO_LANGUAGE_DUTCH}, + {0x12, RETRO_LANGUAGE_KOREAN}, + {0x11, RETRO_LANGUAGE_JAPANESE}, + {0x10, RETRO_LANGUAGE_ITALIAN}, + {0xc, RETRO_LANGUAGE_FRENCH}, + {0xa, RETRO_LANGUAGE_SPANISH}, + {0x9, RETRO_LANGUAGE_ENGLISH}, + {0x8, RETRO_LANGUAGE_GREEK}, + {0x7, RETRO_LANGUAGE_GERMAN}, + {0x4, RETRO_LANGUAGE_CHINESE_SIMPLIFIED}, /* neutral */ + {0x1, RETRO_LANGUAGE_ARABIC}, /* MS does not support Esperanto */ /*{0x0, RETRO_LANGUAGE_ESPERANTO},*/ }; unsigned short win32_get_langid_from_retro_lang(enum retro_language lang) { - unsigned i; + int i; for (i = 0; i < sizeof(win32_lang_pairs) / sizeof(win32_lang_pairs[0]); i++) { @@ -161,7 +154,7 @@ unsigned short win32_get_langid_from_retro_lang(enum retro_language lang) enum retro_language win32_get_retro_lang_from_langid(unsigned short langid) { - unsigned i; + int i; for (i = 0; i < sizeof(win32_lang_pairs) / sizeof(win32_lang_pairs[0]); i++) { @@ -233,9 +226,6 @@ static bool gfx_init_dwm(void) (HRESULT(WINAPI*)(BOOL))dylib_proc(dwm_lib, "DwmEnableMMCSS"); #else DragAcceptFiles_func = DragAcceptFiles; -#if 0 - mmcss = DwmEnableMMCSS; -#endif #endif if (mmcss) @@ -1009,11 +999,11 @@ static bool is_narrator_running_windows(void) #ifdef HAVE_SAPI else { - SPVOICESTATUS pStatus; - if (pVoice) + if (voice_ptr) { - ISpVoice_GetStatus(pVoice, &pStatus, NULL); - if (pStatus.dwRunningState == SPRS_IS_SPEAKING) + SPVOICESTATUS status_ptr; + ISpVoice_GetStatus(voice_ptr, &status_ptr, NULL); + if (status_ptr.dwRunningState == SPRS_IS_SPEAKING) return true; } } @@ -1040,7 +1030,6 @@ static bool accessibility_speak_windows(int speed, { if (is_narrator_running_windows()) return true; - } #ifdef HAVE_NVDA init_nvda(); @@ -1089,26 +1078,26 @@ static bool accessibility_speak_windows(int speed, { HRESULT hr; /* stop the old voice if running */ - if (pVoice) + if (voice_ptr) { CoUninitialize(); - ISpVoice_Release(pVoice); + ISpVoice_Release(voice_ptr); } - pVoice = NULL; + voice_ptr = NULL; /* Play the new voice */ if (FAILED(CoInitialize(NULL))) return NULL; hr = CoCreateInstance(&CLSID_SpVoice, NULL, - CLSCTX_ALL, &IID_ISpVoice, (void **)&pVoice); + CLSCTX_ALL, &IID_ISpVoice, (void **)&voice_ptr); if (SUCCEEDED(hr)) { - wchar_t *wc = utf8_to_utf16_string_alloc(speak_text); + wchar_t *wc = utf8_to_utf16_string_alloc(speak_text); if (!wc) return false; - hr = ISpVoice_Speak(pVoice, wc, SPF_ASYNC /*SVSFlagsAsync*/, NULL); + hr = ISpVoice_Speak(voice_ptr, wc, SPF_ASYNC /*SVSFlagsAsync*/, NULL); free(wc); } }