Changeset - r21585:c96bdc9bd57c
[Not reviewed]
master
0 6 0
planetmaker - 10 years ago 2014-07-30 20:19:29
planetmaker@openttd.org
(svn r26709) -Fix (r15892 and others) [FS#6069]: [OSX] Compilation fails with some lzo2 versions if we define __LP64__ as 0 instead of checking whether it is defined (kernigh2)
6 files changed with 68 insertions and 76 deletions:
0 comments (0 inline, 0 general)
readme.txt
Show inline comments
 
@@ -653,75 +653,76 @@ OpenTTD is licensed under the GNU Genera
 
the complete license text, see the file 'COPYING'. This license applies
 
to all files in this distribution, except as noted below.
 

	
 
The squirrel implementation in src/3rdparty/squirrel is licensed under
 
the Zlib license. See src/3rdparty/squirrel/COPYRIGHT for the complete
 
license text.
 

	
 
The md5 implementation in src/3rdparty/md5 is licensed under the Zlib
 
license. See the comments in the source files in src/3rdparty/md5 for
 
the complete license text.
 

	
 
The exe2coff implementation in os/dos/exe2coff is available under the
 
GPL, with a number of additional terms. See os/dos/exe2coff/copying and
 
os/dos/exe2coff/copying.dj for the exact licensing terms.
 

	
 
The CWSDPMI implementation in os/dos/cwsdpmi is distributed under a
 
custom binary-only license that prohibits modification. The exact
 
licensing terms can be found in os/dos/cwsdpmi/cwsdpmi.txt. The sources
 
for these files can be downloaded at its author site, at:
 
http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip
 

	
 
X.X) Credits
 
---- -------
 
The OpenTTD team (in alphabetical order):
 
  Albert Hofkamp (Alberth)        - GUI expert
 
  Jean-François Claeys (Belugas)  - GUI, newindustries and more
 
  Matthijs Kooijman (blathijs)    - Pathfinder-guru, pool rework
 
  Ulf Hermann (fonsinchen)        - Cargo Distribution
 
  Christoph Elsenhans (frosch)    - General coding
 
  Loïc Guilloux (glx)             - Windows Expert
 
  Michael Lutz (michi_cc)         - Path based signals
 
  Owen Rudge (orudge)             - Forum host, OS/2 port
 
  Peter Nelson (peter1138)        - Spiritual descendant from newGRF gods
 
  Ingo von Borstel (planetmaker)  - Support
 
  Remko Bijker (Rubidium)         - Lead coder and way more
 
  Zdeněk Sojka (SmatZ)            - Bug finder and fixer
 
  José Soler (Terkhen)            - General coding
 
  Thijs Marinussen (Yexo)         - AI Framework
 
  Leif Linse (Zuu)                - AI/Game Script
 
  Albert Hofkamp (Alberth)        - GUI expert (since 0.7)
 
  Matthijs Kooijman (blathijs)    - Pathfinder-guru, Debian port (since 0.3)
 
  Ulf Hermann (fonsinchen)        - Cargo Distribution (since 1.3)
 
  Christoph Elsenhans (frosch)    - General coding (since 0.6)
 
  Loïc Guilloux (glx)             - Windows Expert (since 0.4.5)
 
  Michael Lutz (michi_cc)         - Path based signals (since 0.7)
 
  Owen Rudge (orudge)             - Forum host, OS/2 port (since 0.1)
 
  Peter Nelson (peter1138)        - Spiritual descendant from newGRF gods (since 0.4.5)
 
  Ingo von Borstel (planetmaker)  - General coding, Support (since 1.1)
 
  Remko Bijker (Rubidium)         - Lead coder and way more (since 0.4.5)
 
  José Soler (Terkhen)            - General coding (since 1.0)
 
  Leif Linse (Zuu)                - AI/Game Script (since 1.2)
 

	
 
Inactive Developers:
 
  Bjarni Corfitzen (Bjarni)       - MacOSX port, coder and vehicles
 
  Victor Fischer (Celestar)       - Programming everywhere you need him to
 
  Tamás Faragó (Darkvater)        - Ex-Lead coder
 
  Jaroslav Mazanec (KUDr)         - YAPG (Yet Another Pathfinder God) ;)
 
  Jonathan Coome (Maedhros)       - High priest of the NewGRF Temple
 
  Attila Bán (MiHaMiX)            - WebTranslator 1 and 2
 
  Christoph Mallon (Tron)         - Programmer, code correctness police
 
  Jean-François Claeys (Belugas)  - GUI, newindustries and more (0.4.5 - 1.0)
 
  Bjarni Corfitzen (Bjarni)       - MacOSX port, coder and vehicles (0.3 - 0.7)
 
  Victor Fischer (Celestar)       - Programming everywhere you need him to (0.3 - 0.6)
 
  Jaroslav Mazanec (KUDr)         - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)
 
  Jonathan Coome (Maedhros)       - High priest of the NewGRF Temple (0.5 - 0.6)
 
  Attila Bán (MiHaMiX)            - WebTranslator 1 and 2 (0.3 - 0.5)
 
  Zdeněk Sojka (SmatZ)            - Bug finder and fixer (0.6 - 1.3)
 
  Christoph Mallon (Tron)         - Programmer, code correctness police (0.3 - 0.5)
 
  Patric Stout (TrueBrain)        - NoProgrammer (0.3 - 1.2), sys op (active)
 
  Thijs Marinussen (Yexo)         - AI Framework, General (0.6 - 1.3)
 

	
 
Retired Developers:
 
  Ludvig Strigeus (ludde)         - OpenTTD author, main coder (0.1 - 0.3.3)
 
  Serge Paquet (vurlix)           - Assistant project manager, coder (0.1 - 0.3.3)
 
  Dominik Scherer (dominik81)     - Lead programmer, GUI expert (0.3.0 - 0.3.6)
 
  Benedikt Brüggemeier (skidd13)  - Bug fixer and code reworker
 
  Patric Stout (TrueBrain)        - NoProgrammer (0.3 - 1.2), sys op (active)
 
  Tamás Faragó (Darkvater)        - Ex-Lead coder (0.3 - 0.5)
 
  Dominik Scherer (dominik81)     - Lead programmer, GUI expert (0.3 - 0.3)
 
  Emil Djupfeld (egladil)         - MacOSX port (0.4 - 0.6)
 
  Simon Sasburg (HackyKid)        - Bug fixer (0.4 - 0.4.5)
 
  Ludvig Strigeus (ludde)         - Original author of OpenTTD, main coder (0.1 - 0.3)
 
  Cian Duffy (MYOB)               - BeOS port / manual writing (0.1 - 0.3)
 
  Petr Baudiš (pasky)             - Many patches, newgrf support, etc. (0.3 - 0.3)
 
  Benedikt Brüggemeier (skidd13)  - Bug fixer and code reworker (0.6 - 0.7)
 
  Serge Paquet (vurlix)           - 2nd contributor after ludde (0.1 - 0.3)
 

	
 
Thanks to:
 
  Josef Drexler                   - For his great work on TTDPatch.
 
  Marcin Grzegorczyk              - For his TTDPatch work and documentation of Transport Tycoon Deluxe internals and track foundations
 
  Petr Baudiš (pasky)             - Many patches, newgrf support, etc.
 
  Simon Sasburg (HackyKid)        - For the many bugfixes he has blessed us with
 
  Stefan Meißner (sign_de)        - For his work on the console
 
  Mike Ragsdale                   - OpenTTD installer
 
  Cian Duffy (MYOB)               - BeOS port / manual writing
 
  Christian Rosentreter (tokai)   - MorphOS / AmigaOS port
 
  Richard Kempton (RichK67)       - Additional airports, initial TGP implementation
 
  Alberto Demichelis              - Squirrel scripting language
 
  L. Peter Deutsch                - MD5 implementation
 
  Michael Blunck                  - For revolutionizing TTD with awesome graphics
 
  George                          - Canal graphics
 
  Andrew Parkhouse (andythenorth) - River graphics
 
  David Dallaston (Pikka)         - Tram tracks
 
  All Translators                 - For their support to make OpenTTD a truly international game
 
  Bug Reporters                   - Thanks for all bug reports
 
  Chris Sawyer                    - For an amazing game!
src/fontdetection.cpp
Show inline comments
 
@@ -375,49 +375,49 @@ bool SetFallbackFont(FreeTypeSettings *s
 

	
 
#include "os/macosx/macos.h"
 

	
 
#include "safeguards.h"
 

	
 
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
 
{
 
	FT_Error err = FT_Err_Cannot_Open_Resource;
 

	
 
	/* Get font reference from name. */
 
	CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name, kCFStringEncodingUTF8);
 
	ATSFontRef font = ATSFontFindFromName(name, kATSOptionFlagsDefault);
 
	CFRelease(name);
 
	if (font == kInvalidFont) return err;
 

	
 
	/* Get a file system reference for the font. */
 
	FSRef ref;
 
	OSStatus os_err = -1;
 
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
 
	if (MacOSVersionIsAtLeast(10, 5, 0)) {
 
		os_err = ATSFontGetFileReference(font, &ref);
 
	} else
 
#endif
 
	{
 
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !__LP64__
 
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(__LP64__)
 
		/* This type was introduced with the 10.5 SDK. */
 
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
 
	#define ATSFSSpec FSSpec
 
#endif
 
		FSSpec spec;
 
		os_err = ATSFontGetFileSpecification(font, (ATSFSSpec *)&spec);
 
		if (os_err == noErr) os_err = FSpMakeFSRef(&spec, &ref);
 
#endif
 
	}
 

	
 
	if (os_err == noErr) {
 
		/* Get unix path for file. */
 
		UInt8 file_path[PATH_MAX];
 
		if (FSRefMakePath(&ref, file_path, sizeof(file_path)) == noErr) {
 
			DEBUG(freetype, 3, "Font path for %s: %s", font_name, file_path);
 
			err = FT_New_Face(_library, (const char *)file_path, 0, face);
 
		}
 
	}
 

	
 
	return err;
 
}
 

	
 
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
 
{
src/misc_gui.cpp
Show inline comments
 
@@ -366,88 +366,89 @@ static const NWidgetPart _nested_about_w
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY), SetPIP(4, 2, 4),
 
		NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_ORIGINAL_COPYRIGHT, STR_NULL),
 
		NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_VERSION, STR_NULL),
 
		NWidget(WWT_FRAME, COLOUR_GREY), SetPadding(0, 5, 1, 5),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_A_SCROLLING_TEXT),
 
		EndContainer(),
 
		NWidget(WWT_LABEL, COLOUR_GREY, WID_A_WEBSITE), SetDataTip(STR_BLACK_RAW_STRING, STR_NULL),
 
		NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_COPYRIGHT_OPENTTD, STR_NULL),
 
	EndContainer(),
 
};
 

	
 
static WindowDesc _about_desc(
 
	WDP_CENTER, NULL, 0, 0,
 
	WC_GAME_OPTIONS, WC_NONE,
 
	0,
 
	_nested_about_widgets, lengthof(_nested_about_widgets)
 
);
 

	
 
static const char * const _credits[] = {
 
	"Original design by Chris Sawyer",
 
	"Original graphics by Simon Foster",
 
	"",
 
	"The OpenTTD team (in alphabetical order):",
 
	"  Albert Hofkamp (Alberth) - GUI expert",
 
	"  Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, newindustries and more",
 
	"  Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework",
 
	"  Christoph Elsenhans (frosch) - General coding",
 
	"  Ulf Hermann (fonsinchen) - Cargo Distribution",
 
	"  Lo\xC3\xAF""c Guilloux (glx) - Windows Expert",
 
	"  Michael Lutz (michi_cc) - Path based signals",
 
	"  Owen Rudge (orudge) - Forum host, OS/2 port",
 
	"  Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods",
 
	"  Ingo von Borstel (planetmaker) - Support",
 
	"  Remko Bijker (Rubidium) - Lead coder and way more",
 
	"  Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer",
 
	"  Jos\xC3\xA9 Soler (Terkhen) - General coding",
 
	"  Thijs Marinussen (Yexo) - AI Framework",
 
	"  Leif Linse (Zuu) - AI/Game Script",
 
	"  Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
 
	"  Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
 
	"  Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
 
	"  Christoph Elsenhans (frosch) - General coding (since 0.6)",
 
	"  Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
 
	"  Michael Lutz (michi_cc) - Path based signals (since 0.7)",
 
	"  Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
 
	"  Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
 
	"  Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
 
	"  Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
 
	"  Jos\xC3\xA9 Soler (Terkhen) - General coding (since 1.0)",
 
	"  Leif Linse (Zuu) - AI/Game Script (since 1.2)",
 
	"",
 
	"Inactive Developers:",
 
	"  Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles",
 
	"  Victor Fischer (Celestar) - Programming everywhere you need him to",
 
	"  Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder",
 
	"  Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)",
 
	"  Jonathan Coome (Maedhros) - High priest of the NewGRF Temple",
 
	"  Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2",
 
	"  Christoph Mallon (Tron) - Programmer, code correctness police",
 
	"  Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
 
	"  Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
 
	"  Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
 
	"  Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
 
	"  Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
 
	"  Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
 
	"  Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
 
	"  Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
 
	"  Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
 
	"  Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
 
	"",
 
	"Retired Developers:",
 
	"  Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)",
 
	"  Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)",
 
	"  Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)",
 
	"  Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker",
 
	"  Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)",
 
	"  Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
 
	"  Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
 
	"  Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
 
	"  Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
 
	"  Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
 
	"  Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
 
	"  Petr Baudi\xC5\xA1 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
 
	"  Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
 
	"  Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
 
	"",
 
	"Special thanks go out to:",
 
	"  Josef Drexler - For his great work on TTDPatch",
 
	"  Marcin Grzegorczyk - Track foundations and for describing TTD internals",
 
	"  Petr Baudi\xC5\xA1 (pasky) - Many patches, newGRF support",
 
	"  Simon Sasburg (HackyKid) - Many bugfixes he has blessed us with",
 
	"  Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
 
	"  Mike Ragsdale - OpenTTD installer",
 
	"  Cian Duffy (MYOB) - BeOS port / manual writing",
 
	"  Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
 
	"  Richard Kempton (richK) - additional airports, initial TGP implementation",
 
	"",
 
	"  Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
 
	"  L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
 
	"  Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
 
	"  George - Canal/Lock graphics \xC2\xA9 2003-2004",
 
	"  Andrew Parkhouse (andythenorth) - River graphics",
 
	"  David Dallaston (Pikka) - Tram tracks",
 
	"  All Translators - Who made OpenTTD a truly international game",
 
	"  Bug Reporters - Without whom OpenTTD would still be full of bugs!",
 
	"",
 
	"",
 
	"And last but not least:",
 
	"  Chris Sawyer - For an amazing game!"
 
};
 

	
 
struct AboutWindow : public Window {
 
	int text_position;                       ///< The top of the scrolling text
 
	byte counter;                            ///< Used to scroll the text every 5 ticks
 
	int line_height;                         ///< The height of a single line
 
	static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
 

	
 
	AboutWindow() : Window(&_about_desc)
src/os/macosx/crashlog_osx.cpp
Show inline comments
 
@@ -12,49 +12,49 @@
 
#include "../../stdafx.h"
 
#include "../../crashlog.h"
 
#include "../../string_func.h"
 
#include "../../gamelog.h"
 
#include "../../saveload/saveload.h"
 
#include "macos.h"
 

	
 
#include <errno.h>
 
#include <signal.h>
 
#include <mach-o/arch.h>
 
#include <dlfcn.h>
 
#include <cxxabi.h>
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
/* Macro testing a stack address for valid alignment. */
 
#if defined(__i386__)
 
#define IS_ALIGNED(addr) (((uintptr_t)(addr) & 0xf) == 8)
 
#else
 
#define IS_ALIGNED(addr) (((uintptr_t)(addr) & 0xf) == 0)
 
#endif
 

	
 
/* printf format specification for 32/64-bit addresses. */
 
#if __LP64__
 
#ifdef __LP64__
 
#define PRINTF_PTR "0x%016lx"
 
#else
 
#define PRINTF_PTR "0x%08lx"
 
#endif
 

	
 
#define MAX_STACK_FRAMES 64
 

	
 
/**
 
 * OSX implementation for the crash logger.
 
 */
 
class CrashLogOSX : public CrashLog {
 
	/** Signal that has been thrown. */
 
	int signum;
 

	
 
	char filename_log[MAX_PATH];        ///< Path of crash.log
 
	char filename_save[MAX_PATH];       ///< Path of crash.sav
 
	char filename_screenshot[MAX_PATH]; ///< Path of crash.(png|bmp|pcx)
 

	
 
	/* virtual */ char *LogOSVersion(char *buffer, const char *last) const
 
	{
 
		int ver_maj, ver_min, ver_bug;
 
		GetMacOSVersion(&ver_maj, &ver_min, &ver_bug);
 

	
 
		const NXArchInfo *arch = NXGetLocalArchInfo();
src/os/macosx/osx_stdafx.h
Show inline comments
 
@@ -25,100 +25,90 @@
 
#ifndef MAC_OS_X_VERSION_10_5
 
#define MAC_OS_X_VERSION_10_5 1050
 
#endif
 

	
 
#ifndef MAC_OS_X_VERSION_10_6
 
#define MAC_OS_X_VERSION_10_6 1060
 
#endif
 

	
 
#ifndef MAC_OS_X_VERSION_10_7
 
#define MAC_OS_X_VERSION_10_7 1070
 
#endif
 

	
 
#ifndef MAC_OS_X_VERSION_10_8
 
#define MAC_OS_X_VERSION_10_8 1080
 
#endif
 

	
 
#ifndef MAC_OS_X_VERSION_10_9
 
#define MAC_OS_X_VERSION_10_9 1090
 
#endif
 

	
 

	
 
#define __STDC_LIMIT_MACROS
 
#include <stdint.h>
 

	
 
/* We need to include this first as that "depends" on the compiler's setting
 
 * of __LP64__. So before we define __LP64__ so it can be used. */
 
#include <sys/cdefs.h>
 
#include <unistd.h>
 

	
 
/* Some gcc versions include assert.h via this header. As this would interfere
 
 * with our own assert redefinition, include this header first. */
 
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
 
#	include <debug/debug.h>
 
#endif
 

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

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

	
 
#include <AvailabilityMacros.h>
 

	
 
/* Name conflict */
 
#define Rect        OTTDRect
 
#define Point       OTTDPoint
 
#define WindowClass OTTDWindowClass
 
#define ScriptOrder OTTDScriptOrder
 
#define Palette     OTTDPalette
 
#define GlyphID     OTTDGlyphID
 

	
 
#include <CoreServices/CoreServices.h>
 
#include <ApplicationServices/ApplicationServices.h>
 

	
 
#undef Rect
 
#undef Point
 
#undef WindowClass
 
#undef ScriptOrder
 
#undef Palette
 
#undef GlyphID
 

	
 
/* 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__
 
#ifdef __LP64__
 
typedef long NSInteger;
 
typedef unsigned long NSUInteger;
 
#else
 
typedef int NSInteger;
 
typedef unsigned int NSUInteger;
 
#endif /* __LP64__ */
 
#endif /* NSInteger */
 

	
 
#ifndef CGFLOAT_DEFINED
 
#if __LP64__
 
#ifdef __LP64__
 
typedef double CGFloat;
 
#else
 
typedef float CGFloat;
 
#endif /* __LP64__ */
 
#endif /* CGFLOAT_DEFINED */
 

	
 
/* OS X SDK versions >= 10.5 have a non-const iconv. */
 
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
 
#	define HAVE_NON_CONST_ICONV
 
#endif
 

	
 
#endif /* MACOS_STDAFX_H */
src/video/cocoa/fullscreen.mm
Show inline comments
 
@@ -49,49 +49,49 @@ extern "C" void HideMenuBar();
 
/* Structure for rez switch gamma fades
 
 * We can hide the monitor flicker by setting the gamma tables to 0
 
 */
 
#define QZ_GAMMA_TABLE_SIZE 256
 

	
 
struct OTTD_QuartzGammaTable {
 
	CGGammaValue red[QZ_GAMMA_TABLE_SIZE];
 
	CGGammaValue green[QZ_GAMMA_TABLE_SIZE];
 
	CGGammaValue blue[QZ_GAMMA_TABLE_SIZE];
 
};
 

	
 
/* Add methods to get at private members of NSScreen.
 
 * Since there is a bug in Apple's screen switching code that does not update
 
 * this variable when switching to fullscreen, we'll set it manually (but only
 
 * for the main screen).
 
 */
 
@interface NSScreen (NSScreenAccess)
 
	- (void) setFrame:(NSRect)frame;
 
@end
 

	
 
@implementation NSScreen (NSScreenAccess)
 
- (void) setFrame:(NSRect)frame
 
{
 
/* The 64 bits libraries don't seem to know about _frame, so this hack won't work. */
 
#if !__LP64__
 
#ifndef __LP64__
 
	_frame = frame;
 
#endif
 
}
 
@end
 

	
 
class FullscreenSubdriver : public CocoaSubdriver {
 
	CGDirectDisplayID  display_id;         ///< 0 == main display (only support single display)
 
	CFDictionaryRef    cur_mode;           ///< current mode of the display
 
	CFDictionaryRef    save_mode;          ///< original mode of the display
 
	CGDirectPaletteRef palette;            ///< palette of an 8-bit display
 

	
 

	
 
	/* Gamma functions to try to hide the flash from a res switch
 
	 * Fade the display from normal to black
 
	 * Save gamma tables for fade back to normal
 
	 */
 
	uint32 FadeGammaOut(OTTD_QuartzGammaTable *table)
 
	{
 
		CGGammaValue redTable[QZ_GAMMA_TABLE_SIZE];
 
		CGGammaValue greenTable[QZ_GAMMA_TABLE_SIZE];
 
		CGGammaValue blueTable[QZ_GAMMA_TABLE_SIZE];
 

	
 
		unsigned int actual;
 
		if (CGGetDisplayTransferByTable(this->display_id, QZ_GAMMA_TABLE_SIZE, table->red, table->green, table->blue, &actual) != CGDisplayNoErr
0 comments (0 inline, 0 general)