src/mess/mess.c
| r1083 | r1084 | |
| 21 | 21 | #include "messopts.h" |
| 22 | 22 | |
| 23 | 23 | /* Globals */ |
| 24 | | const char *mess_path; |
| 25 | | |
| 26 | 24 | UINT32 mess_ram_size; |
| 27 | 25 | UINT8 *mess_ram; |
| 28 | 26 | UINT8 mess_ram_default_value = 0xCD; |
| r1083 | r1084 | |
| 132 | 130 | const char *image_name; |
| 133 | 131 | mess_image *image; |
| 134 | 132 | |
| 135 | | /* convienient place to call this */ |
| 136 | | { |
| 137 | | char buf[260]; |
| 138 | | osd_getcurdir(buf, ARRAY_LENGTH(buf)); |
| 139 | | mess_path = auto_strdup(buf); |
| 140 | | } |
| 141 | | |
| 142 | 133 | /* initialize natural keyboard support */ |
| 143 | 134 | inputx_init(); |
| 144 | 135 | |
| r1083 | r1084 | |
| 263 | 254 | |
| 264 | 255 | ***************************************************************************/ |
| 265 | 256 | |
| 266 | | READ8_HANDLER( return8_00 ) { return 0x00; } |
| 267 | 257 | READ8_HANDLER( return8_FE ) { return 0xFE; } |
| 268 | 258 | READ8_HANDLER( return8_FF ) { return 0xFF; } |
| 269 | 259 | READ16_HANDLER( return16_FFFF ) { return 0xFFFF; } |
src/mess/mess.h
| r1083 | r1084 | |
| 32 | 32 | |
| 33 | 33 | /**************************************************************************/ |
| 34 | 34 | |
| 35 | | #ifndef bool |
| 36 | | #define bool int |
| 37 | | #endif |
| 38 | | |
| 39 | 35 | /* Win32 defines this for vararg functions */ |
| 40 | 36 | #ifndef DECL_SPEC |
| 41 | 37 | #define DECL_SPEC |
| r1083 | r1084 | |
| 112 | 108 | /* --------------------------------------------------------------------------------------------- */ |
| 113 | 109 | |
| 114 | 110 | /* dummy read handlers */ |
| 115 | | READ8_HANDLER(return8_00); |
| 116 | 111 | READ8_HANDLER(return8_FE); |
| 117 | 112 | READ8_HANDLER(return8_FF); |
| 118 | 113 | READ16_HANDLER(return16_FFFF); |
| 119 | 114 | |
| 120 | | /* gets the path to the MESS executable */ |
| 121 | | extern const char *mess_path; |
| 122 | | |
| 123 | 115 | #endif |
src/mess/infomess.c
| r1083 | r1084 | |
| 12 | 12 | #include "sound/samples.h" |
| 13 | 13 | #include "info.h" |
| 14 | 14 | #include "hash.h" |
| 15 | #include "xmlfile.h" |
| 15 | 16 | |
| 16 | 17 | /************************************* |
| 17 | 18 | * |
| r1083 | r1084 | |
| 19 | 20 | * |
| 20 | 21 | *************************************/ |
| 21 | 22 | |
| 22 | | /* Print a free format string */ |
| 23 | | static const char *normalize_string(const char* s) |
| 24 | | { |
| 25 | | static char buffer[1024]; |
| 26 | | char *d = &buffer[0]; |
| 27 | 23 | |
| 28 | | if (s) |
| 29 | | { |
| 30 | | while (*s) |
| 31 | | { |
| 32 | | switch (*s) |
| 33 | | { |
| 34 | | case '\"' : d += sprintf(d, """); break; |
| 35 | | case '&' : d += sprintf(d, "&"); break; |
| 36 | | case '<' : d += sprintf(d, "<"); break; |
| 37 | | case '>' : d += sprintf(d, ">"); break; |
| 38 | | default: |
| 39 | | if (*s>=' ' && *s<='~') |
| 40 | | *d++ = *s; |
| 41 | | else |
| 42 | | d += sprintf(d, "&#%d;", (unsigned)(unsigned char)*s); |
| 43 | | } |
| 44 | | ++s; |
| 45 | | } |
| 46 | | } |
| 47 | | *d++ = 0; |
| 48 | | return buffer; |
| 49 | | } |
| 50 | | |
| 51 | | |
| 52 | | |
| 53 | 24 | void print_game_device(FILE* out, const game_driver* game) |
| 54 | 25 | { |
| 55 | 26 | const struct IODevice* devices; |
| r1083 | r1084 | |
| 63 | 34 | for (devindex = 0; devices[devindex].type < IO_COUNT; devindex++) |
| 64 | 35 | { |
| 65 | 36 | /* print out device type */ |
| 66 | | fprintf(out, "\t\t<device type=\"%s\"", normalize_string(device_typename(devices[devindex].type))); |
| 37 | fprintf(out, "\t\t<device type=\"%s\"", xml_normalize_string(device_typename(devices[devindex].type))); |
| 67 | 38 | |
| 68 | 39 | /* does this device have a tag? */ |
| 69 | 40 | if (devices[devindex].tag) |
| 70 | | fprintf(out, " tag=\"%s\"", normalize_string(devices[devindex].tag)); |
| 41 | fprintf(out, " tag=\"%s\"", xml_normalize_string(devices[devindex].tag)); |
| 71 | 42 | |
| 72 | 43 | /* is this device mandatory? */ |
| 73 | 44 | if (devices[devindex].must_be_loaded) |
| r1083 | r1084 | |
| 82 | 53 | shortname = device_briefinstancename(&devices[devindex].devclass, id); |
| 83 | 54 | |
| 84 | 55 | fprintf(out, "\t\t\t<instance"); |
| 85 | | fprintf(out, " name=\"%s\"", normalize_string(name)); |
| 86 | | fprintf(out, " briefname=\"%s\"", normalize_string(shortname)); |
| 56 | fprintf(out, " name=\"%s\"", xml_normalize_string(name)); |
| 57 | fprintf(out, " briefname=\"%s\"", xml_normalize_string(shortname)); |
| 87 | 58 | fprintf(out, "/>\n"); |
| 88 | 59 | } |
| 89 | 60 | |
| r1083 | r1084 | |
| 93 | 64 | while (*ext) |
| 94 | 65 | { |
| 95 | 66 | fprintf(out, "\t\t\t<extension"); |
| 96 | | fprintf(out, " name=\"%s\"", normalize_string(ext)); |
| 67 | fprintf(out, " name=\"%s\"", xml_normalize_string(ext)); |
| 97 | 68 | fprintf(out, "/>\n"); |
| 98 | 69 | ext += strlen(ext) + 1; |
| 99 | 70 | } |