diff options
| author | 2015-04-27 22:01:48 -0400 | |
|---|---|---|
| committer | 2015-05-01 18:27:02 -0400 | |
| commit | e0cb85691a99fb06dbce5e802ae756a944b1a66c (patch) | |
| tree | d82acb9b470acec2f5faf5b2c6d9ea7cd6982018 /src | |
| parent | Memory: Properly cleanup & shutdown. (diff) | |
| download | yuzu-e0cb85691a99fb06dbce5e802ae756a944b1a66c.tar.gz yuzu-e0cb85691a99fb06dbce5e802ae756a944b1a66c.tar.xz yuzu-e0cb85691a99fb06dbce5e802ae756a944b1a66c.zip | |
Services: Initialize all state variables at bootup.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/apt/apt.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/nwm_uds.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/service/y2r_u.cpp | 2 |
8 files changed, 38 insertions, 22 deletions
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 190c5df7a..98ae80b3a 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -28,15 +28,15 @@ namespace APT { | |||
| 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; | 28 | static const VAddr SHARED_FONT_VADDR = 0x18000000; |
| 29 | 29 | ||
| 30 | /// Handle to shared memory region designated to for shared system font | 30 | /// Handle to shared memory region designated to for shared system font |
| 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem = nullptr; | 31 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem; |
| 32 | 32 | ||
| 33 | static Kernel::SharedPtr<Kernel::Mutex> lock = nullptr; | 33 | static Kernel::SharedPtr<Kernel::Mutex> lock; |
| 34 | static Kernel::SharedPtr<Kernel::Event> notification_event = nullptr; ///< APT notification event | 34 | static Kernel::SharedPtr<Kernel::Event> notification_event; ///< APT notification event |
| 35 | static Kernel::SharedPtr<Kernel::Event> start_event = nullptr; ///< APT start event | 35 | static Kernel::SharedPtr<Kernel::Event> start_event; ///< APT start event |
| 36 | 36 | ||
| 37 | static std::vector<u8> shared_font; | 37 | static std::vector<u8> shared_font; |
| 38 | 38 | ||
| 39 | static u32 cpu_percent = 0; ///< CPU time available to the running application | 39 | static u32 cpu_percent; ///< CPU time available to the running application |
| 40 | 40 | ||
| 41 | void Initialize(Service::Interface* self) { | 41 | void Initialize(Service::Interface* self) { |
| 42 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 42 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| @@ -309,6 +309,7 @@ void Init() { | |||
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); | 311 | lock = Kernel::Mutex::Create(false, "APT_U:Lock"); |
| 312 | |||
| 312 | cpu_percent = 0; | 313 | cpu_percent = 0; |
| 313 | 314 | ||
| 314 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. | 315 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. |
| @@ -317,7 +318,11 @@ void Init() { | |||
| 317 | } | 318 | } |
| 318 | 319 | ||
| 319 | void Shutdown() { | 320 | void Shutdown() { |
| 320 | 321 | shared_font.clear(); | |
| 322 | shared_font_mem = nullptr; | ||
| 323 | lock = nullptr; | ||
| 324 | notification_event = nullptr; | ||
| 325 | start_event = nullptr; | ||
| 321 | } | 326 | } |
| 322 | 327 | ||
| 323 | } // namespace APT | 328 | } // namespace APT |
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 6af0352ac..5eccdecf7 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -207,6 +207,7 @@ void Init() { | |||
| 207 | 207 | ||
| 208 | // Initialize the Username block | 208 | // Initialize the Username block |
| 209 | // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals | 209 | // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals |
| 210 | memset(&CONSOLE_USERNAME_BLOCK, 0, sizeof(CONSOLE_USERNAME_BLOCK)); | ||
| 210 | CONSOLE_USERNAME_BLOCK.ng_word = 0; | 211 | CONSOLE_USERNAME_BLOCK.ng_word = 0; |
| 211 | CONSOLE_USERNAME_BLOCK.zero = 0; | 212 | CONSOLE_USERNAME_BLOCK.zero = 0; |
| 212 | 213 | ||
| @@ -219,7 +220,6 @@ void Init() { | |||
| 219 | } | 220 | } |
| 220 | 221 | ||
| 221 | void Shutdown() { | 222 | void Shutdown() { |
| 222 | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | } // namespace CFG | 225 | } // namespace CFG |
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 4d6c70f4d..2e759a3e3 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace DSP_DSP { | 12 | namespace DSP_DSP { |
| 13 | 13 | ||
| 14 | static u32 read_pipe_count = 0; | 14 | static u32 read_pipe_count; |
| 15 | static Kernel::SharedPtr<Kernel::Event> semaphore_event; | 15 | static Kernel::SharedPtr<Kernel::Event> semaphore_event; |
| 16 | static Kernel::SharedPtr<Kernel::Event> interrupt_event; | 16 | static Kernel::SharedPtr<Kernel::Event> interrupt_event; |
| 17 | 17 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 9ca5d13d4..0f30f743a 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -20,17 +20,17 @@ namespace HID { | |||
| 20 | static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position | 20 | static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position |
| 21 | 21 | ||
| 22 | // Handle to shared memory region designated to HID_User service | 22 | // Handle to shared memory region designated to HID_User service |
| 23 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem = nullptr; | 23 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem; |
| 24 | 24 | ||
| 25 | // Event handles | 25 | // Event handles |
| 26 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1 = nullptr; | 26 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1; |
| 27 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2 = nullptr; | 27 | static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2; |
| 28 | static Kernel::SharedPtr<Kernel::Event> event_accelerometer = nullptr; | 28 | static Kernel::SharedPtr<Kernel::Event> event_accelerometer; |
| 29 | static Kernel::SharedPtr<Kernel::Event> event_gyroscope = nullptr; | 29 | static Kernel::SharedPtr<Kernel::Event> event_gyroscope; |
| 30 | static Kernel::SharedPtr<Kernel::Event> event_debug_pad = nullptr; | 30 | static Kernel::SharedPtr<Kernel::Event> event_debug_pad; |
| 31 | 31 | ||
| 32 | static u32 next_pad_index = 0; | 32 | static u32 next_pad_index; |
| 33 | static u32 next_touch_index = 0; | 33 | static u32 next_touch_index; |
| 34 | 34 | ||
| 35 | // TODO(peachum): | 35 | // TODO(peachum): |
| 36 | // Add a method for setting analog input from joystick device for the circle Pad. | 36 | // Add a method for setting analog input from joystick device for the circle Pad. |
| @@ -175,6 +175,12 @@ void Init() { | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void Shutdown() { | 177 | void Shutdown() { |
| 178 | shared_mem = nullptr; | ||
| 179 | event_pad_or_touch_1 = nullptr; | ||
| 180 | event_pad_or_touch_2 = nullptr; | ||
| 181 | event_accelerometer = nullptr; | ||
| 182 | event_gyroscope = nullptr; | ||
| 183 | event_debug_pad = nullptr; | ||
| 178 | } | 184 | } |
| 179 | 185 | ||
| 180 | } // namespace HID | 186 | } // namespace HID |
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index 58dfd8e1a..15ac477ef 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | namespace Service { | 15 | namespace Service { |
| 16 | namespace IR { | 16 | namespace IR { |
| 17 | 17 | ||
| 18 | static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; | 18 | static Kernel::SharedPtr<Kernel::Event> handle_event; |
| 19 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; | 19 | static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory; |
| 20 | 20 | ||
| 21 | void GetHandles(Service::Interface* self) { | 21 | void GetHandles(Service::Interface* self) { |
| 22 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 22 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| @@ -41,6 +41,8 @@ void Init() { | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void Shutdown() { | 43 | void Shutdown() { |
| 44 | shared_memory = nullptr; | ||
| 45 | handle_event = nullptr; | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | } // namespace IR | 48 | } // namespace IR |
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 1cee81ab2..4b06efc3a 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace NWM_UDS { | 12 | namespace NWM_UDS { |
| 13 | 13 | ||
| 14 | static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; | 14 | static Kernel::SharedPtr<Kernel::Event> handle_event; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * NWM_UDS::Shutdown service function | 17 | * NWM_UDS::Shutdown service function |
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 57a301bec..d44510c1b 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp | |||
| @@ -18,9 +18,9 @@ static const GameCoin default_game_coin = { 0x4F00, 42, 0, 0, 0, 2014, 12, 29 }; | |||
| 18 | /// Id of the SharedExtData archive used by the PTM process | 18 | /// Id of the SharedExtData archive used by the PTM process |
| 19 | static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0}; | 19 | static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0}; |
| 20 | 20 | ||
| 21 | static bool shell_open = true; | 21 | static bool shell_open; |
| 22 | 22 | ||
| 23 | static bool battery_is_charging = true; | 23 | static bool battery_is_charging; |
| 24 | 24 | ||
| 25 | u32 GetAdapterState() { | 25 | u32 GetAdapterState() { |
| 26 | // TODO(purpasmart96): This function is only a stub, | 26 | // TODO(purpasmart96): This function is only a stub, |
| @@ -43,6 +43,9 @@ void Init() { | |||
| 43 | AddService(new PTM_Sysm_Interface); | 43 | AddService(new PTM_Sysm_Interface); |
| 44 | AddService(new PTM_U_Interface); | 44 | AddService(new PTM_U_Interface); |
| 45 | 45 | ||
| 46 | shell_open = true; | ||
| 47 | battery_is_charging = true; | ||
| 48 | |||
| 46 | // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist | 49 | // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist |
| 47 | FileSys::Path archive_path(ptm_shared_extdata_id); | 50 | FileSys::Path archive_path(ptm_shared_extdata_id); |
| 48 | auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); | 51 | auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); |
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 6607965e1..33ecf64a2 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Y2R_U { | 12 | namespace Y2R_U { |
| 13 | 13 | ||
| 14 | static Kernel::SharedPtr<Kernel::Event> completion_event = 0; | 14 | static Kernel::SharedPtr<Kernel::Event> completion_event; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | * Y2R_U::IsBusyConversion service function | 17 | * Y2R_U::IsBusyConversion service function |