tweak IP.BIN metadata field names

This commit is contained in:
Anthony Pesch 2017-10-31 19:10:36 -04:00
parent f97782e777
commit ffc48584f1
3 changed files with 37 additions and 29 deletions

View File

@ -15,17 +15,17 @@
/* meta information found in the ip.bin */
struct disc_meta {
char hardware_id[16];
char manufacturer_id[16];
char device_info[16];
char area_symbols[8];
char peripherals[8];
char product_number[10];
char product_version[6];
char release_date[16];
char bootname[16];
char producer_name[16];
char product_name[128];
char hwareid[DISC_HWAREID_SIZE];
char makerid[DISC_MAKERID_SIZE];
char devinfo[DISC_DEVINFO_SIZE];
char areasym[DISC_AREASYM_SIZE];
char periphs[DISC_PERIPHS_SIZE];
char prodnum[DISC_PRODNUM_SIZE];
char prodver[DISC_PRODVER_SIZE];
char reldate[DISC_RELDATE_SIZE];
char bootnme[DISC_BOOTNME_SIZE];
char company[DISC_COMPANY_SIZE];
char prodnme[DISC_PRODNME_SIZE];
};
static void disc_get_meta(struct disc *disc, struct disc_meta *meta) {
@ -48,7 +48,7 @@ static void disc_patch_sector(struct disc *disc, int fad, uint8_t *data) {
/* the area symbols in the meta information contains 8 characters, each of
which is either a space, or the first letter of the area if supported */
struct disc_meta *meta = (struct disc_meta *)data;
strncpy_pad_spaces(meta->area_symbols, "JUE", sizeof(meta->area_symbols));
strncpy_pad_spaces(meta->areasym, "JUE", sizeof(meta->areasym));
} else if (fad == disc->area_fad) {
/* the area protection symbols section contains 8 slots, each of which is
either spaces, or the name of the area if supported. note, each slot
@ -251,19 +251,15 @@ struct disc *disc_create(const char *filename) {
struct disc_meta meta;
disc_get_meta(disc, &meta);
strncpy_trim_space(disc->product_name, meta.product_name,
sizeof(meta.product_name));
strncpy_trim_space(disc->product_number, meta.product_number,
sizeof(meta.product_number));
strncpy_trim_space(disc->product_version, meta.product_version,
sizeof(meta.product_version));
strncpy_trim_space(disc->media_config, meta.device_info + 5,
sizeof(meta.device_info) - 5);
strncpy_trim_space(disc->bootname, meta.bootname, sizeof(meta.bootname));
strncpy_trim_space(disc->prodnme, meta.prodnme, sizeof(meta.prodnme));
strncpy_trim_space(disc->prodnum, meta.prodnum, sizeof(meta.prodnum));
strncpy_trim_space(disc->prodver, meta.prodver, sizeof(meta.prodver));
strncpy_trim_space(disc->discnum, meta.devinfo + 5, sizeof(meta.devinfo) - 5);
strncpy_trim_space(disc->bootnme, meta.bootnme, sizeof(meta.bootnme));
/* generate unique id for the disc */
snprintf(disc->uid, sizeof(disc->uid), "%s %s %s %s", disc->product_name,
disc->product_number, disc->product_version, disc->media_config);
snprintf(disc->uid, sizeof(disc->uid), "%s %s %s %s", disc->prodnme,
disc->prodnum, disc->prodver, disc->discnum);
LOG_INFO("disc_create id=%s", disc->uid);

View File

@ -9,6 +9,18 @@
#define DISC_MAX_TRACKS 128
#define DISC_UID_SIZE 256
#define DISC_HWAREID_SIZE 16
#define DISC_MAKERID_SIZE 16
#define DISC_DEVINFO_SIZE 16
#define DISC_AREASYM_SIZE 8
#define DISC_PERIPHS_SIZE 8
#define DISC_PRODNUM_SIZE 10
#define DISC_PRODVER_SIZE 6
#define DISC_RELDATE_SIZE 16
#define DISC_BOOTNME_SIZE 16
#define DISC_COMPANY_SIZE 16
#define DISC_PRODNME_SIZE 128
enum {
DISC_REGION_JAPAN = 0x1,
DISC_REGION_USA = 0x2,
@ -51,11 +63,11 @@ struct disc {
/* meta information extracted from IP.BIN */
char uid[DISC_UID_SIZE];
char product_name[129];
char product_number[11];
char product_version[7];
char media_config[12];
char bootname[17];
char prodnme[DISC_PRODNME_SIZE + 1];
char prodnum[DISC_PRODNUM_SIZE + 1];
char prodver[DISC_PRODVER_SIZE + 1];
char discnum[DISC_DEVINFO_SIZE + 1];
char bootnme[DISC_BOOTNME_SIZE + 1];
/* media-specific interface */
void (*destroy)(struct disc *);

View File

@ -532,7 +532,7 @@ int gdrom_find_file(struct gdrom *gd, const char *filename, int *fad,
void gdrom_get_bootfile(struct gdrom *gd, int *fad, int *len) {
CHECK_NOTNULL(gd->disc);
int res = disc_find_file(gd->disc, gd->disc->bootname, fad, len);
int res = disc_find_file(gd->disc, gd->disc->bootnme, fad, len);
CHECK(res);
}