Compare commits

...

2 Commits

Author SHA1 Message Date
51b11469d0
added aimeGen as default instead of feliciaGen 2023-08-29 22:57:04 +02:00
f0dc51d01e
idac: added config_hook.json 2023-08-29 20:03:33 +02:00
11 changed files with 125 additions and 8 deletions

View File

@ -80,6 +80,7 @@ $(BUILD_DIR_ZIP)/idac.zip:
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
$(BUILD_DIR_64)/idachook/idachook.dll \
$(DIST_DIR)/idac/segatools.ini \
$(DIST_DIR)/idac/config_hook.json \
$(DIST_DIR)/idac/start.bat \
$(BUILD_DIR_ZIP)/idac
$(V)cp pki/billing.pub \

View File

@ -17,6 +17,7 @@ struct aime_io_config {
wchar_t aime_path[MAX_PATH];
wchar_t felica_path[MAX_PATH];
bool felica_gen;
bool aime_gen;
uint8_t vk_scan;
};
@ -40,6 +41,11 @@ static HRESULT aime_io_generate_felica(
uint8_t *bytes,
size_t nbytes);
static HRESULT aime_io_generate_aime(
const wchar_t *path,
uint8_t *bytes,
size_t nbytes);
static void aime_io_config_read(
struct aime_io_config *cfg,
const wchar_t *filename)
@ -67,6 +73,12 @@ static void aime_io_config_read(
cfg->felica_gen = GetPrivateProfileIntW(
L"aime",
L"felicaGen",
0,
filename);
cfg->aime_gen = GetPrivateProfileIntW(
L"aime",
L"aimeGen",
1,
filename);
@ -136,7 +148,7 @@ static HRESULT aime_io_generate_felica(
srand(time(NULL));
for (i = 0 ; i < nbytes ; i++) {
for (i = 0; i < nbytes; i++) {
bytes[i] = rand();
}
@ -151,7 +163,7 @@ static HRESULT aime_io_generate_felica(
return E_FAIL;
}
for (i = 0 ; i < nbytes ; i++) {
for (i = 0; i < nbytes; i++) {
fprintf(f, "%02X", bytes[i]);
}
@ -163,6 +175,47 @@ static HRESULT aime_io_generate_felica(
return S_OK;
}
static HRESULT aime_io_generate_aime(
const wchar_t *path,
uint8_t *bytes,
size_t nbytes)
{
size_t i;
FILE *f;
assert(path != NULL);
assert(bytes != NULL);
assert(nbytes > 0);
srand(time(NULL));
/* AiMe IDs should not start with 3, due to a missing check for BananaPass IDs */
do {
for (i = 0; i < nbytes; i++) {
bytes[i] = rand() % 10 << 4 | rand() % 10;
}
} while (bytes[0] >> 4 == 3);
f = _wfopen(path, L"w");
if (f == NULL) {
dprintf("AimeIO DLL: %S: fopen failed: %i\n", path, (int) errno);
return E_FAIL;
}
for (i = 0; i < nbytes; i++) {
fprintf(f, "%02x", bytes[i]);
}
fprintf(f, "\n");
fclose(f);
dprintf("AimeIO DLL: Generated random AiMe ID\n");
return S_OK;
}
uint16_t aime_io_get_api_version(void)
{
return 0x0100;
@ -210,6 +263,22 @@ HRESULT aime_io_nfc_poll(uint8_t unit_no)
return S_OK;
}
/* Try generating AiMe IC (if enabled) */
if (aime_io_cfg.aime_gen) {
hr = aime_io_generate_aime(
aime_io_cfg.aime_path,
aime_io_aime_id,
sizeof(aime_io_aime_id));
if (FAILED(hr)) {
return hr;
}
aime_io_aime_id_present = true;
return S_OK;
}
/* Try FeliCa IC */
hr = aime_io_read_id_file(

View File

@ -11,6 +11,7 @@ appdata=
[aime]
; Enable aime reader emulation.
enable=1
aimePath=DEVICE\aime.txt
; Enable high baud rate.
;highbaud=1

View File

@ -12,7 +12,6 @@ appdata=
; Enable aime reader emulation.
enable=1
aimePath=DEVICE\aime.txt
felicaGen=0
[dns]
; Insert the hostname or IP address of the server you wish to use here.

18
dist/idac/config_hook.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"aime" :
{
"firmware_path" :
[
".\\aime_firm\\TN32MSEC003S_V12.hex",
".\\aime_firm\\update_15396_6728_94.bin"
],
"high_baudrate" : true
},
"network" :
{
"property" :
{
"dhcp" : true
}
}
}

View File

@ -12,7 +12,6 @@ appdata=
; Controls emulation of the Aime card reader assembly.
enable=1
aimePath=DEVICE\aime.txt
felicaGen=0
[dns]
; Insert the hostname or IP address of the server you wish to use here.

26
dist/idac/start.bat vendored
View File

@ -16,7 +16,31 @@ if not exist "%APP_DIR%" (
echo Mounted the Y:\ drive to the %TEMP%\SDGT folder
start /min inject -d -k idachook.dll amdaemon.exe -c config_aime_high_ex.json config_aime_high_jp.json config_aime_normal_ex.json config_aime_normal_jp.json config_common.json config_ex.json config_jp.json config_laninstall_client_ex.json config_laninstall_client_jp.json config_laninstall_server_ex.json config_laninstall_server_jp.json config_seat_1_ex.json config_seat_1_jp.json config_seat_2_ex.json config_seat_2_jp.json config_seat_3_ex.json config_seat_3_jp.json config_seat_4_ex.json config_seat_4_jp.json config_seat_single_ex.json config_seat_single_jp.json
set AMDAEMON_CFG=config_common.json ^
config_common.json ^
config_ex.json ^
config_jp.json ^
config_laninstall_client_ex.json ^
config_laninstall_client_jp.json ^
config_laninstall_server_ex.json ^
config_laninstall_server_jp.json ^
config_aime_high_ex.json ^
config_aime_high_jp.json ^
config_aime_normal_ex.json ^
config_aime_normal_jp.json ^
config_seat_1_ex.json ^
config_seat_1_jp.json ^
config_seat_2_ex.json ^
config_seat_2_jp.json ^
config_seat_3_ex.json ^
config_seat_3_jp.json ^
config_seat_4_ex.json ^
config_seat_4_jp.json ^
config_seat_single_ex.json ^
config_seat_single_jp.json ^
config_hook.json
start /min inject -d -k idachook.dll amdaemon.exe -c %AMDAEMON_CFG%
inject -d -k idachook.dll ..\WindowsNoEditor\GameProject.exe -culture=en launch=Cabinet ABSLOG="..\..\..\..\..\Userdata\GameProject.log" -Master -UserDir="..\..\..\Userdata" -NotInstalled -UNATTENDED
taskkill /f /im amdaemon.exe > nul 2>&1

View File

@ -11,6 +11,7 @@ appdata=
[aime]
; Enable aime reader emulation.
enable=1
aimePath=DEVICE\aime.txt
[dns]
; Insert the hostname or IP address of the server you wish to use here.

View File

@ -12,7 +12,6 @@ appdata=
; Controls emulation of the Aime card reader assembly.
enable=1
aimePath=DEVICE\aime.txt
felicaGen=0
[dns]
; Insert the hostname or IP address of the server you wish to use here.

View File

@ -12,7 +12,6 @@ appdata=
; Controls emulation of the Aime card reader assembly.
enable=1
aimePath=DEVICE\aime.txt
felicaGen=0
[dns]
; Insert the hostname or IP address of the server you wish to use here.

View File

@ -45,6 +45,13 @@ Default: `DEVICE\aime.txt`
Path to a text file containing a classic Aime IC card ID. **This does not
currently work**.
### `aimeGen`
Default: `1`
Whether to generate a random AiMe ID if the file at `aimePath` does not
exist.
### `felicaPath`
Default: `DEVICE\felica.txt`
@ -53,7 +60,7 @@ Path to a text file containing a FeliCa e-cash card IDm serial number.
### `felicaGen`
Default: `1`
Default: `0`
Whether to generate a random FeliCa ID if the file at `felicaPath` does not
exist.