diff --git a/build-windows-visual-studio/sm64ex.vcxproj.filters b/build-windows-visual-studio/sm64ex.vcxproj.filters
index bc6bc802..adc2b0ad 100644
--- a/build-windows-visual-studio/sm64ex.vcxproj.filters
+++ b/build-windows-visual-studio/sm64ex.vcxproj.filters
@@ -14793,9 +14793,6 @@
Source Files\src\pc\audio
-
- Source Files\src\pc\audio
-
Source Files\src\pc
@@ -15270,6 +15267,9 @@
Source Files\src\pc\djui\component\compound
+
+ Source Files\src\pc\controller
+
diff --git a/developer/dx.sh b/developer/dx.sh
new file mode 100644
index 00000000..28c87575
--- /dev/null
+++ b/developer/dx.sh
@@ -0,0 +1,7 @@
+function compiler() {
+ make RENDER_API=$1 WINDOW_API=$2 AUDIO_API=$3 CONTROLLER_API=$4
+}
+
+compiler D3D12 DXGI SDL2 SDL2 d3d12_2
+
+./build/us_pc/sm64.us.f3dex2e.exe
diff --git a/developer/flags.sh b/developer/flags.sh
index 4cc9e953..c41dde64 100644
--- a/developer/flags.sh
+++ b/developer/flags.sh
@@ -4,7 +4,13 @@ set -e
function compiler() {
make clean
make RENDER_API=$1 WINDOW_API=$2 AUDIO_API=$3 CONTROLLER_API=$4
- mv ./build/us_pc/sm64.us.f3dex2e.exe ./build/us_pc/$5.exe
+ mv ./build ./build_$5
+}
+
+function compiler_no_discord() {
+ make clean
+ make DISCORD_SDK=0
+ mv ./build ./build_no_discord
}
compiler GL_LEGACY SDL1 SDL1 SDL1 legacy_1
@@ -13,6 +19,8 @@ compiler D3D11 DXGI SDL1 SDL1 d3d11_1
compiler D3D12 DXGI SDL1 SDL1 d3d12_1
compiler GL_LEGACY SDL2 SDL2 SDL2 legacy_2
-compiler GL SDL1 SDL2 SDL2 gl_2
+compiler GL SDL2 SDL2 SDL2 gl_2
compiler D3D11 DXGI SDL2 SDL2 d3d11_2
compiler D3D12 DXGI SDL2 SDL2 d3d12_2
+
+compiler_no_discord
diff --git a/src/pc/controller/controller_sdl1.c b/src/pc/controller/controller_sdl1.c
index d913f147..d332e707 100644
--- a/src/pc/controller/controller_sdl1.c
+++ b/src/pc/controller/controller_sdl1.c
@@ -5,6 +5,10 @@
#include
#include
+#if defined(_WIN32)
+#include
+#endif
+
#include
// Analog camera movement by Pathétique (github.com/vrmiguel), y0shin and Mors
@@ -20,6 +24,8 @@
#include "game/level_update.h"
+#include "pc/djui/djui.h"
+
// mouse buttons are also in the controller namespace (why), just offset 0x100
#define VK_OFS_SDL_MOUSE 0x0100
#define VK_BASE_SDL_MOUSE (VK_BASE_SDL_GAMEPAD + VK_OFS_SDL_MOUSE)
@@ -246,7 +252,21 @@ static void controller_sdl_read(OSContPad *pad) {
void controller_sdl_read_mouse_window(void) {
if (!init_ok) { return; }
+
+#if defined(_WIN32) && (defined(RAPI_D3D12) || defined(RAPI_D3D11))
+ mouse_window_buttons = 0;
+ mouse_window_buttons |= (GetAsyncKeyState(VK_LBUTTON) ? (1 << 0) : 0);
+ mouse_window_buttons |= (GetAsyncKeyState(VK_RBUTTON) ? (1 << 1) : 0);
+ POINT p;
+ if (GetCursorPos(&p) && ScreenToClient(GetActiveWindow(), &p))
+ {
+ mouse_window_x = p.x;
+ mouse_window_y = p.y;
+ }
+#else
mouse_window_buttons = SDL_GetMouseState(&mouse_window_x, &mouse_window_y);
+#endif
+
}
static void controller_sdl_rumble_play(f32 strength, f32 length) { }
diff --git a/src/pc/controller/controller_sdl2.c b/src/pc/controller/controller_sdl2.c
index 67a8f966..835705f8 100644
--- a/src/pc/controller/controller_sdl2.c
+++ b/src/pc/controller/controller_sdl2.c
@@ -5,6 +5,10 @@
#include
#include
+#if defined(_WIN32)
+#include
+#endif
+
#include
// Analog camera movement by Pathétique (github.com/vrmiguel), y0shin and Mors
@@ -271,7 +275,20 @@ static void controller_sdl_read(OSContPad *pad) {
void controller_sdl_read_mouse_window(void) {
if (!init_ok) { return; }
+
+#if defined(_WIN32) && (defined(RAPI_D3D12) || defined(RAPI_D3D11))
+ mouse_window_buttons = 0;
+ mouse_window_buttons |= (GetAsyncKeyState(VK_LBUTTON) ? (1 << 0) : 0);
+ mouse_window_buttons |= (GetAsyncKeyState(VK_RBUTTON) ? (1 << 1) : 0);
+ POINT p;
+ if (GetCursorPos(&p) && ScreenToClient(GetActiveWindow(), &p))
+ {
+ mouse_window_x = p.x;
+ mouse_window_y = p.y;
+ }
+#else
mouse_window_buttons = SDL_GetMouseState(&mouse_window_x, &mouse_window_y);
+#endif
}
static void controller_sdl_rumble_play(f32 strength, f32 length) {
diff --git a/src/pc/gfx/gfx_dxgi.cpp b/src/pc/gfx/gfx_dxgi.cpp
index 0ad1c7f3..fec6f3a7 100644
--- a/src/pc/gfx/gfx_dxgi.cpp
+++ b/src/pc/gfx/gfx_dxgi.cpp
@@ -641,7 +641,7 @@ void gfx_dxgi_set_clipboard_text(char* text) {
EmptyClipboard();
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text) + 1);
buffer = (char *) GlobalLock(clipbuffer);
- strcpy(buffer, LPCSTR(source));
+ strcpy(buffer, LPCSTR(text));
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT, clipbuffer);
CloseClipboard();