mirror of
https://github.com/libretro/beetle-wswan-libretro.git
synced 2024-11-27 10:10:47 +00:00
Avoid using configs. Requires system dir.
This commit is contained in:
parent
8ee82e3878
commit
1ad1474089
10
Makefile
10
Makefile
@ -1,4 +1,6 @@
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
@ -130,8 +132,14 @@ OBJECTS := $(SOURCES:.cpp=.o) $(SOURCES_C:.c=.o)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
FLAGS += -O3 -ffast-math -funroll-loops
|
||||
else
|
||||
FLAGS += -O0 -g
|
||||
endif
|
||||
|
||||
LDFLAGS += $(fpic) -lz $(SHARED)
|
||||
FLAGS += -ffast-math -msse -msse2 -funroll-loops -O3 -g -Wall $(fpic) -fno-strict-overflow
|
||||
FLAGS += -msse -msse2 -Wall $(fpic) -fno-strict-overflow
|
||||
FLAGS += -I. -Imednafen -Imednafen/include -Imednafen/intl
|
||||
|
||||
WARNINGS := -Wall \
|
||||
|
48
libretro.cpp
48
libretro.cpp
@ -5,12 +5,6 @@
|
||||
#include <iostream>
|
||||
#include "libretro.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static MDFNGI *game;
|
||||
static retro_video_refresh_t video_cb;
|
||||
static retro_audio_sample_t audio_cb;
|
||||
@ -23,6 +17,7 @@ static MDFN_Surface *surf;
|
||||
|
||||
static uint16_t conv_buf[680 * 480] __attribute__((aligned(16)));
|
||||
static uint32_t mednafen_buf[680 * 480] __attribute__((aligned(16)));
|
||||
static bool failed_init;
|
||||
|
||||
void retro_init()
|
||||
{
|
||||
@ -33,28 +28,36 @@ void retro_init()
|
||||
MDFNI_InitializeModules(ext);
|
||||
|
||||
const char *dir = NULL;
|
||||
std::string home;
|
||||
|
||||
std::vector<MDFNSetting> settings;
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
||||
{
|
||||
home = dir;
|
||||
home += "/mednafen";
|
||||
std::string eu_path = dir;
|
||||
eu_path += "/scph5502.bin";
|
||||
|
||||
std::string jp_path = dir;
|
||||
jp_path += "/scph5500.bin";
|
||||
|
||||
std::string na_path = dir;
|
||||
na_path += "/scph5501.bin";
|
||||
|
||||
MDFNSetting jp_setting = { "psx.bios_jp", MDFNSF_EMU_STATE, "SCPH-5500 BIOS", NULL, MDFNST_STRING, jp_path.c_str() };
|
||||
MDFNSetting eu_setting = { "psx.bios_eu", MDFNSF_EMU_STATE, "SCPH-5502 BIOS", NULL, MDFNST_STRING, eu_path.c_str() };
|
||||
MDFNSetting na_setting = { "psx.bios_na", MDFNSF_EMU_STATE, "SCPH-5501 BIOS", NULL, MDFNST_STRING, na_path.c_str() };
|
||||
MDFNSetting filesys = { "filesys.path_sav", MDFNSF_NOFLAGS, "Memcards", NULL, MDFNST_STRING, "." };
|
||||
settings.push_back(jp_setting);
|
||||
settings.push_back(eu_setting);
|
||||
settings.push_back(na_setting);
|
||||
settings.push_back(filesys);
|
||||
MDFNI_Initialize(dir, settings);
|
||||
}
|
||||
else // Use "default" mednafen behavior.
|
||||
else
|
||||
{
|
||||
home = getenv("HOME");
|
||||
home += "/.mednafen";
|
||||
fprintf(stderr, "System directory is not defined. Cannot continue ...\n");
|
||||
failed_init = true;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
mkdir(home.c_str(), 0755);
|
||||
#else
|
||||
_mkdir(home.c_str());
|
||||
#endif
|
||||
|
||||
std::vector<MDFNSetting> settings;
|
||||
MDFNI_Initialize(home.c_str(), settings);
|
||||
|
||||
// Hints that we need a fairly powerful system to run this.
|
||||
unsigned level = 3;
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
|
||||
@ -78,6 +81,9 @@ bool retro_load_game_special(unsigned, const struct retro_game_info *, size_t)
|
||||
|
||||
bool retro_load_game(const struct retro_game_info *info)
|
||||
{
|
||||
if (failed_init)
|
||||
return false;
|
||||
|
||||
game = MDFNI_LoadGame("psx", info->path);
|
||||
return game;
|
||||
}
|
||||
|
@ -1095,13 +1095,14 @@ int MDFNI_Initialize(const char *basedir, const std::vector<MDFNSetting> &Driver
|
||||
dynamic_settings.push_back(setting);
|
||||
}
|
||||
|
||||
if(DriverSettings.size())
|
||||
MDFN_MergeSettings(DriverSettings);
|
||||
|
||||
// First merge all settable settings, then load the settings from the SETTINGS FILE OF DOOOOM
|
||||
MDFN_MergeSettings(MednafenSettings);
|
||||
MDFN_MergeSettings(dynamic_settings);
|
||||
MDFN_MergeSettings(MDFNMP_Settings);
|
||||
|
||||
if(DriverSettings.size())
|
||||
MDFN_MergeSettings(DriverSettings);
|
||||
|
||||
for(unsigned int x = 0; x < MDFNSystems.size(); x++)
|
||||
{
|
||||
|
@ -373,7 +373,8 @@ static INLINE void MergeSettingSub(const MDFNSetting *setting)
|
||||
if(FindSetting(setting->name, false, true) != NULL)
|
||||
{
|
||||
printf("Duplicate setting name %s\n", setting->name);
|
||||
abort();
|
||||
//abort();
|
||||
return;
|
||||
}
|
||||
|
||||
name_hash = MakeNameHash(setting->name);
|
||||
|
Loading…
Reference in New Issue
Block a user