Previous 15994 Revisions Next

r13285 Thursday 17th November, 2011 at 10:05:27 UTC by Miodrag Milanović
Move per emulator constants info into separate class (no whatsnew)
[ROOT]makefile
[src/emu]clifront.c emuopts.c info.c ioport.c mame.h romload.c save.c save.h screen.c ui.c uimenu.c video.c
[src/mame]mame.c*
[src/mess]mess.c*
[src/osd/sdl]window.c
[src/osd/windows]d3dhlsl.c window.c winmain.c

src/mame/mame.c
r0r13285
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
37const char * emulator_info::get_appname() { return APPNAME;}
38const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;}
39const char * emulator_info::get_configname() { return CONFIGNAME;}
40const char * emulator_info::get_applongname() { return APPLONGNAME;}
41const char * emulator_info::get_fulllongname() { return FULLLONGNAME;}
42const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;}
43const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;}
44const char * emulator_info::get_gamenoun() { return GAMENOUN;}
45const char * emulator_info::get_gamesnoun() { return GAMESNOUN;}
46const char * emulator_info::get_copyright() { return COPYRIGHT;}
47const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;}
48const char * emulator_info::get_disclaimer() { return DISCLAIMER;}
49const char * emulator_info::get_usage() { return USAGE;}
50const char * emulator_info::get_xml_root() { return XML_ROOT;}
51const char * emulator_info::get_xml_top() { return XML_TOP;}
52const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;}
53void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); }
src/osd/sdl/window.c
r13284r13285
703703
704704   // make the window title
705705   if (video_config.numscreens == 1)
706      sprintf(window->title, APPNAME ": %s [%s]", machine.system().description, machine.system().name);
706      sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
707707   else
708      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine.system().description, machine.system().name, index);
708      sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
709709
710710   wp->window = window;
711711
src/osd/windows/winmain.c
r13284r13285
548548      winwindow_toggle_full_screen();
549549
550550   vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr);
551   win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, APPNAME, MB_OK);
551   win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK);
552552}
553553
554554
src/osd/windows/window.c
r13284r13285
690690
691691   // make the window title
692692   if (video_config.numscreens == 1)
693      sprintf(window->title, APPNAME ": %s [%s]", machine.system().description, machine.system().name);
693      sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
694694   else
695      sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine.system().description, machine.system().name, index);
695      sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
696696
697697   // set the initial maximized state
698698   window->startmaximized = options.maximize();
src/osd/windows/d3dhlsl.c
r13284r13285
400400            return;
401401
402402         // add two text entries describing the image
403         astring text1(APPNAME, " ", build_version);
403         astring text1(emulator_info::get_appname(), " ", build_version);
404404         astring text2(window->machine().system().manufacturer, " ", window->machine().system().description);
405405         png_info pnginfo = { 0 };
406406         png_add_text(&pnginfo, "Software", text1);
src/emu/emuopts.c
r13284r13285
386386
387387   // parse the INI file defined by the platform (e.g., "mame.ini")
388388   // we do this twice so that the first file can change the INI path
389   parse_one_ini(CONFIGNAME, OPTION_PRIORITY_MAME_INI);
390   parse_one_ini(CONFIGNAME, OPTION_PRIORITY_MAME_INI, &error_string);
389   parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI);
390   parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI, &error_string);
391391
392392   // debug mode: parse "debug.ini" as well
393393   if (debug())
src/emu/uimenu.c
r13284r13285
250250static render_texture *arrow_texture;
251251
252252static const char priortext[] = "Return to Prior Menu";
253static const char backtext[] = "Return to " CAPSTARTGAMENOUN;
254253static const char exittext[] = "Exit";
255254
256255// temporary hack until this is C++-ified
r13284r13285
521520   menu->numitems = 0;
522521   menu->visitems = 0;
523522   menu->selected = 0;
523   astring backtext;
524   backtext.printf("Return to %s",emulator_info::get_capstartgamenoun());
524525
525526   /* add an item to return */
526527   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);
528529   else if (menu->parent->handler == menu_quit_game)
529530      ui_menu_item_append(menu, exittext, NULL, 0, NULL);
530531   else
r13284r13285
16381639   int has_configs = FALSE;
16391640   int has_analog = FALSE;
16401641   int has_dips = FALSE;
1641
1642   astring menu_text;
16421643   /* scan the input port array to see what options we need to enable */
16431644   for (port = machine.m_portlist.first(); port != NULL; port = port->next())
16441645      for (field = port->fieldlist().first(); field != NULL; field = field->next())
r13284r13285
16521653      }
16531654
16541655   /* 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);
16571660
16581661   /* add optional input-related menus */
16591662   if (has_dips)
r13284r13285
16671670   ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, (void *)menu_bookkeeping);
16681671
16691672   /* 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);
16711675
16721676   device_image_interface *image = NULL;
16731677   if (machine.devicelist().first(image))
r13284r13285
17171721      ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card);
17181722
17191723   /* 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);
17211726}
17221727
17231728
r13284r13285
37053710   /* if nothing there, add a single multiline item and return */
37063711   if (matchcount == 0)
37073712   {
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);
37113721      return;
37123722   }
37133723
r13284r13285
38683878   }
38693879   else
38703880   {
3871      const char *s = COPYRIGHT;
3881      const char *s = emulator_info::get_copyright();
38723882      line = 0;
38733883      int col = 0;
38743884
38753885      /* 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);
38773887
38783888      /* output message */
38793889      while (line < ARRAY_LENGTH(tempbuf))
src/emu/video.c
r13284r13285
337337   create_snapshot_bitmap(screen);
338338
339339   // add two text entries describing the image
340   astring text1(APPNAME, " ", build_version);
340   astring text1(emulator_info::get_appname(), " ", build_version);
341341   astring text2(machine().system().manufacturer, " ", machine().system().description);
342342   png_info pnginfo = { 0 };
343343   png_add_text(&pnginfo, "Software", text1);
r13284r13285
12591259         png_info pnginfo = { 0 };
12601260         if (m_movie_frame == 0)
12611261         {
1262            astring text1(APPNAME, " ", build_version);
1262            astring text1(emulator_info::get_appname(), " ", build_version);
12631263            astring text2(machine().system().manufacturer, " ", machine().system().description);
12641264            png_add_text(&pnginfo, "Software", text1);
12651265            png_add_text(&pnginfo, "System", text2);
src/emu/ioport.c
r13284r13285
38023802
38033803   /* verify the header against the current game */
38043804   if (memcmp(machine.system().name, header + 0x14, strlen(machine.system().name) + 1) != 0)
3805      mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine.system().name);
3805      mame_printf_info("Input file is for %s '%s', not for current %s '%s'\n", emulator_info::get_gamenoun(), header + 0x14, emulator_info::get_gamenoun(), machine.system().name);
38063806
38073807   /* enable compression */
38083808   portdata->playback_file->compress(FCOMPRESS_MEDIUM);
r13284r13285
39993999   header[0x10] = INP_HEADER_MAJVERSION;
40004000   header[0x11] = INP_HEADER_MINVERSION;
40014001   strcpy((char *)header + 0x14, machine.system().name);
4002   sprintf((char *)header + 0x20, APPNAME " %s", build_version);
4002   sprintf((char *)header + 0x20, "%s %s", emulator_info::get_appname(), build_version);
40034003
40044004   /* write it */
40054005   portdata->record_file->write(header, sizeof(header));
src/emu/ui.c
r13284r13285
917917   /* add a warning if any ROMs were loaded with warnings */
918918   if (rom_load_warnings(machine) > 0)
919919   {
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");
921923      if (machine.system().flags & WARNING_FLAGS)
922924         string.cat("\n");
923925   }
r13284r13285
925927   /* if we have at least one warning flag, print the general header */
926928   if ((machine.system().flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0)
927929   {
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");
929933
930934      /* 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      }
934940      /* add one line per warning flag */
935941      if (input_machine_has_keyboard(machine))
936942         string.cat("The keyboard emulation may not be 100% accurate.\n");
r13284r13285
957963         /* add the strings for these warnings */
958964         if (machine.system().flags & GAME_UNEMULATED_PROTECTION)
959965            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. "
962970                "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         }
966980
967981         /* find the parent of this driver */
968982         driver_enumerator drivlist(machine.options());
src/emu/clifront.c
r13284r13285
268268
269269         // print them out
270270         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());
272272         for (int matchnum = 0; matchnum < ARRAY_LENGTH(matches); matchnum++)
273273            if (matches[matchnum] != -1)
274274               fprintf(stderr, "%-18s%s\n", drivlist.driver(matches[matchnum]).name, drivlist.driver(matches[matchnum]).description);
r13284r13285
13001300   if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0)
13011301   {
13021302      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));
13041305      return;
13051306   }
13061307
r13284r13285
13221323   {
13231324      // attempt to open the output file
13241325      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());
13271328
13281329      // generate the updated INI
13291330      astring initext;
r13284r13285
13861387
13871388void cli_frontend::display_help()
13881389{
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());
13981400}
13991401
14001402
src/emu/romload.c
r13284r13285
553553   {
554554      /* create the error message and exit fatally */
555555      mame_printf_error("%s", romdata->errorstring.cstr());
556      fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run.");
556      fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "ERROR: required files are missing, the %s cannot be run.",emulator_info::get_gamenoun());
557557   }
558558
559559   /* if we had warnings, output them, but continue */
560560   if ((romdata-> warnings) || (romdata->knownbad))
561561   {
562      romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly.");
562      romdata->errorstring.cat("WARNING: the ");
563      romdata->errorstring.cat(emulator_info::get_gamenoun());
564      romdata->errorstring.cat(" might not run correctly.");
563565      mame_printf_warning("%s\n", romdata->errorstring.cstr());
564566   }
565567}
src/emu/info.c
r13284r13285
5353
5454// DTD string describing the data
5555const 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"
7171"\t\t<!ELEMENT description (#PCDATA)>\n"
7272"\t\t<!ELEMENT year (#PCDATA)>\n"
7373"\t\t<!ELEMENT manufacturer (#PCDATA)>\n"
r13284r13285
214214
215215   // output the DTD
216216   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());
218222
219223   // top-level tag
220   fprintf(m_output, "<" XML_ROOT " build=\"%s\" debug=\""
224   fprintf(m_output, "<%s build=\"%s\" debug=\""
221225#ifdef MAME_DEBUG
222226      "yes"
223227#else
224228      "no"
225229#endif
226230      "\" mameconfig=\"%d\">\n",
231      emulator_info::get_xml_root(),
227232      xml_normalize_string(build_version),
228233      CONFIG_VERSION
229234   );
r13284r13285
240245   global_free(m_device_used);
241246
242247   // close the top level tag
243   fprintf(m_output, "</" XML_ROOT ">\n");
248   fprintf(m_output, "</%s>\n",emulator_info::get_xml_root());
244249}
245250
246251
r13284r13285
264269         dev->config_complete();
265270
266271         // 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());
268273         fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname()));
269274         fprintf(m_output, " isdevice=\"yes\"");
270275         fprintf(m_output, " runnable=\"no\"");
r13284r13285
277282         output_rom(dev);
278283
279284         // close the topmost tag
280         fprintf(m_output, "\t</" XML_TOP ">\n");
285         fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top());
281286         global_free(dev);
282287      }
283288   }
r13284r13285
303308      input_port_list_init(*device, portlist, errors);
304309
305310   // 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());
307312   fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name));
308313
309314   // strip away any path information from the source_file and output it
r13284r13285
364369   output_ramoptions();
365370
366371   // close the topmost tag
367   fprintf(m_output, "\t</" XML_TOP ">\n");
372   fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top());
368373}
369374
370375//------------------------------------------------
src/emu/mame.h
r13284r13285
4242};
4343
4444
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
9845
9946
100
10147//**************************************************************************
10248//    TYPE DEFINITIONS
10349//**************************************************************************
r13284r13285
10551// output channel callback
10652typedef void (*output_callback_func)(void *param, const char *format, va_list argptr);
10753
54class emulator_info
55{
56public:
57   // construction/destruction
58   emulator_info() {};
10859
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};
10978
11079//**************************************************************************
11180//  GLOBAL VARIABLES
src/emu/screen.c
r13284r13285
10301030      char text[256];
10311031
10321032      // add two text entries describing the image
1033      sprintf(text, APPNAME " %s", build_version);
1033      sprintf(text,"%s %s", emulator_info::get_appname(), build_version);
10341034      png_add_text(&pnginfo, "Software", text);
10351035      sprintf(text, "%s %s", machine().system().manufacturer, machine().system().description);
10361036      png_add_text(&pnginfo, "System", text);
src/emu/save.c
r13284r13285
8080};
8181
8282
83
8483//**************************************************************************
85//  GLOBAL VARIABLES
86//**************************************************************************
87
88const char save_manager::s_magic_num[8] = { STATE_MAGIC_NUM };
89
90//**************************************************************************
9184//  INITIALIZATION
9285//**************************************************************************
9386
r13284r13285
244237   if (file.read(header, sizeof(header)) != sizeof(header))
245238   {
246239      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());
248241      return STATERR_READ_ERROR;
249242   }
250243
r13284r13285
311304
312305   // generate the header
313306   UINT8 header[HEADER_SIZE];
314   memcpy(&header[0], s_magic_num, 8);
307   memcpy(&header[0], emulator_info::get_state_magic_num(), 8);
315308   header[8] = SAVE_VERSION;
316309   header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
317310   strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a);
r13284r13285
385378   void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix)
386379{
387380   // check magic number
388   if (memcmp(header, s_magic_num, 8))
381   if (memcmp(header, emulator_info::get_state_magic_num(), 8))
389382   {
390383      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());
392385      return STATERR_INVALID_HEADER;
393386   }
394387
src/emu/save.h
r13284r13285
238238   simple_list<state_entry> m_entry_list;         // list of reigstered entries
239239   simple_list<state_callback> m_presave_list;      // list of pre-save functions
240240   simple_list<state_callback> m_postload_list;   // list of post-load functions
241
242   static const char s_magic_num[8];            // magic number for header
243241};
244242
245243
src/mess/mess.c
r0r13285
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
40const char * emulator_info::get_appname() { return APPNAME;}
41const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;}
42const char * emulator_info::get_configname() { return CONFIGNAME;}
43const char * emulator_info::get_applongname() { return APPLONGNAME;}
44const char * emulator_info::get_fulllongname() { return FULLLONGNAME;}
45const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;}
46const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;}
47const char * emulator_info::get_gamenoun() { return GAMENOUN;}
48const char * emulator_info::get_gamesnoun() { return GAMESNOUN;}
49const char * emulator_info::get_copyright() { return COPYRIGHT;}
50const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;}
51const char * emulator_info::get_disclaimer() { return DISCLAIMER;}
52const char * emulator_info::get_usage() { return USAGE;}
53const char * emulator_info::get_xml_root() { return XML_ROOT;}
54const char * emulator_info::get_xml_top() { return XML_TOP;}
55const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;}
56void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); }
makefile
r13284r13285
582582LIBOSD = $(OBJ)/libosd.a
583583
584584VERSIONOBJ = $(OBJ)/version.o
585EMUINFOOBJ = $(OBJ)/$(TARGET)/$(TARGET).o
585586DRIVLISTSRC = $(OBJ)/drivlist.c
586587DRIVLISTOBJ = $(OBJ)/drivlist.o
587588DEVLISTSRC = $(OBJ)/devlist.c
r13284r13285
727728# always recompile the version string
728729$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(LIBOCORE) $(RESFILE)
729730
730$(EMULATOR): $(VERSIONOBJ) $(DRIVLISTOBJ) $(DEVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(ZLIB) $(LIBOCORE) $(RESFILE)
731$(EMULATOR): $(VERSIONOBJ) $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DEVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(ZLIB) $(LIBOCORE) $(RESFILE)
731732   @echo Linking $@...
732733   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
733734ifeq ($(TARGETOS),win32)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team