Centralize dx9 and gles headless stuff.

Well, could be cleaner, but this way all the comparison stuff works.
This commit is contained in:
Unknown W. Brackets 2014-08-30 09:55:40 -07:00
parent af9e0510c3
commit bc66a43fb3
4 changed files with 11 additions and 52 deletions

View File

@ -29,7 +29,6 @@
#include "base/logging.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"
@ -81,8 +80,6 @@ void WindowsHeadlessHost::LoadNativeAssets()
VFSRegister("", new DirectoryAssetReader("../"));
VFSRegister("", new DirectoryAssetReader("../Windows/assets/"));
VFSRegister("", new DirectoryAssetReader("../Windows/"));
gl_lost_manager_init();
}
void WindowsHeadlessHost::SendDebugOutput(const std::string &output)

View File

@ -37,7 +37,7 @@ public:
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h);
virtual void SetComparisonScreenshot(const std::string &filename);
private:
protected:
bool ResizeGL();
void LoadNativeAssets();
void SendOrCollectDebugOutput(const std::string &output);

View File

@ -23,6 +23,7 @@
#include <io.h>
#include "base/logging.h"
#include "thin3d/d3dx9_loader.h"
#include "GPU/Directx9/helper/global.h"
#include "file/vfs.h"
#include "file/zip_read.h"
@ -52,47 +53,20 @@ HWND DxCreateWindow()
RECT wr = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; // set the size, but not the position
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
DWORD style = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
DWORD style = WS_OVERLAPPEDWINDOW | (WINDOW_VISIBLE ? WS_VISIBLE : 0);
return CreateWindowEx(0, _T("PPSSPPHeadless"), _T("PPSSPPHeadless"), style, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, NULL, NULL);
}
void WindowsHeadlessHostDx9::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("../"));
VFSRegister("", new DirectoryAssetReader("../Windows/assets/"));
VFSRegister("", new DirectoryAssetReader("../Windows/"));
// See SendDebugOutput() for how things get back on track.
}
void WindowsHeadlessHostDx9::SendDebugOutput(const std::string &output)
{
fwrite(output.data(), sizeof(char), output.length(), out);
OutputDebugStringUTF8(output.c_str());
}
void WindowsHeadlessHostDx9::SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h)
{
}
void WindowsHeadlessHostDx9::SetComparisonScreenshot(const std::string &filename)
{
comparisonScreenshot = filename;
}
bool WindowsHeadlessHostDx9::InitGL(std::string *error_message)
{
LoadD3DX9Dynamic();
hWnd = DxCreateWindow();
ShowWindow(hWnd, TRUE);
SetFocus(hWnd);
if (WINDOW_VISIBLE)
{
ShowWindow(hWnd, TRUE);
SetFocus(hWnd);
}
DX9::DirectxInit(hWnd);

View File

@ -18,6 +18,7 @@
#pragma once
#include "StubHost.h"
#include "WindowsHeadlessHost.h"
#undef HEADLESSHOST_CLASS
#define HEADLESSHOST_CLASS WindowsHeadlessHost
@ -25,7 +26,7 @@
#include "Common/CommonWindows.h"
// TODO: Get rid of this junk
class WindowsHeadlessHostDx9 : public HeadlessHost
class WindowsHeadlessHostDx9 : public WindowsHeadlessHost
{
public:
virtual bool InitGL(std::string *error_message);
@ -33,19 +34,6 @@ public:
virtual void SwapBuffers();
virtual void SendDebugOutput(const std::string &output);
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h);
virtual void SetComparisonScreenshot(const std::string &filename);
virtual bool ShouldSkipUI() { return false; }
private:
bool ResizeGL();
void LoadNativeAssets();
HWND hWnd;
HDC hDC;
HGLRC hRC;
FILE *out;
std::string comparisonScreenshot;
};