pcsx2/pcsx2-qt/QtHost.h

65 lines
2.7 KiB
C
Raw Normal View History

2021-12-13 12:12:54 +00:00
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2022 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "pcsx2/Host.h"
#include "pcsx2/HostDisplay.h"
#include "pcsx2/HostSettings.h"
#include "pcsx2/Frontend/InputManager.h"
#include "pcsx2/VMManager.h"
#include <QtCore/QMetaType>
2022-04-06 10:42:23 +00:00
#include <functional>
#include <memory>
#include <optional>
2021-12-13 12:12:54 +00:00
class SettingsInterface;
class EmuThread;
Q_DECLARE_METATYPE(std::shared_ptr<VMBootParameters>);
2022-04-06 10:42:23 +00:00
Q_DECLARE_METATYPE(std::optional<bool>);
Q_DECLARE_METATYPE(std::function<void()>);
Q_DECLARE_METATYPE(GSRendererType);
2021-12-13 12:12:54 +00:00
Q_DECLARE_METATYPE(InputBindingKey);
namespace QtHost
{
bool Initialize();
void Shutdown();
void UpdateFolders();
void UpdateLogging();
2022-04-06 10:49:00 +00:00
/// Executes a function on the UI thread.
void RunOnUIThread(const std::function<void()>& func, bool block = false);
2021-12-13 12:12:54 +00:00
/// Thread-safe settings access.
2022-03-25 12:16:21 +00:00
SettingsInterface* GetBaseSettingsInterface();
2021-12-13 12:12:54 +00:00
std::string GetBaseStringSettingValue(const char* section, const char* key, const char* default_value = "");
bool GetBaseBoolSettingValue(const char* section, const char* key, bool default_value = false);
int GetBaseIntSettingValue(const char* section, const char* key, int default_value = 0);
float GetBaseFloatSettingValue(const char* section, const char* key, float default_value = 0.0f);
std::vector<std::string> GetBaseStringListSetting(const char* section, const char* key);
void SetBaseBoolSettingValue(const char* section, const char* key, bool value);
void SetBaseIntSettingValue(const char* section, const char* key, int value);
void SetBaseFloatSettingValue(const char* section, const char* key, float value);
void SetBaseStringSettingValue(const char* section, const char* key, const char* value);
void SetBaseStringListSettingValue(const char* section, const char* key, const std::vector<std::string>& values);
bool AddBaseValueToStringList(const char* section, const char* key, const char* value);
bool RemoveBaseValueFromStringList(const char* section, const char* key, const char* value);
void RemoveBaseSettingValue(const char* section, const char* key);
2022-03-25 12:16:21 +00:00
void QueueSettingsSave();
2021-12-13 12:12:54 +00:00
} // namespace QtHost