Skip to content

Commit

Permalink
[Achievements]Reduce amount of functions in retro_achievements files
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Sep 22, 2023
1 parent 4b58e3f commit a30e6a7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5680,7 +5680,7 @@ void se_draw_menu_panel(){
char login_info_path[SB_FILE_PATH_SIZE];
snprintf(login_info_path,SB_FILE_PATH_SIZE,"%sra_login_info.txt",se_get_pref_path());
remove(login_info_path);
ra_logout();
rc_client_logout(ra_get_client());
}
if (ra_info.achievement_list){
for (int i = 0; i < ra_info.achievement_list->num_buckets; i++){
Expand Down
11 changes: 0 additions & 11 deletions src/retro_achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static void server_callback(const rc_api_request_t* request,
// RetroAchievements may not allow hardcore unlocks if we don't properly identify ourselves.
const char* user_agent = "SkyEmu/4.0";

// TODO: with C++17 we can use structured bindings
auto pair = split_url(request->url);
std::string host = pair.first;
std::string query = pair.second;
Expand Down Expand Up @@ -126,11 +125,6 @@ void ra_shutdown_client()
}
}

bool ra_is_logged_in()
{
return rc_client_get_user_info(ra_client) != NULL;
}

void ra_login_credentials(const char* username, const char* password, rc_client_callback_t login_callback)
{
rc_client_begin_login_with_password(ra_client, username, password, login_callback, NULL);
Expand Down Expand Up @@ -181,11 +175,6 @@ void ra_login_token(const char* username, const char* token, rc_client_callback_
login_thread.detach();
}

void ra_logout()
{
rc_client_logout(ra_client);
}

void ra_load_game(const uint8_t *rom, size_t rom_size, int console_id, rc_client_callback_t callback)
{
std::thread load_game_thread([](const uint8_t *rom, size_t rom_size, int console_id, rc_client_callback_t callback){
Expand Down
2 changes: 0 additions & 2 deletions src/retro_achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ typedef uint32_t (*rc_client_read_memory_func_t)(uint32_t address, uint8_t* buff
typedef void (*rc_client_callback_t)(int result, const char* error_message, rc_client_t* client, void* userdata);
typedef void(*get_image_callback_t)(const uint8_t* buffer, size_t buffer_size, int width, int height, void* userdata);

bool ra_is_logged_in();
void ra_initialize_client(rc_client_read_memory_func_t memory_read_func);
void ra_login_credentials(const char* username, const char* password, rc_client_callback_t login_callback);
void ra_login_token(const char* username, const char* token, rc_client_callback_t login_callback);
void ra_poll_requests();
void ra_shutdown_client();
void ra_logout();
void ra_load_game(const uint8_t* rom, size_t rom_size, int console_id, rc_client_callback_t callback);
void ra_get_image(const char* url, get_image_callback_t callback, void* userdata);
rc_client_t* ra_get_client();
Expand Down

0 comments on commit a30e6a7

Please sign in to comment.