src/mess/climess.c
| r8324 | r8325 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | climess.c |
| 4 | | |
| 5 | | Command-line interface frontend for MESS. |
| 6 | | |
| 7 | | ***************************************************************************/ |
| 8 | | |
| 9 | | #include "emu.h" |
| 10 | | #include "climess.h" |
| 11 | | #include "output.h" |
| 12 | | #include "hash.h" |
| 13 | | |
| 14 | | |
| 15 | | /*------------------------------------------------- |
| 16 | | mess_display_help - display MESS help to |
| 17 | | standard output |
| 18 | | -------------------------------------------------*/ |
| 19 | | |
| 20 | | void mess_display_help(void) |
| 21 | | { |
| 22 | | mame_printf_info( |
| 23 | | "MESS v%s\n" |
| 24 | | "Multi Emulator Super System - Copyright (C) 1997-2009 by the MESS Team\n" |
| 25 | | "MESS is based on MAME Source code\n" |
| 26 | | "Copyright (C) 1997-2009 by Nicola Salmoria and the MAME Team\n\n", |
| 27 | | build_version); |
| 28 | | mame_printf_info("%s\n", mess_disclaimer); |
| 29 | | mame_printf_info( |
| 30 | | "Usage: MESS <system> <device> <software> <options>\n" |
| 31 | | "\n" |
| 32 | | " MESS -showusage for a brief list of options\n" |
| 33 | | " MESS -showconfig for a list of configuration options\n" |
| 34 | | " MESS -listdevices for a full list of supported devices\n" |
| 35 | | " MESS -createconfig to create a mess.ini\n" |
| 36 | | "\n" |
| 37 | | "See config.txt and windows.txt for usage instructions.\n"); |
| 38 | | } |
| 39 | | |
src/mess/infomess.c
| r8324 | r8325 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | infomess.c |
| 4 | | |
| 5 | | MESS-specific augmentation to info.c |
| 6 | | |
| 7 | | ***************************************************************************/ |
| 8 | | |
| 9 | | #include <ctype.h> |
| 10 | | |
| 11 | | #include "emu.h" |
| 12 | | #include "sound/samples.h" |
| 13 | | #include "info.h" |
| 14 | | #include "hash.h" |
| 15 | | #include "xmlfile.h" |
| 16 | | #include "infomess.h" |
| 17 | | #include "devices/messram.h" |
| 18 | | |
| 19 | | |
| 20 | | /************************************* |
| 21 | | * |
| 22 | | * Code used by print_mame_xml() |
| 23 | | * |
| 24 | | *************************************/ |
| 25 | | |
| 26 | | /* device iteration helpers */ |
| 27 | | #define ram_first(config) (config)->devicelist.first(MESSRAM) |
| 28 | | #define ram_next(previous) ((previous)->typenext()) |
| 29 | | |
| 30 | | /*------------------------------------------------- |
| 31 | | print_game_ramoptions - prints out all RAM |
| 32 | | options for this system |
| 33 | | -------------------------------------------------*/ |
| 34 | | static void print_game_ramoptions(FILE *out, const game_driver *game, const machine_config *config) |
| 35 | | { |
| 36 | | const device_config *device; |
| 37 | | |
| 38 | | for (device = ram_first(config); device != NULL; device = ram_next(device)) |
| 39 | | { |
| 40 | | ram_config *ram = (ram_config *)downcast<const legacy_device_config_base *>(device)->inline_config(); |
| 41 | | fprintf(out, "\t\t<ramoption default=\"1\">%u</ramoption>\n", messram_parse_string(ram->default_size)); |
| 42 | | if (ram->extra_options != NULL) |
| 43 | | { |
| 44 | | int j; |
| 45 | | int size = strlen(ram->extra_options); |
| 46 | | char * const s = mame_strdup(ram->extra_options); |
| 47 | | char * const e = s + size; |
| 48 | | char *p = s; |
| 49 | | for (j=0;j<size;j++) { |
| 50 | | if (p[j]==',') p[j]=0; |
| 51 | | } |
| 52 | | /* try to parse each option */ |
| 53 | | while(p <= e) |
| 54 | | { |
| 55 | | fprintf(out, "\t\t<ramoption>%u</ramoption>\n", messram_parse_string(p)); |
| 56 | | p += strlen(p); |
| 57 | | if (p == e) |
| 58 | | break; |
| 59 | | p += 1; |
| 60 | | } |
| 61 | | |
| 62 | | osd_free(s); |
| 63 | | } |
| 64 | | } |
| 65 | | } |
| 66 | | |
| 67 | | |
| 68 | | /*------------------------------------------------- |
| 69 | | print_mess_game_xml - print MESS specific game |
| 70 | | information. |
| 71 | | -------------------------------------------------*/ |
| 72 | | |
| 73 | | void print_mess_game_xml(FILE *out, const game_driver *game, const machine_config *config) |
| 74 | | { |
| 75 | | print_game_ramoptions( out, game, config ); |
| 76 | | } |
| 77 | | |
src/mess/messopts.c
| r8324 | r8325 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | messopts.c - MESS specific option handling |
| 4 | | |
| 5 | | ****************************************************************************/ |
| 6 | | |
| 7 | | #include "emu.h" |
| 8 | | #include "emuopts.h" |
| 9 | | #include "options.h" |
| 10 | | |
| 11 | | /*************************************************************************** |
| 12 | | LOCAL VARIABLES |
| 13 | | ***************************************************************************/ |
| 14 | | |
| 15 | | const options_entry mess_core_options[] = |
| 16 | | { |
| 17 | | { NULL, NULL, OPTION_HEADER, "MESS SPECIFIC OPTIONS" }, |
| 18 | | { "ramsize;ram", NULL, 0, "size of RAM (if supported by driver)" }, |
| 19 | | { "newui;nu", "0", OPTION_BOOLEAN, "use the new MESS UI" }, |
| 20 | | { NULL } |
| 21 | | }; |
| 22 | | |
| 23 | | |
| 24 | | |
| 25 | | /*************************************************************************** |
| 26 | | IMPLEMENTATION |
| 27 | | ***************************************************************************/ |
| 28 | | /*------------------------------------------------- |
| 29 | | mess_options_init - called from core to add |
| 30 | | MESS specific options |
| 31 | | -------------------------------------------------*/ |
| 32 | | |
| 33 | | void mess_options_init(core_options *opts) |
| 34 | | { |
| 35 | | /* add MESS-specific options */ |
| 36 | | options_add_entries(opts, mess_core_options); |
| 37 | | } |
| 38 | | |
src/mess/messopts.h
| r8324 | r8325 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | messopts.h - MESS specific option handling |
| 4 | | |
| 5 | | ****************************************************************************/ |
| 6 | | |
| 7 | | #ifndef __MESSOPTS_H__ |
| 8 | | #define __MESSOPTS_H__ |
| 9 | | |
| 10 | | #include "image.h" |
| 11 | | #include "options.h" |
| 12 | | |
| 13 | | /*************************************************************************** |
| 14 | | CONSTANTS |
| 15 | | ***************************************************************************/ |
| 16 | | |
| 17 | | #define OPTION_RAMSIZE "ramsize" |
| 18 | | #define OPTION_WRITECONFIG "writeconfig" |
| 19 | | |
| 20 | | |
| 21 | | |
| 22 | | /*************************************************************************** |
| 23 | | GLOBALS |
| 24 | | ***************************************************************************/ |
| 25 | | |
| 26 | | extern const options_entry mess_core_options[]; |
| 27 | | |
| 28 | | |
| 29 | | /*************************************************************************** |
| 30 | | FUNCTION PROTOTYPES |
| 31 | | ***************************************************************************/ |
| 32 | | |
| 33 | | /* initialize MESS specific options (called from MAME core) */ |
| 34 | | void mess_options_init(core_options *opts); |
| 35 | | #endif /* __MESSOPTS_H__ */ |
src/mess/mess.c
| r8324 | r8325 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "emu.h" |
| 10 | #include "emuopts.h" |
| 10 | 11 | |
| 11 | 12 | #include "lcd.lh" |
| 12 | 13 | #include "lcd_rot.lh" |
| 13 | 14 | |
| 15 | #include "devices/messram.h" |
| 16 | |
| 14 | 17 | /* Globals */ |
| 15 | 18 | const char mess_disclaimer[] = |
| 16 | 19 | "MESS is an emulator: it reproduces, more or less faithfully, the behaviour of\n" |
| r8324 | r8325 | |
| 22 | 25 | "files are not distributed together with MESS. Distribution of MESS together\n" |
| 23 | 26 | "with these files is a violation of copyright law and should be promptly\n" |
| 24 | 27 | "reported to the authors so that appropriate legal action can be taken.\n\n"; |
| 28 | |
| 29 | /*------------------------------------------------- |
| 30 | mess_display_help - display MESS help to |
| 31 | standard output |
| 32 | -------------------------------------------------*/ |
| 33 | |
| 34 | void mess_display_help(void) |
| 35 | { |
| 36 | mame_printf_info( |
| 37 | "MESS v%s\n" |
| 38 | "Multi Emulator Super System - Copyright (C) 1997-2009 by the MESS Team\n" |
| 39 | "MESS is based on MAME Source code\n" |
| 40 | "Copyright (C) 1997-2009 by Nicola Salmoria and the MAME Team\n\n", |
| 41 | build_version); |
| 42 | mame_printf_info("%s\n", mess_disclaimer); |
| 43 | mame_printf_info( |
| 44 | "Usage: MESS <system> <device> <software> <options>\n" |
| 45 | "\n" |
| 46 | " MESS -showusage for a brief list of options\n" |
| 47 | " MESS -showconfig for a list of configuration options\n" |
| 48 | " MESS -listdevices for a full list of supported devices\n" |
| 49 | " MESS -createconfig to create a mess.ini\n" |
| 50 | "\n" |
| 51 | "See config.txt and windows.txt for usage instructions.\n"); |
| 52 | } |
| 53 | |
| 54 | /************************************* |
| 55 | * |
| 56 | * Code used by print_mame_xml() |
| 57 | * |
| 58 | *************************************/ |
| 59 | |
| 60 | /* device iteration helpers */ |
| 61 | #define ram_first(config) (config)->devicelist.first(MESSRAM) |
| 62 | #define ram_next(previous) ((previous)->typenext()) |
| 63 | |
| 64 | /*------------------------------------------------- |
| 65 | print_game_ramoptions - prints out all RAM |
| 66 | options for this system |
| 67 | -------------------------------------------------*/ |
| 68 | static void print_game_ramoptions(FILE *out, const game_driver *game, const machine_config *config) |
| 69 | { |
| 70 | const device_config *device; |
| 71 | |
| 72 | for (device = ram_first(config); device != NULL; device = ram_next(device)) |
| 73 | { |
| 74 | ram_config *ram = (ram_config *)downcast<const legacy_device_config_base *>(device)->inline_config(); |
| 75 | fprintf(out, "\t\t<ramoption default=\"1\">%u</ramoption>\n", messram_parse_string(ram->default_size)); |
| 76 | if (ram->extra_options != NULL) |
| 77 | { |
| 78 | int j; |
| 79 | int size = strlen(ram->extra_options); |
| 80 | char * const s = mame_strdup(ram->extra_options); |
| 81 | char * const e = s + size; |
| 82 | char *p = s; |
| 83 | for (j=0;j<size;j++) { |
| 84 | if (p[j]==',') p[j]=0; |
| 85 | } |
| 86 | /* try to parse each option */ |
| 87 | while(p <= e) |
| 88 | { |
| 89 | fprintf(out, "\t\t<ramoption>%u</ramoption>\n", messram_parse_string(p)); |
| 90 | p += strlen(p); |
| 91 | if (p == e) |
| 92 | break; |
| 93 | p += 1; |
| 94 | } |
| 95 | |
| 96 | osd_free(s); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | /*------------------------------------------------- |
| 103 | print_mess_game_xml - print MESS specific game |
| 104 | information. |
| 105 | -------------------------------------------------*/ |
| 106 | |
| 107 | void print_mess_game_xml(FILE *out, const game_driver *game, const machine_config *config) |
| 108 | { |
| 109 | print_game_ramoptions( out, game, config ); |
| 110 | } |
| 111 | |
| 112 | /*************************************************************************** |
| 113 | LOCAL VARIABLES |
| 114 | ***************************************************************************/ |
| 115 | |
| 116 | const options_entry mess_core_options[] = |
| 117 | { |
| 118 | { NULL, NULL, OPTION_HEADER, "MESS SPECIFIC OPTIONS" }, |
| 119 | { "ramsize;ram", NULL, 0, "size of RAM (if supported by driver)" }, |
| 120 | { "newui;nu", "0", OPTION_BOOLEAN, "use the new MESS UI" }, |
| 121 | { NULL } |
| 122 | }; |
| 123 | |
| 124 | /*************************************************************************** |
| 125 | IMPLEMENTATION |
| 126 | ***************************************************************************/ |
| 127 | /*------------------------------------------------- |
| 128 | mess_options_init - called from core to add |
| 129 | MESS specific options |
| 130 | -------------------------------------------------*/ |
| 131 | |
| 132 | void mess_options_init(core_options *opts) |
| 133 | { |
| 134 | /* add MESS-specific options */ |
| 135 | options_add_entries(opts, mess_core_options); |
| 136 | } |
src/mess/mess.h
| r8324 | r8325 | |
| 9 | 9 | #ifndef __MESS_H__ |
| 10 | 10 | #define __MESS_H__ |
| 11 | 11 | |
| 12 | | #include "messopts.h" |
| 12 | #include "options.h" |
| 13 | 13 | |
| 14 | | |
| 15 | 14 | /*************************************************************************** |
| 15 | CONSTANTS |
| 16 | ***************************************************************************/ |
| 16 | 17 | |
| 17 | | Constants |
| 18 | #define OPTION_RAMSIZE "ramsize" |
| 19 | #define OPTION_WRITECONFIG "writeconfig" |
| 20 | #define LCD_FRAMES_PER_SECOND 30 |
| 18 | 21 | |
| 22 | |
| 23 | /*************************************************************************** |
| 24 | GLOBALS |
| 19 | 25 | ***************************************************************************/ |
| 20 | 26 | |
| 21 | | #define LCD_FRAMES_PER_SECOND 30 |
| 27 | extern const options_entry mess_core_options[]; |
| 22 | 28 | |
| 23 | | /**************************************************************************/ |
| 24 | | |
| 25 | | /* mess specific layout files */ |
| 26 | 29 | extern const char layout_lcd[]; /* generic 1:1 lcd screen layout */ |
| 27 | 30 | extern const char layout_lcd_rot[]; /* same, for use with ROT90 or ROT270 */ |
| 28 | 31 | |
| 32 | extern const char mess_disclaimer[]; |
| 29 | 33 | |
| 30 | | /***************************************************************************/ |
| 34 | /*************************************************************************** |
| 35 | FUNCTION PROTOTYPES |
| 36 | ***************************************************************************/ |
| 31 | 37 | |
| 32 | | extern const char mess_disclaimer[]; |
| 38 | void mess_display_help(void); |
| 33 | 39 | |
| 34 | | /***************************************************************************/ |
| 40 | /* code used by print_mame_xml() */ |
| 41 | void print_mess_game_xml(FILE *out, const game_driver *game, const machine_config *config); |
| 42 | |
| 43 | /* initialize MESS specific options (called from MAME core) */ |
| 44 | void mess_options_init(core_options *opts); |
| 45 | |
| 35 | 46 | #endif /* __MESS_H__ */ |