summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/macosx/G5_detector.c29
-rw-r--r--os/macosx/Makefile146
-rw-r--r--os/macosx/Makefile.setup131
-rw-r--r--os/macosx/macos.h30
-rw-r--r--os/macosx/macos.m162
-rw-r--r--os/macosx/osx_stdafx.h19
-rw-r--r--os/macosx/splash.c144
-rw-r--r--os/macosx/splash.h10
8 files changed, 0 insertions, 671 deletions
diff --git a/os/macosx/G5_detector.c b/os/macosx/G5_detector.c
deleted file mode 100644
index b4831c772..000000000
--- a/os/macosx/G5_detector.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $Id$ */
-
-#include <mach/mach.h>
-#include <mach/mach_host.h>
-#include <mach/host_info.h>
-#include <mach/machine.h>
-#include <stdio.h>
-
-
-#ifndef CPU_SUBTYPE_POWERPC_970
-#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
-#endif
-
-// this function is a lightly modified version of some code from Apple's developer homepage to detect G5 CPUs at runtime
-main()
-{
- host_basic_info_data_t hostInfo;
- mach_msg_type_number_t infoCount;
- boolean_t is_G5;
-
- infoCount = HOST_BASIC_INFO_COUNT;
- host_info(mach_host_self(), HOST_BASIC_INFO,
- (host_info_t)&hostInfo, &infoCount);
-
- is_G5 = ((hostInfo.cpu_type == CPU_TYPE_POWERPC) &&
- (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970));
- if (is_G5)
- printf("1");
-}
diff --git a/os/macosx/Makefile b/os/macosx/Makefile
deleted file mode 100644
index d8afef98c..000000000
--- a/os/macosx/Makefile
+++ /dev/null
@@ -1,146 +0,0 @@
-# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $
-# This makefile is not a standalone makefile, but is called from the general one
-# it contains targets specific to MacOS X
-
-ifdef MACOSX_BUILD
-
-DEPS_MAGIC := $(shell mkdir -p $(sort $(dir $(OBJS:%.o=.OSX/%))))
-
-ifdef OTTD_PPC
-OTTD_PPC :=.OSX/openttd.ppc
-OBJS_ppc := $(OBJS:%.o=.OSX/%.o.ppc)
-ifndef CC_PPC
-CC_PPC := $(CC) -arch ppc
-endif
-ifndef CXX_PPC
-CXX_PPC := $(CXX) -arch ppc
-endif
-endif
-
-ifdef OTTD_i386
-OTTD_i386 :=.OSX/openttd.i386
-OBJS_i386 := $(OBJS:%.o=.OSX/%.o.i386)
-ifndef CC_I386
-CC_I386 := $(CC) -arch i386
-endif
-ifndef CXX_I386
-CXX_I386 := $(CXX) -arch i386
-endif
-endif
-
-ifdef OTTD_PPC970
-OTTD_PPC970 :=.OSX/openttd.ppc970
-OBJS_ppc970 := $(OBJS:%.o=.OSX/%.o.ppc970)
-ifndef CC_PPC970
-CC_PPC970 := $(CC) -arch ppc970
-endif
-ifndef CXX_PPC970
-CXX_PPC970 := $(CXX) -arch ppc970
-endif
-endif
-
-ifndef LIPO
-LIPO := lipo
-endif
-ifndef STRIP
-STRIP := strip
-endif
-
-# targets to link OpenTTD
-$(TTD): $(OTTD_PPC) $(OTTD_i386) $(OTTD_PPC970)
- @echo '===> Linking $@ into a single file'
- $(Q)$(LIPO) -create -output $@ $(OTTD_PPC) $(OTTD_i386) $(OTTD_PPC970)
-
-$(OTTD_PPC): $(MAKE_CONFIG) $(OBJS_ppc)
- @echo '[PowerPC] Linking $(TTD)'
- $(Q)$(CXX_PPC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_ppc) $(LIBS) $(LDFLAGS_PPC) -o $@
-
-$(OTTD_i386): $(MAKE_CONFIG) $(OBJS_i386)
- @echo '[i386] Linking $(TTD)'
- $(Q)$(CXX_I386) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_i386) $(LIBS) $(LDFLAGS_i386) -o $@
-
-$(OTTD_PPC970): $(MAKE_CONFIG) $(OBJS_ppc970)
- @echo '[PowerPC G5] Linking $(TTD)'
- $(Q)$(CXX_PPC970) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS_ppc970) $(LIBS) $(LDFLAGS_PPC) $(G5_FLAGS) -o $@
-
-# targets to compile each c, m and cpp file
-.OSX/%.o.ppc: %.c .deps/%.d
- @echo '[PowerPC] Compiling $<'
- $(Q)$(CC_PPC) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.ppc: %.cpp .deps/%.d
- @echo '[PowerPC] Compiling $<'
- $(Q)$(CXX_PPC) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.ppc: %.m .deps/%.d
- @echo '[PowerPC] Compiling $<'
- $(Q)$(CC_PPC) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.i386: %.c .deps/%.d
- @echo '[i386] Compiling $<'
- $(Q)$(CC_I386) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.i386: %.cpp .deps/%.d
- @echo '[i386] Compiling $<'
- $(Q)$(CXX_I386) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.i386: %.m .deps/%.d
- @echo '[i386] Compiling $<'
- $(Q)$(CC_I386) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_i386) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.ppc970: %.c .deps/%.d
- @echo '[PowerPC G5] Compiling $<'
- $(Q)$(CC_PPC970) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.ppc970: %.cpp .deps/%.d
- @echo '[PowerPC G5] Compiling $<'
- $(Q)$(CXX_PPC970) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $<
-
-.OSX/%.o.ppc970: %.m .deps/%.d
- @echo '[PowerPC G5] Compiling $<'
- $(Q)$(CC_PPC970) $(CC_CFLAGS) $(CFLAGS) $(CFLAGS_PPC) $(G5_FLAGS) $(CDEFS) -c -o $@ $<
-
-endif
-
-# manual strip, as the -s option fails
-$(OSX_STRIP): $(TTD)
- $(Q)$(STRIP) openttd
-
-
-# build the bundle. OSX wants to keep apps in bundles, so we will give it one
-# the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it
-
-BUILD_OSX_BUNDLE: $(TTD) $(OSX_STRIP)
- @echo '===> Building application bundle'
- $(Q)rm -fr "$(OSXAPP)"
- $(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
- $(Q)mkdir -p "$(OSXAPP)"/Contents/Resources
- $(Q)mkdir -p "$(OSXAPP)"/Contents/Data
- $(Q)mkdir -p "$(OSXAPP)"/Contents/Lang
- $(Q)echo "APPL????" > "$(OSXAPP)"/Contents/PkgInfo
- $(Q)cp os/macosx/openttd.icns "$(OSXAPP)"/Contents/Resources/openttd.icns
- $(Q)os/macosx/plistgen.sh "$(OSXAPP)" "$(REV)"
- $(Q)cp -R data/* "$(OSXAPP)"/Contents/Data/
- $(Q)cp os/macosx/splash.png "$(OSXAPP)"/Contents/Data/
- $(Q)cp lang/*.lng "$(OSXAPP)"/Contents/Lang/
- $(Q)cp $(TTD) "$(OSXAPP)"/Contents/MacOS/$(TTD)
-
-# make the release disk image. Should only be used with releases and is a good and fast way to make sure to remember all the needed files
-release: all
- @echo '===> Building release disk image'
- $(Q)mkdir -p "OpenTTD $(REV)"
- $(Q)mkdir -p "OpenTTD $(REV)/docs"
- $(Q)mkdir -p "OpenTTD $(REV)/scenario"
- $(Q)cp -R $(OSXAPP) "OpenTTD $(REV)/"
- $(Q)cp docs/OSX_install_instructions.txt "OpenTTD $(REV)/How to install (please read).txt"
- $(Q)cp readme.txt "OpenTTD $(REV)/docs/"
- $(Q)cp COPYING "OpenTTD $(REV)/docs/"
- $(Q)cp changelog.txt "OpenTTD $(REV)/docs/"
- $(Q)cp known-bugs.txt "OpenTTD $(REV)/known-bugs.txt"
- $(Q)cp -R scenario/* "OpenTTD $(REV)/scenario/"
- $(Q)hdiutil create -ov -format UDZO -srcfolder "OpenTTD $(REV)" openttd-"$(REV)"-osx.dmg
- $(Q)rm -fr "OpenTTD $(REV)"
-
-$(OSX): $(TTD) $(OSX_STRIP) BUILD_OSX_BUNDLE
-
-.PHONY: release BUILD_OSX_BUNDLE
diff --git a/os/macosx/Makefile.setup b/os/macosx/Makefile.setup
deleted file mode 100644
index 38565ced3..000000000
--- a/os/macosx/Makefile.setup
+++ /dev/null
@@ -1,131 +0,0 @@
-# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $
-# This makefile is not a standalone makefile, but is called from the general one
-# it contains code specific to MacOS X
-
-ifdef RELEASE
-ifndef STATIC
-# all OSX releases needs to be static
-# end users don't tend to have the dynamic libs installed
-$(warning Compiling a dynamic release. It should be static unless you really know what you are doing!!!)
-endif
-endif
-
-ifdef RELEASE
-ifndef UNIVERSAL_BINARY
-$(warning Compiling a release build, that is not a universal binary)
-endif
-endif
-
-ifdef TRIPLE_BINARY
-ifdef DEBUG
-$(error no G5 optimisation is made in debug builds, so triple binaries aren't possible. Use UNIVERSAL_BINARY instead if you really want a universal debug build)
-endif
-UNIVERSAL_BINARY:=1
-endif
-
-ifdef UNIVERSAL_BINARY
-ifndef STATIC
-$(warning Compiling a universal binary, that is not static. Adding static flag)
-STATIC:=1
-endif
-endif
-
-ifdef RELEASE
-ifdef DEBUG
-$(warning Compiling a release build, that is a debug build)
-endif
-endif
-
-ifeq ($(shell uname), Darwin)
- # it's a hardware mac, not crosscompiling
- ifeq ($(shell uname -r), 6.8)
- # OSX 10.2.8 uses Darwin 6.8, so we better set JAGUAR so we avoid the stuff that was added in 10.3 or later
-$(error OpenTTD can not run or compile on MacOS X 10.2. 10.3.9 or newer is needed)
- endif
- NATIVE_OSX:=1
-endif
-
-ifndef PPC_OSX_TARGET
-PPC_OSX_TARGET:=10.3.9
-endif
-ifndef i386_OSX_TARGET
-i386_OSX_TARGET:=10.4u
-endif
-
-# 4-byte bools to make YAPF happy
-CFLAGS_PPC += -DFOUR_BYTE_BOOL
-
-ifndef G5_FLAGS
-G5_FLAGS := -mtune=970 -mcpu=970 -mpowerpc-gpopt
-endif
-
-ifdef UNIVERSAL_BINARY
- OTTD_PPC:=1
- OTTD_i386:=1
- ifdef TRIPLE_BINARY
- OTTD_PPC970:=1
- endif
-endif
-
-# if any targets have been defined by now, we are crosscompiling and we will set up paths accordingly
-ifdef OTTD_PPC
- ifndef OSX_NO_SYSROOT
- CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk
- LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk
- endif
-endif
-
-ifdef OTTD_i386
- ifndef OSX_NO_SYSROOT
- CFLAGS_i386 += -isysroot /Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk
- LDFLAGS_i386 += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk
- endif
-endif
-
-ifdef OTTD_PPC970
- ifndef OTTD_PPC
- CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk
- LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk
- endif
-endif
-
-# setting up flags to make a binary, that fits the system it builds on
-ifdef NATIVE_OSX
- ifndef UNIVERSAL_BINARY
- # we are not crosscompiling for other macs
- # the next line fails if it got whitespace in front of it
-$(shell $(CC) os/macosx/G5_detector.c -o os/macosx/G5_detector)
- IS_G5:=$(shell os/macosx/G5_detector)
- endif
-endif
-
-ifdef NATIVE_OSX
- ifndef OTTD_PPC
- ifndef OTTD_i386
- ifndef OTTD_PPC970
- # no flags have been set for target versions of OSX, so we will set it to compile for the current host
- ifeq ($(shell uname -p), powerpc)
- ifdef IS_G5
- OTTD_PPC970:=1
- else
- OTTD_PPC:=1
- endif
- else
- # we are not using a PowerPC CPU, so we assume that it's an Intel mac
- OTTD_i386:=1
- endif
- endif
- endif
- endif
-endif
-
-ifdef OTTD_PPC
-MACOSX_BUILD:=1
-endif
-ifdef OTTD_i386
-MACOSX_BUILD:=1
-endif
-ifdef OTTD_PPC970
-MACOSX_BUILD:=1
-endif
-
diff --git a/os/macosx/macos.h b/os/macosx/macos.h
deleted file mode 100644
index b8a6cd511..000000000
--- a/os/macosx/macos.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$ */
-
-#ifndef MACOS_H
-#define MACOS_H
-
-/*
- * Functions to show the popup window
- * use ShowMacDialog when you want to control title, message and text on the button
- * ShowMacAssertDialog is used by assert
- * ShowMacErrorDialog should be used when an unrecoverable error shows up. It only contains the title, which will should tell what went wrong
- * the function then adds text that tells the user to update and then report the bug if it's present in the newest version
- * It also quits in a nice way since we call it when we know something happened that will crash OpenTTD (like a needed pointer turns out to be NULL or similar)
- */
-void ShowMacDialog ( const char *title, const char *message, const char *buttonLabel );
-void ShowMacAssertDialog ( const char *function, const char *file, const int line, const char *expression );
-void ShowMacErrorDialog(const char *error);
-
-// Since MacOS X users will never see an assert unless they started the game from a terminal
-// we're using a custom assert(e) macro.
-#undef assert
-
-#ifdef NDEBUG
-#define assert(e) ((void)0)
-#else
-
-#define assert(e) \
- (__builtin_expect(!(e), 0) ? ShowMacAssertDialog ( __func__, __FILE__, __LINE__, #e ): (void)0 )
-#endif
-
-#endif /* MACOS_H */
diff --git a/os/macosx/macos.m b/os/macosx/macos.m
deleted file mode 100644
index 59801fce0..000000000
--- a/os/macosx/macos.m
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $Id$ */
-
-#include <AppKit/AppKit.h>
-
-#include <mach/mach.h>
-#include <mach/mach_host.h>
-#include <mach/host_info.h>
-#include <mach/machine.h>
-#include <stdio.h>
-#include "../../stdafx.h"
-#include "../../openttd.h"
-#include "../../newgrf.h"
-#include "../../gfx.h"
-#include "../../macros.h"
-#include "../../string.h"
-
-#ifndef CPU_SUBTYPE_POWERPC_970
-#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
-#endif
-
-/*
- * This file contains objective C
- * Apple uses objective C instead of plain C to interact with OS specific/native functions
- *
- * Note: TrueLight's crosscompiler can handle this, but it likely needs a manual modification for each change in this file.
- * To insure that the crosscompiler still works, let him try any changes before they are committed
- */
-
-static char *GetOSString(void)
-{
- static char buffer[175];
- const char* CPU;
- char OS[20];
- char newgrf[125];
- long sysVersion;
- extern const char _openttd_revision[];
-
- // get the hardware info
- host_basic_info_data_t hostInfo;
- mach_msg_type_number_t infoCount;
-
- infoCount = HOST_BASIC_INFO_COUNT;
- host_info(
- mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount
- );
-
- // replace the hardware info with strings, that tells a bit more than just an int
- switch (hostInfo.cpu_subtype) {
-#ifdef __POWERPC__
- case CPU_SUBTYPE_POWERPC_750: CPU = "G3"; break;
- case CPU_SUBTYPE_POWERPC_7400:
- case CPU_SUBTYPE_POWERPC_7450: CPU = "G4"; break;
- case CPU_SUBTYPE_POWERPC_970: CPU = "G5"; break;
- default: CPU = "Unknown PPC"; break;
-#else
- /* it looks odd to have a switch for two cases, but it leaves room for easy
- * expansion. Odds are that Apple will some day use newer CPUs than i686
- */
- case CPU_SUBTYPE_PENTPRO: CPU = "i686"; break;
- default: CPU = "Unknown Intel"; break;
-#endif
- }
-
- // get the version of OSX
- if (Gestalt(gestaltSystemVersion, &sysVersion) != noErr) {
- sprintf(OS, "Undetected");
- } else {
- int majorHiNib = GB(sysVersion, 12, 4);
- int majorLoNib = GB(sysVersion, 8, 4);
- int minorNib = GB(sysVersion, 4, 4);
- int bugNib = GB(sysVersion, 0, 4);
-
- sprintf(OS, "%d%d.%d.%d", majorHiNib, majorLoNib, minorNib, bugNib);
- }
-
- // make a list of used newgrf files
- if (_first_grffile != NULL) {
- char* n = newgrf;
- const GRFFile* file;
-
- for (file = _first_grffile; file != NULL; file = file->next) {
- n = strecpy(n, " ", lastof(newgrf));
- n = strecpy(n, file->filename, lastof(newgrf));
- }
- } else {
- sprintf(newgrf, "none");
- }
-
- snprintf(
- buffer, lengthof(buffer),
- "Please add this info: (tip: copy-paste works)\n"
- "CPU: %s, OSX: %s, OpenTTD version: %s\n"
- "NewGRF files:%s",
- CPU, OS, _openttd_revision, newgrf
- );
- return buffer;
-}
-
-
-#ifdef WITH_SDL
-
-void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
-{
- NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil);
-}
-
-#elif defined WITH_COCOA
-
-void CocoaDialog(const char* title, const char* message, const char* buttonLabel);
-
-void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
-{
- CocoaDialog(title, message, buttonLabel);
-}
-
-
-#else
-
-void ShowMacDialog(const char* title, const char* message, const char* buttonLabel)
-{
- fprintf(stderr, "%s: %s\n", title, message);
-}
-
-#endif
-
-void ShowMacAssertDialog(const char* function, const char* file, const int line, const char* expression)
-{
- const char* buffer =
- [[NSString stringWithFormat:@
- "An assertion has failed and OpenTTD must quit.\n"
- "%s in %s (line %d)\n"
- "\"%s\"\n"
- "\n"
- "You should report this error the OpenTTD developers if you think you found a bug.\n"
- "\n"
- "%s",
- function, file, line, expression, GetOSString()] cString
- ];
- NSLog(@"%s", buffer);
- ToggleFullScreen(0);
- ShowMacDialog("Assertion Failed", buffer, "Quit");
-
- // abort so that a debugger has a chance to notice
- abort();
-}
-
-
-void ShowMacErrorDialog(const char *error)
-{
- const char* buffer =
- [[NSString stringWithFormat:@
- "Please update to the newest version of OpenTTD\n"
- "If the problem presists, please report this to\n"
- "http://bugs.openttd.org\n"
- "\n"
- "%s",
- GetOSString()] cString
- ];
- ToggleFullScreen(0);
- ShowMacDialog(error, buffer, "Quit");
- abort();
-}
diff --git a/os/macosx/osx_stdafx.h b/os/macosx/osx_stdafx.h
deleted file mode 100644
index 9567d70ba..000000000
--- a/os/macosx/osx_stdafx.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $Id$ */
-
-#ifndef MACOS_STDAFX_H
-#define MACOS_STDAFX_H
-
-#include <CoreServices/CoreServices.h>
-// remove the variables that CoreServices defines, but we define ourselves too
-#undef bool
-#undef false
-#undef true
-
-/* Name conflict */
-#define Rect OTTDRect
-#define Point OTTDPoint
-#define GetTime OTTDGetTime
-
-#define SL_ERROR OSX_SL_ERROR
-
-#endif /* MACOS_STDAFX_H */
diff --git a/os/macosx/splash.c b/os/macosx/splash.c
deleted file mode 100644
index 46a19b1a6..000000000
--- a/os/macosx/splash.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $Id$ */
-
-#include "../../stdafx.h"
-#include "../../openttd.h"
-#include "../../variables.h"
-#include "../../macros.h"
-#include "../../debug.h"
-#include "../../functions.h"
-#include "../../gfx.h"
-#include "../../fileio.h"
-
-#include "splash.h"
-
-#ifdef WITH_PNG
-
-#include <png.h>
-
-static void PNGAPI png_my_error(png_structp png_ptr, png_const_charp message)
-{
- DEBUG(misc, 0, "[libpng] error: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
- longjmp(png_ptr->jmpbuf, 1);
-}
-
-static void PNGAPI png_my_warning(png_structp png_ptr, png_const_charp message)
-{
- DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
-}
-
-void DisplaySplashImage(void)
-{
- png_byte header[8];
- FILE *f;
- png_structp png_ptr;
- png_infop info_ptr, end_info;
- uint width, height, bit_depth, color_type;
- png_colorp palette;
- int num_palette;
- png_bytep *row_pointers;
- uint8 *src, *dst;
- uint y;
- uint xoff, yoff;
- int i;
-
- f = FioFOpenFile(SPLASH_IMAGE_FILE);
- if (f == NULL) return;
-
- fread(header, 1, 8, f);
- if (png_sig_cmp(header, 0, 8) != 0) {
- fclose(f);
- return;
- }
-
- png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, (png_voidp) NULL, png_my_error, png_my_warning);
-
- if (png_ptr == NULL) {
- fclose(f);
- return;
- }
-
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL) {
- png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
- fclose(f);
- return;
- }
-
- end_info = png_create_info_struct(png_ptr);
- if (end_info == NULL) {
- png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
- fclose(f);
- return;
- }
-
- if (setjmp(png_jmpbuf(png_ptr))) {
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- fclose(f);
- return;
- }
-
- png_init_io(png_ptr, f);
- png_set_sig_bytes(png_ptr, 8);
-
- png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
-
- width = png_get_image_width(png_ptr, info_ptr);
- height = png_get_image_height(png_ptr, info_ptr);
- bit_depth = png_get_bit_depth(png_ptr, info_ptr);
- color_type = png_get_color_type(png_ptr, info_ptr);
-
- if (color_type != PNG_COLOR_TYPE_PALETTE || bit_depth != 8) {
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- fclose(f);
- return;
- }
-
- if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) {
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- fclose(f);
- return;
- }
-
- png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
-
- row_pointers = png_get_rows(png_ptr, info_ptr);
-
- memset(_screen.dst_ptr, 0xff, _screen.pitch * _screen.height);
-
- if (width > (uint) _screen.width) width = _screen.width;
- if (height > (uint) _screen.height) height = _screen.height;
-
- xoff = (_screen.width - width) / 2;
- yoff = (_screen.height - height) / 2;
- for (y = 0; y < height; y++) {
- src = row_pointers[y];
- dst = ((uint8 *) _screen.dst_ptr) + (yoff + y) * _screen.pitch + xoff;
-
- memcpy(dst, src, width);
- }
-
- for (i = 0; i < num_palette; i++) {
- _cur_palette[i].r = palette[i].red;
- _cur_palette[i].g = palette[i].green;
- _cur_palette[i].b = palette[i].blue;
- }
-
- _cur_palette[0xff].r = 0;
- _cur_palette[0xff].g = 0;
- _cur_palette[0xff].b = 0;
-
- _pal_first_dirty = 0;
- _pal_last_dirty = 0xff;
-
- png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
- fclose(f);
- return;
-}
-
-
-
-#else /* WITH_PNG */
-
-void DisplaySplashImage(void) {}
-
-#endif /* WITH_PNG */
diff --git a/os/macosx/splash.h b/os/macosx/splash.h
deleted file mode 100644
index 39880562d..000000000
--- a/os/macosx/splash.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $Id$ */
-
-#ifndef SPLASH_H
-#define SPLASH_H
-
-#define SPLASH_IMAGE_FILE "splash.png"
-
-void DisplaySplashImage(void);
-
-#endif