Fixed building for both sdl and qt

This commit is contained in:
Dmugetsu 2025-02-15 01:41:01 -06:00
parent e26b08c8dc
commit 2d33b026bb
2 changed files with 9 additions and 10 deletions

View File

@ -107,9 +107,8 @@ Emulator::~Emulator() {
Config::saveMainWindow(config_dir / "config.toml"); Config::saveMainWindow(config_dir / "config.toml");
} }
void Emulator::Run(const std::filesystem::path& file, const std::vector<std::string> args) { void Core::Emulator::Run(const std::filesystem::path& file, const std::vector<std::string> args) {
isRunning = true; isRunning = true;
const auto eboot_name = file.filename().string(); const auto eboot_name = file.filename().string();
auto game_folder = file.parent_path(); auto game_folder = file.parent_path();
if (const auto game_folder_name = game_folder.filename().string(); if (const auto game_folder_name = game_folder.filename().string();
@ -351,9 +350,11 @@ QProcess::startDetached(emulatorPath, QStringList() << lastEbootPath);
QString emulatorPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QString emulatorPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) +
"/shadps4.app/Contents/MacOS/shadps4"; "/shadps4.app/Contents/MacOS/shadps4";
QProcess::startDetached(emulatorPath, QStringList() << lastEbootPath); QProcess::startDetached(emulatorPath, QStringList() << lastEbootPath);
isRunning = true;
isRunning = true;
#endif #endif
} } // namespace Core
void Core::Emulator::LoadSystemModules(const std::string& game_serial) { void Core::Emulator::LoadSystemModules(const std::string& game_serial) {
constexpr std::array<SysModules, 11> ModulesToLoad{ constexpr std::array<SysModules, 11> ModulesToLoad{
@ -401,7 +402,7 @@ void Core::Emulator::LoadSystemModules(const std::string& game_serial) {
} }
#ifdef ENABLE_QT_GUI #ifdef ENABLE_QT_GUI
void Emulator::UpdatePlayTime(const std::string& serial) { void Core::Emulator::UpdatePlayTime(const std::string& serial) const {
const auto user_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir); const auto user_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
QString filePath = QString::fromStdString((user_dir / "play_time.txt").string()); QString filePath = QString::fromStdString((user_dir / "play_time.txt").string());
@ -468,6 +469,5 @@ void Emulator::UpdatePlayTime(const std::string& serial) {
} }
LOG_INFO(Loader, "Playing time for {}: {}", serial, playTimeSaved.toStdString()); LOG_INFO(Loader, "Playing time for {}: {}", serial, playTimeSaved.toStdString());
} }
}
#endif #endif
} // namespace Core

View File

@ -29,12 +29,11 @@ public:
~Emulator(); ~Emulator();
void Run(const std::filesystem::path& file, const std::vector<std::string> args = {}); void Run(const std::filesystem::path& file, const std::vector<std::string> args = {});
void UpdatePlayTime(const std::string& serial); void UpdatePlayTime(const std::string& serial) const;
static Emulator& GetInstance(); static Emulator& GetInstance();
void StopEmulation(); void StopEmulation();
bool is_running = false; bool is_running = false;
void Restart(); void Restart();
void Shutdown();
private: private:
void LoadSystemModules(const std::string& game_serial); void LoadSystemModules(const std::string& game_serial);