summaryrefslogtreecommitdiff
path: root/cdutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'cdutils.h')
-rw-r--r--cdutils.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/cdutils.h b/cdutils.h
new file mode 100644
index 0000000..b3aace5
--- /dev/null
+++ b/cdutils.h
@@ -0,0 +1,83 @@
+/*
+ * 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>
+
+#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 FileUnit;
+ unsigned char FileGap;
+ unsigned short VolSeq;
+ unsigned short BEVolSeq;
+ unsigned char N;
+ char id;
+} __attribute__((packed));
+
+extern struct DirEntry rootDir;
+
+extern long sec_sizes[];
+extern long sec_offsts[];
+extern char * sec_modes[];
+
+FILE * open_ppf(char * ppf, FILE * iso, char * comment);
+unsigned short int swap_word(unsigned short int i);
+unsigned long int swap_dword(unsigned long int i);
+int guess_type(FILE * f_iso, int number);
+void sector_seek(FILE * f_iso, long sector);
+long read_sector(FILE * f_iso, unsigned char * buffer, char type, int number = -1);
+void read_datas(FILE * f_iso, unsigned char * buffer, int type, int number, long size);
+void read_file(FILE * f_iso, FILE * file, char type, int number, long size);
+void write_sector(FILE * f_iso_r, FILE * f_iso_w, unsigned char * buffer, char type, int number = -1);
+void write_datas(FILE * f_iso_r, FILE * f_iso_w, unsigned char * buffer, char type, int number, long size);
+void write_file(FILE * f_iso_r, FILE * f_iso_w, FILE * file, char type, int number = -1);
+int get_iso_infos(FILE * h);
+int show_iso_infos(FILE * h);
+int get_pt_infos(FILE * h);
+int show_pt_infos(FILE * h);
+struct DirEntry find_path(FILE * h, char * path);
+struct DirEntry find_parent(FILE * h, char * path);
+void show_head_entry(void);
+int show_entry(struct DirEntry * dir);
+int show_dir(FILE * h, struct DirEntry * dir);
+struct DirEntry find_dir_entry(FILE * h, struct DirEntry * dir, char * name);
+struct DirEntry * find_dir_entry(FILE * h, unsigned char ** buffer, struct DirEntry * dir, char * 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);
+
+#endif