video: Add support for [arcade_vertical] section (#691)
This commit is contained in:
2
cfg.cpp
2
cfg.cpp
@@ -12,6 +12,7 @@
|
||||
#include "file_io.h"
|
||||
#include "user_io.h"
|
||||
#include "video.h"
|
||||
#include "support/arcade/mra_loader.h"
|
||||
|
||||
cfg_t cfg;
|
||||
|
||||
@@ -193,6 +194,7 @@ static int ini_get_section(char* buf, const char *vmode)
|
||||
|
||||
if (!strcasecmp(buf, "MiSTer") ||
|
||||
(is_arcade() && !strcasecmp(buf, "arcade")) ||
|
||||
(arcade_is_vertical() && !strcasecmp(buf, "arcade_vertical")) ||
|
||||
((wc_pos >= 0) ? !strncasecmp(buf, user_io_get_core_name(1), wc_pos) : !strcasecmp(buf, user_io_get_core_name(1))) ||
|
||||
((wc_pos >= 0) ? !strncasecmp(buf, user_io_get_core_name(0), wc_pos) : !strcasecmp(buf, user_io_get_core_name(0))))
|
||||
{
|
||||
|
||||
@@ -49,6 +49,8 @@ static char arcade_error_msg[kBigTextSize] = {};
|
||||
static char arcade_root[kBigTextSize];
|
||||
static char mame_root[kBigTextSize];
|
||||
|
||||
static bool is_vertical = false;
|
||||
|
||||
static sw_struct switches[2] = {};
|
||||
|
||||
static int nvram_idx = 0;
|
||||
@@ -988,36 +990,49 @@ static int xml_scan_rbf(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
static int xml_read_setname(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, const int n, SAX_Data* sd)
|
||||
static int xml_read_pre_parse(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, const int n, SAX_Data* sd)
|
||||
{
|
||||
(void)(sd);
|
||||
static int insetname = 0;
|
||||
static bool insetname = false;
|
||||
static bool inrotation = false;
|
||||
|
||||
static bool foundsetname = false;
|
||||
static bool foundrotation = false;
|
||||
|
||||
switch (evt)
|
||||
{
|
||||
case XML_EVENT_START_DOC:
|
||||
insetname = 0;
|
||||
insetname = false;
|
||||
inrotation = false;
|
||||
foundsetname = false;
|
||||
foundrotation = false;
|
||||
break;
|
||||
|
||||
case XML_EVENT_START_NODE:
|
||||
|
||||
/* on the beginning of a rom tag, we need to reset the state*/
|
||||
if (!strcasecmp(node->tag, "setname"))
|
||||
{
|
||||
insetname = 1;
|
||||
insetname = true;
|
||||
foundsetname = true;
|
||||
}
|
||||
else if (!strcasecmp(node->tag, "rotation"))
|
||||
{
|
||||
inrotation = true;
|
||||
foundrotation = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_EVENT_TEXT:
|
||||
if(insetname) user_io_name_override(text);
|
||||
if(inrotation)
|
||||
{
|
||||
is_vertical = strncasecmp(text, "vertical", 8) == 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_EVENT_END_NODE:
|
||||
if (!strcasecmp(node->tag, "setname"))
|
||||
{
|
||||
insetname = 0;
|
||||
return false;
|
||||
}
|
||||
insetname = false;
|
||||
inrotation = false;
|
||||
if (foundrotation && foundsetname) return false;
|
||||
break;
|
||||
|
||||
case XML_EVENT_ERROR:
|
||||
@@ -1078,15 +1093,20 @@ int arcade_send_rom(const char *xml)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void arcade_override_name(const char *xml)
|
||||
void arcade_pre_parse(const char *xml)
|
||||
{
|
||||
SAX_Callbacks sax;
|
||||
SAX_Callbacks_init(&sax);
|
||||
|
||||
sax.all_event = xml_read_setname;
|
||||
sax.all_event = xml_read_pre_parse;
|
||||
XMLDoc_parse_file_SAX(xml, &sax, NULL);
|
||||
}
|
||||
|
||||
bool arcade_is_vertical()
|
||||
{
|
||||
return is_vertical;
|
||||
}
|
||||
|
||||
void arcade_check_error()
|
||||
{
|
||||
if (arcade_error_msg[0] != 0) {
|
||||
|
||||
@@ -59,7 +59,11 @@ sw_struct *arcade_sw(int n);
|
||||
void arcade_sw_send(int n);
|
||||
void arcade_sw_save(int n);
|
||||
void arcade_sw_load(int n);
|
||||
void arcade_override_name(const char *xml);
|
||||
|
||||
// Read any mra info necessary for ini processing
|
||||
void arcade_pre_parse(const char *xml);
|
||||
|
||||
bool arcade_is_vertical();
|
||||
|
||||
void arcade_nvm_save();
|
||||
|
||||
|
||||
@@ -1280,7 +1280,7 @@ void user_io_init(const char *path, const char *xml)
|
||||
if (xml)
|
||||
{
|
||||
if (isXmlName(xml) == 1) is_arcade_type = 1;
|
||||
arcade_override_name(xml);
|
||||
arcade_pre_parse(xml);
|
||||
}
|
||||
|
||||
if (core_type == CORE_TYPE_8BIT)
|
||||
@@ -1318,7 +1318,7 @@ void user_io_init(const char *path, const char *xml)
|
||||
xml = (const char*)defmra;
|
||||
strcpy(core_path, xml);
|
||||
is_arcade_type = 1;
|
||||
arcade_override_name(xml);
|
||||
arcade_pre_parse(xml);
|
||||
user_io_read_core_name();
|
||||
printf("Using default MRA: %s\n", xml);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user