| Previous | 15994 Revisions | Next |
| r2141 Saturday 29th March, 2008 at 14:46:16 UTC by Nathan Woods |
|---|
| Miscellaneous cleanups; moved private data associated with images into a private data structure hanging off of running_machine. Cleaned up various #include-s |
| [src/emu] | mame.h |
| [src/mess] | cheatms.c image.c image.h mesvalid.c |
| [src/mess/devices] | appldriv.h cassette.c chd_cd.c harddriv.c mflopimg.c |
| [src/mess/drivers] | ql.c |
| [src/mess/formats] | zx81_p.c |
| [src/mess/osd/windows] | tapedlg.c |
| [src/mess/tools/imgtool] | filteoln.c filter.c iflopimg.c imgtool.h main.c stream.c |
| [src/mess/tools/imgtool/modules] | thomson.c |
| [src/mess/tools/imgtool/windows] | wimgtool.c |
| [src/mess/video] | zx8301.c zx8301.h |
| r2140 | r2141 | |
|---|---|---|
| 20 | 20 | #include <stdarg.h> |
| 21 | 21 | |
| 22 | 22 | #ifdef MESS |
| 23 | #include " | |
| 23 | #include " | |
| 24 | 24 | #endif /* MESS */ |
| 25 | 25 | |
| 26 | 26 | |
| r2140 | r2141 | |
| 203 | 203 | palette_private * palette_data; /* internal data from palette.c */ |
| 204 | 204 | streams_private * streams_data; /* internal data from streams.c */ |
| 205 | 205 | devices_private * devices_data; /* internal data from devices.c */ |
| 206 | #ifdef MESS | |
| 207 | images_private * images_data; /* internal data from image.c */ | |
| 208 | #endif /* MESS */ | |
| 206 | 209 | |
| 207 | 210 | /* driver-specific information */ |
| 208 | 211 | void * driver_data; /* drivers can hang data off of here instead of using globals */ |
| r2140 | r2141 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | *********************************************************************/ |
| 17 | 17 | |
| 18 | #include "mame.h" | |
| 18 | 19 | #include "harddisk.h" |
| 19 | 20 | #include "harddriv.h" |
| 20 | 21 |
| r2140 | r2141 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | #include "mame.h" | |
| 9 | 10 | #include "cassette.h" |
| 10 | 11 | #include "formats/cassimg.h" |
| 11 | 12 | #include "ui.h" |
| r2140 | r2141 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | #include "mame.h" | |
| 9 | 10 | #include "cdrom.h" |
| 10 | 11 | #include "chd_cd.h" |
| 11 | 12 |
| r2140 | r2141 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | #include " | |
| 9 | #include "mame | |
| 10 | 10 | #include "mflopimg.h" |
| 11 | 11 | #include "flopdrv.h" |
| 12 | 12 | #include "formats/flopimg.h" |
| r2140 | r2141 | |
|---|---|---|
| 9 | 9 | #ifndef APPLDRIV_H |
| 10 | 10 | #define APPLDRIV_H |
| 11 | 11 | |
| 12 | #include "device.h" | |
| 13 | #include "image.h" | |
| 12 | #include "mame.h" | |
| 14 | 13 | |
| 15 | 14 | |
| 16 | 15 | enum |
| r2140 | r2141 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | #include "mame.h" | |
| 9 | 10 | #include "formats/flopimg.h" |
| 10 | 11 | #include "imgtoolx.h" |
| 11 | 12 | #include "library.h" |
| r2140 | r2141 | |
|---|---|---|
| 20 | 20 | #include "winutf8.h" |
| 21 | 21 | #include "winutil.h" |
| 22 | 22 | #include "winutils.h" |
| 23 | #include "mame.h" | |
| 23 | 24 | |
| 24 | 25 | const TCHAR wimgtool_class[] = TEXT("wimgtool_class"); |
| 25 | 26 | const char wimgtool_producttext[] = "MESS Image Tool"; |
| r2140 | r2141 | |
|---|---|---|
| 7 | 7 | *****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include <string.h> |
| 10 | ||
| 10 | 11 | #include "imgtool.h" |
| 11 | 12 | |
| 12 | 13 | #define EOLN (CRLF == 1 ? "\r" : (CRLF == 2 ? "\n" : (CRLF == 3 ? "\r\n" : NULL))) |
| r2140 | r2141 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #include <stdlib.h> |
| 13 | 13 | #include <stdio.h> |
| 14 | ||
| 14 | 15 | #include "osdepend.h" |
| 15 | #include "me | |
| 16 | #include "mame | |
| 16 | 17 | #include "formats/flopimg.h" |
| 17 | 18 | #include "opresolv.h" |
| 18 | 19 | #include "library.h" |
| r2140 | r2141 | |
|---|---|---|
| 12 | 12 | #include <stdlib.h> |
| 13 | 13 | #include <time.h> |
| 14 | 14 | #include <assert.h> |
| 15 | ||
| 16 | #include "mame.h" | |
| 15 | 17 | #include "imgtool.h" |
| 16 | 18 | #include "mess.h" |
| 17 | 19 | #include "main.h" |
| r2140 | r2141 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include <assert.h> |
| 10 | 10 | #include <string.h> |
| 11 | ||
| 11 | 12 | #include "imgtool.h" |
| 12 | 13 | #include "utils.h" |
| 13 | 14 |
| r2140 | r2141 | |
|---|---|---|
| 257 | 257 | int size = f->heads * f->tracks * 16 * f->sector_size; |
| 258 | 258 | stream_seek( f->stream, 0, SEEK_SET ); |
| 259 | 259 | if ( stream_write( f->stream, f->data, size ) < size ) |
| 260 | logerror( "thom_diskimage_close_fd_qd: write error\n" ); | |
| 260 | { | |
| 261 | /* logerror( "thom_diskimage_close_fd_qd: write error\n" ); */ | |
| 262 | } | |
| 261 | 263 | } |
| 262 | 264 | |
| 263 | 265 | stream_close( f->stream ); |
| r2140 | r2141 | |
| 386 | 388 | |
| 387 | 389 | /* image header */ |
| 388 | 390 | if ( stream_write( f->stream, sap_header, 66 ) < 66 ) { |
| 389 | logerror( "thom_diskimage_close_sap: write error\n" ); | |
| 391 | /* logerror( "thom_diskimage_close_sap: write error\n" ); */ | |
| 390 | 392 | return; |
| 391 | 393 | } |
| 392 | 394 | |
| r2140 | r2141 | |
| 412 | 414 | /* save */ |
| 413 | 415 | if ( stream_write( f->stream, buf, f->sector_size + 6 ) < |
| 414 | 416 | f->sector_size + 6 ) { |
| 415 | logerror( "thom_diskimage_close_sap: write error\n" ); | |
| 417 | /* logerror( "thom_diskimage_close_sap: write error\n" ); */ | |
| 416 | 418 | return; |
| 417 | 419 | } |
| 418 | 420 | } |
| r2140 | r2141 | |
|---|---|---|
| 11 | 11 | #include <zlib.h> |
| 12 | 12 | #include <assert.h> |
| 13 | 13 | |
| 14 | #include "mame.h" | |
| 14 | 15 | #include "unzip.h" |
| 15 | 16 | #include "osdcore.h" |
| 16 | 17 | #include "imgtool.h" |
| r2140 | r2141 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | #include <ctype.h> |
| 14 | 14 | |
| 15 | #include "mame.h" | |
| 15 | 16 | #include "image.h" |
| 16 | 17 | #include "mess.h" |
| 17 | 18 | #include "deprecat.h" |
| r2140 | r2141 | |
| 68 | 69 | |
| 69 | 70 | |
| 70 | 71 | |
| 71 | /*************************************************************************** | |
| 72 | GLOBAL VARIABLES | |
| 73 | ***************************************************************************/ | |
| 72 | struct _images_private | |
| 73 | { | |
| 74 | UINT32 multiple_dev_mask; | |
| 75 | mess_image images[1]; | |
| 76 | }; | |
| 74 | 77 | |
| 75 | static mess_image *images; | |
| 76 | static UINT32 multiple_dev_mask; | |
| 77 | 78 | |
| 78 | 79 | |
| 79 | ||
| 80 | 80 | /*************************************************************************** |
| 81 | 81 | FUNCTION PROTOTYPES |
| 82 | 82 | ***************************************************************************/ |
| r2140 | r2141 | |
| 110 | 110 | { |
| 111 | 111 | int err; |
| 112 | 112 | int count, indx; |
| 113 | UINT32 mask, dev_mask = 0; | |
| 113 | UINT32 mask, dev_mask = 0, multiple_dev_mask = 0; | |
| 114 | 114 | const struct IODevice *dev; |
| 115 | size_t private_size; | |
| 115 | 116 | |
| 116 | /* setup the globals */ | |
| 117 | images = NULL; | |
| 118 | multiple_dev_mask = 0; | |
| 119 | ||
| 120 | 117 | /* first count all images, and identify multiply defined devices */ |
| 121 | 118 | count = 0; |
| 122 | 119 | for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev)) |
| r2140 | r2141 | |
| 136 | 133 | count++; |
| 137 | 134 | } |
| 138 | 135 | |
| 139 | /* allocate the array */ | |
| 140 | if (count > 0) | |
| 141 | { | |
| 142 | images = auto_malloc(count * sizeof(*images)); | |
| 143 | memset(images, 0, count * sizeof(*images)); | |
| 144 | } | |
| 136 | /* allocate the private structure */ | |
| 137 | private_size = sizeof(*machine->images_data) + ((count - 1) | |
| 138 | * sizeof(machine->images_data->images[0])); | |
| 139 | machine->images_data = (images_private *) auto_malloc(private_size); | |
| 140 | memset(machine->images_data, '\0', private_size); | |
| 145 | 141 | |
| 142 | /* some setup */ | |
| 143 | machine->images_data->multiple_dev_mask = multiple_dev_mask; | |
| 144 | ||
| 146 | 145 | /* initialize the devices */ |
| 147 | 146 | indx = 0; |
| 148 | 147 | for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev)) |
| 149 | 148 | { |
| 150 | images[indx].mempool = pool_alloc(memory_error); | |
| 149 | machine->images_data->images[indx].mempool = pool_alloc(memory_error); | |
| 151 | 150 | |
| 152 | 151 | /* setup the device */ |
| 153 | tagpool_init(&images[indx].tagpool); | |
| 154 | images[indx].dev = dev; | |
| 152 | tagpool_init(&machine->images_data->images[indx].tagpool); | |
| 153 | machine->images_data->images[indx].dev = dev; | |
| 155 | 154 | |
| 156 | 155 | if (dev->init != NULL) |
| 157 | 156 | { |
| 158 | err = dev->init(&images[indx]); | |
| 157 | err = dev->init(&machine->images_data->images[indx]); | |
| 159 | 158 | if (err != INIT_PASS) |
| 160 | 159 | return err; |
| 161 | 160 | } |
| r2140 | r2141 | |
| 178 | 177 | mess_image *image; |
| 179 | 178 | const struct IODevice *dev; |
| 180 | 179 | |
| 181 | /* unload all devices */ | |
| 182 | image_unload_all(FALSE); | |
| 183 | image_unload_all(TRUE); | |
| 180 | if (machine->images_data != NULL) | |
| 181 | { | |
| 182 | /* unload all devices */ | |
| 183 | image_unload_all(FALSE); | |
| 184 | image_unload_all(TRUE); | |
| 184 | 185 | |
| 185 | indx = 0; | |
| 186 | indx = 0; | |
| 186 | 187 | |
| 187 | for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev)) | |
| 188 | { | |
| 189 | /* identify the image */ | |
| 190 | image = &images[indx]; | |
| 188 | for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev)) | |
| 189 | { | |
| 190 | /* identify the image */ | |
| 191 | image = &machine->images_data->images[indx]; | |
| 191 | 192 | |
| 192 | /* call the exit handler if appropriate */ | |
| 193 | if (dev->exit != NULL) | |
| 194 | dev->exit(image); | |
| 193 | /* call the exit handler if appropriate */ | |
| 194 | if (dev->exit != NULL) | |
| 195 | dev->exit(image); | |
| 195 | 196 | |
| 196 | /* free the tagpool */ | |
| 197 | tagpool_exit(&images[indx].tagpool); | |
| 197 | /* free the tagpool */ | |
| 198 | tagpool_exit(&image->tagpool); | |
| 198 | 199 | |
| 199 | /* free the working directory */ | |
| 200 | if (image->working_directory != NULL) | |
| 201 | { | |
| 202 | free(image->working_directory); | |
| 203 | image->working_directory = NULL; | |
| 200 | /* free the working directory */ | |
| 201 | if (image->working_directory != NULL) | |
| 202 | { | |
| 203 | free(image->working_directory); | |
| 204 | image->working_directory = NULL; | |
| 205 | } | |
| 206 | ||
| 207 | /* free the memory pool */ | |
| 208 | pool_free(image->mempool); | |
| 209 | image->mempool = NULL; | |
| 210 | indx++; | |
| 204 | 211 | } |
| 205 | 212 | |
| 206 | /* free the memory pool */ | |
| 207 | pool_free(image->mempool); | |
| 208 | image->mempool = NULL; | |
| 209 | indx++; | |
| 213 | machine->images_data = NULL; | |
| 210 | 214 | } |
| 211 | 215 | } |
| 212 | 216 | |
| r2140 | r2141 | |
| 1566 | 1570 | |
| 1567 | 1571 | int image_absolute_index(mess_image *image) |
| 1568 | 1572 | { |
| 1569 | return image - images; | |
| 1573 | return image - Machine->images_data->images; | |
| 1570 | 1574 | } |
| 1571 | 1575 | |
| 1572 | 1576 | |
| 1573 | 1577 | |
| 1574 | 1578 | mess_image *image_from_absolute_index(int absolute_index) |
| 1575 | 1579 | { |
| 1576 | return &images[absolute_index]; | |
| 1580 | return &Machine->images_data->images[absolute_index]; | |
| 1577 | 1581 | } |
| 1578 | 1582 | |
| 1579 | 1583 | |
| r2140 | r2141 | |
| 1599 | 1603 | { |
| 1600 | 1604 | if (device == dev) |
| 1601 | 1605 | { |
| 1602 | image = &images[indx]; | |
| 1606 | image = &Machine->images_data->images[indx]; | |
| 1603 | 1607 | break; |
| 1604 | 1608 | } |
| 1605 | 1609 | indx++; |
| r2140 | r2141 | |
| 1624 | 1628 | { |
| 1625 | 1629 | if (dev->tag && !strcmp(dev->tag, devtag) && (device_index++ == id)) |
| 1626 | 1630 | { |
| 1627 | image = &images[indx]; | |
| 1631 | image = &Machine->images_data->images[indx]; | |
| 1628 | 1632 | break; |
| 1629 | 1633 | } |
| 1630 | 1634 | indx++; |
| r2140 | r2141 | |
| 1652 | 1656 | { |
| 1653 | 1657 | if ((type == dev->type) && (device_index++ == id)) |
| 1654 | 1658 | { |
| 1655 | image = &images[indx]; | |
| 1659 | image = &Machine->images_data->images[indx]; | |
| 1656 | 1660 | break; |
| 1657 | 1661 | } |
| 1658 | 1662 | indx++; |
| r2140 | r2141 | |
|---|---|---|
| 4 | 4 | * |
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 | |
| 7 | #include " | |
| 7 | #include "mam | |
| 8 | 8 | #include "zx8301.h" |
| 9 | 9 | |
| 10 | 10 |
| r2140 | r2141 | |
|---|---|---|
| 7 | 7 | #ifndef ZX8301_H_ |
| 8 | 8 | #define ZX8301_H_ |
| 9 | 9 | |
| 10 | #include "mame.h" | |
| 11 | #include "driver.h" | |
| 10 | 12 | |
| 13 | ||
| 11 | 14 | /*----------- defined in video/zx8301.c -----------*/ |
| 12 | 15 | |
| 13 | 16 | WRITE8_HANDLER( zx8301_control_w ); |
| r2140 | r2141 | |
|---|---|---|
| 13 | 13 | #include "fileio.h" |
| 14 | 14 | #include "utils.h" |
| 15 | 15 | #include "opresolv.h" |
| 16 | #include "device.h" | |
| 17 | #include "osdmess.h" | |
| 16 | 18 | |
| 17 | 19 | typedef enum |
| 18 | 20 | { |
| r2140 | r2141 | |
| 26 | 28 | IMAGE_ERROR_UNSPECIFIED |
| 27 | 29 | } image_error_t; |
| 28 | 30 | |
| 31 | struct _images_private; | |
| 32 | typedef struct _images_private images_private; | |
| 29 | 33 | |
| 30 | 34 | |
| 35 | ||
| 31 | 36 | /**************************************************************************** |
| 32 | 37 | A mess_image pointer represents one device entry; this could be an instance |
| 33 | 38 | of a floppy drive or a printer. The defining property is that either at |
| r2140 | r2141 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include <ctype.h> |
| 10 | 10 | |
| 11 | #include "mame.h" | |
| 11 | 12 | #include "mess.h" |
| 12 | 13 | #include "device.h" |
| 13 | 14 | #include "inputx.h" |
| r2140 | r2141 | |
|---|---|---|
| 10 | 10 | #include <commctrl.h> |
| 11 | 11 | |
| 12 | 12 | // MAME/MESS headers |
| 13 | #include "mame.h" | |
| 13 | 14 | #include "tapedlg.h" |
| 14 | 15 | #include "mess.h" |
| 15 | 16 | #include "messres.h" |
| r2140 | r2141 | |
|---|---|---|
| 1 | /**************************************************************************** | |
| 2 | ||
| 3 | cheatms.c | |
| 4 | ||
| 5 | MESS sepcific cheat code | |
| 6 | ||
| 7 | ****************************************************************************/ | |
| 8 | ||
| 9 | ||
| 10 | #include "mame.h" | |
| 1 | 11 | #include "mess.h" |
| 2 | 12 | #include "image.h" |
| 3 | 13 | #include "cheatms.h" |
| r2140 | r2141 | |
| 2 | 12 | |
| 13 | ||
| 14 | /*************************************************************************** | |
| 15 | GLOBALS | |
| 16 | ***************************************************************************/ | |
| 17 | ||
| 3 | 18 | static UINT32 * deviceCRCList = NULL; |
| r2140 | r2141 | |
| 8 | 23 | |
| 9 | 24 | |
| 10 | 25 | |
| 26 | /*************************************************************************** | |
| 27 | CODE | |
| 28 | ***************************************************************************/ | |
| 29 | ||
| 11 | 30 | static void BuildCRCTable(void) |
| 12 | 31 | { |
| 13 | 32 | int deviceType, deviceID, listIdx; |
| r2140 | r2141 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | *****************************************************************************/ |
| 31 | 31 | |
| 32 | #include " | |
| 32 | #include " | |
| 33 | 33 | #include "zx81_p.h" |
| 34 | 34 | #include "osdepend.h" |
| 35 | 35 | #include "devices/cassette.h" |
| r2140 | r2141 | |
|---|---|---|
| 1 | #include " | |
| 1 | #include "mam | |
| 2 | 2 | #include "cpu/i8039/i8039.h" |
| 3 | 3 | #include "cpu/m68000/m68000.h" |
| 4 | 4 | #include "devices/cartslot.h" |
| Previous | 15994 Revisions | Next |