Previous 15994 Revisions Next

r1677 Saturday 9th February, 2008 at 20:05:31 UTC by Nathan Woods
[Windows] Fixed bug in state saving and loading. (bug #1494)
[docs]messnew.txt
[src/emu]mame.c

src/emu/mame.c
r1676r1677
143143   UINT8         exit_pending;
144144   const game_driver *new_driver_pending;
145145   astring *      saveload_pending_file;
146   const char *   saveload_searchpath;
146147   emu_timer *      soft_reset_timer;
147148   mame_file *      logfile;
148149
r1676r1677
670671
671672
672673/*-------------------------------------------------
673    mame_schedule_save - schedule a save to
674    occur as soon as possible
674    set_saveload_filename - specifies the filename
675    for state loading/saving
675676-------------------------------------------------*/
676677
677void mame_schedule_save(running_machine *machine, const char *filename)
678static void set_saveload_filename(running_machine *machine, const char *filename)
678679{
679680   mame_private *mame = machine->mame_data;
680681
681682   /* free any existing request and allocate a copy of the requested name */
682683   if (mame->saveload_pending_file != NULL)
683684      astring_free(mame->saveload_pending_file);
684   mame->saveload_pending_file = astring_assemble_4(astring_alloc(), machine->basename, PATH_SEPARATOR, filename, ".sta");
685685
686   if (osd_is_absolute_path(filename))
687   {
688      mame->saveload_searchpath = NULL;
689      mame->saveload_pending_file = astring_dupc(filename);
690   }
691   else
692   {
693      mame->saveload_searchpath = SEARCHPATH_STATE;
694      mame->saveload_pending_file = astring_assemble_4(astring_alloc(), machine->basename, PATH_SEPARATOR, filename, ".sta");
695   }
696}
697
698
699/*-------------------------------------------------
700    mame_schedule_save - schedule a save to
701    occur as soon as possible
702-------------------------------------------------*/
703
704void mame_schedule_save(running_machine *machine, const char *filename)
705{
706   mame_private *mame = machine->mame_data;
707
708   /* specify the filename to save or load */
709   set_saveload_filename(machine, filename);
710
686711   /* note the start time and set a timer for the next timeslice to actually schedule it */
687712   mame->saveload_schedule_callback = handle_save;
688713   mame->saveload_schedule_time = timer_get_time();
r1676r1677
701726{
702727   mame_private *mame = machine->mame_data;
703728
704   /* free any existing request and allocate a copy of the requested name */
705   if (mame->saveload_pending_file != NULL)
706      astring_free(mame->saveload_pending_file);
707   mame->saveload_pending_file = astring_assemble_4(astring_alloc(), machine->basename, PATH_SEPARATOR, filename, ".sta");
729   /* specify the filename to save or load */
730   set_saveload_filename(machine, filename);
708731
709732   /* note the start time and set a timer for the next timeslice to actually schedule it */
710733   mame->saveload_schedule_callback = handle_load;
r1676r1677
16981721   }
16991722
17001723   /* open the file */
1701   filerr = mame_fopen(SEARCHPATH_STATE, astring_c(mame->saveload_pending_file), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
1724   filerr = mame_fopen(mame->saveload_searchpath, astring_c(mame->saveload_pending_file), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
17021725   if (filerr == FILERR_NONE)
17031726   {
17041727      int cpunum;
r1676r1677
17481771cancel:
17491772   /* unschedule the save */
17501773   astring_free(mame->saveload_pending_file);
1774   mame->saveload_searchpath = NULL;
17511775   mame->saveload_pending_file = NULL;
17521776   mame->saveload_schedule_callback = NULL;
17531777}
r1676r1677
17841808   }
17851809
17861810   /* open the file */
1787   filerr = mame_fopen(SEARCHPATH_STATE, astring_c(mame->saveload_pending_file), OPEN_FLAG_READ, &file);
1811   filerr = mame_fopen(mame->saveload_searchpath, astring_c(mame->saveload_pending_file), OPEN_FLAG_READ, &file);
17881812   if (filerr == FILERR_NONE)
17891813   {
17901814      /* start loading */
docs/messnew.txt
r1676r1677
1010
1111System Driver Changes:
1212----------------------
13- [APFM1000] Cartridge support, pads fixed and hooked up [PeT]
14
1315- [APPLE2] Fixed lores graphics broken in 0.119.  (bug #1472) [Nate Woods]
1416
1517- [GAMEBOY] Small mode 0 stat bug triggering fixes.  [Wilbert Pol]
r1676r1677
5456- [TI99/GENEVE] More floppy cleanups; fixed TI99_8 regression and made the
5557  floppy drive usable.  (bug #1450)  [Michael Zapf]
5658
57- [APFM1000] cartridge support, pads fixed and hooked up [PeT]
5859
5960
60
6161User Interface Changes:
6262-----------------------
63(none)
63- [Windows] Fixed bug in state saving and loading.  (bug #1494) [Nate Woods]
6464
6565
6666

Previous 15994 Revisions Next


© 1998-2018 The MESS Team