Add first runtime option to Mednafen core - Mednafen PCE_Fast -

pce_nospritelimit
This commit is contained in:
twinaphex 2013-04-09 04:05:18 +02:00
parent c42ea98f06
commit c06d14969b
3 changed files with 38 additions and 1 deletions

View File

@ -314,6 +314,23 @@ bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
return false;
}
static void check_variables(void)
{
struct retro_variable var = {0};
#if defined(WANT_PCE_FAST_EMU)
var.key = "pce_nospritelimit";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
if (strcmp(var.value, "disabled") == 0)
setting_pce_fast_nospritelimit = 0;
else if (strcmp(var.value, "enabled") == 0)
setting_pce_fast_nospritelimit = 1;
}
#endif
}
bool retro_load_game(const struct retro_game_info *info)
{
if (failed_init)
@ -356,6 +373,8 @@ bool retro_load_game(const struct retro_game_info *info)
deint.ClearState();
#endif
check_variables();
return game;
}
@ -743,6 +762,7 @@ static void update_input(void)
static uint64_t video_frames, audio_frames;
void retro_run()
{
MDFNGI *curgame = game;
@ -872,6 +892,10 @@ void retro_run()
audio_frames += spec.SoundBufSize;
audio_batch_cb(spec.SoundBuf, spec.SoundBufSize);
bool updated = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
check_variables();
}
void retro_get_system_info(struct retro_system_info *info)
@ -947,6 +971,15 @@ void retro_set_controller_port_device(unsigned in_port, unsigned device)
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
#if defined(WANT_PCE_FAST_EMU)
static const struct retro_variable vars[] = {
{ "pce_nospritelimit", "No Sprite Limit; disabled|enabled" },
{ NULL, NULL },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void*)vars);
#endif
}
void retro_set_audio_sample(retro_audio_sample_t cb)

View File

@ -21,6 +21,8 @@
#include <string>
#include "settings.h"
uint32_t setting_pce_fast_nospritelimit = 0;
bool MDFN_SaveSettings(const char *path)
{
return(1);
@ -137,7 +139,7 @@ bool MDFN_GetSettingB(const char *name)
if (!strcmp("pce_fast.forcesgx", name))
return 0;
if (!strcmp("pce_fast.nospritelimit", name))
return 0;
return setting_pce_fast_nospritelimit;
if (!strcmp("pce_fast.forcemono", name))
return 0;
if (!strcmp("pce_fast.disable_softreset", name))

View File

@ -3,6 +3,8 @@
#include <string>
extern uint32_t setting_pce_fast_nospritelimit;
bool MDFN_LoadSettings(const char *path, const char *section = NULL, bool override = false);
bool MDFN_MergeSettings(const void*);
bool MDFN_MergeSettings(const std::vector<void> &);