Header cleanups + getting rid of IsAbsolutePath - using libretro-common

equivalent
This commit is contained in:
twinaphex 2020-09-22 06:38:41 +02:00
parent 0c191c231d
commit 839e620c73
13 changed files with 14 additions and 110 deletions

View File

@ -2,6 +2,7 @@
#include "mednafen/mempatcher.h"
#include "mednafen/git.h"
#include "mednafen/general.h"
#include "mednafen/settings.h"
#include <compat/msvc.h>
#include "mednafen/psx/gpu.h"
#ifdef NEED_DEINTERLACER

View File

@ -2,6 +2,7 @@
#include "MemoryStream.h"
#include "error.h"
#include <compat/msvc.h>
#include "math_ops.h"
/*
TODO:

View File

@ -1,9 +0,0 @@
#ifndef _MDFN_DRIVERH
#define _MDFN_DRIVERH
#include "mednafen-types.h"
#include "git.h"
#include "mednafen-driver.h"
#include "mempatcher-driver.h"
#endif

View File

@ -19,6 +19,8 @@
#include <sys/types.h>
#include <file/file_path.h>
#include <string>
#include <boolean.h>
@ -26,31 +28,11 @@
#include "error.h"
#include "mednafen.h"
#include "general.h"
#include "settings.h"
#include "state.h"
using namespace std;
static bool IsAbsolutePath(const char *path)
{
if (
#ifdef _WIN32
path[0] == '\\' ||
#endif
path[0] == '/'
)
return true;
#if defined(_WIN32) || defined(DOS)
if((path[0] >= 'a' && path[0] <= 'z') || (path[0] >= 'A' && path[0] <= 'Z'))
{
if(path[1] == ':')
return true;
}
#endif
return(false);
}
bool MDFN_IsFIROPSafe(const std::string &path)
{
// We could make this more OS-specific, but it shouldn't hurt to try to weed out usage of characters that are path
@ -140,8 +122,8 @@ std::string MDFN_EvalFIP(const std::string &dir_path, const std::string &rel_pat
if(!skip_safety_check && !MDFN_IsFIROPSafe(rel_path))
throw MDFN_Error(0, "Referenced path \"%s\" is potentially unsafe. See \"filesys.untrusted_fip_check\" setting.\n", rel_path.c_str());
if(IsAbsolutePath(rel_path.c_str()))
return(rel_path);
if (path_is_absolute(rel_path.c_str()))
return rel_path;
return(dir_path + slash + rel_path);
}

View File

@ -3,7 +3,7 @@
#include <libretro.h>
#include "video.h"
#include "video/surface.h"
#include "state.h"
enum
@ -228,15 +228,6 @@ typedef struct
// performance possible. HOWEVER, emulation modules must make sure the value is in a range(with minimum and maximum) that their code can handle
// before they try to handle it.
double soundmultiplier;
// True if we want to rewind one frame. Set by the driver code.
bool NeedRewind;
// Sound reversal during state rewinding is normally done in mednafen.cpp, but
// individual system emulation code can also do it if this is set, and clear it after it's done.
// (Also, the driver code shouldn't touch this variable)
bool NeedSoundReverse;
} EmulateSpecStruct;
typedef enum
@ -295,11 +286,6 @@ typedef struct
VideoSystems VideoSystem;
GameMediumTypes GameType;
//int DiskLogicalCount; // A single double-sided disk would be 2 here.
//const char *DiskNames; // Null-terminated.
const char *cspecial; /* Special cart expansion: DIP switches, barcode reader, etc. */
// For absolute coordinates(IDIT_X_AXIS and IDIT_Y_AXIS), usually mapped to a mouse(hence the naming).
float mouse_scale_x, mouse_scale_y;
float mouse_offs_x, mouse_offs_y;

View File

@ -1,25 +0,0 @@
#ifndef __MDFN_MEDNAFEN_DRIVER_H
#define __MDFN_MEDNAFEN_DRIVER_H
#include <libretro.h>
#include <stdio.h>
#include <string.h>
void MDFND_DispMessage(
unsigned priority, enum retro_log_level level,
enum retro_message_target target, enum retro_message_type type,
const char *msg);
#ifdef __cplusplus
extern "C" {
#endif
void MDFN_DispMessage(
unsigned priority, enum retro_log_level level,
enum retro_message_target target, enum retro_message_type type,
const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -2,17 +2,12 @@
#define _MEDNAFEN_H
#include <libretro.h>
#include "mednafen-types.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _(String) (String)
#include "math_ops.h"
#include "git.h"
#ifdef _WIN32
#define strcasecmp _stricmp
#endif
@ -28,10 +23,6 @@
#define GET_FSIZE_PTR(fp) (fp->size)
#define GET_FEXTS_PTR(fp) (fp->ext)
extern MDFNGI *MDFNGameInfo;
#include "settings.h"
void MDFND_DispMessage(
unsigned priority, enum retro_log_level level,
enum retro_message_target target, enum retro_message_type type,
@ -51,6 +42,4 @@ void MDFN_DispMessage(
void MDFN_LoadGameCheats(void *override);
void MDFN_FlushGameCheats(int nosave);
#include "mednafen-driver.h"
#endif

View File

@ -29,6 +29,7 @@
#include "mednafen.h"
#include "general.h"
#include "settings.h"
#include "mempatcher.h"
#include <libretro.h>

View File

@ -26,6 +26,7 @@
#include "../state_helpers.h"
#include "../math_ops.h"
#include "../mednafen.h"
#include "../mednafen-endian.h"
// iCB: PGXP STUFF

View File

@ -19,6 +19,7 @@
#include "../frontio.h"
#include "dualshock.h"
#include "../../mednafen.h"
#include "../../mednafen-endian.h"
/*

View File

@ -21,7 +21,7 @@
#include <libretro.h>
#include "mednafen-driver.h"
#include "mednafen.h"
#include "settings.h"
int setting_initial_scanline = 0;

View File

@ -1,24 +0,0 @@
#ifndef __MDFN_VIDEO_H
#define __MDFN_VIDEO_H
#include <libretro.h>
#include "video/surface.h"
void MDFND_DispMessage(
unsigned priority, enum retro_log_level level,
enum retro_message_target target, enum retro_message_type type,
const char *msg);
#ifdef __cplusplus
extern "C" {
#endif
void MDFN_DispMessage(
unsigned priority, enum retro_log_level level,
enum retro_message_target target, enum retro_message_type type,
const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,8 +1,8 @@
#include "../mednafen.h"
#include "../video.h"
#include "../general.h"
#include "../state.h"
#include "../driver.h"
#include "surface.h"
extern "C" uint8_t psx_gpu_upscale_shift;