1 |
|
/* |
2 |
|
* C64_x.h - Put the pieces together, X specific stuff |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
4 |
> |
* Frodo Copyright (C) Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
128 |
|
joy_maxx[0] = joy_maxy[0] = -32768; |
129 |
|
joy_minx[1] = joy_miny[1] = 32767; |
130 |
|
joy_maxx[1] = joy_maxy[1] = -32768; |
131 |
– |
|
132 |
– |
// we need to create a potential GUI subprocess here, because we don't want |
133 |
– |
// it to inherit file-descriptors (such as for the audio-device and alike..) |
134 |
– |
#if defined(__svgalib__) |
135 |
– |
gui = 0; |
136 |
– |
#else |
137 |
– |
// try to start up Tk gui. |
138 |
– |
gui = new CmdPipe("wish", BINDIR "Frodo_GUI.tcl"); |
139 |
– |
if (gui) { |
140 |
– |
if (gui->fail) { |
141 |
– |
delete gui; gui = 0; |
142 |
– |
} |
143 |
– |
} |
144 |
– |
// wait until the GUI process responds (if it does...) |
145 |
– |
if (gui) { |
146 |
– |
if (5 != gui->ewrite("ping\n",5)) { |
147 |
– |
delete gui; gui = 0; |
148 |
– |
} else { |
149 |
– |
char c; |
150 |
– |
fd_set set; |
151 |
– |
FD_ZERO(&set); |
152 |
– |
FD_SET(gui->get_read_fd(), &set); |
153 |
– |
struct timeval tv; |
154 |
– |
tv.tv_usec = 0; |
155 |
– |
tv.tv_sec = 5; |
156 |
– |
// Use the following commented line for HP-UX < 10.20 |
157 |
– |
// if (select(FD_SETSIZE, (int *)&set, (int *)NULL, (int *)NULL, &tv) <= 0) { |
158 |
– |
if (select(FD_SETSIZE, &set, NULL, NULL, &tv) <= 0) { |
159 |
– |
delete gui; gui = 0; |
160 |
– |
} else { |
161 |
– |
if (1 != gui->eread(&c, 1)) { |
162 |
– |
delete gui; gui = 0; |
163 |
– |
} else { |
164 |
– |
if (c != 'o') { |
165 |
– |
delete gui; gui = 0; |
166 |
– |
} |
167 |
– |
} |
168 |
– |
} |
169 |
– |
} |
170 |
– |
} |
171 |
– |
#endif // __svgalib__ |
131 |
|
} |
132 |
|
|
133 |
|
void C64::c64_ctor2(void) |
134 |
|
{ |
135 |
< |
#ifndef __svgalib__ |
136 |
< |
if (!gui) { |
137 |
< |
fprintf(stderr,"Alas, master, no preferences window will be available.\n" |
138 |
< |
"If you wish to see one, make sure the 'wish' interpreter\n" |
180 |
< |
"(Tk version >= 4.1) is installed in your path.\n" |
181 |
< |
"You can still use Frodo, though. Use F10 to quit, \n" |
182 |
< |
"F11 to cause an NMI and F12 to reset the C64.\n" |
183 |
< |
"You can change the preferences by editing ~/.frodorc\n"); |
184 |
< |
} |
185 |
< |
#endif // SVGAlib |
135 |
> |
printf("Use F9 to enter the SAM machine language monitor,\n" |
136 |
> |
"F10 to edit preferences or quit,\n" |
137 |
> |
"F11 to cause an NMI (RESTORE key) and\n" |
138 |
> |
"F12 to reset the C64.\n\n"); |
139 |
|
|
140 |
|
gettimeofday(&tv_start, NULL); |
141 |
|
} |
238 |
|
|
239 |
|
void C64::thread_func(void) |
240 |
|
{ |
288 |
– |
int linecnt = 0; |
289 |
– |
|
241 |
|
#ifdef FRODO_SC |
242 |
|
while (!quit_thyself) { |
243 |
|
|
286 |
|
// 1541 processor disabled, only emulate 6510 |
287 |
|
TheCPU->EmulateLine(cycles); |
288 |
|
#endif |
338 |
– |
linecnt++; |
339 |
– |
#if !defined(__svgalib__) |
340 |
– |
if ((linecnt & 0xfff) == 0 && gui) { |
341 |
– |
|
342 |
– |
// check for command from GUI process |
343 |
– |
// fprintf(stderr,":"); |
344 |
– |
while (gui->probe()) { |
345 |
– |
char c; |
346 |
– |
if (gui->eread(&c, 1) != 1) { |
347 |
– |
delete gui; |
348 |
– |
gui = 0; |
349 |
– |
fprintf(stderr,"Oops, GUI process died...\n"); |
350 |
– |
} else { |
351 |
– |
// fprintf(stderr,"%c",c); |
352 |
– |
switch (c) { |
353 |
– |
case 'q': |
354 |
– |
quit_thyself = true; |
355 |
– |
break; |
356 |
– |
case 'r': |
357 |
– |
Reset(); |
358 |
– |
break; |
359 |
– |
case 'p':{ |
360 |
– |
Prefs *np = Frodo::reload_prefs(); |
361 |
– |
NewPrefs(np); |
362 |
– |
ThePrefs = *np; |
363 |
– |
break; |
364 |
– |
} |
365 |
– |
default: |
366 |
– |
break; |
367 |
– |
} |
368 |
– |
} |
369 |
– |
} |
370 |
– |
} |
371 |
– |
#endif |
372 |
– |
} |
373 |
– |
#if !defined(__svgalib__) |
374 |
– |
if (gui) { |
375 |
– |
gui->ewrite("quit\n",5); |
289 |
|
} |
290 |
< |
#endif |
290 |
> |
} |
291 |
> |
|
292 |
> |
|
293 |
> |
/* |
294 |
> |
* Pause main emulation thread |
295 |
> |
*/ |
296 |
> |
|
297 |
> |
void C64::Pause(void) |
298 |
> |
{ |
299 |
> |
TheSID->PauseSound(); |
300 |
> |
} |
301 |
> |
|
302 |
> |
|
303 |
> |
/* |
304 |
> |
* Resume main emulation thread |
305 |
> |
*/ |
306 |
> |
|
307 |
> |
void C64::Resume(void) |
308 |
> |
{ |
309 |
> |
TheSID->ResumeSound(); |
310 |
|
} |