1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Use GetUserDataPath() to determine path when creating gliden64.log #1243

This commit is contained in:
Sergey Lipskiy 2016-11-20 12:07:15 +07:00
parent c5c7845294
commit 1c94b4720e
6 changed files with 60 additions and 28 deletions

View File

@ -299,6 +299,7 @@
</ClCompile>
<ClCompile Include="..\..\src\gSP.cpp" />
<ClCompile Include="..\..\src\Keys.cpp" />
<ClCompile Include="..\..\src\Log.cpp" />
<ClCompile Include="..\..\src\MupenPlusPluginAPI.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>

View File

@ -254,6 +254,9 @@
<ClCompile Include="..\..\src\CRC32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\3DMath.h">

View File

@ -34,6 +34,7 @@ set(GLideN64_SOURCES
L3D.cpp
L3DEX2.cpp
L3DEX.cpp
Log.cpp
N64.cpp
OpenGL.cpp
Performance.cpp

48
src/Log.cpp Normal file
View 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

View File

@ -10,7 +10,7 @@
#define LOG_LEVEL LOG_WARNING
#if LOG_LEVEL>0
#if LOG_LEVEL > 0
#ifdef ANDROID
#include <android/log.h>
@ -21,20 +21,10 @@
}
#else // ANDROID
#include <stdio.h>
#include <stdarg.h>
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 <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);
}
void debugPrint(const char * format, ...);
#else
#define debugPrint(A, ...)
#endif

View File

@ -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