annotate src/xs_backend.c @ 935:6f53d0405d58

Oops, we should return TRUE if we are successful. Fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 17:40:52 +0200
parents 4c6c5247de7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
872
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 Backend handling
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 (C) Copyright 1999-2012 Tecnic Software productions (TNSP)
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 (at your option) any later version.
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 GNU General Public License for more details.
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License along
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 with this program; if not, write to the Free Software Foundation, Inc.,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 */
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "xs_backend.h"
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #include "xs_config.h"
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 /* List of emulator engines
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 */
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #ifdef HAVE_SIDPLAY1
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 # include "xs_sidplay1.h"
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #ifdef HAVE_SIDPLAY2
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 # include "xs_sidplay2.h"
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #ifdef HAVE_SIDPLAYFP
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 # include "xs_sidplayfp.h"
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 static XSEngine xs_enginelist[] =
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #ifdef HAVE_SIDPLAY1
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 XS_ENG_SIDPLAY1,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 xs_sidplay1_probe,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 xs_sidplay1_init, xs_sidplay1_close,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 xs_sidplay1_initsong, xs_sidplay1_fillbuffer,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 xs_sidplay1_load, xs_sidplay1_delete,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 xs_sidplay1_getinfo, xs_sidplay1_updateinfo,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 NULL
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 },
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 #ifdef HAVE_SIDPLAY2
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 XS_ENG_SIDPLAY2,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 xs_sidplay2_probe,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 xs_sidplay2_init, xs_sidplay2_close,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 xs_sidplay2_initsong, xs_sidplay2_fillbuffer,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 xs_sidplay2_load, xs_sidplay2_delete,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 xs_sidplay2_getinfo, xs_sidplay2_updateinfo,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 xs_sidplay2_flush
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 },
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 #ifdef HAVE_SIDPLAYFP
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 XS_ENG_SIDPLAYFP,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 xs_sidplayfp_probe,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 xs_sidplayfp_init, xs_sidplayfp_close,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 xs_sidplayfp_initsong, xs_sidplayfp_fillbuffer,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 xs_sidplayfp_load, xs_sidplayfp_delete,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 xs_sidplayfp_getinfo, xs_sidplayfp_updateinfo,
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 xs_sidplayfp_flush
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 },
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 #endif
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 };
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 static const gint xs_nenginelist = sizeof(xs_enginelist) / sizeof(xs_enginelist[0]);
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
79 const XSROMImageData xs_rom_images[XS_C64_ROM_IMAGES] =
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
80 {
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
81 { "Kernal", "kernal", 8192 },
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
82 { "Basic v2.0", "basic", 8192 },
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
83 { "Character ROM", "chargen", 4096 },
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
84 };
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
85
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
86
873
50111e99456a Oops. Fix previous commit.
Matti Hamalainen <ccr@tnsp.org>
parents: 872
diff changeset
87 gboolean xs_init_emu_backend(XSEngineState *state, gint *preferred)
872
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 gint engine;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 gboolean initialized = FALSE;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 XSDEBUG("trying emulator engine #%i...\n", *preferred);
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 for (engine = 0; engine < xs_nenginelist && !initialized; engine++)
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 if (xs_enginelist[engine].plrIdent == *preferred &&
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 xs_enginelist[engine].plrInit(state))
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 initialized = TRUE;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 state->engine = &xs_enginelist[engine];
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 }
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 }
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 XSDEBUG("init#1: %s, %i\n", initialized ? "OK" : "FAILED", *preferred);
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 return initialized;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 }
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
107
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
108
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
109 gboolean xs_load_rom_image(gint index, guint8 **data)
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
110 {
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
111 const XSROMImageData *rom = &xs_rom_images[index];
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
112 size_t size = 0;
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
113
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
114 XSDEBUG("Trying ROM '%s' from '%s%s', %d bytes.\n",
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
115 rom->name, xs_cfg.romPath, rom->filename, rom->size);
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
116
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
117 if (!xs_fload_buffer_path(xs_cfg.romPath, rom->filename,
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
118 data, &size, rom->size, TRUE))
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
119 {
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
120 xs_error("Failed to load required %s ROM image '%s%s'.\n",
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
121 rom->name, xs_cfg.romPath, rom->filename);
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
122 return FALSE;
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
123 }
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
124
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
125 if (size < rom->size)
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
126 {
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
127 xs_error("ROM image %s '%s%s' size does not match: %d != %d\n",
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
128 rom->name, xs_cfg.romPath, rom->filename,
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
129 size, rom->size);
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
130 return FALSE;
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
131 }
935
6f53d0405d58 Oops, we should return TRUE if we are successful. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 912
diff changeset
132
6f53d0405d58 Oops, we should return TRUE if we are successful. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 912
diff changeset
133 return TRUE;
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
134 }
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
135
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
136
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
137 void xs_free_rom_images(guint8 **roms)
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
138 {
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
139 gint i;
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
140 for (i = 0; i < XS_C64_ROM_IMAGES; i++)
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
141 {
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
142 g_free(roms[i]);
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
143 roms[i] = NULL;
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
144 }
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
145 }
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
146
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
147
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
148 gboolean xs_load_rom_images(guint8 **roms)
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
149 {
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
150 gint i;
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
151
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
152 XSDEBUG("Loading C64 ROM images ...\n");
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
153
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
154 xs_free_rom_images(roms);
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
155
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
156 for (i = 0; i < XS_C64_ROM_IMAGES; i++)
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
157 {
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
158 if (!xs_load_rom_image(i, &roms[i]))
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
159 {
912
4c6c5247de7d Improve ROM loading functions, make ROM list a public variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 876
diff changeset
160 xs_free_rom_images(roms);
876
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
161 return FALSE;
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
162 }
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
163 }
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
164
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
165 return TRUE;
d03e5c73eb51 Add ROM image loading.
Matti Hamalainen <ccr@tnsp.org>
parents: 873
diff changeset
166 }