IsElfWii(): return false if open fails. Also query file size only once.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@324 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ef6fb30b3c
commit
19336445df
|
@ -7,10 +7,12 @@
|
|||
bool CBoot::IsElfWii(const char *filename)
|
||||
{
|
||||
Common::IMappedFile *mapfile = Common::IMappedFile::CreateMappedFile();
|
||||
mapfile->Open(filename);
|
||||
u8 *ptr = mapfile->Lock(0, mapfile->GetSize());
|
||||
u8 *mem = new u8[(size_t)mapfile->GetSize()];
|
||||
memcpy(mem, ptr, (size_t)mapfile->GetSize());
|
||||
bool ok = mapfile->Open(filename);
|
||||
if (!ok) return false;
|
||||
size_t filesize = mapfile->GetSize();
|
||||
u8 *ptr = mapfile->Lock(0, filesize);
|
||||
u8 *mem = new u8[filesize];
|
||||
memcpy(mem, ptr, filesize);
|
||||
mapfile->Unlock(ptr);
|
||||
mapfile->Close();
|
||||
|
||||
|
|
Loading…
Reference in New Issue