Compare commits

...

6 Commits

Author SHA1 Message Date
Margen67 ed484956fd
Merge d1be412836 into 55bbb28a80 2025-01-17 19:25:21 +01:00
Marco Rodolfi 55bbb28a80 [threading] Linux fixes on setting an incorrect priority
This call was failing since SCHED_FIFO doesn't support negative priorities, but only positive ones, see third paragraph of scheduling policies: https://man7.org/linux/man-pages/man7/sched.7.html.

Additionally Linux do provice up to 99 levels, but I've limited myself to the required UNIX standard of 32, and split the priority levels evenly from that.

I've also added a couple of rows to debug additional issues in the future like this.
2025-01-17 09:56:43 +01:00
The-Little-Wolf 4d7b30e844 [Xam/XamUser] - Stub XamUserGetOnlineLanguageFromXUID
- Stubs XamUserGetOnlineLanguageFromXUID and have it return cvars::user_language
- Leave notes for future implementation once we have proper profile support
2025-01-17 08:32:46 +01:00
Adrian ae23222ba8 [Emulator] Validate module is an executable before launching 2025-01-17 08:04:49 +01:00
Adrian d99d053408 [Patcher] Replace stoi with from_string for parsing plugin title id 2025-01-16 15:08:20 +01:00
Margen67 d1be412836 Add /Qpar
See https://learn.microsoft.com/en-us/cpp/build/reference/qpar-auto-parallelizer?view=msvc-170
2024-12-16 21:35:12 -08:00
6 changed files with 45 additions and 4 deletions

View File

@ -66,6 +66,7 @@ filter({"configurations:Release", "platforms:Windows"})
buildoptions({ buildoptions({
"/Gw", "/Gw",
"/Ob3", "/Ob3",
"/Qpar",
}) })
filter("configurations:Debug") filter("configurations:Debug")

View File

@ -402,6 +402,7 @@ class Timer : public WaitHandle {
virtual bool Cancel() = 0; virtual bool Cancel() = 0;
}; };
#if XE_PLATFORM_WINDOWS
struct ThreadPriority { struct ThreadPriority {
static const int32_t kLowest = -2; static const int32_t kLowest = -2;
static const int32_t kBelowNormal = -1; static const int32_t kBelowNormal = -1;
@ -409,6 +410,15 @@ struct ThreadPriority {
static const int32_t kAboveNormal = 1; static const int32_t kAboveNormal = 1;
static const int32_t kHighest = 2; static const int32_t kHighest = 2;
}; };
#else
struct ThreadPriority {
static const int32_t kLowest = 1;
static const int32_t kBelowNormal = 8;
static const int32_t kNormal = 16;
static const int32_t kAboveNormal = 24;
static const int32_t kHighest = 32;
};
#endif
// Models a Win32-like thread object. // Models a Win32-like thread object.
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx // https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx

View File

@ -27,6 +27,8 @@
#include <ctime> #include <ctime>
#include <memory> #include <memory>
#include "logging.h"
#if XE_PLATFORM_ANDROID #if XE_PLATFORM_ANDROID
#include <dlfcn.h> #include <dlfcn.h>
@ -660,8 +662,18 @@ class PosixCondition<Thread> : public PosixConditionBase {
WaitStarted(); WaitStarted();
sched_param param{}; sched_param param{};
param.sched_priority = new_priority; param.sched_priority = new_priority;
if (pthread_setschedparam(thread_, SCHED_FIFO, &param) != 0) int res = pthread_setschedparam(thread_, SCHED_FIFO, &param);
assert_always(); if (res != 0) {
switch (res) {
case EPERM:
XELOGW("Permission denied while setting priority");
break;
case EINVAL:
assert_always();
default:
XELOGW("Unknown error while setting priority");
}
}
} }
void QueueUserCallback(std::function<void()> callback) { void QueueUserCallback(std::function<void()> callback) {

View File

@ -1372,6 +1372,12 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
return X_STATUS_NOT_FOUND; return X_STATUS_NOT_FOUND;
} }
if (!module->is_executable()) {
kernel_state_->UnloadUserModule(module, false);
XELOGE("Failed to load user module {}", path);
return X_STATUS_NOT_SUPPORTED;
}
X_RESULT result = kernel_state_->ApplyTitleUpdate(module); X_RESULT result = kernel_state_->ApplyTitleUpdate(module);
if (XFAILED(result)) { if (XFAILED(result)) {
XELOGE("Failed to apply title update! Cannot run module {}", path); XELOGE("Failed to apply title update! Cannot run module {}", path);

View File

@ -799,6 +799,18 @@ dword_result_t XamUserGetUserFlagsFromXUID_entry(qword_t xuid) {
} }
DECLARE_XAM_EXPORT1(XamUserGetUserFlagsFromXUID, kUserProfiles, kImplemented); DECLARE_XAM_EXPORT1(XamUserGetUserFlagsFromXUID, kUserProfiles, kImplemented);
dword_result_t XamUserGetOnlineLanguageFromXUID_entry(qword_t xuid) {
/* Notes:
- Calls XamUserGetUserFlagsFromXUID and returns (ulonglong)(cached_flag <<
0x20) >> 0x39 & 0x1f;
- XamUserGetMembershipTierFromXUID and XamUserGetOnlineCountryFromXUID also
call it
- Removed in metro
*/
return cvars::user_language;
}
DECLARE_XAM_EXPORT1(XamUserGetOnlineLanguageFromXUID, kUserProfiles, kStub);
constexpr uint8_t kStatsMaxAmount = 64; constexpr uint8_t kStatsMaxAmount = 64;
struct X_STATS_DETAILS { struct X_STATS_DETAILS {

View File

@ -48,8 +48,8 @@ void PluginLoader::LoadConfigs() {
xe::filesystem::FilterByName(dir_files, std::regex("[A-Fa-f0-9]{8}")); xe::filesystem::FilterByName(dir_files, std::regex("[A-Fa-f0-9]{8}"));
for (const auto& entry : dir_files) { for (const auto& entry : dir_files) {
const uint32_t title_id = const uint32_t title_id = string_util::from_string<uint32_t>(
std::stoi(entry.name.filename().string(), nullptr, 16); entry.name.filename().string(), true);
LoadTitleConfig(title_id); LoadTitleConfig(title_id);
} }