diff --git a/trunk/src/lua-engine.cpp b/trunk/src/lua-engine.cpp index 1467c4ae..5ee29b48 100644 --- a/trunk/src/lua-engine.cpp +++ b/trunk/src/lua-engine.cpp @@ -21,6 +21,7 @@ #include "driver.h" #include "cheat.h" #include "x6502.h" +#include "ppu.h" #include "utils/xstring.h" #include "utils/memory.h" #include "utils/crc32.h" @@ -1373,6 +1374,27 @@ static int memory_readbyterange(lua_State *L) { return 1; } +static int ppu_readbyte(lua_State *L) { + lua_pushinteger(L, FFCEUX_PPURead(luaL_checkinteger(L, 1))); + return 1; +} + +static int ppu_readbyterange(lua_State *L) { + int range_start = luaL_checkinteger(L, 1); + int range_size = luaL_checkinteger(L, 2); + if (range_size < 0) + return 0; + + char* buf = (char*)alloca(range_size); + for (int i = 0;i