src/mess/osd/winui/messui.c
| r7843 | r7844 | |
| 898 | 898 | static BOOL DevView_GetOpenFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength) |
| 899 | 899 | { |
| 900 | 900 | BOOL bResult; |
| 901 | | TCHAR *s; |
| 901 | TCHAR *t_s; |
| 902 | 902 | int i; |
| 903 | 903 | mess_image_type imagetypes[64]; |
| 904 | 904 | HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST); |
| r7843 | r7844 | |
| 907 | 907 | |
| 908 | 908 | /* Get the path to the currently mounted image */ |
| 909 | 909 | zippath_parent(&as, GetSelectedSoftware(drvindex, config, dev)); |
| 910 | | s = tstring_from_utf8(astring_c(&as)); |
| 910 | t_s = tstring_from_utf8(astring_c(&as)); |
| 911 | 911 | |
| 912 | 912 | /* See if an image was loaded, and that the path still exists */ |
| 913 | 913 | if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1)) |
| r7843 | r7844 | |
| 918 | 918 | /* We only want the first path; throw out the rest */ |
| 919 | 919 | i = astring_chr(&as, 0, ';'); |
| 920 | 920 | if (i > 0) astring_substr(&as, 0, i); |
| 921 | | global_free(s); |
| 922 | | s = tstring_from_utf8(astring_c(&as)); |
| 921 | global_free(t_s); |
| 922 | t_s = tstring_from_utf8(astring_c(&as)); |
| 923 | 923 | |
| 924 | 924 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 925 | 925 | if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1)) |
| r7843 | r7844 | |
| 930 | 930 | /* We only want the first path; throw out the rest */ |
| 931 | 931 | i = astring_chr(&as, 0, ';'); |
| 932 | 932 | if (i > 0) astring_substr(&as, 0, i); |
| 933 | | global_free(s); |
| 934 | | s = tstring_from_utf8(astring_c(&as)); |
| 933 | global_free(t_s); |
| 934 | t_s = tstring_from_utf8(astring_c(&as)); |
| 935 | 935 | |
| 936 | 936 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 937 | 937 | if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1)) |
| r7843 | r7844 | |
| 940 | 940 | |
| 941 | 941 | osd_get_full_path(&dst,"."); |
| 942 | 942 | /* Default to emu directory */ |
| 943 | | global_free(s); |
| 944 | | s = tstring_from_utf8(dst); |
| 943 | global_free(t_s); |
| 944 | t_s = tstring_from_utf8(dst); |
| 945 | 945 | |
| 946 | 946 | /* If software folder exists, use it instead */ |
| 947 | 947 | zippath_combine(&as, dst, "software"); |
| 948 | 948 | if (osd_opendir(astring_c(&as))) |
| 949 | 949 | { |
| 950 | | global_free(s); |
| 951 | | s = tstring_from_utf8(astring_c(&as)); |
| 950 | global_free(t_s); |
| 951 | t_s = tstring_from_utf8(astring_c(&as)); |
| 952 | 952 | } |
| 953 | 953 | global_free(dst); |
| 954 | 954 | } |
| r7843 | r7844 | |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev); |
| 959 | | bResult = CommonFileImageDialog(s, GetOpenFileName, pszFilename, config, imagetypes); |
| 959 | bResult = CommonFileImageDialog(t_s, GetOpenFileName, pszFilename, config, imagetypes); |
| 960 | 960 | CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); |
| 961 | 961 | |
| 962 | | global_free(s); |
| 962 | global_free(t_s); |
| 963 | 963 | |
| 964 | 964 | return bResult; |
| 965 | 965 | } |
| r7843 | r7844 | |
| 977 | 977 | static BOOL DevView_GetCreateFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength) |
| 978 | 978 | { |
| 979 | 979 | BOOL bResult; |
| 980 | | TCHAR *s; |
| 980 | TCHAR *t_s; |
| 981 | 981 | int i; |
| 982 | 982 | mess_image_type imagetypes[64]; |
| 983 | 983 | HWND hwndList = GetDlgItem(GetMainWindow(), IDC_LIST); |
| r7843 | r7844 | |
| 990 | 990 | /* We only want the first path; throw out the rest */ |
| 991 | 991 | i = astring_chr(&as, 0, ';'); |
| 992 | 992 | if (i > 0) astring_substr(&as, 0, i); |
| 993 | | s = tstring_from_utf8(astring_c(&as)); |
| 993 | t_s = tstring_from_utf8(astring_c(&as)); |
| 994 | 994 | |
| 995 | 995 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 996 | 996 | if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1)) |
| r7843 | r7844 | |
| 1001 | 1001 | /* We only want the first path; throw out the rest */ |
| 1002 | 1002 | i = astring_chr(&as, 0, ';'); |
| 1003 | 1003 | if (i > 0) astring_substr(&as, 0, i); |
| 1004 | | global_free(s); |
| 1005 | | s = tstring_from_utf8(astring_c(&as)); |
| 1004 | global_free(t_s); |
| 1005 | t_s = tstring_from_utf8(astring_c(&as)); |
| 1006 | 1006 | |
| 1007 | 1007 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 1008 | 1008 | if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1)) |
| r7843 | r7844 | |
| 1011 | 1011 | |
| 1012 | 1012 | osd_get_full_path(&dst,"."); |
| 1013 | 1013 | /* Default to emu directory */ |
| 1014 | | global_free(s); |
| 1015 | | s = tstring_from_utf8(dst); |
| 1014 | global_free(t_s); |
| 1015 | t_s = tstring_from_utf8(dst); |
| 1016 | 1016 | |
| 1017 | 1017 | /* If software folder exists, use it instead */ |
| 1018 | 1018 | zippath_combine(&as, dst, "software"); |
| 1019 | 1019 | if (osd_opendir(astring_c(&as))) |
| 1020 | 1020 | { |
| 1021 | | global_free(s); |
| 1022 | | s = tstring_from_utf8(astring_c(&as)); |
| 1021 | global_free(t_s); |
| 1022 | t_s = tstring_from_utf8(astring_c(&as)); |
| 1023 | 1023 | } |
| 1024 | 1024 | global_free(dst); |
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev); |
| 1029 | | bResult = CommonFileImageDialog(s, GetSaveFileName, pszFilename, config, imagetypes); |
| 1029 | bResult = CommonFileImageDialog(t_s, GetSaveFileName, pszFilename, config, imagetypes); |
| 1030 | 1030 | CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); |
| 1031 | 1031 | |
| 1032 | | global_free(s); |
| 1032 | global_free(t_s); |
| 1033 | 1033 | |
| 1034 | 1034 | return bResult; |
| 1035 | 1035 | } |
src/mess/osd/winui/devview.c
| r7843 | r7844 | |
| 70 | 70 | DestroyWindow(pDevViewInfo->pEntries[i].hwndEdit); |
| 71 | 71 | DestroyWindow(pDevViewInfo->pEntries[i].hwndBrowseButton); |
| 72 | 72 | } |
| 73 | | global_free(pDevViewInfo->pEntries); |
| 73 | free(pDevViewInfo->pEntries); |
| 74 | 74 | pDevViewInfo->pEntries = NULL; |
| 75 | 75 | } |
| 76 | 76 | |
| r7843 | r7844 | |
| 188 | 188 | int nStaticPos, nStaticWidth, nEditPos, nEditWidth, nButtonPos, nButtonWidth; |
| 189 | 189 | HDC hDc; |
| 190 | 190 | LPTSTR *ppszDevices; |
| 191 | | LPTSTR s; |
| 191 | LPTSTR t_s; |
| 192 | 192 | SIZE sz; |
| 193 | 193 | LONG_PTR l; |
| 194 | 194 | |
| r7843 | r7844 | |
| 214 | 214 | { |
| 215 | 215 | image_device_info info = image_device_getinfo(pDevViewInfo->config->mconfig, dev); |
| 216 | 216 | |
| 217 | | s = tstring_from_utf8(info.name); |
| 218 | | ppszDevices[i] = (TCHAR*)alloca((_tcslen(s) + 1) * sizeof(TCHAR)); |
| 219 | | _tcscpy(ppszDevices[i], s); |
| 220 | | global_free(s); |
| 217 | t_s = tstring_from_utf8(info.name); |
| 218 | ppszDevices[i] = (TCHAR*)alloca((_tcslen(t_s) + 1) * sizeof(TCHAR)); |
| 219 | _tcscpy(ppszDevices[i], t_s); |
| 220 | global_free(t_s); |
| 221 | 221 | i++; |
| 222 | 222 | } |
| 223 | 223 | } |
| r7843 | r7844 | |
| 379 | 379 | DevView_Clear(hwndDevView); |
| 380 | 380 | pDevViewInfo = GetDevViewInfo(hwndDevView); |
| 381 | 381 | DeleteObject(pDevViewInfo->hFont); |
| 382 | | global_free(pDevViewInfo); |
| 382 | free(pDevViewInfo); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |