mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-22 23:39:50 +00:00
Cleanups
This commit is contained in:
parent
98d3f33481
commit
5d97808f18
@ -17,14 +17,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "Stream.h"
|
||||
#include "FileStream.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Stream.h"
|
||||
#include "FileStream.h"
|
||||
|
||||
FileStream::FileStream(const char *path, const int mode)
|
||||
{
|
||||
fp = filestream_open(path, (mode == MODE_WRITE) ? RETRO_VFS_FILE_ACCESS_WRITE : RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
@ -7,6 +7,24 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||
// Rounds up to the nearest power of 2.
|
||||
static INLINE uint32 round_up_pow2(uint32 v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v++;
|
||||
|
||||
v += (v == 0);
|
||||
|
||||
return(v);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Write and Seek expansion that fail should not corrupt the state.
|
||||
|
@ -17,7 +17,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "Stream.h"
|
||||
|
||||
Stream::Stream()
|
||||
|
@ -5,12 +5,13 @@
|
||||
|
||||
// TODO?: BufferedStream, no virtual functions, yes inline functions, constructor takes a Stream* argument.
|
||||
|
||||
#include "mednafen.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <stdio.h> // For SEEK_* defines, which we will use in Stream out of FORCE OF HABIT.
|
||||
#include <string>
|
||||
|
||||
#include "mednafen-types.h"
|
||||
|
||||
#define MODE_READ 0
|
||||
#define MODE_WRITE 1
|
||||
#define MODE_WRITE_SAFE 2
|
||||
|
@ -25,7 +25,6 @@
|
||||
// Don't allow exceptions to propagate into the vorbis/musepack/etc. libraries, as it could easily leave the state of the library's decoder "object" in an
|
||||
// inconsistent state, which would cause all sorts of unfun when we try to destroy it while handling the exception farther up.
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include "CDAFReader.h"
|
||||
#include "CDAFReader_Vorbis.h"
|
||||
#ifdef HAVE_MPC
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __MDFN_CDAFREADER_H
|
||||
#define __MDFN_CDAFREADER_H
|
||||
|
||||
#include <mednafen/Stream.h>
|
||||
#include "../Stream.h"
|
||||
|
||||
class CDAFReader
|
||||
{
|
||||
|
@ -19,11 +19,10 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include "CDAFReader.h"
|
||||
#include "CDAFReader_MPC.h"
|
||||
|
||||
#include <mednafen/mpcdec/mpcdec.h>
|
||||
#include "../mpcdec/mpcdec.h"
|
||||
|
||||
class CDAFReader_MPC : public CDAFReader
|
||||
{
|
||||
|
@ -18,12 +18,12 @@
|
||||
** along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include "CDAFReader.h"
|
||||
#include "CDAFReader_Vorbis.h"
|
||||
|
||||
#include <mednafen/tremor/ivorbisfile.h>
|
||||
#include "../tremor/ivorbisfile.h"
|
||||
|
||||
class CDAFReader_Vorbis : public CDAFReader
|
||||
{
|
||||
|
@ -15,7 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "CDAccess.h"
|
||||
#include "CDAccess_Image.h"
|
||||
#include "CDAccess_CCD.h"
|
||||
|
@ -19,8 +19,9 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include <mednafen/general.h>
|
||||
#include "../mednafen-types.h"
|
||||
#include "../git.h"
|
||||
#include "../general.h"
|
||||
|
||||
#include "CDAccess_CCD.h"
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <mednafen/FileStream.h>
|
||||
#include <mednafen/MemoryStream.h>
|
||||
#include "../FileStream.h"
|
||||
#include "../MemoryStream.h"
|
||||
|
||||
#include "CDAccess.h"
|
||||
|
||||
|
@ -19,8 +19,9 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "../mednafen-types.h"
|
||||
#include "../mednafen-endian.h"
|
||||
#include "../git.h"
|
||||
#include "../general.h"
|
||||
|
||||
#include "CDAccess_CHD.h"
|
||||
|
@ -19,8 +19,8 @@
|
||||
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <mednafen/FileStream.h>
|
||||
#include <mednafen/MemoryStream.h>
|
||||
#include "../FileStream.h"
|
||||
#include "../MemoryStream.h"
|
||||
|
||||
#include "CDAccess.h"
|
||||
#include "chd.h"
|
||||
|
@ -28,8 +28,6 @@
|
||||
it will be added onto the implicit default 00:02:00 of pregap.
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string.h>
|
||||
@ -37,7 +35,9 @@
|
||||
#include <time.h>
|
||||
#include <memory>
|
||||
|
||||
#include "../mednafen-types.h"
|
||||
#include "../general.h"
|
||||
#include "../git.h"
|
||||
#include "../mednafen-endian.h"
|
||||
#include "../FileStream.h"
|
||||
#include "../MemoryStream.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "CDUtility.h"
|
||||
#include "dvdisaster.h"
|
||||
#include "lec.h"
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef __MDFN_CDROM_CDUTILITY_H
|
||||
#define __MDFN_CDROM_CDUTILITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
// Call once at app startup before creating any threads that could potentially cause re-entrancy to these functions.
|
||||
// It will also be called automatically if needed for the first time a function in this namespace that requires
|
||||
// the initialization function to be called is called, for potential
|
||||
|
@ -15,15 +15,17 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include "cdromif.h"
|
||||
#include "CDAccess.h"
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "cdromif.h"
|
||||
#include "CDAccess.h"
|
||||
#include "../mednafen.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool valid;
|
||||
|
@ -18,11 +18,11 @@
|
||||
#ifndef __MDFN_CDROM_CDROMIF_H
|
||||
#define __MDFN_CDROM_CDROMIF_H
|
||||
|
||||
#include "CDUtility.h"
|
||||
#include <mednafen/Stream.h>
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "CDUtility.h"
|
||||
#include "../Stream.h"
|
||||
|
||||
class CDIF
|
||||
{
|
||||
public:
|
||||
|
@ -15,7 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <mednafen/mednafen.h>
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include "scsicd.h"
|
||||
|
@ -15,8 +15,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mednafen.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -35,20 +33,16 @@ void MDFN_GetFilePathComponents(const std::string &file_path,
|
||||
std::string *dir_path_out, std::string *file_base_out,
|
||||
std::string *file_ext_out)
|
||||
{
|
||||
size_t final_ds; // in file_path
|
||||
string file_name;
|
||||
size_t fn_final_dot; // in local var file_name
|
||||
string dir_path, file_base, file_ext; // Temporary output
|
||||
|
||||
#ifdef _WIN32
|
||||
final_ds = file_path.find_last_of('\\');
|
||||
|
||||
size_t final_ds = file_path.find_last_of('\\');
|
||||
size_t alt_final_ds = file_path.find_last_of('/');
|
||||
|
||||
if(final_ds == string::npos || (alt_final_ds != string::npos && alt_final_ds > final_ds))
|
||||
final_ds = alt_final_ds;
|
||||
#else
|
||||
final_ds = file_path.find_last_of('/');
|
||||
size_t final_ds = file_path.find_last_of('/');
|
||||
#endif
|
||||
|
||||
if(final_ds == string::npos)
|
||||
@ -102,20 +96,16 @@ std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_pat
|
||||
void MDFN_ltrim(std::string &string)
|
||||
{
|
||||
size_t len = string.length();
|
||||
size_t di, si;
|
||||
bool InWhitespace = TRUE;
|
||||
|
||||
di = si = 0;
|
||||
size_t si;
|
||||
bool InWhitespace = true;
|
||||
size_t di = si = 0;
|
||||
|
||||
while(si < len)
|
||||
{
|
||||
if(InWhitespace && (string[si] == ' ' || string[si] == '\r' || string[si] == '\n' || string[si] == '\t' || string[si] == 0x0b))
|
||||
{
|
||||
|
||||
}
|
||||
if(InWhitespace && (string[si] == ' ' || string[si] == '\r' || string[si] == '\n' || string[si] == '\t' || string[si] == 0x0b)) { }
|
||||
else
|
||||
{
|
||||
InWhitespace = FALSE;
|
||||
InWhitespace = false;
|
||||
string[di] = string[si];
|
||||
di++;
|
||||
}
|
||||
@ -149,7 +139,6 @@ void MDFN_rtrim(std::string &string)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MDFN_trim(std::string &string)
|
||||
{
|
||||
MDFN_rtrim(string);
|
||||
|
@ -324,23 +324,6 @@ typedef struct
|
||||
double mouse_sensitivity;
|
||||
} MDFNGI;
|
||||
|
||||
// Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||
// Rounds up to the nearest power of 2.
|
||||
static INLINE uint32 round_up_pow2(uint32 v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
v |= v >> 2;
|
||||
v |= v >> 4;
|
||||
v |= v >> 8;
|
||||
v |= v >> 16;
|
||||
v++;
|
||||
|
||||
v += (v == 0);
|
||||
|
||||
return(v);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../mednafen.h"
|
||||
#include "../../mednafen-types.h"
|
||||
#include "../../state.h"
|
||||
#include "../../state_helpers.h"
|
||||
#include "arcade_card.h"
|
||||
|
||||
|
@ -15,13 +15,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mednafen.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <vector>
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "general.h"
|
||||
#include "mempatcher.h"
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "okiadpcm.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "mednafen-types.h"
|
||||
#include "okiadpcm.h"
|
||||
|
||||
const int OKIADPCM_StepSizes[49] =
|
||||
{
|
||||
// These can also be generated like:
|
||||
|
@ -23,7 +23,10 @@
|
||||
PCE_FAST(less accurate, faster, etc.) fork from PCE module "pcecd.cpp".
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "../mednafen-types.h"
|
||||
#include "../state.h"
|
||||
#include "../okiadpcm.h"
|
||||
#include "../cdrom/SimpleFIFO.h"
|
||||
#include "../state_helpers.h"
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "../mednafen-types.h"
|
||||
#include "../state.h"
|
||||
#include "../state_helpers.h"
|
||||
|
||||
#include "psg.h"
|
||||
|
Loading…
Reference in New Issue
Block a user