Previous 15994 Revisions Next

r7344 Saturday 13th February, 2010 at 20:22:52 UTC by Miodrag Milanović
osd_get_emulator_directory call removed.
[src/mess]image.c
[src/mess/osd/winui]messui.c
[src/osd]osdcore.h
[src/osd/sdl]sdlfile.c sdlmain.c sdlos_macosx.c sdlos_unix.c sdlos_win32.c
[src/osd/windows]winfile.c

src/osd/sdl/sdlos_macosx.c
r7343r7344
383383
384384   return err;
385385}
386
387//============================================================
388//  osd_get_emulator_directory
389//============================================================
390extern char sdl_cwd[512];
391void osd_get_emulator_directory(char *dir, size_t dir_size)
392{
393   strncpy(dir, sdl_cwd, dir_size);
394}
src/osd/sdl/sdlos_win32.c
r7343r7344
548548      free(t_path);
549549   return err;
550550}
551
552//============================================================
553//  win_get_module_file_name_utf8
554//============================================================
555
556static DWORD win_get_module_file_name_utf8(HMODULE module, char *filename, DWORD size)
557{
558   TCHAR t_filename[MAX_PATH];
559   char *utf8_filename;
560
561   if (GetModuleFileName(module, t_filename, ARRAY_LENGTH(t_filename)) == 0)
562      return 0;
563
564   utf8_filename = utf8_from_tstring(t_filename);
565   if (!utf8_filename)
566      return 0;
567
568   size = (DWORD) snprintf(filename, size, "%s", utf8_filename);
569   free(utf8_filename);
570   return size;
571}
572
573//============================================================
574//  osd_get_emulator_directory
575//============================================================
576
577void osd_get_emulator_directory(char *dir, size_t dir_size)
578{
579   char *s;
580   win_get_module_file_name_utf8(NULL, dir, dir_size);
581   s = strrchr(dir, '\\');
582   if (s)
583      s[1] = '\0';
584}
No newline at end of file
src/osd/sdl/sdlos_unix.c
r7343r7344
303303
304304   return err;
305305}
306
307//============================================================
308//  osd_get_emulator_directory
309//============================================================
310extern char sdl_cwd[512];
311void osd_get_emulator_directory(char *dir, size_t dir_size)
312{
313   strncpy(dir, sdl_cwd, dir_size);
314}
src/osd/sdl/sdlfile.c
r7343r7344
6161
6262
6363//============================================================
64//  Global variables
65//============================================================
66
67char sdl_cwd[512];
68
69
70//============================================================
7164//  Static variables
7265//============================================================
7366
src/osd/sdl/sdlmain.c
r7343r7344
5757//============================================================
5858
5959#include <unistd.h>
60extern char sdl_cwd[512];
6160
6261//============================================================
6362//  OPTIONS
r7343r7344
271270   MorphToPM();
272271   #endif
273272
274   getcwd(sdl_cwd, 511);
275
276273#if defined(SDLMAME_X11) && (SDL_MAJOR_VERSION == 1) && (SDL_MINOR_VERSION == 2)
277274   if (SDL_Linked_Version()->patch < 10)
278275   /* workaround for SDL choosing a 32-bit ARGB visual */
src/osd/osdcore.h
r7343r7344
834834***************************************************************************/
835835
836836/*-----------------------------------------------------------------------------
837    osd_get_emulator_directory: returns the path containing the emulator
838
839    Parameters:
840
841        dir - space to output directory
842        dir_size - size of path
843
844-----------------------------------------------------------------------------*/
845
846void osd_get_emulator_directory(char *dir, size_t dir_size);
847
848/*-----------------------------------------------------------------------------
849837    osd_get_full_path: retrieves the full path
850838
851839    Parameters:
src/osd/windows/winfile.c
r7343r7344
520520
521521   return p;
522522}
523
524//============================================================
525//  osd_get_emulator_directory
526//============================================================
527
528void osd_get_emulator_directory(char *dir, size_t dir_size)
529{
530   char *s;
531   win_get_module_file_name_utf8(NULL, dir, dir_size);
532   s = strrchr(dir, '\\');
533   if (s)
534      s[1] = '\0';
535}
src/mess/image.c
r7343r7344
16361636
16371637static void setup_working_directory(image_slot_data *image)
16381638{
1639    char mess_directory[1024];
16401639    const game_driver *gamedrv;
16411640
16421641    /* first set up the working directory to be the MESS directory */
1643    osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
1644    astring_cpyc(image->working_directory, mess_directory);
1642    astring_cpyc(image->working_directory, ".");
16451643
16461644    /* now try browsing down to "software" */
16471645    if (try_change_working_directory(image, "software"))
src/mess/osd/winui/messui.c
r7343r7344
927927         if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1))
928928         {
929929            /* Default to emu directory */
930            char mess_directory[1024];
931            osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
932            s = tstring_from_utf8(mess_directory);
930            s = tstring_from_utf8(".");
933931
934932            /* If software folder exists, use it instead */
935            zippath_combine(&as, mess_directory, "software");
933            zippath_combine(&as, ".", "software");
936934            if (osd_opendir(astring_c(&as))) s = tstring_from_utf8(astring_c(&as));
937935         }
938936      }
r7343r7344
987985      if ((!osd_opendir(astring_c(&as))) || (astring_chr(&as, 0, ':') == -1))
988986      {
989987         /* Default to emu directory */
990         char mess_directory[1024];
991         osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
992         s = tstring_from_utf8(mess_directory);
988         s = tstring_from_utf8(".");
993989
994990         /* If software folder exists, use it instead */
995         zippath_combine(&as, mess_directory, "software");
991         zippath_combine(&as, ".", "software");
996992         if (osd_opendir(astring_c(&as))) s = tstring_from_utf8(astring_c(&as));
997993      }
998994   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team