1
0
mirror of https://github.com/AkaiiKitsune/TAL_CardReader synced 2024-11-30 19:24:27 +01:00
TAL_CardReader/PLUGINS.md
Farewell_ c047663c90 First working version
The game sometimes crashes, throwing an access violation at offset 00000000002f399a.

I haven't been able to recreate accurately.
2023-05-12 09:52:01 +02:00

2.3 KiB

Guide for making additional plugins

Plugins are just libraries with certain exported functions that go in the plugins folder.

void PreInit()

Runs in dllmain, may run into loader locks. You can also just use your own dllmain for this but that involves writing out all the arguments.

void Init()

Runs on bngrw_Init, may be a bit late for some things but should generally allow functions which would cause loader locks to run fine if a bit late.

void Exit()

Runs on bnusio_Close, dispose of any data here.

void Update()

Runs once per frame.

void WaitTouch(i32 (*callback) (i32, i32, u8[168], u64), u64 data)

Runs on bngrw_reqWaitTouch. Call the callback like so when you wish to have a card scanned.

u8 cardData[168]= { 0x01, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x2E, 0x58, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x5C, 0x97, 0x44, 0xF0, 0x88, 0x04, 0x00, 0x43, 0x26, 0x2C, 0x33, 0x00, 0x04, 0x06, 0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 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 };
memcpy (cardData + 0x2C, chipId, 33);
memcpy (cardData + 0x50, accessCode, 21);
callback(0, 0, cardData, data);
void Card1Insert()

Runs when user presses CARD_INSERT_1, causes TAL to not insert a card if any plugins have this present

void Card2Insert()

Runs when user presses CARD_INSERT_2, causes TAL to not insert a card if any plugins have this present

void BeforeCard1Insert()

Runs before CARD_INSERT_1 is handled

void BeforeCard2Insert()

Runs before CARD_INSERT_2 is handled