Utility to display a single frame

This commit is contained in:
Flyinghead 2018-07-16 17:19:45 +02:00
parent dc835dd64d
commit a17a0bae3b
4 changed files with 71 additions and 0 deletions

61
core/dispframe.cpp Executable file
View File

@ -0,0 +1,61 @@
#include <signal.h>
#include "hw/pvr/ta_ctx.h"
#include "cfg/cfg.h"
#include "rend/TexCache.h"
extern cResetEvent rs;
extern int rend_en;
extern cResetEvent frame_finished;
extern TA_context* rqueue;
void SetREP(TA_context* cntx);
TA_context* read_frame(const char* file, u8* vram_ref = NULL);
void rend_set_fb_scale(float x,float y);
#ifdef TARGET_DISPFRAME
void dc_run()
{
struct sigaction act, segv_oact;
memset(&act, 0, sizeof(act));
sigemptyset(&act.sa_mask);
act.sa_sigaction = SIG_IGN;
sigaction(SIGUSR1, &act, &segv_oact);
rend_set_fb_scale(1.0, 1.0);
char frame_path[512];
cfgLoadStr("config", "image", frame_path, "null");
printf("Loading %s\n", frame_path);
double t0 = os_GetSeconds();
TA_context*ctx = read_frame(frame_path);
double t1 = os_GetSeconds();
printf("Loaded context in %g ms\n", (t1- t0) * 1000);
while(rend_en)
{
tad_context saved_tad = ctx->tad;
rend_context saved_rend = ctx->rend;
FillBGP(ctx);
if (rqueue)
frame_finished.Wait();
if (QueueRender(ctx)) {
palette_update();
#if !defined(TARGET_NO_THREADS)
rs.Set();
#else
rend_single_frame();
#endif
}
else
SetREP(NULL); // Sched end of render interrupt
ctx = tactx_Alloc();
ctx->tad = saved_tad;
ctx->rend = saved_rend;
os_DoEvents();
}
}
#endif

View File

@ -226,6 +226,7 @@ bool rend_frame(TA_context* ctx, bool draw_osd) {
char name[32];
sprintf(name, "dcframe-%d", FrameCount);
dump_frame(name, _pvrrc, &vram[0]);
dump_frame_switch = false;
}
bool proc = renderer->Process(ctx);
#if !defined(TARGET_NO_THREADS)

View File

@ -78,8 +78,10 @@ s32 plugins_Init()
if (s32 rv = libPvr_Init())
return rv;
#ifndef TARGET_DISPFRAME
if (s32 rv = libGDR_Init())
return rv;
#endif
#if DC_PLATFORM == DC_PLATFORM_NAOMI
if (!naomi_cart_SelectFile(libPvr_GetRenderTarget()))
return rv_serror;
@ -276,10 +278,12 @@ int dc_init(int argc,wchar* argv[])
return rv;
}
#ifndef TARGET_DISPFRAME
void dc_run()
{
sh4_cpu.Run();
}
#endif
void dc_term()
{

View File

@ -338,6 +338,11 @@ ifdef NAOMI
DC_PLATFORM=naomi
EXECUTABLE=reicast_naomi.elf
EXECUTABLE_NAME=reicast-naomi
else ifdef DISPFRAME
CFLAGS += -D TARGET_DISPFRAME
DC_PLATFORM=dreamcast
EXECUTABLE=dispframe.elf
EXECUTABLE_NAME=dispframe
else
DC_PLATFORM=dreamcast
EXECUTABLE=reicast.elf