Skip to content

Commit

Permalink
Fixes for web
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed May 3, 2024
1 parent 4edb6c8 commit 8225c90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ void se_reset_save_states();
void se_reset_cheats();
void se_set_new_controller(se_controller_state_t* cont, int index);
bool se_run_ar_cheat(const uint32_t* buffer, uint32_t size);
static void se_emscripten_flush_fs();
void se_emscripten_flush_fs();
static uint32_t se_save_best_effort_state(se_core_state_t* state);
static bool se_load_best_effort_state(se_core_state_t* state,uint8_t *save_state_data, uint32_t size, uint32_t bess_offset);
static size_t se_get_core_size();
Expand Down Expand Up @@ -1354,7 +1354,7 @@ double se_fps_counter(int tick){
return 1.0/fps;
}

static void se_emscripten_flush_fs(){
void se_emscripten_flush_fs(){
#if defined(EMSCRIPTEN)
EM_ASM( FS.syncfs(function (err) {}););
#endif
Expand Down
13 changes: 5 additions & 8 deletions src/retro_achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void se_boxed_image_dual_label(const char* title, const char* description, const
bool se_button(const char* label, ImVec2 size);
const char* se_localize_and_cache(const char* input_str);
ImFont* se_get_mono_font();
void se_emscripten_flush_fs();
#include "retro_achievements.h"
ra_config_t* se_get_ra_config();
}
Expand Down Expand Up @@ -395,15 +396,13 @@ namespace
uint32_t id = rc_achievement->id;
uint8_t bucket = rc_achievement->bucket;
std::unique_lock<std::mutex> lock(game_state->mutex);
ra_state->download(game_state, url, [game_state, notification, url, id, bucket]() {
ra_achievement_t* achievement =
retro_achievements_move_bucket(game_state, id, bucket);

ra_achievement_t* achievement = retro_achievements_move_bucket(game_state, id, bucket);
game_state->notifications.push_back(*notification);
ra_state->download(game_state, url, [game_state, notification, url, id, bucket, achievement]() {
if (achievement)
{
achievement->tile = &game_state->image_cache[url];
notification->tile = achievement->tile;
game_state->notifications.push_back(*notification);
}
});
}
Expand Down Expand Up @@ -503,9 +502,7 @@ namespace

sb_save_file_data(path.c_str(), (const uint8_t*)data.data(), data.size());
retro_achievements_load_game();
#if defined(SE_PLATFORM_WEB)
EM_ASM( FS.syncfs(function (err) {}););
#endif
se_emscripten_flush_fs();
}

state->pending_login = false;
Expand Down

0 comments on commit 8225c90

Please sign in to comment.