Linux support. (#54)

* Initial Linux attempt.

* Add clang toolchain & make tools compile.

* vcpkg as submodule.

* First implementation of IO rewrite. (#31)

* Fix directory iteration resolving symlinks.

* Refactor kernel objects to be lock-free.

* Implement guest critical sections using std::atomic.

* Make D3D12 support optional. (#33)

* Make D3D12 support optional.

* Update ShaderRecomp, fix macros.

* Replace QueryPerformanceCounter. (#35)

* Add Linux home path for GetUserPath(). (#36)

* Cross-platform Sleep. (#37)

* Add mmap implementations for virtual allocation. (#38)

* Cross-platform TLS. (#34)

* Cross-platform TLS.

* Fix front() to back(), use Mutex.

* Fix global variable namings.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>

* Unicode support. (#39)

* Replace CreateDirectoryA with Unicode version.

* Cross platform thread implementation. (#41)

* Cross-platform thread implementation.

* Put set thread name calls behind a Win32 macro.

* Cross-platform semaphore implementation. (#43)

* xam: use SDL for keyboard input

* Cross-platform atomic operations. (#44)

* Cross-platform spin lock implementation.

* Cross-platform reference counting.

* Cross-platform event implementation. (#47)

* Compiling and running on Linux. (#49)

* Current work trying to get it to compile.

* Update vcpkg.json baseline.

* vcpkg, memory mapped file.

* Bitscan forward.

* Fix localtime_s.

* FPS patches high res clock.

* Rename Window to GameWindow. Fix guest pointers.

* GetCurrentThreadID gone.

* Code cache pointers, RenderWindow type.

* Add Linux stubs.

* Refactor Config.

* Fix paths.

* Add linux-release config.

* FS fixes.

* Fix Windows compilation errors & unicode converter crash.

* Rename physical memory allocation functions to not clash with X11.

* Fix NULL character being added on RtlMultiByteToUnicodeN.

* Use std::exit.

* Add protection to memory on Linux.

* Convert majority of dependencies to submodules. (#48)

* Convert majority of dependencies to submodules.

* Don't compile header-only libraries.

* Fix a few incorrect data types.

* Fix config directory.

* Unicode fixes & sizeof asserts.

* Change the exit function to not call static destructors.

* Fix files picker.

* Add RelWithDebInfo preset for Linux.

* Implement OS Restart on Linux. (#50)

---------

Co-authored-by: Dario <dariosamo@gmail.com>

* Update PowerRecomp.

* Add Env Var detection for VCPKG_ROOT, add DLC detection.

* Use error code version on DLC directory iterator.

* Set D3D12MA::ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED flag.

* Linux flatpak. (#51)

* Add flatpak support.

* Add game install directory override for flatpak.

* Flatpak'ing.

* Flatpak it some more.

* We flat it, we pak it.

* Flatpak'd.

* The Marvelous Misadventures of Flatpak.

* Attempt to change logic of NFD and show error.

* Flattenpakken.

* Use game install directory instead of current path.

* Attempt to fix line endings.

* Update io.github.hedge_dev.unleashedrecomp.json

* Fix system time query implementation.

* Add Present Wait to Vulkan to improve frame pacing and reduce latency. (#53)

* Add present wait support to Vulkan.

* Default to triple buffering if presentWait is supported.

* Bracey fellas.

* Update paths.h

* SDL2 audio (again). (#52)

* Implement SDL2 audio (again).

* Call timeBeginPeriod/timeEndPeriod.

* Replace miniaudio with SDL mixer.

* Queue audio samples in a separate thread.

* Enable CMake option override policy & fix compilation error.

* Fix compilation error on Linux.

* Fix but also trim shared strings.

* Wayland support. (#55)

* Make channel index a global variable in embedded player.

* Fix SDL Audio selection for OGG on Flatpak.

* Minor installer wizard fixes.

* Fix compilation error.

* Yield in model consumer and pipeline compiler threads.

* Special case Sleep(0) to yield on Linux.

* Add App Id hint.

* Correct implementation for auto reset events. (#57)

---------

Co-authored-by: Dario <dariosamo@gmail.com>
Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
This commit is contained in:
Skyth (Asilkan)
2024-12-21 00:44:05 +03:00
committed by GitHub
parent f547c7ca6d
commit 67633917bf
109 changed files with 3373 additions and 2850 deletions
+8 -3
View File
@@ -281,9 +281,14 @@ static void DrawAchievement(int rowIndex, float yOffset, Achievement& achievemen
return;
char buffer[32];
struct tm time;
localtime_s(&time, &timestamp);
strftime(buffer, sizeof(buffer), "%Y/%m/%d %H:%M", &time);
#ifdef _WIN32
tm timeStruct;
tm *timePtr = &timeStruct;
localtime_s(timePtr, &timestamp);
#else
tm *timePtr = localtime(&timestamp);
#endif
strftime(buffer, sizeof(buffer), "%Y/%m/%d %H:%M", timePtr);
fontSize = Scale(12);
textSize = g_fntNewRodinDB->CalcTextSizeA(fontSize, FLT_MAX, 0, buffer);
@@ -1,4 +1,4 @@
#include "window.h"
#include "game_window.h"
#include "sdl_listener.h"
#include <user/config.h>
#include <SDL_syswm.h>
@@ -32,15 +32,15 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
if (!(event->key.keysym.mod & KMOD_ALT) || !m_isFullscreenKeyReleased)
break;
Config::Fullscreen = Window::SetFullscreen(!Window::IsFullscreen());
Config::Fullscreen = GameWindow::SetFullscreen(!GameWindow::IsFullscreen());
if (Config::Fullscreen)
{
Config::Monitor = Window::GetDisplay();
Config::Monitor = GameWindow::GetDisplay();
}
else
{
Config::WindowState = Window::SetMaximised(Config::WindowState == EWindowState::Maximised);
Config::WindowState = GameWindow::SetMaximised(Config::WindowState == EWindowState::Maximised);
}
// Block holding ALT+ENTER spamming window changes.
@@ -51,17 +51,17 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
// Restore original window dimensions on F2.
case SDLK_F2:
Config::Fullscreen = Window::SetFullscreen(false);
Window::ResetDimensions();
Config::Fullscreen = GameWindow::SetFullscreen(false);
GameWindow::ResetDimensions();
break;
// Recentre window on F3.
case SDLK_F3:
{
if (Window::IsFullscreen())
if (GameWindow::IsFullscreen())
break;
Window::SetDimensions(Window::s_width, Window::s_height);
GameWindow::SetDimensions(GameWindow::s_width, GameWindow::s_height);
break;
}
@@ -86,16 +86,16 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
switch (event->window.event)
{
case SDL_WINDOWEVENT_FOCUS_LOST:
Window::s_isFocused = false;
GameWindow::s_isFocused = false;
SDL_ShowCursor(SDL_ENABLE);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
{
Window::s_isFocused = true;
GameWindow::s_isFocused = true;
if (Window::IsFullscreen())
SDL_ShowCursor(Window::s_isFullscreenCursorVisible ? SDL_ENABLE : SDL_DISABLE);
if (GameWindow::IsFullscreen())
SDL_ShowCursor(GameWindow::s_isFullscreenCursorVisible ? SDL_ENABLE : SDL_DISABLE);
break;
}
@@ -110,14 +110,14 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
case SDL_WINDOWEVENT_RESIZED:
m_isResizing = true;
Window::s_width = event->window.data1;
Window::s_height = event->window.data2;
Window::SetTitle(fmt::format("{} - [{}x{}]", Window::GetTitle(), Window::s_width, Window::s_height).c_str());
GameWindow::s_width = event->window.data1;
GameWindow::s_height = event->window.data2;
GameWindow::SetTitle(fmt::format("{} - [{}x{}]", GameWindow::GetTitle(), GameWindow::s_width, GameWindow::s_height).c_str());
break;
case SDL_WINDOWEVENT_MOVED:
Window::s_x = event->window.data1;
Window::s_y = event->window.data2;
GameWindow::s_x = event->window.data1;
GameWindow::s_y = event->window.data2;
break;
}
@@ -125,12 +125,12 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
}
case SDL_USER_EVILSONIC:
Window::s_isIconNight = event->user.code;
Window::SetIcon(Window::s_isIconNight);
GameWindow::s_isIconNight = event->user.code;
GameWindow::SetIcon(GameWindow::s_isIconNight);
break;
}
if (!Window::IsFullscreen())
if (!GameWindow::IsFullscreen())
{
if (event->type == SDL_CONTROLLERBUTTONDOWN || event->type == SDL_CONTROLLERBUTTONUP || event->type == SDL_CONTROLLERAXISMOTION)
{
@@ -147,12 +147,33 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
return 0;
}
void Window::Init()
void GameWindow::Init(bool sdlVideoDefault)
{
SDL_InitSubSystem(SDL_INIT_VIDEO);
#ifdef __linux__
SDL_SetHint("SDL_APP_ID", "io.github.hedge_dev.unleashedrecomp");
if (!sdlVideoDefault)
{
int videoRes = SDL_VideoInit("wayland");
if (videoRes != 0)
sdlVideoDefault = true;
}
#else
sdlVideoDefault = true;
#endif
if (sdlVideoDefault)
SDL_VideoInit(nullptr);
const char* videoDriverName = SDL_GetCurrentVideoDriver();
if (videoDriverName != nullptr)
fmt::println("SDL Video Driver: {}", videoDriverName);
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
SDL_AddEventWatch(Window_OnSDLEvent, s_pWindow);
#ifdef _WIN32
SetProcessDPIAware();
#endif
s_x = Config::WindowX;
s_y = Config::WindowY;
@@ -163,7 +184,7 @@ void Window::Init()
s_x = s_y = SDL_WINDOWPOS_CENTERED;
if (!IsPositionValid())
Window::ResetDimensions();
GameWindow::ResetDimensions();
s_pWindow = SDL_CreateWindow("SWA", s_x, s_y, s_width, s_height, GetWindowFlags());
@@ -180,21 +201,28 @@ void Window::Init()
SDL_VERSION(&info.version);
SDL_GetWindowWMInfo(s_pWindow, &info);
s_handle = info.info.win.window;
#if defined(_WIN32)
s_renderWindow = info.info.win.window;
SetDarkTitleBar(true);
#elif defined(SDL_VULKAN_ENABLED)
s_renderWindow = s_pWindow;
#elif defined(__linux__)
s_renderWindow = { info.info.x11.display, info.info.x11.window };
#else
static_assert(false, "Unknown platform.");
#endif
SDL_ShowWindow(s_pWindow);
}
void Window::Update()
void GameWindow::Update()
{
if (!Window::IsFullscreen() && !Window::IsMaximised() && !s_isChangingDisplay)
if (!GameWindow::IsFullscreen() && !GameWindow::IsMaximised() && !s_isChangingDisplay)
{
Config::WindowX = Window::s_x;
Config::WindowY = Window::s_y;
Config::WindowWidth = Window::s_width;
Config::WindowHeight = Window::s_height;
Config::WindowX = GameWindow::s_x;
Config::WindowY = GameWindow::s_y;
Config::WindowWidth = GameWindow::s_width;
Config::WindowHeight = GameWindow::s_height;
}
if (m_isResizing)
@@ -6,6 +6,7 @@
#include <os/version.h>
#include <ui/window_events.h>
#include <user/config.h>
#include <gpu/rhi/plume_render_interface_types.h>
#if _WIN32
#include <dwmapi.h>
@@ -15,11 +16,11 @@
#define DEFAULT_WIDTH 1280
#define DEFAULT_HEIGHT 720
class Window
class GameWindow
{
public:
static inline SDL_Window* s_pWindow;
static inline HWND s_handle;
static inline plume::RenderWindow s_renderWindow;
static inline int s_x;
static inline int s_y;
@@ -88,7 +89,7 @@ public:
: 19; // DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1
const DWORD useImmersiveDarkMode = isEnabled;
DwmSetWindowAttribute(s_handle, flag, &useImmersiveDarkMode, sizeof(useImmersiveDarkMode));
DwmSetWindowAttribute(s_renderWindow, flag, &useImmersiveDarkMode, sizeof(useImmersiveDarkMode));
#endif
}
@@ -109,7 +110,7 @@ public:
SDL_SetWindowFullscreen(s_pWindow, 0);
SDL_ShowCursor(SDL_ENABLE);
SetIcon(Window::s_isIconNight);
SetIcon(GameWindow::s_isIconNight);
SetDimensions(Config::WindowWidth, Config::WindowHeight, Config::WindowX, Config::WindowY);
}
@@ -198,6 +199,10 @@ public:
if (Config::Fullscreen)
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
#ifdef SDL_VULKAN_ENABLED
flags |= SDL_WINDOW_VULKAN;
#endif
return flags;
}
@@ -298,6 +303,6 @@ public:
return false;
}
static void Init();
static void Init(bool sdlVideoDefault);
static void Update();
};
+86 -55
View File
@@ -13,7 +13,7 @@
#include <ui/button_guide.h>
#include <ui/message_window.h>
#include <ui/sdl_listener.h>
#include <ui/window.h>
#include <ui/game_window.h>
#include <decompressor.h>
#include <res/images/installer/install_001.dds.h>
@@ -96,7 +96,7 @@ static double g_appearTime = 0.0;
static double g_disappearTime = DBL_MAX;
static bool g_isDisappearing = false;
static std::filesystem::path g_installPath = ".";
static std::filesystem::path g_installPath;
static std::filesystem::path g_gameSourcePath;
static std::filesystem::path g_updateSourcePath;
static std::array<std::filesystem::path, int(DLC::Count)> g_dlcSourcePaths;
@@ -133,8 +133,13 @@ static WizardPage g_firstPage = WizardPage::SelectLanguage;
static WizardPage g_currentPage = g_firstPage;
static std::string g_currentMessagePrompt = "";
static bool g_currentMessagePromptConfirmation = false;
static std::list<std::filesystem::path> g_currentPickerResults;
static std::atomic<bool> g_currentPickerResultsReady = false;
static std::string g_currentPickerErrorMessage;
static std::unique_ptr<std::thread> g_currentPickerThread;
static bool g_currentPickerVisible = false;
static bool g_currentPickerFolderMode = false;
static int g_currentMessageResult = -1;
static bool g_filesPickerSkipUpdate = false;
static ImVec2 g_joypadAxis = {};
static int g_currentCursorIndex = -1;
static int g_currentCursorDefault = 0;
@@ -148,7 +153,7 @@ public:
{
constexpr float AxisValueRange = 32767.0f;
constexpr float AxisTapRange = 0.5f;
if (!InstallerWizard::s_isVisible || !g_currentMessagePrompt.empty())
if (!InstallerWizard::s_isVisible || !g_currentMessagePrompt.empty() || g_currentPickerVisible)
{
return;
}
@@ -217,7 +222,7 @@ public:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEMOTION:
{
for (size_t i = 0; i < g_currentCursorRects.size() && !g_filesPickerSkipUpdate; i++)
for (size_t i = 0; i < g_currentCursorRects.size(); i++)
{
auto &currentRect = g_currentCursorRects[i];
if (ImGui::IsMouseHoveringRect(currentRect.first, currentRect.second, false))
@@ -734,7 +739,7 @@ static void DrawButton(ImVec2 min, ImVec2 max, const char *buttonText, bool sour
int baser = 0;
int baseg = 0;
if (g_currentMessagePrompt.empty() && !sourceButton && buttonEnabled && (alpha >= 1.0f))
if (g_currentMessagePrompt.empty() && !g_currentPickerVisible && !sourceButton && buttonEnabled && (alpha >= 1.0f))
{
bool cursorOnButton = PushCursorRect(min, max, buttonPressed, makeDefault);
if (cursorOnButton)
@@ -868,58 +873,65 @@ static bool ConvertPathSet(const nfdpathset_t *pathSet, std::list<std::filesyste
for (nfdpathsetsize_t i = 0; i < pathSetCount; i++)
{
char *pathSetPath = nullptr;
if (NFD_PathSet_GetPathU8(pathSet, i, &pathSetPath) != NFD_OKAY)
nfdnchar_t *pathSetPath = nullptr;
if (NFD_PathSet_GetPathN(pathSet, i, &pathSetPath) != NFD_OKAY)
{
filePaths.clear();
return false;
}
filePaths.emplace_back(std::filesystem::path(std::u8string_view((const char8_t *)(pathSetPath))));
NFD_PathSet_FreePathU8(pathSetPath);
filePaths.emplace_back(std::filesystem::path(pathSetPath));
NFD_PathSet_FreePathN(pathSetPath);
}
return true;
}
static bool ShowFilesPicker(std::list<std::filesystem::path> &filePaths)
static void PickerThreadProcess()
{
filePaths.clear();
const nfdpathset_t *pathSet;
nfdresult_t result = NFD_OpenDialogMultipleU8(&pathSet, nullptr, 0, nullptr);
g_filesPickerSkipUpdate = true;
if (result == NFD_OKAY)
nfdresult_t result = NFD_ERROR;
if (g_currentPickerFolderMode)
{
bool pathsConverted = ConvertPathSet(pathSet, filePaths);
NFD_PathSet_Free(pathSet);
return pathsConverted;
result = NFD_PickFolderMultipleN(&pathSet, nullptr);
}
else
{
return false;
result = NFD_OpenDialogMultipleN(&pathSet, nullptr, 0, nullptr);
}
if (result == NFD_OKAY)
{
bool pathsConverted = ConvertPathSet(pathSet, g_currentPickerResults);
NFD_PathSet_Free(pathSet);
}
else if (result == NFD_ERROR)
{
g_currentPickerErrorMessage = NFD_GetError();
}
g_currentPickerResultsReady = true;
}
static bool ShowFoldersPicker(std::list<std::filesystem::path> &folderPaths)
static void ShowPicker(bool folderMode)
{
folderPaths.clear();
const nfdpathset_t *pathSet;
nfdresult_t result = NFD_PickFolderMultipleU8(&pathSet, nullptr);
g_filesPickerSkipUpdate = true;
if (result == NFD_OKAY)
if (g_currentPickerThread != nullptr)
{
bool pathsConverted = ConvertPathSet(pathSet, folderPaths);
NFD_PathSet_Free(pathSet);
return pathsConverted;
g_currentPickerThread->join();
g_currentPickerThread.reset();
}
g_currentPickerResults.clear();
g_currentPickerFolderMode = folderMode;
g_currentPickerResultsReady = false;
g_currentPickerVisible = true;
// Optional single thread mode for testing on systems that do not interact well with the separate thread being used for NFD.
constexpr bool singleThreadMode = false;
if (singleThreadMode)
PickerThreadProcess();
else
{
return false;
}
g_currentPickerThread = std::make_unique<std::thread>(PickerThreadProcess);
}
static void ParseSourcePaths(std::list<std::filesystem::path> &paths)
@@ -973,7 +985,8 @@ static void ParseSourcePaths(std::list<std::filesystem::path> &paths)
stringStream << Localise("Installer_Message_InvalidFilesList") << std::endl;
for (const std::filesystem::path &path : failedPaths)
{
stringStream << std::endl << "- " << Truncate(path.filename().string(), 32, true, true);
std::u8string filenameU8 = path.filename().u8string();
stringStream << std::endl << "- " << Truncate(std::string(filenameU8.begin(), filenameU8.end()), 32, true, true);
}
if (isFailedPathsOverLimit)
@@ -1012,8 +1025,6 @@ static void DrawLanguagePicker()
static void DrawSourcePickers()
{
g_filesPickerSkipUpdate = false;
bool buttonPressed = false;
std::list<std::filesystem::path> paths;
if (g_currentPage == WizardPage::SelectGameAndUpdate || g_currentPage == WizardPage::SelectDLC)
@@ -1027,9 +1038,9 @@ static void DrawSourcePickers()
ImVec2 min = { Scale(AlignToNextGrid(CONTAINER_X) + BOTTOM_X_GAP), Scale(AlignToNextGrid(CONTAINER_Y + CONTAINER_HEIGHT) + BOTTOM_Y_GAP) };
ImVec2 max = { Scale(AlignToNextGrid(CONTAINER_X) + BOTTOM_X_GAP + textSize.x * squashRatio), Scale(AlignToNextGrid(CONTAINER_Y + CONTAINER_HEIGHT) + BOTTOM_Y_GAP + BUTTON_HEIGHT) };
DrawButton(min, max, addFilesText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
if (buttonPressed && ShowFilesPicker(paths))
if (buttonPressed)
{
ParseSourcePaths(paths);
ShowPicker(false);
}
min.x += Scale(BOTTOM_X_GAP + textSize.x * squashRatio);
@@ -1040,9 +1051,9 @@ static void DrawSourcePickers()
max.x = min.x + Scale(textSize.x * squashRatio);
DrawButton(min, max, addFolderText.c_str(), false, true, buttonPressed, ADD_BUTTON_MAX_TEXT_WIDTH);
if (buttonPressed && ShowFoldersPicker(paths))
if (buttonPressed)
{
ParseSourcePaths(paths);
ShowPicker(true);
}
}
}
@@ -1304,14 +1315,6 @@ static void DrawBorders()
static void DrawMessagePrompt()
{
if (g_filesPickerSkipUpdate)
{
// If a blocking function like the files picker is called, we must wait one update before actually showing
// the message box, as a lot of time has passed since the last real update. Otherwise, animations will play
// too quickly and input glitches might happen.
return;
}
if (g_currentMessagePrompt.empty())
{
return;
@@ -1341,6 +1344,25 @@ static void DrawMessagePrompt()
}
}
static void CheckPickerResults()
{
if (!g_currentPickerResultsReady)
{
return;
}
if (!g_currentPickerErrorMessage.empty())
{
g_currentMessagePrompt = g_currentPickerErrorMessage;
g_currentMessagePromptConfirmation = false;
g_currentPickerErrorMessage.clear();
}
ParseSourcePaths(g_currentPickerResults);
g_currentPickerResultsReady = false;
g_currentPickerVisible = false;
}
void InstallerWizard::Init()
{
auto &io = ImGui::GetIO();
@@ -1379,6 +1401,7 @@ void InstallerWizard::Draw()
DrawNextButton();
DrawBorders();
DrawMessagePrompt();
CheckPickerResults();
if (g_isDisappearing)
{
@@ -1392,13 +1415,19 @@ void InstallerWizard::Draw()
void InstallerWizard::Shutdown()
{
// Wait for and erase the thread.
// Wait for and erase the threads.
if (g_installerThread != nullptr)
{
g_installerThread->join();
g_installerThread.reset();
}
if (g_currentPickerThread != nullptr)
{
g_currentPickerThread->join();
g_currentPickerThread.reset();
}
// Erase the sources.
g_installerSources.game.reset();
g_installerSources.update.reset();
@@ -1418,8 +1447,10 @@ void InstallerWizard::Shutdown()
}
}
bool InstallerWizard::Run(bool skipGame)
bool InstallerWizard::Run(std::filesystem::path installPath, bool skipGame)
{
g_installPath = installPath;
EmbeddedPlayer::Init();
NFD_Init();
@@ -1438,18 +1469,18 @@ bool InstallerWizard::Run(bool skipGame)
g_currentPage = g_firstPage;
}
Window::SetFullscreenCursorVisibility(true);
GameWindow::SetFullscreenCursorVisibility(true);
s_isVisible = true;
while (s_isVisible)
{
SDL_PumpEvents();
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
Window::Update();
GameWindow::Update();
Video::HostPresent();
}
Window::SetFullscreenCursorVisibility(false);
GameWindow::SetFullscreenCursorVisibility(false);
NFD_Quit();
InstallerWizard::Shutdown();
+1 -1
View File
@@ -9,5 +9,5 @@ struct InstallerWizard
static void Init();
static void Draw();
static void Shutdown();
static bool Run(bool skipGame);
static bool Run(std::filesystem::path installPath, bool skipGame);
};
+8 -8
View File
@@ -1,7 +1,7 @@
#include "options_menu.h"
#include "options_menu_thumbnails.h"
#include "imgui_utils.h"
#include "window.h"
#include "game_window.h"
#include "exports.h"
#include <api/SWA/System/InputState.h>
@@ -444,7 +444,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
ImVec2 min = { clipRectMin.x, clipRectMin.y + (optionHeight + optionPadding) * rowIndex + yOffset };
ImVec2 max = { min.x + optionWidth, min.y + optionHeight };
auto configName = config->GetNameLocalised();
auto configName = config->GetNameLocalised(Config::Language);
auto size = Scale(26.0f);
auto textSize = g_seuratFont->CalcTextSizeA(size, FLT_MAX, 0.0f, configName.c_str());
@@ -757,7 +757,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
}
else
{
valueText = config->GetValueLocalised();
valueText = config->GetValueLocalised(Config::Language);
}
size = Scale(20.0f);
@@ -837,7 +837,7 @@ static void DrawConfigOptions()
{
// TODO: expose WindowWidth/WindowHeight as WindowSize.
auto displayCount = Window::GetDisplayCount();
auto displayCount = GameWindow::GetDisplayCount();
auto canChangeMonitor = Config::Fullscreen && displayCount > 1;
auto monitorReason = &Localise("Options_Desc_NotAvailableWindowed");
@@ -978,7 +978,7 @@ static void DrawInfoPanel()
if (g_selectedItem)
{
auto desc = g_selectedItem->GetDescription();
auto desc = g_selectedItem->GetDescription(Config::Language);
auto thumbnail = GetThumbnail(g_selectedItem);
if (thumbnail)
@@ -997,13 +997,13 @@ static void DrawInfoPanel()
auto resScale = round(*(float*)g_selectedItem->GetValue() * 1000) / 1000;
std::snprintf(buf, sizeof(buf), desc.c_str(),
(int)((float)Window::s_width * resScale),
(int)((float)Window::s_height * resScale));
(int)((float)GameWindow::s_width * resScale),
(int)((float)GameWindow::s_height * resScale));
desc = buf;
}
desc += "\n\n" + g_selectedItem->GetValueDescription();
desc += "\n\n" + g_selectedItem->GetValueDescription(Config::Language);
}
auto size = Scale(26.0f);
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include <SDL.h>
#include "ui/window.h"
#include "ui/game_window.h"
#define SDL_USER_EVILSONIC (SDL_USEREVENT + 1)