summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-07-24 04:09:43 +0200
committerSubv <subv2112@gmail.com>2015-07-24 04:32:30 +0200
commit599744921de3160a1f91b78bc5fa5394c9e09730 (patch)
tree9c2a31867b1bb0190798bac41823d17c27128583 /src/core
parentService/APT: Return proper parameters in GetLockHandle. (diff)
downloadyuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar.gz
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar.bz2
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar.lz
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar.xz
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.tar.zst
yuzu-599744921de3160a1f91b78bc5fa5394c9e09730.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/applets/applet.cpp2
-rw-r--r--src/core/hle/service/apt/apt.cpp21
-rw-r--r--src/core/hle/service/apt/apt.h11
-rw-r--r--src/core/hle/service/apt/apt_a.cpp1
-rw-r--r--src/core/hle/service/apt/apt_s.cpp4
-rw-r--r--src/core/hle/service/apt/apt_u.cpp2
6 files changed, 36 insertions, 5 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index e9ab6ffd8..bc2a1829e 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -91,7 +91,7 @@ ResultCode Applet::Start(const Service::APT::AppletStartupParameter& parameter)
bool IsLibraryAppletRunning() {
// Check the applets map for instances of any applet
- for (auto& itr = applets.begin(); itr != applets.end(); ++itr)
+ for (auto itr = applets.begin(); itr != applets.end(); ++itr)
if (itr->second != nullptr)
return true;
return false;
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 1988be521..35402341b 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -334,7 +334,26 @@ void GetAppCpuTimeLimit(Service::Interface* self) {
void PrepareToStartLibraryApplet(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
AppletId applet_id = static_cast<AppletId>(cmd_buff[1]);
- cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw;
+ auto applet = HLE::Applets::Applet::Get(applet_id);
+ if (applet) {
+ LOG_WARNING(Service_APT, "applet has already been started id=%08X", applet_id);
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ } else {
+ cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw;
+ }
+ LOG_DEBUG(Service_APT, "called applet_id=%08X", applet_id);
+}
+
+void PreloadLibraryApplet(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+ AppletId applet_id = static_cast<AppletId>(cmd_buff[1]);
+ auto applet = HLE::Applets::Applet::Get(applet_id);
+ if (applet) {
+ LOG_WARNING(Service_APT, "applet has already been started id=%08X", applet_id);
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ } else {
+ cmd_buff[1] = HLE::Applets::Applet::Create(applet_id).raw;
+ }
LOG_DEBUG(Service_APT, "called applet_id=%08X", applet_id);
}
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h
index 563068d5a..4a72b6b5c 100644
--- a/src/core/hle/service/apt/apt.h
+++ b/src/core/hle/service/apt/apt.h
@@ -303,6 +303,17 @@ void GetAppCpuTimeLimit(Service::Interface* self);
void PrepareToStartLibraryApplet(Service::Interface* self);
/**
+ * APT::PreloadLibraryApplet service function
+ * Inputs:
+ * 0 : Command header [0x00160040]
+ * 1 : Id of the applet to start
+ * Outputs:
+ * 0 : Return header
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void PreloadLibraryApplet(Service::Interface* self);
+
+/**
* APT::StartLibraryApplet service function
* Inputs:
* 0 : Command header [0x001E0084]
diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp
index 88de339f9..22800c56f 100644
--- a/src/core/hle/service/apt/apt_a.cpp
+++ b/src/core/hle/service/apt/apt_a.cpp
@@ -21,6 +21,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x000D0080, ReceiveParameter, "ReceiveParameter"},
{0x000E0080, GlanceParameter, "GlanceParameter"},
{0x000F0100, CancelParameter, "CancelParameter"},
+ {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"},
{0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"},
{0x001E0084, StartLibraryApplet, "StartLibraryApplet"},
{0x003B0040, nullptr, "CancelLibraryApplet?"},
diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp
index 396d1f04a..3ac6ff94f 100644
--- a/src/core/hle/service/apt/apt_s.cpp
+++ b/src/core/hle/service/apt/apt_s.cpp
@@ -32,9 +32,9 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00130000, nullptr, "GetPreparationState"},
{0x00140040, nullptr, "SetPreparationState"},
{0x00150140, nullptr, "PrepareToStartApplication"},
- {0x00160040, nullptr, "PreloadLibraryApplet"},
+ {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"},
{0x00170040, nullptr, "FinishPreloadingLibraryApplet"},
- {0x00180040, nullptr, "PrepareToStartLibraryApplet"},
+ {0x00180040, PrepareToStartLibraryApplet,"PrepareToStartLibraryApplet"},
{0x00190040, nullptr, "PrepareToStartSystemApplet"},
{0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"},
{0x001B00C4, nullptr, "StartApplication"},
diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp
index b724cd72b..146bfd595 100644
--- a/src/core/hle/service/apt/apt_u.cpp
+++ b/src/core/hle/service/apt/apt_u.cpp
@@ -33,7 +33,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00130000, nullptr, "GetPreparationState"},
{0x00140040, nullptr, "SetPreparationState"},
{0x00150140, nullptr, "PrepareToStartApplication"},
- {0x00160040, nullptr, "PreloadLibraryApplet"},
+ {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"},
{0x00170040, nullptr, "FinishPreloadingLibraryApplet"},
{0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"},
{0x00190040, nullptr, "PrepareToStartSystemApplet"},