Skip to content

Commit

Permalink
Add support for memory / achievements.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
  • Loading branch information
audetto committed Nov 24, 2021
1 parent 8fd124e commit 6175dc8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions source/frontends/libretro/libretro.cpp
Expand Up @@ -6,6 +6,8 @@
#include "Common.h"
#include "Video.h"
#include "Interface.h"
#include "Memory.h"
#include "Debugger/DebugDefs.h"

#include "linux/version.h"
#include "linux/paddle.h"
Expand Down Expand Up @@ -142,6 +144,9 @@ void retro_set_environment(retro_environment_t cb)
retro_frame_time_callback timeCallback = {&ra2::Game::frameTimeCallback, 1000000 / ra2::Game::FPS};
cb(RETRO_ENVIRONMENT_SET_FRAME_TIME_CALLBACK, &timeCallback);

bool achievements = true;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS, &achievements);

ra2::SetupRetroVariables();
}

Expand Down Expand Up @@ -288,12 +293,12 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)

void *retro_get_memory_data(unsigned id)
{
ra2::log_cb(RETRO_LOG_INFO, "RA2: %s\n", __FUNCTION__);
return nullptr;
ra2::log_cb(RETRO_LOG_INFO, "RA2: %s (%d)\n", __FUNCTION__, id);
return MemGetBankPtr(id);
}

size_t retro_get_memory_size(unsigned id)
{
ra2::log_cb(RETRO_LOG_INFO, "RA2: %s\n", __FUNCTION__);
return 0;
ra2::log_cb(RETRO_LOG_INFO, "RA2: %s (%d)\n", __FUNCTION__, id);
return MemGetBankPtr(id) ? _6502_MEM_LEN : 0;
}

0 comments on commit 6175dc8

Please sign in to comment.