Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated and tested on BlackBerry 10 devices using latest SDK.

  • Loading branch information...
commit 514685799abfb71f6390df10ad7791e5df3bfce9 1 parent 8cbee38
Sean Taylor authored January 09, 2013

Showing 61 changed files with 1,832 additions and 1,908 deletions. Show diff stats Hide diff stats

  1. 1,411  .cproject
  2. 4  .project
  3. 8  Makefile
  4. 34  README.md
  5. 54  bar-descriptor.xml
  6. 336  code/{unix/qnx_glimp.c → blackberry/blackberry_glimp.c}
  7. 331  code/blackberry/blackberry_main.c
  8. 53  code/{unix/qnx_net.c → blackberry/blackberry_net.c}
  9. 7  code/botlib/be_aas_reach.c
  10. 5  code/botlib/be_interface.c
  11. 8  code/botlib/be_interface.h
  12. 2  code/cgame/cg_draw.c
  13. 2  code/cgame/cg_main.c
  14. 8  code/cgame/cg_marks.c
  15. 2  code/cgame/cg_players.c
  16. 4  code/cgame/cg_public.h
  17. 2  code/cgame/cg_scoreboard.c
  18. 2  code/cgame/cg_syscalls.c
  19. 3  code/cgame/cg_view.c
  20. 6  code/client/cl_keys.c
  21. 2  code/client/cl_main.c
  22. 2  code/client/cl_ui.c
  23. 2  code/game/bg_misc.c
  24. 6  code/game/bg_pmove.c
  25. 2  code/game/bg_slidemove.c
  26. 2  code/game/g_bot.c
  27. 2  code/game/g_local.h
  28. 2  code/game/g_main.c
  29. 4  code/game/g_public.h
  30. 2  code/game/g_svcmds.c
  31. 2  code/game/g_syscalls.c
  32. 2  code/game/q_shared.c
  33. 5  code/game/q_shared.h
  34. 2  code/null/null_client.c
  35. 2  code/q3_ui/ui_atoms.c
  36. 2  code/q3_ui/ui_gameinfo.c
  37. 2  code/q3_ui/ui_local.h
  38. 2  code/q3_ui/ui_main.c
  39. 2  code/q3_ui/ui_players.c
  40. 121  code/qcommon/common.c
  41. 20  code/qcommon/qcommon.h
  42. 2  code/qcommon/unzip.c
  43. 7  code/splines/q_shared.hpp
  44. 2  code/ui/ui_local.h
  45. 2  code/ui/ui_shared.c
  46. 2  code/ui/ui_syscalls.c
  47. 2  code/unix/linux_signals.c
  48. 2  code/unix/linux_snd.c
  49. 389  code/unix/qnx_main.c
  50. 430  code/unix/rim_shared.c
  51. 4  code/unix/unix_net.c
  52. 8  code/unix/unix_shared.c
  53. 19  common.mk
  54. BIN  icon.png
  55. 8  qnx/Makefile
  56. 333  qnx/common.mk
  57. 8  qnx/nto/Makefile
  58. 8  qnx/nto/arm/Makefile
  59. 1  qnx/nto/arm/o.le.g.v7/Makefile
  60. 1  qnx/nto/arm/o.le.v7/Makefile
  61. 42  qnx/quake3.use
1,411  .cproject
1335 additions, 76 deletions not shown
4  .project
... ...
@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <projectDescription>
3  
-	<name>quake3</name>
  3
+	<name>Quake3</name>
4 4
 	<comment></comment>
5 5
 	<projects>
6 6
 	</projects>
@@ -27,7 +27,7 @@
27 27
 				</dictionary>
28 28
 				<dictionary>
29 29
 					<key>org.eclipse.cdt.make.core.buildLocation</key>
30  
-					<value>${workspace_loc:/quake3/Device-Release}</value>
  30
+					<value>${workspace_loc:/Quake3/Device-Debug}</value>
31 31
 				</dictionary>
32 32
 				<dictionary>
33 33
 					<key>org.eclipse.cdt.make.core.contents</key>
8  Makefile
... ...
@@ -1,8 +0,0 @@
1  
-LIST=CPU
2  
-ifndef QRECURSE
3  
-QRECURSE=recurse.mk
4  
-ifdef QCONFIG
5  
-QRDIR=$(dir $(QCONFIG))
6  
-endif
7  
-endif
8  
-include $(QRDIR)$(QRECURSE)
34  README.md
Source Rendered
... ...
@@ -1,43 +1,21 @@
1 1
 Build/Deploy using BlackBerry Native SDK
2 2
 ====================================
3  
-Below are the  instructions for building the Quake3 (id tech 3) game engine for BlackBerry QNX based platforms (PlayBook). 
4  
-The game engine source code included in this repository was ported from the open-source (under GPL license) directly from id software.
  3
+Below are the  instructions for building the Quake3 (id tech 3) game engine for BlackBerry 10 and PlayBook devices. 
  4
+The game engine source code included in this repository was ported from the open-source (under GPL license) directly from id Software.
5 5
 The Quake3 maps/data files are not covered under the open-source agreement and must be provided by the developers wishing
6 6
 to use the code.
7 7
 
8  
-Download the BlackBerry Native SDK 2.0
9  
---------------------------------------
10  
-[Download] (https://bdsc.webapps.blackberry.com/native/beta/)
  8
+Download the BlackBerry Native SDK 10
  9
+-------------------------------------
  10
+http://developer.blackberry.com/native/download/
11 11
 
12 12
 Add your Quake Maps
13 13
 -------------------
14  
-- Copy the .pk3 map file(s) to the resource/baseq3 directory from your Quake3 CD (testing only) or custom maps you have made 
  14
+- Copy the *.pk3 map file(s) to the resource/baseq3 directory. (Typically found from your purchased Quake3 CD (testing only) or demo/custom maps.
15 15
 
16 16
 Building from Momentics IDE
17 17
 ---------------------------
18 18
 - Run BlackBerry Momentics IDE.
19 19
 - Import the project from the repo directory "Quake3".
20  
-- Right click Project -> Build Configurations -> Set Active Configuration -> Device-Release or Device-Debug.
21 20
 - Build the project.
22 21
 - Debug or Run the project.
23  
-
24  
-Build from Makefile
25  
--------------------
26  
-- Run cmd.exe and execute the following commands:
27  
-
28  
-  `> cd [bbndk]` -- where [bbndk] is where the QNX NDK was installed (i.e. C:\bbndk-2.0.0)
29  
-  
30  
-  `> bbndk-env[.bat/.sh]`
31  
-  
32  
-  `> cd [Quake3]/qnx` -- where [Quake3] is the directory where Quake3 was extracted to
33  
-  
34  
-  `> make`
35  
-
36  
-- Following this, the relevant binaries should reside in the following subdirectories:
37  
- - [quake3]/qnx/nto/arm/o.le.v7/quake3       (Release)
38  
- - [quake3]/qnx/nto/arm/o.le.v7.g/quake3_g   (Debug)
39  
-        
40  
-- Run the following to build the Quake3 bar file. Add your additional parameters for signing keys and debug tokens.
41  
-
42  
-  `> blackberry-nativepackager -package Quake3.bar bar-descriptor.xml -e qnx/nto/arm/o.le.v7/quake3 quake3 -e resource/baseq3/pak0.pk3 baseq3/pak0.pk3 icon.png`
43  
-
54  bar-descriptor.xml
@@ -6,10 +6,10 @@
6 6
     Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
7 7
 
8 8
 -->
9  
-
  9
+    
10 10
     <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
11 11
          Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
12  
-    <id>quake3</id>
  12
+    <id>com.idsoftware.Quake3</id>
13 13
 
14 14
     <!-- The name that is displayed in the BlackBerry Tablet OS application installer. 
15 15
          May have multiple values for each language. See samples or xsd schema file. Optional. -->
@@ -22,84 +22,64 @@
22 22
 
23 23
     <!-- Fourth digit segment of the package version. First three segments are taken from the 
24 24
          <versionNumber> element.  Must be an integer from 0 to 2^16-1 -->
25  
-    <buildId>1</buildId>
26  
-                 
27  
-    <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
28  
-    <!-- <versionLabel></versionLabel> -->
29  
-
30  
-    <!-- Description, displayed in the BlackBerry Tablet OS application installer.
31  
-         May have multiple values for each language. See samples or xsd schema file. Optional. -->
32  
-
33  
-    <!-- Copyright information. Optional. -->
34  
-    <!-- <copyright></copyright> -->
  25
+    <buildId>1</buildId>           
35 26
 
36 27
     <!--  Name of author which is used for signing. Must match the developer name of your development certificate. -->
37 28
     <author>id Software</author>
38  
-    <description>Quake 3</description>
39 29
     
40 30
     <!--  Unique author ID assigned by signing authority. Required if using debug tokens. -->
41 31
     <!-- <authorId>ABC1234YjsnUk235h</authorId> -->
42 32
    
43 33
     <initialWindow>
  34
+        <aspectRatio>landscape</aspectRatio>
  35
+        <autoOrients>false</autoOrients>
44 36
         <systemChrome>none</systemChrome>
45 37
         <transparent>false</transparent>
46 38
     </initialWindow>
47 39
     
48  
-    <!--  The category where the application appears. Either core.games or core.media. -->
  40
+     <!--  The category where the application appears. Either core.games or core.media. -->
49 41
     <category>core.games</category>
  42
+    
50 43
     <asset path="icon.png">icon.png</asset>
51 44
     <asset path="resource/baseq3/pak0.pk3">baseq3/pak0.pk3</asset>
52  
-    <configuration id="com.qnx.qcc.configuration.exe.debug.513359716" name="Device-Debug">
  45
+    
  46
+    <configuration name="Device-Debug">
53 47
        <platformArchitecture>armle-v7</platformArchitecture>
54  
-       <asset path="Device-Debug/quake3" entry="true" type="Qnx/Elf">quake3</asset>
  48
+       <asset path="Device-Debug/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
55 49
     </configuration>
56  
-    <configuration id="com.qnx.qcc.configuration.exe.release.1191851318" name="Device-Release">
  50
+    <configuration name="Device-Release">
57 51
        <platformArchitecture>armle-v7</platformArchitecture>
58 52
        <asset path="Device-Release/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
59 53
     </configuration>
60  
-    <configuration id="com.qnx.qcc.configuration.exe.profile.2047434418" name="Device-Profile">
  54
+    <configuration name="Device-Profile">
61 55
        <platformArchitecture>armle-v7</platformArchitecture>
62 56
        <asset path="Device-Profile/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
63 57
     </configuration>
64  
-    <configuration id="com.qnx.qcc.configuration.exe.profile.coverage.1968527117" name="Device-Coverage">
  58
+    <configuration name="Device-Coverage">
65 59
        <platformArchitecture>armle-v7</platformArchitecture>
66 60
        <asset path="Device-Coverage/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
67 61
     </configuration>
68  
-    <configuration id="com.qnx.qcc.configuration.exe.debug.1673080274" name="Simulator-Debug">
  62
+    <configuration name="Simulator-Debug">
69 63
        <platformArchitecture>x86</platformArchitecture>
70 64
        <asset path="Simulator-Debug/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
71 65
     </configuration>
72  
-    <configuration id="com.qnx.qcc.configuration.exe.profile.1942537661" name="Simulator-Profile">
  66
+    <configuration name="Simulator-Profile">
73 67
        <platformArchitecture>x86</platformArchitecture>
74 68
        <asset path="Simulator-Profile/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
75 69
     </configuration>
76  
-    <configuration id="com.qnx.qcc.configuration.exe.profile.coverage.725836059" name="Simulator-Coverage">
  70
+    <configuration name="Simulator-Coverage">
77 71
        <platformArchitecture>x86</platformArchitecture>
78 72
        <asset path="Simulator-Coverage/Quake3" entry="true" type="Qnx/Elf">Quake3</asset>
79 73
     </configuration>
80 74
     
81  
-    <!--  The icon for the application, which should be 86x86. -->
  75
+    <!--  The icon for the application, which should be 114x114. -->
82 76
     <icon>
83 77
         <image>icon.png</image>
84 78
     </icon>
85  
-    
86  
-    <!--  The splash screen that will appear when your application is launching. Should be 1024x600. -->
87  
-    <!-- <splashscreen></splashscreen> -->
88 79
 
89 80
     <!-- Request permission to execute native code.  Required for native applications. -->
90 81
     <action system="true">run_native</action>
91 82
     <action>access_internet</action>
92  
-    
93  
-    <!--  The permissions requested by your application. -->
94  
-    <!--  <action>access_shared</action> -->
95  
-    <!--  <action>record_audio</action> -->
96  
-    <!--  <action>read_geolocation</action> -->
97  
-    <!--  <action>use_camera</action> -->
98  
-    <!--  <action>access_internet</action> -->
99  
-    <!--  <action>play_audio</action> -->
100  
-    <!--  <action>post_notification</action> -->
101  
-    <!--  <action>set_audio_volume</action> -->
102  
-    <!--  <action>read_device_identifying_information</action> -->
103 83
 
104 84
     <!-- Ensure that shared libraries in the package are found at run-time. -->
105 85
     <env var="LD_LIBRARY_PATH" value="app/native/lib"/>
336  code/unix/qnx_glimp.c → code/blackberry/blackberry_glimp.c
@@ -23,19 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 23
 #include "../client/client.h"
24 24
 #include "../q3_ui/ui_local.h"
25 25
 
26  
-#ifdef RIM_NDK
27  
-#include <egl.h>
28  
-#include <graphicsinit.h>
29  
-#include <string.h>
30  
-#include <internal/message.h>
31  
-#include <internal/keypad.h>
32  
-
33  
-// RIM_NDK Cheap trick to allow trackball.h to be included
34  
-#ifndef RIM_DEPRECATED
35  
-#define RIM_DEPRECATED
36  
-#endif
37  
-#include <internal/trackball.h>
38  
-#elif __QNXNTO__
  26
+#ifdef __QNX__
39 27
 #define FALSE 0
40 28
 #define TRUE 1
41 29
 #include <EGL/egl.h>
@@ -197,7 +185,7 @@ void PrintEglError( GLuint errorCode )
197 185
     }
198 186
 }
199 187
 
200  
-void QNX_initDriver()
  188
+void BLACKBERRY_initDriver()
201 189
 {
202 190
     int         err;
203 191
     int         egl_ret;
@@ -435,7 +423,7 @@ static void InitControls(void)
435 423
 	r2square = fireBoundRad * fireBoundRad; //25 * glConfig.vidWidth * glConfig.vidWidth / 10000;
436 424
 }
437 425
 
438  
-int QNX_InitGL(void)
  426
+int BLACKBERRY_InitGL(void)
439 427
 {
440 428
     int usage = SCREEN_USAGE_OPENGL_ES1;
441 429
 	int transp = SCREEN_TRANSPARENCY_NONE;
@@ -546,8 +534,8 @@ int QNX_InitGL(void)
546 534
 		return FALSE;
547 535
 	}
548 536
 
549  
-	size[0] = 1024;
550  
-	size[1] = 600;
  537
+	size[0] = 1280;//1024;
  538
+	size[1] = 768; //600;
551 539
 	err = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SIZE, size);
552 540
 	if (err) {
553 541
 		Com_Printf("screen_set_window_property_iv(SCREEN_PROPERTY_SIZE)");
@@ -630,7 +618,8 @@ static void drawControls()
630 618
 	glPopMatrix();
631 619
 }
632 620
 
633  
-void SwapBuffers( void ) {
  621
+void SwapBuffers( void )
  622
+{
634 623
 	int err, i;
635 624
 	int t;
636 625
 	int size[2];
@@ -669,33 +658,6 @@ void SwapBuffers( void ) {
669 658
 		glEnable(GL_TEXTURE_2D);
670 659
 	}
671 660
 
672  
-//	if (min || max) {
673  
-//		eglMakeCurrent(eglDisplay,
674  
-//						EGL_NO_SURFACE,
675  
-//						EGL_NO_SURFACE,
676  
-//						EGL_NO_CONTEXT);
677  
-//		eglMakeCurrent(eglDisplay,
678  
-//						eglSurface,
679  
-//						eglSurface,
680  
-//						eglContext);
681  
-//
682  
-//		size[0] = glConfig.vidWidth;
683  
-//		size[1] = glConfig.vidHeight;
684  
-//		screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE, size);
685  
-//
686  
-//		if (min) {
687  
-//			pos[0] = 0;
688  
-//			pos[1] = bz[1] - size[1];
689  
-//			min = 0;
690  
-//		} else {
691  
-//			pos[0] = 0;
692  
-//			pos[1] = 0;
693  
-//			max = 0;
694  
-//		}
695  
-//
696  
-//		screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_POSITION, pos);
697  
-//	}
698  
-
699 661
 	eglSwapBuffers(eglDisplay, eglSurface);
700 662
 	err = eglGetError( );
701 663
 	if (err != EGL_SUCCESS ) {
@@ -706,13 +668,13 @@ void SwapBuffers( void ) {
706 668
 }
707 669
 
708 670
 /*
709  
-** QNX_InitGraphics
  671
+** BLACKBERRY_InitGraphics
710 672
 */
711  
-int QNX_InitGraphics( int mode )
  673
+int BLACKBERRY_InitGraphics( int mode )
712 674
 {
713 675
 	int ret;
714 676
 
715  
-    ret = QNX_InitGL();
  677
+    ret = BLACKBERRY_InitGL();
716 678
     if(FALSE == ret) {
717 679
         Com_Printf("Error, failed to initialize gl");
718 680
         return FALSE;
@@ -725,23 +687,13 @@ static qboolean LoadOpenGL( const char *name )
725 687
 {
726 688
 	qboolean fullscreen;
727 689
 	ri.Printf( PRINT_ALL, "...loading %s: ", name );
728  
-
729  
-	// disable the 3Dfx splash screen and set gamma
730  
-	// we do this all the time, but it shouldn't hurt anything
731  
-	// on non-3Dfx stuff
732  
-	//putenv("FX_GLIDE_NO_SPLASH=0");
733  
-
734  
-	// Mesa VooDoo hacks
735  
-	//putenv("MESA_GLX_FX=fullscreen\n");
736  
-
737  
-
738 690
 	// load GL layer
739 691
 	fullscreen = r_fullscreen->integer;
740 692
     ri.Cvar_Set( "r_fullscreen", "1" );
741 693
 	r_fullscreen->modified = qtrue;
742 694
 
743 695
 	// create the window and set up the context
744  
-	if ( !QNX_InitGraphics(r_mode->integer) )
  696
+	if ( !BLACKBERRY_InitGraphics(r_mode->integer) )
745 697
 	{
746 698
         ri.Printf( PRINT_ALL, "FAILURE: InitGL failed in this mode\n" );
747 699
         return qfalse;
@@ -852,12 +804,6 @@ void GLimp_Init( void )
852 804
 
853 805
 	ri.Cvar_Set( "r_lastValidRenderer", glConfig.renderer_string );
854 806
 
855  
-	// initialize extensions
856  
-	//GLW_InitExtensions();
857  
-	//GLW_InitGamma();
858  
-
859  
-//	InitSig(); // not clear why this is at begin & end of function
860  
-
861 807
 	return;
862 808
 }
863 809
 
@@ -868,25 +814,18 @@ void IN_DeactivateMouse( void )
868 814
 
869 815
 	if (mouse_active)
870 816
 	{
871  
-// TODO: comment this first
872  
-// zongzong.yan
873  
-#if 0
874  
-		if (!in_nograb->value)
875  
-			uninstall_grabs();
876  
-		else if (in_dgamouse->value) // force dga mouse to 0 if using nograb
877  
-#endif
878 817
 		ri.Cvar_Set("in_dgamouse", "0");
879 818
 		mouse_active = qfalse;
880 819
 	}
881 820
 }
882 821
 
883  
-void GLimp_Shutdown( void ) {
884  
-	if (!eglContext || !eglDisplay) return;
  822
+void GLimp_Shutdown( void )
  823
+{
  824
+	if (!eglContext || !eglDisplay)
  825
+	    return;
885 826
 	
886 827
     IN_DeactivateMouse();
887  
-	// bk001206 - replaced with H2/Fakk2 solution
888  
-	// XAutoRepeatOn(dpy);
889  
-	// autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv)
  828
+
890 829
     screen_destroy_event(screen_ev);
891 830
 
892 831
     eglMakeCurrent(eglDisplay, NULL, NULL, NULL);
@@ -905,40 +844,50 @@ void GLimp_Shutdown( void ) {
905 844
 	memset( &glState, 0, sizeof( glState ) );
906 845
 }
907 846
 
908  
-void		GLimp_EnableLogging( qboolean enable ) {
  847
+void GLimp_EnableLogging( qboolean enable )
  848
+{
909 849
 }
910 850
 
911  
-void GLimp_LogComment( char *comment ) {
  851
+void GLimp_LogComment( char *comment )
  852
+{
912 853
 }
913 854
 
914  
-void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] ) {
  855
+void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned char blue[256] )
  856
+{
915 857
 }
916 858
 
917  
-qboolean GLimp_SpawnRenderThread( void (*function)( void ) ) {
  859
+qboolean GLimp_SpawnRenderThread( void (*function)( void ) )
  860
+{
918 861
 	ri.Printf( PRINT_WARNING, "ERROR: SMP support was disabled at compile time\n");
919 862
 	return qfalse;
920 863
 }
921  
-void GLimp_FrontEndSleep( void ) {
  864
+void GLimp_FrontEndSleep( void )
  865
+{
922 866
 }
923 867
 
924  
-void *GLimp_RendererSleep( void ) {
  868
+void *GLimp_RendererSleep( void )
  869
+{
925 870
     return NULL;
926 871
 }
927 872
 
928  
-void GLimp_WakeRenderer( void *data ){
  873
+void GLimp_WakeRenderer( void *data )
  874
+{
929 875
 }
930 876
 
931 877
 
932  
-#ifndef RIM_NDK
933  
-qboolean QGL_Init( const char *dllname ) {
  878
+
  879
+qboolean QGL_Init( const char *dllname )
  880
+{
934 881
 	return qtrue;
935 882
 }
936 883
 
937  
-void		QGL_Shutdown( void ) {
  884
+void QGL_Shutdown( void )
  885
+{
938 886
 }
939  
-#endif
940 887
 
941  
-void IN_Init( void ) {
  888
+
  889
+void IN_Init( void )
  890
+{
942 891
 	Com_Printf ("\n------- Input Initialization -------\n");
943 892
 	// mouse variables
944 893
 	in_mouse = Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
@@ -962,21 +911,8 @@ void IN_ActivateMouse( void )
962 911
     if (!mouse_avail || !eglDisplay)
963 912
         return;
964 913
 
965  
-	if (!mouse_active) {
966  
-// TODO: comment this first
967  
-// zongzong.yan
968  
-#if 0
969  
-		if (!in_nograb->value)
970  
-			install_grabs();
971  
-		else if (in_dgamouse->value) // force dga mouse to -1 if using nograb
972  
-#endif
973  
-        // Open channel to App Thread for sharing device input commands
974  
-//        jvmfd = open( "/services/jvm", O_RDWR );
975  
-//        if( -1 == jvmfd ) {
976  
-//            Sys_Error("Error, could not open channel to app thread!");
977  
-//        }
978  
-// __QNXNTO__ TODO input
979  
-
  914
+	if (!mouse_active)
  915
+	{
980 916
 		ri.Cvar_Set("in_dgamouse", "0");
981 917
 		mouse_active = qtrue;
982 918
 	}
@@ -1007,7 +943,7 @@ void IN_Shutdown(void)
1007 943
 }
1008 944
 
1009 945
 
1010  
-static char *LateKey(int scancode, int *key)
  946
+static char* LateKey(int scancode, int *key)
1011 947
 {
1012 948
 	static char buf[4];
1013 949
 
@@ -1020,114 +956,11 @@ static char *LateKey(int scancode, int *key)
1020 956
 	
1021 957
 	switch (scancode)
1022 958
 	{
1023  
-	    /*case VDK_PAD_9:  *key = K_KP_PGUP; break;
1024  
-	    case VDK_PGUP:   *key = K_PGUP; break;
1025  
-
1026  
-	    case VDK_PAD_3: *key = K_KP_PGDN; break;
1027  
-	    case VDK_PGDN:  *key = K_PGDN; break;
1028  
-
1029  
-	    case VDK_PAD_7: *key = K_KP_HOME; break;
1030  
-	    case VDK_HOME:  *key = K_HOME; break;
1031  
-
1032  
-	    case VDK_PAD_1:   *key = K_KP_END; break;
1033  
-	    case VDK_END:   *key = K_END; break;
1034  
-
1035  
-	    case VDK_PAD_4: *key = K_KP_LEFTARROW; break;
1036  
-	    case VDK_LEFT:  *key = K_LEFTARROW; break;
1037  
-
1038  
-	    case VDK_PAD_6: *key = K_KP_RIGHTARROW; break;
1039  
-	    case VDK_RIGHT:  *key = K_RIGHTARROW;    break;
1040  
-
1041  
-	    case VDK_PAD_2:    *key = K_KP_DOWNARROW; break;
1042  
-	    case VDK_DOWN:  *key = K_DOWNARROW; break;
1043  
-
1044  
-	    case VDK_PAD_8:    *key = K_KP_UPARROW; break;
1045  
-	    case VDK_UP:    *key = K_UPARROW;   break;
1046  
-
1047  
-	    case VDK_PAD_ENTER: *key = K_KP_ENTER;  break;
1048  
-
1049  
-	    case VDK_TAB:    *key = K_TAB;      break;
1050  
-
1051  
-	    case VDK_F1:    *key = K_F1;       break;
1052  
-
1053  
-	    case VDK_F2:    *key = K_F2;       break;
1054  
-
1055  
-	    case VDK_F3:    *key = K_F3;       break;
1056  
-
1057  
-	    case VDK_F4:    *key = K_F4;       break;
1058  
-
1059  
-	    case VDK_F5:    *key = K_F5;       break;
1060  
-
1061  
-	    case VDK_F6:    *key = K_F6;       break;
1062  
-
1063  
-	    case VDK_F7:    *key = K_F7;       break;
1064  
-
1065  
-	    case VDK_F8:    *key = K_F8;       break;
1066  
-
1067  
-	    case VDK_F9:    *key = K_F9;       break;
1068  
-
1069  
-	    case VDK_F10:    *key = K_F10;      break;
1070  
-
1071  
-	    case VDK_F11:    *key = K_F11;      break;
1072  
-
1073  
-	    case VDK_F12:    *key = K_F12;      break;
1074  
-
1075  
-		    // bk001206 - from Ryan's Fakk2 
1076  
-		    //case VDK_BackSpace: *key = 8; break; // ctrl-h
1077  
-	    case VDK_BACKSPACE: *key = K_BACKSPACE; break; // ctrl-h
1078  
-
1079  
-	    case VDK_PAD_PERIOD: *key = K_KP_DEL; break;
1080  
-
1081  
-	    case VDK_DELETE: *key = K_DEL; break; 
1082  
-	    case VDK_BREAK:  *key = K_PAUSE;    break;
1083  
-
1084  
-	    case VDK_LSHIFT:
1085  
-	    case VDK_RSHIFT:  *key = K_SHIFT;   break;
1086  
-
1087  
-	    case VDK_LCTRL: 
1088  
-	    case VDK_RCTRL:  *key = K_CTRL;  break;
1089  
-
1090  
-	    case VDK_LALT:  
1091  
-	    case VDK_RALT: *key = K_ALT;     break;
1092  
-
1093  
-	    case VDK_PAD_5: *key = K_KP_5;  break;
1094  
-
1095  
-	    case VDK_INSERT:   *key = K_INS; break;
1096  
-	    case VDK_PAD_0: *key = K_KP_INS; break;
1097  
-
1098  
-	    case VDK_PAD_ASTERISK: *key = '*'; break;
1099  
-	    case VDK_PAD_PLUS:  *key = K_KP_PLUS; break;
1100  
-	    case VDK_PAD_HYPHEN: *key = K_KP_MINUS; break;
1101  
-	    case VDK_PAD_SLASH: *key = K_KP_SLASH; break;
1102  
-
1103  
-		    // bk001130 - from cvs1.17 (mkv)
1104  
-	    case VDK_1: *key = '1'; break;
1105  
-	    case VDK_2: *key = '2'; break;
1106  
-	    case VDK_3: *key = '3'; break;
1107  
-	    case VDK_4: *key = '4'; break;
1108  
-	    case VDK_5: *key = '5'; break;
1109  
-	    case VDK_6: *key = '6'; break;
1110  
-	    case VDK_7: *key = '7'; break;
1111  
-	    case VDK_8: *key = '8'; break;
1112  
-	    case VDK_9: *key = '9'; break;
1113  
-	    case VDK_0: *key = '0'; break;
1114  
-	
1115  
-	    // weird french keyboards ..
1116  
-	    // NOTE: console toggle is hardcoded in cl_keys.c, can't be unbound
1117  
-	    //   cleaner would be .. using hardware key codes instead of the key syms
1118  
-	    //   could also add a new K_KP_CONSOLE
1119  
-	    case VDK_SINGLEQUOTE: *key = '~'; break;*/
1120  
-//__QNXNTO__ todo: add QNX input
1121  
-//        case KEY_BACKSPACE: *key = K_BACKSPACE; break;
1122  
-//        case KEY_DELETE: *key = K_DEL; break;
1123  
-//	    case KEY_ESCAPE: *key = K_ESCAPE;    break;
1124  
-//        case KEY_ENTER: *key = K_ENTER;    break;
1125  
-//	    case KEY_SPACE: *key = K_SPACE; break;
1126  
-//	    case KEY_ALT:  *key = K_CTRL;  break;
1127  
-
1128 959
 	    default:
1129  
-		    if (scancode == 0) {
1130  
-			    if (com_developer->value) {
  960
+		    if (scancode == 0)
  961
+		    {
  962
+			    if (com_developer->value)
  963
+			    {
1131 964
 				    ri.Printf(PRINT_ALL, "Warning: scancode: 0\n");
1132 965
 			    }
1133 966
 			    return NULL;
@@ -1172,49 +1005,6 @@ static void HandleEvents(void)
1172 1005
 	qboolean dowarp = qfalse;
1173 1006
 	int jmping = 0;
1174 1007
 
1175  
-#if 0
1176  
-	while(1) {
1177  
-		while (!screen_get_event(screen_ctx, screen_ev, freeze ? ~0 : 0)) {
1178  
-			rc = screen_get_event_property_iv(screen_ev, SCREEN_PROPERTY_TYPE, &val);
1179  
-			if (rc || val == SCREEN_EVENT_NONE) {
1180  
-				break;
1181  
-			}
1182  
-			switch (val) {
1183  
-			case SCREEN_EVENT_PROPERTY:
1184  
-				screen_get_event_property_iv(screen_ev, SCREEN_PROPERTY_NAME, &prop);
1185  
-				if (prop == SCREEN_PROPERTY_VISIBLE) {
1186  
-					screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_VISIBLE, &prop);
1187  
-					if (prop) {
1188  
-						freeze = 0;
1189  
-					} else {
1190  
-						freeze = 1;
1191  
-					}
1192  
-				}
1193  
-			}
1194  
-		}
1195  
-		if (!freeze) {
1196  
-			break;
1197  
-		}
1198  
-	}
1199  
-
1200  
-	screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_SIZE, size);
1201  
-	if ((size[0] <= 374) && (size[1] <= 219)) {
1202  
-		screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE, size);
1203  
-		if ((size[0] != 374) && (size[1] != 219)) {
1204  
-			glConfig.vidWidth = 374;
1205  
-			glConfig.vidHeight = 219 * 600 / 768;
1206  
-			min = 1;
1207  
-		}
1208  
-	} else {
1209  
-		screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE, size);
1210  
-		if ((size[0] != bz[0]) && (size[1] != bz[1])) {
1211  
-			glConfig.vidWidth = bz[0];
1212  
-			glConfig.vidHeight = bz[1];
1213  
-			max = 1;
1214  
-		}
1215  
-	}
1216  
-
1217  
-#else
1218 1008
 	t = Sys_Milliseconds();
1219 1009
 
1220 1010
 	if (jmping)
@@ -1437,16 +1227,18 @@ static void HandleEvents(void)
1437 1227
 				break;
1438 1228
 		}
1439 1229
 	}
1440  
-#endif
1441 1230
 }
1442 1231
 
1443  
-void Sys_SendKeyEvents (void) {
1444  
-	if (!eglDisplay) return;
  1232
+void Sys_SendKeyEvents (void)
  1233
+{
  1234
+	if (!eglDisplay)
  1235
+	    return;
1445 1236
 
1446 1237
 	HandleEvents();
1447 1238
 }
1448 1239
 
1449  
-void GLimp_EndFrame( void ) {
  1240
+void GLimp_EndFrame( void )
  1241
+{
1450 1242
 	char 		buffer[500];
1451 1243
 	char		*p;
1452 1244
 	int 		len;
@@ -1461,8 +1253,10 @@ void GLimp_EndFrame( void ) {
1461 1253
 		SwapBuffers();
1462 1254
 	}
1463 1255
 
1464  
-	while ( (len = read(ppsfd, buffer, sizeof( buffer ) -1 ) ) >= 0 ) {
1465  
-		if ( len == 0 ) {
  1256
+	while ( (len = read(ppsfd, buffer, sizeof( buffer ) -1 ) ) >= 0 )
  1257
+	{
  1258
+		if ( len == 0 )
  1259
+		{
1466 1260
 			return;
1467 1261
 		}
1468 1262
 		buffer[len] = '\0';
@@ -1477,26 +1271,6 @@ void GLimp_EndFrame( void ) {
1477 1271
 				Sys_QueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qtrue, 0, NULL );
1478 1272
 				Sys_QueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qfalse, 0, NULL );
1479 1273
 			}
1480  
-			/*
1481  
-			if ( strcmp(msg, "activate") == 0 ) {
1482  
-				Com_Printf("pps:orientation\n");
1483  
-			}
1484  
-			else if ( strcmp(msg, "deactivate") == 0 ) {
1485  
-				Com_Printf("pps:orientation\n");
1486  
-			}
1487  
-			else if ( strcmp(msg, "deflate") == 0 ) {
1488  
-				Com_Printf("pps:deflate\n");
1489  
-			}
1490  
-			else if ( strcmp(msg, "orientation") == 0 ) {
1491  
-				Com_Printf("pps:orientation\n");
1492  
-			}
1493  
-			else if ( strcmp(msg, "exit") == 0 ) {
1494  
-				Com_Printf("pps:exit\n");
1495  
-			}
1496  
-			else if ( strcmp(msg, "invoke") == 0 ) {
1497  
-				Com_Printf("pps:invoke\n");
1498  
-			}
1499  
-			*/
1500 1274
 		}
1501 1275
 	}
1502 1276
 }
331  code/blackberry/blackberry_main.c
... ...
@@ -0,0 +1,331 @@
  1
+/*
  2
+===========================================================================
  3
+Copyright (C) 1999-2005 Id Software, Inc.
  4
+
  5
+This file is part of Quake III Arena source code.
  6
+
  7
+Quake III Arena source code is free software; you can redistribute it
  8
+and/or modify it under the terms of the GNU General Public License as
  9
+published by the Free Software Foundation; either version 2 of the License,
  10
+or (at your option) any later version.
  11
+
  12
+Quake III Arena source code is distributed in the hope that it will be
  13
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  14
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15
+GNU General Public License for more details.
  16
+
  17
+You should have received a copy of the GNU General Public License
  18
+along with Foobar; if not, write to the Free Software
  19
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  20
+===========================================================================
  21
+*/
  22
+#include <errno.h>
  23
+#include <stdio.h>
  24
+#include <string.h>
  25
+#include "../game/q_shared.h"
  26
+#include "../qcommon/qcommon.h"
  27
+#include <unistd.h>
  28
+
  29
+#define	MAX_QUED_EVENTS		256
  30
+#define	MASK_QUED_EVENTS	( MAX_QUED_EVENTS - 1 )
  31
+
  32
+sysEvent_t  eventQue[MAX_QUED_EVENTS];
  33
+byte        sys_packetReceived[MAX_MSGLEN];
  34
+int         eventHead = 0;
  35
+int         eventTail = 0;
  36
+
  37
+int			sys_curtime;
  38
+
  39
+static qboolean ttycon_on = qfalse;
  40
+
  41
+
  42
+void Sys_BeginStreamedFile( fileHandle_t f, int readAhead )
  43
+{
  44
+}
  45
+
  46
+void Sys_EndStreamedFile( fileHandle_t f )
  47
+{
  48
+}
  49
+
  50
+int Sys_StreamedRead( void *buffer, int size, int count, fileHandle_t f )
  51
+{
  52
+  return FS_Read( buffer, size * count, f );
  53
+}
  54
+
  55
+void Sys_StreamSeek( fileHandle_t f, int offset, int origin )
  56
+{
  57
+  FS_Seek( f, offset, origin );
  58
+}
  59
+
  60
+void Sys_mkdir ( const char *path )
  61
+{
  62
+    Com_Printf("Using Sys_mkdir which has no programmed behaviour");
  63
+}
  64
+
  65
+void  Sys_Error( const char *error, ...)
  66
+{
  67
+	va_list	argptr;
  68
+	printf ("Sys_Error: ");	
  69
+	va_start (argptr,error);
  70
+	vprintf (error,argptr);
  71
+	va_end (argptr);
  72
+	printf ("\n");
  73
+
  74
+	exit (1);
  75
+}
  76
+
  77
+void Sys_Quit (void)
  78
+{
  79
+	exit (0);
  80
+}
  81
+
  82
+void Sys_UnloadGame (void)
  83
+{
  84
+}
  85
+
  86
+void* Sys_GetGameAPI (void *parms)
  87
+{
  88
+	return NULL;
  89
+}
  90
+
  91
+char* Sys_GetClipboardData( void )
  92
+{
  93
+	return NULL;
  94
+}
  95
+
  96
+char* Sys_FindFirst (char *path, unsigned musthave, unsigned canthave)
  97
+{
  98
+	return NULL;
  99
+}
  100
+
  101
+char* Sys_FindNext (unsigned musthave, unsigned canthave)
  102
+{
  103
+	return NULL;
  104
+}
  105
+
  106
+void Sys_FindClose ( void )
  107
+{
  108
+}
  109
+
  110
+void Sys_In_Restart_f( void )
  111
+{
  112
+    IN_Shutdown();
  113
+    IN_Init();
  114
+}
  115
+
  116
+void Sys_Init ( void )
  117
+{
  118
+    Cmd_AddCommand ("in_restart", Sys_In_Restart_f);
  119
+    Cvar_Set( "arch", "rim" );
  120
+    Cvar_Set( "username", Sys_GetCurrentUser() );
  121
+    IN_Init();
  122
+}
  123
+
  124
+void Sys_EarlyOutput( char *string )
  125
+{
  126
+	printf( "%s", string );
  127
+}
  128
+
  129
+void Sys_Print( const char *msg )
  130
+{
  131
+}
  132
+
  133
+char* Sys_ConsoleInput(void)
  134
+{
  135
+    return NULL;
  136
+}
  137
+
  138
+void Sys_QueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr )
  139
+{
  140
+  sysEvent_t  *ev;
  141
+
  142
+  ev = &eventQue[ eventHead & MASK_QUED_EVENTS ];
  143
+  if ( eventHead - eventTail >= MAX_QUED_EVENTS )
  144
+  {
  145
+    Com_Printf("Sys_QueEvent: overflow\n");
  146
+    // we are discarding an event, but don't leak memory
  147
+    if ( ev->evPtr )
  148
+    {
  149
+        Z_Free( ev->evPtr );
  150
+    }
  151
+    eventTail++;
  152
+  }
  153
+  eventHead++;
  154
+
  155
+  if ( time == 0 )
  156
+  {
  157
+      time = Sys_Milliseconds();
  158
+  }
  159
+
  160
+  ev->evTime = time;
  161
+  ev->evType = type;
  162
+  ev->evValue = value;
  163
+  ev->evValue2 = value2;
  164
+  ev->evPtrLength = ptrLength;
  165
+  ev->evPtr = ptr;
  166
+}
  167
+
  168
+void Sys_ConsoleInputShutdown()
  169
+{
  170
+  if (ttycon_on)
  171
+  {
  172
+    Com_Printf("Shutdown tty console\n");
  173
+  }
  174
+}
  175
+
  176
+void Sys_Exit( int ex )
  177
+{
  178
+    Sys_ConsoleInputShutdown();
  179
+
  180
+    #ifdef NDEBUG // regular behavior
  181
+        _exit(ex);
  182
+    #else
  183
+        // Give me a backtrace on error exits.
  184
+        assert( ex == 0 );
  185
+        exit(ex);
  186
+#endif
  187
+}
  188
+
  189
+sysEvent_t Sys_GetEvent( void )
  190
+{
  191
+    sysEvent_t  ev;
  192
+    char    *s;
  193
+    qmsg_t   netmsg;
  194
+    netadr_t  adr;
  195
+
  196
+    // return if we have data
  197
+    if ( eventHead > eventTail )
  198
+    {
  199
+        eventTail++;
  200
+        return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
  201
+    }
  202
+
  203
+    // pump the message loop in vga this calls KBD_Update, under X, it calls GetEvent
  204
+    Sys_SendKeyEvents ();
  205
+
  206
+    // check for console commands
  207
+    s = Sys_ConsoleInput();
  208
+    if ( s )
  209
+    {
  210
+        char  *b;
  211
+        int   len;
  212
+
  213
+        len = strlen( s ) + 1;
  214
+        b = Z_Malloc( len );
  215
+        strcpy( b, s );
  216
+        Sys_QueEvent( 0, SE_CONSOLE, 0, 0, len, b );
  217
+    }
  218
+
  219
+    // check for other input devices
  220
+    IN_Frame();
  221
+
  222
+    // check for network packets
  223
+    MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
  224
+    if ( Sys_GetPacket ( &adr, &netmsg ) )
  225
+    {
  226
+        netadr_t    *buf;
  227
+        int       len;
  228
+
  229
+        // copy out to a seperate buffer for qeueing
  230
+        len = sizeof( netadr_t ) + netmsg.cursize;
  231
+        buf = Z_Malloc( len );
  232
+        *buf = adr;
  233
+        memcpy( buf+1, netmsg.data, netmsg.cursize );
  234
+        Sys_QueEvent( 0, SE_PACKET, 0, 0, len, buf );
  235
+    }
  236
+
  237
+    // return if we have data
  238
+    if ( eventHead > eventTail )
  239
+    {
  240
+        eventTail++;
  241
+        return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
  242
+    }
  243
+
  244
+    // create an empty event to return
  245
+    memset( &ev, 0, sizeof( ev ) );
  246
+    ev.evTime = Sys_Milliseconds();
  247
+
  248
+    return ev;
  249
+}
  250
+
  251
+extern int UI_vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  );
  252
+extern void UI_dllEntry( int (QDECL *syscallptr)( int arg,... ) );
  253
+extern int CG_vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  );
  254
+extern void CG_dllEntry( int (QDECL *syscallptr)( int arg,... ) );
  255
+extern int G_vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11  );
  256
+extern void G_dllEntry( int (QDECL *syscallptr)( int arg,... ) );
  257
+
  258
+void* Sys_LoadDll( const char *name, char *fqpath , int (**entryPoint)(int, ...), int (*systemcalls)(int, ...) )
  259
+{
  260
+    void *libHandle;
  261
+    int  tmp=0;
  262
+    libHandle = &tmp;
  263
+
  264
+    if(strcmp(name, "ui") == 0)
  265
+    {
  266
+        *entryPoint = &UI_vmMain;
  267
+        UI_dllEntry( systemcalls );
  268
+        Q_strncpyz ( fqpath , "daisy_q3ui.lib" , MAX_QPATH );
  269
+    }
  270
+    else if(strcmp(name, "cgame") == 0)
  271
+    {
  272
+        *entryPoint = &CG_vmMain;
  273
+        CG_dllEntry( systemcalls );
  274
+        Q_strncpyz ( fqpath , "daisy_cgame.lib" , MAX_QPATH );
  275
+    }
  276
+    else if(strcmp(name, "qagame") == 0)
  277
+    {
  278
+        *entryPoint = &G_vmMain;
  279
+        G_dllEntry( systemcalls );
  280
+        Q_strncpyz ( fqpath , "daisy_game.lib" , MAX_QPATH );
  281
+    }
  282
+    else
  283
+    {
  284
+        Com_Printf("Error, Sys_LoadDll is loading unknown library: '%s'", name);
  285
+        exit( 0 );
  286
+    }
  287
+
  288
+    // Return arbitary value in order to indicate dll has been 'loaded'
  289
+    //  The only time this return value is actually used is when called with Sys_UnloadDll
  290
+    //  which simply ignores libHandle
  291
+    return libHandle;
  292
+}
  293
+
  294
+void Sys_UnloadDll( void *dllHandle )
  295
+{
  296
+}
  297
+
  298
+qboolean Sys_LowPhysicalMemory()
  299
+{
  300
+    return qfalse;
  301
+}
  302
+
  303
+void Sys_BeginProfiling( void )
  304
+{
  305
+}
  306
+
  307
+#ifdef __QNX__
  308
+int main(int argc, char **argv)
  309
+{
  310
+    char cmdline[] = "+set sv_pure 0 +set vm_ui 0 +set vm_game 0 +set vm_cgame 0 +set fs_basepath ./app/native";
  311
+	cvar_t* cv = NULL;
  312
+	char cmd_rundemo[100];
  313
+    Sys_SetDefaultCDPath("./app/native");
  314
+
  315
+    //saved_euid = geteuid();
  316
+
  317
+    // Clear the queues
  318
+    memset( &eventQue[0], 0, MAX_QUED_EVENTS*sizeof(sysEvent_t) );
  319
+    memset( &sys_packetReceived[0], 0, MAX_MSGLEN*sizeof(byte) );
  320
+
  321
+    // Initialize game
  322
+    Com_Init(cmdline);
  323
+    NET_Init();
  324
+
  325
+
  326
+	while (1)
  327
+	{
  328
+		Com_Frame();
  329
+	}
  330
+}
  331
+#endif
53  code/unix/qnx_net.c → code/blackberry/blackberry_net.c
@@ -25,11 +25,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 25
 #include <sys/time.h>
26 26
 #include <netinet/in.h>
27 27
 #include <errno.h>
28  
-#ifdef __QNXNTO__
  28
+#ifdef __QNX__
29 29
 #include <sys/types.h>
30 30
 #include <sys/socket.h>
31 31
 #include <netdb.h>
32  
-#include <arpa/inet.h> // bk001204
  32
+#include <arpa/inet.h>
33 33
 #include <sys/ioctl.h>
34 34
 #endif
35 35
 
@@ -61,7 +61,7 @@ char *NET_ErrorString (void)
61 61
 // sleeps msec or until net socket is ready
62 62
 void NET_Sleep(int msec)
63 63
 {
64  
-#if defined(RIM_NDK) || defined(__QNXNTO__)
  64
+#if defined(__QNX__)
65 65
     usleep(msec*1000);
66 66
 #else
67 67
     struct timeval timeout;
@@ -81,11 +81,6 @@ void NET_Sleep(int msec)
81 81
 #endif
82 82
 }
83 83
 
84  
-/*
85  
-==================
86  
-Sys_SendPacket
87  
-==================
88  
-*/
89 84
 void	Sys_SendPacket( int length, const void *data, netadr_t to )
90 85
 {
91 86
 	int		ret;
@@ -121,18 +116,10 @@ void	Sys_SendPacket( int length, const void *data, netadr_t to )
121 116
 	ret = sendto (net_socket, data, length, 0, (struct sockaddr *)&addr, sizeof(addr) );
122 117
 	if (ret == -1)
123 118
 	{
124  
-		Com_Printf ("NET_SendPacket ERROR: %s to %s\n", NET_ErrorString(),
125  
-				NET_AdrToString (to));
  119
+		Com_Printf ("NET_SendPacket ERROR: %s to %s\n", NET_ErrorString(), NET_AdrToString (to));
126 120
 	}
127 121
 }
128 122
 
129  
-/*
130  
-==================
131  
-Sys_GetPacket
132  
-
133  
-Never called by the game logic, just the system event queing
134  
-==================
135  
-*/
136 123
 qboolean	Sys_GetPacket (netadr_t *net_from, qmsg_t *net_message)
137 124
 {
138 125
 	int 	ret;
@@ -153,8 +140,7 @@ qboolean	Sys_GetPacket (netadr_t *net_from, qmsg_t *net_message)
153 140
 			continue;
154 141
 
155 142
 		fromlen = sizeof(from);
156  
-		ret = recvfrom (net_socket, net_message->data, net_message->maxsize
157  
-			, 0, (struct sockaddr *)&from, &fromlen);
  143
+		ret = recvfrom (net_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen);
158 144
 
159 145
 		SockadrToNetadr (&from, net_from);
160 146
 		// bk000305: was missing
@@ -184,26 +170,24 @@ qboolean	Sys_GetPacket (netadr_t *net_from, qmsg_t *net_message)
184 170
 	return qfalse;
185 171
 }
186 172
 
187  
-
188 173
 qboolean Sys_IsLANAddress (netadr_t adr)
189 174
 {
190 175
 	int		i;
191  
-
192  
-	if( adr.type == NA_LOOPBACK ) {
  176