SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
gamejolt.h File Reference

GameJolt Game API implementation for MegaWiFi. More...

#include "types.h"
Include dependency graph for gamejolt.h:

Go to the source code of this file.

Classes

struct  gj_trophy
 Holds the data of a single trophy. More...
struct  gj_time
 Holds the date/time from server. More...
struct  gj_score
 Holds data of a single score. More...
struct  gj_score_table
 Holds data of a single score table. More...
struct  gj_user
 Holds user data. More...

Macros

#define GJ_TROPHY_RESPONSE_TABLE(X_MACRO)
 Reply fields to a trophy fetch request.
#define GJ_TIME_RESPONSE_TABLE(X_MACRO)
 Reply fields to a time fetch request.
#define GJ_SCORE_RESPONSE_TABLE(X_MACRO)
 Reply field to a scores fetch request.
#define GJ_SCORE_TABLE_RESPONSE_TABLE(X_MACRO)
 Reply fields to a scores tables request.
#define GJ_SCORE_GETRANK_RESPONSE_TABLE(X_MACRO)
 Reply fields to a scores get-rank request.
#define GJ_USER_RESPONSE_TABLE(X_MACRO)
 Reply fields to a users fetch request.
#define X_AS_STRUCT(field, decoder, type)
 Expands a response table as a structure with its fields.

Enumerations

enum  gj_error {
  GJ_ERR_NONE = 0 , GJ_ERR_PARAM = -1 , GJ_ERR_REQUEST = -2 , GJ_ERR_RECEPTION = -3 ,
  GJ_ERR_RESPONSE = -4 , GJ_ERR_PARSE = -5
}
 Module error codes. More...
enum  gj_trophy_difficulty {
  GJ_TROPHY_TYPE_BRONZE = 0 , GJ_TROPHY_TYPE_SILVER , GJ_TROPHY_TYPE_GOLD , GJ_TROPHY_TYPE_PLATINUM ,
  GJ_TROPHY_TYPE_UNKNOWN
}
 Difficulty to achieve the trophy. More...
enum  gj_data_store_update_operation {
  GJ_OP_ADD = 0 , GJ_OP_SUBTRACT , GJ_OP_MULTIPLY , GJ_OP_DIVIDE ,
  GJ_OP_APPEND , GJ_OP_PREPEND , GJ_OP_MAX
}
 Operations supported by gj_data_store_update() function. More...

Functions

bool gj_init (const char *endpoint, const char *game_id, const char *private_key, const char *username, const char *user_token, char *reply_buf, uint16_t buf_len, uint16_t tout_frames)
 Initialize the GameJolt API.
enum gj_error gj_get_error (void)
 Return the last error code.
char * gj_trophies_fetch (bool achieved, const char *trophy_id)
 Fetch player trophies.
char * gj_trophy_get_next (char *pos, struct gj_trophy *trophy)
 Decode the trophy raw data for the next entry.
bool gj_trophy_add_achieved (const char *trophy_id)
 Mark a trophy as achieved.
bool gj_trophy_remove_achieved (const char *trophy_id)
 Mark a trophy as not achieved.
const char * gj_trophy_difficulty_str (enum gj_trophy_difficulty difficulty)
 Get the string corresponding to a trophy difficulty.
bool gj_time (struct gj_time *time)
 Get the date and time from server.
char * gj_scores_fetch (const char *limit, const char *table_id, const char *guest, const char *better_than, const char *worse_than, bool only_user)
 Fetch scores data.
char * gj_score_get_next (char *pos, struct gj_score *score)
 Decode the score raw data for the next entry.
char * gj_scores_tables_fetch (void)
 Fetch score tables.
char * gj_score_table_get_next (char *pos, struct gj_score_table *score_table)
 Decode the score tables raw data for the next entry.
char * gj_scores_get_rank (const char *sort, const char *table_id)
 Get ranking corresponding to a sort parameter.
bool gj_scores_add (const char *score, const char *sort, const char *table_id, const char *guest, const char *extra_data)
 Add a score to a scoreboard.
bool gj_data_store_set (const char *key, const char *data, bool user_store)
 Sets a key/value pair in the data store.
char * gj_data_store_keys_fetch (const char *pattern, bool user_store)
 Fetch data store keys.
char * gj_data_store_key_next (char *pos, char **key)
 Decode the key data from a gj_data_store_keys_fetch() call.
char * data_store_fetch (const char *key, bool user_store)
 Retrieve data from the data store.
char * gj_data_store_update (const char *key, enum gj_data_store_update_operation operation, const char *value, bool user_store)
 Update data in the data store.
bool gj_data_store_remove (const char *key, bool user_store)
 Remove data from the data store.
bool gj_sessions_open (void)
 Open a game session for the player.
bool gj_sessions_ping (bool active)
 Ping a session, and allow setting it as active or idle.
bool gj_sessions_check (const char *username, const char *user_token)
 Checks if a user session is active in the game.
bool gj_sessions_close (void)
 Close a previously opened session.
char * gj_users_fetch (const char *username, const char *user_id)
 Get user data.
char * gj_user_get_next (char *pos, struct gj_user *user)
 Decode the user raw data for the next entry.
bool gj_users_auth (void)
 Check user credentials.
char * gj_friends_fetch (void)
 Get friends list.
char * gj_friend_get_next (char *pos, char **user_id)
 Decode the friend raw data for the next entry.
char * gj_request (const char **path, uint8_t num_paths, const char **key, const char **value, uint8_t num_kv_pairs, uint32_t *out_len)
 Generic GameJolt Game API request.

Detailed Description

GameJolt Game API implementation for MegaWiFi.