summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/am.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-17 18:19:06 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commit4ee087fb3ca2b1e064422b73195a8ff7698721d9 (patch)
tree5dcd31972d79e324e8eb75e19c3c00ff2a83b03c /src/core/hle/service/am/am.cpp
parentapplet: Add operation completed callback (diff)
downloadyuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar.gz
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar.bz2
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar.lz
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar.xz
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.tar.zst
yuzu-4ee087fb3ca2b1e064422b73195a8ff7698721d9.zip
Diffstat (limited to 'src/core/hle/service/am/am.cpp')
-rw-r--r--src/core/hle/service/am/am.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 5cbcb8d91..d92a46b00 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -567,12 +567,12 @@ public:
private:
void AppletStorageProxyOutData(IStorage storage) {
- storage_stack.push_back(std::make_shared<IStorage>(storage));
+ storage_stack.push(std::make_shared<IStorage>(storage));
pop_out_data_event->Signal();
}
void AppletStorageProxyOutInteractiveData(IStorage storage) {
- interactive_storage_stack.push_back(std::make_shared<IStorage>(storage));
+ interactive_storage_stack.push(std::make_shared<IStorage>(storage));
pop_interactive_out_data_event->Signal();
}
@@ -621,7 +621,7 @@ private:
void PushInData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- storage_stack.push_back(rp.PopIpcInterface<IStorage>());
+ storage_stack.push(rp.PopIpcInterface<IStorage>());
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@@ -631,17 +631,23 @@ private:
void PopOutData(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+
+ if (storage_stack.empty()) {
+ rb.Push(ResultCode(-1));
+ return;
+ }
+
rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IStorage>(std::move(storage_stack.back()));
+ rb.PushIpcInterface<IStorage>(std::move(storage_stack.front()));
- storage_stack.pop_back();
+ storage_stack.pop();
LOG_DEBUG(Service_AM, "called");
}
void PushInteractiveInData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- interactive_storage_stack.push_back(rp.PopIpcInterface<IStorage>());
+ interactive_storage_stack.push(rp.PopIpcInterface<IStorage>());
ASSERT(applet->IsInitialized());
applet->ReceiveInteractiveData(interactive_storage_stack.back());
@@ -657,10 +663,16 @@ private:
void PopInteractiveOutData(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+
+ if (interactive_storage_stack.empty()) {
+ rb.Push(ResultCode(-1));
+ return;
+ }
+
rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<IStorage>(std::move(interactive_storage_stack.back()));
+ rb.PushIpcInterface<IStorage>(std::move(interactive_storage_stack.front()));
- interactive_storage_stack.pop_back();
+ interactive_storage_stack.pop();
LOG_DEBUG(Service_AM, "called");
}
@@ -682,8 +694,8 @@ private:
}
std::shared_ptr<Applets::Applet> applet;
- std::vector<std::shared_ptr<IStorage>> storage_stack;
- std::vector<std::shared_ptr<IStorage>> interactive_storage_stack;
+ std::queue<std::shared_ptr<IStorage>> storage_stack;
+ std::queue<std::shared_ptr<IStorage>> interactive_storage_stack;
Kernel::SharedPtr<Kernel::Event> state_changed_event;
Kernel::SharedPtr<Kernel::Event> pop_out_data_event;
Kernel::SharedPtr<Kernel::Event> pop_interactive_out_data_event;