| 1513 | } |
| 1514 | |
| 1515 | static 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() |
nothing calls this directly
no test coverage detected