forked from ps2homebrew/hdl-dump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hdl.h
148 lines (124 loc) · 4.55 KB
/
hdl.h
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* hdl.h
* $Id: hdl.h,v 1.9 2006/09/01 17:29:13 bobi Exp $
*
* Copyright 2004 Bobi B., [email protected]
*
* This file is part of hdl_dump.
*
* hdl_dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* hdl_dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with hdl_dump; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(_HDL_H)
#define _HDL_H
#include "config.h"
#include "progress.h"
#include "hio.h"
#include "iin.h"
#include "apa.h"
#include "ps2_hdd.h"
C_START
#define HDL_GAME_NAME_MAX 64
#define VISIBLE_PART "PP."
#define HIDDEN_PART "__."
typedef struct hdl_game_type
{
char name[HDL_GAME_NAME_MAX + 1];
char partition_name[PS2_PART_IDMAX + 1];
char startup[8 + 1 + 3 + 1];
compat_flags_t compat_flags;
unsigned short dma;
int is_dvd;
u_int32_t layer_break;
} hdl_game_t;
typedef struct hdl_game_info_type
{
char partition_name[PS2_PART_IDMAX + 1];
char name[HDL_GAME_NAME_MAX + 1];
char startup[8 + 1 + 3 + 1];
compat_flags_t compat_flags;
unsigned short dma;
int is_dvd;
int slice_index;
u_int32_t start_sector;
u_int32_t raw_size_in_kb;
u_int32_t alloc_size_in_kb;
} hdl_game_info_t;
typedef struct hdl_games_list_type
{
u_int32_t count;
/*@only@*/ hdl_game_info_t *games;
u_int32_t total_chunks;
u_int32_t free_chunks;
} hdl_games_list_t;
typedef /*@only@*/ /*@null@*/ /*@out@*/ hdl_games_list_t *hdl_games_list_p_t;
void hdl_pname(const char *startup_name, const char *name, const char part_prefix[3],
/*@out@*/ char partition_name[PS2_PART_IDMAX + 1]);
int hdl_extract_ex(hio_t *hio,
const char *game_name,
const char *output_file,
progress_t *pgs);
int hdl_extract(const dict_t *config,
const char *device,
const char *name, /* of the game */
const char *output, /* file */
progress_t *pgs);
int hdl_inject(hio_t *hio,
iin_t *iin,
hdl_game_t *details,
int slice_index,
int is_hidden, /* is the game hidden? */
progress_t *pgs);
int hdl_glist_read(hio_t *hio,
/*@special@*/ hdl_games_list_p_t *glist) /*@allocates *glist@*/ /*@defines *glist@*/;
void hdl_glist_free(/*@special@*/ /*@only@*/ hdl_games_list_t *glist) /*@releases glist@*/;
int hdl_ginfo_read(hio_t *hio,
int slice_index,
const ps2_partition_header_t *part,
hdl_game_info_t *ginfo);
int hdl_lookup_partition_ex(hio_t *hio,
const char *game_name,
/*@out@*/ char partition_id[PS2_PART_IDMAX + 1]);
int hdl_lookup_partition(const dict_t *config,
const char *device_name,
const char *game_name,
/*@out@*/ char partition_id[PS2_PART_IDMAX + 1]);
typedef struct hdl_game_alloc_table_type
{
u_int32_t count;
u_int32_t size_in_kb;
struct
{ /* those are in 512-byte long sectors */
u_int32_t start, len;
} part[64];
} hdl_game_alloc_table_t;
int hdl_read_game_alloc_table(hio_t *hio,
const apa_toc_t *toc,
int slice_index,
u_int32_t partition_index,
/*@out@*/ hdl_game_alloc_table_t *gat);
int hdl_modify_game(hio_t *hio,
apa_toc_t *toc,
int slice_index,
u_int32_t starting_partition_sector,
const char *new_name, /* or NULL */
compat_flags_t new_compat_flags, /* or COMPAT_FLAGS_INVALID */
unsigned short new_dma, /* or 0 */
int is_hidden); /* is the game hidden? */
int hdd_inject_header(hio_t *hio,
apa_toc_t *toc,
int slice_index,
u_int32_t starting_partition_sector);
C_END
#endif /* _HDL_H defined? */