mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-08-22 16:34:01 -05:00
feat(core/config-ext): Support reading of security id and mcode
Summary: Test Plan: Summary: Test Plan:
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#include "iface-core/config.h"
|
||||
#include "iface-core/log.h"
|
||||
|
||||
#include "security/id.h"
|
||||
#include "security/mcode.h"
|
||||
|
||||
#include "util/net.h"
|
||||
|
||||
void bt_core_config_ext_s8_get(
|
||||
@@ -131,6 +134,28 @@ void bt_core_config_ext_net_addr_get(const bt_core_config_t *config, const char
|
||||
}
|
||||
}
|
||||
|
||||
void bt_core_config_ext_security_id_get(const bt_core_config_t *config, const char *path, security_id_t *id)
|
||||
{
|
||||
char buffer[16];
|
||||
|
||||
bt_core_config_ext_bin_get(config, path, buffer, sizeof(buffer));
|
||||
|
||||
if (!security_id_parse(buffer, id)) {
|
||||
log_fatal("Cannot parse security id: %s", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void bt_core_config_ext_security_mcode_get(const bt_core_config_t *config, const char *path, security_mcode_t *mcode)
|
||||
{
|
||||
char buffer[16];
|
||||
|
||||
bt_core_config_ext_str_get(config, path, buffer, sizeof(buffer));
|
||||
|
||||
if (!security_mcode_parse(buffer, mcode)) {
|
||||
log_fatal("Cannot parse security mcode: %s", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
bool bt_core_config_ext_s8_optional_get(
|
||||
const bt_core_config_t *config, const char *path, int8_t *value)
|
||||
{
|
||||
@@ -393,5 +418,41 @@ bool bt_core_config_ext_net_addr_optional_get(const bt_core_config_t *config, co
|
||||
log_fatal("Cannot parse server address: %s", buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bt_core_config_ext_security_id_optional_get(const bt_core_config_t *config, const char *path, security_id_t *id)
|
||||
{
|
||||
char buffer[16];
|
||||
bool result;
|
||||
|
||||
result = bt_core_config_ext_bin_optional_get(config, path, buffer, sizeof(buffer));
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!security_id_parse(buffer, id)) {
|
||||
log_fatal("Cannot parse security id: %s", buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bt_core_config_ext_security_mcode_optional_get(const bt_core_config_t *config, const char *path, security_mcode_t *mcode)
|
||||
{
|
||||
char buffer[16];
|
||||
bool result;
|
||||
|
||||
result = bt_core_config_ext_str_optional_get(config, path, buffer, sizeof(buffer));
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!security_mcode_parse(buffer, mcode)) {
|
||||
log_fatal("Cannot parse security mcode: %s", buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "iface-core/config.h"
|
||||
|
||||
#include "security/id.h"
|
||||
#include "security/mcode.h"
|
||||
|
||||
#include "util/net.h"
|
||||
|
||||
void bt_core_config_ext_s8_get(
|
||||
@@ -32,6 +35,8 @@ void bt_core_config_ext_bin_get(
|
||||
void bt_core_config_ext_str_get(
|
||||
const bt_core_config_t *config, const char *path, char *value, size_t len);
|
||||
void bt_core_config_ext_net_addr_get(const bt_core_config_t *config, const char *path, struct net_addr *addr);
|
||||
void bt_core_config_ext_security_id_get(const bt_core_config_t *config, const char *path, security_id_t *id);
|
||||
void bt_core_config_ext_security_mcode_get(const bt_core_config_t *config, const char *path, security_mcode_t *mcode);
|
||||
|
||||
bool bt_core_config_ext_s8_optional_get(
|
||||
const bt_core_config_t *config, const char *path, int8_t *value);
|
||||
@@ -60,5 +65,7 @@ bool bt_core_config_ext_bin_optional_get(
|
||||
bool bt_core_config_ext_str_optional_get(
|
||||
const bt_core_config_t *config, const char *path, char *value, size_t len);
|
||||
bool bt_core_config_ext_net_addr_optional_get(const bt_core_config_t *config, const char *path, struct net_addr *addr);
|
||||
bool bt_core_config_ext_security_id_optional_get(const bt_core_config_t *config, const char *path, security_id_t *id);
|
||||
bool bt_core_config_ext_security_mcode_optional_get(const bt_core_config_t *config, const char *path, security_mcode_t *mcode);
|
||||
|
||||
#endif
|
||||
@@ -31,6 +31,7 @@ libs_iidxhook8 := \
|
||||
iface-core \
|
||||
module \
|
||||
util \
|
||||
security \
|
||||
|
||||
src_iidxhook8 := \
|
||||
config-io.c \
|
||||
|
||||
@@ -33,6 +33,7 @@ libs_iidxhook9 := \
|
||||
iface-core \
|
||||
module \
|
||||
util \
|
||||
security \
|
||||
|
||||
src_iidxhook9 := \
|
||||
config-io.c \
|
||||
|
||||
@@ -28,6 +28,7 @@ libs_sdvxhook2-cn := \
|
||||
iface-io \
|
||||
iface-core \
|
||||
module \
|
||||
security \
|
||||
|
||||
src_sdvxhook2-cn := \
|
||||
acio.c \
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
/**
|
||||
* Structure of a security id, e.g. PCBID or EAMID.
|
||||
*/
|
||||
struct security_id {
|
||||
typedef struct security_id {
|
||||
uint8_t header;
|
||||
uint8_t id[8];
|
||||
uint8_t checksum;
|
||||
};
|
||||
} security_id_t;
|
||||
|
||||
/**
|
||||
* "Default" security id with updated header and cheacksum ready for use.
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
* Structure to represent a Konami mcode which is used to identify games and
|
||||
* different hardware/software revisions.
|
||||
*/
|
||||
struct security_mcode {
|
||||
typedef struct security_mcode {
|
||||
char header;
|
||||
char unkn;
|
||||
/* Identify the game and version, e.g. IIDX 12 */
|
||||
@@ -91,7 +91,7 @@ struct security_mcode {
|
||||
char region;
|
||||
char cabinet;
|
||||
char revision;
|
||||
};
|
||||
} security_mcode_t;
|
||||
|
||||
/**
|
||||
* Default mcode used to identify white eamuse roundplugs.
|
||||
|
||||
Reference in New Issue
Block a user