mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-05-06 05:15:42 -05:00
(Yeah, I know the OS may cache disk reads, but that wasn't the concern) The ALLS series of cabs runs EWF to prevent anything from being written to C:\. This PR adds another layer to iohook to redirect specific open/read/write/close operations to a virtual file table to prevent disk activity, and thus simulate the presence of EWF. This was mainly aimed at ALPB's billing files. Seriously, look at this - especially the timestamps, Sega wtf are you doing. This does not affect other path hooks. It's turned off by default and will throw an error if the current executable resides on C:\. Tested with FGO and APMv3. ![22bf755754[1].png](/attachments/31771aee-2e4d-4e4f-85e3-c5eec63c6f78) Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/84 Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
112 lines
1.9 KiB
C
112 lines
1.9 KiB
C
#include <windows.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include "platform/amvideo.h"
|
|
#include "platform/clock.h"
|
|
#include "platform/dns.h"
|
|
#include "platform/epay.h"
|
|
#include "platform/hwmon.h"
|
|
#include "platform/misc.h"
|
|
#include "platform/netenv.h"
|
|
#include "platform/nusec.h"
|
|
#include "platform/pcbid.h"
|
|
#include "platform/platform.h"
|
|
#include "platform/vfs.h"
|
|
#include "platform/system.h"
|
|
#include "platform/openssl.h"
|
|
|
|
HRESULT platform_hook_init(
|
|
const struct platform_config *cfg,
|
|
const char *game_id,
|
|
const char *platform_id,
|
|
HMODULE redir_mod)
|
|
{
|
|
HRESULT hr;
|
|
|
|
assert(cfg != NULL);
|
|
assert(game_id != NULL);
|
|
assert(platform_id != NULL);
|
|
assert(redir_mod != NULL);
|
|
|
|
hr = amvideo_hook_init(&cfg->amvideo, redir_mod);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = clock_hook_init(&cfg->clock);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = dns_platform_hook_init(&cfg->dns);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = hwmon_hook_init(&cfg->hwmon);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = misc_hook_init(&cfg->misc, platform_id);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = netenv_hook_init(&cfg->netenv, &cfg->nusec);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = nusec_hook_init(&cfg->nusec, game_id, platform_id);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = pcbid_hook_init(&cfg->pcbid);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = vfs_hook_init(&cfg->vfs, game_id);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = epay_hook_init(&cfg->epay);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = system_init(&cfg->system, &cfg->vfs);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = openssl_hook_init(&cfg->openssl);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
hr = ewf_hook_init(&cfg->ewf);
|
|
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|