mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Use GetUserDataPath() to determine path when creating gliden64.log #1243
This commit is contained in:
parent
c5c7845294
commit
1c94b4720e
|
@ -299,6 +299,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\gSP.cpp" />
|
<ClCompile Include="..\..\src\gSP.cpp" />
|
||||||
<ClCompile Include="..\..\src\Keys.cpp" />
|
<ClCompile Include="..\..\src\Keys.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\Log.cpp" />
|
||||||
<ClCompile Include="..\..\src\MupenPlusPluginAPI.cpp">
|
<ClCompile Include="..\..\src\MupenPlusPluginAPI.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
|
|
@ -254,6 +254,9 @@
|
||||||
<ClCompile Include="..\..\src\CRC32.cpp">
|
<ClCompile Include="..\..\src\CRC32.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\Log.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\src\3DMath.h">
|
<ClInclude Include="..\..\src\3DMath.h">
|
||||||
|
|
|
@ -34,6 +34,7 @@ set(GLideN64_SOURCES
|
||||||
L3D.cpp
|
L3D.cpp
|
||||||
L3DEX2.cpp
|
L3DEX2.cpp
|
||||||
L3DEX.cpp
|
L3DEX.cpp
|
||||||
|
Log.cpp
|
||||||
N64.cpp
|
N64.cpp
|
||||||
OpenGL.cpp
|
OpenGL.cpp
|
||||||
Performance.cpp
|
Performance.cpp
|
||||||
|
|
48
src/Log.cpp
Normal file
48
src/Log.cpp
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#ifndef ANDROID
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#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
|
34
src/Log.h
34
src/Log.h
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#define LOG_LEVEL LOG_WARNING
|
#define LOG_LEVEL LOG_WARNING
|
||||||
|
|
||||||
#if LOG_LEVEL>0
|
#if LOG_LEVEL > 0
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
|
@ -21,20 +21,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // ANDROID
|
#else // ANDROID
|
||||||
#include <stdio.h>
|
#include "Types.h"
|
||||||
#include <stdarg.h>
|
|
||||||
inline void LOG( u16 type, const char * format, ... ) {
|
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 );
|
|
||||||
}
|
|
||||||
#endif // ANDROID
|
#endif // ANDROID
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -43,19 +33,7 @@ inline void LOG( u16 type, const char * format, ... ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WINDOWS) && !defined(MINGW)
|
#if defined(OS_WINDOWS) && !defined(MINGW)
|
||||||
#include "windows/GLideN64_windows.h"
|
void debugPrint(const char * format, ...);
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define debugPrint(A, ...)
|
#define debugPrint(A, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#ifdef MUPENPLUSAPI
|
#ifdef MUPENPLUSAPI
|
||||||
#include "m64p_plugin.h"
|
#include "m64p_plugin.h"
|
||||||
#else
|
#else
|
||||||
|
#include "windows/GLideN64_windows.h"
|
||||||
#include "ZilmarGFX_1_3.h"
|
#include "ZilmarGFX_1_3.h"
|
||||||
#include "FrameBufferInfoAPI.h"
|
#include "FrameBufferInfoAPI.h"
|
||||||
#define RSPTHREAD
|
#define RSPTHREAD
|
||||||
|
|
Loading…
Reference in New Issue
Block a user