Improve card plugin support
This commit is contained in:
parent
b5ae7aa8d9
commit
a8fe616c14
@ -28,3 +28,12 @@ memcpy (cardData + 0x2C, chipId, 33);
|
|||||||
memcpy (cardData + 0x50, accessCode, 21);
|
memcpy (cardData + 0x50, accessCode, 21);
|
||||||
callback(0, 0, cardData, data);
|
callback(0, 0, cardData, data);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
void Card1Insert()
|
||||||
|
```
|
||||||
|
Runs when user presses CARD_INSERT_1
|
||||||
|
```
|
||||||
|
void Card2Insert()
|
||||||
|
```
|
||||||
|
Runs when user presses CARD_INSERT_2
|
||||||
|
@ -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,
|
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, 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 };
|
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)) {
|
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 + 0x2C, chipId1, 33);
|
||||||
memcpy (cardData + 0x50, accessCode1, 21);
|
memcpy (cardData + 0x50, accessCode1, 21);
|
||||||
touchCallback (0, 0, cardData, touchData);
|
touchCallback (0, 0, cardData, touchData);
|
||||||
|
}
|
||||||
} else if (IsButtonTapped (CARD_INSERT_2)) {
|
} 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 + 0x2C, chipId2, 33);
|
||||||
memcpy (cardData + 0x50, accessCode2, 21);
|
memcpy (cardData + 0x50, accessCode2, 21);
|
||||||
touchCallback (0, 0, cardData, touchData);
|
touchCallback (0, 0, cardData, touchData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (int i = 0; plugins[i] != 0; i++) {
|
for (int i = 0; plugins[i] != 0; i++) {
|
||||||
FARPROC updateEvent = GetProcAddress (plugins[i], "Update");
|
FARPROC updateEvent = GetProcAddress (plugins[i], "Update");
|
||||||
if (updateEvent) ((event *)updateEvent) ();
|
if (updateEvent) ((event *)updateEvent) ();
|
||||||
|
Loading…
Reference in New Issue
Block a user