From 47741486b8fb61ac644993ee54410667e7c4f58d Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 17 May 2012 14:09:18 +0000 Subject: [PATCH] info.c: added screen tags to xml output, so that it is possible to easily identify which screens depend on optional devices (mostly of use in MESS, for its slot options, but eventually handy for PC-based arcades too) [Fabio Priuli] --- src/emu/info.c | 140 ++++++++++++++++++++++++++----------------------- src/emu/info.h | 2 +- 2 files changed, 75 insertions(+), 67 deletions(-) diff --git a/src/emu/info.c b/src/emu/info.c index af3588818b4..e6b49bf88ed 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -105,6 +105,7 @@ const char info_xml_creator::s_dtd_string[] = "\t\t\t\n" "\t\t\t\n" "\t\t\n" +"\t\t\t\n" "\t\t\t\n" "\t\t\t\n" "\t\t\t\n" @@ -318,7 +319,7 @@ void info_xml_creator::output_one() output_device_roms(); output_sample(); output_chips(m_drivlist.config().root_device(), ""); - output_display(m_drivlist.config().root_device()); + output_display(m_drivlist.config().root_device(), ""); output_sound(m_drivlist.config().root_device()); output_input(portlist); output_switches(portlist, "", IPT_DIPSWITCH, "dipswitch", "dipvalue"); @@ -372,7 +373,7 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) output_rom(device); output_chips(device, devtag); - output_display(device); + output_display(device, devtag); if (has_speaker) output_sound(device); if (has_input) @@ -679,77 +680,84 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag) // displays //------------------------------------------------- -void info_xml_creator::output_display(device_t &device) +void info_xml_creator::output_display(device_t &device, const char *root_tag) { // iterate over screens screen_device_iterator iter(device); for (const screen_device *screendev = iter.first(); screendev != NULL; screendev = iter.next()) { - fprintf(m_output, "\t\tscreen_type()) + if (strcmp(screendev->tag(), device.tag())) { - case SCREEN_TYPE_RASTER: fprintf(m_output, " type=\"raster\""); break; - case SCREEN_TYPE_VECTOR: fprintf(m_output, " type=\"vector\""); break; - case SCREEN_TYPE_LCD: fprintf(m_output, " type=\"lcd\""); break; - default: fprintf(m_output, " type=\"unknown\""); break; + astring newtag(screendev->tag()), oldtag(":"); + newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); + + fprintf(m_output, "\t\tscreen_type()) + { + case SCREEN_TYPE_RASTER: fprintf(m_output, " type=\"raster\""); break; + case SCREEN_TYPE_VECTOR: fprintf(m_output, " type=\"vector\""); break; + case SCREEN_TYPE_LCD: fprintf(m_output, " type=\"lcd\""); break; + default: fprintf(m_output, " type=\"unknown\""); break; + } + + // output the orientation as a string + switch (m_drivlist.driver().flags & ORIENTATION_MASK) + { + case ORIENTATION_FLIP_X: + fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); + break; + case ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); + break; + case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"180\""); + break; + case ORIENTATION_SWAP_XY: + fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: + fprintf(m_output, " rotate=\"90\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"270\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); + break; + default: + fprintf(m_output, " rotate=\"0\""); + break; + } + + // output width and height only for games that are not vector + if (screendev->screen_type() != SCREEN_TYPE_VECTOR) + { + const rectangle &visarea = screendev->visible_area(); + fprintf(m_output, " width=\"%d\"", visarea.width()); + fprintf(m_output, " height=\"%d\"", visarea.height()); + } + + // output refresh rate + fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds())); + + // output raw video parameters only for games that are not vector + // and had raw parameters specified + if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied()) + { + int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()); + + fprintf(m_output, " pixclock=\"%d\"", pixclock); + fprintf(m_output, " htotal=\"%d\"", screendev->width()); + fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x); + fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1); + fprintf(m_output, " vtotal=\"%d\"", screendev->height()); + fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y); + fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1); + } + fprintf(m_output, " />\n"); } - - // output the orientation as a string - switch (m_drivlist.driver().flags & ORIENTATION_MASK) - { - case ORIENTATION_FLIP_X: - fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); - break; - case ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); - break; - case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"180\""); - break; - case ORIENTATION_SWAP_XY: - fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: - fprintf(m_output, " rotate=\"90\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"270\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); - break; - default: - fprintf(m_output, " rotate=\"0\""); - break; - } - - // output width and height only for games that are not vector - if (screendev->screen_type() != SCREEN_TYPE_VECTOR) - { - const rectangle &visarea = screendev->visible_area(); - fprintf(m_output, " width=\"%d\"", visarea.width()); - fprintf(m_output, " height=\"%d\"", visarea.height()); - } - - // output refresh rate - fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds())); - - // output raw video parameters only for games that are not vector - // and had raw parameters specified - if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied()) - { - int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()); - - fprintf(m_output, " pixclock=\"%d\"", pixclock); - fprintf(m_output, " htotal=\"%d\"", screendev->width()); - fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x); - fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1); - fprintf(m_output, " vtotal=\"%d\"", screendev->height()); - fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y); - fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1); - } - fprintf(m_output, " />\n"); } } diff --git a/src/emu/info.h b/src/emu/info.h index 5deb4946ea7..9a6968fc8d3 100644 --- a/src/emu/info.h +++ b/src/emu/info.h @@ -68,7 +68,7 @@ private: void output_device_roms(); void output_sample(); void output_chips(device_t &device, const char *root_tag); - void output_display(device_t &device); + void output_display(device_t &device, const char *root_tag); void output_sound(device_t &device); void output_input(const ioport_list &portlist); void output_switches(const ioport_list &portlist, const char *root_tag, int type, const char *outertag, const char *innertag);