2013-01-06 20:36:31 +02:00
|
|
|
#ifndef _interface__callbacks__hpp__included__
|
|
|
|
#define _interface__callbacks__hpp__included__
|
|
|
|
|
|
|
|
#include <cstdint>
|
2013-10-27 14:41:28 +02:00
|
|
|
#include <string>
|
|
|
|
#include <list>
|
2013-01-06 20:36:31 +02:00
|
|
|
#include "library/framebuffer.hpp"
|
|
|
|
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Callbacks emulator binding can use.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
struct emucore_callbacks
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~emucore_callbacks() throw();
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Get input from specified control.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual int16_t get_input(unsigned port, unsigned index, unsigned control) = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Set input for specified control. Only works in readwrite mode.
|
|
|
|
*
|
|
|
|
* Returns the actual input value used.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual int16_t set_input(unsigned port, unsigned index, unsigned control, int16_t value) = 0;
|
2013-10-27 14:41:28 +02:00
|
|
|
/**
|
|
|
|
* Notifies about latch. Only called on some systems.
|
|
|
|
*/
|
|
|
|
virtual void notify_latch(std::list<std::string>& l) = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Tick the RTC timer.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual void timer_tick(uint32_t increment, uint32_t per_second) = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Get path for firmware.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual std::string get_firmware_path() = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Get the base filename for ROM.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual std::string get_base_path() = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Get current RTC time.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual time_t get_time() = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Get the RNG seed to use.
|
|
|
|
*/
|
2013-01-06 20:36:31 +02:00
|
|
|
virtual time_t get_randomseed() = 0;
|
2013-06-15 14:20:00 +03:00
|
|
|
/**
|
|
|
|
* Output a frame. Call once for each call to emulate().
|
|
|
|
*/
|
2013-12-19 06:57:22 +02:00
|
|
|
virtual void output_frame(framebuffer::raw& screen, uint32_t fps_n, uint32_t fps_d) = 0;
|
2013-06-30 13:20:23 +03:00
|
|
|
/**
|
2013-07-04 18:17:07 +03:00
|
|
|
* Notify that action states have been updated.
|
2013-06-30 13:20:23 +03:00
|
|
|
*/
|
2013-07-04 18:17:07 +03:00
|
|
|
virtual void action_state_updated() = 0;
|
2013-11-28 22:22:00 +02:00
|
|
|
/**
|
|
|
|
* Notify that memory address has been read.
|
|
|
|
*/
|
|
|
|
virtual void memory_read(uint64_t addr, uint64_t value) = 0;
|
|
|
|
/**
|
|
|
|
* Notify that memory address is about to be written.
|
|
|
|
*/
|
|
|
|
virtual void memory_write(uint64_t addr, uint64_t value) = 0;
|
|
|
|
/**
|
|
|
|
* Notify that memory address is about to be executed.
|
|
|
|
*/
|
|
|
|
virtual void memory_execute(uint64_t addr, uint64_t proc) = 0;
|
|
|
|
/**
|
|
|
|
* Notify trace event.
|
|
|
|
*/
|
2014-02-27 22:45:44 +02:00
|
|
|
virtual void memory_trace(uint64_t proc, const char* str, bool insn) = 0;
|
2013-01-06 20:36:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct emucore_callbacks* ecore_callbacks;
|
|
|
|
|
2013-06-30 13:20:23 +03:00
|
|
|
#endif
|