early-access version 3069

This commit is contained in:
pineappleEA 2022-10-31 03:36:05 +01:00
parent 5c950d9ec1
commit 963428917c
6 changed files with 53 additions and 22 deletions

View File

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

View File

@ -1185,8 +1185,10 @@ void KThread::RequestDummyThreadWait() {
} }
void KThread::DummyThreadBeginWait() { void KThread::DummyThreadBeginWait() {
ASSERT(this->IsDummyThread()); if (!this->IsDummyThread() || kernel.IsPhantomModeForSingleCore()) {
ASSERT(!kernel.IsPhantomModeForSingleCore()); // Occurs in single core mode.
return;
}
// Block until runnable is no longer false. // Block until runnable is no longer false.
dummy_thread_runnable.wait(false); dummy_thread_runnable.wait(false);

View File

@ -512,10 +512,11 @@ protected:
class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
public: public:
explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_) explicit IManagerForApplication(Core::System& system_,
const std::shared_ptr<ProfileManager>& profile_manager_)
: ServiceFramework{system_, "IManagerForApplication"}, : ServiceFramework{system_, "IManagerForApplication"},
ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)}, ensure_token_id{std::make_shared<EnsureTokenIdCacheAsyncInterface>(system)},
user_id{user_id_} { profile_manager{profile_manager_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
@ -545,7 +546,7 @@ private:
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushRaw<u64>(user_id.Hash()); rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash());
} }
void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) {
@ -575,17 +576,20 @@ private:
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushRaw<u64>(user_id.Hash()); rb.PushRaw<u64>(profile_manager->GetLastOpenedUser().Hash());
} }
void StoreOpenContext(Kernel::HLERequestContext& ctx) { void StoreOpenContext(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_DEBUG(Service_ACC, "called");
profile_manager->StoreOpenedUsers();
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{}; std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{};
Common::UUID user_id{}; std::shared_ptr<ProfileManager> profile_manager;
}; };
// 6.0.0+ // 6.0.0+
@ -790,7 +794,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
LOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser()); rb.PushIpcInterface<IManagerForApplication>(system, profile_manager);
} }
void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
@ -854,17 +858,14 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
// This is similar to GetBaasAccountManagerForApplication // This is similar to GetBaasAccountManagerForApplication
// This command is used concurrently with ListOpenContextStoredUsers // This command is used concurrently with ListOpenContextStoredUsers
// TODO: Find the differences between this and GetBaasAccountManagerForApplication IPC::ResponseBuilder rb{ctx, 2};
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
} }
void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called"); LOG_DEBUG(Service_ACC, "called");
// TODO(ogniK): Handle open contexts ctx.WriteBuffer(profile_manager->GetStoredOpenedUsers());
ctx.WriteBuffer(profile_manager->GetOpenUsers());
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }

View File

@ -261,6 +261,31 @@ UUID ProfileManager::GetLastOpenedUser() const {
return last_opened_user; return last_opened_user;
} }
/// Gets the list of stored opened users.
UserIDArray ProfileManager::GetStoredOpenedUsers() const {
UserIDArray output{};
std::ranges::transform(stored_opened_profiles, output.begin(), [](const ProfileInfo& p) {
if (p.is_open)
return p.user_uuid;
return Common::InvalidUUID;
});
std::stable_partition(output.begin(), output.end(),
[](const UUID& uuid) { return uuid.IsValid(); });
return output;
}
/// Captures the opened users, which can be queried across process launches with
/// ListOpenContextStoredUsers.
void ProfileManager::StoreOpenedUsers() {
size_t profile_index{};
stored_opened_profiles = {};
std::for_each(profiles.begin(), profiles.end(), [&](const auto& profile) {
if (profile.is_open) {
stored_opened_profiles[profile_index++] = profile;
}
});
}
/// Return the users profile base and the unknown arbitary data. /// Return the users profile base and the unknown arbitary data.
bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile,
UserData& data) const { UserData& data) const {

View File

@ -86,6 +86,8 @@ public:
UserIDArray GetOpenUsers() const; UserIDArray GetOpenUsers() const;
UserIDArray GetAllUsers() const; UserIDArray GetAllUsers() const;
Common::UUID GetLastOpenedUser() const; Common::UUID GetLastOpenedUser() const;
UserIDArray GetStoredOpenedUsers() const;
void StoreOpenedUsers();
bool CanSystemRegisterUser() const; bool CanSystemRegisterUser() const;
@ -101,6 +103,7 @@ private:
bool RemoveProfileAtIndex(std::size_t index); bool RemoveProfileAtIndex(std::size_t index);
std::array<ProfileInfo, MAX_USERS> profiles{}; std::array<ProfileInfo, MAX_USERS> profiles{};
std::array<ProfileInfo, MAX_USERS> stored_opened_profiles{};
std::size_t user_count{}; std::size_t user_count{};
Common::UUID last_opened_user{}; Common::UUID last_opened_user{};
}; };

View File

@ -1787,17 +1787,17 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
const auto& resolution = runtime.resolution; const auto& resolution = runtime.resolution;
u32 width = 0; u32 width = std::numeric_limits<u32>::max();
u32 height = 0; u32 height = std::numeric_limits<u32>::max();
for (size_t index = 0; index < NUM_RT; ++index) { for (size_t index = 0; index < NUM_RT; ++index) {
const ImageView* const color_buffer = color_buffers[index]; const ImageView* const color_buffer = color_buffers[index];
if (!color_buffer) { if (!color_buffer) {
renderpass_key.color_formats[index] = PixelFormat::Invalid; renderpass_key.color_formats[index] = PixelFormat::Invalid;
continue; continue;
} }
width = std::max(width, is_rescaled ? resolution.ScaleUp(color_buffer->size.width) width = std::min(width, is_rescaled ? resolution.ScaleUp(color_buffer->size.width)
: color_buffer->size.width); : color_buffer->size.width);
height = std::max(height, is_rescaled ? resolution.ScaleUp(color_buffer->size.height) height = std::min(height, is_rescaled ? resolution.ScaleUp(color_buffer->size.height)
: color_buffer->size.height); : color_buffer->size.height);
attachments.push_back(color_buffer->RenderTarget()); attachments.push_back(color_buffer->RenderTarget());
renderpass_key.color_formats[index] = color_buffer->format; renderpass_key.color_formats[index] = color_buffer->format;
@ -1809,9 +1809,9 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
} }
const size_t num_colors = attachments.size(); const size_t num_colors = attachments.size();
if (depth_buffer) { if (depth_buffer) {
width = std::max(width, is_rescaled ? resolution.ScaleUp(depth_buffer->size.width) width = std::min(width, is_rescaled ? resolution.ScaleUp(depth_buffer->size.width)
: depth_buffer->size.width); : depth_buffer->size.width);
height = std::max(height, is_rescaled ? resolution.ScaleUp(depth_buffer->size.height) height = std::min(height, is_rescaled ? resolution.ScaleUp(depth_buffer->size.height)
: depth_buffer->size.height); : depth_buffer->size.height);
attachments.push_back(depth_buffer->RenderTarget()); attachments.push_back(depth_buffer->RenderTarget());
renderpass_key.depth_format = depth_buffer->format; renderpass_key.depth_format = depth_buffer->format;