}
}
+static void get_vblanking_limits(int *vbstrtp, int *vbstopp, bool overscanonly)
+{
+ int vbstrt = vblank_firstline_hw;
+ if (!ecs_denise) {
+ vbstrt--;
+ }
+ int vbstop = maxvpos + lof_store;
+ if (!ecs_denise && !ecs_agnus) {
+ vbstop++;
+ } else if (ecs_agnus && !ecs_denise) {
+ // hide hblank bug by faking vblank start 1 line earlier
+ if (currprefs.gfx_overscanmode < OVERSCANMODE_BROADCAST) {
+ vbstrt++;
+ vbstop--;
+ }
+ }
+ if (currprefs.gfx_overscanmode < OVERSCANMODE_OVERSCAN && !overscanonly) {
+ int mult = (OVERSCANMODE_OVERSCAN - currprefs.gfx_overscanmode) * 5;
+ vbstrt += mult;
+ vbstop -= mult;
+ }
+ vbstrt <<= currprefs.gfx_vresolution;
+ vbstop <<= currprefs.gfx_vresolution;
+ if (vblank_top_start < vbstrt) {
+ vblank_top_start = vbstrt;
+ }
+ if (vblank_bottom_stop > vbstop) {
+ vblank_bottom_stop = vbstop;
+ }
+ *vbstrtp = vbstrt;
+ *vbstopp = vbstop;
+}
+
// this handles hardwired vblank
// vb_state in do_color_changes() handles programmed vblank
static void set_vblanking_limits(void)
hardwired = (new_beamcon0 & 0x1000) == 0;
}
if (hardwired) {
- int vbstrt = vblank_firstline_hw;
- if (!ecs_denise) {
- vbstrt--;
- }
- int vbstop = maxvpos;
- if (!ecs_denise && !ecs_agnus) {
- vbstop++;
- } else if (ecs_agnus && !ecs_denise) {
- // hide hblank bug by faking vblank start 1 line earlier
- if (currprefs.gfx_overscanmode < OVERSCANMODE_BROADCAST) {
- vbstop--;
- }
- }
- if (currprefs.gfx_overscanmode < OVERSCANMODE_OVERSCAN) {
- int mult = (OVERSCANMODE_OVERSCAN - currprefs.gfx_overscanmode) * 5;
- vbstrt += mult;
- vbstop -= mult;
- }
- vbstrt <<= currprefs.gfx_vresolution;
- vbstop <<= currprefs.gfx_vresolution;
+ int vbstrt, vbstop;
+ get_vblanking_limits(&vbstrt, &vbstop, false);
if (vblank_top_start < vbstrt) {
vblank_top_start = vbstrt;
}
}
}
+int get_vertical_visible_height(void)
+{
+ struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
+ int h = vidinfo->drawbuffer.inheight;
+ int vbstrt, vbstop;
+
+ if (programmedmode <= 1) {
+ h = (maxvpos_display + maxvpos_display_vsync - minfirstline) << currprefs.gfx_vresolution;
+ }
+ if (interlace_seen && currprefs.gfx_vresolution > 0) {
+ h -= 1 << (currprefs.gfx_vresolution - 1);
+ }
+ bool hardwired = true;
+ if (ecs_agnus) {
+ hardwired = (new_beamcon0 & 0x1000) == 0;
+ }
+ if (hardwired) {
+ get_vblanking_limits(&vbstrt, &vbstop, true);
+ int hh = vbstop - vbstrt;
+ if (h > hh) {
+ h = hh;
+ }
+ }
+ return h;
+}
+
static void set_hblanking_limits(void)
{
// horizontal blanking
void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int height, int depth)
{
- memset (buf, 0, sizeof (struct vidbuffer));
+ memset(buf, 0, sizeof (struct vidbuffer));
buf->monitor_id = monid;
buf->pixbytes = (depth + 7) / 8;
buf->width_allocated = (width + 7) & ~7;
buf->inwidth = buf->width_allocated;
buf->inheight = buf->height_allocated;
- int size = width * height * buf->pixbytes;
- buf->realbufmem = xcalloc (uae_u8, size);
+ buf->rowbytes = buf->width_allocated * buf->pixbytes;
+ int size = buf->rowbytes * buf->height_allocated;
+ buf->realbufmem = xcalloc(uae_u8, size);
buf->bufmem_allocated = buf->bufmem = buf->realbufmem;
- buf->rowbytes = width * buf->pixbytes;
buf->bufmemend = buf->realbufmem + size - buf->rowbytes;
buf->bufmem_lockable = true;
}
return D3D_extoverlay(&eo);
}
+extern int screenshotf(int monid, const TCHAR *spath, int mode, int doprepare, int imagemode, struct vidbuffer *vb);
+extern int screenshotmode;
+static int screencap(LPCVOID pData, struct AmigaMonitor *mon)
+{
+ struct RPScreenCapture *rpsc = (struct RPScreenCapture *)pData;
+ if (rpsc->szScreenFiltered[0] || rpsc->szScreenRaw[0]) {
+ int ossm = screenshotmode;
+ DWORD ret = 0;
+ int ok = 0;
+ screenshotmode = 0;
+ if (log_rp & 2)
+ write_log(_T("'%s' '%s'\n"), rpsc->szScreenFiltered, rpsc->szScreenRaw);
+ if (rpsc->szScreenFiltered[0])
+ ok = screenshotf(0, rpsc->szScreenFiltered, 1, 1, 0, NULL);
+ if (rpsc->szScreenRaw[0]) {
+ struct vidbuf_description *avidinfo = &adisplays[0].gfxvidinfo;
+ struct vidbuffer vb;
+ int w = avidinfo->drawbuffer.inwidth;
+ int h = get_vertical_visible_height();
+ allocvidbuffer(0, &vb, w, h, avidinfo->drawbuffer.pixbytes * 8);
+ set_custom_limits(0, 0, 0, 0);
+ draw_frame(&vb);
+ ok |= screenshotf(0, rpsc->szScreenRaw, 1, 1, 1, &vb);
+ if (log_rp & 2)
+ write_log(_T("Rawscreenshot %dx%d\n"), w, h);
+ //ok |= screenshotf (_T("c:\\temp\\1.bmp"), 1, 1, 1, &vb);
+ freevidbuffer(0, &vb);
+ }
+ screenshotmode = ossm;
+ if (log_rp & 2)
+ write_log(_T("->%d\n"), ok);
+ if (!ok)
+ return RP_SCREENCAPTURE_ERROR;
+ if (WIN32GFX_IsPicassoScreen(mon)) {
+ ret |= RP_GUESTSCREENFLAGS_MODE_DIGITAL;
+ } else {
+ ret |= currprefs.gfx_resolution == RES_LORES ? RP_GUESTSCREENFLAGS_HORIZONTAL_LORES : ((currprefs.gfx_resolution == RES_SUPERHIRES) ? RP_GUESTSCREENFLAGS_HORIZONTAL_SUPERHIRES : 0);
+ ret |= currprefs.ntscmode ? RP_GUESTSCREENFLAGS_MODE_NTSC : RP_GUESTSCREENFLAGS_MODE_PAL;
+ ret |= currprefs.gfx_vresolution ? RP_GUESTSCREENFLAGS_VERTICAL_INTERLACED : 0;
+ }
+ return ret;
+ }
+ return RP_SCREENCAPTURE_ERROR;
+}
+
static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM lParam,
LPCVOID pData, DWORD dwDataSize, LPARAM lMsgFunctionParam)
{
}
case RP_IPC_TO_GUEST_SCREENCAPTURE:
{
- extern int screenshotf(int monid, const TCHAR *spath, int mode, int doprepare, int imagemode, struct vidbuffer *vb);
- extern int screenshotmode;
- struct RPScreenCapture *rpsc = (struct RPScreenCapture*)pData;
- if (rpsc->szScreenFiltered[0] || rpsc->szScreenRaw[0]) {
- int ossm = screenshotmode;
- DWORD ret = 0;
- int ok = 0;
- screenshotmode = 0;
- if (log_rp & 2)
- write_log (_T("'%s' '%s'\n"), rpsc->szScreenFiltered, rpsc->szScreenRaw);
- if (rpsc->szScreenFiltered[0])
- ok = screenshotf(0, rpsc->szScreenFiltered, 1, 1, 0, NULL);
- if (rpsc->szScreenRaw[0]) {
- struct vidbuf_description *avidinfo = &adisplays[0].gfxvidinfo;
- struct vidbuffer vb;
- int w = avidinfo->drawbuffer.inwidth;
- int h = avidinfo->drawbuffer.inheight;
- if (programmedmode <= 1) {
- h = (maxvpos + lof_store - minfirstline) << currprefs.gfx_vresolution;
- }
- if (interlace_seen && currprefs.gfx_vresolution > 0) {
- h -= 1 << (currprefs.gfx_vresolution - 1);
- }
- allocvidbuffer (0, &vb, w, h, avidinfo->drawbuffer.pixbytes * 8);
- set_custom_limits(0, 0, 0, 0);
- draw_frame (&vb);
- ok |= screenshotf(0, rpsc->szScreenRaw, 1, 1, 1, &vb);
- if (log_rp & 2)
- write_log (_T("Rawscreenshot %dx%d\n"), w, h);
- //ok |= screenshotf (_T("c:\\temp\\1.bmp"), 1, 1, 1, &vb);
- freevidbuffer(0, &vb);
- }
- screenshotmode = ossm;
- if (log_rp & 2)
- write_log (_T("->%d\n"), ok);
- if (!ok)
- return RP_SCREENCAPTURE_ERROR;
- if (WIN32GFX_IsPicassoScreen(mon)) {
- ret |= RP_GUESTSCREENFLAGS_MODE_DIGITAL;
- } else {
- ret |= currprefs.gfx_resolution == RES_LORES ? RP_GUESTSCREENFLAGS_HORIZONTAL_LORES : ((currprefs.gfx_resolution == RES_SUPERHIRES) ? RP_GUESTSCREENFLAGS_HORIZONTAL_SUPERHIRES : 0);
- ret |= currprefs.ntscmode ? RP_GUESTSCREENFLAGS_MODE_NTSC : RP_GUESTSCREENFLAGS_MODE_PAL;
- ret |= currprefs.gfx_vresolution ? RP_GUESTSCREENFLAGS_VERTICAL_INTERLACED : 0;
- }
- return ret;
- }
- return RP_SCREENCAPTURE_ERROR;
+ return screencap(pData, mon);
}
case RP_IPC_TO_GUEST_SAVESTATE:
{