--- a/hedgewars/PascalExports.pas Mon Jul 18 14:41:08 2011 +0200
+++ b/hedgewars/PascalExports.pas Thu Aug 04 17:17:21 2011 +0200
@@ -32,6 +32,9 @@
{$INCLUDE "config.inc"}
procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export;
+function HW_getNumberOfWeapons:LongInt; cdecl; export;
+function HW_getMaxNumberOfTeams:LongInt; cdecl; export;
+function HW_getMaxNumberOfHogs:LongInt; cdecl; export;
implementation
{$IFDEF HWLIBRARY}
--- a/hedgewars/hwLibrary.pas Mon Jul 18 14:41:08 2011 +0200
+++ b/hedgewars/hwLibrary.pas Thu Aug 04 17:17:21 2011 +0200
@@ -18,14 +18,45 @@
Library hwLibrary;
+{$IFDEF fpc}
+{$MODE delphi}
+{$ENDIF}
+
+{$IFDEF ANDROID}
+ {$MACRO ON}
+ {$DEFINE Java_Prefix := 'Java_org_hedgewars_mobile_EngineProtocol_PascalExports_'}
+{$ENDIF}
+
// 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)
// 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)
-uses PascalExports, hwengine;
-exports Game, HW_versionInfo;
+uses PascalExports, hwengine{$IFDEF ANDROID},jni{$ENDIF};
+exports Game{$IFNDEF ANDROID}, HW_versionInfo{$ENDIF};
+
+function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl;
+begin
+ JNI_HW_versionInfoNet := cNetProtoVersion;
+end;
+
+function JNI_HW_versionInfoVersion(env: PJNIEnv; obj: JObject):JString; cdecl;
+begin
+ JNI_HW_versionInfoVersion := env^.NewStringUTF(env, PChar(cVersionString));
+end;
+
+
+{$IFDEF ANDROID}
+ exports
+ JNI_HW_versionInfoNet name Java_Prefix+'HWversionInfoNetProto',
+ JNI_HW_versionInfoVersion name Java_Prefix+'HWversionInfoVersion',
+ GenLandPreview name Java_Prefix + 'GenLandPreview',
+ HW_getNumberOfweapons name Java_Prefix + 'HWgetNumberOfWeapons',
+ HW_getMaxNumberOfHogs name Java_Prefix + 'HWgetMaxNumberOfHogs',
+ HW_getMaxNumberOfTeams name Java_Prefix + 'HWgetMaxNumberOfTeams';
+{$ENDIF}
+
begin
end.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/EngineProtocol/PascalExports.java Thu Aug 04 17:17:21 2011 +0200
@@ -0,0 +1,22 @@
+package org.hedgewars.mobile.EngineProtocol;
+
+public class PascalExports {
+
+ static{
+ System.loadLibrary("SDL");
+ System.loadLibrary("SDL_image");
+ System.loadLibrary("mikmod");
+ System.loadLibrary("SDL_net");
+ System.loadLibrary("SDL_mixer");
+ System.loadLibrary("SDL_ttf");
+ System.loadLibrary("lua5.1");
+ System.loadLibrary("hwengine");
+ }
+
+ public static native int HWversionInfoNetProto();
+ public static native String HWversionInfoVersion();
+ public static native int HWgetNumberOfWeapons();
+ public static native int HWgetMaxNumberOfTeams();
+ public static native int HWgetMaxNumberOfHogs();
+
+}