video: Rotation Direction in SPD (#1065)
This commit is contained in:
@@ -55,6 +55,7 @@ static char mame_root[kBigTextSize];
|
||||
static char arcade_setname[kBigTextSize] = {};
|
||||
|
||||
static bool is_vertical = false;
|
||||
static int rotation_dir = 0; // 0 = None, 1 = CW, 2 = CCW
|
||||
|
||||
static sw_struct switches = {};
|
||||
|
||||
@@ -1057,6 +1058,7 @@ static int xml_read_pre_parse(XMLEvent evt, const XMLNode* node, SXML_CHAR* text
|
||||
foundsetname = false;
|
||||
foundrotation = false;
|
||||
samedir = 0;
|
||||
rotation_dir = 0;
|
||||
break;
|
||||
|
||||
case XML_EVENT_START_NODE:
|
||||
@@ -1087,6 +1089,28 @@ static int xml_read_pre_parse(XMLEvent evt, const XMLNode* node, SXML_CHAR* text
|
||||
if(inrotation)
|
||||
{
|
||||
is_vertical = strncasecmp(text, "vertical", 8) == 0;
|
||||
|
||||
rotation_dir = 0;
|
||||
if (is_vertical)
|
||||
{
|
||||
// Check for CCW first (must check before CW since "ccw" contains "cw")
|
||||
if (strstr(text, "ccw") || strstr(text, "CCW") ||
|
||||
strstr(text, "counterclockwise") || strstr(text, "counter-clockwise"))
|
||||
{
|
||||
rotation_dir = 2;
|
||||
}
|
||||
// Then check for CW
|
||||
else if (strstr(text, "cw") || strstr(text, "CW") ||
|
||||
strstr(text, "clockwise"))
|
||||
{
|
||||
rotation_dir = 1;
|
||||
}
|
||||
// Default to CW if no direction specified
|
||||
else
|
||||
{
|
||||
rotation_dir = 1; // Fallback to CW if no direction is declared
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1172,6 +1196,11 @@ bool arcade_is_vertical()
|
||||
return is_vertical;
|
||||
}
|
||||
|
||||
int arcade_get_direction()
|
||||
{
|
||||
return rotation_dir;
|
||||
}
|
||||
|
||||
void arcade_check_error()
|
||||
{
|
||||
if (arcade_error_msg[0] != 0) {
|
||||
|
||||
@@ -64,6 +64,7 @@ void arcade_sw_load();
|
||||
void arcade_pre_parse(const char *xml);
|
||||
|
||||
bool arcade_is_vertical();
|
||||
int arcade_get_direction();
|
||||
|
||||
void arcade_nvm_save();
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "offload.h"
|
||||
|
||||
#include "support.h"
|
||||
#include "support/arcade/mra_loader.h"
|
||||
#include "lib/imlib2/Imlib2.h"
|
||||
#include "lib/md5/md5.h"
|
||||
|
||||
@@ -2969,7 +2970,7 @@ static void spd_config_update()
|
||||
cfg.direct_video ? 'D' : 'V',
|
||||
cfg.direct_video ? 'V' : 'I',
|
||||
cfg.direct_video ? '1' : '1', // version
|
||||
(uint8_t)((vi->interlaced ? 1 : 0) | (menu_present() ? 4 : 0) | (vi->rotated ? 8 : 0)),
|
||||
(uint8_t)((vi->interlaced ? 1 : 0) | (menu_present() ? 4 : 0) | (vi->rotated ? 8 : 0) | (cfg.direct_video ? (arcade_get_direction() << 4) : 0)),
|
||||
(uint8_t)(vi->pixrep ? vi->pixrep : (vi->ctime / vi->width)),
|
||||
(uint8_t)vi->de_h,
|
||||
(uint8_t)(vi->de_h >> 8),
|
||||
|
||||
Reference in New Issue
Block a user