mirror of
https://github.com/LIV2/WinUAE.git
synced 2025-12-06 00:12:52 +00:00
Fix hardware emulated graphics board screenshots.
This commit is contained in:
parent
034eeeb1cc
commit
ce9500d689
76
gfxboard.cpp
76
gfxboard.cpp
@ -43,6 +43,7 @@ static bool memlogw = true;
|
||||
#include "rommgr.h"
|
||||
#include "xwin.h"
|
||||
#include "devices.h"
|
||||
#include "gfxfilter.h"
|
||||
#include "pcem/device.h"
|
||||
#include "pcem/vid_s3_virge.h"
|
||||
#include "pcem/vid_cl5429.h"
|
||||
@ -601,6 +602,8 @@ void gfxboard_free_vram(int index)
|
||||
vram_ram_a8 = 0;
|
||||
}
|
||||
|
||||
extern uae_u8 *getpcembuffer32(int, int, int);
|
||||
|
||||
// PCEM
|
||||
void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
||||
{
|
||||
@ -615,7 +618,6 @@ void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
||||
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[gb->monitor_id];
|
||||
for (int yy = y1; yy < y2 && yy < vidinfo->height; yy++) {
|
||||
uae_u8 *d = gb->gfxboard_surface + yy * vidinfo->rowbytes;
|
||||
extern uae_u8 *getpcembuffer32(int, int, int);
|
||||
uae_u8 *s = getpcembuffer32(x, y, yy);
|
||||
memcpy(d, s, vidinfo->width * vidinfo->pixbytes);
|
||||
}
|
||||
@ -3976,7 +3978,7 @@ static uae_u32 REGPARAM2 gfxboard_lget_vram_pcem(uaecptr addr)
|
||||
if (addr & 0x800000) {
|
||||
v = do_byteswap_32(v);
|
||||
} else if (addr & 0x400000) {
|
||||
v = do_byteswap_32(v);
|
||||
v = (v >> 16) | (v << 16);
|
||||
} else {
|
||||
;
|
||||
}
|
||||
@ -4013,7 +4015,7 @@ static void REGPARAM2 gfxboard_lput_vram_pcem(uaecptr addr, uae_u32 l)
|
||||
if (addr & 0x800000) {
|
||||
l = do_byteswap_32(l);
|
||||
} else if (addr & 0x400000) {
|
||||
l = do_byteswap_32(l);
|
||||
l = (l >> 16) | (l << 16);
|
||||
} else {
|
||||
;
|
||||
}
|
||||
@ -5097,3 +5099,71 @@ int pcem_getvramsize(void)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool gfxboard_isgfxboardscreen(int monid)
|
||||
{
|
||||
int index = rtg_visible[monid];
|
||||
if (index < 0)
|
||||
return false;
|
||||
struct rtgboardconfig *rbc = &currprefs.rtgboards[index];
|
||||
struct rtggfxboard *gb = &rtggfxboards[rbc->rtg_index];
|
||||
return gb->active && rtg_visible[monid] >= 0;
|
||||
}
|
||||
uae_u8 *gfxboard_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette)
|
||||
{
|
||||
int index = rtg_visible[monid];
|
||||
if (index < 0)
|
||||
return NULL;
|
||||
struct rtgboardconfig *rbc = &currprefs.rtgboards[index];
|
||||
|
||||
if (rbc->rtgmem_type < GFXBOARD_HARDWARE) {
|
||||
return uaegfx_getrtgbuffer(monid, widthp, heightp, pitch, depth, palette);
|
||||
}
|
||||
|
||||
struct rtggfxboard *gb = &rtggfxboards[rbc->rtg_index];
|
||||
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
|
||||
struct picasso96_state_struct *state = &picasso96_state[monid];
|
||||
|
||||
if (!gb->pcemdev)
|
||||
return NULL;
|
||||
|
||||
int width = state->VirtualWidth;
|
||||
int height = state->VirtualHeight;
|
||||
if (!width || !height)
|
||||
return NULL;
|
||||
|
||||
uae_u8 *dst = xmalloc(uae_u8, width * height * 4);
|
||||
if (!dst)
|
||||
return NULL;
|
||||
|
||||
uae_u8 *d = dst;
|
||||
for (int yy = 0; yy < height; yy++) {
|
||||
uae_u8 *s = getpcembuffer32(32, 0, yy);
|
||||
memcpy(d, s, width * 4);
|
||||
d += width * 4;
|
||||
}
|
||||
|
||||
*widthp = width;
|
||||
*heightp = height;
|
||||
*pitch = width * 4;
|
||||
*depth = 4 * 8;
|
||||
|
||||
return dst;
|
||||
}
|
||||
void gfxboard_freertgbuffer(int monid, uae_u8 *dst)
|
||||
{
|
||||
int index = rtg_visible[monid];
|
||||
if (index < 0) {
|
||||
uaegfx_freertgbuffer(monid, dst);
|
||||
return;
|
||||
}
|
||||
struct rtgboardconfig *rbc = &currprefs.rtgboards[index];
|
||||
|
||||
if (rbc->rtgmem_type < GFXBOARD_HARDWARE) {
|
||||
uaegfx_freertgbuffer(monid, dst);
|
||||
return;
|
||||
}
|
||||
|
||||
xfree(dst);
|
||||
}
|
||||
|
||||
@ -35,6 +35,10 @@ extern bool gfxboard_init_board(struct autoconfig_info*);
|
||||
extern bool gfxboard_set(int monid, bool rtg);
|
||||
extern void gfxboard_resize(int width, int height, void *p);
|
||||
|
||||
uae_u8 *gfxboard_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
|
||||
void gfxboard_freertgbuffer(int monid, uae_u8 *dst);
|
||||
bool gfxboard_isgfxboardscreen(int monid);
|
||||
|
||||
extern struct gfxboard_func a2410_func;
|
||||
extern struct gfxboard_func harlequin_func;
|
||||
|
||||
|
||||
@ -84,8 +84,8 @@ uae_u8 *getfilterbuffer3d(int monid, int *widthp, int *heightp, int *pitch, int
|
||||
uae_u8 *getfilterbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth);
|
||||
void freefilterbuffer(int monid, uae_u8*);
|
||||
|
||||
uae_u8 *getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
|
||||
void freertgbuffer(int monid, uae_u8 *dst);
|
||||
uae_u8 *uaegfx_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette);
|
||||
void uaegfx_freertgbuffer(int monid, uae_u8 *dst);
|
||||
|
||||
extern void getrtgfilterrect2(int monid, RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height);
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@ void uae_time_init(void);
|
||||
void uae_time_calibrate(void);
|
||||
uae_time_t uae_time(void);
|
||||
|
||||
extern int syncbase;
|
||||
|
||||
#ifdef _WIN32
|
||||
void uae_time_use_rdtsc(bool enable);
|
||||
uae_u32 read_system_time(void);
|
||||
|
||||
@ -43,6 +43,7 @@ Copyright(c) 2001 - 2002;
|
||||
#include "threaddep/thread.h"
|
||||
#include "zfile.h"
|
||||
#include "savestate.h"
|
||||
#include "gfxboard.h"
|
||||
|
||||
#define MAX_AVI_SIZE (0x80000000 - 0x1000000)
|
||||
|
||||
@ -539,10 +540,10 @@ static int AVIOutput_AllocateVideo(void)
|
||||
avioutput_fps = ispal() ? 50 : 60;
|
||||
if (avioutput_originalsize || WIN32GFX_IsPicassoScreen(mon)) {
|
||||
int pitch;
|
||||
if (!WIN32GFX_IsPicassoScreen(mon)) {
|
||||
if (!gfxboard_isgfxboardscreen(0)) {
|
||||
getfilterbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits);
|
||||
} else {
|
||||
freertgbuffer(0, getrtgbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits, NULL));
|
||||
gfxboard_freertgbuffer(0, gfxboard_getrtgbuffer(0, &avioutput_width, &avioutput_height, &pitch, &avioutput_bits, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1105,12 +1106,12 @@ static int getFromBuffer(struct avientry *ae, int original)
|
||||
mem = NULL;
|
||||
dpitch = ((aviout_width_out * avioutput_bits + 31) & ~31) / 8;
|
||||
if (original || WIN32GFX_IsPicassoScreen(mon)) {
|
||||
if (!WIN32GFX_IsPicassoScreen(mon)) {
|
||||
if (!gfxboard_isgfxboardscreen(aviout_monid)) {
|
||||
src = getfilterbuffer(aviout_monid, &w, &h, &spitch, &d);
|
||||
maxw = vidinfo->outbuffer->outwidth;
|
||||
maxh = vidinfo->outbuffer->outheight;
|
||||
} else {
|
||||
src = mem = getrtgbuffer(aviout_monid, &w, &h, &spitch, &d, NULL);
|
||||
src = mem = gfxboard_getrtgbuffer(aviout_monid, &w, &h, &spitch, &d, NULL);
|
||||
maxw = w;
|
||||
maxh = h;
|
||||
}
|
||||
@ -1188,7 +1189,7 @@ static int getFromBuffer(struct avientry *ae, int original)
|
||||
src += spitch;
|
||||
}
|
||||
if (mem)
|
||||
freertgbuffer(aviout_monid, mem);
|
||||
gfxboard_freertgbuffer(aviout_monid, mem);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -5117,7 +5117,7 @@ static void copyall (int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheigh
|
||||
}
|
||||
}
|
||||
|
||||
uae_u8 *getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette)
|
||||
uae_u8 *uaegfx_getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *depth, uae_u8 *palette)
|
||||
{
|
||||
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
|
||||
struct picasso96_state_struct *state = &picasso96_state[monid];
|
||||
@ -5172,7 +5172,7 @@ uae_u8 *getrtgbuffer(int monid, int *widthp, int *heightp, int *pitch, int *dept
|
||||
|
||||
return dst;
|
||||
}
|
||||
void freertgbuffer(int monid, uae_u8 *dst)
|
||||
void uaegfx_freertgbuffer(int monid, uae_u8 *dst)
|
||||
{
|
||||
xfree (dst);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "drawing.h"
|
||||
#include "fsdb.h"
|
||||
#include "zfile.h"
|
||||
#include "picasso96_win.h"
|
||||
#include "gfxboard.h"
|
||||
|
||||
#include "png.h"
|
||||
|
||||
@ -144,8 +144,8 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
|
||||
int screenshot_width = 0, screenshot_height = 0;
|
||||
int screenshot_xoffset = -1, screenshot_yoffset = -1;
|
||||
|
||||
if (WIN32GFX_IsPicassoScreen(mon)) {
|
||||
src = mem = getrtgbuffer(monid, &width, &height, &spitch, &bits, pal);
|
||||
if (gfxboard_isgfxboardscreen(monid)) {
|
||||
src = mem = gfxboard_getrtgbuffer(monid, &width, &height, &spitch, &bits, pal);
|
||||
needfree = true;
|
||||
rgb_bb2 = 8;
|
||||
rgb_gb2 = 8;
|
||||
@ -189,7 +189,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
|
||||
if (width == 0 || height == 0) {
|
||||
if (needfree) {
|
||||
if (WIN32GFX_IsPicassoScreen(mon))
|
||||
freertgbuffer(0, mem);
|
||||
gfxboard_freertgbuffer(0, mem);
|
||||
else
|
||||
freefilterbuffer(0, mem);
|
||||
}
|
||||
@ -290,7 +290,7 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
|
||||
if (!(lpvBits = xmalloc(uae_u8, bi->bmiHeader.biSizeImage))) {
|
||||
if (needfree) {
|
||||
if (WIN32GFX_IsPicassoScreen(mon))
|
||||
freertgbuffer(monid, mem);
|
||||
gfxboard_freertgbuffer(monid, mem);
|
||||
else
|
||||
freefilterbuffer(monid, mem);
|
||||
}
|
||||
@ -408,8 +408,8 @@ static int screenshot_prepare(int monid, int imagemode, struct vidbuffer *vb, bo
|
||||
src += spitch;
|
||||
}
|
||||
if (needfree) {
|
||||
if (WIN32GFX_IsPicassoScreen(mon))
|
||||
freertgbuffer(monid, mem);
|
||||
if (gfxboard_isgfxboardscreen(monid))
|
||||
gfxboard_freertgbuffer(monid, mem);
|
||||
else
|
||||
freefilterbuffer(monid, mem);
|
||||
}
|
||||
|
||||
@ -4158,6 +4158,21 @@ void target_fixup_options (struct uae_prefs *p)
|
||||
nojoy = true;
|
||||
}
|
||||
|
||||
if (p->rtg_hardwaresprite && !p->gfx_api) {
|
||||
error_log(_T("DirectDraw is not RTG hardware sprite compatible."));
|
||||
p->rtg_hardwaresprite = false;
|
||||
}
|
||||
if (p->rtgboards[0].rtgmem_type >= GFXBOARD_HARDWARE) {
|
||||
p->rtg_hardwareinterrupt = false;
|
||||
p->rtg_hardwaresprite = false;
|
||||
p->win32_rtgmatchdepth = false;
|
||||
p->color_mode = 5;
|
||||
if (p->ppc_model && !p->gfx_api) {
|
||||
error_log(_T("Graphics board and PPC: Direct3D enabled."));
|
||||
p->gfx_api = os_win7 ? 2 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
struct MultiDisplay *md = getdisplay(p, 0);
|
||||
for (int j = 0; j < MAX_AMIGADISPLAYS; j++) {
|
||||
if (p->gfx_monitor[j].gfx_size_fs.special == WH_NATIVE) {
|
||||
@ -4190,22 +4205,7 @@ void target_fixup_options (struct uae_prefs *p)
|
||||
p->color_mode = p->color_mode == 5 ? 2 : 5;
|
||||
}
|
||||
}
|
||||
if (p->rtg_hardwaresprite && !p->gfx_api) {
|
||||
error_log (_T("DirectDraw is not RTG hardware sprite compatible."));
|
||||
p->rtg_hardwaresprite = false;
|
||||
}
|
||||
if (p->rtgboards[0].rtgmem_type >= GFXBOARD_HARDWARE) {
|
||||
p->rtg_hardwareinterrupt = false;
|
||||
p->rtg_hardwaresprite = false;
|
||||
p->win32_rtgmatchdepth = false;
|
||||
if (gfxboard_need_byteswap (&p->rtgboards[0]))
|
||||
p->color_mode = 5;
|
||||
if (p->ppc_model && !p->gfx_api) {
|
||||
error_log (_T("Graphics board and PPC: Direct3D enabled."));
|
||||
p->gfx_api = os_win7 ? 2 : 1;
|
||||
}
|
||||
|
||||
}
|
||||
if ((p->gfx_apmode[0].gfx_vsyncmode || p->gfx_apmode[1].gfx_vsyncmode) ) {
|
||||
if (p->produce_sound && sound_devices[p->win32_soundcard]->type == SOUND_DEVICE_DS) {
|
||||
p->win32_soundcard = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user