From ced28d629dd018f3cd5468e43fb092b9a162a7fa Mon Sep 17 00:00:00 2001 From: R2DLiu Date: Sun, 5 Jul 2020 22:28:23 -0400 Subject: [PATCH] Compiling. Online and rollback work. Replays broken currently --- Source/Core/Core/CMakeLists.txt | 2 ++ Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp | 12 ++++++------ Source/Core/Core/Host.h | 2 ++ Source/Core/DolphinNoGUI/MainNoGUI.cpp | 3 +++ Source/Core/DolphinQt/Host.cpp | 10 ++++++++++ Source/Core/DolphinQt/Host.h | 2 ++ Source/Core/DolphinQt/RenderWidget.cpp | 18 +++++++++++++++++- Source/Core/DolphinQt/RenderWidget.h | 3 +++ Source/UnitTests/StubHost.cpp | 6 ++++++ 9 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 7a77a30044..bd2439c3df 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -582,10 +582,12 @@ PUBLIC videoogl videosoftware videovulkan + semver SlippiLib vcdcom vcddec vcdenc + z PRIVATE fmt::fmt diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp index cce3ea664e..372538a6c0 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp @@ -21,6 +21,7 @@ #include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/Debugger/Debugger_SymbolMap.h" +#include "Host.h" #include "Core/HW/EXI/EXI_DeviceSlippi.h" #include "Core/HW/Memmap.h" #include "Core/HW/SystemTimers.h" @@ -44,15 +45,14 @@ //#define LOCAL_TESTING //#define CREATE_DIFF_FILES +extern std::unique_ptr g_playbackStatus; +extern std::unique_ptr g_replayComm; namespace ExpansionInterface { static std::unordered_map slippi_names; static std::unordered_map slippi_connect_codes; -extern std::unique_ptr g_playbackStatus; -extern std::unique_ptr g_replayComm; - template bool isFutureReady(std::future& t) { return t.wait_for(std::chrono::seconds(0)) == std::future_status::ready; @@ -1988,7 +1988,7 @@ void CEXISlippi::handleLogInRequest() if (!logInRes) { //#ifndef LINUX_LOCAL_DEV - //main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement. + Host_LowerWindow(); //#endif user->OpenLogInPage(); user->ListenForLogIn(); @@ -2007,7 +2007,7 @@ void CEXISlippi::handleUpdateAppRequest() #else // main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement // mainwindow hide render widget user->UpdateApp(); - main_frame->DoExit(); + Host_Exit(); #endif } @@ -2036,7 +2036,7 @@ void CEXISlippi::prepareOnlineStatus() // Write connect code (10 bytes) std::string connectCode = userInfo.connectCode; - char shiftJisHashtag[] = { (char)0x81, (char)0x94, (char)0x00 }; + char shiftJisHashtag[] = { '\x81', '\x94', '\x00' }; connectCode.resize(CONNECT_CODE_LENGTH); connectCode = ReplaceAll(connectCode, "#", shiftJisHashtag); auto codeBuf = connectCode.c_str(); diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h index cf65c22eb0..6eb4b64342 100644 --- a/Source/Core/Core/Host.h +++ b/Source/Core/Core/Host.h @@ -44,3 +44,5 @@ void Host_UpdateMainFrame(); void Host_UpdateTitle(const std::string& title); void Host_YieldToUI(); void Host_TitleChanged(); +void Host_LowerWindow(); +void Host_Exit(); diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 0bf4df23b8..db0e00c29b 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -106,6 +106,9 @@ void Host_TitleChanged() #endif } +void Host_LowerWindow() {} +void Host_Exit() {} + static std::unique_ptr GetPlatform(const optparse::Values& options) { std::string platform_name = static_cast(options.get("platform")); diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index 9f3251f7a5..d8e301d3e4 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -173,3 +173,13 @@ void Host_TitleChanged() Discord::UpdateDiscordPresence(); #endif } + +void Host_LowerWindow() +{ + Host::GetInstance()->RequestLowerWindow(); +} + +void Host_Exit() +{ + Host::GetInstance()->RequestExit(); +} diff --git a/Source/Core/DolphinQt/Host.h b/Source/Core/DolphinQt/Host.h index 090e620336..7b9d39273d 100644 --- a/Source/Core/DolphinQt/Host.h +++ b/Source/Core/DolphinQt/Host.h @@ -37,6 +37,8 @@ signals: void RequestRenderSize(int w, int h); void UpdateDisasmDialog(); void NotifyMapLoaded(); + void RequestLowerWindow(); + void RequestExit(); private: Host(); diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index 234eb270cb..2f2f098d8e 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -57,7 +57,8 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent) resize(w / dpr, h / dpr); }); - + connect(Host::GetInstance(), &Host::RequestLowerWindow, this, &RenderWidget::LowerWindow); + connect(Host::GetInstance(), &Host::RequestExit, this, &RenderWidget::Exit); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) { if (state == Core::State::Running) SetImGuiKeyMap(); @@ -334,3 +335,18 @@ void RenderWidget::SetImGuiKeyMap() for (auto entry : key_map) ImGui::GetIO().KeyMap[entry[0]] = entry[1] & 0x1FF; } + +void RenderWidget::LowerWindow() +{ + if (Config::Get(Config::MAIN_RENDER_TO_MAIN)) + return; + + lower(); +} + +void RenderWidget::Exit() +{ + close(); +} + + diff --git a/Source/Core/DolphinQt/RenderWidget.h b/Source/Core/DolphinQt/RenderWidget.h index 650ba2d1dc..1c420dc96a 100644 --- a/Source/Core/DolphinQt/RenderWidget.h +++ b/Source/Core/DolphinQt/RenderWidget.h @@ -29,6 +29,7 @@ signals: void SizeChanged(int new_width, int new_height); void FocusChanged(bool focus); + private: void HandleCursorTimer(); void OnHideCursorChanged(); @@ -38,6 +39,8 @@ private: void SetImGuiKeyMap(); void dragEnterEvent(QDragEnterEvent* event) override; void dropEvent(QDropEvent* event) override; + void LowerWindow(); + void Exit(); static constexpr int MOUSE_HIDE_DELAY = 3000; QTimer* m_mouse_timer; diff --git a/Source/UnitTests/StubHost.cpp b/Source/UnitTests/StubHost.cpp index 211ee8bfba..1d682b0765 100644 --- a/Source/UnitTests/StubHost.cpp +++ b/Source/UnitTests/StubHost.cpp @@ -49,3 +49,9 @@ void Host_YieldToUI() void Host_TitleChanged() { } +void Host_LowerWindow() +{ +} +void Host_Exit() +{ +}