This repository has been archived on 2024-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
segatools/platform/epay.h
Haruka 67eda7458b emoney: Add Thinca authentication card stuff (#35)
This PR adds everything that's needed on the segatools side to add E-Money support regarding Thinca authentication cards.

I've also included set-up documentation (with a network side bonus which was as far as I could figure out so far, but I'm pretty certain no more changes to segatools will be needed)

Due to the nature of a custom protcol called TCAP that Thinca uses for networking (see docs), I can't fully test that everything works as I haven't yet bothered to figure that protocol out.

Tested with both APMv3 and FGO.

![https://puu.sh/KeqVj/ccf4bcccbb.png](https://puu.sh/KeqVj/ccf4bcccbb.png)

Reviewed-on: TeamTofuShop/segatools#35
Co-authored-by: Haruka <haruka@noreply.gitea.tendokyu.moe>
Co-committed-by: Haruka <haruka@noreply.gitea.tendokyu.moe>
2025-04-17 17:01:38 +00:00

66 lines
2.3 KiB
C

#pragma once
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#pragma pack(push,1)
struct epay_config {
bool enable;
bool hook;
};
/* The functions in these structs are how clients like amdaemon interface
* with thinca. We can simply replace these functions with our own stubs
* to bypass errors and such. Currently this DOES NOT allow for epay, and
* trying to do so will most likely just lead to misery. My goal isn't to
* reimplement epay, just to give amdaemon SOMETHING so we can boot properly.
*/
struct thinca_impl {
uint64_t* unk0;
void (*unk8)(struct thinca_impl *);
uint64_t (*initialize)(struct thinca_impl *, uint64_t);
uint64_t (*dispose)(struct thinca_impl *);
uint64_t (*setResource)(struct thinca_impl *, char *);
uint64_t (*setThincaPaymentLog)(struct thinca_impl *, uint64_t, char *, uint64_t, const char *);
uint64_t (*setIcasClientLog)(struct thinca_impl *, uint64_t, char *);
uint64_t (*setIcasClientConfig)(struct thinca_impl *, char *, uint64_t);
uint64_t* unk40;
uint64_t* unk48;
uint64_t (*setClientCertificate)(struct thinca_impl *, char *, uint64_t);
uint64_t (*setTerminalSerial)(struct thinca_impl *, char *);
uint64_t (*setGoodsCode)(struct thinca_impl *, char *);
uint64_t unk68;
uint64_t (*setThincaEventInterface)(struct thinca_impl *, void*); // probably a struct
uint64_t unkGap78[7];
uint64_t (*checkDeal)(struct thinca_impl *, void *); // probably a struct
uint64_t unkGapB8[41];
uint64_t (*cancelRequest)(struct thinca_impl *);
uint64_t (*selectButton)(struct thinca_impl *);
uint64_t unkGap210[2];
uint64_t (*unk220)(struct thinca_impl *, uint64_t);
uint64_t (*unk228)(struct thinca_impl *, uint64_t);
};
/* I believe the actual struct is 0x310 bytes, so for now I'm just
* implementing what I need and hoping the rest don't cause issues
* later. AMDaemon seems to only care about impl1 and deal_thing,
* at least from what I can tell
*/
struct thinca_main {
struct thinca_impl* impl1;
struct thinca_impl* impl2;
HANDLE* mutex1;
HANDLE* mutex2;
HANDLE* mutex3;
uint64_t* unk28;
uint64_t* unk30;
uint64_t* unk38;
uint64_t* unk40;
uint64_t* deal_thing;
uint64_t filler[88];
};
#pragma pack(pop)
HRESULT epay_hook_init(const struct epay_config *cfg);
HRESULT epay_apply_registry_hooks();