summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/file_sys/savedata_factory.cpp4
-rw-r--r--src/core/hle/service/am/am.cpp33
-rw-r--r--src/core/hle/service/am/am.h1
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp17
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h1
-rw-r--r--src/core/hle/service/nvnflinger/buffer_queue_producer.cpp5
-rw-r--r--src/core/hle/service/nvnflinger/parcel.h72
-rw-r--r--src/core/hle/service/vi/vi.cpp12
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp1
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.h3
10 files changed, 103 insertions, 46 deletions
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index 769065b6f..70b36f170 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -82,9 +82,9 @@ std::string GetFutureSaveDataPath(SaveDataSpaceId space_id, SaveDataType type, u
82 // Only detect account/device saves from the future location. 82 // Only detect account/device saves from the future location.
83 switch (type) { 83 switch (type) {
84 case SaveDataType::SaveData: 84 case SaveDataType::SaveData:
85 return fmt::format("{}/account/{}/{:016X}/1", space_id_path, uuid.RawString(), title_id); 85 return fmt::format("{}/account/{}/{:016X}/0", space_id_path, uuid.RawString(), title_id);
86 case SaveDataType::DeviceSaveData: 86 case SaveDataType::DeviceSaveData:
87 return fmt::format("{}/device/{:016X}/1", space_id_path, title_id); 87 return fmt::format("{}/device/{:016X}/0", space_id_path, title_id);
88 default: 88 default:
89 return ""; 89 return "";
90 } 90 }
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index e59de844c..a2375508a 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -13,6 +13,7 @@
13#include "core/file_sys/savedata_factory.h" 13#include "core/file_sys/savedata_factory.h"
14#include "core/hle/kernel/k_event.h" 14#include "core/hle/kernel/k_event.h"
15#include "core/hle/kernel/k_transfer_memory.h" 15#include "core/hle/kernel/k_transfer_memory.h"
16#include "core/hle/result.h"
16#include "core/hle/service/acc/profile_manager.h" 17#include "core/hle/service/acc/profile_manager.h"
17#include "core/hle/service/am/am.h" 18#include "core/hle/service/am/am.h"
18#include "core/hle/service/am/applet_ae.h" 19#include "core/hle/service/am/applet_ae.h"
@@ -1335,7 +1336,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1335 {24, nullptr, "GetLaunchStorageInfoForDebug"}, 1336 {24, nullptr, "GetLaunchStorageInfoForDebug"},
1336 {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"}, 1337 {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"},
1337 {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"}, 1338 {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"},
1338 {27, nullptr, "CreateCacheStorage"}, 1339 {27, &IApplicationFunctions::CreateCacheStorage, "CreateCacheStorage"},
1339 {28, nullptr, "GetSaveDataSizeMax"}, 1340 {28, nullptr, "GetSaveDataSizeMax"},
1340 {29, nullptr, "GetCacheStorageMax"}, 1341 {29, nullptr, "GetCacheStorageMax"},
1341 {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"}, 1342 {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"},
@@ -1738,6 +1739,36 @@ void IApplicationFunctions::GetSaveDataSize(HLERequestContext& ctx) {
1738 rb.Push(size.journal); 1739 rb.Push(size.journal);
1739} 1740}
1740 1741
1742void IApplicationFunctions::CreateCacheStorage(HLERequestContext& ctx) {
1743 struct InputParameters {
1744 u16 index;
1745 s64 size;
1746 s64 journal_size;
1747 };
1748 static_assert(sizeof(InputParameters) == 24);
1749
1750 struct OutputParameters {
1751 u32 storage_target;
1752 u64 required_size;
1753 };
1754 static_assert(sizeof(OutputParameters) == 16);
1755
1756 IPC::RequestParser rp{ctx};
1757 const auto params = rp.PopRaw<InputParameters>();
1758
1759 LOG_WARNING(Service_AM, "(STUBBED) called with index={}, size={:#x}, journal_size={:#x}",
1760 params.index, params.size, params.journal_size);
1761
1762 const OutputParameters resp{
1763 .storage_target = 1,
1764 .required_size = 0,
1765 };
1766
1767 IPC::ResponseBuilder rb{ctx, 6};
1768 rb.Push(ResultSuccess);
1769 rb.PushRaw(resp);
1770}
1771
1741void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) { 1772void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) {
1742 LOG_WARNING(Service_AM, "(STUBBED) called"); 1773 LOG_WARNING(Service_AM, "(STUBBED) called");
1743 1774
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 0dbc6485e..d4fd163da 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -333,6 +333,7 @@ private:
333 void GetPseudoDeviceId(HLERequestContext& ctx); 333 void GetPseudoDeviceId(HLERequestContext& ctx);
334 void ExtendSaveData(HLERequestContext& ctx); 334 void ExtendSaveData(HLERequestContext& ctx);
335 void GetSaveDataSize(HLERequestContext& ctx); 335 void GetSaveDataSize(HLERequestContext& ctx);
336 void CreateCacheStorage(HLERequestContext& ctx);
336 void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); 337 void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx);
337 void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); 338 void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx);
338 void BeginBlockingHomeButton(HLERequestContext& ctx); 339 void BeginBlockingHomeButton(HLERequestContext& ctx);
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 9e559d97e..f73a864c3 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -24,8 +24,10 @@
24#include "core/file_sys/savedata_factory.h" 24#include "core/file_sys/savedata_factory.h"
25#include "core/file_sys/system_archive/system_archive.h" 25#include "core/file_sys/system_archive/system_archive.h"
26#include "core/file_sys/vfs.h" 26#include "core/file_sys/vfs.h"
27#include "core/hle/result.h"
27#include "core/hle/service/filesystem/filesystem.h" 28#include "core/hle/service/filesystem/filesystem.h"
28#include "core/hle/service/filesystem/fsp_srv.h" 29#include "core/hle/service/filesystem/fsp_srv.h"
30#include "core/hle/service/hle_ipc.h"
29#include "core/hle/service/ipc_helpers.h" 31#include "core/hle/service/ipc_helpers.h"
30#include "core/reporter.h" 32#include "core/reporter.h"
31 33
@@ -552,9 +554,9 @@ public:
552 // Write the data to memory 554 // Write the data to memory
553 ctx.WriteBuffer(begin, range_size); 555 ctx.WriteBuffer(begin, range_size);
554 556
555 IPC::ResponseBuilder rb{ctx, 3}; 557 IPC::ResponseBuilder rb{ctx, 4};
556 rb.Push(ResultSuccess); 558 rb.Push(ResultSuccess);
557 rb.Push<u32>(static_cast<u32>(actual_entries)); 559 rb.Push<u64>(actual_entries);
558 } 560 }
559 561
560private: 562private:
@@ -712,7 +714,7 @@ FSP_SRV::FSP_SRV(Core::System& system_)
712 {59, nullptr, "WriteSaveDataFileSystemExtraData"}, 714 {59, nullptr, "WriteSaveDataFileSystemExtraData"},
713 {60, nullptr, "OpenSaveDataInfoReader"}, 715 {60, nullptr, "OpenSaveDataInfoReader"},
714 {61, &FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId, "OpenSaveDataInfoReaderBySaveDataSpaceId"}, 716 {61, &FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId, "OpenSaveDataInfoReaderBySaveDataSpaceId"},
715 {62, nullptr, "OpenCacheStorageList"}, 717 {62, &FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage, "OpenSaveDataInfoReaderOnlyCacheStorage"},
716 {64, nullptr, "OpenSaveDataInternalStorageFileSystem"}, 718 {64, nullptr, "OpenSaveDataInternalStorageFileSystem"},
717 {65, nullptr, "UpdateSaveDataMacForDebug"}, 719 {65, nullptr, "UpdateSaveDataMacForDebug"},
718 {66, nullptr, "WriteSaveDataFileSystemExtraData2"}, 720 {66, nullptr, "WriteSaveDataFileSystemExtraData2"},
@@ -921,6 +923,15 @@ void FSP_SRV::OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx) {
921 std::make_shared<ISaveDataInfoReader>(system, space, fsc)); 923 std::make_shared<ISaveDataInfoReader>(system, space, fsc));
922} 924}
923 925
926void FSP_SRV::OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx) {
927 LOG_WARNING(Service_FS, "(STUBBED) called");
928
929 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
930 rb.Push(ResultSuccess);
931 rb.PushIpcInterface<ISaveDataInfoReader>(system, FileSys::SaveDataSpaceId::TemporaryStorage,
932 fsc);
933}
934
924void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) { 935void FSP_SRV::WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx) {
925 LOG_WARNING(Service_FS, "(STUBBED) called."); 936 LOG_WARNING(Service_FS, "(STUBBED) called.");
926 937
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index 49f17c7c3..4f3c2f6de 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -42,6 +42,7 @@ private:
42 void OpenSaveDataFileSystem(HLERequestContext& ctx); 42 void OpenSaveDataFileSystem(HLERequestContext& ctx);
43 void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx); 43 void OpenReadOnlySaveDataFileSystem(HLERequestContext& ctx);
44 void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx); 44 void OpenSaveDataInfoReaderBySaveDataSpaceId(HLERequestContext& ctx);
45 void OpenSaveDataInfoReaderOnlyCacheStorage(HLERequestContext& ctx);
45 void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx); 46 void WriteSaveDataFileSystemExtraDataBySaveDataAttribute(HLERequestContext& ctx);
46 void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx); 47 void ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(HLERequestContext& ctx);
47 void OpenDataStorageByCurrentProcess(HLERequestContext& ctx); 48 void OpenDataStorageByCurrentProcess(HLERequestContext& ctx);
diff --git a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp
index cd0a13094..b16f9933f 100644
--- a/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp
+++ b/src/core/hle/service/nvnflinger/buffer_queue_producer.cpp
@@ -793,6 +793,7 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
793 std::scoped_lock lock{core->mutex}; 793 std::scoped_lock lock{core->mutex};
794 794
795 slots[slot] = {}; 795 slots[slot] = {};
796 slots[slot].fence = Fence::NoFence();
796 slots[slot].graphic_buffer = buffer; 797 slots[slot].graphic_buffer = buffer;
797 slots[slot].frame_number = 0; 798 slots[slot].frame_number = 0;
798 799
@@ -854,7 +855,7 @@ void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u
854 status = DequeueBuffer(&slot, &fence, is_async, width, height, pixel_format, usage); 855 status = DequeueBuffer(&slot, &fence, is_async, width, height, pixel_format, usage);
855 856
856 parcel_out.Write(slot); 857 parcel_out.Write(slot);
857 parcel_out.WriteObject(&fence); 858 parcel_out.WriteFlattenedObject(&fence);
858 break; 859 break;
859 } 860 }
860 case TransactionId::RequestBuffer: { 861 case TransactionId::RequestBuffer: {
@@ -864,7 +865,7 @@ void BufferQueueProducer::Transact(HLERequestContext& ctx, TransactionId code, u
864 865
865 status = RequestBuffer(slot, &buf); 866 status = RequestBuffer(slot, &buf);
866 867
867 parcel_out.WriteObject(buf); 868 parcel_out.WriteFlattenedObject(buf);
868 break; 869 break;
869 } 870 }
870 case TransactionId::QueueBuffer: { 871 case TransactionId::QueueBuffer: {
diff --git a/src/core/hle/service/nvnflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h
index d1b6201e0..fb56d75d7 100644
--- a/src/core/hle/service/nvnflinger/parcel.h
+++ b/src/core/hle/service/nvnflinger/parcel.h
@@ -117,61 +117,67 @@ private:
117 117
118class OutputParcel final { 118class OutputParcel final {
119public: 119public:
120 static constexpr std::size_t DefaultBufferSize = 0x40; 120 OutputParcel() = default;
121
122 OutputParcel() : buffer(DefaultBufferSize) {}
123
124 template <typename T>
125 explicit OutputParcel(const T& out_data) : buffer(DefaultBufferSize) {
126 Write(out_data);
127 }
128 121
129 template <typename T> 122 template <typename T>
130 void Write(const T& val) { 123 void Write(const T& val) {
131 static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); 124 this->WriteImpl(val, m_data_buffer);
132
133 if (buffer.size() < write_index + sizeof(T)) {
134 buffer.resize(buffer.size() + sizeof(T) + DefaultBufferSize);
135 }
136
137 std::memcpy(buffer.data() + write_index, &val, sizeof(T));
138 write_index += sizeof(T);
139 write_index = Common::AlignUp(write_index, 4);
140 } 125 }
141 126
142 template <typename T> 127 template <typename T>
143 void WriteObject(const T* ptr) { 128 void WriteFlattenedObject(const T* ptr) {
144 static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
145
146 if (!ptr) { 129 if (!ptr) {
147 Write<u32>(0); 130 this->Write<u32>(0);
148 return; 131 return;
149 } 132 }
150 133
151 Write<u32>(1); 134 this->Write<u32>(1);
152 Write<s64>(sizeof(T)); 135 this->Write<s64>(sizeof(T));
153 Write(*ptr); 136 this->Write(*ptr);
154 } 137 }
155 138
156 template <typename T> 139 template <typename T>
157 void WriteObject(const std::shared_ptr<T> ptr) { 140 void WriteFlattenedObject(const std::shared_ptr<T> ptr) {
158 WriteObject(ptr.get()); 141 this->WriteFlattenedObject(ptr.get());
142 }
143
144 template <typename T>
145 void WriteInterface(const T& val) {
146 this->WriteImpl(val, m_data_buffer);
147 this->WriteImpl(0U, m_object_buffer);
159 } 148 }
160 149
161 std::vector<u8> Serialize() const { 150 std::vector<u8> Serialize() const {
151 std::vector<u8> output_buffer(sizeof(ParcelHeader) + m_data_buffer.size() +
152 m_object_buffer.size());
153
162 ParcelHeader header{}; 154 ParcelHeader header{};
163 header.data_size = static_cast<u32>(write_index - sizeof(ParcelHeader)); 155 header.data_size = static_cast<u32>(m_data_buffer.size());
164 header.data_offset = sizeof(ParcelHeader); 156 header.data_offset = sizeof(ParcelHeader);
165 header.objects_size = 4; 157 header.objects_size = static_cast<u32>(m_object_buffer.size());
166 header.objects_offset = static_cast<u32>(sizeof(ParcelHeader) + header.data_size); 158 header.objects_offset = header.data_offset + header.data_size;
167 std::memcpy(buffer.data(), &header, sizeof(ParcelHeader)); 159
160 std::memcpy(output_buffer.data(), &header, sizeof(header));
161 std::ranges::copy(m_data_buffer, output_buffer.data() + header.data_offset);
162 std::ranges::copy(m_object_buffer, output_buffer.data() + header.objects_offset);
163
164 return output_buffer;
165 }
166
167private:
168 template <typename T>
169 requires(std::is_trivially_copyable_v<T>)
170 void WriteImpl(const T& val, std::vector<u8>& buffer) {
171 const size_t aligned_size = Common::AlignUp(sizeof(T), 4);
172 const size_t old_size = buffer.size();
173 buffer.resize(old_size + aligned_size);
168 174
169 return buffer; 175 std::memcpy(buffer.data() + old_size, &val, sizeof(T));
170 } 176 }
171 177
172private: 178private:
173 mutable std::vector<u8> buffer; 179 std::vector<u8> m_data_buffer;
174 std::size_t write_index = sizeof(ParcelHeader); 180 std::vector<u8> m_object_buffer;
175}; 181};
176 182
177} // namespace Service::android 183} // namespace Service::android
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 68eab5133..1b193f00c 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -64,8 +64,8 @@ public:
64private: 64private:
65 const u32 magic = 2; 65 const u32 magic = 2;
66 const u32 process_id = 1; 66 const u32 process_id = 1;
67 const u32 id; 67 const u64 id;
68 INSERT_PADDING_WORDS(3); 68 INSERT_PADDING_WORDS(2);
69 std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'}; 69 std::array<u8, 8> dispdrv = {'d', 'i', 's', 'p', 'd', 'r', 'v', '\0'};
70 INSERT_PADDING_WORDS(2); 70 INSERT_PADDING_WORDS(2);
71}; 71};
@@ -608,7 +608,9 @@ private:
608 return; 608 return;
609 } 609 }
610 610
611 const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; 611 android::OutputParcel parcel;
612 parcel.WriteInterface(NativeWindow{*buffer_queue_id});
613
612 const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); 614 const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
613 615
614 IPC::ResponseBuilder rb{ctx, 4}; 616 IPC::ResponseBuilder rb{ctx, 4};
@@ -654,7 +656,9 @@ private:
654 return; 656 return;
655 } 657 }
656 658
657 const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; 659 android::OutputParcel parcel;
660 parcel.WriteInterface(NativeWindow{*buffer_queue_id});
661
658 const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); 662 const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
659 663
660 IPC::ResponseBuilder rb{ctx, 6}; 664 IPC::ResponseBuilder rb{ctx, 6};
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 012d6fa73..4d0481f2a 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -1864,6 +1864,7 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
1864 num_layers = std::max(num_layers, color_buffer->range.extent.layers); 1864 num_layers = std::max(num_layers, color_buffer->range.extent.layers);
1865 images[num_images] = color_buffer->ImageHandle(); 1865 images[num_images] = color_buffer->ImageHandle();
1866 image_ranges[num_images] = MakeSubresourceRange(color_buffer); 1866 image_ranges[num_images] = MakeSubresourceRange(color_buffer);
1867 rt_map[index] = num_images;
1867 samples = color_buffer->Samples(); 1868 samples = color_buffer->Samples();
1868 ++num_images; 1869 ++num_images;
1869 } 1870 }
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h
index 23473bf9c..4166b3d20 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.h
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.h
@@ -334,7 +334,7 @@ public:
334 } 334 }
335 335
336 [[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept { 336 [[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept {
337 return (image_ranges.at(index).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; 337 return (image_ranges.at(rt_map[index]).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
338 } 338 }
339 339
340 [[nodiscard]] bool HasAspectDepthBit() const noexcept { 340 [[nodiscard]] bool HasAspectDepthBit() const noexcept {
@@ -354,6 +354,7 @@ private:
354 u32 num_images = 0; 354 u32 num_images = 0;
355 std::array<VkImage, 9> images{}; 355 std::array<VkImage, 9> images{};
356 std::array<VkImageSubresourceRange, 9> image_ranges{}; 356 std::array<VkImageSubresourceRange, 9> image_ranges{};
357 std::array<size_t, NUM_RT> rt_map{};
357 bool has_depth{}; 358 bool has_depth{};
358 bool has_stencil{}; 359 bool has_stencil{};
359}; 360};