forked from tonioni/WinUAE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevices.cpp
More file actions
427 lines (410 loc) · 6.71 KB
/
devices.cpp
File metadata and controls
427 lines (410 loc) · 6.71 KB
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
#include "sysconfig.h"
#include "sysdeps.h"
#include "devices.h"
#include "options.h"
#include "threaddep/thread.h"
#include "traps.h"
#include "memory.h"
#include "audio.h"
#include "a2091.h"
#include "a2065.h"
#include "gfxboard.h"
#include "ncr_scsi.h"
#include "ncr9x_scsi.h"
#include "scsi.h"
#include "scsidev.h"
#include "sana2.h"
#include "clipboard.h"
#include "cpuboard.h"
#include "sndboard.h"
#include "statusline.h"
#include "uae/ppc.h"
#include "cd32_fmv.h"
#include "cdtv.h"
#include "cdtvcr.h"
#include "akiko.h"
#include "gayle.h"
#include "idecontrollers.h"
#include "disk.h"
#include "cia.h"
#include "inputdevice.h"
#include "picasso96.h"
#include "blkdev.h"
#include "parallel.h"
#include "picasso96.h"
#include "autoconf.h"
#include "sampler.h"
#include "newcpu.h"
#include "blitter.h"
#include "xwin.h"
#include "custom.h"
#include "serial.h"
#include "bsdsocket.h"
#include "uaeserial.h"
#include "uaeresource.h"
#include "native2amiga.h"
#include "dongle.h"
#include "gensound.h"
#include "gui.h"
#include "savestate.h"
#include "uaeexe.h"
#include "uaenative.h"
#include "tabletlibrary.h"
#include "luascript.h"
#include "driveclick.h"
#include "pci.h"
#include "pci_hw.h"
#include "x86.h"
#include "ethernet.h"
#ifdef RETROPLATFORM
#include "rp.h"
#endif
void devices_reset(int hardreset)
{
gayle_reset (hardreset);
idecontroller_reset();
a1000_reset ();
DISK_reset ();
CIA_reset ();
gayle_reset (0);
soft_scsi_reset();
#ifdef A2091
a2091_reset ();
gvp_reset ();
#endif
#ifdef GFXBOARD
gfxboard_reset ();
#endif
#ifdef WITH_TOCCATA
sndboard_reset();
#endif
#ifdef NCR
ncr_reset();
#endif
#ifdef NCR9X
ncr9x_reset();
#endif
#ifdef WITH_PCI
pci_reset();
#endif
#ifdef WITH_X86
x86_bridge_reset();
#endif
#ifdef JIT
compemu_reset ();
#endif
#ifdef AUTOCONFIG
expamem_reset ();
#endif
}
void devices_vsync_pre(void)
{
audio_vsync ();
blkdev_vsync ();
CIA_vsync_prehandler ();
inputdevice_vsync ();
filesys_vsync ();
sampler_vsync ();
clipboard_vsync ();
#ifdef RETROPLATFORM
rp_vsync ();
#endif
#ifdef CD32
cd32_fmv_vsync_handler();
#endif
cpuboard_vsync();
statusline_vsync();
#ifdef WITH_X86
x86_bridge_vsync();
#endif
}
void devices_vsync_post(void)
{
#ifdef GFXBOARD
if (!picasso_on)
gfxboard_vsync_handler ();
#endif
#ifdef WITH_TOCCATA
sndboard_vsync();
#endif
}
void devices_hsync(void)
{
#ifdef GFXBOARD
gfxboard_hsync_handler();
#endif
#ifdef A2065
a2065_hsync_handler ();
#endif
#ifdef CD32
AKIKO_hsync_handler ();
cd32_fmv_hsync_handler();
#endif
#ifdef CDTV
CDTV_hsync_handler ();
CDTVCR_hsync_handler ();
#endif
decide_blitter (-1);
#ifdef PICASSO96
picasso_handle_hsync ();
#endif
#ifdef AHI
{
void ahi_hsync (void);
ahi_hsync ();
}
#endif
#ifdef WITH_PPC
uae_ppc_hsync_handler();
cpuboard_hsync();
#endif
#ifdef WITH_PCI
pci_hsync();
#endif
#ifdef WITH_X86
x86_bridge_hsync();
#endif
#ifdef WITH_TOCCATA
sndboard_hsync();
#endif
DISK_hsync ();
audio_hsync ();
CIA_hsync_prehandler ();
serial_hsynchandler ();
gayle_hsync ();
idecontroller_hsync();
#ifdef A2091
scsi_hsync ();
#endif
}
void devices_rethink(void)
{
rethink_cias ();
#ifdef A2065
rethink_a2065 ();
#endif
#ifdef A2091
rethink_a2091 ();
#endif
#ifdef CDTV
rethink_cdtv();
rethink_cdtvcr();
#endif
#ifdef CD32
rethink_akiko ();
rethink_cd32fmv();
#endif
#ifdef NCR
ncr_rethink();
#endif
#ifdef NCR9X
ncr9x_rethink();
#endif
ncr80_rethink();
#ifdef WITH_PCI
pci_rethink();
#endif
#ifdef WITH_X86
x86_bridge_rethink();
#endif
#ifdef WITH_TOCCATA
sndboard_rethink();
#endif
rethink_gayle ();
idecontroller_rethink();
/* cpuboard_rethink must be last */
cpuboard_rethink();
}
void devices_update_sound(double clk, double syncadjust)
{
update_sound (clk);
update_sndboard_sound (clk / syncadjust);
update_cda_sound(clk / syncadjust);
}
void devices_update_sync(double svpos, double syncadjust)
{
cd32_fmv_set_sync(svpos, syncadjust);
}
void reset_all_systems (void)
{
init_eventtab ();
#ifdef WITH_PPC
uae_ppc_reset(is_hardreset());
#endif
#ifdef PICASSO96
picasso_reset ();
#endif
#ifdef SCSIEMU
scsi_reset ();
scsidev_reset ();
scsidev_start_threads ();
#endif
#ifdef A2065
a2065_reset ();
#endif
#ifdef SANA2
netdev_reset ();
netdev_start_threads ();
#endif
#ifdef WITH_PCI
pci_reset();
#endif
#ifdef FILESYS
filesys_prepare_reset ();
filesys_reset ();
#endif
init_shm ();
memory_reset ();
#if defined (BSDSOCKET)
bsdlib_reset ();
#endif
#ifdef FILESYS
filesys_start_threads ();
hardfile_reset ();
#endif
#ifdef UAESERIAL
uaeserialdev_reset ();
uaeserialdev_start_threads ();
#endif
#if defined (PARALLEL_PORT)
initparallel ();
#endif
native2amiga_reset ();
dongle_reset ();
sampler_init ();
}
void do_leave_program (void)
{
sampler_free ();
graphics_leave ();
inputdevice_close ();
DISK_free ();
close_sound ();
dump_counts ();
#ifdef SERIAL_PORT
serial_exit ();
#endif
#ifdef CDTV
cdtv_free();
cdtvcr_free();
#endif
#ifdef A2091
a2091_free ();
gvp_free ();
a3000scsi_free ();
#endif
soft_scsi_free();
#ifdef NCR
ncr_free();
#endif
#ifdef NCR9X
ncr9x_free();
#endif
#ifdef CD32
akiko_free ();
cd32_fmv_free();
#endif
if (! no_gui)
gui_exit ();
#ifdef USE_SDL
SDL_Quit ();
#endif
#ifdef AUTOCONFIG
expansion_cleanup ();
#endif
#ifdef WITH_PCI
pci_free();
#endif
#ifdef WITH_X86
x86_bridge_free();
#endif
#ifdef FILESYS
filesys_cleanup ();
#endif
#ifdef BSDSOCKET
bsdlib_reset ();
#endif
gayle_free ();
idecontroller_free();
device_func_reset ();
#ifdef WITH_LUA
uae_lua_free ();
#endif
#ifdef WITH_PPC
uae_ppc_free();
#endif
#ifdef WITH_TOCCATA
sndboard_free();
#endif
gfxboard_free();
savestate_free ();
memory_cleanup ();
free_shm ();
cfgfile_addcfgparam (0);
machdep_free ();
driveclick_free();
ethernet_enumerate_free();
}
void virtualdevice_init (void)
{
#ifdef AUTOCONFIG
rtarea_setup ();
#endif
#ifdef FILESYS
rtarea_init ();
uaeres_install ();
hardfile_install ();
#endif
#ifdef SCSIEMU
scsi_reset ();
scsidev_install ();
#endif
#ifdef SANA2
netdev_install ();
#endif
#ifdef UAESERIAL
uaeserialdev_install ();
#endif
#ifdef AUTOCONFIG
expansion_init ();
emulib_install ();
uaeexe_install ();
#endif
#ifdef FILESYS
filesys_install ();
#endif
#if defined (BSDSOCKET)
bsdlib_install ();
#endif
#ifdef WITH_UAENATIVE
uaenative_install ();
#endif
#ifdef WITH_TABLETLIBRARY
tabletlib_install ();
#endif
#ifdef NCR
ncr_init();
#endif
#ifdef NCR9X
ncr9x_init();
#endif
#ifdef CDTV
cdtvcr_reset();
#endif
}
void devices_restore_start(void)
{
restore_cia_start();
restore_blkdev_start();
changed_prefs.bogomem_size = 0;
changed_prefs.chipmem_size = 0;
changed_prefs.fastmem_size = 0;
changed_prefs.z3fastmem_size = 0;
changed_prefs.z3fastmem2_size = 0;
changed_prefs.mbresmem_low_size = 0;
changed_prefs.mbresmem_high_size = 0;
}
void devices_syncchange(void)
{
x86_bridge_sync_change();
}