From 04cefd27d1a7920187eb0e3145e3c35546876ddb Mon Sep 17 00:00:00 2001 From: gblues Date: Mon, 30 Apr 2018 21:56:06 -0700 Subject: [PATCH 001/112] Cleanup of Wii U launcher code == DETAILS The Wii U main entrypoints were embedded in the frontend driver, which isn't a great place for them. Also, the `main()` method was pretty long and monolithic. Now it's (much) less so. Changes: - Refactor out the main entrypoints into their own source files (`wiiu/main.c` and `wiiu/main.h`) - Optimize includes in both files, so only the minimum needed to compile are included. - The `main()` method is a lot easier to understand now. It's no longer a confusing mess of ifdefs. - There's a small amount of changes in the headers for future work, which is switching kpad_driver to be callback-driven. The only change here is to import the function that will be used, and define some data types. Testing: - Did local builds and confirmed build is successful - Successfully loaded a core and switched among a few games --- Makefile.wiiu | 1 + frontend/drivers/platform_wiiu.c | 396 ++------------------------- wiiu/include/wiiu/kpad.h | 26 ++ wiiu/main.c | 443 +++++++++++++++++++++++++++++++ wiiu/main.h | 23 ++ wiiu/system/imports.h | 5 +- 6 files changed, 511 insertions(+), 383 deletions(-) create mode 100644 wiiu/main.c create mode 100644 wiiu/main.h diff --git a/Makefile.wiiu b/Makefile.wiiu index 59b35b388b..68ecd41953 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -29,6 +29,7 @@ ifneq ($(V), 1) endif OBJ := +OBJ += wiiu/main.o OBJ += wiiu/input/wpad_driver.o OBJ += wiiu/input/kpad_driver.o OBJ += wiiu/input/pad_functions.o diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index 2ad2a41ae2..ee45f31c73 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -14,54 +14,25 @@ * If not, see . */ -#include -#include -#include -#include -#include - +#include #include -#include -#include #ifndef IS_SALAMANDER #include #endif +#include + +#include "file_path_special.h" + #include "../frontend_driver.h" -#include "../frontend.h" -#include "../../verbosity.h" #include "../../defaults.h" #include "../../paths.h" -#include "retroarch.h" -#include "file_path_special.h" -#include "audio/audio_driver.h" +#include "../../verbosity.h" - -#include "tasks/tasks_internal.h" -#include "../../retroarch.h" -#include -#include -#include -#include "fs/fs_utils.h" -#include "fs/sd_fat_devoptab.h" -#include "system/dynamic.h" -#include "system/memory.h" -#include "system/exception_handler.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "wiiu_dbg.h" #include "hbl.h" +#include "wiiu_dbg.h" +#include "tasks/tasks_internal.h" #ifndef IS_SALAMANDER #ifdef HAVE_MENU @@ -69,10 +40,16 @@ #endif #endif -//#define WIIU_SD_PATH "/vol/external01/" #define WIIU_SD_PATH "sd:/" #define WIIU_USB_PATH "usb:/" +/** + * The Wii U frontend driver. + * + * If you're looking for main() and friends, they've been moved to + * wiiu/main.c + */ + static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE; static const char *elf_path_cst = WIIU_SD_PATH "retroarch/retroarch.elf"; @@ -310,346 +287,3 @@ frontend_ctx_driver_t frontend_ctx_wiiu = "wiiu", NULL, /* get_video_driver */ }; - -static int wiiu_log_socket = -1; -static volatile int wiiu_log_lock = 0; - -void wiiu_log_init(const char *ipString, int port) -{ - wiiu_log_lock = 0; - - wiiu_log_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - - if (wiiu_log_socket < 0) - return; - - struct sockaddr_in connect_addr; - memset(&connect_addr, 0, sizeof(connect_addr)); - connect_addr.sin_family = AF_INET; - connect_addr.sin_port = port; - inet_aton(ipString, &connect_addr.sin_addr); - - if (connect(wiiu_log_socket, (struct sockaddr *)&connect_addr, sizeof(connect_addr)) < 0) - { - socketclose(wiiu_log_socket); - wiiu_log_socket = -1; - } -} - -void wiiu_log_deinit(void) -{ - if (wiiu_log_socket >= 0) - { - socketclose(wiiu_log_socket); - wiiu_log_socket = -1; - } -} -static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len) -{ - if (wiiu_log_socket < 0) - return len; - - while (wiiu_log_lock) - OSSleepTicks(((248625000 / 4)) / 1000); - - wiiu_log_lock = 1; - - int ret; - int remaining = len; - - while (remaining > 0) - { - int block = remaining < 1400 ? remaining : 1400; // take max 1400 bytes per UDP packet - ret = send(wiiu_log_socket, ptr, block, 0); - - if (ret < 0) - break; - - remaining -= ret; - ptr += ret; - } - - wiiu_log_lock = 0; - - return len; -} -void net_print(const char *str) -{ - wiiu_log_write(NULL, 0, str, strlen(str)); -} - -void net_print_exp(const char *str) -{ - send(wiiu_log_socket, str, strlen(str), 0); -} - -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) -static devoptab_t dotab_stdout = -{ - "stdout_net", // device name - 0, // size of file structure - NULL, // device open - NULL, // device close - wiiu_log_write, // device write - NULL, - /* ... */ -}; -#endif - -void SaveCallback(void) -{ - OSSavesDone_ReadyToRelease(); -} - -static bool swap_is_pending(void* start_time) -{ - uint32_t swap_count, flip_count; - OSTime last_flip , last_vsync; - - GX2GetSwapStatus(&swap_count, &flip_count, &last_flip, &last_vsync); - - return last_vsync < *(OSTime*)start_time; -} - -int main(int argc, char **argv) -{ - setup_os_exceptions(); - ProcUIInit(&SaveCallback); - -#ifdef IS_SALAMANDER - socket_lib_init(); -#else - network_init(); -#endif -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) - wiiu_log_init(PC_DEVELOPMENT_IP_ADDRESS, PC_DEVELOPMENT_TCP_PORT); - devoptab_list[STD_OUT] = &dotab_stdout; - devoptab_list[STD_ERR] = &dotab_stdout; -#endif -#ifndef IS_SALAMANDER - VPADInit(); - WPADEnableURCC(true); - WPADEnableWiiRemote(true); - KPADInit(); -#endif - verbosity_enable(); - fflush(stdout); - DEBUG_VAR(ARGV_PTR); - if(ARGV_PTR && ((u32)ARGV_PTR < 0x01000000)) - { - struct - { - u32 magic; - u32 argc; - char * argv[3]; - }*param = ARGV_PTR; - if(param->magic == ARGV_MAGIC) - { - argc = param->argc; - argv = param->argv; - } - ARGV_PTR = NULL; - } - - DEBUG_VAR(argc); - DEBUG_STR(argv[0]); - DEBUG_STR(argv[1]); - fflush(stdout); -#ifdef IS_SALAMANDER - int salamander_main(int, char **); - salamander_main(argc, argv); -#else -#if 1 -#if 0 - int argc_ = 2; -// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL}; - char *argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.sfc", NULL}; - - rarch_main(argc_, argv_, NULL); -#else - rarch_main(argc, argv, NULL); -#endif - do - { - unsigned sleep_ms = 0; - - if(video_driver_get_ptr(false)) - { - OSTime start_time = OSGetSystemTime(); - task_queue_wait(swap_is_pending, &start_time); - } - else - task_queue_wait(NULL, NULL); - - int ret = runloop_iterate(&sleep_ms); - - if (ret == 1 && sleep_ms > 0) - retro_sleep(sleep_ms); - - - if (ret == -1) - break; - - } - while (1); - main_exit(NULL); -#endif -#endif - fflush(stdout); - fflush(stderr); - ProcUIShutdown(); - -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) - wiiu_log_deinit(); -#endif - - /* returning non 0 here can prevent loading a different rpx/elf in the HBL environment */ - return 0; -} - -void __eabi(void) -{ - -} - -__attribute__((weak)) -void __init(void) -{ - extern void (*const __CTOR_LIST__)(void); - extern void (*const __CTOR_END__)(void); - - void (*const *ctor)(void) = &__CTOR_LIST__; - while (ctor < &__CTOR_END__) { - (*ctor++)(); - } -} - -__attribute__((weak)) -void __fini(void) -{ - extern void (*const __DTOR_LIST__)(void); - extern void (*const __DTOR_END__)(void); - - void (*const *dtor)(void) = &__DTOR_LIST__; - while (dtor < &__DTOR_END__) { - (*dtor++)(); - } -} - -/* libiosuhax related */ - -//just to be able to call async -void someFunc(void *arg) -{ - (void)arg; -} - -static int mcp_hook_fd = -1; - -int MCPHookOpen(void) -{ - //take over mcp thread - mcp_hook_fd = IOS_Open("/dev/mcp", 0); - - if (mcp_hook_fd < 0) - return -1; - - IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, (void *)0, 0, someFunc, (void *)0); - //let wupserver start up - retro_sleep(1000); - - if (IOSUHAX_Open("/dev/mcp") < 0) - { - IOS_Close(mcp_hook_fd); - mcp_hook_fd = -1; - return -1; - } - - return 0; -} - -void MCPHookClose(void) -{ - if (mcp_hook_fd < 0) - return; - - //close down wupserver, return control to mcp - IOSUHAX_Close(); - //wait for mcp to return - retro_sleep(1000); - IOS_Close(mcp_hook_fd); - mcp_hook_fd = -1; -} - - -static int iosuhaxMount = 0; - -static void fsdev_init(void) -{ - iosuhaxMount = 0; - int res = IOSUHAX_Open(NULL); - - if (res < 0) - res = MCPHookOpen(); - - if (res < 0) - mount_sd_fat("sd"); - else - { - iosuhaxMount = 1; - fatInitDefault(); - } -} -static void fsdev_exit(void) -{ - if (iosuhaxMount) - { - fatUnmount("sd:"); - fatUnmount("usb:"); - - if (mcp_hook_fd >= 0) - MCPHookClose(); - else - IOSUHAX_Close(); - } - else - unmount_sd_fat("sd"); - -} - -/* HBL elf entry point */ -int __entry_menu(int argc, char **argv) -{ - int ret; - - InitFunctionPointers(); - memoryInitialize(); - __init(); - fsdev_init(); - - ret = main(argc, argv); - - fsdev_exit(); - __fini(); - memoryRelease(); - return ret; -} -/* RPX entry point */ -__attribute__((noreturn)) -void _start(int argc, char **argv) -{ - memoryInitialize(); - __init(); - fsdev_init(); - main(argc, argv); - fsdev_exit(); - - /* TODO: fix elf2rpl so it doesn't error with "Could not find matching symbol - for relocation" then uncomment this */ -#if 0 - __fini(); -#endif - memoryRelease(); - SYSRelaunchTitle(0, 0); - exit(0); -} diff --git a/wiiu/include/wiiu/kpad.h b/wiiu/include/wiiu/kpad.h index 17a97a527c..27988fba26 100644 --- a/wiiu/include/wiiu/kpad.h +++ b/wiiu/include/wiiu/kpad.h @@ -65,9 +65,35 @@ typedef struct _KPADData void KPADInit (void); +void KPADShutdown(void); s32 KPADRead(s32 chan, void * data, u32 size); s32 KPADReadEx(s32 chan, KPADData * data, u32 size, s32 *error); +typedef s32 WPADChannel; +/* legal values for WPADChannel */ +enum { + WPAD_CHAN0 = 0, + WPAD_CHAN1 = 1, + WPAD_CHAN2 = 2, + WPAD_CHAN3 = 3 +}; + +typedef s8 WPADError; +/* legal values for WPADError */ +enum { + WPAD_ERROR_NONE = 0, + WPAD_ERROR_NO_CONTROLLER = -1, + WPAD_ERROR_BUSY = -2, + WPAD_ERROR_TRANSFER = -3, + WPAD_ERROR_INVALID = -4, + WPAD_ERROR_NOPERM = -5, + WPAD_ERROR_BROKEN = -6, + WPAD_ERROR_CORRUPTED = -7 +}; + +typedef void (*WPADConnectCallback) (WPADChannel channel, WPADError reason); + + #ifdef __cplusplus } #endif diff --git a/wiiu/main.c b/wiiu/main.c new file mode 100644 index 0000000000..3e80bcb4ef --- /dev/null +++ b/wiiu/main.c @@ -0,0 +1,443 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2014-2016 - Ali Bouhlel + * Copyright (C) 2011-2017 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "main.h" + +/** + * This file contains the main entrypoints for the Wii U executable. + */ + +static void fsdev_init(void); +static void fsdev_exit(void); + +#define WIIU_SD_PATH "sd:/" +#define WIIU_USB_PATH "usb:/" + +static int wiiu_log_socket = -1; +static volatile int wiiu_log_lock = 0; + +/* HBL elf entry point */ +int __entry_menu(int argc, char **argv) +{ + int ret; + + InitFunctionPointers(); + memoryInitialize(); + __init(); + fsdev_init(); + + ret = main(argc, argv); + + fsdev_exit(); + __fini(); + memoryRelease(); + return ret; +} + +/* RPX entry point */ +__attribute__((noreturn)) +void _start(int argc, char **argv) +{ + memoryInitialize(); + __init(); + fsdev_init(); + main(argc, argv); + fsdev_exit(); + + /* TODO: fix elf2rpl so it doesn't error with "Could not find matching symbol + for relocation" then uncomment this */ +#if 0 + __fini(); +#endif + memoryRelease(); + SYSRelaunchTitle(0, 0); + exit(0); +} + +void wiiu_log_init(const char *ipString, int port) +{ + wiiu_log_lock = 0; + + wiiu_log_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (wiiu_log_socket < 0) + return; + + struct sockaddr_in connect_addr; + memset(&connect_addr, 0, sizeof(connect_addr)); + connect_addr.sin_family = AF_INET; + connect_addr.sin_port = port; + inet_aton(ipString, &connect_addr.sin_addr); + + if (connect(wiiu_log_socket, (struct sockaddr *)&connect_addr, sizeof(connect_addr)) < 0) + { + socketclose(wiiu_log_socket); + wiiu_log_socket = -1; + } +} + +void wiiu_log_deinit(void) +{ + if (wiiu_log_socket >= 0) + { + socketclose(wiiu_log_socket); + wiiu_log_socket = -1; + } +} +static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len) +{ + if (wiiu_log_socket < 0) + return len; + + while (wiiu_log_lock) + OSSleepTicks(((248625000 / 4)) / 1000); + + wiiu_log_lock = 1; + + int ret; + int remaining = len; + + while (remaining > 0) + { + int block = remaining < 1400 ? remaining : 1400; // take max 1400 bytes per UDP packet + ret = send(wiiu_log_socket, ptr, block, 0); + + if (ret < 0) + break; + + remaining -= ret; + ptr += ret; + } + + wiiu_log_lock = 0; + + return len; +} +void net_print(const char *str) +{ + wiiu_log_write(NULL, 0, str, strlen(str)); +} + +void net_print_exp(const char *str) +{ + send(wiiu_log_socket, str, strlen(str), 0); +} + +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) +static devoptab_t dotab_stdout = +{ + "stdout_net", // device name + 0, // size of file structure + NULL, // device open + NULL, // device close + wiiu_log_write, // device write + NULL, + /* ... */ +}; +#endif + +void SaveCallback(void) +{ + OSSavesDone_ReadyToRelease(); +} + +static bool swap_is_pending(void* start_time) +{ + uint32_t swap_count, flip_count; + OSTime last_flip , last_vsync; + + GX2GetSwapStatus(&swap_count, &flip_count, &last_flip, &last_vsync); + + return last_vsync < *(OSTime*)start_time; +} + +static void do_network_init(void) +{ +#ifdef IS_SALAMANDER + socket_lib_init(); +#else + network_init(); +#endif +} + +static void init_pad_libraries(void) +{ +#ifndef IS_SALAMANDER + KPADInit(); + WPADEnableURCC(true); + WPADEnableWiiRemote(true); +#endif +} + +static void deinit_pad_libraries(void) +{ +#ifndef IS_SALAMANDER + KPADShutdown(); +#endif +} + +static void do_logging_init(void) +{ +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) + wiiu_log_init(PC_DEVELOPMENT_IP_ADDRESS, PC_DEVELOPMENT_TCP_PORT); + devoptab_list[STD_OUT] = &dotab_stdout; + devoptab_list[STD_ERR] = &dotab_stdout; +#endif +} + +static void do_logging_deinit(void) +{ + fflush(stdout); + fflush(stderr); + +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) + wiiu_log_deinit(); +#endif +} + +static void do_rarch_main(int argc, char **argv) +{ +#if 0 + int argc_ = 2; +// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL}; + char *argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.sfc", NULL}; + + rarch_main(argc_, argv_, NULL); +#else /* #if 0 */ + rarch_main(argc, argv, NULL); +#endif /* #if 0 */ +} + +static void main_loop(void) +{ + unsigned sleep_ms = 0; + OSTime start_time; + int status; + + do + { + if(video_driver_get_ptr(false)) + { + start_time = OSGetSystemTime(); + task_queue_wait(swap_is_pending, &start_time); + } + else + task_queue_wait(NULL, NULL); + + status = runloop_iterate(&sleep_ms); + + if (status == 1 && sleep_ms > 0) + retro_sleep(sleep_ms); + + if (status == -1) + break; + } + while (1); +} + +static void main_init(void) +{ + setup_os_exceptions(); + ProcUIInit(&SaveCallback); + do_network_init(); + do_logging_init(); + init_pad_libraries(); + verbosity_enable(); + fflush(stdout); +} + +static void main_deinit(void) +{ + deinit_pad_libraries(); + ProcUIShutdown(); + + do_logging_deinit(); +} + +static void read_argc_argv(int *argc, char ***argv) +{ + DEBUG_VAR(ARGV_PTR); + if(ARGV_PTR && ((u32)ARGV_PTR < 0x01000000)) + { + struct + { + u32 magic; + u32 argc; + char * argv[3]; + }*param = ARGV_PTR; + if(param->magic == ARGV_MAGIC) + { + *argc = param->argc; + *argv = param->argv; + } + ARGV_PTR = NULL; + } + + DEBUG_VAR(argc); + DEBUG_STR(argv[0]); + DEBUG_STR(argv[1]); + fflush(stdout); +} + +int main(int argc, char **argv) +{ + main_init(); + read_argc_argv(&argc, &argv); + +#ifdef IS_SALAMANDER + int salamander_main(int, char **); + salamander_main(argc, argv); +#else + do_rarch_main(argc, argv); + main_loop(); + main_exit(NULL); +#endif /* IS_SALAMANDER */ + main_deinit(); + + /* returning non 0 here can prevent loading a different rpx/elf in the HBL + environment */ + return 0; +} + +void __eabi(void) +{ + +} + +__attribute__((weak)) +void __init(void) +{ + extern void (*const __CTOR_LIST__)(void); + extern void (*const __CTOR_END__)(void); + + void (*const *ctor)(void) = &__CTOR_LIST__; + while (ctor < &__CTOR_END__) { + (*ctor++)(); + } +} + +__attribute__((weak)) +void __fini(void) +{ + extern void (*const __DTOR_LIST__)(void); + extern void (*const __DTOR_END__)(void); + + void (*const *dtor)(void) = &__DTOR_LIST__; + while (dtor < &__DTOR_END__) { + (*dtor++)(); + } +} + +/* libiosuhax related */ + +//just to be able to call async +void someFunc(void *arg) +{ + (void)arg; +} + +static int mcp_hook_fd = -1; + +int MCPHookOpen(void) +{ + //take over mcp thread + mcp_hook_fd = IOS_Open("/dev/mcp", 0); + + if (mcp_hook_fd < 0) + return -1; + + IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, (void *)0, 0, someFunc, (void *)0); + //let wupserver start up + retro_sleep(1000); + + if (IOSUHAX_Open("/dev/mcp") < 0) + { + IOS_Close(mcp_hook_fd); + mcp_hook_fd = -1; + return -1; + } + + return 0; +} + +void MCPHookClose(void) +{ + if (mcp_hook_fd < 0) + return; + + //close down wupserver, return control to mcp + IOSUHAX_Close(); + //wait for mcp to return + retro_sleep(1000); + IOS_Close(mcp_hook_fd); + mcp_hook_fd = -1; +} + + +static int iosuhaxMount = 0; + +static void fsdev_init(void) +{ + iosuhaxMount = 0; + int res = IOSUHAX_Open(NULL); + + if (res < 0) + res = MCPHookOpen(); + + if (res < 0) + mount_sd_fat("sd"); + else + { + iosuhaxMount = 1; + fatInitDefault(); + } +} +static void fsdev_exit(void) +{ + if (iosuhaxMount) + { + fatUnmount("sd:"); + fatUnmount("usb:"); + + if (mcp_hook_fd >= 0) + MCPHookClose(); + else + IOSUHAX_Close(); + } + else + unmount_sd_fat("sd"); + +} + diff --git a/wiiu/main.h b/wiiu/main.h new file mode 100644 index 0000000000..0c2cbcf916 --- /dev/null +++ b/wiiu/main.h @@ -0,0 +1,23 @@ +#ifndef WIIU_MAIN__H +#define WIIU_MAIN__H + +#include "hbl.h" +#include "wiiu_dbg.h" + +#include "fs/fs_utils.h" +#include "fs/sd_fat_devoptab.h" +#include "system/dynamic.h" +#include "system/memory.h" +#include "system/exception_handler.h" + +#include "../retroarch.h" +#include "../verbosity.h" +#include "../frontend/frontend.h" +#include "../gfx/video_driver.h" +#include "../tasks/tasks_internal.h" + +void __init(void); +void __fini(void); +int main(int argc, char **argv); + +#endif /* WIIU_MAIN_H */ diff --git a/wiiu/system/imports.h b/wiiu/system/imports.h index 939ef361dd..5a2f3daf77 100644 --- a/wiiu/system/imports.h +++ b/wiiu/system/imports.h @@ -249,16 +249,17 @@ IMPORT_END(); /* padscore */ IMPORT_BEGIN(padscore); - IMPORT(KPADInit); IMPORT(WPADProbe); +IMPORT(KPADSetConnectCallback); + IMPORT(WPADSetDataFormat); IMPORT(WPADEnableURCC); IMPORT(WPADEnableWiiRemote); IMPORT(WPADRead); IMPORT(KPADRead); IMPORT(KPADReadEx); - +IMPORT(KPADShutdown); IMPORT_END(); /* nsyskbd */ From 974a04e692c669b40c68be27ee8ac7875a2e6e32 Mon Sep 17 00:00:00 2001 From: altiereslima Date: Tue, 1 May 2018 12:30:49 -0300 Subject: [PATCH 002/112] Update Portuguese Brazilian translation --- intl/msg_hash_pt_br.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index ae74cee172..b70152d882 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -3511,3 +3511,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, "Ativar áudio de menu") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, "Ativar ou desativar o som do menu.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, + "Configurações do Mixer") +MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, + "Visualizar e/ou modificar as configurações do mixer de áudio.") From 33c1d558013eb8fc301dc632aaf98dccfa635ca6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 1 May 2018 21:44:10 +0200 Subject: [PATCH 003/112] GetDisplayConfigBufferSizes and QueryDisplayConfig now go through function pointers for backwards compatibility --- gfx/common/win32_common.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 23951682e4..247c810ef8 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -92,6 +92,9 @@ extern void *dinput_wgl; extern void *dinput; #endif +typedef LONG(CALLBACK* QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO*, UINT32*, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*); +typedef LONG(CALLBACK* GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*); + static bool g_resized = false; bool g_restore_desktop = false; static bool doubleclick_on_titlebar = false; @@ -1276,6 +1279,18 @@ float win32_get_refresh_rate(void *data) DISPLAYCONFIG_PATH_INFO *PathInfoArray = NULL; DISPLAYCONFIG_MODE_INFO *ModeInfoArray = NULL; int result = 0; +#ifdef HAVE_DYNAMIC + static QUERYDISPLAYCONFIG pQueryDisplayConfig; + static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes; + if (!pQueryDisplayConfig) + pQueryDisplayConfig = (QUERYDISPLAYCONFIG)GetProcAddress(GetModuleHandle("user32.dll"), "QueryDisplayConfig"); + + if (!pGetDisplayConfigBufferSizes) + pGetDisplayConfigBufferSizes = (GETDISPLAYCONFIGBUFFERSIZES)GetProcAddress(GetModuleHandle("user32.dll"), "GetDisplayConfigBufferSizes"); +#else + static QUERYDISPLAYCONFIG pQueryDisplayConfig = QueryDisplayConfig; + static GETDISPLAYCONFIGBUFFERSIZES pGetDisplayConfigBufferSizes = GetDisplayConfigBufferSizes; +#endif version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx(&version_info)) @@ -1285,7 +1300,7 @@ float win32_get_refresh_rate(void *data) (version_info.dwMajorVersion == 6 && version_info.dwMinorVersion < 1)) return refresh_rate; - result = GetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, + result = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, &NumPathArrayElements, &NumModeInfoArrayElements); @@ -1297,12 +1312,13 @@ float win32_get_refresh_rate(void *data) ModeInfoArray = (DISPLAYCONFIG_MODE_INFO *) malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * NumModeInfoArrayElements); - result = QueryDisplayConfig(QDC_DATABASE_CURRENT, + result = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &NumPathArrayElements, PathInfoArray, &NumModeInfoArrayElements, ModeInfoArray, &TopologyID); + if (result == ERROR_SUCCESS && NumPathArrayElements >= 1) { refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator / From e3712182bdabfbb0d693ed55ceeec8bb4216b8ca Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 1 May 2018 17:47:12 -0400 Subject: [PATCH 004/112] Qt: only init new UI the first time it is about to be shown --- ui/drivers/qt/ui_qt_application.cpp | 4 +++- ui/ui_companion_driver.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/drivers/qt/ui_qt_application.cpp b/ui/drivers/qt/ui_qt_application.cpp index aac3b237c5..e8a73a6e9f 100644 --- a/ui/drivers/qt/ui_qt_application.cpp +++ b/ui/drivers/qt/ui_qt_application.cpp @@ -95,7 +95,9 @@ AppHandler::~AppHandler() void AppHandler::exit() { app_exiting = true; - qApp->closeAllWindows(); + + if (qApp) + qApp->closeAllWindows(); } bool AppHandler::isExiting() const diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index 79974c6610..802fa06ffe 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -131,7 +131,7 @@ void ui_companion_driver_init_first(void) ui_companion = (ui_companion_driver_t*)ui_companion_init_first(); #ifdef HAVE_QT - if (settings->bools.desktop_menu_enable) + if (settings->bools.desktop_menu_enable && settings->bools.ui_companion_toggle) { ui_companion_qt_data = ui_companion_qt.init(); qt_is_inited = true; @@ -159,8 +159,16 @@ void ui_companion_driver_toggle(bool force) #ifdef HAVE_QT if (settings->bools.desktop_menu_enable) - if (ui_companion_qt.toggle) + { + if ((settings->bools.ui_companion_toggle || force) && !qt_is_inited) + { + ui_companion_qt_data = ui_companion_qt.init(); + qt_is_inited = true; + } + + if (qt_is_inited && ui_companion_qt.toggle) ui_companion_qt.toggle(ui_companion_qt_data, force); + } #endif } From eb549fdc175efa76ceba3e93b7dec439395fb09a Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 1 May 2018 18:17:28 -0400 Subject: [PATCH 005/112] Qt: can't get core info if there isn't any --- ui/drivers/qt/ui_qt_window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 4add946291..317501c79a 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -1324,6 +1324,9 @@ QList > MainWindow::getCoreInfo() core_info_get_list(&core_info_list); + if (!core_info_list || core_info_list->count == 0) + return infoList; + for (i = 0; i < core_info_list->count; i++) { const core_info_t *core = &core_info_list->list[i]; From eba3a1b72d14ebe551caee48830b7ed14c319559 Mon Sep 17 00:00:00 2001 From: altiereslima Date: Tue, 1 May 2018 19:21:14 -0300 Subject: [PATCH 006/112] Update Portuguese Brazilian translation --- intl/msg_hash_pt_br.h | 140 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 134 insertions(+), 6 deletions(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index b70152d882..236837bf4a 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -871,6 +871,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GRAB_MOUSE_TOGGLE, "Alternar captura do Mouse") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_GAME_FOCUS_TOGGLE, "Alternar foco do jogo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_UI_COMPANION_TOGGLE, + "Alternar menu desktop") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_LOAD_STATE_KEY, "Carregar Estado de Jogo") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_MENU_TOGGLE, @@ -1361,7 +1363,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RETRO_ACHIEVEMENTS_SETTINGS, MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_ENABLE, "Habilitar Rebobinagem") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_GRANULARITY, - "Granularidade do Voltar Atrás") + "Granularidade da Rebobinagem") MSG_HASH(MENU_ENUM_LABEL_VALUE_REWIND_SETTINGS, "Rebobinagem") MSG_HASH(MENU_ENUM_LABEL_VALUE_RGUI_BROWSER_DIRECTORY, @@ -1658,6 +1660,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE, "Habilitar Companheiro da Interface de Usuário") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, "Companheiro da Interface de Usuário Roda na Inicialização") +MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, + "Mostrar menu desktop na inicialização") +MSG_HASH(MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, + "Ativar menu desktop (reiniciar)") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, "Barra de Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, @@ -1849,7 +1855,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_FLATUI, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME, "Monocromático") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME_INVERTED, - "Monocromático Inverted") + "Monocromático Invertido") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_SYSTEMATIC, "Sistemático") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_NEOACTIVE, @@ -3491,10 +3497,14 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE, "Ativar espessura de preenchimento de borda") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Ativar espessura de preenchimento do plano de fundo") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "Para monitores CRT de 15 kHz apenas. Tenta usar a resolução exata do núcleo/jogo e a taxa de atualização.") -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, "Trocar para Resolução CRT") -MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, "Quando Trocar para Resolução CRT está ativada, força a resolução horizontal ultrawide para minimizar a alternância de modo.") -MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "Super Resolução CRT") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, + "Para monitores CRT de 15 kHz apenas. Tenta usar a resolução exata do núcleo/jogo e a taxa de atualização.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION, + "Trocar para Resolução CRT") +MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, + "Quando Trocar para Resolução CRT está ativada, força a resolução horizontal ultrawide para minimizar a alternância de modo.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, + "Super Resolução CRT") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, "Mostrar Configurações de Rebobinagem") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, @@ -3515,3 +3525,121 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_MIXER_SETTINGS, "Configurações do Mixer") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_SETTINGS, "Visualizar e/ou modificar as configurações do mixer de áudio.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_INFO, + "Informação") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE, + "&Arquivo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE, + "&Carregar Núcleo...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE, + "&Descarregar Núcleo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT, + "Sai&r") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT, + "&Editar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH, + "&Pesquisar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW, + "&Visualizar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS, + "Docas Fechadas") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS, + "&Opções...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_DOCK_POSITIONS, + "Lembrar posições da doca:") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_GEOMETRY, + "Lembrar geometria da janela:") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB, + "Lembrar a última guia do navegador de conteúdo:") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME, + "Tema") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_DARK, + "Escuro") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_CUSTOM, + "Personalizado...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_TITLE, + "Opções") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE, + "Carregar Núcleo Personalizado...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE, + "Carregar Núcleo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_LOADING_CORE, + "Carregando Núcleo...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_NAME, + "Nome") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION, + "Versão") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS, + "Listas de Reprodução") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER, + "Navegador de Arquivos") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_TOP, + "Topo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP, + "Subir") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER, + "Navegador de Conteúdo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART, + "Arte da Capa") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT, + "Captura de Tela") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN, + "Tela de Título") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ALL_PLAYLISTS, + "Todas as Listas de Reprodução") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CORE, + "Núcleo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CORE_INFO, + "Informação do Núcleo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CORE_SELECTION_ASK, + "") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_INFORMATION, + "Informação") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_WARNING, + "Advertência") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ERROR, + "Erro") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_RESTART_TO_TAKE_EFFECT, + "Por favor, reinicie o programa para que as alterações entrem em vigor.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_LOG, + "Relatório") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, + "Verificação Terminada.

\n" + "Para que o conteúdo seja digitalizado corretamente, você deve:\n" + "
  • ter um núcleo compatível já baixado
  • \n" + "
  • ter os \"Arquivos de Informação de Núcleo\" atualizados via Atualizador Online
  • \n" + "
  • ter a \"Base de Dados\" atualizada via Atualizador Online
  • \n" + "
  • reiniciar o RetroArch caso alguma das situações acima tenha sido feita
\n" + "E finalmente, o conteúdo deve corresponder as bases de dados existentes aqui. Se ainda não estiver funcionando, considere enviar um relatório de erro.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_DONT_SHOW_AGAIN, + "Não mostrar isto novamente") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_STOP, + "Parar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_ASSOCIATE_CORE, + "Associar Núcleo") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_HIDDEN_PLAYLISTS, + "Ocultar Listas de Reprodução") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_HIDE, + "Ocultar") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_HIGHLIGHT_COLOR, + "Cor de Destaque") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CHOOSE, + "&Escolher...") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_SELECT_COLOR, + "Selecionar Cor") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_SELECT_THEME, + "Selecionar Tema") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_CUSTOM_THEME, + "Tema Personalizado") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_PATH_IS_BLANK, + "O caminho do arquivo está em branco.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_IS_EMPTY, + "O arquivo está vazio.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED, + "Não foi possível abrir o arquivo para leitura.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST, + "O arquivo não existe.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, + "Sugerir carregar núcleo primeiro") From d5e62b731bd42843c3cf5cc35bfeab360dfe6625 Mon Sep 17 00:00:00 2001 From: altiereslima Date: Tue, 1 May 2018 19:25:17 -0300 Subject: [PATCH 007/112] update --- intl/msg_hash_pt_br.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 236837bf4a..708782f957 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -3642,4 +3642,4 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_READ_OPEN_FAILED, MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_FILE_DOES_NOT_EXIST, "O arquivo não existe.") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SUGGEST_LOADED_CORE_FIRST, - "Sugerir carregar núcleo primeiro") + "Sugerir primeiro núcleo carregado") From 17524d568109fb900553842747cef8876bfaf9d4 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 1 May 2018 18:45:43 -0400 Subject: [PATCH 008/112] add loglevel tag back --- verbosity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verbosity.c b/verbosity.c index 85a207471e..b55de6e883 100644 --- a/verbosity.c +++ b/verbosity.c @@ -193,7 +193,7 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) if (fp) { - fprintf(fp, "%s", buffer); + fprintf(fp, "%s %s", tag ? tag : file_path_str(FILE_PATH_LOG_INFO), buffer); fflush(fp); } From 95278d39f743a27719280635e9796ac3d3d9dc95 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 May 2018 01:03:25 +0200 Subject: [PATCH 009/112] Buildfix for MSVC 2003 --- gfx/common/win32_common.c | 185 ++++++++++++++++++++++++++++++++++++-- verbosity.c | 5 +- 2 files changed, 179 insertions(+), 11 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 247c810ef8..a46cf3b6d5 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -92,8 +92,175 @@ extern void *dinput_wgl; extern void *dinput; #endif -typedef LONG(CALLBACK* QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO*, UINT32*, DISPLAYCONFIG_MODE_INFO*, DISPLAYCONFIG_TOPOLOGY_ID*); -typedef LONG(CALLBACK* GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*); +typedef enum { + DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED_CUSTOM = 0, + DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE_CUSTOM = 1, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_CUSTOM = 2, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST_CUSTOM = DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_CUSTOM, + DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST_CUSTOM = 3, + DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM; + +typedef enum { + DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE_CUSTOM = 1, + DISPLAYCONFIG_MODE_INFO_TYPE_TARGET_CUSTOM = 2, + DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE_CUSTOM = 3, + DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_MODE_INFO_TYPE_CUSTOM; + +typedef enum { + DISPLAYCONFIG_PIXELFORMAT_8BPP_CUSTOM = 1, + DISPLAYCONFIG_PIXELFORMAT_16BPP_CUSTOM = 2, + DISPLAYCONFIG_PIXELFORMAT_24BPP_CUSTOM = 3, + DISPLAYCONFIG_PIXELFORMAT_32BPP_CUSTOM = 4, + DISPLAYCONFIG_PIXELFORMAT_NONGDI_CUSTOM = 5, + DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32_CUSTOM = 0xffffffff +} DISPLAYCONFIG_PIXELFORMAT_CUSTOM; + +typedef enum { + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER_CUSTOM = -1, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15_CUSTOM = 0, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO_CUSTOM = 1, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO_CUSTOM = 2, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO_CUSTOM = 3, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI_CUSTOM = 4, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI_CUSTOM = 5, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS_CUSTOM = 6, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN_CUSTOM = 8, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI_CUSTOM = 9, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL_CUSTOM = 10, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED_CUSTOM = 11, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL_CUSTOM = 12, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED_CUSTOM = 13, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE_CUSTOM = 14, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_MIRACAST_CUSTOM = 15, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL_CUSTOM = 0x80000000, + DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY_CUSTOM; + +typedef enum { + DISPLAYCONFIG_ROTATION_IDENTITY_CUSTOM = 1, + DISPLAYCONFIG_ROTATION_ROTATE90_CUSTOM = 2, + DISPLAYCONFIG_ROTATION_ROTATE180_CUSTOM = 3, + DISPLAYCONFIG_ROTATION_ROTATE270_CUSTOM = 4, + DISPLAYCONFIG_ROTATION_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_ROTATION_CUSTOM; + +typedef enum { + DISPLAYCONFIG_SCALING_IDENTITY_CUSTOM = 1, + DISPLAYCONFIG_SCALING_CENTERED_CUSTOM = 2, + DISPLAYCONFIG_SCALING_STRETCHED_CUSTOM = 3, + DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX_CUSTOM = 4, + DISPLAYCONFIG_SCALING_CUSTOM_CUSTOM = 5, + DISPLAYCONFIG_SCALING_PREFERRED_CUSTOM = 128, + DISPLAYCONFIG_SCALING_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_SCALING_CUST; + +typedef enum { + DISPLAYCONFIG_TOPOLOGY_INTERNAL_CUSTOM = 0x00000001, + DISPLAYCONFIG_TOPOLOGY_CLONE_CUSTOM = 0x00000002, + DISPLAYCONFIG_TOPOLOGY_EXTEND_CUSTOM = 0x00000004, + DISPLAYCONFIG_TOPOLOGY_EXTERNAL_CUSTOM = 0x00000008, + DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32_CUSTOM = 0xFFFFFFFF +} DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM; + +typedef struct DISPLAYCONFIG_RATIONAL_CUSTOM { + UINT32 Numerator; + UINT32 Denominator; +} DISPLAYCONFIG_RATIONAL_CUSTOM; + +typedef struct DISPLAYCONFIG_2DREGION_CUSTOM { + UINT32 cx; + UINT32 cy; +} DISPLAYCONFIG_2DREGION_CUSTOM; + +typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM { + UINT64 pixelRate; + DISPLAYCONFIG_RATIONAL_CUSTOM hSyncFreq; + DISPLAYCONFIG_RATIONAL_CUSTOM vSyncFreq; + DISPLAYCONFIG_2DREGION_CUSTOM activeSize; + DISPLAYCONFIG_2DREGION_CUSTOM totalSize; + union { + struct { + UINT32 videoStandard :16; + UINT32 vSyncFreqDivider :6; + UINT32 reserved :10; + } AdditionalSignalInfo; + UINT32 videoStandard; + }; + DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM scanLineOrdering; +} DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM; + +typedef struct DISPLAYCONFIG_TARGET_MODE_CUSTOM { + DISPLAYCONFIG_VIDEO_SIGNAL_INFO_CUSTOM targetVideoSignalInfo; +} DISPLAYCONFIG_TARGET_MODE_CUSTOM; + +typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM { + LUID adapterId; + UINT32 id; + union { + UINT32 modeInfoIdx; + struct { + UINT32 cloneGroupId :16; + UINT32 sourceModeInfoIdx :16; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + UINT32 statusFlags; +} DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM; + +typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM { + POINTL PathSourceSize; + RECTL DesktopImageRegion; + RECTL DesktopImageClip; +} DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM; + +typedef struct DISPLAYCONFIG_SOURCE_MODE_CUSTOM { + UINT32 width; + UINT32 height; + DISPLAYCONFIG_PIXELFORMAT_CUSTOM pixelFormat; + POINTL position; +} DISPLAYCONFIG_SOURCE_MODE_CUSTOM; + +typedef struct DISPLAYCONFIG_MODE_INFO_CUSTOM { + DISPLAYCONFIG_MODE_INFO_TYPE_CUSTOM infoType; + UINT32 id; + LUID adapterId; + union { + DISPLAYCONFIG_TARGET_MODE_CUSTOM targetMode; + DISPLAYCONFIG_SOURCE_MODE_CUSTOM sourceMode; + DISPLAYCONFIG_DESKTOP_IMAGE_INFO_CUSTOM desktopImageInfo; + }; +} DISPLAYCONFIG_MODE_INFO_CUSTOM; + +typedef struct DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM { + LUID adapterId; + UINT32 id; + union { + UINT32 modeInfoIdx; + struct { + UINT32 desktopModeInfoIdx :16; + UINT32 targetModeInfoIdx :16; + }; + }; + DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY_CUSTOM outputTechnology; + DISPLAYCONFIG_ROTATION_CUSTOM rotation; + DISPLAYCONFIG_SCALING_CUST scaling; + DISPLAYCONFIG_RATIONAL_CUSTOM refreshRate; + DISPLAYCONFIG_SCANLINE_ORDERING_CUSTOM scanLineOrdering; + BOOL targetAvailable; + UINT32 statusFlags; +} DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM; + + + +typedef struct DISPLAYCONFIG_PATH_INFO_CUSTOM { + DISPLAYCONFIG_PATH_SOURCE_INFO_CUSTOM sourceInfo; + DISPLAYCONFIG_PATH_TARGET_INFO_CUSTOM targetInfo; + UINT32 flags; +} DISPLAYCONFIG_PATH_INFO_CUSTOM; + +typedef LONG (*QUERYDISPLAYCONFIG)(UINT32, UINT32*, DISPLAYCONFIG_PATH_INFO_CUSTOM*, UINT32*, DISPLAYCONFIG_MODE_INFO_CUSTOM*, DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM*); +typedef LONG (*GETDISPLAYCONFIGBUFFERSIZES)(UINT32, UINT32*, UINT32*); static bool g_resized = false; bool g_restore_desktop = false; @@ -1273,11 +1440,11 @@ float win32_get_refresh_rate(void *data) float refresh_rate = 0.0f; #if _WIN32_WINNT >= 0x0601 || _WIN32_WINDOWS >= 0x0601 /* Win 7 */ OSVERSIONINFO version_info; - DISPLAYCONFIG_TOPOLOGY_ID TopologyID; + DISPLAYCONFIG_TOPOLOGY_ID_CUSTOM TopologyID; unsigned int NumPathArrayElements = 0; unsigned int NumModeInfoArrayElements = 0; - DISPLAYCONFIG_PATH_INFO *PathInfoArray = NULL; - DISPLAYCONFIG_MODE_INFO *ModeInfoArray = NULL; + DISPLAYCONFIG_PATH_INFO_CUSTOM *PathInfoArray = NULL; + DISPLAYCONFIG_MODE_INFO_CUSTOM *ModeInfoArray = NULL; int result = 0; #ifdef HAVE_DYNAMIC static QUERYDISPLAYCONFIG pQueryDisplayConfig; @@ -1307,10 +1474,10 @@ float win32_get_refresh_rate(void *data) if (result != ERROR_SUCCESS) return refresh_rate; - PathInfoArray = (DISPLAYCONFIG_PATH_INFO *) - malloc(sizeof(DISPLAYCONFIG_PATH_INFO) * NumPathArrayElements); - ModeInfoArray = (DISPLAYCONFIG_MODE_INFO *) - malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * NumModeInfoArrayElements); + PathInfoArray = (DISPLAYCONFIG_PATH_INFO_CUSTOM *) + malloc(sizeof(DISPLAYCONFIG_PATH_INFO_CUSTOM) * NumPathArrayElements); + ModeInfoArray = (DISPLAYCONFIG_MODE_INFO_CUSTOM *) + malloc(sizeof(DISPLAYCONFIG_MODE_INFO_CUSTOM) * NumModeInfoArrayElements); result = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &NumPathArrayElements, diff --git a/verbosity.c b/verbosity.c index b55de6e883..7b76838eb1 100644 --- a/verbosity.c +++ b/verbosity.c @@ -213,17 +213,18 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) void RARCH_LOG_BUFFER(uint8_t *data, size_t size) { - int i, offset; + unsigned i, offset; int padding = size % 16; uint8_t buf[16]; RARCH_LOG("== %d-byte buffer ==================\n", size); + for(i = 0, offset = 0; i < size; i++) { buf[offset] = data[i]; offset++; - if(offset == 16) + if (offset == 16) { offset = 0; RARCH_LOG("%02x%02x%02x%02x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x\n", From 3304dad7299b79169a3777c479ba23ccbc2f0db4 Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 1 May 2018 18:07:24 -0500 Subject: [PATCH 010/112] fix #6631 --- input/input_driver.c | 22 ++++++++++++++-------- input/input_mapper.c | 14 +++++++++++--- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index f51faf1c51..0e011eedc6 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -690,6 +690,16 @@ int16_t input_state(unsigned port, unsigned device, } } +#ifdef HAVE_OVERLAY + if (overlay_ptr) + input_state_overlay(overlay_ptr, &res, port, device, idx, id); +#endif + +#ifdef HAVE_NETWORKGAMEPAD + if (input_driver_remote) + input_remote_state(&res, port, device, idx, id); +#endif + if (((id < RARCH_FIRST_META_KEY) || (device == RETRO_DEVICE_KEYBOARD))) { bool bind_valid = libretro_input_binds[port] && libretro_input_binds[port][id].valid; @@ -702,8 +712,12 @@ int16_t input_state(unsigned port, unsigned device, joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx]; if (!reset_state) + { res = current_input->input_state( current_input_data, joypad_info, libretro_input_binds, port, device, idx, id); + if (input_overlay_is_alive(overlay_ptr) && port == 0) + res |= input_overlay_key_pressed(overlay_ptr, id); + } else res = 0; } @@ -713,15 +727,7 @@ int16_t input_state(unsigned port, unsigned device, input_mapper_state(input_driver_mapper, &res, port, device, idx, id); -#ifdef HAVE_OVERLAY - if (overlay_ptr) - input_state_overlay(overlay_ptr, &res, port, device, idx, id); -#endif -#ifdef HAVE_NETWORKGAMEPAD - if (input_driver_remote) - input_remote_state(&res, port, device, idx, id); -#endif /* Don't allow turbo for D-pad. */ if (device == RETRO_DEVICE_JOYPAD && (id < RETRO_DEVICE_ID_JOYPAD_UP || diff --git a/input/input_mapper.c b/input/input_mapper.c index e4140765ee..5d7cbd0b1b 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -84,11 +84,16 @@ void input_mapper_free(input_mapper_t *handle) void input_mapper_poll(input_mapper_t *handle) { unsigned i, j; - input_bits_t current_input; + input_bits_t current_input, current_overlay_input; settings_t *settings = config_get_ptr(); - unsigned max_users = + unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); bool key_event[RARCH_CUSTOM_BIND_LIST_END] = { false }; + bool poll_overlay = false; + + if (input_overlay_is_alive(overlay_ptr)) + poll_overlay = true; + #ifdef HAVE_MENU if (menu_driver_is_alive()) @@ -158,7 +163,10 @@ void input_mapper_poll(input_mapper_t *handle) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++) { unsigned current_button_value = BIT256_GET(current_input, j); - unsigned remap_button = + if (poll_overlay && i == 0) + current_button_value |= input_overlay_key_pressed(overlay_ptr, j); + + unsigned remap_button = settings->uints.input_remap_ids[i][j]; bool remap_valid = (current_button_value == 1) && (j != remap_button) && (remap_button != RARCH_UNMAPPED); From 99e4271f29a4152a331203734ac25989e872a073 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 1 May 2018 19:19:27 -0400 Subject: [PATCH 011/112] fix null dereference when there is no runahead save state list --- runahead/run_ahead.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runahead/run_ahead.c b/runahead/run_ahead.c index b5e84de396..71122ce6e6 100644 --- a/runahead/run_ahead.c +++ b/runahead/run_ahead.c @@ -361,7 +361,10 @@ static bool runahead_create(void) static bool runahead_save_state(void) { bool okay = false; - retro_ctx_serialize_info_t *serialize_info = + retro_ctx_serialize_info_t *serialize_info; + if (!runahead_save_state_list) + return false; + serialize_info = (retro_ctx_serialize_info_t*)runahead_save_state_list->data[0]; set_fast_savestate(); okay = core_serialize(serialize_info); From 237a705a820469333665df8f09f4ca887cb9dabf Mon Sep 17 00:00:00 2001 From: orbea Date: Tue, 1 May 2018 15:04:51 -0700 Subject: [PATCH 012/112] qb: Always print CC and CXX variables if set. --- qb/qb.libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index 2cf00c5998..e4fb0028b1 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -222,8 +222,8 @@ create_config_make() printf %s\\n "Creating make config: $outfile" - { [ "$USE_LANG_C" = 'yes' ] && printf %s\\n "CC = $CC" "CFLAGS = $CFLAGS" - [ "$USE_LANG_CXX" = 'yes' ] && printf %s\\n "CXX = $CXX" "CXXFLAGS = $CXXFLAGS" + { [ "${CC}" ] && printf %s\\n "CC = $CC" "CFLAGS = $CFLAGS" + [ "${CXX}" ] && printf %s\\n "CXX = $CXX" "CXXFLAGS = $CXXFLAGS" printf %s\\n "WINDRES = $WINDRES" \ "MOC = $MOC" \ From 0ed2a5307dde85f0e5229fc4e826d7a6a2579260 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 2 May 2018 01:03:10 -0400 Subject: [PATCH 013/112] Qt: always free string list --- ui/drivers/qt/ui_qt_window.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index 317501c79a..fd55465964 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -897,7 +897,7 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&) selectedAction = menu->exec(cursorPos); if (!selectedAction) - return; + goto end; if (!specialPlaylist && selectedAction->parent() == associateMenu.data()) { @@ -925,11 +925,6 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&) new_playlist_names, sizeof(settings->arrays.playlist_names)); strlcpy(settings->arrays.playlist_cores, new_playlist_cores, sizeof(settings->arrays.playlist_cores)); - - if (stnames) - string_list_free(stnames); - if (stcores) - string_list_free(stcores); } else if (selectedAction == hideAction.data()) { @@ -975,6 +970,12 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&) } setCoreActions(); + +end: + if (stnames) + string_list_free(stnames); + if (stcores) + string_list_free(stcores); } void MainWindow::onFileBrowserTreeContextMenuRequested(const QPoint&) From 4785893847db95c1060cbb571a938a44e3acbccd Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 2 May 2018 01:16:09 -0400 Subject: [PATCH 014/112] Qt: select the first visible item, which may not be row 0 --- ui/drivers/qt/ui_qt_window.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ui/drivers/qt/ui_qt_window.cpp b/ui/drivers/qt/ui_qt_window.cpp index fd55465964..12e59b2065 100644 --- a/ui/drivers/qt/ui_qt_window.cpp +++ b/ui/drivers/qt/ui_qt_window.cpp @@ -492,6 +492,7 @@ MainWindow::MainWindow(QWidget *parent) : QDir playlistDir(settings->paths.directory_playlist); QString configDir = QFileInfo(path_get(RARCH_PATH_CONFIG)).dir().absolutePath(); QToolButton *searchResetButton = NULL; + int i = 0; m_tableWidget->setAlternatingRowColors(true); @@ -631,7 +632,16 @@ MainWindow::MainWindow(QWidget *parent) : qApp->processEvents(); QTimer::singleShot(0, this, SLOT(onBrowserStartClicked())); - m_listWidget->setCurrentRow(0); + for (i = 0; i < m_listWidget->count(); i++) + { + /* select the first non-hidden row */ + if (!m_listWidget->isRowHidden(i)) + { + m_listWidget->setCurrentRow(i); + break; + } + } + m_searchLineEdit->setFocus(); m_loadCoreWindow->setWindowModality(Qt::ApplicationModal); @@ -2695,6 +2705,7 @@ void MainWindow::initContentTableWidget() QListWidgetItem *item = m_listWidget->currentItem(); QStringList horizontal_header_labels; QString path; + int i = 0; if (!item) return; @@ -2734,7 +2745,16 @@ void MainWindow::initContentTableWidget() m_tableWidget->sortByColumn(0, Qt::AscendingOrder); m_tableWidget->resizeColumnsToContents(); - m_tableWidget->selectRow(0); + + for (i = 0; i < m_tableWidget->rowCount(); i++) + { + /* select the first non-hidden row */ + if (!m_tableWidget->isRowHidden(i)) + { + m_tableWidget->selectRow(i); + break; + } + } onSearchEnterPressed(); } From 7448fd31578da315c9dd7ca4562a67f3df416cd3 Mon Sep 17 00:00:00 2001 From: gblues Date: Tue, 1 May 2018 23:23:40 -0700 Subject: [PATCH 015/112] More code re-organization === DETAILS Since @aliaspider wants the `wiiu/` to be something of a mini-SDK, I've reorganized the code I put in there: - `wiiu/main.c` now only has the ELF/RPX entrypoints, and the code used by those entrypoints, with RA code removed (e.g. swapped retro_sleep() for usleep()). These entrypoints then call main() ... - Moved `main()` and its support functions back into `frontend/drivers/platform_wiiu.c` I also renamed some of the support functions I wrote, and better organized them within the code. - Moved `wiiu/input/` into the `input/` hierarchy: * The joypad drivers now live in `input/drivers_joypad/wiiu/` * The HID driver now lives in `input/drivers_hid/` * The Wii U specific headers now live in `input/include/wiiu` * I added `input/include` into the include search path to avoid using really ugly relative includes --- Makefile.wiiu | 21 +- frontend/drivers/platform_wiiu.c | 294 +++++++++++++++++- {wiiu/input => input/drivers_hid}/wiiu_hid.c | 2 +- .../drivers_joypad/wiiu}/hidpad_driver.c | 3 +- .../drivers_joypad/wiiu}/kpad_driver.c | 2 +- .../drivers_joypad/wiiu}/pad_functions.c | 2 +- .../drivers_joypad/wiiu}/wpad_driver.c | 2 +- input/drivers_joypad/wiiu_joypad.c | 2 +- .../wiiu_hid.h => input/include/wiiu/hid.h | 5 +- .../include/wiiu/hid_types.h | 0 .../include/wiiu/input.h | 22 +- wiiu/main.c | 273 +--------------- wiiu/main.h | 7 +- 13 files changed, 333 insertions(+), 302 deletions(-) rename {wiiu/input => input/drivers_hid}/wiiu_hid.c (99%) rename {wiiu/input => input/drivers_joypad/wiiu}/hidpad_driver.c (98%) rename {wiiu/input => input/drivers_joypad/wiiu}/kpad_driver.c (99%) rename {wiiu/input => input/drivers_joypad/wiiu}/pad_functions.c (99%) rename {wiiu/input => input/drivers_joypad/wiiu}/wpad_driver.c (99%) rename wiiu/input/wiiu_hid.h => input/include/wiiu/hid.h (98%) rename wiiu/input/wiiu_hid_types.h => input/include/wiiu/hid_types.h (100%) rename wiiu/input/wiiu_input.h => input/include/wiiu/input.h (82%) diff --git a/Makefile.wiiu b/Makefile.wiiu index 68ecd41953..62b9c2665a 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -30,9 +30,9 @@ endif OBJ := OBJ += wiiu/main.o -OBJ += wiiu/input/wpad_driver.o -OBJ += wiiu/input/kpad_driver.o -OBJ += wiiu/input/pad_functions.o +OBJ += input/drivers_joypad/wiiu/wpad_driver.o +OBJ += input/drivers_joypad/wiiu/kpad_driver.o +OBJ += input/drivers_joypad/wiiu/pad_functions.o OBJ += wiiu/system/memory.o OBJ += wiiu/system/atomic.o OBJ += wiiu/system/exception_handler.o @@ -48,8 +48,8 @@ endif ifeq ($(WIIU_HID),1) DEFINES += -DWIIU_HID - OBJ += wiiu/input/hidpad_driver.o - OBJ += wiiu/input/wiiu_hid.o + OBJ += input/drivers_joypad/wiiu/hidpad_driver.o + OBJ += input/drivers_hid/wiiu_hid.o OBJ += input/connect/joypad_connection.o \ input/common/hid/hid_device_driver.o \ input/common/hid/device_wiiu_gca.o \ @@ -198,7 +198,16 @@ else ELF2RPL := $(ELF2RPL).exe endif -INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include +INCDIRS := -I. +INCDIRS += -Ideps +INCDIRS += -Ideps/stb +INCDIRS += -Ideps/libz +INCDIRS += -Ideps/7zip +INCDIRS += -Ilibretro-common/include +INCDIRS += -Iinput/include +INCDIRS += -Iwiiu +INCDIRS += -Iwiiu/include +INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib CFLAGS := -mwup -mcpu=750 -meabi -mhard-float diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index ee45f31c73..1f997633fe 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -14,6 +14,14 @@ * If not, see . */ +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -23,15 +31,27 @@ #include +#include +#include +#include +#include +#include +#include + #include "file_path_special.h" +#include "../frontend.h" #include "../frontend_driver.h" #include "../../defaults.h" #include "../../paths.h" #include "../../verbosity.h" +#include "../../retroarch.h" +#include "../../gfx/video_driver.h" + #include "hbl.h" #include "wiiu_dbg.h" +#include "system/exception_handler.h" #include "tasks/tasks_internal.h" #ifndef IS_SALAMANDER @@ -44,10 +64,7 @@ #define WIIU_USB_PATH "usb:/" /** - * The Wii U frontend driver. - * - * If you're looking for main() and friends, they've been moved to - * wiiu/main.c + * The Wii U frontend driver, along with the main() method. */ static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE; @@ -287,3 +304,272 @@ frontend_ctx_driver_t frontend_ctx_wiiu = "wiiu", NULL, /* get_video_driver */ }; + +/* main() and its supporting functions */ + +static void main_setup(void); +static void get_arguments(int *argc, char ***argv); +static void do_rarch_main(int argc, char **argv); +static void main_loop(void); +static void main_teardown(void); + +static void init_network(void); +static void init_logging(void); +static void deinit_logging(void); +static void wiiu_log_init(const char *ipString, int port); +static void wiiu_log_deinit(void); +static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len); +static void init_pad_libraries(void); +static void deinit_pad_libraries(void); +static void SaveCallback(void); +static bool swap_is_pending(void *start_time); + +static int wiiu_log_socket = -1; +static volatile int wiiu_log_lock = 0; + +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) +static devoptab_t dotab_stdout = +{ + "stdout_net", /* device name */ + 0, /* size of file structure */ + NULL, /* device open */ + NULL, /* device close */ + wiiu_log_write, /* device write */ + NULL, /* ... */ +}; +#endif /* defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) */ + +int main(int argc, char **argv) +{ + main_setup(); + get_arguments(&argc, &argv); + +#ifdef IS_SALAMANDER + int salamander_main(argc, argv); + salamander_main(argc, argv); +#else + do_rarch_main(argc, argv); + main_loop(); + main_exit(NULL); +#endif /* IS_SALAMANDER */ + main_teardown(); + + /* We always return 0 because if we don't, it can prevent loading a + * different RPX/ELF in HBL. */ + return 0; +} + +static void get_arguments(int *argc, char ***argv) +{ + DEBUG_VAR(ARGV_PTR); + if(ARGV_PTR && ((u32)ARGV_PTR < 0x01000000)) + { + struct + { + u32 magic; + u32 argc; + char *argv[3]; + } *param = ARGV_PTR; + if(param->magic == ARGV_MAGIC) + { + *argc = param->argc; + *argv = param->argv; + } + ARGV_PTR = NULL; + } + + DEBUG_VAR(argc); + DEBUG_VAR(argv[0]); + DEBUG_VAR(argv[1]); + fflush(stdout); +} + +static void main_setup(void) +{ + setup_os_exceptions(); + ProcUIInit(&SaveCallback); + init_network(); + init_logging(); + init_pad_libraries(); + verbosity_enable(); + fflush(stdout); +} + +static void main_teardown(void) +{ + deinit_pad_libraries(); + ProcUIShutdown(); + deinit_logging(); +} + +static void main_loop(void) +{ + unsigned sleep_ms = 0; + OSTime start_time; + int status; + + do + { + if(video_driver_get_ptr(false)) + { + start_time = OSGetSystemTime(); + task_queue_wait(swap_is_pending, &start_time); + } + else + task_queue_wait(NULL, NULL); + + status = runloop_iterate(&sleep_ms); + + if(status == 1 && sleep_ms > 0) + usleep(sleep_ms); + + if(status == -1) + break; + } while(true); +} + +static void do_rarch_main(int argc, char **argv) +{ +#if 0 + int argc_ = 2; + char *argv_[] = { WIIU_SD_PATH "retroarch/retroarch.elf", + WIIU_SD_PATH "rom.sfc", + NULL }; + rarch_main(argc_, argv_, NULL); +#else + rarch_main(argc, argv, NULL); +#endif /* if 0 */ +} + +static void SaveCallback(void) +{ + OSSavesDone_ReadyToRelease(); +} + +static bool swap_is_pending(void *start_time) +{ + uint32_t swap_count, flip_count; + OSTime last_flip, last_vsync; + + GX2GetSwapStatus(&swap_count, &flip_count, &last_flip, &last_vsync); + return last_vsync < *(OSTime *)start_time; +} + +static void init_network(void) +{ +#ifdef IS_SALAMANDER + socket_lib_init(); +#else + network_init(); +#endif /* IS_SALAMANDER */ +} + +static void init_logging(void) +{ +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) + wiiu_log_init(PC_DEVELOPMENT_IP_ADDRESS, PC_DEVELOPMENT_TCP_PORT); + devoptab_list[STD_OUT] = &dotab_stdout; + devoptab_list[STD_ERR] = &dotab_stdout; +#endif /* defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) */ +} + +static void deinit_logging(void) +{ + fflush(stdout); + fflush(stderr); + +#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) + wiiu_log_deinit(); +#endif /* defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) */ +} + + +static void wiiu_log_init(const char *ipString, int port) +{ + wiiu_log_lock = 0; + wiiu_log_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + if(wiiu_log_socket < 0) + return; + + struct sockaddr_in connect_addr; + memset(&connect_addr, 0, sizeof(connect_addr)); + connect_addr.sin_family = AF_INET; + connect_addr.sin_port = port; + inet_aton(ipString, &connect_addr.sin_addr); + + if(connect(wiiu_log_socket, + (struct sockaddr *)&connect_addr, + sizeof(connect_addr)) < 0) + { + socketclose(wiiu_log_socket); + wiiu_log_socket = -1; + } +} + +static void wiiu_log_deinit(void) +{ + if(wiiu_log_socket >= 0) + { + socketclose(wiiu_log_socket); + wiiu_log_socket = -1; + } +} + +static void init_pad_libraries(void) +{ +#ifndef IS_SALAMANDER + KPADInit(); + WPADEnableURCC(true); + WPADEnableWiiRemote(true); +#endif /* IS_SALAMANDER */ +} + +static void deinit_pad_libraries(void) +{ +#ifndef IS_SALAMANDER + KPADShutdown(); +#endif /* IS_SALAMANDER */ +} + +/* logging routines */ + +void net_print(const char *str) +{ + wiiu_log_write(NULL, 0, str, strlen(str)); +} + +void net_print_exp(const char *str) +{ + send(wiiu_log_socket, str, strlen(str), 0); +} + +static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len) +{ + if( wiiu_log_socket < 0) + return len; + + while(wiiu_log_lock) + OSSleepTicks(((248625000 / 4)) / 1000); + + wiiu_log_lock = 1; + + int ret; + int remaining = len; + + while(remaining > 0) + { + int block = remaining < 1400 ? remaining : 1400; + ret = send(wiiu_log_socket, ptr, block, 0); + + if(ret < 0) + break; + + remaining -= ret; + ptr += ret; + } + + wiiu_log_lock = 0; + + return len; +} diff --git a/wiiu/input/wiiu_hid.c b/input/drivers_hid/wiiu_hid.c similarity index 99% rename from wiiu/input/wiiu_hid.c rename to input/drivers_hid/wiiu_hid.c index 962e9323d8..221aea7e69 100644 --- a/wiiu/input/wiiu_hid.c +++ b/input/drivers_hid/wiiu_hid.c @@ -14,7 +14,7 @@ * If not, see . */ -#include "wiiu_hid.h" +#include #include static wiiu_event_list events; diff --git a/wiiu/input/hidpad_driver.c b/input/drivers_joypad/wiiu/hidpad_driver.c similarity index 98% rename from wiiu/input/hidpad_driver.c rename to input/drivers_joypad/wiiu/hidpad_driver.c index 03efe64d5c..e698757e8d 100644 --- a/wiiu/input/hidpad_driver.c +++ b/input/drivers_joypad/wiiu/hidpad_driver.c @@ -14,8 +14,7 @@ * If not, see . */ -#include "wiiu_input.h" -#include "wiiu_hid.h" +#include static bool hidpad_init(void *data); static bool hidpad_query_pad(unsigned pad); diff --git a/wiiu/input/kpad_driver.c b/input/drivers_joypad/wiiu/kpad_driver.c similarity index 99% rename from wiiu/input/kpad_driver.c rename to input/drivers_joypad/wiiu/kpad_driver.c index a3c7078357..b222eb7c20 100644 --- a/wiiu/input/kpad_driver.c +++ b/input/drivers_joypad/wiiu/kpad_driver.c @@ -20,7 +20,7 @@ * controllers. */ -#include "wiiu_input.h" +#include static bool kpad_init(void *data); static bool kpad_query_pad(unsigned pad); diff --git a/wiiu/input/pad_functions.c b/input/drivers_joypad/wiiu/pad_functions.c similarity index 99% rename from wiiu/input/pad_functions.c rename to input/drivers_joypad/wiiu/pad_functions.c index 5aefbaf23c..449f8037c1 100644 --- a/wiiu/input/pad_functions.c +++ b/input/drivers_joypad/wiiu/pad_functions.c @@ -14,7 +14,7 @@ * If not, see . */ -#include "wiiu_input.h" +#include enum wiiu_pad_axes { AXIS_LEFT_ANALOG_X, diff --git a/wiiu/input/wpad_driver.c b/input/drivers_joypad/wiiu/wpad_driver.c similarity index 99% rename from wiiu/input/wpad_driver.c rename to input/drivers_joypad/wiiu/wpad_driver.c index 4933a2dc3e..0bda8177bd 100644 --- a/wiiu/input/wpad_driver.c +++ b/input/drivers_joypad/wiiu/wpad_driver.c @@ -21,7 +21,7 @@ * - For HID controllers, see hid_driver.c */ -#include "wiiu_input.h" +#include #define PANIC_BUTTON_MASK (VPAD_BUTTON_R | VPAD_BUTTON_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_STICK_L) diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index 5728a90c6d..5553721cf1 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -14,7 +14,7 @@ * If not, see . */ -#include "../../wiiu/input/wiiu_input.h" +#include #include "wiiu_dbg.h" diff --git a/wiiu/input/wiiu_hid.h b/input/include/wiiu/hid.h similarity index 98% rename from wiiu/input/wiiu_hid.h rename to input/include/wiiu/hid.h index 0c96c9599c..8e2ffc47e0 100644 --- a/wiiu/input/wiiu_hid.h +++ b/input/include/wiiu/hid.h @@ -17,9 +17,8 @@ #ifndef __WIIU_HID__H #define __WIIU_HID__H -#include "wiiu_hid_types.h" - -#include "wiiu_input.h" +#include +#include #define DEVICE_UNUSED 0 #define DEVICE_USED 1 diff --git a/wiiu/input/wiiu_hid_types.h b/input/include/wiiu/hid_types.h similarity index 100% rename from wiiu/input/wiiu_hid_types.h rename to input/include/wiiu/hid_types.h diff --git a/wiiu/input/wiiu_input.h b/input/include/wiiu/input.h similarity index 82% rename from wiiu/input/wiiu_input.h rename to input/include/wiiu/input.h index 37416bc7e6..f10be960b9 100644 --- a/wiiu/input/wiiu_input.h +++ b/input/include/wiiu/input.h @@ -17,8 +17,8 @@ #ifndef __WIIU_INPUT__H #define __WIIU_INPUT__H -#include "wiiu_hid_types.h" -#include "../../input/include/gamepad.h" +#include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -33,15 +33,15 @@ #include #include -#include "../../input/input_driver.h" -#include "../../input/common/hid/hid_device_driver.h" -#include "../../tasks/tasks_internal.h" -#include "../../input/connect/joypad_connection.h" -#include "../../retroarch.h" -#include "../../verbosity.h" -#include "../../command.h" -#include "../../gfx/video_driver.h" -#include "wiiu_hid.h" +#include +#include "../../common/hid/hid_device_driver.h" +#include +#include +#include +#include +#include +#include +#include #define WIIMOTE_TYPE_WIIPLUS 0x00 #define WIIMOTE_TYPE_NUNCHUK 0x01 diff --git a/wiiu/main.c b/wiiu/main.c index 3e80bcb4ef..4a7c74ccc1 100644 --- a/wiiu/main.c +++ b/wiiu/main.c @@ -17,15 +17,11 @@ #include #include #include -#include -#include -#include - -#include #include #include #include +#include #include #include #include @@ -36,17 +32,15 @@ #include "main.h" /** - * This file contains the main entrypoints for the Wii U executable. + * This file contains the main entrypoints for the Wii U executable that + * set up the call to main(). */ static void fsdev_init(void); static void fsdev_exit(void); -#define WIIU_SD_PATH "sd:/" -#define WIIU_USB_PATH "usb:/" - -static int wiiu_log_socket = -1; -static volatile int wiiu_log_lock = 0; +static int iosuhaxMount = 0; +static int mcp_hook_fd = -1; /* HBL elf entry point */ int __entry_menu(int argc, char **argv) @@ -86,251 +80,6 @@ void _start(int argc, char **argv) exit(0); } -void wiiu_log_init(const char *ipString, int port) -{ - wiiu_log_lock = 0; - - wiiu_log_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - - if (wiiu_log_socket < 0) - return; - - struct sockaddr_in connect_addr; - memset(&connect_addr, 0, sizeof(connect_addr)); - connect_addr.sin_family = AF_INET; - connect_addr.sin_port = port; - inet_aton(ipString, &connect_addr.sin_addr); - - if (connect(wiiu_log_socket, (struct sockaddr *)&connect_addr, sizeof(connect_addr)) < 0) - { - socketclose(wiiu_log_socket); - wiiu_log_socket = -1; - } -} - -void wiiu_log_deinit(void) -{ - if (wiiu_log_socket >= 0) - { - socketclose(wiiu_log_socket); - wiiu_log_socket = -1; - } -} -static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len) -{ - if (wiiu_log_socket < 0) - return len; - - while (wiiu_log_lock) - OSSleepTicks(((248625000 / 4)) / 1000); - - wiiu_log_lock = 1; - - int ret; - int remaining = len; - - while (remaining > 0) - { - int block = remaining < 1400 ? remaining : 1400; // take max 1400 bytes per UDP packet - ret = send(wiiu_log_socket, ptr, block, 0); - - if (ret < 0) - break; - - remaining -= ret; - ptr += ret; - } - - wiiu_log_lock = 0; - - return len; -} -void net_print(const char *str) -{ - wiiu_log_write(NULL, 0, str, strlen(str)); -} - -void net_print_exp(const char *str) -{ - send(wiiu_log_socket, str, strlen(str), 0); -} - -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) -static devoptab_t dotab_stdout = -{ - "stdout_net", // device name - 0, // size of file structure - NULL, // device open - NULL, // device close - wiiu_log_write, // device write - NULL, - /* ... */ -}; -#endif - -void SaveCallback(void) -{ - OSSavesDone_ReadyToRelease(); -} - -static bool swap_is_pending(void* start_time) -{ - uint32_t swap_count, flip_count; - OSTime last_flip , last_vsync; - - GX2GetSwapStatus(&swap_count, &flip_count, &last_flip, &last_vsync); - - return last_vsync < *(OSTime*)start_time; -} - -static void do_network_init(void) -{ -#ifdef IS_SALAMANDER - socket_lib_init(); -#else - network_init(); -#endif -} - -static void init_pad_libraries(void) -{ -#ifndef IS_SALAMANDER - KPADInit(); - WPADEnableURCC(true); - WPADEnableWiiRemote(true); -#endif -} - -static void deinit_pad_libraries(void) -{ -#ifndef IS_SALAMANDER - KPADShutdown(); -#endif -} - -static void do_logging_init(void) -{ -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) - wiiu_log_init(PC_DEVELOPMENT_IP_ADDRESS, PC_DEVELOPMENT_TCP_PORT); - devoptab_list[STD_OUT] = &dotab_stdout; - devoptab_list[STD_ERR] = &dotab_stdout; -#endif -} - -static void do_logging_deinit(void) -{ - fflush(stdout); - fflush(stderr); - -#if defined(PC_DEVELOPMENT_IP_ADDRESS) && defined(PC_DEVELOPMENT_TCP_PORT) - wiiu_log_deinit(); -#endif -} - -static void do_rarch_main(int argc, char **argv) -{ -#if 0 - int argc_ = 2; -// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL}; - char *argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.sfc", NULL}; - - rarch_main(argc_, argv_, NULL); -#else /* #if 0 */ - rarch_main(argc, argv, NULL); -#endif /* #if 0 */ -} - -static void main_loop(void) -{ - unsigned sleep_ms = 0; - OSTime start_time; - int status; - - do - { - if(video_driver_get_ptr(false)) - { - start_time = OSGetSystemTime(); - task_queue_wait(swap_is_pending, &start_time); - } - else - task_queue_wait(NULL, NULL); - - status = runloop_iterate(&sleep_ms); - - if (status == 1 && sleep_ms > 0) - retro_sleep(sleep_ms); - - if (status == -1) - break; - } - while (1); -} - -static void main_init(void) -{ - setup_os_exceptions(); - ProcUIInit(&SaveCallback); - do_network_init(); - do_logging_init(); - init_pad_libraries(); - verbosity_enable(); - fflush(stdout); -} - -static void main_deinit(void) -{ - deinit_pad_libraries(); - ProcUIShutdown(); - - do_logging_deinit(); -} - -static void read_argc_argv(int *argc, char ***argv) -{ - DEBUG_VAR(ARGV_PTR); - if(ARGV_PTR && ((u32)ARGV_PTR < 0x01000000)) - { - struct - { - u32 magic; - u32 argc; - char * argv[3]; - }*param = ARGV_PTR; - if(param->magic == ARGV_MAGIC) - { - *argc = param->argc; - *argv = param->argv; - } - ARGV_PTR = NULL; - } - - DEBUG_VAR(argc); - DEBUG_STR(argv[0]); - DEBUG_STR(argv[1]); - fflush(stdout); -} - -int main(int argc, char **argv) -{ - main_init(); - read_argc_argv(&argc, &argv); - -#ifdef IS_SALAMANDER - int salamander_main(int, char **); - salamander_main(argc, argv); -#else - do_rarch_main(argc, argv); - main_loop(); - main_exit(NULL); -#endif /* IS_SALAMANDER */ - main_deinit(); - - /* returning non 0 here can prevent loading a different rpx/elf in the HBL - environment */ - return 0; -} - void __eabi(void) { @@ -368,8 +117,6 @@ void someFunc(void *arg) (void)arg; } -static int mcp_hook_fd = -1; - int MCPHookOpen(void) { //take over mcp thread @@ -380,7 +127,7 @@ int MCPHookOpen(void) IOS_IoctlAsync(mcp_hook_fd, 0x62, (void *)0, 0, (void *)0, 0, someFunc, (void *)0); //let wupserver start up - retro_sleep(1000); + usleep(1000); if (IOSUHAX_Open("/dev/mcp") < 0) { @@ -400,14 +147,11 @@ void MCPHookClose(void) //close down wupserver, return control to mcp IOSUHAX_Close(); //wait for mcp to return - retro_sleep(1000); + usleep(1000); IOS_Close(mcp_hook_fd); mcp_hook_fd = -1; } - -static int iosuhaxMount = 0; - static void fsdev_init(void) { iosuhaxMount = 0; @@ -424,6 +168,7 @@ static void fsdev_init(void) fatInitDefault(); } } + static void fsdev_exit(void) { if (iosuhaxMount) @@ -438,6 +183,4 @@ static void fsdev_exit(void) } else unmount_sd_fat("sd"); - } - diff --git a/wiiu/main.h b/wiiu/main.h index 0c2cbcf916..482d056abb 100644 --- a/wiiu/main.h +++ b/wiiu/main.h @@ -10,14 +10,9 @@ #include "system/memory.h" #include "system/exception_handler.h" -#include "../retroarch.h" -#include "../verbosity.h" -#include "../frontend/frontend.h" -#include "../gfx/video_driver.h" -#include "../tasks/tasks_internal.h" - void __init(void); void __fini(void); + int main(int argc, char **argv); #endif /* WIIU_MAIN_H */ From eac899f573476f3320287d2d8b8ffaca383e726a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 May 2018 13:52:27 +0200 Subject: [PATCH 016/112] Try to fix build for targets that don't have HAvE_OVERLAY defined --- input/input_driver.c | 7 +++++++ input/input_mapper.c | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 0e011eedc6..36386576dc 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -34,6 +34,10 @@ #include "input_remote.h" #endif +#ifdef HAVE_OVERLAY +#include "input_overlay.h" +#endif + #include "input_mapper.h" #include "input_driver.h" @@ -715,8 +719,11 @@ int16_t input_state(unsigned port, unsigned device, { res = current_input->input_state( current_input_data, joypad_info, libretro_input_binds, port, device, idx, id); + +#ifdef HAVE_OVERLAY if (input_overlay_is_alive(overlay_ptr) && port == 0) res |= input_overlay_key_pressed(overlay_ptr, id); +#endif } else res = 0; diff --git a/input/input_mapper.c b/input/input_mapper.c index 5d7cbd0b1b..1a1f613b18 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -41,6 +41,10 @@ #include "input_mapper.h" +#ifdef HAVE_OVERLAY +#include "input_overlay.h" +#endif + #include "../configuration.h" #include "../msg_hash.h" #include "../verbosity.h" @@ -89,11 +93,9 @@ void input_mapper_poll(input_mapper_t *handle) unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); bool key_event[RARCH_CUSTOM_BIND_LIST_END] = { false }; - bool poll_overlay = false; - - if (input_overlay_is_alive(overlay_ptr)) - poll_overlay = true; - +#ifdef HAVE_OVERLAY + bool poll_overlay = input_overlay_is_alive(overlay_ptr) ? true : false; +#endif #ifdef HAVE_MENU if (menu_driver_is_alive()) @@ -162,13 +164,17 @@ void input_mapper_poll(input_mapper_t *handle) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++) { + bool remap_valid; + unsigned remap_button; unsigned current_button_value = BIT256_GET(current_input, j); +#ifdef HAVE_OVERLAY if (poll_overlay && i == 0) current_button_value |= input_overlay_key_pressed(overlay_ptr, j); +#endif - unsigned remap_button = + remap_button = settings->uints.input_remap_ids[i][j]; - bool remap_valid = (current_button_value == 1) && + remap_valid = (current_button_value == 1) && (j != remap_button) && (remap_button != RARCH_UNMAPPED); if (remap_valid) From 212e857656927c26bf4c6e7679ac9d568f2b9879 Mon Sep 17 00:00:00 2001 From: altiereslima Date: Wed, 2 May 2018 09:38:24 -0300 Subject: [PATCH 017/112] Update Portuguese Brazilian translation --- intl/msg_hash_pt_br.h | 57 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 708782f957..61f6be4f2c 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -892,7 +892,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_PAUSE_TOGGLE, MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_QUIT_KEY, "Sair do RetroArch") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_RESET, - "Reinicializar jogo") + "Reiniciar jogo") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_REWIND, "Rebobinar") MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SAVE_STATE_KEY, @@ -993,8 +993,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_SPANISH, "Espanhol") MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_VIETNAMESE, "Vietnamita") -MSG_HASH( - MENU_ENUM_LABEL_VALUE_LANG_ARABIC, +MSG_HASH(MENU_ENUM_LABEL_VALUE_LANG_ARABIC, "Árabe") MSG_HASH(MENU_ENUM_LABEL_VALUE_LEFT_ANALOG, "Analógico Esquerdo") @@ -1649,7 +1648,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_BOXARTS, MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_SCREENSHOTS, "Captura de Tela") MSG_HASH(MENU_ENUM_LABEL_VALUE_THUMBNAIL_MODE_TITLE_SCREENS, - "Tela do Título") + "Telas do Título") MSG_HASH(MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE, "Exibir data e hora") MSG_HASH(MENU_ENUM_LABEL_VALUE_TITLE_COLOR, @@ -1663,7 +1662,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT, MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_COMPANION_TOGGLE, "Mostrar menu desktop na inicialização") MSG_HASH(MENU_ENUM_LABEL_VALUE_DESKTOP_MENU_ENABLE, - "Ativar menu desktop (reiniciar)") + "Habilitar menu desktop (reiniciar)") MSG_HASH(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE, "Barra de Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_UNABLE_TO_READ_COMPRESSED_FILE, @@ -1905,7 +1904,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_HISTORY, MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_ADD, "Exibir Aba de Importação de Conteúdo") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_PLAYLISTS, - "Exibir Guias da Lista de Reprodução") + "Exibir Abas de Lista de Reprodução") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_FAVORITES, "Exibir Aba de Favoritos") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_IMAGES, @@ -1933,9 +1932,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_TEST_UNOFFICIAL, MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_HARDCORE_MODE_ENABLE, "Habilitar ou desabilitar Estado de Jogo, Trapaças, Rebobinagem, Avanço Rápido, Pausa e Câmera Lenta para todos os jogos.") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_LEADERBOARDS_ENABLE, - "Ativar ou desativar tabelas de classificação no jogo. Não tem efeito se o modo Hardcore estiver desativado.") + "Habilitar ou desabilitar tabelas de classificação no jogo. Não tem efeito se o modo Hardcore estiver desativado.") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_BADGES_ENABLE, - "Ativar ou desativar a exibição de insígnia na Lista de Conquistas.") + "Habilitar ou desabilitar a exibição de insígnia na Lista de Conquistas.") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_VERBOSE_ENABLE, "Habilitar ou desabilitar detalhes das conquistas na tela.") MSG_HASH(MENU_ENUM_SUBLABEL_CHEEVOS_AUTO_SCREENSHOT, @@ -2763,7 +2762,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_ENABLE, - "Habilita Rebobinagem. Isso irá impactar o desempenho ao jogar." + "Habilita a Rebobinagem. Isso irá impactar o desempenho ao jogar." ) MSG_HASH( MENU_ENUM_SUBLABEL_REWIND_GRANULARITY, @@ -2799,7 +2798,7 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_AUTODETECT_ENABLE, - "Ativa a detecção automática de entrada. Tentará autoconfigurar joypads, estilo Plug-and-Play." + "Habilita a detecção automática de entrada. Tentará configurar automaticamente joypads, estilo Plug-and-Play." ) MSG_HASH( MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL, @@ -3029,7 +3028,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_DATABASE_MANAGER, MSG_HASH(MENU_ENUM_SUBLABEL_CURSOR_MANAGER, "Visualizar pesquisas anteriores.") MSG_HASH(MENU_ENUM_SUBLABEL_TAKE_SCREENSHOT, - "Capturar uma imagem da tela.") + "Captura uma imagem da tela.") MSG_HASH( MENU_ENUM_SUBLABEL_CLOSE_CONTENT, "Fecha o conteúdo atual. Alterações não salvas serão perdidas." @@ -3288,7 +3287,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_MIXER_MUTE, MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_ONLINE_UPDATER, "Exibir Atualizador Online") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_SHOW_ONLINE_UPDATER, - "Exibir a opção 'Atualizador Online'.") + "Exibir/ocultar a opção 'Atualizador Online'.") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_VIEWS_SETTINGS, "Visualizações") MSG_HASH( @@ -3330,9 +3329,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Habilitar/desabilitar os ícones exibidos do lado esquerdo dos itens de menu.") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Habilitar guia de configurações") + "Habilitar aba de configurações") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_SETTINGS_PASSWORD, - "Definir senha para habilitar guia de configurações") + "Definir senha para habilitar aba de configurações") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, "Digite a senha") MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, @@ -3340,15 +3339,15 @@ MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, "Senha incorreta.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Habilita a guia de configurações. É necessário reiniciar para que a guia apareça.") + "Habilita a aba de configurações. É necessário reiniciar para que a aba apareça.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_SETTINGS_PASSWORD, - "O fornecimento de uma senha ao ocultar a guia de configurações permite restaurar mais tarde a partir do menu, indo para a guia Menu Principal, selecionando Habilitar guia configurações e inserindo a senha.") + "O fornecimento de uma senha ao ocultar a aba de configurações permite restaurar mais tarde a partir do menu, indo para a aba Menu Principal, selecionando Habilitar aba configurações e inserindo a senha.") MSG_HASH(MENU_ENUM_SUBLABEL_PLAYLIST_ENTRY_RENAME, - "Permita que o usuário renomeie as entradas nas coleções.") + "Permita que o usuário renomeie os itens nas coleções.") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_ENTRY_RENAME, - "Permitir renomear entradas" ) + "Permitir renomear itens" ) MSG_HASH(MENU_ENUM_SUBLABEL_RENAME_ENTRY, - "Renomear o título da entrada.") + "Renomear o título do item.") MSG_HASH(MENU_ENUM_LABEL_VALUE_RENAME_ENTRY, "Renomear") MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_SHOW_LOAD_CORE, @@ -3462,7 +3461,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_GREEN, MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_MESSAGE_COLOR_BLUE, "Notificação em Cor Azul") MSG_HASH(MENU_ENUM_LABEL_VALUE_FRAMECOUNT_SHOW, - "Mostrar contagem de quadros na tela FPS") + "Exibir contagem de quadros na tela FPS") MSG_HASH(MSG_CONFIG_OVERRIDE_LOADED, "Substituição de configuração carregada.") MSG_HASH(MSG_GAME_REMAP_FILE_LOADED, @@ -3486,7 +3485,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_SHADER_WATCH_FOR_CHANGES, MSG_HASH(MENU_ENUM_SUBLABEL_SHADER_WATCH_FOR_CHANGES, "Aplicar automaticamente as alterações feitas nos arquivos de shader no disco.") MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SHOW_DECORATIONS, - "Mostrar Decorações da Janela") + "Exibir Decorações da Janela") MSG_HASH(MENU_ENUM_LABEL_VALUE_STATISTICS_SHOW, "Exibir estatísticas") MSG_HASH(MENU_ENUM_SUBLABEL_STATISTICS_SHOW, @@ -3506,17 +3505,17 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION_SUPER, MSG_HASH(MENU_ENUM_LABEL_VALUE_CRT_SWITCH_RESOLUTION_SUPER, "Super Resolução CRT") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_REWIND, - "Mostrar Configurações de Rebobinagem") + "Exibir Configurações de Rebobinagem") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_REWIND, - "Mostrar/ocultar as opções de Rebobinagem.") + "Exibir/ocultar as opções de Rebobinagem.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_LATENCY, - "Mostrar/ocultar as opções de Latência.") + "Exibir/ocultar as opções de Latência.") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_LATENCY, - "Mostrar Configurações de Latência") + "Exibir Configurações de Latência") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_SHOW_OVERLAYS, - "Mostrar/ocultar as opções de Sobreposição.") + "Exibir/ocultar as opções de Sobreposição.") MSG_HASH(MENU_ENUM_LABEL_VALUE_CONTENT_SHOW_OVERLAYS, - "Mostrar Configurações de Sobreposição") + "Exibir Configurações de Sobreposição") MSG_HASH(MENU_ENUM_LABEL_VALUE_AUDIO_ENABLE_MENU, "Ativar áudio de menu") MSG_HASH(MENU_ENUM_SUBLABEL_AUDIO_ENABLE_MENU, @@ -3550,7 +3549,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_DOCK_POSITIONS, MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_GEOMETRY, "Lembrar geometria da janela:") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_SAVE_LAST_TAB, - "Lembrar a última guia do navegador de conteúdo:") + "Lembrar a última aba do navegador de conteúdo:") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME, "Tema") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS_THEME_SYSTEM_DEFAULT, @@ -3607,7 +3606,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_LOG, "Relatório") MSG_HASH(MENU_ENUM_LABEL_VALUE_QT_SCAN_FINISHED, "Verificação Terminada.

\n" - "Para que o conteúdo seja digitalizado corretamente, você deve:\n" + "Para que o conteúdo seja verificado corretamente, você deve em ordem:\n" "
  • ter um núcleo compatível já baixado
  • \n" "
  • ter os \"Arquivos de Informação de Núcleo\" atualizados via Atualizador Online
  • \n" "
  • ter a \"Base de Dados\" atualizada via Atualizador Online
  • \n" From eff75a3bcdbf8f377fbd91b41245a391bd9b118e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 May 2018 19:29:48 +0200 Subject: [PATCH 018/112] Move nbio_buf_t to task_audio_mixer.c --- tasks/task_audio_mixer.c | 6 ++++++ tasks/tasks_internal.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/task_audio_mixer.c b/tasks/task_audio_mixer.c index 69772849fe..cc9d7cbfb2 100644 --- a/tasks/task_audio_mixer.c +++ b/tasks/task_audio_mixer.c @@ -33,6 +33,12 @@ #include "tasks_internal.h" +typedef struct nbio_buf +{ + void *buf; + unsigned bufsize; +} nbio_buf_t; + struct audio_mixer_handle { nbio_buf_t *buffer; diff --git a/tasks/tasks_internal.h b/tasks/tasks_internal.h index 766f593d14..1e04454e14 100644 --- a/tasks/tasks_internal.h +++ b/tasks/tasks_internal.h @@ -37,12 +37,6 @@ RETRO_BEGIN_DECLS typedef int (*transfer_cb_t)(void *data, size_t len); -typedef struct nbio_buf -{ - void *buf; - unsigned bufsize; -} nbio_buf_t; - enum content_mode_load { CONTENT_MODE_LOAD_NONE = 0, From 2fce9127d004e53c2665b4a505929c145dfa8717 Mon Sep 17 00:00:00 2001 From: orbea Date: Wed, 2 May 2018 10:44:45 -0700 Subject: [PATCH 019/112] Makefile.common: Fix vulkan builds on 32-bit linux. --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index c3ac7be651..dce6b77e31 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1189,7 +1189,7 @@ ifeq ($(HAVE_VULKAN), 1) ifeq ($(HAVE_MENU_COMMON), 1) OBJ += menu/drivers_display/menu_display_vulkan.o endif - #LIBS += -lstdc++ + NEED_CXX_LINKER = 1 DEFINES += -DHAVE_VULKAN INCLUDE_DIRS += -Igfx/include From 9fbfd503af3ae6e6fff564117c455fd25f8791ee Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 May 2018 20:13:13 +0200 Subject: [PATCH 020/112] Add value descriptions for audio mixer streams --- audio/audio_driver.c | 15 +++++++++++++++ audio/audio_driver.h | 4 ++++ menu/cbs/menu_cbs_get_value.c | 29 ++++++++++++++++++++++++++++- tasks/task_audio_mixer.c | 22 ++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/audio/audio_driver.c b/audio/audio_driver.c index dfa853cfa1..9293ddcaa4 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -196,6 +196,15 @@ audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i) return &audio_mixer_streams[i]; } +const char *audio_driver_mixer_get_stream_name(unsigned i) +{ + if (i > (AUDIO_MIXER_MAX_STREAMS-1)) + return NULL; + if (!string_is_empty(audio_mixer_streams[i].name)) + return audio_mixer_streams[i].name; + return "N/A"; +} + /** * compute_audio_buffer_statistics: * @@ -1145,6 +1154,7 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params) audio_mixer_active = true; } + audio_mixer_streams[free_slot].name = !string_is_empty(params->basename) ? strdup(params->basename) : NULL; audio_mixer_streams[free_slot].buf = buf; audio_mixer_streams[free_slot].handle = handle; audio_mixer_streams[free_slot].voice = voice; @@ -1274,11 +1284,16 @@ void audio_driver_mixer_remove_stream(unsigned i) audio_mixer_sound_t *handle = audio_mixer_streams[i].handle; if (handle) audio_mixer_destroy(handle); + + if (!string_is_empty(audio_mixer_streams[i].name)) + free(audio_mixer_streams[i].name); + audio_mixer_streams[i].state = AUDIO_STREAM_STATE_NONE; audio_mixer_streams[i].stop_cb = NULL; audio_mixer_streams[i].volume = 0.0f; audio_mixer_streams[i].handle = NULL; audio_mixer_streams[i].voice = NULL; + audio_mixer_streams[i].name = NULL; } } diff --git a/audio/audio_driver.h b/audio/audio_driver.h index 440e563ba1..95efadd41b 100644 --- a/audio/audio_driver.h +++ b/audio/audio_driver.h @@ -64,6 +64,7 @@ typedef struct audio_mixer_stream enum audio_mixer_state state; float volume; void *buf; + char *name; size_t bufsize; } audio_mixer_stream_t; @@ -164,6 +165,7 @@ typedef struct audio_mixer_stream_params enum audio_mixer_type type; enum audio_mixer_state state; void *buf; + char *basename; size_t bufsize; audio_mixer_stop_cb_t cb; } audio_mixer_stream_params_t; @@ -306,6 +308,8 @@ enum resampler_quality audio_driver_get_resampler_quality(void); enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i); +const char *audio_driver_mixer_get_stream_name(unsigned i); + bool compute_audio_buffer_statistics(audio_statistics_t *stats); extern audio_driver_t audio_rsound; diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index a015d5ec39..9e8d03bece 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -57,6 +57,26 @@ extern struct key_desc key_descriptors[RARCH_MAX_KEYS]; +static void menu_action_setting_audio_mixer_stream_name( + file_list_t* list, + unsigned *w, unsigned type, unsigned i, + const char *label, + char *s, size_t len, + const char *entry_label, + const char *path, + char *s2, size_t len2) +{ + unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN); + + *w = 19; + strlcpy(s2, path, len2); + + if (offset >= AUDIO_MIXER_MAX_STREAMS) + return; + + strlcpy(s, audio_driver_mixer_get_stream_name(offset), len); +} + static void menu_action_setting_audio_mixer_stream_volume( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -2115,7 +2135,14 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( static int menu_cbs_init_bind_get_string_representation_compare_type( menu_file_list_cbs_t *cbs, unsigned type) { - if (type >= MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN + if (type >= MENU_SETTINGS_AUDIO_MIXER_STREAM_BEGIN + && type <= MENU_SETTINGS_AUDIO_MIXER_STREAM_END) + { + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_audio_mixer_stream_name); + return 0; + } + else if (type >= MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN && type <= MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_END) { BIND_ACTION_GET_VALUE(cbs, diff --git a/tasks/task_audio_mixer.c b/tasks/task_audio_mixer.c index cc9d7cbfb2..2943504e9d 100644 --- a/tasks/task_audio_mixer.c +++ b/tasks/task_audio_mixer.c @@ -21,6 +21,7 @@ #include #include +#include #include