mirror of
https://github.com/libretro/beetle-pcfx-libretro.git
synced 2024-11-26 18:00:54 +00:00
* Get rid of errno mostly everywhere
* Get rid of MDFN_Error * Some other header cleanups
This commit is contained in:
parent
aec84cf355
commit
e848a08ffe
1
Makefile
1
Makefile
@ -53,7 +53,6 @@ ifneq ($(platform), osx)
|
||||
PTHREAD_FLAGS = -pthread
|
||||
endif
|
||||
NEED_TREMOR = 1
|
||||
WANT_NEW_API = 1
|
||||
NEED_STEREO_SOUND = 1
|
||||
NEED_CD = 1
|
||||
NEED_SCSI_CD = 1
|
||||
|
@ -67,10 +67,6 @@ ifeq ($(NEED_BPP), 32)
|
||||
FLAGS += -DWANT_32BPP
|
||||
endif
|
||||
|
||||
ifeq ($(WANT_NEW_API), 1)
|
||||
FLAGS += -DWANT_NEW_API
|
||||
endif
|
||||
|
||||
ifeq ($(NO_COMPUTED_GOTO), 1)
|
||||
FLAGS += -DNO_COMPUTED_GOTO
|
||||
endif
|
||||
@ -153,7 +149,6 @@ endif
|
||||
|
||||
ifneq ($(HAVE_GRIFFIN), 1)
|
||||
SOURCES_CXX += \
|
||||
$(MEDNAFEN_DIR)/error.cpp \
|
||||
$(MEDNAFEN_DIR)/general.cpp \
|
||||
$(MEDNAFEN_DIR)/FileStream.cpp \
|
||||
$(MEDNAFEN_DIR)/MemoryStream.cpp \
|
||||
|
@ -6,7 +6,6 @@ DEBUG := 0
|
||||
FRONTEND_SUPPORTS_RGB565 := 1
|
||||
CACHE_CD := 0
|
||||
NEED_BPP := 32
|
||||
WANT_NEW_API := 1
|
||||
NEED_STEREO_SOUND := 1
|
||||
HAVE_THREADS := 1
|
||||
NEED_CD := 1
|
||||
|
12
libretro.cpp
12
libretro.cpp
@ -1,5 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
@ -11,7 +10,6 @@
|
||||
#include <retro_timers.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#include "mednafen/error.h"
|
||||
#include "mednafen/mednafen.h"
|
||||
#include "mednafen/mempatcher.h"
|
||||
#include "mednafen/git.h"
|
||||
@ -1187,17 +1185,11 @@ static void ReadM3U(std::vector<std::string> &file_list, std::string path, unsig
|
||||
|
||||
if (efp.size() >= 4 && efp.substr(efp.size() - 4) == ".m3u")
|
||||
{
|
||||
if (efp == path)
|
||||
{
|
||||
MDFN_Error(0, "M3U at \"%s\" references self.", efp.c_str());
|
||||
if (efp == path) /* M3U references self */
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (depth == 99)
|
||||
{
|
||||
MDFN_Error(0, "M3U load recursion too deep!");
|
||||
if (depth == 99) /* M3U load recursion too deep */
|
||||
goto end;
|
||||
}
|
||||
|
||||
ReadM3U(file_list, efp, depth++);
|
||||
}
|
||||
|
@ -87,39 +87,37 @@ static mpc_bool_t impc_canseek(mpc_reader *p_reader)
|
||||
|
||||
CDAFReader_MPC::CDAFReader_MPC(Stream *fp) : fw(fp)
|
||||
{
|
||||
demux = NULL;
|
||||
demux = NULL;
|
||||
memset(&si, 0, sizeof(si));
|
||||
memset(MPCBuffer, 0, sizeof(MPCBuffer));
|
||||
MPCBufferOffs = 0;
|
||||
MPCBufferIn = 0;
|
||||
MPCBufferOffs = 0;
|
||||
MPCBufferIn = 0;
|
||||
|
||||
memset(&reader, 0, sizeof(reader));
|
||||
reader.read = impc_read;
|
||||
reader.seek = impc_seek;
|
||||
reader.tell = impc_tell;
|
||||
reader.read = impc_read;
|
||||
reader.seek = impc_seek;
|
||||
reader.tell = impc_tell;
|
||||
reader.get_size = impc_get_size;
|
||||
reader.canseek = impc_canseek;
|
||||
reader.data = (void*)fp;
|
||||
reader.canseek = impc_canseek;
|
||||
reader.data = (void*)fp;
|
||||
|
||||
if(!(demux = mpc_demux_init(&reader)))
|
||||
{
|
||||
throw(0);
|
||||
}
|
||||
throw 0;
|
||||
|
||||
mpc_demux_get_info(demux, &si);
|
||||
|
||||
if(si.channels != 2)
|
||||
{
|
||||
mpc_demux_exit(demux);
|
||||
demux = NULL;
|
||||
throw MDFN_Error(0, _("MusePack stream has wrong number of channels(%u); the correct number is 2."), si.channels);
|
||||
}
|
||||
goto error;
|
||||
|
||||
if(si.sample_freq != 44100)
|
||||
{
|
||||
mpc_demux_exit(demux);
|
||||
demux = NULL;
|
||||
throw MDFN_Error(0, _("MusePack stream has wrong samplerate(%u Hz); the correct samplerate is 44100 Hz."), si.sample_freq);
|
||||
}
|
||||
goto error;
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
mpc_demux_exit(demux);
|
||||
demux = NULL;
|
||||
throw 0;
|
||||
}
|
||||
|
||||
CDAFReader_MPC::~CDAFReader_MPC()
|
||||
|
@ -19,9 +19,8 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include <mednafen/general.h>
|
||||
#include <mednafen/error.h>
|
||||
#include "../mednafen.h"
|
||||
#include "../general.h"
|
||||
|
||||
#include "CDAccess_CCD.h"
|
||||
|
||||
@ -51,14 +50,11 @@ static T CCD_ReadInt(CCD_Section &s, const std::string &propname, const bool hav
|
||||
{
|
||||
if(have_defval)
|
||||
return defval;
|
||||
else
|
||||
throw MDFN_Error(0, "Missing property: %s", propname.c_str());
|
||||
}
|
||||
|
||||
const std::string &v = zit->second;
|
||||
int scan_base = 10;
|
||||
size_t scan_offset = 0;
|
||||
long ret = 0;
|
||||
int scan_base = 10;
|
||||
size_t scan_offset = 0;
|
||||
|
||||
if(v.length() >= 3 && v[0] == '0' && v[1] == 'x')
|
||||
{
|
||||
@ -70,16 +66,9 @@ static T CCD_ReadInt(CCD_Section &s, const std::string &propname, const bool hav
|
||||
char *ep = NULL;
|
||||
|
||||
if(std::numeric_limits<T>::is_signed)
|
||||
ret = strtol(vp, &ep, scan_base);
|
||||
else
|
||||
ret = strtoul(vp, &ep, scan_base);
|
||||
return strtol(vp, &ep, scan_base);
|
||||
|
||||
if(!vp[0] || ep[0])
|
||||
{
|
||||
throw MDFN_Error(0, "Property %s: Malformed integer: %s", propname.c_str(), v.c_str());
|
||||
}
|
||||
|
||||
return ret;
|
||||
return strtoul(vp, &ep, scan_base);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,14 +33,12 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include <retro_stat.h>
|
||||
|
||||
#include "../error.h"
|
||||
#include "../general.h"
|
||||
#include "../mednafen-endian.h"
|
||||
#include "../FileStream.h"
|
||||
@ -1181,20 +1179,13 @@ int32_t CDAccess_Image::MakeSubPQ(int32_t lba, uint8_t *SubPWBuf) const
|
||||
uint32_t ma, sa, fa;
|
||||
uint32_t m, s, f;
|
||||
uint8_t pause_or = 0x00;
|
||||
bool track_found = false;
|
||||
|
||||
for(track = FirstTrack; track < (FirstTrack + NumTracks); track++)
|
||||
{
|
||||
if(lba >= (Tracks[track].LBA - Tracks[track].pregap_dv - Tracks[track].pregap) && lba < (Tracks[track].LBA + Tracks[track].sectors + Tracks[track].postgap))
|
||||
{
|
||||
track_found = true;
|
||||
if(lba >= (Tracks[track].LBA - Tracks[track].pregap_dv - Tracks[track].pregap) && lba < (Tracks[track].LBA + Tracks[track].sectors + Tracks[track].postgap)) /* Track found? */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!track_found)
|
||||
throw(MDFN_Error(0, "Could not find track for sector %u!", lba));
|
||||
|
||||
if(lba < Tracks[track].LBA)
|
||||
lba_relative = Tracks[track].LBA - 1 - lba;
|
||||
else
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <sys/types.h>
|
||||
#include "cdromif.h"
|
||||
#include "CDAccess.h"
|
||||
#include "../error.h"
|
||||
#include "../general.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -199,7 +198,7 @@ CDIF_Queue::~CDIF_Queue()
|
||||
}
|
||||
|
||||
/* Returns false if message not read, true if it was read. Will always return true if "blocking" is set.
|
||||
* Will throw MDFN_Error if the read message code is CDIF_MSG_FATAL_ERROR */
|
||||
* Will return false if the read message code is CDIF_MSG_FATAL_ERROR */
|
||||
bool CDIF_Queue::Read(CDIF_Message *message, bool blocking)
|
||||
{
|
||||
bool ret = false;
|
||||
@ -529,11 +528,6 @@ CDIF_ST::CDIF_ST(CDAccess *cda) : disc_cdaccess(cda)
|
||||
UnrecoverableError = false;
|
||||
|
||||
disc_cdaccess->Read_TOC(&disc_toc);
|
||||
|
||||
if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track)
|
||||
{
|
||||
throw(MDFN_Error(0, "TOC first(%d)/last(%d) track numbers bad.", disc_toc.first_track, disc_toc.last_track));
|
||||
}
|
||||
}
|
||||
|
||||
CDIF_ST::~CDIF_ST()
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -1,52 +0,0 @@
|
||||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <libretro.h>
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "error.h"
|
||||
|
||||
extern retro_log_printf_t log_cb;
|
||||
|
||||
MDFN_Error::MDFN_Error()
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
MDFN_Error::MDFN_Error(int errno_code_new, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsnprintf(error_message, 4096, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (log_cb)
|
||||
log_cb(RETRO_LOG_ERROR, "%s\n", error_message);
|
||||
}
|
||||
|
||||
MDFN_Error::~MDFN_Error()
|
||||
{
|
||||
if(error_message)
|
||||
{
|
||||
free(error_message);
|
||||
error_message = NULL;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#ifndef __MDFN_ERROR_H
|
||||
#define __MDFN_ERROR_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class MDFN_Error
|
||||
{
|
||||
public:
|
||||
|
||||
MDFN_Error();
|
||||
|
||||
MDFN_Error(int errno_code_new, const char *format, ...);
|
||||
|
||||
~MDFN_Error();
|
||||
|
||||
private:
|
||||
char *error_message;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -41,11 +41,10 @@ found freely through public domain sources.
|
||||
//////////////////////////////////////////////////////////
|
||||
// CPU routines
|
||||
|
||||
#include "mednafen/mednafen.h"
|
||||
#include <mednafen/masmem.h>
|
||||
#include "../../mednafen.h"
|
||||
#include "../../masmem.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "v810_opt.h"
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
#include "mednafen.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <vector>
|
||||
|
||||
#include "general.h"
|
||||
@ -55,19 +55,14 @@ typedef struct __CHEATF
|
||||
} CHEATF;
|
||||
|
||||
static std::vector<CHEATF> cheats;
|
||||
static int savecheats;
|
||||
static uint32 resultsbytelen = 1;
|
||||
static bool resultsbigendian = 0;
|
||||
static bool CheatsActive = TRUE;
|
||||
|
||||
bool SubCheatsOn = 0;
|
||||
std::vector<SUBCHEAT> SubCheats[8];
|
||||
|
||||
static void RebuildSubCheats(void)
|
||||
{
|
||||
std::vector<CHEATF>::iterator chit;
|
||||
|
||||
SubCheatsOn = 0;
|
||||
for(int x = 0; x < 8; x++)
|
||||
SubCheats[x].clear();
|
||||
|
||||
@ -94,7 +89,6 @@ static void RebuildSubCheats(void)
|
||||
else
|
||||
tmpsub.compare = -1;
|
||||
SubCheats[(chit->addr + x) & 0x7].push_back(tmpsub);
|
||||
SubCheatsOn = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -212,8 +206,6 @@ int MDFNI_AddCheat(const char *name, uint32 addr, uint64 val, uint64 compare, ch
|
||||
return(0);
|
||||
}
|
||||
|
||||
savecheats = 1;
|
||||
|
||||
MDFNMP_RemoveReadPatches();
|
||||
RebuildSubCheats();
|
||||
MDFNMP_InstallReadPatches();
|
||||
@ -226,8 +218,6 @@ int MDFNI_DelCheat(uint32 which)
|
||||
free(cheats[which].name);
|
||||
cheats.erase(cheats.begin() + which);
|
||||
|
||||
savecheats=1;
|
||||
|
||||
MDFNMP_RemoveReadPatches();
|
||||
RebuildSubCheats();
|
||||
MDFNMP_InstallReadPatches();
|
||||
@ -589,7 +579,6 @@ int MDFNI_SetCheat(uint32 which, const char *name, uint32 a, uint64 v, uint64 co
|
||||
next->bigendian = bigendian;
|
||||
|
||||
RebuildSubCheats();
|
||||
savecheats=1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -598,7 +587,6 @@ int MDFNI_SetCheat(uint32 which, const char *name, uint32 a, uint64 v, uint64 co
|
||||
int MDFNI_ToggleCheat(uint32 which)
|
||||
{
|
||||
cheats[which].status = !cheats[which].status;
|
||||
savecheats = 1;
|
||||
RebuildSubCheats();
|
||||
|
||||
return(cheats[which].status);
|
||||
|
@ -10,8 +10,6 @@ typedef struct __SUBCHEAT
|
||||
int compare; // < 0 on no compare
|
||||
} SUBCHEAT;
|
||||
|
||||
extern bool SubCheatsOn;
|
||||
|
||||
bool MDFNMP_Init(uint32 ps, uint32 numpages);
|
||||
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
|
||||
void MDFNMP_Kill(void);
|
||||
|
@ -15,7 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
Loading…
Reference in New Issue
Block a user