ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/Emulator.mm
(Generate patch)

Comparing BasiliskII/src/MacOSX/Emulator.mm (file contents):
Revision 1.4 by nigel, 2002-12-18T11:50:12Z vs.
Revision 1.6 by nigel, 2003-03-26T23:04:46Z

# Line 94 | Line 94
94          //[win setHasShadow: NO];               // This causes view & window to now be drawn correctly
95          [win useOptimizedDrawing: YES];                
96  
97 //      [win center];
97          [win makeKeyAndOrderFront:self];
98  
100 //      [self resizeWinToWidth:x Height:y];
101
99          if ( redrawDelay )
100                  [speed setFloatValue: 1.0 / redrawDelay];
101          else
# Line 147 | Line 144
144                  [self Resume: self];
145   }
146  
147 + #ifdef NIGEL
148 + - (IBAction) EjectCD: (id)sender;
149 + {
150 +        NSString        *path;
151 +        const char      *cdrom = PrefsFindString("cdrom");
152 +
153 +        if ( cdrom )
154 +        {
155 +        #include <sys/param.h>
156 +        #define KERNEL
157 +        #include <sys/mount.h>
158 +
159 +                struct statfs buf;
160 +                if ( fsstat(path, &buf) < 0 )
161 +                        return;
162 +
163 +                path = [NSString stringWithCString: cdrom];
164 +
165 +                [[NSWorkspace sharedWorkspace] unmountAndEjectDeviceAtPath: path];
166 + //              [path release];
167 +        }
168 + }
169 + #endif
170 +
171   - (IBAction) Interrupt: (id)sender;
172   {
173          WarningSheet (@"Interrupt action not yet supported", win);
# Line 177 | Line 198
198                  NSLog (@"%s - uae_cpu reset not yet supported, will try to fake it",
199                                  __PRETTY_FUNCTION__);
200  
201 < //              [screen blacken];
202 <                [screen setNeedsDisplay: YES];
201 >                [screen clear];
202 >                [screen display];
203  
204                  [emul terminate]; QuitEmuNoExit();
205  
206 +
207 +                // OK. We have killed & cleaned up. Now, start afresh:
208 +        #include <sys.h>
209 +                int     argc = 0;
210 +                char **argv;
211 +
212 +                PrefsInit(argc, argv);
213 +                SysInit();
214 +
215                  emul = [NNThread new];
216                  [emul perform:@selector(emulThread) of:self];
217                  [emul start];
218  
219                  if ( display_type != DISPLAY_SCREEN )
220                          [redraw resume];
191                uaeCreated = YES;
221          }
222   }
223  
# Line 351 | Line 380 | uint8 lastXPRAM[XPRAM_SIZE];           // Copy of
380          [redraw invalidate]; [redraw release]; redraw = nil;
381          [RTC    invalidate]; [RTC        release]; RTC    = nil;
382          [xPRAM  invalidate]; [xPRAM      release]; xPRAM  = nil;
354        if ( uaeCreated )
355                QuitEmuNoExit();
383   }
384  
385   - (void) emulThread
386   {
360        extern uint8            *RAMBaseHost, *ROMBaseHost;
387          NSAutoreleasePool       *pool = [NSAutoreleasePool new];
388  
389 <        InitEmulator();
389 >        if ( ! InitEmulator() )
390 >        {
391 >                [redraw suspend];               // Stop the barberpole
392  
393 <        if ( RAMBaseHost == NULL || ROMBaseHost == NULL )
394 <                ErrorSheet(@"Cannot start Emulator",
367 <                                   @"Emulator memory not allocated", nil, win);
393 >                ErrorSheet(@"Cannot start Emulator", @"", @"Quit", win);
394 >        }
395          else
396          {
397                  memcpy(lastXPRAM, XPRAM, XPRAM_SIZE);
# Line 374 | Line 401 | uint8 lastXPRAM[XPRAM_SIZE];           // Copy of
401                  while ( screen == nil ) // If we are still loading from Nib?
402                          [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 1.0]];
403  
404 < //              [screen readyToDraw];
378 <                [self   runUpdate];
404 >                [self   runUpdate];             // Set the window close gadget to dimpled
405  
406                  Start680x0();                   // Start 68k and jump to ROM boot routine
407  
408                  puts ("Emulator exited normally");
409          }
410  
385        running = NO;
386        uaeCreated = NO;
387        [self runUpdate];                       // Update button & dimple
411          [pool release];
412 <        [self exitThreads];
412 >        QuitEmulator();
413   }
414  
415   - (void) RTCinterrupt
# Line 399 | Line 422 | uint8 lastXPRAM[XPRAM_SIZE];           // Copy of
422   {
423          if ( display_type == DISPLAY_SCREEN )
424          {
425 <                NSLog(@"Why was redrawScreen() called?");
425 >                NSLog(@"We are in fullscreen mode - why was redrawScreen() called?");
426                  return;
427          }
428          [barberPole animate:self];                      // wobble the pole
429          [screen setNeedsDisplay: YES];          // redisplay next time through runLoop
430          // Or, use a direct method. e.g.
431 <        //      [screen cgDrawInto: ...];
431 >        //      [screen display] or [screen cgDrawInto: ...];
432   }
433  
434   #include <main.h>                               // For #define INTFLAG_60HZ

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines