summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-12-07 22:36:40 -0800
committerGravatar GitHub2016-12-07 22:36:40 -0800
commitbc48e2bda6012b578748608e093d4f9e25b191cd (patch)
tree7ab11cf2244d87e8a05c9a316573b910b3054d7c /src
parentMerge pull request #2282 from lioncash/svc (diff)
parentapplet: Move common IsRunning underlying variable to the Applet class (diff)
downloadyuzu-bc48e2bda6012b578748608e093d4f9e25b191cd.tar.gz
yuzu-bc48e2bda6012b578748608e093d4f9e25b191cd.tar.xz
yuzu-bc48e2bda6012b578748608e093d4f9e25b191cd.zip
Merge pull request #2281 from lioncash/applet
applet: minor interface changes
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/applets/applet.cpp4
-rw-r--r--src/core/hle/applets/applet.h10
-rw-r--r--src/core/hle/applets/erreula.cpp4
-rw-r--r--src/core/hle/applets/erreula.h8
-rw-r--r--src/core/hle/applets/mii_selector.cpp4
-rw-r--r--src/core/hle/applets/mii_selector.h9
-rw-r--r--src/core/hle/applets/swkbd.cpp4
-rw-r--r--src/core/hle/applets/swkbd.h9
8 files changed, 22 insertions, 30 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index 4311d9897..645b2d5fe 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -101,6 +101,10 @@ ResultCode Applet::Start(const Service::APT::AppletStartupParameter& parameter)
101 return result; 101 return result;
102} 102}
103 103
104bool Applet::IsRunning() const {
105 return is_running;
106}
107
104bool IsLibraryAppletRunning() { 108bool IsLibraryAppletRunning() {
105 // Check the applets map for instances of any applet 109 // Check the applets map for instances of any applet
106 for (auto itr = applets.begin(); itr != applets.end(); ++itr) 110 for (auto itr = applets.begin(); itr != applets.end(); ++itr)
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h
index bfdcad126..ebeed9813 100644
--- a/src/core/hle/applets/applet.h
+++ b/src/core/hle/applets/applet.h
@@ -13,8 +13,7 @@ namespace Applets {
13 13
14class Applet { 14class Applet {
15public: 15public:
16 virtual ~Applet() {} 16 virtual ~Applet() = default;
17 Applet(Service::APT::AppletId id) : id(id) {}
18 17
19 /** 18 /**
20 * Creates an instance of the Applet subclass identified by the parameter. 19 * Creates an instance of the Applet subclass identified by the parameter.
@@ -48,7 +47,7 @@ public:
48 /** 47 /**
49 * Whether the applet is currently executing instead of the host application or not. 48 * Whether the applet is currently executing instead of the host application or not.
50 */ 49 */
51 virtual bool IsRunning() const = 0; 50 bool IsRunning() const;
52 51
53 /** 52 /**
54 * Handles an update tick for the Applet, lets it update the screen, send commands, etc. 53 * Handles an update tick for the Applet, lets it update the screen, send commands, etc.
@@ -56,6 +55,8 @@ public:
56 virtual void Update() = 0; 55 virtual void Update() = 0;
57 56
58protected: 57protected:
58 explicit Applet(Service::APT::AppletId id) : id(id) {}
59
59 /** 60 /**
60 * Handles the Applet start event, triggered from the application. 61 * Handles the Applet start event, triggered from the application.
61 * @param parameter Parameter data to handle. 62 * @param parameter Parameter data to handle.
@@ -65,6 +66,9 @@ protected:
65 66
66 Service::APT::AppletId id; ///< Id of this Applet 67 Service::APT::AppletId id; ///< Id of this Applet
67 std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet 68 std::shared_ptr<std::vector<u8>> heap_memory; ///< Heap memory for this Applet
69
70 /// Whether this applet is currently running instead of the host application or not.
71 bool is_running = false;
68}; 72};
69 73
70/// Returns whether a library applet is currently running 74/// Returns whether a library applet is currently running
diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp
index e1379ac4d..75d7fd9fc 100644
--- a/src/core/hle/applets/erreula.cpp
+++ b/src/core/hle/applets/erreula.cpp
@@ -47,7 +47,7 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param
47} 47}
48 48
49ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parameter) { 49ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
50 started = true; 50 is_running = true;
51 51
52 // TODO(Subv): Set the expected fields in the response buffer before resending it to the 52 // TODO(Subv): Set the expected fields in the response buffer before resending it to the
53 // application. 53 // application.
@@ -62,7 +62,7 @@ ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parame
62 message.sender_id = static_cast<u32>(id); 62 message.sender_id = static_cast<u32>(id);
63 Service::APT::SendParameter(message); 63 Service::APT::SendParameter(message);
64 64
65 started = false; 65 is_running = false;
66 return RESULT_SUCCESS; 66 return RESULT_SUCCESS;
67} 67}
68 68
diff --git a/src/core/hle/applets/erreula.h b/src/core/hle/applets/erreula.h
index a7ec7ec01..681bbea0c 100644
--- a/src/core/hle/applets/erreula.h
+++ b/src/core/hle/applets/erreula.h
@@ -17,18 +17,12 @@ public:
17 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; 17 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
18 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; 18 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
19 void Update() override; 19 void Update() override;
20 bool IsRunning() const override {
21 return started;
22 }
23 20
21private:
24 /// This SharedMemory will be created when we receive the LibAppJustStarted message. 22 /// This SharedMemory will be created when we receive the LibAppJustStarted message.
25 /// It holds the framebuffer info retrieved by the application with 23 /// It holds the framebuffer info retrieved by the application with
26 /// GSPGPU::ImportDisplayCaptureInfo 24 /// GSPGPU::ImportDisplayCaptureInfo
27 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; 25 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
28
29private:
30 /// Whether this applet is currently running instead of the host application or not.
31 bool started = false;
32}; 26};
33 27
34} // namespace Applets 28} // namespace Applets
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
index 3455b9201..07c7f5b99 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -55,7 +55,7 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
55} 55}
56 56
57ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) { 57ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
58 started = true; 58 is_running = true;
59 59
60 // TODO(Subv): Set the expected fields in the response buffer before resending it to the 60 // TODO(Subv): Set the expected fields in the response buffer before resending it to the
61 // application. 61 // application.
@@ -78,7 +78,7 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa
78 message.sender_id = static_cast<u32>(id); 78 message.sender_id = static_cast<u32>(id);
79 Service::APT::SendParameter(message); 79 Service::APT::SendParameter(message);
80 80
81 started = false; 81 is_running = false;
82 return RESULT_SUCCESS; 82 return RESULT_SUCCESS;
83} 83}
84 84
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h
index e3ab9f0cd..ec00e29d2 100644
--- a/src/core/hle/applets/mii_selector.h
+++ b/src/core/hle/applets/mii_selector.h
@@ -65,23 +65,18 @@ ASSERT_REG_POSITION(unk_6C, 0x6C);
65 65
66class MiiSelector final : public Applet { 66class MiiSelector final : public Applet {
67public: 67public:
68 MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) {} 68 MiiSelector(Service::APT::AppletId id) : Applet(id) {}
69 69
70 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; 70 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
71 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; 71 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
72 void Update() override; 72 void Update() override;
73 bool IsRunning() const override {
74 return started;
75 }
76 73
74private:
77 /// This SharedMemory will be created when we receive the LibAppJustStarted message. 75 /// This SharedMemory will be created when we receive the LibAppJustStarted message.
78 /// It holds the framebuffer info retrieved by the application with 76 /// It holds the framebuffer info retrieved by the application with
79 /// GSPGPU::ImportDisplayCaptureInfo 77 /// GSPGPU::ImportDisplayCaptureInfo
80 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory; 78 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
81 79
82 /// Whether this applet is currently running instead of the host application or not.
83 bool started;
84
85 MiiConfig config; 80 MiiConfig config;
86}; 81};
87} 82}
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index 1e21337f5..edd30d7ef 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -70,7 +70,7 @@ ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter cons
70 70
71 DrawScreenKeyboard(); 71 DrawScreenKeyboard();
72 72
73 started = true; 73 is_running = true;
74 return RESULT_SUCCESS; 74 return RESULT_SUCCESS;
75} 75}
76 76
@@ -113,7 +113,7 @@ void SoftwareKeyboard::Finalize() {
113 message.sender_id = static_cast<u32>(id); 113 message.sender_id = static_cast<u32>(id);
114 Service::APT::SendParameter(message); 114 Service::APT::SendParameter(message);
115 115
116 started = false; 116 is_running = false;
117} 117}
118} 118}
119} // namespace 119} // namespace
diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h
index ea0b1fba9..cc92a8f19 100644
--- a/src/core/hle/applets/swkbd.h
+++ b/src/core/hle/applets/swkbd.h
@@ -52,14 +52,11 @@ static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config
52 52
53class SoftwareKeyboard final : public Applet { 53class SoftwareKeyboard final : public Applet {
54public: 54public:
55 SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) {} 55 SoftwareKeyboard(Service::APT::AppletId id) : Applet(id) {}
56 56
57 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; 57 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
58 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; 58 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
59 void Update() override; 59 void Update() override;
60 bool IsRunning() const override {
61 return started;
62 }
63 60
64 /** 61 /**
65 * Draws a keyboard to the current bottom screen framebuffer. 62 * Draws a keyboard to the current bottom screen framebuffer.
@@ -72,6 +69,7 @@ public:
72 */ 69 */
73 void Finalize(); 70 void Finalize();
74 71
72private:
75 /// This SharedMemory will be created when we receive the LibAppJustStarted message. 73 /// This SharedMemory will be created when we receive the LibAppJustStarted message.
76 /// It holds the framebuffer info retrieved by the application with 74 /// It holds the framebuffer info retrieved by the application with
77 /// GSPGPU::ImportDisplayCaptureInfo 75 /// GSPGPU::ImportDisplayCaptureInfo
@@ -82,9 +80,6 @@ public:
82 80
83 /// Configuration of this instance of the SoftwareKeyboard, as received from the application 81 /// Configuration of this instance of the SoftwareKeyboard, as received from the application
84 SoftwareKeyboardConfig config; 82 SoftwareKeyboardConfig config;
85
86 /// Whether this applet is currently running instead of the host application or not.
87 bool started;
88}; 83};
89} 84}
90} // namespace 85} // namespace