From 3fbea0f925f44978c8180d3244b763c0c3b3fd5c Mon Sep 17 00:00:00 2001 From: ppc Date: Sun, 19 Jan 2025 19:23:59 +0000 Subject: [PATCH 1/2] fix idm value passing --- AMNet.Server/DllMain.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; } From 5bb477741dbb4d2750f18534d024c426e0996de5 Mon Sep 17 00:00:00 2001 From: ppc Date: Sun, 19 Jan 2025 20:01:07 +0000 Subject: [PATCH 2/2] remove diagnostic logging, update readme --- AMNet.Server/DllMain.cs | 2 +- readme.md | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/AMNet.Server/DllMain.cs b/AMNet.Server/DllMain.cs index 545c713..c20096d 100644 --- a/AMNet.Server/DllMain.cs +++ b/AMNet.Server/DllMain.cs @@ -131,7 +131,7 @@ public static class DllMain *idm = idmValue; - App.Logger.LogInformation("FeliCa IDm read: {idm} ({value})", CardPresenter.FormatHexCode(card.IDm), idmValue); + App.Logger.LogInformation("FeliCa IDm read: {idm}", CardPresenter.FormatHexCode(card.IDm)); return 0; } diff --git a/readme.md b/readme.md index 81d176f..f68f7cd 100644 --- a/readme.md +++ b/readme.md @@ -38,10 +38,15 @@ This was originally intended for use with maimai and CHUNITHM, but should be com ### Physical Cards AMNet 1.3 adds support for scanning physical cards on iOS devices. If you own a physical AiMe/Banapass/e-Amusement/Suica card, you can scan it using the app and use it in-game. -By changing the `useAimeDBForPhysicalCards` in segatools.ini, it is also possible to adjust the format of card numbers sent to the game: +By changing the `useAimeDBForPhysicalCards` in segatools.ini, you can choose how the card is read on a per-game basis: -- `0` - Default value, will send the 20-digit access code on the back of the card to the game and load the save data directly. -- `1` - Send the card's IDm data to the game, and it will use the connected AiMeDB to retrieve a 20 digit code assigned to the card. This option should be used on shared networks to enable the same account data/profile as you would get on a physical cab. +- `0` will send the 20-digit access code on the back of the card to the game and load the save data directly (default option). +- `1` - Send the card's IDm to the game and use AiMeDB to retrieve the 20-digit code assigned to the card. + +Mode `1` makes the app function in the same way to a real card reader and should be used if you want the same access code to show when scanning the card on a cab. +You should also use this option if you're connecting to a hosted server (AquaNet/rinnet/etc). + +Additionally, if `useAimeDBForPhysicalCards` is set to `1` and the game is failing to read the card, make sure an up-to-date version of segatools is being used. ## Interfaces AMNet can be used on most platforms, see below for options available for each platform: