diff --git a/OpenBanapass/banapass.cpp b/OpenBanapass/banapass.cpp index e33156e..5895867 100644 --- a/OpenBanapass/banapass.cpp +++ b/OpenBanapass/banapass.cpp @@ -1,6 +1,8 @@ #include "banapass.h" #include "log.h" - +#include +#include +#include #define BANA_API_VERSION "Ver 1.6.0" extern "C" @@ -160,10 +162,50 @@ int BngRwReqSendUrlTo(UINT a, int b, UINT c, int* d, return 1; } -int BngRwReqWaitTouch(UINT a, int b, UINT c, ULONGLONG d, ULONGLONG e) +int BngRwReqWaitTouch(UINT a, int maxIntSomehow, UINT c, void (*callback)(int, int, void*, void*), void* e) { log("BngRwReqWaitTouch()\n"); - return GetAsyncKeyState('C') ? 0 : -1; + + if (GetAsyncKeyState('C')) { + // Raw card data and some other stuff, who cares + unsigned char rawCardData[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 + }; + + std::string accessCode = "30764352518498791337"; + std::string chipId = "7F5C9744F111111143262C3300040610"; + + memcpy(rawCardData + 0x50, accessCode.c_str(), accessCode.size() + 1); + memcpy(rawCardData + 0x2C, chipId.c_str(), chipId.size() + 1); + + int dn = 0; + int reader_status = 0; + + std::thread t(callback, dn, reader_status, rawCardData, e); + t.detach(); + + // this is a really ugly hack, forgive me + using namespace std::chrono_literals; + std::this_thread::sleep_for(100ms); + return 1; + } + else { + return -1; + } + } } \ No newline at end of file diff --git a/OpenBanapass/banapass.h b/OpenBanapass/banapass.h index 6bdebb7..d38469f 100644 --- a/OpenBanapass/banapass.h +++ b/OpenBanapass/banapass.h @@ -27,7 +27,7 @@ extern "C" BANA_API int BngRwReqLed(UINT, UINT, ULONGLONG, ULONGLONG); BANA_API int BngRwReqSendMailTo(UINT, int, UINT, int*, char*, char*, char*, char*, ULONGLONG, ULONGLONG); BANA_API int BngRwReqSendUrlTo(UINT, int, UINT, int*, char*, char*, ULONGLONG, ULONGLONG); - BANA_API int BngRwReqWaitTouch(UINT, int, UINT, ULONGLONG, ULONGLONG); + BANA_API int BngRwReqWaitTouch(UINT a, int maxIntSomehow, UINT c, void (*callback)(int, int, void*, void*), void* e); BANA_API ULONGLONG BngRwReqSetLedPower(); } \ No newline at end of file