PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
romdrv.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
17/*
18 ROMFS format:
19 ROMDIR section
20 EXTINFO section
21 File data section
22 All files will have an entry in all three sections. The ROMDIR section is terminated by an entry that consists of zeros.
23
24 Required file entries (In this order):
25 RESET (0-byte)
26 ROMDIR (The size of the whole ROMDIR section)
27 EXTINFO (The size of the whole EXTINFO section)
28
29 The EXTINFO section (Extended Information section) contains more information on the file (E.g. date and version numbers) and comments on the file.
30
31 The EXTINFO section is also a file! (In fact, all sections are files)
32
33 All sections and files are aligned to 16-byte boundaries, and all records within each section must be aligned to 4-byte boundaries.
34*/
35
36#ifndef _PS2SDK_ROMDRV_H
37#define _PS2SDK_ROMDRV_H
38
40{
41 char name[10];
42 u16 ExtInfoEntrySize;
43 u32 size;
44};
45
46struct RomImg
47{
48 const void *ImageStart;
49 const void *RomdirStart;
50 const void *RomdirEnd;
51};
52
53/* Each ROMDIR entry can have any combination of EXTINFO fields. */
55{
56 u16 value; /* Only applicable for the version field type. */
57 u8 ExtLength; /* The length of data appended to the end of this entry. */
58 u8 type;
59};
60
61enum ExtInfoFieldTypes {
62 EXTINFO_FIELD_TYPE_DATE = 1,
63 EXTINFO_FIELD_TYPE_VERSION,
64 EXTINFO_FIELD_TYPE_COMMENT,
65 EXTINFO_FIELD_TYPE_FIXED = 0x7F // Must exist at a fixed location.
66};
67
68#define ROMDRV_MAX_IMAGES 4
69#define ROMDRV_MAX_FILES 8
70
71// Error codes
72#define ROMDRV_ADD_FAILED -160
73#define ROMDRV_DEL_FAILED -161
74#define ROMDRV_ADD_BAD_IMAGE -162
75
76#define romdrv_IMPORTS_start DECLARE_IMPORT_TABLE(romdrv, 2, 1)
77#define romdrv_IMPORTS_end END_IMPORT_TABLE
78
79extern int romAddDevice(int unit, const void *image);
80#define I_romAddDevice DECLARE_IMPORT(4, romAddDevice)
81extern int romDelDevice(int unit);
82#define I_romDelDevice DECLARE_IMPORT(5, romDelDevice)
83
84// Functions only available in romdrvX
85#define romdrvX_IMPORTS_start DECLARE_IMPORT_TABLE(romdrvX, 1, 1)
86#define romdrvX_IMPORTS_end END_IMPORT_TABLE
87
88extern const struct RomImg *romGetDevice(int unit);
89#define I_romGetDevice DECLARE_IMPORT(6, romGetDevice)
90
91// Backwards compatibility definitions
92#define romdrv_mount romAddDevice
93#define I_romdrv_mount I_romAddDevice
94#define romdrv_unmount romDelDevice
95#define I_romdrv_unmount I_romDelDevice
96
97#endif
Definition romdrv.h:55
Definition romdrv.h:40