13int IsSonyRXModule(
const char *path)
21 if ((file = fopen(path,
"rb")) != NULL) {
22 if (fread(&header, 1,
sizeof(
elf_header_t), file) != 0) {
23 if (*(uint32_t *)header.ident == ELF_MAGIC && (header.type == ELF_TYPE_ERX2 || header.type == ELF_TYPE_IRX)) {
25 for (i = 0; i < header.shnum; i++) {
26 fseek(file, header.shoff + i * header.shentsize, SEEK_SET);
27 if (fread(&SectionHeader, 1,
sizeof(
elf_shdr_t), file) != 0) {
28 if ((SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_EEMOD_TAB)) || (SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_IOPMOD_TAB))) {
43int GetSonyRXModInfo(
const char *path,
char *description,
unsigned int MaxLength,
unsigned short int *
version)
51 if ((file = fopen(path,
"rb")) != NULL) {
52 if (fread(&header, 1,
sizeof(
elf_header_t), file) != 0) {
53 if (*(uint32_t *)header.ident == ELF_MAGIC && (header.type == ELF_TYPE_ERX2 || header.type == ELF_TYPE_IRX)) {
55 for (i = 0; i < header.shnum; i++) {
56 fseek(file, header.shoff + i * header.shentsize, SEEK_SET);
57 if (fread(&SectionHeader, 1,
sizeof(
elf_shdr_t), file) != 0) {
59 if (SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_EEMOD_TAB) || SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_IOPMOD_TAB)) {
61 if ((buffer = malloc(SectionHeader.size)) != NULL) {
62 fseek(file, SectionHeader.offset, SEEK_SET);
63 if (fread(buffer, 1, SectionHeader.size, file) != 0) {
65 if (SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_IOPMOD_TAB)) {
67 strncpy(description, ((
iopmod_t *)buffer)->modname, MaxLength - 1);
68 description[MaxLength - 1] =
'\0';
69 }
else if (SectionHeader.type == (SHT_LOPROC | SHT_LOPROC_EEMOD_TAB)) {
71 strncpy(description, ((
eemod_t *)buffer)->modname, MaxLength - 1);
72 description[MaxLength - 1] =
'\0';