Changeset - r11526:ee46e584d4c5
[Not reviewed]
master
0 5 0
rubidium - 16 years ago 2009-03-29 19:55:08
rubidium@openttd.org
(svn r15892) -Codechange: [OSX] some type fixes so OpenTTD likes more of the 3.1.x Xcodes.
5 files changed with 35 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/os/macosx/macos.mm
Show inline comments
 
@@ -30,13 +30,13 @@ void ToggleFullScreen(bool fs);
 
static char *GetOSString()
 
{
 
	static char buffer[175];
 
	const char *CPU;
 
	char OS[20];
 
	char newgrf[125];
 
	long sysVersion;
 
	SInt32 sysVersion;
 

	
 
	// get the hardware info
 
	host_basic_info_data_t hostInfo;
 
	mach_msg_type_number_t infoCount;
 

	
 
	infoCount = HOST_BASIC_INFO_COUNT;
 
@@ -198,23 +198,23 @@ const char *GetCurrentLocale(const char 
 
 * for the minor and bugfix version numbers and a scheme of representing all numbers from 9 and up
 
 * with 9. This means we can't tell OS X 10.9 from 10.9 or 10.11. Please use GetMacOSVersionMajor()
 
 * and GetMacOSVersionMinor() instead.
 
 */
 
static long GetMacOSVersion()
 
{
 
	static long sysVersion = -1;
 
	static SInt32 sysVersion = -1;
 

	
 
	if (sysVersion != -1) return sysVersion;
 

	
 
	if (Gestalt(gestaltSystemVersion, &sysVersion) != noErr) sysVersion = -1;
 
	 return sysVersion;
 
}
 

	
 
long GetMacOSVersionMajor()
 
{
 
	static long sysVersion = -1;
 
	static SInt32 sysVersion = -1;
 

	
 
	if (sysVersion != -1) return sysVersion;
 

	
 
	sysVersion = GetMacOSVersion();
 
	if (sysVersion == -1) return -1;
 

	
 
@@ -226,13 +226,13 @@ long GetMacOSVersionMajor()
 

	
 
	return sysVersion;
 
}
 

	
 
long GetMacOSVersionMinor()
 
{
 
	static long sysVersion = -1;
 
	static SInt32 sysVersion = -1;
 

	
 
	if (sysVersion != -1) return sysVersion;
 

	
 
	sysVersion = GetMacOSVersion();
 
	if (sysVersion == -1) return -1;
 

	
 
@@ -244,13 +244,13 @@ long GetMacOSVersionMinor()
 

	
 
	return sysVersion;
 
}
 

	
 
long GetMacOSVersionBugfix()
 
{
 
	static long sysVersion = -1;
 
	static SInt32 sysVersion = -1;
 

	
 
	if (sysVersion != -1) return sysVersion;
 

	
 
	sysVersion = GetMacOSVersion();
 
	if (sysVersion == -1) return -1;
 

	
src/os/macosx/osx_stdafx.h
Show inline comments
 
@@ -2,18 +2,40 @@
 

	
 
/** @file osx_stdafx.h OSX is different on some places. */
 

	
 
#ifndef MACOS_STDAFX_H
 
#define MACOS_STDAFX_H
 

	
 
/* __LP64__ only exists in 10.5 and higher */
 
#if defined(__APPLE__) && !defined(__LP64__)
 
#	define __LP64__ 0
 
#endif
 

	
 
/* Check for mismatching 'architectures' */
 
#if (__LP64__ && !defined(_SQ64)) || (!__LP64__ && defined(_SQ64))
 
#	error "Compiling 64 bits without _SQ64 set! (or vice versa)"
 
#endif
 

	
 
#include <CoreServices/CoreServices.h>
 

	
 
/* remove the variables that CoreServices defines, but we define ourselves too */
 
#undef bool
 
#undef false
 
#undef true
 

	
 
/* Name conflict */
 
#define GetTime		OTTD_GetTime
 

	
 
#define SL_ERROR OSX_SL_ERROR
 

	
 
/* NSInteger and NSUInteger are part of 10.5 and higher. */
 
#ifndef NSInteger
 
#if __LP64__
 
typedef long NSInteger;
 
typedef unsigned long NSUInteger;
 
#else
 
typedef int NSInteger;
 
typedef unsigned int NSUInteger;
 
#endif /* __LP64__ */
 
#endif /* NSInteger */
 

	
 
#endif /* MACOS_STDAFX_H */
src/stdafx.h
Show inline comments
 
@@ -2,12 +2,16 @@
 

	
 
/** @file stdafx.h Definition of base types and functions in a cross-platform compatible way. */
 

	
 
#ifndef STDAFX_H
 
#define STDAFX_H
 

	
 
#if defined(__APPLE__)
 
	#include "os/macosx/osx_stdafx.h"
 
#endif /* __APPLE__ */
 

	
 
#if defined(__NDS__)
 
	#include <nds/jtypes.h>
 
	/* NDS' types for uint32/int32 are based on longs, which causes
 
	 * trouble all over the place in OpenTTD. */
 
	#define uint32 uint32_ugly_hack
 
	#define int32 int32_ugly_hack
 
@@ -101,16 +105,12 @@
 
	#endif
 
	/* Act like we already included this file, as it somehow gives linkage problems
 
	 *  (mismatch linkage of C++ and C between this include and unistd.h). */
 
	#define CLIB_USERGROUP_PROTOS_H
 
#endif /* __MORPHOS__ */
 

	
 
#if defined(__APPLE__)
 
	#include "os/macosx/osx_stdafx.h"
 
#endif /* __APPLE__ */
 

	
 
#if defined(PSP)
 
	/* PSP can only have 10 file-descriptors open at any given time, but this
 
	 *  switch only limits reads via the Fio system. So keep 2 fds free for things
 
	 *  like saving a game. */
 
	#define LIMITED_FDS 8
 
	#define printf pspDebugScreenPrintf
src/video/cocoa/fullscreen.mm
Show inline comments
 
@@ -296,13 +296,13 @@ class FullscreenSubdriver: public CocoaS
 
		CSleep((uint32)(adjustment * 1000));
 
	}
 

	
 

	
 
	bool SetVideoMode(int w, int h)
 
	{
 
		int exact_match;
 
		boolean_t exact_match;
 
		CFNumberRef number;
 
		int bpp;
 
		int gamma_error;
 
		OTTD_QuartzGammaTable gamma_table;
 
		NSRect screen_rect;
 
		CGError error;
src/video/cocoa/wnd_quartz.mm
Show inline comments
 
@@ -62,13 +62,13 @@ class WindowQuartzSubdriver;
 
- (void)miniaturize:(id)sender;
 
- (void)display;
 
- (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
 
- (void)appDidHide:(NSNotification*)note;
 
- (void)appWillUnhide:(NSNotification*)note;
 
- (void)appDidUnhide:(NSNotification*)note;
 
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
 
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
 
@end
 

	
 
/* Delegate for our NSWindow to send ask for quit on close */
 
@interface OTTD_QuartzWindowDelegate : NSObject{
 
	WindowQuartzSubdriver *driver;
 
}
 
@@ -261,13 +261,13 @@ static CGColorSpaceRef QZ_GetCorrectColo
 
	[ self restoreCachedImage ];
 

	
 
	driver->active = true;
 
}
 

	
 

	
 
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
 
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
 
{
 
	/* Make our window subclass receive these application notifications */
 
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
 
	selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ];
 

	
 
	[ [ NSNotificationCenter defaultCenter ] addObserver:self
 
@@ -333,13 +333,13 @@ static CGColorSpaceRef QZ_GetCorrectColo
 
- (void)drawRect:(NSRect)invalidRect
 
{
 
	CGImageRef    fullImage;
 
	CGImageRef    clippedImage;
 
	NSRect        rect;
 
	const NSRect *dirtyRects;
 
	int           dirtyRectCount;
 
	NSInteger     dirtyRectCount;
 
	int           n;
 
	CGRect        clipRect;
 
	CGRect        blitRect;
 
	uint32        blitArea       = 0;
 
	NSRect        frameRect      = [ self frame ];
 
	CGContextRef  viewContext    = (CGContextRef)[ [ NSGraphicsContext currentContext ] graphicsPort ];
0 comments (0 inline, 0 general)