{
for (int i = 0; i < MAX_RTG_BOARDS; i++) {
struct rtggfxboard *gb = &rtggfxboards[i];
- if (gb->pcemdev) {
+ if (gb->pcemdev && gb->pcemobject) {
if (rtg_visible[gb->monitor_id] >= 0 && gb->monswitch_delay == 0 && gb->monswitch_current == gb->monswitch_new) {
if (gb->gfxboard_surface == NULL) {
gb->gfxboard_surface = gfx_lock_picasso(gb->monitor_id, false, false);
for (int yy = y1; yy < y2 && yy < vidinfo->height; yy++) {
uae_u8 *d = gb->gfxboard_surface + yy * vidinfo->rowbytes;
uae_u8 *s = getpcembuffer32(x, y, yy);
- memcpy(d, s, vidinfo->width * vidinfo->pixbytes);
+ int ww = w > vidinfo->width ? vidinfo->width : w;
+ memcpy(d, s, ww * vidinfo->pixbytes);
}
}
}
if (gb->func && gb->userdata) {
gb->func->hsync(gb->userdata);
}
- if (gb->pcemdev && !gb->pcem_vblank) {
+ if (gb->pcemdev && gb->pcemobject && !gb->pcem_vblank) {
extern int svga_get_vtotal(void);
static int pollcnt;
int pollsize = svga_get_vtotal() * 256 / 300;
while (pollcnt >= 256) {
if (gfxboard_pcem_poll(gb)) {
gb->pcem_vblank = 1;
+ pollcnt &= 0xff;
break;
}
pollcnt -= 256;
set_config_changed();
}
if (gb->pcemdev) {
- gb->pcemdev->close(gb->pcemobject);
+ if (gb->pcemobject) {
+ gb->pcemdev->close(gb->pcemobject);
+ gb->pcemobject = NULL;
+ }
}
gb->userdata = NULL;
gb->func = NULL;
static void gfxboard_set_fullrefresh(struct rtggfxboard *gb, int cnt)
{
gb->fullrefresh = cnt;
- if (gb->pcemdev) {
+ if (gb->pcemdev && gb->pcemobject) {
gb->pcemdev->force_redraw(gb->pcemobject);
}
}
} else if (gb->configured_mem > 0 && gb->configured_regs > 0) {
if (gb->pcemdev) {
- if (!gb->pcem_vblank) {
+ static int fcount;
+ if (!gb->pcem_vblank && gb->pcemobject) {
for (;;) {
if (gfxboard_pcem_poll(gb))
break;
}
}
gb->pcem_vblank = 0;
+ extern int console_logging;
+ if (console_logging) {
+ fcount++;
+ if ((fcount % 50) == 0) {
+ if (gb->pcemobject && gb->pcemdev->add_status_info) {
+ char txt[256];
+ txt[0] = 0;
+ gb->pcemdev->add_status_info(txt, sizeof(txt), gb->pcemobject);
+ TCHAR *s = au(txt);
+ write_log(_T("%s"), s);
+ xfree(s);
+ }
+ }
+ }
}
if (gb->monswitch_keep_trying) {
static void picassoiv_checkswitch (struct rtggfxboard *gb)
{
if (ISP4()) {
- uae_u8 v;
+ uae_u8 v = 0;
bool rtg_active = (gb->picassoiv_flifi & 1) == 0;
if (gb->pcemdev) {
- extern uae_u8 pcem_read_io(int, int);
- v = pcem_read_io(0x3d5, 0x51);
+ if (gb->pcemobject) {
+ extern uae_u8 pcem_read_io(int, int);
+ v = pcem_read_io(0x3d5, 0x51);
+ }
} else {
v = gb->vga.vga.cr[0x51];
}
gb->gfxboard_bank_memory.wput = gfxboard_wput_mem;
if (gb->board->pcemdev) {
if (boardnum == GFXBOARD_ID_CV643D_Z3) {
- gb->gfxboardmem_start += 0x4000000;
+ gb->gfxboardmem_start += 0x4800000;
}
}
init_board(gb);
return;
}
}
+ if (gb->pcemdev) {
+ if (gb->pcemobject) {
+ gb->pcemdev->close(gb->pcemobject);
+ gb->pcemobject = NULL;
+ }
+ }
if (gb->vram) {
gb->gfxmem_bank->baseaddr = gb->vramrealstart;
gfxboard_free_vram(gb->rbc->rtg_index);
struct rtggfxboard *gb = getgfxboard(addr);
addr = (addr - gb->gfxboardmem_start) & gb->banksize_mask;
addr += gb->pcem_vram_offset;
+ addr ^= 1;
uae_u8 v = pcem_linear_read_b(addr + pcem_mapping_linear_offset, pcem_mapping_linear_priv);
return v;
}
addr = (addr - gb->gfxboardmem_start) & gb->banksize_mask;
addr += gb->pcem_vram_offset;
addr &= gb->pcem_vram_mask;
+ addr ^= 1;
pcem_linear_write_b(addr + pcem_mapping_linear_offset, b, pcem_mapping_linear_priv);
}
static void REGPARAM2 gfxboard_wput_vram_wordswap_pcem(uaecptr addr, uae_u32 w)
if (gb->device_data & 0x40) {
;
} else if (gb->device_data & 0x20) {
- v = do_byteswap_32(v);
+ v = (v >> 16) | (v << 16);
} else {
v = do_byteswap_32(v);
}
if (gb->device_data & 0x40) {
;
} else if (gb->device_data & 0x20) {
- l = do_byteswap_32(l);
+ l = (l >> 16) | (l << 16);
} else {
l = do_byteswap_32(l);
}
void (*pcem_linear_write_w)(uint32_t addr, uint16_t val, void *priv);
void (*pcem_linear_write_l)(uint32_t addr, uint32_t val, void *priv);
+#define MAX_PCEMMAPPINGS 10
+static mem_mapping_t *pcemmappings[MAX_PCEMMAPPINGS];
+#define PCEMMAPBLOCKSIZE 0x10000
+#define MAX_PCEMMAPBLOCKS (0x10000000 / PCEMMAPBLOCKSIZE)
+mem_mapping_t *pcemmap[MAX_PCEMMAPBLOCKS];
+
static uint8_t dummy_bread(uint32_t addr, void *p)
{
return 0;
{
int c, d, e;
+ for (int i = 0; i < MAX_PCEMMAPBLOCKS; i++) {
+ pcemmap[i] = NULL;
+ }
+ for (int i = 0; i < MAX_PCEMMAPPINGS; i++) {
+ pcemmappings[i] = NULL;
+ }
+
gfxboard_priv = p;
has_vlb = 0;
timer_freq = syncbase;
return 0;
}
+void thread_sleep(int n)
+{
+ sleep_millis(n);
+}
+
thread_t *thread_create(void (*thread_rout)(void *param), void *param)
{
uae_thread_id tid;
}
void thread_kill(thread_t *handle)
{
- uae_end_thread((uae_thread_id*)handle);
+ uae_end_thread((uae_thread_id*)&handle);
}
event_t *thread_create_event(void)
{
uae_sem_destroy((uae_sem_t*)&_event);
}
-#define MAX_PCEMMAPPINGS 10
-static mem_mapping_t *pcemmappings[MAX_PCEMMAPPINGS];
-#define PCEMMAPBLOCKSIZE 0x10000
-#define MAX_PCEMMAPBLOCKS (0x10000000 / PCEMMAPBLOCKSIZE)
-mem_mapping_t *pcemmap[MAX_PCEMMAPBLOCKS];
-
static mem_mapping_t *getmm(uaecptr *addrp)
{
uaecptr addr = *addrp;