mirror of https://github.com/stella-emu/stella.git
This commit was generated by cvs2svn to compensate for changes in r269,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@270 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e4c22f2815
commit
d877d0a95b
Binary file not shown.
|
@ -0,0 +1,30 @@
|
|||
/* AboutBox.h - Header for About Box
|
||||
window class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
|
||||
*/
|
||||
/* $Id: AboutBox.h,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface AboutBox : NSObject
|
||||
{
|
||||
IBOutlet id appNameField;
|
||||
IBOutlet id creditsField;
|
||||
IBOutlet id versionField;
|
||||
NSTimer *scrollTimer;
|
||||
float currentPosition;
|
||||
float maxScrollHeight;
|
||||
NSTimeInterval startTime;
|
||||
BOOL restartAtTop;
|
||||
}
|
||||
|
||||
+ (AboutBox *)sharedInstance;
|
||||
- (IBAction)showPanel:(id)sender;
|
||||
- (void)scrollCredits;
|
||||
- (void)clicked;
|
||||
- (void)doubleClicked;
|
||||
|
||||
@end
|
|
@ -0,0 +1,193 @@
|
|||
/* AboutBox.m - AboutBox window
|
||||
class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
*/
|
||||
/* $Id: AboutBox.m,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import "AboutBox.h";
|
||||
|
||||
static int boxDisplayed = FALSE;
|
||||
static int shouldScroll = TRUE;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* AboutBoxScroll - Function call which is called from main emulator loop
|
||||
* If About Box is key window, and scrolling hasn't been stop, it will
|
||||
* call the scrollCredits method to advance the scroll.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
void AboutBoxScroll(void)
|
||||
{
|
||||
if (boxDisplayed && shouldScroll)
|
||||
[[AboutBox sharedInstance] scrollCredits];
|
||||
}
|
||||
|
||||
@implementation AboutBox
|
||||
|
||||
static AboutBox *sharedInstance = nil;
|
||||
|
||||
+ (AboutBox *)sharedInstance
|
||||
{
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (sharedInstance) {
|
||||
[self dealloc];
|
||||
} else {
|
||||
sharedInstance = [super init];
|
||||
}
|
||||
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* showPanel - Display the About Box.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (IBAction)showPanel:(id)sender
|
||||
{
|
||||
NSRect creditsBounds;
|
||||
|
||||
if (!appNameField)
|
||||
{
|
||||
NSWindow *theWindow;
|
||||
NSString *creditsPath;
|
||||
NSAttributedString *creditsString;
|
||||
NSString *appName;
|
||||
NSString *versionString;
|
||||
NSDictionary *infoDictionary;
|
||||
CFBundleRef localInfoBundle;
|
||||
NSDictionary *localInfoDict;
|
||||
|
||||
if (![NSBundle loadNibNamed:@"AboutBox" owner:self])
|
||||
{
|
||||
NSLog( @"Failed to load AboutBox.nib" );
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
theWindow = [appNameField window];
|
||||
|
||||
// Get the info dictionary (Info.plist)
|
||||
infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
|
||||
|
||||
// Get the localized info dictionary (InfoPlist.strings)
|
||||
localInfoBundle = CFBundleGetMainBundle();
|
||||
localInfoDict = (NSDictionary *)
|
||||
CFBundleGetLocalInfoDictionary( localInfoBundle );
|
||||
|
||||
// Setup the app name field
|
||||
appName = @"StellaOSX";
|
||||
[appNameField setStringValue:appName];
|
||||
|
||||
// Set the about box window title
|
||||
[theWindow setTitle:[NSString stringWithFormat:@"About %@", appName]];
|
||||
|
||||
// Setup the version field
|
||||
versionString = [infoDictionary objectForKey:@"CFBundleVersion"];
|
||||
[versionField setStringValue:[NSString stringWithFormat:@"Version %@",
|
||||
versionString]];
|
||||
|
||||
// Setup our credits
|
||||
creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits"
|
||||
ofType:@"html"];
|
||||
|
||||
creditsString = [[NSAttributedString alloc] initWithPath:creditsPath
|
||||
documentAttributes:nil];
|
||||
|
||||
[creditsField replaceCharactersInRange:NSMakeRange( 0, 0 )
|
||||
withRTF:[creditsString RTFFromRange:
|
||||
NSMakeRange( 0, [creditsString length] )
|
||||
documentAttributes:nil]];
|
||||
|
||||
// Prepare some scroll info
|
||||
creditsBounds = [creditsField bounds];
|
||||
maxScrollHeight = creditsBounds.size.height*2.75;
|
||||
|
||||
// Setup the window
|
||||
[theWindow setExcludedFromWindowsMenu:YES];
|
||||
[theWindow setMenu:nil];
|
||||
[theWindow center];
|
||||
|
||||
}
|
||||
|
||||
if (![[appNameField window] isVisible])
|
||||
{
|
||||
currentPosition = 0;
|
||||
restartAtTop = NO;
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
}
|
||||
|
||||
// Show the window
|
||||
[[appNameField window] makeKeyAndOrderFront:nil];
|
||||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* windowDidBecomeKey - Start the scrolling when the about box is displayed.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
boxDisplayed = TRUE;
|
||||
shouldScroll = TRUE;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* windowDidResignKey - Stop the scrolling when the about box is gone.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
boxDisplayed = FALSE;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* scrollCredits - Perform the scrolling.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)scrollCredits
|
||||
{
|
||||
if (restartAtTop)
|
||||
{
|
||||
restartAtTop = NO;
|
||||
|
||||
// Set the position
|
||||
[creditsField scrollPoint:NSMakePoint( 0, 0 )];
|
||||
|
||||
return;
|
||||
}
|
||||
if (currentPosition >= maxScrollHeight)
|
||||
{
|
||||
// Reset the position
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scroll to the position
|
||||
[creditsField scrollPoint:NSMakePoint( 0, currentPosition )];
|
||||
|
||||
// Increment the scroll position
|
||||
currentPosition += 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* clicked - Starts/stops scrolling on mouse click in about box text view.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)clicked
|
||||
{
|
||||
shouldScroll = !shouldScroll;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* clicked - Restarts at start of about box on double mouse click in about box
|
||||
* text view.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)doubleClicked
|
||||
{
|
||||
shouldScroll = !shouldScroll;
|
||||
currentPosition = 0;
|
||||
restartAtTop = YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {scrollClick = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {appNameField = id; creditsField = id; versionField = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = AboutBoxTextView; LANGUAGE = ObjC; SUPERCLASS = NSTextView; },
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>395 603 356 240 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>349.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>20</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7F44</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
/* AboutBoxTextView.h - Header for the
|
||||
AboutBoxTextView view class for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
*/
|
||||
/* $Id: AboutBoxTextView.h,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface AboutBoxTextView : NSTextView
|
||||
{
|
||||
}
|
||||
@end
|
|
@ -0,0 +1,26 @@
|
|||
/* AboutBoxTextView.m -
|
||||
AboutBoxTextView view class for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
*/
|
||||
/* $Id: AboutBoxTextView.m,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import "AboutBoxTextView.h"
|
||||
#import "AboutBox.h"
|
||||
|
||||
@implementation AboutBoxTextView
|
||||
/*------------------------------------------------------------------------------
|
||||
* mouseDown - This method notifies the AboutBox class of a mouse click, then
|
||||
* calls the normal text view mouseDown.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
if ([theEvent clickCount] >= 2)
|
||||
[[AboutBox sharedInstance] doubleClicked];
|
||||
else
|
||||
[[AboutBox sharedInstance] clicked];
|
||||
[super mouseDown:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Acknowledgements</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;"><big></big>
|
||||
<center><big><big><big><big><br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
StellaOSX<br>
|
||||
<br>
|
||||
</big></big></big>Copyright © 1996-2003 Bradford W. Mott<br>
|
||||
<br>
|
||||
</big><big>Stella Main Web Page<br>
|
||||
<a href="http://stella.sourceforge.net">http://stella.sourceforge.net</a><br>
|
||||
<br>
|
||||
</big><big>Macintosh OS X version by Mark Grebe<br>
|
||||
</big><big>Copyright © 2004 <br>
|
||||
<br>
|
||||
</big><big>Current active members of the Stella development team:<br>
|
||||
Bradford Mott (Original Author)<br>
|
||||
Steve Anthony (Current Maintainer)<br>
|
||||
Mark Grebe (Mac OSX)<br>
|
||||
<br>
|
||||
Graphics by Simple DirectMedia Layer library<br>
|
||||
<a href="http://www.libsdl.org">http://www.libsdl.org</a> <br>
|
||||
<br>
|
||||
This program is free software; you can redistribute it and/or <br>
|
||||
modify it under the terms of the GNU General Public License<br>
|
||||
as published by the Free Software Fuoundation; either version 2<br>
|
||||
of the License, or (at your option) any later version.<br>
|
||||
<br>
|
||||
This program is distributed in the hope that it will be useful, <br>
|
||||
but WITHOUT ANY WARRENTY; without even the <br>
|
||||
implied warranty of MERCHANTABILITY or <br>
|
||||
FITNESS FOR A PARTICULAR PURPOSE. <br>
|
||||
See the GNU General Public License for more details.<br>
|
||||
<br>
|
||||
You should have received a copy of the GNU General <br>
|
||||
Public License with this program; if not, write to the:<br>
|
||||
Free Software Foundation, Inc., <br>
|
||||
59 Temple Place - Suite 330,<br>
|
||||
Boston, MA 02111-1307, USA.<br>
|
||||
</big></center>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,47 @@
|
|||
/* Menus.h - Header for Menus
|
||||
window class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
|
||||
*/
|
||||
/* $Id: Menus.h,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface Menus : NSObject {
|
||||
IBOutlet id limitSpeedMenu;
|
||||
IBOutlet id paddlesMenu;
|
||||
IBOutlet id filterMenu;
|
||||
IBOutlet id videoModeMatrix;
|
||||
IBOutlet id volumeSlider;
|
||||
IBOutlet id aspectRatioField;
|
||||
int openGlEnabled;
|
||||
int gameMenusEnabled;
|
||||
}
|
||||
|
||||
+ (Menus *)sharedInstance;
|
||||
- (void)setSpeedLimitMenu:(int)limit;
|
||||
- (void)initVideoMenu:(int)openGl;
|
||||
- (void)setPaddleMenu:(int)number;
|
||||
- (void)prefsStart;
|
||||
- (void)enableGameMenus;
|
||||
- (void)pushKeyEvent:(int)key:(bool)shift;
|
||||
- (IBAction) paddleChange:(id) sender;
|
||||
- (IBAction) prefsOK:(id) sender;
|
||||
- (IBAction)prefsMenu:(id)sender;
|
||||
- (IBAction)biggerScreen:(id)sender;
|
||||
- (IBAction)smallerScreen:(id)sender;
|
||||
- (IBAction)fullScreen:(id)sender;
|
||||
- (IBAction)openCart:(id)sender;
|
||||
- (IBAction)speedLimit:(id)sender;
|
||||
- (IBAction)pauseGame:(id)sender;
|
||||
- (IBAction)ntscPalMode:(id)sender;
|
||||
- (IBAction)togglePallette:(id)sender;
|
||||
- (IBAction)toggleGlFilter:(id)sender;
|
||||
- (IBAction)grabMouse:(id)sender;
|
||||
- (IBAction)xStartPlus:(id)sender;
|
||||
- (IBAction)xStartMinus:(id)sender;
|
||||
- (IBAction)yStartPlus:(id)sender;
|
||||
- (IBAction)yStartMinus:(id)sender;
|
||||
|
||||
@end
|
|
@ -0,0 +1,301 @@
|
|||
/* Menus.m - Menus window
|
||||
class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
|
||||
*/
|
||||
/* $Id: Menus.m,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "Menus.h"
|
||||
#import "SDL.h"
|
||||
|
||||
#define QZ_m 0x2E
|
||||
#define QZ_o 0x1F
|
||||
#define QZ_h 0x04
|
||||
#define QZ_SLASH 0x2C
|
||||
#define QZ_COMMA 0x2B
|
||||
|
||||
extern void setPaddleMode(int mode);
|
||||
extern void getPrefsSettings(int *gl, int *volume, float *aspect);
|
||||
extern void setPrefsSettings(int gl, int volume, float aspect);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* releaseCmdKeys - This method fixes an issue when modal windows are used with
|
||||
* the Mac OSX version of the SDL library.
|
||||
* As the SDL normally captures all keystrokes, but we need to type in some
|
||||
* Mac windows, all of the control menu windows run in modal mode. However,
|
||||
* when this happens, the release of the command key and the shortcut key
|
||||
* are not sent to SDL. We have to manually cause these events to happen
|
||||
* to keep the SDL library in a sane state, otherwise only everyother shortcut
|
||||
* keypress will work.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
void releaseCmdKeys(NSString *character, int keyCode)
|
||||
{
|
||||
NSEvent *event1, *event2;
|
||||
NSPoint point;
|
||||
|
||||
event1 = [NSEvent keyEventWithType:NSKeyUp location:point modifierFlags:0
|
||||
timestamp:nil windowNumber:0 context:nil characters:character
|
||||
charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode];
|
||||
[NSApp postEvent:event1 atStart:NO];
|
||||
|
||||
event2 = [NSEvent keyEventWithType:NSFlagsChanged location:point modifierFlags:0
|
||||
timestamp:nil windowNumber:0 context:nil characters:nil
|
||||
charactersIgnoringModifiers:nil isARepeat:NO keyCode:0];
|
||||
[NSApp postEvent:event2 atStart:NO];
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* browseFile - This allows the user to chose a file to read in.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
char *browseFile(void) {
|
||||
NSOpenPanel *openPanel = nil;
|
||||
char *fileName;
|
||||
|
||||
fileName = malloc(FILENAME_MAX);
|
||||
if (fileName == NULL)
|
||||
return NULL;
|
||||
|
||||
openPanel = [NSOpenPanel openPanel];
|
||||
[openPanel setCanChooseDirectories:NO];
|
||||
[openPanel setCanChooseFiles:YES];
|
||||
|
||||
if ([openPanel runModalForDirectory:nil file:nil types:nil] == NSOKButton) {
|
||||
[[[openPanel filenames] objectAtIndex:0] getCString:fileName];
|
||||
releaseCmdKeys(@"o",QZ_o);
|
||||
return fileName;
|
||||
}
|
||||
else {
|
||||
releaseCmdKeys(@"o",QZ_o);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void prefsStart(void)
|
||||
{
|
||||
[[Menus sharedInstance] prefsStart];
|
||||
releaseCmdKeys(@",",QZ_m);
|
||||
}
|
||||
|
||||
void hideApp(void) {
|
||||
[NSApp hide:nil];
|
||||
releaseCmdKeys(@"h",QZ_h);
|
||||
}
|
||||
|
||||
void showHelp(void) {
|
||||
[NSApp showHelp:nil];
|
||||
releaseCmdKeys(@"?",QZ_SLASH);
|
||||
}
|
||||
|
||||
void miniturizeWindow(void) {
|
||||
[[NSApp keyWindow] performMiniaturize:nil];
|
||||
releaseCmdKeys(@"m",QZ_m);
|
||||
}
|
||||
|
||||
void initVideoMenu(int openGl)
|
||||
{
|
||||
[[Menus sharedInstance] initVideoMenu:openGl];
|
||||
}
|
||||
|
||||
void setPaddleMenu(int number)
|
||||
{
|
||||
if (number < 4)
|
||||
[[Menus sharedInstance] setPaddleMenu:number];
|
||||
}
|
||||
|
||||
void setSpeedLimitMenu(int limit)
|
||||
{
|
||||
[[Menus sharedInstance] setSpeedLimitMenu:limit];
|
||||
}
|
||||
|
||||
void enableGameMenus(void)
|
||||
{
|
||||
[[Menus sharedInstance] enableGameMenus];
|
||||
}
|
||||
|
||||
@implementation Menus
|
||||
|
||||
static Menus *sharedInstance = nil;
|
||||
|
||||
+ (Menus *)sharedInstance {
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
sharedInstance = self;
|
||||
gameMenusEnabled = 0;
|
||||
return(self);
|
||||
}
|
||||
|
||||
- (void)setSpeedLimitMenu:(int)limit
|
||||
{
|
||||
if (limit)
|
||||
[limitSpeedMenu setState:NSOnState];
|
||||
else
|
||||
[limitSpeedMenu setState:NSOffState];
|
||||
}
|
||||
|
||||
- (void)setPaddleMenu:(int)number
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<4;i++)
|
||||
[[paddlesMenu itemAtIndex:i] setState:NSOffState];
|
||||
if (number < 4)
|
||||
[[paddlesMenu itemAtIndex:number] setState:NSOnState];
|
||||
}
|
||||
|
||||
- (void)initVideoMenu:(int)openGl
|
||||
{
|
||||
openGlEnabled = openGl;
|
||||
}
|
||||
|
||||
- (void)enableGameMenus
|
||||
{
|
||||
gameMenusEnabled = 1;
|
||||
}
|
||||
|
||||
- (IBAction) paddleChange:(id) sender
|
||||
{
|
||||
setPaddleMode([sender tag]);
|
||||
[self setPaddleMenu:[sender tag]];
|
||||
}
|
||||
|
||||
- (void) prefsStart
|
||||
{
|
||||
int gl, volume;
|
||||
float aspectRatio;
|
||||
|
||||
getPrefsSettings(&gl, &volume, &aspectRatio);
|
||||
|
||||
[volumeSlider setIntValue:volume];
|
||||
[videoModeMatrix selectCellWithTag:gl];
|
||||
[aspectRatioField setFloatValue:aspectRatio];
|
||||
|
||||
[NSApp runModalForWindow:[volumeSlider window]];
|
||||
|
||||
gl = [[videoModeMatrix selectedCell] tag];
|
||||
volume = [volumeSlider intValue];
|
||||
aspectRatio = [aspectRatioField floatValue];
|
||||
|
||||
setPrefsSettings(gl, volume, aspectRatio);
|
||||
}
|
||||
|
||||
- (IBAction) prefsOK:(id) sender
|
||||
{
|
||||
[NSApp stopModal];
|
||||
[[volumeSlider window] close];
|
||||
}
|
||||
- (IBAction)prefsMenu:(id)sender
|
||||
{
|
||||
[[Menus sharedInstance] prefsStart];
|
||||
}
|
||||
|
||||
-(void)pushKeyEvent:(int)key:(bool)shift
|
||||
{
|
||||
SDL_Event theEvent;
|
||||
|
||||
theEvent.key.type = SDL_KEYDOWN;
|
||||
theEvent.key.state = SDL_PRESSED;
|
||||
theEvent.key.keysym.scancode = 0;
|
||||
theEvent.key.keysym.sym = key;
|
||||
theEvent.key.keysym.mod = KMOD_LMETA;
|
||||
if (shift)
|
||||
theEvent.key.keysym.mod |= KMOD_LSHIFT;
|
||||
theEvent.key.keysym.unicode = 0;
|
||||
SDL_PushEvent(&theEvent);
|
||||
}
|
||||
|
||||
- (IBAction)biggerScreen:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_EQUALS:NO];
|
||||
}
|
||||
|
||||
- (IBAction)smallerScreen:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_MINUS:NO];
|
||||
}
|
||||
|
||||
- (IBAction)fullScreen:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_RETURN:NO];
|
||||
}
|
||||
|
||||
- (IBAction)openCart:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_o:NO];
|
||||
}
|
||||
|
||||
- (IBAction)speedLimit:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_l:NO];
|
||||
}
|
||||
|
||||
- (IBAction)pauseGame:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_p:NO];
|
||||
}
|
||||
|
||||
- (IBAction)ntscPalMode:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_f:YES];
|
||||
}
|
||||
|
||||
- (IBAction)toggleGlFilter:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_f:NO];
|
||||
}
|
||||
|
||||
- (IBAction)togglePallette:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_p:YES];
|
||||
}
|
||||
|
||||
- (IBAction)grabMouse:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_g:NO];
|
||||
}
|
||||
|
||||
- (IBAction)xStartPlus:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_HOME:NO];
|
||||
}
|
||||
|
||||
- (IBAction)xStartMinus:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_END:NO];
|
||||
}
|
||||
|
||||
- (IBAction)yStartPlus:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_PAGEUP:NO];
|
||||
}
|
||||
|
||||
- (IBAction)yStartMinus:(id)sender
|
||||
{
|
||||
[self pushKeyEvent:SDLK_PAGEDOWN:NO];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
|
||||
{
|
||||
if (gameMenusEnabled) {
|
||||
if ([[menuItem title] isEqualToString:@"Toggle Open GL Filter"]) {
|
||||
if (openGlEnabled)
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
return YES;
|
||||
}
|
||||
else {
|
||||
if ([[menuItem title] isEqualToString:@"Open New CartridgeÉ"] ||
|
||||
[[menuItem title] isEqualToString:@"Preferences..."])
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
@end
|
|
@ -0,0 +1,22 @@
|
|||
/* Preferences.h - Header for Preferences
|
||||
class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
|
||||
Based on the Preferences pane of the
|
||||
TextEdit application.
|
||||
|
||||
*/
|
||||
/* $Id: Preferences.h,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface Preferences : NSObject {
|
||||
NSUserDefaults *defaults; /* Defaults pointer */
|
||||
}
|
||||
|
||||
+ (Preferences *)sharedInstance;
|
||||
- (void)setString:(char *)key:(char *)value;
|
||||
- (void)getString:(char *)key:(char *)value;
|
||||
- (void)save;
|
||||
|
||||
@end
|
|
@ -0,0 +1,80 @@
|
|||
/* Preferences.m - Preferences
|
||||
class and support functions for the
|
||||
Macintosh OS X SDL port of Stella
|
||||
Mark Grebe <atarimac@cox.net>
|
||||
|
||||
Based on the Preferences pane of the
|
||||
TextEdit application.
|
||||
|
||||
*/
|
||||
/* $Id: Preferences.m,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "Preferences.h"
|
||||
#import "SDL.h"
|
||||
|
||||
void prefsSetString(char *key, char *value)
|
||||
{
|
||||
[[Preferences sharedInstance] setString:key:value];
|
||||
}
|
||||
|
||||
void prefsGetString(char *key, char *value)
|
||||
{
|
||||
[[Preferences sharedInstance] getString:key:value];
|
||||
}
|
||||
|
||||
void prefsSave(void)
|
||||
{
|
||||
[[Preferences sharedInstance] save];
|
||||
}
|
||||
|
||||
@implementation Preferences
|
||||
|
||||
static Preferences *sharedInstance = nil;
|
||||
|
||||
+ (Preferences *)sharedInstance {
|
||||
return sharedInstance ? sharedInstance : [[self alloc] init];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
sharedInstance = self;
|
||||
return(self);
|
||||
}
|
||||
|
||||
- (void)setString:(char *)key:(char *)value
|
||||
{
|
||||
NSNumber *theValue;
|
||||
NSString *theKey;
|
||||
|
||||
theKey = [NSString stringWithCString:key];
|
||||
theValue = [NSString stringWithCString:value];
|
||||
[defaults setObject:theValue forKey:theKey];
|
||||
[theKey release];
|
||||
[theValue release];
|
||||
}
|
||||
|
||||
- (void)getString:(char *)key:(char *)value
|
||||
{
|
||||
NSString *theKey;
|
||||
NSString *theValue;
|
||||
|
||||
theKey = [NSString stringWithCString:key];
|
||||
theValue = [defaults objectForKey:theKey];
|
||||
if (theValue == nil)
|
||||
value[0] = 0;
|
||||
else {
|
||||
[theValue getCString:value maxLength:1023];
|
||||
[theKey release];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)save
|
||||
{
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,31 @@
|
|||
README for Building StellaOSX
|
||||
-----------------------------
|
||||
|
||||
StellaOSX is configured to be built using Xcode. The project file for doing
|
||||
this is in this directory, named stella.pbproj.
|
||||
|
||||
The project links the application with two external static libraries.
|
||||
|
||||
The first of these is SDL. The project expects a copy of the SDL.Framework to
|
||||
be present in the macosx directory. It will then link against this
|
||||
framework, and place a copy of the framework in the Application bundle. The
|
||||
current version of the SDL framework may be downloaded from www.libsdl.org. The
|
||||
current release is linked against version 1.2.7 for MacOSX. The SDL framework
|
||||
may be located else where, but the project include and copy framework settings
|
||||
would need to be changed.
|
||||
|
||||
The second library which the application is linked libpng. The library source
|
||||
may be downloaded from http://www.libpng.org/pub/png/libpng.html. I am
|
||||
currently using version 1.2.5. The source will need to be built for MacOSX
|
||||
(but not necessarily installed). The following files will then need to
|
||||
be placed in the stella/src/macosx diretory:
|
||||
|
||||
libpng.a
|
||||
png.h
|
||||
pngconf.h
|
||||
|
||||
Finally, the application is going to
|
||||
|
||||
Mark Grebe
|
||||
|
||||
$Id: READMEbuild.txt,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $
|
|
@ -0,0 +1,16 @@
|
|||
/* SDLMain.h - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
/* $Id: SDLMain.h,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
{
|
||||
}
|
||||
+ (SDLMain *)sharedInstance;
|
||||
|
||||
@end
|
|
@ -0,0 +1,238 @@
|
|||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||
|
||||
Feel free to customize this file to suit your needs
|
||||
*/
|
||||
/* $Id: SDLMain.m,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $ */
|
||||
|
||||
#import "SDL.h"
|
||||
#import "SDLMain.h"
|
||||
#import "Preferences.h"
|
||||
#import <sys/param.h> /* for MAXPATHLEN */
|
||||
#import <unistd.h>
|
||||
|
||||
extern int stellaMain(int argc, char* argv[]);
|
||||
|
||||
static int gArgc;
|
||||
static char **gArgv;
|
||||
static BOOL gFinderLaunch;
|
||||
static BOOL started=NO;
|
||||
static char startupFile[FILENAME_MAX];
|
||||
int fileToLoad = FALSE;
|
||||
|
||||
/* A helper category for NSString */
|
||||
@interface NSString (ReplaceSubString)
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
|
||||
@end
|
||||
|
||||
@interface SDLApplication : NSApplication
|
||||
@end
|
||||
|
||||
@implementation SDLApplication
|
||||
/* Invoked from the Quit menu item */
|
||||
- (void)terminate:(id)sender
|
||||
{
|
||||
/* Post a SDL_QUIT event */
|
||||
SDL_Event event;
|
||||
event.type = SDL_QUIT;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
static SDLMain *sharedInstance = nil;
|
||||
|
||||
+ (SDLMain *)sharedInstance {
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
- (void) setupWorkingDirectory:(BOOL)shouldChdir
|
||||
{
|
||||
char parentdir[MAXPATHLEN];
|
||||
char *c;
|
||||
|
||||
strncpy ( parentdir, gArgv[0], sizeof(parentdir) );
|
||||
c = (char*) parentdir;
|
||||
|
||||
while (*c != '\0') /* go to end */
|
||||
c++;
|
||||
|
||||
while (*c != '/') /* back up to parent */
|
||||
c--;
|
||||
|
||||
*c++ = '\0'; /* cut off last part (binary name) */
|
||||
|
||||
if (shouldChdir)
|
||||
{
|
||||
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
|
||||
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
|
||||
{
|
||||
NSRange aRange;
|
||||
NSEnumerator *enumerator;
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
aRange = [[aMenu title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
|
||||
|
||||
enumerator = [[aMenu itemArray] objectEnumerator];
|
||||
while ((menuItem = [enumerator nextObject]))
|
||||
{
|
||||
aRange = [[menuItem title] rangeOfString:@"SDL App"];
|
||||
if (aRange.length != 0)
|
||||
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
|
||||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
[ aMenu sizeToFit ];
|
||||
}
|
||||
|
||||
char *appName = "StellaOSX";
|
||||
char fileName[FILENAME_MAX];
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
int status;
|
||||
char *args[2];
|
||||
|
||||
started = YES;
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
||||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]];
|
||||
|
||||
/* Hand off to main application code */
|
||||
args[0] = appName;
|
||||
if (fileToLoad)
|
||||
args[1] = startupFile;
|
||||
else
|
||||
args[1] = NULL;
|
||||
status = stellaMain(2,args);
|
||||
|
||||
/* We're done, thank you for playing */
|
||||
exit(status);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* application openFile - Open a file dragged to the application.
|
||||
*-----------------------------------------------------------------------------*/
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
SDL_Event event;
|
||||
char *cFilename;
|
||||
|
||||
if (started) {
|
||||
cFilename = malloc(FILENAME_MAX);
|
||||
if (cFilename)
|
||||
{
|
||||
[filename getCString:cFilename];
|
||||
event.type = SDL_USEREVENT;
|
||||
event.user.code = 1;
|
||||
event.user.data1 = cFilename;
|
||||
event.user.data2 = 0;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fileToLoad = TRUE;
|
||||
[filename getCString:startupFile];
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (ReplaceSubString)
|
||||
|
||||
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
|
||||
{
|
||||
unsigned int bufferSize;
|
||||
unsigned int selfLen = [self length];
|
||||
unsigned int aStringLen = [aString length];
|
||||
unichar *buffer;
|
||||
NSRange localRange;
|
||||
NSString *result;
|
||||
|
||||
bufferSize = selfLen + aStringLen - aRange.length;
|
||||
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
|
||||
|
||||
/* Get first part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aRange.location;
|
||||
[self getCharacters:buffer range:localRange];
|
||||
|
||||
/* Get middle part into buffer */
|
||||
localRange.location = 0;
|
||||
localRange.length = aStringLen;
|
||||
[aString getCharacters:(buffer+aRange.location) range:localRange];
|
||||
|
||||
/* Get last part into buffer */
|
||||
localRange.location = aRange.location + aRange.length;
|
||||
localRange.length = selfLen - localRange.location;
|
||||
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
|
||||
|
||||
/* Build output string */
|
||||
result = [NSString stringWithCharacters:buffer length:bufferSize];
|
||||
|
||||
NSDeallocateMemoryPages(buffer, bufferSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif
|
||||
|
||||
/* Main entry point to executable - should *not* be SDL_main! */
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
static Preferences *myPrefs;
|
||||
/* Copy the arguments into a global variable */
|
||||
int i;
|
||||
|
||||
/* This is passed if we are launched by double-clicking */
|
||||
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
|
||||
gArgc = 1;
|
||||
gFinderLaunch = YES;
|
||||
} else {
|
||||
gArgc = argc;
|
||||
gFinderLaunch = NO;
|
||||
}
|
||||
gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1));
|
||||
assert (gArgv != NULL);
|
||||
for (i = 0; i < gArgc; i++)
|
||||
gArgv[i] = argv[i];
|
||||
gArgv[i] = NULL;
|
||||
|
||||
myPrefs = [Preferences sharedInstance];
|
||||
|
||||
[SDLApplication poseAsClass:[NSApplication class]];
|
||||
NSApplicationMain (argc, argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Routine to center the application window */
|
||||
void centerAppWindow(void)
|
||||
{
|
||||
[[[SDLApplication sharedApplication] keyWindow] center];
|
||||
}
|
||||
|
Binary file not shown.
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {showPanel = id; };
|
||||
CLASS = AboutBox;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {appNameField = id; creditsField = id; versionField = id; };
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {
|
||||
biggerScreen = id;
|
||||
fullScreen = id;
|
||||
grabMouse = id;
|
||||
leftJoyChange = id;
|
||||
ntscPalMode = id;
|
||||
openCart = id;
|
||||
paddleChange = id;
|
||||
pauseGame = id;
|
||||
prefsMenu = id;
|
||||
prefsOK = id;
|
||||
rightJoyChange = id;
|
||||
smallerScreen = id;
|
||||
speedLimit = id;
|
||||
toggleGlFilter = id;
|
||||
togglePallette = id;
|
||||
xStartMinus = id;
|
||||
xStartPlus = id;
|
||||
yStartMinus = id;
|
||||
yStartPlus = id;
|
||||
};
|
||||
CLASS = Menus;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
aspectRatioField = id;
|
||||
filterMenu = id;
|
||||
limitSpeedMenu = id;
|
||||
paddlesMenu = id;
|
||||
videoModeMatrix = id;
|
||||
volumeSlider = id;
|
||||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = Preferences; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{CLASS = SDLMain; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>495 397 359 316 0 0 1280 1002 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>29</key>
|
||||
<string>116 460 371 44 0 0 1280 1002 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>349.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>578</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7H63</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -0,0 +1,122 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-1999 by Bradford W. Mott
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsMACOSX.cxx,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "StellaEvent.hxx"
|
||||
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsMACOSX.hxx"
|
||||
|
||||
extern "C" {
|
||||
void prefsSetString(char *key, char *value);
|
||||
void prefsGetString(char *key, char *value);
|
||||
void prefsSave(void);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsMACOSX::SettingsMACOSX()
|
||||
{
|
||||
// First set variables that the parent class needs
|
||||
myBaseDir = "./";
|
||||
string stelladir = myBaseDir;
|
||||
|
||||
myStateDir = stelladir + "state/";
|
||||
if(access(myStateDir.c_str(), R_OK|W_OK|X_OK) != 0 )
|
||||
mkdir(myStateDir.c_str(), 0777);
|
||||
|
||||
myUserPropertiesFile = stelladir + "stella.pro";
|
||||
mySystemPropertiesFile = stelladir + "stella.pro";
|
||||
myUserConfigFile = "";
|
||||
mySystemConfigFile = "";
|
||||
|
||||
// Set up the names of the input and output config files
|
||||
mySettingsOutputFilename = myUserConfigFile;
|
||||
mySettingsInputFilename = myUserConfigFile;
|
||||
|
||||
mySnapshotFile = "";
|
||||
myStateFile = "";
|
||||
|
||||
// Now create MacOSX specific settings
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
set("ssdir", "./");
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsMACOSX::~SettingsMACOSX()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsMACOSX::usage(string& message)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsMACOSX::loadConfig()
|
||||
{
|
||||
string key, value;
|
||||
char cvalue[1024];
|
||||
|
||||
// Write out each of the key and value pairs
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
prefsGetString((char *) mySettings[i].key.c_str(),cvalue);
|
||||
if (cvalue[0] != 0)
|
||||
mySettings[i].value.assign(cvalue);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SettingsMACOSX::saveConfig()
|
||||
{
|
||||
// Write out each of the key and value pairs
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
if(mySettings[i].save)
|
||||
{
|
||||
prefsSetString((char *) mySettings[i].key.c_str(),
|
||||
(char *) mySettings[i].value.c_str());
|
||||
}
|
||||
prefsSave();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string SettingsMACOSX::stateFilename(const string& md5, uInt32 state)
|
||||
{
|
||||
ostringstream buf;
|
||||
buf << myStateDir << md5 << ".st" << state;
|
||||
|
||||
myStateFile = buf.str();
|
||||
return myStateFile;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SettingsMACOSX::fileExists(const string& filename)
|
||||
{
|
||||
return (access(filename.c_str(), F_OK|W_OK) == 0);
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-1999 by Bradford W. Mott
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsMACOSX.hxx,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SETTINGS_MAC_OSX_HXX
|
||||
#define SETTINGS_MAX_OSX_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
class Console;
|
||||
|
||||
|
||||
/**
|
||||
This class defines Macintosh OSX system specific settings.
|
||||
|
||||
@author Mark Grebe
|
||||
@version $Id: SettingsMACOSX.hxx,v 1.1.1.1 2004-06-16 02:30:30 markgrebe Exp $
|
||||
*/
|
||||
class SettingsMACOSX : public Settings
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new UNIX settings object
|
||||
*/
|
||||
SettingsMACOSX();
|
||||
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
virtual ~SettingsMACOSX();
|
||||
|
||||
public:
|
||||
/**
|
||||
This method should be called to get the filename of a state file
|
||||
given the state number.
|
||||
|
||||
@return String representing the full path of the state filename.
|
||||
*/
|
||||
virtual string stateFilename(const string& md5, uInt32 state);
|
||||
|
||||
/**
|
||||
This method should be called to test whether the given file exists.
|
||||
|
||||
@param filename The filename to test for existence.
|
||||
|
||||
@return boolean representing whether or not the file exists
|
||||
*/
|
||||
virtual bool fileExists(const string& filename);
|
||||
|
||||
/**
|
||||
Display the commandline settings for this UNIX version of Stella.
|
||||
|
||||
@param message A short message about this version of Stella
|
||||
*/
|
||||
virtual void usage(string& message);
|
||||
|
||||
/**
|
||||
This method should be called to load the current settings from the
|
||||
standard Mac preferences.
|
||||
*/
|
||||
void loadConfig();
|
||||
|
||||
/**
|
||||
This method should be called to save the current settings to the
|
||||
standard Mac preferences.
|
||||
*/
|
||||
|
||||
void saveConfig();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Description</key>
|
||||
<string>This project builds an SDL-based application with Cocoa menus.</string>
|
||||
<key>FilesToMacroExpand</key>
|
||||
<array>
|
||||
<string>English.lproj/InfoPlist.strings</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue