2020-05-21 23:08:13 +00:00
|
|
|
#include "mednafen/src/mednafen.h"
|
|
|
|
#include "mednafen/src/general.h"
|
|
|
|
#include "mednafen/src/state.h"
|
|
|
|
#include "mednafen/src/settings.h"
|
|
|
|
#include "mednafen/src/mempatcher.h"
|
|
|
|
#include "mednafen/src/mednafen-driver.h"
|
2020-05-21 23:24:50 +00:00
|
|
|
#include "mednafen/src/player.h"
|
2020-05-21 23:08:13 +00:00
|
|
|
|
2020-05-22 17:53:34 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
2020-05-24 21:56:43 +00:00
|
|
|
#include <emulibc.h>
|
|
|
|
|
|
|
|
enum { SETTING_VALUE_MAX_LENGTH = 256 };
|
|
|
|
|
|
|
|
static void (*FrontendSettingQuery)(const char* setting, char* dest);
|
|
|
|
ECL_EXPORT void SetFrontendSettingQuery(void (*q)(const char* setting, char* dest))
|
|
|
|
{
|
|
|
|
FrontendSettingQuery = q;
|
|
|
|
}
|
2020-05-22 17:53:34 +00:00
|
|
|
|
2020-05-21 23:08:13 +00:00
|
|
|
namespace Mednafen
|
|
|
|
{
|
|
|
|
MDFNGI *MDFNGameInfo = NULL;
|
2020-05-22 00:32:42 +00:00
|
|
|
NativeVFS NVFS;
|
2020-05-21 23:08:13 +00:00
|
|
|
|
|
|
|
std::string MDFN_MakeFName(MakeFName_Type type, int id1, const char *cd1)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
// mednafen-driver.h
|
2020-05-22 17:53:34 +00:00
|
|
|
static int curindent = 0;
|
2020-05-21 23:08:13 +00:00
|
|
|
void MDFN_indent(int indent)
|
2020-05-22 17:53:34 +00:00
|
|
|
{
|
|
|
|
curindent += indent;
|
|
|
|
if(curindent < 0)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "MDFN_indent negative!\n");
|
|
|
|
curindent = 0;
|
|
|
|
}
|
|
|
|
}
|
2020-05-21 23:08:13 +00:00
|
|
|
void MDFN_printf(const char *format, ...) noexcept
|
2020-05-22 17:53:34 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < curindent; i++)
|
|
|
|
putchar('\t');
|
|
|
|
va_list argp;
|
|
|
|
va_start(argp, format);
|
|
|
|
vprintf(format, argp);
|
|
|
|
va_end(argp);
|
|
|
|
}
|
2020-05-21 23:08:13 +00:00
|
|
|
void MDFND_OutputNotice(MDFN_NoticeType t, const char* s) noexcept
|
2020-05-22 17:53:34 +00:00
|
|
|
{
|
|
|
|
fputs(s, t == MDFN_NOTICE_ERROR ? stderr : stdout);
|
|
|
|
fputc('\n', t == MDFN_NOTICE_ERROR ? stderr : stdout);
|
|
|
|
}
|
2020-05-21 23:08:13 +00:00
|
|
|
void MDFND_OutputInfo(const char* s) noexcept
|
2020-05-22 17:53:34 +00:00
|
|
|
{
|
|
|
|
puts(s);
|
|
|
|
}
|
2020-05-21 23:08:13 +00:00
|
|
|
void MDFN_Notify(MDFN_NoticeType t, const char* format, ...) noexcept
|
2020-05-22 17:53:34 +00:00
|
|
|
{
|
|
|
|
va_list argp;
|
|
|
|
va_start(argp, format);
|
|
|
|
vfprintf(t == MDFN_NOTICE_ERROR ? stderr : stdout, format, argp);
|
|
|
|
}
|
2020-05-22 22:01:48 +00:00
|
|
|
void MDFN_MidSync(EmulateSpecStruct *espec, const unsigned flags)
|
2020-05-21 23:08:13 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool MDFNSS_StateAction(StateMem *sm, const unsigned load, const bool data_only, const SFORMAT *sf, const char *sname, const bool optional) noexcept
|
|
|
|
{
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
2020-05-23 22:36:42 +00:00
|
|
|
static const MDFNSetting* GetSetting(const char* name)
|
|
|
|
{
|
|
|
|
const MDFNSetting* s;
|
|
|
|
for (int i = 0; s = &MDFNGameInfo->Settings[i], s->name; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(s->name, name) == 0)
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2020-05-21 23:08:13 +00:00
|
|
|
uint64 MDFN_GetSettingUI(const char *name)
|
|
|
|
{
|
2020-05-23 22:36:42 +00:00
|
|
|
auto s = GetSetting(name);
|
2020-05-24 21:56:43 +00:00
|
|
|
char tmp[SETTING_VALUE_MAX_LENGTH];
|
|
|
|
FrontendSettingQuery(name, tmp);
|
|
|
|
if (s && s->type == MDFNST_ENUM)
|
|
|
|
{
|
|
|
|
for (int i = 0; s->enum_list[i].string; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(s->enum_list[i].string, tmp) == 0)
|
|
|
|
return s->enum_list[i].number;
|
|
|
|
}
|
|
|
|
for (int i = 0; s->enum_list[i].string; i++)
|
|
|
|
{
|
|
|
|
if (strcmp(s->enum_list[i].string, s->default_value) == 0)
|
|
|
|
return s->enum_list[i].number;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return strtoul(tmp, nullptr, 10);
|
|
|
|
}
|
2020-05-21 23:08:13 +00:00
|
|
|
}
|
|
|
|
int64 MDFN_GetSettingI(const char *name)
|
|
|
|
{
|
2020-05-24 21:56:43 +00:00
|
|
|
char tmp[SETTING_VALUE_MAX_LENGTH];
|
|
|
|
FrontendSettingQuery(name, tmp);
|
|
|
|
return strtol(tmp, nullptr, 10);
|
2020-05-21 23:08:13 +00:00
|
|
|
}
|
|
|
|
double MDFN_GetSettingF(const char *name)
|
|
|
|
{
|
2020-05-24 21:56:43 +00:00
|
|
|
char tmp[SETTING_VALUE_MAX_LENGTH];
|
|
|
|
FrontendSettingQuery(name, tmp);
|
|
|
|
return strtod(tmp, nullptr);
|
2020-05-21 23:08:13 +00:00
|
|
|
}
|
|
|
|
bool MDFN_GetSettingB(const char *name)
|
|
|
|
{
|
2020-05-24 21:56:43 +00:00
|
|
|
char tmp[SETTING_VALUE_MAX_LENGTH];
|
|
|
|
FrontendSettingQuery(name, tmp);
|
|
|
|
return strtol(tmp, nullptr, 10) != 0;
|
2020-05-21 23:08:13 +00:00
|
|
|
}
|
|
|
|
std::string MDFN_GetSettingS(const char *name)
|
|
|
|
{
|
2020-05-24 21:56:43 +00:00
|
|
|
char tmp[SETTING_VALUE_MAX_LENGTH];
|
|
|
|
FrontendSettingQuery(name, tmp);
|
|
|
|
return std::string(tmp);
|
2020-05-21 23:08:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MDFNMP_Init(uint32 ps, uint32 numpages)
|
|
|
|
{}
|
|
|
|
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM, bool use_in_search) // Deprecated
|
|
|
|
{}
|
|
|
|
void MDFNMP_RegSearchable(uint32 addr, uint32 size)
|
|
|
|
{}
|
|
|
|
void MDFNMP_Kill(void)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void MDFN_LoadGameCheats(Stream* override)
|
|
|
|
{}
|
|
|
|
void MDFNMP_InstallReadPatches(void)
|
|
|
|
{}
|
|
|
|
void MDFNMP_RemoveReadPatches(void)
|
|
|
|
{}
|
|
|
|
void MDFNMP_ApplyPeriodicCheats(void)
|
|
|
|
{}
|
2020-05-22 22:01:48 +00:00
|
|
|
std::vector<SUBCHEAT> SubCheats[8];
|
|
|
|
bool SubCheatsOn;
|
2020-05-21 23:08:13 +00:00
|
|
|
|
2020-05-21 23:24:50 +00:00
|
|
|
// player.h
|
|
|
|
void Player_Init(int tsongs, const std::string &album, const std::string &artist, const std::string ©right, const std::vector<std::string> &snames, bool override_gi)
|
|
|
|
{}
|
|
|
|
void Player_Draw(MDFN_Surface *surface, MDFN_Rect *dr, int CurrentSong, int16 *samples, int32 sampcount)
|
|
|
|
{}
|
|
|
|
}
|