37 |
|
#import <prefs.h> |
38 |
|
#import <timer.h> |
39 |
|
|
40 |
< |
#undef check() // memory.h defines a check macro, which clashes with an OS X one? |
40 |
> |
#undef check() // memory.h defines a check macro, clashes with an OS X one? |
41 |
|
#import <cpu_emulation.h> |
42 |
|
|
43 |
< |
#define DEBUG 1 |
43 |
> |
#define DEBUG 0 |
44 |
|
#import <debug.h> |
45 |
|
|
46 |
|
// NSWindow method, which is invoked via delegation |
120 |
|
- (NSSlider *) speed { return speed; } |
121 |
|
- (NSWindow *) window { return win; } |
122 |
|
|
123 |
– |
//#define DEBUG 1 |
124 |
– |
//#include <debug.h> |
123 |
|
|
124 |
|
// Update some UI elements |
125 |
|
|
149 |
|
|
150 |
|
- (IBAction) Interrupt: (id)sender; |
151 |
|
{ |
152 |
< |
WarningSheet (@"Interrupt action not yet supported", @"", @"OK", win); |
152 |
> |
WarningSheet (@"Interrupt action not yet supported", win); |
153 |
|
} |
154 |
|
|
155 |
|
- (IBAction) PowerKey: (id)sender; |
182 |
|
|
183 |
|
[emul terminate]; QuitEmuNoExit(); |
184 |
|
|
185 |
< |
emul = [[NNThread alloc] init]; |
185 |
> |
emul = [NNThread new]; |
186 |
|
[emul perform:@selector(emulThread) of:self]; |
187 |
|
[emul start]; |
188 |
|
|
202 |
|
[xPRAM resume]; |
203 |
|
} |
204 |
|
|
205 |
+ |
- (IBAction) ScreenHideShow: (NSButton *)sender; |
206 |
+ |
{ |
207 |
+ |
WarningSheet(@"Nigel doesn't know how to shrink or grow this window", |
208 |
+ |
@"Maybe you can grab the source code and have a go yourself?", |
209 |
+ |
nil, win); |
210 |
+ |
} |
211 |
+ |
|
212 |
|
- (IBAction) Snapshot: (id) sender |
213 |
|
{ |
214 |
|
if ( screen == nil || uaeCreated == NO ) |
215 |
|
WarningSheet(@"The emulator has not yet started.", |
216 |
|
@"There is no screen output to snapshot", |
217 |
< |
@"OK", win); |
217 |
> |
nil, win); |
218 |
|
else |
219 |
|
{ |
220 |
|
NSData *TIFFdata; |
308 |
|
- (void) createThreads |
309 |
|
{ |
310 |
|
#ifdef USE_PTHREADS |
311 |
< |
[NSThread detachNewThreadSelector:(SEL)"" toTarget:nil withObject:nil]; // Make UI threadsafe |
311 |
> |
// Make UI threadsafe: |
312 |
> |
[NSThread detachNewThreadSelector:(SEL)"" toTarget:nil withObject:nil]; |
313 |
|
//emul = [[NNThread alloc] initWithAutoReleasePool]; |
314 |
|
#endif |
315 |
< |
emul = [[NNThread alloc] init]; |
316 |
< |
RTC = [[NNTimer alloc] init]; |
317 |
< |
redraw = [[NNTimer alloc] init]; |
318 |
< |
tick = [[NNTimer alloc] init]; |
319 |
< |
xPRAM = [[NNTimer alloc] init]; |
315 |
> |
emul = [NNThread new]; |
316 |
> |
RTC = [NNTimer new]; |
317 |
> |
redraw = [NNTimer new]; |
318 |
> |
tick = [NNTimer new]; |
319 |
> |
xPRAM = [NNTimer new]; |
320 |
|
|
321 |
|
[emul perform:@selector(emulThread) of:self]; |
322 |
|
[RTC repeat:@selector(RTCinterrupt) of:self |
358 |
|
- (void) emulThread |
359 |
|
{ |
360 |
|
extern uint8 *RAMBaseHost, *ROMBaseHost; |
361 |
< |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
356 |
< |
|
357 |
< |
// [screen allocBitmap]; // Do this first, because InitEmulator() calls VideoInit(), which needs the_bitmap. |
361 |
> |
NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
362 |
|
|
363 |
|
InitEmulator(); |
364 |
|
|
365 |
|
if ( RAMBaseHost == NULL || ROMBaseHost == NULL ) |
366 |
< |
ErrorSheet(@"Cannot start Emulator.", |
367 |
< |
@"Emulator memory not allocated", @"OK", win); |
366 |
> |
ErrorSheet(@"Cannot start Emulator", |
367 |
> |
@"Emulator memory not allocated", nil, win); |
368 |
|
else |
369 |
|
{ |
370 |
|
memcpy(lastXPRAM, XPRAM, XPRAM_SIZE); |
371 |
|
|
372 |
|
uaeCreated = YES; // Enable timers to access emulated Mac's memory |
373 |
|
|
374 |
< |
while ( screen == nil ) // If init sets running, but we are still loading from Nib? |
374 |
> |
while ( screen == nil ) // If we are still loading from Nib? |
375 |
|
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 1.0]]; |
376 |
|
|
377 |
|
// [screen readyToDraw]; |
431 |
|
} |
432 |
|
} |
433 |
|
|
434 |
< |
@end |
434 |
> |
@end |