Ability to change username (#432)

This commit is contained in:
¥IGA 2024-08-15 11:33:10 +02:00 committed by GitHub
parent 9adc638220
commit 8c77d4dde6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 39 additions and 31 deletions

View File

@ -107,7 +107,7 @@ if(ENABLE_QT_GUI)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
endif() endif()
set(AUDIO_CORE src/audio_core/sdl_audio.cpp set(AUDIO_CORE src/audio_core/sdl_audio.cpp
src/audio_core/sdl_audio.h src/audio_core/sdl_audio.h
) )
@ -527,34 +527,33 @@ set(EMULATOR src/emulator.cpp
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
qt_add_resources(RESOURCE_FILES src/shadps4.qrc) qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
set(QT_GUI set(QT_GUI src/qt_gui/main_window_ui.h
src/qt_gui/main_window_ui.h src/qt_gui/main_window.cpp
src/qt_gui/main_window.cpp src/qt_gui/main_window.h
src/qt_gui/main_window.h src/qt_gui/gui_context_menus.h
src/qt_gui/gui_context_menus.h src/qt_gui/game_list_utils.h
src/qt_gui/game_list_utils.h src/qt_gui/game_info.cpp
src/qt_gui/game_info.cpp src/qt_gui/game_info.h
src/qt_gui/game_info.h src/qt_gui/game_list_frame.cpp
src/qt_gui/game_list_frame.cpp src/qt_gui/game_list_frame.h
src/qt_gui/game_list_frame.h src/qt_gui/game_grid_frame.cpp
src/qt_gui/game_grid_frame.cpp src/qt_gui/game_grid_frame.h
src/qt_gui/game_grid_frame.h src/qt_gui/game_install_dialog.cpp
src/qt_gui/game_install_dialog.cpp src/qt_gui/game_install_dialog.h
src/qt_gui/game_install_dialog.h src/qt_gui/pkg_viewer.cpp
src/qt_gui/pkg_viewer.cpp src/qt_gui/pkg_viewer.h
src/qt_gui/pkg_viewer.h src/qt_gui/trophy_viewer.cpp
src/qt_gui/trophy_viewer.cpp src/qt_gui/trophy_viewer.h
src/qt_gui/trophy_viewer.h src/qt_gui/elf_viewer.cpp
src/qt_gui/elf_viewer.cpp src/qt_gui/elf_viewer.h
src/qt_gui/elf_viewer.h src/qt_gui/main_window_themes.cpp
src/qt_gui/main_window_themes.cpp src/qt_gui/main_window_themes.h
src/qt_gui/main_window_themes.h src/qt_gui/settings_dialog.cpp
src/qt_gui/settings_dialog.cpp src/qt_gui/settings_dialog.h
src/qt_gui/settings_dialog.h src/qt_gui/settings_dialog.ui
src/qt_gui/settings_dialog.ui src/qt_gui/main.cpp
src/qt_gui/main.cpp ${EMULATOR}
${EMULATOR} ${RESOURCE_FILES}
${RESOURCE_FILES}
) )
endif() endif()

View File

@ -16,6 +16,7 @@ static u32 screenHeight = 720;
static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto select static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto select
static std::string logFilter; static std::string logFilter;
static std::string logType = "async"; static std::string logType = "async";
static std::string userName = "shadPS4";
static bool isDebugDump = false; static bool isDebugDump = false;
static bool isLibc = true; static bool isLibc = true;
static bool isShowSplash = false; static bool isShowSplash = false;
@ -80,6 +81,10 @@ std::string getLogType() {
return logType; return logType;
} }
std::string getUserName() {
return userName;
}
bool debugDump() { bool debugDump() {
return isDebugDump; return isDebugDump;
} }
@ -313,6 +318,7 @@ void load(const std::filesystem::path& path) {
isFullscreen = toml::find_or<bool>(general, "Fullscreen", false); isFullscreen = toml::find_or<bool>(general, "Fullscreen", false);
logFilter = toml::find_or<std::string>(general, "logFilter", ""); logFilter = toml::find_or<std::string>(general, "logFilter", "");
logType = toml::find_or<std::string>(general, "logType", "sync"); logType = toml::find_or<std::string>(general, "logType", "sync");
userName = toml::find_or<std::string>(general, "userName", "shadPS4");
isShowSplash = toml::find_or<bool>(general, "showSplash", true); isShowSplash = toml::find_or<bool>(general, "showSplash", true);
} }
@ -400,6 +406,7 @@ void save(const std::filesystem::path& path) {
data["General"]["Fullscreen"] = isFullscreen; data["General"]["Fullscreen"] = isFullscreen;
data["General"]["logFilter"] = logFilter; data["General"]["logFilter"] = logFilter;
data["General"]["logType"] = logType; data["General"]["logType"] = logType;
data["General"]["userName"] = userName;
data["General"]["showSplash"] = isShowSplash; data["General"]["showSplash"] = isShowSplash;
data["GPU"]["screenWidth"] = screenWidth; data["GPU"]["screenWidth"] = screenWidth;
data["GPU"]["screenHeight"] = screenHeight; data["GPU"]["screenHeight"] = screenHeight;

View File

@ -15,6 +15,7 @@ bool isNeoMode();
bool isFullscreenMode(); bool isFullscreenMode();
std::string getLogFilter(); std::string getLogFilter();
std::string getLogType(); std::string getLogType();
std::string getUserName();
u32 getScreenWidth(); u32 getScreenWidth();
u32 getScreenHeight(); u32 getScreenHeight();

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator // Generated By moduleGenerator
#include "common/config.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
@ -977,7 +978,7 @@ int PS4_SYSV_ABI sceNpGetGamePresenceStatusA() {
int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId userId, OrbisNpId* npId) { int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId userId, OrbisNpId* npId) {
LOG_ERROR(Lib_NpManager, "(DUMMY) called"); LOG_ERROR(Lib_NpManager, "(DUMMY) called");
std::string name = "shadps4"; std::string name = Config::getUserName();
strcpy(npId->handle.data, name.c_str()); strcpy(npId->handle.data, name.c_str());
return ORBIS_OK; return ORBIS_OK;
} }

View File

@ -10,6 +10,7 @@
#include "common/ntapi.h" #include "common/ntapi.h"
#include "common/path_util.h" #include "common/path_util.h"
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "common/scm_rev.h"
#include "common/singleton.h" #include "common/singleton.h"
#include "common/version.h" #include "common/version.h"
#include "core/file_format/playgo_chunk.h" #include "core/file_format/playgo_chunk.h"
@ -26,7 +27,6 @@
#include "core/linker.h" #include "core/linker.h"
#include "core/memory.h" #include "core/memory.h"
#include "emulator.h" #include "emulator.h"
#include "src/common/scm_rev.h"
#include "video_core/renderdoc.h" #include "video_core/renderdoc.h"
Frontend::WindowSDL* g_window = nullptr; Frontend::WindowSDL* g_window = nullptr;