set svn:eol-style=native for **.h

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing
2008-12-08 04:46:09 +00:00
parent e6fe5ec42f
commit 30c883bcfc
334 changed files with 30407 additions and 30407 deletions

View File

@ -1,57 +1,57 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_H_
#define _BANNER_LOADER_H_
#include "Filesystem.h"
namespace DiscIO
{
class IBannerLoader
{
public:
IBannerLoader()
{}
virtual ~IBannerLoader()
{}
virtual bool IsValid() = 0;
virtual bool GetBanner(u32* _pBannerImage) = 0;
virtual bool GetName(std::string& _rName, int language) = 0;
virtual bool GetCompany(std::string& _rCompany) = 0;
virtual bool GetDescription(std::string& _rDescription) = 0;
protected:
bool CopyToStringAndCheck(std::string& _rDestination, const char* _src);
};
IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem);
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_H_
#define _BANNER_LOADER_H_
#include "Filesystem.h"
namespace DiscIO
{
class IBannerLoader
{
public:
IBannerLoader()
{}
virtual ~IBannerLoader()
{}
virtual bool IsValid() = 0;
virtual bool GetBanner(u32* _pBannerImage) = 0;
virtual bool GetName(std::string& _rName, int language) = 0;
virtual bool GetCompany(std::string& _rCompany) = 0;
virtual bool GetDescription(std::string& _rDescription) = 0;
protected:
bool CopyToStringAndCheck(std::string& _rDestination, const char* _src);
};
IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem);
} // namespace
#endif

View File

@ -1,97 +1,97 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_GC_H_
#define _BANNER_LOADER_GC_H_
#include "BannerLoader.h"
namespace DiscIO
{
class CBannerLoaderGC
: public IBannerLoader
{
public:
CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem);
virtual ~CBannerLoaderGC();
virtual bool IsValid();
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription);
private:
enum
{
DVD_BANNER_WIDTH = 96,
DVD_BANNER_HEIGHT = 32
};
// Banner Comment
struct DVDBannerComment
{
char shortTitle[32]; // Short game title shown in IPL menu
char shortMaker[32]; // Short developer, publisher names shown in IPL menu
char longTitle[64]; // Long game title shown in IPL game start screen
char longMaker[64]; // Long developer, publisher names shown in IPL game start screen
char comment[128]; // Game description shown in IPL game start screen in two lines.
};
// "opening.bnr" file format for JP/US console
struct DVDBanner
{
u32 id; // 'BNR1'
u32 padding[7];
u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image
DVDBannerComment comment;
};
// "opening.bnr" file format for EU console
struct DVDBanner2
{
u32 id; // 'BNR2'
u32 padding[7];
u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image
DVDBannerComment comment[6]; // Comments in six languages
};
// for banner decoding
int lut3to8[8];
int lut4to8[16];
int lut5to8[32];
u8* m_pBannerFile;
bool m_IsValid;
u32 decode5A3(u16 val);
void decode5A3image(u32* dst, u16* src, int width, int height);
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_GC_H_
#define _BANNER_LOADER_GC_H_
#include "BannerLoader.h"
namespace DiscIO
{
class CBannerLoaderGC
: public IBannerLoader
{
public:
CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem);
virtual ~CBannerLoaderGC();
virtual bool IsValid();
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription);
private:
enum
{
DVD_BANNER_WIDTH = 96,
DVD_BANNER_HEIGHT = 32
};
// Banner Comment
struct DVDBannerComment
{
char shortTitle[32]; // Short game title shown in IPL menu
char shortMaker[32]; // Short developer, publisher names shown in IPL menu
char longTitle[64]; // Long game title shown in IPL game start screen
char longMaker[64]; // Long developer, publisher names shown in IPL game start screen
char comment[128]; // Game description shown in IPL game start screen in two lines.
};
// "opening.bnr" file format for JP/US console
struct DVDBanner
{
u32 id; // 'BNR1'
u32 padding[7];
u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image
DVDBannerComment comment;
};
// "opening.bnr" file format for EU console
struct DVDBanner2
{
u32 id; // 'BNR2'
u32 padding[7];
u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image
DVDBannerComment comment[6]; // Comments in six languages
};
// for banner decoding
int lut3to8[8];
int lut4to8[16];
int lut5to8[32];
u8* m_pBannerFile;
bool m_IsValid;
u32 decode5A3(u16 val);
void decode5A3image(u32* dst, u16* src, int width, int height);
};
} // namespace
#endif

View File

@ -1,82 +1,82 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_WII_H_
#define _BANNER_LOADER_WII_H_
#include "BannerLoader.h"
namespace DiscIO
{
class CBannerLoaderWii
: public IBannerLoader
{
public:
CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem);
virtual ~CBannerLoaderWii();
virtual bool IsValid();
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription);
private:
#define WII_BANNER_TEXTURE_SIZE (192 * 64 * 2)
#define WII_BANNER_ICON_SIZE ( 48 * 48 * 2)
#define WII_BANNER_COMMENT_SIZE 32
struct SWiiBanner
{
u32 ID;
u32 m_Flag;
u16 m_Speed;
u8 m_Unknown[22];
u16 m_Comment[2][WII_BANNER_COMMENT_SIZE];
u8 m_BannerTexture[WII_BANNER_TEXTURE_SIZE];
u8 m_IconTexture[8][WII_BANNER_ICON_SIZE];
} ;
// for banner decoding
int lut3to8[8];
int lut4to8[16];
int lut5to8[32];
u8* m_pBannerFile;
bool m_IsValid;
void InitLUTTable();
u32 decode5A3(u16 val);
void decode5A3image(u32* dst, u16* src, int width, int height);
std::string StupidWideCharToString(u16* _pSrc, size_t _max);
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BANNER_LOADER_WII_H_
#define _BANNER_LOADER_WII_H_
#include "BannerLoader.h"
namespace DiscIO
{
class CBannerLoaderWii
: public IBannerLoader
{
public:
CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem);
virtual ~CBannerLoaderWii();
virtual bool IsValid();
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
virtual bool GetDescription(std::string& _rDescription);
private:
#define WII_BANNER_TEXTURE_SIZE (192 * 64 * 2)
#define WII_BANNER_ICON_SIZE ( 48 * 48 * 2)
#define WII_BANNER_COMMENT_SIZE 32
struct SWiiBanner
{
u32 ID;
u32 m_Flag;
u16 m_Speed;
u8 m_Unknown[22];
u16 m_Comment[2][WII_BANNER_COMMENT_SIZE];
u8 m_BannerTexture[WII_BANNER_TEXTURE_SIZE];
u8 m_IconTexture[8][WII_BANNER_ICON_SIZE];
} ;
// for banner decoding
int lut3to8[8];
int lut4to8[16];
int lut5to8[32];
u8* m_pBannerFile;
bool m_IsValid;
void InitLUTTable();
u32 decode5A3(u16 val);
void decode5A3image(u32* dst, u16* src, int width, int height);
std::string StupidWideCharToString(u16* _pSrc, size_t _max);
};
} // namespace
#endif

View File

@ -1,82 +1,82 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BLOB_H
#define _BLOB_H
// BLOB
// Blobs in Dolphin are read only Binary Large OBjects. For example, a typical DVD image.
// Often, you may want to store these things in a highly compressed format, but still
// allow random access. Or you may store them on an odd device, like raw on a DVD.
// Always read your BLOBs using an interface returned by CreateBlobReader(). It will
// detect whether the file is a compressed blob, or just a big hunk of data, and
// automatically do the right thing.
#include "Common.h"
namespace DiscIO
{
class IBlobReader
{
public:
virtual ~IBlobReader() {}
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0;
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;
protected:
IBlobReader() {}
};
// Provides caching and split-operation-to-block-operations facilities.
// Used for compressed blob reading and direct drive reading.
class SectorReader : public IBlobReader
{
private:
virtual void GetBlock(u64 block_num, u8 *out) = 0;
enum { CACHE_SIZE = 32 };
int m_blocksize;
u8* cache[CACHE_SIZE];
u64 cache_tags[CACHE_SIZE];
int cache_age[CACHE_SIZE];
protected:
void SetSectorSize(int blocksize);
public:
~SectorReader();
const u8 *GetBlockData(u64 block_num);
bool Read(u64 offset, u64 size, u8* out_ptr);
};
// Factory function - examines the path to choose the right type of IBlobReader, and returns one.
IBlobReader* CreateBlobReader(const char* filename);
typedef void (*CompressCB)(const char* text, float percent, void* arg);
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type = 0, int sector_size = 16384,
CompressCB callback = 0, void* arg = 0);
bool DecompressBlobToFile(const char* infile, const char* outfile,
CompressCB callback = 0, void* arg = 0);
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BLOB_H
#define _BLOB_H
// BLOB
// Blobs in Dolphin are read only Binary Large OBjects. For example, a typical DVD image.
// Often, you may want to store these things in a highly compressed format, but still
// allow random access. Or you may store them on an odd device, like raw on a DVD.
// Always read your BLOBs using an interface returned by CreateBlobReader(). It will
// detect whether the file is a compressed blob, or just a big hunk of data, and
// automatically do the right thing.
#include "Common.h"
namespace DiscIO
{
class IBlobReader
{
public:
virtual ~IBlobReader() {}
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0;
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;
protected:
IBlobReader() {}
};
// Provides caching and split-operation-to-block-operations facilities.
// Used for compressed blob reading and direct drive reading.
class SectorReader : public IBlobReader
{
private:
virtual void GetBlock(u64 block_num, u8 *out) = 0;
enum { CACHE_SIZE = 32 };
int m_blocksize;
u8* cache[CACHE_SIZE];
u64 cache_tags[CACHE_SIZE];
int cache_age[CACHE_SIZE];
protected:
void SetSectorSize(int blocksize);
public:
~SectorReader();
const u8 *GetBlockData(u64 block_num);
bool Read(u64 offset, u64 size, u8* out_ptr);
};
// Factory function - examines the path to choose the right type of IBlobReader, and returns one.
IBlobReader* CreateBlobReader(const char* filename);
typedef void (*CompressCB)(const char* text, float percent, void* arg);
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type = 0, int sector_size = 16384,
CompressCB callback = 0, void* arg = 0);
bool DecompressBlobToFile(const char* infile, const char* outfile,
CompressCB callback = 0, void* arg = 0);
} // namespace
#endif

View File

@ -1,83 +1,83 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// WARNING Code not big-endian safe.
// To create new compressed BLOBs, use CompressFileToBlob.
// File format
// * Header
// * [Block Pointers interleaved with block hashes (hash of decompressed data)]
// * [Data]
#ifndef COMPRESSED_BLOB_H_
#define COMPRESSED_BLOB_H_
#include <stdio.h>
#include "Blob.h"
namespace DiscIO
{
bool IsCompressedBlob(const char* filename);
const u32 kBlobCookie = 0xB10BC001;
// A blob file structure:
// BlobHeader
// u64 offsetsToBlocks[n], top bit specifies whether the block is compressed, or not.
// compressed data
// Blocks that won't compress to less than 97% of the original size are stored as-is.
struct CompressedBlobHeader // 32 bytes
{
u32 magic_cookie; //0xB10BB10B
u32 sub_type; // gc image, whatever
u64 compressed_data_size;
u64 data_size;
u32 block_size;
u32 num_blocks;
};
class CompressedBlobReader : public SectorReader
{
private:
CompressedBlobHeader header;
u64 *block_pointers;
u32 *hashes;
int data_offset;
FILE *file;
u64 file_size;
u8 *zlib_buffer;
int zlib_buffer_size;
CompressedBlobReader(const char *filename);
public:
static CompressedBlobReader* Create(const char *filename);
~CompressedBlobReader();
const CompressedBlobHeader &GetHeader() const { return header; }
u64 GetDataSize() const { return header.data_size; }
u64 GetRawSize() const { return file_size; }
u64 GetBlockCompressedSize(u64 block_num) const;
void GetBlock(u64 block_num, u8 *out_ptr);
};
} // namespace
#endif // COMPRESSED_BLOB_H_
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// WARNING Code not big-endian safe.
// To create new compressed BLOBs, use CompressFileToBlob.
// File format
// * Header
// * [Block Pointers interleaved with block hashes (hash of decompressed data)]
// * [Data]
#ifndef COMPRESSED_BLOB_H_
#define COMPRESSED_BLOB_H_
#include <stdio.h>
#include "Blob.h"
namespace DiscIO
{
bool IsCompressedBlob(const char* filename);
const u32 kBlobCookie = 0xB10BC001;
// A blob file structure:
// BlobHeader
// u64 offsetsToBlocks[n], top bit specifies whether the block is compressed, or not.
// compressed data
// Blocks that won't compress to less than 97% of the original size are stored as-is.
struct CompressedBlobHeader // 32 bytes
{
u32 magic_cookie; //0xB10BB10B
u32 sub_type; // gc image, whatever
u64 compressed_data_size;
u64 data_size;
u32 block_size;
u32 num_blocks;
};
class CompressedBlobReader : public SectorReader
{
private:
CompressedBlobHeader header;
u64 *block_pointers;
u32 *hashes;
int data_offset;
FILE *file;
u64 file_size;
u8 *zlib_buffer;
int zlib_buffer_size;
CompressedBlobReader(const char *filename);
public:
static CompressedBlobReader* Create(const char *filename);
~CompressedBlobReader();
const CompressedBlobHeader &GetHeader() const { return header; }
u64 GetDataSize() const { return header.data_size; }
u64 GetRawSize() const { return file_size; }
u64 GetBlockCompressedSize(u64 block_num) const;
void GetBlock(u64 block_num, u8 *out_ptr);
};
} // namespace
#endif // COMPRESSED_BLOB_H_

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DRIVE_BLOB_H
#define _DRIVE_BLOB_H
#include "Blob.h"
#ifdef _WIN32
#include <windows.h>
#endif
namespace DiscIO
{
#ifdef _WIN32
class DriveReader : public SectorReader
{
HANDLE hDisc;
private:
DriveReader(const char *drive) {
/*
char path[MAX_PATH];
strncpy(path, drive, 3);
path[2] = 0;
sprintf(path, "\\\\.\\%s", drive);
hDisc = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
SetSectorSize(2048);
*/
}
public:
static DriveReader *Create(const char *drive) {
return NULL;// new DriveReader(drive);
}
};
#endif
} // namespace
#endif // _DRIVE_BLOB_H
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DRIVE_BLOB_H
#define _DRIVE_BLOB_H
#include "Blob.h"
#ifdef _WIN32
#include <windows.h>
#endif
namespace DiscIO
{
#ifdef _WIN32
class DriveReader : public SectorReader
{
HANDLE hDisc;
private:
DriveReader(const char *drive) {
/*
char path[MAX_PATH];
strncpy(path, drive, 3);
path[2] = 0;
sprintf(path, "\\\\.\\%s", drive);
hDisc = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
SetSectorSize(2048);
*/
}
public:
static DriveReader *Create(const char *drive) {
return NULL;// new DriveReader(drive);
}
};
#endif
} // namespace
#endif // _DRIVE_BLOB_H

View File

@ -1,53 +1,53 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILE_BLOB_H
#define _FILE_BLOB_H
#include "Blob.h"
#ifdef _WIN32
#include <windows.h>
#else
#include <cstdio>
#endif
namespace DiscIO
{
class PlainFileReader : public IBlobReader
{
#ifdef _WIN32
HANDLE hFile;
PlainFileReader(HANDLE hFile_);
#else
FILE* file_;
PlainFileReader(FILE* file__);
#endif
s64 size;
public:
static PlainFileReader* Create(const char* filename);
~PlainFileReader();
u64 GetDataSize() const { return size; }
u64 GetRawSize() const { return size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr);
};
} // namespace
#endif // _FILE_BLOB_H
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILE_BLOB_H
#define _FILE_BLOB_H
#include "Blob.h"
#ifdef _WIN32
#include <windows.h>
#else
#include <cstdio>
#endif
namespace DiscIO
{
class PlainFileReader : public IBlobReader
{
#ifdef _WIN32
HANDLE hFile;
PlainFileReader(HANDLE hFile_);
#else
FILE* file_;
PlainFileReader(FILE* file__);
#endif
s64 size;
public:
static PlainFileReader* Create(const char* filename);
~PlainFileReader();
u64 GetDataSize() const { return size; }
u64 GetRawSize() const { return size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr);
};
} // namespace
#endif // _FILE_BLOB_H

View File

@ -1,66 +1,66 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _ARC_FILE_H
#define _ARC_FILE_H
#include <string>
#include <vector>
#include "Common.h"
#include "Filesystem.h"
namespace DiscIO
{
class CARCFile
{
public:
CARCFile(const u8* _pBuffer, size_t _BufferSize);
virtual ~CARCFile();
bool IsInitialized();
size_t GetFileSize(const std::string& _rFullPath);
size_t ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize);
bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename);
bool ExportAllFiles(const std::string& _rFullPath);
private:
u8* m_pBuffer;
bool m_Initialized;
typedef std::vector<SFileInfo>CFileInfoVector;
CFileInfoVector m_FileInfoVector;
bool ParseBuffer();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable);
const SFileInfo* FindFileInfo(std::string _rFullPath) const;
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _ARC_FILE_H
#define _ARC_FILE_H
#include <string>
#include <vector>
#include "Common.h"
#include "Filesystem.h"
namespace DiscIO
{
class CARCFile
{
public:
CARCFile(const u8* _pBuffer, size_t _BufferSize);
virtual ~CARCFile();
bool IsInitialized();
size_t GetFileSize(const std::string& _rFullPath);
size_t ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize);
bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename);
bool ExportAllFiles(const std::string& _rFullPath);
private:
u8* m_pBuffer;
bool m_Initialized;
typedef std::vector<SFileInfo>CFileInfoVector;
CFileInfoVector m_FileInfoVector;
bool ParseBuffer();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable);
const SFileInfo* FindFileInfo(std::string _rFullPath) const;
};
} // namespace
#endif

View File

@ -1,57 +1,57 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILESYSTEM_GC_WII_H
#define _FILESYSTEM_GC_WII_H
#include <vector>
#include "Filesystem.h"
namespace DiscIO
{
class CFileSystemGCWii : public IFileSystem
{
public:
CFileSystemGCWii(const IVolume *_rVolume);
virtual ~CFileSystemGCWii();
virtual bool IsInitialized() const;
virtual u64 GetFileSize(const char* _rFullPath) const;
virtual const char* GetFileName(u64 _Address) const;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const;
virtual bool ExportAllFiles(const char* _rFullPath) const;
private:
std::vector <SFileInfo> m_FileInfoVector;
bool m_Initialized;
u32 m_OffsetShift; // WII offsets are all shifted
u32 Read32(u64 _Offset) const;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) const;
void GetStringFromOffset(u64 _Offset, char* Filename) const;
const SFileInfo* FindFileInfo(const char* _rFullPath) const;
bool InitFileSystem();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset);
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILESYSTEM_GC_WII_H
#define _FILESYSTEM_GC_WII_H
#include <vector>
#include "Filesystem.h"
namespace DiscIO
{
class CFileSystemGCWii : public IFileSystem
{
public:
CFileSystemGCWii(const IVolume *_rVolume);
virtual ~CFileSystemGCWii();
virtual bool IsInitialized() const;
virtual u64 GetFileSize(const char* _rFullPath) const;
virtual const char* GetFileName(u64 _Address) const;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const;
virtual bool ExportAllFiles(const char* _rFullPath) const;
private:
std::vector <SFileInfo> m_FileInfoVector;
bool m_Initialized;
u32 m_OffsetShift; // WII offsets are all shifted
u32 Read32(u64 _Offset) const;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) const;
void GetStringFromOffset(u64 _Offset, char* Filename) const;
const SFileInfo* FindFileInfo(const char* _rFullPath) const;
bool InitFileSystem();
size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset);
};
} // namespace
#endif

View File

@ -1,69 +1,69 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILESYSTEM_H
#define _FILESYSTEM_H
#include "Volume.h"
namespace DiscIO
{
// file info of an FST entry
struct SFileInfo
{
u64 m_NameOffset;
u64 m_Offset;
u64 m_FileSize;
char m_FullPath[512];
bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0 ? true : false; }
SFileInfo() : m_NameOffset(0), m_Offset(0), m_FileSize(0) {
memset(m_FullPath, 0, sizeof(m_FullPath));
}
SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset),
m_Offset(rhs.m_Offset), m_FileSize(rhs.m_FileSize) {
strcpy(m_FullPath, rhs.m_FullPath);
}
};
class IFileSystem
{
public:
IFileSystem(const IVolume *_rVolume);
virtual ~IFileSystem();
virtual bool IsInitialized() const = 0;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) const = 0;
virtual u64 GetFileSize(const char* _rFullPath) const = 0;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const = 0;
virtual bool ExportAllFiles(const char* _rFullPath) const = 0;
virtual const char* GetFileName(u64 _Address) const = 0;
virtual const IVolume *GetVolume() const { return m_rVolume; }
protected:
const IVolume *m_rVolume;
};
IFileSystem* CreateFileSystem(const IVolume *_rVolume);
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _FILESYSTEM_H
#define _FILESYSTEM_H
#include "Volume.h"
namespace DiscIO
{
// file info of an FST entry
struct SFileInfo
{
u64 m_NameOffset;
u64 m_Offset;
u64 m_FileSize;
char m_FullPath[512];
bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0 ? true : false; }
SFileInfo() : m_NameOffset(0), m_Offset(0), m_FileSize(0) {
memset(m_FullPath, 0, sizeof(m_FullPath));
}
SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset),
m_Offset(rhs.m_Offset), m_FileSize(rhs.m_FileSize) {
strcpy(m_FullPath, rhs.m_FullPath);
}
};
class IFileSystem
{
public:
IFileSystem(const IVolume *_rVolume);
virtual ~IFileSystem();
virtual bool IsInitialized() const = 0;
virtual size_t GetFileList(std::vector<const SFileInfo *> &_rFilenames) const = 0;
virtual u64 GetFileSize(const char* _rFullPath) const = 0;
virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0;
virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const = 0;
virtual bool ExportAllFiles(const char* _rFullPath) const = 0;
virtual const char* GetFileName(u64 _Address) const = 0;
virtual const IVolume *GetVolume() const { return m_rVolume; }
protected:
const IVolume *m_rVolume;
};
IFileSystem* CreateFileSystem(const IVolume *_rVolume);
} // namespace
#endif

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_H
#define _VOLUME_H
#include <string>
#include <vector>
#include "Common.h"
namespace DiscIO
{
class IVolume
{
public:
IVolume()
{}
virtual ~IVolume()
{}
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;
virtual u32 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0;
enum ECountry
{
COUNTRY_EUROPE = 0,
COUNTRY_FRANCE = 1,
COUNTRY_USA = 2,
COUNTRY_JAP,
COUNTRY_UNKNOWN,
NUMBER_OF_COUNTRIES
};
virtual ECountry GetCountry() const = 0;
virtual u64 GetSize() const = 0;
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_H
#define _VOLUME_H
#include <string>
#include <vector>
#include "Common.h"
namespace DiscIO
{
class IVolume
{
public:
IVolume()
{}
virtual ~IVolume()
{}
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;
virtual u32 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0;
enum ECountry
{
COUNTRY_EUROPE = 0,
COUNTRY_FRANCE = 1,
COUNTRY_USA = 2,
COUNTRY_JAP,
COUNTRY_UNKNOWN,
NUMBER_OF_COUNTRIES
};
virtual ECountry GetCountry() const = 0;
virtual u64 GetSize() const = 0;
};
} // namespace
#endif

View File

@ -1,31 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_CREATOR_H
#define _VOLUME_CREATOR_H
#include "Volume.h"
namespace DiscIO
{
IVolume* CreateVolumeFromFilename(const std::string& _rFilename);
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii);
bool IsVolumeWiiDisc(const IVolume *_rVolume);
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_CREATOR_H
#define _VOLUME_CREATOR_H
#include "Volume.h"
namespace DiscIO
{
IVolume* CreateVolumeFromFilename(const std::string& _rFilename);
IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii);
bool IsVolumeWiiDisc(const IVolume *_rVolume);
} // namespace
#endif

View File

@ -1,106 +1,106 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Volume.h"
#include "Common.h"
#include "FileUtil.h"
#include <string>
#include <map>
//
// --- this volume type is used for reading files directly from the hard drive ---
//
namespace DiscIO
{
class CVolumeDirectory
: public IVolume
{
public:
CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii);
~CVolumeDirectory();
static bool IsValidDirectory(const std::string& _rDirectory);
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
std::string GetMakerID() const;
std::string GetName() const;
void SetName(std::string);
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
void BuildFST();
private:
static std::string ExtractDirectoryName(const std::string& _rDirectory);
void SetDiskTypeWii();
void SetDiskTypeGC();
// writing to read buffer
void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src,
u64& _Address, u64& _Length, u8*& _pBuffer) const;
void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const;
void Write32(u32 data, u32 offset, u8* buffer);
// FST creation
void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length);
void WriteEntryName(u32& nameOffset, const std::string& name);
void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum);
// returns number of entries found in _Directory
u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry);
std::string m_rootDirectory;
std::map<u64, std::string> m_virtualDisk;
u32 m_totalNameSize;
// gc has no shift, wii has 2 bit shift
u32 m_addressShift;
// first address on disk containing file data
u64 m_dataStartAddress;
u64 m_fstNameOffset;
u64 m_fstSize;
u8* m_FSTData;
u8* m_diskHeader;
};
} // namespace
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Volume.h"
#include "Common.h"
#include "FileUtil.h"
#include <string>
#include <map>
//
// --- this volume type is used for reading files directly from the hard drive ---
//
namespace DiscIO
{
class CVolumeDirectory
: public IVolume
{
public:
CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii);
~CVolumeDirectory();
static bool IsValidDirectory(const std::string& _rDirectory);
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
std::string GetMakerID() const;
std::string GetName() const;
void SetName(std::string);
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
void BuildFST();
private:
static std::string ExtractDirectoryName(const std::string& _rDirectory);
void SetDiskTypeWii();
void SetDiskTypeGC();
// writing to read buffer
void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src,
u64& _Address, u64& _Length, u8*& _pBuffer) const;
void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const;
void Write32(u32 data, u32 offset, u8* buffer);
// FST creation
void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length);
void WriteEntryName(u32& nameOffset, const std::string& name);
void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum);
// returns number of entries found in _Directory
u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry);
std::string m_rootDirectory;
std::map<u64, std::string> m_virtualDisk;
u32 m_totalNameSize;
// gc has no shift, wii has 2 bit shift
u32 m_addressShift;
// first address on disk containing file data
u64 m_dataStartAddress;
u64 m_fstNameOffset;
u64 m_fstSize;
u8* m_FSTData;
u8* m_diskHeader;
};
} // namespace

View File

@ -1,45 +1,45 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Volume.h"
#include "Blob.h"
// --- this volume type is used for GC disc images ---
namespace DiscIO
{
class CVolumeGC : public IVolume
{
public:
CVolumeGC(IBlobReader* _pReader);
~CVolumeGC();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
private:
IBlobReader* m_pReader;
};
} // namespace
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Volume.h"
#include "Blob.h"
// --- this volume type is used for GC disc images ---
namespace DiscIO
{
class CVolumeGC : public IVolume
{
public:
CVolumeGC(IBlobReader* _pReader);
~CVolumeGC();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
private:
IBlobReader* m_pReader;
};
} // namespace

View File

@ -1,58 +1,58 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_WII_CRYPTED
#define _VOLUME_WII_CRYPTED
#include "Volume.h"
#include "Blob.h"
#include "AES/aes.h"
// --- this volume type is used for encrypted Wii images ---
namespace DiscIO
{
class CVolumeWiiCrypted : public IVolume
{
public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
~CVolumeWiiCrypted();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
private:
IBlobReader* m_pReader;
u8* m_pBuffer;
AES_KEY m_AES_KEY;
u64 m_VolumeOffset;
mutable u64 m_LastDecryptedBlockOffset;
mutable unsigned char m_LastDecryptedBlock[0x8000];
};
} // namespace
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VOLUME_WII_CRYPTED
#define _VOLUME_WII_CRYPTED
#include "Volume.h"
#include "Blob.h"
#include "AES/aes.h"
// --- this volume type is used for encrypted Wii images ---
namespace DiscIO
{
class CVolumeWiiCrypted : public IVolume
{
public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
~CVolumeWiiCrypted();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
private:
IBlobReader* m_pReader;
u8* m_pBuffer;
AES_KEY m_AES_KEY;
u64 m_VolumeOffset;
mutable u64 m_LastDecryptedBlockOffset;
mutable unsigned char m_LastDecryptedBlock[0x8000];
};
} // namespace
#endif

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _SCL_SECURE_NO_DEPRECATE
// TODO: reference additional headers your program requires here
// Copyright (C) 2003-2008 Dolphin Project.
// 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, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _SCL_SECURE_NO_DEPRECATE
// TODO: reference additional headers your program requires here