summaryrefslogtreecommitdiff
path: root/src/unix
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix')
-rwxr-xr-xsrc/unix/MacSupport/SLA-dmg.sh30
-rw-r--r--src/unix/MacSupport/SLA.r260
-rwxr-xr-xsrc/unix/MacSupport/ioquake3.icnsbin0 -> 35224 bytes
-rw-r--r--src/unix/unix_main.c42
-rw-r--r--src/unix/unix_net.c33
5 files changed, 355 insertions, 10 deletions
diff --git a/src/unix/MacSupport/SLA-dmg.sh b/src/unix/MacSupport/SLA-dmg.sh
new file mode 100755
index 00000000..51c6e429
--- /dev/null
+++ b/src/unix/MacSupport/SLA-dmg.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# This script appends a SLA.r (Software License Agreement) resource to a .dmg
+#
+# usage is './SLA-dmg.sh SLA.r /path/to/ioquake3.dmg'
+#
+
+if [ "x$1" = "x" ] || [ "x$2" = "x"]; then
+ echo "usage: ./SLA-dmg.sh SLAFILE DMGFILE"
+ exit 1;
+fi
+
+if [ ! -r $1 ]; then
+ echo "$1 is not a readable .r file"
+ exit 1;
+fi
+if [ ! -w $2 ]; then
+ echo "$2 is not writable .dmg file"
+ exit 1;
+fi
+
+hdiutil convert -format UDCO -o tmp.dmg $2 || exit 1
+hdiutil unflatten tmp.dmg || exit 1
+/Developer/Tools/Rez /Developer/Headers/FlatCarbon/*.r $1 -a -o tmp.dmg \
+ || exit 1
+hdiutil flatten tmp.dmg || exit 1
+hdiutil internet-enable -yes tmp.dmg || exit 1
+mv tmp.dmg $2 || (echo "Could not copy tmp.dmg to $2" && exit 1)
+rm tmp.dmg
+echo "SLA $1 successfully added to $2"
diff --git a/src/unix/MacSupport/SLA.r b/src/unix/MacSupport/SLA.r
new file mode 100644
index 00000000..e5edaf0e
--- /dev/null
+++ b/src/unix/MacSupport/SLA.r
@@ -0,0 +1,260 @@
+data 'LPic' (5000) {
+ $"0002 0011 0003 0001 0000 0000 0002 0000"
+ $"0008 0003 0000 0001 0004 0000 0004 0005"
+ $"0000 000E 0006 0001 0005 0007 0000 0007"
+ $"0008 0000 0047 0009 0000 0034 000A 0001"
+ $"0035 000B 0001 0020 000C 0000 0011 000D"
+ $"0000 005B 0004 0000 0033 000F 0001 000C"
+ $"0010 0000 000B 000E 0000"
+};
+
+
+data 'TEXT' (5002, "English") {
+"LIMITED USE SOFTWARE LICENSE AGREEMENT\n"
+"\n"
+"\n"
+"\n"
+"This Limited Use Software License Agreement (the \"Agreement\") is a legal"
+"agreement between you, the end-user, and Id Software, Inc. (\"ID\"). BY"
+"CONTINUING THE INSTALLATION OF THIS GAME DEMO PROGRAM ENTITLED QUAKE III:"
+"ARENA (THE \"SOFTWARE\"), BY LOADING OR RUNNING THE SOFTWARE, OR BY PLACING"
+"OR COPYING THE SOFTWARE ONTO YOUR COMPUTER HARD DRIVE, COMPUTER RAM OR"
+"OTHER STORAGE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF THIS "
+"AGREEMENT.\n"
+"\n"
+"\n"
+"\n"
+"1. Grant of License. Subject to the terms and provisions of this"
+"Agreement, ID grants to you the non-exclusive and limited right to use the"
+"Software only in executable or object code form. The term \"Software\""
+"includes all elements of the Software, including, without limitation, data"
+"files and screen displays. You are not receiving any ownership or"
+"proprietary right, title or interest in or to the Software or the "
+"copyright, trademarks, or other rights related thereto. For purposes of"
+"this section, \"use\" means loading the Software into RAM and/or onto "
+"computer hard drive, as well as installation of the Software on a hard"
+"disk or other storage device and means the uses permitted in section 3."
+"hereinbelow. You agree that the Software will not be shipped,"
+"transferred or exported into any country in violation of the U.S. Export"
+"Administration Act (or any other law governing such matters) by you or"
+"anyone at your direction and that you will not utilize and will not"
+"authorize anyone to utilize, in any other manner, the Software in"
+"violation of any applicable law. The Software may not be downloaded"
+"or otherwise exported or exported into (or to a national or resident"
+"of) any country to which the U.S. has embargoed goods or to anyone"
+"or into any country who/which are prohibited, by applicable law, from"
+"receiving such property."
+"\n"
+"\n"
+"\n"
+"2. Prohibitions. You, either directly or indirectly, shall not do"
+"any of the following acts:"
+"\n"
+"\n"
+"\n"
+"a. rent the Software;"
+"\n"
+"\n"
+"\n"
+"b. sell the Software;"
+"\n"
+"\n"
+"\n"
+"c. lease or lend the Software;"
+"\n"
+"\n"
+"\n"
+"d. offer the Software on a \"pay-per-play\" basis;"
+"\n"
+"\n"
+"\n"
+"e. distribute the Software (except as permitted by section 3."
+"hereinbelow);"
+"\n"
+"\n"
+"\n"
+"f. in any other manner and through any medium whatsoever"
+"commercially exploit the Software or use the Software for any commercial"
+"purpose;"
+"\n"
+"\n"
+"\n"
+"g. disassemble, reverse engineer, decompile, modify or alter the"
+"Software including, without limitation, creating or developing extra or"
+"add-on levels for the Software;"
+"\n"
+"\n"
+"\n"
+"h. translate the Software;"
+"\n"
+"\n"
+"\n"
+"i. reproduce or copy the Software (except as permitted by section"
+"3. hereinbelow);"
+"\n"
+"\n"
+"\n"
+"j. publicly display the Software;"
+"\n"
+"\n"
+"\n"
+"k. prepare or develop derivative works based upon the Software; or"
+"\n"
+"\n"
+"\n"
+"l. remove or alter any legal notices or other markings or "
+"legends, such as trademark and copyright notices, affixed on or within"
+"the Software."
+"\n"
+"\n"
+"\n"
+"3. Permitted Distribution and Copying. So long as this Agreement"
+"accompanies each copy you make of the Software, and so long as you fully"
+"comply, at all times, with this Agreement, ID grants to you the"
+"non-exclusive and limited right to copy the Software and to distribute "
+"such copies of the Software free of charge for non-commercial purposes "
+"which shall include the free of charge distribution of copies of the"
+"Software as mounted on the covers of magazines; provided, however, you"
+"shall not copy or distribute the Software in any infringing manner or"
+"in any manner which violates any law or third party right and you shall"
+"not distribute the Software together with any material which is "
+"infringing, libelous, defamatory, obscene, false, misleading, or "
+"otherwise illegal or unlawful. You agree to label conspicuously as "
+"\"SHAREWARE\" or \"DEMO\" each CD or other non-electronic copy of the "
+"Software that you make and distribute. ID reserves all rights not"
+"granted in this Agreement. You shall not commercially distribute the"
+"Software unless you first enter into a separate contract with ID, a"
+"copy of which you may request, but which ID may decline to execute."
+"For more information visit www.quake3arena.com."
+"\n"
+"\n"
+"\n"
+"4. Intellectual Property Rights. The Software and all copyrights,"
+"trademarks and all other conceivable intellectual property rights related"
+"to the Software are owned by ID and are protected by United States"
+"copyright laws, international treaty provisions and all applicable law,"
+"such as the Lanham Act. You must treat the Software like any other"
+"copyrighted material, as required by 17 U.S.C., §101 et seq. and othen"
+"applicable law. You agree to use your best efforts to see that any user"
+"of the Software licensed hereunder complies with this Agreement. You"
+"agree that you are receiving a copy of the Software by license only"
+"and not by sale and that the \"first sale\" doctrine of 17 U.S.C. §10"
+"does not apply to your receipt or use of the Software."
+"\n"
+"\n"
+"\n"
+"5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR"
+"IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF"
+"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE"
+"SOFTWARE. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE WILL BE"
+"UNINTERRUPTED OR ERROR FREE OR THAT THE SOFTWARE WILL MEET YOUR SPECIFIC"
+"REQUIREMENTS. ADDITIONAL STATEMENTS SUCH AS PRESENTATIONS, WHETHER ORAL"
+"OR WRITTEN, DO NOT CONSTITUTE WARRANTIES BY ID AND SHOULD NOT BE RELIED"
+"UPON. THIS SECTION 5. SHALL SURVIVE CANCELLATION OR TERMINATION OF THIS"
+"AGREEMENT."
+"\n"
+"\n"
+"\n"
+"6. Governing Law, Venue, Indemnity and Liability Limitation. This"
+"Agreement shall be construed in accordance with and governed by the"
+"applicable laws of the State of Texas and applicable United States federal"
+"law. Copyright and other proprietary matters will be governed by United"
+"States laws and international treaties. Exclusive venue for all"
+"litigation regarding this Agreement shall be in Dallas County, Texas"
+"and you agree to submit to the jurisdiction of the courts in Dallas,"
+"Texas for any such litigation. You agree to indemnify, defend and hold"
+"harmless ID and ID's officers, employees, directors, agents, licensees"
+"(excluding you), successors and assigns from and against all losses,"
+"lawsuits, damages, causes of action and claims relating to and/or"
+"arising from your breach of this Agreement. You agree that your"
+"unauthorized use of the Software, or any part thereof, may immediately"
+"and irreparably damage ID such that ID could not be adequately"
+"compensated solely by a monetary award and that at ID's option ID shall"
+"be entitled to an injunctive order, in addition to all other available"
+"remedies including a monetary award, appropriately restraining and/or"
+"prohibiting such unauthorized use without the necessity of ID posting"
+"bond or other security. IN ANY CASE, ID AND ID'S OFFICERS, EMPLOYEES,"
+"DIRECTORS, AGENTS, LICENSEES, SUBLICENSEES, SUCCESSORS AND ASSIGNS"
+"SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST SAVINGS,"
+"SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT, PUNITIVE OR OTHER SIMILAR"
+"DAMAGES ARISING FROM ANY ALLEGED CLAIM FOR BREACH OF WARRANTY, BREACH"
+"OF CONTRACT, NEGLIGENCE, STRICT PRODUCT LIABILITY, OR OTHER LEGAL"
+"THEORY EVEN IF ID OR ITS AGENT HAVE BEEN ADVISED OF THE POSSIBILITY"
+"OF SUCH DAMAGES OR EVEN IF SUCH DAMAGES ARE FORESEEABLE, OR LIABLE"
+"FOR ANY CLAIM BY ANY OTHER PARTY. Some jurisdictions do not allow"
+"the exclusion or limitation of incidental or consequential damages,"
+"so the above limitation or exclusion may not apply to you. This"
+"Section 6. shall survive cancellation or termination of this Agreement."
+"\n"
+"\n"
+"\n"
+"7. U.S. Government Restricted Rights. To the extent applicable,"
+"the United States Government shall only have those rights to use the"
+"Software as expressly stated and expressly limited and restricted in"
+"this Agreement, as provided in 48 C.F.R. §§ 227.7201 through 227.7204,"
+"inclusive."
+"\n"
+"\n"
+"\n"
+"8. General Provisions. Neither this Agreement nor any part or"
+"portion hereof shall be assigned or sublicensed by you. ID may assign its"
+"rights under this Agreement in ID's sole discretion. Should any provision"
+"of this Agreement be held to be void, invalid, unenforceable or illegal by"
+"a court of competent jurisdiction, the validity and enforceability of the"
+"other provisions shall not be affected thereby. If any provision is"
+"determined to be unenforceable by a court of competent jurisdiction, you"
+"agree to a modification of such provision to provide for enforcement of"
+"the provision's intent, to the extent permitted by applicable law."
+"Failure of ID to enforce any provision of this Agreement shall not"
+"constitute or be construed as a waiver of such provision or of the right"
+"to enforce such provision. Immediately upon your failure to comply with"
+"or breach of any term or provision of this Agreement, THIS AGREEMENT"
+"AND YOUR LICENSE SHALL AUTOMATICALLY TERMINATE, WITHOUT NOTICE, AND ID"
+"MAY PURSUE ALL RELIEF AND REMEDIES AGAINST YOU WHICH ARE AVAILABLE UNDER"
+"APPLICABLE LAW AND/OR THIS AGREEMENT. In the event this Agreement is"
+"terminated, you shall have no right to use the Software, in any manner,"
+"and you shall immediately destroy all copies of the Software in your"
+"possession, custody or control."
+"\n"
+"\n"
+"\n"
+"YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, YOU UNDERSTAND THIS"
+"AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE INSTALLATION OF THE"
+"SOFTWARE, BY LOADING OR RUNNING THE SOFTWARE, OR BY PLACING OR COPYING"
+"THE SOFTWARE ONTO YOUR COMPUTER HARD DRIVE OR RAM, YOU AGREE TO BE BOUND"
+"BY THE TERMS AND CONDITIONS OF THIS AGREEMENT. YOU FURTHER AGREE THAT,"
+"EXCEPT FOR WRITTEN SEPARATE AGREEMENTS BETWEEN ID AND YOU, THIS "
+"AGREEMENT IS A COMPLETE AND EXCLUSIVE STATEMENT OF THE RIGHTS AND"
+"LIABILITIES OF THE PARTIES HERETO. THIS AGREEMENT SUPERSEDES ALL PRIOR"
+"ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND ANY OTHER"
+"COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER OF"
+"THIS AGREEMENT."
+"\n"
+};
+
+resource 'STR#' (5002, "English") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "English",
+ /* [2] */
+ "Agree",
+ /* [3] */
+ "Disagree",
+ /* [4] */
+ "Print",
+ /* [5] */
+ "Save...",
+ /* [6] */
+ "IMPORTANT - Read this License Agreement carefully before clicking on "
+ "the \"Agree\" button. By clicking on the \"Agree\" button, you agree "
+ "to be bound by the terms of the License Agreement.",
+ /* [7] */
+ "Software License Agreement",
+ /* [8] */
+ "This text cannot be saved. This disk may be full or locked, or the file "
+ "may be locked.",
+ /* [9] */
+ "Unable to print. Make sure you have selected a printer."
+ }
+};
+
diff --git a/src/unix/MacSupport/ioquake3.icns b/src/unix/MacSupport/ioquake3.icns
new file mode 100755
index 00000000..30e3b673
--- /dev/null
+++ b/src/unix/MacSupport/ioquake3.icns
Binary files differ
diff --git a/src/unix/unix_main.c b/src/unix/unix_main.c
index eb815685..e399140c 100644
--- a/src/unix/unix_main.c
+++ b/src/unix/unix_main.c
@@ -1237,7 +1237,7 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
if( msg[ i ] == '\n' )
{
Com_sprintf( tempBuffer, 7, "%c[0m\n", 0x1B );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
i++;
}
else if( msg[ i ] == Q_COLOR_ESCAPE )
@@ -1259,7 +1259,7 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
if( escapeCode )
{
Com_sprintf( tempBuffer, 7, "%c[%sm", 0x1B, escapeCode );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
}
i++;
@@ -1268,7 +1268,7 @@ void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
else
{
Com_sprintf( tempBuffer, 7, "%c", msg[ i++ ] );
- strncat( buffer, tempBuffer, bufferSize );
+ strncat( buffer, tempBuffer, bufferSize - 1);
}
}
}
@@ -1383,8 +1383,42 @@ void Sys_ParseArgs( int argc, char* argv[] ) {
}
}
+#ifdef MACOS_X
+/*
+=================
+Sys_EscapeAppBundle
+
+Discovers if passed dir is suffixed with the directory structure of a
+Mac OS X .app bundle. If it is, the .app directory structure is stripped off
+the end and the result is returned. If not, dir is returned untouched.
+
+=================
+*/
+char *Sys_StripAppBundle(char *dir)
+{
+ static char cwd[MAX_OSPATH];
+
+ Q_strncpyz(cwd, dir, sizeof(cwd));
+ if(strcmp(basename(cwd), "MacOS"))
+ return dir;
+ Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+ if(strcmp(basename(cwd), "Contents"))
+ return dir;
+ Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+ if(!strstr(basename(cwd), ".app"))
+ return dir;
+ Q_strncpyz(cwd, dirname(cwd), sizeof(cwd));
+ return cwd;
+}
+#endif /* MACOS_X */
+
#ifndef DEFAULT_BASEDIR
-# define DEFAULT_BASEDIR Sys_DefaultCDPath()
+ #ifdef MACOS_X
+ // if run from an .app bundle, we want to also search its containing dir
+ #define DEFAULT_BASEDIR Sys_StripAppBundle(Sys_DefaultCDPath())
+ #else
+ #define DEFAULT_BASEDIR Sys_DefaultCDPath()
+ #endif
#endif
#include "../client/client.h"
diff --git a/src/unix/unix_net.c b/src/unix/unix_net.c
index d89e766a..31d27c8d 100644
--- a/src/unix/unix_net.c
+++ b/src/unix/unix_net.c
@@ -649,19 +649,40 @@ char *NET_ErrorString (void)
// sleeps msec or until net socket is ready
void NET_Sleep(int msec)
{
- struct timeval timeout;
+ struct timeval timeout;
fd_set fdset;
extern qboolean stdin_active;
+ int highestfd = 0;
- if (!ip_socket || !com_dedicated->integer)
+ if (!com_dedicated->integer)
return; // we're not a server, just run full speed
FD_ZERO(&fdset);
if (stdin_active)
+ {
FD_SET(0, &fdset); // stdin is processed too
- FD_SET(ip_socket, &fdset); // network socket
- timeout.tv_sec = msec/1000;
- timeout.tv_usec = (msec%1000)*1000;
- select(ip_socket+1, &fdset, NULL, NULL, &timeout);
+ highestfd = 1;
+ }
+ if(ip_socket)
+ {
+ FD_SET(ip_socket, &fdset); // network socket
+ if(ip_socket >= highestfd)
+ highestfd = ip_socket + 1;
+ }
+
+ if(highestfd)
+ {
+ if(msec >= 0)
+ {
+ timeout.tv_sec = msec/1000;
+ timeout.tv_usec = (msec%1000)*1000;
+ select(highestfd, &fdset, NULL, NULL, &timeout);
+ }
+ else
+ {
+ // Block indefinitely
+ select(highestfd, &fdset, NULL, NULL, NULL);
+ }
+ }
}