move platform code around, based off a gci task by dag10
authorkoda
Mon, 14 Jan 2013 12:35:01 +0100
changeset 8381 588a8e6e2041
parent 8380 0b375a3ceaa0
child 8382 67e257b98422
move platform code around, based off a gci task by dag10
QTfrontend/AutoUpdater.cpp
QTfrontend/AutoUpdater.h
QTfrontend/CMakeLists.txt
QTfrontend/CocoaInitializer.h
QTfrontend/CocoaInitializer.mm
QTfrontend/InstallController.cpp
QTfrontend/InstallController.h
QTfrontend/M3InstallController.h
QTfrontend/M3InstallController.m
QTfrontend/M3Panel.h
QTfrontend/M3Panel.mm
QTfrontend/NSWorkspace_RBAdditions.h
QTfrontend/NSWorkspace_RBAdditions.m
QTfrontend/SparkleAutoUpdater.h
QTfrontend/SparkleAutoUpdater.mm
QTfrontend/util/platform/AutoUpdater.cpp
QTfrontend/util/platform/AutoUpdater.h
QTfrontend/util/platform/CocoaInitializer.h
QTfrontend/util/platform/CocoaInitializer.mm
QTfrontend/util/platform/InstallController.cpp
QTfrontend/util/platform/InstallController.h
QTfrontend/util/platform/M3InstallController.h
QTfrontend/util/platform/M3InstallController.m
QTfrontend/util/platform/M3Panel.h
QTfrontend/util/platform/M3Panel.mm
QTfrontend/util/platform/NSWorkspace_RBAdditions.h
QTfrontend/util/platform/NSWorkspace_RBAdditions.m
QTfrontend/util/platform/SparkleAutoUpdater.h
QTfrontend/util/platform/SparkleAutoUpdater.mm
QTfrontend/util/platform/Xfire Game SDK.url
QTfrontend/util/platform/xfire.cpp
QTfrontend/util/platform/xfire.h
QTfrontend/util/platform/xfire_license.txt
QTfrontend/util/platform/xfiregameclient.cpp
QTfrontend/util/platform/xfiregameclient.h
QTfrontend/xfire.cpp
QTfrontend/xfire.h
misc/xfire/Xfire Game SDK.url
misc/xfire/license.txt
misc/xfire/xfiregameclient.cpp
misc/xfire/xfiregameclient.h
project_files/hedgewars.pro
--- a/QTfrontend/AutoUpdater.cpp	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2008 Remko Troncon
- */
-
-#include "AutoUpdater.h"
-
-AutoUpdater::~AutoUpdater()
-{
-}
--- a/QTfrontend/AutoUpdater.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2008 Remko Troncon
- */
-
-#ifndef AUTOUPDATER_H
-#define AUTOUPDATER_H
-
-class AutoUpdater
-{
-    public:
-        virtual ~AutoUpdater();
-
-        virtual void checkForUpdates() = 0;
-        virtual void checkForUpdatesNow() = 0;
-};
-
-#endif
--- a/QTfrontend/CMakeLists.txt	Mon Jan 14 12:07:51 2013 +0100
+++ b/QTfrontend/CMakeLists.txt	Mon Jan 14 12:35:01 2013 +0100
@@ -31,6 +31,7 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util/platform)
 include_directories(${SDL_INCLUDE_DIR})
 include_directories(${SDLMIXER_INCLUDE_DIR})
 include_directories(${FFMPEG_INCLUDE_DIR})
@@ -83,7 +84,7 @@
 
 #xfire integration
 if(WIN32)
-    list(APPEND hwfr_src xfire.cpp ../misc/xfire/xfiregameclient.cpp)
+    list(APPEND hwfr_src util/platform/xfire.cpp util/platform/xfiregameclient.cpp)
 endif(WIN32)
 
 if(MINGW)
@@ -144,17 +145,18 @@
 if(APPLE)
     find_library(iokit_framework NAMES IOKit)
     list(APPEND HW_LINK_LIBS ${iokit_framework})
-    list(APPEND hwfr_src CocoaInitializer.mm
-                             InstallController.cpp
-                             M3Panel.mm
-                             M3InstallController.m
-                             NSWorkspace_RBAdditions.m
-                             )
+    list(APPEND hwfr_src util/platform/CocoaInitializer.mm
+                         util/platform/InstallController.cpp
+                         util/platform/M3Panel.mm
+                         util/platform/M3InstallController.m
+                         util/platform/NSWorkspace_RBAdditions.m
+                         )
     if(NOT NOAUTOUPDATE)
         find_package(Sparkle)
         if(SPARKLE_FOUND)
             add_definitions(-DSPARKLE_ENABLED)
-            list(APPEND hwfr_src AutoUpdater.cpp SparkleAutoUpdater.mm)
+            list(APPEND hwfr_src util/platform/AutoUpdater.cpp
+                                 util/platform/SparkleAutoUpdater.mm)
             list(APPEND HW_LINK_LIBS ${SPARKLE_LIBRARY})
         endif()
     endif()
--- a/QTfrontend/CocoaInitializer.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
-
-#ifndef COCOAINITIALIZER_H
-#define COCOAINITIALIZER_H
-
-class CocoaInitializer
-{
-    public:
-        CocoaInitializer();
-        ~CocoaInitializer();
-
-    private:
-        class Private;
-        Private* c;
-};
-
-#endif
--- a/QTfrontend/CocoaInitializer.mm	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
-
-#include "CocoaInitializer.h"
-
-#include <AppKit/AppKit.h>
-#include <Cocoa/Cocoa.h>
-#include <QtDebug>
-
-class CocoaInitializer::Private
-{
-    public:
-        NSAutoreleasePool* pool;
-};
-
-CocoaInitializer::CocoaInitializer()
-{
-    c = new CocoaInitializer::Private();
-    c->pool = [[NSAutoreleasePool alloc] init];
-    NSApplicationLoad();
-}
-
-CocoaInitializer::~CocoaInitializer()
-{
-    [c->pool release];
-    delete c;
-}
--- a/QTfrontend/InstallController.cpp	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "InstallController.h"
-
-InstallController::~InstallController()
-{
-}
--- a/QTfrontend/InstallController.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef INSTALLCONTROLLER_H
-#define INSTALLCONTROLLER_H
-
-class InstallController
-{
-    public:
-        virtual ~InstallController();
-
-        virtual void showInstallController() = 0;
-};
-
-#endif
--- a/QTfrontend/M3InstallController.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*****************************************************************
- M3InstallController.m
-
- Created by Martin Pilkington on 02/06/2007.
-
- Copyright (c) 2006-2009 M Cubed Software
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the "Software"), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- *****************************************************************/
-
-#import <Cocoa/Cocoa.h>
-#import <AvailabilityMacros.h>
-
-//#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
-#if __LP64__ || NS_BUILD_32_LIKE_64
-typedef long NSInteger;
-typedef unsigned long NSUInteger;
-#else
-typedef int NSInteger;
-typedef unsigned int NSUInteger;
-#endif
-//#endif
-
-
-@interface M3InstallController :
-NSObject
-{
-    NSAlert *alert;
-}
-
-- (void)displayInstaller;
-- (void)installApp;
-@end
--- a/QTfrontend/M3InstallController.m	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*****************************************************************
- M3InstallController.m
-
- Created by Martin Pilkington on 02/06/2007.
-
- Copyright (c) 2006-2009 M Cubed Software
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the "Software"), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- *****************************************************************/
-
-#import "M3InstallController.h"
-#import "NSWorkspace_RBAdditions.h"
-
-#import <Foundation/Foundation.h>
-
-@implementation M3InstallController
-
-- (id) init {
-        if ((self = [super init])) {
-		NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
-		NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ is currently running from a disk image", @"AppName is currently running from a disk image"), appName];
-		NSString *body = [NSString stringWithFormat:NSLocalizedString(@"Would you like to install %@ in your applications folder before quitting?", @"Would you like to install App Name in your applications folder before quitting?"), appName];
-		alert = [[NSAlert alertWithMessageText:title
-								 defaultButton:NSLocalizedString(@"Install", @"Install")
-							   alternateButton:NSLocalizedString(@"Don't Install", @"Don't Install")
-								   otherButton:nil
-					 informativeTextWithFormat:body] retain];
-		//[alert setShowsSuppressionButton:YES];
-	}
-	return self;
-}
-
-- (void)displayInstaller {
-	NSString *imageFilePath = [[[NSWorkspace sharedWorkspace] propertiesForPath:[[NSBundle mainBundle] bundlePath]] objectForKey:NSWorkspace_RBimagefilepath];
-	if (imageFilePath && ![imageFilePath isEqualToString:[NSString stringWithFormat:@"/Users/.%@/%@.sparseimage", NSUserName(), NSUserName()]] && ![[NSUserDefaults standardUserDefaults] boolForKey:@"M3DontAskInstallAgain"]) {
-		NSInteger returnValue = [alert runModal];
-		if (returnValue == NSAlertDefaultReturn) {
-			[self installApp];
-		}
-		if ([[alert suppressionButton] state] == NSOnState) {
-			[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"M3DontAskInstallAgain"];
-		}
-	}
-}
-
-- (void)installApp {
-	NSString *appsPath = [[NSString stringWithString:@"/Applications"] stringByAppendingPathComponent:[[[NSBundle mainBundle] bundlePath] lastPathComponent]];
-	NSString *userAppsPath = [[[NSString stringWithString:@"~/Applications"] stringByAppendingPathComponent:[[[NSBundle mainBundle] bundlePath] lastPathComponent]] stringByExpandingTildeInPath];
-	NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
-
-	//Delete the app that is installed
-	if ([[NSFileManager defaultManager] fileExistsAtPath:appsPath]) {
-		[[NSFileManager defaultManager] removeFileAtPath:appsPath handler:nil];
-	}
-	//Delete the app that is installed
-	if ([[NSFileManager defaultManager] copyPath:[[NSBundle mainBundle] bundlePath] toPath:appsPath
-										  handler:nil]) {
-		NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"%@ installed successfully", @"App Name installed successfully"), appName],
-						[NSString stringWithFormat:NSLocalizedString(@"%@ was installed in /Applications", @"App Name was installed in /Applications"), appName],
-						NSLocalizedString(@"Quit", @"Quit"), nil, nil);
-	} else {
-		if ([[NSFileManager defaultManager] fileExistsAtPath:userAppsPath]) {
-			[[NSFileManager defaultManager] removeFileAtPath:userAppsPath handler:nil];
-		}
-		if ([[NSFileManager defaultManager] copyPath:[[NSBundle mainBundle] bundlePath] toPath:userAppsPath
-												handler:nil]) {
-		NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"%@ installed successfully", @"AppName installed successfully"), appName],
-				[NSString stringWithFormat:NSLocalizedString(@"%@ was installed in %@", @"App Name was installed in %@"), appName, [[NSString stringWithString:@"~/Applications"] stringByExpandingTildeInPath]],
-						NSLocalizedString(@"Quit", @"Quit"), nil, nil);
-		} else {
-			NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"Could not install %@", @"Could not install App Name"), appName],
-							NSLocalizedString(@"An error occurred when installing", @"An error occurred when installing"), NSLocalizedString(@"Quit", @"Quit"), nil, nil);
-		}
-	}
-}
-
-@end
--- a/QTfrontend/M3Panel.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef M3PANEL_H
-#define M3PANEL_H
-
-#include "InstallController.h"
-
-class M3Panel : public InstallController
-{
-    public:
-        M3Panel(void);
-        ~M3Panel();
-
-        void showInstallController();
-
-    private:
-        class Private;
-        Private* m;
-};
-
-#endif
--- a/QTfrontend/M3Panel.mm	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "M3Panel.h"
-#include "M3InstallController.h"
-
-#include <Cocoa/Cocoa.h>
-
-class M3Panel::Private
-{
-    public:
-        M3InstallController *install;
-};
-
-M3Panel::M3Panel(void)
-{
-    m = new M3Panel::Private();
-
-    m->install = [[M3InstallController alloc] init];
-    [m->install retain];
-}
-
-M3Panel::~M3Panel()
-{
-    [m->install release];
-    delete m;
-}
-
-void M3Panel::showInstallController()
-{
-    [m->install displayInstaller];
-}
--- a/QTfrontend/NSWorkspace_RBAdditions.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-//
-//  NSWorkspace_RBAdditions.h
-//  PathProps
-//
-//  Created by Rainer Brockerhoff on 10/04/2007.
-//  Copyright 2007 Rainer Brockerhoff. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-extern NSString* NSWorkspace_RBfstypename;
-extern NSString* NSWorkspace_RBmntonname;
-extern NSString* NSWorkspace_RBmntfromname;
-extern NSString* NSWorkspace_RBdeviceinfo;
-extern NSString* NSWorkspace_RBimagefilepath;
-extern NSString* NSWorkspace_RBconnectiontype;
-extern NSString* NSWorkspace_RBpartitionscheme;
-extern NSString* NSWorkspace_RBserverURL;
-
-@interface NSWorkspace (NSWorkspace_RBAdditions)
-
-// This method will return nil if the input path is invalid. Otherwise, the returned NSDictionary may contain
-// the following keys:
-//- NSWorkspace_RBfstypename: will always be present.Shows the filesystem type (usually "hfs"), from statfs.
-//- NSWorkspace_RBmntonname: will always be present. Shows the volume mount point.
-//- NSWorkspace_RBmntfromname: will always be present. Shows the BSD device path for local volumes; info for
-//      remote volumes depends on the filesystem type.
-//- NSWorkspace_RBconnectiontype: should always be present for local volumes. Shows the connection type ("SATA", "USB", etc.).
-//- NSWorkspace_RBpartitionscheme: should always be present for local volumes. Shows the partition scheme.
-//- NSWorkspace_RBdeviceinfo: should always be present for local volumes. Shows some information about the
-//      physical device; varies widely.
-//- NSWorkspace_RBimagefilepath: should be present for disk images only. Shows the path of the disk image file.
-//- NSWorkspace_RBserverURL: should be present for remote volumes only. Shows the server URL.
-
-- (NSDictionary*)propertiesForPath:
-(NSString*)path;
-
-@end
--- a/QTfrontend/NSWorkspace_RBAdditions.m	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-//
-//  NSWorkspace_RBAdditions.m
-//  PathProps
-//
-//  Created by Rainer Brockerhoff on 10/04/2007.
-//  Copyright 2007 Rainer Brockerhoff. All rights reserved.
-//
-
-#import "NSWorkspace_RBAdditions.h"
-#include <IOKit/IOKitLib.h>
-#include <sys/mount.h>
-#include <mach/mach.h>
-
-NSString* NSWorkspace_RBfstypename = @"NSWorkspace_RBfstypename";
-NSString* NSWorkspace_RBmntonname = @"NSWorkspace_RBmntonname";
-NSString* NSWorkspace_RBmntfromname = @"NSWorkspace_RBmntfromname";
-NSString* NSWorkspace_RBdeviceinfo = @"NSWorkspace_RBdeviceinfo";
-NSString* NSWorkspace_RBimagefilepath = @"NSWorkspace_RBimagefilepath";
-NSString* NSWorkspace_RBconnectiontype = @"NSWorkspace_RBconnectiontype";
-NSString* NSWorkspace_RBpartitionscheme = @"NSWorkspace_RBpartitionscheme";
-NSString* NSWorkspace_RBserverURL = @"NSWorkspace_RBserverURL";
-
-// This static funtion concatenates two strings, but first checks several possibilities...
-// like one or the other nil, or one containing the other already.
-
-static NSString* AddPart(NSString* first,NSString* second) {
-	if (!second) {
-		return first;
-	}
-	second = [second stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
-	if (first) {
-		if ([first rangeOfString:second options:NSCaseInsensitiveSearch].location==NSNotFound) {
-			if ([second rangeOfString:first options:NSCaseInsensitiveSearch].location==NSNotFound) {
-				return [NSString stringWithFormat:@"%@; %@",first,second];
-			}
-			return second;
-		}
-		return first;
-	}
-	return second;
-}
-
-// This static functions recurses "upwards" over the IO registry. Returns strings that are concatenated
-// and ultimately end up under the NSWorkspace_RBdeviceinfo key.
-// This isn't too robust in that it assumes that objects returned by the objectForKey methods are
-// either strings or dictionaries. A "standard" implementations would use either only CoreFoundation and
-// IOKit calls for this, or do more robust type checking on the returned objects.
-//
-// Also notice that this works as determined experimentally in 10.4.9, there's no official docs I could find.
-// YMMV, and it may stop working in any new version of Mac OS X.
-
-static NSString* CheckParents(io_object_t thing,NSString* part,NSMutableDictionary* dict) {
-	NSString* result = part;
-    io_iterator_t parentsIterator = 0;
-    kern_return_t kernResult = IORegistryEntryGetParentIterator(thing,kIOServicePlane,&parentsIterator);
-    if ((kernResult==KERN_SUCCESS)&&parentsIterator) {
-		io_object_t nextParent = 0;
-		while ((nextParent = IOIteratorNext(parentsIterator))) {
-			NSDictionary* props = nil;
-			NSString* image = nil;
-			NSString* partition = nil;
-			NSString* connection = nil;
-			kernResult = IORegistryEntryCreateCFProperties(nextParent,(CFMutableDictionaryRef*)&props,kCFAllocatorDefault,0);
-			if (IOObjectConformsTo(nextParent,"IOApplePartitionScheme")) {
-				partition = [props objectForKey:@"Content Mask"];
-			} else if (IOObjectConformsTo(nextParent,"IOMedia")) {
-				partition = [props objectForKey:@"Content"];
-			} else if (IOObjectConformsTo(nextParent,"IODiskImageBlockStorageDeviceOutKernel")) {
-				NSData* data = nil;
-                                if ((data = [[props objectForKey:@"Protocol Characteristics"] objectForKey:@"Virtual Interface Location Path"])) {
-					image = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease];
-				}
-			} else if (IOObjectConformsTo(nextParent,"IOHDIXHDDriveInKernel")) {
-				image = [props objectForKey:@"KDIURLPath"];
-			}
-			NSDictionary* subdict;
-                        if ((subdict = [props objectForKey:@"Protocol Characteristics"])) {
-				connection = [subdict objectForKey:@"Physical Interconnect"];
-			} else {
-				connection = [props objectForKey:@"Physical Interconnect"];
-			}
-			if (connection) {
-				[dict setObject:AddPart([dict objectForKey:NSWorkspace_RBconnectiontype],connection) forKey:NSWorkspace_RBconnectiontype];
-			}
-			if (partition) {
-				[dict setObject:partition forKey:NSWorkspace_RBpartitionscheme];
-			}
-			if (image) {
-				[dict setObject:image forKey:NSWorkspace_RBimagefilepath];
-			}
-			NSString* value;
-                        if ((subdict = [props objectForKey:@"Device Characteristics"])) {
-                                if ((value = [subdict objectForKey:@"Product Name"])) {
-					result = AddPart(result,value);
-				}
-                                if ((value = [subdict objectForKey:@"Product Revision Level"])) {
-					result = AddPart(result,value);
-				}
-                                if ((value = [subdict objectForKey:@"Vendor Name"])) {
-					result = AddPart(result,value);
-				}
-			}
-                        if ((value = [props objectForKey:@"USB Serial Number"])) {
-				result = AddPart(result,value);
-			}
-                        if ((value = [props objectForKey:@"USB Vendor Name"])) {
-				result = AddPart(result,value);
-			}
-			NSString* cls = [(NSString*)IOObjectCopyClass(nextParent) autorelease];
-			if (![cls isEqualToString:@"IOPCIDevice"]) {
-
-// Uncomment the following line to have the device tree dumped to the console.
-//				NSLog(@"=================================> %@:%@\n",cls,props);
-
-				result = CheckParents(nextParent,result,dict);
-			}
-			IOObjectRelease(nextParent);
-		}
-    }
-    if (parentsIterator) {
-		IOObjectRelease(parentsIterator);
-    }
-	return result;
-}
-
-// This formats the (partially undocumented) AFPXMountInfo info into a string.
-
-/*
-static NSString* FormatAFPURL(AFPXVolMountInfoPtr mountInfo,NSString** devdesc) {
-	UInt8* work = ((UInt8*)mountInfo)+mountInfo->serverNameOffset;
-	if (devdesc) {
-		*devdesc = [[[NSString alloc] initWithBytes:&work[1] length:work[0] encoding:NSUTF8StringEncoding] autorelease];
-	}
-	work = ((UInt8*)mountInfo)+mountInfo->volNameOffset;
-	NSString* volname = [[[NSString alloc] initWithBytes:&work[1] length:work[0] encoding:NSUTF8StringEncoding] autorelease];
-	work = ((UInt8*)mountInfo)+mountInfo->alternateAddressOffset;
-	AFPAlternateAddress* afpa = (AFPAlternateAddress*)work;
-	AFPTagData* afpta = (AFPTagData*)(&afpa->fAddressList);
-	NSString* ip = nil;
-	NSString* dns = nil;
-	int i = afpa->fAddressCount;
-	while ((i-->0)) {
-		switch (afpta->fType) {
-			case kAFPTagTypeIP:
-				if (!ip) {
-					ip = [[[NSString alloc] initWithBytes:&afpta->fData[0] length:afpta->fLength-2 encoding:NSUTF8StringEncoding] autorelease];
-				}
-				break;
-			case kAFPTagTypeIPPort:
-				ip = [NSString stringWithFormat:@"%u.%u.%u.%u:%u",afpta->fData[0],afpta->fData[1],afpta->fData[2],afpta->fData[3],OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[4])];
-				break;
-			case kAFPTagTypeDNS:
-				dns = [[[NSString alloc] initWithBytes:&afpta->fData[0] length:afpta->fLength-2 encoding:NSUTF8StringEncoding] autorelease];
-				break;
-			case 0x07:
-				ip = [NSString stringWithFormat:@"[%x:%x:%x:%x:%x:%x:%x:%x]",OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[0]),
-					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[2]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[4]),
-					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[6]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[8]),
-					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[10]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[12]),
-					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[14])];
-				break;
-		}
-		afpta = (AFPTagData*)((char*)afpta+afpta->fLength);
-	}
-	return [NSString stringWithFormat:@"afp://%@/%@",dns?:(ip?:@""),volname];
-}
-*/
-
-@implementation NSWorkspace (NSWorkspace_RBAdditions)
-
-// Returns a NSDictionary with properties for the path. See details in the .h file.
-// This assumes that the length of path is less than PATH_MAX (currently 1024 characters).
-
-- (NSDictionary*)propertiesForPath:(NSString*)path {
-	const char* ccpath = (const char*)[path fileSystemRepresentation];
-	NSMutableDictionary* result = nil;
-	struct statfs fs;
-	if (!statfs(ccpath,&fs)) {
-		NSString* from = [NSString stringWithUTF8String:fs.f_mntfromname];
-		result = [NSMutableDictionary dictionaryWithObjectsAndKeys:
-			[NSString stringWithUTF8String:fs.f_fstypename],NSWorkspace_RBfstypename,
-			[NSString stringWithUTF8String:fs.f_mntonname],NSWorkspace_RBmntonname,
-			nil];
-		if (strncmp(fs.f_mntfromname,"/dev/",5)==0) {
-// For a local volume,get the IO registry tree and search it for further info.
-			mach_port_t masterPort = 0;
-			io_iterator_t mediaIterator = 0;
-			kern_return_t kernResult = IOMasterPort(bootstrap_port,&masterPort);
-			if (kernResult==KERN_SUCCESS) {
-				CFMutableDictionaryRef classesToMatch = IOBSDNameMatching(masterPort,0,&fs.f_mntfromname[5]);
-				if (classesToMatch) {
-					kernResult = IOServiceGetMatchingServices(masterPort,classesToMatch,&mediaIterator);
-					if ((kernResult==KERN_SUCCESS)&&mediaIterator) {
-						io_object_t firstMedia = 0;
-						while ((firstMedia = IOIteratorNext(mediaIterator))) {
-							NSString* stuff = CheckParents(firstMedia,nil,result);
-							if (stuff) {
-								[result setObject:stuff forKey:NSWorkspace_RBdeviceinfo];
-							}
-							IOObjectRelease(firstMedia);
-						}
-					}
-				}
-			}
-			if (mediaIterator) {
-				IOObjectRelease(mediaIterator);
-			}
-			if (masterPort) {
-				mach_port_deallocate(mach_task_self(),masterPort);
-			}
-		}
-		//Don't need this for disk images, gets around warnings for some deprecated functions
-
-		/* else {
-// For a network volume, get the volume reference number and use to get the server URL.
-			FSRef ref;
-			if (FSPathMakeRef((const UInt8*)ccpath,&ref,NULL)==noErr) {
-				FSCatalogInfo info;
-				if (FSGetCatalogInfo(&ref,kFSCatInfoVolume,&info,NULL,NULL,NULL)==noErr) {
-					ParamBlockRec pb;
-					UInt16 vmisize = 0;
-					VolumeMountInfoHeaderPtr mountInfo = NULL;
-					pb.ioParam.ioCompletion = NULL;
-					pb.ioParam.ioNamePtr = NULL;
-					pb.ioParam.ioVRefNum = info.volume;
-					pb.ioParam.ioBuffer = (Ptr)&vmisize;
-					pb.ioParam.ioReqCount = sizeof(vmisize);
-					if ((PBGetVolMountInfoSize(&pb)==noErr)&&vmisize) {
-						mountInfo = (VolumeMountInfoHeaderPtr)malloc(vmisize);
-						if (mountInfo) {
-							pb.ioParam.ioBuffer = (Ptr)mountInfo;
-							pb.ioParam.ioReqCount = vmisize;
-							if (PBGetVolMountInfo(&pb)==noErr) {
-								NSString* url = nil;
-								switch (mountInfo->media) {
-								case AppleShareMediaType:
-									url = FormatAFPURL((AFPXVolMountInfoPtr)mountInfo,&from);
-									break;
-								case 'http':
-									url = from;
-									break;
-								case 'crbm':
-								case 'nfs_':
-								case 'cifs':
-									url = [NSString stringWithUTF8String:(char*)mountInfo+sizeof(VolumeMountInfoHeader)+sizeof(OSType)];
-									break;
-								}
-								if (url) {
-									[result setObject:url forKey:NSWorkspace_RBserverURL];
-								}
-							}
-						}
-						free(mountInfo);
-					}
-				}
-			}
-		}*/
-		[result setObject:from forKey:NSWorkspace_RBmntfromname];
-	}
-	return result;
-}
-
-@end
--- a/QTfrontend/SparkleAutoUpdater.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2008 Remko Troncon
- */
-
-#ifndef SPARKLEAUTOUPDATER_H
-#define SPARKLEAUTOUPDATER_H
-
-#include <QString>
-
-#include "AutoUpdater.h"
-
-class SparkleAutoUpdater : public AutoUpdater
-{
-    public:
-        SparkleAutoUpdater();
-        ~SparkleAutoUpdater();
-
-        void checkForUpdates();
-        void checkForUpdatesNow();
-
-    private:
-        class Private;
-        Private* d;
-};
-
-#endif
--- a/QTfrontend/SparkleAutoUpdater.mm	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
-
-#include "SparkleAutoUpdater.h"
-
-#include <Cocoa/Cocoa.h>
-#include <Sparkle/Sparkle.h>
-
-class SparkleAutoUpdater::Private
-{
-    public:
-        SUUpdater* updater;
-};
-
-SparkleAutoUpdater::SparkleAutoUpdater()
-{
-    d = new SparkleAutoUpdater::Private();
-
-    d->updater = [SUUpdater sharedUpdater];
-    [d->updater retain];
-}
-
-SparkleAutoUpdater::~SparkleAutoUpdater()
-{
-    [d->updater release];
-    delete d;
-}
-
-void SparkleAutoUpdater::checkForUpdates()
-{
-    [d->updater checkForUpdatesInBackground];
-}
-
-void SparkleAutoUpdater::checkForUpdatesNow()
-{
-    [d->updater checkForUpdates:NULL];
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/AutoUpdater.cpp	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2008 Remko Troncon
+ */
+
+#include "AutoUpdater.h"
+
+AutoUpdater::~AutoUpdater()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/AutoUpdater.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2008 Remko Troncon
+ */
+
+#ifndef AUTOUPDATER_H
+#define AUTOUPDATER_H
+
+class AutoUpdater
+{
+    public:
+        virtual ~AutoUpdater();
+
+        virtual void checkForUpdates() = 0;
+        virtual void checkForUpdatesNow() = 0;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/CocoaInitializer.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
+
+#ifndef COCOAINITIALIZER_H
+#define COCOAINITIALIZER_H
+
+class CocoaInitializer
+{
+    public:
+        CocoaInitializer();
+        ~CocoaInitializer();
+
+    private:
+        class Private;
+        Private* c;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/CocoaInitializer.mm	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
+
+#include "CocoaInitializer.h"
+
+#include <AppKit/AppKit.h>
+#include <Cocoa/Cocoa.h>
+#include <QtDebug>
+
+class CocoaInitializer::Private
+{
+    public:
+        NSAutoreleasePool* pool;
+};
+
+CocoaInitializer::CocoaInitializer()
+{
+    c = new CocoaInitializer::Private();
+    c->pool = [[NSAutoreleasePool alloc] init];
+    NSApplicationLoad();
+}
+
+CocoaInitializer::~CocoaInitializer()
+{
+    [c->pool release];
+    delete c;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/InstallController.cpp	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,23 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "InstallController.h"
+
+InstallController::~InstallController()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/InstallController.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef INSTALLCONTROLLER_H
+#define INSTALLCONTROLLER_H
+
+class InstallController
+{
+    public:
+        virtual ~InstallController();
+
+        virtual void showInstallController() = 0;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/M3InstallController.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,53 @@
+/*****************************************************************
+ M3InstallController.m
+
+ Created by Martin Pilkington on 02/06/2007.
+
+ Copyright (c) 2006-2009 M Cubed Software
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ *****************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import <AvailabilityMacros.h>
+
+//#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#if __LP64__ || NS_BUILD_32_LIKE_64
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+//#endif
+
+
+@interface M3InstallController :
+NSObject
+{
+    NSAlert *alert;
+}
+
+- (void)displayInstaller;
+- (void)installApp;
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/M3InstallController.m	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,97 @@
+/*****************************************************************
+ M3InstallController.m
+
+ Created by Martin Pilkington on 02/06/2007.
+
+ Copyright (c) 2006-2009 M Cubed Software
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ *****************************************************************/
+
+#import "M3InstallController.h"
+#import "NSWorkspace_RBAdditions.h"
+
+#import <Foundation/Foundation.h>
+
+@implementation M3InstallController
+
+- (id) init {
+        if ((self = [super init])) {
+		NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
+		NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ is currently running from a disk image", @"AppName is currently running from a disk image"), appName];
+		NSString *body = [NSString stringWithFormat:NSLocalizedString(@"Would you like to install %@ in your applications folder before quitting?", @"Would you like to install App Name in your applications folder before quitting?"), appName];
+		alert = [[NSAlert alertWithMessageText:title
+								 defaultButton:NSLocalizedString(@"Install", @"Install")
+							   alternateButton:NSLocalizedString(@"Don't Install", @"Don't Install")
+								   otherButton:nil
+					 informativeTextWithFormat:body] retain];
+		//[alert setShowsSuppressionButton:YES];
+	}
+	return self;
+}
+
+- (void)displayInstaller {
+	NSString *imageFilePath = [[[NSWorkspace sharedWorkspace] propertiesForPath:[[NSBundle mainBundle] bundlePath]] objectForKey:NSWorkspace_RBimagefilepath];
+	if (imageFilePath && ![imageFilePath isEqualToString:[NSString stringWithFormat:@"/Users/.%@/%@.sparseimage", NSUserName(), NSUserName()]] && ![[NSUserDefaults standardUserDefaults] boolForKey:@"M3DontAskInstallAgain"]) {
+		NSInteger returnValue = [alert runModal];
+		if (returnValue == NSAlertDefaultReturn) {
+			[self installApp];
+		}
+		if ([[alert suppressionButton] state] == NSOnState) {
+			[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"M3DontAskInstallAgain"];
+		}
+	}
+}
+
+- (void)installApp {
+	NSString *appsPath = [[NSString stringWithString:@"/Applications"] stringByAppendingPathComponent:[[[NSBundle mainBundle] bundlePath] lastPathComponent]];
+	NSString *userAppsPath = [[[NSString stringWithString:@"~/Applications"] stringByAppendingPathComponent:[[[NSBundle mainBundle] bundlePath] lastPathComponent]] stringByExpandingTildeInPath];
+	NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
+
+	//Delete the app that is installed
+	if ([[NSFileManager defaultManager] fileExistsAtPath:appsPath]) {
+		[[NSFileManager defaultManager] removeFileAtPath:appsPath handler:nil];
+	}
+	//Delete the app that is installed
+	if ([[NSFileManager defaultManager] copyPath:[[NSBundle mainBundle] bundlePath] toPath:appsPath
+										  handler:nil]) {
+		NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"%@ installed successfully", @"App Name installed successfully"), appName],
+						[NSString stringWithFormat:NSLocalizedString(@"%@ was installed in /Applications", @"App Name was installed in /Applications"), appName],
+						NSLocalizedString(@"Quit", @"Quit"), nil, nil);
+	} else {
+		if ([[NSFileManager defaultManager] fileExistsAtPath:userAppsPath]) {
+			[[NSFileManager defaultManager] removeFileAtPath:userAppsPath handler:nil];
+		}
+		if ([[NSFileManager defaultManager] copyPath:[[NSBundle mainBundle] bundlePath] toPath:userAppsPath
+												handler:nil]) {
+		NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"%@ installed successfully", @"AppName installed successfully"), appName],
+				[NSString stringWithFormat:NSLocalizedString(@"%@ was installed in %@", @"App Name was installed in %@"), appName, [[NSString stringWithString:@"~/Applications"] stringByExpandingTildeInPath]],
+						NSLocalizedString(@"Quit", @"Quit"), nil, nil);
+		} else {
+			NSRunAlertPanel([NSString stringWithFormat:NSLocalizedString(@"Could not install %@", @"Could not install App Name"), appName],
+							NSLocalizedString(@"An error occurred when installing", @"An error occurred when installing"), NSLocalizedString(@"Quit", @"Quit"), nil, nil);
+		}
+	}
+}
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/M3Panel.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef M3PANEL_H
+#define M3PANEL_H
+
+#include "InstallController.h"
+
+class M3Panel : public InstallController
+{
+    public:
+        M3Panel(void);
+        ~M3Panel();
+
+        void showInstallController();
+
+    private:
+        class Private;
+        Private* m;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/M3Panel.mm	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "M3Panel.h"
+#include "M3InstallController.h"
+
+#include <Cocoa/Cocoa.h>
+
+class M3Panel::Private
+{
+    public:
+        M3InstallController *install;
+};
+
+M3Panel::M3Panel(void)
+{
+    m = new M3Panel::Private();
+
+    m->install = [[M3InstallController alloc] init];
+    [m->install retain];
+}
+
+M3Panel::~M3Panel()
+{
+    [m->install release];
+    delete m;
+}
+
+void M3Panel::showInstallController()
+{
+    [m->install displayInstaller];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/NSWorkspace_RBAdditions.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,38 @@
+//
+//  NSWorkspace_RBAdditions.h
+//  PathProps
+//
+//  Created by Rainer Brockerhoff on 10/04/2007.
+//  Copyright 2007 Rainer Brockerhoff. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+extern NSString* NSWorkspace_RBfstypename;
+extern NSString* NSWorkspace_RBmntonname;
+extern NSString* NSWorkspace_RBmntfromname;
+extern NSString* NSWorkspace_RBdeviceinfo;
+extern NSString* NSWorkspace_RBimagefilepath;
+extern NSString* NSWorkspace_RBconnectiontype;
+extern NSString* NSWorkspace_RBpartitionscheme;
+extern NSString* NSWorkspace_RBserverURL;
+
+@interface NSWorkspace (NSWorkspace_RBAdditions)
+
+// This method will return nil if the input path is invalid. Otherwise, the returned NSDictionary may contain
+// the following keys:
+//- NSWorkspace_RBfstypename: will always be present.Shows the filesystem type (usually "hfs"), from statfs.
+//- NSWorkspace_RBmntonname: will always be present. Shows the volume mount point.
+//- NSWorkspace_RBmntfromname: will always be present. Shows the BSD device path for local volumes; info for
+//      remote volumes depends on the filesystem type.
+//- NSWorkspace_RBconnectiontype: should always be present for local volumes. Shows the connection type ("SATA", "USB", etc.).
+//- NSWorkspace_RBpartitionscheme: should always be present for local volumes. Shows the partition scheme.
+//- NSWorkspace_RBdeviceinfo: should always be present for local volumes. Shows some information about the
+//      physical device; varies widely.
+//- NSWorkspace_RBimagefilepath: should be present for disk images only. Shows the path of the disk image file.
+//- NSWorkspace_RBserverURL: should be present for remote volumes only. Shows the server URL.
+
+- (NSDictionary*)propertiesForPath:
+(NSString*)path;
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/NSWorkspace_RBAdditions.m	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,263 @@
+//
+//  NSWorkspace_RBAdditions.m
+//  PathProps
+//
+//  Created by Rainer Brockerhoff on 10/04/2007.
+//  Copyright 2007 Rainer Brockerhoff. All rights reserved.
+//
+
+#import "NSWorkspace_RBAdditions.h"
+#include <IOKit/IOKitLib.h>
+#include <sys/mount.h>
+#include <mach/mach.h>
+
+NSString* NSWorkspace_RBfstypename = @"NSWorkspace_RBfstypename";
+NSString* NSWorkspace_RBmntonname = @"NSWorkspace_RBmntonname";
+NSString* NSWorkspace_RBmntfromname = @"NSWorkspace_RBmntfromname";
+NSString* NSWorkspace_RBdeviceinfo = @"NSWorkspace_RBdeviceinfo";
+NSString* NSWorkspace_RBimagefilepath = @"NSWorkspace_RBimagefilepath";
+NSString* NSWorkspace_RBconnectiontype = @"NSWorkspace_RBconnectiontype";
+NSString* NSWorkspace_RBpartitionscheme = @"NSWorkspace_RBpartitionscheme";
+NSString* NSWorkspace_RBserverURL = @"NSWorkspace_RBserverURL";
+
+// This static funtion concatenates two strings, but first checks several possibilities...
+// like one or the other nil, or one containing the other already.
+
+static NSString* AddPart(NSString* first,NSString* second) {
+	if (!second) {
+		return first;
+	}
+	second = [second stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+	if (first) {
+		if ([first rangeOfString:second options:NSCaseInsensitiveSearch].location==NSNotFound) {
+			if ([second rangeOfString:first options:NSCaseInsensitiveSearch].location==NSNotFound) {
+				return [NSString stringWithFormat:@"%@; %@",first,second];
+			}
+			return second;
+		}
+		return first;
+	}
+	return second;
+}
+
+// This static functions recurses "upwards" over the IO registry. Returns strings that are concatenated
+// and ultimately end up under the NSWorkspace_RBdeviceinfo key.
+// This isn't too robust in that it assumes that objects returned by the objectForKey methods are
+// either strings or dictionaries. A "standard" implementations would use either only CoreFoundation and
+// IOKit calls for this, or do more robust type checking on the returned objects.
+//
+// Also notice that this works as determined experimentally in 10.4.9, there's no official docs I could find.
+// YMMV, and it may stop working in any new version of Mac OS X.
+
+static NSString* CheckParents(io_object_t thing,NSString* part,NSMutableDictionary* dict) {
+	NSString* result = part;
+    io_iterator_t parentsIterator = 0;
+    kern_return_t kernResult = IORegistryEntryGetParentIterator(thing,kIOServicePlane,&parentsIterator);
+    if ((kernResult==KERN_SUCCESS)&&parentsIterator) {
+		io_object_t nextParent = 0;
+		while ((nextParent = IOIteratorNext(parentsIterator))) {
+			NSDictionary* props = nil;
+			NSString* image = nil;
+			NSString* partition = nil;
+			NSString* connection = nil;
+			kernResult = IORegistryEntryCreateCFProperties(nextParent,(CFMutableDictionaryRef*)&props,kCFAllocatorDefault,0);
+			if (IOObjectConformsTo(nextParent,"IOApplePartitionScheme")) {
+				partition = [props objectForKey:@"Content Mask"];
+			} else if (IOObjectConformsTo(nextParent,"IOMedia")) {
+				partition = [props objectForKey:@"Content"];
+			} else if (IOObjectConformsTo(nextParent,"IODiskImageBlockStorageDeviceOutKernel")) {
+				NSData* data = nil;
+                                if ((data = [[props objectForKey:@"Protocol Characteristics"] objectForKey:@"Virtual Interface Location Path"])) {
+					image = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease];
+				}
+			} else if (IOObjectConformsTo(nextParent,"IOHDIXHDDriveInKernel")) {
+				image = [props objectForKey:@"KDIURLPath"];
+			}
+			NSDictionary* subdict;
+                        if ((subdict = [props objectForKey:@"Protocol Characteristics"])) {
+				connection = [subdict objectForKey:@"Physical Interconnect"];
+			} else {
+				connection = [props objectForKey:@"Physical Interconnect"];
+			}
+			if (connection) {
+				[dict setObject:AddPart([dict objectForKey:NSWorkspace_RBconnectiontype],connection) forKey:NSWorkspace_RBconnectiontype];
+			}
+			if (partition) {
+				[dict setObject:partition forKey:NSWorkspace_RBpartitionscheme];
+			}
+			if (image) {
+				[dict setObject:image forKey:NSWorkspace_RBimagefilepath];
+			}
+			NSString* value;
+                        if ((subdict = [props objectForKey:@"Device Characteristics"])) {
+                                if ((value = [subdict objectForKey:@"Product Name"])) {
+					result = AddPart(result,value);
+				}
+                                if ((value = [subdict objectForKey:@"Product Revision Level"])) {
+					result = AddPart(result,value);
+				}
+                                if ((value = [subdict objectForKey:@"Vendor Name"])) {
+					result = AddPart(result,value);
+				}
+			}
+                        if ((value = [props objectForKey:@"USB Serial Number"])) {
+				result = AddPart(result,value);
+			}
+                        if ((value = [props objectForKey:@"USB Vendor Name"])) {
+				result = AddPart(result,value);
+			}
+			NSString* cls = [(NSString*)IOObjectCopyClass(nextParent) autorelease];
+			if (![cls isEqualToString:@"IOPCIDevice"]) {
+
+// Uncomment the following line to have the device tree dumped to the console.
+//				NSLog(@"=================================> %@:%@\n",cls,props);
+
+				result = CheckParents(nextParent,result,dict);
+			}
+			IOObjectRelease(nextParent);
+		}
+    }
+    if (parentsIterator) {
+		IOObjectRelease(parentsIterator);
+    }
+	return result;
+}
+
+// This formats the (partially undocumented) AFPXMountInfo info into a string.
+
+/*
+static NSString* FormatAFPURL(AFPXVolMountInfoPtr mountInfo,NSString** devdesc) {
+	UInt8* work = ((UInt8*)mountInfo)+mountInfo->serverNameOffset;
+	if (devdesc) {
+		*devdesc = [[[NSString alloc] initWithBytes:&work[1] length:work[0] encoding:NSUTF8StringEncoding] autorelease];
+	}
+	work = ((UInt8*)mountInfo)+mountInfo->volNameOffset;
+	NSString* volname = [[[NSString alloc] initWithBytes:&work[1] length:work[0] encoding:NSUTF8StringEncoding] autorelease];
+	work = ((UInt8*)mountInfo)+mountInfo->alternateAddressOffset;
+	AFPAlternateAddress* afpa = (AFPAlternateAddress*)work;
+	AFPTagData* afpta = (AFPTagData*)(&afpa->fAddressList);
+	NSString* ip = nil;
+	NSString* dns = nil;
+	int i = afpa->fAddressCount;
+	while ((i-->0)) {
+		switch (afpta->fType) {
+			case kAFPTagTypeIP:
+				if (!ip) {
+					ip = [[[NSString alloc] initWithBytes:&afpta->fData[0] length:afpta->fLength-2 encoding:NSUTF8StringEncoding] autorelease];
+				}
+				break;
+			case kAFPTagTypeIPPort:
+				ip = [NSString stringWithFormat:@"%u.%u.%u.%u:%u",afpta->fData[0],afpta->fData[1],afpta->fData[2],afpta->fData[3],OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[4])];
+				break;
+			case kAFPTagTypeDNS:
+				dns = [[[NSString alloc] initWithBytes:&afpta->fData[0] length:afpta->fLength-2 encoding:NSUTF8StringEncoding] autorelease];
+				break;
+			case 0x07:
+				ip = [NSString stringWithFormat:@"[%x:%x:%x:%x:%x:%x:%x:%x]",OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[0]),
+					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[2]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[4]),
+					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[6]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[8]),
+					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[10]),OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[12]),
+					OSSwapBigToHostInt16(*(UInt16*)&afpta->fData[14])];
+				break;
+		}
+		afpta = (AFPTagData*)((char*)afpta+afpta->fLength);
+	}
+	return [NSString stringWithFormat:@"afp://%@/%@",dns?:(ip?:@""),volname];
+}
+*/
+
+@implementation NSWorkspace (NSWorkspace_RBAdditions)
+
+// Returns a NSDictionary with properties for the path. See details in the .h file.
+// This assumes that the length of path is less than PATH_MAX (currently 1024 characters).
+
+- (NSDictionary*)propertiesForPath:(NSString*)path {
+	const char* ccpath = (const char*)[path fileSystemRepresentation];
+	NSMutableDictionary* result = nil;
+	struct statfs fs;
+	if (!statfs(ccpath,&fs)) {
+		NSString* from = [NSString stringWithUTF8String:fs.f_mntfromname];
+		result = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+			[NSString stringWithUTF8String:fs.f_fstypename],NSWorkspace_RBfstypename,
+			[NSString stringWithUTF8String:fs.f_mntonname],NSWorkspace_RBmntonname,
+			nil];
+		if (strncmp(fs.f_mntfromname,"/dev/",5)==0) {
+// For a local volume,get the IO registry tree and search it for further info.
+			mach_port_t masterPort = 0;
+			io_iterator_t mediaIterator = 0;
+			kern_return_t kernResult = IOMasterPort(bootstrap_port,&masterPort);
+			if (kernResult==KERN_SUCCESS) {
+				CFMutableDictionaryRef classesToMatch = IOBSDNameMatching(masterPort,0,&fs.f_mntfromname[5]);
+				if (classesToMatch) {
+					kernResult = IOServiceGetMatchingServices(masterPort,classesToMatch,&mediaIterator);
+					if ((kernResult==KERN_SUCCESS)&&mediaIterator) {
+						io_object_t firstMedia = 0;
+						while ((firstMedia = IOIteratorNext(mediaIterator))) {
+							NSString* stuff = CheckParents(firstMedia,nil,result);
+							if (stuff) {
+								[result setObject:stuff forKey:NSWorkspace_RBdeviceinfo];
+							}
+							IOObjectRelease(firstMedia);
+						}
+					}
+				}
+			}
+			if (mediaIterator) {
+				IOObjectRelease(mediaIterator);
+			}
+			if (masterPort) {
+				mach_port_deallocate(mach_task_self(),masterPort);
+			}
+		}
+		//Don't need this for disk images, gets around warnings for some deprecated functions
+
+		/* else {
+// For a network volume, get the volume reference number and use to get the server URL.
+			FSRef ref;
+			if (FSPathMakeRef((const UInt8*)ccpath,&ref,NULL)==noErr) {
+				FSCatalogInfo info;
+				if (FSGetCatalogInfo(&ref,kFSCatInfoVolume,&info,NULL,NULL,NULL)==noErr) {
+					ParamBlockRec pb;
+					UInt16 vmisize = 0;
+					VolumeMountInfoHeaderPtr mountInfo = NULL;
+					pb.ioParam.ioCompletion = NULL;
+					pb.ioParam.ioNamePtr = NULL;
+					pb.ioParam.ioVRefNum = info.volume;
+					pb.ioParam.ioBuffer = (Ptr)&vmisize;
+					pb.ioParam.ioReqCount = sizeof(vmisize);
+					if ((PBGetVolMountInfoSize(&pb)==noErr)&&vmisize) {
+						mountInfo = (VolumeMountInfoHeaderPtr)malloc(vmisize);
+						if (mountInfo) {
+							pb.ioParam.ioBuffer = (Ptr)mountInfo;
+							pb.ioParam.ioReqCount = vmisize;
+							if (PBGetVolMountInfo(&pb)==noErr) {
+								NSString* url = nil;
+								switch (mountInfo->media) {
+								case AppleShareMediaType:
+									url = FormatAFPURL((AFPXVolMountInfoPtr)mountInfo,&from);
+									break;
+								case 'http':
+									url = from;
+									break;
+								case 'crbm':
+								case 'nfs_':
+								case 'cifs':
+									url = [NSString stringWithUTF8String:(char*)mountInfo+sizeof(VolumeMountInfoHeader)+sizeof(OSType)];
+									break;
+								}
+								if (url) {
+									[result setObject:url forKey:NSWorkspace_RBserverURL];
+								}
+							}
+						}
+						free(mountInfo);
+					}
+				}
+			}
+		}*/
+		[result setObject:from forKey:NSWorkspace_RBmntfromname];
+	}
+	return result;
+}
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/SparkleAutoUpdater.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2008 Remko Troncon
+ */
+
+#ifndef SPARKLEAUTOUPDATER_H
+#define SPARKLEAUTOUPDATER_H
+
+#include <QString>
+
+#include "AutoUpdater.h"
+
+class SparkleAutoUpdater : public AutoUpdater
+{
+    public:
+        SparkleAutoUpdater();
+        ~SparkleAutoUpdater();
+
+        void checkForUpdates();
+        void checkForUpdatesNow();
+
+    private:
+        class Private;
+        Private* d;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/SparkleAutoUpdater.mm	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,54 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+// see original example here http://el-tramo.be/blog/mixing-cocoa-and-qt
+
+#include "SparkleAutoUpdater.h"
+
+#include <Cocoa/Cocoa.h>
+#include <Sparkle/Sparkle.h>
+
+class SparkleAutoUpdater::Private
+{
+    public:
+        SUUpdater* updater;
+};
+
+SparkleAutoUpdater::SparkleAutoUpdater()
+{
+    d = new SparkleAutoUpdater::Private();
+
+    d->updater = [SUUpdater sharedUpdater];
+    [d->updater retain];
+}
+
+SparkleAutoUpdater::~SparkleAutoUpdater()
+{
+    [d->updater release];
+    delete d;
+}
+
+void SparkleAutoUpdater::checkForUpdates()
+{
+    [d->updater checkForUpdatesInBackground];
+}
+
+void SparkleAutoUpdater::checkForUpdatesNow()
+{
+    [d->updater checkForUpdates:NULL];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/Xfire Game SDK.url	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,5 @@
+[{000214A0-0000-0000-C000-000000000046}]
+Prop3=19,2
+[InternetShortcut]
+URL=http://www.xfire.com/cms/xf_game_sdk
+IDList=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/xfire.cpp	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,85 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <string>
+#include <cstring>
+#include <stdio.h>
+
+#include "xfire.h"
+#include "xfiregameclient.h"
+
+#ifdef USE_XFIRE
+// use_xfire: stores if xfire is loaded and functions should do something at all
+bool use_xfire = false;
+char *keys[XFIRE_KEY_COUNT];
+char *values[XFIRE_KEY_COUNT];
+
+// xfire_init(): used to initialize all variables and set their default values
+void xfire_init(void)
+{
+    if(use_xfire)
+        return;
+    use_xfire = XfireIsLoaded() == 1;
+
+    if(!use_xfire)
+        return;
+
+    for(int i = 0; i < XFIRE_KEY_COUNT; i++)
+    {
+        keys[i] = new char[256];
+        values[i] = new char[256];
+        strcpy(keys[i], "");
+        strcpy(values[i], "");
+    }
+
+    strcpy(keys[XFIRE_NICKNAME], "Nickname");
+    strcpy(keys[XFIRE_ROOM], "Room");
+    strcpy(keys[XFIRE_SERVER], "Server");
+    strcpy(keys[XFIRE_STATUS], "Status");
+    xfire_update();
+}
+
+// xfire_free(): used to free up ressources used etc.
+void xfire_free(void)
+{
+    if(!use_xfire)
+        return;
+
+    for(int i = 0; i < XFIRE_KEY_COUNT; i++)
+    {
+        delete [] keys[i];
+        delete [] values[i];
+    }
+}
+
+// xfire_setvalue(): set a specific value
+void xfire_setvalue(const XFIRE_KEYS status, const char *value)
+{
+    if(!use_xfire || strlen(value) > 255)
+        return;
+    strcpy(values[status], value);
+}
+
+// xfire_update(): submits current values to the xfire app
+void xfire_update(void)
+{
+    if(!use_xfire)
+        return;
+    XfireSetCustomGameDataA(XFIRE_KEY_COUNT, (const char**)keys, (const char**)values);
+}
+#endif // USE_XFIRE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/xfire.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef XFIRE_H
+#define XFIRE_H
+
+
+#ifdef USE_XFIRE
+enum XFIRE_KEYS
+{
+    XFIRE_STATUS = 0,
+    XFIRE_NICKNAME,
+    XFIRE_SERVER,
+    XFIRE_ROOM,
+    XFIRE_KEY_COUNT,
+};
+
+void xfire_init(void);
+void xfire_free(void);
+void xfire_setvalue(const XFIRE_KEYS status, const char *value);
+void xfire_update(void);
+#endif
+
+#endif // XFIRE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/xfire_license.txt	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,103 @@
+Terms and Conditions
+AGREEMENT BETWEEN USER AND XFIRE INC.
+This is a legal agreement between you and Xfire Inc. ("Xfire") with respect to your access and use of the Xfire Service, which may also include Xfire software, content and related documentation and information (collectively, the "Service"). You must accept without modification all of the terms, conditions, and notices contained in these Terms of Use in order to access and/or use the Service (collectively, the "Terms of Use" or "Agreement"). If you do not accept these Terms of Use in their entirety, you may not access or use the Service. 
+
+Portions of the Service may be governed by posted guidelines, rules, or other terms and conditions. All such guidelines, rules, terms and conditions are hereby incorporated by reference into these Terms of Use. In the event of a conflict between such other guidelines, rules, terms and conditions and these Terms of Use, the Terms of Use shall control, except that the Xfire Service Privacy Policy, referenced below, supersedes any conflicting language in these Terms of Use and/or any other guidelines, rules, terms and conditions published in connection with the Service with respect to the subject matter covered by such privacy policy.
+
+MODIFICATION OF THESE TERMS OF USE; UPDATES
+Xfire may change the Terms of Use at any time and such changes shall be effective immediately. You are responsible for regularly reviewing the Terms of Use. The most recent version of the Terms of Use can be found at http://www.xfire.com/xf/terms.php. Your continued use of the Service affirms your agreement to the Terms of Use and any changes.
+
+Xfire is not obligated to provide updates or improvements to the Service. However, if Xfire, in its sole discretion, updates or improves the Service, these Terms of Use shall apply to such updates and improvements unless expressly noted otherwise.
+
+CLIENT SOFTWARE USE LIMITATION
+YOU MAY ONLY USE XFIRE CLIENT SOFTWARE OR AUTHORIZED THIRD-PARTY SOFTWARE TO ACCESS AND/OR USE THE SERVICE. You may not use any software or services in conjunction with the Xfire software or authorized third-party software which modifies or reroutes, or attempts to modify or reroute, the Service. You may not authorize any third party to access and/or use the Service on your behalf using any automated process such as a BOT, a spider or periodic caching of information stored by the Xfire Service on your behalf without a separate written agreement with Xfire. You may not use any software or hardware that reduces the number of users directly accessing or using the Service (sometimes called 'multiplexing' or 'pooling' software or hardware).
+
+You may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information, software, products or services that are part of the Service except as expressly provided in these Terms of Use.
+
+NO UNLAWFUL OR PROHIBITED USE; RESPONSIBILITY FOR YOUR ACCOUNT
+As a condition of your use of the Service, you will not use the Service for any purpose that is unlawful or prohibited by these Terms of Use. You may not use the Service in any manner that could damage, disable, overburden, or impair the Service or interfere with any other party's use and enjoyment of it. You may not attempt to gain unauthorized access to any account, computer systems or networks associated with the Service or to otherwise interfere with or disrupt any accounts, computer systems or networks connected to the Service. You may not obtain or attempt to obtain any materials or information through any means not intentionally made available or provided for through the Service. You may not use access to the Service to obtain information necessary for you to design, develop or update unauthorized software that you use or provide to others to use to access the Service. You may not charge others to use the Service either directly or indirectly without the express written agreement of Xfire.
+Subject to these Terms of Use, you may use the Service within your commercial organization, but you may not use the Service to advertise or offer to buy or sell any goods or services, or to run a business or commercial entity without the express written agreement of Xfire.
+You agree to use the Service only to send, receive, and transfer appropriate messages and material. By way of example, and not as a limitation, you agree that when using the Service, you will not:
+
+
+• Use the Service in connection with surveys, contests, pyramid schemes, chain letters, junk email, spamming or any duplicative, bulk or unsolicited messages (commercial or otherwise). 
+
+• Defame, abuse, harass, stalk, threaten or otherwise violate the legal rights (such as rights of privacy and publicity) of others. 
+
+• Create a false identity for the purpose of misleading others. 
+
+• Publish, transfer, distribute or disseminate any inappropriate, profane, defamatory, obscene, indecent or unlawful topic, name, material or information. 
+
+• Transfer, stream, or otherwise make available, files or other material that contain images, photographs, software or other material protected by intellectual property laws, including, by way of example, and not as limitation, copyright or trademark laws (or by rights of privacy or publicity) unless you own or control the rights thereto or have received all necessary consents to do the same. 
+
+• Use any material or information, including images or photographs, which is made available through the Service in any manner that infringes any copyright, trademark, patent, trade secret, or other proprietary right of any party. 
+
+• Transfer, stream or otherwise make available, files or other material that contain viruses, Trojan horses, worms, time bombs, cancelbots, corrupted files, or any other similar software or programs that may damage the operation of another's computer or property of another. 
+
+• Download any file or other material transferred by another user of the Service that you know, or reasonably should know, cannot be legally distributed in such manner. 
+
+• Use, download or otherwise copy, or provide (whether or not for a fee) to a person or entity any directory of users of the Service or other user or usage information or any portion thereof. 
+
+• Falsify or delete any author attributions, legal or other proper notices or proprietary designations or labels of the origin or source of software or other material contained in a file that is transferred. 
+
+• Violate any code of conduct or other guidelines which may be applicable to the Service. 
+
+• Use any portion of the Service to harvest or otherwise collect information about others, including e-mail addresses. 
+
+Xfire reserves the right at all times to monitor communications on the Service and disclose any information Xfire deems necessary to (i) ensure your compliance with this Agreement; (ii) satisfy any applicable law, regulation or legal process; or (iii) protect the rights, property, and interests of Xfire, its employees or the public. Xfire also reserves the right to edit, refuse to transfer or to remove any information or materials, in whole or in part, in Xfire's sole discretion.
+
+Always use caution when giving out any personally identifiable information about yourself or your children in the Service. Xfire does not control or endorse the content, messages or information exchanged by means of the Service and, therefore, Xfire specifically disclaims any liability with regard to the Service and any actions resulting from your participation in the Service.
+
+You are responsible for all activities that occur in your Service account. You agree to notify Xfire immediately of any unauthorized use of your account or breach in security known to you related to the Service.
+
+
+PRIVACY
+See the Xfire Service Privacy Statement at http://www.xfire.com/xf/privacy.php for disclosures relating to the collection and use of your information.
+
+
+INTERACTION WITH THIRD PARTY SITES AND SERVICES
+The Service may allow you to interact with third-party Web sites and Web services ("Link(s)"). The Links are not under the control of Xfire and Xfire is not responsible for the contents of any Links, including without limitation any link contained in a Link, or any changes or updates to a Link. Xfire is not responsible for any form of transmission received from any Link, nor is Xfire responsible if the Link is not working appropriately. Xfire is providing these Links to you only as a convenience, and the inclusion of any Link does not imply endorsement by Xfire of the Link or any association with its operators. You are responsible for viewing and abiding by any privacy statements and terms of use posted in connection with the Links.
+
+You are solely responsible for any dealings with third parties (including advertisers) who support the Service, including the delivery of and payment for goods and services.
+
+TERMS OF USE FOR SERVICE-ENABLED PROPERTIES
+For the terms and conditions governing your use of any Xfire or authorized third party Web site or service that enables you to use the Service other than the Service itself ("Service-Enabled Properties"), please refer to the applicable Terms of Use for such Service-Enabled Properties.
+
+SOFTWARE AND CONTENT AVAILABLE ON THE SERVICE
+All Xfire content and software (if any) that is made available to view and/or download in connection with the Service ("Software") is owned by and is the copyrighted work of Xfire and/or its suppliers and is licensed, not sold. Your use of the Software is governed by the terms of the license agreement, if any, which accompanies or is included with the Software ("License Agreement"). You may not install or use any Software that is accompanied by or includes a License Agreement unless you first agree to the License Agreement terms. For any Software not accompanied by a license agreement, Xfire hereby grants to you, the user, a non-exclusive, revocable, personal, non-transferable license to use the Software solely in connection with the Service in accordance with these Terms of Use. You may not lend, lease, rent or sublicense the Software or any aspect of the Service.
+
+You will not disassemble, decompile, or reverse engineer the Software. All Software is protected by copyright laws and international treaty provisions. Any unauthorized reproduction or redistribution of the Software is expressly prohibited by law, and may result in severe civil and criminal penalties. WITHOUT LIMITING THE FOREGOING, COPYING OR REPRODUCTION OF THE SOFTWARE TO ANY OTHER SERVER OR LOCATION FOR FURTHER REPRODUCTION OR REDISTRIBUTION IS EXPRESSLY PROHIBITED. THE SOFTWARE IS WARRANTED, IF AT ALL, ONLY ACCORDING TO THE TERMS OF THE LICENSE AGREEMENT. You acknowledge that the Software, and any accompanying documentation and/or technical information, is subject to applicable export control laws and regulations of the U.S.A. You agree not to export or re-export the Software, directly or indirectly, to any countries that are subject to U.S.A. export restrictions.
+
+Your license to use the Software with the Service terminates when you terminate your use of the Service. Your license to use the Software with the Service may also terminate if Xfire, in its sole discretion, modifies the Service to no longer support such Software.
+
+NO WARRANTIES; LIABILITY DISCLAIMER; EXCLUSIVE REMEDY
+XFIRE PROVIDES THE SERVICE AND THE SOFTWARE "AS IS," "WITH ALL FAULTS" AND "AS AVAILABLE," AND THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH YOU. XFIRE, ITS AFFILIATES, ITS RESELLERS, DISTRIBUTORS, SERVICE PROVIDERS AND/OR SUPPLIERS (COLLECTIVELY, THE "XFIRE PARTIES") MAKE NO WARRANTIES. THE XFIRE PARTIES DISCLAIM ANY AND ALL WARRANTIES, EXPRESS, STATUTORY AND IMPLIED, INCLUDING WITHOUT LIMITATION (1) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, ACCURACY, TITLE, QUIET ENJOYMENT, NO ENCUMBRANCES, NO LIENS AND NON-INFRINGEMENT, (2) WARRANTIES ARISING THROUGH COURSE OF DEALING OR USAGE OF TRADE, AND (3) WARRANTIES THAT ACCESS TO OR USE OF THE SERVICE WILL BE UNINTERRUPTED OR ERROR-FREE. THERE ARE NO WARRANTIES THAT EXTEND BEYOND THE FACE OF THIS AGREEMENT. XFIRE MAY CHANGE THE SERVICE OR THE FEATURES IN ANY WAY, AND AT ANY TIME AND FOR ANY REASON.
+
+IN NO EVENT SHALL ANY OF THE XFIRE PARTIES BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES ARISING OUT OF, BASED ON, OR RESULTING FROM THIS AGREEMENT OR YOUR USE OF THE SERVICE, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, WITH THE DELAY OR INABILITY TO USE THE SERVICE, THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, OR FOR ANY INFORMATION, SOFTWARE, PRODUCTS, OR SERVICES OBTAINED THROUGH THE SERVICE, OR OTHERWISE ARISING OUT OF THE USE OF THE SERVICE, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF XFIREOR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
+
+IF YOU ARE DISSATISFIED WITH ANY PORTION OF THE SERVICE, OR WITH ANY OF THESE TERMS OF USE, YOUR SOLE AND EXCLUSIVE REMEDY IS TO DISCONTINUE USING THE SERVICE.
+
+INDEMNITY
+You agree to indemnify and hold Xfire, its officers, and employees, harmless from any claim or demand, including reasonable attorneys' fees, made by any third party due to or arising out of your use of the Services, the violation of these Terms of Use by you, or the infringement by you, or other user of the Services using your computer or identity, of any intellectual property or other right of any person or entity.
+
+CUSTOMER SUPPORT
+Xfire may, but is not required to, provide you with customer support ("Support"). Unless you have entered into a separate written support agreement with Xfire with respect to the Service, Xfire may terminate any Support it provides at any time in its sole discretion.
+
+Authorized third-party software that uses the Service is not supported by Xfire and you should contact the provider of such software for support, if any.
+
+TERMINATION/ACCESS RESTRICTION
+Unless you, or a third party on your behalf, have entered into a separate written agreement with Xfire that modifies these Terms of Use, Xfire reserves the right, in its sole discretion, to terminate your access to and use of the Service or any portion thereof at any time, without notice. Also, unless you or a third party on your behalf have entered into a separate agreement with Xfire, Xfire may terminate or suspend your access to the Service for inactivity, which is defined as failing to log onto the Service for an extended period of time, as determined by Xfire.
+ELECTRONIC NOTICES
+You consent to Xfire providing you any information regarding the Service in electronic form. Xfire may provide such information to you via e-mail at the e-mail address you specified when you registered for the Service, by instant message to your account, or by access to a Xfire web site. As long as you access and use the Service, you will have the necessary software and hardware to receive such notices. If you do not consent to receive any notices electronically, you must discontinue your use of the Service.
+
+GENERAL
+If you reside in the United States, claims for enforcement, breach or violation of duties or rights under these Terms of Use are governed by the laws of the State of California, without reference to conflict of laws principles. All other claims, including, without limitation, claims under or for violation of state consumer protection laws, unfair competition laws, and in tort, are governed by the laws of your state of residence in the United States. If you reside outside of the United States, these Terms of Use are governed by the laws of the State of California, without reference to conflict of laws principles. You hereby irrevocably consent to the exclusive jurisdiction and venue of courts in San Mateo County, California, U.S.A. in all disputes arising out of or relating to the use of the Service.
+
+YOU AND XFIRE AGREE THAT ANY CAUSE OF ACTION ARISING OUT OF OR RELATED TO THE SERVICE MUST COMMENCE WITHIN ONE (1) YEAR AFTER THE CAUSE OF ACTION ACCRUES. OTHERWISE, SUCH CAUSE OF ACTION IS PERMANENTLY BARRED.
+
+Xfire may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in any Web pages that are part of the Service. Except as expressly provided in these Terms of Use, the furnishing of such Web pages to you does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Any rights not expressly granted herein are reserved.
+
+June 2004
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/xfiregameclient.cpp	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,121 @@
+/* This file is NOT open source. See "license.txt" to read the full license provided with the Xfire SDK. */
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tlhelp32.h>
+
+#include "xfiregameclient.h"
+
+static HMODULE g_toucan_dll = NULL;
+static void HelperInit();
+static HMODULE HelperGetToucanDLL();
+
+typedef int (*XfireSetCustomGameDataAFunction)(int , const char **, const char **);
+typedef int (*XfireSetCustomGameDataWFunction)(int , const wchar_t **, const wchar_t **);
+typedef int (*XfireSetCustomGameDataUTF8Function)(int , const char **, const char **);
+
+static XfireSetCustomGameDataAFunction ptr_XfireSetCustomGameDataA = NULL;
+static XfireSetCustomGameDataWFunction ptr_XfireSetCustomGameDataW = NULL;
+static XfireSetCustomGameDataUTF8Function ptr_XfireSetCustomGameDataUTF8 = NULL;
+
+/* make sure we are going to call the ANSI version */
+#ifdef MODULEENTRY32
+#undef MODULEENTRY32
+#endif
+
+#ifdef Module32First
+#undef Module32First
+#endif
+
+#ifdef Module32Next
+#undef Module32Next
+#endif
+
+
+int XfireIsLoaded()
+{
+	HelperInit();
+	if (ptr_XfireSetCustomGameDataA &&
+		ptr_XfireSetCustomGameDataW &&
+		ptr_XfireSetCustomGameDataUTF8)
+		return 1;
+	return 0;
+}
+
+int XfireSetCustomGameDataA(int num_keys, const char **keys, const char **values)
+{
+	HelperInit();
+	if (ptr_XfireSetCustomGameDataA)
+		return ptr_XfireSetCustomGameDataA(num_keys, keys, values);
+	return 1;
+}
+
+int XfireSetCustomGameDataW(int num_keys, const wchar_t **keys, const wchar_t **values)
+{
+	HelperInit();
+	if (ptr_XfireSetCustomGameDataW)
+		return ptr_XfireSetCustomGameDataW(num_keys, keys, values);
+	return 1;
+}
+
+int XfireSetCustomGameDataUTF8(int num_keys, const char **keys, const char **values)
+{
+	HelperInit();
+	if (ptr_XfireSetCustomGameDataUTF8)
+		return ptr_XfireSetCustomGameDataUTF8(num_keys, keys, values);
+	return 1;
+}
+
+/* ------------------------------------------------------------------------- */
+static void HelperInit()
+{
+	if (!ptr_XfireSetCustomGameDataA ||
+		!ptr_XfireSetCustomGameDataW ||
+		!ptr_XfireSetCustomGameDataUTF8)
+	{
+		HMODULE toucan_dll = HelperGetToucanDLL();
+		if (toucan_dll)
+		{
+			ptr_XfireSetCustomGameDataA = (XfireSetCustomGameDataAFunction)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataA_V1");
+			ptr_XfireSetCustomGameDataW = (XfireSetCustomGameDataWFunction)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataW_V1");
+			ptr_XfireSetCustomGameDataUTF8 = (XfireSetCustomGameDataUTF8Function)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataUTF8_V1");
+		}
+	}
+}
+
+
+static HMODULE HelperGetToucanDLL()
+{
+	if (g_toucan_dll)
+		return g_toucan_dll;
+
+	/*
+	** We need to enumerate the DLLs loaded to find toucan dll.
+	** This is done because the toucan dll changes with each update.
+	** The toucan dll has the following format. "xfire_toucan_{BUILD_NUMBER}.dll"
+	** We simply try to find a dll w/ the prefix "xfire_toucan"
+	*/
+	HANDLE snapshot_handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
+	if (snapshot_handle != INVALID_HANDLE_VALUE)
+	{
+		MODULEENTRY32 module_entry;
+		module_entry.dwSize = sizeof(MODULEENTRY32);
+
+		BOOL result = Module32First(snapshot_handle, &module_entry);
+		char module_name[] = "xfire_toucan";
+		DWORD module_name_len = sizeof(module_name)-1;
+		while (result)
+		{
+			if (CompareStringA(LOCALE_USER_DEFAULT, NORM_IGNORECASE, module_entry.szModule, module_name_len, module_name, module_name_len) == CSTR_EQUAL)
+			{
+				g_toucan_dll = module_entry.hModule;
+				break;
+			}
+			result = Module32Next(snapshot_handle, &module_entry);
+		}
+
+		CloseHandle(snapshot_handle);
+	}
+
+	return g_toucan_dll;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/util/platform/xfiregameclient.h	Mon Jan 14 12:35:01 2013 +0100
@@ -0,0 +1,49 @@
+/* This file is NOT open source. See "license.txt" to read the full license provided with the Xfire SDK. */
+
+#ifndef __XFIREGAMECLIENT_H__
+#define __XFIREGAMECLIENT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+**  XfireIsLoaded()
+**
+**  returns 1 if application can talk to Xfire, 0 otherwise
+*/
+int XfireIsLoaded();
+
+/*
+**  XfireSetCustomGameDataA()
+**
+**  ANSI version to tell xfire of custom game data
+*/
+int XfireSetCustomGameDataA(int num_keys, const char **keys, const char **values);
+
+/*
+**  XfireSetCustomGameDataA()
+**
+**  UNICODE version to tell xfire of custom game data
+*/
+int XfireSetCustomGameDataW(int num_keys, const wchar_t **keys, const wchar_t **values);
+
+/*
+**  XfireSetCustomGameDataUTF8()
+**
+**  UTF8 version to tell xfire of custom game data
+*/
+int XfireSetCustomGameDataUTF8(int num_keys, const char **keys, const char **values);
+
+#ifdef UNICODE
+#define XfireSetCustomGameData XfireSetCustomGameDataW
+#else
+#define XfireSetCustomGameData XfireSetCustomGameDataA
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XFIREGAMECLIENT_H__ */
--- a/QTfrontend/xfire.cpp	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include <string>
-#include <cstring>
-#include <stdio.h>
-
-#include "xfire.h"
-#include "../misc/xfire/xfiregameclient.h"
-
-#ifdef USE_XFIRE
-// use_xfire: stores if xfire is loaded and functions should do something at all
-bool use_xfire = false;
-char *keys[XFIRE_KEY_COUNT];
-char *values[XFIRE_KEY_COUNT];
-
-// xfire_init(): used to initialize all variables and set their default values
-void xfire_init(void)
-{
-    if(use_xfire)
-        return;
-    use_xfire = XfireIsLoaded() == 1;
-
-    if(!use_xfire)
-        return;
-
-    for(int i = 0; i < XFIRE_KEY_COUNT; i++)
-    {
-        keys[i] = new char[256];
-        values[i] = new char[256];
-        strcpy(keys[i], "");
-        strcpy(values[i], "");
-    }
-
-    strcpy(keys[XFIRE_NICKNAME], "Nickname");
-    strcpy(keys[XFIRE_ROOM], "Room");
-    strcpy(keys[XFIRE_SERVER], "Server");
-    strcpy(keys[XFIRE_STATUS], "Status");
-    xfire_update();
-}
-
-// xfire_free(): used to free up ressources used etc.
-void xfire_free(void)
-{
-    if(!use_xfire)
-        return;
-
-    for(int i = 0; i < XFIRE_KEY_COUNT; i++)
-    {
-        delete [] keys[i];
-        delete [] values[i];
-    }
-}
-
-// xfire_setvalue(): set a specific value
-void xfire_setvalue(const XFIRE_KEYS status, const char *value)
-{
-    if(!use_xfire || strlen(value) > 255)
-        return;
-    strcpy(values[status], value);
-}
-
-// xfire_update(): submits current values to the xfire app
-void xfire_update(void)
-{
-    if(!use_xfire)
-        return;
-    XfireSetCustomGameDataA(XFIRE_KEY_COUNT, (const char**)keys, (const char**)values);
-}
-#endif // USE_XFIRE
--- a/QTfrontend/xfire.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifndef XFIRE_H
-#define XFIRE_H
-
-
-#ifdef USE_XFIRE
-enum XFIRE_KEYS
-{
-    XFIRE_STATUS = 0,
-    XFIRE_NICKNAME,
-    XFIRE_SERVER,
-    XFIRE_ROOM,
-    XFIRE_KEY_COUNT,
-};
-
-void xfire_init(void);
-void xfire_free(void);
-void xfire_setvalue(const XFIRE_KEYS status, const char *value);
-void xfire_update(void);
-#endif
-
-#endif // XFIRE_H
--- a/misc/xfire/Xfire Game SDK.url	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-[{000214A0-0000-0000-C000-000000000046}]
-Prop3=19,2
-[InternetShortcut]
-URL=http://www.xfire.com/cms/xf_game_sdk
-IDList=
--- a/misc/xfire/license.txt	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-Terms and Conditions
-AGREEMENT BETWEEN USER AND XFIRE INC.
-This is a legal agreement between you and Xfire Inc. ("Xfire") with respect to your access and use of the Xfire Service, which may also include Xfire software, content and related documentation and information (collectively, the "Service"). You must accept without modification all of the terms, conditions, and notices contained in these Terms of Use in order to access and/or use the Service (collectively, the "Terms of Use" or "Agreement"). If you do not accept these Terms of Use in their entirety, you may not access or use the Service. 
-
-Portions of the Service may be governed by posted guidelines, rules, or other terms and conditions. All such guidelines, rules, terms and conditions are hereby incorporated by reference into these Terms of Use. In the event of a conflict between such other guidelines, rules, terms and conditions and these Terms of Use, the Terms of Use shall control, except that the Xfire Service Privacy Policy, referenced below, supersedes any conflicting language in these Terms of Use and/or any other guidelines, rules, terms and conditions published in connection with the Service with respect to the subject matter covered by such privacy policy.
-
-MODIFICATION OF THESE TERMS OF USE; UPDATES
-Xfire may change the Terms of Use at any time and such changes shall be effective immediately. You are responsible for regularly reviewing the Terms of Use. The most recent version of the Terms of Use can be found at http://www.xfire.com/xf/terms.php. Your continued use of the Service affirms your agreement to the Terms of Use and any changes.
-
-Xfire is not obligated to provide updates or improvements to the Service. However, if Xfire, in its sole discretion, updates or improves the Service, these Terms of Use shall apply to such updates and improvements unless expressly noted otherwise.
-
-CLIENT SOFTWARE USE LIMITATION
-YOU MAY ONLY USE XFIRE CLIENT SOFTWARE OR AUTHORIZED THIRD-PARTY SOFTWARE TO ACCESS AND/OR USE THE SERVICE. You may not use any software or services in conjunction with the Xfire software or authorized third-party software which modifies or reroutes, or attempts to modify or reroute, the Service. You may not authorize any third party to access and/or use the Service on your behalf using any automated process such as a BOT, a spider or periodic caching of information stored by the Xfire Service on your behalf without a separate written agreement with Xfire. You may not use any software or hardware that reduces the number of users directly accessing or using the Service (sometimes called 'multiplexing' or 'pooling' software or hardware).
-
-You may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information, software, products or services that are part of the Service except as expressly provided in these Terms of Use.
-
-NO UNLAWFUL OR PROHIBITED USE; RESPONSIBILITY FOR YOUR ACCOUNT
-As a condition of your use of the Service, you will not use the Service for any purpose that is unlawful or prohibited by these Terms of Use. You may not use the Service in any manner that could damage, disable, overburden, or impair the Service or interfere with any other party's use and enjoyment of it. You may not attempt to gain unauthorized access to any account, computer systems or networks associated with the Service or to otherwise interfere with or disrupt any accounts, computer systems or networks connected to the Service. You may not obtain or attempt to obtain any materials or information through any means not intentionally made available or provided for through the Service. You may not use access to the Service to obtain information necessary for you to design, develop or update unauthorized software that you use or provide to others to use to access the Service. You may not charge others to use the Service either directly or indirectly without the express written agreement of Xfire.
-Subject to these Terms of Use, you may use the Service within your commercial organization, but you may not use the Service to advertise or offer to buy or sell any goods or services, or to run a business or commercial entity without the express written agreement of Xfire.
-You agree to use the Service only to send, receive, and transfer appropriate messages and material. By way of example, and not as a limitation, you agree that when using the Service, you will not:
-
-
-• Use the Service in connection with surveys, contests, pyramid schemes, chain letters, junk email, spamming or any duplicative, bulk or unsolicited messages (commercial or otherwise). 
-
-• Defame, abuse, harass, stalk, threaten or otherwise violate the legal rights (such as rights of privacy and publicity) of others. 
-
-• Create a false identity for the purpose of misleading others. 
-
-• Publish, transfer, distribute or disseminate any inappropriate, profane, defamatory, obscene, indecent or unlawful topic, name, material or information. 
-
-• Transfer, stream, or otherwise make available, files or other material that contain images, photographs, software or other material protected by intellectual property laws, including, by way of example, and not as limitation, copyright or trademark laws (or by rights of privacy or publicity) unless you own or control the rights thereto or have received all necessary consents to do the same. 
-
-• Use any material or information, including images or photographs, which is made available through the Service in any manner that infringes any copyright, trademark, patent, trade secret, or other proprietary right of any party. 
-
-• Transfer, stream or otherwise make available, files or other material that contain viruses, Trojan horses, worms, time bombs, cancelbots, corrupted files, or any other similar software or programs that may damage the operation of another's computer or property of another. 
-
-• Download any file or other material transferred by another user of the Service that you know, or reasonably should know, cannot be legally distributed in such manner. 
-
-• Use, download or otherwise copy, or provide (whether or not for a fee) to a person or entity any directory of users of the Service or other user or usage information or any portion thereof. 
-
-• Falsify or delete any author attributions, legal or other proper notices or proprietary designations or labels of the origin or source of software or other material contained in a file that is transferred. 
-
-• Violate any code of conduct or other guidelines which may be applicable to the Service. 
-
-• Use any portion of the Service to harvest or otherwise collect information about others, including e-mail addresses. 
-
-Xfire reserves the right at all times to monitor communications on the Service and disclose any information Xfire deems necessary to (i) ensure your compliance with this Agreement; (ii) satisfy any applicable law, regulation or legal process; or (iii) protect the rights, property, and interests of Xfire, its employees or the public. Xfire also reserves the right to edit, refuse to transfer or to remove any information or materials, in whole or in part, in Xfire's sole discretion.
-
-Always use caution when giving out any personally identifiable information about yourself or your children in the Service. Xfire does not control or endorse the content, messages or information exchanged by means of the Service and, therefore, Xfire specifically disclaims any liability with regard to the Service and any actions resulting from your participation in the Service.
-
-You are responsible for all activities that occur in your Service account. You agree to notify Xfire immediately of any unauthorized use of your account or breach in security known to you related to the Service.
-
-
-PRIVACY
-See the Xfire Service Privacy Statement at http://www.xfire.com/xf/privacy.php for disclosures relating to the collection and use of your information.
-
-
-INTERACTION WITH THIRD PARTY SITES AND SERVICES
-The Service may allow you to interact with third-party Web sites and Web services ("Link(s)"). The Links are not under the control of Xfire and Xfire is not responsible for the contents of any Links, including without limitation any link contained in a Link, or any changes or updates to a Link. Xfire is not responsible for any form of transmission received from any Link, nor is Xfire responsible if the Link is not working appropriately. Xfire is providing these Links to you only as a convenience, and the inclusion of any Link does not imply endorsement by Xfire of the Link or any association with its operators. You are responsible for viewing and abiding by any privacy statements and terms of use posted in connection with the Links.
-
-You are solely responsible for any dealings with third parties (including advertisers) who support the Service, including the delivery of and payment for goods and services.
-
-TERMS OF USE FOR SERVICE-ENABLED PROPERTIES
-For the terms and conditions governing your use of any Xfire or authorized third party Web site or service that enables you to use the Service other than the Service itself ("Service-Enabled Properties"), please refer to the applicable Terms of Use for such Service-Enabled Properties.
-
-SOFTWARE AND CONTENT AVAILABLE ON THE SERVICE
-All Xfire content and software (if any) that is made available to view and/or download in connection with the Service ("Software") is owned by and is the copyrighted work of Xfire and/or its suppliers and is licensed, not sold. Your use of the Software is governed by the terms of the license agreement, if any, which accompanies or is included with the Software ("License Agreement"). You may not install or use any Software that is accompanied by or includes a License Agreement unless you first agree to the License Agreement terms. For any Software not accompanied by a license agreement, Xfire hereby grants to you, the user, a non-exclusive, revocable, personal, non-transferable license to use the Software solely in connection with the Service in accordance with these Terms of Use. You may not lend, lease, rent or sublicense the Software or any aspect of the Service.
-
-You will not disassemble, decompile, or reverse engineer the Software. All Software is protected by copyright laws and international treaty provisions. Any unauthorized reproduction or redistribution of the Software is expressly prohibited by law, and may result in severe civil and criminal penalties. WITHOUT LIMITING THE FOREGOING, COPYING OR REPRODUCTION OF THE SOFTWARE TO ANY OTHER SERVER OR LOCATION FOR FURTHER REPRODUCTION OR REDISTRIBUTION IS EXPRESSLY PROHIBITED. THE SOFTWARE IS WARRANTED, IF AT ALL, ONLY ACCORDING TO THE TERMS OF THE LICENSE AGREEMENT. You acknowledge that the Software, and any accompanying documentation and/or technical information, is subject to applicable export control laws and regulations of the U.S.A. You agree not to export or re-export the Software, directly or indirectly, to any countries that are subject to U.S.A. export restrictions.
-
-Your license to use the Software with the Service terminates when you terminate your use of the Service. Your license to use the Software with the Service may also terminate if Xfire, in its sole discretion, modifies the Service to no longer support such Software.
-
-NO WARRANTIES; LIABILITY DISCLAIMER; EXCLUSIVE REMEDY
-XFIRE PROVIDES THE SERVICE AND THE SOFTWARE "AS IS," "WITH ALL FAULTS" AND "AS AVAILABLE," AND THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH YOU. XFIRE, ITS AFFILIATES, ITS RESELLERS, DISTRIBUTORS, SERVICE PROVIDERS AND/OR SUPPLIERS (COLLECTIVELY, THE "XFIRE PARTIES") MAKE NO WARRANTIES. THE XFIRE PARTIES DISCLAIM ANY AND ALL WARRANTIES, EXPRESS, STATUTORY AND IMPLIED, INCLUDING WITHOUT LIMITATION (1) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, ACCURACY, TITLE, QUIET ENJOYMENT, NO ENCUMBRANCES, NO LIENS AND NON-INFRINGEMENT, (2) WARRANTIES ARISING THROUGH COURSE OF DEALING OR USAGE OF TRADE, AND (3) WARRANTIES THAT ACCESS TO OR USE OF THE SERVICE WILL BE UNINTERRUPTED OR ERROR-FREE. THERE ARE NO WARRANTIES THAT EXTEND BEYOND THE FACE OF THIS AGREEMENT. XFIRE MAY CHANGE THE SERVICE OR THE FEATURES IN ANY WAY, AND AT ANY TIME AND FOR ANY REASON.
-
-IN NO EVENT SHALL ANY OF THE XFIRE PARTIES BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES ARISING OUT OF, BASED ON, OR RESULTING FROM THIS AGREEMENT OR YOUR USE OF THE SERVICE, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, WITH THE DELAY OR INABILITY TO USE THE SERVICE, THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, OR FOR ANY INFORMATION, SOFTWARE, PRODUCTS, OR SERVICES OBTAINED THROUGH THE SERVICE, OR OTHERWISE ARISING OUT OF THE USE OF THE SERVICE, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF XFIREOR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
-
-IF YOU ARE DISSATISFIED WITH ANY PORTION OF THE SERVICE, OR WITH ANY OF THESE TERMS OF USE, YOUR SOLE AND EXCLUSIVE REMEDY IS TO DISCONTINUE USING THE SERVICE.
-
-INDEMNITY
-You agree to indemnify and hold Xfire, its officers, and employees, harmless from any claim or demand, including reasonable attorneys' fees, made by any third party due to or arising out of your use of the Services, the violation of these Terms of Use by you, or the infringement by you, or other user of the Services using your computer or identity, of any intellectual property or other right of any person or entity.
-
-CUSTOMER SUPPORT
-Xfire may, but is not required to, provide you with customer support ("Support"). Unless you have entered into a separate written support agreement with Xfire with respect to the Service, Xfire may terminate any Support it provides at any time in its sole discretion.
-
-Authorized third-party software that uses the Service is not supported by Xfire and you should contact the provider of such software for support, if any.
-
-TERMINATION/ACCESS RESTRICTION
-Unless you, or a third party on your behalf, have entered into a separate written agreement with Xfire that modifies these Terms of Use, Xfire reserves the right, in its sole discretion, to terminate your access to and use of the Service or any portion thereof at any time, without notice. Also, unless you or a third party on your behalf have entered into a separate agreement with Xfire, Xfire may terminate or suspend your access to the Service for inactivity, which is defined as failing to log onto the Service for an extended period of time, as determined by Xfire.
-ELECTRONIC NOTICES
-You consent to Xfire providing you any information regarding the Service in electronic form. Xfire may provide such information to you via e-mail at the e-mail address you specified when you registered for the Service, by instant message to your account, or by access to a Xfire web site. As long as you access and use the Service, you will have the necessary software and hardware to receive such notices. If you do not consent to receive any notices electronically, you must discontinue your use of the Service.
-
-GENERAL
-If you reside in the United States, claims for enforcement, breach or violation of duties or rights under these Terms of Use are governed by the laws of the State of California, without reference to conflict of laws principles. All other claims, including, without limitation, claims under or for violation of state consumer protection laws, unfair competition laws, and in tort, are governed by the laws of your state of residence in the United States. If you reside outside of the United States, these Terms of Use are governed by the laws of the State of California, without reference to conflict of laws principles. You hereby irrevocably consent to the exclusive jurisdiction and venue of courts in San Mateo County, California, U.S.A. in all disputes arising out of or relating to the use of the Service.
-
-YOU AND XFIRE AGREE THAT ANY CAUSE OF ACTION ARISING OUT OF OR RELATED TO THE SERVICE MUST COMMENCE WITHIN ONE (1) YEAR AFTER THE CAUSE OF ACTION ACCRUES. OTHERWISE, SUCH CAUSE OF ACTION IS PERMANENTLY BARRED.
-
-Xfire may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in any Web pages that are part of the Service. Except as expressly provided in these Terms of Use, the furnishing of such Web pages to you does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Any rights not expressly granted herein are reserved.
-
-June 2004
-
-
-
--- a/misc/xfire/xfiregameclient.cpp	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* This file is NOT open source. See "license.txt" to read the full license provided with the Xfire SDK. */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <tlhelp32.h>
-
-#include "xfiregameclient.h"
-
-static HMODULE g_toucan_dll = NULL;
-static void HelperInit();
-static HMODULE HelperGetToucanDLL();
-
-typedef int (*XfireSetCustomGameDataAFunction)(int , const char **, const char **);
-typedef int (*XfireSetCustomGameDataWFunction)(int , const wchar_t **, const wchar_t **);
-typedef int (*XfireSetCustomGameDataUTF8Function)(int , const char **, const char **);
-
-static XfireSetCustomGameDataAFunction ptr_XfireSetCustomGameDataA = NULL;
-static XfireSetCustomGameDataWFunction ptr_XfireSetCustomGameDataW = NULL;
-static XfireSetCustomGameDataUTF8Function ptr_XfireSetCustomGameDataUTF8 = NULL;
-
-/* make sure we are going to call the ANSI version */
-#ifdef MODULEENTRY32
-#undef MODULEENTRY32
-#endif
-
-#ifdef Module32First
-#undef Module32First
-#endif
-
-#ifdef Module32Next
-#undef Module32Next
-#endif
-
-
-int XfireIsLoaded()
-{
-	HelperInit();
-	if (ptr_XfireSetCustomGameDataA &&
-		ptr_XfireSetCustomGameDataW &&
-		ptr_XfireSetCustomGameDataUTF8)
-		return 1;
-	return 0;
-}
-
-int XfireSetCustomGameDataA(int num_keys, const char **keys, const char **values)
-{
-	HelperInit();
-	if (ptr_XfireSetCustomGameDataA)
-		return ptr_XfireSetCustomGameDataA(num_keys, keys, values);
-	return 1;
-}
-
-int XfireSetCustomGameDataW(int num_keys, const wchar_t **keys, const wchar_t **values)
-{
-	HelperInit();
-	if (ptr_XfireSetCustomGameDataW)
-		return ptr_XfireSetCustomGameDataW(num_keys, keys, values);
-	return 1;
-}
-
-int XfireSetCustomGameDataUTF8(int num_keys, const char **keys, const char **values)
-{
-	HelperInit();
-	if (ptr_XfireSetCustomGameDataUTF8)
-		return ptr_XfireSetCustomGameDataUTF8(num_keys, keys, values);
-	return 1;
-}
-
-/* ------------------------------------------------------------------------- */
-static void HelperInit()
-{
-	if (!ptr_XfireSetCustomGameDataA ||
-		!ptr_XfireSetCustomGameDataW ||
-		!ptr_XfireSetCustomGameDataUTF8)
-	{
-		HMODULE toucan_dll = HelperGetToucanDLL();
-		if (toucan_dll)
-		{
-			ptr_XfireSetCustomGameDataA = (XfireSetCustomGameDataAFunction)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataA_V1");
-			ptr_XfireSetCustomGameDataW = (XfireSetCustomGameDataWFunction)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataW_V1");
-			ptr_XfireSetCustomGameDataUTF8 = (XfireSetCustomGameDataUTF8Function)::GetProcAddress(toucan_dll, "ToucanSendGameClientDataUTF8_V1");
-		}
-	}
-}
-
-
-static HMODULE HelperGetToucanDLL()
-{
-	if (g_toucan_dll)
-		return g_toucan_dll;
-
-	/*
-	** We need to enumerate the DLLs loaded to find toucan dll.
-	** This is done because the toucan dll changes with each update.
-	** The toucan dll has the following format. "xfire_toucan_{BUILD_NUMBER}.dll"
-	** We simply try to find a dll w/ the prefix "xfire_toucan"
-	*/
-	HANDLE snapshot_handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
-	if (snapshot_handle != INVALID_HANDLE_VALUE)
-	{
-		MODULEENTRY32 module_entry;
-		module_entry.dwSize = sizeof(MODULEENTRY32);
-
-		BOOL result = Module32First(snapshot_handle, &module_entry);
-		char module_name[] = "xfire_toucan";
-		DWORD module_name_len = sizeof(module_name)-1;
-		while (result)
-		{
-			if (CompareStringA(LOCALE_USER_DEFAULT, NORM_IGNORECASE, module_entry.szModule, module_name_len, module_name, module_name_len) == CSTR_EQUAL)
-			{
-				g_toucan_dll = module_entry.hModule;
-				break;
-			}
-			result = Module32Next(snapshot_handle, &module_entry);
-		}
-
-		CloseHandle(snapshot_handle);
-	}
-
-	return g_toucan_dll;
-}
--- a/misc/xfire/xfiregameclient.h	Mon Jan 14 12:07:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* This file is NOT open source. See "license.txt" to read the full license provided with the Xfire SDK. */
-
-#ifndef __XFIREGAMECLIENT_H__
-#define __XFIREGAMECLIENT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-**  XfireIsLoaded()
-**
-**  returns 1 if application can talk to Xfire, 0 otherwise
-*/
-int XfireIsLoaded();
-
-/*
-**  XfireSetCustomGameDataA()
-**
-**  ANSI version to tell xfire of custom game data
-*/
-int XfireSetCustomGameDataA(int num_keys, const char **keys, const char **values);
-
-/*
-**  XfireSetCustomGameDataA()
-**
-**  UNICODE version to tell xfire of custom game data
-*/
-int XfireSetCustomGameDataW(int num_keys, const wchar_t **keys, const wchar_t **values);
-
-/*
-**  XfireSetCustomGameDataUTF8()
-**
-**  UTF8 version to tell xfire of custom game data
-*/
-int XfireSetCustomGameDataUTF8(int num_keys, const char **keys, const char **values);
-
-#ifdef UNICODE
-#define XfireSetCustomGameData XfireSetCustomGameDataW
-#else
-#define XfireSetCustomGameData XfireSetCustomGameDataA
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __XFIREGAMECLIENT_H__ */
--- a/project_files/hedgewars.pro	Mon Jan 14 12:07:51 2013 +0100
+++ b/project_files/hedgewars.pro	Mon Jan 14 12:35:01 2013 +0100
@@ -9,6 +9,7 @@
 INCLUDEPATH += ../QTfrontend/ui/dialog
 INCLUDEPATH += ../QTfrontend/net
 INCLUDEPATH += ../QTfrontend/util
+INCLUDEPATH += ../QTfrontend/util/platform
 INCLUDEPATH += ../misc/physfs/src
 INCLUDEPATH += ../misc/physfs/extras
 
@@ -243,13 +244,11 @@
     QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
     QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.6.sdk
 
-    OBJECTIVE_SOURCES += ../QTfrontend/*.m ../QTfrontend/*.mm
-    SOURCES += ../QTfrontend/AutoUpdater.cpp ../QTfrontend/InstallController.cpp \
+    OBJECTIVE_SOURCES += ../QTfrontend/util/platform/*.m ../QTfrontend/util/platform/*.mm
+    SOURCES += ../QTfrontend/util/platform/AutoUpdater.cpp
+			   ../QTfrontend/util/platform/InstallController.cpp \
                ../../build/QTfrontend/hwconsts.cpp
-    HEADERS += ../QTfrontend/M3InstallController.h ../QTfrontend/M3Panel.h \
-               ../QTfrontend/NSWorkspace_RBAdditions.h ../QTfrontend/AutoUpdater.h \
-               ../QTfrontend/CocoaInitializer.h ../QTfrontend/InstallController.h \
-               ../QTfrontend/SparkleAutoUpdater.h
+    HEADERS += ../QTfrontend/util/platform/*.h
 
     LIBS += -lobjc -framework AppKit -framework IOKit -framework Foundation -framework SDL -framework SDL_Mixer -framework Sparkle -DSPARKLE_ENABLED
     INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers /Library/Frameworks/SDL_Mixer.framework/Headers
@@ -259,9 +258,9 @@
 
 win32 {
     RC_FILE = ../QTfrontend/hedgewars.rc
-    SOURCES += ../QTfrontend/xfire.cpp
+    SOURCES += ../QTfrontend/util/platform/xfire.cpp ../QTfrontend/util/platform/xfiregameclient.cpp
+    LIBS += -L../misc/winutils/lib
     INCLUDEPATH += ../misc/winutils/include
-    LIBS += -L../misc/winutils/lib
 }
 
 !macx {