emulua: add rom.gethash
This commit is contained in:
parent
50cd0559d3
commit
45848c7591
|
@ -1199,6 +1199,13 @@ void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& save
|
||||||
|
|
||||||
static int rom_readbyte(lua_State *L) { lua_pushinteger(L, FCEU_ReadRomByte(luaL_checkinteger(L,1))); return 1; }
|
static int rom_readbyte(lua_State *L) { lua_pushinteger(L, FCEU_ReadRomByte(luaL_checkinteger(L,1))); return 1; }
|
||||||
static int rom_readbytesigned(lua_State *L) { lua_pushinteger(L, (signed char)FCEU_ReadRomByte(luaL_checkinteger(L,1))); return 1; }
|
static int rom_readbytesigned(lua_State *L) { lua_pushinteger(L, (signed char)FCEU_ReadRomByte(luaL_checkinteger(L,1))); return 1; }
|
||||||
|
static int rom_gethash(lua_State *L) {
|
||||||
|
const char *type = luaL_checkstring(L, 1);
|
||||||
|
if(!type) lua_pushstring(L, "");
|
||||||
|
else if(!stricmp(type,"md5")) lua_pushstring(L, md5_asciistr(GameInfo->MD5));
|
||||||
|
else lua_pushstring(L, "");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
static int memory_readbyte(lua_State *L) { lua_pushinteger(L, FCEU_CheatGetByte(luaL_checkinteger(L,1))); return 1; }
|
static int memory_readbyte(lua_State *L) { lua_pushinteger(L, FCEU_CheatGetByte(luaL_checkinteger(L,1))); return 1; }
|
||||||
static int memory_writebyte(lua_State *L) { FCEU_CheatSetByte(luaL_checkinteger(L,1), luaL_checkinteger(L,2)); return 0; }
|
static int memory_writebyte(lua_State *L) { FCEU_CheatSetByte(luaL_checkinteger(L,1), luaL_checkinteger(L,2)); return 0; }
|
||||||
static int memory_readbyterange(lua_State *L) {
|
static int memory_readbyterange(lua_State *L) {
|
||||||
|
@ -4672,6 +4679,8 @@ static const struct luaL_reg romlib [] = {
|
||||||
{"readbytesigned", rom_readbytesigned},
|
{"readbytesigned", rom_readbytesigned},
|
||||||
// alternate naming scheme for unsigned
|
// alternate naming scheme for unsigned
|
||||||
{"readbyteunsigned", rom_readbyte},
|
{"readbyteunsigned", rom_readbyte},
|
||||||
|
|
||||||
|
{"gethash", rom_gethash},
|
||||||
{NULL,NULL}
|
{NULL,NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue