Add switch for openssl patch in segatools.ini
parent
97d2d6b9bc
commit
cef3406691
|
@ -23,6 +23,7 @@
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "platform/vfs.h"
|
#include "platform/vfs.h"
|
||||||
#include "platform/system.h"
|
#include "platform/system.h"
|
||||||
|
#include "platform/opensslpatch.h"
|
||||||
|
|
||||||
void platform_config_load(struct platform_config *cfg, const wchar_t *filename)
|
void platform_config_load(struct platform_config *cfg, const wchar_t *filename)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,7 @@ void platform_config_load(struct platform_config *cfg, const wchar_t *filename)
|
||||||
nusec_config_load(&cfg->nusec, filename);
|
nusec_config_load(&cfg->nusec, filename);
|
||||||
vfs_config_load(&cfg->vfs, filename);
|
vfs_config_load(&cfg->vfs, filename);
|
||||||
system_config_load(&cfg->system, filename);
|
system_config_load(&cfg->system, filename);
|
||||||
|
openssl_patch_config_load(&cfg->openssl, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void amvideo_config_load(struct amvideo_config *cfg, const wchar_t *filename)
|
void amvideo_config_load(struct amvideo_config *cfg, const wchar_t *filename)
|
||||||
|
@ -355,3 +357,18 @@ void epay_config_load(struct epay_config *cfg, const wchar_t *filename)
|
||||||
|
|
||||||
cfg->enable = GetPrivateProfileIntW(L"epay", L"enable", 1, filename);
|
cfg->enable = GetPrivateProfileIntW(L"epay", L"enable", 1, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void openssl_patch_config_load(struct openssl_patch_config *cfg, const wchar_t *filename)
|
||||||
|
{
|
||||||
|
// Ensure the config structure and filename are valid
|
||||||
|
assert(cfg != NULL);
|
||||||
|
assert(filename != NULL);
|
||||||
|
|
||||||
|
// Read the "enable" key from the "[openssl]" section of the configuration file
|
||||||
|
cfg->enable = GetPrivateProfileIntW(
|
||||||
|
L"openssl", // Section name
|
||||||
|
L"enable", // Key name
|
||||||
|
1, // Default value if the key is not found (disabled by default)
|
||||||
|
filename // INI file name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -36,3 +36,4 @@ void nusec_config_load(struct nusec_config *cfg, const wchar_t *filename);
|
||||||
void pcbid_config_load(struct pcbid_config *cfg, const wchar_t *filename);
|
void pcbid_config_load(struct pcbid_config *cfg, const wchar_t *filename);
|
||||||
void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename);
|
void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename);
|
||||||
void system_config_load(struct system_config *cfg, const wchar_t *filename);
|
void system_config_load(struct system_config *cfg, const wchar_t *filename);
|
||||||
|
void openssl_patch_config_load(struct openssl_patch_config *cfg, const wchar_t *filename);
|
|
@ -79,16 +79,25 @@ static void openssl_patch(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int openssl_patch_apply(void) {
|
HRESULT openssl_patch_apply(const struct openssl_patch_config *cfg) {
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
assert(cfg != NULL);
|
||||||
|
|
||||||
|
if (!cfg->enable) {
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
char* cpuname = get_cpu_name();
|
char* cpuname = get_cpu_name();
|
||||||
if (cpuname == NULL) {
|
if (cpuname == NULL) {
|
||||||
dprintf("OpenSSL Patch: Error: Unable to detect CPU.\n");
|
dprintf("OpenSSL Patch: Error: Unable to detect CPU.\n");
|
||||||
return 1;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_cpu(cpuname)) {
|
if (check_cpu(cpuname)) {
|
||||||
openssl_patch();
|
openssl_patch();
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cpuname);
|
free(cpuname);
|
||||||
return 0;
|
return S_OK;
|
||||||
}
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
int openssl_patch_apply(void);
|
struct openssl_patch_config {
|
||||||
|
int enable;
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT openssl_patch_apply(const struct openssl_patch_config *cfg);
|
||||||
|
|
|
@ -29,7 +29,11 @@ HRESULT platform_hook_init(
|
||||||
assert(platform_id != NULL);
|
assert(platform_id != NULL);
|
||||||
assert(redir_mod != NULL);
|
assert(redir_mod != NULL);
|
||||||
|
|
||||||
openssl_patch_apply();
|
hr = openssl_patch_apply(&cfg->openssl);
|
||||||
|
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
hr = amvideo_hook_init(&cfg->amvideo, redir_mod);
|
hr = amvideo_hook_init(&cfg->amvideo, redir_mod);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct platform_config {
|
||||||
struct nusec_config nusec;
|
struct nusec_config nusec;
|
||||||
struct vfs_config vfs;
|
struct vfs_config vfs;
|
||||||
struct system_config system;
|
struct system_config system;
|
||||||
|
struct openssl_patch_config openssl;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT platform_hook_init(
|
HRESULT platform_hook_init(
|
||||||
|
|
Loading…
Reference in New Issue