Commit b29cbb60 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Cleanups

parent 832142e9
Pipeline #56392 passed with stages
in 10 minutes and 9 seconds
......@@ -30,7 +30,7 @@
#define RLSB MDFNSTATE_RLSB //0x80000000
int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
static int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
{
if ((len + st->loc) > st->len)
return 0;
......@@ -41,7 +41,7 @@ int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
return(len);
}
int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
static int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
{
if ((len + st->loc) > st->malloced)
{
......@@ -61,15 +61,7 @@ int32_t smem_write(StateMem *st, void *buffer, uint32_t len)
return(len);
}
int32_t smem_putc(StateMem *st, int value)
{
uint8_t tmpval = value;
if(smem_write(st, &tmpval, 1) != 1)
return(-1);
return(1);
}
int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
static int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
{
switch(whence)
{
......@@ -87,7 +79,7 @@ int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
return(0);
}
int smem_write32le(StateMem *st, uint32_t b)
static int smem_write32le(StateMem *st, uint32_t b)
{
uint8_t s[4];
s[0]=b;
......@@ -97,7 +89,7 @@ int smem_write32le(StateMem *st, uint32_t b)
return((smem_write(st, s, 4)<4)?0:4);
}
int smem_read32le(StateMem *st, uint32_t *b)
static int smem_read32le(StateMem *st, uint32_t *b)
{
uint8_t s[4];
......@@ -246,38 +238,6 @@ static SFORMAT *FindSF(const char *name, SFORMAT *sf)
return NULL;
}
// Fast raw chunk reader
static void DOReadChunk(StateMem *st, SFORMAT *sf)
{
while(sf->size || sf->name) // Size can sometimes be zero, so also check for the text name.
// These two should both be zero only at the end of a struct.
{
if(!sf->size || !sf->v)
{
sf++;
continue;
}
if(sf->size == (uint32_t) ~0) // Link to another SFORMAT struct
{
DOReadChunk(st, (SFORMAT *)sf->v);
sf++;
continue;
}
int32_t bytesize = sf->size;
// Loading raw data, bool types are stored as they appear in memory, not as single bytes in the full state format.
// In the SFORMAT structure, the size member for bool entries is the number of bool elements, not the total in-memory size,
// so we adjust it here.
if(sf->flags & MDFNSTATE_BOOL)
bytesize *= sizeof(bool);
smem_read(st, (uint8_t *)sf->v, bytesize);
sf++;
}
}
static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
{
int temp = st->loc;
......
......@@ -12,15 +12,6 @@ typedef struct
uint32_t initial_malloc; // A setting!
} StateMem;
// Eh, we abuse the smem_* in-memory stream code
// in a few other places. :)
int32_t smem_read(StateMem *st, void *buffer, uint32_t len);
int32_t smem_write(StateMem *st, void *buffer, uint32_t len);
int32_t smem_putc(StateMem *st, int value);
int32_t smem_seek(StateMem *st, uint32_t offset, int whence);
int smem_write32le(StateMem *st, uint32_t b);
int smem_read32le(StateMem *st, uint32_t *b);
int MDFNSS_SaveSM(void *st, int, int, const void*, const void*, const void*);
int MDFNSS_LoadSM(void *st, int, int);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment