1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-27 16:00:52 +01:00

jbhook: Fix security error when booting knit append

This commit is contained in:
Will Toohey 2022-01-03 16:46:56 +10:00
parent b42c9aa93b
commit ba2016b5bc
5 changed files with 28 additions and 27 deletions

View File

@ -1,15 +0,0 @@
#ifndef JBHOOK_UTIL_SECURITY_H
#define JBHOOK_UTIL_SECURITY_H
#include "security/mcode.h"
static const struct security_mcode jbhook_util_security_default_mcode = {
.header = SECURITY_MCODE_HEADER,
.unkn = SECURITY_MCODE_UNKN_C,
.game = SECURITY_MCODE_GAME_JB_1,
.region = SECURITY_MCODE_REGION_JAPAN,
.cabinet = SECURITY_MCODE_CABINET_A,
.revision = SECURITY_MCODE_REVISION_B,
};
#endif

View File

@ -4,8 +4,6 @@
#include "jbhook1/config-security.h"
#include "jbhook-util/security.h"
#include "security/mcode.h"
#include "util/log.h"
@ -13,14 +11,20 @@
#define JBHOOK1_CONFIG_SECURITY_MCODE_KEY "security.mcode"
#define JBHOOK1_CONFIG_SECURITY_DEFAULT_MCODE_VALUE \
jbhook_util_security_default_mcode
static const struct security_mcode security_mcode_h44 = {
.header = SECURITY_MCODE_HEADER,
.unkn = SECURITY_MCODE_UNKN_C,
.game = SECURITY_MCODE_GAME_JB_1,
.region = SECURITY_MCODE_REGION_JAPAN,
.cabinet = SECURITY_MCODE_CABINET_A,
.revision = SECURITY_MCODE_REVISION_B,
};
void jbhook1_config_security_init(struct cconfig *config)
{
char *tmp;
tmp = security_mcode_to_str(&JBHOOK1_CONFIG_SECURITY_DEFAULT_MCODE_VALUE);
tmp = security_mcode_to_str(&security_mcode_h44);
cconfig_util_set_str(
config,
@ -38,7 +42,7 @@ void jbhook1_config_security_get(
char mcode[9];
tmp_default =
security_mcode_to_str(&JBHOOK1_CONFIG_SECURITY_DEFAULT_MCODE_VALUE);
security_mcode_to_str(&security_mcode_h44);
if (!cconfig_util_get_str(
config,
@ -63,7 +67,7 @@ void jbhook1_config_security_get(
memcpy(
&config_security->mcode,
&JBHOOK1_CONFIG_SECURITY_DEFAULT_MCODE_VALUE,
&security_mcode_h44,
sizeof(struct security_mcode));
}

View File

@ -24,7 +24,6 @@
#include "jbhook-util/eamuse.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util/p3io.h"
#include "jbhook-util/security.h"
#include "p3ioemu/devmgr.h"
#include "p3ioemu/emu.h"
@ -33,6 +32,7 @@
#include "p4ioemu/setupapi.h"
#include "security/id.h"
#include "security/mcode.h"
#include "util/defs.h"
#include "util/log.h"
@ -40,6 +40,15 @@
static struct options options;
static const struct security_mcode security_mcode_j44 = {
.header = SECURITY_MCODE_HEADER,
.unkn = SECURITY_MCODE_UNKN_C,
.game = SECURITY_MCODE_GAME_JB_3,
.region = SECURITY_MCODE_REGION_JAPAN,
.cabinet = SECURITY_MCODE_CABINET_C,
.revision = SECURITY_MCODE_REVISION_A,
};
static bool my_dll_entry_init(char *sidcode, struct property_node *param)
{
bool eam_io_ok;
@ -57,9 +66,11 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
if (!options.disable_p3ioemu) {
log_assert(sidcode != NULL);
// pcbid and eamid are only used here for sec check, the ones used for
// network access are taken from ea3-config.xml
// network access are taken from ea3-config.xml.
// When booting knit append (and on no other version), the code must
// actually match, so the ID used is for append (JCA)
jbhook_util_p3io_init(
&jbhook_util_security_default_mcode,
&security_mcode_j44,
&security_id_default, &security_id_default);
log_info("Starting up jubeat IO backend");

View File

@ -23,7 +23,6 @@
#include "jbhook-util/eamuse.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util/p4io.h"
#include "jbhook-util/security.h"
#include "p4ioemu/device.h"
#include "p4ioemu/setupapi.h"

View File

@ -51,6 +51,7 @@
/* Jubeat */
#define SECURITY_MCODE_GAME_JB_1 "H44"
#define SECURITY_MCODE_GAME_JB_3 "J44"
/* Region */
#define SECURITY_MCODE_REGION_ASIA 'A'
@ -58,6 +59,7 @@
/* Cabinet */
#define SECURITY_MCODE_CABINET_A 'A'
#define SECURITY_MCODE_CABINET_C 'C'
/* Revision */
#define SECURITY_MCODE_REVISION_A 'A'
@ -104,4 +106,4 @@ bool security_mcode_parse(const char *str, struct security_mcode *mcode);
*/
char *security_mcode_to_str(const struct security_mcode *mcode);
#endif
#endif