mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
Convert settings.cpp to C
This commit is contained in:
parent
1e6f9b53ee
commit
b53abf36a1
@ -277,7 +277,6 @@ ifneq ($(HAVE_GRIFFIN), 1)
|
||||
$(CDROM_DIR)/edc_crc32.c
|
||||
|
||||
SOURCES_CXX += $(MEDNAFEN_DIR)/error.cpp \
|
||||
$(MEDNAFEN_DIR)/settings.cpp \
|
||||
$(MEDNAFEN_DIR)/general.cpp \
|
||||
$(MEDNAFEN_DIR)/FileStream.cpp \
|
||||
$(MEDNAFEN_DIR)/MemoryStream.cpp \
|
||||
@ -291,6 +290,7 @@ ifneq ($(HAVE_GRIFFIN), 1)
|
||||
$(CORE_DIR)/rsx/rsx_intf.cpp
|
||||
|
||||
SOURCES_C += $(MEDNAFEN_DIR)/md5.c \
|
||||
$(MEDNAFEN_DIR)/settings.c \
|
||||
$(MEDNAFEN_DIR)/state.c
|
||||
|
||||
ifneq ($(RSX_DUMP),)
|
||||
|
@ -1997,7 +1997,7 @@ static void InitCommon(std::vector<CDIF *> *_CDInterfaces, const bool EmulateMem
|
||||
abort();
|
||||
|
||||
const char *biospath = MDFN_MakeFName(MDFNMKF_FIRMWARE,
|
||||
0, MDFN_GetSettingS(biospath_sname).c_str());
|
||||
0, MDFN_GetSettingS(biospath_sname));
|
||||
|
||||
BIOSFile = filestream_open(biospath,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
|
@ -26,10 +26,16 @@ void MDFND_DispMessage(
|
||||
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
|
||||
|
||||
uint32 MDFNI_CRC32(uint32 crc, uint8 *buf, uint32 len);
|
||||
|
||||
|
@ -37,10 +37,16 @@ void MDFND_DispMessage(
|
||||
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
|
||||
|
||||
void MDFN_LoadGameCheats(void *override);
|
||||
void MDFN_FlushGameCheats(int nosave);
|
||||
|
@ -15,14 +15,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <string>
|
||||
#include <libretro.h>
|
||||
|
||||
#include "mednafen.h"
|
||||
#include "settings.h"
|
||||
#include <compat/msvc.h>
|
||||
|
||||
int setting_initial_scanline = 0;
|
||||
int setting_initial_scanline_pal = 0;
|
||||
@ -34,10 +33,6 @@ uint32_t setting_psx_multitap_port_2 = 0;
|
||||
uint32_t setting_psx_analog_toggle = 0;
|
||||
uint32_t setting_psx_fastboot = 1;
|
||||
|
||||
extern char retro_cd_base_name[4096];
|
||||
extern char retro_save_directory[4096];
|
||||
extern char retro_base_directory[4096];
|
||||
|
||||
uint64_t MDFN_GetSettingUI(const char *name)
|
||||
{
|
||||
if (!strcmp("psx.spu.resamp_quality", name)) /* make configurable */
|
||||
@ -49,7 +44,7 @@ uint64_t MDFN_GetSettingUI(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64 MDFN_GetSettingI(const char *name)
|
||||
int64_t MDFN_GetSettingI(const char *name)
|
||||
{
|
||||
if (!strcmp("psx.region_default", name)) /* make configurable */
|
||||
return 1; /* REGION_JP = 0, REGION_NA = 1, REGION_EU = 2 */
|
||||
@ -106,76 +101,24 @@ bool MDFN_GetSettingB(const char *name)
|
||||
/* FILESYS */
|
||||
if (!strcmp("filesys.untrusted_fip_check", name))
|
||||
return 0;
|
||||
if (!strcmp("filesys.disablesavegz", name))
|
||||
return 1;
|
||||
MDFN_DispMessage(3, RETRO_LOG_WARN,
|
||||
RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
|
||||
"unhandled setting B: %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string MDFN_GetSettingS(const char *name)
|
||||
const char *MDFN_GetSettingS(const char *name)
|
||||
{
|
||||
if (!strcmp("psx.bios_eu", name))
|
||||
return std::string("scph5502.bin");
|
||||
return "scph5502.bin";
|
||||
if (!strcmp("psx.bios_jp", name))
|
||||
return std::string("scph5500.bin");
|
||||
return "scph5500.bin";
|
||||
if (!strcmp("psx.bios_na", name))
|
||||
return std::string("scph5501.bin");
|
||||
return "scph5501.bin";
|
||||
if (!strcmp("psx.region_default", name)) /* make configurable */
|
||||
return "na";
|
||||
/* FILESYS */
|
||||
if (!strcmp("filesys.path_firmware", name))
|
||||
return std::string(retro_base_directory);
|
||||
if (!strcmp("filesys.path_sav", name))
|
||||
return std::string(retro_save_directory);
|
||||
if (!strcmp("filesys.path_state", name))
|
||||
return std::string(retro_save_directory);
|
||||
if (!strcmp("filesys.fname_state", name))
|
||||
{
|
||||
char fullpath[4096];
|
||||
int r = snprintf(fullpath, sizeof(fullpath), "%s.sav", retro_cd_base_name);
|
||||
if (r > 4095)
|
||||
{
|
||||
MDFND_DispMessage(3, RETRO_LOG_ERROR,
|
||||
RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
|
||||
"Path to .sav too long.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return std::string(fullpath);
|
||||
}
|
||||
if (!strcmp("filesys.fname_sav", name))
|
||||
{
|
||||
char fullpath[4096];
|
||||
int r = snprintf(fullpath, sizeof(fullpath), "%s.bsv", retro_cd_base_name);
|
||||
if (r > 4095)
|
||||
{
|
||||
MDFND_DispMessage(3, RETRO_LOG_ERROR,
|
||||
RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
|
||||
"Path to .bsv too long.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return std::string(fullpath);
|
||||
}
|
||||
MDFN_DispMessage(3, RETRO_LOG_WARN,
|
||||
RETRO_MESSAGE_TARGET_LOG, RETRO_MESSAGE_TYPE_NOTIFICATION,
|
||||
"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_t value)
|
||||
{
|
||||
return false;
|
||||
}
|
@ -1,7 +1,14 @@
|
||||
#ifndef MDFN_SETTINGS_H
|
||||
#define MDFN_SETTINGS_H
|
||||
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t setting_psx_multitap_port_1;
|
||||
extern uint32_t setting_psx_multitap_port_2;
|
||||
@ -12,10 +19,15 @@ extern int setting_initial_scanline_pal;
|
||||
extern int setting_last_scanline;
|
||||
extern int setting_last_scanline_pal;
|
||||
|
||||
// This should assert() or something if the setting isn't found, since it would
|
||||
// be a totally tubular error!
|
||||
uint64 MDFN_GetSettingUI(const char *name);
|
||||
int64 MDFN_GetSettingI(const char *name);
|
||||
/* This should assert() or something if the setting isn't found,
|
||||
* since it would be a totally tubular error! */
|
||||
uint64_t MDFN_GetSettingUI(const char *name);
|
||||
int64_t MDFN_GetSettingI(const char *name);
|
||||
bool MDFN_GetSettingB(const char *name);
|
||||
std::string MDFN_GetSettingS(const char *name);
|
||||
const char *MDFN_GetSettingS(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -10,9 +10,15 @@ void MDFND_DispMessage(
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user