1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
<?xml version='1.0'?>
<appendix xml:id="database-schema">
<title>Game Database Schema</title>
<simplesect>
<title>Table: mame</title>
<programlisting>
CREATE TABLE mame (
build,
debug DEFAULT 'no' CHECK (debug in ('yes', 'no')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: game</title>
<programlisting>
CREATE TABLE game (
name PRIMARY KEY,
sourcefile,
isbios DEFAULT 'no' CHECK (isbios in ('yes', 'no')),
runnable DEFAULT 'yes' CHECK (runnable in ('yes', 'no')),
cloneof,
romof,
romset CHECK (romset in ('good', 'best available', 'bad')),
sampleof,
sampleset CHECK (sampleset in ('good', 'best available', 'bad')),
description NOT NULL,
year,
manufacturer NOT NULL,
sound_channels,
input_service DEFAULT 'no' CHECK (input_service in ('yes', 'no')),
input_tilt DEFAULT 'no' CHECK (input_tilt in ('yes', 'no')),
input_players,
input_buttons,
input_coins,
driver_status CHECK (driver_status in ('good', 'imperfect', 'preliminary')),
driver_emulation CHECK (driver_emulation in ('good', 'imperfect', 'preliminary')),
driver_color CHECK (driver_color in ('good', 'imperfect', 'preliminary')),
driver_sound CHECK (driver_sound in ('good', 'imperfect', 'preliminary')),
driver_graphic CHECK (driver_graphic in ('good', 'imperfect', 'preliminary')),
driver_cocktail CHECK (driver_cocktail in ('good', 'imperfect', 'preliminary')),
driver_protection CHECK (driver_protection in ('good', 'imperfect', 'preliminary')),
driver_savestate CHECK (driver_savestate in ('supported', 'unsupported')),
driver_palettesize);
</programlisting>
</simplesect>
<simplesect>
<title>Table: biosset</title>
<programlisting>
CREATE TABLE biosset (
game NOT NULL,
name NOT NULL,
description NOT NULL,
default_ DEFAULT 'no' CHECK (default_ in ('yes', 'no')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: rom</title>
<programlisting>
CREATE TABLE rom (
game NOT NULL,
name NOT NULL,
bios,
size NOT NULL,
crc,
md5,
sha1,
merge,
region,
offset,
status DEFAULT 'good' CHECK (status in ('baddump', 'nodump', 'good')),
dispose DEFAULT 'no' CHECK (dispose in ('yes', 'no')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: disk</title>
<programlisting>
CREATE TABLE disk (
game NOT NULL,
name NOT NULL,
md5,
sha1,
merge,
region,
index_,
status DEFAULT 'good' CHECK (status in ('baddump', 'nodump', 'good')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: sample</title>
<programlisting>
CREATE TABLE sample (
game NOT NULL,
name NOT NULL);
</programlisting>
</simplesect>
<simplesect>
<title>Table: chip</title>
<programlisting>
CREATE TABLE chip (
game NOT NULL,
name NOT NULL,
type NOT NULL CHECK (type in ('cpu', 'audio')),
clock);
</programlisting>
</simplesect>
<simplesect>
<title>Table: display</title>
<programlisting>
CREATE TABLE display (
game NOT NULL,
type NOT NULL CHECK (type in ('raster', 'vector', 'lcd', 'unknown')),
rotate NOT NULL CHECK (rotate in ('0', '90', '180', '270')),
flipx DEFAULT 'no' CHECK (flipx in ('yes', 'no')),
width,
height,
refresh NOT NULL,
pixclock,
htotal,
hbend,
hbstart,
vtotal,
vbend
vbstart);
</programlisting>
</simplesect>
<simplesect>
<title>Table: control</title>
<programlisting>
CREATE TABLE control (
game NOT NULL,
type NOT NULL,
minimum,
maximum,
sensitivity,
keydelta,
reverse DEFAULT 'no' CHECK (reverse in ('yes', 'no')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: dipvalue</title>
<programlisting>
CREATE TABLE dipvalue (
game NOT NULL,
dipswitch NOT NULL,
name NOT NULL,
default_ DEFAULT 'no' CHECK (default_ in ('yes', 'no')));
</programlisting>
</simplesect>
<simplesect>
<title>Table: playback</title>
<programlisting>
CREATE TABLE playback (
name NOT NULL,
inode NOT NULL,
comment);
</programlisting>
</simplesect>
<simplesect>
<title>Table: window</title>
<programlisting>
CREATE TABLE window (
name PRIMARY KEY,
x,
y,
width,
height,
maximized);
</programlisting>
</simplesect>
<simplesect>
<title>View: available</title>
<programlisting>
CREATE VIEW available AS SELECT
*,
getcategory(name) AS category,
isfavorite(name) AS favorite FROM game
WHERE (romset IN ('good', 'best available')
AND isbios = 'no');
</programlisting>
</simplesect>
</appendix>
|