From a30e6a7ba3b961115b4a117f5c2ff0623593469b Mon Sep 17 00:00:00 2001 From: offtkp Date: Fri, 22 Sep 2023 14:08:12 +0300 Subject: [PATCH] [Achievements]Reduce amount of functions in retro_achievements files --- src/main.c | 2 +- src/retro_achievements.cpp | 11 ----------- src/retro_achievements.h | 2 -- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main.c b/src/main.c index 4d65d1ab3..8d7bbcbfc 100644 --- a/src/main.c +++ b/src/main.c @@ -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++){ diff --git a/src/retro_achievements.cpp b/src/retro_achievements.cpp index 0e7c42ee1..1054834f5 100644 --- a/src/retro_achievements.cpp +++ b/src/retro_achievements.cpp @@ -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; @@ -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); @@ -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){ diff --git a/src/retro_achievements.h b/src/retro_achievements.h index 0895ab740..486e886b3 100644 --- a/src/retro_achievements.h +++ b/src/retro_achievements.h @@ -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();