diff --git a/Makefile.griffin b/Makefile.griffin index 45dcef8553..d4f9d6d5ea 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -344,7 +344,6 @@ else ifeq ($(platform), windows_msvc6_x86) export INCLUDE := $(INCLUDE);$(INETSDK)\Include;libretro-common\include;libretro-common\include\compat\msvc export LIB := $(LIB);$(INETSDK)\Lib - export INETSDK := $(INETSDK) else ifeq ($(platform), windows_msvc2003_x86) HAVE_RPNG := 1 HAVE_RJPEG := 1 @@ -383,11 +382,9 @@ else ifeq ($(platform), windows_msvc2003_x86) INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/include") LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib") - export INETSDK := $(INETSDK) - ifeq ($(HAVE_DIRECTX), 1) PLATCFLAGS += -DHAVE_DINPUT -DHAVE_DSOUND - export DXSDK_DIR := $(DXSDK_DIR) + DXSDK_DIR := $(DXSDK_DIR:\=) export INCLUDE := $(INCLUDE);$(INETSDK)\Include;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc export LIB := $(LIB);$(INETSDK)\Lib;$(DXSDK_DIR)\Lib\x86 else @@ -433,11 +430,9 @@ else ifeq ($(platform), windows_msvc2005_x86) INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/include") LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/lib") - export INETSDK := $(INETSDK) - ifeq ($(HAVE_DIRECTX), 1) PLATCFLAGS += -DHAVE_DINPUT -DHAVE_DSOUND - export DXSDK_DIR := $(DXSDK_DIR) + DXSDK_DIR := $(DXSDK_DIR:\=) export INCLUDE := $(INCLUDE);$(INETSDK)\Include;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc export LIB := $(LIB);$(INETSDK)\Lib;$(DXSDK_DIR)\Lib\x86 else @@ -502,16 +497,18 @@ else ifneq (,$(findstring windows_msvc2010,$(platform))) PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE") INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/include") - export INETSDK := $(INETSDK) + WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*') + WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*') + WindowsSdkDir := $(WindowsSdkDir:\=) ifeq ($(HAVE_DIRECTX), 1) PLATCFLAGS += -DHAVE_DINPUT -DHAVE_DSOUND -DHAVE_D3D -DHAVE_D3D9 -DHAVE_XAUDIO -DHAVE_XINPUT - export DXSDK_DIR := $(DXSDK_DIR) - export INCLUDE := $(INCLUDE);$(INETSDK)\Include;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include - export LIB := $(LIB);$(INETSDK)\$(PlatLib);$(DXSDK_DIR)\Lib\$(WinArch) + DXSDK_DIR := $(DXSDK_DIR:\=) + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib);$(DXSDK_DIR)\Lib\$(WinArch) else - export INCLUDE := $(INCLUDE);$(INETSDK)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include - export LIB := $(LIB);$(INETSDK)\$(PlatLib) + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib) endif else ifneq (,$(findstring windows_msvc2012,$(platform))) HAVE_RPNG := 1 @@ -576,16 +573,92 @@ else ifneq (,$(findstring windows_msvc2012,$(platform))) PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS110COMNTOOLS)../IDE") INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS110COMNTOOLS)../../VC/include") - export INETSDK := $(INETSDK) + WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -v "KitsRoot81" | grep -o '[A-Z]:\\.*') + WindowsSdkDir := $(WindowsSdkDir:\=) ifeq ($(HAVE_DIRECTX), 1) PLATCFLAGS += -DHAVE_DINPUT -DHAVE_DSOUND -DHAVE_D3D -DHAVE_D3D9 -DHAVE_XAUDIO -DHAVE_XINPUT - export DXSDK_DIR := $(DXSDK_DIR) - export INCLUDE := $(INCLUDE);$(INETSDK)\Include\um;$(INETSDK)\Include\shared;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include - export LIB := $(LIB);$(INETSDK)\$(PlatLib);$(DXSDK_DIR)\Lib\$(WinArch) + DXSDK_DIR := $(DXSDK_DIR:\=) + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include\um;$(WindowsSdkDir)\Include\shared;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib);$(DXSDK_DIR)\Lib\$(WinArch) else - export INCLUDE := $(INCLUDE);$(INETSDK)\Include\um;$(INETSDK)\Include\shared;libretro-common\include;libretro-common\include\compat\msvc;gfx\include - export LIB := $(LIB);$(INETSDK)\$(PlatLib) + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include\um;$(WindowsSdkDir)\Include\shared;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib) + endif +else ifneq (,$(findstring windows_msvc2013,$(platform))) + HAVE_RPNG := 1 + HAVE_RJPEG := 1 + HAVE_RBMP := 1 + HAVE_RTGA := 1 + HAVE_ZLIB := 1 + WANT_ZLIB := 1 + HAVE_7ZIP := 1 + HAVE_NETWORKING := 1 + HAVE_NETWORK_CMD := 1 + HAVE_OVERLAY := 1 + HAVE_MATERIALUI := 1 + HAVE_XMB := 1 + HAVE_STB_FONT := 1 + HAVE_THREADS := 1 + HAVE_LIBRETRODB := 1 + HAVE_FBO := 1 + HAVE_COMMAND := 1 + HAVE_STDIN_CMD := 1 + HAVE_CMD := 1 + HAVE_DYLIB := 1 + HAVE_DYNAMIC := 1 + HAVE_GRIFFIN_CPP := 1 + HAVE_DIRECTX ?= 1 + + EXT_TARGET := $(TARGET_NAME).exe + EXT_INTER_TARGET := $(TARGET_NAME).exe + CC = cl.exe + CXX = cl.exe + LD = link.exe + + PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS + PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 + LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib + + PlatformSuffix = $(subst windows_msvc2013_,,$(platform)) + + ifneq (,$(findstring x64,$(PlatformSuffix))) + ifeq ($(HOST_ARCH),x86) + # cross-compile for x64 from x86 host + PATH := $(shell IFS=$$'\n'; cygpath "$(VS120COMNTOOLS)../../VC/bin/x86_amd64"):$(PATH) + else + PATH := $(shell IFS=$$'\n'; cygpath "$(VS120COMNTOOLS)../../VC/bin/amd64"):$(PATH) + endif + + LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS120COMNTOOLS)../../VC/lib/amd64") + WinArch = x64 + PlatLib = Lib\winv6.3\um\x64 + else ifneq (,$(findstring arm,$(PlatformSuffix))) + PATH := $(shell IFS=$$'\n'; cygpath "$(VS120COMNTOOLS)../../VC/bin/x86_arm"):$(PATH) + LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS120COMNTOOLS)../../VC/lib/arm") + HAVE_DIRECTX = 0 + PlatLib = Lib\winv6.3\um\arm + else + PATH := $(shell IFS=$$'\n'; cygpath "$(VS120COMNTOOLS)../../VC/bin"):$(PATH) + LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS120COMNTOOLS)../../VC/lib") + WinArch = x86 + PlatLib = Lib\winv6.3\um\x86 + endif + + PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS120COMNTOOLS)../IDE") + INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS120COMNTOOLS)../../VC/include") + + WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -v "KitsRoot81" | grep -o '[A-Z]:\\.*') + WindowsSdkDir := $(WindowsSdkDir:\=) + + ifeq ($(HAVE_DIRECTX), 1) + PLATCFLAGS += -DHAVE_DINPUT -DHAVE_DSOUND -DHAVE_D3D -DHAVE_D3D9 -DHAVE_XAUDIO -DHAVE_XINPUT + DXSDK_DIR := $(DXSDK_DIR:\=) + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include\um;$(WindowsSdkDir)\Include\shared;$(DXSDK_DIR)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib);$(DXSDK_DIR)\Lib\$(WinArch) + else + export INCLUDE := $(INCLUDE);$(WindowsSdkDir)\Include\um;$(WindowsSdkDir)\Include\shared;libretro-common\include;libretro-common\include\compat\msvc;gfx\include + export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib) endif endif diff --git a/command.c b/command.c index a53ef71d06..499931aa85 100644 --- a/command.c +++ b/command.c @@ -1015,6 +1015,7 @@ static void command_event_init_controllers(void) RARCH_LOG("%s %u.\n", msg_hash_to_str(MSG_VALUE_DISCONNECTING_DEVICE_FROM_PORT), i + 1); + set_controller = true; break; case RETRO_DEVICE_JOYPAD: break; @@ -1023,14 +1024,18 @@ static void command_event_init_controllers(void) * This is broken behavior of course, but avoid breaking * cores needlessly. */ RARCH_LOG("%s %u: %s (ID: %u).\n", - msg_hash_to_str(MSG_CONNECTING_TO_PORT), - device, ident, i+1); + msg_hash_to_str(MSG_CONNECTING_TO_PORT), + device, ident, i+1); + set_controller = true; break; } - pad.device = device; - pad.port = i; - core_set_controller_port_device(&pad); + if (set_controller) + { + pad.device = device; + pad.port = i; + core_set_controller_port_device(&pad); + } } } @@ -1305,7 +1310,7 @@ static void command_event_restore_default_shader_preset(void) static void command_event_restore_remaps(void) { if (rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL)) - input_remapping_set_defaults(); + input_remapping_set_defaults(true); } static bool command_event_save_auto_state(void) diff --git a/configuration.c b/configuration.c index b0cbe90ee8..3f9a0a0abc 100644 --- a/configuration.c +++ b/configuration.c @@ -1586,7 +1586,7 @@ static void config_set_defaults(void) #endif input_config_reset(); - input_remapping_set_defaults(); + input_remapping_set_defaults(true); input_autoconfigure_reset(); /* Verify that binds are in proper order. */ @@ -3009,7 +3009,7 @@ bool config_load_remap(void) else { RARCH_LOG("Remaps: no game-specific remap found at %s.\n", game_path); - input_remapping_set_defaults(); + input_remapping_set_defaults(false); } /* Create a new config file from core_path */ @@ -3029,7 +3029,7 @@ bool config_load_remap(void) else { RARCH_LOG("Remaps: no core-specific remap found at %s.\n", core_path); - input_remapping_set_defaults(); + input_remapping_set_defaults(false); } new_conf = NULL; diff --git a/input/drivers/winraw_input.c b/input/drivers/winraw_input.c index 738d033f6c..a6a85a5160 100644 --- a/input/drivers/winraw_input.c +++ b/input/drivers/winraw_input.c @@ -56,6 +56,9 @@ typedef struct static winraw_keyboard_t *g_keyboard = NULL; static winraw_mouse_t *g_mice = NULL; static unsigned g_mouse_cnt = 0; +static bool g_mouse_xy_mapping_ready = false; +static double g_view_abs_ratio_x = 0.0; +static double g_view_abs_ratio_y = 0.0; static HWND winraw_create_window(WNDPROC wnd_proc) { @@ -304,14 +307,48 @@ static int16_t winraw_joypad_state(winraw_input_t *wr, return input_joypad_pressed(wr->joypad, joypad_info, port, binds, id); } +static void winraw_init_mouse_xy_mapping() +{ + struct video_viewport viewport; + int center_x; + int center_y; + unsigned i; + + if (video_driver_get_viewport_info(&viewport)) + { + center_x = viewport.x + viewport.width / 2; + center_y = viewport.y + viewport.height / 2; + + for (i = 0; i < g_mouse_cnt; ++i) + { + g_mice[i].x = center_x; + g_mice[i].y = center_y; + } + + g_view_abs_ratio_x = (double)viewport.full_width / 65535.0; + g_view_abs_ratio_y = (double)viewport.full_height / 65535.0; + + g_mouse_xy_mapping_ready = true; + } +} + static void winraw_update_mouse_state(winraw_mouse_t *mouse, RAWMOUSE *state) { POINT crs_pos; if (state->usFlags & MOUSE_MOVE_ABSOLUTE) { - mouse->x = state->lLastX; - mouse->y = state->lLastY; + if (g_mouse_xy_mapping_ready) + { + state->lLastX = (LONG)(g_view_abs_ratio_x * state->lLastX); + state->lLastY = (LONG)(g_view_abs_ratio_y * state->lLastY); + InterlockedExchangeAdd(&mouse->dlt_x, state->lLastX - mouse->x); + InterlockedExchangeAdd(&mouse->dlt_y, state->lLastY - mouse->y); + mouse->x = state->lLastX; + mouse->y = state->lLastY; + } + else + winraw_init_mouse_xy_mapping(); } else if (state->lLastX || state->lLastY) { @@ -558,6 +595,8 @@ static void winraw_free(void *d) free(wr->mice); free(wr); + g_mouse_xy_mapping_ready = false; + WINRAW_LOG("Input driver deinitialized."); } diff --git a/input/input_remapping.c b/input/input_remapping.c index 5a0f650ac4..9f147bbf8c 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -246,10 +246,21 @@ bool input_remapping_remove_file(const char *path) return ret; } -void input_remapping_set_defaults(void) +void input_remapping_set_defaults(bool deinit) { unsigned i, j; settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + + if (!global) + return; + + if (deinit) + { + global->name.remapfile[0] = '\0'; + rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL); + rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL); + } for (i = 0; i < MAX_USERS; i++) { diff --git a/input/input_remapping.h b/input/input_remapping.h index 147136f1ef..12316e1115 100644 --- a/input/input_remapping.h +++ b/input/input_remapping.h @@ -47,7 +47,7 @@ bool input_remapping_save_file(const char *path); bool input_remapping_remove_file(const char *path); -void input_remapping_set_defaults(void); +void input_remapping_set_defaults(bool deinit); RETRO_END_DECLS diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b0ce5b8410..9b2c920698 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2151,7 +2151,7 @@ static int generic_action_ok_remap_file_operation(const char *path, { if (action_type == ACTION_OK_REMAP_FILE_SAVE_CORE) rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL); - else + else if (action_type == ACTION_OK_REMAP_FILE_SAVE_GAME) rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL); runloop_msg_queue_push( @@ -2167,10 +2167,19 @@ static int generic_action_ok_remap_file_operation(const char *path, { if(input_remapping_remove_file(file)) { - if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE) + if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE && + rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL)) + { rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL); - else + input_remapping_set_defaults(true); + } + + else if (action_type == ACTION_OK_REMAP_FILE_REMOVE_GAME && + rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL)) + { rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL); + input_remapping_set_defaults(true); + } runloop_msg_queue_push( msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY), diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index e6225eec3b..57e988171c 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -48,13 +48,7 @@ static int action_start_remap_file_load(unsigned type, const char *label) { - global_t *global = global_get_ptr(); - - if (!global) - return -1; - - global->name.remapfile[0] = '\0'; - input_remapping_set_defaults(); + input_remapping_set_defaults(true); return 0; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c0c2de2243..89298adca0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3516,16 +3516,20 @@ static int menu_displaylist_parse_options_remappings( { for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++) { - char desc_label[64]; unsigned user = settings->uints.keymapper_port + 1; unsigned desc_offset = retro_id; - const char *description = NULL; + char descriptor[255]; + const struct retro_keybind *auto_bind = NULL; + const struct retro_keybind *keybind = NULL; - desc_label[0] = '\0'; + keybind = &input_config_binds[settings->uints.keymapper_port][retro_id]; + auto_bind = (const struct retro_keybind*) + input_config_get_bind_auto(settings->uints.keymapper_port, retro_id); + + input_config_get_bind_string(descriptor, + keybind, auto_bind, sizeof(descriptor)); - snprintf(desc_label, sizeof(desc_label), - "%s: ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B + retro_id)); - menu_entries_append_enum(info->list, desc_label, "", + menu_entries_append_enum(info->list, descriptor, "", MSG_UNKNOWN, MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id, 0, 0); }