diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 4a72b6b5c..cff707256 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -1,339 +1,349 @@ -// Copyright 2015 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_types.h" - -#include "core/hle/kernel/kernel.h" - -namespace Service { - -class Interface; - -namespace APT { - -/// Holds information about the parameters used in Send/Glance/ReceiveParameter -struct MessageParameter { - u32 sender_id = 0; - u32 destination_id = 0; - u32 signal = 0; - u32 buffer_size = 0; - Kernel::SharedPtr object = nullptr; - u8* data = nullptr; -}; - -/// Holds information about the parameters used in StartLibraryApplet -struct AppletStartupParameter { - u32 buffer_size = 0; - Kernel::SharedPtr object = nullptr; - u8* data = nullptr; -}; - -/// Signals used by APT functions -enum class SignalType : u32 { - None = 0x0, - AppJustStarted = 0x1, - LibAppJustStarted = 0x2, - LibAppFinished = 0x3, - LibAppClosed = 0xA, - ReturningToApp = 0xB, - ExitingApp = 0xC, -}; - -/// App Id's used by APT functions -enum class AppletId : u32 { - HomeMenu = 0x101, - AlternateMenu = 0x103, - Camera = 0x110, - FriendsList = 0x112, - GameNotes = 0x113, - InternetBrowser = 0x114, - InstructionManual = 0x115, - Notifications = 0x116, - Miiverse = 0x117, - SoftwareKeyboard1 = 0x201, - Ed = 0x202, - PnoteApp = 0x204, - SnoteApp = 0x205, - Error = 0x206, - Mint = 0x207, - Extrapad = 0x208, - Memolib = 0x209, - Application = 0x300, - AnyLibraryApplet = 0x400, - SoftwareKeyboard2 = 0x401, -}; - -/// Send a parameter to the currently-running application, which will read it via ReceiveParameter -void SendParameter(const MessageParameter& parameter); - -/** - * APT::Initialize service function - * Service function that initializes the APT process for the running application - * Outputs: - * 1 : Result of the function, 0 on success, otherwise error code - * 3 : Handle to the notification event - * 4 : Handle to the pause event - */ -void Initialize(Service::Interface* self); - -/** - * APT::GetSharedFont service function - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Virtual address of where shared font will be loaded in memory - * 4 : Handle to shared font memory - */ -void GetSharedFont(Service::Interface* self); - -/** - * APT::NotifyToWait service function - * Inputs: - * 1 : AppID - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void NotifyToWait(Service::Interface* self); - -/** - * APT::GetLockHandle service function - * Inputs: - * 1 : Applet attributes - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Applet attributes - * 3 : Power button state - * 4 : IPC handle descriptor - * 5 : APT mutex handle - */ -void GetLockHandle(Service::Interface* self); - -/** - * APT::Enable service function - * Inputs: - * 1 : Applet attributes - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void Enable(Service::Interface* self); - -/** - * APT::GetAppletManInfo service function. - * Inputs: - * 1 : Unknown - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Unknown u32 value - * 3 : Unknown u8 value - * 4 : Home Menu AppId - * 5 : AppID of currently active app - */ -void GetAppletManInfo(Service::Interface* self); - -/** - * APT::IsRegistered service function. This returns whether the specified AppID is registered with NS yet. - * An AppID is "registered" once the process associated with the AppID uses APT:Enable. Home Menu uses this - * command to determine when the launched process is running and to determine when to stop using GSP etc, - * while displaying the "Nintendo 3DS" loading screen. - * Inputs: - * 1 : AppID - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Output, 0 = not registered, 1 = registered. - */ -void IsRegistered(Service::Interface* self); - -void InquireNotification(Service::Interface* self); - -/** - * APT::SendParameter service function. This sets the parameter data state. - * Inputs: - * 1 : Source AppID - * 2 : Destination AppID - * 3 : Signal type - * 4 : Parameter buffer size, max size is 0x1000 (this can be zero) - * 5 : Value - * 6 : Handle to the destination process, likely used for shared memory (this can be zero) - * 7 : (Size<<14) | 2 - * 8 : Input parameter buffer ptr - * Outputs: - * 0 : Return Header - * 1 : Result of function, 0 on success, otherwise error code -*/ -void SendParameter(Service::Interface* self); - -/** - * APT::ReceiveParameter service function. This returns the current parameter data from NS state, - * from the source process which set the parameters. Once finished, NS will clear a flag in the NS - * state so that this command will return an error if this command is used again if parameters were - * not set again. This is called when the second Initialize event is triggered. It returns a signal - * type indicating why it was triggered. - * Inputs: - * 1 : AppID - * 2 : Parameter buffer size, max size is 0x1000 - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : AppID of the process which sent these parameters - * 3 : Signal type - * 4 : Actual parameter buffer size, this is <= to the the input size - * 5 : Value - * 6 : Handle from the source process which set the parameters, likely used for shared memory - * 7 : Size - * 8 : Output parameter buffer ptr - */ -void ReceiveParameter(Service::Interface* self); - -/** - * APT::GlanceParameter service function. This is exactly the same as APT_U::ReceiveParameter - * (except for the word value prior to the output handle), except this will not clear the flag - * (except when responseword[3]==8 || responseword[3]==9) in NS state. - * Inputs: - * 1 : AppID - * 2 : Parameter buffer size, max size is 0x1000 - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Unknown, for now assume AppID of the process which sent these parameters - * 3 : Unknown, for now assume Signal type - * 4 : Actual parameter buffer size, this is <= to the the input size - * 5 : Value - * 6 : Handle from the source process which set the parameters, likely used for shared memory - * 7 : Size - * 8 : Output parameter buffer ptr - */ -void GlanceParameter(Service::Interface* self); - -/** - * APT::CancelParameter service function. When the parameter data is available, and when the above - * specified fields match the ones in NS state(for the ones where the checks are enabled), this - * clears the flag which indicates that parameter data is available - * (same flag cleared by APT:ReceiveParameter). - * Inputs: - * 1 : Flag, when non-zero NS will compare the word after this one with a field in the NS state. - * 2 : Unknown, this is the same as the first unknown field returned by APT:ReceiveParameter. - * 3 : Flag, when non-zero NS will compare the word after this one with a field in the NS state. - * 4 : AppID - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - * 2 : Status flag, 0 = failure due to no parameter data being available, or the above enabled - * fields don't match the fields in NS state. 1 = success. - */ -void CancelParameter(Service::Interface* self); - -/** - * APT::PrepareToStartApplication service function. When the input title-info programID is zero, - * NS will load the actual program ID via AMNet:GetTitleIDList. After doing some checks with the - * programID, NS will then set a NS state flag to value 1, then set the programID for AppID - * 0x300(application) to the input program ID(or the one from GetTitleIDList). A media-type field - * in the NS state is also set to the input media-type value - * (other state fields are set at this point as well). With 8.0.0-18, NS will set an u8 NS state - * field to value 1 when input flags bit8 is set - * Inputs: - * 1-4 : 0x10-byte title-info struct - * 4 : Flags - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - */ -void PrepareToStartApplication(Service::Interface* self); - -/** - * APT::StartApplication service function. Buf0 is copied to NS FIRMparams+0x0, then Buf1 is copied - * to the NS FIRMparams+0x480. Then the application is launched. - * Inputs: - * 1 : Buffer 0 size, max size is 0x300 - * 2 : Buffer 1 size, max size is 0x20 (this can be zero) - * 3 : u8 flag - * 4 : (Size0<<14) | 2 - * 5 : Buffer 0 pointer - * 6 : (Size1<<14) | 0x802 - * 7 : Buffer 1 pointer - * Outputs: - * 0 : Return Header - * 1 : Result of function, 0 on success, otherwise error code -*/ -void StartApplication(Service::Interface* self); - -/** - * APT::AppletUtility service function - * Inputs: - * 1 : Unknown, but clearly used for something - * 2 : Buffer 1 size (purpose is unknown) - * 3 : Buffer 2 size (purpose is unknown) - * 5 : Buffer 1 address (purpose is unknown) - * 65 : Buffer 2 address (purpose is unknown) - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void AppletUtility(Service::Interface* self); - -/** - * APT::SetAppCpuTimeLimit service function - * Inputs: - * 1 : Value, must be one - * 2 : Percentage of CPU time from 5 to 80 - * Outputs: - * 1 : Result of function, 0 on success, otherwise error code - */ -void SetAppCpuTimeLimit(Service::Interface* self); - -/** - * APT::GetAppCpuTimeLimit service function - * Inputs: - * 1 : Value, must be one - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - * 2 : System core CPU time percentage - */ -void GetAppCpuTimeLimit(Service::Interface* self); - -/** - * APT::PrepareToStartLibraryApplet service function - * Inputs: - * 0 : Command header [0x00180040] - * 1 : Id of the applet to start - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - */ -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] - * 1 : Id of the applet to start - * 2 : Buffer size - * 3 : Always 0? - * 4 : Handle passed to the applet - * 5 : (Size << 14) | 2 - * 6 : Input buffer virtual address - * Outputs: - * 0 : Return header - * 1 : Result of function, 0 on success, otherwise error code - */ -void StartLibraryApplet(Service::Interface* self); - -/// Initialize the APT service -void Init(); - -/// Shutdown the APT service -void Shutdown(); - -} // namespace APT -} // namespace Service +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +#include "core/hle/kernel/kernel.h" + +namespace Service { + +class Interface; + +namespace APT { + +/// Holds information about the parameters used in Send/Glance/ReceiveParameter +struct MessageParameter { + u32 sender_id = 0; + u32 destination_id = 0; + u32 signal = 0; + u32 buffer_size = 0; + Kernel::SharedPtr object = nullptr; + u8* data = nullptr; +}; + +/// Holds information about the parameters used in StartLibraryApplet +struct AppletStartupParameter { + u32 buffer_size = 0; + Kernel::SharedPtr object = nullptr; + u8* data = nullptr; +}; + +/// Signals used by APT functions +enum class SignalType : u32 { + None = 0x0, + AppJustStarted = 0x1, + LibAppJustStarted = 0x2, + LibAppFinished = 0x3, + LibAppClosed = 0xA, + ReturningToApp = 0xB, + ExitingApp = 0xC, +}; + +/// App Id's used by APT functions +enum class AppletId : u32 { + HomeMenu = 0x101, + AlternateMenu = 0x103, + CameraApplet = 0x110, + FriendsListApplet = 0x112, + GameNotesApplet = 0x113, + InternetBrowser = 0x114, + InstructionManual = 0x115, + Notifications = 0x116, + MiiverseApplet = 0x117, + MiiversePostingApplet = 0x118, + AmiiboSettings = 0x119, + SoftwareKeyboard1 = 0x201, + MiiSelectorEd1 = 0x202, + PhotoSelector1 = 0x204, + SoundSelector1 = 0x205, + ErrorDisplay1 = 0x206, + EShopMint1 = 0x207, + Extrapad1 = 0x208, + Notepad1 = 0x209, + Application = 0x300, + EShopTiger = 0x301, + AnyLibraryApplet = 0x400, + SoftwareKeyboard2 = 0x401, + MiiSelectorEd2 = 0x402, + PhotoSelector2 = 0x404, + SoundSelector2 = 0x405, + ErrorDisplay2 = 0x406, + EShopMint2 = 0x407, + Extrapad2 = 0x408, + Notepad2 = 0x409 +}; + +/// Send a parameter to the currently-running application, which will read it via ReceiveParameter +void SendParameter(const MessageParameter& parameter); + +/** + * APT::Initialize service function + * Service function that initializes the APT process for the running application + * Outputs: + * 1 : Result of the function, 0 on success, otherwise error code + * 3 : Handle to the notification event + * 4 : Handle to the pause event + */ +void Initialize(Service::Interface* self); + +/** + * APT::GetSharedFont service function + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Virtual address of where shared font will be loaded in memory + * 4 : Handle to shared font memory + */ +void GetSharedFont(Service::Interface* self); + +/** + * APT::NotifyToWait service function + * Inputs: + * 1 : AppID + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void NotifyToWait(Service::Interface* self); + +/** + * APT::GetLockHandle service function + * Inputs: + * 1 : Applet attributes + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Applet attributes + * 3 : Power button state + * 4 : IPC handle descriptor + * 5 : APT mutex handle + */ +void GetLockHandle(Service::Interface* self); + +/** + * APT::Enable service function + * Inputs: + * 1 : Applet attributes + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void Enable(Service::Interface* self); + +/** + * APT::GetAppletManInfo service function. + * Inputs: + * 1 : Unknown + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Unknown u32 value + * 3 : Unknown u8 value + * 4 : Home Menu AppId + * 5 : AppID of currently active app + */ +void GetAppletManInfo(Service::Interface* self); + +/** + * APT::IsRegistered service function. This returns whether the specified AppID is registered with NS yet. + * An AppID is "registered" once the process associated with the AppID uses APT:Enable. Home Menu uses this + * command to determine when the launched process is running and to determine when to stop using GSP etc, + * while displaying the "Nintendo 3DS" loading screen. + * Inputs: + * 1 : AppID + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Output, 0 = not registered, 1 = registered. + */ +void IsRegistered(Service::Interface* self); + +void InquireNotification(Service::Interface* self); + +/** + * APT::SendParameter service function. This sets the parameter data state. + * Inputs: + * 1 : Source AppID + * 2 : Destination AppID + * 3 : Signal type + * 4 : Parameter buffer size, max size is 0x1000 (this can be zero) + * 5 : Value + * 6 : Handle to the destination process, likely used for shared memory (this can be zero) + * 7 : (Size<<14) | 2 + * 8 : Input parameter buffer ptr + * Outputs: + * 0 : Return Header + * 1 : Result of function, 0 on success, otherwise error code +*/ +void SendParameter(Service::Interface* self); + +/** + * APT::ReceiveParameter service function. This returns the current parameter data from NS state, + * from the source process which set the parameters. Once finished, NS will clear a flag in the NS + * state so that this command will return an error if this command is used again if parameters were + * not set again. This is called when the second Initialize event is triggered. It returns a signal + * type indicating why it was triggered. + * Inputs: + * 1 : AppID + * 2 : Parameter buffer size, max size is 0x1000 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : AppID of the process which sent these parameters + * 3 : Signal type + * 4 : Actual parameter buffer size, this is <= to the the input size + * 5 : Value + * 6 : Handle from the source process which set the parameters, likely used for shared memory + * 7 : Size + * 8 : Output parameter buffer ptr + */ +void ReceiveParameter(Service::Interface* self); + +/** + * APT::GlanceParameter service function. This is exactly the same as APT_U::ReceiveParameter + * (except for the word value prior to the output handle), except this will not clear the flag + * (except when responseword[3]==8 || responseword[3]==9) in NS state. + * Inputs: + * 1 : AppID + * 2 : Parameter buffer size, max size is 0x1000 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Unknown, for now assume AppID of the process which sent these parameters + * 3 : Unknown, for now assume Signal type + * 4 : Actual parameter buffer size, this is <= to the the input size + * 5 : Value + * 6 : Handle from the source process which set the parameters, likely used for shared memory + * 7 : Size + * 8 : Output parameter buffer ptr + */ +void GlanceParameter(Service::Interface* self); + +/** + * APT::CancelParameter service function. When the parameter data is available, and when the above + * specified fields match the ones in NS state(for the ones where the checks are enabled), this + * clears the flag which indicates that parameter data is available + * (same flag cleared by APT:ReceiveParameter). + * Inputs: + * 1 : Flag, when non-zero NS will compare the word after this one with a field in the NS state. + * 2 : Unknown, this is the same as the first unknown field returned by APT:ReceiveParameter. + * 3 : Flag, when non-zero NS will compare the word after this one with a field in the NS state. + * 4 : AppID + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Status flag, 0 = failure due to no parameter data being available, or the above enabled + * fields don't match the fields in NS state. 1 = success. + */ +void CancelParameter(Service::Interface* self); + +/** + * APT::PrepareToStartApplication service function. When the input title-info programID is zero, + * NS will load the actual program ID via AMNet:GetTitleIDList. After doing some checks with the + * programID, NS will then set a NS state flag to value 1, then set the programID for AppID + * 0x300(application) to the input program ID(or the one from GetTitleIDList). A media-type field + * in the NS state is also set to the input media-type value + * (other state fields are set at this point as well). With 8.0.0-18, NS will set an u8 NS state + * field to value 1 when input flags bit8 is set + * Inputs: + * 1-4 : 0x10-byte title-info struct + * 4 : Flags + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + */ +void PrepareToStartApplication(Service::Interface* self); + +/** + * APT::StartApplication service function. Buf0 is copied to NS FIRMparams+0x0, then Buf1 is copied + * to the NS FIRMparams+0x480. Then the application is launched. + * Inputs: + * 1 : Buffer 0 size, max size is 0x300 + * 2 : Buffer 1 size, max size is 0x20 (this can be zero) + * 3 : u8 flag + * 4 : (Size0<<14) | 2 + * 5 : Buffer 0 pointer + * 6 : (Size1<<14) | 0x802 + * 7 : Buffer 1 pointer + * Outputs: + * 0 : Return Header + * 1 : Result of function, 0 on success, otherwise error code +*/ +void StartApplication(Service::Interface* self); + +/** + * APT::AppletUtility service function + * Inputs: + * 1 : Unknown, but clearly used for something + * 2 : Buffer 1 size (purpose is unknown) + * 3 : Buffer 2 size (purpose is unknown) + * 5 : Buffer 1 address (purpose is unknown) + * 65 : Buffer 2 address (purpose is unknown) + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void AppletUtility(Service::Interface* self); + +/** + * APT::SetAppCpuTimeLimit service function + * Inputs: + * 1 : Value, must be one + * 2 : Percentage of CPU time from 5 to 80 + * Outputs: + * 1 : Result of function, 0 on success, otherwise error code + */ +void SetAppCpuTimeLimit(Service::Interface* self); + +/** + * APT::GetAppCpuTimeLimit service function + * Inputs: + * 1 : Value, must be one + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + * 2 : System core CPU time percentage + */ +void GetAppCpuTimeLimit(Service::Interface* self); + +/** + * APT::PrepareToStartLibraryApplet service function + * Inputs: + * 0 : Command header [0x00180040] + * 1 : Id of the applet to start + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + */ +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] + * 1 : Id of the applet to start + * 2 : Buffer size + * 3 : Always 0? + * 4 : Handle passed to the applet + * 5 : (Size << 14) | 2 + * 6 : Input buffer virtual address + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + */ +void StartLibraryApplet(Service::Interface* self); + +/// Initialize the APT service +void Init(); + +/// Shutdown the APT service +void Shutdown(); + +} // namespace APT +} // namespace Service diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 0c6a77305..6a5c692d1 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -1,38 +1,107 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/service/apt/apt.h" -#include "core/hle/service/apt/apt_a.h" - -namespace Service { -namespace APT { - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetLockHandle, "GetLockHandle?"}, - {0x00020080, Initialize, "Initialize?"}, - {0x00030040, Enable, "Enable?"}, - {0x00040040, nullptr, "Finalize?"}, - {0x00050040, nullptr, "GetAppletManInfo?"}, - {0x00060040, nullptr, "GetAppletInfo?"}, - {0x00090040, IsRegistered, "IsRegistered"}, - {0x000C0104, SendParameter, "SendParameter"}, - {0x000D0080, ReceiveParameter, "ReceiveParameter"}, - {0x000E0080, GlanceParameter, "GlanceParameter"}, - {0x000F0100, CancelParameter, "CancelParameter"}, - {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, - {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, - {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, - {0x003B0040, nullptr, "CancelLibraryApplet?"}, - {0x00430040, NotifyToWait, "NotifyToWait?"}, - {0x00440000, GetSharedFont, "GetSharedFont?"}, - {0x004B00C2, AppletUtility, "AppletUtility?"}, - {0x00550040, nullptr, "WriteInputToNsState?"}, -}; - -APT_A_Interface::APT_A_Interface() { - Register(FunctionTable); -} - -} // namespace APT -} // namespace Service +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_a.h" + +namespace Service { +namespace APT { + + const Interface::FunctionInfo FunctionTable[] = { + { 0x00010040, GetLockHandle, "GetLockHandle"}, + { 0x00020080, Initialize, "Initialize"}, + { 0x00030040, Enable, "Enable"}, + { 0x00040040, nullptr, "Finalize"}, + { 0x00050040, nullptr, "GetAppletManInfo"}, + { 0x00060040, nullptr, "GetAppletInfo"}, + { 0x00070000, nullptr, "GetLastSignaledAppletId"}, + { 0x00080000, nullptr, "CountRegisteredApplet"}, + { 0x00090040, IsRegistered, "IsRegistered"}, + { 0x000A0040, nullptr, "GetAttribute"}, + { 0x000B0040, InquireNotification, "InquireNotification"}, + { 0x000C0104, SendParameter, "SendParameter"}, + { 0x000D0080, ReceiveParameter, "ReceiveParameter"}, + { 0x000E0080, GlanceParameter, "GlanceParameter"}, + { 0x000F0100, CancelParameter, "CancelParameter"}, + { 0x001000C2, nullptr, "DebugFunc"}, + { 0x001100C0, nullptr, "MapProgramIdForDebug"}, + { 0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"}, + { 0x00130000, nullptr, "GetPreparationState"}, + { 0x00140040, nullptr, "SetPreparationState"}, + { 0x00150140, nullptr, "PrepareToStartApplication"}, + { 0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, + { 0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, + { 0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet" }, + { 0x00190040, nullptr, "PrepareToStartSystemApplet" }, + { 0x001A0000, nullptr, "PrepareToStartNewestHomeMenu" }, + { 0x001B00C4, nullptr, "StartApplication" }, + { 0x001C0000, nullptr, "WakeupApplication" }, + { 0x001D0000, nullptr, "CancelApplication" }, + { 0x001E0084, nullptr, "StartLibraryApplet" }, + { 0x001F0084, StartLibraryApplet, "StartSystemApplet" }, + { 0x00200044, nullptr, "StartNewestHomeMenu" }, + { 0x00210000, nullptr, "OrderToCloseApplication" }, + { 0x00220040, nullptr, "PrepareToCloseApplication" }, + { 0x00230040, nullptr, "PrepareToJumpToApplication" }, + { 0x00240044, nullptr, "JumpToApplication" }, + { 0x002500C0, nullptr, "PrepareToCloseLibraryApplet" }, + { 0x00260000, nullptr, "PrepareToCloseSystemApplet" }, + { 0x00270044, nullptr, "CloseApplication" }, + { 0x00280044, nullptr, "CloseLibraryApplet" }, + { 0x00290044, nullptr, "CloseSystemApplet" }, + { 0x002A0000, nullptr, "OrderToCloseSystemApplet" }, + { 0x002B0000, nullptr, "PrepareToJumpToHomeMenu" }, + { 0x002C0044, nullptr, "JumpToHomeMenu" }, + { 0x002D0000, nullptr, "PrepareToLeaveHomeMenu" }, + { 0x002E0044, nullptr, "LeaveHomeMenu" }, + { 0x002F0040, nullptr, "PrepareToLeaveResidentApplet" }, + { 0x00300044, nullptr, "LeaveResidentApplet" }, + { 0x00310100, nullptr, "PrepareToDoApplicationJump" }, + { 0x00320084, nullptr, "DoApplicationJump" }, + { 0x00330000, nullptr, "GetProgramIdOnApplicationJump" }, + { 0x00340084, nullptr, "SendDeliverArg" }, + { 0x00350080, nullptr, "ReceiveDeliverArg" }, + { 0x00360040, nullptr, "LoadSysMenuArg" }, + { 0x00370042, nullptr, "StoreSysMenuArg" }, + { 0x00380040, nullptr, "PreloadResidentApplet" }, + { 0x00390040, nullptr, "PrepareToStartResidentApplet" }, + { 0x003A0044, nullptr, "StartResidentApplet" }, + { 0x003B0040, nullptr, "CancelLibraryApplet" }, + { 0x003C0042, nullptr, "SendDspSleep" }, + { 0x003D0042, nullptr, "SendDspWakeUp" }, + { 0x003E0080, nullptr, "ReplySleepQuery" }, + { 0x003F0040, nullptr, "ReplySleepNotificationComplete" }, + { 0x00400042, nullptr, "SendCaptureBufferInfo" }, + { 0x00410040, nullptr, "ReceiveCaptureBufferInfo" }, + { 0x00420080, nullptr, "SleepSystem" }, + { 0x00430040, NotifyToWait, "NotifyToWait" }, + { 0x00440000, GetSharedFont, "GetSharedFont" }, + { 0x00450040, nullptr, "GetWirelessRebootInfo" }, + { 0x00460104, nullptr, "Wrap" }, + { 0x00470104, nullptr, "Unwrap" }, + { 0x00480100, nullptr, "GetProgramInfo" }, + { 0x00490180, nullptr, "Reboot" }, + { 0x004A0040, nullptr, "GetCaptureInfo" }, + { 0x004B00C2, AppletUtility, "AppletUtility" }, + { 0x004C0000, nullptr, "SetFatalErrDispMode" }, + { 0x004D0080, nullptr, "GetAppletProgramInfo" }, + { 0x004E0000, nullptr, "HardwareResetAsync" }, + { 0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit" }, + { 0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit" }, + { 0x00510080, nullptr, "GetStartupArgument" }, + { 0x00520104, nullptr, "Wrap1" }, + { 0x00530104, nullptr, "Unwrap1" }, + { 0x00580002, nullptr, "GetProgramID" }, + { 0x01010000, nullptr, "CheckNew3DSApp" }, + { 0x01020000, nullptr, "CheckNew3DS" }, + { 0x01040000, nullptr, "IsStandardMemoryLayout"}, + { 0x01050100, nullptr, "IsTitleAllowed"} +}; + +APT_A_Interface::APT_A_Interface() { + Register(FunctionTable); +} + +} // namespace APT +} // namespace Service diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 7f6e81a63..f0492410c 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -1,105 +1,107 @@ -// Copyright 2015 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/service/apt/apt.h" -#include "core/hle/service/apt/apt_s.h" - -namespace Service { -namespace APT { - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetLockHandle, "GetLockHandle"}, - {0x00020080, Initialize, "Initialize"}, - {0x00030040, Enable, "Enable"}, - {0x00040040, nullptr, "Finalize"}, - {0x00050040, nullptr, "GetAppletManInfo"}, - {0x00060040, nullptr, "GetAppletInfo"}, - {0x00070000, nullptr, "GetLastSignaledAppletId"}, - {0x00080000, nullptr, "CountRegisteredApplet"}, - {0x00090040, nullptr, "IsRegistered"}, - {0x000A0040, nullptr, "GetAttribute"}, - {0x000B0040, InquireNotification, "InquireNotification"}, - {0x000C0104, nullptr, "SendParameter"}, - {0x000D0080, ReceiveParameter, "ReceiveParameter"}, - {0x000E0080, GlanceParameter, "GlanceParameter"}, - {0x000F0100, nullptr, "CancelParameter"}, - {0x001000C2, nullptr, "DebugFunc"}, - {0x001100C0, nullptr, "MapProgramIdForDebug"}, - {0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"}, - {0x00130000, nullptr, "GetPreparationState"}, - {0x00140040, nullptr, "SetPreparationState"}, - {0x00150140, nullptr, "PrepareToStartApplication"}, - {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, - {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, - {0x00180040, PrepareToStartLibraryApplet,"PrepareToStartLibraryApplet"}, - {0x00190040, nullptr, "PrepareToStartSystemApplet"}, - {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, - {0x001B00C4, nullptr, "StartApplication"}, - {0x001C0000, nullptr, "WakeupApplication"}, - {0x001D0000, nullptr, "CancelApplication"}, - {0x001E0084, nullptr, "StartLibraryApplet"}, - {0x001F0084, nullptr, "StartSystemApplet"}, - {0x00200044, nullptr, "StartNewestHomeMenu"}, - {0x00210000, nullptr, "OrderToCloseApplication"}, - {0x00220040, nullptr, "PrepareToCloseApplication"}, - {0x00230040, nullptr, "PrepareToJumpToApplication"}, - {0x00240044, nullptr, "JumpToApplication"}, - {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"}, - {0x00260000, nullptr, "PrepareToCloseSystemApplet"}, - {0x00270044, nullptr, "CloseApplication"}, - {0x00280044, nullptr, "CloseLibraryApplet"}, - {0x00290044, nullptr, "CloseSystemApplet"}, - {0x002A0000, nullptr, "OrderToCloseSystemApplet"}, - {0x002B0000, nullptr, "PrepareToJumpToHomeMenu"}, - {0x002C0044, nullptr, "JumpToHomeMenu"}, - {0x002D0000, nullptr, "PrepareToLeaveHomeMenu"}, - {0x002E0044, nullptr, "LeaveHomeMenu"}, - {0x002F0040, nullptr, "PrepareToLeaveResidentApplet"}, - {0x00300044, nullptr, "LeaveResidentApplet"}, - {0x00310100, nullptr, "PrepareToDoApplicationJump"}, - {0x00320084, nullptr, "DoApplicationJump"}, - {0x00330000, nullptr, "GetProgramIdOnApplicationJump"}, - {0x00340084, nullptr, "SendDeliverArg"}, - {0x00350080, nullptr, "ReceiveDeliverArg"}, - {0x00360040, nullptr, "LoadSysMenuArg"}, - {0x00370042, nullptr, "StoreSysMenuArg"}, - {0x00380040, nullptr, "PreloadResidentApplet"}, - {0x00390040, nullptr, "PrepareToStartResidentApplet"}, - {0x003A0044, nullptr, "StartResidentApplet"}, - {0x003B0040, nullptr, "CancelLibraryApplet"}, - {0x003C0042, nullptr, "SendDspSleep"}, - {0x003D0042, nullptr, "SendDspWakeUp"}, - {0x003E0080, nullptr, "ReplySleepQuery"}, - {0x003F0040, nullptr, "ReplySleepNotificationComplete"}, - {0x00400042, nullptr, "SendCaptureBufferInfo"}, - {0x00410040, nullptr, "ReceiveCaptureBufferInfo"}, - {0x00420080, nullptr, "SleepSystem"}, - {0x00430040, NotifyToWait, "NotifyToWait"}, - {0x00440000, GetSharedFont, "GetSharedFont"}, - {0x00450040, nullptr, "GetWirelessRebootInfo"}, - {0x00460104, nullptr, "Wrap"}, - {0x00470104, nullptr, "Unwrap"}, - {0x00480100, nullptr, "GetProgramInfo"}, - {0x00490180, nullptr, "Reboot"}, - {0x004A0040, nullptr, "GetCaptureInfo"}, - {0x004B00C2, AppletUtility, "AppletUtility"}, - {0x004C0000, nullptr, "SetFatalErrDispMode"}, - {0x004D0080, nullptr, "GetAppletProgramInfo"}, - {0x004E0000, nullptr, "HardwareResetAsync"}, - {0x004F0080, nullptr, "SetApplicationCpuTimeLimit"}, - {0x00500040, nullptr, "GetApplicationCpuTimeLimit"}, - {0x00510080, nullptr, "GetStartupArgument"}, - {0x00520104, nullptr, "Wrap1"}, - {0x00530104, nullptr, "Unwrap1"}, - {0x00580002, nullptr, "GetProgramID"}, - {0x01010000, nullptr, "CheckNew3DSApp"}, - {0x01020000, nullptr, "CheckNew3DS"} -}; - -APT_S_Interface::APT_S_Interface() { - Register(FunctionTable); -} - -} // namespace APT -} // namespace Service +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_s.h" + +namespace Service { +namespace APT { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010040, GetLockHandle, "GetLockHandle"}, + {0x00020080, Initialize, "Initialize"}, + {0x00030040, Enable, "Enable"}, + {0x00040040, nullptr, "Finalize"}, + {0x00050040, nullptr, "GetAppletManInfo"}, + {0x00060040, nullptr, "GetAppletInfo"}, + {0x00070000, nullptr, "GetLastSignaledAppletId"}, + {0x00080000, nullptr, "CountRegisteredApplet"}, + {0x00090040, nullptr, "IsRegistered"}, + {0x000A0040, nullptr, "GetAttribute"}, + {0x000B0040, InquireNotification, "InquireNotification"}, + {0x000C0104, nullptr, "SendParameter"}, + {0x000D0080, ReceiveParameter, "ReceiveParameter"}, + {0x000E0080, GlanceParameter, "GlanceParameter"}, + {0x000F0100, nullptr, "CancelParameter"}, + {0x001000C2, nullptr, "DebugFunc"}, + {0x001100C0, nullptr, "MapProgramIdForDebug"}, + {0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"}, + {0x00130000, nullptr, "GetPreparationState"}, + {0x00140040, nullptr, "SetPreparationState"}, + {0x00150140, nullptr, "PrepareToStartApplication"}, + {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, + {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, + {0x00180040, PrepareToStartLibraryApplet,"PrepareToStartLibraryApplet"}, + {0x00190040, nullptr, "PrepareToStartSystemApplet"}, + {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, + {0x001B00C4, nullptr, "StartApplication"}, + {0x001C0000, nullptr, "WakeupApplication"}, + {0x001D0000, nullptr, "CancelApplication"}, + {0x001E0084, nullptr, "StartLibraryApplet"}, + {0x001F0084, StartLibraryApplet, "StartSystemApplet"}, + {0x00200044, nullptr, "StartNewestHomeMenu"}, + {0x00210000, nullptr, "OrderToCloseApplication"}, + {0x00220040, nullptr, "PrepareToCloseApplication"}, + {0x00230040, nullptr, "PrepareToJumpToApplication"}, + {0x00240044, nullptr, "JumpToApplication"}, + {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"}, + {0x00260000, nullptr, "PrepareToCloseSystemApplet"}, + {0x00270044, nullptr, "CloseApplication"}, + {0x00280044, nullptr, "CloseLibraryApplet"}, + {0x00290044, nullptr, "CloseSystemApplet"}, + {0x002A0000, nullptr, "OrderToCloseSystemApplet"}, + {0x002B0000, nullptr, "PrepareToJumpToHomeMenu"}, + {0x002C0044, nullptr, "JumpToHomeMenu"}, + {0x002D0000, nullptr, "PrepareToLeaveHomeMenu"}, + {0x002E0044, nullptr, "LeaveHomeMenu"}, + {0x002F0040, nullptr, "PrepareToLeaveResidentApplet"}, + {0x00300044, nullptr, "LeaveResidentApplet"}, + {0x00310100, nullptr, "PrepareToDoApplicationJump"}, + {0x00320084, nullptr, "DoApplicationJump"}, + {0x00330000, nullptr, "GetProgramIdOnApplicationJump"}, + {0x00340084, nullptr, "SendDeliverArg"}, + {0x00350080, nullptr, "ReceiveDeliverArg"}, + {0x00360040, nullptr, "LoadSysMenuArg"}, + {0x00370042, nullptr, "StoreSysMenuArg"}, + {0x00380040, nullptr, "PreloadResidentApplet"}, + {0x00390040, nullptr, "PrepareToStartResidentApplet"}, + {0x003A0044, nullptr, "StartResidentApplet"}, + {0x003B0040, nullptr, "CancelLibraryApplet"}, + {0x003C0042, nullptr, "SendDspSleep"}, + {0x003D0042, nullptr, "SendDspWakeUp"}, + {0x003E0080, nullptr, "ReplySleepQuery"}, + {0x003F0040, nullptr, "ReplySleepNotificationComplete"}, + {0x00400042, nullptr, "SendCaptureBufferInfo"}, + {0x00410040, nullptr, "ReceiveCaptureBufferInfo"}, + {0x00420080, nullptr, "SleepSystem"}, + {0x00430040, NotifyToWait, "NotifyToWait"}, + {0x00440000, GetSharedFont, "GetSharedFont"}, + {0x00450040, nullptr, "GetWirelessRebootInfo"}, + {0x00460104, nullptr, "Wrap"}, + {0x00470104, nullptr, "Unwrap"}, + {0x00480100, nullptr, "GetProgramInfo"}, + {0x00490180, nullptr, "Reboot"}, + {0x004A0040, nullptr, "GetCaptureInfo"}, + {0x004B00C2, AppletUtility, "AppletUtility"}, + {0x004C0000, nullptr, "SetFatalErrDispMode"}, + {0x004D0080, nullptr, "GetAppletProgramInfo"}, + {0x004E0000, nullptr, "HardwareResetAsync"}, + {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit" }, + {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit" }, + {0x00510080, nullptr, "GetStartupArgument"}, + {0x00520104, nullptr, "Wrap1"}, + {0x00530104, nullptr, "Unwrap1"}, + {0x00580002, nullptr, "GetProgramID"}, + {0x01010000, nullptr, "CheckNew3DSApp"}, + {0x01020000, nullptr, "CheckNew3DS"}, + {0x01040000, nullptr, "IsStandardMemoryLayout" }, + {0x01050100, nullptr, "IsTitleAllowed" } +}; + +APT_S_Interface::APT_S_Interface() { + Register(FunctionTable); +} + +} // namespace APT +} // namespace Service diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 209a0055b..e2c9a0081 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -1,105 +1,107 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/service/apt/apt.h" -#include "core/hle/service/apt/apt_u.h" - -namespace Service { -namespace APT { - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010040, GetLockHandle, "GetLockHandle"}, - {0x00020080, Initialize, "Initialize"}, - {0x00030040, Enable, "Enable"}, - {0x00040040, nullptr, "Finalize"}, - {0x00050040, GetAppletManInfo, "GetAppletManInfo"}, - {0x00060040, nullptr, "GetAppletInfo"}, - {0x00070000, nullptr, "GetLastSignaledAppletId"}, - {0x00080000, nullptr, "CountRegisteredApplet"}, - {0x00090040, IsRegistered, "IsRegistered"}, - {0x000A0040, nullptr, "GetAttribute"}, - {0x000B0040, InquireNotification, "InquireNotification"}, - {0x000C0104, SendParameter, "SendParameter"}, - {0x000D0080, ReceiveParameter, "ReceiveParameter"}, - {0x000E0080, GlanceParameter, "GlanceParameter"}, - {0x000F0100, CancelParameter, "CancelParameter"}, - {0x001000C2, nullptr, "DebugFunc"}, - {0x001100C0, nullptr, "MapProgramIdForDebug"}, - {0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"}, - {0x00130000, nullptr, "GetPreparationState"}, - {0x00140040, nullptr, "SetPreparationState"}, - {0x00150140, nullptr, "PrepareToStartApplication"}, - {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, - {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, - {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, - {0x00190040, nullptr, "PrepareToStartSystemApplet"}, - {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, - {0x001B00C4, nullptr, "StartApplication"}, - {0x001C0000, nullptr, "WakeupApplication"}, - {0x001D0000, nullptr, "CancelApplication"}, - {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, - {0x001F0084, nullptr, "StartSystemApplet"}, - {0x00200044, nullptr, "StartNewestHomeMenu"}, - {0x00210000, nullptr, "OrderToCloseApplication"}, - {0x00220040, nullptr, "PrepareToCloseApplication"}, - {0x00230040, nullptr, "PrepareToJumpToApplication"}, - {0x00240044, nullptr, "JumpToApplication"}, - {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"}, - {0x00260000, nullptr, "PrepareToCloseSystemApplet"}, - {0x00270044, nullptr, "CloseApplication"}, - {0x00280044, nullptr, "CloseLibraryApplet"}, - {0x00290044, nullptr, "CloseSystemApplet"}, - {0x002A0000, nullptr, "OrderToCloseSystemApplet"}, - {0x002B0000, nullptr, "PrepareToJumpToHomeMenu"}, - {0x002C0044, nullptr, "JumpToHomeMenu"}, - {0x002D0000, nullptr, "PrepareToLeaveHomeMenu"}, - {0x002E0044, nullptr, "LeaveHomeMenu"}, - {0x002F0040, nullptr, "PrepareToLeaveResidentApplet"}, - {0x00300044, nullptr, "LeaveResidentApplet"}, - {0x00310100, nullptr, "PrepareToDoApplicationJump"}, - {0x00320084, nullptr, "DoApplicationJump"}, - {0x00330000, nullptr, "GetProgramIdOnApplicationJump"}, - {0x00340084, nullptr, "SendDeliverArg"}, - {0x00350080, nullptr, "ReceiveDeliverArg"}, - {0x00360040, nullptr, "LoadSysMenuArg"}, - {0x00370042, nullptr, "StoreSysMenuArg"}, - {0x00380040, nullptr, "PreloadResidentApplet"}, - {0x00390040, nullptr, "PrepareToStartResidentApplet"}, - {0x003A0044, nullptr, "StartResidentApplet"}, - {0x003B0040, nullptr, "CancelLibraryApplet"}, - {0x003C0042, nullptr, "SendDspSleep"}, - {0x003D0042, nullptr, "SendDspWakeUp"}, - {0x003E0080, nullptr, "ReplySleepQuery"}, - {0x003F0040, nullptr, "ReplySleepNotificationComplete"}, - {0x00400042, nullptr, "SendCaptureBufferInfo"}, - {0x00410040, nullptr, "ReceiveCaptureBufferInfo"}, - {0x00420080, nullptr, "SleepSystem"}, - {0x00430040, NotifyToWait, "NotifyToWait"}, - {0x00440000, GetSharedFont, "GetSharedFont"}, - {0x00450040, nullptr, "GetWirelessRebootInfo"}, - {0x00460104, nullptr, "Wrap"}, - {0x00470104, nullptr, "Unwrap"}, - {0x00480100, nullptr, "GetProgramInfo"}, - {0x00490180, nullptr, "Reboot"}, - {0x004A0040, nullptr, "GetCaptureInfo"}, - {0x004B00C2, AppletUtility, "AppletUtility"}, - {0x004C0000, nullptr, "SetFatalErrDispMode"}, - {0x004D0080, nullptr, "GetAppletProgramInfo"}, - {0x004E0000, nullptr, "HardwareResetAsync"}, - {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, - {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, - {0x00510080, nullptr, "GetStartupArgument"}, - {0x00520104, nullptr, "Wrap1"}, - {0x00530104, nullptr, "Unwrap1"}, - {0x00580002, nullptr, "GetProgramID"}, - {0x01010000, nullptr, "CheckNew3DSApp"}, - {0x01020000, nullptr, "CheckNew3DS"} -}; - -APT_U_Interface::APT_U_Interface() { - Register(FunctionTable); -} - -} // namespace APT -} // namespace Service +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_u.h" + +namespace Service { +namespace APT { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010040, GetLockHandle, "GetLockHandle"}, + {0x00020080, Initialize, "Initialize"}, + {0x00030040, Enable, "Enable"}, + {0x00040040, nullptr, "Finalize"}, + {0x00050040, GetAppletManInfo, "GetAppletManInfo"}, + {0x00060040, nullptr, "GetAppletInfo"}, + {0x00070000, nullptr, "GetLastSignaledAppletId"}, + {0x00080000, nullptr, "CountRegisteredApplet"}, + {0x00090040, IsRegistered, "IsRegistered"}, + {0x000A0040, nullptr, "GetAttribute"}, + {0x000B0040, InquireNotification, "InquireNotification"}, + {0x000C0104, SendParameter, "SendParameter"}, + {0x000D0080, ReceiveParameter, "ReceiveParameter"}, + {0x000E0080, GlanceParameter, "GlanceParameter"}, + {0x000F0100, CancelParameter, "CancelParameter"}, + {0x001000C2, nullptr, "DebugFunc"}, + {0x001100C0, nullptr, "MapProgramIdForDebug"}, + {0x00120040, nullptr, "SetHomeMenuAppletIdForDebug"}, + {0x00130000, nullptr, "GetPreparationState"}, + {0x00140040, nullptr, "SetPreparationState"}, + {0x00150140, nullptr, "PrepareToStartApplication"}, + {0x00160040, PreloadLibraryApplet, "PreloadLibraryApplet"}, + {0x00170040, nullptr, "FinishPreloadingLibraryApplet"}, + {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, + {0x00190040, nullptr, "PrepareToStartSystemApplet"}, + {0x001A0000, nullptr, "PrepareToStartNewestHomeMenu"}, + {0x001B00C4, nullptr, "StartApplication"}, + {0x001C0000, nullptr, "WakeupApplication"}, + {0x001D0000, nullptr, "CancelApplication"}, + {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, + {0x001F0084, nullptr, "StartSystemApplet"}, + {0x00200044, nullptr, "StartNewestHomeMenu"}, + {0x00210000, nullptr, "OrderToCloseApplication"}, + {0x00220040, nullptr, "PrepareToCloseApplication"}, + {0x00230040, nullptr, "PrepareToJumpToApplication"}, + {0x00240044, nullptr, "JumpToApplication"}, + {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"}, + {0x00260000, nullptr, "PrepareToCloseSystemApplet"}, + {0x00270044, nullptr, "CloseApplication"}, + {0x00280044, nullptr, "CloseLibraryApplet"}, + {0x00290044, nullptr, "CloseSystemApplet"}, + {0x002A0000, nullptr, "OrderToCloseSystemApplet"}, + {0x002B0000, nullptr, "PrepareToJumpToHomeMenu"}, + {0x002C0044, nullptr, "JumpToHomeMenu"}, + {0x002D0000, nullptr, "PrepareToLeaveHomeMenu"}, + {0x002E0044, nullptr, "LeaveHomeMenu"}, + {0x002F0040, nullptr, "PrepareToLeaveResidentApplet"}, + {0x00300044, nullptr, "LeaveResidentApplet"}, + {0x00310100, nullptr, "PrepareToDoApplicationJump"}, + {0x00320084, nullptr, "DoApplicationJump"}, + {0x00330000, nullptr, "GetProgramIdOnApplicationJump"}, + {0x00340084, nullptr, "SendDeliverArg"}, + {0x00350080, nullptr, "ReceiveDeliverArg"}, + {0x00360040, nullptr, "LoadSysMenuArg"}, + {0x00370042, nullptr, "StoreSysMenuArg"}, + {0x00380040, nullptr, "PreloadResidentApplet"}, + {0x00390040, nullptr, "PrepareToStartResidentApplet"}, + {0x003A0044, nullptr, "StartResidentApplet"}, + {0x003B0040, nullptr, "CancelLibraryApplet"}, + {0x003C0042, nullptr, "SendDspSleep"}, + {0x003D0042, nullptr, "SendDspWakeUp"}, + {0x003E0080, nullptr, "ReplySleepQuery"}, + {0x003F0040, nullptr, "ReplySleepNotificationComplete"}, + {0x00400042, nullptr, "SendCaptureBufferInfo"}, + {0x00410040, nullptr, "ReceiveCaptureBufferInfo"}, + {0x00420080, nullptr, "SleepSystem"}, + {0x00430040, NotifyToWait, "NotifyToWait"}, + {0x00440000, GetSharedFont, "GetSharedFont"}, + {0x00450040, nullptr, "GetWirelessRebootInfo"}, + {0x00460104, nullptr, "Wrap"}, + {0x00470104, nullptr, "Unwrap"}, + {0x00480100, nullptr, "GetProgramInfo"}, + {0x00490180, nullptr, "Reboot"}, + {0x004A0040, nullptr, "GetCaptureInfo"}, + {0x004B00C2, AppletUtility, "AppletUtility"}, + {0x004C0000, nullptr, "SetFatalErrDispMode"}, + {0x004D0080, nullptr, "GetAppletProgramInfo"}, + {0x004E0000, nullptr, "HardwareResetAsync"}, + {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, + {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, + {0x00510080, nullptr, "GetStartupArgument"}, + {0x00520104, nullptr, "Wrap1"}, + {0x00530104, nullptr, "Unwrap1"}, + {0x00580002, nullptr, "GetProgramID"}, + {0x01010000, nullptr, "CheckNew3DSApp"}, + {0x01020000, nullptr, "CheckNew3DS"}, + {0x01040000, nullptr, "IsStandardMemoryLayout" }, + {0x01050100, nullptr, "IsTitleAllowed" } +}; + +APT_U_Interface::APT_U_Interface() { + Register(FunctionTable); +} + +} // namespace APT +} // namespace Service diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index f792bc9cd..5f27b9395 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -1,38 +1,54 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/service/mic_u.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace MIC_U - -namespace MIC_U { - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010042, nullptr, "MapSharedMem"}, - {0x00020000, nullptr, "UnmapSharedMem"}, - {0x00030140, nullptr, "Initialize"}, - {0x00040040, nullptr, "AdjustSampling"}, - {0x00050000, nullptr, "StopSampling"}, - {0x00060000, nullptr, "IsSampling"}, - {0x00070000, nullptr, "GetEventHandle"}, - {0x00080040, nullptr, "SetGain"}, - {0x00090000, nullptr, "GetGain"}, - {0x000A0040, nullptr, "SetPower"}, - {0x000B0000, nullptr, "GetPower"}, - {0x000C0042, nullptr, "size"}, - {0x000D0040, nullptr, "SetClamp"}, - {0x000E0000, nullptr, "GetClamp"}, - {0x000F0040, nullptr, "SetAllowShellClosed"}, - {0x00100040, nullptr, "unknown_input2"}, -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { - Register(FunctionTable); -} - -} // namespace +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/mic_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace MIC_U + +namespace MIC_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010042, nullptr, "MapSharedMem"}, + {0x00020000, nullptr, "UnmapSharedMem"}, + {0x00030140, nullptr, "Initialize"}, + {0x00040040, nullptr, "AdjustSampling"}, + {0x00050000, nullptr, "StopSampling"}, + {0x00060000, nullptr, "IsSampling"}, + {0x00070000, nullptr, "GetEventHandle"}, + {0x00080040, nullptr, "SetGain"}, + {0x00090000, nullptr, "GetGain"}, + {0x000A0040, nullptr, "SetPower"}, + {0x000B0000, nullptr, "GetPower"}, + {0x000C0042, nullptr, "size"}, + {0x000D0040, nullptr, "SetClamp"}, + {0x000E0000, nullptr, "GetClamp"}, + {0x000F0040, nullptr, "SetAllowShellClosed"}, + {0x00100040, nullptr, "unknown_input2"}, +}; + +enum Encoding +{ + ENCODING_PCM8=0, + ENCODING_PCM16, + ENCODING_PCM8_SIGNED, + ENCODING_PCM16_SIGNED +}; + +enum SampleRate +{ + SAMPLE_RATE_32730=0, + SAMPLE_RATE_16360, + SAMPLE_RATE_10910, + SAMPLE_RATE_8180 +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable); +} + +} // namespace diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm_u.cpp index 8fdf1ef90..53a03e183 100644 --- a/src/core/hle/service/ndm_u.cpp +++ b/src/core/hle/service/ndm_u.cpp @@ -1,45 +1,95 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/service/ndm_u.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace NDM_U - -namespace NDM_U { - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010042, nullptr, "EnterExclusiveState"}, - {0x00020002, nullptr, "LeaveExclusiveState"}, - {0x00030000, nullptr, "QueryExclusiveMode"}, - {0x00040002, nullptr, "LockState"}, - {0x00050002, nullptr, "UnlockState"}, - {0x00060040, nullptr, "SuspendDaemons"}, - {0x00070040, nullptr, "ResumeDaemons"}, - {0x00080040, nullptr, "DisableWifiUsage"}, - {0x00090000, nullptr, "EnableWifiUsage"}, - {0x000A0000, nullptr, "GetCurrentState"}, - {0x000B0000, nullptr, "GetTargetState"}, - {0x000C0000, nullptr, ""}, - {0x000D0040, nullptr, "QueryStatus"}, - {0x000E0040, nullptr, "GetDaemonDisableCount"}, - {0x000F0000, nullptr, "GetSchedulerDisableCount"}, - {0x00100040, nullptr, "SetScanInterval"}, - {0x00110000, nullptr, "GetScanInterval"}, - {0x00120040, nullptr, "SetRetryInterval"}, - {0x00130000, nullptr, "GetRetryInterval"}, - {0x00140040, nullptr, "OverrideDefaultDaemons"}, - {0x00150000, nullptr, "ResetDefaultDaemons"}, - {0x00160000, nullptr, "GetDefaultDaemons"}, - {0x00170000, nullptr, "ClearHalfAwakeMacFilter"}, -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { - Register(FunctionTable); -} - -} // namespace +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/ndm_u.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace NDM_U + +namespace NDM_U { + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010042, nullptr, "EnterExclusiveState"}, + {0x00020002, nullptr, "LeaveExclusiveState"}, + {0x00030000, nullptr, "QueryExclusiveMode"}, + {0x00040002, nullptr, "LockState"}, + {0x00050002, nullptr, "UnlockState"}, + {0x00060040, nullptr, "SuspendDaemons"}, + {0x00070040, nullptr, "ResumeDaemons"}, + {0x00080040, nullptr, "DisableWifiUsage"}, + {0x00090000, nullptr, "EnableWifiUsage"}, + {0x000A0000, nullptr, "GetCurrentState"}, + {0x000B0000, nullptr, "GetTargetState"}, + {0x000C0000, nullptr, ""}, + {0x000D0040, nullptr, "QueryStatus"}, + {0x000E0040, nullptr, "GetDaemonDisableCount"}, + {0x000F0000, nullptr, "GetSchedulerDisableCount"}, + {0x00100040, nullptr, "SetScanInterval"}, + {0x00110000, nullptr, "GetScanInterval"}, + {0x00120040, nullptr, "SetRetryInterval"}, + {0x00130000, nullptr, "GetRetryInterval"}, + {0x00140040, nullptr, "OverrideDefaultDaemons"}, + {0x00150000, nullptr, "ResetDefaultDaemons"}, + {0x00160000, nullptr, "GetDefaultDaemons"}, + {0x00170000, nullptr, "ClearHalfAwakeMacFilter"}, +}; + + +enum ExclusiveState +{ + EXCLUSIVE_STATE_NONE=0, + EXCLUSIVE_STATE_INFRASTRUCTURE, + EXCLUSIVE_STATE_LOCAL_COMMUNICATIONS, + EXCLUSIVE_STATE_STREETPASS, + EXCLUSIVE_STATE_STREETPASS_DATA +}; + +enum Daemon +{ + DAEMON_CEC=0, + DAEMON_BOSS, + DAEMON_NIM, + DAEMON_FRIENDS +}; + +enum DaemonMask +{ + DAEMON_MASK_CEC = (1 << DAEMON_CEC), + DAEMON_MASK_BOSS = (1 << DAEMON_BOSS), + DAEMON_MASK_NIM = (1 << DAEMON_NIM), + DAEMON_MASK_FRIENDS = (1 << DAEMON_FRIENDS) +}; + +enum DaemonStatus +{ + DAEMON_STATUS_BUSY=0, + DAEMON_STATUS_IDLE, + DAEMON_STATUS_SUSPENDING, + DAEMON_STATUS_SUSPENDED +}; + +enum State +{ + STATE_INITIAL=0, + STATE_SUSPENDED, + STATE_INFRASTRUCTURE_CONNECTING, + STATE_INFRASTRUCTURE_CONNECTED, + STATE_INFRASTRUCTURE_WORKING, + STATE_INFRASTRUCTURE_SUSPENDING, + STATE_INFRASTRUCTURE_FORCE_SUSPENDING, + STATE_INFRASTRUCTURE_DISCONNECTING, + STATE_INFRASTRUCTURE_FORCE_DISCONNECTING, + STATE_CEC_WORKING, + STATE_CEC_FORCE_SUSPENDING, + STATE_CEC_SUSPENDING +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable); +} + +} // namespace diff --git a/src/core/hle/service/pm_dbg.cpp b/src/core/hle/service/pm_dbg.cpp new file mode 100644 index 000000000..9208342bd --- /dev/null +++ b/src/core/hle/service/pm_dbg.cpp @@ -0,0 +1,25 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/pm_dbg.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace PM_APP + +namespace PM_DBG { + + const Interface::FunctionInfo FunctionTable[] = { + {0x00010140,nullptr, "LaunchAppDebug"}, + {0x00020140,nullptr, "LaunchApp"}, + {0x00030000,nullptr, "RunQueuedProcess"} + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + // Interface class + + Interface::Interface() { + Register(FunctionTable); + } + +} // namespace diff --git a/src/core/hle/service/pm_dbg.h b/src/core/hle/service/pm_dbg.h new file mode 100644 index 000000000..f5afb0e98 --- /dev/null +++ b/src/core/hle/service/pm_dbg.h @@ -0,0 +1,23 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace PM_DBG + +namespace PM_DBG { + + class Interface : public Service::Interface { + public: + Interface(); + + std::string GetPortName() const override { + return "pm:dbg"; + } + }; + +} // namespace diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 41fc3437b..352e709e8 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -1,75 +1,80 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "common/common_types.h" -#include "common/logging/log.h" - -#include "core/hle/service/srv.h" -#include "core/hle/kernel/event.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace SRV - -namespace SRV { - -static Kernel::SharedPtr event_handle; - -static void Initialize(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - cmd_buff[1] = 0; // No error -} - -static void GetProcSemaphore(Service::Interface* self) { - u32* cmd_buff = Kernel::GetCommandBuffer(); - - // TODO(bunnei): Change to a semaphore once these have been implemented - event_handle = Kernel::Event::Create(RESETTYPE_ONESHOT, "SRV:Event"); - event_handle->Clear(); - - cmd_buff[1] = 0; // No error - cmd_buff[3] = Kernel::g_handle_table.Create(event_handle).MoveFrom(); -} - -static void GetServiceHandle(Service::Interface* self) { - ResultCode res = RESULT_SUCCESS; - u32* cmd_buff = Kernel::GetCommandBuffer(); - - std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); - auto it = Service::g_srv_services.find(port_name); - - if (it != Service::g_srv_services.end()) { - cmd_buff[3] = Kernel::g_handle_table.Create(it->second).MoveFrom(); - LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); - } else { - LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); - res = UnimplementedFunction(ErrorModule::SRV); - } - cmd_buff[1] = res.raw; -} - -const Interface::FunctionInfo FunctionTable[] = { - {0x00010002, Initialize, "Initialize"}, - {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, - {0x00030100, nullptr, "RegisterService"}, - {0x000400C0, nullptr, "UnregisterService"}, - {0x00050100, GetServiceHandle, "GetServiceHandle"}, - {0x000600C2, nullptr, "RegisterHandle"}, - {0x00090040, nullptr, "Subscribe"}, - {0x000B0000, nullptr, "ReceiveNotification"}, - {0x000C0080, nullptr, "PublishToSubscriber"}, -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { - Register(FunctionTable); -} - -Interface::~Interface() { - event_handle = nullptr; -} - -} // namespace +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/common_types.h" +#include "common/logging/log.h" + +#include "core/hle/service/srv.h" +#include "core/hle/kernel/event.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Namespace SRV + +namespace SRV { + +static Kernel::SharedPtr event_handle; + +static void Initialize(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + cmd_buff[1] = 0; // No error +} + +static void EnableNotification(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + + // TODO(bunnei): Change to a semaphore once these have been implemented + event_handle = Kernel::Event::Create(RESETTYPE_ONESHOT, "SRV:Event"); + event_handle->Clear(); + + cmd_buff[1] = 0; // No error + cmd_buff[3] = Kernel::g_handle_table.Create(event_handle).MoveFrom(); +} + +static void GetServiceHandle(Service::Interface* self) { + ResultCode res = RESULT_SUCCESS; + u32* cmd_buff = Kernel::GetCommandBuffer(); + + std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); + auto it = Service::g_srv_services.find(port_name); + + if (it != Service::g_srv_services.end()) { + cmd_buff[3] = Kernel::g_handle_table.Create(it->second).MoveFrom(); + LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); + } else { + LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); + res = UnimplementedFunction(ErrorModule::SRV); + } + cmd_buff[1] = res.raw; +} + +const Interface::FunctionInfo FunctionTable[] = { + {0x00010002, Initialize, "Initialize"}, + {0x00020000, EnableNotification, "EnableNotification"}, + {0x00030100, nullptr, "RegisterService"}, + {0x000400C0, nullptr, "UnregisterService"}, + {0x00050100, GetServiceHandle, "GetServiceHandle"}, + {0x000600C2, nullptr, "RegisterHandle"}, + {0x000700C0, nullptr, "UnregisterPort"}, + {0x00080100, nullptr, "GetPort"}, + {0x00090040, nullptr, "Subscribe"}, + {0x000A0040, nullptr, "Unsubscribe"}, + {0x000B0000, nullptr, "ReceiveNotification"}, + {0x000C0080, nullptr, "PublishToSubscriber"}, + {0x000D0040, nullptr, "PublishAndGetSubscriber"}, + {0x000E00C0, nullptr, "IsServiceRegistered"} +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Interface class + +Interface::Interface() { + Register(FunctionTable); +} + +Interface::~Interface() { + event_handle = nullptr; +} + +} // namespace diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h index 4b9c71e06..f359e4c60 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h @@ -20,6 +20,12 @@ struct PageInfo { u32 flags; }; +enum PageFlags +{ + LOCKED=0, + CHANGED +}; + enum ResetType { RESETTYPE_ONESHOT, RESETTYPE_STICKY,