mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-23 07:50:03 +00:00
Cleanups
This commit is contained in:
parent
e2f040e024
commit
53567cbc8d
@ -200,47 +200,3 @@ void Endian_V_NE_to_LE(void *src, uint32_t bytesize)
|
||||
FlipByteOrder((uint8_t *)src, bytesize);
|
||||
#endif
|
||||
}
|
||||
|
||||
int write16le(uint16_t b, FILE *fp)
|
||||
{
|
||||
uint8_t s[2];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
return((fwrite(s,1,2,fp)<2)?0:2);
|
||||
}
|
||||
|
||||
int write32le(uint32_t b, FILE *fp)
|
||||
{
|
||||
uint8_t s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
return((fwrite(s,1,4,fp)<4)?0:4);
|
||||
}
|
||||
|
||||
int read32le(uint32_t *Bufo, FILE *fp)
|
||||
{
|
||||
uint32_t buf;
|
||||
if(fread(&buf,1,4,fp)<4)
|
||||
return 0;
|
||||
#ifdef MSB_FIRST
|
||||
*(uint32_t*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#else
|
||||
*(uint32_t*)Bufo=buf;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read16le(char *d, FILE *fp)
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
int ret;
|
||||
ret=fread(d+1,1,1,fp);
|
||||
ret+=fread(d,1,1,fp);
|
||||
return ret<2?0:2;
|
||||
#else
|
||||
return((fread(d,1,2,fp)<2)?0:2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,12 @@
|
||||
#ifndef __MDFN_ENDIAN_H
|
||||
#define __MDFN_ENDIAN_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int write16le(uint16_t b, FILE *fp);
|
||||
int write32le(uint32_t b, FILE *fp);
|
||||
int read32le(uint32_t *Bufo, FILE *fp);
|
||||
|
||||
void Endian_A16_Swap(void *src, uint32_t nelements);
|
||||
void Endian_A32_Swap(void *src, uint32_t nelements);
|
||||
void Endian_A64_Swap(void *src, uint32_t nelements);
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define _MEDNAFEN_H
|
||||
|
||||
#include "mednafen-types.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define __MDFN_MEMPATCHER_H
|
||||
|
||||
#include "mempatcher-driver.h"
|
||||
#include <vector>
|
||||
|
||||
typedef struct __SUBCHEAT
|
||||
{
|
||||
@ -11,7 +10,6 @@ typedef struct __SUBCHEAT
|
||||
int compare; // < 0 on no compare
|
||||
} SUBCHEAT;
|
||||
|
||||
extern std::vector<SUBCHEAT> SubCheats[8];
|
||||
extern bool SubCheatsOn;
|
||||
|
||||
bool MDFNMP_Init(uint32 ps, uint32 numpages);
|
||||
|
@ -32,6 +32,30 @@
|
||||
/* Forward declaration */
|
||||
int StateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
static int write32le(uint32_t b, FILE *fp)
|
||||
{
|
||||
uint8_t s[4];
|
||||
s[0]=b;
|
||||
s[1]=b>>8;
|
||||
s[2]=b>>16;
|
||||
s[3]=b>>24;
|
||||
return((fwrite(s,1,4,fp)<4)?0:4);
|
||||
}
|
||||
|
||||
static int read32le(uint32_t *Bufo, FILE *fp)
|
||||
{
|
||||
uint32_t buf;
|
||||
if(fread(&buf,1,4,fp)<4)
|
||||
return 0;
|
||||
#ifdef MSB_FIRST
|
||||
*(uint32_t*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#else
|
||||
*(uint32_t*)Bufo=buf;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int32_t smem_read(StateMem *st, void *buffer, uint32_t len)
|
||||
{
|
||||
if ((len + st->loc) > st->len)
|
||||
|
Loading…
Reference in New Issue
Block a user