mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-28 22:37:03 +00:00
UI+build: Isolate wxWidgets code from non-GUI code (#1633)
This commit is contained in:
parent
5f3c2816ec
commit
67de63bed6
199 changed files with 2414 additions and 2091 deletions
|
|
@ -1,186 +1,7 @@
|
|||
add_library(CemuGui
|
||||
canvas/IRenderCanvas.h
|
||||
canvas/OpenGLCanvas.cpp
|
||||
canvas/OpenGLCanvas.h
|
||||
canvas/VulkanCanvas.cpp
|
||||
canvas/VulkanCanvas.h
|
||||
CemuApp.cpp
|
||||
CemuApp.h
|
||||
CemuUpdateWindow.cpp
|
||||
CemuUpdateWindow.h
|
||||
ChecksumTool.cpp
|
||||
ChecksumTool.h
|
||||
components/TextList.cpp
|
||||
components/TextList.h
|
||||
components/wxDownloadManagerList.cpp
|
||||
components/wxDownloadManagerList.h
|
||||
components/wxGameList.cpp
|
||||
components/wxGameList.h
|
||||
components/wxInputDraw.cpp
|
||||
components/wxInputDraw.h
|
||||
components/wxLogCtrl.cpp
|
||||
components/wxLogCtrl.h
|
||||
components/wxTitleManagerList.cpp
|
||||
components/wxTitleManagerList.h
|
||||
debugger/BreakpointWindow.cpp
|
||||
debugger/BreakpointWindow.h
|
||||
debugger/DebuggerWindow2.cpp
|
||||
debugger/DebuggerWindow2.h
|
||||
debugger/DisasmCtrl.cpp
|
||||
debugger/DisasmCtrl.h
|
||||
debugger/DumpCtrl.cpp
|
||||
debugger/DumpCtrl.h
|
||||
debugger/DumpWindow.cpp
|
||||
debugger/DumpWindow.h
|
||||
debugger/ModuleWindow.cpp
|
||||
debugger/ModuleWindow.h
|
||||
debugger/RegisterCtrl.cpp
|
||||
debugger/RegisterCtrl.h
|
||||
debugger/RegisterWindow.cpp
|
||||
debugger/RegisterWindow.h
|
||||
debugger/SymbolCtrl.cpp
|
||||
debugger/SymbolCtrl.h
|
||||
debugger/SymbolWindow.cpp
|
||||
debugger/SymbolWindow.h
|
||||
dialogs/CreateAccount/wxCreateAccountDialog.cpp
|
||||
dialogs/CreateAccount/wxCreateAccountDialog.h
|
||||
dialogs/SaveImport/SaveImportWindow.cpp
|
||||
dialogs/SaveImport/SaveImportWindow.h
|
||||
dialogs/SaveImport/SaveTransfer.cpp
|
||||
dialogs/SaveImport/SaveTransfer.h
|
||||
DownloadGraphicPacksWindow.cpp
|
||||
DownloadGraphicPacksWindow.h
|
||||
GameProfileWindow.cpp
|
||||
GameProfileWindow.h
|
||||
GameUpdateWindow.cpp
|
||||
GameUpdateWindow.h
|
||||
GeneralSettings2.cpp
|
||||
GeneralSettings2.h
|
||||
GettingStartedDialog.cpp
|
||||
GettingStartedDialog.h
|
||||
GraphicPacksWindow2.cpp
|
||||
GraphicPacksWindow2.h
|
||||
guiWrapper.cpp
|
||||
guiWrapper.h
|
||||
helpers/wxControlObject.h
|
||||
helpers/wxCustomData.h
|
||||
helpers/wxCustomEvents.cpp
|
||||
helpers/wxCustomEvents.h
|
||||
helpers/wxHelpers.cpp
|
||||
helpers/wxHelpers.h
|
||||
helpers/wxLogEvent.h
|
||||
helpers/wxWayland.cpp
|
||||
helpers/wxWayland.h
|
||||
input/HotkeySettings.cpp
|
||||
input/HotkeySettings.h
|
||||
input/InputAPIAddWindow.cpp
|
||||
input/InputAPIAddWindow.h
|
||||
input/InputSettings2.cpp
|
||||
input/InputSettings2.h
|
||||
input/PairingDialog.cpp
|
||||
input/PairingDialog.h
|
||||
input/panels/ClassicControllerInputPanel.cpp
|
||||
input/panels/ClassicControllerInputPanel.h
|
||||
input/panels/InputPanel.cpp
|
||||
input/panels/InputPanel.h
|
||||
input/panels/ProControllerInputPanel.cpp
|
||||
input/panels/ProControllerInputPanel.h
|
||||
input/panels/VPADInputPanel.cpp
|
||||
input/panels/VPADInputPanel.h
|
||||
input/panels/WiimoteInputPanel.cpp
|
||||
input/panels/WiimoteInputPanel.h
|
||||
input/settings/DefaultControllerSettings.cpp
|
||||
input/settings/DefaultControllerSettings.h
|
||||
input/settings/WiimoteControllerSettings.cpp
|
||||
input/settings/WiimoteControllerSettings.h
|
||||
LoggingWindow.cpp
|
||||
LoggingWindow.h
|
||||
MainWindow.cpp
|
||||
MainWindow.h
|
||||
MemorySearcherTool.cpp
|
||||
MemorySearcherTool.h
|
||||
PadViewFrame.cpp
|
||||
PadViewFrame.h
|
||||
TitleManager.cpp
|
||||
TitleManager.h
|
||||
EmulatedUSBDevices/EmulatedUSBDeviceFrame.cpp
|
||||
EmulatedUSBDevices/EmulatedUSBDeviceFrame.h
|
||||
windows/PPCThreadsViewer
|
||||
windows/PPCThreadsViewer/DebugPPCThreadsWindow.cpp
|
||||
windows/PPCThreadsViewer/DebugPPCThreadsWindow.h
|
||||
windows/TextureRelationViewer
|
||||
windows/TextureRelationViewer/TextureRelationWindow.cpp
|
||||
windows/TextureRelationViewer/TextureRelationWindow.h
|
||||
wxcomponents/checked2.xpm
|
||||
wxcomponents/checked_dis.xpm
|
||||
wxcomponents/checked_d.xpm
|
||||
wxcomponents/checked_ld.xpm
|
||||
wxcomponents/checkedlistctrl.cpp
|
||||
wxcomponents/checkedlistctrl.h
|
||||
wxcomponents/checked_mo.xpm
|
||||
wxcomponents/checked.xpm
|
||||
wxcomponents/checktree.cpp
|
||||
wxcomponents/checktree.h
|
||||
wxcomponents/unchecked2.xpm
|
||||
wxcomponents/unchecked_dis.xpm
|
||||
wxcomponents/unchecked_d.xpm
|
||||
wxcomponents/unchecked_ld.xpm
|
||||
wxcomponents/unchecked_mo.xpm
|
||||
wxcomponents/unchecked.xpm
|
||||
wxgui.h
|
||||
wxHelper.h
|
||||
)
|
||||
add_library(CemuGui INTERFACE)
|
||||
target_include_directories(CemuGui INTERFACE "interface")
|
||||
|
||||
set_property(TARGET CemuGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
|
||||
target_include_directories(CemuGui PUBLIC "../")
|
||||
# PUBLIC because rapidjson/document.h is included in ChecksumTool.h
|
||||
target_include_directories(CemuGui PUBLIC ${RAPIDJSON_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(CemuGui PRIVATE
|
||||
CemuAudio
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuComponents
|
||||
CemuConfig
|
||||
CemuInput
|
||||
CemuResource
|
||||
CemuUtil
|
||||
Boost::headers
|
||||
CURL::libcurl
|
||||
libzip::zip
|
||||
OpenSSL::Crypto
|
||||
pugixml::pugixml
|
||||
ZArchive::zarchive
|
||||
)
|
||||
|
||||
if(ENABLE_WXWIDGETS AND UNIX AND NOT APPLE)
|
||||
# PUBLIC because gdk/gdkkeysyms.h is included in guiWrapper.h
|
||||
target_link_libraries(CemuGui PUBLIC GTK3::gtk)
|
||||
if (ENABLE_WAYLAND)
|
||||
target_link_libraries(CemuGui PRIVATE Wayland::Client CemuWaylandProtocols)
|
||||
endif()
|
||||
if(ENABLE_WXWIDGETS)
|
||||
add_subdirectory(wxgui)
|
||||
target_link_libraries(CemuGui INTERFACE CemuWxGui)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
target_link_libraries(CemuGui PRIVATE cubeb::cubeb)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(ENABLE_FERAL_GAMEMODE)
|
||||
target_link_libraries(CemuGui PRIVATE gamemode)
|
||||
endif()
|
||||
endif()
|
||||
if (ENABLE_WXWIDGETS)
|
||||
# PUBLIC because wx/app.h is included in CemuApp.h
|
||||
target_link_libraries(CemuGui PUBLIC wx::base wx::core wx::gl wx::propgrid wx::xrc)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(CemuGui PRIVATE bthprops)
|
||||
endif()
|
||||
|
||||
if(ALLOW_PORTABLE)
|
||||
target_compile_definitions(CemuGui PRIVATE CEMU_ALLOW_PORTABLE)
|
||||
endif ()
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <wx/frame.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/combobox.h>
|
||||
#include "gui/components/wxLogCtrl.h"
|
||||
|
||||
class wxLogEvent;
|
||||
|
||||
class LoggingWindow : public wxFrame
|
||||
{
|
||||
public:
|
||||
LoggingWindow(wxFrame* parent);
|
||||
~LoggingWindow();
|
||||
|
||||
static void Log(std::string_view filter, std::string_view message);
|
||||
static void Log(std::string_view message) { Log("", message); }
|
||||
static void Log(std::string_view filter, std::wstring_view message);
|
||||
static void Log(std::wstring_view message){ Log("", message); }
|
||||
|
||||
template<typename ...TArgs>
|
||||
static void Log(std::string_view filter, std::string_view format, TArgs&&... args)
|
||||
{
|
||||
Log(filter, fmt::format(format, std::forward<TArgs>(args)...));
|
||||
}
|
||||
|
||||
template<typename ...TArgs>
|
||||
static void Log(std::string_view filter, std::wstring_view format, TArgs&&... args)
|
||||
{
|
||||
Log(filter, fmt::format(format, std::forward<TArgs>(args)...));
|
||||
}
|
||||
private:
|
||||
void OnLogMessage(wxLogEvent& event);
|
||||
void OnFilterChange(wxCommandEvent& event);
|
||||
void OnFilterMessageChange(wxCommandEvent& event);
|
||||
|
||||
wxComboBox* m_filter;
|
||||
wxLogCtrl* m_log_list;
|
||||
wxCheckBox* m_filter_message;
|
||||
|
||||
inline static std::shared_mutex s_mutex;
|
||||
inline static LoggingWindow* s_instance = nullptr;
|
||||
};
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#pragma once
|
||||
#include <wx/window.h>
|
||||
#include "gui/canvas/IRenderCanvas.h"
|
||||
|
||||
wxWindow* GLCanvas_Create(wxWindow* parent, const wxSize& size, bool is_main_window);
|
||||
bool GLCanvas_MakeCurrent(bool padView);
|
||||
void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC);
|
||||
bool GLCanvas_HasPadViewOpen();
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
#if BOOST_OS_LINUX
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkwindow.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#ifdef HAS_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "gui/wxgui.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Latte/Core/Latte.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
||||
#include "Cafe/CafeSystem.h"
|
||||
|
||||
#include "wxHelper.h"
|
||||
|
||||
WindowInfo g_window_info {};
|
||||
|
||||
std::shared_mutex g_mutex;
|
||||
MainWindow* g_mainFrame = nullptr;
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
void _wxLaunch()
|
||||
{
|
||||
SetThreadName("MainThread_UI");
|
||||
wxEntry();
|
||||
}
|
||||
#endif
|
||||
|
||||
void gui_create()
|
||||
{
|
||||
SetThreadName("cemu");
|
||||
#if BOOST_OS_WINDOWS
|
||||
// on Windows wxWidgets there is a bug where wxDirDialog->ShowModal will deadlock in Windows internals somehow
|
||||
// moving the UI thread off the main thread fixes this
|
||||
std::thread t = std::thread(_wxLaunch);
|
||||
t.join();
|
||||
#else
|
||||
int argc = 0;
|
||||
char* argv[1]{};
|
||||
wxEntry(argc, argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
WindowInfo& gui_getWindowInfo()
|
||||
{
|
||||
return g_window_info;
|
||||
}
|
||||
|
||||
void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps)
|
||||
{
|
||||
std::string windowText;
|
||||
windowText = BUILD_VERSION_WITH_NAME_STRING;
|
||||
|
||||
if (isIdle)
|
||||
{
|
||||
if (g_mainFrame)
|
||||
g_mainFrame->AsyncSetTitle(windowText);
|
||||
return;
|
||||
}
|
||||
if (isLoading)
|
||||
{
|
||||
windowText.append(" - loading...");
|
||||
if (g_mainFrame)
|
||||
g_mainFrame->AsyncSetTitle(windowText);
|
||||
return;
|
||||
}
|
||||
|
||||
const char* renderer = "";
|
||||
if(g_renderer)
|
||||
{
|
||||
switch(g_renderer->GetType())
|
||||
{
|
||||
case RendererAPI::OpenGL:
|
||||
renderer = "[OpenGL]";
|
||||
break;
|
||||
case RendererAPI::Vulkan:
|
||||
renderer = "[Vulkan]";
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
// get GPU vendor/mode
|
||||
const char* graphicMode = "[Generic]";
|
||||
if (LatteGPUState.glVendor == GLVENDOR_AMD)
|
||||
graphicMode = "[AMD GPU]";
|
||||
else if (LatteGPUState.glVendor == GLVENDOR_INTEL)
|
||||
graphicMode = "[Intel GPU]";
|
||||
else if (LatteGPUState.glVendor == GLVENDOR_NVIDIA)
|
||||
graphicMode = "[NVIDIA GPU]";
|
||||
else if (LatteGPUState.glVendor == GLVENDOR_APPLE)
|
||||
graphicMode = "[Apple GPU]";
|
||||
|
||||
const uint64 titleId = CafeSystem::GetForegroundTitleId();
|
||||
windowText.append(fmt::format(" - FPS: {:.2f} {} {} [TitleId: {:08x}-{:08x}]", (double)fps, renderer, graphicMode, (uint32)(titleId >> 32), (uint32)(titleId & 0xFFFFFFFF)));
|
||||
|
||||
if (ActiveSettings::IsOnlineEnabled())
|
||||
{
|
||||
if (ActiveSettings::GetNetworkService() == NetworkService::Nintendo)
|
||||
windowText.append(" [Online]");
|
||||
else if (ActiveSettings::GetNetworkService() == NetworkService::Pretendo)
|
||||
windowText.append(" [Online-Pretendo]");
|
||||
else if (ActiveSettings::GetNetworkService() == NetworkService::Custom)
|
||||
windowText.append(" [Online-" + GetNetworkConfig().networkname.GetValue() + "]");
|
||||
}
|
||||
windowText.append(" ");
|
||||
windowText.append(CafeSystem::GetForegroundTitleName());
|
||||
// append region
|
||||
CafeConsoleRegion region = CafeSystem::GetForegroundTitleRegion();
|
||||
uint16 titleVersion = CafeSystem::GetForegroundTitleVersion();
|
||||
if (region == CafeConsoleRegion::JPN)
|
||||
windowText.append(fmt::format(" [JP v{}]", titleVersion));
|
||||
else if (region == CafeConsoleRegion::USA)
|
||||
windowText.append(fmt::format(" [US v{}]", titleVersion));
|
||||
else if (region == CafeConsoleRegion::EUR)
|
||||
windowText.append(fmt::format(" [EU v{}]", titleVersion));
|
||||
else
|
||||
windowText.append(fmt::format(" [v{}]", titleVersion));
|
||||
|
||||
std::shared_lock lock(g_mutex);
|
||||
if (g_mainFrame)
|
||||
{
|
||||
g_mainFrame->AsyncSetTitle(windowText);
|
||||
auto* pad = g_mainFrame->GetPadView();
|
||||
if (pad)
|
||||
pad->AsyncSetTitle(fmt::format("{} - FPS: {:.02f}", _("GamePad View").utf8_string(), fps));
|
||||
}
|
||||
}
|
||||
|
||||
void gui_getWindowSize(int& w, int& h)
|
||||
{
|
||||
w = g_window_info.width;
|
||||
h = g_window_info.height;
|
||||
}
|
||||
|
||||
void gui_getPadWindowSize(int& w, int& h)
|
||||
{
|
||||
if (g_window_info.pad_open)
|
||||
{
|
||||
w = g_window_info.pad_width;
|
||||
h = g_window_info.pad_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 0;
|
||||
h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void gui_getWindowPhysSize(int& w, int& h)
|
||||
{
|
||||
w = g_window_info.phys_width;
|
||||
h = g_window_info.phys_height;
|
||||
}
|
||||
|
||||
void gui_getPadWindowPhysSize(int& w, int& h)
|
||||
{
|
||||
if (g_window_info.pad_open)
|
||||
{
|
||||
w = g_window_info.phys_pad_width;
|
||||
h = g_window_info.phys_pad_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 0;
|
||||
h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
double gui_getWindowDPIScale()
|
||||
{
|
||||
return g_window_info.dpi_scale;
|
||||
}
|
||||
|
||||
double gui_getPadDPIScale()
|
||||
{
|
||||
return g_window_info.pad_open ? g_window_info.pad_dpi_scale.load() : 1.0;
|
||||
}
|
||||
|
||||
bool gui_isPadWindowOpen()
|
||||
{
|
||||
return g_window_info.pad_open;
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
std::string gui_gtkRawKeyCodeToString(uint32 keyCode)
|
||||
{
|
||||
return gdk_keyval_name(keyCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
handleInfoOut.hwnd = wxw->GetHWND();
|
||||
#elif BOOST_OS_LINUX
|
||||
GtkWidget* gtkWidget = (GtkWidget*)wxw->GetHandle(); // returns GtkWidget
|
||||
gtk_widget_realize(gtkWidget);
|
||||
GdkWindow* gdkWindow = gtk_widget_get_window(gtkWidget);
|
||||
GdkDisplay* gdkDisplay = gdk_window_get_display(gdkWindow);
|
||||
if(GDK_IS_X11_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfoOut.backend = WindowHandleInfo::Backend::X11;
|
||||
handleInfoOut.xlib_window = gdk_x11_window_get_xid(gdkWindow);
|
||||
handleInfoOut.xlib_display = gdk_x11_display_get_xdisplay(gdkDisplay);
|
||||
if(!handleInfoOut.xlib_display)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Unable to get xlib display");
|
||||
}
|
||||
}
|
||||
else
|
||||
#ifdef HAS_WAYLAND
|
||||
if(GDK_IS_WAYLAND_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfoOut.backend = WindowHandleInfo::Backend::WAYLAND;
|
||||
handleInfoOut.surface = gdk_wayland_window_get_wl_surface(gdkWindow);
|
||||
handleInfoOut.display = gdk_wayland_display_get_wl_display(gdkDisplay);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Unsuported GTK backend");
|
||||
}
|
||||
#else
|
||||
handleInfoOut.handle = wxw->GetHandle();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool gui_isKeyDown(uint32 key)
|
||||
{
|
||||
return g_window_info.get_keystate(key);
|
||||
}
|
||||
|
||||
bool gui_isKeyDown(PlatformKeyCodes key)
|
||||
{
|
||||
return gui_isKeyDown((std::underlying_type_t<PlatformKeyCodes>)key);
|
||||
}
|
||||
|
||||
void gui_notifyGameLoaded()
|
||||
{
|
||||
std::shared_lock lock(g_mutex);
|
||||
if (g_mainFrame)
|
||||
{
|
||||
g_mainFrame->OnGameLoaded();
|
||||
g_mainFrame->UpdateSettingsAfterGameLaunch();
|
||||
}
|
||||
}
|
||||
|
||||
void gui_notifyGameExited()
|
||||
{
|
||||
std::shared_lock lock(g_mutex);
|
||||
if(g_mainFrame)
|
||||
g_mainFrame->RestoreSettingsAfterGameExited();
|
||||
}
|
||||
|
||||
bool gui_isFullScreen()
|
||||
{
|
||||
return g_window_info.is_fullscreen;
|
||||
}
|
||||
|
||||
bool gui_hasScreenshotRequest()
|
||||
{
|
||||
const bool result = g_window_info.has_screenshot_request;
|
||||
g_window_info.has_screenshot_request = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
extern DebuggerWindow2* g_debugger_window;
|
||||
void debuggerWindow_updateViewThreadsafe2()
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_UPDATE_VIEW);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
||||
void debuggerWindow_moveIP()
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_MOVE_IP);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
||||
void debuggerWindow_notifyDebugBreakpointHit2()
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_BREAKPOINT_HIT);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
||||
void debuggerWindow_notifyRun()
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_RUN);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
||||
void debuggerWindow_notifyModuleLoaded(void* module)
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_NOTIFY_MODULE_LOADED);
|
||||
evt->SetClientData(module);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
||||
void debuggerWindow_notifyModuleUnloaded(void* module)
|
||||
{
|
||||
if (g_debugger_window)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_NOTIFY_MODULE_UNLOADED);
|
||||
evt->SetClientData(module);
|
||||
wxQueueEvent(g_debugger_window, evt);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "xcb/xproto.h"
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_MACOS
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
struct WindowHandleInfo
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
std::atomic<HWND> hwnd;
|
||||
#elif BOOST_OS_LINUX
|
||||
enum class Backend
|
||||
{
|
||||
X11,
|
||||
WAYLAND,
|
||||
} backend;
|
||||
// XLIB
|
||||
Display* xlib_display{};
|
||||
Window xlib_window{};
|
||||
|
||||
// XCB (not used by GTK so we cant retrieve these without making our own window)
|
||||
//xcb_connection_t* xcb_con{};
|
||||
//xcb_window_t xcb_window{};
|
||||
#ifdef HAS_WAYLAND
|
||||
struct wl_display* display;
|
||||
struct wl_surface* surface;
|
||||
#endif // HAS_WAYLAND
|
||||
#else
|
||||
void* handle;
|
||||
#endif
|
||||
};
|
||||
|
||||
enum struct PlatformKeyCodes : uint32
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
LCONTROL = VK_LCONTROL,
|
||||
RCONTROL = VK_RCONTROL,
|
||||
TAB = VK_TAB,
|
||||
ESCAPE = VK_ESCAPE,
|
||||
#elif BOOST_OS_LINUX
|
||||
LCONTROL = GDK_KEY_Control_L,
|
||||
RCONTROL = GDK_KEY_Control_R,
|
||||
TAB = GDK_KEY_Tab,
|
||||
ESCAPE = GDK_KEY_Escape,
|
||||
#elif BOOST_OS_MACOS
|
||||
LCONTROL = kVK_Control,
|
||||
RCONTROL = kVK_RightControl,
|
||||
TAB = kVK_Tab,
|
||||
ESCAPE = kVK_Escape,
|
||||
#else
|
||||
LCONTROL = 0,
|
||||
RCONTROL = 0,
|
||||
TAB = 0,
|
||||
ESCAPE = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct WindowInfo
|
||||
{
|
||||
std::atomic_bool app_active; // our app is active/has focus
|
||||
|
||||
std::atomic_int32_t width, height; // client size of main window
|
||||
std::atomic_int32_t phys_width, phys_height; // client size of main window in physical pixels
|
||||
std::atomic<double> dpi_scale;
|
||||
|
||||
std::atomic_bool pad_open; // if separate pad view is open
|
||||
std::atomic_int32_t pad_width, pad_height; // client size of pad window
|
||||
std::atomic_int32_t phys_pad_width, phys_pad_height; // client size of pad window in physical pixels
|
||||
std::atomic<double> pad_dpi_scale;
|
||||
|
||||
std::atomic_bool pad_maximized = false;
|
||||
std::atomic_int32_t restored_pad_x = -1, restored_pad_y = -1;
|
||||
std::atomic_int32_t restored_pad_width = -1, restored_pad_height = -1;
|
||||
|
||||
std::atomic_bool has_screenshot_request;
|
||||
std::atomic_bool is_fullscreen;
|
||||
|
||||
void set_keystate(uint32 keycode, bool state)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
m_keydown[keycode] = state;
|
||||
}
|
||||
|
||||
bool get_keystate(uint32 keycode)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
auto result = m_keydown.find(keycode);
|
||||
if (result == m_keydown.end())
|
||||
return false;
|
||||
return result->second;
|
||||
}
|
||||
|
||||
void set_keystatesup()
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
std::for_each(m_keydown.begin(), m_keydown.end(), [](std::pair<const uint32, bool>& el){ el.second = false; });
|
||||
}
|
||||
|
||||
template <typename fn>
|
||||
void iter_keystates(fn f)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
std::for_each(m_keydown.cbegin(), m_keydown.cend(), f);
|
||||
}
|
||||
|
||||
WindowHandleInfo window_main;
|
||||
WindowHandleInfo window_pad;
|
||||
|
||||
// canvas
|
||||
WindowHandleInfo canvas_main;
|
||||
WindowHandleInfo canvas_pad;
|
||||
private:
|
||||
std::mutex keycode_mutex;
|
||||
// m_keydown keys must be valid ImGuiKey values
|
||||
std::unordered_map<uint32, bool> m_keydown;
|
||||
};
|
||||
|
||||
void gui_create();
|
||||
|
||||
WindowInfo& gui_getWindowInfo();
|
||||
|
||||
void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps);
|
||||
void gui_getWindowSize(int& w, int& h);
|
||||
void gui_getPadWindowSize(int& w, int& h);
|
||||
void gui_getWindowPhysSize(int& w, int& h);
|
||||
void gui_getPadWindowPhysSize(int& w, int& h);
|
||||
double gui_getWindowDPIScale();
|
||||
double gui_getPadDPIScale();
|
||||
bool gui_isPadWindowOpen();
|
||||
bool gui_isKeyDown(uint32 key);
|
||||
bool gui_isKeyDown(PlatformKeyCodes key);
|
||||
|
||||
void gui_notifyGameLoaded();
|
||||
void gui_notifyGameExited();
|
||||
|
||||
bool gui_isFullScreen();
|
||||
|
||||
void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw);
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
std::string gui_gtkRawKeyCodeToString(uint32 keyCode);
|
||||
#endif
|
||||
/*
|
||||
* Returns true if a screenshot request is queued
|
||||
* Once this function has returned true, it will reset back to
|
||||
* false until the next time a screenshot is requested
|
||||
*/
|
||||
bool gui_hasScreenshotRequest();
|
||||
|
||||
// debugger stuff
|
||||
void debuggerWindow_updateViewThreadsafe2();
|
||||
void debuggerWindow_notifyDebugBreakpointHit2();
|
||||
void debuggerWindow_notifyRun();
|
||||
void debuggerWindow_moveIP();
|
||||
void debuggerWindow_notifyModuleLoaded(void* module);
|
||||
void debuggerWindow_notifyModuleUnloaded(void* module);
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
#include "gui/helpers/wxHelpers.h"
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/dirdlg.h>
|
||||
|
||||
#include "gui/helpers/wxControlObject.h"
|
||||
|
||||
void wxAutosizeColumn(wxListCtrlBase* ctrl, int col)
|
||||
{
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE_USEHEADER);
|
||||
int wh = ctrl->GetColumnWidth(col);
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE);
|
||||
int wc = ctrl->GetColumnWidth(col);
|
||||
if (wh > wc)
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE_USEHEADER);
|
||||
}
|
||||
|
||||
void wxAutosizeColumns(wxListCtrlBase* ctrl, int col_start, int col_end)
|
||||
{
|
||||
wxWindowUpdateLocker lock(ctrl);
|
||||
for (int i = col_start; i <= col_end; ++i)
|
||||
wxAutosizeColumn(ctrl, i);
|
||||
}
|
||||
|
||||
void update_slider_text(wxCommandEvent& event, const wxFormatString& format /*= "%d%%"*/)
|
||||
{
|
||||
const auto slider = dynamic_cast<wxSlider*>(event.GetEventObject());
|
||||
wxASSERT(slider);
|
||||
|
||||
auto slider_text = dynamic_cast<wxControlObject*>(event.GetEventUserData())->GetControl<wxStaticText>();
|
||||
wxASSERT(slider_text);
|
||||
|
||||
slider_text->SetLabel(wxString::Format(format, slider->GetValue()));
|
||||
}
|
||||
|
||||
uint32 fix_raw_keycode(uint32 keycode, uint32 raw_flags)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
const auto flags = (HIWORD(raw_flags) & 0xFFF);
|
||||
if(keycode == VK_SHIFT)
|
||||
{
|
||||
if(flags == 0x2A)
|
||||
return 160;
|
||||
else if (flags == 0x36)
|
||||
return 161;
|
||||
}
|
||||
else if (keycode == VK_CONTROL)
|
||||
{
|
||||
if (flags == 0x1d)
|
||||
return 162;
|
||||
else if (flags == 0x11d)
|
||||
return 163;
|
||||
}
|
||||
else if (keycode == VK_MENU)
|
||||
{
|
||||
if ((flags & 0xFF) == 0x38)
|
||||
return 164;
|
||||
else if ((flags & 0xFF) == 0x38)
|
||||
return 165;
|
||||
}
|
||||
#endif
|
||||
|
||||
return keycode;
|
||||
}
|
||||
126
src/gui/interface/WindowSystem.h
Normal file
126
src/gui/interface/WindowSystem.h
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
#pragma once
|
||||
|
||||
#include "config/CemuConfig.h"
|
||||
#include "input/api/ControllerState.h"
|
||||
|
||||
namespace WindowSystem
|
||||
{
|
||||
struct WindowHandleInfo
|
||||
{
|
||||
enum class Backend
|
||||
{
|
||||
X11,
|
||||
Wayland,
|
||||
Cocoa,
|
||||
Windows,
|
||||
} backend;
|
||||
void* display = nullptr;
|
||||
void* surface = nullptr;
|
||||
};
|
||||
|
||||
enum struct PlatformKeyCodes : uint32
|
||||
{
|
||||
LCONTROL,
|
||||
RCONTROL,
|
||||
TAB,
|
||||
ESCAPE,
|
||||
};
|
||||
|
||||
struct WindowInfo
|
||||
{
|
||||
std::atomic_bool app_active; // our app is active/has focus
|
||||
|
||||
std::atomic_int32_t width, height; // client size of main window
|
||||
std::atomic_int32_t phys_width, phys_height; // client size of main window in physical pixels
|
||||
std::atomic<double> dpi_scale;
|
||||
|
||||
std::atomic_bool pad_open; // if separate pad view is open
|
||||
std::atomic_int32_t pad_width, pad_height; // client size of pad window
|
||||
std::atomic_int32_t phys_pad_width, phys_pad_height; // client size of pad window in physical pixels
|
||||
std::atomic<double> pad_dpi_scale;
|
||||
|
||||
std::atomic_bool pad_maximized = false;
|
||||
std::atomic_int32_t restored_pad_x = -1, restored_pad_y = -1;
|
||||
std::atomic_int32_t restored_pad_width = -1, restored_pad_height = -1;
|
||||
|
||||
std::atomic_bool is_fullscreen;
|
||||
|
||||
void set_keystate(uint32 keycode, bool state)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
m_keydown[keycode] = state;
|
||||
}
|
||||
|
||||
bool get_keystate(uint32 keycode)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
auto result = m_keydown.find(keycode);
|
||||
if (result == m_keydown.end())
|
||||
return false;
|
||||
return result->second;
|
||||
}
|
||||
|
||||
void set_keystatesup()
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
std::for_each(m_keydown.begin(), m_keydown.end(), [](std::pair<const uint32, bool>& el) { el.second = false; });
|
||||
}
|
||||
|
||||
template<typename fn>
|
||||
void iter_keystates(fn f)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(keycode_mutex);
|
||||
std::for_each(m_keydown.cbegin(), m_keydown.cend(), f);
|
||||
}
|
||||
|
||||
WindowHandleInfo window_main;
|
||||
WindowHandleInfo window_pad;
|
||||
|
||||
// canvas
|
||||
WindowHandleInfo canvas_main;
|
||||
WindowHandleInfo canvas_pad;
|
||||
|
||||
private:
|
||||
std::mutex keycode_mutex;
|
||||
std::unordered_map<uint32, bool> m_keydown;
|
||||
};
|
||||
|
||||
enum class ErrorCategory
|
||||
{
|
||||
KEYS_TXT_CREATION = 0,
|
||||
GRAPHIC_PACKS = 1,
|
||||
};
|
||||
|
||||
void ShowErrorDialog(std::string_view message, std::string_view title, std::optional<ErrorCategory> errorCategory = {});
|
||||
inline void ShowErrorDialog(std::string_view message, std::optional<ErrorCategory> errorCategory = {})
|
||||
{
|
||||
ShowErrorDialog(message, "", errorCategory);
|
||||
}
|
||||
|
||||
void Create();
|
||||
|
||||
WindowInfo& GetWindowInfo();
|
||||
|
||||
void UpdateWindowTitles(bool isIdle, bool isLoading, double fps);
|
||||
void GetWindowSize(int& w, int& h);
|
||||
void GetPadWindowSize(int& w, int& h);
|
||||
void GetWindowPhysSize(int& w, int& h);
|
||||
void GetPadWindowPhysSize(int& w, int& h);
|
||||
double GetWindowDPIScale();
|
||||
double GetPadDPIScale();
|
||||
bool IsPadWindowOpen();
|
||||
bool IsKeyDown(uint32 key);
|
||||
bool IsKeyDown(PlatformKeyCodes key);
|
||||
std::string GetKeyCodeName(uint32 key);
|
||||
|
||||
bool InputConfigWindowHasFocus();
|
||||
|
||||
void NotifyGameLoaded();
|
||||
void NotifyGameExited();
|
||||
|
||||
void RefreshGameList();
|
||||
|
||||
bool IsFullScreen();
|
||||
|
||||
void CaptureInput(const ControllerState& currentState, const ControllerState& lastState);
|
||||
}; // namespace WindowSystem
|
||||
331
src/gui/wxgui/AudioDebuggerWindow.cpp
Normal file
331
src/gui/wxgui/AudioDebuggerWindow.cpp
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
#include "wxgui.h"
|
||||
#include "AudioDebuggerWindow.h"
|
||||
|
||||
#include "Cafe/OS/libs/snd_core/ax.h"
|
||||
#include "Cafe/OS/libs/snd_core/ax_internal.h"
|
||||
|
||||
enum
|
||||
{
|
||||
// options
|
||||
REFRESH_ID,
|
||||
CLOSE_ID,
|
||||
VOICELIST_ID,
|
||||
REFRESH_TIMER_ID,
|
||||
};
|
||||
|
||||
wxBEGIN_EVENT_TABLE(AudioDebuggerWindow, wxFrame)
|
||||
EVT_BUTTON(CLOSE_ID, AudioDebuggerWindow::OnCloseButton)
|
||||
EVT_BUTTON(REFRESH_ID, AudioDebuggerWindow::OnRefreshButton)
|
||||
EVT_TIMER(REFRESH_TIMER_ID, AudioDebuggerWindow::OnRefreshTimer)
|
||||
|
||||
EVT_CLOSE(AudioDebuggerWindow::OnClose)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
AudioDebuggerWindow::AudioDebuggerWindow(wxFrame& parent)
|
||||
: wxFrame(&parent, wxID_ANY, _("AX voice viewer"), wxDefaultPosition, wxSize(1126, 580), wxCLOSE_BOX | wxCLIP_CHILDREN | wxCAPTION | wxRESIZE_BORDER)
|
||||
{
|
||||
|
||||
wxPanel* mainPane = new wxPanel(this);
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
voiceListbox = new wxListCtrl(mainPane, VOICELIST_ID, wxPoint(0, 0), wxSize(1126, 570), wxLC_REPORT);
|
||||
voiceListbox->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, "Courier New"));
|
||||
// add columns
|
||||
wxListItem col0;
|
||||
col0.SetId(0);
|
||||
col0.SetText("idx");
|
||||
col0.SetWidth(40);
|
||||
voiceListbox->InsertColumn(0, col0);
|
||||
wxListItem col1;
|
||||
col1.SetId(1);
|
||||
col1.SetText("state");
|
||||
col1.SetWidth(48);
|
||||
voiceListbox->InsertColumn(1, col1);
|
||||
//wxListItem col2;
|
||||
// format
|
||||
col1.SetId(2);
|
||||
col1.SetText("fmt");
|
||||
col1.SetWidth(52);
|
||||
voiceListbox->InsertColumn(2, col1);
|
||||
// sample base addr
|
||||
col1.SetId(3);
|
||||
col1.SetText("base");
|
||||
col1.SetWidth(70);
|
||||
voiceListbox->InsertColumn(3, col1);
|
||||
// current offset
|
||||
col1.SetId(4);
|
||||
col1.SetText("current");
|
||||
col1.SetWidth(70);
|
||||
voiceListbox->InsertColumn(4, col1);
|
||||
// loop offset
|
||||
col1.SetId(5);
|
||||
col1.SetText("loop");
|
||||
col1.SetWidth(70);
|
||||
voiceListbox->InsertColumn(5, col1);
|
||||
// end offset
|
||||
col1.SetId(6);
|
||||
col1.SetText("end");
|
||||
col1.SetWidth(70);
|
||||
voiceListbox->InsertColumn(6, col1);
|
||||
// volume
|
||||
col1.SetId(7);
|
||||
col1.SetText("vol");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(7, col1);
|
||||
// volume delta
|
||||
col1.SetId(8);
|
||||
col1.SetText("volD");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(8, col1);
|
||||
// src
|
||||
col1.SetId(9);
|
||||
col1.SetText("src");
|
||||
col1.SetWidth(70);
|
||||
voiceListbox->InsertColumn(9, col1);
|
||||
// low-pass filter coef a0
|
||||
col1.SetId(10);
|
||||
col1.SetText("lpa0");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(10, col1);
|
||||
// low-pass filter coef b0
|
||||
col1.SetId(11);
|
||||
col1.SetText("lpb0");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(11, col1);
|
||||
// biquad filter coef b0
|
||||
col1.SetId(12);
|
||||
col1.SetText("bqb0");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(12, col1);
|
||||
// biquad filter coef b0
|
||||
col1.SetId(13);
|
||||
col1.SetText("bqb1");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(13, col1);
|
||||
// biquad filter coef b0
|
||||
col1.SetId(14);
|
||||
col1.SetText("bqb2");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(14, col1);
|
||||
// biquad filter coef a0
|
||||
col1.SetId(15);
|
||||
col1.SetText("bqa1");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(15, col1);
|
||||
// biquad filter coef a1
|
||||
col1.SetId(16);
|
||||
col1.SetText("bqa2");
|
||||
col1.SetWidth(46);
|
||||
voiceListbox->InsertColumn(16, col1);
|
||||
// device mix
|
||||
col1.SetId(17);
|
||||
col1.SetText("deviceMix");
|
||||
col1.SetWidth(186);
|
||||
voiceListbox->InsertColumn(17, col1);
|
||||
|
||||
sizer->Add(voiceListbox, 1, wxEXPAND | wxBOTTOM, 0);
|
||||
|
||||
voiceListbox->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(AudioDebuggerWindow::OnVoiceListRightClick), NULL, this);
|
||||
|
||||
mainPane->SetSizer(sizer);
|
||||
|
||||
// add empty entries
|
||||
for (sint32 i = 0; i < snd_core::AX_MAX_VOICES; i++)
|
||||
{
|
||||
wxListItem item;
|
||||
item.SetId(i);
|
||||
char tempStr[32];
|
||||
sprintf(tempStr, "%d", snd_core::AX_MAX_VOICES-i-1);
|
||||
item.SetText(wxString(tempStr));
|
||||
voiceListbox->InsertItem(item);
|
||||
}
|
||||
RefreshVoiceList();
|
||||
|
||||
wxFrame::SetBackgroundColour(*wxWHITE);
|
||||
|
||||
// start refresh timer
|
||||
static const int INTERVAL = 100; // milliseconds
|
||||
refreshTimer = new wxTimer(this, REFRESH_TIMER_ID);
|
||||
refreshTimer->Start(INTERVAL);
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnRefreshTimer(wxTimerEvent& event)
|
||||
{
|
||||
RefreshVoiceList();
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnCloseButton(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnRefreshButton(wxCommandEvent& event)
|
||||
{
|
||||
RefreshVoiceList();
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#define _r(__idx) _swapEndianU32(threadItrBE->context.gpr[__idx])
|
||||
|
||||
void AudioDebuggerWindow::RefreshVoiceList_sndgeneric()
|
||||
{
|
||||
if (snd_core::__AXVPBInternalVoiceArray == nullptr || snd_core::__AXVPBArrayPtr == nullptr)
|
||||
return;
|
||||
|
||||
snd_core::AXVPB tempVoiceArray[snd_core::AX_MAX_VOICES];
|
||||
memcpy(tempVoiceArray, snd_core::__AXVPBArrayPtr, sizeof(snd_core::AXVPB)*snd_core::AX_MAX_VOICES);
|
||||
|
||||
voiceListbox->Freeze();
|
||||
|
||||
char tempStr[64];
|
||||
for (sint32 i = 0; i < snd_core::AX_MAX_VOICES; i++)
|
||||
{
|
||||
sint32 voiceIndex = snd_core::AX_MAX_VOICES - 1 - i;
|
||||
snd_core::AXVPBInternal_t* internal = snd_core::__AXVPBInternalVoiceArray + voiceIndex;
|
||||
// index
|
||||
sprintf(tempStr, "%d", (sint32)tempVoiceArray[voiceIndex].index);
|
||||
voiceListbox->SetItem(i, 0, tempStr);
|
||||
// state
|
||||
uint16 playbackState = _swapEndianU16(internal->playbackState);
|
||||
if (playbackState)
|
||||
strcpy(tempStr, "on");
|
||||
else
|
||||
strcpy(tempStr, "off");
|
||||
voiceListbox->SetItem(i, 1, tempStr);
|
||||
// if voice index is invalid then stop updating here to prevent crashes
|
||||
if (voiceIndex < 0 || playbackState == 0)
|
||||
{
|
||||
voiceListbox->SetItem(i, 0, "");
|
||||
voiceListbox->SetItem(i, 1, "");
|
||||
voiceListbox->SetItem(i, 2, "");
|
||||
voiceListbox->SetItem(i, 3, "");
|
||||
voiceListbox->SetItem(i, 4, "");
|
||||
voiceListbox->SetItem(i, 5, "");
|
||||
voiceListbox->SetItem(i, 6, "");
|
||||
voiceListbox->SetItem(i, 7, "");
|
||||
voiceListbox->SetItem(i, 8, "");
|
||||
voiceListbox->SetItem(i, 9, "");
|
||||
voiceListbox->SetItem(i, 10, "");
|
||||
voiceListbox->SetItem(i, 11, "");
|
||||
voiceListbox->SetItem(i, 12, "");
|
||||
voiceListbox->SetItem(i, 13, "");
|
||||
voiceListbox->SetItem(i, 14, "");
|
||||
voiceListbox->SetItem(i, 15, "");
|
||||
voiceListbox->SetItem(i, 16, "");
|
||||
voiceListbox->SetItem(i, 17, "");
|
||||
continue;
|
||||
}
|
||||
// format
|
||||
if (tempVoiceArray[voiceIndex].offsets.format == _swapEndianU16(snd_core::AX_FORMAT_ADPCM))
|
||||
strcpy(tempStr, "adpcm");
|
||||
else if (tempVoiceArray[voiceIndex].offsets.format == _swapEndianU16(snd_core::AX_FORMAT_PCM16))
|
||||
strcpy(tempStr, "pcm16");
|
||||
else if (tempVoiceArray[voiceIndex].offsets.format == _swapEndianU16(snd_core::AX_FORMAT_PCM8))
|
||||
strcpy(tempStr, "pcm8");
|
||||
else
|
||||
strcpy(tempStr, "ukn");
|
||||
voiceListbox->SetItem(i, 2, tempStr);
|
||||
// update offsets
|
||||
snd_core::AXPBOFFSET_t tempOffsets;
|
||||
snd_core::AXGetVoiceOffsets(tempVoiceArray + voiceIndex, &tempOffsets);
|
||||
// sample base
|
||||
sprintf(tempStr, "%08x", _swapEndianU32(tempOffsets.samples));
|
||||
voiceListbox->SetItem(i, 3, tempStr);
|
||||
// current offset
|
||||
sprintf(tempStr, "%08x", _swapEndianU32(tempOffsets.currentOffset));
|
||||
voiceListbox->SetItem(i, 4, tempStr);
|
||||
// loop offset
|
||||
if (tempOffsets.loopFlag)
|
||||
sprintf(tempStr, "%08x", _swapEndianU32(tempOffsets.loopOffset));
|
||||
else
|
||||
sprintf(tempStr, "");
|
||||
voiceListbox->SetItem(i, 5, tempStr);
|
||||
// end offset
|
||||
sprintf(tempStr, "%08x", _swapEndianU32(tempOffsets.endOffset));
|
||||
voiceListbox->SetItem(i, 6, tempStr);
|
||||
// volume
|
||||
sprintf(tempStr, "%04x", (uint16)internal->veVolume);
|
||||
voiceListbox->SetItem(i, 7, tempStr);
|
||||
// volume delta
|
||||
sprintf(tempStr, "%04x", (uint16)internal->veDelta);
|
||||
voiceListbox->SetItem(i, 8, tempStr);
|
||||
// src
|
||||
sprintf(tempStr, "%04x%04x", _swapEndianU16(internal->src.ratioHigh), _swapEndianU16(internal->src.ratioLow));
|
||||
voiceListbox->SetItem(i, 9, tempStr);
|
||||
// lpf
|
||||
if (internal->lpf.on)
|
||||
{
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->lpf.a0));
|
||||
voiceListbox->SetItem(i, 10, tempStr);
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->lpf.b0));
|
||||
voiceListbox->SetItem(i, 11, tempStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
voiceListbox->SetItem(i, 10, "");
|
||||
voiceListbox->SetItem(i, 11, "");
|
||||
}
|
||||
// biquad
|
||||
if (internal->biquad.on)
|
||||
{
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->biquad.b0));
|
||||
voiceListbox->SetItem(i, 12, tempStr);
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->biquad.b1));
|
||||
voiceListbox->SetItem(i, 13, tempStr);
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->biquad.b2));
|
||||
voiceListbox->SetItem(i, 14, tempStr);
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->biquad.a1));
|
||||
voiceListbox->SetItem(i, 15, tempStr);
|
||||
sprintf(tempStr, "%04x", _swapEndianU16(internal->biquad.a2));
|
||||
voiceListbox->SetItem(i, 16, tempStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
voiceListbox->SetItem(i, 12, "");
|
||||
voiceListbox->SetItem(i, 13, "");
|
||||
voiceListbox->SetItem(i, 14, "");
|
||||
voiceListbox->SetItem(i, 15, "");
|
||||
voiceListbox->SetItem(i, 16, "");
|
||||
}
|
||||
// device mix
|
||||
for (uint32 f = 0; f < snd_core::AX_TV_CHANNEL_COUNT*snd_core::AX_MAX_NUM_BUS; f++)
|
||||
{
|
||||
sint32 busIndex = f% snd_core::AX_MAX_NUM_BUS;
|
||||
sint32 channelIndex = f / snd_core::AX_MAX_NUM_BUS;
|
||||
|
||||
//debug_printf("DeviceMix TV Voice %08x b%02d/c%02d vol %04x delta %04x\n", hCPU->gpr[3], busIndex, channelIndex, _swapEndianU16(mixArrayBE[f].vol), _swapEndianU16(mixArrayBE[f].volDelta));
|
||||
uint32 mixVol = internal->deviceMixTV[channelIndex * 4 + busIndex].vol;
|
||||
mixVol = (mixVol + 0x0FFF) >> (12);
|
||||
sprintf(tempStr + f, "%x", mixVol);
|
||||
//ax.voiceInternal[voiceIndex].deviceMixTVChannel[channelIndex].bus[busIndex].vol = _swapEndianU16(mixArrayBE[f].vol);
|
||||
}
|
||||
voiceListbox->SetItem(i, 17, tempStr);
|
||||
}
|
||||
voiceListbox->Thaw();
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::RefreshVoiceList()
|
||||
{
|
||||
RefreshVoiceList_sndgeneric();
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnVoiceListPopupClick(wxCommandEvent &evt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::OnVoiceListRightClick(wxMouseEvent& event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AudioDebuggerWindow::Close()
|
||||
{
|
||||
// this->MakeModal(false);
|
||||
refreshTimer->Stop();
|
||||
this->Destroy();
|
||||
}
|
||||
28
src/gui/wxgui/AudioDebuggerWindow.h
Normal file
28
src/gui/wxgui/AudioDebuggerWindow.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
class AudioDebuggerWindow : public wxFrame
|
||||
{
|
||||
public:
|
||||
AudioDebuggerWindow(wxFrame& parent);
|
||||
|
||||
void OnCloseButton(wxCommandEvent& event);
|
||||
void OnRefreshButton(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void RefreshVoiceList_sndgeneric();
|
||||
void RefreshVoiceList();
|
||||
void OnRefreshTimer(wxTimerEvent& event);
|
||||
void OnVoiceListPopupClick(wxCommandEvent &evt);
|
||||
void OnVoiceListRightClick(wxMouseEvent& event);
|
||||
|
||||
void Close();
|
||||
|
||||
private:
|
||||
wxListCtrl* voiceListbox;
|
||||
wxTimer* refreshTimer;
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
|
||||
};
|
||||
189
src/gui/wxgui/CMakeLists.txt
Normal file
189
src/gui/wxgui/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
add_library(CemuWxGui
|
||||
canvas/IRenderCanvas.h
|
||||
canvas/OpenGLCanvas.cpp
|
||||
canvas/OpenGLCanvas.h
|
||||
canvas/VulkanCanvas.cpp
|
||||
canvas/VulkanCanvas.h
|
||||
CemuApp.cpp
|
||||
CemuApp.h
|
||||
CemuUpdateWindow.cpp
|
||||
CemuUpdateWindow.h
|
||||
ChecksumTool.cpp
|
||||
ChecksumTool.h
|
||||
components/TextList.cpp
|
||||
components/TextList.h
|
||||
components/wxDownloadManagerList.cpp
|
||||
components/wxDownloadManagerList.h
|
||||
components/wxGameList.cpp
|
||||
components/wxGameList.h
|
||||
components/wxInputDraw.cpp
|
||||
components/wxInputDraw.h
|
||||
components/wxLogCtrl.cpp
|
||||
components/wxLogCtrl.h
|
||||
components/wxTitleManagerList.cpp
|
||||
components/wxTitleManagerList.h
|
||||
debugger/BreakpointWindow.cpp
|
||||
debugger/BreakpointWindow.h
|
||||
debugger/DebuggerWindow2.cpp
|
||||
debugger/DebuggerWindow2.h
|
||||
debugger/DisasmCtrl.cpp
|
||||
debugger/DisasmCtrl.h
|
||||
debugger/DumpCtrl.cpp
|
||||
debugger/DumpCtrl.h
|
||||
debugger/DumpWindow.cpp
|
||||
debugger/DumpWindow.h
|
||||
debugger/ModuleWindow.cpp
|
||||
debugger/ModuleWindow.h
|
||||
debugger/RegisterCtrl.cpp
|
||||
debugger/RegisterCtrl.h
|
||||
debugger/RegisterWindow.cpp
|
||||
debugger/RegisterWindow.h
|
||||
debugger/SymbolCtrl.cpp
|
||||
debugger/SymbolCtrl.h
|
||||
debugger/SymbolWindow.cpp
|
||||
debugger/SymbolWindow.h
|
||||
dialogs/CreateAccount/wxCreateAccountDialog.cpp
|
||||
dialogs/CreateAccount/wxCreateAccountDialog.h
|
||||
dialogs/SaveImport/SaveImportWindow.cpp
|
||||
dialogs/SaveImport/SaveImportWindow.h
|
||||
dialogs/SaveImport/SaveTransfer.cpp
|
||||
dialogs/SaveImport/SaveTransfer.h
|
||||
AudioDebuggerWindow.cpp
|
||||
AudioDebuggerWindow.h
|
||||
DownloadGraphicPacksWindow.cpp
|
||||
DownloadGraphicPacksWindow.h
|
||||
GameProfileWindow.cpp
|
||||
GameProfileWindow.h
|
||||
GameUpdateWindow.cpp
|
||||
GameUpdateWindow.h
|
||||
GeneralSettings2.cpp
|
||||
GeneralSettings2.h
|
||||
GettingStartedDialog.cpp
|
||||
GettingStartedDialog.h
|
||||
GraphicPacksWindow2.cpp
|
||||
GraphicPacksWindow2.h
|
||||
wxWindowSystem.cpp
|
||||
helpers/wxControlObject.h
|
||||
helpers/wxCustomData.h
|
||||
helpers/wxCustomEvents.cpp
|
||||
helpers/wxCustomEvents.h
|
||||
helpers/wxHelpers.cpp
|
||||
helpers/wxHelpers.h
|
||||
helpers/wxLogEvent.h
|
||||
helpers/wxWayland.cpp
|
||||
helpers/wxWayland.h
|
||||
input/HotkeySettings.cpp
|
||||
input/HotkeySettings.h
|
||||
input/InputAPIAddWindow.cpp
|
||||
input/InputAPIAddWindow.h
|
||||
input/InputSettings2.cpp
|
||||
input/InputSettings2.h
|
||||
input/PairingDialog.cpp
|
||||
input/PairingDialog.h
|
||||
input/panels/ClassicControllerInputPanel.cpp
|
||||
input/panels/ClassicControllerInputPanel.h
|
||||
input/panels/InputPanel.cpp
|
||||
input/panels/InputPanel.h
|
||||
input/panels/ProControllerInputPanel.cpp
|
||||
input/panels/ProControllerInputPanel.h
|
||||
input/panels/VPADInputPanel.cpp
|
||||
input/panels/VPADInputPanel.h
|
||||
input/panels/WiimoteInputPanel.cpp
|
||||
input/panels/WiimoteInputPanel.h
|
||||
input/settings/DefaultControllerSettings.cpp
|
||||
input/settings/DefaultControllerSettings.h
|
||||
input/settings/WiimoteControllerSettings.cpp
|
||||
input/settings/WiimoteControllerSettings.h
|
||||
LoggingWindow.cpp
|
||||
LoggingWindow.h
|
||||
MainWindow.cpp
|
||||
MainWindow.h
|
||||
MemorySearcherTool.cpp
|
||||
MemorySearcherTool.h
|
||||
PadViewFrame.cpp
|
||||
PadViewFrame.h
|
||||
TitleManager.cpp
|
||||
TitleManager.h
|
||||
wxCemuConfig.cpp
|
||||
wxCemuConfig.h
|
||||
EmulatedUSBDevices/EmulatedUSBDeviceFrame.cpp
|
||||
EmulatedUSBDevices/EmulatedUSBDeviceFrame.h
|
||||
windows/PPCThreadsViewer
|
||||
windows/PPCThreadsViewer/DebugPPCThreadsWindow.cpp
|
||||
windows/PPCThreadsViewer/DebugPPCThreadsWindow.h
|
||||
windows/TextureRelationViewer
|
||||
windows/TextureRelationViewer/TextureRelationWindow.cpp
|
||||
windows/TextureRelationViewer/TextureRelationWindow.h
|
||||
wxcomponents/checked2.xpm
|
||||
wxcomponents/checked_dis.xpm
|
||||
wxcomponents/checked_d.xpm
|
||||
wxcomponents/checked_ld.xpm
|
||||
wxcomponents/checkedlistctrl.cpp
|
||||
wxcomponents/checkedlistctrl.h
|
||||
wxcomponents/checked_mo.xpm
|
||||
wxcomponents/checked.xpm
|
||||
wxcomponents/checktree.cpp
|
||||
wxcomponents/checktree.h
|
||||
wxcomponents/unchecked2.xpm
|
||||
wxcomponents/unchecked_dis.xpm
|
||||
wxcomponents/unchecked_d.xpm
|
||||
wxcomponents/unchecked_ld.xpm
|
||||
wxcomponents/unchecked_mo.xpm
|
||||
wxcomponents/unchecked.xpm
|
||||
wxgui.h
|
||||
wxHelper.h
|
||||
)
|
||||
|
||||
set_property(TARGET CemuWxGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
|
||||
target_include_directories(CemuWxGui PUBLIC "../")
|
||||
# PUBLIC because rapidjson/document.h is included in ChecksumTool.h
|
||||
target_include_directories(CemuWxGui PUBLIC ${RAPIDJSON_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(CemuWxGui PRIVATE
|
||||
CemuAudio
|
||||
CemuCafe
|
||||
CemuCommon
|
||||
CemuComponents
|
||||
CemuConfig
|
||||
CemuInput
|
||||
CemuResource
|
||||
CemuUtil
|
||||
Boost::headers
|
||||
CURL::libcurl
|
||||
libzip::zip
|
||||
OpenSSL::Crypto
|
||||
pugixml::pugixml
|
||||
ZArchive::zarchive
|
||||
)
|
||||
|
||||
if(ENABLE_WXWIDGETS AND UNIX AND NOT APPLE)
|
||||
# PUBLIC because gdk/gdkkeysyms.h is included in guiWrapper.h
|
||||
target_link_libraries(CemuWxGui PUBLIC GTK3::gtk)
|
||||
if (ENABLE_WAYLAND)
|
||||
target_link_libraries(CemuWxGui PRIVATE Wayland::Client CemuWaylandProtocols)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
target_link_libraries(CemuWxGui PRIVATE cubeb::cubeb)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(ENABLE_FERAL_GAMEMODE)
|
||||
target_link_libraries(CemuWxGui PRIVATE gamemode)
|
||||
endif()
|
||||
endif()
|
||||
if (ENABLE_WXWIDGETS)
|
||||
# PUBLIC because wx/app.h is included in CemuApp.h
|
||||
target_link_libraries(CemuWxGui PUBLIC wx::base wx::core wx::gl wx::propgrid wx::xrc)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(CemuWxGui PRIVATE bthprops)
|
||||
endif()
|
||||
|
||||
if(ALLOW_PORTABLE)
|
||||
target_compile_definitions(CemuWxGui PRIVATE CEMU_ALLOW_PORTABLE)
|
||||
endif ()
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
#include "gui/CemuApp.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/wxgui.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
|
||||
#include "Cafe/HW/Latte/Core/LatteOverlay.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/LaunchSettings.h"
|
||||
#include "gui/GettingStartedDialog.h"
|
||||
#include "wxgui/GettingStartedDialog.h"
|
||||
#include "input/InputManager.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "Cemu/ncrypto/ncrypto.h"
|
||||
#include "gui/input/HotkeySettings.h"
|
||||
#include "wxgui/input/HotkeySettings.h"
|
||||
#include <wx/language.h>
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#include "wxgui/helpers/wxWayland.h"
|
||||
#endif
|
||||
#if __WXGTK__
|
||||
#include <glib.h>
|
||||
|
|
@ -30,8 +31,8 @@
|
|||
|
||||
wxIMPLEMENT_APP_NO_MAIN(CemuApp);
|
||||
|
||||
// defined in guiWrapper.cpp
|
||||
extern WindowInfo g_window_info;
|
||||
// defined in wxWindowSystem.cpp
|
||||
extern WindowSystem::WindowInfo g_window_info;
|
||||
extern std::shared_mutex g_mutex;
|
||||
|
||||
// forward declarations from main.cpp
|
||||
|
|
@ -238,7 +239,7 @@ void CemuApp::InitializeExistingMLCOrFail(fs::path mlc)
|
|||
else // reset path
|
||||
{
|
||||
GetConfig().mlc_path = "";
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -249,6 +250,11 @@ void CemuApp::InitializeExistingMLCOrFail(fs::path mlc)
|
|||
}
|
||||
}
|
||||
|
||||
std::string TranslationCallback(std::string_view msgId)
|
||||
{
|
||||
return wxGetTranslation(to_wxString(msgId)).utf8_string();
|
||||
}
|
||||
|
||||
bool CemuApp::OnInit()
|
||||
{
|
||||
#if __WXGTK__
|
||||
|
|
@ -259,22 +265,27 @@ bool CemuApp::OnInit()
|
|||
// make sure default cemu directories exist
|
||||
CreateDefaultCemuFiles();
|
||||
|
||||
g_config.SetFilename(ActiveSettings::GetConfigPath("settings.xml").generic_wstring());
|
||||
GetConfigHandle().SetFilename(ActiveSettings::GetConfigPath("settings.xml").generic_wstring());
|
||||
|
||||
auto& config = GetWxGUIConfig();
|
||||
|
||||
std::error_code ec;
|
||||
bool isFirstStart = !fs::exists(ActiveSettings::GetConfigPath("settings.xml"), ec);
|
||||
|
||||
NetworkConfig::LoadOnce();
|
||||
if(!isFirstStart)
|
||||
if (!isFirstStart)
|
||||
{
|
||||
g_config.Load();
|
||||
LocalizeUI(static_cast<wxLanguage>(GetConfig().language == wxLANGUAGE_DEFAULT ? wxLocale::GetSystemLanguage() : GetConfig().language.GetValue()));
|
||||
GetConfigHandle().Load();
|
||||
sint32 language = config.language.GetValue();
|
||||
LocalizeUI(static_cast<wxLanguage>(language == wxLANGUAGE_DEFAULT ? wxLocale::GetSystemLanguage() : language));
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizeUI(static_cast<wxLanguage>(wxLocale::GetSystemLanguage()));
|
||||
}
|
||||
|
||||
SetTranslationCallback(TranslationCallback);
|
||||
|
||||
for (auto&& path : failedWriteAccess)
|
||||
{
|
||||
wxMessageBox(formatWxString(_("Cemu can't write to {}!"), wxString::FromUTF8(_pathToUtf8(path))),
|
||||
|
|
@ -287,7 +298,7 @@ bool CemuApp::OnInit()
|
|||
GettingStartedDialog dia(nullptr);
|
||||
dia.ShowModal();
|
||||
// make sure config is created. Gfx pack UI and input UI may create it earlier already, but we still want to update it
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
// create mlc, on failure the user can quit here. So do this after the Getting Started dialog
|
||||
InitializeNewMLCOrFail(ActiveSettings::GetMlcPath());
|
||||
}
|
||||
|
|
@ -326,7 +337,6 @@ bool CemuApp::OnInit()
|
|||
|
||||
Bind(wxEVT_ACTIVATE_APP, &CemuApp::ActivateApp, this);
|
||||
|
||||
auto& config = GetConfig();
|
||||
m_mainFrame = new MainWindow();
|
||||
|
||||
std::unique_lock lock(g_mutex);
|
||||
|
|
@ -344,7 +354,7 @@ bool CemuApp::OnInit()
|
|||
|
||||
// show warning on macOS about state of builds
|
||||
#if BOOST_OS_MACOS
|
||||
if (!GetConfig().did_show_macos_disclaimer)
|
||||
if (!config.did_show_macos_disclaimer)
|
||||
{
|
||||
const auto message = _(
|
||||
"Thank you for testing the in-development build of Cemu for macOS.\n \n"
|
||||
|
|
@ -353,8 +363,8 @@ bool CemuApp::OnInit()
|
|||
wxMessageDialog dialog(nullptr, message, _("Preview version"), wxCENTRE | wxOK | wxICON_WARNING);
|
||||
dialog.SetOKLabel(_("I understand"));
|
||||
dialog.ShowModal();
|
||||
GetConfig().did_show_macos_disclaimer = true;
|
||||
g_config.Save();
|
||||
config.did_show_macos_disclaimer = true;
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
#include "gui/CemuUpdateWindow.h"
|
||||
#include "wxgui/CemuUpdateWindow.h"
|
||||
|
||||
#include "Common/version.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "Common/FileStream.h"
|
||||
#include "wxCemuConfig.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/gauge.h>
|
||||
|
|
@ -118,7 +119,7 @@ bool CemuUpdateWindow::QueryUpdateInfo(std::string& downloadUrlOut, std::string&
|
|||
#elif
|
||||
#error Name for current platform is missing
|
||||
#endif
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
if(config.receive_untested_updates)
|
||||
urlStr.append("&allowNewUpdates=1");
|
||||
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#include "gui/ChecksumTool.h"
|
||||
#include "wxgui/ChecksumTool.h"
|
||||
|
||||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "gui/wxHelper.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxgui/wxHelper.h"
|
||||
#include "Cafe/Filesystem/WUD/wud.h"
|
||||
|
||||
#include <zip.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include <wx/dialog.h>
|
||||
#include "gui/components/wxTitleManagerList.h"
|
||||
#include "wxgui/components/wxTitleManagerList.h"
|
||||
#include "Cafe/TitleList/TitleInfo.h"
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/DownloadGraphicPacksWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/DownloadGraphicPacksWindow.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <curl/curl.h>
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "config/CemuConfig.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "gui/wxHelper.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxgui/wxHelper.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
#include "Cafe/OS/libs/nsyshid/nsyshid.h"
|
||||
|
|
@ -73,7 +73,7 @@ wxPanel* EmulatedUSBDeviceFrame::AddSkylanderPage(wxNotebook* notebook)
|
|||
m_emulatePortal->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
GetConfig().emulated_usb_devices.emulate_skylander_portal =
|
||||
m_emulatePortal->IsChecked();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
});
|
||||
row->Add(m_emulatePortal, 1, wxEXPAND | wxALL, 2);
|
||||
boxSizer->Add(row, 1, wxEXPAND | wxALL, 2);
|
||||
|
|
@ -103,7 +103,7 @@ wxPanel* EmulatedUSBDeviceFrame::AddInfinityPage(wxNotebook* notebook)
|
|||
m_emulateBase->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
GetConfig().emulated_usb_devices.emulate_infinity_base =
|
||||
m_emulateBase->IsChecked();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
});
|
||||
row->Add(m_emulateBase, 1, wxEXPAND | wxALL, 2);
|
||||
boxSizer->Add(row, 1, wxEXPAND | wxALL, 2);
|
||||
|
|
@ -139,7 +139,7 @@ wxPanel* EmulatedUSBDeviceFrame::AddDimensionsPage(wxNotebook* notebook)
|
|||
m_emulateToypad->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) {
|
||||
GetConfig().emulated_usb_devices.emulate_dimensions_toypad =
|
||||
m_emulateToypad->IsChecked();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
});
|
||||
row->Add(m_emulateToypad, 1, wxEXPAND | wxALL, 2);
|
||||
box_sizer->Add(row, 1, wxEXPAND | wxALL, 2);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/GameProfileWindow.h"
|
||||
#include "wxgui/GameProfileWindow.h"
|
||||
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/sizer.h>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#include <wx/wupdlock.h>
|
||||
#include <wx/slider.h>
|
||||
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/GameUpdateWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/GameUpdateWindow.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <sstream>
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxHelper.h"
|
||||
|
||||
wxString _GetTitleIdTypeStr(TitleId titleId)
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/GeneralSettings2.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "gui/helpers/wxControlObject.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/GeneralSettings2.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "wxgui/helpers/wxControlObject.h"
|
||||
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
|
|
@ -31,7 +32,7 @@
|
|||
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
#include "wxgui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <VersionHelpers.h>
|
||||
|
|
@ -39,7 +40,7 @@
|
|||
|
||||
#include "config/LaunchSettings.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
|
||||
#include "resource/embedded/resources.h"
|
||||
|
||||
|
|
@ -959,14 +960,15 @@ void GeneralSettings2::StoreConfig()
|
|||
{
|
||||
auto* app = (CemuApp*)wxTheApp;
|
||||
auto& config = GetConfig();
|
||||
auto& wxGuiConfig = GetWxGUIConfig();
|
||||
|
||||
config.use_discord_presence = m_discord_presence->IsChecked();
|
||||
config.fullscreen_menubar = m_fullscreen_menubar->IsChecked();
|
||||
config.check_update = m_auto_update->IsChecked();
|
||||
config.save_screenshot = m_save_screenshot->IsChecked();
|
||||
config.receive_untested_updates = m_receive_untested_releases->IsChecked();
|
||||
wxGuiConfig.use_discord_presence = m_discord_presence->IsChecked();
|
||||
wxGuiConfig.fullscreen_menubar = m_fullscreen_menubar->IsChecked();
|
||||
wxGuiConfig.check_update = m_auto_update->IsChecked();
|
||||
wxGuiConfig.save_screenshot = m_save_screenshot->IsChecked();
|
||||
wxGuiConfig.receive_untested_updates = m_receive_untested_releases->IsChecked();
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
config.feral_gamemode = m_feral_gamemode->IsChecked();
|
||||
wxGuiConfig.feral_gamemode = m_feral_gamemode->IsChecked();
|
||||
#endif
|
||||
config.play_boot_sound = m_play_boot_sound->IsChecked();
|
||||
config.disable_screensaver = m_disable_screensaver->IsChecked();
|
||||
|
|
@ -978,10 +980,10 @@ void GeneralSettings2::StoreConfig()
|
|||
|
||||
|
||||
// -1 is default wx widget value -> set to dummy 0 so mainwindow and padwindow will update it
|
||||
config.window_position = m_save_window_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
config.window_size = m_save_window_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
config.pad_position = m_save_padwindow_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
config.pad_size = m_save_padwindow_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
wxGuiConfig.window_position = m_save_window_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
wxGuiConfig.window_size = m_save_window_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
wxGuiConfig.pad_position = m_save_padwindow_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
wxGuiConfig.pad_size = m_save_padwindow_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
|
||||
config.game_paths.clear();
|
||||
for (auto& path : m_game_paths->GetStrings())
|
||||
|
|
@ -989,7 +991,7 @@ void GeneralSettings2::StoreConfig()
|
|||
|
||||
auto selection = m_language->GetSelection();
|
||||
if (selection == 0)
|
||||
GetConfig().language = wxLANGUAGE_DEFAULT;
|
||||
wxGuiConfig.language = wxLANGUAGE_DEFAULT;
|
||||
else
|
||||
{
|
||||
const auto language = m_language->GetStringSelection();
|
||||
|
|
@ -997,7 +999,7 @@ void GeneralSettings2::StoreConfig()
|
|||
{
|
||||
if (lang->DescriptionNative == language)
|
||||
{
|
||||
GetConfig().language = lang->Language;
|
||||
wxGuiConfig.language = lang->Language;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1112,7 +1114,7 @@ void GeneralSettings2::StoreConfig()
|
|||
config.crash_dump = (CrashDump)m_crash_dump->GetSelection();
|
||||
config.gdb_port = m_gdb_port->GetValue();
|
||||
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
GeneralSettings2::~GeneralSettings2()
|
||||
|
|
@ -1133,9 +1135,9 @@ void GeneralSettings2::OnClose(wxCloseEvent& event)
|
|||
|
||||
void GeneralSettings2::ValidateConfig()
|
||||
{
|
||||
g_config.Load();
|
||||
GetConfigHandle().Load();
|
||||
|
||||
auto& data = g_config.data();
|
||||
auto& data = GetConfigHandle().data();
|
||||
// todo
|
||||
//data.fullscreen_scaling = min(max(data.fullscreen_scaling,))
|
||||
}
|
||||
|
|
@ -1610,6 +1612,7 @@ void GeneralSettings2::HandleGraphicsApiSelection()
|
|||
void GeneralSettings2::ApplyConfig()
|
||||
{
|
||||
ValidateConfig();
|
||||
auto& wxGUIconfig = GetWxGUIConfig();
|
||||
auto& config = GetConfig();
|
||||
|
||||
if (LaunchSettings::GetMLCPath().has_value())
|
||||
|
|
@ -1617,20 +1620,20 @@ void GeneralSettings2::ApplyConfig()
|
|||
else
|
||||
m_mlc_path->SetValue(wxHelper::FromUtf8(config.mlc_path.GetValue()));
|
||||
|
||||
m_save_window_position_size->SetValue(config.window_position != Vector2i{-1,-1});
|
||||
m_save_padwindow_position_size->SetValue(config.pad_position != Vector2i{-1,-1});
|
||||
m_save_window_position_size->SetValue(wxGUIconfig.window_position != Vector2i{-1,-1});
|
||||
m_save_padwindow_position_size->SetValue(wxGUIconfig.pad_position != Vector2i{-1,-1});
|
||||
|
||||
m_discord_presence->SetValue(config.use_discord_presence);
|
||||
m_fullscreen_menubar->SetValue(config.fullscreen_menubar);
|
||||
m_discord_presence->SetValue(wxGUIconfig.use_discord_presence);
|
||||
m_fullscreen_menubar->SetValue(wxGUIconfig.fullscreen_menubar);
|
||||
|
||||
m_auto_update->SetValue(config.check_update);
|
||||
m_receive_untested_releases->SetValue(config.receive_untested_updates);
|
||||
m_save_screenshot->SetValue(config.save_screenshot);
|
||||
m_auto_update->SetValue(wxGUIconfig.check_update);
|
||||
m_receive_untested_releases->SetValue(wxGUIconfig.receive_untested_updates);
|
||||
m_save_screenshot->SetValue(wxGUIconfig.save_screenshot);
|
||||
|
||||
m_disable_screensaver->SetValue(config.disable_screensaver);
|
||||
m_play_boot_sound->SetValue(config.play_boot_sound);
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
m_feral_gamemode->SetValue(config.feral_gamemode);
|
||||
m_feral_gamemode->SetValue(wxGUIconfig.feral_gamemode);
|
||||
#endif
|
||||
// temporary workaround because feature crashes on macOS
|
||||
#if BOOST_OS_MACOS
|
||||
|
|
@ -1646,7 +1649,7 @@ void GeneralSettings2::ApplyConfig()
|
|||
const auto app = (CemuApp*)wxTheApp;
|
||||
for (const auto& language : app->GetLanguages())
|
||||
{
|
||||
if (config.language == language->Language)
|
||||
if (wxGUIconfig.language == language->Language)
|
||||
{
|
||||
m_language->SetStringSelection(language->DescriptionNative);
|
||||
break;
|
||||
|
|
@ -2124,7 +2127,7 @@ void GeneralSettings2::OnMLCPathClear(wxCommandEvent& event)
|
|||
return;
|
||||
GetConfig().SetMLCPath("");
|
||||
StoreConfig();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
wxMessageBox(_("Cemu needs to be restarted for the changes to take effect."), _("Information"), wxOK | wxCENTRE | wxICON_INFORMATION, this);
|
||||
// close settings and then cemu
|
||||
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/GettingStartedDialog.h"
|
||||
#include "wxgui/GettingStartedDialog.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/filepicker.h>
|
||||
|
|
@ -8,10 +8,11 @@
|
|||
#include <wx/button.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "gui/DownloadGraphicPacksWindow.h"
|
||||
#include "gui/GraphicPacksWindow2.h"
|
||||
#include "gui/input/InputSettings2.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "wxgui/DownloadGraphicPacksWindow.h"
|
||||
#include "wxgui/GraphicPacksWindow2.h"
|
||||
#include "wxgui/input/InputSettings2.h"
|
||||
#include "config/CemuConfig.h"
|
||||
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
|
@ -204,7 +205,7 @@ wxPanel* GettingStartedDialog::CreatePage2()
|
|||
|
||||
void GettingStartedDialog::ApplySettings()
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
m_page2.fullscreenCheckbox->SetValue(config.fullscreen.GetValue());
|
||||
m_page2.updateCheckbox->SetValue(config.check_update.GetValue());
|
||||
m_page2.separateCheckbox->SetValue(config.pad_open.GetValue());
|
||||
|
|
@ -225,11 +226,12 @@ void GettingStartedDialog::OnClose(wxCloseEvent& event)
|
|||
{
|
||||
event.Skip();
|
||||
|
||||
auto& config = GetConfig();
|
||||
config.fullscreen = m_page2.fullscreenCheckbox->GetValue();
|
||||
config.check_update = m_page2.updateCheckbox->GetValue();
|
||||
config.pad_open = m_page2.separateCheckbox->GetValue();
|
||||
auto& wxGUIConfig = GetWxGUIConfig();
|
||||
wxGUIConfig.fullscreen = m_page2.fullscreenCheckbox->GetValue();
|
||||
wxGUIConfig.check_update = m_page2.updateCheckbox->GetValue();
|
||||
wxGUIConfig.pad_open = m_page2.separateCheckbox->GetValue();
|
||||
|
||||
auto& config = GetConfig();
|
||||
const fs::path gamePath = wxHelper::MakeFSPath(m_page1.gamePathPicker->GetPath());
|
||||
std::error_code ec;
|
||||
if (!gamePath.empty() && fs::exists(gamePath, ec))
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/GraphicPacksWindow2.h"
|
||||
#include "gui/DownloadGraphicPacksWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/GraphicPacksWindow2.h"
|
||||
#include "wxgui/DownloadGraphicPacksWindow.h"
|
||||
#include "Cafe/GraphicPack/GraphicPack2.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
|
|
@ -325,7 +325,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil
|
|||
|
||||
void GraphicPacksWindow2::SaveStateToConfig()
|
||||
{
|
||||
auto& data = g_config.data();
|
||||
auto& data = GetConfigHandle().data();
|
||||
data.graphic_pack_entries.clear();
|
||||
|
||||
for (const auto& gp : GraphicPack2::GetGraphicPacks())
|
||||
|
|
@ -348,7 +348,7 @@ void GraphicPacksWindow2::SaveStateToConfig()
|
|||
}
|
||||
}
|
||||
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
GraphicPacksWindow2::~GraphicPacksWindow2()
|
||||
|
|
@ -1,17 +1,14 @@
|
|||
#include "gui/LoggingWindow.h"
|
||||
#include "wxgui/LoggingWindow.h"
|
||||
|
||||
#include "gui/helpers/wxLogEvent.h"
|
||||
#include "Cemu/Logging/CemuLogging.h"
|
||||
#include "wxgui/helpers/wxLogEvent.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
|
||||
wxDEFINE_EVENT(EVT_LOG, wxLogEvent);
|
||||
|
||||
LoggingWindow* s_instance;
|
||||
|
||||
LoggingWindow::LoggingWindow(wxFrame* parent)
|
||||
: wxFrame(parent, wxID_ANY, _("Logging window"), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL)
|
||||
{
|
||||
|
|
@ -42,27 +39,20 @@ LoggingWindow::LoggingWindow(wxFrame* parent)
|
|||
|
||||
this->Bind(EVT_LOG, &LoggingWindow::OnLogMessage, this);
|
||||
|
||||
std::unique_lock lock(s_mutex);
|
||||
cemu_assert_debug(s_instance == nullptr);
|
||||
s_instance = this;
|
||||
cemuLog_setCallbacks(this);
|
||||
}
|
||||
|
||||
LoggingWindow::~LoggingWindow()
|
||||
{
|
||||
this->Unbind(EVT_LOG, &LoggingWindow::OnLogMessage, this);
|
||||
|
||||
std::unique_lock lock(s_mutex);
|
||||
s_instance = nullptr;
|
||||
cemuLog_clearCallbacks();
|
||||
}
|
||||
|
||||
void LoggingWindow::Log(std::string_view filter, std::string_view message)
|
||||
{
|
||||
std::shared_lock lock(s_mutex);
|
||||
if(!s_instance)
|
||||
return;
|
||||
|
||||
wxLogEvent event(std::string {filter}, std::string{ message });
|
||||
s_instance->OnLogMessage(event);
|
||||
OnLogMessage(event);
|
||||
|
||||
//const auto log_event = new wxLogEvent(filter, message);
|
||||
//wxQueueEvent(s_instance, log_event);
|
||||
|
|
@ -70,12 +60,8 @@ void LoggingWindow::Log(std::string_view filter, std::string_view message)
|
|||
|
||||
void LoggingWindow::Log(std::string_view filter, std::wstring_view message)
|
||||
{
|
||||
std::shared_lock lock(s_mutex);
|
||||
if(!s_instance)
|
||||
return;
|
||||
|
||||
wxLogEvent event(std::string {filter}, std::wstring{ message });
|
||||
s_instance->OnLogMessage(event);
|
||||
OnLogMessage(event);
|
||||
|
||||
//const auto log_event = new wxLogEvent(filter, message);
|
||||
//wxQueueEvent(s_instance, log_event);
|
||||
29
src/gui/wxgui/LoggingWindow.h
Normal file
29
src/gui/wxgui/LoggingWindow.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "Cemu/Logging/CemuLogging.h"
|
||||
|
||||
#include <wx/frame.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/combobox.h>
|
||||
#include "wxgui/components/wxLogCtrl.h"
|
||||
|
||||
class wxLogEvent;
|
||||
|
||||
class LoggingWindow : public wxFrame, public LoggingCallbacks
|
||||
{
|
||||
public:
|
||||
LoggingWindow(wxFrame* parent);
|
||||
~LoggingWindow();
|
||||
|
||||
void Log(std::string_view filter, std::string_view message) override;
|
||||
void Log(std::string_view filter, std::wstring_view message) override;
|
||||
|
||||
private:
|
||||
void OnLogMessage(wxLogEvent& event);
|
||||
void OnFilterChange(wxCommandEvent& event);
|
||||
void OnFilterMessageChange(wxCommandEvent& event);
|
||||
|
||||
wxComboBox* m_filter;
|
||||
wxLogCtrl* m_log_list;
|
||||
wxCheckBox* m_filter_message;
|
||||
};
|
||||
|
|
@ -1,46 +1,48 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
||||
#include "interface/WindowSystem.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/clipbrd.h>
|
||||
|
||||
#include "gui/GameUpdateWindow.h"
|
||||
#include "gui/PadViewFrame.h"
|
||||
#include "gui/windows/TextureRelationViewer/TextureRelationWindow.h"
|
||||
#include "gui/windows/PPCThreadsViewer/DebugPPCThreadsWindow.h"
|
||||
#include "audio/audioDebuggerWindow.h"
|
||||
#include "gui/canvas/OpenGLCanvas.h"
|
||||
#include "gui/canvas/VulkanCanvas.h"
|
||||
#include "wxgui/GameUpdateWindow.h"
|
||||
#include "wxgui/PadViewFrame.h"
|
||||
#include "wxgui/windows/TextureRelationViewer/TextureRelationWindow.h"
|
||||
#include "wxgui/windows/PPCThreadsViewer/DebugPPCThreadsWindow.h"
|
||||
#include "AudioDebuggerWindow.h"
|
||||
#include "wxgui/canvas/OpenGLCanvas.h"
|
||||
#include "wxgui/canvas/VulkanCanvas.h"
|
||||
#include "Cafe/OS/libs/nfc/nfc.h"
|
||||
#include "Cafe/OS/libs/swkbd/swkbd.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "Cemu/DiscordPresence/DiscordPresence.h"
|
||||
#include "util/ScreenSaver/ScreenSaver.h"
|
||||
#include "gui/GeneralSettings2.h"
|
||||
#include "gui/GraphicPacksWindow2.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "gui/CemuUpdateWindow.h"
|
||||
#include "gui/LoggingWindow.h"
|
||||
#include "wxgui/GeneralSettings2.h"
|
||||
#include "wxgui/GraphicPacksWindow2.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "wxgui/CemuUpdateWindow.h"
|
||||
#include "wxgui/LoggingWindow.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/LaunchSettings.h"
|
||||
|
||||
#include "Cafe/Filesystem/FST/FST.h"
|
||||
|
||||
#include "gui/TitleManager.h"
|
||||
#include "gui/EmulatedUSBDevices/EmulatedUSBDeviceFrame.h"
|
||||
#include "wxgui/TitleManager.h"
|
||||
#include "wxgui/EmulatedUSBDevices/EmulatedUSBDeviceFrame.h"
|
||||
|
||||
#include "Cafe/CafeSystem.h"
|
||||
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "gui/DownloadGraphicPacksWindow.h"
|
||||
#include "gui/GettingStartedDialog.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/DownloadGraphicPacksWindow.h"
|
||||
#include "wxgui/GettingStartedDialog.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Vulkan/VsyncDriver.h"
|
||||
#include "gui/input/InputSettings2.h"
|
||||
#include "gui/input/HotkeySettings.h"
|
||||
#include "wxgui/input/InputSettings2.h"
|
||||
#include "wxgui/input/HotkeySettings.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
|
@ -54,7 +56,7 @@
|
|||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#include "wxgui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
//GameMode support
|
||||
|
|
@ -66,7 +68,7 @@
|
|||
#include "Cafe/TitleList/TitleList.h"
|
||||
#include "wxHelper.h"
|
||||
|
||||
extern WindowInfo g_window_info;
|
||||
extern WindowSystem::WindowInfo g_window_info;
|
||||
extern std::shared_mutex g_mutex;
|
||||
|
||||
enum
|
||||
|
|
@ -273,7 +275,7 @@ public:
|
|||
std::string path = filenames[0].utf8_string();
|
||||
if (nfc::TouchTagFromFile(_utf8ToPath(path), &nfcError))
|
||||
{
|
||||
GetConfig().AddRecentNfcFile(path);
|
||||
GetWxGUIConfig().AddRecentNfcFile(path);
|
||||
m_window->UpdateNFCMenu();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -299,7 +301,7 @@ MainWindow::MainWindow()
|
|||
wxApp::s_macAboutMenuItemId = MAINFRAME_MENU_ID_HELP_ABOUT;
|
||||
wxApp::s_macPreferencesMenuItemId = MAINFRAME_MENU_ID_OPTIONS_MAC_SETTINGS;
|
||||
#endif
|
||||
gui_initHandleContextFromWxWidgetsWindow(g_window_info.window_main, this);
|
||||
g_window_info.window_main = initHandleContextFromWxWidgetsWindow(this);
|
||||
g_mainFrame = this;
|
||||
CafeSystem::SetImplementation(this);
|
||||
|
||||
|
|
@ -362,9 +364,8 @@ MainWindow::MainWindow()
|
|||
|
||||
LoadSettings();
|
||||
|
||||
auto& config = GetConfig();
|
||||
#ifdef ENABLE_DISCORD_RPC
|
||||
if (config.use_discord_presence)
|
||||
if (GetWxGUIConfig().use_discord_presence)
|
||||
m_discord = std::make_unique<DiscordPresence>();
|
||||
#endif
|
||||
|
||||
|
|
@ -373,7 +374,7 @@ MainWindow::MainWindow()
|
|||
|
||||
if (LaunchSettings::GDBStubEnabled())
|
||||
{
|
||||
g_gdbstub = std::make_unique<GDBServer>(config.gdb_port);
|
||||
g_gdbstub = std::make_unique<GDBServer>(GetConfig().gdb_port);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +438,7 @@ void MainWindow::OnClose(wxCloseEvent& event)
|
|||
if(m_game_list)
|
||||
m_game_list->OnClose(event);
|
||||
|
||||
if (!IsMaximized() && !gui_isFullScreen())
|
||||
if (!IsMaximized() && !WindowSystem::IsFullScreen())
|
||||
m_restored_size = GetSize();
|
||||
|
||||
SaveSettings();
|
||||
|
|
@ -571,9 +572,9 @@ bool MainWindow::FileLoad(const fs::path launchPath, wxLaunchGameEvent::INITIATE
|
|||
}
|
||||
|
||||
if(launchTitle.IsValid())
|
||||
GetConfig().AddRecentlyLaunchedFile(_pathToUtf8(launchTitle.GetPath()));
|
||||
GetWxGUIConfig().AddRecentlyLaunchedFile(_pathToUtf8(launchTitle.GetPath()));
|
||||
else
|
||||
GetConfig().AddRecentlyLaunchedFile(_pathToUtf8(launchPath));
|
||||
GetWxGUIConfig().AddRecentlyLaunchedFile(_pathToUtf8(launchPath));
|
||||
|
||||
wxWindowUpdateLocker lock(this);
|
||||
|
||||
|
|
@ -598,12 +599,12 @@ bool MainWindow::FileLoad(const fs::path launchPath, wxLaunchGameEvent::INITIATE
|
|||
// ScreenSaver::SetInhibit(false);
|
||||
}
|
||||
|
||||
if (ActiveSettings::FullscreenEnabled())
|
||||
if (FullscreenEnabled())
|
||||
SetFullScreen(true);
|
||||
|
||||
//GameMode support
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
if(GetConfig().feral_gamemode)
|
||||
if(GetWxGUIConfig().feral_gamemode)
|
||||
{
|
||||
// attempt to start gamemode
|
||||
if(gamemode_request_start() < 0)
|
||||
|
|
@ -665,7 +666,7 @@ void MainWindow::OnFileMenu(wxCommandEvent& event)
|
|||
}
|
||||
else if (menuId >= MAINFRAME_MENU_ID_FILE_RECENT_0 && menuId <= MAINFRAME_MENU_ID_FILE_RECENT_LAST)
|
||||
{
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
const size_t index = menuId - MAINFRAME_MENU_ID_FILE_RECENT_0;
|
||||
if (index < config.recent_launch_files.size())
|
||||
{
|
||||
|
|
@ -759,14 +760,14 @@ void MainWindow::OnNFCMenu(wxCommandEvent& event)
|
|||
}
|
||||
else
|
||||
{
|
||||
GetConfig().AddRecentNfcFile(wxStrFilePath.utf8_string());
|
||||
GetWxGUIConfig().AddRecentNfcFile(wxStrFilePath.utf8_string());
|
||||
UpdateNFCMenu();
|
||||
}
|
||||
}
|
||||
else if (event.GetId() >= MAINFRAME_MENU_ID_NFC_RECENT_0 && event.GetId() <= MAINFRAME_MENU_ID_NFC_RECENT_LAST)
|
||||
{
|
||||
const size_t index = event.GetId() - MAINFRAME_MENU_ID_NFC_RECENT_0;
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
if (index < config.recent_nfc_files.size())
|
||||
{
|
||||
const auto& path = config.recent_nfc_files[index];
|
||||
|
|
@ -799,7 +800,7 @@ void MainWindow::OnFileExit(wxCommandEvent& event)
|
|||
|
||||
void MainWindow::TogglePadView()
|
||||
{
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
if (config.pad_open)
|
||||
{
|
||||
if (m_padView)
|
||||
|
|
@ -848,7 +849,7 @@ WXLRESULT MainWindow::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
|
|||
|
||||
void MainWindow::OpenSettings()
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
const auto language = config.language;
|
||||
|
||||
GeneralSettings2 frame(this, m_game_launched);
|
||||
|
|
@ -900,8 +901,8 @@ void MainWindow::OnOptionsInput(wxCommandEvent& event)
|
|||
}
|
||||
case MAINFRAME_MENU_ID_OPTIONS_SECOND_WINDOW_PADVIEW:
|
||||
{
|
||||
GetConfig().pad_open = !GetConfig().pad_open;
|
||||
g_config.Save();
|
||||
GetWxGUIConfig().pad_open = !GetWxGUIConfig().pad_open;
|
||||
g_wxConfig.Save();
|
||||
|
||||
TogglePadView();
|
||||
break;
|
||||
|
|
@ -953,7 +954,7 @@ void MainWindow::OnAccountSelect(wxCommandEvent& event)
|
|||
auto& config = GetConfig();
|
||||
config.account.m_persistent_id = accounts[index].GetPersistentId();
|
||||
// config.account.online_enabled.value = false; // reset online for safety
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
void MainWindow::OnConsoleLanguage(wxCommandEvent& event)
|
||||
|
|
@ -1004,7 +1005,7 @@ void MainWindow::OnConsoleLanguage(wxCommandEvent& event)
|
|||
m_game_list->DeleteCachedStrings();
|
||||
m_game_list->ReloadGameEntries(false);
|
||||
}
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
//void MainWindow::OnCPUMode(wxCommandEvent& event)
|
||||
|
|
@ -1020,7 +1021,7 @@ void MainWindow::OnConsoleLanguage(wxCommandEvent& event)
|
|||
// else
|
||||
// cemu_assert_debug(false);
|
||||
//
|
||||
// g_config.Save();
|
||||
// GetConfigHandle().Save();
|
||||
//}
|
||||
|
||||
void MainWindow::OnDebugSetting(wxCommandEvent& event)
|
||||
|
|
@ -1084,7 +1085,7 @@ void MainWindow::OnDebugSetting(wxCommandEvent& event)
|
|||
else
|
||||
cemu_assert_debug(false);
|
||||
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
void MainWindow::OnDebugLoggingToggleFlagGeneric(wxCommandEvent& event)
|
||||
|
|
@ -1101,14 +1102,14 @@ void MainWindow::OnDebugLoggingToggleFlagGeneric(wxCommandEvent& event)
|
|||
else
|
||||
GetConfig().log_flag = GetConfig().log_flag.GetValue() & ~cemuLog_getFlag(loggingType);
|
||||
cemuLog_setActiveLoggingFlags(GetConfig().log_flag.GetValue());
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnPPCInfoToggle(wxCommandEvent& event)
|
||||
{
|
||||
GetConfig().advanced_ppc_logging = !GetConfig().advanced_ppc_logging.GetValue();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
void MainWindow::OnDebugDumpGeneric(wxCommandEvent& event)
|
||||
|
|
@ -1289,8 +1290,8 @@ wxRect MainWindow::GetDesktopRect()
|
|||
|
||||
void MainWindow::LoadSettings()
|
||||
{
|
||||
g_config.Load();
|
||||
const auto& config = GetConfig();
|
||||
GetConfigHandle().Load();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
|
||||
if(config.check_update)
|
||||
m_update_available = CemuUpdateWindow::IsUpdateAvailableAsync();
|
||||
|
|
@ -1328,8 +1329,8 @@ void MainWindow::LoadSettings()
|
|||
|
||||
void MainWindow::SaveSettings()
|
||||
{
|
||||
auto lock = g_config.Lock();
|
||||
auto& config = GetConfig();
|
||||
auto lock = GetConfigHandle().Lock();
|
||||
auto& config = GetWxGUIConfig();
|
||||
|
||||
if (config.window_position != Vector2i{ -1,-1 })
|
||||
{
|
||||
|
|
@ -1368,7 +1369,7 @@ void MainWindow::SaveSettings()
|
|||
if(m_game_list)
|
||||
m_game_list->SaveConfig();
|
||||
|
||||
g_config.Save();
|
||||
g_wxConfig.Save();
|
||||
}
|
||||
|
||||
void MainWindow::OnMouseMove(wxMouseEvent& event)
|
||||
|
|
@ -1388,7 +1389,7 @@ void MainWindow::OnMouseMove(wxMouseEvent& event)
|
|||
if (!IsFullScreen())
|
||||
return;
|
||||
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
// if mouse goes to upper screen then show our menu in fullscreen mode
|
||||
if (config.fullscreen_menubar)
|
||||
SetMenuVisible(event.GetPosition().y < 50);
|
||||
|
|
@ -1640,7 +1641,7 @@ void MainWindow::DestroyCanvas()
|
|||
|
||||
void MainWindow::OnSizeEvent(wxSizeEvent& event)
|
||||
{
|
||||
if (!IsMaximized() && !gui_isFullScreen())
|
||||
if (!IsMaximized() && !WindowSystem::IsFullScreen())
|
||||
m_restored_size = GetSize();
|
||||
|
||||
const wxSize client_size = GetClientSize();
|
||||
|
|
@ -1671,7 +1672,7 @@ void MainWindow::OnDPIChangedEvent(wxDPIChangedEvent& event)
|
|||
|
||||
void MainWindow::OnMove(wxMoveEvent& event)
|
||||
{
|
||||
if (!IsMaximized() && !gui_isFullScreen())
|
||||
if (!IsMaximized() && !WindowSystem::IsFullScreen())
|
||||
m_restored_position = GetPosition();
|
||||
|
||||
if (m_debugger_window && m_debugger_window->IsShown())
|
||||
|
|
@ -1687,7 +1688,7 @@ void MainWindow::OnDebuggerClose(wxCloseEvent& event)
|
|||
|
||||
void MainWindow::OnPadClose(wxCloseEvent& event)
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
config.pad_open = false;
|
||||
if (config.pad_position != Vector2i{ -1,-1 })
|
||||
m_padView->GetPosition(&config.pad_position.x, &config.pad_position.y);
|
||||
|
|
@ -1695,7 +1696,7 @@ void MainWindow::OnPadClose(wxCloseEvent& event)
|
|||
if (config.pad_size != Vector2i{ -1,-1 })
|
||||
m_padView->GetSize(&config.pad_size.x, &config.pad_size.y);
|
||||
|
||||
g_config.Save();
|
||||
g_wxConfig.Save();
|
||||
|
||||
// already deleted by wxwidget
|
||||
m_padView = nullptr;
|
||||
|
|
@ -1726,8 +1727,8 @@ void MainWindow::SetFullScreen(bool state)
|
|||
// only update config entry if we dont't have launch parameters
|
||||
if (!LaunchSettings::FullscreenEnabled().has_value())
|
||||
{
|
||||
GetConfig().fullscreen = state;
|
||||
g_config.Save();
|
||||
GetWxGUIConfig().fullscreen = state;
|
||||
g_wxConfig.Save();
|
||||
}
|
||||
if (state && !m_game_launched)
|
||||
return;
|
||||
|
|
@ -1759,14 +1760,14 @@ void MainWindow::UpdateNFCMenu()
|
|||
m_nfcMenuSeparator0 = nullptr;
|
||||
}
|
||||
// remove recent files list
|
||||
for (sint32 i = 0; i < CemuConfig::kMaxRecentEntries; i++)
|
||||
for (sint32 i = 0; i < wxCemuConfig::kMaxRecentEntries; i++)
|
||||
{
|
||||
if (m_nfcMenu->FindChildItem(MAINFRAME_MENU_ID_NFC_RECENT_0 + i) == nullptr)
|
||||
continue;
|
||||
m_nfcMenu->Remove(MAINFRAME_MENU_ID_NFC_RECENT_0 + i);
|
||||
}
|
||||
// add entries
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
sint32 recentFileIndex = 0;
|
||||
for (size_t i = 0; i < config.recent_nfc_files.size(); i++)
|
||||
{
|
||||
|
|
@ -2097,7 +2098,7 @@ void MainWindow::RecreateMenu()
|
|||
m_menuBar = nullptr;
|
||||
}
|
||||
|
||||
auto& config = GetConfig();
|
||||
auto& guiConfig = GetWxGUIConfig();
|
||||
|
||||
m_menuBar = new wxMenuBar();
|
||||
// file submenu
|
||||
|
|
@ -2111,9 +2112,9 @@ void MainWindow::RecreateMenu()
|
|||
sint32 recentFileIndex = 0;
|
||||
m_fileMenuSeparator0 = nullptr;
|
||||
m_fileMenuSeparator1 = nullptr;
|
||||
for (size_t i = 0; i < config.recent_launch_files.size(); i++)
|
||||
for (size_t i = 0; i < guiConfig.recent_launch_files.size(); i++)
|
||||
{
|
||||
const std::string& pathStr = config.recent_launch_files[i];
|
||||
const std::string& pathStr = guiConfig.recent_launch_files[i];
|
||||
if (pathStr.empty())
|
||||
continue;
|
||||
if (recentFileIndex == 0)
|
||||
|
|
@ -2155,6 +2156,8 @@ void MainWindow::RecreateMenu()
|
|||
++index;
|
||||
}
|
||||
|
||||
auto& config = GetConfig();
|
||||
auto& wxConfig = GetWxGUIConfig();
|
||||
// options->console language submenu
|
||||
wxMenu* optionsConsoleLanguageMenu = new wxMenu();
|
||||
optionsConsoleLanguageMenu->AppendRadioItem(MAINFRAME_MENU_ID_OPTIONS_LANGUAGE_ENGLISH, _("&English"), wxEmptyString)->Check(config.console_language == CafeConsoleLanguage::EN);
|
||||
|
|
@ -2181,11 +2184,11 @@ void MainWindow::RecreateMenu()
|
|||
// options submenu
|
||||
wxMenu* optionsMenu = new wxMenu();
|
||||
m_fullscreenMenuItem = optionsMenu->AppendCheckItem(MAINFRAME_MENU_ID_OPTIONS_FULLSCREEN, _("&Fullscreen"), wxEmptyString);
|
||||
m_fullscreenMenuItem->Check(ActiveSettings::FullscreenEnabled());
|
||||
m_fullscreenMenuItem->Check(FullscreenEnabled());
|
||||
|
||||
optionsMenu->Append(MAINFRAME_MENU_ID_OPTIONS_GRAPHIC_PACKS2, _("&Graphic packs"));
|
||||
m_padViewMenuItem = optionsMenu->AppendCheckItem(MAINFRAME_MENU_ID_OPTIONS_SECOND_WINDOW_PADVIEW, _("&Separate GamePad view"), wxEmptyString);
|
||||
m_padViewMenuItem->Check(GetConfig().pad_open);
|
||||
m_padViewMenuItem->Check(wxConfig.pad_open);
|
||||
optionsMenu->AppendSeparator();
|
||||
#if BOOST_OS_MACOS
|
||||
optionsMenu->Append(MAINFRAME_MENU_ID_OPTIONS_MAC_SETTINGS, _("&Settings..." "\tCtrl-,"));
|
||||
|
|
@ -2408,3 +2411,8 @@ void MainWindow::CafeRecreateCanvas()
|
|||
wxQueueEvent(g_mainFrame, evt);
|
||||
sem.decrementWithWait();
|
||||
}
|
||||
|
||||
bool MainWindow::FullscreenEnabled() const
|
||||
{
|
||||
return LaunchSettings::FullscreenEnabled().value_or(GetWxGUIConfig().fullscreen);
|
||||
}
|
||||
|
|
@ -5,13 +5,13 @@
|
|||
#include <wx/infobar.h>
|
||||
#include "wxcomponents/checkedlistctrl.h"
|
||||
|
||||
#include "gui/PadViewFrame.h"
|
||||
#include "gui/MemorySearcherTool.h"
|
||||
#include "wxgui/PadViewFrame.h"
|
||||
#include "wxgui/MemorySearcherTool.h"
|
||||
|
||||
#include "config/XMLConfig.h"
|
||||
|
||||
#include "gui/LoggingWindow.h"
|
||||
#include "gui/components/wxGameList.h"
|
||||
#include "wxgui/LoggingWindow.h"
|
||||
#include "wxgui/components/wxGameList.h"
|
||||
|
||||
#include <future>
|
||||
#include "Cafe/HW/Espresso/Debugger/GDBStub.h"
|
||||
|
|
@ -145,6 +145,7 @@ public:
|
|||
static void RequestLaunchGame(fs::path filePath, wxLaunchGameEvent::INITIATED_BY initiatedBy);
|
||||
|
||||
private:
|
||||
bool FullscreenEnabled() const;
|
||||
void RecreateMenu();
|
||||
void UpdateChildWindowTitleRunningState();
|
||||
static wxString GetInitialWindowTitle();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
|
||||
#include "gui/MemorySearcherTool.h"
|
||||
#include "wxgui/MemorySearcherTool.h"
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#include <wx/listctrl.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "Common/FileStream.h"
|
||||
#include "util/IniParser/IniParser.h"
|
||||
#include "util/helpers/StringHelpers.h"
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "Cafe/HW/MMU/MMU.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
|
||||
enum SearchDataType
|
||||
{
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "gui/PadViewFrame.h"
|
||||
#include "interface/WindowSystem.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/PadViewFrame.h"
|
||||
|
||||
#include <wx/display.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "Cafe/OS/libs/swkbd/swkbd.h"
|
||||
#include "gui/canvas/OpenGLCanvas.h"
|
||||
#include "gui/canvas/VulkanCanvas.h"
|
||||
#include "wxgui/canvas/OpenGLCanvas.h"
|
||||
#include "wxgui/canvas/VulkanCanvas.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#endif
|
||||
#include "wxHelper.h"
|
||||
|
||||
extern WindowInfo g_window_info;
|
||||
extern WindowSystem::WindowInfo g_window_info;
|
||||
|
||||
#define PAD_MIN_WIDTH 320
|
||||
#define PAD_MIN_HEIGHT 180
|
||||
|
|
@ -26,7 +26,7 @@ extern WindowInfo g_window_info;
|
|||
PadViewFrame::PadViewFrame(wxFrame* parent)
|
||||
: wxFrame(nullptr, wxID_ANY, _("GamePad View"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxCLOSE_BOX | wxWANTS_CHARS)
|
||||
{
|
||||
gui_initHandleContextFromWxWidgetsWindow(g_window_info.window_pad, this);
|
||||
g_window_info.window_pad = initHandleContextFromWxWidgetsWindow(this);
|
||||
|
||||
SetIcon(wxICON(M_WND_ICON128));
|
||||
wxWindow::EnableTouchEvents(wxTOUCH_PAN_GESTURES);
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
#include "gui/TitleManager.h"
|
||||
#include "wxgui/TitleManager.h"
|
||||
|
||||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "gui/wxHelper.h"
|
||||
#include "gui/components/wxTitleManagerList.h"
|
||||
#include "gui/components/wxDownloadManagerList.h"
|
||||
#include "gui/GameUpdateWindow.h"
|
||||
#include "gui/dialogs/SaveImport/SaveTransfer.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxgui/wxHelper.h"
|
||||
#include "wxgui/components/wxTitleManagerList.h"
|
||||
#include "wxgui/components/wxDownloadManagerList.h"
|
||||
#include "wxgui/GameUpdateWindow.h"
|
||||
#include "wxgui/dialogs/SaveImport/SaveTransfer.h"
|
||||
|
||||
#include <wx/listbase.h>
|
||||
#include <wx/sizer.h>
|
||||
|
|
@ -33,10 +33,10 @@
|
|||
|
||||
#include "Cafe/IOSU/legacy/iosu_crypto.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/dialogs/SaveImport/SaveImportWindow.h"
|
||||
#include "wxgui/dialogs/SaveImport/SaveImportWindow.h"
|
||||
#include "Cafe/Account/Account.h"
|
||||
#include "Cemu/Tools/DownloadManager/DownloadManager.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
#include "Cafe/TitleList/SaveList.h"
|
||||
#include "resource/embedded/resources.h"
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
#include "gui/canvas/OpenGLCanvas.h"
|
||||
#include "wxgui/canvas/OpenGLCanvas.h"
|
||||
|
||||
#include "wxgui/canvas/IRenderCanvas.h"
|
||||
|
||||
#include "Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.h"
|
||||
|
||||
#include "config/CemuConfig.h"
|
||||
|
|
@ -26,9 +29,59 @@ static const int g_gl_attribute_list[] =
|
|||
0, // end of list
|
||||
};
|
||||
|
||||
wxGLContext* sGLContext = nullptr;
|
||||
class OpenGLCanvas* sGLTVView = nullptr;
|
||||
class OpenGLCanvas* sGLPadView = nullptr;
|
||||
class OpenGLCanvas;
|
||||
|
||||
class GLCanvasManager : public OpenGLCanvasCallbacks
|
||||
{
|
||||
public:
|
||||
GLCanvasManager()
|
||||
{
|
||||
SetOpenGLCanvasCallbacks(this);
|
||||
}
|
||||
|
||||
~GLCanvasManager()
|
||||
{
|
||||
ClearOpenGLCanvasCallbacks();
|
||||
}
|
||||
|
||||
void SetTVView(OpenGLCanvas* canvas)
|
||||
{
|
||||
m_tvView = canvas;
|
||||
}
|
||||
|
||||
void SetPadView(OpenGLCanvas* canvas)
|
||||
{
|
||||
m_padView = canvas;
|
||||
}
|
||||
|
||||
void SetGLContext(wxGLContext* context)
|
||||
{
|
||||
m_glContext = context;
|
||||
}
|
||||
|
||||
void DeleteGLContext()
|
||||
{
|
||||
if (m_tvView == nullptr && m_padView == nullptr && m_glContext)
|
||||
{
|
||||
delete m_glContext;
|
||||
m_glContext = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool HasPadViewOpen() const
|
||||
{
|
||||
return m_padView != nullptr;
|
||||
}
|
||||
|
||||
bool MakeCurrent(bool padView);
|
||||
|
||||
void SwapBuffers(bool swapTV, bool swapDRC);
|
||||
|
||||
private:
|
||||
wxGLContext* m_glContext = nullptr;
|
||||
OpenGLCanvas* m_tvView = nullptr;
|
||||
OpenGLCanvas* m_padView = nullptr;
|
||||
} s_glCanvasManager;
|
||||
|
||||
class OpenGLCanvas : public IRenderCanvas, public wxGLCanvas
|
||||
{
|
||||
|
|
@ -38,13 +91,15 @@ public:
|
|||
{
|
||||
if (m_is_main_window)
|
||||
{
|
||||
sGLTVView = this;
|
||||
sGLContext = new wxGLContext(this);
|
||||
s_glCanvasManager.SetTVView(this);
|
||||
s_glCanvasManager.SetGLContext(new wxGLContext(this));
|
||||
|
||||
g_renderer = std::make_unique<OpenGLRenderer>();
|
||||
}
|
||||
else
|
||||
sGLPadView = this;
|
||||
{
|
||||
s_glCanvasManager.SetPadView(this);
|
||||
}
|
||||
|
||||
wxWindow::EnableTouchEvents(wxTOUCH_PAN_GESTURES);
|
||||
}
|
||||
|
|
@ -54,12 +109,11 @@ public:
|
|||
// todo - if this is the main window, make sure the renderer has been shut down
|
||||
|
||||
if (m_is_main_window)
|
||||
sGLTVView = nullptr;
|
||||
s_glCanvasManager.SetTVView(nullptr);
|
||||
else
|
||||
sGLPadView = nullptr;
|
||||
s_glCanvasManager.SetPadView(nullptr);
|
||||
|
||||
if (sGLTVView == nullptr && sGLPadView == nullptr && sGLContext)
|
||||
delete sGLContext;
|
||||
s_glCanvasManager.DeleteGLContext();
|
||||
}
|
||||
|
||||
void UpdateVSyncState()
|
||||
|
|
@ -95,34 +149,30 @@ wxWindow* GLCanvas_Create(wxWindow* parent, const wxSize& size, bool is_main_win
|
|||
return new OpenGLCanvas(parent, size, is_main_window);
|
||||
}
|
||||
|
||||
bool GLCanvas_HasPadViewOpen()
|
||||
void GLCanvasManager::SwapBuffers(bool swapTV, bool swapDRC)
|
||||
{
|
||||
return sGLPadView != nullptr;
|
||||
if (swapTV && m_tvView)
|
||||
{
|
||||
MakeCurrent(false);
|
||||
m_tvView->SwapBuffers();
|
||||
m_tvView->UpdateVSyncState();
|
||||
}
|
||||
|
||||
if (swapDRC && m_padView)
|
||||
{
|
||||
MakeCurrent(true);
|
||||
m_padView->SwapBuffers();
|
||||
m_padView->UpdateVSyncState();
|
||||
}
|
||||
|
||||
MakeCurrent(false);
|
||||
}
|
||||
|
||||
bool GLCanvas_MakeCurrent(bool padView)
|
||||
bool GLCanvasManager::MakeCurrent(bool padView)
|
||||
{
|
||||
OpenGLCanvas* canvas = padView ? sGLPadView : sGLTVView;
|
||||
OpenGLCanvas* canvas = padView ? m_padView : m_tvView;
|
||||
if (!canvas)
|
||||
return false;
|
||||
sGLContext->SetCurrent(*canvas);
|
||||
m_glContext->SetCurrent(*canvas);
|
||||
return true;
|
||||
}
|
||||
|
||||
void GLCanvas_SwapBuffers(bool swapTV, bool swapDRC)
|
||||
{
|
||||
if (swapTV && sGLTVView)
|
||||
{
|
||||
GLCanvas_MakeCurrent(false);
|
||||
sGLTVView->SwapBuffers();
|
||||
sGLTVView->UpdateVSyncState();
|
||||
}
|
||||
if (swapDRC && sGLPadView)
|
||||
{
|
||||
GLCanvas_MakeCurrent(true);
|
||||
sGLPadView->SwapBuffers();
|
||||
sGLPadView->UpdateVSyncState();
|
||||
}
|
||||
|
||||
GLCanvas_MakeCurrent(false);
|
||||
}
|
||||
}
|
||||
4
src/gui/wxgui/canvas/OpenGLCanvas.h
Normal file
4
src/gui/wxgui/canvas/OpenGLCanvas.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <wx/window.h>
|
||||
|
||||
wxWindow* GLCanvas_Create(wxWindow* parent, const wxSize& size, bool is_main_window);
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
#include "gui/canvas/VulkanCanvas.h"
|
||||
#include "wxgui/canvas/VulkanCanvas.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#include "wxgui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
|
@ -15,10 +14,10 @@ VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_wi
|
|||
Bind(wxEVT_PAINT, &VulkanCanvas::OnPaint, this);
|
||||
Bind(wxEVT_SIZE, &VulkanCanvas::OnResize, this);
|
||||
|
||||
WindowHandleInfo& canvas = is_main_window ? gui_getWindowInfo().canvas_main : gui_getWindowInfo().canvas_pad;
|
||||
gui_initHandleContextFromWxWidgetsWindow(canvas, this);
|
||||
auto& canvas = is_main_window ? WindowSystem::GetWindowInfo().canvas_main : WindowSystem::GetWindowInfo().canvas_pad;
|
||||
canvas = initHandleContextFromWxWidgetsWindow(this);
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if (canvas.backend == WindowHandleInfo::Backend::WAYLAND)
|
||||
if (canvas.backend == WindowSystem::WindowHandleInfo::Backend::Wayland)
|
||||
{
|
||||
m_subsurface = std::make_unique<wxWlSubsurface>(this);
|
||||
canvas.surface = m_subsurface->getSurface();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/canvas/IRenderCanvas.h"
|
||||
#include "wxgui/canvas/IRenderCanvas.h"
|
||||
|
||||
#include <wx/frame.h>
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "TextList.h"
|
||||
#include <wx/setup.h>
|
||||
#include <wx/tooltip.h>
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#include "gui/components/wxDownloadManagerList.h"
|
||||
#include "wxgui/components/wxDownloadManagerList.h"
|
||||
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "gui/components/wxGameList.h"
|
||||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/components/wxGameList.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
|
@ -18,10 +18,10 @@
|
|||
#include <functional>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/ChecksumTool.h"
|
||||
#include "wxgui/ChecksumTool.h"
|
||||
#include "Cemu/Tools/DownloadManager/DownloadManager.h"
|
||||
#include "Cafe/TitleList/TitleId.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
|
||||
wxDEFINE_EVENT(wxEVT_REMOVE_ENTRY, wxCommandEvent);
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "config/CemuConfig.h"
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
#include "gui/components/wxGameList.h"
|
||||
#include "wxgui/components/wxGameList.h"
|
||||
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/GameProfileWindow.h"
|
||||
#include "wxgui/GameProfileWindow.h"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
|
|
@ -28,9 +29,9 @@
|
|||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
||||
#include "gui/CemuApp.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "wxgui/CemuApp.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
|
||||
#include "../wxHelper.h"
|
||||
|
||||
|
|
@ -137,7 +138,7 @@ bool writeICNS(const fs::path& pngPath, const fs::path& icnsPath) {
|
|||
wxGameList::wxGameList(wxWindow* parent, wxWindowID id)
|
||||
: wxListView(parent, id, wxDefaultPosition, wxDefaultSize, GetStyleFlags(Style::kList)), m_style(Style::kList)
|
||||
{
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
|
||||
InsertColumn(ColumnHiddenName, "", wxLIST_FORMAT_LEFT, 0);
|
||||
if(config.show_icon_column)
|
||||
|
|
@ -221,7 +222,7 @@ wxGameList::~wxGameList()
|
|||
|
||||
void wxGameList::LoadConfig()
|
||||
{
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
SetStyle((Style)config.game_list_style, false);
|
||||
|
||||
if (!config.game_list_column_order.empty())
|
||||
|
|
@ -327,7 +328,7 @@ int wxGameList::GetColumnDefaultWidth(int column)
|
|||
|
||||
void wxGameList::SaveConfig(bool flush)
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
|
||||
config.game_list_style = (int)m_style;
|
||||
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
|
||||
|
|
@ -335,7 +336,7 @@ void wxGameList::SaveConfig(bool flush)
|
|||
#endif
|
||||
|
||||
if (flush)
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
bool wxGameList::IsVisible(long item) const
|
||||
|
|
@ -426,8 +427,8 @@ void wxGameList::SetStyle(Style style, bool save)
|
|||
|
||||
if(save)
|
||||
{
|
||||
GetConfig().game_list_style = (int)m_style;
|
||||
g_config.Save();
|
||||
GetWxGUIConfig().game_list_style = (int)m_style;
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
|
||||
if (style == Style::kList)
|
||||
|
|
@ -726,7 +727,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||
const auto custom_name = dialog.GetValue();
|
||||
GetConfig().SetGameListCustomName(title_id, custom_name.utf8_string());
|
||||
m_name_cache.clear();
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
// update list entry
|
||||
for (int i = 0; i < GetItemCount(); ++i)
|
||||
{
|
||||
|
|
@ -906,7 +907,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
|
|||
|
||||
const auto menu = dynamic_cast<wxMenu*>(event.GetEventObject());
|
||||
const int column = dynamic_cast<wxCustomData<int>*>(menu->GetClientObject())->GetData();
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
|
|
@ -980,7 +981,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
ApplyGameListColumnWidths();
|
||||
});
|
||||
|
||||
|
|
@ -990,7 +991,7 @@ void wxGameList::OnColumnRightClick(wxListEvent& event)
|
|||
|
||||
void wxGameList::ApplyGameListColumnWidths()
|
||||
{
|
||||
const auto& config = GetConfig();
|
||||
const auto& config = GetWxGUIConfig();
|
||||
wxWindowUpdateLocker lock(this);
|
||||
if(config.show_icon_column)
|
||||
SetColumnWidth(ColumnIcon, kListIconWidth);
|
||||
|
|
@ -1044,7 +1045,7 @@ void wxGameList::OnColumnResize(wxListEvent& event)
|
|||
const int column = event.GetColumn();
|
||||
const int width = GetColumnWidth(column);
|
||||
|
||||
auto& config = GetConfig();
|
||||
auto& config = GetWxGUIConfig();
|
||||
switch (column)
|
||||
{
|
||||
case ColumnName:
|
||||
|
|
@ -1069,7 +1070,7 @@ void wxGameList::OnColumnResize(wxListEvent& event)
|
|||
break;
|
||||
}
|
||||
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
AdjustLastColumnWidth();
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/components/wxInputDraw.h"
|
||||
#include "wxgui/components/wxInputDraw.h"
|
||||
|
||||
#include <wx/dcbuffer.h>
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/components/wxLogCtrl.h"
|
||||
#include "wxgui/components/wxLogCtrl.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#include "gui/components/wxTitleManagerList.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/components/wxTitleManagerList.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "Cafe/TitleList/GameInfo.h"
|
||||
#include "Cafe/TitleList/TitleInfo.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
#include "gui/components/wxGameList.h"
|
||||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/components/wxGameList.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
#include <functional>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/ChecksumTool.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "wxgui/ChecksumTool.h"
|
||||
#include "wxgui/MainWindow.h"
|
||||
#include "Cafe/TitleList/TitleId.h"
|
||||
#include "Cafe/TitleList/SaveList.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "config/CemuConfig.h"
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/BreakpointWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/BreakpointWindow.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
|
||||
#include "Cemu/ExpressionParser/ExpressionParser.h"
|
||||
|
|
@ -180,7 +179,7 @@ void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
|
|||
const auto item = m_breakpoints->GetItemText(index, ColumnAddress);
|
||||
const auto address = std::stoul(item.ToStdString(), nullptr, 16);
|
||||
debuggerState.debugSession.instructionPointer = address;
|
||||
debuggerWindow_moveIP();
|
||||
g_debuggerDispatcher.MoveIP();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "gui/wxcomponents/checkedlistctrl.h"
|
||||
#include "wxgui/wxcomponents/checkedlistctrl.h"
|
||||
|
||||
class DebuggerWindow2;
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
|
|
@ -7,16 +7,16 @@
|
|||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "Cafe/OS/RPL/rpl_debug_symbols.h"
|
||||
|
||||
#include "gui/debugger/RegisterWindow.h"
|
||||
#include "gui/debugger/DumpWindow.h"
|
||||
#include "wxgui/debugger/RegisterWindow.h"
|
||||
#include "wxgui/debugger/DumpWindow.h"
|
||||
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
#include "gui/debugger/DisasmCtrl.h"
|
||||
#include "gui/debugger/SymbolWindow.h"
|
||||
#include "gui/debugger/BreakpointWindow.h"
|
||||
#include "gui/debugger/ModuleWindow.h"
|
||||
#include "wxgui/debugger/DisasmCtrl.h"
|
||||
#include "wxgui/debugger/SymbolWindow.h"
|
||||
#include "wxgui/debugger/BreakpointWindow.h"
|
||||
#include "wxgui/debugger/ModuleWindow.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
#include "resource/embedded/resources.h"
|
||||
|
|
@ -270,6 +270,8 @@ DebuggerWindow2::DebuggerWindow2(wxFrame& parent, const wxRect& display_size)
|
|||
: wxFrame(&parent, wxID_ANY, _("PPC Debugger"), wxDefaultPosition, wxSize(1280, 300), wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT),
|
||||
m_module_address(0)
|
||||
{
|
||||
g_debuggerDispatcher.SetDebuggerCallbacks(this);
|
||||
|
||||
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
|
||||
|
||||
const auto file = ActiveSettings::GetConfigPath("debugger/config.xml");
|
||||
|
|
@ -335,6 +337,8 @@ DebuggerWindow2::DebuggerWindow2(wxFrame& parent, const wxRect& display_size)
|
|||
|
||||
DebuggerWindow2::~DebuggerWindow2()
|
||||
{
|
||||
g_debuggerDispatcher.ClearDebuggerCallbacks();
|
||||
|
||||
debuggerState.breakOnEntry = false;
|
||||
g_debugger_window = nullptr;
|
||||
|
||||
|
|
@ -680,4 +684,42 @@ void DebuggerWindow2::UpdateModuleLabel(uint32 address)
|
|||
m_module_label->SetLabel(wxString::Format("> %s", "Cemu codecave"));
|
||||
m_module_address = mmuRange_CODECAVE.getBase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerWindow2::UpdateViewThreadsafe()
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_UPDATE_VIEW);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
void DebuggerWindow2::NotifyDebugBreakpointHit()
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_BREAKPOINT_HIT);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
void DebuggerWindow2::NotifyRun()
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_RUN);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
void DebuggerWindow2::MoveIP()
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_MOVE_IP);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
void DebuggerWindow2::NotifyModuleLoaded(void* module)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_NOTIFY_MODULE_LOADED);
|
||||
evt->SetClientData(module);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
||||
void DebuggerWindow2::NotifyModuleUnloaded(void* module)
|
||||
{
|
||||
auto* evt = new wxCommandEvent(wxEVT_NOTIFY_MODULE_UNLOADED);
|
||||
evt->SetClientData(module);
|
||||
wxQueueEvent(this, evt);
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/debugger/DisasmCtrl.h"
|
||||
#include "wxgui/debugger/DisasmCtrl.h"
|
||||
#include "config/XMLConfig.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
|
|
@ -42,7 +42,7 @@ struct DebuggerConfig
|
|||
void Load(XMLConfigParser& parser);
|
||||
void Save(XMLConfigParser& parser);
|
||||
};
|
||||
typedef XMLDataConfig<DebuggerConfig, &DebuggerConfig::Load, &DebuggerConfig::Save> XMLDebuggerConfig;
|
||||
typedef XMLDataConfig<DebuggerConfig> XMLDebuggerConfig;
|
||||
|
||||
struct DebuggerModuleStorage
|
||||
{
|
||||
|
|
@ -54,9 +54,9 @@ struct DebuggerModuleStorage
|
|||
void Load(XMLConfigParser& parser);
|
||||
void Save(XMLConfigParser& parser);
|
||||
};
|
||||
typedef XMLDataConfig<DebuggerModuleStorage, &DebuggerModuleStorage::Load, &DebuggerModuleStorage::Save> XMLDebuggerModuleConfig;
|
||||
typedef XMLDataConfig<DebuggerModuleStorage> XMLDebuggerModuleConfig;
|
||||
|
||||
class DebuggerWindow2 : public wxFrame
|
||||
class DebuggerWindow2 : public wxFrame, public DebuggerCallbacks
|
||||
{
|
||||
public:
|
||||
void CreateToolBar();
|
||||
|
|
@ -92,6 +92,13 @@ private:
|
|||
void CreateMenuBar();
|
||||
void UpdateModuleLabel(uint32 address = 0);
|
||||
|
||||
void UpdateViewThreadsafe() override;
|
||||
void NotifyDebugBreakpointHit() override;
|
||||
void NotifyRun() override;
|
||||
void MoveIP() override;
|
||||
void NotifyModuleLoaded(void* module) override;
|
||||
void NotifyModuleUnloaded(void* module) override;
|
||||
|
||||
XMLDebuggerConfig m_config;
|
||||
std::vector<std::unique_ptr<XMLDebuggerModuleConfig>> m_modules_storage;
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/DisasmCtrl.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/DisasmCtrl.h"
|
||||
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
|
|
@ -7,9 +7,8 @@
|
|||
#include "Cafe/OS/RPL/rpl_debug_symbols.h"
|
||||
#include "Cemu/PPCAssembler/ppcAssembler.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
|
||||
#include "Cemu/ExpressionParser/ExpressionParser.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/DebugSymbolStorage.h"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "gui/components/TextList.h"
|
||||
#include "wxgui/components/TextList.h"
|
||||
|
||||
wxDECLARE_EVENT(wxEVT_DISASMCTRL_NOTIFY_GOTO_ADDRESS, wxCommandEvent); // Notify parent that goto address operation completed. Event contains the address that was jumped to.
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/DumpCtrl.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/DumpCtrl.h"
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "gui/components/TextList.h"
|
||||
#include "wxgui/components/TextList.h"
|
||||
|
||||
|
||||
class DumpCtrl : public TextList
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/DumpWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/DumpWindow.h"
|
||||
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "gui/debugger/DumpCtrl.h"
|
||||
#include "wxgui/debugger/DumpCtrl.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/debugger/DumpCtrl.h"
|
||||
#include "wxgui/debugger/DumpCtrl.h"
|
||||
|
||||
class DebuggerWindow2;
|
||||
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "gui/debugger/ModuleWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/ModuleWindow.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
|
|
@ -133,5 +132,5 @@ void ModuleWindow::OnLeftDClick(wxMouseEvent& event)
|
|||
if (address == 0)
|
||||
return;
|
||||
debuggerState.debugSession.instructionPointer = address;
|
||||
debuggerWindow_moveIP();
|
||||
g_debuggerDispatcher.MoveIP();
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/RegisterCtrl.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/RegisterCtrl.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
|
||||
#define COLOR_DEBUG_ACTIVE_BP 0xFFFFA0FF
|
||||
#define COLOR_DEBUG_ACTIVE 0xFFFFA080
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "gui/components/TextList.h"
|
||||
#include "wxgui/components/TextList.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
|
||||
class RegisterCtrl : public TextList
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/debugger/RegisterWindow.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/RegisterWindow.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#include "gui/debugger/SymbolCtrl.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "wxgui/debugger/SymbolCtrl.h"
|
||||
#include "Cafe/OS/RPL/rpl_symbol_storage.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include <wx/listctrl.h>
|
||||
|
|
@ -114,7 +113,7 @@ void SymbolListCtrl::OnLeftDClick(wxListEvent& event)
|
|||
if (address == 0)
|
||||
return;
|
||||
debuggerState.debugSession.instructionPointer = address;
|
||||
debuggerWindow_moveIP();
|
||||
g_debuggerDispatcher.MoveIP();
|
||||
}
|
||||
|
||||
void SymbolListCtrl::OnRightClick(wxListEvent& event)
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "gui/debugger/SymbolWindow.h"
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "wxgui/debugger/SymbolWindow.h"
|
||||
#include "wxgui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Espresso/Debugger/Debugger.h"
|
||||
#include "Cafe/OS/RPL/rpl_symbol_storage.h"
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "gui/debugger/SymbolCtrl.h"
|
||||
#include "wxgui/debugger/SymbolCtrl.h"
|
||||
|
||||
class DebuggerWindow2;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
#include "wxgui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
#include "Cafe/Account/Account.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
#include "Cafe/OS/libs/coreinit/coreinit_Time.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "Cafe/HW/Espresso/PPCState.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
|
||||
SaveImportWindow::SaveImportWindow(wxWindow* parent, uint64 title_id)
|
||||
: wxDialog(parent, wxID_ANY, _("Import save entry"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxFRAME_TOOL_WINDOW | wxSYSTEM_MENU | wxTAB_TRAVERSAL | wxCLOSE_BOX),
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#include "Cafe/Account/Account.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
|
||||
SaveTransfer::SaveTransfer(wxWindow* parent, uint64 title_id, const wxString& source_account, uint32 source_id)
|
||||
: wxDialog(parent, wxID_ANY, _("Save transfer"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxFRAME_TOOL_WINDOW | wxSYSTEM_MENU | wxTAB_TRAVERSAL | wxCLOSE_BOX),
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/helpers/wxCustomEvents.h"
|
||||
#include "wxgui/helpers/wxCustomEvents.h"
|
||||
|
||||
wxDEFINE_EVENT(wxEVT_SET_STATUS_BAR_TEXT, wxSetStatusBarTextEvent);
|
||||
wxDEFINE_EVENT(wxEVT_SET_GAUGE_VALUE, wxSetGaugeValue);
|
||||
116
src/gui/wxgui/helpers/wxHelpers.cpp
Normal file
116
src/gui/wxgui/helpers/wxHelpers.cpp
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
#include "wxgui/helpers/wxHelpers.h"
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/dirdlg.h>
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkwindow.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#ifdef HAS_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "wxgui/helpers/wxControlObject.h"
|
||||
|
||||
void wxAutosizeColumn(wxListCtrlBase* ctrl, int col)
|
||||
{
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE_USEHEADER);
|
||||
int wh = ctrl->GetColumnWidth(col);
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE);
|
||||
int wc = ctrl->GetColumnWidth(col);
|
||||
if (wh > wc)
|
||||
ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE_USEHEADER);
|
||||
}
|
||||
|
||||
void wxAutosizeColumns(wxListCtrlBase* ctrl, int col_start, int col_end)
|
||||
{
|
||||
wxWindowUpdateLocker lock(ctrl);
|
||||
for (int i = col_start; i <= col_end; ++i)
|
||||
wxAutosizeColumn(ctrl, i);
|
||||
}
|
||||
|
||||
void update_slider_text(wxCommandEvent& event, const wxFormatString& format /*= "%d%%"*/)
|
||||
{
|
||||
const auto slider = dynamic_cast<wxSlider*>(event.GetEventObject());
|
||||
wxASSERT(slider);
|
||||
|
||||
auto slider_text = dynamic_cast<wxControlObject*>(event.GetEventUserData())->GetControl<wxStaticText>();
|
||||
wxASSERT(slider_text);
|
||||
|
||||
slider_text->SetLabel(wxString::Format(format, slider->GetValue()));
|
||||
}
|
||||
|
||||
uint32 fix_raw_keycode(uint32 keycode, uint32 raw_flags)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
const auto flags = (HIWORD(raw_flags) & 0xFFF);
|
||||
if(keycode == VK_SHIFT)
|
||||
{
|
||||
if(flags == 0x2A)
|
||||
return 160;
|
||||
else if (flags == 0x36)
|
||||
return 161;
|
||||
}
|
||||
else if (keycode == VK_CONTROL)
|
||||
{
|
||||
if (flags == 0x1d)
|
||||
return 162;
|
||||
else if (flags == 0x11d)
|
||||
return 163;
|
||||
}
|
||||
else if (keycode == VK_MENU)
|
||||
{
|
||||
if ((flags & 0xFF) == 0x38)
|
||||
return 164;
|
||||
else if ((flags & 0xFF) == 0x38)
|
||||
return 165;
|
||||
}
|
||||
#endif
|
||||
|
||||
return keycode;
|
||||
}
|
||||
|
||||
WindowSystem::WindowHandleInfo initHandleContextFromWxWidgetsWindow(wxWindow* wxw)
|
||||
{
|
||||
WindowSystem::WindowHandleInfo handleInfo;
|
||||
#if BOOST_OS_WINDOWS
|
||||
handleInfo.backend = WindowSystem::WindowHandleInfo::Backend::Windows;
|
||||
handleInfo.surface = reinterpret_cast<void*>(wxw->GetHWND());
|
||||
#elif BOOST_OS_LINUX
|
||||
GtkWidget* gtkWidget = (GtkWidget*)wxw->GetHandle(); // returns GtkWidget
|
||||
gtk_widget_realize(gtkWidget);
|
||||
GdkWindow* gdkWindow = gtk_widget_get_window(gtkWidget);
|
||||
GdkDisplay* gdkDisplay = gdk_window_get_display(gdkWindow);
|
||||
if (GDK_IS_X11_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfo.backend = WindowSystem::WindowHandleInfo::Backend::X11;
|
||||
handleInfo.surface = reinterpret_cast<void*>(gdk_x11_window_get_xid(gdkWindow));
|
||||
handleInfo.display = gdk_x11_display_get_xdisplay(gdkDisplay);
|
||||
if (!handleInfo.display)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Unable to get xlib display");
|
||||
}
|
||||
}
|
||||
#ifdef HAS_WAYLAND
|
||||
else if (GDK_IS_WAYLAND_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfo.backend = WindowSystem::WindowHandleInfo::Backend::Wayland;
|
||||
handleInfo.surface = gdk_wayland_window_get_wl_surface(gdkWindow);
|
||||
handleInfo.display = gdk_wayland_display_get_wl_display(gdkDisplay);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Unsuported GTK backend");
|
||||
}
|
||||
#elif BOOST_OS_MACOS
|
||||
handleInfo.backend = WindowSystem::WindowHandleInfo::Backend::Cocoa;
|
||||
handleInfo.surface = reinterpret_cast<void*>(wxw->GetHandle());
|
||||
#endif
|
||||
return handleInfo;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "interface/WindowSystem.h"
|
||||
#include <wx/control.h>
|
||||
#include <wx/listbase.h>
|
||||
#include <wx/string.h>
|
||||
|
|
@ -109,3 +110,5 @@ T get_prev_sibling(const T element)
|
|||
void update_slider_text(wxCommandEvent& event, const wxFormatString& format = "%d%%");
|
||||
|
||||
uint32 fix_raw_keycode(uint32 keycode, uint32 raw_flags);
|
||||
|
||||
WindowSystem::WindowHandleInfo initHandleContextFromWxWidgetsWindow(wxWindow* wxw);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/helpers/wxWayland.h"
|
||||
#include "wxgui/helpers/wxWayland.h"
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
|
||||
|
|
@ -1,19 +1,122 @@
|
|||
#include "gui/input/HotkeySettings.h"
|
||||
#include "wxgui/input/HotkeySettings.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
||||
#include "interface/WindowSystem.h"
|
||||
#include <config/ActiveSettings.h>
|
||||
#include <gui/guiWrapper.h>
|
||||
#include "input/InputManager.h"
|
||||
#include "HotkeySettings.h"
|
||||
|
||||
#include <wx/clipbrd.h>
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <ole2.h>
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
extern WindowInfo g_window_info;
|
||||
std::optional<fs::path> GenerateScreenshotFilename(bool isDRC)
|
||||
{
|
||||
fs::path screendir = ActiveSettings::GetUserDataPath("screenshots");
|
||||
// build screenshot name with format Screenshot_YYYY-MM-DD_HH-MM-SS[_GamePad].png
|
||||
// if the file already exists add a suffix counter (_2.png, _3.png etc)
|
||||
std::time_t time_t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
std::tm* tm = std::localtime(&time_t);
|
||||
|
||||
std::string screenshotFileName = fmt::format("Screenshot_{:04}-{:02}-{:02}_{:02}-{:02}-{:02}", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
if (isDRC)
|
||||
screenshotFileName.append("_GamePad");
|
||||
|
||||
fs::path screenshotPath;
|
||||
for (sint32 i = 0; i < 999; i++)
|
||||
{
|
||||
screenshotPath = screendir;
|
||||
if (i == 0)
|
||||
screenshotPath.append(fmt::format("{}.png", screenshotFileName));
|
||||
else
|
||||
screenshotPath.append(fmt::format("{}_{}.png", screenshotFileName, i + 1));
|
||||
|
||||
std::error_code ec;
|
||||
bool exists = fs::exists(screenshotPath, ec);
|
||||
|
||||
if (!ec && !exists)
|
||||
return screenshotPath;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool SaveScreenshotToFile(const fs::path& imagePath, const wxImage& image)
|
||||
{
|
||||
std::error_code ec;
|
||||
fs::create_directories(imagePath.parent_path(), ec);
|
||||
if (ec)
|
||||
return false;
|
||||
|
||||
// suspend wxWidgets logging for the lifetime this object, to prevent a message box if wxImage::SaveFile fails
|
||||
wxLogNull _logNo;
|
||||
return image.SaveFile(imagePath.wstring());
|
||||
}
|
||||
|
||||
bool SaveScreenshotToClipboard(const wxImage& image)
|
||||
{
|
||||
static std::mutex s_clipboardMutex;
|
||||
bool success = false;
|
||||
|
||||
s_clipboardMutex.lock();
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
wxTheClipboard->SetData(new wxImageDataObject(image));
|
||||
wxTheClipboard->Close();
|
||||
success = true;
|
||||
}
|
||||
s_clipboardMutex.unlock();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
std::optional<std::string> SaveScreenshot(std::vector<uint8> data, int width, int height, bool mainWindow)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
// on Windows wxWidgets uses OLE API for the clipboard
|
||||
// to make this work we need to call OleInitialize() on the same thread
|
||||
OleInitialize(nullptr);
|
||||
#endif
|
||||
bool save_screenshot = GetWxGUIConfig().save_screenshot;
|
||||
wxImage image(width, height, data.data(), true);
|
||||
if (mainWindow)
|
||||
{
|
||||
if (SaveScreenshotToClipboard(image))
|
||||
{
|
||||
if (!save_screenshot)
|
||||
return "Screenshot saved to clipboard";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed to open clipboard";
|
||||
}
|
||||
}
|
||||
if (save_screenshot)
|
||||
{
|
||||
auto imagePath = GenerateScreenshotFilename(mainWindow);
|
||||
if (imagePath.has_value() && SaveScreenshotToFile(imagePath.value(), image))
|
||||
{
|
||||
if (mainWindow)
|
||||
return "Screenshot saved";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed to save screenshot to file";
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
extern WindowSystem::WindowInfo g_window_info;
|
||||
const std::unordered_map<sHotkeyCfg*, std::function<void(void)>> HotkeySettings::s_cfgHotkeyToFuncMap{
|
||||
{&s_cfgHotkeys.toggleFullscreen, [](void) { s_mainWindow->ShowFullScreen(!s_mainWindow->IsFullScreen()); }},
|
||||
{&s_cfgHotkeys.toggleFullscreenAlt, [](void) { s_mainWindow->ShowFullScreen(!s_mainWindow->IsFullScreen()); }},
|
||||
{&s_cfgHotkeys.exitFullscreen, [](void) { s_mainWindow->ShowFullScreen(false); }},
|
||||
{&s_cfgHotkeys.takeScreenshot, [](void) { g_window_info.has_screenshot_request = true; }},
|
||||
{&s_cfgHotkeys.takeScreenshot, [](void) { if(g_renderer) g_renderer->RequestScreenshot(SaveScreenshot); }},
|
||||
{&s_cfgHotkeys.toggleFastForward, [](void) { ActiveSettings::SetTimerShiftFactor((ActiveSettings::GetTimerShiftFactor() < 3) ? 3 : 1); }},
|
||||
};
|
||||
|
||||
|
|
@ -71,7 +174,7 @@ HotkeySettings::~HotkeySettings()
|
|||
m_controllerTimer->Stop();
|
||||
if (m_needToSave)
|
||||
{
|
||||
g_config.Save();
|
||||
GetConfigHandle().Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "config/CemuConfig.h"
|
||||
#include "wxCemuConfig.h"
|
||||
#include "input/api/Controller.h"
|
||||
|
||||
class HotkeyEntry;
|
||||
|
|
@ -22,7 +22,7 @@ private:
|
|||
static const std::unordered_map<sHotkeyCfg*, std::function<void(void)>> s_cfgHotkeyToFuncMap;
|
||||
inline static std::unordered_map<uint16, std::function<void(void)>> s_keyboardHotkeyToFuncMap{};
|
||||
inline static std::unordered_map<uint16, std::function<void(void)>> s_controllerHotkeyToFuncMap{};
|
||||
inline static auto& s_cfgHotkeys = GetConfig().hotkeys;
|
||||
inline static auto& s_cfgHotkeys = GetWxGUIConfig().hotkeys;
|
||||
|
||||
wxPanel* m_panel;
|
||||
wxFlexGridSizer* m_sizer;
|
||||
|
|
@ -30,7 +30,7 @@ private:
|
|||
wxTimer* m_controllerTimer{ nullptr };
|
||||
const wxSize m_minButtonSize{ 250, 45 };
|
||||
const wxString m_disabledHotkeyText{ _("----") };
|
||||
const wxString m_editModeHotkeyText{ _("") };
|
||||
const wxString m_editModeHotkeyText{ "" };
|
||||
|
||||
std::vector<HotkeyEntry> m_hotkeys;
|
||||
std::weak_ptr<ControllerBase> m_activeController{};
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#include "gui/input/InputAPIAddWindow.h"
|
||||
#include "wxgui/input/InputAPIAddWindow.h"
|
||||
|
||||
#include "input/InputManager.h"
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "input/api/Controller.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <wx/dialog.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
#include "input/api/Controller.h"
|
||||
|
||||
class wxComboBox;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
#include "gui/input/InputSettings2.h"
|
||||
#include "wxgui/input/InputSettings2.h"
|
||||
|
||||
#include <wx/gbsizer.h>
|
||||
|
||||
#include "input/InputManager.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "gui/helpers/wxControlObject.h"
|
||||
#include "gui/helpers/wxCustomData.h"
|
||||
#include "wxgui/helpers/wxHelpers.h"
|
||||
#include "wxgui/helpers/wxControlObject.h"
|
||||
#include "wxgui/helpers/wxCustomData.h"
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/notebook.h>
|
||||
|
|
@ -17,18 +17,18 @@
|
|||
#include <wx/bmpbuttn.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/input/InputAPIAddWindow.h"
|
||||
#include "wxgui/input/InputAPIAddWindow.h"
|
||||
#include "input/ControllerFactory.h"
|
||||
|
||||
#include "gui/input/PairingDialog.h"
|
||||
#include "wxgui/input/PairingDialog.h"
|
||||
|
||||
#include "gui/input/panels/VPADInputPanel.h"
|
||||
#include "gui/input/panels/ProControllerInputPanel.h"
|
||||
#include "wxgui/input/panels/VPADInputPanel.h"
|
||||
#include "wxgui/input/panels/ProControllerInputPanel.h"
|
||||
|
||||
#include "gui/input/settings/DefaultControllerSettings.h"
|
||||
#include "gui/input/panels/ClassicControllerInputPanel.h"
|
||||
#include "gui/input/panels/WiimoteInputPanel.h"
|
||||
#include "gui/input/settings/WiimoteControllerSettings.h"
|
||||
#include "wxgui/input/settings/DefaultControllerSettings.h"
|
||||
#include "wxgui/input/panels/ClassicControllerInputPanel.h"
|
||||
#include "wxgui/input/panels/WiimoteInputPanel.h"
|
||||
#include "wxgui/input/settings/WiimoteControllerSettings.h"
|
||||
#include "util/EventService.h"
|
||||
|
||||
#include "resource/embedded/resources.h"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "gui/wxgui.h"
|
||||
#include "wxgui/wxgui.h"
|
||||
#include "PairingDialog.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue