early-access version 1539

main
pineappleEA 2021-03-31 00:53:57 +02:00
parent 87ca75758c
commit 0680b2ff76
6 changed files with 56 additions and 27 deletions

View File

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

View File

@ -17,7 +17,7 @@ namespace Error {
constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101};
constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104};
constexpr ResultCode ResultNoCapatability{ErrorModule::PCTL, 131};
constexpr ResultCode ResultNoCapability{ErrorModule::PCTL, 131};
constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181};
} // namespace Error
@ -133,7 +133,7 @@ public:
}
private:
bool CheckFreeCommunicationPermissionImpl() {
bool CheckFreeCommunicationPermissionImpl() const {
if (states.temporary_unlocked) {
return true;
}
@ -146,11 +146,13 @@ private:
if (!settings.is_free_communication_default_on) {
return true;
}
// TODO(ogniK): Check for blacklisted/exempted applications
// TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here
// but as we don't have multiproceses support yet, we can just assume our application is
// valid for the time being
return true;
}
bool ConfirmStereoVisionPermissionImpl() {
bool ConfirmStereoVisionPermissionImpl() const {
if (states.temporary_unlocked) {
return true;
}
@ -179,12 +181,11 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & (Capability::Application | Capability::System))) {
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}",
static_cast<s32>(capability));
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
return;
}
// TODO(ogniK): Recovery
// TODO(ogniK): Recovery flag initialization for pctl:r
const auto tid = system.CurrentProcess()->GetTitleID();
if (tid != 0) {
@ -251,7 +252,7 @@ private:
IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & (Capability::Status | Capability::Recovery))) {
LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!");
rb.Push(Error::ResultNoCapatability);
rb.Push(Error::ResultNoCapability);
rb.Push(false);
return;
}
@ -264,9 +265,9 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
return;
}
@ -297,9 +298,9 @@ private:
LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
return;
}
@ -311,9 +312,9 @@ private:
LOG_DEBUG(Service_PCTL, "called");
IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
rb.Push(false);
return;
}
@ -391,7 +392,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
auto module = std::make_shared<Module>();
std::make_shared<PCTL>(system, module, "pctl",
Capability::Application | Capability::SnsPost | Capability::Status |
Capability::SteroVision)
Capability::StereoVision)
->InstallAsService(service_manager);
// TODO(ogniK): Implement remaining capabilities
std::make_shared<PCTL>(system, module, "pctl:a", Capability::None)

View File

@ -13,13 +13,13 @@ class System;
namespace Service::PCTL {
enum class Capability : s32 {
None = 0x0,
enum class Capability : u32 {
None = 0,
Application = 1 << 0,
SnsPost = 1 << 1,
Recovery = 1 << 6,
Status = 1 << 8,
SteroVision = 1 << 9,
StereoVision = 1 << 9,
System = 1 << 15,
};
DECLARE_ENUM_FLAG_OPERATORS(Capability);

View File

@ -51,7 +51,7 @@ constexpr std::array REQUIRED_EXTENSIONS{
#ifdef _WIN32
VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
#endif
#ifdef __linux__
#ifdef __unix__
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
#endif
};

View File

@ -62,7 +62,7 @@ public:
: memory{std::move(memory_)}, allocation_size{allocation_size_}, property_flags{properties},
shifted_memory_type{1U << type} {}
#if defined(_WIN32) || defined(__linux__)
#if defined(_WIN32) || defined(__unix__)
~MemoryAllocation() {
if (owning_opengl_handle != 0) {
glDeleteMemoryObjectsEXT(1, &owning_opengl_handle);
@ -114,7 +114,7 @@ public:
}
return owning_opengl_handle;
}
#elif __linux__
#elif __unix__
[[nodiscard]] u32 ExportOpenGLHandle() {
if (!owning_opengl_handle) {
glCreateMemoryObjectsEXT(1, &owning_opengl_handle);
@ -165,7 +165,7 @@ private:
const u32 shifted_memory_type; ///< Shifted Vulkan memory type.
std::vector<Range> commits; ///< All commit ranges done from this allocation.
std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before.
#if defined(_WIN32) || defined(__linux__)
#if defined(_WIN32) || defined(__unix__)
u32 owning_opengl_handle{}; ///< Owning OpenGL memory object handle.
#endif
};
@ -249,7 +249,7 @@ void MemoryAllocator::AllocMemory(VkMemoryPropertyFlags flags, u32 type_mask, u6
.pNext = nullptr,
#ifdef _WIN32
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT,
#elif __linux__
#elif __unix__
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT,
#else
.handleTypes = 0,

View File

@ -320,6 +320,34 @@ GMainWindow::GMainWindow()
continue;
}
// Launch game with a specific user
if (args[i] == QStringLiteral("-u")) {
if (i >= args.size() - 1) {
continue;
}
if (args[i + 1].startsWith(QChar::fromLatin1('-'))) {
continue;
}
bool argument_ok;
const std::size_t selected_user = args[++i].toUInt(&argument_ok);
if (!argument_ok) {
LOG_ERROR(Frontend, "Invalid user argument");
continue;
}
const Service::Account::ProfileManager manager;
if (!manager.UserExistsIndex(selected_user)) {
LOG_ERROR(Frontend, "Selected user doesn't exist");
continue;
}
Settings::values.current_user = selected_user;
continue;
}
// Launch game at path
if (args[i] == QStringLiteral("-g")) {
if (i >= args.size() - 1) {