Update Hedgeroid to current JNA version, remove workaround for a bug they fixed.
authorMedo <smaxein@googlemail.com>
Mon, 18 Feb 2013 00:22:16 +0100
changeset 8512d2bca8e68688
parent 8511 4f899fbce66d
child 8513 cd85ab23f38b
Update Hedgeroid to current JNA version, remove workaround for a bug they fixed.
project_files/Android-build/SDL-android-project/jni/jnidispatch/libjnidispatch.so
project_files/Android-build/SDL-android-project/libs/jna-3.5.1.jar
project_files/Android-build/SDL-android-project/libs/jna.jar
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Frontlib.java
     1.1 Binary file project_files/Android-build/SDL-android-project/jni/jnidispatch/libjnidispatch.so has changed
     2.1 Binary file project_files/Android-build/SDL-android-project/libs/jna-3.5.1.jar has changed
     3.1 Binary file project_files/Android-build/SDL-android-project/libs/jna.jar has changed
     4.1 --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Frontlib.java	Mon Feb 18 00:31:16 2013 +0400
     4.2 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Frontlib.java	Mon Feb 18 00:22:16 2013 +0100
     4.3 @@ -21,6 +21,7 @@
     4.4  package org.hedgewars.hedgeroid.frontlib;
     4.5  import java.io.UnsupportedEncodingException;
     4.6  import java.util.ArrayList;
     4.7 +import java.util.Arrays;
     4.8  import java.util.HashMap;
     4.9  import java.util.List;
    4.10  import java.util.Map;
    4.11 @@ -350,10 +351,14 @@
    4.12  	static class HogStruct extends Structure {
    4.13  		public static class ByVal extends HogStruct implements Structure.ByValue {}
    4.14  		public static class ByRef extends HogStruct implements Structure.ByReference {}
    4.15 -		private static String[] FIELD_ORDER = new String[] {"name", "hat", "rounds", "kills", "deaths", "suicides", "difficulty", "initialHealth", "weaponset"};
    4.16  
    4.17 -		public HogStruct() { super(); setFieldOrder(FIELD_ORDER); }
    4.18 -		public HogStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
    4.19 +		public HogStruct() { super(); }
    4.20 +		public HogStruct(Pointer ptr) { super(ptr); }
    4.21 +		
    4.22 +		@Override
    4.23 +		protected List<String> getFieldOrder() {
    4.24 +			return Arrays.asList("name", "hat", "rounds", "kills", "deaths", "suicides", "difficulty", "initialHealth", "weaponset");
    4.25 +		}
    4.26  		
    4.27  		public void fillFrom(Hog hog) {
    4.28  			difficulty = hog.level;
    4.29 @@ -382,10 +387,14 @@
    4.30  	static class TeamStruct extends Structure {
    4.31  		public static class ByVal extends TeamStruct implements Structure.ByValue {}
    4.32  		public static class ByRef extends TeamStruct implements Structure.ByReference {}
    4.33 -		private static String[] FIELD_ORDER = new String[] {"hogs", "name", "grave", "fort", "voicepack", "flag", "bindings", "bindingCount", "rounds", "wins", "campaignProgress", "colorIndex", "hogsInGame", "remoteDriven", "ownerName"};
    4.34  
    4.35 -		public TeamStruct() { super(); setFieldOrder(FIELD_ORDER); }
    4.36 -		public TeamStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
    4.37 +		public TeamStruct() { super(); }
    4.38 +		public TeamStruct(Pointer ptr) { super(ptr); }
    4.39 +		
    4.40 +		@Override
    4.41 +		protected List<String> getFieldOrder() {
    4.42 +			return Arrays.asList("hogs", "name", "grave", "fort", "voicepack", "flag", "bindings", "bindingCount", "rounds", "wins", "campaignProgress", "colorIndex", "hogsInGame", "remoteDriven", "ownerName");
    4.43 +		}
    4.44  		
    4.45  		public void fillFrom(Team team, TeamIngameAttributes attrs) {
    4.46  			if(team != null) {
    4.47 @@ -458,10 +467,14 @@
    4.48  	static class WeaponsetStruct extends Structure {
    4.49  		public static class ByVal extends WeaponsetStruct implements Structure.ByValue {}
    4.50  		public static class ByRef extends WeaponsetStruct implements Structure.ByReference {}
    4.51 -		private static String[] FIELD_ORDER = new String[] {"loadout", "crateprob", "crateammo", "delay", "name"};
    4.52 +		
    4.53 +		public WeaponsetStruct() { super(); }
    4.54 +		public WeaponsetStruct(Pointer ptr) { super(ptr); }
    4.55  		
    4.56 -		public WeaponsetStruct() { super(); setFieldOrder(FIELD_ORDER); }
    4.57 -		public WeaponsetStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
    4.58 +		@Override
    4.59 +		protected List<String> getFieldOrder() {
    4.60 +			return Arrays.asList("loadout", "crateprob", "crateammo", "delay", "name");
    4.61 +		}
    4.62  		
    4.63  		public void fillFrom(Weaponset weaponset) {
    4.64  			fillWeaponInfo(loadout, weaponset.loadout);
    4.65 @@ -501,10 +514,13 @@
    4.66  	 * Represents a flib_weaponset*, for use as part of a flib_weaponset**
    4.67  	 */
    4.68  	static class WeaponsetPointerByReference extends Structure implements Structure.ByReference {
    4.69 -		private static String[] FIELD_ORDER = new String[] {"weaponset"};
    4.70 +		public WeaponsetPointerByReference() { super(); }
    4.71 +		public WeaponsetPointerByReference(Pointer ptr) { super(ptr); }
    4.72  		
    4.73 -		public WeaponsetPointerByReference() { super(); setFieldOrder(FIELD_ORDER); }
    4.74 -		public WeaponsetPointerByReference(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
    4.75 +		@Override
    4.76 +		protected List<String> getFieldOrder() {
    4.77 +			return Arrays.asList("weaponset");
    4.78 +		}
    4.79  		
    4.80  		public WeaponsetStruct.ByRef weaponset;
    4.81  	}
    4.82 @@ -512,10 +528,14 @@
    4.83  	static class WeaponsetListStruct extends Structure {
    4.84  		public static class ByVal extends WeaponsetListStruct implements Structure.ByValue {}
    4.85  		public static class ByRef extends WeaponsetListStruct implements Structure.ByReference {}
    4.86 -		private static String[] FIELD_ORDER = new String[] {"weaponsetCount", "weaponsets"};
    4.87 +		
    4.88 +		public WeaponsetListStruct() { super(); }
    4.89 +		public WeaponsetListStruct(Pointer ptr) { super(ptr); }
    4.90  		
    4.91 -		public WeaponsetListStruct() { super(); setFieldOrder(FIELD_ORDER); }
    4.92 -		public WeaponsetListStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
    4.93 +		@Override
    4.94 +		protected List<String> getFieldOrder() {
    4.95 +			return Arrays.asList("weaponsetCount", "weaponsets");
    4.96 +		}
    4.97  		
    4.98  		public void fillFrom(List<Weaponset> list) {
    4.99  			weaponsetCount = list.size();
   4.100 @@ -560,11 +580,15 @@
   4.101  	static class RoomStruct extends Structure {
   4.102  		public static class ByVal extends RoomStruct implements Structure.ByValue {}
   4.103  		public static class ByRef extends RoomStruct implements Structure.ByReference {}
   4.104 -		private static String[] FIELD_ORDER = new String[] {"inProgress", "name", "playerCount", "teamCount", "owner", "map", "scheme", "weapons"};
   4.105  		
   4.106 -		public RoomStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.107 -		public RoomStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.108 +		public RoomStruct() { super(); }
   4.109 +		public RoomStruct(Pointer ptr) { super(ptr); }
   4.110  
   4.111 +		@Override
   4.112 +		protected List<String> getFieldOrder() {
   4.113 +			return Arrays.asList("inProgress", "name", "playerCount", "teamCount", "owner", "map", "scheme", "weapons");
   4.114 +		}
   4.115 +		
   4.116  		public Room toRoomlistRoom() {
   4.117  			return new Room(name, map, scheme, weapons, owner, playerCount, teamCount, inProgress);
   4.118  		}
   4.119 @@ -582,10 +606,14 @@
   4.120  	static class MapRecipeStruct extends Structure {
   4.121  		public static class ByVal extends MapRecipeStruct implements Structure.ByValue {}
   4.122  		public static class ByRef extends MapRecipeStruct implements Structure.ByReference {}
   4.123 -		private static String[] FIELD_ORDER = new String[] {"mapgen", "name", "seed", "theme", "drawData", "drawDataSize", "templateFilter", "mazeSize"};
   4.124 +		
   4.125 +		public MapRecipeStruct() { super(); }
   4.126 +		public MapRecipeStruct(Pointer ptr) { super(ptr); }
   4.127  		
   4.128 -		public MapRecipeStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.129 -		public MapRecipeStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.130 +		@Override
   4.131 +		protected List<String> getFieldOrder() {
   4.132 +			return Arrays.asList("mapgen", "name", "seed", "theme", "drawData", "drawDataSize", "templateFilter", "mazeSize");
   4.133 +		}
   4.134  		
   4.135  		public void fillFrom(MapRecipe map) {
   4.136  			mapgen = map.mapgen;
   4.137 @@ -593,24 +621,14 @@
   4.138  			seed = map.seed;
   4.139  			theme = map.theme;
   4.140  			byte[] buf = map.getDrawData();
   4.141 -			if(buf==null || buf.length==0) {
   4.142 -				drawData = null;
   4.143 -			} else {
   4.144 -				drawData = ByteArrayPtr.createJavaOwned(buf).getPointer();
   4.145 -			}
   4.146 +			drawData = ByteArrayPtr.createJavaOwned(buf);
   4.147  			drawDataSize = NativeSizeT.valueOf(buf==null ? 0 : buf.length);
   4.148  			templateFilter = map.templateFilter;
   4.149  			mazeSize = map.mazeSize;
   4.150  		}
   4.151  		
   4.152  		public MapRecipe toMapRecipe() {
   4.153 -			byte[] buf;
   4.154 -			int size = drawDataSize.intValue();
   4.155 -			if(size>0) {
   4.156 -				buf = drawData.getByteArray(0, size);
   4.157 -			} else {
   4.158 -				buf = null;
   4.159 -			}
   4.160 +			byte[] buf = ByteArrayPtr.deref(drawData, drawDataSize.intValue());
   4.161  			return new MapRecipe(mapgen, templateFilter, mazeSize, name, seed, theme, buf);
   4.162  		}
   4.163  		
   4.164 @@ -618,7 +636,7 @@
   4.165  		public String name;
   4.166  		public String seed;
   4.167  		public String theme;
   4.168 -		public Pointer drawData;			// We can't use ByteArrayPtr in a struct because JNA will overwrite the value with NULL - probably a bug.
   4.169 +		public ByteArrayPtr drawData;
   4.170  		public NativeSizeT drawDataSize;
   4.171  		public int templateFilter;
   4.172  		public int mazeSize;
   4.173 @@ -627,10 +645,14 @@
   4.174  	static class MetaschemeSettingStruct extends Structure {
   4.175  		public static class ByVal extends MetaschemeSettingStruct implements Structure.ByValue {}
   4.176  		public static class ByRef extends MetaschemeSettingStruct implements Structure.ByReference {}
   4.177 -		private static String[] FIELD_ORDER = new String[] {"name", "engineCommand", "maxMeansInfinity", "times1000", "min", "max", "def"};
   4.178 +		
   4.179 +		public MetaschemeSettingStruct() { super(); }
   4.180 +		public MetaschemeSettingStruct(Pointer ptr) { super(ptr); }
   4.181  		
   4.182 -		public MetaschemeSettingStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.183 -		public MetaschemeSettingStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.184 +		@Override
   4.185 +		protected List<String> getFieldOrder() {
   4.186 +			return Arrays.asList("name", "engineCommand", "maxMeansInfinity", "times1000", "min", "max", "def");
   4.187 +		}
   4.188  		
   4.189  		public void fillFrom(Setting setting) {
   4.190  			name = setting.name;
   4.191 @@ -658,10 +680,14 @@
   4.192  	static class MetaschemeModStruct extends Structure {
   4.193  		public static class ByVal extends MetaschemeModStruct implements Structure.ByValue {}
   4.194  		public static class ByRef extends MetaschemeModStruct implements Structure.ByReference {}
   4.195 -		private static String[] FIELD_ORDER = new String[] {"name", "bitmaskIndex"};
   4.196 +		
   4.197 +		public MetaschemeModStruct() { super(); }
   4.198 +		public MetaschemeModStruct(Pointer ptr) { super(ptr); }
   4.199  		
   4.200 -		public MetaschemeModStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.201 -		public MetaschemeModStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.202 +		@Override
   4.203 +		protected List<String> getFieldOrder() {
   4.204 +			return Arrays.asList("name", "bitmaskIndex");
   4.205 +		}
   4.206  		
   4.207  		public void fillFrom(Mod mod) {
   4.208  			name = mod.name;
   4.209 @@ -681,10 +707,13 @@
   4.210  		public static class ByVal extends MetaschemeStruct implements Structure.ByValue {}
   4.211  		public static class ByRef extends MetaschemeStruct implements Structure.ByReference {}
   4.212  
   4.213 -		private static String[] FIELD_ORDER = new String[] {"settingCount", "modCount", "settings", "mods"};
   4.214 +		public MetaschemeStruct() { super(); }
   4.215 +		public MetaschemeStruct(Pointer ptr) { super(ptr); }
   4.216  		
   4.217 -		public MetaschemeStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.218 -		public MetaschemeStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.219 +		@Override
   4.220 +		protected List<String> getFieldOrder() {
   4.221 +			return Arrays.asList("settingCount", "modCount", "settings", "mods");
   4.222 +		}
   4.223  		
   4.224  		/**
   4.225  		 * Only use on native-owned structs!
   4.226 @@ -720,10 +749,14 @@
   4.227  	static class SchemeStruct extends Structure {
   4.228  		public static class ByVal extends SchemeStruct implements Structure.ByValue {}
   4.229  		public static class ByRef extends SchemeStruct implements Structure.ByReference {}
   4.230 -		private static String[] FIELD_ORDER = new String[] {"name", "settings", "mod"};
   4.231 +		
   4.232 +		public SchemeStruct() { super(); }
   4.233 +		public SchemeStruct(Pointer ptr) { super(ptr); }
   4.234  		
   4.235 -		public SchemeStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.236 -		public SchemeStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.237 +		@Override
   4.238 +		protected List<String> getFieldOrder() {
   4.239 +			return Arrays.asList("name", "settings", "mods");
   4.240 +		}
   4.241  		
   4.242  		public void fillFrom(Scheme scheme) {
   4.243  			MetaScheme meta = MetaScheme.INSTANCE;
   4.244 @@ -762,10 +795,13 @@
   4.245  	 * Represents a flib_scheme*, for use as part of a flib_scheme**
   4.246  	 */
   4.247  	static class SchemePointerByReference extends Structure implements Structure.ByReference {
   4.248 -		private static String[] FIELD_ORDER = new String[] {"scheme"};
   4.249 +		public SchemePointerByReference() { super(); }
   4.250 +		public SchemePointerByReference(Pointer ptr) { super(ptr); }
   4.251  		
   4.252 -		public SchemePointerByReference() { super(); setFieldOrder(FIELD_ORDER); }
   4.253 -		public SchemePointerByReference(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.254 +		@Override
   4.255 +		protected List<String> getFieldOrder() {
   4.256 +			return Arrays.asList("scheme");
   4.257 +		}
   4.258  		
   4.259  		public SchemeStruct.ByRef scheme;
   4.260  	}
   4.261 @@ -773,10 +809,14 @@
   4.262  	static class SchemelistStruct extends Structure {
   4.263  		public static class ByVal extends SchemelistStruct implements Structure.ByValue {}
   4.264  		public static class ByRef extends SchemelistStruct implements Structure.ByReference {}
   4.265 -		private static String[] FIELD_ORDER = new String[] {"schemeCount", "schemes"};
   4.266 +		
   4.267 +		public SchemelistStruct() { super(); }
   4.268 +		public SchemelistStruct(Pointer ptr) { super(ptr); }
   4.269  		
   4.270 -		public SchemelistStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.271 -		public SchemelistStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.272 +		@Override
   4.273 +		protected List<String> getFieldOrder() {
   4.274 +			return Arrays.asList("schemeCount", "schemes");
   4.275 +		}
   4.276  		
   4.277  		public void fillFrom(List<Scheme> schemeList) {
   4.278  			schemeCount = schemeList.size();
   4.279 @@ -823,10 +863,13 @@
   4.280  	 * Represents a flib_team*, for use as part of a flib_team**
   4.281  	 */
   4.282  	static class TeamPointerByReference extends Structure implements Structure.ByReference {
   4.283 -		private static String[] FIELD_ORDER = new String[] {"team"};
   4.284 +		public TeamPointerByReference() { super(); }
   4.285 +		public TeamPointerByReference(Pointer ptr) { super(ptr); }
   4.286  		
   4.287 -		public TeamPointerByReference() { super(); setFieldOrder(FIELD_ORDER); }
   4.288 -		public TeamPointerByReference(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.289 +		@Override
   4.290 +		protected List<String> getFieldOrder() {
   4.291 +			return Arrays.asList("team");
   4.292 +		}
   4.293  		
   4.294  		public TeamStruct.ByRef team;
   4.295  	}
   4.296 @@ -835,10 +878,13 @@
   4.297  		public static class ByVal extends TeamlistStruct implements Structure.ByValue {}
   4.298  		public static class ByRef extends TeamlistStruct implements Structure.ByReference {}
   4.299  
   4.300 -		private static String[] FIELD_ORDER = new String[] {"teamCount", "teams"};
   4.301 +		public TeamlistStruct() { super(); }
   4.302 +		public TeamlistStruct(Pointer ptr) { super(ptr); }
   4.303  		
   4.304 -		public TeamlistStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.305 -		public TeamlistStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.306 +		@Override
   4.307 +		protected List<String> getFieldOrder() {
   4.308 +			return Arrays.asList("teamCount", "teams");
   4.309 +		}
   4.310  		
   4.311  		public void fillFrom(List<TeamInGame> teamList, WeaponsetStruct.ByRef weaponset, int initialHealth) {
   4.312  			teamCount = teamList.size();
   4.313 @@ -878,10 +924,14 @@
   4.314  	static class GameSetupStruct extends Structure {
   4.315  		public static class ByVal extends GameSetupStruct implements Structure.ByValue {}
   4.316  		public static class ByRef extends GameSetupStruct implements Structure.ByReference {}
   4.317 -		private static String[] FIELD_ORDER = new String[] {"script", "gamescheme", "map", "teamlist"};
   4.318 +		
   4.319 +		public GameSetupStruct() { super(); }
   4.320 +		public GameSetupStruct(Pointer ptr) { super(ptr); }
   4.321  		
   4.322 -		public GameSetupStruct() { super(); setFieldOrder(FIELD_ORDER); }
   4.323 -		public GameSetupStruct(Pointer ptr) { super(ptr); setFieldOrder(FIELD_ORDER); }
   4.324 +		@Override
   4.325 +		protected List<String> getFieldOrder() {
   4.326 +			return Arrays.asList("script", "gamescheme", "map", "teamlist");
   4.327 +		}
   4.328  		
   4.329  		public void fillFrom(GameConfig conf) {
   4.330  			script = conf.style;