mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Updated rcheevos to 7.1.0
This commit is contained in:
parent
60010b4545
commit
3aa200e3ba
19
deps/rcheevos/src/rcheevos/operand.c
vendored
19
deps/rcheevos/src/rcheevos/operand.c
vendored
@ -3,6 +3,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef RC_DISABLE_LUA
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -14,6 +16,8 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
|
||||
static int rc_parse_operand_lua(rc_operand_t* self, const char** memaddr, lua_State* L, int funcs_ndx) {
|
||||
const char* aux = *memaddr;
|
||||
const char* id;
|
||||
@ -32,6 +36,8 @@ static int rc_parse_operand_lua(rc_operand_t* self, const char** memaddr, lua_St
|
||||
aux++;
|
||||
}
|
||||
|
||||
#ifndef RC_DISABLE_LUA
|
||||
|
||||
if (L != 0) {
|
||||
if (!lua_istable(L, funcs_ndx)) {
|
||||
return RC_INVALID_LUA_OPERAND;
|
||||
@ -48,6 +54,8 @@ static int rc_parse_operand_lua(rc_operand_t* self, const char** memaddr, lua_St
|
||||
self->function_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
}
|
||||
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
|
||||
self->type = RC_OPERAND_LUA;
|
||||
*memaddr = aux;
|
||||
return RC_OK;
|
||||
@ -288,6 +296,8 @@ int rc_parse_operand(rc_operand_t* self, const char** memaddr, int is_trigger, l
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RC_DISABLE_LUA
|
||||
|
||||
typedef struct {
|
||||
rc_peek_t peek;
|
||||
void* ud;
|
||||
@ -305,8 +315,13 @@ static int rc_luapeek(lua_State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
|
||||
unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_State* L) {
|
||||
#ifndef RC_DISABLE_LUA
|
||||
rc_luapeek_t luapeek;
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
|
||||
unsigned value = 0;
|
||||
|
||||
switch (self->type) {
|
||||
@ -319,6 +334,8 @@ unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_S
|
||||
return 0;
|
||||
|
||||
case RC_OPERAND_LUA:
|
||||
#ifndef RC_DISABLE_LUA
|
||||
|
||||
if (L != 0) {
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, self->function_ref);
|
||||
lua_pushcfunction(L, rc_luapeek);
|
||||
@ -340,6 +357,8 @@ unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_S
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
|
||||
break;
|
||||
|
||||
case RC_OPERAND_ADDRESS:
|
||||
|
6
deps/rcheevos/test/test.c
vendored
6
deps/rcheevos/test/test.c
vendored
@ -2065,9 +2065,11 @@ static void test_lboard(void) {
|
||||
static void test_lua(void) {
|
||||
{
|
||||
/*------------------------------------------------------------------------
|
||||
TestJson
|
||||
TestLua
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RC_DISABLE_LUA
|
||||
|
||||
lua_State* L;
|
||||
const char* luacheevo = "return { test = function(peek, ud) return peek(0, 4, ud) end }";
|
||||
unsigned char ram[] = {0x00, 0x12, 0x34, 0xAB, 0x56};
|
||||
@ -2087,6 +2089,8 @@ static void test_lua(void) {
|
||||
|
||||
trigger = rc_parse_trigger(buffer, "@test=0xX0", L, 1);
|
||||
assert(rc_test_trigger(trigger, peek, &memory, L) != 0);
|
||||
|
||||
#endif /* RC_DISABLE_LUA */
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user