diff --git a/projects/msvc12/GLideN64.vcxproj b/projects/msvc12/GLideN64.vcxproj
index 43fbcd1c..a732780d 100644
--- a/projects/msvc12/GLideN64.vcxproj
+++ b/projects/msvc12/GLideN64.vcxproj
@@ -299,6 +299,7 @@
+
true
true
diff --git a/projects/msvc12/GLideN64.vcxproj.filters b/projects/msvc12/GLideN64.vcxproj.filters
index 18f354a6..407dd0dc 100644
--- a/projects/msvc12/GLideN64.vcxproj.filters
+++ b/projects/msvc12/GLideN64.vcxproj.filters
@@ -254,6 +254,9 @@
Source Files
+
+ Source Files
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c4aa6b2c..a922351a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,6 +34,7 @@ set(GLideN64_SOURCES
L3D.cpp
L3DEX2.cpp
L3DEX.cpp
+ Log.cpp
N64.cpp
OpenGL.cpp
Performance.cpp
diff --git a/src/Log.cpp b/src/Log.cpp
new file mode 100644
index 00000000..dc86ed7f
--- /dev/null
+++ b/src/Log.cpp
@@ -0,0 +1,48 @@
+#ifndef ANDROID
+
+#include
+#include
+#include "Log.h"
+#include "PluginAPI.h"
+#include "wst.h"
+
+void LOG(u16 type, const char * format, ...) {
+ if (type > LOG_LEVEL)
+ return;
+
+ wchar_t logPath[PLUGIN_PATH_SIZE + 16];
+ api().GetUserDataPath(logPath);
+ gln_wcscat(logPath, wst("/gliden64.log"));
+
+#ifdef OS_WINDOWS
+ FILE *dumpFile = _wfopen(logPath, wst("a+"));
+#else
+ char cbuf[MAX_PATH];
+ wcstombs(cbuf, logPath, MAX_PATH);
+ FILE *dumpFile = fopen(cbuf, "a+");
+#endif
+
+ if (dumpFile == nullptr)
+ return;
+ va_list va;
+ va_start(va, format);
+ vfprintf(dumpFile, format, va);
+ fclose(dumpFile);
+ va_end(va);
+}
+
+#if defined(OS_WINDOWS) && !defined(MINGW)
+#include "windows/GLideN64_windows.h"
+void debugPrint(const char * format, ...) {
+ char text[256];
+ wchar_t wtext[256];
+ va_list va;
+ va_start(va, format);
+ vsprintf(text, format, va);
+ mbstowcs(wtext, text, 256);
+ OutputDebugString(wtext);
+ va_end(va);
+}
+#endif
+
+#endif // ANDROID
diff --git a/src/Log.h b/src/Log.h
index 28dbfe8e..82f0c011 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -10,7 +10,7 @@
#define LOG_LEVEL LOG_WARNING
-#if LOG_LEVEL>0
+#if LOG_LEVEL > 0
#ifdef ANDROID
#include
@@ -21,20 +21,10 @@
}
#else // ANDROID
-#include
-#include
-inline void LOG( u16 type, const char * format, ... ) {
- if (type > LOG_LEVEL)
- return;
- FILE *dumpFile = fopen( "gliden64.log", "a+" );
- if (dumpFile == NULL)
- return;
- va_list va;
- va_start( va, format );
- vfprintf( dumpFile, format, va );
- fclose( dumpFile );
- va_end( va );
-}
+#include "Types.h"
+
+void LOG(u16 type, const char * format, ...);
+
#endif // ANDROID
#else
@@ -43,19 +33,7 @@ inline void LOG( u16 type, const char * format, ... ) {
#endif
#if defined(OS_WINDOWS) && !defined(MINGW)
-#include "windows/GLideN64_windows.h"
-#include
-
-inline void debugPrint(const char * format, ...) {
- char text[256];
- wchar_t wtext[256];
- va_list va;
- va_start(va, format);
- vsprintf(text, format, va);
- mbstowcs(wtext, text, 256);
- OutputDebugString(wtext);
- va_end(va);
-}
+void debugPrint(const char * format, ...);
#else
#define debugPrint(A, ...)
#endif
diff --git a/src/PluginAPI.h b/src/PluginAPI.h
index aa1c325a..7d660578 100644
--- a/src/PluginAPI.h
+++ b/src/PluginAPI.h
@@ -7,6 +7,7 @@
#ifdef MUPENPLUSAPI
#include "m64p_plugin.h"
#else
+#include "windows/GLideN64_windows.h"
#include "ZilmarGFX_1_3.h"
#include "FrameBufferInfoAPI.h"
#define RSPTHREAD