Add support for booting mra files via bootcore ini setting. Includes lastcore/lastexactcore functionality
Co-authored-by: Zakk <zakk@rsdio.com>
This commit is contained in:
13
bootcore.cpp
13
bootcore.cpp
@@ -10,13 +10,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
extern int arcade_load(const char *xml);
|
||||
int16_t btimeout;
|
||||
char bootcoretype[64];
|
||||
|
||||
bool isExactcoreName(char *path)
|
||||
{
|
||||
char *spl = strrchr(path, '.');
|
||||
return (spl && !strcmp(spl, ".rbf"));
|
||||
return (spl && (!strcmp(spl, ".rbf") || !strcmp(spl, ".mra")));
|
||||
}
|
||||
|
||||
char *getcoreName(char *path)
|
||||
@@ -103,8 +105,7 @@ char* loadLastcore()
|
||||
long size = ftell(fd);
|
||||
|
||||
fseek(fd, 0L, SEEK_SET);
|
||||
char *lastcore = new char[size + 1];
|
||||
|
||||
char *lastcore = new char[size + 1]();
|
||||
int ret = fread(lastcore, sizeof(char), size, fd);
|
||||
fclose(fd);
|
||||
if (ret == size)
|
||||
@@ -147,7 +148,7 @@ char *findCore(const char *name, char *coreName, int indent)
|
||||
snprintf(path, 256, "%s/%s", name, entry->d_name);
|
||||
if (strstr(path, coreName) != NULL) {
|
||||
spl = strrchr(path, '.');
|
||||
if (spl && !strcmp(spl, ".rbf"))
|
||||
if (spl && (!strcmp(spl, ".rbf") || !strcmp(spl, ".mra")))
|
||||
{
|
||||
closedir(dir);
|
||||
return path;
|
||||
@@ -205,7 +206,7 @@ void bootcore_init(const char *path)
|
||||
{
|
||||
if (!cfg.bootcore_timeout)
|
||||
{
|
||||
fpga_load_rbf(bootcore);
|
||||
isMraName(bootcore) ? arcade_load(bootcore) : fpga_load_rbf(bootcore);
|
||||
}
|
||||
|
||||
strcpy(cfg.bootcore, strcmp(bootcore, "menu.rbf") ? bootcore : "");
|
||||
@@ -218,7 +219,7 @@ void bootcore_init(const char *path)
|
||||
{
|
||||
|
||||
strcpy(auxstr, path);
|
||||
auxpointer = !strcmp(cfg.bootcore, "lastexactcore") ? getcoreExactName(auxstr) : getcoreName(auxstr);
|
||||
auxpointer = (!strcmp(cfg.bootcore, "lastexactcore") || isMraName(auxstr)) ? getcoreExactName(auxstr) : getcoreName(auxstr);
|
||||
|
||||
if (auxpointer != NULL)
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@ void bootcore_init(const char *path);
|
||||
extern char bootcoretype[64];
|
||||
extern int16_t btimeout;
|
||||
|
||||
#endif // __BOOTCORE_H__
|
||||
#endif // __BOOTCORE_H__
|
||||
|
||||
@@ -1583,3 +1583,10 @@ direntext_t* flist_SelectedItem()
|
||||
{
|
||||
return &DirItem[iSelectedEntry];
|
||||
}
|
||||
|
||||
bool isMraName(char *path)
|
||||
{
|
||||
char *spl = strrchr(path, '.');
|
||||
return (spl && !strcmp(spl, ".mra"));
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ const char *getRootDir();
|
||||
const char *getFullPath(const char *name);
|
||||
|
||||
uint32_t getFileType(const char *name);
|
||||
bool isMraName(char *path);
|
||||
|
||||
|
||||
#define COEFF_DIR "filters"
|
||||
#define GAMMA_DIR "gamma"
|
||||
|
||||
7
menu.cpp
7
menu.cpp
@@ -52,13 +52,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "cfg.h"
|
||||
#include "input.h"
|
||||
#include "battery.h"
|
||||
#include "bootcore.h"
|
||||
#include "cheats.h"
|
||||
#include "video.h"
|
||||
#include "joymapping.h"
|
||||
#include "recent.h"
|
||||
|
||||
#include "support.h"
|
||||
#include "bootcore.h"
|
||||
|
||||
/*menu states*/
|
||||
enum MENU
|
||||
@@ -777,7 +776,7 @@ const char* get_rbf_name_bootcore(char *str)
|
||||
if (!p) return str;
|
||||
|
||||
char *spl = strrchr(p + 1, '.');
|
||||
if (spl && !strcmp(spl, ".rbf"))
|
||||
if (spl && (!strcmp(spl, ".rbf") || !strcmp(spl, ".mra")))
|
||||
{
|
||||
*spl = 0;
|
||||
}
|
||||
@@ -4909,7 +4908,7 @@ void HandleUI(void)
|
||||
PrintFileName(str, 14, 0);
|
||||
sprintf(str, " Loading...");
|
||||
OsdWrite(15, str, 1, 0);
|
||||
fpga_load_rbf(cfg.bootcore);
|
||||
isMraName(cfg.bootcore) ? arcade_load(getFullPath(cfg.bootcore)) : fpga_load_rbf(cfg.bootcore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ void user_io_init(const char *path, const char *xml)
|
||||
MiSTer_ini_parse();
|
||||
if (cfg.bootcore[0] != '\0')
|
||||
{
|
||||
bootcore_init(path);
|
||||
bootcore_init(xml ? xml : path);
|
||||
}
|
||||
|
||||
video_mode_load();
|
||||
|
||||
Reference in New Issue
Block a user