misc: add ability to re-enable a few things (#100)

This adds two new config flags to re-enable master registry key access and rebooting. This is needed on real hardware if you want to be able to move to System Test Mode.

Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/100
Reviewed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
This commit is contained in:
kyoubate-haruka 2026-03-04 07:58:01 +00:00 committed by Dniel97
parent 1c7531e45e
commit 85b8ae02fa
4 changed files with 33 additions and 7 deletions

View File

@ -168,6 +168,8 @@ void misc_config_load(struct misc_config *cfg, const wchar_t *filename)
assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"misc", L"enable", 1, filename);
cfg->allowMasterKeyWrite = GetPrivateProfileIntW(L"misc", L"allowMasterKeyWrite", 0, filename);
cfg->allowReboot = GetPrivateProfileIntW(L"misc", L"allowReboot", 0, filename);
}
void netenv_config_load(struct netenv_config *cfg, const wchar_t *filename)

View File

@ -118,11 +118,13 @@ HRESULT misc_hook_init(const struct misc_config *cfg, const char *platform_id)
return hr;
}
hr = reg_hook_push_key(
HKEY_LOCAL_MACHINE,
L"SYSTEM\\SEGA\\SystemProperty\\Master",
misc_master_keys,
_countof(misc_master_keys));
if (!cfg->allowMasterKeyWrite) {
hr = reg_hook_push_key(
HKEY_LOCAL_MACHINE,
L"SYSTEM\\SEGA\\SystemProperty\\Master",
misc_master_keys,
_countof(misc_master_keys));
}
if (FAILED(hr)) {
return hr;
@ -130,7 +132,9 @@ HRESULT misc_hook_init(const struct misc_config *cfg, const char *platform_id)
/* Apply function hooks */
hook_table_apply(NULL, "user32.dll", misc_syms, _countof(misc_syms));
if (!cfg->allowReboot) {
hook_table_apply(NULL, "user32.dll", misc_syms, _countof(misc_syms));
}
return S_OK;
}

View File

@ -1,9 +1,13 @@
#pragma once
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
struct misc_config {
bool enable;
bool allowReboot;
bool allowMasterKeyWrite;
};
HRESULT misc_hook_init(const struct misc_config *cfg, const char *platform_id);

View File

@ -744,4 +744,20 @@ Example for redirecting COM 5 to COM 10:
```
redirection0from=\\.\COM5
redirection0to=\\.\COM10
```
```
## `[misc]`
Configure miscellaneous hooks and features.
### `allowMasterKeyWrite`
Default: `0`
Allows the game to write to specific registry keys relevant for the boot process. Only intended for owners of real hardware.
### `allowReboot`
Default: `0`
Allows the game to reboot the computer. Only intended for owners of real hardware.