mirror of
https://gitea.tendokyu.moe/TeamTofuShop/segatools.git
synced 2026-09-22 22:37:59 +03:00
Merge pull request 'nfc: add setting to change FeliCa PMm to read as FeliCa Mobile' (#118) from Haruka/segatools:mobile_felica into develop
Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/118
This commit is contained in:
@@ -80,6 +80,7 @@ void aime_config_load_bykey(struct aime_config *cfg, const wchar_t *filename, co
|
||||
cfg->high_baudrate = GetPrivateProfileIntW(config_key, L"highBaud", 1, filename);
|
||||
cfg->gen = GetPrivateProfileIntW(config_key, L"gen", 0, filename);
|
||||
cfg->proxy_flag = GetPrivateProfileIntW(config_key, L"proxyFlag", 2, filename);
|
||||
cfg->mobile_felica = GetPrivateProfileIntW(config_key, L"mobileFelica", 0, filename);
|
||||
|
||||
GetPrivateProfileStringW(
|
||||
config_key,
|
||||
|
||||
@@ -125,6 +125,7 @@ void sg_nfc_init(
|
||||
unsigned int gen,
|
||||
unsigned int proxy_flag,
|
||||
const wchar_t* authdata_path,
|
||||
bool mobile_felica,
|
||||
void *ops_ctx)
|
||||
{
|
||||
assert(nfc != NULL);
|
||||
@@ -136,6 +137,7 @@ void sg_nfc_init(
|
||||
nfc->gen = gen;
|
||||
nfc->proxy_flag = proxy_flag;
|
||||
nfc->authdata_path = authdata_path;
|
||||
nfc->felica.is_mobile = mobile_felica;
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
@@ -445,12 +447,12 @@ static HRESULT sg_nfc_poll_felica(
|
||||
felica->type = 0x20;
|
||||
felica->id_len = sizeof(felica->IDm) + sizeof(felica->PMm);
|
||||
felica->IDm = _byteswap_uint64(IDm);
|
||||
felica->PMm = _byteswap_uint64(felica_get_amusement_ic_PMm());
|
||||
felica->PMm = _byteswap_uint64(felica_get_amusement_ic_PMm(nfc->felica.is_mobile));
|
||||
|
||||
/* Initialize FeliCa IC emulator */
|
||||
|
||||
nfc->felica.IDm = IDm;
|
||||
nfc->felica.PMm = felica_get_amusement_ic_PMm();
|
||||
nfc->felica.PMm = felica_get_amusement_ic_PMm(nfc->felica.is_mobile);
|
||||
nfc->felica.system_code = 0x88b4;
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -70,6 +70,7 @@ void sg_nfc_init(
|
||||
unsigned int gen,
|
||||
unsigned int proxy_flag,
|
||||
const wchar_t* authdata_path,
|
||||
bool mobile_felica,
|
||||
void *ops_ctx);
|
||||
|
||||
void sg_nfc_transact(
|
||||
|
||||
@@ -82,7 +82,7 @@ HRESULT sg_reader_queue_hook_init(
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
sg_nfc_init(&sg_reader_nfc, 0x01, &sg_reader_nfc_ops, gen, cfg->proxy_flag, cfg->authdata_path, NULL);
|
||||
sg_nfc_init(&sg_reader_nfc, 0x01, &sg_reader_nfc_ops, gen, cfg->proxy_flag, cfg->authdata_path, cfg->mobile_felica, NULL);
|
||||
sg_led_init(&sg_reader_led, 0x08, &sg_reader_led_ops, gen, NULL);
|
||||
|
||||
InitializeCriticalSection(&sg_reader_lock);
|
||||
|
||||
@@ -131,7 +131,7 @@ HRESULT sg_reader_hook_init(
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
sg_nfc_init(&sg_reader_nfc, 0x00, &sg_reader_nfc_ops, gen, cfg->proxy_flag, cfg->authdata_path, NULL);
|
||||
sg_nfc_init(&sg_reader_nfc, 0x00, &sg_reader_nfc_ops, gen, cfg->proxy_flag, cfg->authdata_path, cfg->mobile_felica, NULL);
|
||||
sg_led_init(&sg_reader_led, 0x08, &sg_reader_led_ops, gen, NULL);
|
||||
|
||||
InitializeCriticalSection(&sg_reader_lock);
|
||||
|
||||
@@ -14,6 +14,7 @@ struct aime_config {
|
||||
unsigned int gen;
|
||||
unsigned int proxy_flag;
|
||||
wchar_t authdata_path[MAX_PATH];
|
||||
bool mobile_felica;
|
||||
};
|
||||
|
||||
HRESULT sg_reader_hook_init(
|
||||
|
||||
@@ -37,14 +37,14 @@ static HRESULT felica_cmd_write_without_encryption(
|
||||
struct const_iobuf* req,
|
||||
struct iobuf* res);
|
||||
|
||||
uint64_t felica_get_amusement_ic_PMm(void)
|
||||
uint64_t felica_get_amusement_ic_PMm(bool is_mobile)
|
||||
{
|
||||
/*
|
||||
* AIC Card PMm, if this is returned from the card,
|
||||
* the aimelib will access the actual blocks for authentication.
|
||||
*/
|
||||
|
||||
return 0x00F1000000014300;
|
||||
return is_mobile ? 0x0018000000014300 : 0x00F1000000014300;
|
||||
}
|
||||
|
||||
HRESULT felica_transact(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -19,6 +20,7 @@ struct felica {
|
||||
uint64_t IDm;
|
||||
uint64_t PMm;
|
||||
uint16_t system_code;
|
||||
bool is_mobile;
|
||||
};
|
||||
|
||||
HRESULT felica_transact(
|
||||
@@ -26,4 +28,4 @@ HRESULT felica_transact(
|
||||
struct const_iobuf *req,
|
||||
struct iobuf *res);
|
||||
|
||||
uint64_t felica_get_amusement_ic_PMm(void);
|
||||
uint64_t felica_get_amusement_ic_PMm(bool is_mobile);
|
||||
|
||||
@@ -113,6 +113,12 @@ Default: `DEVICE\authdata.bin`
|
||||
|
||||
Path to the binary file containing data for a Thinca authentication card (see `emoney.txt`)
|
||||
|
||||
### `mobileFelica`
|
||||
|
||||
Default: `0`
|
||||
|
||||
Whether to simulate the scanned FeliCa being a mobile device (1) or an IC card (0). Changes behavior of Aime DB and the card registration flow slightly.
|
||||
|
||||
## `[vfd]`
|
||||
|
||||
Controls emulation of the VFD GP1232A02A FUTABA assembly.
|
||||
|
||||
Reference in New Issue
Block a user