Skip to content

Powse/libminichieves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libminichieves

A C library for syncing RetroAchievements data to a local SQLite database.

Fetches consoles, games, achievements, and completion progress for one or more users, with optional image downloads. Designed to be embedded in frontends (desktop, handheld, etc.) that need offline access to RA data.

Features

  • Sync all games and achievements for a user, or target a specific console or game
  • Blocking and async (fire-and-forget) variants for every sync operation
  • Optional image download (console icons, game icons, achievement badges)
  • Multi-user support with stored credentials
  • Cross-compiles for ARM (MiyooMini)

Building

make

Output: out/libminichieves.a

Cross-compile for MiyooMini:

Use the Docker image from dev-miyoomini-toolchain. The cross-compile toolchain is already configured inside the container.

Enter the shell:

make shell

Then build and install:

make install

Install (native):

make install PREFIX=/usr/local

Usage

The library does not ship an HTTP client — you provide one. This keeps it portable and free of libcurl or similar dependencies.

#include <minichieves.h>

// 1. Implement mc_http_client with your HTTP backend (curl, etc.)
mc_http_client http = {
    .get      = my_http_get,
    .download = my_http_download,
    .userdata = NULL,
};

// 2. Initialize a context (creates the SQLite DB if needed)
mc_context *ctx = mc_init("/path/to/data/ra.db", http);

// 3. Set a user (username + RetroAchievements API key)
mc_auth auth = { .username = "Player1", .key = "abc123..." };
mc_set_user(ctx, auth);

// 4. Sync
mc_callbacks cb = {
    .on_sync_start    = on_start,
    .on_sync_progress = on_progress,
    .on_sync_done     = on_done,
    .on_sync_error    = on_error,
};
mc_sync_blocking(ctx, /*do_download=*/true, &cb);

// 5. Query
int count;
mc_game **games = mc_get_games(ctx, console_id, &count);
// ... use games ...
mc_free_games(games, count);

mc_end(ctx);

Linking

-lminichieves -lpthread

Dependencies

Bundled (no system install needed):

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Contributors