project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/PascalExports.java
author sheepluva
Sat, 07 Dec 2019 16:18:20 +0100
branchhedgeroid
changeset 15512 45d6806548e9
parent 10017 de822cd3df3a
permissions -rw-r--r--
hedgeroid: add debug logging to library loading
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     1
/*
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
6700
e04da46ee43c the most important commit of the year
koda
parents: 6047
diff changeset
     3
 * Copyright (c) 2011-2012 Richard Deurwaarder <xeli@xelification.com>
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     4
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
     5
 *
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     6
 * This program is free software; you can redistribute it and/or
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     7
 * modify it under the terms of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     8
 * as published by the Free Software Foundation; either version 2
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     9
 * of the License, or (at your option) any later version.
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    10
 *
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful,
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    14
 * GNU General Public License for more details.
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    15
 *
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    17
 * along with this program; if not, write to the Free Software
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    19
 */
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    20
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    21
package org.hedgewars.hedgeroid.EngineProtocol;
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    22
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    23
public class PascalExports {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    24
    public static Object engineMutex = new Object();
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    25
15512
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    26
    protected final static String[] libs = {
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    27
        "SDL2",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    28
        "SDL2_image",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    29
        "mikmod",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    30
        "SDL2_net",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    31
        "SDL2_mixer",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    32
        "SDL2_ttf",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    33
        "lua",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    34
        "physfs",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    35
        "physlayer",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    36
        "hwengine",
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    37
    };
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    38
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    39
    static{
15512
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    40
        for (String l : libs) {
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    41
            try {
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    42
                android.util.Log.d("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) is attempting to load library '" + l + "' ...");
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    43
                System.loadLibrary(l);
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    44
                android.util.Log.d("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) successfully loaded library '" + l + "'.");
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    45
            } catch (Exception ex) {
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    46
                android.util.Log.e("org.hedgewars.hedgeroid.EngineProtocol.PascalExports", "Hedgewars (class PascalExports) failed to load library '" + l + "':" + ex.getMessage());
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    47
                throw ex;
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    48
            }
45d6806548e9 hedgeroid: add debug logging to library loading
sheepluva
parents: 10017
diff changeset
    49
        }
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    50
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    51
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    52
    public static native int HWgetMaxNumberOfTeams();
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
    53
    private static native void HWGenLandPreview(int port);
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
    54
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
    55
    public static void synchronizedGenLandPreview(int port) {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    56
        synchronized(engineMutex) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    57
            HWGenLandPreview(port);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    58
        }
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents: 7508
diff changeset
    59
    }
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8538
diff changeset
    60
6047
10011f051f9c Changed package name from org.hedgewars.mobile to org.hedgewars.hedgeroid to upload it to the market
Xeli
parents:
diff changeset
    61
}