Previous 15994 Revisions Next

r8076 Tuesday 18th May, 2010 at 18:32:22 UTC by Firewave
Show message about success/failure when loading image during run-time (or print to console when specified on command-line / fixes bug 1031)
Also removed now redundant messagebox with newui
[src/mess]image.c
[src/mess/osd/windows]menu.c

src/mess/image.c
r8075r8076
854854    /* success! */
855855
856856done:
857    if (slot->err)
858        image_clear(slot);
857    if (slot->err) {
858      if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
859         popmessage("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, image_error(image));
860      else
861         mame_printf_error("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, image_error(image));
862      image_clear(slot);
863   }
859864   else {
860865      /* do we need to reset the CPU? only schedule it if load/create is successful */
861866      if ((attotime_compare(timer_get_time(machine), attotime_zero) > 0) && slot->info.reset_on_load)
862867         mame_schedule_hard_reset(machine);
868      else
869      {
870         if (mame_get_phase(machine) == MAME_PHASE_RUNNING)
871            popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded");
872         else
873            mame_printf_info("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded");
874      }
863875   }
864876
865877    return slot->err ? INIT_FAIL : INIT_PASS;
src/mess/osd/windows/menu.c
r8075r8076
929929   dialog_box *dialog = NULL;
930930   char filter[2048];
931931   char filename[MAX_PATH];
932   char buffer[512];
933932   const char *initial_dir;
934933   BOOL result;
935934   int create_format = 0;
936935   option_resolution *create_args = NULL;
937   image_error_t err;
938936   image_device_info info;
939937
940938   // sanity check
r8075r8076
980978   {
981979      // mount the image
982980      if (is_save)
983         err = (image_error_t)image_create(device, filename, image_device_get_indexed_creatable_format(device, create_format), create_args);
981         (image_error_t)image_create(device, filename, image_device_get_indexed_creatable_format(device, create_format), create_args);
984982      else
985         err = (image_error_t)image_load(device, filename);
983         (image_error_t)image_load(device, filename);
986984
987      // error?
988      if (err)
989      {
990         snprintf(buffer, ARRAY_LENGTH(buffer),
991            "Error when %s the image: %s",
992            is_save ? "creating" : "loading",
993            image_error(device));
994
995         win_message_box_utf8(wnd, buffer, APPNAME, MB_OK);
996      }
985      // no need to check the returnvalue and show a messagebox anymore.
986      // a UI message will now be generated by the image code
997987   }
998988
999989done:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team