OVR works
This commit is contained in:
parent
e3ad17f609
commit
c69d36abb7
17
src/luaapi.c
17
src/luaapi.c
|
@ -1249,5 +1249,20 @@ void callLuaScanline(tic_mem* memory, s32 row)
|
||||||
|
|
||||||
void callLuaOverlap(tic_mem* memory)
|
void callLuaOverlap(tic_mem* memory)
|
||||||
{
|
{
|
||||||
|
tic_machine* machine = (tic_machine*)memory;
|
||||||
|
lua_State* lua = machine->lua;
|
||||||
|
|
||||||
|
if (lua)
|
||||||
|
{
|
||||||
|
static const char* OverlapFunc = "overlap";
|
||||||
|
|
||||||
|
lua_getglobal(lua, OverlapFunc);
|
||||||
|
if(lua_isfunction(lua, -1))
|
||||||
|
{
|
||||||
|
if(lua_pcall(lua, 0, 0, 0) != LUA_OK)
|
||||||
|
machine->data->error(machine->data->data, lua_tostring(lua, -1));
|
||||||
|
}
|
||||||
|
else lua_pop(lua, 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
30
src/tic.c
30
src/tic.c
|
@ -158,10 +158,10 @@ static void overlapPixel(tic_mem* tic, s32 x, s32 y, u8 color)
|
||||||
{
|
{
|
||||||
tic_machine* machine = (tic_machine*)tic;
|
tic_machine* machine = (tic_machine*)tic;
|
||||||
|
|
||||||
enum {Top = (TIC80_FULLHEIGHT-TIC80_HEIGHT)/2, Bottom = Top};
|
enum {Top = (TIC80_FULLHEIGHT-TIC80_HEIGHT)/2};
|
||||||
enum {Left = (TIC80_FULLWIDTH-TIC80_WIDTH)/2, Right = Left};
|
enum {Left = (TIC80_FULLWIDTH-TIC80_WIDTH)/2};
|
||||||
|
|
||||||
tic->screen[x + Left + (y + Top) * TIC80_FULLWIDTH] = machine->state.overlapPalette[tic_tool_peek4(tic->ram.vram.mapping, color & 0xf)];
|
tic->screen[x + y * TIC80_FULLWIDTH + (Left + Top * TIC80_FULLWIDTH)] = machine->state.overlapPalette[tic_tool_peek4(tic->ram.vram.mapping, color & 0xf)];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
|
static void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
|
||||||
|
@ -1181,6 +1181,8 @@ static void api_tick_start(tic_mem* memory, const tic_sound* src)
|
||||||
if(prevDown && prevDown == down) (*hold)++;
|
if(prevDown && prevDown == down) (*hold)++;
|
||||||
else *hold = 0;
|
else *hold = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
machine->state.pixel = dmaPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void api_tick_end(tic_mem* memory)
|
static void api_tick_end(tic_mem* memory)
|
||||||
|
@ -1204,6 +1206,26 @@ static void api_tick_end(tic_mem* memory)
|
||||||
|
|
||||||
blip_end_frame(machine->blip, EndTime);
|
blip_end_frame(machine->blip, EndTime);
|
||||||
blip_read_samples(machine->blip, machine->memory.samples.buffer, machine->samplerate / TIC_FRAMERATE);
|
blip_read_samples(machine->blip, machine->memory.samples.buffer, machine->samplerate / TIC_FRAMERATE);
|
||||||
|
|
||||||
|
machine->state.pixel = overlapPixel;
|
||||||
|
|
||||||
|
// temporary palette blit
|
||||||
|
{
|
||||||
|
u32* pal = machine->state.overlapPalette;
|
||||||
|
|
||||||
|
const u8* src = memory->cart.palette.data;
|
||||||
|
|
||||||
|
memset(pal, 0xff, TIC_PALETTE_SIZE);
|
||||||
|
|
||||||
|
u8* dst = (u8*)pal;
|
||||||
|
const u8* end = src + sizeof(tic_palette);
|
||||||
|
|
||||||
|
enum{RGB = sizeof(tic_rgb)};
|
||||||
|
|
||||||
|
for(; src != end; dst++, src+=RGB)
|
||||||
|
for(s32 j = 0; j < RGB; j++)
|
||||||
|
*dst++ = *(src+(RGB-1)-j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1751,9 +1773,7 @@ static void api_blit(tic_mem* tic, tic_scanline scanline, tic_overlap overlap)
|
||||||
memset4(&out[(TIC80_FULLHEIGHT-Bottom) * TIC80_FULLWIDTH], pal[tic->ram.vram.vars.border], TIC80_FULLWIDTH*Bottom);
|
memset4(&out[(TIC80_FULLHEIGHT-Bottom) * TIC80_FULLWIDTH], pal[tic->ram.vram.vars.border], TIC80_FULLWIDTH*Bottom);
|
||||||
|
|
||||||
if(overlap)
|
if(overlap)
|
||||||
{
|
|
||||||
overlap(tic);
|
overlap(tic);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initApi(tic_api* api)
|
static void initApi(tic_api* api)
|
||||||
|
|
Loading…
Reference in New Issue