From 50f0dd331f8168fb5b2cd60c70178fad627b7fb6 Mon Sep 17 00:00:00 2001 From: pixel Date: Sat, 27 Nov 2004 21:44:15 +0000 Subject: Large dos2unix commit... --- includes/cdabstract.h | 130 +++++++++++------------ includes/cdreader.h | 132 ++++++++++++------------ includes/cdutils.h | 278 +++++++++++++++++++++++++------------------------- includes/dte.h | 38 +++---- includes/gettext.h | 116 ++++++++++----------- includes/isobuilder.h | 210 +++++++++++++++++++------------------- includes/luacd.h | 184 ++++++++++++++++----------------- includes/luapsx.h | 68 ++++++------ includes/lzss.h | 162 ++++++++++++++--------------- includes/mips.h | 36 +++---- includes/mipsdis.h | 108 ++++++++++---------- includes/mipsdump.h | 146 +++++++++++++------------- includes/mipsmem.h | 228 ++++++++++++++++++++--------------------- includes/mipsobj.h | 148 +++++++++++++-------------- includes/yazedc.h | 220 +++++++++++++++++++-------------------- 15 files changed, 1102 insertions(+), 1102 deletions(-) (limited to 'includes') diff --git a/includes/cdabstract.h b/includes/cdabstract.h index 9a728ec..a5dcd0e 100644 --- a/includes/cdabstract.h +++ b/includes/cdabstract.h @@ -1,65 +1,65 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: cdabstract.h,v 1.5 2003-12-11 16:53:42 pixel Exp $ */ - -#ifndef __CD_ABSTRACT_H__ -#define __CD_ABSTRACT_H__ - -#if defined (_MSC_VER) || defined (__MINGW32__) -#include - -#define IOCTL_SCSI_BASE 0x00000004 - -#define METHOD_BUFFERED 0 -#define METHOD_OUT_DIRECT 2 - -#define FILE_ANY_ACCESS 0 -#define FILE_READ_ACCESS 0x0001 - -#define CTL_CODE( DevType, Function, Method, Access ) ( \ - ((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ -) -#define IOCTL_SCSI_GET_ADDRESS CTL_CODE( IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS ) -#define FILE_DEVICE_CD_ROM 0x00000002 -#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM -#define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS) - -#endif - -#include -#include -#include - -class cdabstract : public Base { - public: - static Handle * open_cd(const String &); - static bool canprobe(); - static std::vector probe() throw (GeneralException); -#ifdef _WIN32 - protected: - static HANDLE OpenIOCTLFile(char cLetter); - static void GetIOCTLAdapter(HANDLE hF, int * iDA, int * iDT, int * iDL); -#endif - private: - static bool subprobe(String &); - friend class cdreader; -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: cdabstract.h,v 1.6 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __CD_ABSTRACT_H__ +#define __CD_ABSTRACT_H__ + +#if defined (_MSC_VER) || defined (__MINGW32__) +#include + +#define IOCTL_SCSI_BASE 0x00000004 + +#define METHOD_BUFFERED 0 +#define METHOD_OUT_DIRECT 2 + +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 0x0001 + +#define CTL_CODE( DevType, Function, Method, Access ) ( \ + ((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE( IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS ) +#define FILE_DEVICE_CD_ROM 0x00000002 +#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM +#define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS) + +#endif + +#include +#include +#include + +class cdabstract : public Base { + public: + static Handle * open_cd(const String &); + static bool canprobe(); + static std::vector probe() throw (GeneralException); +#ifdef _WIN32 + protected: + static HANDLE OpenIOCTLFile(char cLetter); + static void GetIOCTLAdapter(HANDLE hF, int * iDA, int * iDT, int * iDL); +#endif + private: + static bool subprobe(String &); + friend class cdreader; +}; + +#endif diff --git a/includes/cdreader.h b/includes/cdreader.h index a962d19..6b01efc 100644 --- a/includes/cdreader.h +++ b/includes/cdreader.h @@ -1,66 +1,66 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: cdreader.h,v 1.10 2003-12-04 01:55:15 pixel Exp $ */ - -#ifndef __CDREADER_H__ -#define __CDREADER_H__ - -#include -#include -#include -#include -#include "cdabstract.h" - -class cdreader : public Handle { - public: - cdreader(const String &) throw (GeneralException); - cdreader(const cdreader &); - virtual ~cdreader(); - virtual bool CanWrite() const; - virtual bool CanRead() const; - virtual bool CanSeek() const; -#if defined (_MSC_VER) || defined (__MINGW32__) - virtual void close() throw (GeneralException); -#endif - virtual ssize_t read(void *buf, size_t count) throw (GeneralException); - virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); - virtual String GetName() const; - virtual ssize_t GetSize() const; - void fetchsector(void *, int = -1); - void getsector(void *, int = -1, int = 1) throw (GeneralException); - void sectorseek(int); - - private: - struct cachedsector { - Byte sector[2352]; - cachedsector * next, * prev; - int n; - }; - String n; - int sector; - cachedsector * head, * tail, * sectors[400000]; - int nsectors; - - void removetail(); - void actualize(cachedsector * s); - void introduce(Byte * datas, int n); -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: cdreader.h,v 1.11 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __CDREADER_H__ +#define __CDREADER_H__ + +#include +#include +#include +#include +#include "cdabstract.h" + +class cdreader : public Handle { + public: + cdreader(const String &) throw (GeneralException); + cdreader(const cdreader &); + virtual ~cdreader(); + virtual bool CanWrite() const; + virtual bool CanRead() const; + virtual bool CanSeek() const; +#if defined (_MSC_VER) || defined (__MINGW32__) + virtual void close() throw (GeneralException); +#endif + virtual ssize_t read(void *buf, size_t count) throw (GeneralException); + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + virtual String GetName() const; + virtual ssize_t GetSize() const; + void fetchsector(void *, int = -1); + void getsector(void *, int = -1, int = 1) throw (GeneralException); + void sectorseek(int); + + private: + struct cachedsector { + Byte sector[2352]; + cachedsector * next, * prev; + int n; + }; + String n; + int sector; + cachedsector * head, * tail, * sectors[400000]; + int nsectors; + + void removetail(); + void actualize(cachedsector * s); + void introduce(Byte * datas, int n); +}; + +#endif diff --git a/includes/cdutils.h b/includes/cdutils.h index c81c093..2f59341 100644 --- a/includes/cdutils.h +++ b/includes/cdutils.h @@ -1,139 +1,139 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: cdutils.h,v 1.16 2004-05-03 12:55:04 pixel Exp $ */ - -#ifndef __CDUTILS_H__ -#define __CDUTILS_H__ - -#include "yazedc.h" -#include "generic.h" - -#include "Handle.h" - -#define MODE0 0 -#define MODE1 1 -#define MODE2 2 -#define MODE2_FORM1 3 -#define MODE2_FORM2 4 -#define MODE_RAW 5 -#define GUESS 6 - -extern const long sec_sizes[]; -extern const long sec_offsts[]; -extern const String sec_modes[]; - -#ifdef _MSC_VER -#pragma pack(1) -#endif - -class cdutils : public Base { - public: - cdutils(Handle * f_iso_r, Handle * f_iso_w = 0); - virtual ~cdutils(); - - PPACKED 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[1]; - } PACKED; - - struct DirEntry * rootDir; - - Handle * open_ppf(String ppf, String comment) throw(GeneralException); - void close_ppf() throw(GeneralException); - void set_iso_w(Handle *); - static unsigned short int swap_word(unsigned short int i); - static unsigned long int swap_dword(unsigned long int i); - int guess_type(int number = -1); - void sector_seek(long sector); - long read_sector(Byte * buffer, int type = GUESS, int number = -1); - void read_datas(Byte * buffer, long size, int type = GUESS, int number = -1); - void read_file(Handle * Handle, long size, int type = GUESS, int number = -1); - void write_sector(Byte * buffer, int type = GUESS, int number = -1) throw (GeneralException); - void write_datas(Byte * buffer, long size, int type = GUESS, int number = -1); - void write_file(Handle * Handle, long size = -1, int type = GUESS, int number = -1); - void create_sector(int type, int number, bool eof = false) throw (GeneralException); - int get_iso_infos(); - int show_iso_infos(); - int get_pt_infos(); - int show_pt_infos(); - struct DirEntry find_path(String path); - struct DirEntry find_parent(String path); - struct DirEntry * find_path(Byte ** buffer, String path); - struct DirEntry * find_parent(Byte ** buffer, String path); - void show_head_entry(void); - int show_entry(struct DirEntry * dir); - int show_dir(struct DirEntry * dir); - struct DirEntry find_dir_entry(struct DirEntry * dir, String name); - struct DirEntry * find_dir_entry(Byte ** buffer, struct DirEntry * dir, String name); - static unsigned char from_BCD(unsigned char x); - static unsigned char to_BCD(unsigned char x); - static bool is_valid_BCD(unsigned char x); - static unsigned long from_MSF(unsigned long msf, unsigned long start = 150); - static unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150); - static unsigned long to_MSF(int sect, unsigned long start = 150); - static void to_MSF(int sect, unsigned char & m, unsigned char & s, unsigned char & f, unsigned long start = 150); - private: - void write_ppf(Byte * old_sec, Byte * new_sec, int sec_num); - String format_date(String input); - yazedc yazedc_o; - - Handle * f_iso_r, * f_iso_w, * ppf_file; - int pt1, pt2, snum, ptl, root; -}; - -class cdfile : public Handle { - public: - cdfile(cdutils *, const cdutils::DirEntry *, int = GUESS); - cdfile(cdutils *, int sector, ssize_t = -1, int = GUESS); - virtual ~cdfile(); - virtual ssize_t read(void *buf, size_t count) throw (GeneralException); - virtual bool CanRead() const; - virtual String GetName() const; - virtual bool CanWatch() const; - virtual ssize_t GetSize() const; - virtual bool CanSeek() const; - virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); - private: - cdutils * cd; - int sector, mode; - size_t size; - String name; - cdutils::DirEntry * dir; -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: cdutils.h,v 1.17 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __CDUTILS_H__ +#define __CDUTILS_H__ + +#include "yazedc.h" +#include "generic.h" + +#include "Handle.h" + +#define MODE0 0 +#define MODE1 1 +#define MODE2 2 +#define MODE2_FORM1 3 +#define MODE2_FORM2 4 +#define MODE_RAW 5 +#define GUESS 6 + +extern const long sec_sizes[]; +extern const long sec_offsts[]; +extern const String sec_modes[]; + +#ifdef _MSC_VER +#pragma pack(1) +#endif + +class cdutils : public Base { + public: + cdutils(Handle * f_iso_r, Handle * f_iso_w = 0); + virtual ~cdutils(); + + PPACKED 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[1]; + } PACKED; + + struct DirEntry * rootDir; + + Handle * open_ppf(String ppf, String comment) throw(GeneralException); + void close_ppf() throw(GeneralException); + void set_iso_w(Handle *); + static unsigned short int swap_word(unsigned short int i); + static unsigned long int swap_dword(unsigned long int i); + int guess_type(int number = -1); + void sector_seek(long sector); + long read_sector(Byte * buffer, int type = GUESS, int number = -1); + void read_datas(Byte * buffer, long size, int type = GUESS, int number = -1); + void read_file(Handle * Handle, long size, int type = GUESS, int number = -1); + void write_sector(Byte * buffer, int type = GUESS, int number = -1) throw (GeneralException); + void write_datas(Byte * buffer, long size, int type = GUESS, int number = -1); + void write_file(Handle * Handle, long size = -1, int type = GUESS, int number = -1); + void create_sector(int type, int number, bool eof = false) throw (GeneralException); + int get_iso_infos(); + int show_iso_infos(); + int get_pt_infos(); + int show_pt_infos(); + struct DirEntry find_path(String path); + struct DirEntry find_parent(String path); + struct DirEntry * find_path(Byte ** buffer, String path); + struct DirEntry * find_parent(Byte ** buffer, String path); + void show_head_entry(void); + int show_entry(struct DirEntry * dir); + int show_dir(struct DirEntry * dir); + struct DirEntry find_dir_entry(struct DirEntry * dir, String name); + struct DirEntry * find_dir_entry(Byte ** buffer, struct DirEntry * dir, String name); + static unsigned char from_BCD(unsigned char x); + static unsigned char to_BCD(unsigned char x); + static bool is_valid_BCD(unsigned char x); + static unsigned long from_MSF(unsigned long msf, unsigned long start = 150); + static unsigned long from_MSF(unsigned char m, unsigned char s, unsigned char f, unsigned long start = 150); + static unsigned long to_MSF(int sect, unsigned long start = 150); + static void to_MSF(int sect, unsigned char & m, unsigned char & s, unsigned char & f, unsigned long start = 150); + private: + void write_ppf(Byte * old_sec, Byte * new_sec, int sec_num); + String format_date(String input); + yazedc yazedc_o; + + Handle * f_iso_r, * f_iso_w, * ppf_file; + int pt1, pt2, snum, ptl, root; +}; + +class cdfile : public Handle { + public: + cdfile(cdutils *, const cdutils::DirEntry *, int = GUESS); + cdfile(cdutils *, int sector, ssize_t = -1, int = GUESS); + virtual ~cdfile(); + virtual ssize_t read(void *buf, size_t count) throw (GeneralException); + virtual bool CanRead() const; + virtual String GetName() const; + virtual bool CanWatch() const; + virtual ssize_t GetSize() const; + virtual bool CanSeek() const; + virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); + private: + cdutils * cd; + int sector, mode; + size_t size; + String name; + cdutils::DirEntry * dir; +}; + +#endif diff --git a/includes/dte.h b/includes/dte.h index 3be7f9c..f464084 100644 --- a/includes/dte.h +++ b/includes/dte.h @@ -1,19 +1,19 @@ -#ifndef __DTE_H__ -#define __DTE_H__ - -void dte_reset(void); -void build_dte(void); -void push_entry(long entry); -char * read_line(Handle * f, char * b); -void dte_compress(); -void read_thingy(Handle * f); -void read_thingy_file(Handle * f); - -extern char * dte_text; -extern char * things[256]; -extern long dte_text_size; -extern long dte_usage[256]; - -extern long tnb_dte; - -#endif +#ifndef __DTE_H__ +#define __DTE_H__ + +void dte_reset(void); +void build_dte(void); +void push_entry(long entry); +char * read_line(Handle * f, char * b); +void dte_compress(); +void read_thingy(Handle * f); +void read_thingy_file(Handle * f); + +extern char * dte_text; +extern char * things[256]; +extern long dte_text_size; +extern long dte_usage[256]; + +extern long tnb_dte; + +#endif diff --git a/includes/gettext.h b/includes/gettext.h index c37de7f..36573bc 100644 --- a/includes/gettext.h +++ b/includes/gettext.h @@ -1,58 +1,58 @@ -#ifndef __GETTEXT_H__ -#define __GETTEXT_H__ - -#ifndef gettext -# define gettext(Msgid) ((const char *) (Msgid)) -#endif - -#ifndef dgettext -# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) -#endif - -#ifndef dcgettext -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -#endif - -#ifndef ngettext -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -#endif - -#ifndef dngettext -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -#endif - -#ifndef dcngettext -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -#endif - -#ifndef textdomain -# define textdomain(Domainname) ((const char *) (Domainname)) -#endif - -#ifndef bindtextdomain -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -#endif - -#ifndef bind_text_domain_codeset -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) -#endif - -#ifndef setlocale -# define setlocale(category, locale) -#endif - -#ifndef LC_ALL -# define LC_ALL 0 -#endif - -#ifndef gettext_noop -# define gettext_noop(String) String -#endif - -#define _(Text) dgettext ("bleh", Text) -#define N_(Text) Text - -#endif +#ifndef __GETTEXT_H__ +#define __GETTEXT_H__ + +#ifndef gettext +# define gettext(Msgid) ((const char *) (Msgid)) +#endif + +#ifndef dgettext +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +#endif + +#ifndef dcgettext +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +#endif + +#ifndef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +#endif + +#ifndef dngettext +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +#endif + +#ifndef dcngettext +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +#endif + +#ifndef textdomain +# define textdomain(Domainname) ((const char *) (Domainname)) +#endif + +#ifndef bindtextdomain +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +#endif + +#ifndef bind_text_domain_codeset +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) +#endif + +#ifndef setlocale +# define setlocale(category, locale) +#endif + +#ifndef LC_ALL +# define LC_ALL 0 +#endif + +#ifndef gettext_noop +# define gettext_noop(String) String +#endif + +#define _(Text) dgettext ("bleh", Text) +#define N_(Text) Text + +#endif diff --git a/includes/isobuilder.h b/includes/isobuilder.h index 3a5de00..d693651 100644 --- a/includes/isobuilder.h +++ b/includes/isobuilder.h @@ -1,105 +1,105 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: isobuilder.h,v 1.9 2004-01-03 15:04:47 pixel Exp $ */ - -#ifndef __ISOBUILDER_H__ -#define __ISOBUILDER_H__ - -#include -#include "cdutils.h" -#include "yazedc.h" - -class isobuilder : public Base { - public: - struct Date { - int year, month, day, hour, minute, second, hundredths, offset; - void dump(Byte * datas); - Date(int = 0); - Date(Byte * datas); - }; - struct PVD { - String sysid, volid; - String volsetid, pubid, prepid, appid; - String copyright, abstract, biblio; - Date volcreat, modif, volexp, voleff; - Byte appdata[512]; - }; - class DirTree : public Base { - public: - DirTree(DirTree * father, bool dir = true); - virtual ~DirTree(); - void fromdir(cdutils::DirEntry *); - void dumpdirs(isobuilder *) throw (GeneralException); - int buildpath(Byte * datas, int size, bool bigendian = false) throw (GeneralException); - bool isdir(); - void setbasicsxa(); - int sector; - int size; - bool hidden; - bool hardhide; - String name; - Date creation; - bool have_xa, xa_dir, xa_audio, xa_str, xa_xa, xa_form1; - int buildentry(Byte * buffer, int spaceleft, bool put_xa = true); - int mode; - DirTree * Father(); - DirTree * Child(); - DirTree * Brother(); - DirTree * Find(const String &); - private: - DirTree * father, * child, * brother; - bool dir; - int node; - int numerate(int); - }; - isobuilder(Handle * w, int mode = MODE2_FORM1); - ~isobuilder(); - void foreword(cdutils *); - void foreword(Handle * forewords, int mode = MODE_RAW); - void foreword(Byte * forewords, int mode = MODE_RAW); - int getdispsect(); - int putfile(Handle * file, int mode = -1, int sector = -1); - int putdatas(Byte * datas, size_t size, int mode = -1, int sector = -1); - int createsector(Byte * datas, int mode = -1, int sector = -1); - void setEOF(); - void clearEOF(); - DirTree * setbasics(PVD pvd, int rootsize = 1, int ptsize = 1, int nvd = 1, int rootsect = -1) throw (GeneralException); - DirTree * createdir(DirTree *, const String & _name, int size = 1, cdutils::DirEntry * = 0, int mode = -1) throw (GeneralException); - DirTree * createfile(DirTree *, Handle * file, const String & _name, cdutils::DirEntry * = 0, int mode = -1) throw (GeneralException); - void copydir(DirTree *, cdutils *, cdutils::DirEntry *, int mode = -1); - static PVD createpvd(Handle *); - static PVD createpvd(cdutils *); - static PVD createpvd(Byte *); - void close(Handle * cue = 0, int mode = -1, int nsects = -1) throw (GeneralException); - private: - Handle * w; - int sector, nsectors; - int sub_EOF, sub_EOR; - bool basics; - PVD pvd; - int rootsize, ptsize, nvd, ptsect, rootsect; - int lastdispsect; - DirTree * root; - yazedc yazedc_o; - bool closed; - int dmode; -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: isobuilder.h,v 1.10 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __ISOBUILDER_H__ +#define __ISOBUILDER_H__ + +#include +#include "cdutils.h" +#include "yazedc.h" + +class isobuilder : public Base { + public: + struct Date { + int year, month, day, hour, minute, second, hundredths, offset; + void dump(Byte * datas); + Date(int = 0); + Date(Byte * datas); + }; + struct PVD { + String sysid, volid; + String volsetid, pubid, prepid, appid; + String copyright, abstract, biblio; + Date volcreat, modif, volexp, voleff; + Byte appdata[512]; + }; + class DirTree : public Base { + public: + DirTree(DirTree * father, bool dir = true); + virtual ~DirTree(); + void fromdir(cdutils::DirEntry *); + void dumpdirs(isobuilder *) throw (GeneralException); + int buildpath(Byte * datas, int size, bool bigendian = false) throw (GeneralException); + bool isdir(); + void setbasicsxa(); + int sector; + int size; + bool hidden; + bool hardhide; + String name; + Date creation; + bool have_xa, xa_dir, xa_audio, xa_str, xa_xa, xa_form1; + int buildentry(Byte * buffer, int spaceleft, bool put_xa = true); + int mode; + DirTree * Father(); + DirTree * Child(); + DirTree * Brother(); + DirTree * Find(const String &); + private: + DirTree * father, * child, * brother; + bool dir; + int node; + int numerate(int); + }; + isobuilder(Handle * w, int mode = MODE2_FORM1); + ~isobuilder(); + void foreword(cdutils *); + void foreword(Handle * forewords, int mode = MODE_RAW); + void foreword(Byte * forewords, int mode = MODE_RAW); + int getdispsect(); + int putfile(Handle * file, int mode = -1, int sector = -1); + int putdatas(Byte * datas, size_t size, int mode = -1, int sector = -1); + int createsector(Byte * datas, int mode = -1, int sector = -1); + void setEOF(); + void clearEOF(); + DirTree * setbasics(PVD pvd, int rootsize = 1, int ptsize = 1, int nvd = 1, int rootsect = -1) throw (GeneralException); + DirTree * createdir(DirTree *, const String & _name, int size = 1, cdutils::DirEntry * = 0, int mode = -1) throw (GeneralException); + DirTree * createfile(DirTree *, Handle * file, const String & _name, cdutils::DirEntry * = 0, int mode = -1) throw (GeneralException); + void copydir(DirTree *, cdutils *, cdutils::DirEntry *, int mode = -1); + static PVD createpvd(Handle *); + static PVD createpvd(cdutils *); + static PVD createpvd(Byte *); + void close(Handle * cue = 0, int mode = -1, int nsects = -1) throw (GeneralException); + private: + Handle * w; + int sector, nsectors; + int sub_EOF, sub_EOR; + bool basics; + PVD pvd; + int rootsize, ptsize, nvd, ptsect, rootsect; + int lastdispsect; + DirTree * root; + yazedc yazedc_o; + bool closed; + int dmode; +}; + +#endif diff --git a/includes/luacd.h b/includes/luacd.h index c26957f..f2c7e4a 100644 --- a/includes/luacd.h +++ b/includes/luacd.h @@ -1,92 +1,92 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: luacd.h,v 1.6 2004-05-01 11:48:57 pixel Exp $ */ - -#ifndef __LUACD_H__ -#define __LUACD_H__ - -#include -#include -#include -#include -#include - -#define CD_PUSHSTATICS(L) { \ - Luacdutils::pushstatics(L); \ - Luacddate::pushstatics(L); \ - LuaPVD::pushstatics(L); \ - LuaDirTree::pushstatics(L); \ - Luaisobuilder::pushstatics(L); \ -} - -class Luacdutils : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); - Luacdutils(cdutils *); - protected: - virtual void pushmembers(Lua *); - cdutils * cd; -}; - -class Luadirentry : public LuaObject { - public: - Luadirentry(cdutils::DirEntry *); - protected: - virtual void pushmembers(Lua *); - cdutils::DirEntry * dir; -}; - -class Luacddate : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); - Luacddate(isobuilder::Date *); - private: - virtual void pushmembers(Lua *); - struct isobuilder::Date * date; -}; - -class LuaPVD : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); - LuaPVD(struct isobuilder::PVD *); - private: - virtual void pushmembers(Lua *); - struct isobuilder::PVD * pvd; -}; - -class LuaDirTree : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); - LuaDirTree(isobuilder::DirTree *); - private: - virtual void pushmembers(Lua *); - isobuilder::DirTree * dir; -}; - -class Luaisobuilder : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); - Luaisobuilder(isobuilder *); - private: - virtual void pushmembers(Lua *); - isobuilder * iso; -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: luacd.h,v 1.7 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __LUACD_H__ +#define __LUACD_H__ + +#include +#include +#include +#include +#include + +#define CD_PUSHSTATICS(L) { \ + Luacdutils::pushstatics(L); \ + Luacddate::pushstatics(L); \ + LuaPVD::pushstatics(L); \ + LuaDirTree::pushstatics(L); \ + Luaisobuilder::pushstatics(L); \ +} + +class Luacdutils : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); + Luacdutils(cdutils *); + protected: + virtual void pushmembers(Lua *); + cdutils * cd; +}; + +class Luadirentry : public LuaObject { + public: + Luadirentry(cdutils::DirEntry *); + protected: + virtual void pushmembers(Lua *); + cdutils::DirEntry * dir; +}; + +class Luacddate : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); + Luacddate(isobuilder::Date *); + private: + virtual void pushmembers(Lua *); + struct isobuilder::Date * date; +}; + +class LuaPVD : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); + LuaPVD(struct isobuilder::PVD *); + private: + virtual void pushmembers(Lua *); + struct isobuilder::PVD * pvd; +}; + +class LuaDirTree : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); + LuaDirTree(isobuilder::DirTree *); + private: + virtual void pushmembers(Lua *); + isobuilder::DirTree * dir; +}; + +class Luaisobuilder : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); + Luaisobuilder(isobuilder *); + private: + virtual void pushmembers(Lua *); + isobuilder * iso; +}; + +#endif diff --git a/includes/luapsx.h b/includes/luapsx.h index 1d28dcc..4b8e6e7 100644 --- a/includes/luapsx.h +++ b/includes/luapsx.h @@ -1,34 +1,34 @@ - /* - * PSX-Tools Bundle Pack - * Copyright (C) 2002-2003 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 - */ - -/* $Id: luapsx.h,v 1.3 2004-05-01 11:48:58 pixel Exp $ */ - -#ifndef __LUAPSX_H__ -#define __LUAPSX_H__ - -#include -#include -#include - -class Luapsx : public LuaObject { - public: - static void pushstatics(Lua *) throw (GeneralException); -}; - -#endif + /* + * PSX-Tools Bundle Pack + * Copyright (C) 2002-2003 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 + */ + +/* $Id: luapsx.h,v 1.4 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __LUAPSX_H__ +#define __LUAPSX_H__ + +#include +#include +#include + +class Luapsx : public LuaObject { + public: + static void pushstatics(Lua *) throw (GeneralException); +}; + +#endif diff --git a/includes/lzss.h b/includes/lzss.h index 14aa345..d4da684 100644 --- a/includes/lzss.h +++ b/includes/lzss.h @@ -1,81 +1,81 @@ -/* - * 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 - * aint with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LZSS_H__ -#define __LZSS_H__ - -#include -#include "generic.h" -#include "Handle.h" - -#define LZSS_VERSION String("3.0.0-pre1") -#define LZSS_NAME String("lzss") - -class lzss : public Base { - public: - lzss(); - typedef struct { - char * name; - int one_is_compressed, bitmap_inversed, one_jump, overlap_trick, negative_trick, sixteen_bits, ptrb, filling; - int window_start; - int l_mask_1, l_shft_1, l_mask_2, l_shft_2; - int j_mask_1, j_shft_1, j_mask_2, j_shft_2; - int f_mask_1, f_shft_1, f_mask_2, f_shft_2; - int v_mask_1, v_shft_1, v_mask_2, v_shft_2; - } scheme_t; - - enum { - XENO = 0, - DBZ, - FF7, - LM, - MM, - OB, - LODOSS, - FF6, - VP_1, - VP_2, - TOD, - END - }; - - static const scheme_t schemes[]; - int tolerate, blockb; - int blk, bitmap_count; - - unsigned int lzss_decomp(Handle * f_source, Handle * f_cible, int true_length = -1); - void lzss_comp(Handle * f_source, Handle * f_cible, int * delta = NULL); - - Byte swap_bits(Byte); - - void change_scheme(scheme_t); - scheme_t get_scheme(); - - private: - scheme_t scheme; - int lzss_maxsize, lzss_maxptr; - - unsigned int shift(unsigned int, int); - void compute_limits(void); - unsigned char lzss_rd(unsigned char *, int); - int lzss_comp_strstr(unsigned char *, unsigned char *, int *, int); - unsigned char * lzss_memcomp(unsigned char *, int *, int *); -}; - -#endif +/* + * 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 + * aint with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LZSS_H__ +#define __LZSS_H__ + +#include +#include "generic.h" +#include "Handle.h" + +#define LZSS_VERSION String("3.0.0-pre1") +#define LZSS_NAME String("lzss") + +class lzss : public Base { + public: + lzss(); + typedef struct { + char * name; + int one_is_compressed, bitmap_inversed, one_jump, overlap_trick, negative_trick, sixteen_bits, ptrb, filling; + int window_start; + int l_mask_1, l_shft_1, l_mask_2, l_shft_2; + int j_mask_1, j_shft_1, j_mask_2, j_shft_2; + int f_mask_1, f_shft_1, f_mask_2, f_shft_2; + int v_mask_1, v_shft_1, v_mask_2, v_shft_2; + } scheme_t; + + enum { + XENO = 0, + DBZ, + FF7, + LM, + MM, + OB, + LODOSS, + FF6, + VP_1, + VP_2, + TOD, + END + }; + + static const scheme_t schemes[]; + int tolerate, blockb; + int blk, bitmap_count; + + unsigned int lzss_decomp(Handle * f_source, Handle * f_cible, int true_length = -1); + void lzss_comp(Handle * f_source, Handle * f_cible, int * delta = NULL); + + Byte swap_bits(Byte); + + void change_scheme(scheme_t); + scheme_t get_scheme(); + + private: + scheme_t scheme; + int lzss_maxsize, lzss_maxptr; + + unsigned int shift(unsigned int, int); + void compute_limits(void); + unsigned char lzss_rd(unsigned char *, int); + int lzss_comp_strstr(unsigned char *, unsigned char *, int *, int); + unsigned char * lzss_memcomp(unsigned char *, int *, int *); +}; + +#endif diff --git a/includes/mips.h b/includes/mips.h index 8ace76f..f3fc911 100644 --- a/includes/mips.h +++ b/includes/mips.h @@ -1,18 +1,18 @@ -#ifndef __MIPS_H__ -#define __MIPS_H__ - -#include "mipsdis.h" - -void decode(TDis * d, Uint32 pc); - -enum registers { - Rzr, Rat, Rv0, Rv1, Ra0, Ra1, Ra2, Ra3, - Rt0, Rt1, Rt2, Rt3, Rt4, Rt5, Rt6, Rt7, - Rs0, Rs1, Rs2, Rs3, Rs4, Rs5, Rs6, Rs7, - Rt8, Rt9, Rk0, Rk1, Rgp, Rsp, Rfp, Rra, -}; - -extern char * registers[]; -extern char * CP0registers[]; - -#endif +#ifndef __MIPS_H__ +#define __MIPS_H__ + +#include "mipsdis.h" + +void decode(TDis * d, Uint32 pc); + +enum registers { + Rzr, Rat, Rv0, Rv1, Ra0, Ra1, Ra2, Ra3, + Rt0, Rt1, Rt2, Rt3, Rt4, Rt5, Rt6, Rt7, + Rs0, Rs1, Rs2, Rs3, Rs4, Rs5, Rs6, Rs7, + Rt8, Rt9, Rk0, Rk1, Rgp, Rsp, Rfp, Rra, +}; + +extern char * registers[]; +extern char * CP0registers[]; + +#endif diff --git a/includes/mipsdis.h b/includes/mipsdis.h index 5ce2506..e8644cc 100644 --- a/includes/mipsdis.h +++ b/includes/mipsdis.h @@ -1,54 +1,54 @@ -#ifndef __MIPSDIS_H__ -#define __MIPSDIS_H__ -#include -#include -#include "mipsmem.h" - -class TDis : public Base { - public: - TDis(mipsmem *); - virtual mipsmem * getmem(); - virtual void add_branch(Uint32); - virtual void add_jump(Uint32); - virtual void add_function(Uint32); - virtual void SetTag(Uint32, int, bool); - virtual void Name(const String &); - virtual void PushGPReg(int); - virtual void PushCPReg(int); - virtual void PushImm(Uint32); - virtual void PushTarget(Uint32); - virtual void PushSa(Uint32); - virtual void PushOfB(int reg, Uint32, int); - virtual void PushOffset(Uint32); - virtual void PushFull(Uint32); - virtual void Invalid(); - virtual void Suspect(); - virtual void Comment(const String &); - - virtual void reset(); - - bool invalid; - std::priority_queue, std::greater > bheap; - std::priority_queue, std::greater > jheap; - std::priority_queue, std::greater > fheap; - - Uint32 pc; - private: - mipsmem * mm; -}; - -class Disassembler : public Base { - public: - Disassembler(mipsmem *); - virtual ~Disassembler(); - void mainloop(); - void crawl_code(Uint32 = 0xffffffff); - private: - mipsmem * mm; - TDis * dis; - bool started; - bool infunction; -}; - - -#endif +#ifndef __MIPSDIS_H__ +#define __MIPSDIS_H__ +#include +#include +#include "mipsmem.h" + +class TDis : public Base { + public: + TDis(mipsmem *); + virtual mipsmem * getmem(); + virtual void add_branch(Uint32); + virtual void add_jump(Uint32); + virtual void add_function(Uint32); + virtual void SetTag(Uint32, int, bool); + virtual void Name(const String &); + virtual void PushGPReg(int); + virtual void PushCPReg(int); + virtual void PushImm(Uint32); + virtual void PushTarget(Uint32); + virtual void PushSa(Uint32); + virtual void PushOfB(int reg, Uint32, int); + virtual void PushOffset(Uint32); + virtual void PushFull(Uint32); + virtual void Invalid(); + virtual void Suspect(); + virtual void Comment(const String &); + + virtual void reset(); + + bool invalid; + std::priority_queue, std::greater > bheap; + std::priority_queue, std::greater > jheap; + std::priority_queue, std::greater > fheap; + + Uint32 pc; + private: + mipsmem * mm; +}; + +class Disassembler : public Base { + public: + Disassembler(mipsmem *); + virtual ~Disassembler(); + void mainloop(); + void crawl_code(Uint32 = 0xffffffff); + private: + mipsmem * mm; + TDis * dis; + bool started; + bool infunction; +}; + + +#endif diff --git a/includes/mipsdump.h b/includes/mipsdump.h index a6c6288..ca2047a 100644 --- a/includes/mipsdump.h +++ b/includes/mipsdump.h @@ -1,73 +1,73 @@ -#ifndef __MIPSDUMP_H__ -#define __MIPSDUMP_H__ - -#include -#include - -enum arg_type { - T_GPREGISTER, - T_CPREGISTER, - T_IMM8, - T_IMM16, - T_IMM32, - T_OFB, -}; - -union arg { - Uint32 v; - struct { - Uint32 o; - int r; - int w; - } OfB; -}; - -template -struct mypair { - T1 left; - T2 right; -}; - -typedef mypair pairarg; - -class TDump : public TDis { - public: - TDump(mipsmem *); - virtual void add_branch(Uint32); - virtual void add_jump(Uint32); - virtual void add_function(Uint32); - virtual void SetTag(Uint32, int, bool); - virtual void Name(const String &); - virtual void PushGPReg(int); - virtual void PushCPReg(int); - virtual void PushImm(Uint32); - virtual void PushTarget(Uint32); - virtual void PushSa(Uint32); - virtual void PushOfB(int reg, Uint32, int); - virtual void PushOffset(Uint32); - virtual void PushFull(Uint32); - virtual void Invalid(); - virtual void Suspect(); - virtual void Comment(const String &); - - virtual void reset(); - - String name; - std::vector args; - String comments; - - Uint32 tg; - - bool invalid, hasbr, hastg, hasfc; -}; - -class Dumper : public Base { - public: - Dumper(mipsmem *); - void process(); - private: - TDump * dump; - mipsmem * mm; -}; - -#endif +#ifndef __MIPSDUMP_H__ +#define __MIPSDUMP_H__ + +#include +#include + +enum arg_type { + T_GPREGISTER, + T_CPREGISTER, + T_IMM8, + T_IMM16, + T_IMM32, + T_OFB, +}; + +union arg { + Uint32 v; + struct { + Uint32 o; + int r; + int w; + } OfB; +}; + +template +struct mypair { + T1 left; + T2 right; +}; + +typedef mypair pairarg; + +class TDump : public TDis { + public: + TDump(mipsmem *); + virtual void add_branch(Uint32); + virtual void add_jump(Uint32); + virtual void add_function(Uint32); + virtual void SetTag(Uint32, int, bool); + virtual void Name(const String &); + virtual void PushGPReg(int); + virtual void PushCPReg(int); + virtual void PushImm(Uint32); + virtual void PushTarget(Uint32); + virtual void PushSa(Uint32); + virtual void PushOfB(int reg, Uint32, int); + virtual void PushOffset(Uint32); + virtual void PushFull(Uint32); + virtual void Invalid(); + virtual void Suspect(); + virtual void Comment(const String &); + + virtual void reset(); + + String name; + std::vector args; + String comments; + + Uint32 tg; + + bool invalid, hasbr, hastg, hasfc; +}; + +class Dumper : public Base { + public: + Dumper(mipsmem *); + void process(); + private: + TDump * dump; + mipsmem * mm; +}; + +#endif diff --git a/includes/mipsmem.h b/includes/mipsmem.h index f763af8..b083b0f 100644 --- a/includes/mipsmem.h +++ b/includes/mipsmem.h @@ -1,114 +1,114 @@ -#ifndef __MIPSMEM_H__ -#define __MIPSMEM_H__ -#define PSXMEM 0x200000 - -#include -#include - -enum tags_t { - CODE, - DATA, - STOP, - INVALID, -}; - -class memdata; - -class func_t : public Base { - public: - func_t(); - virtual ~func_t(); - Uint32 endpc; - Uint8 stacksize; -}; - -class refto_t; -class reffrom_t : public Base { - public: - reffrom_t(refto_t *, memdata *); - virtual ~reffrom_t(); - memdata * getref(); - memdata * getmem(); - reffrom_t * getnext(); - private: - refto_t * refto; - reffrom_t * next, * prev; - memdata * header; -}; - -class refto_t : public Base { - public: - refto_t(Uint32, memdata *); - virtual ~refto_t(); - memdata * getref(); - memdata * getmem(); - private: - reffrom_t * reffrom; - memdata * mem; -}; - -class mipsmem; -class memdata : public Base { - public: - memdata(Uint32, mipsmem *); - virtual ~memdata(); - Uint32 getaddress(); - memdata * getmem(Uint32); - static memdata * getmem(Uint32, mipsmem *); - func_t * getfunc(); - refto_t * getrefto(); - reffrom_t * getreffrom(); - void setfunc(func_t *); - void setrefto(refto_t *); - void setreffrom(reffrom_t *); - private: - void checkdestroy(); - Uint32 address; - mipsmem * mm; - func_t * func; - refto_t * refto; - reffrom_t * reffrom; -}; - -class mipsmem : public Base { - public: - mipsmem(); - Uint8 Read8(Uint32 addr); - Uint16 Read16(Uint32 addr); - Uint32 Read32(Uint32 addr); - void Write8(Uint32 addr, Uint8); - void Write16(Uint32 addr, Uint16); - void Write32(Uint32 addr, Uint32); - void unpatch8(Uint32 addr); - void unpatch16(Uint32 addr); - void unpatch32(Uint32 addr); - bool IsPatched(Uint32 addr); - void LoadPSYQ(Handle *); - void SavePSYQ(Handle *); - bool GetTag(Uint32 addr, char tag); - void SetTag(Uint32 addr, char tag, bool); - memdata * GetDatas(Uint32 addr); - void SetDatas(Uint32 addr, memdata * p); - Uint32 GetPC(); - Uint32 GetLower(); - Uint32 GetUpper(); - private: - void patch(Uint32, int); - void unpatch(Uint32, int); - Uint8 psyqhead[0x800]; - Uint8 plainmemory[PSXMEM]; - Uint8 patches[PSXMEM]; - Uint8 patchesmap[PSXMEM / 8]; - Uint8 tags[PSXMEM]; - memdata * datas[PSXMEM]; - Uint32 paddr, psize, startpc; - - struct psyq { - Uint8 id[8]; - Uint32 text, data, pc0, gp0, t_addr, t_size; - Uint32 d_addr, d_size, b_addr, b_size, s_addr, s_size; - Uint32 sp, fp, gp, ra, s0; - }; -}; - -#endif +#ifndef __MIPSMEM_H__ +#define __MIPSMEM_H__ +#define PSXMEM 0x200000 + +#include +#include + +enum tags_t { + CODE, + DATA, + STOP, + INVALID, +}; + +class memdata; + +class func_t : public Base { + public: + func_t(); + virtual ~func_t(); + Uint32 endpc; + Uint8 stacksize; +}; + +class refto_t; +class reffrom_t : public Base { + public: + reffrom_t(refto_t *, memdata *); + virtual ~reffrom_t(); + memdata * getref(); + memdata * getmem(); + reffrom_t * getnext(); + private: + refto_t * refto; + reffrom_t * next, * prev; + memdata * header; +}; + +class refto_t : public Base { + public: + refto_t(Uint32, memdata *); + virtual ~refto_t(); + memdata * getref(); + memdata * getmem(); + private: + reffrom_t * reffrom; + memdata * mem; +}; + +class mipsmem; +class memdata : public Base { + public: + memdata(Uint32, mipsmem *); + virtual ~memdata(); + Uint32 getaddress(); + memdata * getmem(Uint32); + static memdata * getmem(Uint32, mipsmem *); + func_t * getfunc(); + refto_t * getrefto(); + reffrom_t * getreffrom(); + void setfunc(func_t *); + void setrefto(refto_t *); + void setreffrom(reffrom_t *); + private: + void checkdestroy(); + Uint32 address; + mipsmem * mm; + func_t * func; + refto_t * refto; + reffrom_t * reffrom; +}; + +class mipsmem : public Base { + public: + mipsmem(); + Uint8 Read8(Uint32 addr); + Uint16 Read16(Uint32 addr); + Uint32 Read32(Uint32 addr); + void Write8(Uint32 addr, Uint8); + void Write16(Uint32 addr, Uint16); + void Write32(Uint32 addr, Uint32); + void unpatch8(Uint32 addr); + void unpatch16(Uint32 addr); + void unpatch32(Uint32 addr); + bool IsPatched(Uint32 addr); + void LoadPSYQ(Handle *); + void SavePSYQ(Handle *); + bool GetTag(Uint32 addr, char tag); + void SetTag(Uint32 addr, char tag, bool); + memdata * GetDatas(Uint32 addr); + void SetDatas(Uint32 addr, memdata * p); + Uint32 GetPC(); + Uint32 GetLower(); + Uint32 GetUpper(); + private: + void patch(Uint32, int); + void unpatch(Uint32, int); + Uint8 psyqhead[0x800]; + Uint8 plainmemory[PSXMEM]; + Uint8 patches[PSXMEM]; + Uint8 patchesmap[PSXMEM / 8]; + Uint8 tags[PSXMEM]; + memdata * datas[PSXMEM]; + Uint32 paddr, psize, startpc; + + struct psyq { + Uint8 id[8]; + Uint32 text, data, pc0, gp0, t_addr, t_size; + Uint32 d_addr, d_size, b_addr, b_size, s_addr, s_size; + Uint32 sp, fp, gp, ra, s0; + }; +}; + +#endif diff --git a/includes/mipsobj.h b/includes/mipsobj.h index 18ac504..8ed68d8 100644 --- a/includes/mipsobj.h +++ b/includes/mipsobj.h @@ -1,74 +1,74 @@ -#ifndef __MIPSOBJ_H__ -#define __MIPSOBJ_H__ - -#include -#include -#include - -enum mips_reloc_t { - R_MIPS_26, - R_MIPS_32, - R_MIPS_HI16, - R_MIPS_LO16, -}; - -enum symbol_type_t { - LOCAL, - GLOBAL, - EXTERN, -}; - -enum section_type_t { - TEXT, - DATA, - BSS, -}; - -struct reloc_t { - String symbol; - int type; - Uint32 offset; -}; - -struct symbol_t { - String name; - String section; - int type; - Uint32 offset; -}; - -class section : public Base { - public: - section(const String &, int); - section(); - virtual ~section(); - void setname(const String &); - void settype(int); - void putdatas(const Uint8 *, int); - int gettype(); - int getsize(); - const Uint8 * getdatas(); - void putreloc(const String &, int, Uint32); - void putreloc(const struct reloc_t &); - std::vector relocs; - private: - String name; - int type; - Uint8 * datas; - int length; -}; - -class mipsobj : public Base { - public: - mipsobj(); - virtual ~mipsobj(); - std::map sections; - std::map symbols; - void loadELF(Handle *) throw (GeneralException); - void loadOBJ(Handle *) throw (GeneralException); - void loadLIB(Handle *, const String &) throw (GeneralException); - private: - bool loaded; -}; - -#endif +#ifndef __MIPSOBJ_H__ +#define __MIPSOBJ_H__ + +#include +#include +#include + +enum mips_reloc_t { + R_MIPS_26, + R_MIPS_32, + R_MIPS_HI16, + R_MIPS_LO16, +}; + +enum symbol_type_t { + LOCAL, + GLOBAL, + EXTERN, +}; + +enum section_type_t { + TEXT, + DATA, + BSS, +}; + +struct reloc_t { + String symbol; + int type; + Uint32 offset; +}; + +struct symbol_t { + String name; + String section; + int type; + Uint32 offset; +}; + +class section : public Base { + public: + section(const String &, int); + section(); + virtual ~section(); + void setname(const String &); + void settype(int); + void putdatas(const Uint8 *, int); + int gettype(); + int getsize(); + const Uint8 * getdatas(); + void putreloc(const String &, int, Uint32); + void putreloc(const struct reloc_t &); + std::vector relocs; + private: + String name; + int type; + Uint8 * datas; + int length; +}; + +class mipsobj : public Base { + public: + mipsobj(); + virtual ~mipsobj(); + std::map sections; + std::map symbols; + void loadELF(Handle *) throw (GeneralException); + void loadOBJ(Handle *) throw (GeneralException); + void loadLIB(Handle *, const String &) throw (GeneralException); + private: + bool loaded; +}; + +#endif diff --git a/includes/yazedc.h b/includes/yazedc.h index 296c532..8227e87 100644 --- a/includes/yazedc.h +++ b/includes/yazedc.h @@ -1,110 +1,110 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 1998 Heiko Eissfeldt - * portions used& Chris Smith - * First modified by Yazoo, then by - * 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 - */ - -/* $Id: yazedc.h,v 1.4 2003-12-04 01:47:37 pixel Exp $ */ - -#ifndef __YAZEDC_H__ -#define __YAZEDC_H__ - -#include "Exceptions.h" - -#define RS_L12_BITS 8 - -/* audio sector definitions for CIRC */ -#define FRAMES_PER_SECTOR 98 -/* user data bytes per frame */ -#define L1_RAW 24 -/* parity bytes with 8 bit */ -#define L1_Q 4 -#define L1_P 4 - -/* data sector definitions for RSPC */ -/* user data bytes per frame */ -#define L2_RAW (1024*2) -/* parity bytes for 16 bit units */ -#define L2_Q (26*2*2) -#define L2_P (43*2*2) - -/* known sector types */ -#define MODE_0 0 -#define MODE_1 1 -#define MODE_2 2 -#define MODE_2_FORM_1 3 -#define MODE_2_FORM_2 4 - -/* r-w sub channel definitions */ -#define RS_SUB_RW_BITS 6 - -#define PACKETS_PER_SUBCHANNELFRAME 4 -#define LSUB_RAW 18 -#define LSUB_QRAW 2 -/* 6 bit */ -#define LSUB_Q 2 -#define LSUB_P 4 - -class yazedc : public Base { - - public: - yazedc(); - -/* set one of the MODE_* constants for subsequent data sector formatting */ - int set_sector_type(int st); -/* get the current sector type setting for data sector formatting */ - int get_sector_type(void); - -/* data sector layer 2 Reed-Solomon Product Code encoder */ -/* encode the given data portion depending on sector type (see - get/set_sector_type() functions). Use the given address for the header. - The returned data is __unscrambled__ and not in F2-frame format (for that - see function scramble_L2()). - Supported sector types: - MODE_0: a 12-byte sync field, a header and 2336 zeros are returned. - MODE_1: the user data portion (2048 bytes) has to be given - at offset 16 in the inout array. - Sync-, header-, edc-, spare-, p- and q- fields will be added. - MODE_2: the user data portion (2336 bytes) has to be given - at offset 16 in the inout array. - Sync- and header- fields will be added. - MODE_2_FORM_1: the user data portion (8 bytes subheader followed - by 2048 bytes data) has to be given at offset 16 - in the inout array. - Sync-, header-, edc-, p- and q- fields will be added. - MODE_2_FORM_2: the user data portion (8 bytes subheader followed - by 2324 bytes data) has to be given at offset 16 - in the inout array. - Sync-, header- and edc- fields will be added. -*/ - int do_encode_L2(unsigned char *inout, int sectortype, unsigned address); - -/* generates f2 frames from otherwise fully formatted sectors (generated by - do_encode_L2()). */ - int scramble_L2(unsigned char *inout); - - unsigned char minute, second, frame; - - private: - int sectortype; - int build_address(unsigned char inout[], int sectortype, unsigned address); - -}; - -#endif +/* + * PSX-Tools Bundle Pack + * Copyright (C) 1998 Heiko Eissfeldt + * portions used& Chris Smith + * First modified by Yazoo, then by + * 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 + */ + +/* $Id: yazedc.h,v 1.5 2004-11-27 21:44:46 pixel Exp $ */ + +#ifndef __YAZEDC_H__ +#define __YAZEDC_H__ + +#include "Exceptions.h" + +#define RS_L12_BITS 8 + +/* audio sector definitions for CIRC */ +#define FRAMES_PER_SECTOR 98 +/* user data bytes per frame */ +#define L1_RAW 24 +/* parity bytes with 8 bit */ +#define L1_Q 4 +#define L1_P 4 + +/* data sector definitions for RSPC */ +/* user data bytes per frame */ +#define L2_RAW (1024*2) +/* parity bytes for 16 bit units */ +#define L2_Q (26*2*2) +#define L2_P (43*2*2) + +/* known sector types */ +#define MODE_0 0 +#define MODE_1 1 +#define MODE_2 2 +#define MODE_2_FORM_1 3 +#define MODE_2_FORM_2 4 + +/* r-w sub channel definitions */ +#define RS_SUB_RW_BITS 6 + +#define PACKETS_PER_SUBCHANNELFRAME 4 +#define LSUB_RAW 18 +#define LSUB_QRAW 2 +/* 6 bit */ +#define LSUB_Q 2 +#define LSUB_P 4 + +class yazedc : public Base { + + public: + yazedc(); + +/* set one of the MODE_* constants for subsequent data sector formatting */ + int set_sector_type(int st); +/* get the current sector type setting for data sector formatting */ + int get_sector_type(void); + +/* data sector layer 2 Reed-Solomon Product Code encoder */ +/* encode the given data portion depending on sector type (see + get/set_sector_type() functions). Use the given address for the header. + The returned data is __unscrambled__ and not in F2-frame format (for that + see function scramble_L2()). + Supported sector types: + MODE_0: a 12-byte sync field, a header and 2336 zeros are returned. + MODE_1: the user data portion (2048 bytes) has to be given + at offset 16 in the inout array. + Sync-, header-, edc-, spare-, p- and q- fields will be added. + MODE_2: the user data portion (2336 bytes) has to be given + at offset 16 in the inout array. + Sync- and header- fields will be added. + MODE_2_FORM_1: the user data portion (8 bytes subheader followed + by 2048 bytes data) has to be given at offset 16 + in the inout array. + Sync-, header-, edc-, p- and q- fields will be added. + MODE_2_FORM_2: the user data portion (8 bytes subheader followed + by 2324 bytes data) has to be given at offset 16 + in the inout array. + Sync-, header- and edc- fields will be added. +*/ + int do_encode_L2(unsigned char *inout, int sectortype, unsigned address); + +/* generates f2 frames from otherwise fully formatted sectors (generated by + do_encode_L2()). */ + int scramble_L2(unsigned char *inout); + + unsigned char minute, second, frame; + + private: + int sectortype; + int build_address(unsigned char inout[], int sectortype, unsigned address); + +}; + +#endif -- cgit v1.2.3