libretro: Expose main RAM to frontend
This commit is contained in:
parent
401ecfa872
commit
5f76140aa5
|
@ -5,6 +5,7 @@
|
|||
#include "common/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/analog_controller.h"
|
||||
#include "core/bus.h"
|
||||
#include "core/digital_controller.h"
|
||||
#include "core/game_list.h"
|
||||
#include "core/gpu.h"
|
||||
|
@ -299,6 +300,30 @@ bool LibretroHostInterface::retro_unserialize(const void* data, size_t size)
|
|||
return true;
|
||||
}
|
||||
|
||||
void* LibretroHostInterface::retro_get_memory_data(unsigned id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SYSTEM_RAM:
|
||||
return m_system ? m_system->GetBus()->GetRAM() : nullptr;
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
size_t LibretroHostInterface::retro_get_memory_size(unsigned id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_MEMORY_SYSTEM_RAM:
|
||||
return Bus::RAM_SIZE;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool LibretroHostInterface::AcquireHostDisplay()
|
||||
{
|
||||
// start in software mode, switch to hardware later
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
size_t retro_serialize_size();
|
||||
bool retro_serialize(void* data, size_t size);
|
||||
bool retro_unserialize(const void* data, size_t size);
|
||||
void* retro_get_memory_data(unsigned id);
|
||||
size_t retro_get_memory_size(unsigned id);
|
||||
|
||||
protected:
|
||||
bool AcquireHostDisplay() override;
|
||||
|
|
|
@ -111,12 +111,12 @@ RETRO_API unsigned retro_get_region(void)
|
|||
|
||||
RETRO_API void* retro_get_memory_data(unsigned id)
|
||||
{
|
||||
return nullptr;
|
||||
return g_libretro_host_interface.retro_get_memory_data(id);
|
||||
}
|
||||
|
||||
RETRO_API size_t retro_get_memory_size(unsigned id)
|
||||
{
|
||||
return 0;
|
||||
return g_libretro_host_interface.retro_get_memory_size(id);
|
||||
}
|
||||
|
||||
RETRO_API void retro_set_environment(retro_environment_t f)
|
||||
|
|
Loading…
Reference in New Issue