parent
f79e24dba8
commit
41104fd315
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 thoduv
|
||||
Copyright (C) 2006-2007 Theo Berkau
|
||||
Copyright (C) 2008-2017 DeSmuME team
|
||||
Copyright (C) 2008-2018 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1653,35 +1653,25 @@ bool BackupDevice::import_dsv(const char *filename)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool BackupDevice::load_movie(EMUFILE &is)
|
||||
bool BackupDevice::load_movie(EMUFILE *is)
|
||||
{
|
||||
const s32 cookieLen = (s32)strlen(kDesmumeSaveCookie);
|
||||
delete fpMC;
|
||||
fpMC = is;
|
||||
|
||||
is.fseek(-cookieLen, SEEK_END);
|
||||
is.fseek(-4, SEEK_CUR);
|
||||
int ok = readFooter();
|
||||
// TODO - in case we ever change the format again (and we should probably entirely rewrite this if we do) we'd need to detect the old versions
|
||||
// (that is, returning -1 or -2 here or some other errors)
|
||||
|
||||
u32 version = is.read_u32LE();
|
||||
if (version != 0)
|
||||
{
|
||||
printf("Unknown save file format\n");
|
||||
return false;
|
||||
}
|
||||
is.fseek(-24, SEEK_CUR);
|
||||
is->fseek(0, SEEK_SET);
|
||||
|
||||
BackupDeviceFileInfo info;
|
||||
|
||||
is.read_32LE(info.size);
|
||||
is.read_32LE(info.padSize);
|
||||
is.read_32LE(info.type);
|
||||
is.read_32LE(info.addr_size);
|
||||
is.read_32LE(info.mem_size);
|
||||
|
||||
is.fseek(0, SEEK_SET);
|
||||
fpMC = &is;
|
||||
EMUFILE_MEMORY* scratchbuf = new EMUFILE_MEMORY(this->_info.padSize);
|
||||
is->fread(scratchbuf->buf(),_info.padSize);
|
||||
fpMC = scratchbuf;
|
||||
|
||||
//this is what load_movie has always done.
|
||||
//seems sloppy, the original intention was for this to basically be a savestate, so that all fields are saved, but someone wrecked that
|
||||
state = RUNNING;
|
||||
addr_size = info.addr_size;
|
||||
//none of the other fields are used right now
|
||||
addr_size = _info.addr_size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1692,6 +1682,8 @@ void BackupDevice::load_movie_blank()
|
|||
fpMC = new EMUFILE_MEMORY();
|
||||
|
||||
state = DETECTING;
|
||||
fsize = 0;
|
||||
addr_size = 0;
|
||||
}
|
||||
|
||||
void BackupDevice::forceManualBackupType()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 thoduv
|
||||
Copyright (C) 2006 Theo Berkau
|
||||
Copyright (C) 2008-2017 DeSmuME team
|
||||
Copyright (C) 2008-2018 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
bool export_raw(const char* filename);
|
||||
bool no_gba_unpack(u8 *&buf, u32 &size);
|
||||
|
||||
bool load_movie(EMUFILE &is);
|
||||
bool load_movie(EMUFILE *is);
|
||||
void load_movie_blank();
|
||||
|
||||
u32 importDataSize(const char *filename);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2008-2017 DeSmuME team
|
||||
Copyright 2008-2018 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -606,8 +606,8 @@ static void openRecordingMovie(const char* fname)
|
|||
|
||||
bool MovieData::loadSramFrom(std::vector<u8>* buf)
|
||||
{
|
||||
EMUFILE_MEMORY* ms = new EMUFILE_MEMORY(buf); // change to new to avoid automatic destruction
|
||||
MMU_new.backupDevice.load_movie(*ms);
|
||||
EMUFILE_MEMORY ms(buf);
|
||||
MMU_new.backupDevice.load_movie(&ms);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue