src/mess/osd/winui/messui.c
| r6127 | r6128 | |
| 850 | 850 | 2009-10-18 Robbbert: |
| 851 | 851 | I've attempted to set the directory properly. Since the emulation is not running at this time, |
| 852 | 852 | we cannot do the same as the NEWUI does, that is, "initial_dir = image_working_directory(dev);" |
| 853 | | because a crash occurs (the image system isn't set up yet). So, if an image is already mounted |
| 854 | | we can use the directory it is in. Otherwise, we can use the "software" folder assuming that |
| 855 | | the user has set one up. If this fails, use the mess software directory if it exists. Otherwise |
| 856 | | use the mess root directory. */ |
| 853 | because a crash occurs (the image system isn't set up yet). |
| 857 | 854 | |
| 855 | Order of priority: |
| 856 | 1. Directory where existing image is already loaded from |
| 857 | 2. First directory specified in game-specific software tab |
| 858 | 3. First directory specified in the system-wide software directories |
| 859 | 4. mess-folder\software |
| 860 | 5. mess-folder */ |
| 861 | |
| 858 | 862 | static BOOL DevView_GetOpenFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength) |
| 859 | 863 | { |
| 860 | 864 | BOOL bResult; |
| r6127 | r6128 | |
| 883 | 887 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 884 | 888 | if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1)) |
| 885 | 889 | { |
| 886 | | /* Default to emu directory */ |
| 887 | | char mess_directory[1024]; |
| 888 | | osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory)); |
| 889 | | s = mess_directory; |
| 890 | /* Get the path from the system-wide software setting in the drop-down directory setup */ |
| 891 | astring_cpyc(as, GetSoftwareDirs()); |
| 890 | 892 | |
| 891 | | /* If software folder exists, use it instead - TODO: do properly when bug 1709 gets done */ |
| 892 | | zippath_combine(as, mess_directory, "software"); |
| 893 | | if (osd_opendir(astring_c(as))) s = (char*)astring_c(as); |
| 893 | /* We only want the first path; throw out the rest */ |
| 894 | i = astring_chr(as, 0, ';'); |
| 895 | if (i > 0) astring_substr(as, 0, i); |
| 896 | s = (char*)astring_c(as); |
| 897 | |
| 898 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 899 | if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1)) |
| 900 | { |
| 901 | /* Default to emu directory */ |
| 902 | char mess_directory[1024]; |
| 903 | osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory)); |
| 904 | s = mess_directory; |
| 905 | |
| 906 | /* If software folder exists, use it instead */ |
| 907 | zippath_combine(as, mess_directory, "software"); |
| 908 | if (osd_opendir(astring_c(as))) s = (char*)astring_c(as); |
| 909 | } |
| 894 | 910 | } |
| 895 | 911 | } |
| 896 | 912 | |
| r6127 | r6128 | |
| 904 | 920 | |
| 905 | 921 | /* This is used to Create an image in the device view of MESSUI. The directory in the dialog box is not |
| 906 | 922 | set, and is thus random. |
| 907 | | 2009-10-18 Robbbert: |
| 908 | | If the user has set up a "software" folder, this will be used. If this fails, we can use the |
| 909 | | mess software directory if it exists. Otherwise use the mess root directory. */ |
| 910 | 923 | |
| 924 | Order of priority: |
| 925 | 1. First directory specified in game-specific software tab |
| 926 | 2. First directory specified in the system-wide software directories |
| 927 | 3. mess-folder\software |
| 928 | 4. mess-folder */ |
| 929 | |
| 911 | 930 | static BOOL DevView_GetCreateFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength) |
| 912 | 931 | { |
| 913 | 932 | BOOL bResult; |
| r6127 | r6128 | |
| 929 | 948 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 930 | 949 | if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1)) |
| 931 | 950 | { |
| 932 | | /* Default to emu directory */ |
| 933 | | char mess_directory[1024]; |
| 934 | | osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory)); |
| 935 | | s = mess_directory; |
| 951 | /* Get the path from the system-wide software setting in the drop-down directory setup */ |
| 952 | astring_cpyc(as, GetSoftwareDirs()); |
| 936 | 953 | |
| 937 | | /* If software folder exists, use it instead - TODO: do properly when bug 1709 gets done */ |
| 938 | | zippath_combine(as, mess_directory, "software"); |
| 939 | | if (osd_opendir(astring_c(as))) s = (char*)astring_c(as); |
| 954 | /* We only want the first path; throw out the rest */ |
| 955 | i = astring_chr(as, 0, ';'); |
| 956 | if (i > 0) astring_substr(as, 0, i); |
| 957 | s = (char*)astring_c(as); |
| 958 | |
| 959 | /* Make sure a folder was specified in the tab, and that it exists */ |
| 960 | if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1)) |
| 961 | { |
| 962 | /* Default to emu directory */ |
| 963 | char mess_directory[1024]; |
| 964 | osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory)); |
| 965 | s = mess_directory; |
| 966 | |
| 967 | /* If software folder exists, use it instead */ |
| 968 | zippath_combine(as, mess_directory, "software"); |
| 969 | if (osd_opendir(astring_c(as))) s = (char*)astring_c(as); |
| 970 | } |
| 940 | 971 | } |
| 941 | 972 | |
| 942 | 973 | astring_free(as); |