emulua: add rom.gethash

This commit is contained in:
zeromus 2010-07-27 03:40:59 +00:00
parent 50cd0559d3
commit 45848c7591
1 changed files with 9 additions and 0 deletions

View File

@ -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_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_writebyte(lua_State *L) { FCEU_CheatSetByte(luaL_checkinteger(L,1), luaL_checkinteger(L,2)); return 0; }
static int memory_readbyterange(lua_State *L) {
@ -4672,6 +4679,8 @@ static const struct luaL_reg romlib [] = {
{"readbytesigned", rom_readbytesigned},
// alternate naming scheme for unsigned
{"readbyteunsigned", rom_readbyte},
{"gethash", rom_gethash},
{NULL,NULL}
};