This commit is contained in:
Nayla Hanegan 2024-05-12 02:17:59 -04:00
commit 98c174edc4
520 changed files with 74815 additions and 58942 deletions

View file

@ -5,8 +5,9 @@ add_executable(dolphin-nogui
MainNoGUI.cpp
)
if(ENABLE_X11 AND X11_FOUND)
if(X11_FOUND)
target_sources(dolphin-nogui PRIVATE PlatformX11.cpp)
target_link_libraries(dolphin-nogui PRIVATE PkgConfig::XRANDR PkgConfig::X11)
endif()
if(WIN32)
@ -40,6 +41,11 @@ if(APPLE)
)
endif()
if(WIN32)
# needed for adjusting window decorations with DwmSetWindowAttribute
target_link_libraries(dolphin-nogui PRIVATE dwmapi.lib)
endif()
if(MSVC)
# Add precompiled header
target_link_libraries(dolphin-nogui PRIVATE use_pch)

View file

@ -24,6 +24,7 @@
#include "Core/Core.h"
#include "Core/DolphinAnalytics.h"
#include "Core/Host.h"
#include "Core/System.h"
#include "UICommon/CommandLineParse.h"
#ifdef USE_DISCORD_PRESENCE
@ -56,7 +57,7 @@ std::vector<std::string> Host_GetPreferredLocales()
return {};
}
void Host_NotifyMapLoaded()
void Host_PPCSymbolsChanged()
{
}
@ -304,7 +305,7 @@ int main(int argc, char* argv[])
DolphinAnalytics::Instance().ReportDolphinStart("nogui");
if (!BootManager::BootCore(std::move(boot), wsi))
if (!BootManager::BootCore(Core::System::GetInstance(), std::move(boot), wsi))
{
fprintf(stderr, "Could not boot the specified file\n");
return 1;
@ -315,9 +316,9 @@ int main(int argc, char* argv[])
#endif
s_platform->MainLoop();
Core::Stop();
Core::Stop(Core::System::GetInstance());
Core::Shutdown();
Core::Shutdown(Core::System::GetInstance());
s_platform.reset();
return 0;

View file

@ -9,6 +9,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/State.h"
#include "Core/System.h"
#include <climits>
#include <cstdio>
@ -78,7 +79,7 @@ void PlatformFBDev::MainLoop()
while (IsRunning())
{
UpdateRunningFlag();
Core::HostDispatchJobs();
Core::HostDispatchJobs(Core::System::GetInstance());
// TODO: Is this sleep appropriate?
std::this_thread::sleep_for(std::chrono::milliseconds(1));

View file

@ -3,7 +3,9 @@
#include <cstdio>
#include <thread>
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinNoGUI/Platform.h"
namespace
@ -27,7 +29,7 @@ void PlatformHeadless::MainLoop()
while (m_running.IsSet())
{
UpdateRunningFlag();
Core::HostDispatchJobs();
Core::HostDispatchJobs(Core::System::GetInstance());
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

View file

@ -7,6 +7,7 @@
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
#include "Core/State.h"
#include "Core/System.h"
#include "VideoCommon/Present.h"
#include "VideoCommon/RenderBase.h"
@ -41,10 +42,11 @@
- (void)togglePause
{
if (Core::GetState() == Core::State::Running)
Core::SetState(Core::State::Paused);
auto& system = Core::System::GetInstance();
if (Core::GetState(system) == Core::State::Running)
Core::SetState(system, Core::State::Paused);
else
Core::SetState(Core::State::Running);
Core::SetState(system, Core::State::Running);
}
- (void)saveScreenShot
@ -54,27 +56,27 @@
- (void)loadLastSaved
{
State::LoadLastSaved();
State::LoadLastSaved(Core::System::GetInstance());
}
- (void)undoLoadState
{
State::UndoLoadState();
State::UndoLoadState(Core::System::GetInstance());
}
- (void)undoSaveState
{
State::UndoSaveState();
State::UndoSaveState(Core::System::GetInstance());
}
- (void)loadState:(id)sender
{
State::Load([sender tag]);
State::Load(Core::System::GetInstance(), [sender tag]);
}
- (void)saveState:(id)sender
{
State::Save([sender tag]);
State::Save(Core::System::GetInstance(), [sender tag]);
}
@end
@ -225,7 +227,7 @@ void PlatformMacOS::MainLoop()
while (IsRunning())
{
UpdateRunningFlag();
Core::HostDispatchJobs();
Core::HostDispatchJobs(Core::System::GetInstance());
ProcessEvents();
UpdateWindowPosition();
}
@ -262,8 +264,10 @@ void PlatformMacOS::ProcessEvents()
{
m_window_focus = true;
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never &&
Core::GetState() != Core::State::Paused)
Core::GetState(Core::System::GetInstance()) != Core::State::Paused)
{
[NSCursor unhide];
}
}
else
{

View file

@ -8,10 +8,12 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/State.h"
#include "Core/System.h"
#include <Windows.h>
#include <climits>
#include <cstdio>
#include <dwmapi.h>
#include "VideoCommon/Present.h"
#include "resource.h"
@ -123,7 +125,7 @@ void PlatformWin32::MainLoop()
while (IsRunning())
{
UpdateRunningFlag();
Core::HostDispatchJobs();
Core::HostDispatchJobs(Core::System::GetInstance());
ProcessEvents();
UpdateWindowPosition();
@ -179,6 +181,18 @@ LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
return DefWindowProc(hwnd, msg, wParam, lParam);
}
case WM_CREATE:
{
if (hwnd)
{
// Remove rounded corners from the render window on Windows 11
const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND;
DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference,
sizeof(corner_preference));
}
}
break;
case WM_SIZE:
{
if (g_presenter)

View file

@ -15,6 +15,7 @@ static constexpr auto X_None = None;
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
#include "Core/State.h"
#include "Core/System.h"
#include <climits>
#include <cstdio>
@ -151,7 +152,7 @@ void PlatformX11::MainLoop()
while (IsRunning())
{
UpdateRunningFlag();
Core::HostDispatchJobs();
Core::HostDispatchJobs(Core::System::GetInstance());
ProcessEvents();
UpdateWindowPosition();
@ -198,17 +199,17 @@ void PlatformX11::ProcessEvents()
}
else if (key == XK_F10)
{
if (Core::GetState() == Core::State::Running)
if (Core::GetState(Core::System::GetInstance()) == Core::State::Running)
{
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XUndefineCursor(m_display, m_window);
Core::SetState(Core::State::Paused);
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
}
else
{
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never)
XDefineCursor(m_display, m_window, m_blank_cursor);
Core::SetState(Core::State::Running);
Core::SetState(Core::System::GetInstance(), Core::State::Running);
}
}
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
@ -224,28 +225,30 @@ void PlatformX11::ProcessEvents()
{
int slot_number = key - XK_F1 + 1;
if (event.xkey.state & ShiftMask)
State::Save(slot_number);
State::Save(Core::System::GetInstance(), slot_number);
else
State::Load(slot_number);
State::Load(Core::System::GetInstance(), slot_number);
}
else if (key == XK_F9)
Core::SaveScreenShot();
else if (key == XK_F11)
State::LoadLastSaved();
State::LoadLastSaved(Core::System::GetInstance());
else if (key == XK_F12)
{
if (event.xkey.state & ShiftMask)
State::UndoLoadState();
State::UndoLoadState(Core::System::GetInstance());
else
State::UndoSaveState();
State::UndoSaveState(Core::System::GetInstance());
}
break;
case FocusIn:
{
m_window_focus = true;
if (Config::Get(Config::MAIN_SHOW_CURSOR) == Config::ShowCursor::Never &&
Core::GetState() != Core::State::Paused)
Core::GetState(Core::System::GetInstance()) != Core::State::Paused)
{
XDefineCursor(m_display, m_window, m_blank_cursor);
}
}
break;
case FocusOut: