# HG changeset patch # User koda # Date 1317748842 -7200 # Node ID 6bcc36225162b237cfdc0006232f6db035de84b3 # Parent 95d565991edd2e9f6a3285d9e14fe3c549ba878f fix compiling for android, strip out all delphi code, objfpc ftw diff -r 95d565991edd -r 6bcc36225162 hedgewars/hwLibrary.pas --- a/hedgewars/hwLibrary.pas Tue Oct 04 17:18:25 2011 +0200 +++ b/hedgewars/hwLibrary.pas Tue Oct 04 19:20:42 2011 +0200 @@ -17,26 +17,31 @@ *) Library hwLibrary; - +{$INCLUDE "options.inc"} -// Add all your Pascal units to the "uses" clause below to add them to the program. +// Add all your Pascal units to the 'uses' clause below to add them to the program. // Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using -// "cdecl; export;" (see the fpclogo.pas unit for an example), and then add C-declarations for -// these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group) +// 'cdecl; export;' (see the fpclogo.pas unit for an example), and then add C-declarations for +// these procedures/functions to the PascalImports.h file (also in the 'Pascal Sources' group) // to make these functions available in the C/C++/Objective-C source files -// (add "#include PascalImports.h" near the top of these files if it's not there yet) +// (add '#include PascalImports.h' near the top of these files if it is not there yet) uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF}; exports Game, HW_versionInfo; {$IFDEF ANDROID} function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl; begin - JNI_HW_versionInfoNet := cNetProtoVersion; + env:= env; // avoid hint + obj:= obj; // avoid hint + JNI_HW_versionInfoNet:= cNetProtoVersion; end; function JNI_HW_versionInfoVersion(env: PJNIEnv; obj: JObject):JString; cdecl; +var envderef : JNIEnv; begin - JNI_HW_versionInfoVersion := env^.NewStringUTF(env, PChar(cVersionString)); + obj:= obj; // avoid hint + envderef:= @env; + JNI_HW_versionInfoVersion := envderef^.NewStringUTF(env, PChar(cVersionString)); end; exports diff -r 95d565991edd -r 6bcc36225162 hedgewars/options.inc --- a/hedgewars/options.inc Tue Oct 04 17:18:25 2011 +0200 +++ b/hedgewars/options.inc Tue Oct 04 19:20:42 2011 +0200 @@ -28,7 +28,6 @@ {$DEFINE GLunit:=GL} {$IFDEF ANDROID} - {$MODE delphi} {$DEFINE SDL13} {$DEFINE HWLIBRARY} {$DEFINE S3D_DISABLED} @@ -43,7 +42,10 @@ {$DEFINE S3D_DISABLED} {$DEFINE GLunit:=gles11} {$DEFINE MOBILE} -{$ELSE} +{$ENDIF} + +{$IFNDEF IPHONEOS} + // not needed on ios because it is switched from the compiler command line arguments {$DEFINE DEBUGFILE} //{$DEFINE TRACEAIACTIONS} //{$DEFINE COUNTTICKS} diff -r 95d565991edd -r 6bcc36225162 hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Tue Oct 04 17:18:25 2011 +0200 +++ b/hedgewars/uConsole.pas Tue Oct 04 19:20:42 2011 +0200 @@ -93,9 +93,9 @@ function ShortStringAsPChar(s: ShortString) : PChar; begin - if Length(S) = High(s) then Dec(s[0]); + if Length(s) = High(s) then Dec(s[0]); s[Ord(Length(s))+1] := #0; - Result := @S[1]; + exit(@s[1]); end; function GetLastConsoleLine: shortstring; diff -r 95d565991edd -r 6bcc36225162 project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java Tue Oct 04 17:18:25 2011 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java Tue Oct 04 19:20:42 2011 +0200 @@ -283,7 +283,7 @@ // Runs SDL_main() with added parameters SDLActivity.nativeInit(new String[] { String.valueOf(ipc.port), String.valueOf(surfaceWidth), String.valueOf(surfaceHeight), - "0", "null", "xeli", "1", "1", "1", "0", "", path }); + "0", "null", "xeli", "1", "1", "1", path, "" }); try { ipc.quitIPC(); diff -r 95d565991edd -r 6bcc36225162 project_files/Android-build/Templates/Makefile.android --- a/project_files/Android-build/Templates/Makefile.android Tue Oct 04 17:18:25 2011 +0200 +++ b/project_files/Android-build/Templates/Makefile.android Tue Oct 04 19:20:42 2011 +0200 @@ -1,7 +1,7 @@ SDL_ANDROID_DIR=./SDL-android-project PPCROSSARM=${FPC_DIR}/compiler/ppcrossarm -PPCROSSARM_FLAGS= -Xd -O- -Tlinux -XParm-linux-androideabi- -vwnh -XS -a- +PPCROSSARM_FLAGS= -Xd -O- -Tlinux -XParm-linux-androideabi- -vwnh -XS -a- -B PPCROSSARM_INCLUDES= \ -FD${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin \ -Fu${FPC_DIR}/rtl/units/arm-linux \