mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-02-04 04:36:28 +00:00
move init_saving and join_saving_thread to librecomp namespace
This commit is contained in:
parent
c7ab41ec05
commit
30bc1533c9
5 changed files with 27 additions and 10 deletions
|
|
@ -4,9 +4,10 @@
|
|||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
#include "ultramodern/ultramodern.hpp"
|
||||
|
||||
#include "recomp.h"
|
||||
#include "rsp.hpp"
|
||||
#include <ultramodern/ultramodern.hpp>
|
||||
|
||||
namespace recomp {
|
||||
struct GameEntry {
|
||||
|
|
|
|||
13
librecomp/include/librecomp/save.hpp
Normal file
13
librecomp/include/librecomp/save.hpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __LIBRECOMP_SAVE_HPP__
|
||||
#define __LIBRECOMP_SAVE_HPP__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace recomp {
|
||||
namespace save {
|
||||
void init(uint8_t *rdram);
|
||||
void join_thread();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -7,8 +7,11 @@
|
|||
#include "recomp.h"
|
||||
#include "game.hpp"
|
||||
#include "files.hpp"
|
||||
#include <ultramodern/ultra64.h>
|
||||
#include <ultramodern/ultramodern.hpp>
|
||||
|
||||
#include "ultramodern/ultra64.h"
|
||||
#include "ultramodern/ultramodern.hpp"
|
||||
|
||||
#include "librecomp/save.hpp"
|
||||
|
||||
static std::vector<uint8_t> rom;
|
||||
|
||||
|
|
@ -153,7 +156,7 @@ void save_write_ptr(const void* in, uint32_t offset, uint32_t count) {
|
|||
std::lock_guard lock { save_context.save_buffer_mutex };
|
||||
memcpy(&save_context.save_buffer[offset], in, count);
|
||||
}
|
||||
|
||||
|
||||
save_context.write_sempahore.signal();
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +187,7 @@ void save_clear(uint32_t start, uint32_t size, char value) {
|
|||
save_context.write_sempahore.signal();
|
||||
}
|
||||
|
||||
void ultramodern::init_saving(RDRAM_ARG1) {
|
||||
void recomp::save::init(uint8_t *rdram) {
|
||||
std::filesystem::path save_file_path = get_save_file_path();
|
||||
|
||||
// Ensure the save file directory exists.
|
||||
|
|
@ -203,7 +206,7 @@ void ultramodern::init_saving(RDRAM_ARG1) {
|
|||
save_context.saving_thread = std::thread{saving_thread_func, PASS_RDRAM};
|
||||
}
|
||||
|
||||
void ultramodern::join_saving_thread() {
|
||||
void recomp::save::join_thread() {
|
||||
if (save_context.saving_thread.joinable()) {
|
||||
save_context.saving_thread.join();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
#include "ultramodern/ultramodern.hpp"
|
||||
#include "ultramodern/error_handling.hpp"
|
||||
|
||||
#include "librecomp/save.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
inline uint32_t byteswap(uint32_t val) {
|
||||
return _byteswap_ulong(val);
|
||||
|
|
@ -434,7 +436,7 @@ void recomp::start(
|
|||
ultramodern::error_handling::message_box("Error opening stored ROM! Please restart this program.");
|
||||
}
|
||||
|
||||
ultramodern::init_saving(rdram);
|
||||
recomp::save::init(rdram);
|
||||
|
||||
auto find_it = game_roms.find(current_game.value());
|
||||
const recomp::GameEntry& game_entry = find_it->second;
|
||||
|
|
@ -469,5 +471,5 @@ void recomp::start(
|
|||
game_thread.join();
|
||||
ultramodern::join_event_threads();
|
||||
ultramodern::join_thread_cleaner_thread();
|
||||
ultramodern::join_saving_thread();
|
||||
recomp::save::join_thread();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ constexpr uint32_t save_size = 1024 * 1024 / 8; // Maximum save size, 1Mbit for
|
|||
|
||||
// Initialization.
|
||||
void preinit(RDRAM_ARG renderer::WindowHandle window_handle);
|
||||
void init_saving(RDRAM_ARG1);
|
||||
void init_events(RDRAM_ARG renderer::WindowHandle window_handle);
|
||||
void init_timers(RDRAM_ARG1);
|
||||
void init_thread_cleanup();
|
||||
|
|
@ -124,7 +123,6 @@ bool is_game_started();
|
|||
void quit();
|
||||
void join_event_threads();
|
||||
void join_thread_cleaner_thread();
|
||||
void join_saving_thread();
|
||||
|
||||
void set_audio_callbacks(const audio_callbacks_t& callbacks);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue