Updated some deprecated code for the OSX version to compile under Snow

Leopard (10.6).  From this point on, the lowest supported version is
OSX 10.4.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1886 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-10-13 00:30:45 +00:00
parent f283052d36
commit 7a5b2c3661
8 changed files with 51 additions and 67 deletions

View File

@ -5,7 +5,7 @@
*/
/* $Id: AboutBox.m,v 1.2 2005-06-04 02:04:06 markgrebe Exp $ */
#import "AboutBox.h";
#import "AboutBox.h"
@implementation AboutBox

View File

@ -34,12 +34,12 @@ void releaseCmdKeys(NSString *character, int keyCode)
NSPoint point;
event1 = [NSEvent keyEventWithType:NSKeyUp location:point modifierFlags:0
timestamp:nil windowNumber:0 context:nil characters:character
timestamp:0.0 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
timestamp:0.0 windowNumber:0 context:nil characters:nil
charactersIgnoringModifiers:nil isARepeat:NO keyCode:0];
[NSApp postEvent:event2 atStart:NO];
}

View File

@ -15,8 +15,8 @@
}
+ (Preferences *)sharedInstance;
- (void)setString:(char *)key:(char *)value;
- (void)getString:(char *)key:(char *)value;
- (void)setString:(const char *)key:(const char *)value;
- (void)getString:(const char *)key:(char *)value:(int)size;
- (void)save;
@end

View File

@ -13,14 +13,14 @@
#import "Preferences.h"
#import "SDL.h"
void prefsSetString(char *key, char *value)
void prefsSetString(const char* key, const char* value)
{
[[Preferences sharedInstance] setString:key:value];
}
void prefsGetString(char *key, char *value)
void prefsGetString(const char* key, char* value, int size)
{
[[Preferences sharedInstance] getString:key:value];
[[Preferences sharedInstance] getString:key:value:size];
}
void prefsSave(void)
@ -43,31 +43,27 @@ static Preferences *sharedInstance = nil;
return(self);
}
- (void)setString:(char *)key:(char *)value
- (void)setString:(const char *)key:(const char *)value
{
NSNumber *theValue;
NSString *theKey;
theKey = [NSString stringWithCString:key];
theValue = [NSString stringWithCString:value];
[defaults setObject:theValue forKey:theKey];
[theKey release];
[theValue release];
NSString* theKey = [NSString stringWithCString:key encoding:NSASCIIStringEncoding];
NSString* theValue = [NSString stringWithCString:value encoding:NSASCIIStringEncoding];
[defaults setObject:theValue forKey:theKey];
[theKey release];
[theValue release];
}
- (void)getString:(char *)key:(char *)value
- (void)getString:(const char *)key:(char *)value:(int)size
{
NSString *theKey;
NSString *theValue;
theKey = [NSString stringWithCString:key];
theValue = [defaults objectForKey:theKey];
if (theValue == nil)
value[0] = 0;
else {
[theValue getCString:value];
[theKey release];
}
NSString* theKey = [NSString stringWithCString:key encoding:NSASCIIStringEncoding];
NSString* theValue = [defaults objectForKey:theKey];
if (theValue != nil)
strncpy(value, [theValue cStringUsingEncoding: NSASCIIStringEncoding], size);
else
value[0] = 0;
[theKey release];
[theValue release];
}
- (void)save

View File

@ -83,11 +83,10 @@ static SDLMain *sharedInstance = nil;
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
[ aMenu sizeToFit ];
/* SA [ aMenu sizeToFit ]; */
}
char *appName = "StellaOSX";
char fileName[FILENAME_MAX];
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
@ -121,22 +120,20 @@ char fileName[FILENAME_MAX];
*-----------------------------------------------------------------------------*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
char *cFilename;
if (started) {
cFilename = malloc(FILENAME_MAX);
if (cFilename)
{
[filename getCString:cFilename];
if (started)
{
char cFilename[FILENAME_MAX];
strncpy(cFilename, [filename cStringUsingEncoding: NSASCIIStringEncoding], FILENAME_MAX-1);
if (strlen(cFilename) > 0)
macOpenConsole(cFilename);
}
}
else {
fileToLoad = TRUE;
[filename getCString:startupFile];
}
}
else
{
fileToLoad = TRUE;
strncpy(startupFile, [filename cStringUsingEncoding: NSASCIIStringEncoding], FILENAME_MAX-1);
}
return(FALSE);
return(FALSE);
}
@end

View File

@ -33,8 +33,8 @@
#include "SettingsMACOSX.hxx"
extern "C" {
void prefsSetString(char *key, char *value);
void prefsGetString(char *key, char *value);
void prefsSetString(const char* key, const char* value);
void prefsGetString(const char* key, char* value, int size);
void prefsSave(void);
}
@ -62,7 +62,7 @@ void SettingsMACOSX::loadConfig()
const SettingsArray& settings = getInternalSettings();
for(unsigned int i = 0; i < settings.size(); ++i)
{
prefsGetString((char *) settings[i].key.c_str(), cvalue);
prefsGetString(settings[i].key.c_str(), cvalue, 2047);
if(cvalue[0] != 0)
setInternal(settings[i].key, cvalue, i, true);
}
@ -74,9 +74,7 @@ void SettingsMACOSX::saveConfig()
// Write out each of the key and value pairs
const SettingsArray& settings = getInternalSettings();
for(unsigned int i = 0; i < settings.size(); ++i)
{
prefsSetString((char *) settings[i].key.c_str(),
(char *) settings[i].value.c_str());
}
prefsSetString(settings[i].key.c_str(), settings[i].value.c_str());
prefsSave();
}

View File

@ -1,6 +0,0 @@
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
GCC_VERSION_ppc = 3.3
GCC_VERSION_i386 = 4.0
MACOSX_DEPLOYMENT_TARGET_ppc = 10.2
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@ -473,7 +473,7 @@
2D73959508C3EB4E0060BB99 /* CommandMenu.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CommandMenu.cxx; path = ../gui/CommandMenu.cxx; sourceTree = SOURCE_ROOT; };
2D73959608C3EB4E0060BB99 /* CommandMenu.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = CommandMenu.hxx; path = ../gui/CommandMenu.hxx; sourceTree = SOURCE_ROOT; };
2D7B4F6C063B513200579B93 /* Credits.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = Credits.html; sourceTree = SOURCE_ROOT; };
2D91751A09BA90380026E9FF /* Info-StellaOSX__Upgraded_.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-StellaOSX__Upgraded_.plist"; sourceTree = "<group>"; };
2D91751A09BA90380026E9FF /* Info-StellaOSX__Upgraded_.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-StellaOSX__Upgraded_.plist"; sourceTree = "<group>"; };
2D91751E09BA90390026E9FF /* StellaOSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StellaOSX.app; sourceTree = BUILT_PRODUCTS_DIR; };
2D91753709BA91BC0026E9FF /* StellaOSX.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; path = StellaOSX.xcconfig; sourceTree = SOURCE_ROOT; };
2D9217FA0857CC88001D664B /* ConsoleFont.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = ConsoleFont.hxx; path = ../gui/ConsoleFont.hxx; sourceTree = SOURCE_ROOT; };
@ -1414,7 +1414,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 2D91752109BA903B0026E9FF /* Build configuration list for PBXProject "stella" */;
compatibilityVersion = "Xcode 2.4";
compatibilityVersion = "Xcode 3.2";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* «PROJECTNAMEASXML» */;
projectDirPath = "";
@ -1817,6 +1817,7 @@
2D91752209BA903B0026E9FF /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
FRAMEWORK_SEARCH_PATHS = (
.,
"$(HOME)/Library/Frameworks",
@ -1828,25 +1829,23 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 2D91753709BA91BC0026E9FF /* StellaOSX.xcconfig */;
buildSettings = {
ARCHS = (
ppc,
i386,
);
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
FRAMEWORK_SEARCH_PATHS = (
.,
"$(HOME)/Library/Frameworks",
);
GCC_ENABLE_CPP_RTTI = NO;
GCC_OPTIMIZATION_LEVEL = 3;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
};
name = Deployment;
};
2D91752409BA903B0026E9FF /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
MACOSX_DEPLOYMENT_TARGET = 10.4;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT = macosx10.4;
};
name = Default;
};