Previous 15994 Revisions Next

r14563 Tuesday 21st February, 2012 at 10:31:37 UTC by Miodrag Milanović
Added support for handling all CRT types for C64, added helpers in diiimage for future (no whatsnew)
[src/emu]diimage.c diimage.h
[src/mess/machine]c64exp.c

src/emu/diimage.c
r14562r14563
3838***************************************************************************/
3939
4040#include "emu.h"
41#include "emuopts.h"
4142#include "ui.h"
4243#include "zippath.h"
4344#include "uiimage.h"
r14562r14563
845846    load_internal - core image loading
846847-------------------------------------------------*/
847848
848bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args)
849bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load)
849850{
850851    UINT32 open_plan[4];
851852    int i;
r14562r14563
926927    /* success! */
927928
928929done:
930   if (just_load) {
931      if(m_err) clear();
932      return m_err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS;
933   }
929934    if (m_err!=0) {
930935      if (!m_init_phase)
931936      {
r14562r14563
962967
963968bool device_image_interface::load(const char *path)
964969{
965    return load_internal(path, FALSE, 0, NULL);
970    return load_internal(path, FALSE, 0, NULL, FALSE);
966971}
967972
973/*-------------------------------------------------
974    load_for_slot - load an image for slot device
975-------------------------------------------------*/
968976
977bool device_image_interface::load_for_slot(emu_options &options)
978{
979   const char* path = options.value(instance_name());
980   if (strlen(path)>0)
981   {
982      set_init_phase();
983      if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
984      {
985         if (software_entry()==NULL) return true;
986      }
987   }
988   return false;
989}
990
969991/*-------------------------------------------------
970992    image_finish_load - special call - only use
971993    from core
r14562r14563
10161038bool device_image_interface::create(const char *path, const image_device_format *create_format, option_resolution *create_args)
10171039{
10181040    int format_index = (create_format != NULL) ? create_format->m_index : 0;
1019    return load_internal(path, TRUE, format_index, create_args);
1041    return load_internal(path, TRUE, format_index, create_args, FALSE);
10201042}
10211043
10221044
src/emu/diimage.h
r14562r14563
246246   image_device_format *formatlist() const { return m_formatlist; }
247247
248248   bool load(const char *path);
249   bool load_for_slot(emu_options &options);
249250   bool finish_load();
250251   void unload();
251252   bool create(const char *path, const image_device_format *create_format, option_resolution *create_args);
r14562r14563
253254   int reopen_for_write(const char *path);
254255
255256protected:
256   bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args);
257   bool load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load);
257258   void determine_open_plan(int is_create, UINT32 *open_plan);
258259   image_error_t load_image_by_path(UINT32 open_flags, const char *path);
259260   void clear();
src/mess/machine/c64exp.c
r14562r14563
88**********************************************************************/
99
1010#include "emu.h"
11#include "emuopts.h"
1211#include "machine/c64exp.h"
1312#include "formats/cbm_crt.h"
1413#include "formats/imageutl.h"
r14562r14563
289288
290289            UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
291290
292            // TODO support other cartridge hardware
293            if (hardware != CRT_C64_STANDARD)
294               return IMAGE_INIT_FAIL;
295
296291            if (LOG)
297292            {
298293               logerror("Name: %s\n", header.name);
r14562r14563
404399
405400const char * c64_expansion_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
406401{
402   if (load_for_slot(options))
403   {
404      if (!mame_stricmp(filetype(), "crt"))
405      {
406         // read the header
407         cbm_crt_header header;
408         fread(&header, CRT_HEADER_LENGTH);
409
410         if (memcmp(header.signature, CRT_SIGNATURE, 16) == 0)
411         {
412            UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
413            return CRT_C64_SLOT_NAMES[hardware];
414         }
415      }
416   }
407417   return software_get_default_slot(config, options, this, "standard");
408418}
409419

Previous 15994 Revisions Next


© 1998-2018 The MESS Team