Previous 15994 Revisions Next

r6128 Sunday 18th October, 2009 at 08:37:24 UTC by Robbbert
[MESSUI] Discovered the existence of a system-wide software setting; added this to the Device View directory search.
[src/mess/osd/winui]messui.c

src/mess/osd/winui/messui.c
r6127r6128
850850   2009-10-18 Robbbert:
851851   I've attempted to set the directory properly. Since the emulation is not running at this time,
852852   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).
857854
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
858862static BOOL DevView_GetOpenFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength)
859863{
860864   BOOL bResult;
r6127r6128
883887      /* Make sure a folder was specified in the tab, and that it exists */
884888      if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1))
885889      {
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());
890892
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         }
894910      }
895911   }
896912
r6127r6128
904920
905921/* This is used to Create an image in the device view of MESSUI. The directory in the dialog box is not
906922   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. */
910923
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
911930static BOOL DevView_GetCreateFileName(HWND hwndDevView, const machine_config *config, const device_config *dev, LPTSTR pszFilename, UINT nFilenameLength)
912931{
913932   BOOL bResult;
r6127r6128
929948   /* Make sure a folder was specified in the tab, and that it exists */
930949   if ((!osd_opendir(astring_c(as))) || (astring_chr(as, 0, ':') == -1))
931950   {
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());
936953
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      }
940971   }
941972
942973   astring_free(as);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team