diff --git a/AMNet.Server/DllMain.cs b/AMNet.Server/DllMain.cs index 248ded4..545c713 100644 --- a/AMNet.Server/DllMain.cs +++ b/AMNet.Server/DllMain.cs @@ -111,7 +111,7 @@ public static class DllMain } [UnmanagedCallersOnly(EntryPoint = "aime_io_nfc_get_felica_id")] - public static int GetFelicaId(byte unitNo, IntPtr idm) + public static unsafe int GetFelicaId(byte unitNo, ulong* idm) { if (!Config.PhysicalCardUseIDm || unitNo != 0) { @@ -123,9 +123,15 @@ public static class DllMain { return 1; } - - Marshal.Copy(card.IDm, 0, idm, sizeof(ulong)); - App.Logger.LogInformation("FeliCa IDm read: {idm}", CardPresenter.FormatHexCode(card.IDm)); + + ulong idmValue = 0; + for (var i = 0 ; i < 8 ; i++) { + idmValue = (idmValue << 8) | card.IDm[i]; + } + + *idm = idmValue; + + App.Logger.LogInformation("FeliCa IDm read: {idm} ({value})", CardPresenter.FormatHexCode(card.IDm), idmValue); return 0; }