mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Remove gui dependency from all projects except CemuBin
This commit is contained in:
+7
-3
@@ -42,9 +42,10 @@ add_compile_definitions(VK_NO_PROTOTYPES)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_subdirectory(Common)
|
||||
add_subdirectory(gui)
|
||||
if(ANDROID)
|
||||
add_subdirectory(android/app/src/main/cpp)
|
||||
else()
|
||||
add_subdirectory(gui)
|
||||
endif()
|
||||
add_subdirectory(Cafe)
|
||||
add_subdirectory(Cemu)
|
||||
@@ -57,7 +58,7 @@ add_subdirectory(resource)
|
||||
add_subdirectory(asm)
|
||||
|
||||
if(ANDROID)
|
||||
add_library(CemuBin
|
||||
add_library(CemuBin STATIC
|
||||
main.cpp
|
||||
mainLLE.cpp
|
||||
)
|
||||
@@ -123,11 +124,14 @@ target_link_libraries(CemuBin PRIVATE
|
||||
CemuCommon
|
||||
CemuComponents
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuInput
|
||||
CemuUtil
|
||||
)
|
||||
|
||||
if(NOT ANDROID)
|
||||
target_link_libraries(CemuBin PRIVATE CemuGui)
|
||||
endif()
|
||||
|
||||
if(ENABLE_OPENGL)
|
||||
target_link_libraries(CemuBin PRIVATE OpenGL::GL)
|
||||
endif()
|
||||
|
||||
@@ -126,7 +126,7 @@ bool OpenGLRenderer::ImguiBegin(bool mainWindow)
|
||||
{
|
||||
if (!mainWindow)
|
||||
{
|
||||
GLCanvas_MakeCurrent(true);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(true);
|
||||
m_isPadViewContext = true;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void OpenGLRenderer::ImguiEnd()
|
||||
|
||||
if (m_isPadViewContext)
|
||||
{
|
||||
GLCanvas_MakeCurrent(false);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(false);
|
||||
m_isPadViewContext = false;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void OpenGLRenderer::Initialize()
|
||||
auto lock = cemuLog_acquire();
|
||||
cemuLog_log(LogType::Force, "------- Init OpenGL graphics backend -------");
|
||||
|
||||
GLCanvas_MakeCurrent(false);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(false);
|
||||
LoadOpenGLImports();
|
||||
GetVendorInformation();
|
||||
|
||||
@@ -354,7 +354,7 @@ void OpenGLRenderer::Initialize()
|
||||
|
||||
bool OpenGLRenderer::IsPadWindowActive()
|
||||
{
|
||||
return GLCanvas_HasPadViewOpen();
|
||||
return m_openGLCallbacks->GLCanvas_HasPadViewOpen();
|
||||
}
|
||||
|
||||
void OpenGLRenderer::Flush(bool waitIdle)
|
||||
@@ -369,6 +369,15 @@ void OpenGLRenderer::NotifyLatteCommandProcessorIdle()
|
||||
glFlush();
|
||||
}
|
||||
|
||||
void OpenGLRenderer::RegisterOpenGLCallbacks(OpenGLCallbacks* openGLCallbacks)
|
||||
{
|
||||
m_openGLCallbacks = openGLCallbacks;
|
||||
}
|
||||
|
||||
void OpenGLRenderer::UnregisterOpenGLCallbacks()
|
||||
{
|
||||
m_openGLCallbacks = nullptr;
|
||||
}
|
||||
|
||||
bool IsRunningInWine();
|
||||
|
||||
@@ -445,7 +454,7 @@ void OpenGLRenderer::EnableDebugMode()
|
||||
|
||||
void OpenGLRenderer::SwapBuffers(bool swapTV, bool swapDRC)
|
||||
{
|
||||
GLCanvas_SwapBuffers(swapTV, swapDRC);
|
||||
m_openGLCallbacks->GLCanvas_SwapBuffers(swapTV, swapDRC);
|
||||
|
||||
if (swapTV)
|
||||
cleanupAfterFrame();
|
||||
@@ -456,7 +465,7 @@ bool OpenGLRenderer::BeginFrame(bool mainWindow)
|
||||
if (!mainWindow && !IsPadWindowActive())
|
||||
return false;
|
||||
|
||||
GLCanvas_MakeCurrent(!mainWindow);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(!mainWindow);
|
||||
|
||||
ClearColorbuffer(!mainWindow);
|
||||
return true;
|
||||
@@ -550,7 +559,7 @@ void OpenGLRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
|
||||
return;
|
||||
|
||||
catchOpenGLError();
|
||||
GLCanvas_MakeCurrent(padView);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(padView);
|
||||
|
||||
renderstate_resetColorControl();
|
||||
renderstate_resetDepthControl();
|
||||
@@ -609,7 +618,7 @@ void OpenGLRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutpu
|
||||
|
||||
// switch back to TV context
|
||||
if (padView)
|
||||
GLCanvas_MakeCurrent(false);
|
||||
m_openGLCallbacks->GLCanvas_MakeCurrent(false);
|
||||
}
|
||||
|
||||
void OpenGLRenderer::renderTarget_setViewport(float x, float y, float width, float height, float nearZ, float farZ, bool halfZ /*= false*/)
|
||||
|
||||
@@ -158,6 +158,18 @@ public:
|
||||
void occlusionQuery_updateState() override {};
|
||||
|
||||
private:
|
||||
|
||||
class OpenGLCallbacks
|
||||
{
|
||||
public:
|
||||
virtual bool GLCanvas_HasPadViewOpen() = 0;
|
||||
virtual bool GLCanvas_MakeCurrent(bool padView) = 0;
|
||||
virtual void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC) = 0;
|
||||
};
|
||||
|
||||
void RegisterOpenGLCallbacks(OpenGLCallbacks* openGLCallbacks);
|
||||
void UnregisterOpenGLCallbacks();
|
||||
|
||||
void GetVendorInformation() override;
|
||||
|
||||
void texture_setActiveTextureUnit(sint32 index);
|
||||
@@ -165,6 +177,8 @@ private:
|
||||
void texture_syncSliceSpecialBC4(LatteTexture* srcTexture, sint32 srcSliceIndex, sint32 srcMipIndex, LatteTexture* dstTexture, sint32 dstSliceIndex, sint32 dstMipIndex);
|
||||
void texture_syncSliceSpecialIntegerToBC3(LatteTexture* srcTexture, sint32 srcSliceIndex, sint32 srcMipIndex, LatteTexture* dstTexture, sint32 dstSliceIndex, sint32 dstMipIndex);
|
||||
|
||||
OpenGLCallbacks* m_openGLCallbacks = nullptr;
|
||||
|
||||
GLuint m_defaultFramebufferId;
|
||||
GLuint m_pipeline = 0;
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ target_link_libraries(CemuComponents PRIVATE
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuUtil
|
||||
Boost::headers
|
||||
CURL::libcurl
|
||||
|
||||
@@ -34,7 +34,6 @@ target_link_libraries(CemuAudio PRIVATE
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuUtil
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ wxGLContext* sGLContext = nullptr;
|
||||
class OpenGLCanvas* sGLTVView = nullptr;
|
||||
class OpenGLCanvas* sGLPadView = nullptr;
|
||||
|
||||
class OpenGLCanvas : public IRenderCanvas, public wxGLCanvas
|
||||
class OpenGLCanvas : public IRenderCanvas, public wxGLCanvas, public OpenGLRenderer::OpenGLCallbacks
|
||||
{
|
||||
public:
|
||||
OpenGLCanvas(wxWindow* parent, const wxSize& size, bool is_main_window)
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
{
|
||||
sGLTVView = this;
|
||||
sGLContext = new wxGLContext(this);
|
||||
|
||||
g_renderer = std::make_unique<OpenGLRenderer>();
|
||||
OpenGLRenderer::GetInstance()->RegisterOpenGLCallbacks(this);
|
||||
}
|
||||
else
|
||||
sGLPadView = this;
|
||||
@@ -64,6 +64,10 @@ public:
|
||||
delete sGLContext;
|
||||
}
|
||||
|
||||
bool GLCanvas_HasPadViewOpen() override;
|
||||
bool GLCanvas_MakeCurrent(bool padView) override;
|
||||
void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC) override;
|
||||
|
||||
void UpdateVSyncState()
|
||||
{
|
||||
int configValue = GetConfig().vsync.GetValue();
|
||||
@@ -97,12 +101,12 @@ wxWindow* GLCanvas_Create(wxWindow* parent, const wxSize& size, bool is_main_win
|
||||
return new OpenGLCanvas(parent, size, is_main_window);
|
||||
}
|
||||
|
||||
bool GLCanvas_HasPadViewOpen()
|
||||
bool OpenGLCanvas::GLCanvas_HasPadViewOpen()
|
||||
{
|
||||
return sGLPadView != nullptr;
|
||||
}
|
||||
|
||||
bool GLCanvas_MakeCurrent(bool padView)
|
||||
bool OpenGLCanvas::GLCanvas_MakeCurrent(bool padView)
|
||||
{
|
||||
OpenGLCanvas* canvas = padView ? sGLPadView : sGLTVView;
|
||||
if (!canvas)
|
||||
@@ -111,7 +115,7 @@ bool GLCanvas_MakeCurrent(bool padView)
|
||||
return true;
|
||||
}
|
||||
|
||||
void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC)
|
||||
void OpenGLCanvas::GLCanvas_SwapBuffers(bool swapTV, bool swapDRC)
|
||||
{
|
||||
if (swapTV && sGLTVView)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_wi
|
||||
auto& canvas = is_main_window ? GuiSystem::getWindowInfo().canvas_main : GuiSystem::getWindowInfo().canvas_pad;
|
||||
canvas = get_window_handle_info_for_wxWindow(this);
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if (canvas.backend == GuiSystem::WindowHandleInfo::Backend::WAYLAND)
|
||||
if (canvas.backend == GuiSystem::WindowHandleInfo::Backend::Wayland)
|
||||
{
|
||||
m_subsurface = std::make_unique<wxWlSubsurface>(this);
|
||||
canvas.surface = m_subsurface->getSurface();
|
||||
|
||||
@@ -143,7 +143,7 @@ GuiSystem::WindowHandleInfo get_window_handle_info_for_wxWindow(wxWindow* wxw)
|
||||
{
|
||||
GuiSystem::WindowHandleInfo handleInfo;
|
||||
#if BOOST_OS_WINDOWS
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::WINDOWS;
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::Windows;
|
||||
handleInfo.surface = reinterpret_cast<void*>(wxw->GetHWND());
|
||||
#elif BOOST_OS_LINUX
|
||||
GtkWidget* gtkWidget = (GtkWidget*)wxw->GetHandle(); // returns GtkWidget
|
||||
@@ -163,7 +163,7 @@ GuiSystem::WindowHandleInfo get_window_handle_info_for_wxWindow(wxWindow* wxw)
|
||||
#ifdef HAS_WAYLAND
|
||||
else if (GDK_IS_WAYLAND_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::WAYLAND;
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::Wayland;
|
||||
handleInfo.surface = gdk_wayland_window_get_wl_surface(gdkWindow);
|
||||
handleInfo.display = gdk_wayland_display_get_wl_display(gdkDisplay);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ GuiSystem::WindowHandleInfo get_window_handle_info_for_wxWindow(wxWindow* wxw)
|
||||
cemuLog_log(LogType::Force, "Unsuported GTK backend");
|
||||
}
|
||||
#elif BOOST_OS_MACOS
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::COCOA;
|
||||
handleInfo.backend = GuiSystem::WindowHandleInfo::Backend::Cocoa;
|
||||
handleInfo.surface = reinterpret_cast<void*>(wxw->GetHandle());
|
||||
#endif
|
||||
return handleInfo;
|
||||
|
||||
@@ -24,7 +24,6 @@ target_include_directories(imguiImpl PUBLIC "../../dependencies/imgui/")
|
||||
target_link_libraries(imguiImpl PRIVATE
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuGui
|
||||
CemuInput
|
||||
CemuResource
|
||||
CemuUtil
|
||||
|
||||
@@ -92,7 +92,6 @@ target_link_libraries(CemuInput PRIVATE
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuUtil
|
||||
Boost::headers
|
||||
Boost::program_options
|
||||
|
||||
Reference in New Issue
Block a user