mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-24 12:56:53 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b02eb28fd1 | |||
| 07f1e77d23 | |||
| 6980e0863d | |||
| 42bfeec2e9 | |||
| 795743ce22 | |||
| ccddd6fb94 |
@@ -22,6 +22,7 @@ void Shutdown() {
|
||||
void Load(const ConfigOptions& cfg) {
|
||||
EXIT_IF(g_config == nullptr);
|
||||
EXIT_IF(cfg.user_name.empty() || cfg.user_name.size() > MAX_USER_NAME_LENGTH);
|
||||
EXIT_IF(!IsConfiguredUserIdValid(cfg.user_id));
|
||||
|
||||
*g_config = cfg;
|
||||
}
|
||||
@@ -38,6 +39,10 @@ const std::string& GetUserName() {
|
||||
return g_config->user_name;
|
||||
}
|
||||
|
||||
int32_t GetUserId() {
|
||||
return g_config->user_id;
|
||||
}
|
||||
|
||||
PresentMode GetPresentMode() {
|
||||
return g_config->present_mode;
|
||||
}
|
||||
|
||||
@@ -34,11 +34,19 @@ using Keymap = std::vector<std::string>;
|
||||
constexpr uint32_t DEFAULT_CONSOLE_LANGUAGE = 1;
|
||||
constexpr uint32_t MAX_CONSOLE_LANGUAGE = 29;
|
||||
constexpr std::size_t MAX_USER_NAME_LENGTH = 16;
|
||||
constexpr int32_t DEFAULT_USER_ID = 1000;
|
||||
|
||||
constexpr bool IsConfiguredUserIdValid(int32_t user_id) {
|
||||
constexpr int32_t USER_ID_EVERYONE = 0xfe;
|
||||
constexpr int32_t USER_ID_SYSTEM = 0xff;
|
||||
return user_id >= 0 && user_id != USER_ID_EVERYONE && user_id != USER_ID_SYSTEM;
|
||||
}
|
||||
|
||||
struct ConfigOptions {
|
||||
uint32_t screen_width = 1280;
|
||||
uint32_t screen_height = 720;
|
||||
std::string user_name = "Kyty";
|
||||
int32_t user_id = DEFAULT_USER_ID;
|
||||
PresentMode present_mode = PresentMode::Fifo;
|
||||
bool fullscreen_enabled = false;
|
||||
uint32_t vblank_frequency = 60;
|
||||
@@ -70,6 +78,7 @@ void Load(const ConfigOptions& cfg);
|
||||
uint32_t GetScreenWidth();
|
||||
uint32_t GetScreenHeight();
|
||||
const std::string& GetUserName();
|
||||
int32_t GetUserId();
|
||||
PresentMode GetPresentMode();
|
||||
bool FullscreenEnabled();
|
||||
uint32_t GetVblankFrequency();
|
||||
|
||||
@@ -200,6 +200,10 @@ void Run(const RunOptions& options) {
|
||||
int ok = atexit(KytyClose);
|
||||
EXIT_NOT_IMPLEMENTED(ok != 0);
|
||||
|
||||
// Guest threads are still running, so skip KytyClose() and only flush emergency state.
|
||||
ok = at_quick_exit(Common::Subsystems::EmergencyShutdownActive);
|
||||
EXIT_NOT_IMPLEMENTED(ok != 0);
|
||||
|
||||
Libs::LibKernel::FileSystem::Mount(options.app0_dir, "/app0");
|
||||
Libs::LibKernel::FileSystem::Mount(options.app0_dir, "/hostapp");
|
||||
|
||||
|
||||
@@ -84,17 +84,8 @@ void uc_print(const char* func, const HW::UserConfig& uc) {
|
||||
}
|
||||
|
||||
void uc_check(const HW::UserConfig& uc) {
|
||||
const auto& ge_cntl = uc.GetGeControl();
|
||||
const auto& user_en = uc.GetGeUserVgprEn();
|
||||
|
||||
if (ge_cntl.primitive_group_size > 0x0040) {
|
||||
LOGF("\t warning: unsupported GE_CNTL primitive_group_size = 0x%04" PRIx16 "\n",
|
||||
ge_cntl.primitive_group_size);
|
||||
}
|
||||
if (ge_cntl.vertex_group_size > 0x0040) {
|
||||
LOGF("\t warning: unsupported GE_CNTL vertex_group_size = 0x%04" PRIx16 "\n",
|
||||
ge_cntl.vertex_group_size);
|
||||
}
|
||||
EXIT_NOT_IMPLEMENTED(user_en.vgpr1 != false);
|
||||
EXIT_NOT_IMPLEMENTED(user_en.vgpr2 != false);
|
||||
EXIT_NOT_IMPLEMENTED(user_en.vgpr3 != false);
|
||||
|
||||
@@ -450,15 +450,14 @@ static bool ShouldSkipGeShader(const CommandBuffer& buffer) {
|
||||
const bool unsupported_stage_mask = (stages != 0 && stages != 0x02002000);
|
||||
const bool unsupported_gs_stage = (vertex_info.es_regs.data_addr != 0 &&
|
||||
vertex_info.gs_regs.data_addr != 0 && !ps5_ngg_vertex_path);
|
||||
const bool ge_group_size =
|
||||
ge_cntl.primitive_group_size > 0x0040 || ge_cntl.vertex_group_size > 0x0040;
|
||||
// GE_CNTL group sizes control guest scheduling and do not constrain the host vertex path.
|
||||
const bool ge_shader_regs =
|
||||
(sh_regs.m_geNggSubgrpCntl != 0x00000000 && sh_regs.m_geNggSubgrpCntl != 0x00000001) ||
|
||||
sh_regs.m_vgtGsMaxVertOut != 0x00000000 ||
|
||||
!is_known_gs_out_prim_type(sh_regs.m_vgtGsOutPrimType) ||
|
||||
sh_regs.m_geMaxOutputPerSubgroup > 0x00000040;
|
||||
|
||||
if (unsupported_stage_mask || unsupported_gs_stage || ge_group_size || ge_shader_regs) {
|
||||
if (unsupported_stage_mask || unsupported_gs_stage || ge_shader_regs) {
|
||||
static std::once_flag warning_once;
|
||||
std::call_once(warning_once, [] {
|
||||
std::printf("Warning: game uses unsupported graphics pipelines; some draw calls were "
|
||||
|
||||
@@ -940,8 +940,8 @@ constexpr Vop2SdwaRule VOP2_SDWA_RULES[] = {
|
||||
true, true},
|
||||
{SdwaSelFull(), SdwaSelAll(), SdwaSelAll(), false, false},
|
||||
{SdwaSelAll(), SdwaSelAll(), SdwaSelAll(), true, false},
|
||||
{SdwaSelFull(), SdwaSelFull(), SdwaSelWords() | SdwaSelFull(), false, false},
|
||||
{SdwaSelFull(), SdwaSelFull(), SdwaSelAll(), false, false},
|
||||
{SdwaSelFull(), SdwaSelAll(), SdwaSelWords() | SdwaSelFull(), false, false},
|
||||
{SdwaSelFull(), SdwaSelAll(), SdwaSelAll(), false, false},
|
||||
{SdwaSelWords() | SdwaSelFull(), SdwaSelAll(), SdwaSelAll(), true, false},
|
||||
};
|
||||
static_assert(sizeof(VOP2_SDWA_RULES) / sizeof(VOP2_SDWA_RULES[0]) ==
|
||||
|
||||
@@ -119,41 +119,58 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_user_id">
|
||||
<property name="text">
|
||||
<string>User ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_user_id">
|
||||
<property name="toolTip">
|
||||
<string>Local user ID exposed to games</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2147483647</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Screen resolution:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBox_screen_resolution">
|
||||
<property name="toolTip">
|
||||
<string>Window resolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_present_mode">
|
||||
<property name="text">
|
||||
<string>Present mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBox_present_mode">
|
||||
<property name="toolTip">
|
||||
<string>Vulkan swapchain presentation mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_vblank_frequency">
|
||||
<property name="text">
|
||||
<string>Vblank frequency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_vblank_frequency">
|
||||
<property name="toolTip">
|
||||
<string>Virtual display refresh rate used for frame pacing</string>
|
||||
@@ -169,56 +186,56 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_console_language">
|
||||
<property name="text">
|
||||
<string>Console language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboBox_console_language">
|
||||
<property name="toolTip">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_20">
|
||||
<property name="text">
|
||||
<string>Shader optimization type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="comboBox_shader_optimization_type">
|
||||
<property name="toolTip">
|
||||
<string>Optimize shaders for code size or performance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
<string>Shader log direction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="comboBox_shader_log_direction">
|
||||
<property name="toolTip">
|
||||
<string>Dump shaders to file or console window. If enabled may decrease emulator performance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Shader log folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="MandatoryLineEdit" name="lineEdit_shader_log_folder">
|
||||
<property name="toolTip">
|
||||
<string>Specify directory to dump shaders</string>
|
||||
@@ -228,14 +245,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Command buffer dump folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="MandatoryLineEdit" name="lineEdit_cmd_dump_folder">
|
||||
<property name="toolTip">
|
||||
<string>Specify directory to dump command buffers</string>
|
||||
@@ -245,28 +262,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Printf direction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="comboBox_printf_direction">
|
||||
<property name="toolTip">
|
||||
<string>Print logs to file or console window. If enabled may decrease emulator performance</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Printf output file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="MandatoryLineEdit" name="lineEdit_printf_file">
|
||||
<property name="toolTip">
|
||||
<string>Specify file to dump logs</string>
|
||||
@@ -276,14 +293,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Profiler direction:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QComboBox" name="comboBox_profiler_direction">
|
||||
<property name="toolTip">
|
||||
<string>Enable or disable profiler. If enabled may decrease emulator performance</string>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LAUNCHER_INCLUDE_CONFIGURATION_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "common/emulatorConfig.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QChar>
|
||||
@@ -91,6 +92,7 @@ public:
|
||||
|
||||
Resolution screen_resolution = Resolution::R1280X720;
|
||||
QString user_name = "Kyty";
|
||||
int user_id = Config::DEFAULT_USER_ID;
|
||||
PresentMode present_mode = PresentMode::Fifo;
|
||||
bool fullscreen_enabled = false;
|
||||
int vblank_frequency = 60;
|
||||
@@ -116,6 +118,7 @@ public:
|
||||
void CopyEmulatorSettingsFrom(const Configuration& other) {
|
||||
screen_resolution = other.screen_resolution;
|
||||
user_name = other.user_name;
|
||||
user_id = other.user_id;
|
||||
present_mode = other.present_mode;
|
||||
fullscreen_enabled = other.fullscreen_enabled;
|
||||
vblank_frequency = other.vblank_frequency;
|
||||
@@ -158,6 +161,7 @@ public:
|
||||
KYTY_CFG_SET(custom_settings);
|
||||
KYTY_CFG_SET(screen_resolution);
|
||||
KYTY_CFG_SET(user_name);
|
||||
KYTY_CFG_SET(user_id);
|
||||
KYTY_CFG_SET(present_mode);
|
||||
KYTY_CFG_SET(fullscreen_enabled);
|
||||
KYTY_CFG_SET(vblank_frequency);
|
||||
@@ -186,7 +190,12 @@ public:
|
||||
KYTY_CFG_GET(game_path);
|
||||
KYTY_CFG_GET(custom_settings);
|
||||
KYTY_CFG_GET(screen_resolution);
|
||||
user_name = s->value("user_name", user_name).toString();
|
||||
user_name = s->value("user_name", user_name).toString();
|
||||
bool user_id_ok = false;
|
||||
auto saved_user_id = s->value("user_id", user_id).toInt(&user_id_ok);
|
||||
user_id = user_id_ok && Config::IsConfiguredUserIdValid(saved_user_id)
|
||||
? saved_user_id
|
||||
: Config::DEFAULT_USER_ID;
|
||||
KYTY_CFG_GET(present_mode);
|
||||
if (EnumToText(present_mode).isEmpty()) {
|
||||
present_mode = PresentMode::Fifo;
|
||||
|
||||
@@ -156,6 +156,7 @@ static void ListInit(QComboBox* combo, T value) {
|
||||
void ConfigurationEditDialog::Init(const Configuration& info) {
|
||||
m_ui->lineEdit_user_name->setMaxLength(static_cast<int>(Config::MAX_USER_NAME_LENGTH));
|
||||
m_ui->lineEdit_user_name->setText(info.user_name);
|
||||
m_ui->spinBox_user_id->setValue(info.user_id);
|
||||
ListInit(m_ui->comboBox_screen_resolution, info.screen_resolution);
|
||||
ListInit(m_ui->comboBox_present_mode, info.present_mode);
|
||||
m_ui->checkBox_fullscreen->setChecked(info.fullscreen_enabled);
|
||||
@@ -289,6 +290,7 @@ void ConfigurationEditDialog::moveEvent(QMoveEvent* event) {
|
||||
|
||||
static void UpdateInfo(Configuration& info, Ui::ConfigurationEditDialog& ui) {
|
||||
info.user_name = ui.lineEdit_user_name->text().trimmed();
|
||||
info.user_id = ui.spinBox_user_id->value();
|
||||
info.screen_resolution =
|
||||
TextToEnum<Configuration::Resolution>(ui.comboBox_screen_resolution->currentText());
|
||||
info.present_mode =
|
||||
@@ -337,6 +339,11 @@ void ConfigurationEditDialog::save() {
|
||||
return;
|
||||
}
|
||||
m_ui->lineEdit_user_name->setText(user_name);
|
||||
if (!Config::IsConfiguredUserIdValid(m_ui->spinBox_user_id->value())) {
|
||||
QMessageBox::critical(this, tr("Save failed"),
|
||||
tr("User ID cannot be 254 (everyone) or 255 (system)"));
|
||||
return;
|
||||
}
|
||||
|
||||
update_info();
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ static QStringList CreateEmulatorArgs(const Configuration& info) {
|
||||
args << "--screen-width" << r.at(0);
|
||||
args << "--screen-height" << r.at(1);
|
||||
args << "--user-name" << info.user_name;
|
||||
args << "--user-id" << QString::number(info.user_id);
|
||||
args << "--present-mode" << EnumToText(info.present_mode);
|
||||
if (info.fullscreen_enabled) {
|
||||
args << "--fullscreen";
|
||||
|
||||
+29
-2
@@ -1,7 +1,9 @@
|
||||
#include "libs/controller.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common.h"
|
||||
#include "common/emulatorConfig.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/stringUtils.h"
|
||||
#include "common/threads.h"
|
||||
@@ -21,6 +23,9 @@ LIB_NAME("Pad", "Pad");
|
||||
constexpr int PAD_ERROR_INVALID_ARG = -2137915391; /* 0x80920001 */
|
||||
constexpr int PAD_ERROR_INVALID_HANDLE = -2137915389; /* 0x80920003 */
|
||||
|
||||
// SDL limits rumble commands to 0xffff ms; zero strengths stop immediately.
|
||||
constexpr uint32_t RUMBLE_DURATION_MS = 0xffff;
|
||||
|
||||
struct PadControllerInformation {
|
||||
float touch_pixel_density;
|
||||
uint16_t touch_resolution_x;
|
||||
@@ -58,6 +63,7 @@ public:
|
||||
void Axis(int id, Axis axis, int value);
|
||||
void ResetInputState();
|
||||
void GetConnectionInfo(bool* flag, int* count);
|
||||
void SetVibration(uint8_t large_motor, uint8_t small_motor);
|
||||
void ReadState(ControllerState* state, bool* flag, int* count);
|
||||
int ReadStates(ControllerState* states, int states_num, bool* flag, int* count);
|
||||
|
||||
@@ -268,6 +274,25 @@ void GameController::ResetInputState() {
|
||||
AddState(state);
|
||||
}
|
||||
|
||||
void GameController::SetVibration(uint8_t large_motor, uint8_t small_motor) {
|
||||
Common::LockGuard lock(m_mutex);
|
||||
|
||||
if (m_active_id == HOST_INPUT_CONTROLLER_ID) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* pad = SDL_GameControllerFromInstanceID(static_cast<SDL_JoystickID>(m_active_id));
|
||||
if (pad == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto large = static_cast<uint16_t>(large_motor * 0x101U);
|
||||
const auto small = static_cast<uint16_t>(small_motor * 0x101U);
|
||||
if (SDL_GameControllerRumble(pad, large, small, RUMBLE_DURATION_MS) != 0) {
|
||||
LOGF("\t rumble failed: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
void GameController::GetConnectionInfo(bool* flag, int* count) {
|
||||
EXIT_IF(flag == nullptr);
|
||||
EXIT_IF(count == nullptr);
|
||||
@@ -358,13 +383,12 @@ int KYTY_SYSV_ABI PadInit() {
|
||||
}
|
||||
|
||||
static bool PadOpenArgsAreValid(int user_id, int type, int index) {
|
||||
constexpr int user_id_initial = 1000;
|
||||
constexpr int user_id_system = 0xff;
|
||||
constexpr int port_type_standard = 0;
|
||||
constexpr int port_type_special = 2;
|
||||
constexpr int port_type_remote = 16;
|
||||
const bool personal_port =
|
||||
user_id == user_id_initial && (type == port_type_standard || type == port_type_special);
|
||||
user_id == Config::GetUserId() && (type == port_type_standard || type == port_type_special);
|
||||
const bool system_remote_control = user_id == user_id_system && type == port_type_remote;
|
||||
return index == 0 && (personal_port || system_remote_control);
|
||||
}
|
||||
@@ -544,6 +568,9 @@ int KYTY_SYSV_ABI PadSetVibration(int handle, const PadVibrationParam* param) {
|
||||
"\t small_motor = %d\n",
|
||||
static_cast<int>(param->large_motor), static_cast<int>(param->small_motor));
|
||||
|
||||
EXIT_IF(g_controller == nullptr);
|
||||
g_controller->SetVibration(param->large_motor, param->small_motor);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,5 +1,6 @@
|
||||
#include "libs/dialog.h"
|
||||
|
||||
#include "common/emulatorConfig.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/stringUtils.h"
|
||||
#include "libs/errno.h"
|
||||
@@ -41,7 +42,6 @@ constexpr int LOGIN_RESULT_OK = 0;
|
||||
constexpr int LOGIN_MODE_ALL_USERS = 0;
|
||||
constexpr int LOGIN_MODE_NOT_LOGGED_IN = 1;
|
||||
constexpr int LOGIN_USER_INVALID = -1;
|
||||
constexpr int LOGIN_USER_ID = 1000;
|
||||
|
||||
constexpr int LOGIN_ERROR_NOT_INITIALIZED = static_cast<int>(0x81340001u);
|
||||
constexpr int LOGIN_ERROR_ALREADY_INITIALIZED = static_cast<int>(0x81340002u);
|
||||
@@ -67,7 +67,7 @@ static_assert(sizeof(LoginDialogResult) == 16);
|
||||
static_assert(sizeof(LoginDialogParam) == 64);
|
||||
|
||||
static int g_login_status = LOGIN_STATUS_NONE;
|
||||
static int g_login_selected_user = LOGIN_USER_ID;
|
||||
static int g_login_selected_user = LOGIN_USER_INVALID;
|
||||
|
||||
int KYTY_SYSV_ABI LoginDialogInitialize() {
|
||||
PRINT_NAME();
|
||||
@@ -77,7 +77,7 @@ int KYTY_SYSV_ABI LoginDialogInitialize() {
|
||||
}
|
||||
|
||||
g_login_status = LOGIN_STATUS_INITIALIZED;
|
||||
g_login_selected_user = LOGIN_USER_ID;
|
||||
g_login_selected_user = Config::GetUserId();
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ int KYTY_SYSV_ABI LoginDialogTerminate() {
|
||||
}
|
||||
|
||||
g_login_status = LOGIN_STATUS_NONE;
|
||||
g_login_selected_user = LOGIN_USER_ID;
|
||||
g_login_selected_user = LOGIN_USER_INVALID;
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int KYTY_SYSV_ABI LoginDialogOpen(const void* param) {
|
||||
}
|
||||
|
||||
g_login_selected_user =
|
||||
p->initial_focus != LOGIN_USER_INVALID ? p->initial_focus : LOGIN_USER_ID;
|
||||
p->initial_focus != LOGIN_USER_INVALID ? p->initial_focus : Config::GetUserId();
|
||||
|
||||
LOGF("\t size = %d\n"
|
||||
"\t mode = %d\n"
|
||||
|
||||
+13
-13
@@ -56,7 +56,7 @@ static KYTY_SYSV_ABI int UserServiceGetInitialUser(int* user_id) {
|
||||
|
||||
EXIT_NOT_IMPLEMENTED(user_id == nullptr);
|
||||
|
||||
*user_id = 1000;
|
||||
*user_id = Config::GetUserId();
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static KYTY_SYSV_ABI int UserServiceGetEvent(SceUserServiceEvent* event) {
|
||||
if (!logged_in) {
|
||||
logged_in = true;
|
||||
event->event_type = UserServiceEventTypeLogin;
|
||||
event->user_id = 1000;
|
||||
event->user_id = Config::GetUserId();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static KYTY_SYSV_ABI int UserServiceGetLoginUserIdList(UserServiceLoginUserIdLis
|
||||
|
||||
EXIT_NOT_IMPLEMENTED(user_id_list == nullptr);
|
||||
|
||||
user_id_list->user_id[0] = 1000;
|
||||
user_id_list->user_id[0] = Config::GetUserId();
|
||||
user_id_list->user_id[1] = -1;
|
||||
user_id_list->user_id[2] = -1;
|
||||
user_id_list->user_id[3] = -1;
|
||||
@@ -92,7 +92,7 @@ static KYTY_SYSV_ABI int UserServiceGetLoginUserIdList(UserServiceLoginUserIdLis
|
||||
}
|
||||
|
||||
static KYTY_SYSV_ABI int UserServiceGetUserName(int user_id, char* name, size_t size) {
|
||||
EXIT_NOT_IMPLEMENTED(user_id != 1000);
|
||||
EXIT_NOT_IMPLEMENTED(user_id != Config::GetUserId());
|
||||
EXIT_NOT_IMPLEMENTED(size < 5);
|
||||
|
||||
const auto& user_name = Config::GetUserName();
|
||||
@@ -109,7 +109,7 @@ static KYTY_SYSV_ABI int UserServiceGetUserNumber(int user_id, int32_t* number)
|
||||
if (number == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ static KYTY_SYSV_ABI int UserServiceGetGamePresets(int user_id, UserServiceGameP
|
||||
if (presets == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ static KYTY_SYSV_ABI int UserServiceGetAccessibilityVibration(int user_id, int32
|
||||
if (vibration == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ static KYTY_SYSV_ABI int UserServiceGetAccessibilityTriggerEffect(int user_
|
||||
if (trigger_effect == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ static KYTY_SYSV_ABI int UserServiceGetAgeLevel(int user_id, uint32_t* age_level
|
||||
if (age_level == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ static KYTY_SYSV_ABI int UserServiceGetAccessibilityChatTranscription(int u
|
||||
if (chat_transcription == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ UserServiceGetAccessibilityPressAndHoldDelay(int user_id, int32_t* press_and_hol
|
||||
if (press_and_hold_delay == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ static KYTY_SYSV_ABI int UserServiceGetAccessibilityZoomEnabled(int user_id
|
||||
if (zoom_enabled == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ static KYTY_SYSV_ABI int UserServiceGetAccessibilityZoomFollowFocus(int use
|
||||
if (zoom_follow_focus == nullptr) {
|
||||
return USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
if (user_id != 1000) {
|
||||
if (user_id != Config::GetUserId()) {
|
||||
return USER_SERVICE_ERROR_NOT_LOGGED_IN;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ static void PrintUsage() {
|
||||
::printf(" --screen-height <num> Window height. Default: 720.\n");
|
||||
::printf(
|
||||
" --user-name <name> Local user name (1-16 bytes). Default: Kyty.\n");
|
||||
::printf(" --user-id <num> Local user ID. Default: %d.\n",
|
||||
Config::DEFAULT_USER_ID);
|
||||
::printf(" --present-mode <value> Fifo, Mailbox, or Immediate. Default: Fifo.\n");
|
||||
::printf(" --fullscreen Run in borderless desktop fullscreen.\n");
|
||||
::printf(" --vblank-frequency <num> Virtual vblank frequency. Default: 60.\n");
|
||||
@@ -125,6 +127,17 @@ static bool ParseConsoleLanguage(const std::string& value, uint32_t& out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ParseUserId(const std::string& value, int32_t& out) {
|
||||
int32_t user_id = 0;
|
||||
auto [end, error] = std::from_chars(value.data(), value.data() + value.size(), user_id);
|
||||
if (error != std::errc {} || end != value.data() + value.size() ||
|
||||
!Config::IsConfiguredUserIdValid(user_id)) {
|
||||
return false;
|
||||
}
|
||||
out = user_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_help) {
|
||||
show_help = false;
|
||||
|
||||
@@ -211,6 +224,11 @@ static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_he
|
||||
return false;
|
||||
}
|
||||
options.config.user_name = value;
|
||||
} else if (arg == "--user-id") {
|
||||
if (!ParseUserId(value, options.config.user_id)) {
|
||||
::printf("invalid user ID: %s\n", value.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (arg == "--present-mode") {
|
||||
if (!ParseEnum(value, options.config.present_mode)) {
|
||||
::printf("invalid present mode: %s\n", value.c_str());
|
||||
|
||||
@@ -4043,6 +4043,40 @@ void TestNewShaderDecoderArchitecture() {
|
||||
"decoder rejected or misdecoded captured partial-destination "
|
||||
"V_ADD_NC_U32");
|
||||
|
||||
const uint32_t vop2_sdwa_byte_shift[] = {
|
||||
0x2c0910f9u,
|
||||
0x86000613u, // v_lshrrev_b32 v4, v19.byte0, 8
|
||||
};
|
||||
Instruction byte_shift;
|
||||
Check(DecodeInstruction(vop2_sdwa_byte_shift, 0u, byte_shift, &error),
|
||||
error.c_str());
|
||||
Check(byte_shift.family == Family::VOP2 &&
|
||||
byte_shift.opcode == Opcode::V_LSHRREV_B32 &&
|
||||
byte_shift.word_count == 2u && byte_shift.dst.reg == 4u &&
|
||||
byte_shift.src0.kind == OperandKind::Vgpr &&
|
||||
byte_shift.src0.reg == 19u && byte_shift.src0.sdwa_sel == 0u &&
|
||||
byte_shift.src1.kind == OperandKind::IntegerInlineConstant &&
|
||||
byte_shift.src1.value == 8u,
|
||||
"decoder rejected or misdecoded captured V_LSHRREV_B32 byte shift");
|
||||
|
||||
const uint32_t vop2_sdwa_byte_left_shift[] = {
|
||||
0x340d02f9u,
|
||||
0x86030607u, // v_lshlrev_b32 v6, v7.byte3, 1
|
||||
};
|
||||
Instruction byte_left_shift;
|
||||
Check(DecodeInstruction(vop2_sdwa_byte_left_shift, 0u, byte_left_shift,
|
||||
&error),
|
||||
error.c_str());
|
||||
Check(byte_left_shift.family == Family::VOP2 &&
|
||||
byte_left_shift.opcode == Opcode::V_LSHLREV_B32 &&
|
||||
byte_left_shift.word_count == 2u && byte_left_shift.dst.reg == 6u &&
|
||||
byte_left_shift.src0.kind == OperandKind::Vgpr &&
|
||||
byte_left_shift.src0.reg == 7u &&
|
||||
byte_left_shift.src0.sdwa_sel == 3u &&
|
||||
byte_left_shift.src1.kind == OperandKind::IntegerInlineConstant &&
|
||||
byte_left_shift.src1.value == 1u,
|
||||
"decoder rejected or misdecoded captured V_LSHLREV_B32 byte shift");
|
||||
|
||||
const uint32_t mimg_nsa[] = {EncodeMimg0(0x20, 0xf) | (3u << 1u),
|
||||
EncodeMimg1(4, 0, 1, 8), 0x03020100u,
|
||||
0x07060504u, 0x0b0a0908u};
|
||||
|
||||
Reference in New Issue
Block a user