diff options
| author | Carl Ouellette <carlouellette2@gmail.com> | 2022-10-18 21:14:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-19 01:14:31 +0000 |
| commit | 2099a3e84b8e01138ebb32b305eea01359e7b4ed (patch) | |
| tree | f56601b2b6193dbc11f863e2ebd6789a115b5798 | |
| parent | 7d26e4ac7b61c4b6a860f6fd9aabdc8e653bc2d7 (diff) | |
Manage state of NfcManager (#3678)
* Manage state of NfcManager
Very basic state management but works with Hyrule Warriors Definitive Edition. Partially fixes #2122
* Fixes changes from review
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nfc/NfcManager/INfc.cs | 28 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nfc/NfcManager/Types/State.cs | 8 |
2 files changed, 35 insertions, 1 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/INfc.cs b/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/INfc.cs index f2fc867d..a1ae0b9c 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/INfc.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/INfc.cs @@ -5,22 +5,48 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.NfcManager class INfc : IpcService { private NfcPermissionLevel _permissionLevel; + private State _state; public INfc(NfcPermissionLevel permissionLevel) { _permissionLevel = permissionLevel; + _state = State.NonInitialized; } [CommandHipc(0)] [CommandHipc(400)] // 4.0.0+ - // Initialize() + // Initialize(u64, u64, pid, buffer<unknown, 5>) public ResultCode Initialize(ServiceCtx context) { + _state = State.Initialized; + Logger.Stub?.PrintStub(LogClass.ServiceNfc, new { _permissionLevel }); return ResultCode.Success; } + [CommandHipc(1)] + [CommandHipc(401)] // 4.0.0+ + // Finalize() + public ResultCode Finalize(ServiceCtx context) + { + _state = State.NonInitialized; + + Logger.Stub?.PrintStub(LogClass.ServiceNfc, new { _permissionLevel }); + + return ResultCode.Success; + } + + [CommandHipc(2)] + [CommandHipc(402)] // 4.0.0+ + // GetState() -> u32 + public ResultCode GetState(ServiceCtx context) + { + context.ResponseData.Write((int)_state); + + return ResultCode.Success; + } + [CommandHipc(3)] [CommandHipc(403)] // 4.0.0+ // IsNfcEnabled() -> b8 diff --git a/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/Types/State.cs b/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/Types/State.cs new file mode 100644 index 00000000..85f99950 --- /dev/null +++ b/Ryujinx.HLE/HOS/Services/Nfc/NfcManager/Types/State.cs @@ -0,0 +1,8 @@ +namespace Ryujinx.HLE.HOS.Services.Nfc.NfcManager +{ + enum State + { + NonInitialized, + Initialized + } +}
\ No newline at end of file |
