Update WindowsHeadlessHost to fix graphic tests.

Although I'm not sure if they actually work...
This commit is contained in:
Unknown W. Brackets 2013-04-10 22:07:57 -07:00
parent ab37f6e760
commit de3f4d03ba
4 changed files with 9 additions and 13 deletions

View File

@ -150,7 +150,7 @@ int main(int argc, const char* argv[])
host = headlessHost;
std::string error_string;
host->InitGL(&error_string);
bool glWorking = host->InitGL(&error_string);
LogManager::Init();
LogManager *logman = LogManager::GetInstance();
@ -170,7 +170,7 @@ int main(int argc, const char* argv[])
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.cpuCore = useJit ? CPU_JIT : CPU_INTERPRETER;
coreParameter.gpuCore = headlessHost->isGLWorking() ? GPU_GLES : GPU_NULL;
coreParameter.gpuCore = glWorking ? GPU_GLES : GPU_NULL;
coreParameter.enableSound = false;
coreParameter.headLess = true;
coreParameter.printfEmuLog = true;

View File

@ -33,7 +33,7 @@ public:
virtual void SetDebugMode(bool mode) { }
virtual bool InitGL(std::string *error_message) {return true;}
virtual bool InitGL(std::string *error_message) {return false;}
virtual void ShutdownGL() {}
virtual void InitSound(PMixer *mixer) {}
@ -49,8 +49,6 @@ public:
virtual void SendDebugOutput(const std::string &output) { printf("%s", output.c_str()); }
virtual void SetComparisonScreenshot(const std::string &filename) {}
virtual bool isGLWorking() { return false; }
// Unique for HeadlessHost
virtual void SwapBuffers() {}

View File

@ -78,6 +78,8 @@ void WindowsHeadlessHost::LoadNativeAssets()
VFSRegister("", new DirectoryAssetReader("assets/"));
VFSRegister("", new DirectoryAssetReader(""));
VFSRegister("", new DirectoryAssetReader("../"));
VFSRegister("", new DirectoryAssetReader("../Windows/assets/"));
VFSRegister("", new DirectoryAssetReader("../Windows/"));
gl_lost_manager_init();
@ -138,9 +140,8 @@ void WindowsHeadlessHost::SetComparisonScreenshot(const std::string &filename)
comparisonScreenshot = filename;
}
void WindowsHeadlessHost::InitGL()
bool WindowsHeadlessHost::InitGL(std::string *error_message)
{
glOkay = false;
hWnd = CreateHiddenWindow();
if (WINDOW_VISIBLE)
@ -160,7 +161,7 @@ void WindowsHeadlessHost::InitGL()
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
#define ENFORCE(x, msg) { if (!(x)) { fprintf(stderr, msg); return; } }
#define ENFORCE(x, msg) { if (!(x)) { fprintf(stderr, msg); *error_message = msg; return false; } }
ENFORCE(hDC = GetDC(hWnd), "Unable to create DC.");
ENFORCE(pixelFormat = ChoosePixelFormat(hDC, &pfd), "Unable to match pixel format.");
@ -175,8 +176,7 @@ void WindowsHeadlessHost::InitGL()
LoadNativeAssets();
if (ResizeGL())
glOkay = true;
return ResizeGL();
}
void WindowsHeadlessHost::ShutdownGL()

View File

@ -28,9 +28,8 @@
class WindowsHeadlessHost : public HeadlessHost
{
public:
virtual void InitGL();
virtual bool InitGL(std::string *error_message);
virtual void ShutdownGL();
virtual bool isGLWorking() { return glOkay; }
virtual void SwapBuffers();
@ -42,7 +41,6 @@ private:
bool ResizeGL();
void LoadNativeAssets();
bool glOkay;
HWND hWnd;
HDC hDC;
HGLRC hRC;