#ifndef AXAL_RUNTIME_H
#define AXAL_RUNTIME_H 1
#include <memory>
#include <thread>
#include "library.h"
#include "axal.h"
namespace ax {
class Runtime {
public:
Runtime();
virtual ~Runtime() noexcept;
void core_load(void* userdata, const char* filename);
void core_unload();
void get_info(axal_info* info);
void rom_insert(const char* filename);
void rom_remove();
void reset();
void pause();
void resume();
void set_video_refresh(axal_video_refresh_fn callback);
bool is_loaded() const {
return _core != nullptr;
}
bool is_running() const {
return _running;
}
private:
static void _main(Runtime* self) noexcept;
static int16_t _input_state(void*, uint8_t, uint8_t, uint32_t) noexcept;
std::unique_ptr<Library> _lib;
axal_core _core_vt;
void* _core;
std::unique_ptr<std::thread> _thread;
bool _running = false;
axal_video_refresh_fn _video_refresh_cb;
};
}
#endif