summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2019-05-22 22:24:17 -0400
committerGravatar Lioncash2019-05-22 23:24:27 -0400
commit819d229e766ac4c1d51ebd8afc6a194212178f01 (patch)
tree3cf986b61d8078cc0c3417bd1600f4fc5212930f
parentshader/decode/memory: Remove left in debug pragma (diff)
downloadyuzu-819d229e766ac4c1d51ebd8afc6a194212178f01.tar.gz
yuzu-819d229e766ac4c1d51ebd8afc6a194212178f01.tar.xz
yuzu-819d229e766ac4c1d51ebd8afc6a194212178f01.zip
service/aoc: Pop all passed values where applicable
A few of the aoc service stubs/implementations weren't fully popping all of the parameters passed to them. This ensures that all parameters are popped and, at minimum, logged out.
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp57
1 files changed, 45 insertions, 12 deletions
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index bd4e38461..12f845024 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -75,7 +75,15 @@ AOC_U::AOC_U() : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs
75AOC_U::~AOC_U() = default; 75AOC_U::~AOC_U() = default;
76 76
77void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { 77void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
78 LOG_DEBUG(Service_AOC, "called"); 78 struct Parameters {
79 u64 process_id;
80 };
81 static_assert(sizeof(Parameters) == 8);
82
83 IPC::RequestParser rp{ctx};
84 const auto params = rp.PopRaw<Parameters>();
85
86 LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id);
79 87
80 IPC::ResponseBuilder rb{ctx, 3}; 88 IPC::ResponseBuilder rb{ctx, 3};
81 rb.Push(RESULT_SUCCESS); 89 rb.Push(RESULT_SUCCESS);
@@ -94,23 +102,32 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
94} 102}
95 103
96void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { 104void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
105 struct Parameters {
106 u32 offset;
107 u32 count;
108 u64 process_id;
109 };
110 static_assert(sizeof(Parameters) == 16);
111
97 IPC::RequestParser rp{ctx}; 112 IPC::RequestParser rp{ctx};
113 const auto [offset, count, process_id] = rp.PopRaw<Parameters>();
98 114
99 const auto offset = rp.PopRaw<u32>(); 115 LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count,
100 auto count = rp.PopRaw<u32>(); 116 process_id);
101 LOG_DEBUG(Service_AOC, "called with offset={}, count={}", offset, count);
102 117
103 const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 118 const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID();
104 119
105 std::vector<u32> out; 120 std::vector<u32> out;
106 for (size_t i = 0; i < add_on_content.size(); ++i) { 121 for (size_t i = 0; i < add_on_content.size(); ++i) {
107 if ((add_on_content[i] & DLC_BASE_TITLE_ID_MASK) == current) 122 if ((add_on_content[i] & DLC_BASE_TITLE_ID_MASK) == current) {
108 out.push_back(static_cast<u32>(add_on_content[i] & 0x7FF)); 123 out.push_back(static_cast<u32>(add_on_content[i] & 0x7FF));
124 }
109 } 125 }
110 126
111 const auto& disabled = Settings::values.disabled_addons[current]; 127 const auto& disabled = Settings::values.disabled_addons[current];
112 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) 128 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
113 out = {}; 129 out = {};
130 }
114 131
115 if (out.size() < offset) { 132 if (out.size() < offset) {
116 IPC::ResponseBuilder rb{ctx, 2}; 133 IPC::ResponseBuilder rb{ctx, 2};
@@ -119,22 +136,31 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
119 return; 136 return;
120 } 137 }
121 138
122 count = static_cast<u32>(std::min<size_t>(out.size() - offset, count)); 139 const auto out_count = static_cast<u32>(std::min<size_t>(out.size() - offset, count));
123 std::rotate(out.begin(), out.begin() + offset, out.end()); 140 std::rotate(out.begin(), out.begin() + offset, out.end());
124 out.resize(count); 141 out.resize(out_count);
125 142
126 ctx.WriteBuffer(out); 143 ctx.WriteBuffer(out);
127 144
128 IPC::ResponseBuilder rb{ctx, 3}; 145 IPC::ResponseBuilder rb{ctx, 3};
129 rb.Push(RESULT_SUCCESS); 146 rb.Push(RESULT_SUCCESS);
130 rb.Push(count); 147 rb.Push(out_count);
131} 148}
132 149
133void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { 150void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
134 LOG_DEBUG(Service_AOC, "called"); 151 struct Parameters {
152 u64 process_id;
153 };
154 static_assert(sizeof(Parameters) == 8);
155
156 IPC::RequestParser rp{ctx};
157 const auto params = rp.PopRaw<Parameters>();
158
159 LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id);
135 160
136 IPC::ResponseBuilder rb{ctx, 4}; 161 IPC::ResponseBuilder rb{ctx, 4};
137 rb.Push(RESULT_SUCCESS); 162 rb.Push(RESULT_SUCCESS);
163
138 const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 164 const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
139 FileSys::PatchManager pm{title_id}; 165 FileSys::PatchManager pm{title_id};
140 166
@@ -148,10 +174,17 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
148} 174}
149 175
150void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { 176void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) {
177 struct Parameters {
178 s32 addon_index;
179 u64 process_id;
180 };
181 static_assert(sizeof(Parameters) == 16);
182
151 IPC::RequestParser rp{ctx}; 183 IPC::RequestParser rp{ctx};
184 const auto [addon_index, process_id] = rp.PopRaw<Parameters>();
152 185
153 const auto aoc_id = rp.PopRaw<u32>(); 186 LOG_WARNING(Service_AOC, "(STUBBED) called with addon_index={}, process_id={}", addon_index,
154 LOG_WARNING(Service_AOC, "(STUBBED) called with aoc_id={:08X}", aoc_id); 187 process_id);
155 188
156 IPC::ResponseBuilder rb{ctx, 2}; 189 IPC::ResponseBuilder rb{ctx, 2};
157 rb.Push(RESULT_SUCCESS); 190 rb.Push(RESULT_SUCCESS);