Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a3613d32e2 | |||
ac39fd08f9 | |||
e66ea42f54 |
19
README.md
19
README.md
@ -12,14 +12,14 @@ Initial project setup done with the help of [Stepland](https://github.com/Stepla
|
||||
|
||||
# How to use
|
||||
|
||||
To build this, you'll need two things :
|
||||
Copy cardreader.dll and it's config file to your TAL's plugin folder (\Executable\Release\plugins\). You should be able to see the plugin initializing in the game's console.
|
||||
|
||||
- [Meson 1.1.0](https://mesonbuild.com)
|
||||
- [Build Tools pour Visual Studio 2022](https://visualstudio.microsoft.com/fr/downloads/)
|
||||
*There are two versions of this plugin :*
|
||||
|
||||
Once you've edited your build64.bat file to point to your local installation of the VS2022 build tools, you should be good to go.
|
||||
* For JPN or ASIA dumps, use the [CARD Insert](https://gitea.farewell.dev/AkaiiKitsune/tal-cardreader/releases/download/CARD-Fix/cardreader-card.zip) build.
|
||||
* If you're playing on CHN instead, use the [QR Insert](https://gitea.farewell.dev/AkaiiKitsune/tal-cardreader/releases/download/QR-Fix/cardreader-qr.zip) build.
|
||||
|
||||
Copy cardreader.dll to your TAL's plugin folder. You should be able to see the plugin initializing in the game's console.
|
||||
If there's an error when you log-in, make sure you're using the right version for your game dump and that you're using an updated version of esuo1198's TAL fork (Commit [3920cc2](https://github.com/esuo1198/TaikoArcadeLoader/commit/3920cc2) and above !).
|
||||
|
||||
# Settings
|
||||
|
||||
@ -28,3 +28,12 @@ Copy cardreader.dll to your TAL's plugin folder. You should be able to see the p
|
||||
|
||||
- read_cooldown (default : 20)
|
||||
* _Cooldown between each read attempt, a low value (below 15) can lead to game crashes, a high value (above 500) will break SmartCard readers._
|
||||
|
||||
# Compiling
|
||||
|
||||
To build this, you'll need two things :
|
||||
|
||||
- [Meson 1.1.0](https://mesonbuild.com)
|
||||
- [Build Tools pour Visual Studio 2022](https://visualstudio.microsoft.com/fr/downloads/)
|
||||
|
||||
Once you've edited your build64.bat file to point to your local installation of the VS2022 build tools, you should be good to go.
|
||||
|
@ -37,59 +37,61 @@ static unsigned int __stdcall reader_poll_thread_proc(void *ctx)
|
||||
if (HasCard && !usingSmartCard) // A Cardio scan is already in progress, SmartCard doesn't need any extra cooldown.
|
||||
{
|
||||
Sleep(500);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t UID[8] = {0};
|
||||
|
||||
// update devices
|
||||
if (!usingSmartCard) // CardIO
|
||||
else
|
||||
{
|
||||
EnterCriticalSection(&CARDIO_HID_CRIT_SECTION);
|
||||
for (size_t device_no = 0; device_no < CARDIO_HID_CONTEXTS_LENGTH; device_no++)
|
||||
{
|
||||
struct cardio_hid_device *device = &CARDIO_HID_CONTEXTS[device_no];
|
||||
|
||||
// get status
|
||||
cardio_hid_poll_value_t status = cardio_hid_device_poll(device);
|
||||
if (status == HID_POLL_CARD_READY)
|
||||
uint8_t UID[8] = {0};
|
||||
|
||||
// update devices
|
||||
if (!usingSmartCard) // CardIO
|
||||
{
|
||||
EnterCriticalSection(&CARDIO_HID_CRIT_SECTION);
|
||||
for (size_t device_no = 0; device_no < CARDIO_HID_CONTEXTS_LENGTH; device_no++)
|
||||
{
|
||||
struct cardio_hid_device *device = &CARDIO_HID_CONTEXTS[device_no];
|
||||
|
||||
// read card
|
||||
if (cardio_hid_device_read(device) == HID_CARD_NONE)
|
||||
continue;
|
||||
// get status
|
||||
cardio_hid_poll_value_t status = cardio_hid_device_poll(device);
|
||||
if (status == HID_POLL_CARD_READY)
|
||||
{
|
||||
|
||||
// if card not empty
|
||||
if (*((uint64_t *)&device->u.usage_value[0]) > 0)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
UID[i] = device->u.usage_value[i];
|
||||
// read card
|
||||
if (cardio_hid_device_read(device) == HID_CARD_NONE)
|
||||
continue;
|
||||
|
||||
// if card not empty
|
||||
if (*((uint64_t *)&device->u.usage_value[0]) > 0)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
UID[i] = device->u.usage_value[i];
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&CARDIO_HID_CRIT_SECTION);
|
||||
Sleep(readCooldown);
|
||||
}
|
||||
LeaveCriticalSection(&CARDIO_HID_CRIT_SECTION);
|
||||
Sleep(readCooldown);
|
||||
}
|
||||
else // SmartCard
|
||||
{
|
||||
scard_update(UID);
|
||||
}
|
||||
|
||||
if (UID[0] > 0) // If a card was read, format it properly and set HasCard to true so the game can insert it on next frame.
|
||||
{
|
||||
printWarning("%s (%s): Read card %02X%02X%02X%02X%02X%02X%02X%02X\n", __func__, module, UID[0], UID[1], UID[2], UID[3], UID[4], UID[5], UID[6], UID[7]);
|
||||
|
||||
if (waitingForTouch) // Check if game is waiting for a card.
|
||||
else // SmartCard
|
||||
{
|
||||
// Properly format the AccessID
|
||||
u64 ReversedAccessID;
|
||||
for (int i = 0; i < 8; i++)
|
||||
ReversedAccessID = (ReversedAccessID << 8) | UID[i];
|
||||
sprintf(AccessID, "%020llu", ReversedAccessID);
|
||||
|
||||
waitingForTouch = false; // We don't want to read more cards unless the game asks us to, this is a failsafe to avoid weird behaviour.
|
||||
HasCard = true;
|
||||
scard_update(UID);
|
||||
}
|
||||
|
||||
if (UID[0] > 0) // If a card was read, format it properly and set HasCard to true so the game can insert it on next frame.
|
||||
{
|
||||
printWarning("%s (%s): Read card %02X%02X%02X%02X%02X%02X%02X%02X\n", __func__, module, UID[0], UID[1], UID[2], UID[3], UID[4], UID[5], UID[6], UID[7]);
|
||||
|
||||
if (waitingForTouch) // Check if game is waiting for a card.
|
||||
{
|
||||
// Properly format the AccessID
|
||||
u64 ReversedAccessID;
|
||||
for (int i = 0; i < 8; i++)
|
||||
ReversedAccessID = (ReversedAccessID << 8) | UID[i];
|
||||
sprintf(AccessID, "%020llu", ReversedAccessID);
|
||||
|
||||
waitingForTouch = false; // We don't want to read more cards unless the game asks us to, this is a failsafe to avoid weird behaviour.
|
||||
HasCard = true;
|
||||
}
|
||||
else // Game wasn't checking for cards yet.
|
||||
printError("%s (%s): Card %02X%02X%02X%02X%02X%02X%02X%02X was rejected, still waiting for WaitTouch()\n", __func__, module, UID[0], UID[1], UID[2], UID[3], UID[4], UID[5], UID[6], UID[7]);
|
||||
}
|
||||
else // Game wasn't checking for cards yet.
|
||||
printError("%s (%s): Card %02X%02X%02X%02X%02X%02X%02X%02X was rejected, still waiting for WaitTouch()\n", __func__, module, UID[0], UID[1], UID[2], UID[3], UID[4], UID[5], UID[6], UID[7]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user