mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 19:53:48 +01:00
Don't let native's log output spoil tests.
Also, log to stderr, makes more sense anyway.
This commit is contained in:
1 parent
03d9157d26
commit
ade0f4103b
6 files changed
+48
-17
No files matched your search
+3
-4
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "../System.h"
|
||||
#include "../Config.h"
|
||||
#include "../Host.h"
|
||||
#include "../SaveState.h"
|
||||
#include "HLE.h"
|
||||
#include "../MIPS/MIPS.h"
|
||||
@@ -644,10 +645,8 @@ u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 outPtr,
|
||||
std::string data(Memory::GetCharPointer(argAddr), argLen);
|
||||
if (PSP_CoreParameter().printfEmuLog)
|
||||
{
|
||||
printf("%s", data.c_str());
|
||||
#ifdef _WIN32
|
||||
OutputDebugString(data.c_str());
|
||||
#endif
|
||||
host->SendDebugOutput(data.c_str());
|
||||
|
||||
// Also collect the debug output
|
||||
emuDebugOutput += data;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ public:
|
||||
virtual bool IsDebuggingEnabled() {return true;}
|
||||
virtual bool AttemptLoadSymbolMap() {return false;}
|
||||
virtual void SetWindowTitle(const char *message) {}
|
||||
|
||||
// Used for headless.
|
||||
virtual void SendDebugOutput(const std::string &output) {}
|
||||
};
|
||||
|
||||
extern Host *host;
|
||||
+7
-11
@@ -12,8 +12,6 @@
|
||||
#include "../Core/Host.h"
|
||||
#include "Log.h"
|
||||
#include "LogManager.h"
|
||||
#include "file/vfs.h"
|
||||
#include "file/zip_read.h"
|
||||
|
||||
#include "StubHost.h"
|
||||
#ifdef _WIN32
|
||||
@@ -28,20 +26,20 @@ public:
|
||||
switch (level)
|
||||
{
|
||||
case LogTypes::LDEBUG:
|
||||
printf("D %s", msg);
|
||||
fprintf(stderr, "D %s", msg);
|
||||
break;
|
||||
case LogTypes::LINFO:
|
||||
printf("I %s", msg);
|
||||
fprintf(stderr, "I %s", msg);
|
||||
break;
|
||||
case LogTypes::LERROR:
|
||||
printf("E %s", msg);
|
||||
fprintf(stderr, "E %s", msg);
|
||||
break;
|
||||
case LogTypes::LWARNING:
|
||||
printf("W %s", msg);
|
||||
fprintf(stderr, "W %s", msg);
|
||||
break;
|
||||
case LogTypes::LNOTICE:
|
||||
default:
|
||||
printf("N %s", msg);
|
||||
fprintf(stderr, "N %s", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -118,9 +116,6 @@ int main(int argc, const char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(""));
|
||||
|
||||
HeadlessHost *headlessHost = new HEADLESSHOST_CLASS();
|
||||
host = headlessHost;
|
||||
host->InitGL();
|
||||
@@ -160,8 +155,9 @@ int main(int argc, const char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
coreState = CORE_RUNNING;
|
||||
host->BootDone();
|
||||
|
||||
coreState = CORE_RUNNING;
|
||||
while (coreState == CORE_RUNNING)
|
||||
{
|
||||
// Run for a frame at a time, just because.
|
||||
|
||||
@@ -49,5 +49,7 @@ public:
|
||||
virtual bool IsDebuggingEnabled() {return false;}
|
||||
virtual bool AttemptLoadSymbolMap() {return false;}
|
||||
|
||||
virtual void SendDebugOutput(const std::string &output) { printf("%s", output.c_str()); }
|
||||
|
||||
virtual bool isGLWorking() { return false; }
|
||||
};
|
||||
@@ -19,9 +19,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#include "../native/gfx_es2/gl_state.h"
|
||||
#include "../native/gfx/gl_common.h"
|
||||
#include "gfx_es2/gl_state.h"
|
||||
#include "gfx/gl_common.h"
|
||||
#include "gfx/gl_lost_manager.h"
|
||||
#include "file/vfs.h"
|
||||
#include "file/zip_read.h"
|
||||
|
||||
const bool WINDOW_VISIBLE = false;
|
||||
const int WINDOW_WIDTH = 480;
|
||||
@@ -64,6 +68,27 @@ void SetVSync(int value)
|
||||
wglSwapIntervalEXT(value);
|
||||
}
|
||||
|
||||
void WindowsHeadlessHost::LoadNativeAssets()
|
||||
{
|
||||
// Native is kinda talkative, but that's annoying in our case.
|
||||
out = _fdopen(_dup(_fileno(stdout)), "wt");
|
||||
freopen("NUL", "wt", stdout);
|
||||
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(""));
|
||||
VFSRegister("", new DirectoryAssetReader("../"));
|
||||
|
||||
gl_lost_manager_init();
|
||||
|
||||
// See SendDebugOutput() for how things get back on track.
|
||||
}
|
||||
|
||||
void WindowsHeadlessHost::SendDebugOutput(const std::string &output)
|
||||
{
|
||||
fprintf_s(out, "%s", output.c_str());
|
||||
OutputDebugString(output.c_str());
|
||||
}
|
||||
|
||||
void WindowsHeadlessHost::InitGL()
|
||||
{
|
||||
glOkay = false;
|
||||
@@ -99,6 +124,8 @@ void WindowsHeadlessHost::InitGL()
|
||||
glewInit();
|
||||
glstate.Initialize();
|
||||
|
||||
LoadNativeAssets();
|
||||
|
||||
if (ResizeGL())
|
||||
glOkay = true;
|
||||
}
|
||||
|
||||
@@ -34,11 +34,15 @@ public:
|
||||
virtual void ShutdownGL();
|
||||
virtual bool isGLWorking() { return glOkay; }
|
||||
|
||||
virtual void SendDebugOutput(const std::string &output);
|
||||
|
||||
private:
|
||||
bool ResizeGL();
|
||||
void LoadNativeAssets();
|
||||
|
||||
bool glOkay;
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HGLRC hRC;
|
||||
FILE *out;
|
||||
};
|
||||
Reference in new issue
Block a user