Commit 7a0fdffa authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Cleanups

parent 38c06839
......@@ -17,7 +17,6 @@
#include "mednafen/pce/input.h"
#include "mednafen/pce/huc.h"
#include "mednafen/pce/vce.h"
#include "mednafen/settings-driver.h"
#include "mednafen/mempatcher.h"
#include "mednafen/cdrom/cdromif.h"
#include "mednafen/cdrom/CDUtility.h"
......@@ -701,14 +700,6 @@ static MDFNGI *MDFNI_LoadCD(const char *devicename)
static MDFNGI *MDFNI_LoadGame(const char *name)
{
static const FileExtensionSpecStruct KnownExtensions[] =
{
{ ".pce", "PC Engine ROM Image" },
{ ".sgx", "SuperGrafx ROM Image" },
{ NULL, NULL }
};
std::vector<FileExtensionSpecStruct> valid_iae;
MDFNFILE *GameFile = NULL;
MDFNGameInfo = &EmulatedPCE;
......@@ -722,14 +713,6 @@ static MDFNGI *MDFNI_LoadGame(const char *name)
MDFN_indent(1);
// Construct a NULL-delimited list of known file extensions for MDFN_fopen()
const FileExtensionSpecStruct *curexts = KnownExtensions;
while(curexts->extension && curexts->description)
{
valid_iae.push_back(*curexts);
curexts++;
}
GameFile = file_open(name);
if(!GameFile)
......@@ -817,7 +800,8 @@ void MDFN_printf(const char *format, ...)
vsnprintf(temp, 4096, format_temp, ap);
free(format_temp);
MDFND_Message(temp);
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s\n", temp);
free(temp);
va_end(ap);
......@@ -833,7 +817,8 @@ void MDFN_PrintError(const char *format, ...)
temp = (char*)malloc(4096 * sizeof(char));
vsnprintf(temp, 4096, format, ap);
MDFND_PrintError(temp);
if (log_cb)
log_cb(RETRO_LOG_ERROR, "%s\n", temp);
free(temp);
va_end(ap);
......@@ -2042,18 +2027,6 @@ std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1)
return ret;
}
void MDFND_Message(const char *str)
{
if (log_cb)
log_cb(RETRO_LOG_INFO, "%s\n", str);
}
void MDFND_PrintError(const char* err)
{
if (log_cb)
log_cb(RETRO_LOG_ERROR, "%s\n", err);
}
/* forward declarations */
extern void MDFND_DispMessage(unsigned char *str);
......
#ifndef _MDFN_DRIVERH
#define _MDFN_DRIVERH
#include "mednafen-types.h"
#include "git.h"
#include "settings-driver.h"
#include "mednafen-driver.h"
#include "mempatcher-driver.h"
#endif
......@@ -4,20 +4,14 @@
#include <string>
#include <libretro.h>
#include "file.h"
#include "state.h"
#include "video.h"
#if 0
template<typename T> void showtype(T foo);
#endif
typedef struct
{
const char *extension; // Example ".nes"
const char *description; // Example "iNES Format ROM Image"
} FileExtensionSpecStruct;
#include "file.h"
enum
{
MDFN_ROTATE0 = 0,
......@@ -45,9 +39,6 @@ typedef enum
GMT_PLAYER // Music player(NSF, HES, GSF)
} GameMediumTypes;
#include "state.h"
#include "settings-common.h"
typedef enum
{
IDIT_BUTTON, // 1-bit
......@@ -295,8 +286,6 @@ class CDIF;
typedef struct
{
const MDFNSetting *Settings;
// Time base for EmulateSpecStruct::MasterCycles
int64 MasterClock;
......
#ifndef __MDFN_LEPACKER_H
#define __MDFN_LEPACKER_H
#include <vector>
#include "mednafen.h"
/* Little-endian byte packer(and unpacker). */
......
......@@ -2,38 +2,11 @@
#define __MDFN_MEDNAFEN_DRIVER_H
#include <stdio.h>
#include <vector>
#include <string>
#include "settings-common.h"
extern std::vector<MDFNGI *>MDFNSystems;
/* Indent stdout newlines +- "indent" amount */
void MDFN_indent(int indent);
void MDFN_printf(const char *format, ...);
#define MDFNI_printf MDFN_printf
/* Displays an error. Can block or not. */
void MDFND_PrintError(const char *s);
void MDFND_Message(const char *s);
uint32 MDFND_GetTime(void);
/* Sets the base directory(save states, snapshots, etc. are saved in directories
below this directory. */
void MDFNI_SetBaseDirectory(const char *dir);
void MDFN_DispMessage(const char *format, ...);
#define MDFNI_DispMessage MDFN_DispMessage
uint32 MDFNI_CRC32(uint32 crc, uint8 *buf, uint32 len);
// NES hackish function. Should abstract in the future.
int MDFNI_DatachSet(const uint8 *rcode);
void MDFNI_DumpModulesDef(const char *fn);
#endif
......@@ -656,21 +656,3 @@ int MDFNI_ToggleCheat(uint32 which)
return(cheats[which].status);
}
static void SettingChanged(const char *name)
{
MDFNMP_RemoveReadPatches();
CheatsActive = MDFN_GetSettingB("cheats");
RebuildSubCheats();
MDFNMP_InstallReadPatches();
}
MDFNSetting MDFNMP_Settings[] =
{
{ "cheats", MDFNSF_NOFLAGS, "Enable cheats.", NULL, MDFNST_BOOL, "1", NULL, NULL, NULL, SettingChanged },
{ NULL}
};
......@@ -24,6 +24,4 @@ void MDFNMP_RemoveReadPatches(void);
void MDFNMP_ApplyPeriodicCheats(void);
extern MDFNSetting MDFNMP_Settings[];
#endif
......@@ -36,14 +36,6 @@
extern MDFNGI EmulatedPCE;
static const MDFNSetting_EnumList PSGRevisionList[] =
{
{ "huc6280", PCE_PSG::REVISION_HUC6280, "HuC6280", "HuC6280 as found in the original PC Engine." },
{ "huc6280a", PCE_PSG::REVISION_HUC6280A, "HuC6280A", "HuC6280A as found in the SuperGrafx and CoreGrafx I. Provides proper channel amplitude centering, but may cause clicking in a few games designed with the original HuC6280's sound characteristics in mind." },
{ "match", PCE_PSG::_REVISION_COUNT, "Match emulation mode.", "Selects \"huc6280\" for non-SuperGrafx mode, and \"huc6280a\" for SuperGrafx(full) mode." },
{ NULL, 0 },
};
static std::vector<CDIF*> *cdifs = NULL;
HuC6280 HuCPU;
......@@ -388,14 +380,6 @@ static MDFN_COLD int LoadCommon(void)
psgrevision = IsSGX ? PCE_PSG::REVISION_HUC6280A : PCE_PSG::REVISION_HUC6280;
}
for(const MDFNSetting_EnumList *el = PSGRevisionList; el->string; el++)
{
if(el->number == psgrevision)
{
MDFN_printf("PSG Revision: %s\n", el->description);
break;
}
}
psg = new PCE_PSG(HRBufs[0]->Buf(), HRBufs[1]->Buf(), psgrevision);
psg->SetVolume(1.0);
......@@ -603,12 +587,8 @@ void Emulate(EmulateSpecStruct *espec)
if(espec->SoundFormatChanged)
SetSoundRate(espec->SoundRate);
//int t = MDFND_GetTime();
vce->StartFrame(espec->surface, &espec->DisplayRect, espec->LineWidths, espec->skip);
// Begin loop here:
//for(int i = 0; i < 2; i++)
bool rp_rv;
bool start_frame = true;
......@@ -699,11 +679,6 @@ void Emulate(EmulateSpecStruct *espec)
start_frame = false;
} while(!rp_rv);
//printf("%d\n", MDFND_GetTime() - t);
// End loop here.
//printf("%d\n", vce->GetScanlineNo());
vce->EndFrame(&espec->DisplayRect);
}
......@@ -757,48 +732,6 @@ void DoSimpleCommand(int cmd)
}
}
static const MDFNSetting PCESettings[] =
{
{ "pce.input.multitap", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Enable multitap(TurboTap) emulation.", NULL, MDFNST_BOOL, "1" },
{ "pce.slstart", MDFNSF_NOFLAGS, "First rendered scanline.", NULL, MDFNST_UINT, "4", "0", "239" },
{ "pce.slend", MDFNSF_NOFLAGS, "Last rendered scanline.", NULL, MDFNST_UINT, "235", "0", "239" },
{ "pce.h_overscan", MDFNSF_NOFLAGS, "Show horizontal overscan area.", NULL, MDFNST_BOOL, "0" },
{ "pce.mouse_sensitivity", MDFNSF_NOFLAGS, "Emulated mouse sensitivity.", NULL, MDFNST_FLOAT, "0.50", NULL, NULL, NULL, PCEINPUT_SettingChanged },
{ "pce.disable_softreset", MDFNSF_NOFLAGS, "If set, when RUN+SEL are pressed simultaneously, disable both buttons temporarily.", NULL, MDFNST_BOOL, "0", NULL, NULL, NULL, PCEINPUT_SettingChanged },
{ "pce.disable_bram_cd", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Disable BRAM(saved game memory) for CD games.", "It is intended for viewing CD games' error screens that may be different from simple BRAM full and uninitialized BRAM error screens, though it can cause the game to crash outright.", MDFNST_BOOL, "0" },
{ "pce.disable_bram_hucard", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Disable BRAM(saved game memory) for HuCard games.", "It is intended for changing the behavior(passwords vs save games) of some HuCard games.", MDFNST_BOOL, "0" },
{ "pce.forcesgx", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Force SuperGrafx emulation.",
"Enabling this option is not necessary to run unrecognized PCE ROM images in SuperGrafx mode, and enabling it is discouraged; ROM images with a file extension of \".sgx\" will automatically enable SuperGrafx emulation.", MDFNST_BOOL, "0" },
{ "pce.arcadecard", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Enable Arcade Card emulation.",
"Leaving this option enabled is recommended, unless you want to see special warning screens on ACD games, or you prefer the non-enhanced modes of ACD-enhanced SCD games. Additionally, you may want to disable it you you wish to use state rewinding with a SCD ACD-enhanced game on a slow CPU, as the extra 2MiB of RAM the Arcade Card offers is difficult to compress in real-time.", MDFNST_BOOL, "1" },
{ "pce.nospritelimit", MDFNSF_NOFLAGS, "Remove 16-sprites-per-scanline hardware limit.",
"WARNING: Enabling this option may cause undesirable graphics glitching on some games(such as \"Bloody Wolf\").", MDFNST_BOOL, "0" },
{ "pce.cdbios", MDFNSF_EMU_STATE, "Path to the CD BIOS", NULL, MDFNST_STRING, "syscard3.pce" },
{ "pce.gecdbios", MDFNSF_EMU_STATE, "Path to the GE CD BIOS", "Games Express CD Card BIOS (Unlicensed)", MDFNST_STRING, "gecard.pce" },
{ "pce.psgrevision", MDFNSF_NOFLAGS, "Select PSG revision.", "WARNING: HES playback will always use the \"huc6280a\" revision if this setting is set to \"match\", since HES playback is always done with SuperGrafx emulation enabled.", MDFNST_ENUM, "match", NULL, NULL, NULL, NULL, PSGRevisionList },
{ "pce.cdpsgvolume", MDFNSF_NOFLAGS, "PSG volume when playing a CD game.", "Setting this volume control too high may cause sample clipping.", MDFNST_UINT, "100", "0", "200", NULL, CDSettingChanged },
{ "pce.cddavolume", MDFNSF_NOFLAGS, "CD-DA volume.", "Setting this volume control too high may cause sample clipping.", MDFNST_UINT, "100", "0", "200", NULL, CDSettingChanged },
{ "pce.adpcmvolume", MDFNSF_NOFLAGS, "ADPCM volume.", "Setting this volume control too high may cause sample clipping.", MDFNST_UINT, "100", "0", "200", NULL, CDSettingChanged },
{ "pce.adpcmextraprec", MDFNSF_NOFLAGS, "Output the full 12-bit ADPCM predictor.", "Enabling this option causes the MSM5205 ADPCM predictor to be outputted with full precision of 12-bits, rather than only outputting 10-bits of precision(as an actual MSM5205 does). Enable this option to reduce whining noise during ADPCM playback.", MDFNST_BOOL, "0" },
{ "pce.resamp_quality", MDFNSF_NOFLAGS, "Sound quality.", "Higher values correspond to better SNR and better preservation of higher frequencies(\"brightness\"), at the cost of increased computational complexity and a negligible increase in latency.\n\nHigher values will also slightly increase the probability of sample clipping(relevant if Mednafen's volume control settings are set too high), due to increased (time-domain) ringing.", MDFNST_INT, "3", "0", "5" },
{ "pce.resamp_rate_error", MDFNSF_NOFLAGS, "Sound output rate tolerance.", "Lower values correspond to better matching of the output rate of the resampler to the actual desired output rate, at the expense of increased RAM usage and poorer CPU cache utilization.", MDFNST_FLOAT, "0.0000009", "0.0000001", "0.0000350" },
{ "pce.vramsize", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE | MDFNSF_SUPPRESS_DOC, "Size of emulated VRAM per VDC in 16-bit words. DO NOT CHANGE THIS UNLESS YOU KNOW WTF YOU ARE DOING.", NULL, MDFNST_UINT, "32768", "32768", "65536" },
{ NULL }
};
static DECLFR(CheatReadFunc)
{
std::vector<SUBCHEAT>::iterator chit;
......@@ -840,13 +773,6 @@ static void SetLayerEnableMask(uint64 mask)
vce->SetLayerEnableMask(mask);
}
static const FileExtensionSpecStruct KnownExtensions[] =
{
{ ".pce", "PC Engine ROM Image" },
{ ".sgx", "SuperGrafx ROM Image" },
{ NULL, NULL }
};
static bool SetSoundRate(double rate)
{
if(HRRes)
......@@ -880,7 +806,6 @@ void SettingsChanged()
MDFNGI EmulatedPCE =
{
PCESettings,
MDFN_MASTERCLOCK_FIXED(PCE_MASTER_CLOCK),
0,
......
#ifndef __MDFN_PCE_PCE_H
#define __MDFN_PCE_PCE_H
#include <vector>
#include <mednafen/mednafen.h>
#include <mednafen/state.h>
#include <mednafen/general.h>
......
#ifndef _MDFN_SETTINGS_COMMON_H
#define _MDFN_SETTINGS_COMMON_H
typedef enum
{
// Actual base types
MDFNST_INT = 0, // (signed), int8, int16, int32, int64(saved as)
MDFNST_UINT, // uint8, uint16, uint32, uint64(saved as)
MDFNST_BOOL, // bool. bool. bool!
MDFNST_FLOAT, // float, double(saved as).
MDFNST_STRING,
MDFNST_ENUM, // Handled like a string, but validated against the enumeration list, and MDFN_GetSettingUI() returns the number in the enumeration list.
MDFNST_ALIAS
} MDFNSettingType;
//#define MDFNST_EX_DRIVER = (1 << 16), // If this is not set, the setting is assumed to be internal. This...should probably be set automatically?
#define MDFNSF_NOFLAGS 0 // Always 0, makes setting definitions prettier...maybe.
// TODO(cats)
#define MDFNSF_CAT_INPUT (1 << 8)
#define MDFNSF_CAT_SOUND (1 << 9)
#define MDFNSF_CAT_VIDEO (1 << 10)
#define MDFNSF_EMU_STATE (1 << 17) // If the setting affects emulation from the point of view of the emulated program
#define MDFNSF_UNTRUSTED_SAFE (1 << 18) // If it's safe for an untrusted source to modify it, probably only used in conjunction with
// MDFNST_EX_EMU_STATE and network play
#define MDFNSF_SUPPRESS_DOC (1 << 19) // Suppress documentation generation for this setting.
#define MDFNSF_COMMON_TEMPLATE (1 << 20) // Auto-generated common template setting(like nes.xscale, pce.xscale, vb.xscale, nes.enable, pce.enable, vb.enable)
// TODO:
// #define MDFNSF_WILL_BREAK_GAMES (1 << ) // If changing the value of the setting from the default value will break games/programs that would otherwise work.
// TODO(in progress):
#define MDFNSF_REQUIRES_RELOAD (1 << 24) // If a game reload is required for the setting to take effect.
#define MDFNSF_REQUIRES_RESTART (1 << 25) // If Mednafen restart is required for the setting to take effect.
typedef struct
{
const char *string;
int number;
const char *description; // Short
const char *description_extra; // Extra verbose text appended to the short description.
} MDFNSetting_EnumList;
typedef struct
{
const char *name;
uint32 flags;
const char *description; // Short
const char *description_extra;
MDFNSettingType type;
const char *default_value;
const char *minimum;
const char *maximum;
bool (*validate_func)(const char *name, const char *value);
void (*ChangeNotification)(const char *name);
const MDFNSetting_EnumList *enum_list;
} MDFNSetting;
typedef struct __MDFNCS
{
char *name;
char *value;
char *game_override; // per-game setting override(netplay_override > game_override > value, in precedence)
const MDFNSetting *desc;
void (*ChangeNotification)(const char *name);
uint32 name_hash;
} MDFNCS;
#endif
#ifndef _MDFN_SETTINGS_DRIVER_H
#define _MDFN_SETTINGS_DRIVER_H
#include "settings-common.h"
bool MDFNI_SetSetting(const char *name, const char *value, bool NetplayOverride = FALSE);
bool MDFNI_SetSettingB(const char *name, bool value);
bool MDFNI_SetSettingUI(const char *name, uint64 value);
bool MDFNI_DumpSettingsDef(const char *path);
#include <map>
#endif
......@@ -152,22 +152,3 @@ std::string MDFN_GetSettingS(const char *name)
fprintf(stderr, "unhandled setting S: %s\n", name);
return 0;
}
bool MDFNI_SetSetting(const char *name, const char *value, bool NetplayOverride)
{
return false;
}
bool MDFNI_SetSettingB(const char *name, bool value)
{
return false;
}
bool MDFNI_SetSettingUI(const char *name, uint64 value)
{
return false;
}
void MDFNI_DumpSettingsDef(const char *path)
{
}
......@@ -841,25 +841,5 @@ OwlResampler::OwlResampler(double input_rate, double output_rate, double rate_er
MDFN_indent(-1);
//abort();
#if 0
{
static float dummy_wave[1024];
static float dummy_coeffs[1024];
int32 dummy_out;
uint32 begin_time = MDFND_GetTime();
for(int i = 0; i < 1024 * 1024; i++)
{
DoMAC_AVX_32X(dummy_wave, dummy_coeffs, 1024, &dummy_out);
//DoMAC_SSE_16X(dummy_wave, dummy_coeffs, 1024, &dummy_out);
}
printf("%u\n", MDFND_GetTime() - begin_time);
abort();
}
#endif
delete[] FilterBuf;
}
......@@ -4,6 +4,7 @@
class OwlResampler;
class RavenBuffer;
#include <vector>
#include <mednafen/state.h>
class OwlBuffer
......
......@@ -20,7 +20,6 @@
#include <boolean.h>
#include "mednafen.h"
#include "driver.h"
#include "general.h"
#include "state.h"
#include "video.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment