# Guide for making additional plugins Plugins are just libraries with certain exported functions that go in the plugins folder. ```C 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. ```C 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. ```C void Exit() ``` Runs on bnusio_Close, dispose of any data here. ```C void Update() ``` Runs once per frame. ```C 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. ```C 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); ``` ```C void Card1Insert() ``` Runs when user presses CARD_INSERT_1, causes TAL to not insert a card if any plugins have this present ```C void Card2Insert() ``` Runs when user presses CARD_INSERT_2, causes TAL to not insert a card if any plugins have this present ```C void BeforeCard1Insert() ``` Runs before CARD_INSERT_1 is handled ```C void BeforeCard2Insert() ``` Runs before CARD_INSERT_2 is handled