early-access version 2081

This commit is contained in:
pineappleEA 2021-09-24 15:00:03 +02:00
parent 397fea26bb
commit da6fdc0ca9
6 changed files with 17 additions and 9 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2080. This is the source code for early-access 2081.
## Legal Notice ## Legal Notice

View file

@ -58,6 +58,13 @@ struct UUID {
uuid = INVALID_UUID; uuid = INVALID_UUID;
} }
[[nodiscard]] constexpr bool IsInvalid() const {
return uuid == INVALID_UUID;
}
[[nodiscard]] constexpr bool IsValid() const {
return !IsInvalid();
}
// TODO(ogniK): Properly generate a Nintendo ID // TODO(ogniK): Properly generate a Nintendo ID
[[nodiscard]] constexpr u64 GetNintendoID() const { [[nodiscard]] constexpr u64 GetNintendoID() const {
return uuid[0]; return uuid[0];

View file

@ -13,7 +13,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default;
void DefaultProfileSelectApplet::SelectProfile( void DefaultProfileSelectApplet::SelectProfile(
std::function<void(std::optional<Common::UUID>)> callback) const { std::function<void(std::optional<Common::UUID>)> callback) const {
Service::Account::ProfileManager manager; Service::Account::ProfileManager manager;
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); callback(manager.GetUser(Settings::values.current_user.GetValue())
.value_or(Common::UUID{Common::INVALID_UUID}));
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");
} }

View file

@ -929,8 +929,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
} }
const auto user_list = profile_manager->GetAllUsers(); const auto user_list = profile_manager->GetAllUsers();
if (std::all_of(user_list.begin(), user_list.end(), if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) {
[](const auto& user) { return user.uuid == Common::INVALID_UUID; })) {
rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code
rb.PushRaw<u128>(Common::INVALID_UUID); rb.PushRaw<u128>(Common::INVALID_UUID);
return; return;

View file

@ -208,9 +208,10 @@ bool ProfileManager::UserExists(UUID uuid) const {
} }
bool ProfileManager::UserExistsIndex(std::size_t index) const { bool ProfileManager::UserExistsIndex(std::size_t index) const {
if (index >= MAX_USERS) if (index >= MAX_USERS) {
return false; return false;
return profiles[index].user_uuid.uuid != Common::INVALID_UUID; }
return profiles[index].user_uuid.IsValid();
} }
/// Opens a specific user /// Opens a specific user
@ -304,7 +305,7 @@ bool ProfileManager::RemoveUser(UUID uuid) {
bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) {
const auto index = GetUserIndex(uuid); const auto index = GetUserIndex(uuid);
if (!index || profile_new.user_uuid == UUID(Common::INVALID_UUID)) { if (!index || profile_new.user_uuid.IsInvalid()) {
return false; return false;
} }
@ -346,7 +347,7 @@ void ProfileManager::ParseUserSaveFile() {
} }
for (const auto& user : data.users) { for (const auto& user : data.users) {
if (user.uuid == UUID(Common::INVALID_UUID)) { if (user.uuid.IsInvalid()) {
continue; continue;
} }

View file

@ -60,7 +60,7 @@ void ProfileSelect::Execute() {
void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) {
UserSelectionOutput output{}; UserSelectionOutput output{};
if (uuid.has_value() && uuid->uuid != Common::INVALID_UUID) { if (uuid.has_value() && uuid->IsValid()) {
output.result = 0; output.result = 0;
output.uuid_selected = uuid->uuid; output.uuid_selected = uuid->uuid;
} else { } else {