hostio.h
2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#define VERSION "1.1"
#define STACKSIZE 0x2000
#if defined(_LANGUAGE_C)
#include <ultra64.h>
#include <leosp.h>
typedef struct
{
u32 cmdFlags; /* flags of the command line */
s32 offset; /* start LBA */
s32 filesize; /* in bytes */
s32 type;
void *address;
LEODiskID diskID;
u16 romEndLBA;
u16 ramStartLBA;
u16 ramEndLBA;
} ctrlblk;
typedef struct
{
LEODiskID diskID;
u8 diskmanID[200];
} idInfo;
typedef struct
{
u32 country;
u8 formatType; /* 0x00 old, 0x10 new */
u8 type;
u16 IPLSize;
u8 defectData1[20];
void *loadAddr;
u8 defectData[160];
} sysInfoDev;
typedef struct
{
u32 country;
u8 formatType; /* 0x00 old, 0x10 new */
u8 type;
u16 IPLSize;
u8 defectData1[20];
void *loadAddr;
u8 defectData[192];
u16 romEndLBA;
u16 ramStartLBA;
u16 ramEndLBA;
u16 reserved2;
} sysInfoProd;
#define SECPERBLOCK 85
typedef union
{
sysInfoProd prod[SECPERBLOCK];
sysInfoDev dev[SECPERBLOCK];
} sysInfo;
#define JAPAN 0xe848d316
#define USA 0x2263ee56
#define SECSIZE_PROD 232
#define SECSIZE_DEV 192
#define PROD 0
#define DEV 1
#define PRODUSA 2
/*
* Definition of the ctrlblk packet
*/
#define DO_FORMAT 0x0001 /* Force to format the disk */
#define ID_SPECIFIED 0x0002 /* disk ID number is specified */
#define SEND_ME_INFO 0x0004 /* send disk info to the host */
#define WRITE_DUP_INFO 0x0008 /* write rom end, ram start and ram end */
#define SPECD_ID_FILE 0x0010 /* ID area is specified by file */
#define DO_FORMAT_AS_DEV 0x0021 /* Force to format the disk as dev */
#define DO_FORMAT_AS_PROD 0x0041 /* Force to format the disk as prod */
#define DO_FORMAT_AS_PRODUSA 0x0061 /* Force to format the disk as prod USA */
#define SYS_UNFORMATTED 0x0100 /* system area is unformatted */
#define ID_UNFORMATTED 0x0200 /* id area is unformatted */
#define DRIVE_PROD 0x0400 /* drive type is prod */
#define END_COMMAND 0x8000 /* end of leowrite */
#define DO_FORMAT_MASK 0x0061
#define Min(a, b) (((a) < (b)) ? (a) : (b))
#define Max(a, b) (((a) > (b)) ? (a) : (b))
#define BUFSIZE 1024*1024
#define NUM_LBAS 4292
#define MAX_HOSTNAME_LEN 8
#define MAX_TIME_LEN 8
#define TYPE_DONT_CHANGE -1
#define CLOSE_FILE 1
#define CLOSE_GAME 2
#define KILL_CHILD 4
#define END_ALL (CLOSE_FILE | CLOSE_GAME | KILL_CHILD)
#define LBAOFF 24
#define CMDB_LEO_NOCHKSYS 0x40
#define SAVE_COUNTRY(x) \
{ \
*(u8*)OS_PHYSICAL_TO_K1(0x00000010) = (((u32)(x) & 0xff000000) >> 24); \
*(u8*)OS_PHYSICAL_TO_K1(0x00000090) = (((u32)(x) & 0x00ff0000) >> 16); \
*(u8*)OS_PHYSICAL_TO_K1(0x00000110) = (((u32)(x) & 0x0000ff00) >> 8); \
*(u8*)OS_PHYSICAL_TO_K1(0x00000190) = ( (u32)(x) & 0x000000ff ); \
}
/*
* prototypes
*/
extern s32 myLeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq);
#endif /* _LANGUAGE_C */