Added a few options to emu.getscreenpixel. Can now fully distinguish between LUA and Emu pixels, or ignore distinction.
This commit is contained in:
parent
a8016502b0
commit
6c991885bf
|
@ -3186,6 +3186,7 @@ static int emu_getscreenpixel(lua_State *L) {
|
|||
|
||||
int x = luaL_checkinteger(L, 1);
|
||||
int y = luaL_checkinteger(L,2);
|
||||
bool getemuscreen = (lua_toboolean(L,3) == 1);
|
||||
|
||||
int r, g, b;
|
||||
int palette;
|
||||
|
@ -3208,10 +3209,10 @@ static int emu_getscreenpixel(lua_State *L) {
|
|||
return 4;
|
||||
}
|
||||
|
||||
uint32 pixelinfo = GetScreenPixel(x,y);
|
||||
uint32 pixelinfo = GetScreenPixel(x,y,getemuscreen);
|
||||
|
||||
LUA_DECOMPOSE_PIXEL(pixelinfo, palette, r, g, b);
|
||||
palette = GetScreenPixelPalette(x,y);
|
||||
palette = GetScreenPixelPalette(x,y,getemuscreen);
|
||||
|
||||
lua_pushinteger(L, r);
|
||||
lua_pushinteger(L, g);
|
||||
|
|
|
@ -414,24 +414,32 @@ static int WritePNGChunk(FILE *fp, uint32 size, char *type, uint8 *data)
|
|||
return 1;
|
||||
}
|
||||
|
||||
uint32 GetScreenPixel(int x, int y) {
|
||||
uint32 GetScreenPixel(int x, int y, bool usebackup) {
|
||||
|
||||
uint8 r,g,b;
|
||||
|
||||
if (((x < 0) || (x > 255)) || ((y < 0) || (y > 255)))
|
||||
return -1;
|
||||
|
||||
FCEUD_GetPalette(XBuf[(y*256)+x],&r,&g,&b);
|
||||
if (usebackup)
|
||||
FCEUD_GetPalette(XBackBuf[(y*256)+x],&r,&g,&b);
|
||||
else
|
||||
FCEUD_GetPalette(XBuf[(y*256)+x],&r,&g,&b);
|
||||
|
||||
|
||||
return ((int) (r) << 16) | ((int) (g) << 8) | (int) (b);
|
||||
}
|
||||
|
||||
int GetScreenPixelPalette(int x, int y) {
|
||||
int GetScreenPixelPalette(int x, int y, bool usebackup) {
|
||||
|
||||
if (((x < 0) || (x > 255)) || ((y < 0) || (y > 255)))
|
||||
return -1;
|
||||
|
||||
return XBuf[(y*256)+x] & 0x3f;
|
||||
if (usebackup)
|
||||
return XBackBuf[(y*256)+x] & 0x3f;
|
||||
else
|
||||
return XBuf[(y*256)+x] & 0x3f;
|
||||
|
||||
}
|
||||
|
||||
int SaveSnapshot(void)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
int FCEU_InitVirtualVideo(void);
|
||||
void FCEU_KillVirtualVideo(void);
|
||||
int SaveSnapshot(void);
|
||||
uint32 GetScreenPixel(int x, int y);
|
||||
int GetScreenPixelPalette(int x, int y);
|
||||
uint32 GetScreenPixel(int x, int y, bool usebackup);
|
||||
int GetScreenPixelPalette(int x, int y, bool usebackup);
|
||||
extern uint8 *XBuf;
|
||||
extern uint8 *XBackBuf;
|
||||
extern int ClipSidesOffset;
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue