fix idm value passing

This commit is contained in:
ppc
2025-01-19 19:23:59 +00:00
parent 2bc9c9f673
commit 3fbea0f925
+10 -4
View File
@@ -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;
}