~ubuntu-branches/ubuntu/raring/vice/raring

« back to all changes in this revision

Viewing changes to src/c64/cart/crt.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mto: (9.1.1 lenny) (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050201113026-6gy97mcqlg2ykg4z
Tags: upstream-1.16
ImportĀ upstreamĀ versionĀ 1.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "final.h"
42
42
#include "generic.h"
43
43
#include "kcs.h"
 
44
#include "magicformel.h"
44
45
#include "resources.h"
45
46
#include "supergames.h"
46
47
#include "supersnapshot.h"
61
62
int crt_attach(const char *filename, BYTE *rawcart)
62
63
{
63
64
    BYTE header[0x40], chipheader[0x10];
64
 
    int rc;
 
65
    int rc, new_crttype;
65
66
    FILE *fd;
66
67
 
67
68
    fd = fopen(filename, MODE_READ);
79
80
        return -1;
80
81
    }
81
82
 
82
 
    crttype = header[0x17] + header[0x16] * 256;
 
83
    new_crttype = header[0x17] + header[0x16] * 256;
 
84
 
 
85
    if (c64cart_type == CARTRIDGE_CRT && crttype != new_crttype)
 
86
        cartridge_detach_image();
 
87
 
 
88
    crttype = new_crttype;
83
89
 
84
90
    switch (crttype) {
85
91
      case CARTRIDGE_CRT:
189
195
        if (rc < 0)
190
196
            return -1;
191
197
        break;
 
198
      case CARTRIDGE_MAGIC_FORMEL:
 
199
        rc = magicformel_crt_attach(fd, rawcart);
 
200
        fclose(fd);
 
201
        if (rc < 0)
 
202
            return -1;
 
203
        break;
192
204
      default:
193
205
        fclose(fd);
194
206
        return -1;