PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
romimg.h
1/*
2 ROMFS format:
3 ROMDIR section
4 EXTINFO section
5 File data section
6 All files will have an entry in all three sections. The ROMDIR section is terminated by an entry that consists of zeros.
7
8 Required file entries (In this order):
9 RESET (0-byte)
10 ROMDIR (The size of the whole ROMDIR section)
11 EXTINFO (The size of the whole EXTINFO section)
12
13 The EXTINFO section (Extended Information section) contains more information on the file (E.g. date and version numbers) and comments on the file.
14
15 The EXTINFO section is also a file! (In fact, all sections are files)
16
17 All sections and files are (must be?) aligned to 16-byte boundaries, and all records within each section must be aligned to 4-byte boundaries.
18*/
19
20#ifndef __ROMING_H__
21#define __ROMING_H__
22
23#include "dprintf.h"
24#if defined(_WIN32) || defined(WIN32)
25#define RMIMG_PTRCAST unsigned int
26#else
27#define RMIMG_PTRCAST unsigned char *
28#endif
29struct RomDirEntry
30{
31 char name[10];
32 unsigned short int ExtInfoEntrySize;
33 unsigned int size;
34};
35
36/* Each ROMDIR entry can have any combination of EXTINFO fields. */
38{
39 unsigned short int value; /* Only applicable for the version field type. */
40 unsigned char ExtLength; /* The length of data appended to the end of this entry. */
41 unsigned char type;
42};
43
44enum ExtInfoFieldTypes {
45 EXTINFO_FIELD_TYPE_DATE = 1,
46 EXTINFO_FIELD_TYPE_VERSION,
47 EXTINFO_FIELD_TYPE_COMMENT,
48 EXTINFO_FIELD_TYPE_NULL = 0x7F
49};
50
52{
53 struct RomDirEntry RomDir;
54 unsigned char *ExtInfoData;
55 void *FileData;
56};
57
58typedef struct ImageStructure
59{
60 unsigned int NumFiles;
61 unsigned int date;
62 char *comment;
63 struct FileEntry *files; // Stores the records of all files, including RESET. Only those entries that are automatically generated like ROMDIR and EXTINFO will be omitted.
64} ROMIMG;
65
66/* Function prototypes */
67int CreateBlankROMImg(const char *filename, ROMIMG *ROMImg);
68int WriteROMImg(const char *file, const ROMIMG *ROMImg);
69int LoadROMImg(ROMIMG *ROMImg, const char *path);
70void UnloadROMImg(ROMIMG *ROMImg);
71int AddFile(ROMIMG *ROMImg, const char *path, int upperconv);
72int DeleteFile(ROMIMG *ROMImg, const char *filename);
73int ExtractFile(const ROMIMG *ROMImg, const char *filename, const char *FileToExtract);
74int IsFileExists(const ROMIMG *ROMImg, const char *filename);
75
76#endif /* __ROMING_H__ */
Definition romdrv.h:55
Definition romimg.h:52
Definition romdrv.h:40