summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp54
-rw-r--r--src/core/hle/service/filesystem/filesystem.h50
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp138
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h34
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp46
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.h48
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp9
-rw-r--r--src/core/hle/service/nvdrv/interface.h2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp4
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.cpp31
-rw-r--r--src/core/hle/service/nvdrv/nvmemp.h23
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/hle/service/vi/vi.cpp51
-rw-r--r--src/core/hle/service/vi/vi.h7
14 files changed, 494 insertions, 5 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
new file mode 100644
index 000000000..4b47548fd
--- /dev/null
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -0,0 +1,54 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <boost/container/flat_map.hpp>
+#include "core/file_sys/filesystem.h"
+#include "core/hle/service/filesystem/filesystem.h"
+#include "core/hle/service/filesystem/fsp_srv.h"
+
+namespace Service {
+namespace FileSystem {
+
+/**
+ * Map of registered file systems, identified by type. Once an file system is registered here, it
+ * is never removed until UnregisterFileSystems is called.
+ */
+static boost::container::flat_map<Type, std::unique_ptr<FileSys::FileSystemFactory>> filesystem_map;
+
+ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& factory, Type type) {
+ auto result = filesystem_map.emplace(type, std::move(factory));
+
+ bool inserted = result.second;
+ ASSERT_MSG(inserted, "Tried to register more than one system with same id code");
+
+ auto& filesystem = result.first->second;
+ LOG_DEBUG(Service_FS, "Registered file system %s with id code 0x%08X",
+ filesystem->GetName().c_str(), static_cast<u32>(type));
+ return RESULT_SUCCESS;
+}
+
+ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
+ FileSys::Path& path) {
+ LOG_TRACE(Service_FS, "Opening FileSystem with type=%d", type);
+
+ auto itr = filesystem_map.find(type);
+ if (itr == filesystem_map.end()) {
+ // TODO(bunnei): Find a better error code for this
+ return ResultCode(-1);
+ }
+
+ return itr->second->Open(path);
+}
+
+void UnregisterFileSystems() {
+ filesystem_map.clear();
+}
+
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ UnregisterFileSystems();
+ std::make_shared<FSP_SRV>()->InstallAsService(service_manager);
+}
+
+} // namespace FileSystem
+} // namespace Service
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
new file mode 100644
index 000000000..a674c9493
--- /dev/null
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -0,0 +1,50 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include "common/common_types.h"
+#include "core/hle/result.h"
+
+namespace FileSys {
+class FileSystemBackend;
+class FileSystemFactory;
+class Path;
+} // namespace FileSys
+
+namespace Service {
+
+namespace SM {
+class ServiceManager;
+} // namespace SM
+
+namespace FileSystem {
+
+/// Supported FileSystem types
+enum class Type {
+ RomFS = 1,
+};
+
+/**
+ * Registers a FileSystem, instances of which can later be opened using its IdCode.
+ * @param factory FileSystem backend interface to use
+ * @param type Type used to access this type of FileSystem
+ */
+ResultCode RegisterFileSystem(std::unique_ptr<FileSys::FileSystemFactory>&& factory, Type type);
+
+/**
+ * Opens a file system
+ * @param type Type of the file system to open
+ * @param path Path to the file system, used with Binary paths
+ * @return FileSys::FileSystemBackend interface to the file system
+ */
+ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
+ FileSys::Path& path);
+
+/// Registers all Filesystem services with the specified service manager.
+void InstallInterfaces(SM::ServiceManager& service_manager);
+
+} // namespace FileSystem
+} // namespace Service
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
new file mode 100644
index 000000000..ef1915e5a
--- /dev/null
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -0,0 +1,138 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/logging/log.h"
+#include "core/core.h"
+#include "core/file_sys/filesystem.h"
+#include "core/file_sys/storage.h"
+#include "core/hle/ipc_helpers.h"
+#include "core/hle/kernel/client_port.h"
+#include "core/hle/kernel/client_session.h"
+#include "core/hle/service/filesystem/filesystem.h"
+#include "core/hle/service/filesystem/fsp_srv.h"
+
+namespace Service {
+namespace FileSystem {
+
+class IStorage final : public ServiceFramework<IStorage> {
+public:
+ IStorage(std::unique_ptr<FileSys::StorageBackend>&& backend)
+ : ServiceFramework("IStorage"), backend(std::move(backend)) {
+ static const FunctionInfo functions[] = {
+ {0, &IStorage::Read, "Read"}, {1, nullptr, "Write"}, {2, nullptr, "Flush"},
+ {3, nullptr, "SetSize"}, {4, nullptr, "GetSize"},
+ };
+ RegisterHandlers(functions);
+ }
+
+private:
+ std::unique_ptr<FileSys::StorageBackend> backend;
+
+ void Read(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const s64 offset = rp.Pop<s64>();
+ const s64 length = rp.Pop<s64>();
+ const auto& descriptor = ctx.BufferDescriptorB()[0];
+
+ LOG_DEBUG(Service_FS, "called, offset=0x%llx, length=0x%llx", offset, length);
+
+ // Error checking
+ ASSERT_MSG(length == descriptor.Size(), "unexpected size difference");
+ if (length < 0) {
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidLength));
+ return;
+ }
+ if (offset < 0) {
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(ResultCode(ErrorModule::FS, ErrorDescription::InvalidOffset));
+ return;
+ }
+
+ // Read the data from the Storage backend
+ std::vector<u8> output(length);
+ ResultVal<size_t> res = backend->Read(offset, length, output.data());
+ if (res.Failed()) {
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(res.Code());
+ return;
+ }
+
+ // Write the data to memory
+ Memory::WriteBlock(descriptor.Address(), output.data(), descriptor.Size());
+
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ }
+};
+
+FSP_SRV::FSP_SRV() : ServiceFramework("fsp-srv") {
+ static const FunctionInfo functions[] = {
+ {1, &FSP_SRV::Initalize, "Initalize"},
+ {200, &FSP_SRV::OpenDataStorageByCurrentProcess, "OpenDataStorageByCurrentProcess"},
+ {203, &FSP_SRV::OpenRomStorage, "OpenRomStorage"},
+ {1005, &FSP_SRV::GetGlobalAccessLogMode, "GetGlobalAccessLogMode"},
+ };
+ RegisterHandlers(functions);
+}
+
+void FSP_SRV::TryLoadRomFS() {
+ if (romfs) {
+ return;
+ }
+ FileSys::Path unused;
+ auto res = OpenFileSystem(Type::RomFS, unused);
+ if (res.Succeeded()) {
+ romfs = std::move(res.Unwrap());
+ }
+}
+
+void FSP_SRV::Initalize(Kernel::HLERequestContext& ctx) {
+ LOG_WARNING(Service_FS, "(STUBBED) called");
+
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+}
+
+void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
+ LOG_WARNING(Service_FS, "(STUBBED) called");
+
+ IPC::RequestBuilder rb{ctx, 4};
+ rb.Push(RESULT_SUCCESS);
+ rb.Push<u32>(5);
+}
+
+void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
+ LOG_DEBUG(Service_FS, "called");
+
+ TryLoadRomFS();
+ if (!romfs) {
+ // TODO (bunnei): Find the right error code to use here
+ LOG_CRITICAL(Service_FS, "no file system interface available!");
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(ResultCode(-1));
+ return;
+ }
+
+ // Attempt to open a StorageBackend interface to the RomFS
+ auto storage = romfs->OpenFile({}, {});
+ if (storage.Failed()) {
+ LOG_CRITICAL(Service_FS, "no storage interface available!");
+ IPC::RequestBuilder rb{ctx, 2};
+ rb.Push(storage.Code());
+ return;
+ }
+
+ IPC::RequestBuilder rb{ctx, 2, 0, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushIpcInterface<IStorage>(std::move(storage.Unwrap()));
+}
+
+void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
+ LOG_WARNING(Service_FS, "(STUBBED) called, using OpenDataStorageByCurrentProcess");
+ OpenDataStorageByCurrentProcess(ctx);
+}
+
+} // namespace FileSystem
+} // namespace Service
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
new file mode 100644
index 000000000..15be8edc1
--- /dev/null
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -0,0 +1,34 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+#include "core/hle/service/service.h"
+
+namespace FileSys {
+class FileSystemBackend;
+}
+
+namespace Service {
+namespace FileSystem {
+
+class FSP_SRV final : public ServiceFramework<FSP_SRV> {
+public:
+ explicit FSP_SRV();
+ ~FSP_SRV() = default;
+
+private:
+ void TryLoadRomFS();
+
+ void Initalize(Kernel::HLERequestContext& ctx);
+ void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
+ void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx);
+ void OpenRomStorage(Kernel::HLERequestContext& ctx);
+
+ std::unique_ptr<FileSys::FileSystemBackend> romfs;
+};
+
+} // namespace FileSystem
+} // namespace Service
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
new file mode 100644
index 000000000..2078f2187
--- /dev/null
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -0,0 +1,46 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/assert.h"
+#include "common/logging/log.h"
+#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
+
+namespace Service {
+namespace Nvidia {
+namespace Devices {
+
+u32 nvhost_ctrl::ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) {
+ LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%lx, output_size=0x%lx", command,
+ input.size(), output.size());
+
+ switch (command) {
+ case IocGetConfigCommand:
+ return NvOsGetConfigU32(input, output);
+ }
+ UNIMPLEMENTED();
+ return 0;
+}
+
+u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
+ IocGetConfigParams params;
+ std::memcpy(&params, input.data(), sizeof(params));
+ LOG_DEBUG(Service_NVDRV, "called, setting=%s!%s", params.domain_str.data(),
+ params.param_str.data());
+
+ if (!strcmp(params.domain_str.data(), "nv")) {
+ if (!strcmp(params.param_str.data(), "NV_MEMORY_PROFILER")) {
+ params.config_str[0] = '1';
+ } else {
+ UNIMPLEMENTED();
+ }
+ } else {
+ UNIMPLEMENTED();
+ }
+ std::memcpy(output.data(), &params, sizeof(params));
+ return 0;
+}
+
+} // namespace Devices
+} // namespace Nvidia
+} // namespace Service
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
new file mode 100644
index 000000000..abce35e17
--- /dev/null
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
@@ -0,0 +1,48 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <cstdlib>
+#include <cstring>
+#include <vector>
+#include "common/common_types.h"
+#include "core/hle/service/nvdrv/devices/nvdevice.h"
+
+namespace Service {
+namespace Nvidia {
+namespace Devices {
+
+class nvhost_ctrl final : public nvdevice {
+public:
+ nvhost_ctrl() = default;
+ ~nvhost_ctrl() override = default;
+
+ u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override;
+
+private:
+ enum IoctlCommands {
+ IocSyncptReadCommand = 0xC0080014,
+ IocSyncptIncrCommand = 0x40040015,
+ IocSyncptWaitCommand = 0xC00C0016,
+ IocModuleMutexCommand = 0x40080017,
+ IocModuleRegRDWRCommand = 0xC008010E,
+ IocSyncptWaitexCommand = 0xC0100019,
+ IocSyncptReadMaxCommand = 0xC008001A,
+ IocGetConfigCommand = 0xC183001B,
+ };
+
+ struct IocGetConfigParams {
+ std::array<char, 0x41> domain_str;
+ std::array<char, 0x41> param_str;
+ std::array<char, 0x101> config_str;
+ };
+
+ u32 NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output);
+};
+
+} // namespace Devices
+} // namespace Nvidia
+} // namespace Service
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index 417455200..0181d1b4f 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -69,13 +69,12 @@ void NVDRV::Initialize(Kernel::HLERequestContext& ctx) {
void NVDRV::SetClientPID(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- u64 pid = rp.Pop<u64>();
- u64 unk = rp.Pop<u64>();
+ pid = rp.Pop<u64>();
- LOG_WARNING(Service, "(STUBBED) called, pid=0x%llx, unk=0x%llx", pid, unk);
-
- IPC::RequestBuilder rb{ctx, 2};
+ LOG_INFO(Service, "called, pid=0x%lx", pid);
+ IPC::RequestBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
+ rb.Push<u32>(0);
}
NVDRV::NVDRV(std::shared_ptr<Module> nvdrv, const char* name)
diff --git a/src/core/hle/service/nvdrv/interface.h b/src/core/hle/service/nvdrv/interface.h
index 2283f358e..f96f2bd29 100644
--- a/src/core/hle/service/nvdrv/interface.h
+++ b/src/core/hle/service/nvdrv/interface.h
@@ -25,6 +25,8 @@ private:
void SetClientPID(Kernel::HLERequestContext& ctx);
std::shared_ptr<Module> nvdrv;
+
+ u64 pid{};
};
} // namespace Nvidia
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index 9d3013c16..141ddaedd 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -6,9 +6,11 @@
#include "core/hle/service/nvdrv/devices/nvdevice.h"
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
#include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h"
+#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
#include "core/hle/service/nvdrv/devices/nvmap.h"
#include "core/hle/service/nvdrv/interface.h"
#include "core/hle/service/nvdrv/nvdrv.h"
+#include "core/hle/service/nvdrv/nvmemp.h"
namespace Service {
namespace Nvidia {
@@ -19,6 +21,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module_ = std::make_shared<Module>();
std::make_shared<NVDRV>(module_, "nvdrv")->InstallAsService(service_manager);
std::make_shared<NVDRV>(module_, "nvdrv:a")->InstallAsService(service_manager);
+ std::make_shared<NVMEMP>()->InstallAsService(service_manager);
nvdrv = module_;
}
@@ -27,6 +30,7 @@ Module::Module() {
devices["/dev/nvhost-as-gpu"] = std::make_shared<Devices::nvhost_as_gpu>();
devices["/dev/nvmap"] = nvmap_dev;
devices["/dev/nvdisp_disp0"] = std::make_shared<Devices::nvdisp_disp0>(nvmap_dev);
+ devices["/dev/nvhost-ctrl"] = std::make_shared<Devices::nvhost_ctrl>();
}
u32 Module::Open(std::string device_name) {
diff --git a/src/core/hle/service/nvdrv/nvmemp.cpp b/src/core/hle/service/nvdrv/nvmemp.cpp
new file mode 100644
index 000000000..5a13732c7
--- /dev/null
+++ b/src/core/hle/service/nvdrv/nvmemp.cpp
@@ -0,0 +1,31 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/assert.h"
+#include "common/logging/log.h"
+#include "core/hle/ipc_helpers.h"
+#include "core/hle/service/nvdrv/nvdrv.h"
+#include "core/hle/service/nvdrv/nvmemp.h"
+
+namespace Service {
+namespace Nvidia {
+
+NVMEMP::NVMEMP() : ServiceFramework("nvmemp") {
+ static const FunctionInfo functions[] = {
+ {0, &NVMEMP::Unknown0, "Unknown0"},
+ {1, &NVMEMP::Unknown1, "Unknown1"},
+ };
+ RegisterHandlers(functions);
+}
+
+void NVMEMP::Unknown0(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED();
+}
+
+void NVMEMP::Unknown1(Kernel::HLERequestContext& ctx) {
+ UNIMPLEMENTED();
+}
+
+} // namespace Nvidia
+} // namespace Service
diff --git a/src/core/hle/service/nvdrv/nvmemp.h b/src/core/hle/service/nvdrv/nvmemp.h
new file mode 100644
index 000000000..a6b5fbb82
--- /dev/null
+++ b/src/core/hle/service/nvdrv/nvmemp.h
@@ -0,0 +1,23 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/hle/service/service.h"
+
+namespace Service {
+namespace Nvidia {
+
+class NVMEMP final : public ServiceFramework<NVMEMP> {
+public:
+ NVMEMP();
+ ~NVMEMP() = default;
+
+private:
+ void Unknown0(Kernel::HLERequestContext& ctx);
+ void Unknown1(Kernel::HLERequestContext& ctx);
+};
+
+} // namespace Nvidia
+} // namespace Service
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 19213a2f4..3f5ce56c6 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -19,6 +19,7 @@
#include "core/hle/service/aoc/aoc_u.h"
#include "core/hle/service/apm/apm.h"
#include "core/hle/service/audio/audio.h"
+#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/lm/lm.h"
#include "core/hle/service/nvdrv/nvdrv.h"
@@ -172,6 +173,7 @@ void Init() {
AOC::InstallInterfaces(*SM::g_service_manager);
APM::InstallInterfaces(*SM::g_service_manager);
Audio::InstallInterfaces(*SM::g_service_manager);
+ FileSystem::InstallInterfaces(*SM::g_service_manager);
HID::InstallInterfaces(*SM::g_service_manager);
LM::InstallInterfaces(*SM::g_service_manager);
Nvidia::InstallInterfaces(*SM::g_service_manager);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index c624e734e..3f2fd72b2 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -356,6 +356,35 @@ private:
Data data{};
};
+class IGBPQueryRequestParcel : public Parcel {
+public:
+ explicit IGBPQueryRequestParcel(const std::vector<u8>& buffer) : Parcel(buffer) {
+ Deserialize();
+ }
+ ~IGBPQueryRequestParcel() override = default;
+
+ void DeserializeData() override {
+ std::u16string token = ReadInterfaceToken();
+ type = Read<u32_le>();
+ }
+
+ u32 type;
+};
+
+class IGBPQueryResponseParcel : public Parcel {
+public:
+ explicit IGBPQueryResponseParcel(u32 value) : Parcel(), value(value) {}
+ ~IGBPQueryResponseParcel() override = default;
+
+protected:
+ void SerializeData() override {
+ Write(value);
+ }
+
+private:
+ u32_le value;
+};
+
class IHOSBinderDriver final : public ServiceFramework<IHOSBinderDriver> {
public:
explicit IHOSBinderDriver(std::shared_ptr<NVFlinger> nv_flinger)
@@ -445,6 +474,15 @@ private:
auto response_buffer = response.Serialize();
Memory::WriteBlock(output_buffer.Address(), response_buffer.data(),
output_buffer.Size());
+ } else if (transaction == TransactionId::Query) {
+ IGBPQueryRequestParcel request{input_data};
+
+ u32 value = buffer_queue->Query(static_cast<BufferQueue::QueryType>(request.type));
+
+ IGBPQueryResponseParcel response{value};
+ auto response_buffer = response.Serialize();
+ Memory::WriteBlock(output_buffer.Address(), response_buffer.data(),
+ output_buffer.Size());
} else {
ASSERT_MSG(false, "Unimplemented");
}
@@ -918,6 +956,19 @@ void BufferQueue::ReleaseBuffer(u32 slot) {
itr->status = Buffer::Status::Free;
}
+u32 BufferQueue::Query(QueryType type) {
+ LOG_WARNING(Service, "(STUBBED) called type=%u", static_cast<u32>(type));
+ switch (type) {
+ case QueryType::NativeWindowFormat:
+ // TODO(Subv): Use an enum for this
+ static constexpr u32 FormatABGR8 = 1;
+ return FormatABGR8;
+ }
+
+ UNIMPLEMENTED();
+ return 0;
+}
+
Layer::Layer(u64 id, std::shared_ptr<BufferQueue> queue) : id(id), buffer_queue(std::move(queue)) {}
Display::Display(u64 id, std::string name) : id(id), name(std::move(name)) {
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index 81d4f3daa..4dd4d1783 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -37,6 +37,12 @@ static_assert(sizeof(IGBPBuffer) == 0x16C, "IGBPBuffer has wrong size");
class BufferQueue {
public:
+ enum class QueryType {
+ NativeWindowWidth = 0,
+ NativeWindowHeight = 1,
+ NativeWindowFormat = 2,
+ };
+
BufferQueue(u32 id, u64 layer_id);
~BufferQueue() = default;
@@ -54,6 +60,7 @@ public:
void QueueBuffer(u32 slot);
boost::optional<const Buffer&> AcquireBuffer();
void ReleaseBuffer(u32 slot);
+ u32 Query(QueryType type);
u32 GetId() const {
return id;