Remove EmuWindow.

All it did was raise complexity.
This commit is contained in:
Armada
2014-06-15 00:23:43 +02:00
parent 5a66ded081
commit f2759ffe65
14 changed files with 32 additions and 284 deletions

View File

@ -41,6 +41,7 @@ void Close();
extern ID3D11Device* device;
extern ID3D11DeviceContext* context;
extern IDXGISwapChain* swapchain;
extern HWND hWnd;
extern bool bFrameInProgress;
void Reset();

View File

@ -26,7 +26,6 @@
#include "VideoCommon/AVIDump.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/EmuWindow.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/ImageWrite.h"
@ -178,7 +177,7 @@ void CreateScreenshotTexture(const TargetRectangle& rc)
D3D::SetDebugObjectName((ID3D11DeviceChild*)s_screenshot_texture, "staging screenshot texture");
}
Renderer::Renderer()
Renderer::Renderer(void *&window_handle)
{
int x, y, w_temp, h_temp;
@ -186,7 +185,7 @@ Renderer::Renderer()
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
D3D::Create(EmuWindow::GetWnd());
D3D::Create((HWND)window_handle);
s_backbuffer_width = D3D::GetBackBufferWidth();
s_backbuffer_height = D3D::GetBackBufferHeight();
@ -275,21 +274,8 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
// size.
bool Renderer::CheckForResize()
{
while (EmuWindow::IsSizing())
Sleep(10);
if (EmuWindow::GetParentWnd())
{
// Re-stretch window to parent window size again, if it has a parent window.
RECT rcParentWindow;
GetWindowRect(EmuWindow::GetParentWnd(), &rcParentWindow);
int width = rcParentWindow.right - rcParentWindow.left;
int height = rcParentWindow.bottom - rcParentWindow.top;
if (width != Renderer::GetBackbufferWidth() || height != Renderer::GetBackbufferHeight())
MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE);
}
RECT rcWindow;
GetClientRect(EmuWindow::GetWnd(), &rcWindow);
GetClientRect(D3D::hWnd, &rcWindow);
int client_width = rcWindow.right - rcWindow.left;
int client_height = rcWindow.bottom - rcWindow.top;
@ -866,7 +852,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
{
s_recordWidth = GetTargetRectangle().GetWidth();
s_recordHeight = GetTargetRectangle().GetHeight();
bAVIDumping = AVIDump::Start(EmuWindow::GetParentWnd(), s_recordWidth, s_recordHeight);
bAVIDumping = AVIDump::Start(D3D::hWnd, s_recordWidth, s_recordHeight);
if (!bAVIDumping)
{
PanicAlert("Error dumping frames to AVI.");

View File

@ -9,7 +9,7 @@ namespace DX11
class Renderer : public ::Renderer
{
public:
Renderer();
Renderer(void *&window_handle);
~Renderer();
void SetColorMask() override;

View File

@ -21,6 +21,8 @@ class VideoBackend : public VideoBackendHardware
void UpdateFPSDisplay(const std::string&) override;
unsigned int PeekMessages() override;
void* m_window_handle;
};
}

View File

@ -29,7 +29,6 @@
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/EmuWindow.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/IndexGenerator.h"
#include "VideoCommon/OnScreenDisplay.h"
@ -58,7 +57,8 @@ unsigned int VideoBackend::PeekMessages()
void VideoBackend::UpdateFPSDisplay(const std::string& text)
{
EmuWindow::SetWindowText(StringFromFormat("%s | D3D | %s", scm_rev_str, text.c_str()));
std::string str = StringFromFormat("%s | D3D | %s", scm_rev_str, text.c_str());
SetWindowTextA((HWND)m_window_handle, str.c_str());
}
std::string VideoBackend::GetName() const
@ -147,6 +147,9 @@ void VideoBackend::ShowConfig(void *_hParent)
bool VideoBackend::Initialize(void *&window_handle)
{
if (window_handle == nullptr)
return false;
InitializeShared();
InitBackendInfo();
@ -158,12 +161,7 @@ bool VideoBackend::Initialize(void *&window_handle)
g_Config.VerifyValidity();
UpdateActiveConfig();
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait."));
if (window_handle == nullptr)
{
ERROR_LOG(VIDEO, "An error has occurred while trying to create the window.");
return false;
}
m_window_handle = window_handle;
s_BackendInitialized = true;
@ -178,7 +176,7 @@ void VideoBackend::Video_Prepare()
s_swapRequested = FALSE;
// internal interfaces
g_renderer = new Renderer;
g_renderer = new Renderer(m_window_handle);
g_texture_cache = new TextureCache;
g_vertex_manager = new VertexManager;
g_perf_query = new PerfQuery;