yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Services: Initialize all state variables at bootup.

This commit is contained in:
bunnei 2015-04-27 22:01:48 -04:00
parent bbabed8e98
commit e0cb85691a
8 changed files with 38 additions and 22 deletions

View File

@ -28,15 +28,15 @@ namespace APT {
static const VAddr SHARED_FONT_VADDR = 0x18000000; static const VAddr SHARED_FONT_VADDR = 0x18000000;
/// Handle to shared memory region designated to for shared system font /// Handle to shared memory region designated to for shared system font
static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem = nullptr; static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem;
static Kernel::SharedPtr<Kernel::Mutex> lock = nullptr; static Kernel::SharedPtr<Kernel::Mutex> lock;
static Kernel::SharedPtr<Kernel::Event> notification_event = nullptr; ///< APT notification event static Kernel::SharedPtr<Kernel::Event> notification_event; ///< APT notification event
static Kernel::SharedPtr<Kernel::Event> start_event = nullptr; ///< APT start event static Kernel::SharedPtr<Kernel::Event> start_event; ///< APT start event
static std::vector<u8> shared_font; static std::vector<u8> shared_font;
static u32 cpu_percent = 0; ///< CPU time available to the running application static u32 cpu_percent; ///< CPU time available to the running application
void Initialize(Service::Interface* self) { void Initialize(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
@ -309,6 +309,7 @@ void Init() {
} }
lock = Kernel::Mutex::Create(false, "APT_U:Lock"); lock = Kernel::Mutex::Create(false, "APT_U:Lock");
cpu_percent = 0; cpu_percent = 0;
// TODO(bunnei): Check if these are created in Initialize or on APT process startup. // TODO(bunnei): Check if these are created in Initialize or on APT process startup.
@ -317,7 +318,11 @@ void Init() {
} }
void Shutdown() { void Shutdown() {
shared_font.clear();
shared_font_mem = nullptr;
lock = nullptr;
notification_event = nullptr;
start_event = nullptr;
} }
} // namespace APT } // namespace APT

View File

@ -207,6 +207,7 @@ void Init() {
// Initialize the Username block // Initialize the Username block
// TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals
memset(&CONSOLE_USERNAME_BLOCK, 0, sizeof(CONSOLE_USERNAME_BLOCK));
CONSOLE_USERNAME_BLOCK.ng_word = 0; CONSOLE_USERNAME_BLOCK.ng_word = 0;
CONSOLE_USERNAME_BLOCK.zero = 0; CONSOLE_USERNAME_BLOCK.zero = 0;
@ -219,7 +220,6 @@ void Init() {
} }
void Shutdown() { void Shutdown() {
} }
} // namespace CFG } // namespace CFG

View File

@ -11,7 +11,7 @@
namespace DSP_DSP { namespace DSP_DSP {
static u32 read_pipe_count = 0; static u32 read_pipe_count;
static Kernel::SharedPtr<Kernel::Event> semaphore_event; static Kernel::SharedPtr<Kernel::Event> semaphore_event;
static Kernel::SharedPtr<Kernel::Event> interrupt_event; static Kernel::SharedPtr<Kernel::Event> interrupt_event;

View File

@ -20,17 +20,17 @@ namespace HID {
static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position static const int MAX_CIRCLEPAD_POS = 0x9C; ///< Max value for a circle pad position
// Handle to shared memory region designated to HID_User service // Handle to shared memory region designated to HID_User service
static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem = nullptr; static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
// Event handles // Event handles
static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1 = nullptr; static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_1;
static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2 = nullptr; static Kernel::SharedPtr<Kernel::Event> event_pad_or_touch_2;
static Kernel::SharedPtr<Kernel::Event> event_accelerometer = nullptr; static Kernel::SharedPtr<Kernel::Event> event_accelerometer;
static Kernel::SharedPtr<Kernel::Event> event_gyroscope = nullptr; static Kernel::SharedPtr<Kernel::Event> event_gyroscope;
static Kernel::SharedPtr<Kernel::Event> event_debug_pad = nullptr; static Kernel::SharedPtr<Kernel::Event> event_debug_pad;
static u32 next_pad_index = 0; static u32 next_pad_index;
static u32 next_touch_index = 0; static u32 next_touch_index;
// TODO(peachum): // TODO(peachum):
// Add a method for setting analog input from joystick device for the circle Pad. // Add a method for setting analog input from joystick device for the circle Pad.
@ -175,6 +175,12 @@ void Init() {
} }
void Shutdown() { void Shutdown() {
shared_mem = nullptr;
event_pad_or_touch_1 = nullptr;
event_pad_or_touch_2 = nullptr;
event_accelerometer = nullptr;
event_gyroscope = nullptr;
event_debug_pad = nullptr;
} }
} // namespace HID } // namespace HID

View File

@ -15,8 +15,8 @@
namespace Service { namespace Service {
namespace IR { namespace IR {
static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; static Kernel::SharedPtr<Kernel::Event> handle_event;
static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;
void GetHandles(Service::Interface* self) { void GetHandles(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
@ -41,6 +41,8 @@ void Init() {
} }
void Shutdown() { void Shutdown() {
shared_memory = nullptr;
handle_event = nullptr;
} }
} // namespace IR } // namespace IR

View File

@ -11,7 +11,7 @@
namespace NWM_UDS { namespace NWM_UDS {
static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; static Kernel::SharedPtr<Kernel::Event> handle_event;
/** /**
* NWM_UDS::Shutdown service function * NWM_UDS::Shutdown service function

View File

@ -18,9 +18,9 @@ static const GameCoin default_game_coin = { 0x4F00, 42, 0, 0, 0, 2014, 12, 29 };
/// Id of the SharedExtData archive used by the PTM process /// Id of the SharedExtData archive used by the PTM process
static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0}; static const std::vector<u8> ptm_shared_extdata_id = {0, 0, 0, 0, 0x0B, 0, 0, 0xF0, 0, 0, 0, 0};
static bool shell_open = true; static bool shell_open;
static bool battery_is_charging = true; static bool battery_is_charging;
u32 GetAdapterState() { u32 GetAdapterState() {
// TODO(purpasmart96): This function is only a stub, // TODO(purpasmart96): This function is only a stub,
@ -43,6 +43,9 @@ void Init() {
AddService(new PTM_Sysm_Interface); AddService(new PTM_Sysm_Interface);
AddService(new PTM_U_Interface); AddService(new PTM_U_Interface);
shell_open = true;
battery_is_charging = true;
// Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist
FileSys::Path archive_path(ptm_shared_extdata_id); FileSys::Path archive_path(ptm_shared_extdata_id);
auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path);

View File

@ -11,7 +11,7 @@
namespace Y2R_U { namespace Y2R_U {
static Kernel::SharedPtr<Kernel::Event> completion_event = 0; static Kernel::SharedPtr<Kernel::Event> completion_event;
/** /**
* Y2R_U::IsBusyConversion service function * Y2R_U::IsBusyConversion service function