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
1ea41d26aa
commit
c2cc9e28a9
@ -26,7 +26,9 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "file.h"
|
||||
#include "general.h"
|
||||
|
||||
#define MDFN_FILETYPE_PLAIN 0
|
||||
|
||||
bool MDFNFILE::ApplyIPS(void *unused)
|
||||
{
|
||||
(void)unused;
|
||||
@ -35,21 +33,19 @@ bool MDFNFILE::ApplyIPS(void *unused)
|
||||
|
||||
// This function should ALWAYS close the system file "descriptor"(gzip library, zip library, or FILE *) it's given,
|
||||
// even if it errors out.
|
||||
bool MDFNFILE::MakeMemWrapAndClose(void *tz)
|
||||
bool MDFNFILE::MakeMemWrapAndClose(void *fp)
|
||||
{
|
||||
bool ret = FALSE;
|
||||
|
||||
location = 0;
|
||||
|
||||
::fseek((FILE *)tz, 0, SEEK_END);
|
||||
f_size = ::ftell((FILE *)tz);
|
||||
::fseek((FILE *)tz, 0, SEEK_SET);
|
||||
::fseek((FILE *)fp, 0, SEEK_END);
|
||||
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*)MDFN_malloc(f_size, _("file read buffer"))))
|
||||
goto doret;
|
||||
}
|
||||
if((int64)::fread(f_data, 1, f_size, (FILE *)tz) != f_size)
|
||||
if ((int64)::fread(f_data, 1, f_size, (FILE *)fp) != f_size)
|
||||
{
|
||||
ErrnoHolder ene(errno);
|
||||
MDFN_PrintError(_("Error reading file: %s"), ene.StrError());
|
||||
@ -60,10 +56,10 @@ bool MDFNFILE::MakeMemWrapAndClose(void *tz)
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
doret:
|
||||
fclose((FILE *)tz);
|
||||
doret:
|
||||
fclose((FILE *)fp);
|
||||
|
||||
return(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
MDFNFILE::MDFNFILE()
|
||||
@ -78,7 +74,7 @@ MDFNFILE::MDFNFILE()
|
||||
MDFNFILE::MDFNFILE(const char *path, const void *known_ext, const char *purpose)
|
||||
{
|
||||
(void)known_ext;
|
||||
if(!Open(path, known_ext, purpose, false))
|
||||
if (!Open(path, known_ext, purpose, false))
|
||||
throw(MDFN_Error(0, "TODO ERROR"));
|
||||
}
|
||||
|
||||
@ -94,20 +90,20 @@ bool MDFNFILE::Open(const char *path, const void *known_ext, const char *purpose
|
||||
FILE *fp;
|
||||
(void)known_ext;
|
||||
|
||||
if(!(fp = fopen(path, "rb")))
|
||||
if (!(fp = fopen(path, "rb")))
|
||||
{
|
||||
ErrnoHolder ene(errno);
|
||||
|
||||
if(ene.Errno() != ENOENT || !suppress_notfound_pe)
|
||||
if (ene.Errno() != ENOENT || !suppress_notfound_pe)
|
||||
MDFN_PrintError(_("Error opening \"%s\": %s"), path, ene.StrError());
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
::fseek(fp, 0, SEEK_SET);
|
||||
|
||||
if(!MakeMemWrapAndClose(fp))
|
||||
return(0);
|
||||
if (!MakeMemWrapAndClose(fp))
|
||||
return 0;
|
||||
|
||||
const char *ld = strrchr(path, '.');
|
||||
f_ext = strdup(ld ? ld + 1 : "");
|
||||
@ -119,13 +115,13 @@ bool MDFNFILE::Open(const char *path, const void *known_ext, const char *purpose
|
||||
|
||||
bool MDFNFILE::Close(void)
|
||||
{
|
||||
if(f_ext)
|
||||
if (f_ext)
|
||||
{
|
||||
free(f_ext);
|
||||
f_ext = NULL;
|
||||
}
|
||||
|
||||
if(f_data)
|
||||
if (f_data)
|
||||
{
|
||||
free(f_data);
|
||||
f_data = NULL;
|
||||
@ -138,10 +134,10 @@ uint64 MDFNFILE::fread(void *ptr, size_t element_size, size_t nmemb)
|
||||
{
|
||||
uint32 total = element_size * nmemb;
|
||||
|
||||
if(location >= f_size)
|
||||
if (location >= f_size)
|
||||
return 0;
|
||||
|
||||
if((location + total) > f_size)
|
||||
if ((location + total) > f_size)
|
||||
{
|
||||
int64 ak = f_size - location;
|
||||
|
||||
@ -165,52 +161,55 @@ int MDFNFILE::fseek(int64 offset, int whence)
|
||||
{
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:if(offset >= f_size)
|
||||
return(-1);
|
||||
case SEEK_SET:
|
||||
if (offset >= f_size)
|
||||
return -1;
|
||||
|
||||
location = offset;
|
||||
break;
|
||||
|
||||
case SEEK_CUR:if((offset + location) > f_size)
|
||||
return(-1);
|
||||
case SEEK_CUR:
|
||||
if ((offset + location) > f_size)
|
||||
return -1;
|
||||
|
||||
location += offset;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MDFNFILE::read16le(uint16 *val)
|
||||
{
|
||||
if((location + 2) > f_size)
|
||||
if ((location + 2) > f_size)
|
||||
return 0;
|
||||
|
||||
*val = MDFN_de16lsb(f_data + location);
|
||||
|
||||
location += 2;
|
||||
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MDFNFILE::read32le(uint32 *val)
|
||||
{
|
||||
if((location + 4) > f_size)
|
||||
if ((location + 4) > f_size)
|
||||
return 0;
|
||||
|
||||
*val = MDFN_de32lsb(f_data + location);
|
||||
|
||||
location += 4;
|
||||
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *MDFNFILE::fgets(char *s, int buffer_size)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
if(!buffer_size)
|
||||
if (!buffer_size)
|
||||
return(NULL);
|
||||
|
||||
if(location >= buffer_size)
|
||||
if (location >= buffer_size)
|
||||
return(NULL);
|
||||
|
||||
while(pos < (buffer_size - 1) && location < buffer_size)
|
||||
@ -219,48 +218,49 @@ char *MDFNFILE::fgets(char *s, int buffer_size)
|
||||
s[pos] = v;
|
||||
location++;
|
||||
pos++;
|
||||
if(v == '\n') break;
|
||||
if (v == '\n')
|
||||
break;
|
||||
}
|
||||
|
||||
if(buffer_size)
|
||||
if (buffer_size)
|
||||
s[pos] = 0;
|
||||
|
||||
return(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
static INLINE bool MDFN_DumpToFileReal(const char *filename, int compress, const std::vector<PtrLengthPair> &pearpairs)
|
||||
{
|
||||
FILE *fp = fopen(filename, "wb");
|
||||
|
||||
if(!fp)
|
||||
return(0);
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
for(unsigned int i = 0; i < pearpairs.size(); i++)
|
||||
{
|
||||
const void *data = pearpairs[i].GetData();
|
||||
const uint64 length = pearpairs[i].GetLength();
|
||||
|
||||
if(fwrite(data, 1, length, fp) != length)
|
||||
if (fwrite(data, 1, length, fp) != length)
|
||||
{
|
||||
fclose(fp);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(fclose(fp) == EOF)
|
||||
return(0);
|
||||
if (fclose(fp) == EOF)
|
||||
return 0;
|
||||
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool MDFN_DumpToFile(const char *filename, int compress, const std::vector<PtrLengthPair> &pearpairs)
|
||||
{
|
||||
return(MDFN_DumpToFileReal(filename, compress, pearpairs));
|
||||
return (MDFN_DumpToFileReal(filename, compress, pearpairs));
|
||||
}
|
||||
|
||||
bool MDFN_DumpToFile(const char *filename, int compress, const void *data, uint64 length)
|
||||
{
|
||||
std::vector<PtrLengthPair> tmp_pairs;
|
||||
tmp_pairs.push_back(PtrLengthPair(data, length));
|
||||
return(MDFN_DumpToFileReal(filename, compress, tmp_pairs));
|
||||
return (MDFN_DumpToFileReal(filename, compress, tmp_pairs));
|
||||
}
|
||||
|
@ -27,7 +27,9 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -29,48 +29,48 @@ bool MDFN_SaveSettings(const char *path)
|
||||
uint64 MDFN_GetSettingUI(const char *name)
|
||||
{
|
||||
/* VB */
|
||||
if(!strcmp("vb.anaglyph.lcolor", name))
|
||||
if (!strcmp("vb.anaglyph.lcolor", name))
|
||||
return 0xFF0000;
|
||||
if(!strcmp("vb.anaglyph.rcolor", name))
|
||||
if (!strcmp("vb.anaglyph.rcolor", name))
|
||||
return 0x000000;
|
||||
/* PCE FAST */
|
||||
if(!strcmp("pce_fast.cddavolume", name)) /* make configurable */
|
||||
if (!strcmp("pce_fast.cddavolume", name)) /* make configurable */
|
||||
return 100;
|
||||
if(!strcmp("pce_fast.adpcmvolume", name)) /* make configurable */
|
||||
if (!strcmp("pce_fast.adpcmvolume", name)) /* make configurable */
|
||||
return 100;
|
||||
if(!strcmp("pce_fast.cdpsgvolume", name)) /* make configurable */
|
||||
if (!strcmp("pce_fast.cdpsgvolume", name)) /* make configurable */
|
||||
return 100;
|
||||
if(!strcmp("pce_fast.cdspeed", name)) /* make configurable */
|
||||
if (!strcmp("pce_fast.cdspeed", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("pce_fast.ocmultiplier", name)) /* make configurable */
|
||||
if (!strcmp("pce_fast.ocmultiplier", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("pce_fast.slstart", name))
|
||||
if (!strcmp("pce_fast.slstart", name))
|
||||
return 4;
|
||||
if(!strcmp("pce_fast.slend", name))
|
||||
if (!strcmp("pce_fast.slend", name))
|
||||
return 235;
|
||||
/* WSWAN */
|
||||
if(!strcmp("wswan.ocmultiplier", name))
|
||||
if (!strcmp("wswan.ocmultiplier", name))
|
||||
return 1;
|
||||
if(!strcmp("wswan.bday", name))
|
||||
if (!strcmp("wswan.bday", name))
|
||||
return 23;
|
||||
if(!strcmp("wswan.bmonth", name))
|
||||
if (!strcmp("wswan.bmonth", name))
|
||||
return 6;
|
||||
if(!strcmp("wswan.byear", name))
|
||||
if (!strcmp("wswan.byear", name))
|
||||
return 1989;
|
||||
if(!strcmp("wswan.cdspeed", name))
|
||||
if (!strcmp("wswan.cdspeed", name))
|
||||
return 2;
|
||||
if(!strcmp("wswan.cdpsgvolume", name))
|
||||
if (!strcmp("wswan.cdpsgvolume", name))
|
||||
return 100;
|
||||
if(!strcmp("wswan.cddavolume", name))
|
||||
if (!strcmp("wswan.cddavolume", name))
|
||||
return 100;
|
||||
if(!strcmp("wswan.adpcmvolume", name))
|
||||
if (!strcmp("wswan.adpcmvolume", name))
|
||||
return 100;
|
||||
if(!strcmp("wswan.slstart", name))
|
||||
if (!strcmp("wswan.slstart", name))
|
||||
return 4;
|
||||
if(!strcmp("wswan.slend", name))
|
||||
if (!strcmp("wswan.slend", name))
|
||||
return 235;
|
||||
/* PSX */
|
||||
if(!strcmp("psx.spu.resamp_quality", name)) /* make configurable */
|
||||
if (!strcmp("psx.spu.resamp_quality", name)) /* make configurable */
|
||||
return 4;
|
||||
|
||||
fprintf(stderr, "unhandled setting UI: %s\n", name);
|
||||
@ -81,15 +81,15 @@ uint64 MDFN_GetSettingUI(const char *name)
|
||||
int64 MDFN_GetSettingI(const char *name)
|
||||
{
|
||||
/* VB */
|
||||
if(!strcmp("vb.anaglyph.preset", name))
|
||||
if (!strcmp("vb.anaglyph.preset", name))
|
||||
return 0;
|
||||
/* PSX */
|
||||
if(!strcmp("psx.region_default", name)) /* make configurable */
|
||||
if (!strcmp("psx.region_default", name)) /* make configurable */
|
||||
return 1; /* REGION_JP = 0, REGION_NA = 1, REGION_EU = 2 */
|
||||
/* WSWAN */
|
||||
if(!strcmp("wswan.sex", name))
|
||||
if (!strcmp("wswan.sex", name))
|
||||
return 0;
|
||||
if(!strcmp("wswan.blood", name))
|
||||
if (!strcmp("wswan.blood", name))
|
||||
return 0;
|
||||
fprintf(stderr, "unhandled setting I: %s\n", name);
|
||||
assert(0);
|
||||
@ -99,10 +99,10 @@ int64 MDFN_GetSettingI(const char *name)
|
||||
double MDFN_GetSettingF(const char *name)
|
||||
{
|
||||
/* PSX */
|
||||
if(!strcmp("psx.input.mouse_sensitivity", name)) /* make configurable */
|
||||
if (!strcmp("psx.input.mouse_sensitivity", name)) /* make configurable */
|
||||
return 1.00;
|
||||
/* WSWAN */
|
||||
if(!strcmp("wswan.mouse_sensitivity", name))
|
||||
if (!strcmp("wswan.mouse_sensitivity", name))
|
||||
return 0.50;
|
||||
|
||||
fprintf(stderr, "unhandled setting F: %s\n", name);
|
||||
@ -112,81 +112,81 @@ double MDFN_GetSettingF(const char *name)
|
||||
|
||||
bool MDFN_GetSettingB(const char *name)
|
||||
{
|
||||
if(!strcmp("cheats", name))
|
||||
if (!strcmp("cheats", name))
|
||||
return 0;
|
||||
/* LIBRETRO */
|
||||
if(!strcmp("libretro.cd_load_into_ram", name))
|
||||
if (!strcmp("libretro.cd_load_into_ram", name))
|
||||
return 0;
|
||||
/* VB */
|
||||
if(!strcmp("vb.instant_display_hack", name))
|
||||
if (!strcmp("vb.instant_display_hack", name))
|
||||
return 1;
|
||||
if(!strcmp("vb.allow_draw_skip", name))
|
||||
if (!strcmp("vb.allow_draw_skip", name))
|
||||
return 1;
|
||||
/* SNES */
|
||||
if(!strcmp("snes.correct_aspect", name))
|
||||
if (!strcmp("snes.correct_aspect", name))
|
||||
return 0;
|
||||
if(!strcmp("snes.input.port1.multitap", name))
|
||||
if (!strcmp("snes.input.port1.multitap", name))
|
||||
return 0;
|
||||
if(!strcmp("snes.input.port2.multitap", name))
|
||||
if (!strcmp("snes.input.port2.multitap", name))
|
||||
return 0;
|
||||
/* PCE_FAST */
|
||||
if(!strcmp("pce_fast.input.multitap", name))
|
||||
if (!strcmp("pce_fast.input.multitap", name))
|
||||
return 1;
|
||||
if(!strcmp("pce_fast.arcadecard", name))
|
||||
if (!strcmp("pce_fast.arcadecard", name))
|
||||
return 1;
|
||||
if(!strcmp("pce_fast.forcesgx", name))
|
||||
if (!strcmp("pce_fast.forcesgx", name))
|
||||
return 0;
|
||||
if(!strcmp("pce_fast.nospritelimit", name))
|
||||
if (!strcmp("pce_fast.nospritelimit", name))
|
||||
return 0;
|
||||
if(!strcmp("pce_fast.forcemono", name))
|
||||
if (!strcmp("pce_fast.forcemono", name))
|
||||
return 0;
|
||||
if(!strcmp("pce_fast.disable_softreset", name))
|
||||
if (!strcmp("pce_fast.disable_softreset", name))
|
||||
return 0;
|
||||
if(!strcmp("pce_fast.adpcmlp", name))
|
||||
if (!strcmp("pce_fast.adpcmlp", name))
|
||||
return 0;
|
||||
if(!strcmp("pce_fast.correct_aspect", name))
|
||||
if (!strcmp("pce_fast.correct_aspect", name))
|
||||
return 1;
|
||||
/* PSX */
|
||||
if(!strcmp("psx.input.port1.memcard", name))
|
||||
if (!strcmp("psx.input.port1.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port2.memcard", name))
|
||||
if (!strcmp("psx.input.port2.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port3.memcard", name))
|
||||
if (!strcmp("psx.input.port3.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port4.memcard", name))
|
||||
if (!strcmp("psx.input.port4.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port5.memcard", name))
|
||||
if (!strcmp("psx.input.port5.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port6.memcard", name))
|
||||
if (!strcmp("psx.input.port6.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port7.memcard", name))
|
||||
if (!strcmp("psx.input.port7.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port8.memcard", name))
|
||||
if (!strcmp("psx.input.port8.memcard", name))
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port1.multitap", name)) /* make configurable */
|
||||
if (!strcmp("psx.input.port1.multitap", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("psx.input.port2.multitap", name)) /* make configurable */
|
||||
if (!strcmp("psx.input.port2.multitap", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("psx.region_autodetect", name)) /* make configurable */
|
||||
if (!strcmp("psx.region_autodetect", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("psx.input.analog_mode_ct", name)) /* make configurable */
|
||||
if (!strcmp("psx.input.analog_mode_ct", name)) /* make configurable */
|
||||
return 1;
|
||||
if(!strcmp("psx.fastboot", name))
|
||||
if (!strcmp("psx.fastboot", name))
|
||||
return 1;
|
||||
/* WSWAN */
|
||||
if(!strcmp("wswan.forcemono", name))
|
||||
if (!strcmp("wswan.forcemono", name))
|
||||
return 0;
|
||||
if(!strcmp("wswan.language", name))
|
||||
if (!strcmp("wswan.language", name))
|
||||
return 1;
|
||||
if(!strcmp("wswan.correct_aspect", name))
|
||||
if (!strcmp("wswan.correct_aspect", name))
|
||||
return 1;
|
||||
/* CDROM */
|
||||
if(!strcmp("cdrom.lec_eval", name))
|
||||
if (!strcmp("cdrom.lec_eval", name))
|
||||
return 1;
|
||||
/* FILESYS */
|
||||
if(!strcmp("filesys.untrusted_fip_check", name))
|
||||
if (!strcmp("filesys.untrusted_fip_check", name))
|
||||
return 0;
|
||||
if(!strcmp("filesys.disablesavegz", name))
|
||||
if (!strcmp("filesys.disablesavegz", name))
|
||||
return 1;
|
||||
fprintf(stderr, "unhandled setting B: %s\n", name);
|
||||
assert(0);
|
||||
@ -205,75 +205,75 @@ std::string MDFN_GetSettingS(const char *name)
|
||||
slash = '/';
|
||||
#endif
|
||||
/* GBA */
|
||||
if(!strcmp("gba.bios", name))
|
||||
if (!strcmp("gba.bios", name))
|
||||
{
|
||||
fprintf(stderr, "gba.bios: %s\n", std::string("gba_bios.bin").c_str());
|
||||
return std::string(retro_base_directory) + slash + std::string("gba_bios.bin");
|
||||
}
|
||||
/* PCE_FAST */
|
||||
if(!strcmp("pce_fast.cdbios", name))
|
||||
if (!strcmp("pce_fast.cdbios", name))
|
||||
{
|
||||
fprintf(stderr, "pce_fast.cdbios: %s\n", std::string("syscard3.pce").c_str());
|
||||
return std::string(retro_base_directory) + slash + std::string("syscard3.pce");
|
||||
}
|
||||
/* PSX */
|
||||
if(!strcmp("psx.bios_eu", name))
|
||||
if (!strcmp("psx.bios_eu", name))
|
||||
{
|
||||
std::string ret = std::string(retro_base_directory) + slash + std::string("scph5502.bin");
|
||||
fprintf(stderr, "psx.bios_eu: %s\n", ret.c_str());
|
||||
return ret;
|
||||
}
|
||||
if(!strcmp("psx.bios_jp", name))
|
||||
if (!strcmp("psx.bios_jp", name))
|
||||
{
|
||||
std::string ret = std::string(retro_base_directory) + slash + std::string("scph5500.bin");
|
||||
fprintf(stderr, "psx.bios_jp: %s\n", ret.c_str());
|
||||
return ret;
|
||||
}
|
||||
if(!strcmp("psx.bios_na", name))
|
||||
if (!strcmp("psx.bios_na", name))
|
||||
{
|
||||
std::string ret = std::string(retro_base_directory) + slash + std::string("scph5501.bin");
|
||||
fprintf(stderr, "psx.bios_na: %s\n", ret.c_str());
|
||||
return ret;
|
||||
}
|
||||
if(!strcmp("psx.region_default", name)) /* make configurable */
|
||||
if (!strcmp("psx.region_default", name)) /* make configurable */
|
||||
return "na";
|
||||
/* WSWAN */
|
||||
if(!strcmp("wswan.name", name))
|
||||
if (!strcmp("wswan.name", name))
|
||||
{
|
||||
return std::string("Mednafen");
|
||||
}
|
||||
/* FILESYS */
|
||||
if(!strcmp("filesys.path_firmware", name))
|
||||
if (!strcmp("filesys.path_firmware", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.path_firmware: %s\n", retro_base_directory.c_str());
|
||||
return retro_base_directory;
|
||||
}
|
||||
if(!strcmp("filesys.path_palette", name))
|
||||
if (!strcmp("filesys.path_palette", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.path_palette: %s\n", retro_base_directory.c_str());
|
||||
return retro_base_directory;
|
||||
}
|
||||
if(!strcmp("filesys.path_sav", name))
|
||||
if (!strcmp("filesys.path_sav", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.path_sav: %s\n", retro_base_directory.c_str());
|
||||
return retro_base_directory;
|
||||
}
|
||||
if(!strcmp("filesys.path_state", name))
|
||||
if (!strcmp("filesys.path_state", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.path_state: %s\n", retro_base_directory.c_str());
|
||||
return retro_base_directory;
|
||||
}
|
||||
if(!strcmp("filesys.path_cheat", name))
|
||||
if (!strcmp("filesys.path_cheat", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.path_cheat: %s\n", retro_base_directory.c_str());
|
||||
return retro_base_directory;
|
||||
}
|
||||
if(!strcmp("filesys.fname_state", name))
|
||||
if (!strcmp("filesys.fname_state", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.fname_state: %s%s\n", retro_base_name.c_str(), std::string(".sav").c_str());
|
||||
return retro_base_name + std::string(".sav");
|
||||
}
|
||||
if(!strcmp("filesys.fname_sav", name))
|
||||
if (!strcmp("filesys.fname_sav", name))
|
||||
{
|
||||
fprintf(stderr, "filesys.fname_sav: %s%s\n", retro_base_name.c_str(), std::string(".bsv").c_str());
|
||||
return retro_base_name + std::string(".bsv");
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
int32 smem_read(StateMem *st, void *buffer, uint32 len)
|
||||
{
|
||||
if((len + st->loc) > st->len)
|
||||
return(0);
|
||||
if ((len + st->loc) > st->len)
|
||||
return 0;
|
||||
|
||||
memcpy(buffer, st->data + st->loc, len);
|
||||
st->loc += len;
|
||||
@ -40,7 +40,7 @@ int32 smem_read(StateMem *st, void *buffer, uint32 len)
|
||||
|
||||
int32 smem_write(StateMem *st, void *buffer, uint32 len)
|
||||
{
|
||||
if((len + st->loc) > st->malloced)
|
||||
if ((len + st->loc) > st->malloced)
|
||||
{
|
||||
uint32 newsize = (st->malloced >= 32768) ? st->malloced : (st->initial_malloc ? st->initial_malloc : 32768);
|
||||
|
||||
@ -52,7 +52,8 @@ int32 smem_write(StateMem *st, void *buffer, uint32 len)
|
||||
memcpy(st->data + st->loc, buffer, len);
|
||||
st->loc += len;
|
||||
|
||||
if(st->loc > st->len) st->len = st->loc;
|
||||
if (st->loc > st->len)
|
||||
st->len = st->loc;
|
||||
|
||||
return(len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user