Merge pull request #740 from lioncash/host

Core: Kill off a few Host interface functions.
This commit is contained in:
Lioncash 2014-08-09 00:50:14 -04:00
commit e266635f40
20 changed files with 37 additions and 114 deletions

View File

@ -122,11 +122,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
ERROR_LOG(_t_, __VA_ARGS__); \
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
}
#define _dbg_update_() Host_UpdateLogDisplay();
#else // not debug
#define _dbg_update_() ;
#ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) {}
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}

View File

@ -429,7 +429,5 @@ bool CBoot::BootUp()
// Not part of the binary itself, but either we or Gecko OS might insert
// this, and it doesn't clear the icache properly.
HLE::Patch(0x800018a8, "GeckoCodehandler");
Host_UpdateLogDisplay();
return true;
}

View File

@ -36,9 +36,7 @@ void Host_SetStartupDebuggingParameters();
void Host_SetWiiMoteConnectionState(int _State);
void Host_ShowJitResults(unsigned int address);
void Host_SysMessage(const char *fmt, ...);
void Host_UpdateBreakPointView();
void Host_UpdateDisasmDialog();
void Host_UpdateLogDisplay();
void Host_UpdateMainFrame();
void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
void Host_UpdateTitle(const std::string& title);

View File

@ -106,7 +106,6 @@ int SyncTrace()
*/
if (difference)
{
Host_UpdateLogDisplay();
//Also show drec compare window here
//CDynaViewDlg::Show(true);
//CDynaViewDlg::ViewAddr(m_BlockStart);

View File

@ -33,6 +33,7 @@
#include "Common/SymbolDB.h"
#include "Core/Core.h"
#include "Core/Host.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/CodeView.h"
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
@ -139,7 +140,10 @@ void CCodeView::ToggleBreakpoint(u32 address)
{
m_debugger->ToggleBreakpoint(address);
Refresh();
Host_UpdateBreakPointView();
// Propagate back to the parent window to update the breakpoint list.
wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
GetEventHandler()->AddPendingEvent(evt);
}
void CCodeView::OnMouseMove(wxMouseEvent& event)

View File

@ -285,7 +285,6 @@ void CCodeWindow::SingleStep()
// need a short wait here
JumpToAddress(PC);
Update();
Host_UpdateLogDisplay();
}
}

View File

@ -25,7 +25,7 @@
#include "Common/Common.h"
#include "Common/DebugInterface.h"
#include "Core/Host.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
#include "DolphinWX/Debugger/MemoryView.h"
@ -97,7 +97,10 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event)
debugger->ToggleMemCheck(YToAddress(y));
Refresh();
Host_UpdateBreakPointView();
// Propagate back to the parent window to update the breakpoint list.
wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
GetEventHandler()->AddPendingEvent(evt);
}
event.Skip();

View File

@ -4,9 +4,6 @@
#include <wx/panel.h>
#include "Core/ConfigManager.h"
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/VertexShaderManager.h"
@ -21,10 +18,9 @@ void cInterfaceAGL::Swap()
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceAGL::Create(void *&window_handle)
{
int _tx, _ty, _twidth, _theight;
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());
// FIXME: Get rid of the explicit use of wxPanel here. This shouldn't be necessary.
GLWin.cocoaWin = reinterpret_cast<NSView*>(((wxPanel*)window_handle)->GetHandle());
NSSize size = [GLWin.cocoaWin frame].size;
// Enable high-resolution display support.
[GLWin.cocoaWin setWantsBestResolutionOpenGLSurface:YES];
@ -32,12 +28,12 @@ bool cInterfaceAGL::Create(void *&window_handle)
NSWindow *window = [GLWin.cocoaWin window];
float scale = [window backingScaleFactor];
_twidth *= scale;
_theight *= scale;
size.width *= scale;
size.height *= scale;
// Control window size and picture scaling
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
s_backbuffer_width = size.width;
s_backbuffer_height = size.height;
NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, NSOpenGLPFAAccelerated, 0 };
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]

View File

@ -104,8 +104,6 @@ typedef struct {
XSetWindowAttributes attr;
std::thread xEventThread;
#endif
int x, y;
unsigned int width, height;
} GLWindow;
extern GLWindow GLWin;

View File

@ -4,8 +4,6 @@
#include <string>
#include "Core/Host.h"
#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoCommon/RenderBase.h"
@ -41,13 +39,6 @@ void cInterfaceGLX::Swap()
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool cInterfaceGLX::Create(void *&window_handle)
{
int _tx, _ty, _twidth, _theight;
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
// Control window size and picture scaling
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
int glxMajorVersion, glxMinorVersion;
// attributes for a single buffered visual in RGBA format with at least
@ -113,11 +104,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
return false;
}
GLWin.x = _tx;
GLWin.y = _ty;
GLWin.width = _twidth;
GLWin.height = _theight;
XWindow.CreateXWindow();
window_handle = (void *)GLWin.win;
return true;
@ -125,14 +111,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
bool cInterfaceGLX::MakeCurrent()
{
// connect the glx-context to the window
#if defined(HAVE_WX) && (HAVE_WX)
Host_GetRenderWindowSize(GLWin.x, GLWin.y,
(int&)GLWin.width, (int&)GLWin.height);
XMoveResizeWindow(GLWin.evdpy, GLWin.win, GLWin.x, GLWin.y,
GLWin.width, GLWin.height);
#endif
bool success = glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
if (success)
{

View File

@ -135,8 +135,6 @@ bool cPlatform::Init(EGLConfig config, void *window_handle)
ANativeWindow_setBuffersGeometry((EGLNativeWindowType)Host_GetRenderHandle(), 0, 0, format);
int none, width, height;
Host_GetRenderWindowSize(none, none, width, height);
GLWin.width = width;
GLWin.height = height;
GLInterface->SetBackBufferDimensions(width, height);
#endif
return true;

View File

@ -58,7 +58,7 @@ bool cInterfaceWGL::PeekMessages()
// Show the current FPS
void cInterfaceWGL::UpdateFPSDisplay(const std::string& text)
{
SetWindowTextA((HWND)m_window_handle, text.c_str());
SetWindowTextA(m_window_handle, text.c_str());
}
// Create rendering window.
@ -68,14 +68,19 @@ bool cInterfaceWGL::Create(void *&window_handle)
if (window_handle == nullptr)
return false;
int _tx, _ty, _twidth, _theight;
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
HWND window_handle_reified = reinterpret_cast<HWND>(window_handle);
RECT window_rect = {0};
if (!GetClientRect(window_handle_reified, &window_rect))
return false;
// Control window size and picture scaling
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
int twidth = (window_rect.right - window_rect.left);
int theight = (window_rect.bottom - window_rect.top);
s_backbuffer_width = twidth;
s_backbuffer_height = theight;
m_window_handle = window_handle;
m_window_handle = window_handle_reified;
#ifdef _WIN32
dllHandle = LoadLibrary(TEXT("OpenGL32.dll"));
@ -105,7 +110,7 @@ bool cInterfaceWGL::Create(void *&window_handle)
int PixelFormat; // Holds The Results After Searching For A Match
if (!(hDC = GetDC((HWND)window_handle))) {
if (!(hDC = GetDC(window_handle_reified))) {
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
return false;
}
@ -145,11 +150,11 @@ bool cInterfaceWGL::ClearCurrent()
void cInterfaceWGL::Update()
{
RECT rcWindow;
GetClientRect((HWND)m_window_handle, &rcWindow);
GetClientRect(m_window_handle, &rcWindow);
// Get the new window width and height
s_backbuffer_width = rcWindow.right - rcWindow.left;
s_backbuffer_height = rcWindow.bottom - rcWindow.top;
s_backbuffer_width = (rcWindow.right - rcWindow.left);
s_backbuffer_height = (rcWindow.bottom - rcWindow.top);
}
// Close backend
@ -166,7 +171,7 @@ void cInterfaceWGL::Shutdown()
hRC = nullptr;
}
if (hDC && !ReleaseDC((HWND)m_window_handle, hDC))
if (hDC && !ReleaseDC(m_window_handle, hDC))
{
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
hDC = nullptr;

View File

@ -22,5 +22,5 @@ public:
void Update();
bool PeekMessages();
void* m_window_handle;
HWND m_window_handle;
};

View File

@ -19,8 +19,7 @@ bool cXInterface::ServerConnect(void)
bool cXInterface::Initialize(void *config, void *window_handle)
{
int _tx, _ty, _twidth, _theight;
XVisualInfo visTemplate;
XVisualInfo visTemplate;
int num_visuals;
EGLint vid;
@ -42,13 +41,6 @@ bool cXInterface::Initialize(void *config, void *window_handle)
exit(1);
}
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
GLWin.x = _tx;
GLWin.y = _ty;
GLWin.width = _twidth;
GLWin.height = _theight;
GLWin.evdpy = XOpenDisplay(nullptr);
GLWin.parent = (Window) window_handle;
GLWin.screen = DefaultScreen(GLWin.dpy);
@ -81,7 +73,7 @@ void *cXInterface::CreateWindow(void)
// Create the window
GLWin.win = XCreateWindow(GLWin.evdpy, GLWin.parent,
GLWin.x, GLWin.y, GLWin.width, GLWin.height, 0,
0, 0, 1, 1, 0,
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
@ -131,7 +123,7 @@ void cX11Window::CreateXWindow(void)
// Create the window
GLWin.win = XCreateWindow(GLWin.evdpy, GLWin.parent,
GLWin.x, GLWin.y, GLWin.width, GLWin.height, 0,
0, 0, 1, 1, 0,
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);

View File

@ -245,7 +245,6 @@ enum
IDM_COMPRESSGCM,
IDM_MULTICOMPRESSGCM,
IDM_MULTIDECOMPRESSGCM,
IDM_UPDATELOGDISPLAY,
IDM_UPDATEDISASMDIALOG,
IDM_UPDATEGUI,
IDM_UPDATESTATUSBAR,

View File

@ -542,19 +542,6 @@ void Host_NotifyMapLoaded()
}
}
void Host_UpdateLogDisplay()
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATELOGDISPLAY);
main_frame->GetEventHandler()->AddPendingEvent(event);
if (main_frame->g_pCodeWindow)
{
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
}
void Host_UpdateDisasmDialog()
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEDISASMDIALOG);
@ -566,7 +553,6 @@ void Host_UpdateDisasmDialog()
}
}
void Host_ShowJitResults(unsigned int address)
{
if (main_frame->g_pCodeWindow && main_frame->g_pCodeWindow->m_JitWindow)
@ -591,17 +577,6 @@ void Host_UpdateTitle(const std::string& title)
main_frame->GetEventHandler()->AddPendingEvent(event);
}
void Host_UpdateBreakPointView()
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
main_frame->GetEventHandler()->AddPendingEvent(event);
if (main_frame->g_pCodeWindow)
{
main_frame->g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
}
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
main_frame->GetRenderWindowSize(x, y, width, height);

View File

@ -72,16 +72,12 @@ void Host_UpdateTitle(const std::string& title)
__android_log_write(ANDROID_LOG_INFO, DOLPHIN_TAG, title.c_str());
}
void Host_UpdateLogDisplay(){}
void Host_UpdateDisasmDialog(){}
void Host_UpdateMainFrame()
{
}
void Host_UpdateBreakPointView(){}
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;

View File

@ -67,8 +67,6 @@ void* Host_GetRenderHandle()
void Host_UpdateTitle(const std::string& title){};
void Host_UpdateLogDisplay(){}
void Host_UpdateDisasmDialog(){}
void Host_UpdateMainFrame()
@ -76,8 +74,6 @@ void Host_UpdateMainFrame()
updateMainFrameEvent.Set();
}
void Host_UpdateBreakPointView(){}
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
{
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;

View File

@ -179,10 +179,6 @@ void CreateScreenshotTexture(const TargetRectangle& rc)
Renderer::Renderer(void *&window_handle)
{
int x, y, w_temp, h_temp;
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
D3D::Create((HWND)window_handle);
s_backbuffer_width = D3D::GetBackBufferWidth();

View File

@ -15,12 +15,9 @@ void Host_RefreshDSPDebuggerWindow() {}
void Host_ShowJitResults(unsigned int) {}
void Host_Message(int) {}
void* Host_GetRenderHandle() { return nullptr; }
void* Host_GetInstance() { return nullptr; }
void Host_UpdateTitle(const std::string&) {}
void Host_UpdateLogDisplay() {}
void Host_UpdateDisasmDialog() {}
void Host_UpdateMainFrame() {}
void Host_UpdateBreakPointView() {}
void Host_GetRenderWindowSize(int&, int&, int&, int&) {}
void Host_RequestRenderWindowSize(int, int) {}
void Host_SetStartupDebuggingParameters() {}