Skip to content

Commit

Permalink
Merge pull request #740 from lioncash/host
Browse files Browse the repository at this point in the history
Core: Kill off a few Host interface functions.
  • Loading branch information
lioncash committed Aug 9, 2014
2 parents 907e0d0 + dc2bc62 commit e266635
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 114 deletions.
4 changes: 0 additions & 4 deletions Source/Core/Common/Logging/Log.h
Expand Up @@ -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_, ...) {}
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/Boot/Boot.cpp
Expand Up @@ -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;
}
2 changes: 0 additions & 2 deletions Source/Core/Core/Host.h
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/Tracer.cpp
Expand Up @@ -106,7 +106,6 @@ int SyncTrace()
*/
if (difference)
{
Host_UpdateLogDisplay();
//Also show drec compare window here
//CDynaViewDlg::Show(true);
//CDynaViewDlg::ViewAddr(m_BlockStart);
Expand Down
6 changes: 5 additions & 1 deletion Source/Core/DolphinWX/Debugger/CodeView.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion Source/Core/DolphinWX/Debugger/CodeWindow.cpp
Expand Up @@ -285,7 +285,6 @@ void CCodeWindow::SingleStep()
// need a short wait here
JumpToAddress(PC);
Update();
Host_UpdateLogDisplay();
}
}

Expand Down
7 changes: 5 additions & 2 deletions Source/Core/DolphinWX/Debugger/MemoryView.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
18 changes: 7 additions & 11 deletions Source/Core/DolphinWX/GLInterface/AGL.cpp
Expand Up @@ -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"
Expand All @@ -21,23 +18,22 @@ 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];

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]
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinWX/GLInterface/GLInterface.h
Expand Up @@ -104,8 +104,6 @@ typedef struct {
XSetWindowAttributes attr;
std::thread xEventThread;
#endif
int x, y;
unsigned int width, height;
} GLWindow;

extern GLWindow GLWin;
22 changes: 0 additions & 22 deletions Source/Core/DolphinWX/GLInterface/GLX.cpp
Expand Up @@ -4,8 +4,6 @@

#include <string>

#include "Core/Host.h"

#include "DolphinWX/GLInterface/GLInterface.h"

#include "VideoCommon/RenderBase.h"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -113,26 +104,13 @@ 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;
}

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)
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinWX/GLInterface/Platform.cpp
Expand Up @@ -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;
Expand Down
27 changes: 16 additions & 11 deletions Source/Core/DolphinWX/GLInterface/WGL.cpp
Expand Up @@ -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.
Expand All @@ -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"));
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/GLInterface/WGL.h
Expand Up @@ -22,5 +22,5 @@ class cInterfaceWGL : public cInterfaceBase
void Update();
bool PeekMessages();

void* m_window_handle;
HWND m_window_handle;
};
14 changes: 3 additions & 11 deletions Source/Core/DolphinWX/GLInterface/X11_Util.cpp
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion Source/Core/DolphinWX/Globals.h
Expand Up @@ -245,7 +245,6 @@ enum
IDM_COMPRESSGCM,
IDM_MULTICOMPRESSGCM,
IDM_MULTIDECOMPRESSGCM,
IDM_UPDATELOGDISPLAY,
IDM_UPDATEDISASMDIALOG,
IDM_UPDATEGUI,
IDM_UPDATESTATUSBAR,
Expand Down
25 changes: 0 additions & 25 deletions Source/Core/DolphinWX/Main.cpp
Expand Up @@ -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);
Expand All @@ -566,7 +553,6 @@ void Host_UpdateDisasmDialog()
}
}


void Host_ShowJitResults(unsigned int address)
{
if (main_frame->g_pCodeWindow && main_frame->g_pCodeWindow->m_JitWindow)
Expand All @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/DolphinWX/MainAndroid.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit e266635

Please sign in to comment.