project_files/frontlib/extra/jnacontrol.c
author alfadur
Sat, 03 Aug 2019 17:10:19 +0300
changeset 15296 07ab4206f2a9
parent 10017 de822cd3df3a
permissions -rw-r--r--
fix condition
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     1
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     2
 * Hedgewars, a free turn based strategy game
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     4
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     5
 * This program is free software; you can redistribute it and/or
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     6
 * modify it under the terms of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     8
 * of the License, or (at your option) any later version.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
     9
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    13
 * GNU General Public License for more details.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    14
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    15
 * You should have received a copy of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    16
 * along with this program; if not, write to the Free Software
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    18
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    19
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    20
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    21
 * This file is not directly part of the frontlib and is not required to build it.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    22
 * However, it is recommended to include it in compilation when building for Android. The purpose of this file
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    23
 * is to ensure consistency between the function signatures of the JNA Java bindings of the Android port and the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    24
 * frontlib functions.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    25
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    26
 * This file, in essence, consists only of function declarations. They are duplicates of function declarations
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    27
 * from the frontlib headers that are referenced from JNA bindings. If the signature of one of these functions
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    28
 * changes in the frontlib, it will no longer match the signature in this file, and the compiler will show an error.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    29
 * If that happens, you need to update the JNA bindings in Hedgeroid to match the new function signature, and then
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    30
 * update this file.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    31
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    32
 * The reason for all this is that JNA does not actually know the function signatures of the functions it binds,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    33
 * it derives them from Java method declarations. If those do not match the actual function signatures, you will
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    34
 * only notice when you suddenly get strange (and possibly hard to track down) problems at runtime. This file is
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    35
 * an attempt to detect these problems at compile time instead. Notice that it will NOT detect changes to structs
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    36
 * or constants though, which also require updates to the JNA bindings.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    37
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    38
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    39
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    40
 * Before we include the frontlib headers, we define away the const keyword. This is necessary because there is no
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    41
 * distinction between const and non-const types on the JNA side, and we don't want the compiler to complain because
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    42
 * of bad constness.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    43
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    44
 * This is so evil, but it works...
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    45
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    46
#define const
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    47
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    48
#include "../frontlib.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    49
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    50
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    51
 * Now we map the Java types to the corresponding C types...
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    52
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    53
typedef flib_netconn *NetconnPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    54
typedef flib_gameconn *GameconnPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    55
typedef flib_mapconn *MapconnPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    56
typedef flib_metascheme *MetaschemePtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    57
typedef flib_room **RoomArrayPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    58
typedef flib_weaponset *WeaponsetPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    59
typedef flib_weaponsetlist *WeaponsetListPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    60
typedef flib_map *MapRecipePtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    61
typedef flib_scheme *SchemePtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    62
typedef flib_schemelist *SchemelistPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    63
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    64
typedef flib_room *RoomPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    65
typedef flib_team *TeamPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    66
typedef flib_gamesetup *GameSetupPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    67
typedef bool boolean;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    68
typedef size_t NativeSizeT;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    69
typedef void *Pointer;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    70
typedef uint8_t *ByteArrayPtr;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    71
typedef char *String;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    72
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    73
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    74
 * Mapping callback types
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    75
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    76
typedef void (*VoidCallback)(Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    77
typedef void (*StrCallback)(Pointer context, String arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    78
typedef void (*IntCallback)(Pointer context, int arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    79
typedef void (*IntStrCallback)(Pointer context, int arg1, String arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    80
typedef void (*StrIntCallback)(Pointer context, String arg1, int arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    81
typedef void (*StrStrCallback)(Pointer context, String arg1, String arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    82
typedef void (*StrStrBoolCallback)(Pointer context, String arg1, String arg2, boolean arg3);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    83
typedef void (*RoomCallback)(Pointer context, RoomPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    84
typedef void (*RoomListCallback)(Pointer context, RoomArrayPtr arg1, int arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    85
typedef void (*StrRoomCallback)(Pointer context, String arg1, RoomPtr arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    86
typedef void (*BoolCallback)(Pointer context, boolean arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    87
typedef void (*StrBoolCallback)(Pointer context, String arg1, boolean arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    88
typedef void (*TeamCallback)(Pointer context, TeamPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    89
typedef void (*BytesCallback)(Pointer context, const uint8_t *buffer, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    90
typedef void (*BytesBoolCallback)(Pointer context, const uint8_t *buffer, NativeSizeT size, boolean arg3);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    91
typedef void (*SchemeCallback)(Pointer context, SchemePtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    92
typedef void (*MapIntCallback)(Pointer context, MapRecipePtr arg1, int arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    93
typedef void (*WeaponsetCallback)(Pointer context, WeaponsetPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    94
typedef void (*MapimageCallback)(Pointer context, const uint8_t *mapimage, int hogs);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    95
typedef void (*LogCallback)(int arg1, String arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    96
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    97
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    98
 * Below here are the copypasted method declarations from the JNA bindings
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
    99
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   100
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   101
    // frontlib.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   102
    int flib_init();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   103
    void flib_quit();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   104
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   105
    // hwconsts.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   106
    int flib_get_teamcolor_count();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   107
    int flib_get_hedgehogs_per_team();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   108
    int flib_get_weapons_count();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   109
    MetaschemePtr flib_get_metascheme();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   110
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   111
    // net/netconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   112
    NetconnPtr flib_netconn_create(String playerName, String dataDirPath, String host, int port);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   113
    void flib_netconn_destroy(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   114
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   115
    void flib_netconn_tick(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   116
    boolean flib_netconn_is_chief(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   117
    String flib_netconn_get_playername(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   118
    GameSetupPtr flib_netconn_create_gamesetup(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   119
    int flib_netconn_send_quit(NetconnPtr conn, String quitmsg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   120
    int flib_netconn_send_chat(NetconnPtr conn, String chat);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   121
    int flib_netconn_send_teamchat(NetconnPtr conn, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   122
    int flib_netconn_send_password(NetconnPtr conn, String passwd);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   123
    int flib_netconn_send_nick(NetconnPtr conn, String nick);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   124
    int flib_netconn_send_request_roomlist(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   125
    int flib_netconn_send_joinRoom(NetconnPtr conn, String room);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   126
    int flib_netconn_send_createRoom(NetconnPtr conn, String room);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   127
    int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   128
    int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   129
    int flib_netconn_send_toggleReady(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   130
    int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   131
    int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   132
    int flib_netconn_send_engineMessage(NetconnPtr conn, ByteArrayPtr message, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   133
    int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   134
    int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   135
    int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   136
    int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   137
    int flib_netconn_send_mapName(NetconnPtr conn, String mapName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   138
    int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   139
    int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   140
    int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   141
    int flib_netconn_send_mapSeed(NetconnPtr conn, String seed);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   142
    int flib_netconn_send_mapTheme(NetconnPtr conn, String theme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   143
    int flib_netconn_send_mapDrawdata(NetconnPtr conn, ByteArrayPtr drawData, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   144
    int flib_netconn_send_script(NetconnPtr conn, String scriptName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   145
    int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   146
    int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   147
    int flib_netconn_send_ban(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   148
    int flib_netconn_send_kick(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   149
    int flib_netconn_send_playerInfo(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   150
    int flib_netconn_send_playerFollow(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   151
    int flib_netconn_send_startGame(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   152
    int flib_netconn_send_toggleRestrictJoins(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   153
    int flib_netconn_send_toggleRestrictTeams(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   154
    int flib_netconn_send_clearAccountsCache(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   155
    int flib_netconn_send_setServerVar(NetconnPtr conn, String name, String value);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   156
    int flib_netconn_send_getServerVars(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   157
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   158
    void flib_netconn_onMessage(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   159
    void flib_netconn_onClientFlags(NetconnPtr conn, StrStrBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   160
    void flib_netconn_onChat(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   161
    void flib_netconn_onConnected(NetconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   162
    void flib_netconn_onDisconnected(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   163
    void flib_netconn_onRoomlist(NetconnPtr conn, RoomListCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   164
    void flib_netconn_onRoomAdd(NetconnPtr conn, RoomCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   165
    void flib_netconn_onRoomDelete(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   166
    void flib_netconn_onRoomUpdate(NetconnPtr conn, StrRoomCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   167
    void flib_netconn_onLobbyJoin(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   168
    void flib_netconn_onLobbyLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   169
    void flib_netconn_onNickTaken(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   170
    void flib_netconn_onPasswordRequest(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   171
    void flib_netconn_onEnterRoom(NetconnPtr conn, BoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   172
    void flib_netconn_onLeaveRoom(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   173
    void flib_netconn_onTeamAdd(NetconnPtr conn, TeamCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   174
    void flib_netconn_onTeamDelete(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   175
    void flib_netconn_onRoomJoin(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   176
    void flib_netconn_onRoomLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   177
    void flib_netconn_onRunGame(NetconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   178
    void flib_netconn_onTeamAccepted(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   179
    void flib_netconn_onHogCountChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   180
    void flib_netconn_onTeamColorChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   181
    void flib_netconn_onEngineMessage(NetconnPtr conn, BytesCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   182
    void flib_netconn_onSchemeChanged(NetconnPtr conn, SchemeCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   183
    void flib_netconn_onMapChanged(NetconnPtr conn, MapIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   184
    void flib_netconn_onScriptChanged(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   185
    void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   186
    void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   187
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   188
    // ipc/gameconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   189
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   190
    GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   191
    GameconnPtr flib_gameconn_create_playdemo(ByteArrayPtr demo, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   192
    GameconnPtr flib_gameconn_create_loadgame(String playerName, ByteArrayPtr save, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   193
    GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   194
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   195
    void flib_gameconn_destroy(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   196
    int flib_gameconn_getport(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   197
    void flib_gameconn_tick(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   198
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   199
    int flib_gameconn_send_enginemsg(GameconnPtr conn, ByteArrayPtr data, NativeSizeT len);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   200
    int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   201
    int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   202
    int flib_gameconn_send_quit(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   203
    int flib_gameconn_send_cmd(GameconnPtr conn, String cmdString);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   204
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   205
    void flib_gameconn_onConnect(GameconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   206
    void flib_gameconn_onDisconnect(GameconnPtr conn, IntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   207
    void flib_gameconn_onErrorMessage(GameconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   208
    void flib_gameconn_onChat(GameconnPtr conn, StrBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   209
    void flib_gameconn_onGameRecorded(GameconnPtr conn, BytesBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   210
    void flib_gameconn_onEngineMessage(GameconnPtr conn, BytesCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   211
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   212
    // ipc/mapconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   213
    MapconnPtr flib_mapconn_create(MapRecipePtr mapdesc);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   214
    void flib_mapconn_destroy(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   215
    int flib_mapconn_getport(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   216
    void flib_mapconn_onSuccess(MapconnPtr conn, MapimageCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   217
    void flib_mapconn_onFailure(MapconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   218
    void flib_mapconn_tick(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   219
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   220
    // model/schemelist.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   221
    SchemelistPtr flib_schemelist_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   222
    int flib_schemelist_to_ini(String filename, SchemelistPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   223
    void flib_schemelist_destroy(SchemelistPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   224
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   225
    // model/team.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   226
    TeamPtr flib_team_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   227
    int flib_team_to_ini(String filename, TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   228
    void flib_team_destroy(TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   229
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   230
    // model/weapon.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   231
    WeaponsetListPtr flib_weaponsetlist_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   232
    int flib_weaponsetlist_to_ini(String filename, WeaponsetListPtr weaponsets);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   233
    void flib_weaponsetlist_destroy(WeaponsetListPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   234
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   235
    // model/gamesetup.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   236
    void flib_gamesetup_destroy(GameSetupPtr gamesetup);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   237
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   238
    // util/logging.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   239
    void flib_log_setLevel(int level);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7691
diff changeset
   240
    void flib_log_setCallback(LogCallback callback);