Move per emulator constants info into separate class [Miodrag Milanovic]

out of log:
This way it is possible to link two or more separated executables with different 
copyright/xml out/name/... in one compilation, just one step closer...
This commit is contained in:
Miodrag Milanovic 2011-11-17 10:02:55 +00:00
parent 8e23f11ae2
commit be8bd3552f
19 changed files with 188 additions and 140 deletions

1
.gitattributes vendored
View File

@ -4109,6 +4109,7 @@ src/mame/machine/znsec.c svneol=native#text/plain
src/mame/machine/znsec.h svneol=native#text/plain src/mame/machine/znsec.h svneol=native#text/plain
src/mame/machine/zs01.c svneol=native#text/plain src/mame/machine/zs01.c svneol=native#text/plain
src/mame/machine/zs01.h svneol=native#text/plain src/mame/machine/zs01.h svneol=native#text/plain
src/mame/mame.c svneol=native#text/plain
src/mame/mame.lst svneol=native#text/plain src/mame/mame.lst svneol=native#text/plain
src/mame/mame.mak svneol=native#text/plain src/mame/mame.mak svneol=native#text/plain
src/mame/mame_dev.lst svneol=native#text/plain src/mame/mame_dev.lst svneol=native#text/plain

View File

@ -582,6 +582,7 @@ LIBOCORE = $(OBJ)/libocore.a
LIBOSD = $(OBJ)/libosd.a LIBOSD = $(OBJ)/libosd.a
VERSIONOBJ = $(OBJ)/version.o VERSIONOBJ = $(OBJ)/version.o
EMUINFOOBJ = $(OBJ)/$(TARGET)/$(TARGET).o
DRIVLISTSRC = $(OBJ)/drivlist.c DRIVLISTSRC = $(OBJ)/drivlist.c
DRIVLISTOBJ = $(OBJ)/drivlist.o DRIVLISTOBJ = $(OBJ)/drivlist.o
DEVLISTSRC = $(OBJ)/devlist.c DEVLISTSRC = $(OBJ)/devlist.c
@ -727,7 +728,7 @@ ifndef EXECUTABLE_DEFINED
# always recompile the version string # always recompile the version string
$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(LIBOCORE) $(RESFILE) $(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(LIBOCORE) $(RESFILE)
$(EMULATOR): $(VERSIONOBJ) $(DRIVLISTOBJ) $(DEVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(ZLIB) $(LIBOCORE) $(RESFILE) $(EMULATOR): $(VERSIONOBJ) $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DEVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(FORMATS_LIB) $(COTHREAD) $(ZLIB) $(LIBOCORE) $(RESFILE)
@echo Linking $@... @echo Linking $@...
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@ $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
ifeq ($(TARGETOS),win32) ifeq ($(TARGETOS),win32)

View File

@ -268,7 +268,7 @@ int cli_frontend::execute(int argc, char **argv)
// print them out // print them out
fprintf(stderr, "\n\"%s\" approximately matches the following\n" fprintf(stderr, "\n\"%s\" approximately matches the following\n"
"supported " GAMESNOUN " (best match first):\n\n", m_options.system_name()); "supported %s (best match first):\n\n", m_options.system_name(),emulator_info::get_gamesnoun());
for (int matchnum = 0; matchnum < ARRAY_LENGTH(matches); matchnum++) for (int matchnum = 0; matchnum < ARRAY_LENGTH(matches); matchnum++)
if (matches[matchnum] != -1) if (matches[matchnum] != -1)
fprintf(stderr, "%-18s%s\n", drivlist.driver(matches[matchnum]).name, drivlist.driver(matches[matchnum]).description); fprintf(stderr, "%-18s%s\n", drivlist.driver(matches[matchnum]).name, drivlist.driver(matches[matchnum]).description);
@ -1300,7 +1300,8 @@ void cli_frontend::execute_commands(const char *exename)
if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0) if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0)
{ {
astring helpstring; astring helpstring;
mame_printf_info(USAGE "\n\nOptions:\n%s", exename, GAMENOUN, m_options.output_help(helpstring)); emulator_info::printf_usage(exename, emulator_info::get_gamenoun());
mame_printf_info("\n\nOptions:\n%s", m_options.output_help(helpstring));
return; return;
} }
@ -1322,8 +1323,8 @@ void cli_frontend::execute_commands(const char *exename)
{ {
// attempt to open the output file // attempt to open the output file
emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file.open(CONFIGNAME ".ini") != FILERR_NONE) if (file.open(emulator_info::get_configname(), ".ini") != FILERR_NONE)
throw emu_fatalerror("Unable to create file " CONFIGNAME ".ini\n"); throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname());
// generate the updated INI // generate the updated INI
astring initext; astring initext;
@ -1386,15 +1387,16 @@ void cli_frontend::execute_commands(const char *exename)
void cli_frontend::display_help() void cli_frontend::display_help()
{ {
mame_printf_info(APPLONGNAME " v%s - " FULLLONGNAME "\n" 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());
COPYRIGHT_INFO "\n\n", build_version); mame_printf_info("%s\n", emulator_info::get_disclaimer());
mame_printf_info("%s\n", DISCLAIMER); emulator_info::printf_usage(emulator_info::get_appname(),emulator_info::get_gamenoun());
mame_printf_info(USAGE "\n\n" mame_printf_info("\n\n"
" " APPNAME " -showusage for a brief list of options\n" " %s -showusage for a brief list of options\n"
" " APPNAME " -showconfig for a list of configuration options\n" " %s -showconfig for a list of configuration options\n"
" " APPNAME " -listmedia for a full list of supported media\n" " %s -listmedia for a full list of supported media\n"
" " APPNAME " -createconfig to create a " CONFIGNAME ".ini\n\n" " %s -createconfig to create a %s.ini\n\n"
"For usage instructions, please consult the files config.txt and windows.txt.\n",APPNAME,GAMENOUN); "For usage instructions, please consult the files config.txt and windows.txt.\n",emulator_info::get_appname(),
emulator_info::get_appname(),emulator_info::get_appname(),emulator_info::get_appname(),emulator_info::get_configname());
} }

View File

@ -386,8 +386,8 @@ void emu_options::parse_standard_inis(astring &error_string)
// parse the INI file defined by the platform (e.g., "mame.ini") // parse the INI file defined by the platform (e.g., "mame.ini")
// we do this twice so that the first file can change the INI path // we do this twice so that the first file can change the INI path
parse_one_ini(CONFIGNAME, OPTION_PRIORITY_MAME_INI); parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI);
parse_one_ini(CONFIGNAME, OPTION_PRIORITY_MAME_INI, &error_string); parse_one_ini(emulator_info::get_configname(), OPTION_PRIORITY_MAME_INI, &error_string);
// debug mode: parse "debug.ini" as well // debug mode: parse "debug.ini" as well
if (debug()) if (debug())

View File

@ -53,21 +53,21 @@
// DTD string describing the data // DTD string describing the data
const char info_xml_creator::s_dtd_string[] = const char info_xml_creator::s_dtd_string[] =
"<!DOCTYPE " XML_ROOT " [\n" "<!DOCTYPE __XML_ROOT__ [\n"
"<!ELEMENT " XML_ROOT " (" XML_TOP "+)>\n" "<!ELEMENT __XML_ROOT__ (__XML_TOP__+)>\n"
"\t<!ATTLIST " XML_ROOT " build CDATA #IMPLIED>\n" "\t<!ATTLIST __XML_ROOT__ build CDATA #IMPLIED>\n"
"\t<!ATTLIST " XML_ROOT " debug (yes|no) \"no\">\n" "\t<!ATTLIST __XML_ROOT__ debug (yes|no) \"no\">\n"
"\t<!ATTLIST " XML_ROOT " mameconfig CDATA #REQUIRED>\n" "\t<!ATTLIST __XML_ROOT__ mameconfig CDATA #REQUIRED>\n"
"\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" "\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"
"\t\t<!ATTLIST " XML_TOP " name CDATA #REQUIRED>\n" "\t\t<!ATTLIST __XML_TOP__ name CDATA #REQUIRED>\n"
"\t\t<!ATTLIST " XML_TOP " sourcefile CDATA #IMPLIED>\n" "\t\t<!ATTLIST __XML_TOP__ sourcefile CDATA #IMPLIED>\n"
"\t\t<!ATTLIST " XML_TOP " isbios (yes|no) \"no\">\n" "\t\t<!ATTLIST __XML_TOP__ isbios (yes|no) \"no\">\n"
"\t\t<!ATTLIST " XML_TOP " isdevice (yes|no) \"no\">\n" "\t\t<!ATTLIST __XML_TOP__ isdevice (yes|no) \"no\">\n"
"\t\t<!ATTLIST " XML_TOP " ismechanical (yes|no) \"no\">\n" "\t\t<!ATTLIST __XML_TOP__ ismechanical (yes|no) \"no\">\n"
"\t\t<!ATTLIST " XML_TOP " runnable (yes|no) \"yes\">\n" "\t\t<!ATTLIST __XML_TOP__ runnable (yes|no) \"yes\">\n"
"\t\t<!ATTLIST " XML_TOP " cloneof CDATA #IMPLIED>\n" "\t\t<!ATTLIST __XML_TOP__ cloneof CDATA #IMPLIED>\n"
"\t\t<!ATTLIST " XML_TOP " romof CDATA #IMPLIED>\n" "\t\t<!ATTLIST __XML_TOP__ romof CDATA #IMPLIED>\n"
"\t\t<!ATTLIST " XML_TOP " sampleof CDATA #IMPLIED>\n" "\t\t<!ATTLIST __XML_TOP__ sampleof CDATA #IMPLIED>\n"
"\t\t<!ELEMENT description (#PCDATA)>\n" "\t\t<!ELEMENT description (#PCDATA)>\n"
"\t\t<!ELEMENT year (#PCDATA)>\n" "\t\t<!ELEMENT year (#PCDATA)>\n"
"\t\t<!ELEMENT manufacturer (#PCDATA)>\n" "\t\t<!ELEMENT manufacturer (#PCDATA)>\n"
@ -214,16 +214,21 @@ void info_xml_creator::output(FILE *out)
// output the DTD // output the DTD
fprintf(m_output, "<?xml version=\"1.0\"?>\n"); fprintf(m_output, "<?xml version=\"1.0\"?>\n");
fprintf(m_output, "%s\n\n", s_dtd_string); astring dtd(s_dtd_string);
dtd.replace(0,"__XML_ROOT__", emulator_info::get_xml_root());
dtd.replace(0,"__XML_TOP__", emulator_info::get_xml_top());
fprintf(m_output, "%s\n\n", dtd.cstr());
// top-level tag // top-level tag
fprintf(m_output, "<" XML_ROOT " build=\"%s\" debug=\"" fprintf(m_output, "<%s build=\"%s\" debug=\""
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
"yes" "yes"
#else #else
"no" "no"
#endif #endif
"\" mameconfig=\"%d\">\n", "\" mameconfig=\"%d\">\n",
emulator_info::get_xml_root(),
xml_normalize_string(build_version), xml_normalize_string(build_version),
CONFIG_VERSION CONFIG_VERSION
); );
@ -240,7 +245,7 @@ void info_xml_creator::output(FILE *out)
global_free(m_device_used); global_free(m_device_used);
// close the top level tag // close the top level tag
fprintf(m_output, "</" XML_ROOT ">\n"); fprintf(m_output, "</%s>\n",emulator_info::get_xml_root());
} }
@ -264,7 +269,7 @@ void info_xml_creator::output_devices()
dev->config_complete(); dev->config_complete();
// print the header and the game name // print the header and the game name
fprintf(m_output, "\t<" XML_TOP); fprintf(m_output, "\t<%s",emulator_info::get_xml_top());
fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname())); fprintf(m_output, " name=\"%s\"", xml_normalize_string(dev->shortname()));
fprintf(m_output, " isdevice=\"yes\""); fprintf(m_output, " isdevice=\"yes\"");
fprintf(m_output, " runnable=\"no\""); fprintf(m_output, " runnable=\"no\"");
@ -277,7 +282,7 @@ void info_xml_creator::output_devices()
output_rom(dev); output_rom(dev);
// close the topmost tag // close the topmost tag
fprintf(m_output, "\t</" XML_TOP ">\n"); fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top());
global_free(dev); global_free(dev);
} }
} }
@ -303,7 +308,7 @@ void info_xml_creator::output_one()
input_port_list_init(*device, portlist, errors); input_port_list_init(*device, portlist, errors);
// print the header and the game name // print the header and the game name
fprintf(m_output, "\t<" XML_TOP); fprintf(m_output, "\t<%s",emulator_info::get_xml_top());
fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name)); fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name));
// strip away any path information from the source_file and output it // strip away any path information from the source_file and output it
@ -364,7 +369,7 @@ void info_xml_creator::output_one()
output_ramoptions(); output_ramoptions();
// close the topmost tag // close the topmost tag
fprintf(m_output, "\t</" XML_TOP ">\n"); fprintf(m_output, "\t</%s>\n",emulator_info::get_xml_top());
} }
//------------------------------------------------ //------------------------------------------------

View File

@ -3802,7 +3802,7 @@ static time_t playback_init(running_machine &machine)
/* verify the header against the current game */ /* verify the header against the current game */
if (memcmp(machine.system().name, header + 0x14, strlen(machine.system().name) + 1) != 0) if (memcmp(machine.system().name, header + 0x14, strlen(machine.system().name) + 1) != 0)
mame_printf_info("Input file is for " GAMENOUN " '%s', not for current " GAMENOUN " '%s'\n", header + 0x14, machine.system().name); 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);
/* enable compression */ /* enable compression */
portdata->playback_file->compress(FCOMPRESS_MEDIUM); portdata->playback_file->compress(FCOMPRESS_MEDIUM);
@ -3999,7 +3999,7 @@ static void record_init(running_machine &machine)
header[0x10] = INP_HEADER_MAJVERSION; header[0x10] = INP_HEADER_MAJVERSION;
header[0x11] = INP_HEADER_MINVERSION; header[0x11] = INP_HEADER_MINVERSION;
strcpy((char *)header + 0x14, machine.system().name); strcpy((char *)header + 0x14, machine.system().name);
sprintf((char *)header + 0x20, APPNAME " %s", build_version); sprintf((char *)header + 0x20, "%s %s", emulator_info::get_appname(), build_version);
/* write it */ /* write it */
portdata->record_file->write(header, sizeof(header)); portdata->record_file->write(header, sizeof(header));

View File

@ -42,60 +42,6 @@ enum
}; };
// MESS vs. MAME abstractions
#ifndef MESS
#define APPNAME "MAME"
#define APPNAME_LOWER "mame"
#define CONFIGNAME "mame"
#define APPLONGNAME "M.A.M.E."
#define FULLLONGNAME "Multiple Arcade Machine Emulator"
#define CAPGAMENOUN "GAME"
#define CAPSTARTGAMENOUN "Game"
#define GAMENOUN "game"
#define GAMESNOUN "games"
#define COPYRIGHT "Copyright Nicola Salmoria\nand the MAME team\nhttp://mamedev.org"
#define COPYRIGHT_INFO "Copyright Nicola Salmoria and the MAME team"
#define DISCLAIMER "MAME is an emulator: it reproduces, more or less faithfully, the behaviour of\n" \
"several arcade machines. But hardware is useless without software, so an image\n" \
"of the ROMs which run on that hardware is required. Such ROMs, like any other\n" \
"commercial software, are copyrighted material and it is therefore illegal to\n" \
"use them if you don't own the original arcade machine. Needless to say, ROMs\n" \
"are not distributed together with MAME. Distribution of MAME together with ROM\n" \
"images is a violation of copyright law and should be promptly reported to the\n" \
"authors so that appropriate legal action can be taken.\n"
#define USAGE "Usage: %s [%s] [options]"
#define XML_ROOT "mame"
#define XML_TOP "game"
#define STATE_MAGIC_NUM 'M', 'A', 'M', 'E', 'S', 'A', 'V', 'E'
#else
#define APPNAME "MESS"
#define APPNAME_LOWER "mess"
#define CONFIGNAME "mess"
#define APPLONGNAME "M.E.S.S."
#define FULLLONGNAME "Multi Emulator Super System"
#define CAPGAMENOUN "SYSTEM"
#define CAPSTARTGAMENOUN "System"
#define GAMENOUN "system"
#define GAMESNOUN "systems"
#define COPYRIGHT "Copyright the MESS team\nhttp://mess.org"
#define COPYRIGHT_INFO "Copyright the MESS team\n\n" \
"MESS is based on MAME Source code\n" \
"Copyright Nicola Salmoria and the MAME team"
#define DISCLAIMER "MESS is an emulator: it reproduces, more or less faithfully, the behaviour of\n"\
"several computer and console systems. But hardware is useless without software\n" \
"so a file dump of the ROM, cartridges, discs, and cassettes which run on that\n" \
"hardware is required. Such files, like any other commercial software, are\n" \
"copyrighted material and it is therefore illegal to use them if you don't own\n" \
"the original media from which the files are derived. Needless to say, these\n" \
"files are not distributed together with MESS. Distribution of MESS together\n" \
"with these files is a violation of copyright law and should be promptly\n" \
"reported to the authors so that appropriate legal action can be taken.\n"
#define USAGE "Usage: %s [%s] [media] [software] [options]"
#define XML_ROOT "mess"
#define XML_TOP "machine"
#define STATE_MAGIC_NUM 'M', 'E', 'S', 'S', 'S', 'A', 'V', 'E'
#endif
//************************************************************************** //**************************************************************************
@ -105,7 +51,30 @@ enum
// output channel callback // output channel callback
typedef void (*output_callback_func)(void *param, const char *format, va_list argptr); typedef void (*output_callback_func)(void *param, const char *format, va_list argptr);
class emulator_info
{
public:
// construction/destruction
emulator_info() {};
static const char * get_appname();
static const char * get_appname_lower();
static const char * get_configname();
static const char * get_applongname();
static const char * get_fulllongname();
static const char * get_capgamenoun();
static const char * get_capstartgamenoun();
static const char * get_gamenoun();
static const char * get_gamesnoun();
static const char * get_copyright();
static const char * get_copyright_info();
static const char * get_disclaimer();
static const char * get_usage();
static const char * get_xml_root();
static const char * get_xml_top();
static const char * get_state_magic_num();
static void printf_usage(const char *par1, const char *par2);
};
//************************************************************************** //**************************************************************************
// GLOBAL VARIABLES // GLOBAL VARIABLES

View File

@ -553,13 +553,15 @@ static void display_rom_load_results(rom_load_data *romdata)
{ {
/* create the error message and exit fatally */ /* create the error message and exit fatally */
mame_printf_error("%s", romdata->errorstring.cstr()); mame_printf_error("%s", romdata->errorstring.cstr());
fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "ERROR: required files are missing, the "GAMENOUN" cannot be run."); fatalerror_exitcode(romdata->machine(), MAMERR_MISSING_FILES, "ERROR: required files are missing, the %s cannot be run.",emulator_info::get_gamenoun());
} }
/* if we had warnings, output them, but continue */ /* if we had warnings, output them, but continue */
if ((romdata-> warnings) || (romdata->knownbad)) if ((romdata-> warnings) || (romdata->knownbad))
{ {
romdata->errorstring.cat("WARNING: the "GAMENOUN" might not run correctly."); romdata->errorstring.cat("WARNING: the ");
romdata->errorstring.cat(emulator_info::get_gamenoun());
romdata->errorstring.cat(" might not run correctly.");
mame_printf_warning("%s\n", romdata->errorstring.cstr()); mame_printf_warning("%s\n", romdata->errorstring.cstr());
} }
} }

View File

@ -80,13 +80,6 @@ enum
}; };
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const char save_manager::s_magic_num[8] = { STATE_MAGIC_NUM };
//************************************************************************** //**************************************************************************
// INITIALIZATION // INITIALIZATION
//************************************************************************** //**************************************************************************
@ -244,7 +237,7 @@ save_error save_manager::check_file(running_machine &machine, emu_file &file, co
if (file.read(header, sizeof(header)) != sizeof(header)) if (file.read(header, sizeof(header)) != sizeof(header))
{ {
if (errormsg != NULL) if (errormsg != NULL)
(*errormsg)("Could not read " APPNAME " save file header"); (*errormsg)("Could not read %s save file header",emulator_info::get_appname());
return STATERR_READ_ERROR; return STATERR_READ_ERROR;
} }
@ -311,7 +304,7 @@ save_error save_manager::write_file(emu_file &file)
// generate the header // generate the header
UINT8 header[HEADER_SIZE]; UINT8 header[HEADER_SIZE];
memcpy(&header[0], s_magic_num, 8); memcpy(&header[0], emulator_info::get_state_magic_num(), 8);
header[8] = SAVE_VERSION; header[8] = SAVE_VERSION;
header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a); strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a);
@ -385,10 +378,10 @@ save_error save_manager::validate_header(const UINT8 *header, const char *gamena
void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix) void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix)
{ {
// check magic number // check magic number
if (memcmp(header, s_magic_num, 8)) if (memcmp(header, emulator_info::get_state_magic_num(), 8))
{ {
if (errormsg != NULL) if (errormsg != NULL)
(*errormsg)("%sThis is not a " APPNAME " save file", error_prefix); (*errormsg)("%sThis is not a %s save file", error_prefix,emulator_info::get_appname());
return STATERR_INVALID_HEADER; return STATERR_INVALID_HEADER;
} }

View File

@ -238,8 +238,6 @@ private:
simple_list<state_entry> m_entry_list; // list of reigstered entries simple_list<state_entry> m_entry_list; // list of reigstered entries
simple_list<state_callback> m_presave_list; // list of pre-save functions simple_list<state_callback> m_presave_list; // list of pre-save functions
simple_list<state_callback> m_postload_list; // list of post-load functions simple_list<state_callback> m_postload_list; // list of post-load functions
static const char s_magic_num[8]; // magic number for header
}; };

View File

@ -1030,7 +1030,7 @@ void screen_device::finalize_burnin()
char text[256]; char text[256];
// add two text entries describing the image // add two text entries describing the image
sprintf(text, APPNAME " %s", build_version); sprintf(text,"%s %s", emulator_info::get_appname(), build_version);
png_add_text(&pnginfo, "Software", text); png_add_text(&pnginfo, "Software", text);
sprintf(text, "%s %s", machine().system().manufacturer, machine().system().description); sprintf(text, "%s %s", machine().system().manufacturer, machine().system().description);
png_add_text(&pnginfo, "System", text); png_add_text(&pnginfo, "System", text);

View File

@ -917,7 +917,9 @@ static astring &warnings_string(running_machine &machine, astring &string)
/* add a warning if any ROMs were loaded with warnings */ /* add a warning if any ROMs were loaded with warnings */
if (rom_load_warnings(machine) > 0) if (rom_load_warnings(machine) > 0)
{ {
string.cat("One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n"); string.cat("One or more ROMs/CHDs for this game are incorrect. The ");
string.cat(emulator_info::get_gamenoun());
string.cat(" may not run correctly.\n");
if (machine.system().flags & WARNING_FLAGS) if (machine.system().flags & WARNING_FLAGS)
string.cat("\n"); string.cat("\n");
} }
@ -925,12 +927,16 @@ static astring &warnings_string(running_machine &machine, astring &string)
/* if we have at least one warning flag, print the general header */ /* if we have at least one warning flag, print the general header */
if ((machine.system().flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0) if ((machine.system().flags & WARNING_FLAGS) || rom_load_knownbad(machine) > 0)
{ {
string.cat("There are known problems with this " GAMENOUN "\n\n"); string.cat("There are known problems with this ");
string.cat(emulator_info::get_gamenoun());
string.cat("\n\n");
/* add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP */ /* add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP */
if (rom_load_knownbad(machine) > 0) if (rom_load_knownbad(machine) > 0) {
string.cat("One or more ROMs/CHDs for this " GAMENOUN " have not been correctly dumped.\n"); string.cat("One or more ROMs/CHDs for this ");
string.cat(emulator_info::get_gamenoun());
string.cat(" have not been correctly dumped.\n");
}
/* add one line per warning flag */ /* add one line per warning flag */
if (input_machine_has_keyboard(machine)) if (input_machine_has_keyboard(machine))
string.cat("The keyboard emulation may not be 100% accurate.\n"); string.cat("The keyboard emulation may not be 100% accurate.\n");
@ -957,12 +963,20 @@ static astring &warnings_string(running_machine &machine, astring &string)
/* add the strings for these warnings */ /* add the strings for these warnings */
if (machine.system().flags & GAME_UNEMULATED_PROTECTION) if (machine.system().flags & GAME_UNEMULATED_PROTECTION)
string.cat("The game has protection which isn't fully emulated.\n"); string.cat("The game has protection which isn't fully emulated.\n");
if (machine.system().flags & GAME_NOT_WORKING) if (machine.system().flags & GAME_NOT_WORKING) {
string.cat("\nTHIS " CAPGAMENOUN " DOESN'T WORK. The emulation for this game is not yet complete. " string.cat("\nTHIS ");
string.cat(emulator_info::get_capgamenoun());
string.cat(" DOESN'T WORK. The emulation for this game is not yet complete. "
"There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n");
if (machine.system().flags & GAME_MECHANICAL) }
string.cat("\nCertain elements of this " GAMENOUN " cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " if (machine.system().flags & GAME_MECHANICAL) {
"It is not possible to fully play this " GAMENOUN ".\n"); string.cat("\nCertain elements of this ");
string.cat(emulator_info::get_gamenoun());
string.cat(" cannot be emulated as it requires actual physical interaction or consists of mechanical devices. "
"It is not possible to fully play this ");
string.cat(emulator_info::get_gamenoun());
string.cat(".\n");
}
/* find the parent of this driver */ /* find the parent of this driver */
driver_enumerator drivlist(machine.options()); driver_enumerator drivlist(machine.options());

View File

@ -250,7 +250,6 @@ static render_texture *hilight_texture;
static render_texture *arrow_texture; static render_texture *arrow_texture;
static const char priortext[] = "Return to Prior Menu"; static const char priortext[] = "Return to Prior Menu";
static const char backtext[] = "Return to " CAPSTARTGAMENOUN;
static const char exittext[] = "Exit"; static const char exittext[] = "Exit";
// temporary hack until this is C++-ified // temporary hack until this is C++-ified
@ -521,10 +520,12 @@ void ui_menu_reset(ui_menu *menu, ui_menu_reset_options options)
menu->numitems = 0; menu->numitems = 0;
menu->visitems = 0; menu->visitems = 0;
menu->selected = 0; menu->selected = 0;
astring backtext;
backtext.printf("Return to %s",emulator_info::get_capstartgamenoun());
/* add an item to return */ /* add an item to return */
if (menu->parent == NULL) if (menu->parent == NULL)
ui_menu_item_append(menu, backtext, NULL, 0, NULL); ui_menu_item_append(menu, backtext.cstr(), NULL, 0, NULL);
else if (menu->parent->handler == menu_quit_game) else if (menu->parent->handler == menu_quit_game)
ui_menu_item_append(menu, exittext, NULL, 0, NULL); ui_menu_item_append(menu, exittext, NULL, 0, NULL);
else else
@ -1638,7 +1639,7 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
int has_configs = FALSE; int has_configs = FALSE;
int has_analog = FALSE; int has_analog = FALSE;
int has_dips = FALSE; int has_dips = FALSE;
astring menu_text;
/* scan the input port array to see what options we need to enable */ /* scan the input port array to see what options we need to enable */
for (port = machine.m_portlist.first(); port != NULL; port = port->next()) for (port = machine.m_portlist.first(); port != NULL; port = port->next())
for (field = port->fieldlist().first(); field != NULL; field = field->next()) for (field = port->fieldlist().first(); field != NULL; field = field->next())
@ -1652,8 +1653,10 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
} }
/* add input menu items */ /* add input menu items */
ui_menu_item_append(menu, "Input (general)", NULL, 0, (void *)menu_input_groups); ui_menu_item_append(menu, "Input (general)", NULL, 0, (void *)menu_input_groups);
ui_menu_item_append(menu, "Input (this " CAPSTARTGAMENOUN ")", NULL, 0, (void *)menu_input_specific);
menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun());
ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_input_specific);
/* add optional input-related menus */ /* add optional input-related menus */
if (has_dips) if (has_dips)
@ -1667,7 +1670,8 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, (void *)menu_bookkeeping); ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, (void *)menu_bookkeeping);
/* add game info menu */ /* add game info menu */
ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, (void *)menu_game_info); menu_text.printf("%s Information",emulator_info::get_capstartgamenoun());
ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_game_info);
device_image_interface *image = NULL; device_image_interface *image = NULL;
if (machine.devicelist().first(image)) if (machine.devicelist().first(image))
@ -1717,7 +1721,8 @@ static void menu_main_populate(running_machine &machine, ui_menu *menu, void *st
ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card); ui_menu_item_append(menu, "Memory Card", NULL, 0, (void *)menu_memory_card);
/* add reset and exit menus */ /* add reset and exit menus */
ui_menu_item_append(menu, "Select New " CAPSTARTGAMENOUN, NULL, 0, (void *)menu_select_game); menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun());
ui_menu_item_append(menu, menu_text.cstr(), NULL, 0, (void *)menu_select_game);
} }
@ -3705,9 +3710,14 @@ static void menu_select_game_populate(running_machine &machine, ui_menu *menu, s
/* if nothing there, add a single multiline item and return */ /* if nothing there, add a single multiline item and return */
if (matchcount == 0) if (matchcount == 0)
{ {
ui_menu_item_append(menu, "No "GAMESNOUN" found. Please check the rompath specified in the "CONFIGNAME".ini file.\n\n" astring txt;
"If this is your first time using "APPNAME", please see the config.txt file in " txt.printf("No %s found. Please check the rompath specified in the %s.ini file.\n\n"
"the docs directory for information on configuring "APPNAME".", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL); "If this is your first time using %s, please see the config.txt file in "
"the docs directory for information on configuring %s.",
emulator_info::get_gamesnoun(),
emulator_info::get_configname(),
emulator_info::get_appname(),emulator_info::get_appname() );
ui_menu_item_append(menu, txt.cstr(), NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
return; return;
} }
@ -3868,12 +3878,12 @@ static void menu_select_game_custom_render(running_machine &machine, ui_menu *me
} }
else else
{ {
const char *s = COPYRIGHT; const char *s = emulator_info::get_copyright();
line = 0; line = 0;
int col = 0; int col = 0;
/* first line is version string */ /* first line is version string */
sprintf(&tempbuf[line++][0], "%s %s", APPLONGNAME, build_version); sprintf(&tempbuf[line++][0], "%s %s", emulator_info::get_applongname(), build_version);
/* output message */ /* output message */
while (line < ARRAY_LENGTH(tempbuf)) while (line < ARRAY_LENGTH(tempbuf))

View File

@ -337,7 +337,7 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file)
create_snapshot_bitmap(screen); create_snapshot_bitmap(screen);
// add two text entries describing the image // add two text entries describing the image
astring text1(APPNAME, " ", build_version); astring text1(emulator_info::get_appname(), " ", build_version);
astring text2(machine().system().manufacturer, " ", machine().system().description); astring text2(machine().system().manufacturer, " ", machine().system().description);
png_info pnginfo = { 0 }; png_info pnginfo = { 0 };
png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "Software", text1);
@ -1259,7 +1259,7 @@ void video_manager::record_frame()
png_info pnginfo = { 0 }; png_info pnginfo = { 0 };
if (m_movie_frame == 0) if (m_movie_frame == 0)
{ {
astring text1(APPNAME, " ", build_version); astring text1(emulator_info::get_appname(), " ", build_version);
astring text2(machine().system().manufacturer, " ", machine().system().description); astring text2(machine().system().manufacturer, " ", machine().system().description);
png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "Software", text1);
png_add_text(&pnginfo, "System", text2); png_add_text(&pnginfo, "System", text2);

53
src/mame/mame.c Normal file
View File

@ -0,0 +1,53 @@
/***************************************************************************
mame.c
Specific (per target) constants
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
****************************************************************************/
#include "emu.h"
#define APPNAME "MAME"
#define APPNAME_LOWER "mame"
#define CONFIGNAME "mame"
#define APPLONGNAME "M.A.M.E."
#define FULLLONGNAME "Multiple Arcade Machine Emulator"
#define CAPGAMENOUN "GAME"
#define CAPSTARTGAMENOUN "Game"
#define GAMENOUN "game"
#define GAMESNOUN "games"
#define COPYRIGHT "Copyright Nicola Salmoria\nand the MAME team\nhttp://mamedev.org"
#define COPYRIGHT_INFO "Copyright Nicola Salmoria and the MAME team"
#define DISCLAIMER "MAME is an emulator: it reproduces, more or less faithfully, the behaviour of\n" \
"several arcade machines. But hardware is useless without software, so an image\n" \
"of the ROMs which run on that hardware is required. Such ROMs, like any other\n" \
"commercial software, are copyrighted material and it is therefore illegal to\n" \
"use them if you don't own the original arcade machine. Needless to say, ROMs\n" \
"are not distributed together with MAME. Distribution of MAME together with ROM\n" \
"images is a violation of copyright law and should be promptly reported to the\n" \
"authors so that appropriate legal action can be taken.\n"
#define USAGE "Usage: %s [%s] [options]"
#define XML_ROOT "mame"
#define XML_TOP "game"
#define STATE_MAGIC_NUM "MAMESAVE"
const char * emulator_info::get_appname() { return APPNAME;}
const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;}
const char * emulator_info::get_configname() { return CONFIGNAME;}
const char * emulator_info::get_applongname() { return APPLONGNAME;}
const char * emulator_info::get_fulllongname() { return FULLLONGNAME;}
const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;}
const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;}
const char * emulator_info::get_gamenoun() { return GAMENOUN;}
const char * emulator_info::get_gamesnoun() { return GAMESNOUN;}
const char * emulator_info::get_copyright() { return COPYRIGHT;}
const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;}
const char * emulator_info::get_disclaimer() { return DISCLAIMER;}
const char * emulator_info::get_usage() { return USAGE;}
const char * emulator_info::get_xml_root() { return XML_ROOT;}
const char * emulator_info::get_xml_top() { return XML_TOP;}
const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;}
void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); }

View File

@ -703,9 +703,9 @@ int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monit
// make the window title // make the window title
if (video_config.numscreens == 1) if (video_config.numscreens == 1)
sprintf(window->title, APPNAME ": %s [%s]", machine.system().description, machine.system().name); sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
else else
sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine.system().description, machine.system().name, index); sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
wp->window = window; wp->window = window;

View File

@ -400,7 +400,7 @@ void hlsl_info::render_snapshot(d3d_surface *surface)
return; return;
// add two text entries describing the image // add two text entries describing the image
astring text1(APPNAME, " ", build_version); astring text1(emulator_info::get_appname(), " ", build_version);
astring text2(window->machine().system().manufacturer, " ", window->machine().system().description); astring text2(window->machine().system().manufacturer, " ", window->machine().system().description);
png_info pnginfo = { 0 }; png_info pnginfo = { 0 };
png_add_text(&pnginfo, "Software", text1); png_add_text(&pnginfo, "Software", text1);

View File

@ -690,9 +690,9 @@ void winwindow_video_window_create(running_machine &machine, int index, win_moni
// make the window title // make the window title
if (video_config.numscreens == 1) if (video_config.numscreens == 1)
sprintf(window->title, APPNAME ": %s [%s]", machine.system().description, machine.system().name); sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
else else
sprintf(window->title, APPNAME ": %s [%s] - Screen %d", machine.system().description, machine.system().name, index); sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
// set the initial maximized state // set the initial maximized state
window->startmaximized = options.maximize(); window->startmaximized = options.maximize();

View File

@ -548,7 +548,7 @@ static void winui_output_error(void *param, const char *format, va_list argptr)
winwindow_toggle_full_screen(); winwindow_toggle_full_screen();
vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr); vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr);
win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, APPNAME, MB_OK); win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK);
} }