Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
beetle-pce-libretro
Commits
0e147b79
Commit
0e147b79
authored
Sep 18, 2021
by
Libretro-Admin
Browse files
Cleanups
parent
b79462dc
Pipeline
#55031
failed with stages
in 19 minutes and 2 seconds
Changes
2
Pipelines
10
Hide whitespace changes
Inline
Side-by-side
mednafen/state.cpp
View file @
0e147b79
...
...
@@ -27,7 +27,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
;
...
...
@@ -38,7 +38,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
)
{
...
...
@@ -58,15 +58,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
)
{
...
...
@@ -84,7 +76,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
;
...
...
@@ -94,7 +86,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
];
...
...
@@ -255,40 +247,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
)
{
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
;
...
...
mednafen/state.h
View file @
0e147b79
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment