~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include "c64cart.h"
32
32
#include "c64cartmem.h"
 
33
#include "c64export.h"
33
34
#include "cartridge.h"
34
35
#include "crt.h"
35
36
#include "generic.h"
37
38
#include "util.h"
38
39
 
39
40
 
 
41
static const c64export_resource_t export_res_8kb = {
 
42
    "Generic 8KB", 0, 0, 1, 0
 
43
};
 
44
 
 
45
static const c64export_resource_t export_res_16kb = {
 
46
    "Generic 16KB", 0, 0, 1, 1
 
47
};
 
48
 
 
49
static c64export_resource_t export_res_ultimax = {
 
50
    "Generic Ultimax", 0, 0, 0, 1
 
51
};
 
52
 
 
53
 
40
54
void generic_8kb_config_init(void)
41
55
{
42
56
    cartridge_config_changed(0, 0, CMODE_READ);
78
92
        UTIL_FILE_LOAD_SKIP_ADDRESS) < 0)
79
93
        return -1;
80
94
 
 
95
    if (c64export_add(&export_res_8kb) < 0)
 
96
        return -1;
 
97
 
81
98
    return 0;
82
99
}
83
100
 
87
104
        UTIL_FILE_LOAD_SKIP_ADDRESS) < 0)
88
105
        return -1;
89
106
 
 
107
    if (c64export_add(&export_res_16kb) < 0)
 
108
        return -1;
 
109
 
90
110
    return 0;
91
111
}
92
112
 
94
114
{
95
115
    BYTE chipheader[0x10];
96
116
 
 
117
    export_res_ultimax.use_roml = 0;
 
118
 
97
119
    if (fread(chipheader, 0x10, 1, fd) < 1)
98
120
        return -1;
99
121
 
105
127
        crttype = (chipheader[0xe] <= 0x20) ? CARTRIDGE_GENERIC_8KB
106
128
                  : CARTRIDGE_GENERIC_16KB;
107
129
        /* try to read next CHIP header in case of 16k Ultimax cart */
108
 
        if (fread(chipheader, 0x10, 1, fd) < 1)
 
130
        if (fread(chipheader, 0x10, 1, fd) < 1) {
 
131
            if (crttype == CARTRIDGE_GENERIC_8KB) {
 
132
                if (c64export_add(&export_res_8kb) < 0)
 
133
                    return -1;
 
134
            } else {
 
135
                if (c64export_add(&export_res_16kb) < 0)
 
136
                    return -1;
 
137
            }
109
138
            return 0;
 
139
        } else {
 
140
            export_res_ultimax.use_roml = 1;
 
141
        }
110
142
    }
111
143
 
112
144
    if (chipheader[0xc] >= 0xe0 && chipheader[0xe] != 0
116
148
            return -1;
117
149
 
118
150
        crttype = CARTRIDGE_ULTIMAX;
 
151
 
 
152
        if (c64export_add(&export_res_ultimax) < 0)
 
153
            return -1;
 
154
 
119
155
        return 0;
120
156
    }
121
157
 
122
158
    return -1;
123
159
}
124
160
 
 
161
void generic_8kb_detach(void)
 
162
{
 
163
    c64export_remove(&export_res_8kb);
 
164
}
 
165
 
 
166
void generic_16kb_detach(void)
 
167
{
 
168
    c64export_remove(&export_res_16kb);
 
169
}
 
170
 
 
171
void generic_ultimax_detach(void)
 
172
{
 
173
    c64export_remove(&export_res_ultimax);
 
174
}
 
175