Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clean up some space/tab mismatches in DiscIO and InputCommon.
Keeps the files consistent.
  • Loading branch information
lioncash committed Mar 19, 2013
1 parent 019b525 commit 0e3d8e2
Show file tree
Hide file tree
Showing 9 changed files with 379 additions and 379 deletions.
24 changes: 12 additions & 12 deletions Source/Core/DiscIO/Src/FileHandlerARC.cpp
Expand Up @@ -27,19 +27,19 @@
namespace DiscIO
{
CARCFile::CARCFile(const std::string& _rFilename)
: m_pBuffer(NULL)
, m_Initialized(false)
: m_pBuffer(NULL)
, m_Initialized(false)
{
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rFilename.c_str());
if (pReader != NULL)
{
u64 FileSize = pReader->GetDataSize();
m_pBuffer = new u8[(u32)FileSize];
pReader->Read(0, FileSize, m_pBuffer);
delete pReader;

m_Initialized = ParseBuffer();
}
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rFilename.c_str());
if (pReader != NULL)
{
u64 FileSize = pReader->GetDataSize();
m_pBuffer = new u8[(u32)FileSize];
pReader->Read(0, FileSize, m_pBuffer);
delete pReader;

m_Initialized = ParseBuffer();
}
}

CARCFile::CARCFile(const std::string& _rFilename, u32 offset)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DiscIO/Src/NANDContentLoader.cpp
Expand Up @@ -273,7 +273,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName)
continue;
}

rContent.m_pData = NULL;
rContent.m_pData = NULL;
char szFilename[1024];

if (rContent.m_Type & 0x8000) // shared app
Expand Down
64 changes: 32 additions & 32 deletions Source/Core/DiscIO/Src/NANDContentLoader.h
Expand Up @@ -32,49 +32,49 @@ namespace DiscIO
bool Add_Ticket(u64 TitleID, const u8 *p_tik, u32 tikSize);
struct SNANDContent
{
u32 m_ContentID;
u16 m_Index;
u16 m_Type;
u32 m_Size;
u8 m_SHA1Hash[20];
u8 m_Header[36]; //all of the above

u8* m_pData;
u32 m_ContentID;
u16 m_Index;
u16 m_Type;
u32 m_Size;
u8 m_SHA1Hash[20];
u8 m_Header[36]; //all of the above

u8* m_pData;
};

// pure virtual interface so just the NANDContentManager can create these files only
class INANDContentLoader
{
public:

INANDContentLoader() {}
INANDContentLoader() {}

virtual ~INANDContentLoader() {}
virtual ~INANDContentLoader() {}

virtual bool IsValid() const = 0;
virtual bool IsValid() const = 0;
virtual void RemoveTitle() const = 0;
virtual u64 GetTitleID() const = 0;
virtual u16 GetIosVersion() const = 0;
virtual u32 GetBootIndex() const = 0;
virtual size_t GetContentSize() const = 0;
virtual const SNANDContent* GetContentByIndex(int _Index) const = 0;
virtual u64 GetTitleID() const = 0;
virtual u16 GetIosVersion() const = 0;
virtual u32 GetBootIndex() const = 0;
virtual size_t GetContentSize() const = 0;
virtual const SNANDContent* GetContentByIndex(int _Index) const = 0;
virtual const u8* GetTMDView() const = 0;
virtual const u8* GetTMDHeader() const = 0;
virtual u32 GetTIKSize() const = 0;
virtual const u8* GetTIK() const = 0;
virtual const std::vector<SNANDContent>& GetContent() const = 0;
virtual u16 GetTitleVersion() const = 0;
virtual u16 GetNumEntries() const = 0;
virtual DiscIO::IVolume::ECountry GetCountry() const = 0;
virtual const std::vector<SNANDContent>& GetContent() const = 0;
virtual u16 GetTitleVersion() const = 0;
virtual u16 GetNumEntries() const = 0;
virtual DiscIO::IVolume::ECountry GetCountry() const = 0;
virtual u8 GetCountryChar() const = 0;

enum
{
TMD_VIEW_SIZE = 0x58,
TMD_HEADER_SIZE = 0x1e4,
enum
{
TMD_VIEW_SIZE = 0x58,
TMD_HEADER_SIZE = 0x1e4,
CONTENT_HEADER_SIZE = 0x24,
TICKET_SIZE = 0x2A4
};
};
};


Expand All @@ -83,22 +83,22 @@ class CNANDContentManager
{
public:

static CNANDContentManager& Access() { return m_Instance; }
static CNANDContentManager& Access() { return m_Instance; }
u64 Install_WiiWAD(std::string &fileName);

const INANDContentLoader& GetNANDLoader(const std::string& _rName, bool forceReload = false);
const INANDContentLoader& GetNANDLoader(const std::string& _rName, bool forceReload = false);
const INANDContentLoader& GetNANDLoader(u64 _titleId, bool forceReload = false);
bool RemoveTitle(u64 _titleID);
private:

CNANDContentManager() {};
CNANDContentManager() {};

~CNANDContentManager();
~CNANDContentManager();

static CNANDContentManager m_Instance;
static CNANDContentManager m_Instance;

typedef std::map<std::string, INANDContentLoader*> CNANDContentMap;
CNANDContentMap m_Map;
typedef std::map<std::string, INANDContentLoader*> CNANDContentMap;
CNANDContentMap m_Map;

};

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DiscIO/Src/VolumeDirectory.h
Expand Up @@ -59,7 +59,7 @@ class CVolumeDirectory : public IVolume

ECountry GetCountry() const;

u64 GetSize() const;
u64 GetSize() const;

void BuildFST();

Expand Down
28 changes: 14 additions & 14 deletions Source/Core/DiscIO/Src/WbfsBlob.cpp
Expand Up @@ -75,47 +75,47 @@ bool WbfsFileReader::OpenFiles(const char* filename)
delete new_entry;
return 0 != m_total_files;
}

new_entry->base_address = m_size;
new_entry->size = new_entry->file.GetSize();
m_size += new_entry->size;

m_total_files ++;
m_files.push_back(new_entry);
m_files.push_back(new_entry);
}
}

bool WbfsFileReader::ReadHeader()
{
m_files[0]->file.Seek(4, SEEK_SET);

// Read hd size info
m_files[0]->file.ReadBytes(&hd_sector_count, 4);
hd_sector_count = Common::swap32(hd_sector_count);

m_files[0]->file.ReadBytes(&hd_sector_shift, 1);
hd_sector_size = 1 << hd_sector_shift;

if(m_size != hd_sector_count * hd_sector_size)
{
//printf("File size doesn't match expected size\n");
return false;
}

// Read wbfs cluster info
m_files[0]->file.ReadBytes(&wbfs_sector_shift, 1);
wbfs_sector_size = 1 << wbfs_sector_shift;
wbfs_sector_count = m_size / wbfs_sector_size;

if(wbfs_sector_size < wii_sector_size)
{
//Setting this too low would case a very large memory allocation
return false;
}

m_blocks_per_disc = (wii_sector_count * wii_sector_size) / wbfs_sector_size;
m_disc_info_size = align(wii_disc_header_size + m_blocks_per_disc * 2, hd_sector_size);

// Read disc table
m_files[0]->file.Seek(2, SEEK_CUR);
m_files[0]->file.ReadBytes(disc_table, 500);
Expand All @@ -125,7 +125,7 @@ bool WbfsFileReader::ReadHeader()
//printf("Game must be in 'slot 0'\n");
return false;
}

return true;
}

Expand All @@ -143,7 +143,7 @@ bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
nbytes -= read_size;
offset += read_size;
}

return true;
}

Expand Down Expand Up @@ -172,16 +172,16 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
}
}
}

PanicAlert("Read beyond end of disc");
m_files[0]->file.Seek(0, SEEK_SET);
return m_files[0]->file;
}

WbfsFileReader* WbfsFileReader::Create(const char* filename)
{
{
WbfsFileReader* reader = new WbfsFileReader(filename);

if(reader->IsGood())
{
return reader;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DiscIO/Src/WbfsBlob.h
Expand Up @@ -63,7 +63,7 @@ class WbfsFileReader : public IBlobReader

u16* m_wlba_table;
u64 m_blocks_per_disc;

bool m_good;

public:
Expand Down

0 comments on commit 0e3d8e2

Please sign in to comment.