summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Lioncash2016-12-07 17:11:39 -0500
committerGravatar Lioncash2016-12-07 17:13:46 -0500
commitf1709b8b5986af28546877be4c162884118ca161 (patch)
tree5b4d2b287ea2dbda6e31a9bf3e8ef9bd010a9d50 /src/core
parentapplet: Make virtual destructor defaulted (diff)
downloadyuzu-f1709b8b5986af28546877be4c162884118ca161.tar.gz
yuzu-f1709b8b5986af28546877be4c162884118ca161.tar.xz
yuzu-f1709b8b5986af28546877be4c162884118ca161.zip
applet: Move common IsRunning underlying variable to the Applet class
Gets rid of basic duplication.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/applets/applet.cpp4
-rw-r--r--src/core/hle/applets/applet.h5
-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, 19 insertions, 28 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 583ddbe10..ebeed9813 100644
--- a/src/core/hle/applets/applet.h
+++ b/src/core/hle/applets/applet.h
@@ -47,7 +47,7 @@ public:
47 /** 47 /**
48 * 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.
49 */ 49 */
50 virtual bool IsRunning() const = 0; 50 bool IsRunning() const;
51 51
52 /** 52 /**
53 * 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.
@@ -66,6 +66,9 @@ protected:
66 66
67 Service::APT::AppletId id; ///< Id of this Applet 67 Service::APT::AppletId id; ///< Id of this Applet
68 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;
69}; 72};
70 73
71/// 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