no message
This commit is contained in:
parent
f39c7290d4
commit
f578428381
|
@ -828,3 +828,8 @@ void callJavascriptScanline(tic_mem* memory, s32 row)
|
||||||
}
|
}
|
||||||
else duk_pop(duk);
|
else duk_pop(duk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void callJavascriptOverlap(tic_mem* memory)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -1245,4 +1245,9 @@ void callLuaScanline(tic_mem* memory, s32 row)
|
||||||
}
|
}
|
||||||
else lua_pop(lua, 1);
|
else lua_pop(lua, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void callLuaOverlap(tic_mem* memory)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@ typedef struct
|
||||||
s32 duration;
|
s32 duration;
|
||||||
} Channel;
|
} Channel;
|
||||||
|
|
||||||
typedef void(ScanlineFunc)(tic_mem* memory, s32 row);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
s32 l;
|
s32 l;
|
||||||
|
@ -84,7 +82,8 @@ typedef struct
|
||||||
Channel channels[TIC_SOUND_CHANNELS];
|
Channel channels[TIC_SOUND_CHANNELS];
|
||||||
} music;
|
} music;
|
||||||
|
|
||||||
ScanlineFunc* scanline;
|
tic_scanline scanline;
|
||||||
|
tic_overlap overlap;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
} MachineState;
|
} MachineState;
|
||||||
|
|
||||||
|
@ -134,3 +133,6 @@ void callJavascriptTick(tic_machine* machine);
|
||||||
|
|
||||||
void callLuaScanline(tic_mem* memory, s32 row);
|
void callLuaScanline(tic_mem* memory, s32 row);
|
||||||
void callJavascriptScanline(tic_mem* memory, s32 row);
|
void callJavascriptScanline(tic_mem* memory, s32 row);
|
||||||
|
|
||||||
|
void callLuaOverlap(tic_mem* memory);
|
||||||
|
void callJavascriptOverlap(tic_mem* memory);
|
||||||
|
|
|
@ -1452,7 +1452,7 @@ static void setCoverImage()
|
||||||
|
|
||||||
if(pixels)
|
if(pixels)
|
||||||
{
|
{
|
||||||
tic->api.blit(tic, pixels, tic->api.scanline);
|
tic->api.blit(tic, pixels, tic->api.scanline, tic->api.overlap);
|
||||||
|
|
||||||
u32* buffer = SDL_malloc(TIC80_WIDTH * TIC80_HEIGHT * sizeof(u32));
|
u32* buffer = SDL_malloc(TIC80_WIDTH * TIC80_HEIGHT * sizeof(u32));
|
||||||
|
|
||||||
|
@ -1932,11 +1932,13 @@ static void blitTexture()
|
||||||
SDL_LockTexture(studio.texture, NULL, &pixels, &pitch);
|
SDL_LockTexture(studio.texture, NULL, &pixels, &pitch);
|
||||||
|
|
||||||
tic_scanline scanline = NULL;
|
tic_scanline scanline = NULL;
|
||||||
|
tic_overlap overlap = NULL;
|
||||||
|
|
||||||
switch(studio.mode)
|
switch(studio.mode)
|
||||||
{
|
{
|
||||||
case TIC_RUN_MODE:
|
case TIC_RUN_MODE:
|
||||||
scanline = tic->api.scanline;
|
scanline = tic->api.scanline;
|
||||||
|
overlap = tic->api.overlap;
|
||||||
break;
|
break;
|
||||||
case TIC_SPRITE_MODE:
|
case TIC_SPRITE_MODE:
|
||||||
scanline = studio.sprite.scanline;
|
scanline = studio.sprite.scanline;
|
||||||
|
@ -1948,7 +1950,7 @@ static void blitTexture()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tic->api.blit(tic, pixels, scanline);
|
tic->api.blit(tic, pixels, scanline, overlap);
|
||||||
|
|
||||||
recordFrame(pixels);
|
recordFrame(pixels);
|
||||||
|
|
||||||
|
|
18
src/tic.c
18
src/tic.c
|
@ -430,6 +430,7 @@ static void api_reset(tic_mem* memory)
|
||||||
tic_machine* machine = (tic_machine*)memory;
|
tic_machine* machine = (tic_machine*)memory;
|
||||||
machine->state.initialized = false;
|
machine->state.initialized = false;
|
||||||
machine->state.scanline = NULL;
|
machine->state.scanline = NULL;
|
||||||
|
machine->state.overlap = NULL;
|
||||||
|
|
||||||
updateSaveid(memory);
|
updateSaveid(memory);
|
||||||
}
|
}
|
||||||
|
@ -1428,6 +1429,7 @@ static void api_tick(tic_mem* memory, tic_tick_data* data)
|
||||||
if(done)
|
if(done)
|
||||||
{
|
{
|
||||||
machine->state.scanline = memory->script == tic_script_js ? callJavascriptScanline : callLuaScanline;
|
machine->state.scanline = memory->script == tic_script_js ? callJavascriptScanline : callLuaScanline;
|
||||||
|
machine->state.overlap = memory->script == tic_script_js ? callJavascriptOverlap : callLuaOverlap;
|
||||||
machine->state.initialized = true;
|
machine->state.initialized = true;
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
|
@ -1447,6 +1449,14 @@ static void api_scanline(tic_mem* memory, s32 row)
|
||||||
machine->state.scanline(memory, row);
|
machine->state.scanline(memory, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void api_overlap(tic_mem* memory)
|
||||||
|
{
|
||||||
|
tic_machine* machine = (tic_machine*)memory;
|
||||||
|
|
||||||
|
if(machine->state.initialized)
|
||||||
|
machine->state.overlap(memory);
|
||||||
|
}
|
||||||
|
|
||||||
static double api_time(tic_mem* memory)
|
static double api_time(tic_mem* memory)
|
||||||
{
|
{
|
||||||
tic_machine* machine = (tic_machine*)memory;
|
tic_machine* machine = (tic_machine*)memory;
|
||||||
|
@ -1645,7 +1655,7 @@ static u32* paletteBlit(tic_mem* tic)
|
||||||
return pal;
|
return pal;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void api_blit(tic_mem* tic, u32* out, tic_scanline scanline)
|
static void api_blit(tic_mem* tic, u32* out, tic_scanline scanline, tic_overlap overlap)
|
||||||
{
|
{
|
||||||
const u32* pal = paletteBlit(tic);
|
const u32* pal = paletteBlit(tic);
|
||||||
|
|
||||||
|
@ -1721,6 +1731,11 @@ static void api_blit(tic_mem* tic, u32* out, tic_scanline scanline)
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
{
|
||||||
|
overlap(tic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initApi(tic_api* api)
|
static void initApi(tic_api* api)
|
||||||
|
@ -1757,6 +1772,7 @@ static void initApi(tic_api* api)
|
||||||
INIT_API(time);
|
INIT_API(time);
|
||||||
INIT_API(tick);
|
INIT_API(tick);
|
||||||
INIT_API(scanline);
|
INIT_API(scanline);
|
||||||
|
INIT_API(overlap);
|
||||||
INIT_API(reset);
|
INIT_API(reset);
|
||||||
INIT_API(pause);
|
INIT_API(pause);
|
||||||
INIT_API(resume);
|
INIT_API(resume);
|
||||||
|
|
|
@ -121,7 +121,7 @@ TIC80_API void tic80_tick(tic80* tic, tic80_input input)
|
||||||
tic80->memory->api.tick(tic80->memory, &tic80->tickData);
|
tic80->memory->api.tick(tic80->memory, &tic80->tickData);
|
||||||
tic80->memory->api.tick_end(tic80->memory);
|
tic80->memory->api.tick_end(tic80->memory);
|
||||||
|
|
||||||
tic80->memory->api.blit(tic80->memory, tic->screen, tic80->memory->api.scanline);
|
tic80->memory->api.blit(tic80->memory, tic->screen, tic80->memory->api.scanline, tic80->memory->api.overlap);
|
||||||
|
|
||||||
TickCounter++;
|
TickCounter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct tic_mem tic_mem;
|
typedef struct tic_mem tic_mem;
|
||||||
typedef void(*tic_scanline)(tic_mem* memory, s32 row);
|
typedef void(*tic_scanline)(tic_mem* memory, s32 row);
|
||||||
|
typedef void(*tic_overlap)(tic_mem* memory);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -96,6 +97,7 @@ typedef struct
|
||||||
double (*time) (tic_mem* memory);
|
double (*time) (tic_mem* memory);
|
||||||
void (*tick) (tic_mem* memory, tic_tick_data* data);
|
void (*tick) (tic_mem* memory, tic_tick_data* data);
|
||||||
void (*scanline) (tic_mem* memory, s32 row);
|
void (*scanline) (tic_mem* memory, s32 row);
|
||||||
|
void (*overlap) (tic_mem* memory);
|
||||||
void (*reset) (tic_mem* memory);
|
void (*reset) (tic_mem* memory);
|
||||||
void (*pause) (tic_mem* memory);
|
void (*pause) (tic_mem* memory);
|
||||||
void (*resume) (tic_mem* memory);
|
void (*resume) (tic_mem* memory);
|
||||||
|
@ -107,7 +109,7 @@ typedef struct
|
||||||
|
|
||||||
void (*tick_start) (tic_mem* memory, const tic_sound* src);
|
void (*tick_start) (tic_mem* memory, const tic_sound* src);
|
||||||
void (*tick_end) (tic_mem* memory);
|
void (*tick_end) (tic_mem* memory);
|
||||||
void (*blit) (tic_mem* tic, u32* out, tic_scanline scanline);
|
void (*blit) (tic_mem* tic, u32* out, tic_scanline scanline, tic_overlap overlap);
|
||||||
|
|
||||||
tic_script_lang (*get_script)(tic_mem* memory);
|
tic_script_lang (*get_script)(tic_mem* memory);
|
||||||
} tic_api;
|
} tic_api;
|
||||||
|
|
Loading…
Reference in New Issue