annotate src/xs_backend.c @ 873:50111e99456a

Oops. Fix previous commit.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 09 Nov 2012 04:39:41 +0200
parents b02f934d8224
children d03e5c73eb51
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
873
50111e99456a Oops. Fix previous commit.
Matti Hamalainen <ccr@tnsp.org>
parents: 872
diff changeset
79 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
80 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 gint engine;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 gboolean initialized = FALSE;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 XSDEBUG("trying emulator engine #%i...\n", *preferred);
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 for (engine = 0; engine < xs_nenginelist && !initialized; engine++)
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 if (xs_enginelist[engine].plrIdent == *preferred &&
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 xs_enginelist[engine].plrInit(state))
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 initialized = TRUE;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 state->engine = &xs_enginelist[engine];
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 }
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 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
97 return initialized;
b02f934d8224 Move some code to xs_backend.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 }