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
0f1b8f979b
commit
f8ebe86550
15
libretro.cpp
15
libretro.cpp
@ -642,7 +642,7 @@ static void Cleanup(void)
|
||||
PCECD_Close();
|
||||
|
||||
if(HuCROM)
|
||||
MDFN_free(HuCROM);
|
||||
free(HuCROM);
|
||||
HuCROM = NULL;
|
||||
}
|
||||
|
||||
@ -673,7 +673,7 @@ int HuCLoad(const uint8 *data, uint32 len, uint32 crc32)
|
||||
MDFN_printf(_("ROM CRC32: 0x%04x\n"), crc32);
|
||||
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
|
||||
|
||||
if(!(HuCROM = (uint8 *)MDFN_malloc(m_len, _("HuCard ROM"))))
|
||||
if(!(HuCROM = (uint8 *)malloc(m_len)))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@ -1876,17 +1876,6 @@ static size_t serialize_size;
|
||||
|
||||
size_t retro_serialize_size(void)
|
||||
{
|
||||
MDFNGI *curgame = (MDFNGI*)game;
|
||||
//if (serialize_size)
|
||||
// return serialize_size;
|
||||
|
||||
if (!StateAction)
|
||||
{
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_WARN, "[mednafen]: Module %s doesn't support save states.\n", EmulatedPCE_Fast.shortname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
StateMem st;
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
|
@ -42,7 +42,7 @@ bool MDFNFILE::MakeMemWrapAndClose(void *fp)
|
||||
f_size = ::ftell((FILE *)fp);
|
||||
::fseek((FILE *)fp, 0, SEEK_SET);
|
||||
|
||||
if (!(f_data = (uint8*)MDFN_malloc(f_size, _("file read buffer"))))
|
||||
if (!(f_data = (uint8*)malloc(f_size)))
|
||||
goto fail;
|
||||
::fread(f_data, 1, f_size, (FILE *)fp);
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
#ifndef _MDFN_MEMORY_H
|
||||
#define _MDFN_MEMORY_H
|
||||
|
||||
// These functions can be used from driver code or from internal Mednafen code.
|
||||
//
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MDFN_malloc(size, purpose) malloc(size)
|
||||
#define MDFN_calloc(nmemb, size, purpose) calloc(nmemb, size)
|
||||
#define MDFN_realloc(ptr, size, purpose) realloc(ptr, size)
|
||||
|
||||
#define MDFN_malloc_real(size, purpose) malloc(size)
|
||||
#define MDFN_calloc_real(nmemb, size, purpose) calloc(nmemb, size)
|
||||
#define MDFN_realloc_real(ptr, size, purpose) realloc(ptr, size)
|
||||
#define MDFN_free(ptr) free(ptr)
|
||||
|
||||
static inline void MDFN_FastU32MemsetM8(uint32_t *array, uint32_t value_32, unsigned int u32len)
|
||||
{
|
||||
for(uint32_t *ai = array; ai < array + u32len; ai += 2)
|
||||
{
|
||||
ai[0] = value_32;
|
||||
ai[1] = value_32;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -62,6 +62,5 @@ void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y);
|
||||
#include "mednafen-driver.h"
|
||||
|
||||
#include "mednafen-endian.h"
|
||||
#include "mednafen-memory.h"
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "../mednafen.h"
|
||||
#include "../state.h"
|
||||
#include "../general.h"
|
||||
#include "../mednafen-memory.h"
|
||||
|
||||
#define PCE_MASTER_CLOCK 21477272.727273
|
||||
|
||||
|
@ -291,7 +291,7 @@ bool PCECD_Init(const PCECD_Settings *settings, void (*irqcb)(bool), double mast
|
||||
// Warning: magic number 126000 in PCECD_SetSettings() too
|
||||
PCECD_Drive_Init(3 * OC_Multiplier, sbuf[0], sbuf[1], 126000 * (settings ? settings->CD_Speed : 1), master_clock * OC_Multiplier, CDIRQ, StuffSubchannel);
|
||||
|
||||
if(!(ADPCM.RAM = (uint8 *)MDFN_malloc(0x10000, _("PCE ADPCM RAM"))))
|
||||
if(!(ADPCM.RAM = (uint8 *)malloc(0x10000)))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
@ -306,12 +306,10 @@ bool PCECD_Init(const PCECD_Settings *settings, void (*irqcb)(bool), double mast
|
||||
|
||||
void PCECD_Close(void)
|
||||
{
|
||||
if(ADPCM.RAM)
|
||||
{
|
||||
MDFN_free(ADPCM.RAM);
|
||||
ADPCM.RAM = NULL;
|
||||
}
|
||||
PCECD_Drive_Close();
|
||||
if(ADPCM.RAM)
|
||||
free(ADPCM.RAM);
|
||||
ADPCM.RAM = NULL;
|
||||
PCECD_Drive_Close();
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,6 +59,18 @@ vdc_t *vdc = NULL;
|
||||
|
||||
#define MAKECOLOR_PCE(val) ((((val & 0x038) >> 3) << 13)|(((((val & 0x038) >> 3) & 0x6) << 10) | (((val & 0x1c0) >> 6) << 8) | (((val & 0x1c0) >> 6) << 5) | ((val & 0x007) << 2) | ((val & 0x007) >> 1)))
|
||||
|
||||
|
||||
static INLINE void MDFN_FastU32MemsetM8(uint32_t *array, uint32_t value_32, unsigned int u32len)
|
||||
{
|
||||
uint32_t *ai;
|
||||
|
||||
for(ai = array; ai < array + u32len; ai += 2)
|
||||
{
|
||||
ai[0] = value_32;
|
||||
ai[1] = value_32;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void FixPCache(int entry)
|
||||
{
|
||||
if(!(entry & 0xFF))
|
||||
@ -1112,16 +1124,14 @@ void VDC_Init(int sgx)
|
||||
correct_aspect = MDFN_GetSettingB("pce_fast.correct_aspect");
|
||||
userle = ~0;
|
||||
|
||||
vdc = (vdc_t *)MDFN_malloc(sizeof(vdc_t), "VDC");
|
||||
vdc = (vdc_t *)malloc(sizeof(vdc_t));
|
||||
}
|
||||
|
||||
void VDC_Close(void)
|
||||
{
|
||||
{
|
||||
if(vdc)
|
||||
MDFN_free(vdc);
|
||||
vdc = NULL;
|
||||
}
|
||||
if(vdc)
|
||||
free(vdc);
|
||||
vdc = NULL;
|
||||
}
|
||||
|
||||
int VDC_StateAction(StateMem *sm, int load, int data_only)
|
||||
|
Loading…
Reference in New Issue
Block a user