src/mess/osd/winui/messui.c
| r2470 | r2471 | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 | |
| 7 | // standard windows headers |
| 7 | 8 | #define WIN32_LEAN_AND_MEAN |
| 8 | 9 | #include <assert.h> |
| 9 | 10 | #include <string.h> |
| r2470 | r2471 | |
| 15 | 16 | #include <winuser.h> |
| 16 | 17 | #include <tchar.h> |
| 17 | 18 | |
| 19 | // MAME/MAMEOS/MAMEUI/MESS headers |
| 18 | 20 | #include "screenshot.h" |
| 19 | 21 | #include "bitmask.h" |
| 20 | 22 | #include "winui.h" |
| r2470 | r2471 | |
| 34 | 36 | #include "messui.h" |
| 35 | 37 | #include "winutf8.h" |
| 36 | 38 | |
| 39 | |
| 40 | //============================================================ |
| 41 | // PARAMETERS |
| 42 | //============================================================ |
| 43 | |
| 37 | 44 | #define LOG_SOFTWARE 0 |
| 38 | 45 | |
| 39 | | static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn); |
| 40 | 46 | |
| 41 | | static LPCSTR SoftwareTabView_GetTabShortName(int tab); |
| 42 | | static LPCSTR SoftwareTabView_GetTabLongName(int tab); |
| 43 | | static void SoftwareTabView_OnSelectionChanged(void); |
| 44 | | static void SoftwareTabView_OnMoveSize(void); |
| 45 | | static void SetupSoftwareTabView(void); |
| 47 | //============================================================ |
| 48 | // TYPEDEFS |
| 49 | //============================================================ |
| 46 | 50 | |
| 51 | typedef struct _mess_image_type mess_image_type; |
| 52 | struct _mess_image_type |
| 53 | { |
| 54 | const device_config *dev; |
| 55 | const char *ext; |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | typedef struct _device_entry device_entry; |
| 60 | struct _device_entry |
| 61 | { |
| 62 | iodevice_t dev_type; |
| 63 | const char *icon_name; |
| 64 | const char *dlgname; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | //============================================================ |
| 71 | // GLOBAL VARIABLES |
| 72 | //============================================================ |
| 73 | |
| 74 | char g_szSelectedItem[MAX_PATH]; |
| 75 | |
| 76 | |
| 77 | |
| 78 | //============================================================ |
| 79 | // LOCAL VARIABLES |
| 80 | //============================================================ |
| 81 | |
| 82 | static int s_nGame; |
| 83 | static BOOL s_bIgnoreSoftwarePickerNotifies; |
| 84 | |
| 85 | static int *mess_icon_index; |
| 86 | |
| 87 | // TODO - We need to make icons for Cylinders, Punch Cards, and Punch Tape! |
| 88 | static const device_entry s_devices[] = |
| 89 | { |
| 90 | { IO_CARTSLOT, "roms", "Cartridge images" }, |
| 91 | { IO_FLOPPY, "floppy", "Floppy disk images" }, |
| 92 | { IO_HARDDISK, "hard", "Hard disk images" }, |
| 93 | { IO_CYLINDER, NULL, "Cylinders" }, |
| 94 | { IO_CASSETTE, NULL, "Cassette images" }, |
| 95 | { IO_PUNCHCARD, NULL, "Punchcard images" }, |
| 96 | { IO_PUNCHTAPE, NULL, "Punchtape images" }, |
| 97 | { IO_PRINTER, NULL, "Printer Output" }, |
| 98 | { IO_SERIAL, NULL, "Serial Output" }, |
| 99 | { IO_PARALLEL, NULL, "Parallel Output" }, |
| 100 | { IO_SNAPSHOT, "snapshot", "Snapshots" }, |
| 101 | { IO_QUICKLOAD, "snapshot", "Quickloads" }, |
| 102 | { IO_MEMCARD, NULL, "Memory cards" }, |
| 103 | { IO_CDROM, NULL, "CD-ROM images" } |
| 104 | }; |
| 105 | |
| 106 | |
| 107 | |
| 47 | 108 | static const LPCTSTR mess_column_names[] = |
| 48 | 109 | { |
| 49 | 110 | TEXT("Software"), |
| r2470 | r2471 | |
| 56 | 117 | TEXT("MD5") |
| 57 | 118 | }; |
| 58 | 119 | |
| 59 | | static int *mess_icon_index; |
| 60 | 120 | |
| 121 | |
| 122 | //============================================================ |
| 123 | // PROTOTYPES |
| 124 | //============================================================ |
| 125 | |
| 126 | static void SoftwarePicker_OnHeaderContextMenu(POINT pt, int nColumn); |
| 127 | |
| 128 | static LPCSTR SoftwareTabView_GetTabShortName(int tab); |
| 129 | static LPCSTR SoftwareTabView_GetTabLongName(int tab); |
| 130 | static void SoftwareTabView_OnSelectionChanged(void); |
| 131 | static void SoftwareTabView_OnMoveSize(void); |
| 132 | static void SetupSoftwareTabView(void); |
| 133 | |
| 61 | 134 | static void MessOpenOtherSoftware(const device_config *dev); |
| 62 | 135 | static void MessCreateDevice(const device_config *dev); |
| 63 | 136 | static void MessRefreshPicker(int drvindex); |
| r2470 | r2471 | |
| 75 | 148 | static void MessTestsBegin(void); |
| 76 | 149 | #endif /* MAME_DEBUG */ |
| 77 | 150 | |
| 78 | | char g_szSelectedItem[MAX_PATH]; |
| 79 | 151 | |
| 80 | | static int s_nGame; |
| 81 | | static BOOL s_bIgnoreSoftwarePickerNotifies; |
| 82 | 152 | |
| 83 | | struct deviceentry |
| 84 | | { |
| 85 | | iodevice_t dev_type; |
| 86 | | const char *icon_name; |
| 87 | | const char *dlgname; |
| 88 | | }; |
| 153 | //============================================================ |
| 154 | // PICKER/TABVIEW CALLBACKS |
| 155 | //============================================================ |
| 89 | 156 | |
| 90 | 157 | static const struct PickerCallbacks s_softwareListCallbacks = |
| 91 | 158 | { |
| r2470 | r2471 | |
| 135 | 202 | |
| 136 | 203 | |
| 137 | 204 | |
| 138 | | // ------------------------------------------------------------------------ |
| 139 | | // Image types |
| 205 | //============================================================ |
| 206 | // Image types |
| 140 | 207 | // |
| 141 | | // IO_ZIP is used for ZIP files |
| 142 | | // IO_ALIAS is used for unknown types |
| 143 | | // IO_COUNT is used for bad files |
| 144 | | // ------------------------------------------------------------------------ |
| 208 | // IO_ZIP is used for ZIP files |
| 209 | // IO_UNKNOWN is used for unknown types |
| 210 | // IO_BAD is used for bad files |
| 211 | //============================================================ |
| 145 | 212 | |
| 146 | 213 | #define IO_ZIP (IO_COUNT + 0) |
| 147 | 214 | #define IO_BAD (IO_COUNT + 1) |
| 148 | 215 | #define IO_UNKNOWN (IO_COUNT + 2) |
| 149 | 216 | |
| 150 | | // TODO - We need to make icons for Cylinders, Punch Cards, and Punch Tape! |
| 151 | | static const struct deviceentry s_devices[] = |
| 152 | | { |
| 153 | | { IO_CARTSLOT, "roms", "Cartridge images" }, |
| 154 | | { IO_FLOPPY, "floppy", "Floppy disk images" }, |
| 155 | | { IO_HARDDISK, "hard", "Hard disk images" }, |
| 156 | | { IO_CYLINDER, NULL, "Cylinders" }, |
| 157 | | { IO_CASSETTE, NULL, "Cassette images" }, |
| 158 | | { IO_PUNCHCARD, NULL, "Punchcard images" }, |
| 159 | | { IO_PUNCHTAPE, NULL, "Punchtape images" }, |
| 160 | | { IO_PRINTER, NULL, "Printer Output" }, |
| 161 | | { IO_SERIAL, NULL, "Serial Output" }, |
| 162 | | { IO_PARALLEL, NULL, "Parallel Output" }, |
| 163 | | { IO_SNAPSHOT, "snapshot", "Snapshots" }, |
| 164 | | { IO_QUICKLOAD, "snapshot", "Quickloads" }, |
| 165 | | { IO_MEMCARD, NULL, "Memory cards" }, |
| 166 | | { IO_CDROM, NULL, "CD-ROM images" } |
| 167 | | }; |
| 217 | //============================================================ |
| 218 | // IMPLEMENTATION |
| 219 | //============================================================ |
| 168 | 220 | |
| 169 | | |
| 170 | | |
| 171 | | static const struct deviceentry *lookupdevice(iodevice_t d) |
| 221 | static const device_entry *lookupdevice(iodevice_t d) |
| 172 | 222 | { |
| 173 | 223 | int i; |
| 174 | 224 | for (i = 0; i < ARRAY_LENGTH(s_devices); i++) |
| r2470 | r2471 | |
| 181 | 231 | |
| 182 | 232 | |
| 183 | 233 | |
| 184 | | // ------------------------------------------------------------------------ |
| 185 | | // UI |
| 186 | | // ------------------------------------------------------------------------ |
| 187 | | |
| 188 | 234 | BOOL CreateMessIcons(void) |
| 189 | 235 | { |
| 190 | 236 | int i; |
| r2470 | r2471 | |
| 572 | 618 | // Open others dialog |
| 573 | 619 | // ------------------------------------------------------------------------ |
| 574 | 620 | |
| 575 | | typedef struct |
| 576 | | { |
| 577 | | const device_config *dev; |
| 578 | | const char *ext; |
| 579 | | } mess_image_type; |
| 580 | | |
| 581 | 621 | static BOOL CommonFileImageDialog(LPTSTR the_last_directory, common_file_dialog_proc cfd, LPTSTR filename, const machine_config *config, mess_image_type *imagetypes) |
| 582 | 622 | { |
| 583 | 623 | BOOL success; |
| r2470 | r2471 | |
| 927 | 967 | LPCSTR pszName; |
| 928 | 968 | LPSTR s; |
| 929 | 969 | int drvindex; |
| 930 | | const device_config *device; |
| 931 | 970 | HWND hwndList; |
| 932 | 971 | |
| 933 | 972 | hwndList = GetDlgItem(GetMainWindow(), IDC_LIST); |
| r2470 | r2471 | |
| 942 | 981 | pszName = s ? s + 1 : pszFullName; |
| 943 | 982 | |
| 944 | 983 | // Do the dirty work |
| 945 | | device = SoftwarePicker_LookupDevice(hwndSoftwarePicker, nItem); |
| 946 | | if (device == NULL) |
| 947 | | return; |
| 948 | 984 | MessSpecifyImage(drvindex, NULL, pszFullName); |
| 949 | 985 | |
| 950 | 986 | // Set up s_szSelecteItem, for the benefit of UpdateScreenShot() |