/[projet1]/public/pc/emulators/caloric/src/oric.c
Defence Force logotype

Contents of /public/pc/emulators/caloric/src/oric.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations)
Tue Mar 10 20:10:29 2009 UTC (10 years, 8 months ago) by Jede
File MIME type: text/plain
File size: 3906 byte(s)


1 /*
2 * oric.c - main
3 * FF sometime in 1994-1997
4 */
5
6 /*
7 Parts of this file copyright 1994-1997 Fabrice Francès.
8 Parts of this file copyright 2000-2003 André Majorel.
9
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of version 2 of the GNU General Public License as published by the
12 Free Software Foundation.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place, Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 // -lgmodule-2.0
24 #include <stdio.h>
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <string.h>
28 //#if HAVE_DEBUGGER
29 #include <pthread.h>
30 //#endif
31
32 #include "caloric.h"
33 #include "dsp.h"
34 #include "screenshot.h"
35 #include "stats.h"
36
37 /* FIXME use headers */
38 extern int init(char argc, char *argv[]);
39 extern void setup(char *env[]);
40 extern int sdl_start(void);
41 extern void sdl_end(void);
42 extern void adlib_init(void);
43 extern void hook_interrupts(void);
44 extern void redirect_output(void);
45 extern void delete_output(void);
46 extern void init_time(void);
47 extern void Restart(void);
48 extern void Reset(void);
49 extern void restore_time(void);
50 extern void restore_interrupts(void);
51 extern void adlib_end(void);
52 extern void *watch(void *arg);
53 extern char restart_flag;
54 extern int debugger;
55
56 /*http://sourceware.org/pthreads-win32/*/
57
58 int main(int argc, char *argv[], char *env[])
59 {
60 #if HAVE_DEBUGGER
61 pthread_t watcher;
62 int id;
63 #endif
64 stats_init();
65 if (argc>=2 && strcmp(argv[1],"--help")==0) {
66 puts(
67 "caloric - an Oric emulator\n"
68 "http://punk.lnxscene.org/~jylam/caloric\n"
69 "Usage:\n"
70 " caloric --help\n"
71 " caloric --version\n"
72 " caloric [-1|a|t] [-djJpQr] [-A file] [-s num] [-S arts|auto|oss]\n"
73 " [-X always|auto|never] [-z num] file ...\n"
74 "Options:\n"
75 " --help print usage on standard output and exit successfully\n"
76 " --version print version number on standard output and exit successfully\n"
77 " -1 emulate an Oric-1\n"
78 " -a emulate an Oric Atmos (this is the default)\n"
79 " -A file pathname of OSS audio device (default /dev/dsp)\n"
80 " -d emulate a Microdisk floppy disk drive\n"
81 " -j emulate a Jasmin floppy disk drive\n"
82 " -J emulate a Telestrat joystick\n"
83 " -p emulate a P.A.S.E. joystick interface\n"
84 " -Q quit on illegal instructions\n"
85 " -r restart from a dump\n"
86 " -s num emulate at num percent of the normal speed (default 100)\n"
87 " -S alsa|arts|auto|oss sound output method (default is auto)\n"
88 " -t emulate a Telestrat\n"
89 " -X always|auto|never XShm usage policy (default is auto)\n"
90 " -z num set zoom factor to num (1, 2 or 3, default 1)\n"
91 " -g start debugger");
92 exit(0);
93 }
94 if (argc>=2 && strcmp(argv[1],"--version")==0) {
95 sprintf(stderr, VERSION);
96 if (fflush(stdout))
97 exit(1);
98 exit(0);
99 }
100
101 setup(env);
102 keyboard_map_init();
103
104 restart_flag=init(argc,argv);
105
106 if(!sdl_start()) {
107 fprintf(stderr, "Can't open graphics (8bpp). Too bad AH!\n");
108 return -1;
109 }
110
111 sound_open();
112 hook_interrupts();
113 init_time();
114 redirect_output();
115
116
117 /* Watcher thread */
118 if(debugger == 1) {
119 #if HAVE_DEBUGGER
120 printf("Debugger on\n");
121 pthread_create(&watcher,NULL,watch,&id);
122 #else
123 fprintf(stderr, "Please compile caloric with debugger support.\n");
124 #endif
125 }
126
127 if (restart_flag) {
128 Restart();
129 } else {
130 Reset();
131 }
132 return 0; /* NOT REACHED */
133 }
134
135 void Quit(void)
136 {
137 restore_time();
138 restore_interrupts();
139
140 sdl_end();
141
142 if (sound)
143 sound_close();
144 stats_dump(stderr); /* stdout does not work */
145 exit(0);
146 }
147

  ViewVC Help
Powered by ViewVC 1.1.26