Commit 6c932990 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Cleanups

parent 1ee96854
Pipeline #54204 passed with stage
in 37 minutes and 21 seconds
......@@ -52,7 +52,7 @@ static INLINE uint32_t MDFN_de32lsb_(const uint8_t *morp)
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
}
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;
......@@ -63,7 +63,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)
{
......@@ -83,15 +83,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)
{
......@@ -115,7 +107,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;
......@@ -125,7 +117,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];
......@@ -286,44 +278,6 @@ static SFORMAT *FindSF(const char *name, SFORMAT *sf)
return NULL;
}
/* Fast raw chunk reader */
static void DOReadChunk(StateMem *st, SFORMAT *sf)
{
/* 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. */
while(sf->size || sf->name)
{
int32_t bytesize;
if(!sf->size || !sf->v)
{
sf++;
continue;
}
/* Link to another SFORMAT struct */
if(sf->size == (uint32_t) ~0)
{
DOReadChunk(st, (SFORMAT *)sf->v);
sf++;
continue;
}
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;
......
......@@ -48,15 +48,6 @@ struct SSDescriptor
extern "C" {
#endif
/* 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 a, int b, const void *c, const void *d, const void *e);
int MDFNSS_LoadSM(void *st, int a, int b);
......
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