mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
fix snapshot loading
This commit is contained in:
parent
6978c615ce
commit
646255157f
@ -304,30 +304,28 @@ static void SzDisplayError(SZ_RESULT res)
|
|||||||
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
// function used by the 7zip SDK to read data from SD/USB/DVD/SMB
|
||||||
static SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
|
static SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
|
||||||
{
|
{
|
||||||
u32 seekok = 0;
|
size_t sizeread = 0;
|
||||||
u32 sizeread = 0;
|
|
||||||
|
if(maxRequiredSize == 0)
|
||||||
|
return SZ_OK;
|
||||||
|
|
||||||
// the void* object is a SzFileInStream
|
// the void* object is a SzFileInStream
|
||||||
SzFileInStream *s = (SzFileInStream *) object;
|
SzFileInStream *s = (SzFileInStream *) object;
|
||||||
|
|
||||||
// calculate offset
|
|
||||||
u64 offset = (u64) (s->offset + s->pos);
|
|
||||||
|
|
||||||
if (maxRequiredSize > 2048)
|
if (maxRequiredSize > 2048)
|
||||||
maxRequiredSize = 2048;
|
maxRequiredSize = 2048;
|
||||||
|
|
||||||
// read data
|
// read data
|
||||||
seekok = fseek(file, offset, SEEK_SET);
|
|
||||||
sizeread = fread(sz_buffer, 1, maxRequiredSize, file);
|
sizeread = fread(sz_buffer, 1, maxRequiredSize, file);
|
||||||
|
|
||||||
if(seekok != 0 || sizeread <= 0)
|
if(sizeread <= 0)
|
||||||
return SZE_FAILREAD;
|
return SZE_FAILREAD;
|
||||||
|
|
||||||
*buffer = sz_buffer;
|
*buffer = sz_buffer;
|
||||||
*processedSize = maxRequiredSize;
|
*processedSize = sizeread;
|
||||||
s->pos += *processedSize;
|
s->pos += sizeread;
|
||||||
|
|
||||||
if(maxRequiredSize > 1024) // only show progress for large reads
|
if(sizeread > 1024) // only show progress for large reads
|
||||||
// this isn't quite right, but oh well
|
// this isn't quite right, but oh well
|
||||||
ShowProgress ("Loading...", s->pos, browserList[browser.selIndex].length);
|
ShowProgress ("Loading...", s->pos, browserList[browser.selIndex].length);
|
||||||
|
|
||||||
@ -345,6 +343,9 @@ static SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
|||||||
return SZE_FAIL;
|
return SZE_FAIL;
|
||||||
|
|
||||||
// save new position and return
|
// save new position and return
|
||||||
|
if(fseek(file, (long)pos, SEEK_SET) != 0)
|
||||||
|
return SZE_FAIL;
|
||||||
|
|
||||||
s->pos = pos;
|
s->pos = pos;
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
}
|
}
|
||||||
|
@ -235,47 +235,39 @@ void S9xLoadSDD1Data()
|
|||||||
|
|
||||||
const char *S9xChooseFilename(bool8 read_only)
|
const char *S9xChooseFilename(bool8 read_only)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * S9xChooseMovieFilename(bool8 read_only)
|
const char * S9xChooseMovieFilename(bool8 read_only)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * S9xGetDirectory(enum s9x_getdirtype dirtype)
|
const char * S9xGetDirectory(enum s9x_getdirtype dirtype)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * S9xGetFilename(const char *ex, enum s9x_getdirtype dirtype)
|
const char * S9xGetFilename(const char *ex, enum s9x_getdirtype dirtype)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * S9xGetFilenameInc(const char *e, enum s9x_getdirtype dirtype)
|
const char * S9xGetFilenameInc(const char *e, enum s9x_getdirtype dirtype)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * S9xBasename(char *name)
|
char * S9xBasename(char *name)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _splitpath(char const *buf, char *drive, char *dir, char *fname, char *ext)
|
void _splitpath(char const *buf, char *drive, char *dir, char *fname, char *ext)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _makepath(char *filename, const char *drive, const char *dir,
|
void _makepath(char *filename, const char *drive, const char *dir,
|
||||||
const char *fname, const char *ext)
|
const char *fname, const char *ext)
|
||||||
{
|
{
|
||||||
ExitApp();
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user