bsnes/snesreader/unrar/headers.hpp

146 lines
2.5 KiB
C++
Raw Normal View History

Update to bsnes v063 release. Time for another (hopefully) stable release. The changelog has all updates since the last stable release. Most notably, this release features substantial accuracy improvements all around. Almost all of them represent brand new findings never before seen in any SNES emulator. Changelog: - fixed off-by-one buffer size issue in S-PPU RTO calculations [PiCiJi] - added XML parser - added XML-based memory mapping system - moved header-based memory mapping code into snesreader library - added some linker flags for Fedora [belegdol] - added cheat code database; with codes for over 1,500 games [mightymo] - fixed a bug where S-CPU IRQs were being tested one cycle early on direct page indexed read opcodes - added global cheat system enable/disable checkbox to cheat code editor - fixed bug in overflow calculation of S-CPU ADC and SBC opcodes in BCD mode [blargg] - emulated the S-CPU ALU MUL and DIV hardware delays with partial result calculation steps [blargg] - controller port read now returns real-time results of B button when strobe latch is raised - major improvements to emulation of the S-SMP TEST register [blargg, byuu] - fixed DSP2 memory map [Overload] - "Apply Patch" checkbox will now scan UPS patch folder if one is set in the paths section - fixed S-CPU TSC negative flag calculation in emulation mode [address] - added "make uninstall" command to Makefile for Linux users - S-CPU (H)DMA now updates the S-CPU MDR; fixes a freeze in Speedy Gonzales - Stage 6-1 - very substantial code cleanups and optimizations as a result of moving from C++98 to C++0x
2010-03-28 15:46:44 +00:00
#ifndef _RAR_HEADERS_
#define _RAR_HEADERS_
#define SIZEOF_MARKHEAD 7
#define SIZEOF_OLDMHD 7
#define SIZEOF_NEWMHD 13
#define SIZEOF_OLDLHD 21
#define SIZEOF_NEWLHD 32
#define SIZEOF_SHORTBLOCKHEAD 7
#define SIZEOF_SUBBLOCKHEAD 14
#define SIZEOF_COMMHEAD 13
#define UNP_VER 36
#define MHD_VOLUME 0x0001
#define MHD_COMMENT 0x0002
#define MHD_SOLID 0x0008
#define MHD_PASSWORD 0x0080
#define LHD_SPLIT_BEFORE 0x0001
#define LHD_SPLIT_AFTER 0x0002
#define LHD_PASSWORD 0x0004
#define LHD_COMMENT 0x0008
#define LHD_SOLID 0x0010
#define LHD_WINDOWMASK 0x00e0
#define LHD_DIRECTORY 0x00e0
#define LHD_LARGE 0x0100
#define LHD_UNICODE 0x0200
#define LHD_SALT 0x0400
#define LHD_EXTTIME 0x1000
#define LONG_BLOCK 0x8000
enum HEADER_TYPE {
MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76,
SUB_HEAD=0x77,PROTECT_HEAD=0x78,SIGN_HEAD=0x79,NEWSUB_HEAD=0x7a,
ENDARC_HEAD=0x7b
};
enum HOST_SYSTEM {
HOST_MSDOS=0,HOST_OS2=1,HOST_WIN32=2,HOST_UNIX=3,HOST_MACOS=4,
HOST_BEOS=5,HOST_MAX
};
struct OldMainHeader
{
byte Mark[4];
ushort HeadSize;
byte Flags;
};
struct OldFileHeader
{
uint PackSize;
uint UnpSize;
ushort FileCRC;
ushort HeadSize;
uint FileTime;
byte FileAttr;
byte Flags;
byte UnpVer;
byte NameSize;
byte Method;
};
struct MarkHeader
{
byte Mark[7];
};
struct BaseBlock
{
ushort HeadCRC;
HEADER_TYPE HeadType;//byte
ushort Flags;
ushort HeadSize;
};
struct BlockHeader:BaseBlock
{
union {
uint DataSize;
uint PackSize;
};
};
struct MainHeader:BaseBlock
{
ushort HighPosAV;
uint PosAV;
};
#define SALT_SIZE 8
struct FileHeader:BlockHeader
{
uint UnpSize;
byte HostOS;
uint FileCRC;
uint FileTime;
byte UnpVer;
byte Method;
ushort NameSize;
union {
uint FileAttr;
uint SubFlags;
};
/* optional */
uint HighPackSize;
uint HighUnpSize;
/* names */
char FileName[NM*4]; // *4 to avoid using lots of stack in arcread
wchar FileNameW[NM];
/* optional */
byte Salt[SALT_SIZE];
RarTime mtime;
/* dummy */
Int64 FullPackSize;
Int64 FullUnpSize;
};
// SubBlockHeader and its successors were used in RAR 2.x format.
// RAR 3.x uses FileHeader with NEWSUB_HEAD HeadType for subblocks.
struct SubBlockHeader:BlockHeader
{
ushort SubType;
byte Level;
};
struct ProtectHeader:BlockHeader
{
byte Version;
ushort RecSectors;
uint TotalBlocks;
byte Mark[8];
};
#endif