diff --git a/MMRecomp.vcxproj b/MMRecomp.vcxproj
index 959b67b..75d2082 100644
--- a/MMRecomp.vcxproj
+++ b/MMRecomp.vcxproj
@@ -78,14 +78,14 @@
true
- make TARGET=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)
- make TARGET=$(Configuration) clean
+ make CONFIG=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)
+ make CONFIG=$(Configuration) clean
$(SolutionDir)build\$(Configuration)\
false
- make TARGET=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)
- make TARGET=$(Configuration) clean
+ make CONFIG=$(Configuration) LIB_DIR="$(VC_LibraryPath_VC_x64_Desktop)" UCRT_DIR="$(UniversalCRT_LibraryPath_x64)" SDK_DIR="$(WindowsSDK_LibraryPath)\x64" -j$(NUMBER_OF_PROCESSORS)
+ make CONFIG=$(Configuration) clean
$(SolutionDir)build\$(Configuration)\
@@ -207,6 +207,7 @@ XCOPY "$(ProjectDir)lib\SDL2-2.24.0\lib\$(Platform)\SDL2.dll" "$(TargetDir)" /S
+
diff --git a/MMRecomp.vcxproj.filters b/MMRecomp.vcxproj.filters
index 0a09252..bc3b782 100644
--- a/MMRecomp.vcxproj.filters
+++ b/MMRecomp.vcxproj.filters
@@ -105,6 +105,9 @@
Source Files
+
+ Source Files
+
diff --git a/Makefile b/Makefile
index 8a9fbb2..e2c966c 100644
--- a/Makefile
+++ b/Makefile
@@ -18,18 +18,18 @@ $(error "Invalid build configuration: $(CONFIG)")
endif
ifeq ($(OS),Windows_NT)
-DYN_EXT := .dll
-LIB_EXT := .lib
-EXE_EXT := .exe
-AR := clang++
-ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o
-# Static C runtime linking
-LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt
-# Dynamic
-# LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -lmsvcrt -lvcruntime -lucrt
-LIB_DIR ?= C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64
-UCRT_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64;
-SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
+ DYN_EXT := .dll
+ LIB_EXT := .lib
+ EXE_EXT := .exe
+ AR := clang++
+ ARFLAGS := $(OPTFLAGS) -fuse-ld=llvm-lib -o
+ # Static C runtime linking
+ LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -llibcmt -llibvcruntime -llibucrt
+ # Dynamic
+ # LIBS := -Wl,/nodefaultlib:libcmt -Wl,/nodefaultlib:ucrt -Wl,/nodefaultlib:libucrt -lmsvcrt -lvcruntime -lucrt
+ LIB_DIR ?= C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\x64
+ UCRT_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64;
+ SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
define mkdir
mkdir $(subst /,\\,$(1))
endef
@@ -37,12 +37,12 @@ SDK_DIR ?= C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64
rmdir /S /Q $(subst /,\\,$(1))
endef
else
-DYN_EXT := .so
-LIB_EXT := .a
-EXE_EXT :=
-LIB_PRE := lib
-AR := ar
-ARFLAGS := rcs
+ DYN_EXT := .so
+ LIB_EXT := .a
+ EXE_EXT :=
+ LIB_PRE := lib
+ AR := ar
+ ARFLAGS := rcs
define mkdir
mkdir -p $(1)
endef
@@ -90,15 +90,6 @@ CFLAGS := -ffunction-sections -fdata-sections -march=nehalem $(OPTFLAGS) $(WA
CXXFLAGS := -ffunction-sections -fdata-sections -march=nehalem $(OPTFLAGS) $(WARNFLAGS) -std=c++20 -c
CPPFLAGS := -Iinclude -Ithirdparty
-ifeq ($(OS),Windows_NT)
-LDFLAGS := -v -Wl,/OPT:REF $(OPTFLAGS) $(LIBS) -L"$(LIB_DIR:;=)" -L"$(UCRT_DIR:;=)" -L"$(SDK_DIR:;=)" lib/RT64/$(CONFIG)/RT64.lib
-else
-LDFLAGS := $(OPTFLAGS) -L$(BUILD_DIR) -lRecompiledFuncs -L. -lrt64 -lSDL2 -lX11 -Wl,--gc-sections
-FUNC_CFLAGS += -ffunction-sections -fdata-sections
-FUNC_CXXFLAGS += -ffunction-sections -fdata-sections
-EXTRA_DEPS := librt64.a
-endif
-
ifeq ($(LIB),1)
TARGET := $(BUILD_DIR)/MMRecomp$(DYN_EXT)
LDFLAGS += -shared
@@ -106,6 +97,16 @@ else
TARGET := $(BUILD_DIR)/MMRecomp$(EXE_EXT)
endif
+ifeq ($(OS),Windows_NT)
+LDFLAGS := -v -Wl,/OPT:REF $(OPTFLAGS) $(LIBS) -L"$(LIB_DIR:;=)" -L"$(UCRT_DIR:;=)" -L"$(SDK_DIR:;=)" lib/RT64/$(CONFIG)/mupen64plus-video-rt64.lib lib/SDL2-2.24.0/lib/x64/SDL2.lib
+CPPFLAGS += -Ilib/SDL2-2.24.0/include
+else
+LDFLAGS := $(OPTFLAGS) -L$(BUILD_DIR) -lRecompiledFuncs -L. -lrt64 -lSDL2 -lX11 -Wl,--gc-sections
+FUNC_CFLAGS += -ffunction-sections -fdata-sections
+FUNC_CXXFLAGS += -ffunction-sections -fdata-sections
+EXTRA_DEPS := librt64.a
+endif
+
default: $(TARGET)
clean:
diff --git a/include/rt64_layer.h b/include/rt64_layer.h
index 91a0e64..666969c 100644
--- a/include/rt64_layer.h
+++ b/include/rt64_layer.h
@@ -63,11 +63,18 @@ typedef struct {
//DLLEXPORT void (CALL *UpdateScreen)(void) = nullptr;
//DLLEXPORT void (CALL *PumpEvents)(void) = nullptr;
+#if defined(_WIN32)
+extern "C" int InitiateGFXWindows(GFX_INFO Gfx_Info, HWND hwnd);
+#elif defined(__ANDROID__)
+static_assert(false && "Unimplemented");
+#elif defined(__linux__)
extern "C" int InitiateGFXLinux(GFX_INFO Gfx_Info, Window window, Display *display);
+#else
+static_assert(false && "Unimplemented");
+#endif
DLLIMPORT void ProcessRDPList(void);
DLLIMPORT void ProcessDList(void);
DLLIMPORT void UpdateScreen(void);
-DLLIMPORT void PumpEvents(void);
DLLIMPORT void ChangeWindow(void);
#endif
diff --git a/portultra/multilibultra.hpp b/portultra/multilibultra.hpp
index 58dde89..4ab705b 100644
--- a/portultra/multilibultra.hpp
+++ b/portultra/multilibultra.hpp
@@ -9,6 +9,8 @@
#include "ultra64.h"
#if defined(_WIN32)
+# define WIN32_LEAN_AND_MEAN
+# define NOMINMAX
# include
#elif defined(__ANDROID__)
# include "android/native_window.h"
diff --git a/src/rt64_layer.cpp b/src/rt64_layer.cpp
index ab719bb..53aa4d4 100644
--- a/src/rt64_layer.cpp
+++ b/src/rt64_layer.cpp
@@ -97,7 +97,15 @@ void RT64Init(uint8_t* rom, uint8_t* rdram, Multilibultra::WindowHandle window_h
gfx_info.SP_STATUS_REG = &SP_STATUS_REG;
gfx_info.RDRAM_SIZE = &RDRAM_SIZE;
+#if defined(_WIN32)
+ InitiateGFXWindows(gfx_info, window_handle);
+#elif defined(__ANDROID__)
+ static_assert(false && "Unimplemented");
+#elif defined(__linux__)
InitiateGFXLinux(gfx_info, window_handle.window, window_handle.display);
+#else
+ static_assert(false && "Unimplemented");
+#endif
}
void RT64SendDL(uint8_t* rdram, const OSTask* task) {