Attempt to fix issue r3458. I don't have a 32bit linux install, however I know it will at least fix compressing. Please test if uncompressed games run.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6510 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2010-12-03 12:42:01 +00:00
parent 08a3b60f8c
commit 3d441febda
12 changed files with 42 additions and 42 deletions

View File

@ -21,20 +21,19 @@
#include "Boot_ELF.h"
#include "Boot_WiiWAD.h"
#include "ElfReader.h"
#include "FileUtil.h"
bool CBoot::IsElfWii(const char *filename)
{
/* We already check if filename existed before we called this function, so
there is no need for another check, just read the file right away */
FILE *f = fopen(filename, "rb");
fseek(f, 0, SEEK_END);
u64 filesize = ftell(f);
fseek(f, 0, SEEK_SET);
u64 filesize = File::GetSize(f);
u8 *mem = new u8[(size_t)filesize];
fread(mem, 1, (size_t)filesize, f);
fclose(f);
ElfReader reader(mem);
ElfReader reader(mem);
// TODO: Find a more reliable way to distinguish.
bool isWii = reader.GetEntryPoint() >= 0x80004000;
delete[] mem;
@ -46,9 +45,7 @@ bool CBoot::IsElfWii(const char *filename)
bool CBoot::Boot_ELF(const char *filename)
{
FILE *f = fopen(filename, "rb");
fseek(f, 0, SEEK_END);
u64 filesize = ftell(f);
fseek(f, 0, SEEK_SET);
u64 filesize = File::GetSize(f);
u8 *mem = new u8[(size_t)filesize];
fread(mem, 1, (size_t)filesize, f);
fclose(f);

View File

@ -18,6 +18,7 @@
#include "Common.h"
#include "Dump.h"
#include "FileUtil.h"
CDump::CDump(const char* _szFilename) :
m_pData(NULL),
@ -26,9 +27,7 @@ CDump::CDump(const char* _szFilename) :
FILE* pStream = fopen(_szFilename, "rb");
if (pStream != NULL)
{
fseek(pStream, 0, SEEK_END);
m_size = (size_t) ftell(pStream);
fseek(pStream, 0, SEEK_SET);
m_size = (size_t)File::GetSize(pStream);
m_pData = new u8[m_size];

View File

@ -100,11 +100,6 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
iPosition = _iLength;
break;
// WII Something - this could be bogus
case 0xCE:
WARN_LOG(SERIALINTERFACE, "Unknown Wii SI Command");
break;
// DEFAULT
default:
{

View File

@ -353,9 +353,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
}
else
{
fseek(f, 0, SEEK_END);
sz = (int)(ftell(f) - sizeof(state_header));
fseek(f, sizeof(state_header), SEEK_SET);
sz = (int)(File::GetSize(f) - sizeof(state_header));
buffer = new u8[sz];
int x;
if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz)
@ -455,9 +453,7 @@ void VerifyStateCallback(u64 userdata, int cyclesLate)
}
else
{
fseek(f, 0, SEEK_END);
sz = (int)(ftell(f) - sizeof(int));
fseek(f, sizeof(int), SEEK_SET);
sz = (int)(File::GetSize(f) - sizeof(int));
buffer = new u8[sz];
int x;
if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz)