summaryrefslogtreecommitdiff
path: root/includes/cdutils.h
blob: fa44ca6aa13a7db10d871f3cbeef44d844990cf1 (plain)
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
/* 
 *  PSX-Tools Bundle Pack 
 *  Copyright (C) 2002 Nicolas "Pixel" Noble 
 *  
 *  This program 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. 
 * 
 *  This program 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 this program; if not, write to the Free Software 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */

#ifndef __CDUTILS_H__
#define __CDUTILS_H__

#include "yazedc.h"
#include "generic.h"

#include "Handle.h"

#define GUESS 5

struct DirEntry {
    unsigned char R;
    unsigned char NExt;
    unsigned long Sector;
    unsigned long BESector;
    unsigned long Size;
    unsigned long BESize;
    unsigned char Year;
    unsigned char Month;
    unsigned char Day;
    unsigned char Hour;
    unsigned char Minute;
    unsigned char Second;
    unsigned char Offset;
    unsigned char Flags;
    unsigned char HandleUnit;
    unsigned char HandleGap;
    unsigned short VolSeq;
    unsigned short BEVolSeq;
    unsigned char N;
    char id;
} PACKED;

extern struct DirEntry rootDir;

extern long sec_sizes[];
extern long sec_offsts[];
extern String sec_modes[];

Handle * open_ppf(String ppf, Handle * iso, char * comment);
unsigned short int swap_word(unsigned short int i);
unsigned long int swap_dword(unsigned long int i);
int guess_type(Handle * f_iso, int number);
void sector_seek(Handle * f_iso, long sector);
long read_sector(Handle * f_iso, Byte * buffer, int type, int number = -1);
void read_datas(Handle * f_iso, Byte * buffer, int type, int number, long size);
void read_Handle(Handle * f_iso, Handle * Handle, int type, int number, long size);
void write_sector(Handle * f_iso_r, Handle * f_iso_w, Byte * buffer, int type, int number = -1);
void write_datas(Handle * f_iso_r, Handle * f_iso_w, Byte * buffer, int type, int number, long size);
void write_file(Handle * f_iso_r, Handle * f_iso_w, Handle * Handle, int type, int number = -1);
int get_iso_infos(Handle * h);
int show_iso_infos(Handle * h);
int get_pt_infos(Handle * h);
int show_pt_infos(Handle * h);
struct DirEntry find_path(Handle * h, String path);
struct DirEntry find_parent(Handle * h, String path);
void show_head_entry(void);
int show_entry(struct DirEntry * dir);
int show_dir(Handle * h, struct DirEntry * dir);
struct DirEntry find_dir_entry(Handle * h, struct DirEntry * dir, String name);
struct DirEntry * find_dir_entry(Handle * h, Byte ** buffer, struct DirEntry * dir, String name);
unsigned char from_BCD(unsigned char x);
unsigned char to_BCD(unsigned char x);
int is_valid_BCD(unsigned char x);
unsigned long from_MSF(unsigned long msf, unsigned long start = 150);
unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150);

#endif