project_files/frontlib/extra/jnacontrol.c
changeset 7588 27e5857da6af
parent 7580 c92596feac0d
child 7691 55c0a856ecd0
equal deleted inserted replaced
7586:33924ff4af50 7588:27e5857da6af
    65 typedef flib_team *TeamPtr;
    65 typedef flib_team *TeamPtr;
    66 typedef flib_gamesetup *GameSetupPtr;
    66 typedef flib_gamesetup *GameSetupPtr;
    67 typedef bool boolean;
    67 typedef bool boolean;
    68 typedef size_t NativeSizeT;
    68 typedef size_t NativeSizeT;
    69 typedef void *Pointer;
    69 typedef void *Pointer;
       
    70 typedef uint8_t *ByteArrayPtr;
    70 typedef char *String;
    71 typedef char *String;
    71 
    72 
    72 /*
    73 /*
    73  * Mapping callback types
    74  * Mapping callback types
    74  */
    75  */
    94 
    95 
    95 /*
    96 /*
    96  * Below here are the copypasted method declarations from the JNA bindings
    97  * Below here are the copypasted method declarations from the JNA bindings
    97  */
    98  */
    98 
    99 
    99 // frontlib.h
   100 	// frontlib.h
   100     int flib_init();
   101     int flib_init();
   101     void flib_quit();
   102     void flib_quit();
   102 
   103 
   103     // hwconsts.h
   104     // hwconsts.h
   104     int flib_get_teamcolor_count();
   105     int flib_get_teamcolor_count();
   125 	int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName);
   126 	int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName);
   126 	int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg);
   127 	int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg);
   127 	int flib_netconn_send_toggleReady(NetconnPtr conn);
   128 	int flib_netconn_send_toggleReady(NetconnPtr conn);
   128 	int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team);
   129 	int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team);
   129 	int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname);
   130 	int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname);
       
   131 	int flib_netconn_send_engineMessage(NetconnPtr conn, ByteArrayPtr message, NativeSizeT size);
   130 	int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount);
   132 	int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount);
   131 	int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex);
   133 	int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex);
   132 	int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset);
   134 	int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset);
   133 	int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map);
   135 	int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map);
   134 	int flib_netconn_send_mapName(NetconnPtr conn, String mapName);
   136 	int flib_netconn_send_mapName(NetconnPtr conn, String mapName);
   135 	int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen);
   137 	int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen);
   136 	int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter);
   138 	int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter);
   137 	int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize);
   139 	int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize);
   138 	int flib_netconn_send_mapSeed(NetconnPtr conn, String seed);
   140 	int flib_netconn_send_mapSeed(NetconnPtr conn, String seed);
   139 	int flib_netconn_send_mapTheme(NetconnPtr conn, String theme);
   141 	int flib_netconn_send_mapTheme(NetconnPtr conn, String theme);
       
   142 	int flib_netconn_send_mapDrawdata(NetconnPtr conn, ByteArrayPtr drawData, NativeSizeT size);
   140 	int flib_netconn_send_script(NetconnPtr conn, String scriptName);
   143 	int flib_netconn_send_script(NetconnPtr conn, String scriptName);
   141 	int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme);
   144 	int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme);
   142 	int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError);
   145 	int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError);
   143 	int flib_netconn_send_ban(NetconnPtr conn, String playerName);
   146 	int flib_netconn_send_ban(NetconnPtr conn, String playerName);
   144 	int flib_netconn_send_kick(NetconnPtr conn, String playerName);
   147 	int flib_netconn_send_kick(NetconnPtr conn, String playerName);
   182 	void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context);
   185 	void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context);
   183 	void flib_netconn_onAdminAccess(NetconnPtr conn, VoidCallback callback, Pointer context);
   186 	void flib_netconn_onAdminAccess(NetconnPtr conn, VoidCallback callback, Pointer context);
   184 	void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context);
   187 	void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context);
   185 
   188 
   186 	// ipc/gameconn.h
   189 	// ipc/gameconn.h
       
   190 
   187 	GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame);
   191 	GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame);
       
   192 	GameconnPtr flib_gameconn_create_playdemo(ByteArrayPtr demo, NativeSizeT size);
       
   193 	GameconnPtr flib_gameconn_create_loadgame(String playerName, ByteArrayPtr save, NativeSizeT size);
   188 	GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script);
   194 	GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script);
   189 
   195 
   190 	void flib_gameconn_destroy(GameconnPtr conn);
   196 	void flib_gameconn_destroy(GameconnPtr conn);
   191 	int flib_gameconn_getport(GameconnPtr conn);
   197 	int flib_gameconn_getport(GameconnPtr conn);
   192 	void flib_gameconn_tick(GameconnPtr conn);
   198 	void flib_gameconn_tick(GameconnPtr conn);
   193 
   199 
       
   200 	int flib_gameconn_send_enginemsg(GameconnPtr conn, ByteArrayPtr data, NativeSizeT len);
   194 	int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg);
   201 	int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg);
   195 	int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg);
   202 	int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg);
   196 	int flib_gameconn_send_quit(GameconnPtr conn);
   203 	int flib_gameconn_send_quit(GameconnPtr conn);
   197 	int flib_gameconn_send_cmd(GameconnPtr conn, String cmdString);
   204 	int flib_gameconn_send_cmd(GameconnPtr conn, String cmdString);
   198 
   205 
   227 	void flib_weaponsetlist_destroy(WeaponsetListPtr list);
   234 	void flib_weaponsetlist_destroy(WeaponsetListPtr list);
   228 
   235 
   229 	// model/gamesetup.h
   236 	// model/gamesetup.h
   230 	void flib_gamesetup_destroy(GameSetupPtr gamesetup);
   237 	void flib_gamesetup_destroy(GameSetupPtr gamesetup);
   231 
   238 
       
   239 	// util/logging.h
   232     void flib_log_setLevel(int level);
   240     void flib_log_setLevel(int level);
   233     void flib_log_setCallback(LogCallback callback);
   241     void flib_log_setCallback(LogCallback callback);