some more draft work

This commit is contained in:
georgemoralis 2025-06-13 17:51:45 +03:00
parent 6c64deecde
commit 4bccf7a2db
6 changed files with 61 additions and 0 deletions

View file

@ -794,6 +794,8 @@ set(CORE src/core/aerolib/stubs.cpp
src/core/thread.h
src/core/tls.cpp
src/core/tls.h
src/core/user_account.cpp
src/core/user_account.h
)
if (ARCHITECTURE STREQUAL "x86_64")

View file

@ -74,7 +74,12 @@ static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false;
static std::string trophyKey;
static bool isPSNSignedIn = false;
std::string userid{"00000001"};
std::string selectedUserid{"00000001"};
std::string getDefaultUserId() {
return userid;
}
// Gui
static bool load_game_size = true;
static std::vector<GameInstallDir> settings_install_dirs = {};

View file

@ -34,6 +34,7 @@ bool getEnableDiscordRPC();
bool getCompatibilityEnabled();
bool getCheckCompatibilityOnStartup();
bool getPSNSignedIn();
std::string getDefaultUserId();
std::string getLogFilter();
std::string getLogType();

18
src/core/user_account.cpp Normal file
View file

@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <filesystem>
#include "user_account.h"
user_account::user_account(const std::string& user_id) {
// Setting userId.
m_user_id = user_id;
// TODO
}
std::map<u32, user_account> user_account::GetUserAccounts(const std::string& base_dir) {
std::map<u32, user_account> user_list;
// TODO
return user_list;
}

29
src/core/user_account.h Normal file
View file

@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <map>
#include <string>
#include "common/types.h"
class user_account {
public:
explicit user_account(const std::string& user_id = "00000001");
const std::string& GetUserId() const {
return m_user_id;
}
const std::string& GetUserDir() const {
return m_user_dir;
}
const std::string& GetUsername() const {
return m_username;
}
static std::map<u32, user_account> GetUserAccounts(const std::string& base_dir);
private:
std::string m_user_id;
std::string m_user_dir;
std::string m_username;
};

View file

@ -32,6 +32,12 @@ int main(int argc, char* argv[]) {
const auto user_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::load(user_dir / "config.toml");
const auto& default_user_dir =
Common::FS::GetUserPath(Common::FS::PathType::HomeDir) / Config::getDefaultUserId();
if (!std::filesystem::exists(default_user_dir)) {
std::filesystem::create_directory(default_user_dir);
}
bool has_command_line_argument = argc > 1;
bool show_gui = false, has_game_argument = false;
std::string game_path;