Frontend:
authorsmxx
Sat, 20 Feb 2010 09:33:20 +0000 (2010-02-20)
changeset 2830 571a9deffeac
parent 2829 dfaa6f918ad2
child 2831 797207d0c500
Frontend: * Added Xfire SDK files to /misc/xfire. See license.txt for further details.
QTfrontend/CMakeLists.txt
QTfrontend/xfire.cpp
misc/xfire/license.txt
misc/xfire/xfiregameclient.cpp
misc/xfire/xfiregameclient.h
--- a/QTfrontend/CMakeLists.txt	Fri Feb 19 02:19:47 2010 +0000
+++ b/QTfrontend/CMakeLists.txt	Sat Feb 20 09:33:20 2010 +0000
@@ -91,7 +91,7 @@
 
 #xfire integration
 if(WIN32)
-	set(hwfr_src ${hwfr_src} xfire.cpp xfiregameclient.cpp)
+	set(hwfr_src ${hwfr_src} xfire.cpp ../misc/xfire/xfiregameclient.cpp)
 endif(WIN32)
 
 if(MINGW)
--- a/QTfrontend/xfire.cpp	Fri Feb 19 02:19:47 2010 +0000
+++ b/QTfrontend/xfire.cpp	Sat Feb 20 09:33:20 2010 +0000
@@ -20,7 +20,7 @@
 #include <stdio.h>
 
 #include "xfire.h"
-#include "xfiregameclient.h"
+#include "../misc/xfire/xfiregameclient.h"
 
 // use_xfire: stores if xfire is loaded and functions should do something at all
 bool use_xfire = false;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/xfire/license.txt	Sat Feb 20 09:33:20 2010 +0000
@@ -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/misc/xfire/xfiregameclient.cpp	Sat Feb 20 09:33:20 2010 +0000
@@ -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;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/xfire/xfiregameclient.h	Sat Feb 20 09:33:20 2010 +0000
@@ -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__ */