1 Commits

Author SHA1 Message Date
d118ef614c updated README and added "AM Daemon" window name 2024-02-22 12:12:29 +01:00
18 changed files with 43 additions and 542 deletions

View File

@ -1,6 +1,6 @@
# Segatools
Version: `2024-03-13`
Version: `2024-02-22`
Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platforms.
@ -8,9 +8,7 @@ Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platfo
* CHUNITHM
* up to [CHUNITHM PARADISE LOST](doc/chunihook.md)
* starting from CHUNITHM NEW!!
* crossbeats REV.
* up to crossbeats REV. SUNRISE
* starting from CHUNITHM NEW!!
* Initial D
* [Initial D Arcade Stage Zero](doc/idzhook.md)
* Initial D THE ARCADE

View File

@ -68,6 +68,7 @@ static void aime_io_config_read(
cfg->felica_path,
_countof(cfg->felica_path),
filename);
// dprintf("NFC: felicaPath GetLastError %lx\n", GetLastError());
cfg->felica_gen = GetPrivateProfileIntW(
L"aime",

View File

@ -154,7 +154,7 @@ static int my_cCommIo_GetTrigger()
out &= ~last_triggers;
// dprintf("Revio: GetTrigger %X\n", out);
dprintf("Revio: GetTrigger %X\n", out);
last_triggers = out;
return out;
}
@ -188,7 +188,7 @@ static int my_cCommIo_GetRelease()
out &= ~btns;
// dprintf("Revio: GetRelease %X\n", out);
dprintf("Revio: GetRelease %X\n", out);
last_triggers = btns;
return out;
}

View File

@ -19,10 +19,10 @@ appdata=
[aime]
; Aime reader emulation
; CXB is stupid, so we have to make the paths go back one
enable=1
; CXB is stupid, so we have to make the paths go back two directories. This
; will load the file from "resource\DEVICE\aime.txt".
aimePath=../DEVICE/aime.txt
felicaPath=../DEVICE/felica.txt
[led]
; Emulation for the LED board. Currently it's just dummy responses,
@ -39,10 +39,6 @@ enable=1
; Note that 127.0.0.1, localhost etc are specifically rejected.
default=127.0.0.1
; Set the title server hostname or IP address here, as the title server
; is hardcoded in the game.
title=https://127.0.0.1:9002
[netenv]
; Simulate an ideal LAN environment. This may interfere with head-to-head play.
; Crossbeats is extremely picky about its LAN environment, so leaving this
@ -117,7 +113,6 @@ test=0x70
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Menu up key. Default is up arrow.
up=0x26
; Menu down key. Default is down arrow.

View File

@ -129,12 +129,12 @@ path=
[io4]
; Input API selection for JVS input emulator.
; Test button virtual-key code. Default is the F1 key.
test=0x70
; Service button virtual-key code. Default is the F2 key.
service=0x71
; Keyboard button to increment coin counter. Default is the F3 key.
coin=0x72
; Test button virtual-key code. Default is the 1 key.
test=0x31
; Service button virtual-key code. Default is the 2 key.
service=0x32
; Keyboard button to increment coin counter. Default is the 3 key.
coin=0x33
; .·:'''''''''''''''''''''''''''''''''''''''''''''':·.
; : : ______ / \ [] : :
@ -151,8 +151,8 @@ coin=0x72
;
; Only XInput is currently supported.
; XInput bindings
;
; Controller Button
; -------------------------------------------------------
; Left Stick Joystick
; Left Stick Click Reset Camera
; Left Trigger Dash

3
dist/mai2/start.bat vendored
View File

@ -3,8 +3,7 @@
pushd %~dp0
start "AM Daemon" /min inject -d -k mai2hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json
inject -d -k mai2hook.dll sinmai -screen-fullscreen 0 -popupwindow -screen-width 2160 -screen-height 1920 -silent-crashes
inject -d -k mai2hook.dll sinmai -screen-fullscreen 0
taskkill /f /im amdaemon.exe > nul 2>&1
echo.

View File

@ -81,7 +81,7 @@ enable=1
; Leave empty if you want to use Segatools built-in keyboard input.
path=
[mu3io]
[fgoio]
; To use a custom O.N.G.E.K.I. IO DLL enter its path here.
; Leave empty if you want to use Segatools built-in keyboard/gamepad input.
path=

View File

@ -63,7 +63,7 @@ enable=1
; Enable freeplay mode. This will disable the coin slot and set the game to
; freeplay. Keep in mind that some game modes (e.g. Freedom/Time Modes) will not
; allow you to start a game in freeplay mode.
freeplay=0
freeplay=0´
; -----------------------------------------------------------------------------
; Custom IO settings

View File

@ -153,13 +153,6 @@ setting. Also, loopback addresses are specifically checked for and rejected by
the games themselves; this needs to be a LAN or WAN IP (or a hostname that
resolves to one).
### `title`
Default: `title`
Leave it as `title` to use the title server returned by ALL.Net. Rewrites
the title server hostname for certain games, such as crossbeats REV.
### `router`
Default: Empty string (i.e. use value from `default` setting)
@ -395,29 +388,13 @@ Bit values are:
- 3: EXP: Export (for Asian markets)
- 4: CHS: China (Simplified Chinese?)
### `billingCa`
Default: `DEVICE\\ca.crt`
Set the billing certificate path. This has to match the one used for the
SSL billing server. The DER certificate must fit in 1024 bytes so it must be
small.
### `billingPub`
Default: `DEVICE\\billing.pub`
Set the actual keychip RSA public key path. This public key has to match the
private key `billing.key` of the billing server in order to decrypt/encrypt
the billing transactions.
### `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 REV. requires billing type 2), so this option is provided if this
then 1 (ex. Crossbeats requires billing type 2), so this option is provided if this
is an issue. Billing types are:
- 0: No billing?

View File

@ -3,7 +3,6 @@
#include <windows.h>
#include <windns.h>
#include <ws2tcpip.h>
#include <winhttp.h>
#include <assert.h>
#include <stdbool.h>
@ -13,8 +12,6 @@
#include "hook/hr.h"
#include "hook/table.h"
#include "util/dprintf.h"
#include "hooklib/dns.h"
/* Latest w32headers does not include DnsQueryEx, so we'll have to "polyfill"
@ -69,18 +66,6 @@ static int WSAAPI hook_getaddrinfo(
const ADDRINFOA *pHints,
ADDRINFOA **ppResult);
static HINTERNET WINAPI hook_WinHttpConnect(
HINTERNET hSession,
const wchar_t *pwszServerName,
INTERNET_PORT nServerPort,
DWORD dwReserved);
static bool WINAPI hook_WinHttpCrackUrl(
const wchar_t *pwszUrl,
DWORD dwUrlLength,
DWORD dwFlags,
LPURL_COMPONENTS lpUrlComponents);
/* Link pointers */
static DNS_STATUS (WINAPI *next_DnsQuery_A)(
@ -110,18 +95,6 @@ static int (WSAAPI *next_getaddrinfo)(
const ADDRINFOA *pHints,
ADDRINFOA **ppResult);
static HINTERNET (WINAPI *next_WinHttpConnect)(
HINTERNET hSession,
const wchar_t *pwszServerName,
INTERNET_PORT nServerPort,
DWORD dwReserved);
static bool (WINAPI *next_WinHttpCrackUrl)(
const wchar_t *pwszUrl,
DWORD dwUrlLength,
DWORD dwFlags,
LPURL_COMPONENTS lpUrlComponents);
static const struct hook_symbol dns_hook_syms_dnsapi[] = {
{
.name = "DnsQuery_A",
@ -147,24 +120,10 @@ static const struct hook_symbol dns_hook_syms_ws2[] = {
}
};
static const struct hook_symbol dns_hook_syms_winhttp[] = {
{
.name = "WinHttpConnect",
.patch = hook_WinHttpConnect,
.link = (void **) &next_WinHttpConnect,
}, {
.name = "WinHttpCrackUrl",
.patch = hook_WinHttpCrackUrl,
.link = (void **) &next_WinHttpCrackUrl,
}
};
static bool dns_hook_initted;
static CRITICAL_SECTION dns_hook_lock;
static struct dns_hook_entry *dns_hook_entries;
static size_t dns_hook_nentries;
static char received_title_url[255];
static void dns_hook_init(void)
{
@ -186,12 +145,6 @@ static void dns_hook_init(void)
"ws2_32.dll",
dns_hook_syms_ws2,
_countof(dns_hook_syms_ws2));
hook_table_apply(
NULL,
"winhttp.dll",
dns_hook_syms_winhttp,
_countof(dns_hook_syms_winhttp));
}
HRESULT dns_hook_push(const wchar_t *from_src, const wchar_t *to_src)
@ -507,83 +460,3 @@ end:
return result;
}
static HINTERNET WINAPI hook_WinHttpConnect(
HINTERNET hSession,
const wchar_t *pwszServerName,
INTERNET_PORT nServerPort,
DWORD dwReserved)
{
const struct dns_hook_entry *pos;
size_t i;
if (pwszServerName == NULL) {
return NULL;
}
EnterCriticalSection(&dns_hook_lock);
for (i = 0 ; i < dns_hook_nentries ; i++) {
pos = &dns_hook_entries[i];
if (_wcsicmp(pwszServerName, pos->from) == 0) {
if(pos->to == NULL) {
LeaveCriticalSection(&dns_hook_lock);
return NULL;
}
pwszServerName = pos->to;
break;
}
}
LeaveCriticalSection(&dns_hook_lock);
return next_WinHttpConnect(hSession, pwszServerName, nServerPort, dwReserved);
}
// Hook to replace CXB title url
static bool WINAPI hook_WinHttpCrackUrl(
const wchar_t *pwszUrl,
DWORD dwUrlLength,
DWORD dwFlags,
LPURL_COMPONENTS lpUrlComponents)
{
const struct dns_hook_entry *pos;
size_t i;
EnterCriticalSection(&dns_hook_lock);
for (i = 0 ; i < dns_hook_nentries ; i++) {
pos = &dns_hook_entries[i];
if (_wcsicmp(pwszUrl, pos->from) == 0) {
wchar_t* toAddr = pos->to;
wchar_t titleBuffer[255];
if(wcscmp(toAddr, L"title") == 0) {
size_t wstr_c;
mbstowcs_s(&wstr_c, titleBuffer, 255, received_title_url, strlen(received_title_url));
toAddr = titleBuffer;
}
bool result = next_WinHttpCrackUrl(
toAddr,
wcslen(toAddr),
dwFlags,
lpUrlComponents
);
LeaveCriticalSection(&dns_hook_lock);
return result;
}
}
LeaveCriticalSection(&dns_hook_lock);
return next_WinHttpCrackUrl(
pwszUrl,
dwUrlLength,
dwFlags,
lpUrlComponents
);
}

View File

@ -101,40 +101,6 @@ static BOOL WINAPI hook_PathFileExistsA(LPCSTR pszPath);
static BOOL WINAPI hook_PathFileExistsW(LPCWSTR pszPath);
static BOOL WINAPI hook_MoveFileA(
const char *lpExistingFileName,
const char *lpNewFileName);
static BOOL WINAPI hook_MoveFileW(
const wchar_t *lpExistingFileName,
const wchar_t *lpNewFileName);
static BOOL WINAPI hook_MoveFileExA(
const char *lpExistingFileName,
const char *lpNewFileName,
uint32_t dwFlags);
static BOOL WINAPI hook_ReplaceFileA(
const char *lpReplacedFileName,
const char *lpReplacementFileName,
const char *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved);
static BOOL WINAPI hook_ReplaceFileW(
const wchar_t *lpReplacedFileName,
const wchar_t *lpReplacementFileName,
const wchar_t *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved);
static BOOL WINAPI hook_DeleteFileA(const char *lpFileName);
static BOOL WINAPI hook_DeleteFileW(const wchar_t *lpFileName);
/* Link pointers */
static BOOL (WINAPI *next_CreateDirectoryA)(
@ -219,39 +185,6 @@ static BOOL (WINAPI *next_PathFileExistsA)(LPCSTR pszPath);
static BOOL (WINAPI *next_PathFileExistsW)(LPCWSTR pszPath);
static BOOL (WINAPI *next_MoveFileA)(
const char *lpExistingFileName,
const char *lpNewFileName);
static BOOL (WINAPI *next_MoveFileW)(
const wchar_t *lpExistingFileName,
const wchar_t *lpNewFileName);
static BOOL (WINAPI *next_MoveFileExA)(
const char *lpExistingFileName,
const char *lpNewFileName,
uint32_t dwFlags);
static BOOL (WINAPI *next_ReplaceFileA)(
const char *lpReplacedFileName,
const char *lpReplacementFileName,
const char *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved);
static BOOL (WINAPI *next_ReplaceFileW)(
const wchar_t *lpReplacedFileName,
const wchar_t *lpReplacementFileName,
const wchar_t *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved);
static BOOL (WINAPI *next_DeleteFileA)(const char *lpFileName);
static BOOL (WINAPI *next_DeleteFileW)(const wchar_t *lpFileName);
/* Hook table */
static const struct hook_symbol path_hook_syms[] = {
@ -327,34 +260,6 @@ static const struct hook_symbol path_hook_syms[] = {
.name = "PathFileExistsW",
.patch = hook_PathFileExistsW,
.link = (void **) &next_PathFileExistsW,
}, {
.name = "MoveFileA",
.patch = hook_MoveFileA,
.link = (void **) &next_MoveFileA,
}, {
.name = "MoveFileW",
.patch = hook_MoveFileW,
.link = (void **) &next_MoveFileW,
}, {
.name = "MoveFileExA",
.patch = hook_MoveFileExA,
.link = (void **) &next_MoveFileExA,
}, {
.name = "ReplaceFileA",
.patch = hook_ReplaceFileA,
.link = (void **) &next_ReplaceFileA,
}, {
.name = "ReplaceFileW",
.patch = hook_ReplaceFileW,
.link = (void **) &next_ReplaceFileW,
}, {
.name = "DeleteFileA",
.patch = hook_DeleteFileA,
.link = (void **) &next_DeleteFileA,
}, {
.name = "DeleteFileW",
.patch = hook_DeleteFileW,
.link = (void **) &next_DeleteFileW,
}
};
@ -1001,213 +906,3 @@ static BOOL WINAPI hook_PathFileExistsW(LPCWSTR pszPath)
return ok;
}
static BOOL WINAPI hook_MoveFileA(
const char *lpExistingFileName,
const char *lpNewFileName)
{
char *oldTrans;
char *newTrans;
BOOL ok;
ok = path_transform_a(&oldTrans, lpExistingFileName);
if (!ok) {
return FALSE;
}
ok = path_transform_a(&newTrans, lpNewFileName);
if (!ok) {
free(oldTrans);
return FALSE;
}
ok = next_MoveFileA(
oldTrans ? oldTrans : lpExistingFileName,
newTrans ? newTrans : lpNewFileName);
free(oldTrans);
free(newTrans);
return ok;
}
static BOOL WINAPI hook_MoveFileW(
const wchar_t *lpExistingFileName,
const wchar_t *lpNewFileName)
{
wchar_t *oldTrans;
wchar_t *newTrans;
BOOL ok;
ok = path_transform_w(&oldTrans, lpExistingFileName);
if (!ok) {
return FALSE;
}
ok = path_transform_w(&newTrans, lpNewFileName);
if (!ok) {
free(oldTrans);
return FALSE;
}
ok = next_MoveFileW(
oldTrans ? oldTrans : lpExistingFileName,
newTrans ? newTrans : lpNewFileName);
free(oldTrans);
free(newTrans);
return ok;
}
static BOOL WINAPI hook_MoveFileExA(
const char *lpExistingFileName,
const char *lpNewFileName,
uint32_t dwFlags)
{
char *oldTrans;
char *newTrans;
BOOL ok;
ok = path_transform_a(&oldTrans, lpExistingFileName);
if (!ok) {
return FALSE;
}
ok = path_transform_a(&newTrans, lpNewFileName);
if (!ok) {
free(oldTrans);
return FALSE;
}
ok = next_MoveFileExA(
oldTrans ? oldTrans : lpExistingFileName,
newTrans ? newTrans : lpNewFileName,
dwFlags);
free(oldTrans);
free(newTrans);
return ok;
}
static BOOL WINAPI hook_ReplaceFileA(
const char *lpReplacedFileName,
const char *lpReplacementFileName,
const char *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved)
{
char *oldTrans;
char *newTrans;
BOOL ok;
ok = path_transform_a(&oldTrans, lpReplacedFileName);
if (!ok) {
return FALSE;
}
ok = path_transform_a(&newTrans, lpReplacementFileName);
if (!ok) {
free(oldTrans);
return FALSE;
}
ok = next_ReplaceFileA(
oldTrans ? oldTrans : lpReplacedFileName,
newTrans ? newTrans : lpReplacementFileName,
lpBackupFileName,
dwReplaceFlags,
lpExclude,
lpReserved);
free(oldTrans);
free(newTrans);
return ok;
}
static BOOL WINAPI hook_ReplaceFileW(
const wchar_t *lpReplacedFileName,
const wchar_t *lpReplacementFileName,
const wchar_t *lpBackupFileName,
uint32_t dwReplaceFlags,
void *lpExclude,
void *lpReserved)
{
wchar_t *oldTrans;
wchar_t *newTrans;
BOOL ok;
ok = path_transform_w(&oldTrans, lpReplacedFileName);
if (!ok) {
return FALSE;
}
ok = path_transform_w(&newTrans, lpReplacementFileName);
if (!ok) {
free(oldTrans);
return FALSE;
}
ok = next_ReplaceFileW(
oldTrans ? oldTrans : lpReplacedFileName,
newTrans ? newTrans : lpReplacementFileName,
lpBackupFileName,
dwReplaceFlags,
lpExclude,
lpReserved);
free(oldTrans);
free(newTrans);
return ok;
}
static BOOL WINAPI hook_DeleteFileA(const char *lpFileName)
{
char *trans;
BOOL ok;
ok = path_transform_a(&trans, lpFileName);
if (!ok) {
return FALSE;
}
ok = next_DeleteFileA(trans ? trans: lpFileName);
return ok;
}
static BOOL WINAPI hook_DeleteFileW(const wchar_t *lpFileName)
{
wchar_t *trans;
BOOL ok;
ok = path_transform_w(&trans, lpFileName);
if (!ok) {
return FALSE;
}
ok = next_DeleteFileW(trans ? trans: lpFileName);
return ok;
}

View File

@ -13,6 +13,7 @@ EXPORTS
amDllVideoSetResolution @3
idac_io_get_api_version
idac_io_init
idac_io_poll
idac_io_get_opbtns
idac_io_get_gamebtns
idac_io_get_shifter

View File

@ -52,6 +52,10 @@ HRESULT idac_xi_init(const struct idac_xi_config *cfg, const struct idac_io_back
return S_OK;
}
HRESULT idac_io_poll(void) {
return S_OK;
}
static HRESULT idac_xi_config_apply(const struct idac_xi_config *cfg) {
/* Deadzones check */
if (cfg->left_stick_deadzone > 32767 || cfg->left_stick_deadzone < 0) {

View File

@ -113,14 +113,6 @@ void dns_config_load(struct dns_config *cfg, const wchar_t *filename)
cfg->aimedb,
_countof(cfg->aimedb),
filename);
GetPrivateProfileStringW(
L"dns",
L"title",
L"title",
cfg->title,
_countof(cfg->title),
filename);
}
void hwmon_config_load(struct hwmon_config *cfg, const wchar_t *filename)

View File

@ -82,33 +82,6 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
return hr;
}
// croosbeats REV.
hr = dns_hook_push(L"https://rev-ent.ac.capcom.jp:443", cfg->title);
if (FAILED(hr)) {
return hr;
}
// AimePay
hr = dns_hook_push(L"api-aime.am-all.net", cfg->startup);
if (FAILED(hr)) {
return hr;
}
// E-MONEY
hr = dns_hook_push(L"tasms-api-basis.thincacloud.com", cfg->startup);
if (FAILED(hr)) {
return hr;
}
hr = dns_hook_push(L"shop.tfps.thincacloud.com", cfg->startup);
if (FAILED(hr)) {
return hr;
}
// if your ISP resolves bad domains, it will kill the network. These 2
// *cannot* resolve

View File

@ -11,7 +11,6 @@ struct dns_config {
wchar_t startup[128];
wchar_t billing[128];
wchar_t aimedb[128];
wchar_t title[128];
};
HRESULT dns_platform_hook_init(const struct dns_config *cfg);

View File

@ -14,22 +14,22 @@
#include "util/str.h"
enum {
NUSEC_IOCTL_PING = CTL_CODE(0x22, 0x845, METHOD_BUFFERED, FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_PLAY_COUNT = CTL_CODE(0x22, 0x854, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_ADD_PLAY_COUNT = CTL_CODE(0x22, 0x855, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_ERASE_TRACE_LOG = CTL_CODE(0x22, 0x862, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_TD_ERASE_USED = CTL_CODE(0x22, 0x863, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_PUT_TRACE_LOG_DATA = CTL_CODE(0x22, 0x864, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_TRACE_LOG_DATA = CTL_CODE(0x22, 0x865, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_TRACE_LOG_STATE = CTL_CODE(0x22, 0x866, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_NVRAM_AVAILABLE = CTL_CODE(0x22, 0x867, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_BILLING_CA_CERT = CTL_CODE(0x22, 0x871, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_BILLING_PUBKEY = CTL_CODE(0x22, 0x872, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_PLAY_LIMIT = CTL_CODE(0x22, 0x881, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_PUT_PLAY_LIMIT = CTL_CODE(0x22, 0x882, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_NEARFULL = CTL_CODE(0x22, 0x883, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_PUT_NEARFULL = CTL_CODE(0x22, 0x884, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_GET_NVRAM_GEOMETRY = CTL_CODE(0x22, 0x893, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS),
NUSEC_IOCTL_PING = 0x22A114,
NUSEC_IOCTL_ERASE_TRACE_LOG = 0x22E188,
NUSEC_IOCTL_TD_ERASE_USED = 0x22E18C,
NUSEC_IOCTL_ADD_PLAY_COUNT = 0x22E154,
NUSEC_IOCTL_GET_BILLING_CA_CERT = 0x22E1C4,
NUSEC_IOCTL_GET_BILLING_PUBKEY = 0x22E1C8,
NUSEC_IOCTL_GET_NEARFULL = 0x22E20C,
NUSEC_IOCTL_GET_NVRAM_AVAILABLE = 0x22E19C,
NUSEC_IOCTL_GET_NVRAM_GEOMETRY = 0x22E24C,
NUSEC_IOCTL_GET_PLAY_COUNT = 0x22E150,
NUSEC_IOCTL_GET_PLAY_LIMIT = 0x22E204,
NUSEC_IOCTL_GET_TRACE_LOG_DATA = 0x22E194,
NUSEC_IOCTL_GET_TRACE_LOG_STATE = 0x22E198,
NUSEC_IOCTL_PUT_NEARFULL = 0x22E210,
NUSEC_IOCTL_PUT_PLAY_LIMIT = 0x22E208,
NUSEC_IOCTL_PUT_TRACE_LOG_DATA = 0x22E190,
};
struct nusec_log_record {

View File

@ -277,12 +277,11 @@ static HRESULT vfs_path_hook(const wchar_t *src, wchar_t *dest, size_t *count)
const wchar_t *redir;
size_t required;
size_t redir_len;
size_t src_len;
assert(src != NULL);
assert(count != NULL);
if (src[0] == L'\0' || src[1] != L':') {
if (src[0] == L'\0' || src[1] != L':' || !path_is_separator_w(src[2])) {
return S_FALSE;
}
@ -305,15 +304,10 @@ static HRESULT vfs_path_hook(const wchar_t *src, wchar_t *dest, size_t *count)
return S_FALSE;
}
/* GetFileAttributesW would request the src "E:", so fix the src_len in
in order to redirect the drive letter successfully */
src_len = path_is_separator_w(src[2]) ? 3 : 2;
/* Cut off <prefix>\, replace with redir path, count NUL terminator */
redir_len = wcslen(redir);
required = wcslen(src) - src_len + redir_len + 1;
required = wcslen(src) - 3 + redir_len + 1;
if (dest != NULL) {
if (required > *count) {
@ -321,7 +315,7 @@ static HRESULT vfs_path_hook(const wchar_t *src, wchar_t *dest, size_t *count)
}
wcscpy_s(dest, *count, redir);
wcscpy_s(dest + redir_len, *count - redir_len, src + src_len);
wcscpy_s(dest + redir_len, *count - redir_len, src + 3);
}
*count = required;