1
0
mirror of synced 2024-11-27 17:00:53 +01:00

Improve card plugin support

This commit is contained in:
BroGamer 2022-10-10 23:05:19 +13:00
parent b5ae7aa8d9
commit a8fe616c14
2 changed files with 33 additions and 7 deletions

View File

@ -28,3 +28,12 @@ memcpy (cardData + 0x2C, chipId, 33);
memcpy (cardData + 0x50, accessCode, 21);
callback(0, 0, cardData, data);
```
```
void Card1Insert()
```
Runs when user presses CARD_INSERT_1
```
void Card2Insert()
```
Runs when user presses CARD_INSERT_2

View File

@ -113,16 +113,33 @@ u16 __fastcall bnusio_GetCoin (i32 a1) {
0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x42, 0x47, 0x49, 0x43, 0x36,
0x00, 0x00, 0xFA, 0xE9, 0x69, 0x00, 0xF6, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
bool hasInserted = false;
if (IsButtonTapped (CARD_INSERT_1)) {
for (int i = 0; plugins[i] != 0; i++) {
FARPROC insertEvent = GetProcAddress (plugins[i], "Card1Insert");
if (insertEvent) {
((event *)insertEvent) ();
hasInserted = true;
}
}
if (!hasInserted) {
memcpy (cardData + 0x2C, chipId1, 33);
memcpy (cardData + 0x50, accessCode1, 21);
touchCallback (0, 0, cardData, touchData);
}
} else if (IsButtonTapped (CARD_INSERT_2)) {
for (int i = 0; plugins[i] != 0; i++) {
FARPROC insertEvent = GetProcAddress (plugins[i], "Card2Insert");
if (insertEvent) ((event *)insertEvent) ();
hasInserted = true;
}
if (!hasInserted) {
memcpy (cardData + 0x2C, chipId2, 33);
memcpy (cardData + 0x50, accessCode2, 21);
touchCallback (0, 0, cardData, touchData);
}
}
}
for (int i = 0; plugins[i] != 0; i++) {
FARPROC updateEvent = GetProcAddress (plugins[i], "Update");
if (updateEvent) ((event *)updateEvent) ();