From dce5bbe66d7c49cc7095ca6ef183a13d749a3e3c Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 10 Dec 2022 23:21:54 -0500 Subject: [PATCH] platform: make billing type configurable --- doc/config/common.md | 14 ++++++++++++++ platform/config.c | 1 + platform/nusec.c | 5 +++-- platform/nusec.h | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/config/common.md b/doc/config/common.md index 4dcaf43..7dc14c1 100644 --- a/doc/config/common.md +++ b/doc/config/common.md @@ -326,6 +326,20 @@ Bit values are: - 3: EXP: Export (for Asian markets) - 4: CHS: China (Simplified Chinese?) +### `billingType` + +Default: `1` + +Set the billing "type" for the keychip. The type determins what kind of revenue share, +if any, the game maker has with SEGA. Some games may be picky and require types other +then 1 (ex. Crossbeats requires billing type 2), so this option is provided if this +is an issue. Billing types are: + +- 0: No billing? +- 1: Billing type A +- 2: Billing type B1 +- 3: Billing type B2 + ### `systemFlag` Default: `0x64` diff --git a/platform/config.c b/platform/config.c index 848cfbd..715e3c3 100644 --- a/platform/config.c +++ b/platform/config.c @@ -222,6 +222,7 @@ void nusec_config_load(struct nusec_config *cfg, const wchar_t *filename) filename); cfg->region = GetPrivateProfileIntW(L"keychip", L"region", 1, filename); + cfg->region = GetPrivateProfileIntW(L"keychip", L"billingType", 1, filename); cfg->system_flag = GetPrivateProfileIntW( L"keychip", L"systemFlag", diff --git a/platform/nusec.c b/platform/nusec.c index 7f888a4..cc1030b 100644 --- a/platform/nusec.c +++ b/platform/nusec.c @@ -134,8 +134,9 @@ HRESULT nusec_hook_init( if (nusec_cfg.platform_id[0] == '\0') { memcpy(nusec_cfg.platform_id, platform_id, sizeof(nusec_cfg.platform_id)); } - - nusec_nearfull = 0x00010200; + + // High 16 bits is billing type, low is actual playlimit + nusec_nearfull = (nusec_cfg.billing_type << 16) + 512; nusec_play_count = 0; nusec_play_limit = 1024; diff --git a/platform/nusec.h b/platform/nusec.h index 60886b1..5d3dd4f 100644 --- a/platform/nusec.h +++ b/platform/nusec.h @@ -14,6 +14,7 @@ struct nusec_config { uint8_t region; uint8_t system_flag; uint32_t subnet; + uint16_t billing_type; wchar_t billing_ca[MAX_PATH]; wchar_t billing_pub[MAX_PATH]; };