Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #764 from magcius/new-nogui-2
Rewrite GLInterface
  • Loading branch information
lioncash committed Aug 21, 2014
2 parents cf82972 + 6dbafa9 commit f17dcd2
Show file tree
Hide file tree
Showing 47 changed files with 439 additions and 1,394 deletions.
30 changes: 2 additions & 28 deletions CMakeLists.txt
Expand Up @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 2.8)
option(ANDROID "Enables a build for Android" OFF)
option(USE_EGL "Enables EGL OpenGL Interface" OFF)
option(TRY_X11 "Enables X11 Support" ON)
option(TRY_WAYLAND "Enables Wayland Support" OFF)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
option(ENABLE_PCH "Use PCH to speed up compilation" ON)
Expand Down Expand Up @@ -324,7 +323,6 @@ if(ANDROID)
message("Building for Android")
add_definitions(-DANDROID)
set(USE_X11 0)
set(USE_WAYLAND 0)
set(USE_UPNP 0)
set(USE_EGL 1)
endif()
Expand Down Expand Up @@ -407,26 +405,8 @@ if(NOT ANDROID)
endif(OPENAL_FOUND)

set(USE_X11 0)
set(USE_WAYLAND 0)

if(UNIX AND NOT APPLE)
# Note: The convention is to check TRY_X11 or TRY_WAYLAND where needed.
# This is where we detect platforms and set the variables accordingly.
pkg_check_modules(WAYLAND wayland-egl wayland-client wayland-cursor)
if(TRY_WAYLAND AND WAYLAND_FOUND)
pkg_check_modules(XKBCOMMON xkbcommon)
if(XKBCOMMON_FOUND)
set(USE_WAYLAND 1)
add_definitions(-DHAVE_WAYLAND)
include_directories(${WAYLAND_INCLUDE_DIR})
message("Wayland support enabled")
endif(XKBCOMMON_FOUND)
else()
set(USE_WAYLAND 0)
message("Wayland support disabled")
add_definitions(-DHAVE_WAYLAND=0)
endif(TRY_WAYLAND AND WAYLAND_FOUND)

# Note: We do not need to explicitly check for X11 as it is done in the cmake
# FindOpenGL module on linux.
if(TRY_X11 AND X11_FOUND)
Expand All @@ -441,19 +421,13 @@ if(NOT ANDROID)
add_definitions(-DHAVE_X11=0)
endif(TRY_X11 AND X11_FOUND)

if (NOT USE_WAYLAND AND NOT USE_X11)
if (NOT USE_X11)
message(FATAL_ERROR "\n"
"No suitable display platform found\n"
"Requires wayland or x11 to run")
"Requires x11 to run")
endif()
endif()

# For now Wayland and EGL are tied to each other.
# The alternative would be an shm path
if(USE_WAYLAND)
set(USE_EGL 1)
endif()

if(USE_X11)
check_lib(XRANDR Xrandr)
if(XRANDR_FOUND)
Expand Down
33 changes: 1 addition & 32 deletions Source/Core/Core/Core.cpp
Expand Up @@ -126,21 +126,6 @@ void DisplayMessage(const std::string& message, int time_in_ms)
}

g_video_backend->Video_AddMessage(message, time_in_ms);

if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar)
{
Host_UpdateStatusBar(message);
}
else
{
Host_UpdateTitle(message);
}
}

void *GetWindowHandle()
{
return g_pWindowHandle;
}

bool IsRunning()
Expand Down Expand Up @@ -213,9 +198,6 @@ bool Init()
!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
}

// g_pWindowHandle is first the m_Panel handle,
// then it is updated to the render window handle,
// within g_video_backend->Initialize()
g_pWindowHandle = Host_GetRenderHandle();

// Start the emu thread
Expand Down Expand Up @@ -700,10 +682,6 @@ void UpdateTitle()
}
// This is our final "frame counter" string
std::string SMessage = StringFromFormat("%s | %s", SSettings.c_str(), SFPS.c_str());
std::string TMessage = StringFromFormat("%s | %s", scm_rev_str, SMessage.c_str());

// Show message
g_video_backend->UpdateFPSDisplay(SMessage);

// Update the audio timestretcher with the current speed
if (soundStream)
Expand All @@ -712,16 +690,7 @@ void UpdateTitle()
pMixer->UpdateSpeed((float)Speed / 100);
}

if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar)
{
Host_UpdateStatusBar(SMessage);
Host_UpdateTitle(scm_rev_str);
}
else
{
Host_UpdateTitle(TMessage);
}
Host_UpdateTitle(SMessage);
}

void Shutdown()
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/Core.h
Expand Up @@ -59,9 +59,6 @@ void SaveScreenShot();

void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);

void* GetWindowHandle();


// This displays messages in a user-visible way.
void DisplayMessage(const std::string& message, int time_in_ms);

Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/Host.h
Expand Up @@ -37,7 +37,6 @@ void Host_SetWiiMoteConnectionState(int _State);
void Host_SysMessage(const char *fmt, ...);
void Host_UpdateDisasmDialog();
void Host_UpdateMainFrame();
void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
void Host_UpdateTitle(const std::string& title);
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
const std::string& config_name);
Expand Down
5 changes: 0 additions & 5 deletions Source/Core/Core/PowerPC/PPCSymbolDB.cpp
Expand Up @@ -279,9 +279,6 @@ bool PPCSymbolDB::SaveMap(const std::string& filename, bool WithCodes) const
mapFile.c_str()).c_str(), "Confirm", wxYES_NO)) return false;
}

if (WithCodes)
Host_UpdateStatusBar("Saving code, please stand by ...");

// Make a file
File::IOFile f(mapFile, "w");
if (!f)
Expand Down Expand Up @@ -342,8 +339,6 @@ bool PPCSymbolDB::SaveMap(const std::string& filename, bool WithCodes) const
fprintf(f.GetHandle(), "\n");
}
}
// ---------------
Host_UpdateStatusBar(StringFromFormat("Saved %s", mapFile.c_str()).c_str());

return true;
}
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/DolphinWX/Android/ButtonManager.cpp
Expand Up @@ -4,8 +4,10 @@

#include <unordered_map>

#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/Thread.h"
#include "DolphinWX/Android/ButtonManager.h"
#include "DolphinWX/GLInterface/GLInterface.h"

namespace ButtonManager
{
Expand Down
33 changes: 14 additions & 19 deletions Source/Core/DolphinWX/CMakeLists.txt
Expand Up @@ -10,9 +10,6 @@ if(NOT ANDROID)
if(USE_X11)
set(LIBS ${LIBS} ${XRANDR_LIBRARIES})
endif()
if(USE_WAYLAND)
set(LIBS ${LIBS} ${WAYLAND_LIBRARIES} ${XKBCOMMON_LIBRARIES})
endif()

link_directories(${CMAKE_PREFIX_PATH}/lib)
else()
Expand Down Expand Up @@ -76,25 +73,23 @@ set(ANDROID_SRCS Android/ButtonManager.cpp
MainAndroid.cpp)

if(USE_EGL)
set(SRCS ${SRCS} GLInterface/Platform.cpp
GLInterface/EGL.cpp)
if(USE_WAYLAND)
set(SRCS ${SRCS} GLInterface/Wayland_Util.cpp)
endif()
if(USE_X11)
set(SRCS ${SRCS} GLInterface/X11_Util.cpp)
set(SRCS ${SRCS} GLInterface/EGL.cpp)
if(ANDROID)
set(SRCS ${SRCS} GLInterface/EGLAndroid.cpp)
elseif(USE_X11)
set(SRCS ${SRCS} GLInterface/EGLX11.cpp)
endif()
else()
if(WIN32)
set(SRCS ${SRCS} GLInterface/WGL.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} GLInterface/AGL.cpp)
else()
set(SRCS ${SRCS} GLInterface/GLX.cpp
GLInterface/X11_Util.cpp)
endif()

endif()
if(WIN32)
set(SRCS ${SRCS} GLInterface/WGL.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} GLInterface/AGL.cpp)
elseif(USE_X11)
set(SRCS ${SRCS} GLInterface/GLX.cpp
GLInterface/X11_Util.cpp)
endif()

set(SRCS ${SRCS} GLInterface/GLInterface.cpp)

set(NOGUI_SRCS MainNoGUI.cpp)
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/DolphinWX/DolphinWX.vcxproj
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
Expand Down Expand Up @@ -100,7 +100,6 @@
<ClCompile Include="WxUtils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="GLInterface\GLInterface.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="AboutDolphin.h" />
<ClInclude Include="ARCodeAddEdit.h" />
Expand Down
1 change: 0 additions & 1 deletion Source/Core/DolphinWX/DolphinWX.vcxproj.filters
Expand Up @@ -282,7 +282,6 @@
<ClInclude Include="WiimoteConfigDiag.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="GLInterface\GLInterface.h" />
<ClInclude Include="SoftwareVideoConfigDialog.h">
<Filter>GUI\Video</Filter>
</ClInclude>
Expand Down
26 changes: 16 additions & 10 deletions Source/Core/DolphinWX/Frame.cpp
Expand Up @@ -2,14 +2,6 @@
// Licensed under GPLv2
// Refer to the license.txt file included.


// CFrame is the main parent window. Inside CFrame there is an m_Panel that is
// the parent for the rendering window (when we render to the main window). In
// Windows the rendering window is created by giving CreateWindow()
// m_Panel->GetHandle() as parent window and creating a new child window to
// m_Panel. The new child window handle that is returned by CreateWindow() can
// be accessed from Core::GetWindowHandle().

#ifdef __APPLE__
#include <Cocoa/Cocoa.h>
#endif
Expand Down Expand Up @@ -636,6 +628,21 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
}
#endif

void CFrame::UpdateTitle(const std::string &str)
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar)
{
GetStatusBar()->SetStatusText(str, 0);
m_RenderFrame->SetTitle(scm_rev_str);
}
else
{
std::string titleStr = StringFromFormat("%s | %s", scm_rev_str, str.c_str());
m_RenderFrame->SetTitle(titleStr);
}
}

void CFrame::OnHostMessage(wxCommandEvent& event)
{
switch (event.GetId())
Expand All @@ -650,8 +657,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
break;

case IDM_UPDATETITLE:
if (m_RenderFrame != nullptr)
m_RenderFrame->SetTitle(event.GetString());
SetTitle(event.GetString());
break;

case IDM_WINDOWSIZEREQUEST:
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Frame.h
Expand Up @@ -126,6 +126,7 @@ class CFrame : public CRenderFrame
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr);
void PopulateSavedPerspectives();
static void ConnectWiimote(int wm_idx, bool connect);
void UpdateTitle(const std::string &str);

const CGameListCtrl *GetGameListCtrl() const;

Expand Down
19 changes: 0 additions & 19 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -2,18 +2,6 @@
// Licensed under GPLv2
// Refer to the license.txt file included.


/*
1.1 Windows
CFrame is the main parent window. Inside CFrame there is m_Panel which is the
parent for the rendering window (when we render to the main window). In Windows
the rendering window is created by giving CreateWindow() m_Panel->GetHandle()
as parent window and creating a new child window to m_Panel. The new child
window handle that is returned by CreateWindow() can be accessed from
Core::GetWindowHandle().
*/

#include <cstdarg>
#include <cstdio>
#include <mutex>
Expand Down Expand Up @@ -840,13 +828,6 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
}
#if defined(HAVE_X11) && HAVE_X11
wxRect client_rect = m_RenderParent->GetClientRect();
XMoveResizeWindow(X11Utils::XDisplayFromHandle(GetHandle()),
(Window) Core::GetWindowHandle(),
client_rect.x, client_rect.y,
client_rect.width, client_rect.height);
#endif
m_LogWindow->Refresh();
m_LogWindow->Update();
}
Expand Down

0 comments on commit f17dcd2

Please sign in to comment.