Drawing and Events updates from WinUAE
This commit is contained in:
parent
447d875976
commit
b901d298ad
3 changed files with 74 additions and 14 deletions
|
@ -3126,7 +3126,13 @@ static void pfield_draw_line (struct vidbuffer *vb, int lineno, int gfx_ypos, in
|
|||
have_color_changes = is_color_changes(dip_for_drawing);
|
||||
sprite_smaller_than_64_inuse = false;
|
||||
|
||||
xlinebuffer = row_map[gfx_ypos], dh = dh_buf;
|
||||
dh = dh_line;
|
||||
xlinebuffer = vidinfo->drawbuffer.linemem;
|
||||
if (xlinebuffer == 0 && do_double
|
||||
&& (border == 0 || have_color_changes))
|
||||
xlinebuffer = vidinfo->drawbuffer.emergmem, dh = dh_emerg;
|
||||
if (xlinebuffer == 0)
|
||||
xlinebuffer = row_map[gfx_ypos], dh = dh_buf;
|
||||
xlinebuffer -= linetoscr_x_adjust_pixbytes;
|
||||
//xlinebuffer_genlock = row_map_genlock[gfx_ypos] - linetoscr_x_adjust_pixels;
|
||||
|
||||
|
@ -3606,8 +3612,19 @@ void putpixel(uae_u8 *buf, uae_u8 *genlockbuf, int bpp, int x, xcolnr c8, int op
|
|||
case 4:
|
||||
{
|
||||
int i;
|
||||
uae_u32 *p = (uae_u32*)buf + x;
|
||||
*p = c8;
|
||||
if (1 || opaq || currprefs.gf[0].gfx_filter == 0) {
|
||||
uae_u32 *p = (uae_u32*)buf + x;
|
||||
*p = c8;
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
int v1 = buf[i + bpp * x];
|
||||
int v2 = (c8 >> (i * 8)) & 255;
|
||||
v1 = (v1 * 2 + v2 * 3) / 5;
|
||||
if (v1 > 255)
|
||||
v1 = 255;
|
||||
buf[i + bpp * x] = v1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4219,7 +4236,7 @@ void reset_drawing(void)
|
|||
{
|
||||
struct amigadisplay* ad = &adisplays;
|
||||
struct vidbuf_description* vidinfo = &ad->gfxvidinfo;
|
||||
|
||||
|
||||
max_diwstop = 0;
|
||||
|
||||
lores_reset ();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "sysdeps.h"
|
||||
|
||||
#include "options.h"
|
||||
#include "events.h"
|
||||
#include "memory.h"
|
||||
#include "newcpu.h"
|
||||
#include "xwin.h"
|
||||
|
@ -51,6 +52,8 @@ void events_schedule(void)
|
|||
nextevent = currcycle + mintime;
|
||||
}
|
||||
|
||||
extern void vsync_event_done(void);
|
||||
|
||||
static bool event_check_vsync(void)
|
||||
{
|
||||
/* Keep only CPU emulation running while waiting for sync point. */
|
||||
|
@ -66,6 +69,16 @@ static bool event_check_vsync(void)
|
|||
}
|
||||
// wait for vblank
|
||||
audio_finish_pull();
|
||||
int done = vsync_isdone(NULL);
|
||||
if (!done)
|
||||
{
|
||||
if (currprefs.cachesize)
|
||||
pissoff = pissoff_value;
|
||||
else
|
||||
pissoff = pissoff_nojit_value;
|
||||
return true;
|
||||
}
|
||||
vsync_event_done();
|
||||
}
|
||||
|
||||
else if (is_syncline == -10) {
|
||||
|
@ -110,20 +123,24 @@ static bool event_check_vsync(void)
|
|||
|
||||
void do_cycles_cpu_fastest(uae_u32 cycles_to_add)
|
||||
{
|
||||
if ((pissoff -= cycles_to_add) > 0)
|
||||
return;
|
||||
|
||||
cycles_to_add = -pissoff;
|
||||
pissoff = 0;
|
||||
|
||||
if (is_syncline)
|
||||
{
|
||||
if (event_check_vsync())
|
||||
if (!currprefs.cpu_thread) {
|
||||
if ((pissoff -= cycles_to_add) >= 0)
|
||||
return;
|
||||
|
||||
cycles_to_add = -pissoff;
|
||||
pissoff = 0;
|
||||
} else {
|
||||
pissoff = 0x40000000;
|
||||
}
|
||||
|
||||
while ((nextevent - currcycle) <= cycles_to_add)
|
||||
{
|
||||
if (is_syncline)
|
||||
{
|
||||
if (event_check_vsync())
|
||||
return;
|
||||
}
|
||||
|
||||
cycles_to_add -= (nextevent - currcycle);
|
||||
currcycle = nextevent;
|
||||
|
||||
|
@ -131,7 +148,10 @@ void do_cycles_cpu_fastest(uae_u32 cycles_to_add)
|
|||
{
|
||||
if (i.active && i.evtime == currcycle)
|
||||
{
|
||||
(*i.handler)();
|
||||
if (i.handler == nullptr)
|
||||
i.active = false;
|
||||
else
|
||||
(*i.handler)();
|
||||
}
|
||||
}
|
||||
events_schedule();
|
||||
|
@ -207,6 +227,7 @@ void MISC_handler(void)
|
|||
if (mintime != ~0UL)
|
||||
{
|
||||
eventtab[ev_misc].active = true;
|
||||
eventtab[ev_misc].oldcycles = ct;
|
||||
eventtab[ev_misc].evtime = ct + mintime;
|
||||
events_schedule();
|
||||
}
|
||||
|
@ -247,3 +268,17 @@ void event2_newevent_xx(int no, evt t, uae_u32 data, evfunc2 func)
|
|||
eventtab2[no].data = data;
|
||||
MISC_handler();
|
||||
}
|
||||
|
||||
void event2_newevent_x_replace(evt t, uae_u32 data, evfunc2 func)
|
||||
{
|
||||
for (int i = 0; i < ev2_max; i++) {
|
||||
if (eventtab2[i].active && eventtab2[i].handler == func) {
|
||||
eventtab2[i].active = false;
|
||||
}
|
||||
}
|
||||
if (((int)t) <= 0) {
|
||||
func(data);
|
||||
return;
|
||||
}
|
||||
event2_newevent_xx(-1, t * CYCLE_UNIT, data, func);
|
||||
}
|
||||
|
|
|
@ -1754,7 +1754,9 @@ static int save_thumb(char* path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef USE_DISPMANX
|
||||
static int currVSyncRate = 0;
|
||||
#endif
|
||||
bool vsync_switchmode(int hz)
|
||||
{
|
||||
static struct PicassoResolution* oldmode;
|
||||
|
@ -1873,6 +1875,12 @@ bool vsync_switchmode(int hz)
|
|||
#endif
|
||||
}
|
||||
|
||||
int vsync_isdone(frame_time_t* dt)
|
||||
{
|
||||
if (isvsync() == 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool target_graphics_buffer_update()
|
||||
{
|
||||
auto rate_changed = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue