early-access version 1539

This commit is contained in:
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 yuzu emulator early access
============= =============
This is the source code for early-access 1538. This is the source code for early-access 1539.
## Legal Notice ## Legal Notice

View file

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

View file

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

View file

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

View file

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

View file

@ -320,6 +320,34 @@ GMainWindow::GMainWindow()
continue; 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 // Launch game at path
if (args[i] == QStringLiteral("-g")) { if (args[i] == QStringLiteral("-g")) {
if (i >= args.size() - 1) { if (i >= args.size() - 1) {