#include "cd32_fmv.h"
#include "specialmonitors.h"
#include "devices.h"
+#include "gfxboard.h"
#define BG_COLOR_DEBUG 0
//#define XLINECHECK
#endif
}
-void redraw_frame (void)
+void redraw_frame(void)
{
last_drawn_line = 0;
first_drawn_line = 32767;
//flush_screen (vidinfo->inbuffer, 0, 0);
}
+void full_redraw_all(void)
+{
+ int monid = 0;
+ struct amigadisplay *ad = &adisplays[monid];
+ notice_screen_contents_lost(monid);
+ gfxboard_refresh(monid);
+ if (!ad->picasso_on) {
+ redraw_frame();
+ }
+ render_screen(0, 1, true);
+ show_screen(0, 0);
+}
+
bool vsync_handle_check (void)
{
int monid = 0;
}
}
-bool gfxboard_vsync_handler(bool full_redraw_required, bool redraw_required)
+void gfxboard_vsync_handler(bool full_redraw_required, bool redraw_required)
{
- bool flushed = false;
-
for (int i = 0; i < MAX_RTG_BOARDS; i++) {
struct rtggfxboard *gb = &rtggfxboards[i];
struct amigadisplay *ad = &adisplays[gb->monitor_id];
if (gb->userdata) {
struct gfxboard_mode mode = { 0 };
mode.redraw_required = full_redraw_required;
- flushed = gb->func->vsync(gb->userdata, &mode);
+ gb->func->vsync(gb->userdata, &mode);
if (mode.mode && mode.width && mode.height) {
if (state->Width != mode.width ||
state->Height != mode.height ||
if (gb->fullrefresh > 0)
gb->fullrefresh--;
}
-
- if (gb->gfxboard_surface) {
- flushed = true;
- gfx_unlock_picasso(gb->monitor_id, true);
- }
+ gfx_unlock_picasso(gb->monitor_id, true);
gb->gfxboard_surface = NULL;
}
-
- return flushed;
}
double gfxboard_get_vsync (void)
extern bool notice_interlace_seen (bool);
extern void notice_resolution_seen (int, bool);
extern bool frame_drawn (int monid);
-extern void redraw_frame (void);
+extern void redraw_frame(void);
+extern void full_redraw_all(void);
extern bool draw_frame (struct vidbuffer*);
extern int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh);
extern void store_custom_limits (int w, int h, int dx, int dy);
extern bool gfxboard_init_registers(struct autoconfig_info*);
extern void gfxboard_free (void);
extern void gfxboard_reset (void);
-extern bool gfxboard_vsync_handler (bool, bool);
+extern void gfxboard_vsync_handler (bool, bool);
extern void gfxboard_hsync_handler(void);
extern int gfxboard_get_configtype (struct rtgboardconfig*);
extern bool gfxboard_is_registers (struct rtgboardconfig*);
static void tms_reset(void *userdata)
{
struct a2410_struct *data = (struct a2410_struct*)userdata;
+ int monid = currprefs.rtgboards[data->a2410_gfxboard].monitor_id;
if (data->a2410_surface)
- gfx_unlock_picasso(0, true);
+ gfx_unlock_picasso(monid, true);
data->a2410_surface = NULL;
data->a2410_modechanged = false;
static void tms_free(void *userdata)
{
struct a2410_struct *data = (struct a2410_struct*)userdata;
+ int monid = currprefs.rtgboards[data->a2410_gfxboard].monitor_id;
if (data->a2410_surface)
- gfx_unlock_picasso(0, true);
+ gfx_unlock_picasso(monid, true);
data->a2410_surface = NULL;
if (data->a2410_gfxboard >= 0) {
gfxboard_free_vram(data->a2410_gfxboard);
}
}
}
-
- if (data->a2410_surface)
- gfx_unlock_picasso(monid, true);
- data->a2410_surface = NULL;
+ if (data->a2410_surface) {
+ data->a2410_surface = NULL;
+ gfx_unlock_picasso(monid, false);
+ }
}
data->a2410_interlace = -data->a2410_interlace;
static bool tms_vsync(void *userdata, struct gfxboard_mode *mode)
{
struct a2410_struct *data = (struct a2410_struct*)userdata;
+ int monid = currprefs.rtgboards[data->a2410_gfxboard].monitor_id;
bool flushed = false;
if (!data->a2410_enabled)
tms_vsync_handler2(data, false);
- if (data->a2410_surface) {
- gfx_unlock_picasso(0, false);
- flushed = true;
- }
data->a2410_surface = NULL;
+ gfx_unlock_picasso(monid, true);
if (data->a2410_visible) {
mode->width = data->a2410_width;
return true;
}
-static void xD3D_unlocktexture(int monid, int y_start, int y_end)
-{
- struct d3dstruct *d3d = &d3ddata[monid];
- HRESULT hr;
-
- if (!isd3d (d3d) || !d3d->texture)
- return;
-
- if (d3d->locked) {
- if (currprefs.leds_on_screen & (STATUSLINE_CHIPSET | STATUSLINE_RTG))
- updateleds (d3d);
- hr = d3d->texture->UnlockRect (0);
- }
- d3d->locked = 0;
- d3d->fulllocked = 0;
-}
-
static void xD3D_flushtexture(int monid, int miny, int maxy)
{
struct d3dstruct *d3d = &d3ddata[monid];
}
}
+static void xD3D_unlocktexture(int monid, int y_start, int y_end)
+{
+ struct d3dstruct *d3d = &d3ddata[monid];
+ HRESULT hr;
+
+ if (!isd3d(d3d) || !d3d->texture)
+ return;
+
+ if (d3d->locked) {
+ if (currprefs.leds_on_screen & (STATUSLINE_CHIPSET | STATUSLINE_RTG))
+ updateleds(d3d);
+ hr = d3d->texture->UnlockRect(0);
+ if (y_start >= 0)
+ xD3D_flushtexture(monid, y_start, y_end);
+ }
+ d3d->locked = 0;
+ d3d->fulllocked = 0;
+}
+
static uae_u8 *xD3D_locktexture (int monid, int *pitch, int *height, bool fullupdate)
{
struct d3dstruct *d3d = &d3ddata[monid];
}
}
-bool xD3D_getscanline(int *scanline, bool *invblank)
+static bool xD3D_getscanline(int *scanline, bool *invblank)
{
struct d3dstruct *d3d = &d3ddata[0];
HRESULT hr;
return true;
}
+static bool xD3D_run(int monid)
+{
+ struct d3dstruct *d3d = &d3ddata[monid];
+ return false;
+}
+
void d3d9_select(void)
{
D3D_free = xD3D_free;
D3D_resize = NULL;
D3D_change = NULL;
D3D_getscalerect = xD3D_getscalerect;
- D3D_run = NULL;
+ D3D_run = xD3D_run;
D3D_debug = xD3D_debug;
D3D_led = xD3D_led;
D3D_getscanline = xD3D_getscanline;
extern void(*D3D_resize)(int, int);
extern void(*D3D_change)(int, int);
extern bool(*D3D_getscalerect)(int, float *mx, float *my, float *sx, float *sy);
-extern void(*D3D_run)(int);
+extern bool(*D3D_run)(int);
extern int(*D3D_debug)(int, int);
extern void(*D3D_led)(int, int, int);
extern bool(*D3D_getscanline)(int*, bool*);
void(*D3D_resize)(int, int);
void (*D3D_change)(int, int);
bool(*D3D_getscalerect)(int, float *mx, float *my, float *sx, float *sy);
-void(*D3D_run)(int);
+bool(*D3D_run)(int);
int(*D3D_debug)(int, int);
void(*D3D_led)(int, int, int);
bool(*D3D_getscanline)(int*, bool*);
d3d->swapChainDesc.Scaling = (d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL || d3d->swapChainDesc.SwapEffect == DXGI_SWAP_EFFECT_FLIP_DISCARD) ? DXGI_SCALING_NONE : DXGI_SCALING_STRETCH;
d3d->blackscreen = false;
- if (!monid) {
+ if (!monid && isvsync()) {
+ int vsync = isvsync();
int hzmult = 0;
getvsyncrate(monid, *freq, &hzmult);
if (hzmult < 0) {
d3d->blackscreen = true;
}
}
- int vsync = isvsync();
if (vsync > 0 && !apm->gfx_vsyncmode) {
if (apm->gfx_strobo)
d3d->blackscreen = true;
}
-static void D3D11_resize_do(struct d3d11struct *d3d)
+static bool D3D11_resize_do(struct d3d11struct *d3d)
{
HRESULT hr;
if (!d3d->fsresizedo)
- return;
+ return false;
if (!d3d->m_swapChain)
- return;
+ return false;
d3d->fsresizedo = false;
}
resizemode(d3d);
- notice_screen_contents_lost(d3d - d3d11data);
- gfxboard_refresh(d3d - d3d11data);
write_log(_T("D3D11 resize exit\n"));
+ return true;
}
-static void recheck(struct d3d11struct *d3d)
+static bool recheck(struct d3d11struct *d3d)
{
+ bool r = false;
if (xD3D11_quit(d3d))
- return;
- D3D11_resize_do(d3d);
+ return r;
+ r = D3D11_resize_do(d3d);
if (d3d->resizeretry) {
resizemode(d3d);
- return;
+ return r;
}
if (!d3d->delayedfs)
- return;
+ return r;
xD3D11_free(d3d - d3d11data, true);
d3d->delayedfs = 0;
ShowWindow(d3d->ahwnd, SW_SHOWNORMAL);
int freq = 0;
if (!xxD3D11_init2(d3d->ahwnd, d3d - d3d11data, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultx))
d3d->invalidmode = true;
+ return false;
}
static bool xD3D11_alloctexture(int monid, int w, int h)
ShowWindow(d3d->ahwnd, SW_HIDE);
} else if (guion == 0) {
d3d->delayedfs = 1;
- notice_screen_contents_lost(monid);
- gfxboard_refresh(monid);
}
write_log(_T("fs guimode end\n"));
}
return true;
}
-static void xD3D11_run(int monid)
+static bool xD3D11_run(int monid)
{
struct d3d11struct *d3d = &d3d11data[monid];
if (xD3D11_quit(d3d))
- return;
- D3D11_resize_do(d3d);
+ return false;
+ if (recheck(d3d))
+ return true;
+ return D3D11_resize_do(d3d);
}
void d3d11_select(void)
resumesoundpaused ();
if (pausemouseactive) {
pausemouseactive = 0;
- setmouseactive(mon->monitor_id, -1);
+ setmouseactive(mon->monitor_id, isfullscreen() > 0 ? 1 : -1);
}
pause_emulation = 0;
setsystime ();
TranslateMessage (&msg);
DispatchMessage (&msg);
}
- if (D3D_run)
- D3D_run(0);
+ if (D3D_run) {
+ if (D3D_run(0)) {
+ full_redraw_all();
+ }
+ }
inputdevicefunc_keyboard.read ();
inputdevicefunc_mouse.read ();
inputdevicefunc_joystick.read ();
cnt2 = 5;
}
}
- if (D3D_run)
- D3D_run(0);
+ if (D3D_run) {
+ if (D3D_run(0))
+ full_redraw_all();
+ }
return pause_emulation != 0;
}
if (d3d) {
if (D3D_restore)
D3D_restore(monid, true);
- surfstart = D3D_locktexture(monid, &pitch, &surf_height, true);
+ surfstart = D3D_locktexture(monid, &pitch, &surf_height, y_start < 0);
if (surfstart == NULL)
return;
} else {
if (opengui) {
DirectDraw_FlipToGDISurface();
} else {
- ;// vblank_reset(-1);
+ full_redraw_all();
}
}