diff -r d5c880e6d772 -r c92596feac0d project_files/frontlib/extra/jnacontrol.c --- a/project_files/frontlib/extra/jnacontrol.c Mon Aug 20 17:08:52 2012 +0200 +++ b/project_files/frontlib/extra/jnacontrol.c Mon Aug 20 20:16:37 2012 +0200 @@ -65,10 +65,9 @@ typedef flib_team *TeamPtr; typedef flib_gamesetup *GameSetupPtr; typedef bool boolean; -typedef size_t NativeLong; +typedef size_t NativeSizeT; typedef void *Pointer; typedef char *String; -typedef uint8_t *Buffer; /* * Mapping callback types @@ -85,8 +84,8 @@ typedef void (*BoolCallback)(Pointer context, boolean arg1); typedef void (*StrBoolCallback)(Pointer context, String arg1, boolean arg2); typedef void (*TeamCallback)(Pointer context, TeamPtr arg1); -typedef void (*BytesCallback)(Pointer context, const uint8_t *buffer, NativeLong size); -typedef void (*BytesBoolCallback)(Pointer context, const uint8_t *buffer, NativeLong size, boolean arg3); +typedef void (*BytesCallback)(Pointer context, const uint8_t *buffer, NativeSizeT size); +typedef void (*BytesBoolCallback)(Pointer context, const uint8_t *buffer, NativeSizeT size, boolean arg3); typedef void (*SchemeCallback)(Pointer context, SchemePtr arg1); typedef void (*MapIntCallback)(Pointer context, MapRecipePtr arg1, int arg2); typedef void (*WeaponsetCallback)(Pointer context, WeaponsetPtr arg1); @@ -98,140 +97,137 @@ */ // frontlib.h -int flib_init(); -void flib_quit(); + int flib_init(); + void flib_quit(); -// hwconsts.h -int flib_get_teamcolor_count(); -int flib_get_hedgehogs_per_team(); -int flib_get_weapons_count(); + // hwconsts.h + int flib_get_teamcolor_count(); + int flib_get_hedgehogs_per_team(); + int flib_get_weapons_count(); + MetaschemePtr flib_get_metascheme(); -// net/netconn.h -NetconnPtr flib_netconn_create(String playerName, String dataDirPath, String host, int port); -void flib_netconn_destroy(NetconnPtr conn); + // net/netconn.h + NetconnPtr flib_netconn_create(String playerName, String dataDirPath, String host, int port); + void flib_netconn_destroy(NetconnPtr conn); -void flib_netconn_tick(NetconnPtr conn); -boolean flib_netconn_is_chief(NetconnPtr conn); -String flib_netconn_get_playername(NetconnPtr conn); -GameSetupPtr flib_netconn_create_gamesetup(NetconnPtr conn); -int flib_netconn_send_quit(NetconnPtr conn, String quitmsg); -int flib_netconn_send_chat(NetconnPtr conn, String chat); -int flib_netconn_send_teamchat(NetconnPtr conn, String msg); -int flib_netconn_send_password(NetconnPtr conn, String passwd); -int flib_netconn_send_nick(NetconnPtr conn, String nick); -int flib_netconn_send_request_roomlist(NetconnPtr conn); -int flib_netconn_send_joinRoom(NetconnPtr conn, String room); -int flib_netconn_send_createRoom(NetconnPtr conn, String room); -int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName); -int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg); -int flib_netconn_send_toggleReady(NetconnPtr conn); -int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team); -int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname); -int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount); -int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex); -int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset); -int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map); -int flib_netconn_send_mapName(NetconnPtr conn, String mapName); -int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen); -int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter); -int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize); -int flib_netconn_send_mapSeed(NetconnPtr conn, String seed); -int flib_netconn_send_mapTheme(NetconnPtr conn, String theme); -int flib_netconn_send_script(NetconnPtr conn, String scriptName); -int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme); -int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError); -int flib_netconn_send_ban(NetconnPtr conn, String playerName); -int flib_netconn_send_kick(NetconnPtr conn, String playerName); -int flib_netconn_send_playerInfo(NetconnPtr conn, String playerName); -int flib_netconn_send_playerFollow(NetconnPtr conn, String playerName); -int flib_netconn_send_startGame(NetconnPtr conn); -int flib_netconn_send_toggleRestrictJoins(NetconnPtr conn); -int flib_netconn_send_toggleRestrictTeams(NetconnPtr conn); -int flib_netconn_send_clearAccountsCache(NetconnPtr conn); -int flib_netconn_send_setServerVar(NetconnPtr conn, String name, String value); -int flib_netconn_send_getServerVars(NetconnPtr conn); + void flib_netconn_tick(NetconnPtr conn); + boolean flib_netconn_is_chief(NetconnPtr conn); + String flib_netconn_get_playername(NetconnPtr conn); + GameSetupPtr flib_netconn_create_gamesetup(NetconnPtr conn); + int flib_netconn_send_quit(NetconnPtr conn, String quitmsg); + int flib_netconn_send_chat(NetconnPtr conn, String chat); + int flib_netconn_send_teamchat(NetconnPtr conn, String msg); + int flib_netconn_send_password(NetconnPtr conn, String passwd); + int flib_netconn_send_nick(NetconnPtr conn, String nick); + int flib_netconn_send_request_roomlist(NetconnPtr conn); + int flib_netconn_send_joinRoom(NetconnPtr conn, String room); + int flib_netconn_send_createRoom(NetconnPtr conn, String room); + int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName); + int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg); + int flib_netconn_send_toggleReady(NetconnPtr conn); + int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team); + int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname); + int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount); + int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex); + int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset); + int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map); + int flib_netconn_send_mapName(NetconnPtr conn, String mapName); + int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen); + int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter); + int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize); + int flib_netconn_send_mapSeed(NetconnPtr conn, String seed); + int flib_netconn_send_mapTheme(NetconnPtr conn, String theme); + int flib_netconn_send_script(NetconnPtr conn, String scriptName); + int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme); + int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError); + int flib_netconn_send_ban(NetconnPtr conn, String playerName); + int flib_netconn_send_kick(NetconnPtr conn, String playerName); + int flib_netconn_send_playerInfo(NetconnPtr conn, String playerName); + int flib_netconn_send_playerFollow(NetconnPtr conn, String playerName); + int flib_netconn_send_startGame(NetconnPtr conn); + int flib_netconn_send_toggleRestrictJoins(NetconnPtr conn); + int flib_netconn_send_toggleRestrictTeams(NetconnPtr conn); + int flib_netconn_send_clearAccountsCache(NetconnPtr conn); + int flib_netconn_send_setServerVar(NetconnPtr conn, String name, String value); + int flib_netconn_send_getServerVars(NetconnPtr conn); -void flib_netconn_onMessage(NetconnPtr conn, IntStrCallback callback, Pointer context); -void flib_netconn_onChat(NetconnPtr conn, StrStrCallback callback, Pointer context); -void flib_netconn_onConnected(NetconnPtr conn, VoidCallback callback, Pointer context); -void flib_netconn_onDisconnected(NetconnPtr conn, IntStrCallback callback, Pointer context); -void flib_netconn_onRoomlist(NetconnPtr conn, RoomListCallback callback, Pointer context); -void flib_netconn_onRoomAdd(NetconnPtr conn, RoomCallback callback, Pointer context); -void flib_netconn_onRoomDelete(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onRoomUpdate(NetconnPtr conn, StrRoomCallback callback, Pointer context); -void flib_netconn_onLobbyJoin(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onLobbyLeave(NetconnPtr conn, StrStrCallback callback, Pointer context); -void flib_netconn_onNickTaken(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onPasswordRequest(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onEnterRoom(NetconnPtr conn, BoolCallback callback, Pointer context); -void flib_netconn_onRoomChiefStatus(NetconnPtr conn, BoolCallback callback, Pointer context); -void flib_netconn_onReadyState(NetconnPtr conn, StrBoolCallback callback, Pointer context); -void flib_netconn_onLeaveRoom(NetconnPtr conn, IntStrCallback callback, Pointer context); -void flib_netconn_onTeamAdd(NetconnPtr conn, TeamCallback callback, Pointer context); -void flib_netconn_onTeamDelete(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onRoomJoin(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onRoomLeave(NetconnPtr conn, StrStrCallback callback, Pointer context); -void flib_netconn_onRunGame(NetconnPtr conn, VoidCallback callback, Pointer context); -void flib_netconn_onTeamAccepted(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onHogCountChanged(NetconnPtr conn, StrIntCallback callback, Pointer context); -void flib_netconn_onTeamColorChanged(NetconnPtr conn, StrIntCallback callback, Pointer context); -void flib_netconn_onEngineMessage(NetconnPtr conn, BytesCallback callback, Pointer context); -void flib_netconn_onCfgScheme(NetconnPtr conn, SchemeCallback callback, Pointer context); -void flib_netconn_onMapChanged(NetconnPtr conn, MapIntCallback callback, Pointer context); -void flib_netconn_onScriptChanged(NetconnPtr conn, StrCallback callback, Pointer context); -void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context); -void flib_netconn_onAdminAccess(NetconnPtr conn, VoidCallback callback, Pointer context); -void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context); + void flib_netconn_onMessage(NetconnPtr conn, IntStrCallback callback, Pointer context); + void flib_netconn_onChat(NetconnPtr conn, StrStrCallback callback, Pointer context); + void flib_netconn_onConnected(NetconnPtr conn, VoidCallback callback, Pointer context); + void flib_netconn_onDisconnected(NetconnPtr conn, IntStrCallback callback, Pointer context); + void flib_netconn_onRoomlist(NetconnPtr conn, RoomListCallback callback, Pointer context); + void flib_netconn_onRoomAdd(NetconnPtr conn, RoomCallback callback, Pointer context); + void flib_netconn_onRoomDelete(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onRoomUpdate(NetconnPtr conn, StrRoomCallback callback, Pointer context); + void flib_netconn_onLobbyJoin(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onLobbyLeave(NetconnPtr conn, StrStrCallback callback, Pointer context); + void flib_netconn_onNickTaken(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onPasswordRequest(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onEnterRoom(NetconnPtr conn, BoolCallback callback, Pointer context); + void flib_netconn_onRoomChiefStatus(NetconnPtr conn, BoolCallback callback, Pointer context); + void flib_netconn_onReadyState(NetconnPtr conn, StrBoolCallback callback, Pointer context); + void flib_netconn_onLeaveRoom(NetconnPtr conn, IntStrCallback callback, Pointer context); + void flib_netconn_onTeamAdd(NetconnPtr conn, TeamCallback callback, Pointer context); + void flib_netconn_onTeamDelete(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onRoomJoin(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onRoomLeave(NetconnPtr conn, StrStrCallback callback, Pointer context); + void flib_netconn_onRunGame(NetconnPtr conn, VoidCallback callback, Pointer context); + void flib_netconn_onTeamAccepted(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onHogCountChanged(NetconnPtr conn, StrIntCallback callback, Pointer context); + void flib_netconn_onTeamColorChanged(NetconnPtr conn, StrIntCallback callback, Pointer context); + void flib_netconn_onEngineMessage(NetconnPtr conn, BytesCallback callback, Pointer context); + void flib_netconn_onSchemeChanged(NetconnPtr conn, SchemeCallback callback, Pointer context); + void flib_netconn_onMapChanged(NetconnPtr conn, MapIntCallback callback, Pointer context); + void flib_netconn_onScriptChanged(NetconnPtr conn, StrCallback callback, Pointer context); + void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context); + void flib_netconn_onAdminAccess(NetconnPtr conn, VoidCallback callback, Pointer context); + void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context); -// ipc/gameconn.h -GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame); -GameconnPtr flib_gameconn_create_playdemo(Buffer demo, NativeLong size); -GameconnPtr flib_gameconn_create_loadgame(String playerName, Buffer save, NativeLong size); -GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script); + // ipc/gameconn.h + GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame); + GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script); -void flib_gameconn_destroy(GameconnPtr conn); -int flib_gameconn_getport(GameconnPtr conn); -void flib_gameconn_tick(GameconnPtr conn); + void flib_gameconn_destroy(GameconnPtr conn); + int flib_gameconn_getport(GameconnPtr conn); + void flib_gameconn_tick(GameconnPtr conn); -int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg); -int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg); -int flib_gameconn_send_quit(GameconnPtr conn); + int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg); + int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg); + int flib_gameconn_send_quit(GameconnPtr conn); + int flib_gameconn_send_cmd(GameconnPtr conn, String cmdString); -void flib_gameconn_onConnect(GameconnPtr conn, VoidCallback callback, Pointer context); -void flib_gameconn_onDisconnect(GameconnPtr conn, IntCallback callback, Pointer context); -void flib_gameconn_onErrorMessage(GameconnPtr conn, StrCallback callback, Pointer context); -void flib_gameconn_onChat(GameconnPtr conn, StrBoolCallback callback, Pointer context); -void flib_gameconn_onGameRecorded(GameconnPtr conn, BytesBoolCallback callback, Pointer context); -void flib_gameconn_onEngineMessage(GameconnPtr conn, BytesCallback callback, Pointer context); + void flib_gameconn_onConnect(GameconnPtr conn, VoidCallback callback, Pointer context); + void flib_gameconn_onDisconnect(GameconnPtr conn, IntCallback callback, Pointer context); + void flib_gameconn_onErrorMessage(GameconnPtr conn, StrCallback callback, Pointer context); + void flib_gameconn_onChat(GameconnPtr conn, StrBoolCallback callback, Pointer context); + void flib_gameconn_onGameRecorded(GameconnPtr conn, BytesBoolCallback callback, Pointer context); + void flib_gameconn_onEngineMessage(GameconnPtr conn, BytesCallback callback, Pointer context); -// ipc/mapconn.h -MapconnPtr flib_mapconn_create(MapRecipePtr mapdesc); -void flib_mapconn_destroy(MapconnPtr conn); -int flib_mapconn_getport(MapconnPtr conn); -void flib_mapconn_onSuccess(MapconnPtr conn, MapimageCallback callback, Pointer context); -void flib_mapconn_onFailure(MapconnPtr conn, StrCallback callback, Pointer context); -void flib_mapconn_tick(MapconnPtr conn); - -MetaschemePtr flib_get_metascheme(); + // ipc/mapconn.h + MapconnPtr flib_mapconn_create(MapRecipePtr mapdesc); + void flib_mapconn_destroy(MapconnPtr conn); + int flib_mapconn_getport(MapconnPtr conn); + void flib_mapconn_onSuccess(MapconnPtr conn, MapimageCallback callback, Pointer context); + void flib_mapconn_onFailure(MapconnPtr conn, StrCallback callback, Pointer context); + void flib_mapconn_tick(MapconnPtr conn); -// model/schemelist.h -SchemelistPtr flib_schemelist_from_ini(String filename); -int flib_schemelist_to_ini(String filename, SchemelistPtr list); -void flib_schemelist_destroy(SchemelistPtr list); + // model/schemelist.h + SchemelistPtr flib_schemelist_from_ini(String filename); + int flib_schemelist_to_ini(String filename, SchemelistPtr list); + void flib_schemelist_destroy(SchemelistPtr list); -// model/team.h -TeamPtr flib_team_from_ini(String filename); -int flib_team_to_ini(String filename, TeamPtr team); -void flib_team_destroy(TeamPtr team); + // model/team.h + TeamPtr flib_team_from_ini(String filename); + int flib_team_to_ini(String filename, TeamPtr team); + void flib_team_destroy(TeamPtr team); -// model/weapon.h -WeaponsetListPtr flib_weaponsetlist_from_ini(String filename); -int flib_weaponsetlist_to_ini(String filename, WeaponsetListPtr weaponsets); -void flib_weaponsetlist_destroy(WeaponsetListPtr list); + // model/weapon.h + WeaponsetListPtr flib_weaponsetlist_from_ini(String filename); + int flib_weaponsetlist_to_ini(String filename, WeaponsetListPtr weaponsets); + void flib_weaponsetlist_destroy(WeaponsetListPtr list); -// model/gamesetup.h -void flib_gamesetup_destroy(GameSetupPtr gamesetup); + // model/gamesetup.h + void flib_gamesetup_destroy(GameSetupPtr gamesetup); -// util/logging.h -void flib_log_setLevel(int level); -void flib_log_setCallback(LogCallback callback); + void flib_log_setLevel(int level); + void flib_log_setCallback(LogCallback callback);