MCPcopy Create free account
hub / github.com/TASEmulators/fceux / rom_readbyterange

Function rom_readbyterange

src/lua-engine.cpp:1515–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1513}
1514
1515static int rom_readbyterange(lua_State *L) {
1516 int range_start = luaL_checkinteger(L, 1);
1517 int range_size = luaL_checkinteger(L, 2);
1518 if (range_size < 0)
1519 return 0;
1520
1521 char* buf = (char*)alloca(range_size);
1522 for (int i = 0;i<range_size;i++) {
1523 buf[i] = FCEU_ReadRomByte(range_start + i);
1524 }
1525
1526 lua_pushlstring(L, buf, range_size);
1527
1528 return 1;
1529}
1530
1531// doesn't keep backups to allow maximum speed (for automatic rom corruptors and stuff)
1532// keeping them might be an option though, just need to use memview's ApplyPatch()

Callers

nothing calls this directly

Calls 3

luaL_checkintegerFunction · 0.85
FCEU_ReadRomByteFunction · 0.85
lua_pushlstringFunction · 0.85

Tested by

no test coverage detected