src/mame/mame.c
| r0 | r13285 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | mame.c |
| 4 | |
| 5 | Specific (per target) constants |
| 6 | |
| 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | ****************************************************************************/ |
| 11 | #include "emu.h" |
| 12 | |
| 13 | #define APPNAME "MAME" |
| 14 | #define APPNAME_LOWER "mame" |
| 15 | #define CONFIGNAME "mame" |
| 16 | #define APPLONGNAME "M.A.M.E." |
| 17 | #define FULLLONGNAME "Multiple Arcade Machine Emulator" |
| 18 | #define CAPGAMENOUN "GAME" |
| 19 | #define CAPSTARTGAMENOUN "Game" |
| 20 | #define GAMENOUN "game" |
| 21 | #define GAMESNOUN "games" |
| 22 | #define COPYRIGHT "Copyright Nicola Salmoria\nand the MAME team\nhttp://mamedev.org" |
| 23 | #define COPYRIGHT_INFO "Copyright Nicola Salmoria and the MAME team" |
| 24 | #define DISCLAIMER "MAME is an emulator: it reproduces, more or less faithfully, the behaviour of\n" \ |
| 25 | "several arcade machines. But hardware is useless without software, so an image\n" \ |
| 26 | "of the ROMs which run on that hardware is required. Such ROMs, like any other\n" \ |
| 27 | "commercial software, are copyrighted material and it is therefore illegal to\n" \ |
| 28 | "use them if you don't own the original arcade machine. Needless to say, ROMs\n" \ |
| 29 | "are not distributed together with MAME. Distribution of MAME together with ROM\n" \ |
| 30 | "images is a violation of copyright law and should be promptly reported to the\n" \ |
| 31 | "authors so that appropriate legal action can be taken.\n" |
| 32 | #define USAGE "Usage: %s [%s] [options]" |
| 33 | #define XML_ROOT "mame" |
| 34 | #define XML_TOP "game" |
| 35 | #define STATE_MAGIC_NUM "MAMESAVE" |
| 36 | |
| 37 | const char * emulator_info::get_appname() { return APPNAME;} |
| 38 | const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;} |
| 39 | const char * emulator_info::get_configname() { return CONFIGNAME;} |
| 40 | const char * emulator_info::get_applongname() { return APPLONGNAME;} |
| 41 | const char * emulator_info::get_fulllongname() { return FULLLONGNAME;} |
| 42 | const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;} |
| 43 | const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;} |
| 44 | const char * emulator_info::get_gamenoun() { return GAMENOUN;} |
| 45 | const char * emulator_info::get_gamesnoun() { return GAMESNOUN;} |
| 46 | const char * emulator_info::get_copyright() { return COPYRIGHT;} |
| 47 | const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;} |
| 48 | const char * emulator_info::get_disclaimer() { return DISCLAIMER;} |
| 49 | const char * emulator_info::get_usage() { return USAGE;} |
| 50 | const char * emulator_info::get_xml_root() { return XML_ROOT;} |
| 51 | const char * emulator_info::get_xml_top() { return XML_TOP;} |
| 52 | const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;} |
| 53 | void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); } |
src/emu/uimenu.c
| r13284 | r13285 | |
| 250 | 250 | static render_texture *arrow_texture; |
| 251 | 251 | |
| 252 | 252 | static const char priortext[] = "Return to Prior Menu"; |
| 253 | | static const char backtext[] = "Return to " CAPSTARTGAMENOUN; |
| 254 | 253 | static const char exittext[] = "Exit"; |
| 255 | 254 | |
| 256 | 255 | // temporary hack until this is C++-ified |
| r13284 | r13285 | |
| 521 | 520 | menu->numitems = 0; |
| 522 | 521 | menu->visitems = 0; |
| 523 | 522 | menu->selected = 0; |
| 523 | astring backtext; |
| 524 | backtext.printf("Return to %s",emulator_info::get_capstartgamenoun()); |
| 524 | 525 | |
| 525 | 526 | /* add an item to return */ |
| 526 | 527 | if (menu->parent == NULL) |
| 527 | | ui_menu_item_append(menu, backtext, NULL, 0, NULL); |
| 528 | ui_menu_item_append(menu, backtext.cstr(), NULL, 0, NULL); |
| 528 | 529 | else if (menu->parent->handler == menu_quit_game) |
| 529 | 530 | ui_menu_item_append(menu, exittext, NULL, 0, NULL); |
| 530 | 531 | else |
| r13284 | r13285 | |
| 1638 | 1639 | int has_configs = FALSE; |
| 1639 | 1640 | int has_analog = FALSE; |
| 1640 | 1641 | int has_dips = FALSE; |
| 1641 | | |
| 1642 | astring menu_text; |
| 1642 | 1643 | /* scan the input port array to see what options we need to enable */ |
| 1643 | 1644 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1644 | 1645 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) |
| r13284 | r13285 | |
| 1652 | 1653 | } |
| 1653 | 1654 | |
| 1654 | 1655 | /* add input menu items */ |
| 1655 | | ui_menu_item_append(menu, "Input (general)", NULL, 0, (void *)menu_input_groups); |
| 1656 | | ui_menu_item_append(menu, "Input (this " CAPSTARTGAMENOUN ")", NULL, 0, (void *)menu_input_specific); |
| 1656 | ui_menu_item_append(menu, "Input (general)", NULL, 0, (void *)menu_input_groups); |
| 1657 | |
| 1658 | menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun()); |
| 1659 | ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_input_specific); |
| 1657 | 1660 | |
| 1658 | 1661 | /* add optional input-related menus */ |
| 1659 | 1662 | if (has_dips) |
| r13284 | r13285 | |
| 1667 | 1670 | ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, (void *)menu_bookkeeping); |
| 1668 | 1671 | |
| 1669 | 1672 | /* add game info menu */ |
| 1670 | | ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info); |
| 1673 | menu_text.printf("%s Information",emulator_info::get_capstartgamenoun()); |
| 1674 | ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_game_info); |
| 1671 | 1675 | |
| 1672 | 1676 | device_image_interface *image = NULL; |
| 1673 | 1677 | if (machine.devicelist().first(image)) |
| r13284 | r13285 | |
| 1717 | 1721 | ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card); |
| 1718 | 1722 | |
| 1719 | 1723 | /* add reset and exit menus */ |
| 1720 | | ui_menu_item_append(menu, "Select New " CAPSTARTGAMENOUN, NULL, 0, (void *)menu_select_game); |
| 1724 | menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun()); |
| 1725 | ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_select_game); |
| 1721 | 1726 | } |
| 1722 | 1727 | |
| 1723 | 1728 | |
| r13284 | r13285 | |
| 3705 | 3710 | /* if nothing there, add a single multiline item and return */ |
| 3706 | 3711 | if (matchcount == 0) |
| 3707 | 3712 | { |
| 3708 | | ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n" |
| 3709 | | "If this is your first time using "APPNAME", please see the config.txt file in " |
| 3710 | | "the docs directory for information on configuring "APPNAME".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); |
| 3713 | astring txt; |
| 3714 | txt.printf("No %s found. Please check the rompath specified in the %s.ini file.\n\n" |
| 3715 | "If this is your first time using %s, please see the config.txt file in " |
| 3716 | "the docs directory for information on configuring %s.", |
| 3717 | emulator_info::get_gamesnoun(), |
| 3718 | emulator_info::get_configname(), |
| 3719 | emulator_info::get_appname(),emulator_info::get_appname() ); |
| 3720 | ui_menu_item_append(menu, txt.cstr(), NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); |
| 3711 | 3721 | return; |
| 3712 | 3722 | } |
| 3713 | 3723 | |
| r13284 | r13285 | |
| 3868 | 3878 | } |
| 3869 | 3879 | else |
| 3870 | 3880 | { |
| 3871 | | const char *s = COPYRIGHT; |
| 3881 | const char *s = emulator_info::get_copyright(); |
| 3872 | 3882 | line = 0; |
| 3873 | 3883 | int col = 0; |
| 3874 | 3884 | |
| 3875 | 3885 | /* first line is version string */ |
| 3876 | | sprintf(&tempbuf[line++][0], "%s %s", APPLONGNAME, build_version); |
| 3886 | sprintf(&tempbuf[line++][0], "%s %s", emulator_info::get_applongname(), build_version); |
| 3877 | 3887 | |
| 3878 | 3888 | /* output message */ |
| 3879 | 3889 | while (line < ARRAY_LENGTH(tempbuf)) |
src/emu/video.c
| r13284 | r13285 | |
| 337 | 337 | create_snapshot_bitmap(screen); |
| 338 | 338 | |
| 339 | 339 | // add two text entries describing the image |
| 340 | | astring text1(APPNAME, " ", build_version); |
| 340 | astring text1(emulator_info::get_appname(), " ", build_version); |
| 341 | 341 | astring text2(machine().system().manufacturer, " ", machine().system().description); |
| 342 | 342 | png_info pnginfo = { 0 }; |
| 343 | 343 | png_add_text(&pnginfo, "Software", text1); |
| r13284 | r13285 | |
| 1259 | 1259 | png_info pnginfo = { 0 }; |
| 1260 | 1260 | if (m_movie_frame == 0) |
| 1261 | 1261 | { |
| 1262 | | astring text1(APPNAME, " ", build_version); |
| 1262 | astring text1(emulator_info::get_appname(), " ", build_version); |
| 1263 | 1263 | astring text2(machine().system().manufacturer, " ", machine().system().description); |
| 1264 | 1264 | png_add_text(&pnginfo, "Software", text1); |
| 1265 | 1265 | png_add_text(&pnginfo, "System", text2); |
src/emu/ui.c
| r13284 | r13285 | |
| 917 | 917 | /* add a warning if any ROMs were loaded with warnings */ |
| 918 | 918 | if (rom_load_warnings(machine) > 0) |
| 919 | 919 | { |
| 920 | | string.cat("One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n"); |
| 920 | string.cat("One or more ROMs/CHDs for this game are incorrect. The "); |
| 921 | string.cat(emulator_info::get_gamenoun()); |
| 922 | string.cat(" may not run correctly.\n"); |
| 921 | 923 | if (machine.system().flags & WARNING_FLAGS) |
| 922 | 924 | string.cat("\n"); |
| 923 | 925 | } |
| r13284 | r13285 | |
| 925 | 927 | /* if we have at least one warning flag, print the general header */ |
| 926 | 928 | if ((machine.system().flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0) |
| 927 | 929 | { |
| 928 | | string.cat("There are known problems with this " GAMENOUN "\n\n"); |
| 930 | string.cat("There are known problems with this "); |
| 931 | string.cat(emulator_info::get_gamenoun()); |
| 932 | string.cat("\n\n"); |
| 929 | 933 | |
| 930 | 934 | /* add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP */ |
| 931 | | if (rom_load_knownbad(machine) > 0) |
| 932 | | string.cat("One or more ROMs/CHDs for this " GAMENOUN " have not been correctly dumped.\n"); |
| 933 | | |
| 935 | if (rom_load_knownbad(machine) > 0) { |
| 936 | string.cat("One or more ROMs/CHDs for this "); |
| 937 | string.cat(emulator_info::get_gamenoun()); |
| 938 | string.cat(" have not been correctly dumped.\n"); |
| 939 | } |
| 934 | 940 | /* add one line per warning flag */ |
| 935 | 941 | if (input_machine_has_keyboard(machine)) |
| 936 | 942 | string.cat("The keyboard emulation may not be 100% accurate.\n"); |
| r13284 | r13285 | |
| 957 | 963 | /* add the strings for these warnings */ |
| 958 | 964 | if (machine.system().flags & GAME_UNEMULATED_PROTECTION) |
| 959 | 965 | string.cat("The game has protection which isn't fully emulated.\n"); |
| 960 | | if (machine.system().flags & GAME_NOT_WORKING) |
| 961 | | string.cat("\nTHIS " CAPGAMENOUN " DOESN'T WORK. The emulation for this game is not yet complete. " |
| 966 | if (machine.system().flags & GAME_NOT_WORKING) { |
| 967 | string.cat("\nTHIS "); |
| 968 | string.cat(emulator_info::get_capgamenoun()); |
| 969 | string.cat(" DOESN'T WORK. The emulation for this game is not yet complete. " |
| 962 | 970 | "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); |
| 963 | | if (machine.system().flags & GAME_MECHANICAL) |
| 964 | | string.cat("\nCertain elements of this " GAMENOUN " cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " |
| 965 | | "It is not possible to fully play this " GAMENOUN ".\n"); |
| 971 | } |
| 972 | if (machine.system().flags & GAME_MECHANICAL) { |
| 973 | string.cat("\nCertain elements of this "); |
| 974 | string.cat(emulator_info::get_gamenoun()); |
| 975 | string.cat(" cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " |
| 976 | "It is not possible to fully play this "); |
| 977 | string.cat(emulator_info::get_gamenoun()); |
| 978 | string.cat(".\n"); |
| 979 | } |
| 966 | 980 | |
| 967 | 981 | /* find the parent of this driver */ |
| 968 | 982 | driver_enumerator drivlist(machine.options()); |
src/emu/clifront.c
| r13284 | r13285 | |
| 268 | 268 | |
| 269 | 269 | // print them out |
| 270 | 270 | fprintf(stderr, "\n\"%s\" approximately matches the following\n" |
| 271 | | "supported " GAMESNOUN " (best match first):\n\n", m_options.system_name()); |
| 271 | "supported %s (best match first):\n\n", m_options.system_name(),emulator_info::get_gamesnoun()); |
| 272 | 272 | for (int matchnum = 0; matchnum < ARRAY_LENGTH(matches); matchnum++) |
| 273 | 273 | if (matches[matchnum] != -1) |
| 274 | 274 | fprintf(stderr, "%-18s%s\n", drivlist.driver(matches[matchnum]).name, drivlist.driver(matches[matchnum]).description); |
| r13284 | r13285 | |
| 1300 | 1300 | if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0) |
| 1301 | 1301 | { |
| 1302 | 1302 | astring helpstring; |
| 1303 | | mame_printf_info(USAGE "\n\nOptions:\n%s", exename, GAMENOUN, m_options.output_help(helpstring)); |
| 1303 | emulator_info::printf_usage(exename, emulator_info::get_gamenoun()); |
| 1304 | mame_printf_info("\n\nOptions:\n%s", m_options.output_help(helpstring)); |
| 1304 | 1305 | return; |
| 1305 | 1306 | } |
| 1306 | 1307 | |
| r13284 | r13285 | |
| 1322 | 1323 | { |
| 1323 | 1324 | // attempt to open the output file |
| 1324 | 1325 | emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); |
| 1325 | | if (file.open(CONFIGNAME ".ini") != FILERR_NONE) |
| 1326 | | throw emu_fatalerror("Unable to create file " CONFIGNAME ".ini\n"); |
| 1326 | if (file.open(emulator_info::get_configname(), ".ini") != FILERR_NONE) |
| 1327 | throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname()); |
| 1327 | 1328 | |
| 1328 | 1329 | // generate the updated INI |
| 1329 | 1330 | astring initext; |
| r13284 | r13285 | |
| 1386 | 1387 | |
| 1387 | 1388 | void cli_frontend::display_help() |
| 1388 | 1389 | { |
| 1389 | | mame_printf_info(APPLONGNAME " v%s - " FULLLONGNAME "\n" |
| 1390 | | COPYRIGHT_INFO "\n\n", build_version); |
| 1391 | | mame_printf_info("%s\n", DISCLAIMER); |
| 1392 | | mame_printf_info(USAGE "\n\n" |
| 1393 | | " " APPNAME " -showusage for a brief list of options\n" |
| 1394 | | " " APPNAME " -showconfig for a list of configuration options\n" |
| 1395 | | " " APPNAME " -listmedia for a full list of supported media\n" |
| 1396 | | " " APPNAME " -createconfig to create a " CONFIGNAME ".ini\n\n" |
| 1397 | | "For usage instructions, please consult the files config.txt and windows.txt.\n",APPNAME,GAMENOUN); |
| 1390 | mame_printf_info("%s v%s - %s\n%s\n\n", emulator_info::get_applongname(),build_version,emulator_info::get_fulllongname(),emulator_info::get_copyright_info()); |
| 1391 | mame_printf_info("%s\n", emulator_info::get_disclaimer()); |
| 1392 | emulator_info::printf_usage(emulator_info::get_appname(),emulator_info::get_gamenoun()); |
| 1393 | mame_printf_info("\n\n" |
| 1394 | " %s -showusage for a brief list of options\n" |
| 1395 | " %s -showconfig for a list of configuration options\n" |
| 1396 | " %s -listmedia for a full list of supported media\n" |
| 1397 | " %s -createconfig to create a %s.ini\n\n" |
| 1398 | "For usage instructions, please consult the files config.txt and windows.txt.\n",emulator_info::get_appname(), |
| 1399 | emulator_info::get_appname(),emulator_info::get_appname(),emulator_info::get_appname(),emulator_info::get_configname()); |
| 1398 | 1400 | } |
| 1399 | 1401 | |
| 1400 | 1402 | |
src/emu/info.c
| r13284 | r13285 | |
| 53 | 53 | |
| 54 | 54 | // DTD string describing the data |
| 55 | 55 | const char info_xml_creator::s_dtd_string[] = |
| 56 | | "<!DOCTYPE " XML_ROOT " [\n" |
| 57 | | "<!ELEMENT " XML_ROOT " (" XML_TOP "+)>\n" |
| 58 | | "\t<!ATTLIST " XML_ROOT " build CDATA #IMPLIED>\n" |
| 59 | | "\t<!ATTLIST " XML_ROOT " debug (yes|no) \"no\">\n" |
| 60 | | "\t<!ATTLIST " XML_ROOT " mameconfig CDATA #REQUIRED>\n" |
| 61 | | "\t<!ELEMENT " XML_TOP " (description, year?, manufacturer?, biosset*, rom*, disk*, device_ref*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, adjuster*, driver?, device*, slot*, softwarelist*, ramoption*)>\n" |
| 62 | | "\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n" |
| 63 | | "\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n" |
| 64 | | "\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n" |
| 65 | | "\t\t<!ATTLIST " XML_TOP " isdevice (yes|no) \"no\">\n" |
| 66 | | "\t\t<!ATTLIST " XML_TOP " ismechanical (yes|no) \"no\">\n" |
| 67 | | "\t\t<!ATTLIST " XML_TOP " runnable (yes|no) \"yes\">\n" |
| 68 | | "\t\t<!ATTLIST " XML_TOP " cloneof CDATA #IMPLIED>\n" |
| 69 | | "\t\t<!ATTLIST " XML_TOP " romof CDATA #IMPLIED>\n" |
| 70 | | "\t\t<!ATTLIST " XML_TOP " sampleof CDATA #IMPLIED>\n" |
| 56 | "<!DOCTYPE __XML_ROOT__ [\n" |
| 57 | "<!ELEMENT __XML_ROOT__ (__XML_TOP__+)>\n" |
| 58 | "\t<!ATTLIST __XML_ROOT__ build CDATA #IMPLIED>\n" |
| 59 | "\t<!ATTLIST __XML_ROOT__ debug (yes|no) \"no\">\n" |
| 60 | "\t<!ATTLIST __XML_ROOT__ mameconfig CDATA #REQUIRED>\n" |
| 61 | "\t<!ELEMENT __XML_TOP__ (description, year?, manufacturer?, biosset*, rom*, disk*, device_ref*, sample*, chip*, display*, sound?, input?, dipswitch*, configuration*, adjuster*, driver?, device*, slot*, softwarelist*, ramoption*)>\n" |
| 62 | "\t\t<!ATTLIST __XML_TOP__ name CDATA #REQUIRED>\n" |
| 63 | "\t\t<!ATTLIST __XML_TOP__ sourcefile CDATA #IMPLIED>\n" |
| 64 | "\t\t<!ATTLIST __XML_TOP__ isbios (yes|no) \"no\">\n" |
| 65 | "\t\t<!ATTLIST __XML_TOP__ isdevice (yes|no) \"no\">\n" |
| 66 | "\t\t<!ATTLIST __XML_TOP__ ismechanical (yes|no) \"no\">\n" |
| 67 | "\t\t<!ATTLIST __XML_TOP__ runnable (yes|no) \"yes\">\n" |
| 68 | "\t\t<!ATTLIST __XML_TOP__ cloneof CDATA #IMPLIED>\n" |
| 69 | "\t\t<!ATTLIST __XML_TOP__ romof CDATA #IMPLIED>\n" |
| 70 | "\t\t<!ATTLIST __XML_TOP__ sampleof CDATA #IMPLIED>\n" |
| 71 | 71 | "\t\t<!ELEMENT description (#PCDATA)>\n" |
| 72 | 72 | "\t\t<!ELEMENT year (#PCDATA)>\n" |
| 73 | 73 | "\t\t<!ELEMENT manufacturer (#PCDATA)>\n" |
| r13284 | r13285 | |
| 214 | 214 | |
| 215 | 215 | // output the DTD |
| 216 | 216 | fprintf(m_output, "<?xml version=\"1.0\"?>\n"); |
| 217 | | fprintf(m_output, "%s\n\n", s_dtd_string); |
| 217 | astring dtd(s_dtd_string); |
| 218 | dtd.replace(0,"__XML_ROOT__", emulator_info::get_xml_root()); |
| 219 | dtd.replace(0,"__XML_TOP__", emulator_info::get_xml_top()); |
| 220 | |
| 221 | fprintf(m_output, "%s\n\n", dtd.cstr()); |
| 218 | 222 | |
| 219 | 223 | // top-level tag |
| 220 | | fprintf(m_output, "<" XML_ROOT " build=\"%s\" debug=\"" |
| 224 | fprintf(m_output, "<%s build=\"%s\" debug=\"" |
| 221 | 225 | #ifdef MAME_DEBUG |
| 222 | 226 | "yes" |
| 223 | 227 | #else |
| 224 | 228 | "no" |
| 225 | 229 | #endif |
| 226 | 230 | "\" mameconfig=\"%d\">\n", |
| 231 | emulator_info::get_xml_root(), |
| 227 | 232 | xml_normalize_string(build_version), |
| 228 | 233 | CONFIG_VERSION |
| 229 | 234 | ); |
| r13284 | r13285 | |
| 240 | 245 | global_free(m_device_used); |
| 241 | 246 | |
| 242 | 247 | // close the top level tag |
| 243 | | fprintf(m_output, "</" XML_ROOT ">\n"); |
| 248 | fprintf(m_output, "</%s>\n",emulator_info::get_xml_root()); |
| 244 | 249 | } |
| 245 | 250 | |
| 246 | 251 | |
| r13284 | r13285 | |
| 264 | 269 | dev->config_complete(); |
| 265 | 270 | |
| 266 | 271 | // print the header and the game name |
| 267 | | fprintf(m_output, "\t<" XML_TOP); |
| 272 | fprintf(m_output, "\t<%s",emulator_info::get_xml_top()); |
| 268 | 273 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname())); |
| 269 | 274 | fprintf(m_output, " isdevice=\"yes\""); |
| 270 | 275 | fprintf(m_output, " runnable=\"no\""); |
| r13284 | r13285 | |
| 277 | 282 | output_rom(dev); |
| 278 | 283 | |
| 279 | 284 | // close the topmost tag |
| 280 | | fprintf(m_output, "\t</" XML_TOP ">\n"); |
| 285 | fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top()); |
| 281 | 286 | global_free(dev); |
| 282 | 287 | } |
| 283 | 288 | } |
| r13284 | r13285 | |
| 303 | 308 | input_port_list_init(*device, portlist, errors); |
| 304 | 309 | |
| 305 | 310 | // print the header and the game name |
| 306 | | fprintf(m_output, "\t<" XML_TOP); |
| 311 | fprintf(m_output, "\t<%s",emulator_info::get_xml_top()); |
| 307 | 312 | fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name)); |
| 308 | 313 | |
| 309 | 314 | // strip away any path information from the source_file and output it |
| r13284 | r13285 | |
| 364 | 369 | output_ramoptions(); |
| 365 | 370 | |
| 366 | 371 | // close the topmost tag |
| 367 | | fprintf(m_output, "\t</" XML_TOP ">\n"); |
| 372 | fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top()); |
| 368 | 373 | } |
| 369 | 374 | |
| 370 | 375 | //------------------------------------------------ |
src/emu/mame.h
| r13284 | r13285 | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | |
| 45 | | // MESS vs. MAME abstractions |
| 46 | | #ifndef MESS |
| 47 | | #define APPNAME "MAME" |
| 48 | | #define APPNAME_LOWER "mame" |
| 49 | | #define CONFIGNAME "mame" |
| 50 | | #define APPLONGNAME "M.A.M.E." |
| 51 | | #define FULLLONGNAME "Multiple Arcade Machine Emulator" |
| 52 | | #define CAPGAMENOUN "GAME" |
| 53 | | #define CAPSTARTGAMENOUN "Game" |
| 54 | | #define GAMENOUN "game" |
| 55 | | #define GAMESNOUN "games" |
| 56 | | #define COPYRIGHT "Copyright Nicola Salmoria\nand the MAME team\nhttp://mamedev.org" |
| 57 | | #define COPYRIGHT_INFO "Copyright Nicola Salmoria and the MAME team" |
| 58 | | #define DISCLAIMER "MAME is an emulator: it reproduces, more or less faithfully, the behaviour of\n" \ |
| 59 | | "several arcade machines. But hardware is useless without software, so an image\n" \ |
| 60 | | "of the ROMs which run on that hardware is required. Such ROMs, like any other\n" \ |
| 61 | | "commercial software, are copyrighted material and it is therefore illegal to\n" \ |
| 62 | | "use them if you don't own the original arcade machine. Needless to say, ROMs\n" \ |
| 63 | | "are not distributed together with MAME. Distribution of MAME together with ROM\n" \ |
| 64 | | "images is a violation of copyright law and should be promptly reported to the\n" \ |
| 65 | | "authors so that appropriate legal action can be taken.\n" |
| 66 | | #define USAGE "Usage: %s [%s] [options]" |
| 67 | | #define XML_ROOT "mame" |
| 68 | | #define XML_TOP "game" |
| 69 | | #define STATE_MAGIC_NUM 'M', 'A', 'M', 'E', 'S', 'A', 'V', 'E' |
| 70 | | #else |
| 71 | | #define APPNAME "MESS" |
| 72 | | #define APPNAME_LOWER "mess" |
| 73 | | #define CONFIGNAME "mess" |
| 74 | | #define APPLONGNAME "M.E.S.S." |
| 75 | | #define FULLLONGNAME "Multi Emulator Super System" |
| 76 | | #define CAPGAMENOUN "SYSTEM" |
| 77 | | #define CAPSTARTGAMENOUN "System" |
| 78 | | #define GAMENOUN "system" |
| 79 | | #define GAMESNOUN "systems" |
| 80 | | #define COPYRIGHT "Copyright the MESS team\nhttp://mess.org" |
| 81 | | #define COPYRIGHT_INFO "Copyright the MESS team\n\n" \ |
| 82 | | "MESS is based on MAME Source code\n" \ |
| 83 | | "Copyright Nicola Salmoria and the MAME team" |
| 84 | | #define DISCLAIMER "MESS is an emulator: it reproduces, more or less faithfully, the behaviour of\n"\ |
| 85 | | "several computer and console systems. But hardware is useless without software\n" \ |
| 86 | | "so a file dump of the ROM, cartridges, discs, and cassettes which run on that\n" \ |
| 87 | | "hardware is required. Such files, like any other commercial software, are\n" \ |
| 88 | | "copyrighted material and it is therefore illegal to use them if you don't own\n" \ |
| 89 | | "the original media from which the files are derived. Needless to say, these\n" \ |
| 90 | | "files are not distributed together with MESS. Distribution of MESS together\n" \ |
| 91 | | "with these files is a violation of copyright law and should be promptly\n" \ |
| 92 | | "reported to the authors so that appropriate legal action can be taken.\n" |
| 93 | | #define USAGE "Usage: %s [%s] [media] [software] [options]" |
| 94 | | #define XML_ROOT "mess" |
| 95 | | #define XML_TOP "machine" |
| 96 | | #define STATE_MAGIC_NUM 'M', 'E', 'S', 'S', 'S', 'A', 'V', 'E' |
| 97 | | #endif |
| 98 | 45 | |
| 99 | 46 | |
| 100 | | |
| 101 | 47 | //************************************************************************** |
| 102 | 48 | // TYPE DEFINITIONS |
| 103 | 49 | //************************************************************************** |
| r13284 | r13285 | |
| 105 | 51 | // output channel callback |
| 106 | 52 | typedef void (*output_callback_func)(void *param, const char *format, va_list argptr); |
| 107 | 53 | |
| 54 | class emulator_info |
| 55 | { |
| 56 | public: |
| 57 | // construction/destruction |
| 58 | emulator_info() {}; |
| 108 | 59 | |
| 60 | static const char * get_appname(); |
| 61 | static const char * get_appname_lower(); |
| 62 | static const char * get_configname(); |
| 63 | static const char * get_applongname(); |
| 64 | static const char * get_fulllongname(); |
| 65 | static const char * get_capgamenoun(); |
| 66 | static const char * get_capstartgamenoun(); |
| 67 | static const char * get_gamenoun(); |
| 68 | static const char * get_gamesnoun(); |
| 69 | static const char * get_copyright(); |
| 70 | static const char * get_copyright_info(); |
| 71 | static const char * get_disclaimer(); |
| 72 | static const char * get_usage(); |
| 73 | static const char * get_xml_root(); |
| 74 | static const char * get_xml_top(); |
| 75 | static const char * get_state_magic_num(); |
| 76 | static void printf_usage(const char *par1, const char *par2); |
| 77 | }; |
| 109 | 78 | |
| 110 | 79 | //************************************************************************** |
| 111 | 80 | // GLOBAL VARIABLES |
src/emu/save.c
| r13284 | r13285 | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | |
| 83 | | |
| 84 | 83 | //************************************************************************** |
| 85 | | // GLOBAL VARIABLES |
| 86 | | //************************************************************************** |
| 87 | | |
| 88 | | const char save_manager::s_magic_num[8] = { STATE_MAGIC_NUM }; |
| 89 | | |
| 90 | | //************************************************************************** |
| 91 | 84 | // INITIALIZATION |
| 92 | 85 | //************************************************************************** |
| 93 | 86 | |
| r13284 | r13285 | |
| 244 | 237 | if (file.read(header, sizeof(header)) != sizeof(header)) |
| 245 | 238 | { |
| 246 | 239 | if (errormsg != NULL) |
| 247 | | (*errormsg)("Could not read " APPNAME " save file header"); |
| 240 | (*errormsg)("Could not read %s save file header",emulator_info::get_appname()); |
| 248 | 241 | return STATERR_READ_ERROR; |
| 249 | 242 | } |
| 250 | 243 | |
| r13284 | r13285 | |
| 311 | 304 | |
| 312 | 305 | // generate the header |
| 313 | 306 | UINT8 header[HEADER_SIZE]; |
| 314 | | memcpy(&header[0], s_magic_num, 8); |
| 307 | memcpy(&header[0], emulator_info::get_state_magic_num(), 8); |
| 315 | 308 | header[8] = SAVE_VERSION; |
| 316 | 309 | header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); |
| 317 | 310 | strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a); |
| r13284 | r13285 | |
| 385 | 378 | void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix) |
| 386 | 379 | { |
| 387 | 380 | // check magic number |
| 388 | | if (memcmp(header, s_magic_num, 8)) |
| 381 | if (memcmp(header, emulator_info::get_state_magic_num(), 8)) |
| 389 | 382 | { |
| 390 | 383 | if (errormsg != NULL) |
| 391 | | (*errormsg)("%sThis is not a " APPNAME " save file", error_prefix); |
| 384 | (*errormsg)("%sThis is not a %s save file", error_prefix,emulator_info::get_appname()); |
| 392 | 385 | return STATERR_INVALID_HEADER; |
| 393 | 386 | } |
| 394 | 387 | |
src/mess/mess.c
| r0 | r13285 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | mess.c |
| 4 | |
| 5 | Specific (per target) constants |
| 6 | |
| 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | ****************************************************************************/ |
| 11 | #include "emu.h" |
| 12 | |
| 13 | #define APPNAME "MESS" |
| 14 | #define APPNAME_LOWER "mess" |
| 15 | #define CONFIGNAME "mess" |
| 16 | #define APPLONGNAME "M.E.S.S." |
| 17 | #define FULLLONGNAME "Multi Emulator Super System" |
| 18 | #define CAPGAMENOUN "SYSTEM" |
| 19 | #define CAPSTARTGAMENOUN "System" |
| 20 | #define GAMENOUN "system" |
| 21 | #define GAMESNOUN "systems" |
| 22 | #define COPYRIGHT "Copyright the MESS team\nhttp://mess.org" |
| 23 | #define COPYRIGHT_INFO "Copyright the MESS team\n\n" \ |
| 24 | "MESS is based on MAME Source code\n" \ |
| 25 | "Copyright Nicola Salmoria and the MAME team" |
| 26 | #define DISCLAIMER "MESS is an emulator: it reproduces, more or less faithfully, the behaviour of\n"\ |
| 27 | "several computer and console systems. But hardware is useless without software\n" \ |
| 28 | "so a file dump of the ROM, cartridges, discs, and cassettes which run on that\n" \ |
| 29 | "hardware is required. Such files, like any other commercial software, are\n" \ |
| 30 | "copyrighted material and it is therefore illegal to use them if you don't own\n" \ |
| 31 | "the original media from which the files are derived. Needless to say, these\n" \ |
| 32 | "files are not distributed together with MESS. Distribution of MESS together\n" \ |
| 33 | "with these files is a violation of copyright law and should be promptly\n" \ |
| 34 | "reported to the authors so that appropriate legal action can be taken.\n" |
| 35 | #define USAGE "Usage: %s [%s] [media] [software] [options]" |
| 36 | #define XML_ROOT "mess" |
| 37 | #define XML_TOP "machine" |
| 38 | #define STATE_MAGIC_NUM "MESSSAVE" |
| 39 | |
| 40 | const char * emulator_info::get_appname() { return APPNAME;} |
| 41 | const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;} |
| 42 | const char * emulator_info::get_configname() { return CONFIGNAME;} |
| 43 | const char * emulator_info::get_applongname() { return APPLONGNAME;} |
| 44 | const char * emulator_info::get_fulllongname() { return FULLLONGNAME;} |
| 45 | const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;} |
| 46 | const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;} |
| 47 | const char * emulator_info::get_gamenoun() { return GAMENOUN;} |
| 48 | const char * emulator_info::get_gamesnoun() { return GAMESNOUN;} |
| 49 | const char * emulator_info::get_copyright() { return COPYRIGHT;} |
| 50 | const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;} |
| 51 | const char * emulator_info::get_disclaimer() { return DISCLAIMER;} |
| 52 | const char * emulator_info::get_usage() { return USAGE;} |
| 53 | const char * emulator_info::get_xml_root() { return XML_ROOT;} |
| 54 | const char * emulator_info::get_xml_top() { return XML_TOP;} |
| 55 | const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;} |
| 56 | void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); } |