From: Toni Wilen Date: Sun, 30 Mar 2008 09:36:50 +0000 (+0300) Subject: imported winuaesrc1500b11.zip X-Git-Tag: 2100~156 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=dc716c74406d7c7cb48b13292f3a4cf5d8a0e7a2;p=francis%2Fwinuae.git imported winuaesrc1500b11.zip --- diff --git a/autoconf.c b/autoconf.c index 24465420..063f06c8 100755 --- a/autoconf.c +++ b/autoconf.c @@ -199,6 +199,7 @@ static void rtarea_init_mem (void) write_log ("virtual memory exhausted (rtarea)!\n"); abort (); } + memset (rtarea, 0, 0x10000); rtarea_bank.baseaddr = rtarea; } diff --git a/blitter.c b/blitter.c index fadb1df5..b57d5677 100755 --- a/blitter.c +++ b/blitter.c @@ -9,6 +9,7 @@ //#define BLITTER_DEBUG //#define BLITTER_SLOWDOWNDEBUG 4 +//#define BLITTER_DEBUG_NO_D #define SPEEDUP @@ -264,6 +265,13 @@ static void blitter_done (void) #endif } +STATIC_INLINE chipmem_agnus_wput2 (uaecptr addr, uae_u32 w) +{ +#ifndef BLITTER_DEBUG_NO_D + chipmem_agnus_wput (addr, w); +#endif +} + static void blitter_dofast (void) { int i,j; @@ -327,7 +335,8 @@ static void blitter_dofast (void) blt_info.bltcdat = chipmem_agnus_wget (bltcdatptr); bltcdatptr += 2; } - if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat); + if (dodst) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF; if (blitfill) { uae_u16 d = blt_info.bltddat; @@ -345,12 +354,17 @@ static void blitter_dofast (void) bltddatptr += 2; } } - if (bltadatptr) bltadatptr += blt_info.bltamod; - if (bltbdatptr) bltbdatptr += blt_info.bltbmod; - if (bltcdatptr) bltcdatptr += blt_info.bltcmod; - if (bltddatptr) bltddatptr += blt_info.bltdmod; + if (bltadatptr) + bltadatptr += blt_info.bltamod; + if (bltbdatptr) + bltbdatptr += blt_info.bltbmod; + if (bltcdatptr) + bltcdatptr += blt_info.bltcmod; + if (bltddatptr) + bltddatptr += blt_info.bltdmod; } - if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat); + if (dodst) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); blt_info.bltbhold = blitbhold; } blit_masktable[0] = 0xFFFF; @@ -420,7 +434,8 @@ static void blitter_dofast_desc (void) blt_info.bltcdat = blt_info.bltbdat = chipmem_agnus_wget (bltcdatptr); bltcdatptr -= 2; } - if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat); + if (dodst) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF; if (blitfill) { uae_u16 d = blt_info.bltddat; @@ -438,12 +453,17 @@ static void blitter_dofast_desc (void) bltddatptr -= 2; } } - if (bltadatptr) bltadatptr -= blt_info.bltamod; - if (bltbdatptr) bltbdatptr -= blt_info.bltbmod; - if (bltcdatptr) bltcdatptr -= blt_info.bltcmod; - if (bltddatptr) bltddatptr -= blt_info.bltdmod; + if (bltadatptr) + bltadatptr -= blt_info.bltamod; + if (bltbdatptr) + bltbdatptr -= blt_info.bltbmod; + if (bltcdatptr) + bltcdatptr -= blt_info.bltcmod; + if (bltddatptr) + bltddatptr -= blt_info.bltdmod; } - if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat); + if (dodst) + chipmem_agnus_wput2 (dstp, blt_info.bltddat); blt_info.bltbhold = blitbhold; } blit_masktable[0] = 0xFFFF; @@ -730,7 +750,7 @@ STATIC_INLINE int blitter_doddma (void) wd = 1; } if (wd) { - chipmem_agnus_wput (bltdpt, d); + chipmem_agnus_wput2 (bltdpt, d); bltdpt += blit_add; blitter_hcounter2++; if (blitter_hcounter2 == blt_info.hblitsize) { diff --git a/cfgfile.c b/cfgfile.c index 05b838e3..88812de7 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -499,6 +499,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "parallel_autoflush=%d\n", p->parallel_autoflush_time); cfgfile_dwrite (f, "gfx_display=%d\n", p->gfx_display); + cfgfile_dwrite (f, "gfx_display_name=%s\n", p->gfx_display_name); cfgfile_dwrite (f, "gfx_framerate=%d\n", p->gfx_framerate); cfgfile_dwrite (f, "gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */ cfgfile_dwrite (f, "gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */ @@ -643,6 +644,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "cpu_cycle_exact=%s\n", p->cpu_cycle_exact ? "true" : "false"); cfgfile_write (f, "blitter_cycle_exact=%s\n", p->blitter_cycle_exact ? "true" : "false"); cfgfile_write (f, "rtg_nocustom=%s\n", p->picasso96_nocustom ? "true" : "false"); + cfgfile_write (f, "rtg_modes=0x%x\n", p->picasso96_modeflags); cfgfile_write (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false"); if (p->catweasel >= 100) @@ -902,6 +904,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) || cfgfile_string (option, value, "floppy1soundext", p->dfxclickexternal[1], sizeof p->dfxclickexternal[1]) || cfgfile_string (option, value, "floppy2soundext", p->dfxclickexternal[2], sizeof p->dfxclickexternal[2]) || cfgfile_string (option, value, "floppy3soundext", p->dfxclickexternal[3], sizeof p->dfxclickexternal[3]) + || cfgfile_string (option, value, "gfx_display_name", p->gfx_display_name, sizeof p->gfx_display_name) || cfgfile_string (option, value, "config_info", p->info, sizeof p->info) || cfgfile_string (option, value, "config_description", p->description, sizeof p->description)) return 1; @@ -1349,6 +1352,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu || cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1) || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000) || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000) + || cfgfile_intval (option, value, "rtg_modes", &p->picasso96_modeflags, 1) || cfgfile_intval (option, value, "floppy_speed", &p->floppy_speed, 1) || cfgfile_intval (option, value, "floppy_write_length", &p->floppy_write_length, 1) || cfgfile_intval (option, value, "nr_floppies", &p->nr_floppies, 1) @@ -2923,8 +2927,8 @@ void default_prefs (struct uae_prefs *p, int type) p->cs_resetwarning = 1; p->gfx_filter = 0; - p->gfx_filter_horiz_zoom_mult = 1000; - p->gfx_filter_vert_zoom_mult = 1000; + p->gfx_filter_horiz_zoom_mult = 0; + p->gfx_filter_vert_zoom_mult = 0; p->gfx_filter_filtermode = 1; p->gfx_filter_scanlineratio = (1 << 4) | 1; diff --git a/custom.c b/custom.c index 8e395a9d..8715469c 100755 --- a/custom.c +++ b/custom.c @@ -819,9 +819,9 @@ static void compute_toscr_delay_1 (void) delay2 += delayoffset; delaymask = (fetchwidth - 1) >> toscr_res; toscr_delay1x = (delay1 & delaymask) << toscr_res; - toscr_delay1x |= shdelay1 >> (2 - toscr_res); + toscr_delay1x |= shdelay1 >> (RES_MAX - toscr_res); toscr_delay2x = (delay2 & delaymask) << toscr_res; - toscr_delay2x |= shdelay2 >> (2 - toscr_res); + toscr_delay2x |= shdelay2 >> (RES_MAX - toscr_res); } static void compute_toscr_delay (int hpos) @@ -1880,23 +1880,38 @@ STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int db { int j = 0; while (datab) { - unsigned int tmp = *buf; unsigned int col = (datab & 3) << (2 * num); - tmp |= col; - if ((j & mask) == 0) + unsigned coltmp = 0; + + if ((j & mask) == 0) { + unsigned int tmp = (*buf) | col; *buf++ = tmp; - if (dbl > 0) + if (do_collisions) + coltmp |= tmp; + } + if (dbl > 0) { + unsigned int tmp = (*buf) | col; *buf++ = tmp; + if (do_collisions) + coltmp |= tmp; + } if (dbl > 1) { + unsigned int tmp; + tmp = (*buf) | col; *buf++ = tmp; + if (do_collisions) + coltmp |= tmp; + tmp = (*buf) | col; *buf++ = tmp; + if (do_collisions) + coltmp |= tmp; } j++; datab >>= 2; if (do_collisions) { - tmp &= collision_mask; - if (tmp) { - unsigned int shrunk_tmp = sprite_ab_merge[tmp & 255] | (sprite_ab_merge[tmp >> 8] << 2); + coltmp &= collision_mask; + if (coltmp) { + unsigned int shrunk_tmp = sprite_ab_merge[coltmp & 255] | (sprite_ab_merge[coltmp >> 8] << 2); clxdat |= sprclx[shrunk_tmp]; } } @@ -1909,8 +1924,8 @@ STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int db This function assumes that for all sprites in a given line, SPRXP either stays equal or increases between successive calls. - The data is recorded either in lores pixels (if OCS/ECS), or in superhires - pixels (if AGA). */ + The data is recorded either in lores pixels (if OCS/ECS), or in hires or + superhires pixels (if AGA). */ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl) { @@ -1928,14 +1943,14 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 if (dbl < 0) { half = -dbl; dbl = 0; - if (ecsshres ()) - mask = 1; + if (ecsshres () || (sprite_buffer_res < RES_SUPERHIRES && sprres == RES_SUPERHIRES)) + mask = 1; /* need to halve horizontal size */ } width = (sprite_width << sprite_buffer_res) >> sprres; - attachment = (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80)))); + attachment = (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80)))); /* Try to coalesce entries if they aren't too far apart */ - if (!next_sprite_forced && e[-1].max + sprite_width >= sprxp && (attachment || ((bplcon4 >> 4) & 15) == ((bplcon4 >> 0) & 15))) { + if (!next_sprite_forced && e[-1].max + sprite_width >= sprxp) { e--; } else { next_sprite_entry++; @@ -1972,7 +1987,6 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 low order bit records whether the attach bit was set for this pair. */ if (attachment) { uae_u32 state = 0x01010101 << (num & ~1); - uae_u32 *stbuf = spixstate.words + (word_offs >> 2); uae_u8 *stb1 = spixstate.bytes + word_offs; for (i = 0; i < width; i += 8) { stb1[0] |= state; @@ -3240,13 +3254,13 @@ STATIC_INLINE void SPRxCTLPOS (int num) } #ifdef AGA else if (currprefs.chipset_mask & CSMASK_AGA) { - sprxp |= ((sprctl[num] >> 3) & 3) >> (2 - sprite_buffer_res); + sprxp |= ((sprctl[num] >> 3) & 3) >> (RES_MAX - sprite_buffer_res); s->dblscan = sprpos[num] & 0x80; } #endif #ifdef ECS_DENISE else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) { - sprxp |= ((sprctl[num] >> 3) & 2) >> (2 - sprite_buffer_res); + sprxp |= ((sprctl[num] >> 3) & 2) >> (RES_MAX - sprite_buffer_res); } #endif s->xpos = sprxp; @@ -4289,9 +4303,7 @@ static void vsync_handler (void) lof ^= 0x8000; #ifdef PICASSO96 - /* And now let's update the Picasso palette, if required */ - if (picasso_on) - picasso_handle_vsync (); + picasso_handle_vsync (); #endif if (quit_program > 0) { @@ -4821,9 +4833,6 @@ void customreset (int hardreset) bogusframe = 1; - sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES; - if (sprite_buffer_res > currprefs.gfx_resolution) - sprite_buffer_res = currprefs.gfx_resolution; if (savestate_state == STATE_RESTORE) { uae_u16 v; uae_u32 vv; diff --git a/drawing.c b/drawing.c index 123c6aa1..759ec301 100755 --- a/drawing.c +++ b/drawing.c @@ -1031,6 +1031,7 @@ STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf, stbuf -= e->pos; window_pos = e->pos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res); + spr_level = 0; spr_level_max = 0; if (res_shift > 0 && aga) { @@ -1043,10 +1044,12 @@ STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf, else if (posdoubling) window_pos <<= posdoubling; window_pos += pixels_offset; + if (aga) { if (window_pos < sprite_aga_first_x) sprite_aga_first_x = window_pos; } + for (pos = e->pos; pos < e->max; pos += 1 << sizeskip) { int maskshift, plfmask; unsigned int v = buf[pos]; @@ -1998,7 +2001,7 @@ static void center_image (void) visible_left_border = (max_diwlastword - 48) / 2 - gfxvidinfo.width; } if (currprefs.gfx_xcenter_pos >= 0) { - int val = currprefs.gfx_xcenter_pos < 56 ? 56 : currprefs.gfx_xcenter_pos; + int val = (currprefs.gfx_xcenter_pos >> RES_MAX) < 56 ? 56 : (currprefs.gfx_xcenter_pos >> RES_MAX); visible_left_border = val + (DIW_DDF_OFFSET << currprefs.gfx_resolution) - (DISPLAY_LEFT_SHIFT * 2 - (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution)); } @@ -2032,7 +2035,7 @@ static void center_image (void) } } if (currprefs.gfx_ycenter_pos >= 0) { - thisframe_y_adjust = currprefs.gfx_ycenter_pos; + thisframe_y_adjust = currprefs.gfx_ycenter_pos >> 1; if (thisframe_y_adjust + max_drawn_amiga_line > 2 * maxvpos_max) thisframe_y_adjust = 2 * maxvpos_max - max_drawn_amiga_line; if (thisframe_y_adjust < 0) @@ -2736,6 +2739,10 @@ void reset_drawing (void) notice_screen_contents_lost (); frame_res_cnt = FRAMES_UNTIL_RES_SWITCH; lightpen_y1 = lightpen_y2 = -1; + + sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES; + if (sprite_buffer_res > currprefs.gfx_resolution) + sprite_buffer_res = currprefs.gfx_resolution; } void drawing_init (void) diff --git a/expansion.c b/expansion.c index 395df6d5..4b3db836 100755 --- a/expansion.c +++ b/expansion.c @@ -27,6 +27,8 @@ #include "ncr_scsi.h" #include "debug.h" +static int scrambled_autoconfig = 0; + #define MAX_EXPANSION_BOARDS 8 /* ********************************************************** */ @@ -1173,7 +1175,10 @@ void expamem_reset (void) int cardno = 0; ecard = 0; - uae_id = hackers_id; + if (scrambled_autoconfig) + uae_id = rand () & 2047 + 100; + else + uae_id = hackers_id; allocate_expamem (); diff --git a/gfxutil.c b/gfxutil.c index b230da5a..357748f9 100755 --- a/gfxutil.c +++ b/gfxutil.c @@ -10,6 +10,7 @@ #include "sysdeps.h" #include "options.h" #include "custom.h" +#include "rtgmodes.h" #include "xwin.h" #include "gfxfilter.h" @@ -90,7 +91,7 @@ static unsigned int doAlpha (int alpha, int bits, int shift) return (alpha & ((1 << bits) - 1)) << shift; } -static float video_gamma(float value, float gamma, float bri, float con) +static float video_gamma (float value, float gamma, float bri, float con) { double factor; float ret; @@ -113,7 +114,7 @@ static float video_gamma(float value, float gamma, float bri, float con) static uae_u32 gamma[256 * 3]; static int lf, hf; -static void video_calc_gammatable(void) +static void video_calc_gammatable (void) { int i; float bri, con, gam, v; @@ -141,7 +142,7 @@ static void video_calc_gammatable(void) } } -static uae_u32 limit256(double v) +static uae_u32 limit256 (double v) { v = v * (double)(currprefs.gfx_filter_contrast + 1000) / 1000.0 + currprefs.gfx_filter_luminance / 10.0; if (v < 0) @@ -150,7 +151,7 @@ static uae_u32 limit256(double v) v = 255; return ((uae_u32)v) & 0xff; } -static uae_u32 limit256rb(double v) +static uae_u32 limit256rb (double v) { v *= (double)(currprefs.gfx_filter_saturation + 1000) / 1000.0; if (v < -128) @@ -159,25 +160,25 @@ static uae_u32 limit256rb(double v) v = 127; return ((uae_u32)v) & 0xff; } -static double get_y(int r, int g, int b) +static double get_y (int r, int g, int b) { - return 0.2989f*r + 0.5866f*g + 0.1145f*b; + return 0.2989f * r + 0.5866f * g + 0.1145f * b; } -static uae_u32 get_yh(int r, int g, int b) +static uae_u32 get_yh (int r, int g, int b) { - return limit256(get_y(r, g, b) * hf / 256); + return limit256 (get_y (r, g, b) * hf / 256); } -static uae_u32 get_yl(int r, int g, int b) +static uae_u32 get_yl (int r, int g, int b) { - return limit256(get_y(r, g, b) * lf / 256); + return limit256 (get_y (r, g, b) * lf / 256); } -static uae_u32 get_cb(int r, int g, int b) +static uae_u32 get_cb (int r, int g, int b) { - return limit256rb(-0.168736f*r - 0.331264f*g + 0.5f*b); + return limit256rb (-0.168736f * r - 0.331264f * g + 0.5f * b); } -static uae_u32 get_cr(int r, int g, int b) +static uae_u32 get_cr (int r, int g, int b) { - return limit256rb(0.5f*r - 0.418688f*g - 0.081312f*b); + return limit256rb (0.5f * r - 0.418688f * g - 0.081312f * b); } extern uae_s32 tyhrgb[65536]; @@ -186,23 +187,92 @@ extern uae_s32 tcbrgb[65536]; extern uae_s32 tcrrgb[65536]; extern uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256]; -static uae_u32 lowbits(int v, int shift, int lsize) +static uae_u32 lowbits (int v, int shift, int lsize) { v >>= shift; v &= (1 << lsize) - 1; return v; } -void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap) +void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt) { + int byte_swap = 0; int i; + int red_bits = 0, green_bits, blue_bits; + int red_shift, green_shift, blue_shift; - for (i = 0; i < 65536; i++) { - uae_u32 r, g, b; - r = (((i >> 11) & 31) << 3) | lowbits (i, 11, 3); - g = (((i >> 5) & 63) << 2) | lowbits (i, 5, 2); - b = (((i >> 0) & 31) << 3) | lowbits (i, 0, 3); - p96_rgbx16[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs); + int bpp = rw + gw + bw; + + switch (rgbfmt) + { + case RGBFB_R5G6B5PC: + red_bits = 5; + green_bits = 6; + blue_bits = 5; + red_shift = 11; + green_shift = 5; + blue_shift = 0; + break; + case RGBFB_R5G5B5PC: + red_bits = green_bits = blue_bits = 5; + red_shift = 10; + green_shift = 5; + blue_shift = 0; + break; + case RGBFB_R5G6B5: + red_bits = 5; + green_bits = 6; + blue_bits = 5; + red_shift = 11; + green_shift = 5; + blue_shift = 0; + byte_swap = 1; + break; + case RGBFB_R5G5B5: + red_bits = green_bits = blue_bits = 5; + red_shift = 10; + green_shift = 5; + blue_shift = 0; + byte_swap = 1; + break; + case RGBFB_B5G6R5PC: + red_bits = 5; + green_bits = 6; + blue_bits = 5; + red_shift = 0; + green_shift = 5; + blue_shift = 11; + break; + case RGBFB_B5G5R5PC: + red_bits = 5; + green_bits = 5; + blue_bits = 5; + red_shift = 0; + green_shift = 5; + blue_shift = 10; + break; + } + + memset (p96_rgbx16, 0, sizeof p96_rgbx16); + + if (red_bits) { + int lrbits = 8 - red_bits; + int lgbits = 8 - green_bits; + int lbbits = 8 - blue_bits; + int lrmask = (1 << red_bits) - 1; + int lgmask = (1 << green_bits) - 1; + int lbmask = (1 << blue_bits) - 1; + for (i = 65535; i >= 0; i--) { + uae_u32 r, g, b, c; + uae_u32 j = byte_swap ? bswap_16 (i) : i; + r = (((j >> red_shift) & lrmask) << lrbits) | lowbits (j, red_shift, lrbits); + g = (((j >> green_shift) & lgmask) << lgbits) | lowbits (j, green_shift, lgbits); + b = (((j >> blue_shift) & lbmask) << lbbits) | lowbits (j, blue_shift, lbbits); + c = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs); + if (bpp <= 16) + c |= c * 0x00010001; + p96_rgbx16[i] = c; + } } } diff --git a/include/custom.h b/include/custom.h index 984a6ea5..bd6d96d1 100755 --- a/include/custom.h +++ b/include/custom.h @@ -160,6 +160,7 @@ extern int bpl_off[8]; #define RES_LORES 0 #define RES_HIRES 1 #define RES_SUPERHIRES 2 +#define RES_MAX 2 /* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") */ #define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2) diff --git a/include/inputdevice.h b/include/inputdevice.h index 843e7b32..1cf5e7e7 100755 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -91,6 +91,7 @@ extern void mousehack_handle (int sprctl, int sprpos); extern void togglemouse (void); extern int mousehack_alive (void); extern int mousehack_allowed (void); +extern int magicmouse_alive (void); extern void setmousebuttonstateall (int mouse, uae_u32 buttonbits, uae_u32 buttonmask); extern void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask); diff --git a/include/options.h b/include/options.h index bd303c8d..d1d4841d 100755 --- a/include/options.h +++ b/include/options.h @@ -150,6 +150,7 @@ struct uae_prefs { uae_u32 override_dga_address; int gfx_display; + char gfx_display_name[256]; int gfx_framerate, gfx_autoframerate; struct wh gfx_size_win; struct wh gfx_size_fs; @@ -260,6 +261,7 @@ struct uae_prefs { int cpu_compatible; int address_space_24; int picasso96_nocustom; + int picasso96_modeflags; uae_u32 z3fastmem_size; uae_u32 z3fastmem_start; diff --git a/include/rtgmodes.h b/include/rtgmodes.h new file mode 100755 index 00000000..41818fbf --- /dev/null +++ b/include/rtgmodes.h @@ -0,0 +1,65 @@ +/* Types for RGBFormat used */ +typedef enum { + RGBFB_NONE, /* no valid RGB format (should not happen) */ + RGBFB_CLUT, /* palette mode, set colors when opening screen using + tags or use SetRGB32/LoadRGB32(...) */ + RGBFB_R8G8B8, /* TrueColor RGB (8 bit each) */ + RGBFB_B8G8R8, /* TrueColor BGR (8 bit each) */ + RGBFB_R5G6B5PC, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), + format: gggbbbbbrrrrrggg */ + RGBFB_R5G5B5PC, /* HiColor15 (5 bit each), format: gggbbbbb0rrrrrgg */ + RGBFB_A8R8G8B8, /* 4 Byte TrueColor ARGB (A unused alpha channel) */ + RGBFB_A8B8G8R8, /* 4 Byte TrueColor ABGR (A unused alpha channel) */ + RGBFB_R8G8B8A8, /* 4 Byte TrueColor RGBA (A unused alpha channel) */ + RGBFB_B8G8R8A8, /* 4 Byte TrueColor BGRA (A unused alpha channel) */ + RGBFB_R5G6B5, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), + format: rrrrrggggggbbbbb */ + RGBFB_R5G5B5, /* HiColor15 (5 bit each), format: 0rrrrrgggggbbbbb */ + RGBFB_B5G6R5PC, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), + format: gggrrrrrbbbbbggg */ + RGBFB_B5G5R5PC, /* HiColor15 (5 bit each), format: gggrrrrr0bbbbbbgg */ + + /* By now, the following formats are for use with a hardware window only + (bitmap operations may be implemented incompletely) */ + + RGBFB_Y4U2V2, /* 2 Byte TrueColor YUV (CCIR recommendation CCIR601). + Each two-pixel unit is stored as one longword + containing luminance (Y) for each of the two pixels, + and chrominance (U,V) for alternate pixels. + The missing chrominance values are generated by + interpolation. (Y1-U0-Y0-V0) */ + RGBFB_Y4U1V1, /* 1 Byte TrueColor ACCUPAK. Four adjacent pixels form + a packet of 5 bits Y (luminance) each pixel and 6 bits + U and V (chrominance) shared by the four pixels */ + + RGBFB_MaxFormats +} RGBFTYPE; + +#define RGBFF_NONE (1< 0; } +int magicmouse_alive (void) +{ + return mouseedge_alive > 0; +} + static void mousehack_helper (void) { int mousexpos, mouseypos; - if (!mousehack_allowed()) + if (!mousehack_allowed ()) return; #ifdef PICASSO96 if (picasso_on) { @@ -963,10 +967,10 @@ static void mousehack_helper (void) } else #endif { - mouseypos = coord_native_to_amiga_y (lastmy) << 1; mousexpos = coord_native_to_amiga_x (lastmx); + mouseypos = coord_native_to_amiga_y (lastmy) << 1; } - mousehack_setpos(mousexpos, mouseypos); + mousehack_setpos (mousexpos, mouseypos); } STATIC_INLINE int adjust (int val) @@ -1932,11 +1936,14 @@ void inputdevice_vsync (void) inputdevice_handle_inputcode (); if (ievent_alive > 0) ievent_alive--; + if (mouseedge_alive > 0) + mouseedge_alive--; #ifdef ARCADIA if (arcadia_bios) arcadia_vsync (); #endif - mouseedge(); + if (mouseedge ()) + mouseedge_alive = 10; } void inputdevice_reset (void) @@ -3206,7 +3213,7 @@ void setmousestate (int mouse, int axis, int data, int isabs) } for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0); - mousehack_helper(); + mousehack_helper (); } int getmousestate(int joy) { diff --git a/memory.c b/memory.c index 4b12931b..9ed8a0b0 100755 --- a/memory.c +++ b/memory.c @@ -814,7 +814,7 @@ struct romdata *getromdatabyidgroup (int id, int group, int subitem) return 0; } -STATIC_INLINE int notcrc32(uae_u32 crc32) +STATIC_INLINE int notcrc32 (uae_u32 crc32) { if (crc32 == 0xffffffff || crc32 == 0x00000000) return 1; @@ -832,7 +832,7 @@ struct romdata *getromdatabycrc (uae_u32 crc32) return 0; } -static int cmpsha1(uae_u8 *s1, struct romdata *rd) +static int cmpsha1 (uae_u8 *s1, struct romdata *rd) { int i; @@ -846,7 +846,7 @@ static int cmpsha1(uae_u8 *s1, struct romdata *rd) return 0; } -static struct romdata *checkromdata(uae_u8 *sha1, int size, uae_u32 mask) +static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask) { int i = 0; while (roms[i].name) { @@ -941,7 +941,7 @@ void getromname (struct romdata *rd, char *name) sprintf (name + strlen (name), " [%s]", rd->partnumber); } -struct romlist *getromlistbyromdata(struct romdata *rd) +struct romlist *getromlistbyromdata (struct romdata *rd) { int ids[2]; @@ -950,7 +950,7 @@ struct romlist *getromlistbyromdata(struct romdata *rd) return getromlistbyids(ids); } -struct romlist *getromlistbyids(int *ids) +struct romlist *getromlistbyids (int *ids) { struct romdata *rd; int i, j; @@ -969,7 +969,7 @@ struct romlist *getromlistbyids(int *ids) return NULL; } -void romwarning(int *ids) +void romwarning (int *ids) { int i, exp; char tmp1[MAX_DPATH], tmp2[MAX_DPATH]; @@ -1029,7 +1029,7 @@ __inline__ void byteput (uaecptr addr, uae_u32 b) } #endif -int addr_valid(char *txt, uaecptr addr, uae_u32 len) +int addr_valid (char *txt, uaecptr addr, uae_u32 len) { addrbank *ab = &get_mem_bank(addr); if (ab == 0 || !(ab->flags & ABFLAG_RAM) || addr < 0x100 || len < 0 || len > 16777215 || !valid_address (addr, len)) { @@ -1058,7 +1058,7 @@ static int REGPARAM3 dummy_check (uaecptr addr, uae_u32 size) REGPARAM; #define NONEXISTINGDATA 0 //#define NONEXISTINGDATA 0xffffffff -static void dummylog(int rw, uaecptr addr, int size, uae_u32 val, int ins) +static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins) { if (illegal_count >= MAX_ILG) return; @@ -2265,8 +2265,8 @@ void a3000_fakekick (int map) extendedkickmem_mask = extendedkickmem_size - 1; extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0"); extendedkickmem_bank.baseaddr = extendedkickmemory; - memcpy(extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536); - map_banks(&extendedkickmem_bank, 0xf0, 1, 1); + memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536); + map_banks (&extendedkickmem_bank, 0xf0, 1, 1); f0 = 1; } else { write_log ("A3000 Bonus hack: can't map bonus when uae boot rom is enabled\n"); @@ -2278,7 +2278,7 @@ void a3000_fakekick (int map) } } else { if (f0) { - map_banks(&dummy_bank, 0xf0, 1, 1); + map_banks (&dummy_bank, 0xf0, 1, 1); mapped_free(extendedkickmemory); extendedkickmemory = NULL; f0 = 0; @@ -2658,7 +2658,7 @@ static int patch_residents (uae_u8 *kickmemory, int size) return patched; } -static void patch_kick(void) +static void patch_kick (void) { int patched = 0; if (kickmem_size >= 524288 && currprefs.kickshifter) @@ -2810,7 +2810,7 @@ void mapped_free (uae_u8 *p) shmpiece *shm_start; -static void dumplist(void) +static void dumplist (void) { shmpiece *x = shm_start; write_log ("Start Dump:\n"); @@ -2952,6 +2952,7 @@ uae_u8 *mapped_malloc (size_t s, char *file) static void init_mem_banks (void) { int i; + for (i = 0; i < MEMORY_BANKS; i++) put_mem_bank (i << 16, &dummy_bank, 0); #ifdef NATMEM_OFFSET diff --git a/od-win32/ahidsound.c b/od-win32/ahidsound.c index 1e297c92..b499e61d 100755 --- a/od-win32/ahidsound.c +++ b/od-win32/ahidsound.c @@ -33,7 +33,6 @@ #include "newcpu.h" #include "traps.h" #include "od-win32/win32.h" -#include "picasso96_win.h" #include "sounddep/sound.h" #include "dxwrap.h" #include "win32.h" diff --git a/od-win32/cloanto/RetroPlatformGuestIPC.c b/od-win32/cloanto/RetroPlatformGuestIPC.c index 3e0c18d7..cf55ff65 100755 --- a/od-win32/cloanto/RetroPlatformGuestIPC.c +++ b/od-win32/cloanto/RetroPlatformGuestIPC.c @@ -161,13 +161,14 @@ BOOL RPSendMessage(UINT uMessage, WPARAM wParam, LPARAM lParam, cds.dwData = (ULONG_PTR)uMessage; cds.cbData = dwDataSize; cds.lpData = (LPVOID)pData; - if (!SendMessageTimeout(pInfo->hHostMessageWindow, WM_COPYDATA, (WPARAM)pInfo->hGuestMessageWindow, (LPARAM)&cds, SMTO_NORMAL, SRPMSG_TIMEOUT, &dwResult)) - return FALSE; + dwResult = SendMessage(pInfo->hHostMessageWindow, WM_COPYDATA, (WPARAM)pInfo->hGuestMessageWindow, (LPARAM)&cds); } else { - if (!SendMessageTimeout(pInfo->hHostMessageWindow, uMessage, wParam, lParam, SMTO_NORMAL, SRPMSG_TIMEOUT, &dwResult)) - return FALSE; + // SendMessageTimeout is not used, since the host + // might display MessageBoxes during notifications + // (e.g. go-to-fullscreen message) + dwResult = SendMessage(pInfo->hHostMessageWindow, uMessage, wParam, lParam); } if (plResult) *plResult = dwResult; diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index 7ccaf461..e1c1a516 100755 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -7,7 +7,7 @@ : License version 2 as published by the Free Software Foundation. Authors : os, mcb Created : 2007-08-27 13:55:49 - Updated : 2008-02-03 06:49:00 + Updated : 2008-03-25 18:49:00 Comment : RP Player interprocess communication include file *****************************************************************************/ @@ -28,42 +28,44 @@ // Guest-to-Host Messages // **************************************************************************** -#define RPIPCGM_REGISTER (WM_APP + 0) -#define RPIPCGM_FEATURES (WM_APP + 1) -#define RPIPCGM_CLOSED (WM_APP + 2) -#define RPIPCGM_ACTIVATED (WM_APP + 3) -#define RPIPCGM_DEACTIVATED (WM_APP + 4) -#define RPIPCGM_SCREENMODE (WM_APP + 9) -#define RPIPCGM_POWERLED (WM_APP + 10) -#define RPIPCGM_DEVICES (WM_APP + 11) -#define RPIPCGM_DEVICEACTIVITY (WM_APP + 12) -#define RPIPCGM_MOUSECAPTURE (WM_APP + 13) -#define RPIPCGM_HOSTAPIVERSION (WM_APP + 14) -#define RPIPCGM_PAUSE (WM_APP + 15) -#define RPIPCGM_DEVICECONTENT (WM_APP + 16) -#define RPIPCGM_TURBO (WM_APP + 17) -#define RPIPCGM_PING (WM_APP + 18) -#define RPIPCGM_VOLUME (WM_APP + 19) -#define RPIPCGM_ESCAPED (WM_APP + 20) -#define RPIPCGM_PARENT (WM_APP + 21) +#define RPIPCGM_REGISTER (WM_APP + 0) +#define RPIPCGM_FEATURES (WM_APP + 1) +#define RPIPCGM_CLOSED (WM_APP + 2) +#define RPIPCGM_ACTIVATED (WM_APP + 3) +#define RPIPCGM_DEACTIVATED (WM_APP + 4) +#define RPIPCGM_SCREENMODE (WM_APP + 9) +#define RPIPCGM_POWERLED (WM_APP + 10) +#define RPIPCGM_DEVICES (WM_APP + 11) +#define RPIPCGM_DEVICEACTIVITY (WM_APP + 12) +#define RPIPCGM_MOUSECAPTURE (WM_APP + 13) +#define RPIPCGM_HOSTAPIVERSION (WM_APP + 14) +#define RPIPCGM_PAUSE (WM_APP + 15) +#define RPIPCGM_DEVICECONTENT (WM_APP + 16) +#define RPIPCGM_TURBO (WM_APP + 17) +#define RPIPCGM_PING (WM_APP + 18) +#define RPIPCGM_VOLUME (WM_APP + 19) +#define RPIPCGM_ESCAPED (WM_APP + 20) +#define RPIPCGM_PARENT (WM_APP + 21) +#define RPIPCGM_DEVICESEEK (WM_APP + 22) // **************************************************************************** // Host-to-Guest Messages // **************************************************************************** -#define RPIPCHM_CLOSE (WM_APP + 200) -#define RPIPCHM_SCREENMODE (WM_APP + 202) -#define RPIPCHM_SCREENCAPTURE (WM_APP + 203) -#define RPIPCHM_PAUSE (WM_APP + 204) -#define RPIPCHM_DEVICECONTENT (WM_APP + 205) -#define RPIPCHM_RESET (WM_APP + 206) -#define RPIPCHM_TURBO (WM_APP + 207) -#define RPIPCHM_PING (WM_APP + 208) -#define RPIPCHM_VOLUME (WM_APP + 209) -#define RPIPCHM_ESCAPEKEY (WM_APP + 210) -#define RPIPCHM_EVENT (WM_APP + 211) -#define RPIPCHM_MOUSECAPTURE (WM_APP + 212) +#define RPIPCHM_CLOSE (WM_APP + 200) +#define RPIPCHM_SCREENMODE (WM_APP + 202) +#define RPIPCHM_SCREENCAPTURE (WM_APP + 203) +#define RPIPCHM_PAUSE (WM_APP + 204) +#define RPIPCHM_DEVICECONTENT (WM_APP + 205) +#define RPIPCHM_RESET (WM_APP + 206) +#define RPIPCHM_TURBO (WM_APP + 207) +#define RPIPCHM_PING (WM_APP + 208) +#define RPIPCHM_VOLUME (WM_APP + 209) +#define RPIPCHM_ESCAPEKEY (WM_APP + 210) +#define RPIPCHM_EVENT (WM_APP + 211) +#define RPIPCHM_MOUSECAPTURE (WM_APP + 212) +#define RPIPCHM_SCREENCLIP (WM_APP + 213) // **************************************************************************** @@ -80,6 +82,7 @@ #define RP_FEATURE_PAUSE 0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message) #define RP_FEATURE_TURBO 0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message) #define RP_FEATURE_VOLUME 0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message) +#define RP_FEATURE_SCREENCLIP 0x00000200 // screen clipping is supported (see RPIPCHM_SCREENCLIP message) // Screen Modes #define RP_SCREENMODE_1X 0 // 1x windowed mode @@ -127,5 +130,16 @@ typedef struct RPDeviceContent #define RP_RESET_SOFT 0 // soft reset #define RP_RESET_HARD 1 // hard reset +// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE +#define RP_MOUSECAPTURE_CAPTURED 0x00000001 +#define RP_MOUSECAPTURE_MAGICMOUSE 0x00000002 + +typedef struct RPScreenClip +{ + LONG lLeft; + LONG lTop; + LONG lWidth; + LONG lHeight; +} RPSCREENCLIP; #endif // __CLOANTO_RETROPLATFORMIPC_H__ diff --git a/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt b/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt new file mode 100755 index 00000000..a867aea4 --- /dev/null +++ b/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt @@ -0,0 +1,532 @@ +Reference for RetroPlatformIPC.h (RP Player interprocess communication include file) + + +**************************************************************************** + Guest-to-Host Messages +**************************************************************************** + +Message: + RPIPCGM_REGISTER +Description: + this is a private message and is automatically sent + by the RPInitializeGuest() function + to register the caller as a RetroPlatform guest + + +Message: + RPIPCGM_FEATURES +Description: + the guest uses this message to tell the host + about the features it supports; + at startup time, the guest sends initialization messages + so that the host can adapt the GUI based on the reported features; + these messages include: + RPIPCGM_FEATURES (describes guest features), + RPIPCGM_POWERLED (turns on the power LED in the GUI), + RPIPCGM_DEVICES (one for each device category: tells the number of emulated devices), + RPIPCGM_DEVICECONTENT (one for each device with an image file or peripheral attached), + RPIPCGM_TURBO (tells if some of the turbo modes are activated from the start), + RPIPCGM_VOLUME (reports about starting volume level), + RPIPCGM_SCREENMODE (communicates the screen mode and the guest window handle); + note that at startup time the guest should create a borderless and hidden window + and send its handle using a RPIPCGM_SCREENMODE message, which must be the last + of the initialization messages, since it displays the guest window + and the host "frame window" (the part of the player user interface + with command and status icons which can be used to drag the guest window, etc.) +Data sent: + WPARAM = RP_FEATURE_* flags +Response: + none + + +Message: + RPIPCGM_CLOSED +Description: + this message is sent to the host when the guest is terminating +Data sent: + none +Response: + none + + +Message: + RPIPCGM_ACTIVATED +Description: + the guest sends this message to the host + when its window is being activated +Data sent: + LPARAM = identifier of the thread that owns the window being deactivated +Response: + none + + +Message: + RPIPCGM_DEACTIVATED +Description: + the guest sends this message to the host + when its window is being deactivated +Data sent: + LPARAM = identifier of the thread that owns the window being activated +Response: + none + + +Message: + RPIPCGM_SCREENMODE +Description: + the guest sends a RPIPCGM_SCREENMODE message to notify the host + about a change in its "screen mode" (1x/2x/4x/full screen, etc.); + screen mode changes requested by the host + (see the RPIPCHM_SCREENMODE message) must not be notified, + unless this is an asynchronous screen mode change + (i.e. the guest returned the INVALID_HANDLE_VALUE + response to a RPIPCHM_SCREENMODE host request); + this message can also be sent when the guest has to close + and reopen its window for other reasons; + at startup-time, the guest must create + a borderless and hidden window and send its handle + using this message; the host will then take care + of preparing, positioning and showing the guest window +Data sent: + WPARAM = new screen mode (RP_SCREENMODE_* value) + LPARAM = handle of the (new) guest window +Response: + none + + +Message: + RPIPCGM_POWERLED +Description: + sent to the host to change the power LED state +Data sent: + WPARAM = power LED intensity (min/off 0, max 100) +Response: + none + + +Message: + RPIPCGM_DEVICES +Description: + this message is used to notify the host about a change + in the number of emulated devices (floppy drives, hard disks, etc.) +Data sent: + WPARAM = device category (RP_DEVICE_* value) + LPARAM = 32-bit bitfield representing the devices + emulated in the specified category + (every bit set to 1 corresponds to a mounted drive + e.g. 0x00000005 = drive 0 and drive 2 are emulated) +Response: + none + + +Message: + RPIPCGM_DEVICEACTIVITY +Description: + this message can be used to turn on or off the activity indicator + of a specified device (like a LED on the original hardware); + the indicator can also be "blinked", i.e. the host will turn the + LED on and then off again after the specified amount of time +Data sent: + WPARAM = device category (RP_DEVICE_* value) and device number + combined with the MAKEWORD macro; + e.g. MAKEWORD(RP_DEVICE_FLOPPY, 0); + the RP_ALL_DEVICES define may be used as device number + to turn on or off all the activity leds for a device category + LPARAM = 0 turns off the activity LED, + (LPARAM)-1 turns on the activity LED, + turns on the activity LED + for the specified amount of time (blink) +Response: + none + + +Message: + RPIPCGM_MOUSECAPTURE +Description: + the guest sends this message when the mouse is captured/released + (the mouse is "captured" when its movements are restricted to the guest window area + and the system cursor is not visible); + mouse capture changes requested by the host + (see the RPIPCHM_MOUSECAPTURE message) must not be notified; + for consistency across different guests, a guest which sends RPIPCGM_MOUSECAPTURE + messages should also implement a keyboard-actuated escape functionality + (the preferred key for this purpose is included in the parameters sent from the + host at startup time - see RPLaunchGuest() in RetroPlatformPlugin.h); + note that in order not to interfere with the window dragging functionality, + the mouse should not be captured when the guest window gets the focus, + but when a mouse button event is received +Data sent: + WPARAM = mouse capture state (RP_MOUSECAPTURE_* value) +Response: + none + + +Message: + RPIPCGM_HOSTAPIVERSION +Description: + the guest can send a RPIPCGM_HOSTAPIVERSION to query the host + about the RetroPlatform API version it implements; + since the guest plugin already asks for a minimim version of the API + on the host side, this message can be used to check the host API version + and enable optional functionality +Data sent: + none +Response: + LRESULT = major and minor version combined with the MAKELONG macro + (e.g. LOWORD(lr) = major version; HIWORD(lr) = minor version) + + +Message: + RPIPCGM_PAUSE +Description: + the guest sends this message to the host + when it enters or exits pause mode; + pause mode changes requested by the host + (see the RPIPCHM_PAUSE message) must not be notified; + note: when paused, the guest should release the mouse (if captured) +Data sent: + WPARAM = non-zero when the guest enters pause mode + or zero when the guest exits from pause mode +Response: + none + + +Message: + RPIPCGM_DEVICECONTENT +Description: + the guest sends a RPIPCGM_DEVICECONTENT message + to notify the host that an image file (e.g. a floppy disk image) + or a peripheral (e.g. a joystick) + has been loaded into (or ejected from) an emulated device; + this notification must not be sent when the event + has been requested by the host (see the RPIPCHM_DEVICECONTENT message) +Data sent: + pData = a RPDEVICECONTENT structure (see below); + the szImageFile field of the structure + contains an empty string when the guest + is ejecting something from the device +Response: + none + + +Message: + RPIPCGM_TURBO +Description: + the guest sends a RPIPCGM_TURBO message + to notify the host about activation of "turbo" (maximum speed) mode + of some of its functionalities (e.g. floppy, CPU); + turbo mode activations/deactivations requested by the host + (see the RPIPCHM_TURBO message) must not be notified; +Data sent: + WPARAM = mask of functionalities affected (RP_TURBO_* flags) + LPARAM = bits corresponding to those set in WPARAM + (1 = turbo mode activated for the guest functionality + 0 = guest functionality reverted to normal speed) +Response: + none + + +Message: + RPIPCGM_PING +Description: + this is a no-operation message and can be sent + to check if the host is responsive and functional +Data sent: + none +Response: + LRESULT = non-zero value is returned + + +Message: + RPIPCGM_VOLUME +Description: + the guest uses the RPIPCGM_VOLUME message + to notify the host about a change of its audio level; + audio level changes requested by the host + (see the RPIPCHM_VOLUME message) must not be notified +Data sent: + WPARAM = volume level (min/off 0, max 100) +Response: + none + + +Message: + RPIPCGM_ESCAPED +Description: + this message is sent to notify the host + that the escape key has been held down +Data sent: + none +Response: + none + + +Message: + RPIPCGM_PARENT +Description: + the guest sends this message to the host to get the handle + of the parent for its window; the guest window must be created + as a borderless (WS_POPUP style), hidden window, + using the handle returned by this message as the parent window parameter +Data sent: + none +Response: + LRESULT = window handle (HWND) to use in a CreateWindow call + + +Message: + RPIPCGM_DEVICESEEK +Description: + this message can be used to notify the host about a seek operation + of a specified device (e.g. the head of a disk drive changes position); +Data sent: + WPARAM = device category (RP_DEVICE_* value) and device number + combined with the MAKEWORD macro; + e.g. MAKEWORD(RP_DEVICE_FLOPPY, 0) + LPARAM = device-dependant seek position (e.g. drive track position) +Response: + none + + + + + +**************************************************************************** + Host-to-Guest Messages +**************************************************************************** + +Message: + RPIPCHM_CLOSE +Description: + sent from the host when the emulation must be terminated + (e.g. the user has hit the close button in the host window); + the guest should destroy its window and terminate (see Response below) +Data sent: + none +Response: + LRESULT = non-zero if the guest can safely terminate or 0 otherwise + + +Message: + RPIPCHM_SCREENMODE +Description: + this message is sent to ask the guest to activate a specified screen mode; + when switching to the new screen mode, the guest can resize (reuse) its window + or close its window and open a new one +Data sent: + WPARAM = RP_SCREENMODE_* value +Response: + LRESULT = handle of the (new) guest window + or NULL (the screen mode couldn't be changed) + or INVALID_HANDLE_VALUE (the screen mode will be changed asynchronously + and the host will soon get a RPIPCGM_SCREENMODE notification) + + +Message: + RPIPCHM_SCREENCAPTURE +Description: + with this message the host asks the guest to save its screen + to the the specified file in BMP format +Data sent: + pData = (Unicode) full path and name of the file to save + (note: the file may exist and can be overwritten) +Response: + LRESULT = non-zero if the guest saved its screen to the file + + +Message: + RPIPCHM_PAUSE +Description: + the RPIPCHM_PAUSE message sets the guest into pause mode + or resumes the guest from pause mode; + note: when paused, the guest should release the mouse (if captured) +Data sent: + WPARAM = non-zero to set the guest into pause mode + or zero to resume the guest from pause mode +Response: + LRESULT = non-zero if the guest executed the command + + +Message: + RPIPCHM_DEVICECONTENT +Description: + the host sends a RPIPCHM_DEVICECONTENT message + to load an image file or a peripheral into an emulated device + (e.g. an ADF floppy file into a floppy drive, + or a physical or keyboard-emulated joystick into an input port) + or to unload the currently loaded content from the device +Data sent: + pData = a RPDEVICECONTENT structure (see below); + if the szImageFile field of the structure + contains an empty string, the guest should + unload the current content from the device +Response: + LRESULT = non-zero if the guest executed the command + + +Message: + RPIPCHM_RESET +Description: + the host sends this message to reset the guest +Data sent: + WPARAM = a RP_RESET_* value +Response: + LRESULT = non-zero if the guest executed the command + + +Message: + RPIPCHM_TURBO +Description: + the host sends this message to activate or deactivate + the turbo mode of selected guest functionalities +Data sent: + WPARAM = mask of functionalities to change (RP_TURBO_* flags) + LPARAM = bits corresponding to those set in WPARAM + (1 = speedup the guest functionality + 0 = revert to normal speed emulation) +Response: + LRESULT = non-zero if the guest executed the command + + +Message: + RPIPCHM_PING +Description: + this is a no-operation message and can be sent + to check if the guest is responsive and functional +Data sent: + none +Response: + LRESULT = non-zero value is returned + + +Message: + RPIPCHM_VOLUME +Description: + the host uses the RPIPCHM_VOLUME message to set + the audio level of the guest +Data sent: + WPARAM = volume level (min 0, max 100) +Response: + LRESULT = non-zero if the guest set the volume as requested + + +Message: + RPIPCHM_ESCAPEKEY +Description: + the host uses the RPIPCHM_ESCAPEKEY message + to change the escape key information +Data sent: + WPARAM = DirectInput DIK_* identifier of the escape key + (e.g. 1 for the Esc key - see DIK_* constants in dinput.h) + LPARAM = milliseconds value + (amount of time the user has to hold the above key to trigger the escape functionality) +Response: + LRESULT = non-zero if the guest accepted the new settings + + +Message: + RPIPCHM_EVENT +Description: + the host uses the RPIPCHM_EVENT message + to simulate keyboard, mouse, joystick (press/release) + and other guest-specific events +Data sent: + pData = (Unicode) event string (guest-specific) +Response: + LRESULT = non-zero if the guest simulated the specified event + + +Message: + RPIPCHM_MOUSECAPTURE +Description: + the host uses this message to ask the guest + to capture or release the mouse +Data sent: + WPARAM = mouse capture state being requested (RP_MOUSECAPTURE_* value) +Response: + LRESULT = non-zero if the guest executed the command + + +Message: + RPIPCHM_SCREENCLIP +Description: + this command is used to set the clipping coordinates of the screen +Data sent: + pData = a RPSCREENCLIP structure +Response: + LRESULT = non-zero if the guest executed the command + + + +// **************************************************************************** +// Message Data Structures and Defines +// **************************************************************************** + +// Guest Features +#define RP_FEATURE_POWERLED 0x00000001 // a power LED is emulated +#define RP_FEATURE_SCREEN1X 0x00000002 // 1x windowed mode is available +#define RP_FEATURE_SCREEN2X 0x00000004 // 2x windowed mode is available +#define RP_FEATURE_SCREEN4X 0x00000008 // 4x windowed mode is available +#define RP_FEATURE_FULLSCREEN 0x00000010 // full screen display is available +#define RP_FEATURE_SCREENCAPTURE 0x00000020 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message) +#define RP_FEATURE_PAUSE 0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message) +#define RP_FEATURE_TURBO 0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message) +#define RP_FEATURE_VOLUME 0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message) + +// Screen Modes +#define RP_SCREENMODE_1X 0 // 1x windowed mode +#define RP_SCREENMODE_2X 1 // 2x windowed mode +#define RP_SCREENMODE_4X 2 // 4x windowed mode +#define RP_SCREENMODE_FULLSCREEN 3 // full screen + +// Device Categories +#define RP_DEVICE_FLOPPY 0 // floppy disk drive +#define RP_DEVICE_HD 1 // hard disk drive +#define RP_DEVICE_CD 2 // CD/DVD drive +#define RP_DEVICE_NET 3 // network card +#define RP_DEVICE_TAPE 4 // cassette tape drive +#define RP_DEVICE_CARTRIDGE 5 // expansion cartridge +#define RP_DEVICE_INPUTPORT 6 // input port + +typedef struct RPDeviceContent +{ + BYTE btDeviceCategory; // RP_DEVICE_* value + BYTE btDeviceNumber; // device number (range 0..31) + WCHAR szContent[1]; // full path and name of the image file to load, or input port device (Unicode, variable-sized field) +} RPDEVICECONTENT; + +// Input Port Devices +#define RP_IPD_MOUSE1 L"Mouse1" // first mouse type (e.g. Windows Mouse for WinUAE) +#define RP_IPD_MOUSE2 L"Mouse2" // second mouse type (e.g. Mouse for WinUAE) +#define RP_IPD_MOUSE3 L"Mouse3" // third mouse type (e.g. Mousehack Mouse for WinUAE) +#define RP_IPD_MOUSE4 L"Mouse4" // fourth mouse type (e.g. RAW Mouse for WinUAE) +#define RP_IPD_JOYSTICK1 L"Joystick1" // first joystick type (e.g. standard joystick for WinUAE, described as "Joystick1\ProductGUID\ProductName") +#define RP_IPD_JOYSTICK2 L"Joystick2" // second joystick type (e.g. X-Arcade (Left) joystick for WinUAE, described as "Joystick2\ProductGUID\ProductName") +#define RP_IPD_JOYSTICK3 L"Joystick3" // third joystick type (e.g. X-Arcade (Right) joystick for WinUAE, described as "Joystick3\ProductGUID\ProductName") +#define RP_IPD_KEYBDL1 L"KeyboardLayout1" // first joystick emulation keyboard layout (e.g. Keyboard Layout A for WinUAE) +#define RP_IPD_KEYBDL2 L"KeyboardLayout2" // second joystick emulation keyboard layout (e.g. Keyboard Layout B for WinUAE) +#define RP_IPD_KEYBDL3 L"KeyboardLayout3" // third joystick emulation keyboard layout (e.g. Keyboard Layout C for WinUAE) + +// Turbo Mode Functionalities +#define RP_TURBO_CPU 0x00000001 // CPU +#define RP_TURBO_FLOPPY 0x00000002 // floppy disk drive +#define RP_TURBO_TAPE 0x00000004 // cassette tape drive + +// Reset Type +#define RP_RESET_SOFT 0 // soft reset +#define RP_RESET_HARD 1 // hard reset + +// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE +#define RP_MOUSECAPTURE_UNCAPTURED 0 +#define RP_MOUSECAPTURE_CAPTURED 1 +#define RP_MOUSECAPTURE_MAGICMOUSE 2 + +typedef struct RPScreenClip +{ + LONG lLeft; + LONG lTop; + LONG lWidth; + LONG lHeight; +} RPSCREENCLIP; + +#endif // __CLOANTO_RETROPLATFORMIPC_H__ diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index 298f7c32..7387f7bd 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -118,7 +118,7 @@ void unlocksurface (LPDIRECTDRAWSURFACE7 surf) } static char *alloctexts[] = { "NonLocalVRAM", "DefaultRAM", "VRAM", "RAM" }; -LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, int forcemode) +LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, uae_u8 *ptr, int pitch, int forcemode) { HRESULT ddrval; DDSURFACEDESC2 desc; @@ -136,13 +136,17 @@ LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, int forcemode) desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; desc.dwWidth = width; desc.dwHeight = height; + if (ptr) { + desc.dwFlags |= DDSD_LPSURFACE | DDSD_PITCH; + desc.lPitch = pitch; + desc.lpSurface = ptr; + } memcpy (&desc.ddpfPixelFormat, &dxdata.native.ddpfPixelFormat, sizeof (DDPIXELFORMAT)); ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &surf, NULL); if (FAILED (ddrval)) { write_log ("IDirectDraw7_CreateSurface (%dx%d,%s): %s\n", width, height, alloctexts[forcemode], DXError (ddrval)); } else { - clearsurf (surf); - write_log ("Created %dx%d surface in %s (%d)\n", width, height, alloctexts[forcemode]); + write_log ("Created %dx%d surface in %s (%d)\n", width, height, alloctexts[forcemode], forcemode); } return surf; } @@ -153,9 +157,11 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height) int mode = ddforceram; for (;;) { - s = allocsurface_2 (width, height, mode); - if (s) + s = allocsurface_2 (width, height, NULL, 0, mode); + if (s) { + clearsurf (s); return s; + } mode++; if (mode >= 4) mode = 0; @@ -163,6 +169,10 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height) return NULL; } } +LPDIRECTDRAWSURFACE7 createsurface (uae_u8 *ptr, int pitch, int width, int height) +{ + return allocsurface_2 (width, height, ptr, pitch, DDFORCED_SYSMEM); +} void freesurface (LPDIRECTDRAWSURFACE7 surf) { @@ -321,13 +331,15 @@ const char *DXError (HRESULT ddrval) return dderr; } -RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface) +RGBFTYPE DirectDraw_GetSurfacePixelFormat (LPDDSURFACEDESC2 surface) { int surface_is = 0; DDPIXELFORMAT *pfp = NULL; DWORD r, g, b; DWORD surf_flags; + if (surface == NULL) + surface = &dxdata.native; surf_flags = surface->dwFlags; pfp = &surface->ddpfPixelFormat; @@ -340,7 +352,8 @@ RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface) r = pfp->dwRBitMask; g = pfp->dwGBitMask; b = pfp->dwBBitMask; - switch (pfp->dwRGBBitCount) { + switch (pfp->dwRGBBitCount) + { case 8: if ((pfp->dwFlags & DDPF_PALETTEINDEXED8) != 0) return RGBFB_CHUNKY; diff --git a/od-win32/dxwrap.h b/od-win32/dxwrap.h index a307f07e..950d012d 100755 --- a/od-win32/dxwrap.h +++ b/od-win32/dxwrap.h @@ -1,8 +1,11 @@ #ifndef __DXWRAP_H__ #define __DXWRAP_H__ +#include "rtgmodes.h" #include "ddraw.h" +extern int ddforceram; + struct ddstuff { int ddinit; @@ -51,77 +54,12 @@ struct MultiDisplay { int primary, disabled, gdi; GUID guid; char *name; + char *name2; struct PicassoResolution *DisplayModes; RECT rect; }; extern struct MultiDisplay Displays[MAX_DISPLAYS]; -/* Types for RGBFormat used */ -typedef enum { - RGBFB_NONE, /* no valid RGB format (should not happen) */ - RGBFB_CLUT, /* palette mode, set colors when opening screen using - tags or use SetRGB32/LoadRGB32(...) */ - RGBFB_R8G8B8, /* TrueColor RGB (8 bit each) */ - RGBFB_B8G8R8, /* TrueColor BGR (8 bit each) */ - RGBFB_R5G6B5PC, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), - format: gggbbbbbrrrrrggg */ - RGBFB_R5G5B5PC, /* HiColor15 (5 bit each), format: gggbbbbb0rrrrrgg */ - RGBFB_A8R8G8B8, /* 4 Byte TrueColor ARGB (A unused alpha channel) */ - RGBFB_A8B8G8R8, /* 4 Byte TrueColor ABGR (A unused alpha channel) */ - RGBFB_R8G8B8A8, /* 4 Byte TrueColor RGBA (A unused alpha channel) */ - RGBFB_B8G8R8A8, /* 4 Byte TrueColor BGRA (A unused alpha channel) */ - RGBFB_R5G6B5, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), - format: rrrrrggggggbbbbb */ - RGBFB_R5G5B5, /* HiColor15 (5 bit each), format: 0rrrrrgggggbbbbb */ - RGBFB_B5G6R5PC, /* HiColor16 (5 bit R, 6 bit G, 5 bit B), - format: gggrrrrrbbbbbggg */ - RGBFB_B5G5R5PC, /* HiColor15 (5 bit each), format: gggrrrrr0bbbbbbgg */ - - /* By now, the following formats are for use with a hardware window only - (bitmap operations may be implemented incompletely) */ - - RGBFB_Y4U2V2, /* 2 Byte TrueColor YUV (CCIR recommendation CCIR601). - Each two-pixel unit is stored as one longword - containing luminance (Y) for each of the two pixels, - and chrominance (U,V) for alternate pixels. - The missing chrominance values are generated by - interpolation. (Y1-U0-Y0-V0) */ - RGBFB_Y4U1V1, /* 1 Byte TrueColor ACCUPAK. Four adjacent pixels form - a packet of 5 bits Y (luminance) each pixel and 6 bits - U and V (chrominance) shared by the four pixels */ - - RGBFB_MaxFormats -} RGBFTYPE; - -#define RGBFF_NONE (1<= *lpdwCount) break; - if (memwatchtable[i]) - lpAddresses[j++] = p96mem_offset + i * si.dwPageSize; + if (memwatchtable[off + i]) + lpAddresses[j++] = (uae_u8*)lpBaseAddress + i * si.dwPageSize; } *lpdwCount = j; *lpdwGranularity = si.dwPageSize; @@ -183,6 +184,7 @@ typedef BOOL (CALLBACK* GLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX); void preinit_shm (void) { + int i; uae_u64 total64; uae_u64 totalphys64; MEMORYSTATUS memstats; @@ -223,14 +225,47 @@ void preinit_shm (void) if (max_z3fastmem < 512 * 1024 * 1024) max_z3fastmem = 512 * 1024 * 1024; + shm_start = 0; + for (i = 0; i < MAX_SHMID; i++) { + shmids[i].attached = 0; + shmids[i].key = -1; + shmids[i].size = 0; + shmids[i].addr = NULL; + shmids[i].name[0] = 0; + } + write_log ("Max Z3FastRAM %dM. Total physical RAM %uM\n", max_z3fastmem >> 20, totalphys64 >> 20); testwritewatch (); canbang = 1; } -int init_shm (void) +static void resetmem (void) { int i; + + if (!shm_start) + return; + for (i = 0; i < MAX_SHMID; i++) { + struct shmid_ds *s = &shmids[i]; + int size = s->size; + uae_u8 *shmaddr; + uae_u8 *result; + + if (!s->attached) + continue; + if (!s->natmembase) + continue; + shmaddr = natmem_offset + ((uae_u8*)s->attached - (uae_u8*)s->natmembase); + result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, s->mode); + if (result != shmaddr) + write_log ("NATMEM: realloc(%p,%d,%d) failed, err=%x\n", shmaddr, size, s->mode, GetLastError ()); + else + write_log ("NATMEM: rellocated(%p,%d,%s)\n", shmaddr, size, s->name); + } +} + +int init_shm (void) +{ uae_u32 size, totalsize, z3size, natmemsize, rtgbarrier, rtgextra; int rounds = 0; @@ -272,14 +307,6 @@ restart: } natmemsize = size + z3size; - shm_start = 0; - for (i = 0; i < MAX_SHMID; i++) { - shmids[i].attached = 0; - shmids[i].key = -1; - shmids[i].size = 0; - shmids[i].addr = NULL; - shmids[i].name[0] = 0; - } xfree (memwatchtable); memwatchtable = 0; if (currprefs.gfxmem_size) { @@ -338,11 +365,13 @@ restart: natmem_offset_end = p96mem_offset + currprefs.gfxmem_size; } + resetmem (); + return canbang; } -void mapped_free(uae_u8 *mem) +void mapped_free (uae_u8 *mem) { shmpiece *x = shm_start; @@ -354,6 +383,8 @@ void mapped_free(uae_u8 *mem) shmids[shmid].name[0] = '\0'; shmids[shmid].size = 0; shmids[shmid].attached = 0; + shmids[shmid].mode = 0; + shmids[shmid].natmembase = 0; } x = x->next; } @@ -362,21 +393,21 @@ void mapped_free(uae_u8 *mem) while(x) { if(mem == x->native_address) - shmdt(x->native_address); + shmdt (x->native_address); x = x->next; } x = shm_start; while(x) { struct shmid_ds blah; if (mem == x->native_address) { - if (shmctl(x->id, IPC_STAT, &blah) == 0) - shmctl(x->id, IPC_RMID, &blah); + if (shmctl (x->id, IPC_STAT, &blah) == 0) + shmctl (x->id, IPC_RMID, &blah); } x = x->next; } } -static key_t get_next_shmkey(void) +static key_t get_next_shmkey (void) { key_t result = -1; int i; @@ -390,7 +421,7 @@ static key_t get_next_shmkey(void) return result; } -STATIC_INLINE key_t find_shmkey(key_t key) +STATIC_INLINE key_t find_shmkey (key_t key) { int result = -1; if(shmids[key].key == key) { @@ -399,13 +430,13 @@ STATIC_INLINE key_t find_shmkey(key_t key) return result; } -int mprotect(void *addr, size_t len, int prot) +int mprotect (void *addr, size_t len, int prot) { int result = 0; return result; } -void *shmat(int shmid, void *shmaddr, int shmflg) +void *shmat (int shmid, void *shmaddr, int shmflg) { void *result = (void *)-1; BOOL got = FALSE; @@ -413,10 +444,12 @@ void *shmat(int shmid, void *shmaddr, int shmflg) DWORD protect = PAGE_READWRITE; #ifdef NATMEM_OFFSET - unsigned int size=shmids[shmid].size; - if(shmids[shmid].attached) + unsigned int size = shmids[shmid].size; + + if (shmids[shmid].attached) return shmids[shmid].attached; - if ((uae_u8*)shmaddr> 10, GetLastError()); - } else { - shmids[shmid].attached = result; - write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok%s\n", - (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size, - size, size >> 10, p96special ? " P96" : ""); - } - } else { - shmids[shmid].attached = shmaddr; - result = shmaddr; + if (shmids[shmid].key == shmid && shmids[shmid].size) { + shmids[shmid].mode = protect; + shmids[shmid].natmembase = natmem_offset; + if (shmaddr) + virtualfreewithlock (shmaddr, size, MEM_DECOMMIT); + result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, protect); + if (result == NULL) { + result = (void*)-1; + write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) failed %d\n", + (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size, + size, size >> 10, GetLastError()); + } else { + shmids[shmid].attached = result; + write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok%s\n", + (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size, + size, size >> 10, p96special ? " P96" : ""); } } return result; } -int shmdt(const void *shmaddr) +int shmdt (const void *shmaddr) { return 0; } -int shmget(key_t key, size_t size, int shmflg, char *name) +int shmget (key_t key, size_t size, int shmflg, char *name) { int result = -1; @@ -559,11 +588,11 @@ int shmget(key_t key, size_t size, int shmflg, char *name) return result; } -int shmctl(int shmid, int cmd, struct shmid_ds *buf) +int shmctl (int shmid, int cmd, struct shmid_ds *buf) { int result = -1; - if ((find_shmkey(shmid) != -1) && buf) { + if ((find_shmkey (shmid) != -1) && buf) { switch(cmd) { case IPC_STAT: @@ -571,11 +600,12 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf) result = 0; break; case IPC_RMID: - VirtualFree(shmids[shmid].attached, shmids[shmid].size, MEM_DECOMMIT); + VirtualFree (shmids[shmid].attached, shmids[shmid].size, MEM_DECOMMIT); shmids[shmid].key = -1; shmids[shmid].name[0] = '\0'; shmids[shmid].size = 0; shmids[shmid].attached = 0; + shmids[shmid].mode = 0; result = 0; break; } @@ -585,9 +615,9 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf) #endif -int isinf(double x) +int isinf (double x) { - const int nClass = _fpclass(x); + const int nClass = _fpclass (x); int result; if (nClass == _FPCLASS_NINF || nClass == _FPCLASS_PINF) result = 1; diff --git a/od-win32/parser.c b/od-win32/parser.c index 0861c996..16b85788 100755 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -53,7 +53,6 @@ static char prtbuf[PRTBUFSIZE]; static int prtbufbytes,wantwrite; static HANDLE hPrt = INVALID_HANDLE_VALUE; static DWORD dwJob; -extern HWND hAmigaWnd; static int prtopen; extern void flushpixels(void); void DoSomeWeirdPrintingStuff(char val); diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 2f73ca63..f978c711 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -30,6 +30,8 @@ * programs started from a Picasso workbench. */ +#define P96DX 0 + #include "sysconfig.h" #include "sysdeps.h" @@ -46,17 +48,23 @@ #if defined(PICASSO96) -#define NOBLITTER 0 - -static int hwsprite = 0; -static int uaegfxcard_old = 1; - #include "registry.h" #include "dxwrap.h" #include "rp.h" #include "picasso96_win.h" #include "win32gfx.h" +#define NOBLITTER 0 +#define NOBLITTER_BLIT 0 + +static int hwsprite = 0; +static int picasso96_BT = BT_uaegfx; +static int picasso96_GCT = GCT_Unknown; +static int picasso96_PCT = PCT_Unknown; +#ifndef UAEGFX_INTERNAL +static int uaegfxcard_old = 1; +#endif + int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity); void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize); @@ -94,6 +102,8 @@ struct picasso96_state_struct picasso96_state; struct picasso_vidbuf_description picasso_vidinfo; static struct PicassoResolution *newmodes; +static int picasso_convert, host_mode; + /* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */ /* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects /* data here. */ @@ -105,6 +115,9 @@ static struct ScreenResolution alphacolour = { 640, 480 }; uae_u32 p96_rgbx16[65536]; +#if P96DX > 0 +static LPDIRECTDRAWSURFACE7 p96surface; +#endif static LPDIRECTDRAWSURFACE7 cursorsurface; static int cursorwidth, cursorheight; static uae_u32 cursorrgb[4], cursorrgbn[4]; @@ -184,7 +197,7 @@ static void endianswap (uae_u32 *vp, int bpp) switch (bpp) { case 2: - *vp = (((v >> 8) & 0xff) | (v << 8)) & 0xffff; + *vp = (((v >> 8) & 0x00ff) | (v << 8)) & 0xffff; break; case 4: *vp = ((v >> 24) & 0x000000ff) | ((v >> 8) & 0x0000ff00) | ((v << 8) & 0x00ff0000) | ((v << 24) & 0xff000000); @@ -501,15 +514,15 @@ static int renderinfo_is_current_screen (struct RenderInfo *ri) /* * Fill a rectangle in the screen. */ -STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y, - int Width, int Height, uae_u32 Pen, int Bpp) +static void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y, + int Width, int Height, uae_u32 Pen, int Bpp) { int cols; - uae_u8 *src, *dst; + uae_u8 *dst; int lines; int bpr = ri->BytesPerRow; - dst = src = ri->Memory + X * Bpp + Y * ri->BytesPerRow; + dst = ri->Memory + X * Bpp + Y * ri->BytesPerRow; endianswap (&Pen, Bpp); switch (Bpp) { @@ -530,11 +543,11 @@ STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y break; case 3: for (lines = 0; lines < Height; lines++, dst += bpr) { - uae_u8 *d = (uae_u8*)dst; + uae_u8 *p = (uae_u8*)dst; for (cols = 0; cols < Width; cols++) { - *d++ = Pen >> 16; - *d++ = Pen >> 8; - *d++ = Pen; + *p++ = Pen >> 0; + *p++ = Pen >> 8; + *p++ = Pen >> 16; } } break; @@ -644,6 +657,13 @@ void picasso_handle_vsync (void) { static int vsynccnt; +#ifdef RETROPLATFORM + rp_vsync (); +#endif + + if (!picasso_on) + return; + framecnt++; mouseupdate (); @@ -663,6 +683,119 @@ void picasso_handle_vsync (void) static int set_panning_called = 0; + +typedef enum { + + /* DEST = RGBFB_B8G8R8A8,32 */ + RGBFB_A8R8G8B8_32 = 1, + RGBFB_A8B8G8R8_32, + RGBFB_R8G8B8A8_32, + RGBFB_B8G8R8A8_32, + RGBFB_R8G8B8_32, + RGBFB_B8G8R8_32, + RGBFB_R5G6B5PC_32, + RGBFB_R5G5B5PC_32, + RGBFB_R5G6B5_32, + RGBFB_R5G5B5_32, + RGBFB_B5G6R5PC_32, + RGBFB_B5G5R5PC_32, + RGBFB_CLUT_RGBFB_32, + + /* DEST = RGBFB_R5G6B5PC,16 */ + RGBFB_A8R8G8B8_16, + RGBFB_A8B8G8R8_16, + RGBFB_R8G8B8A8_16, + RGBFB_B8G8R8A8_16, + RGBFB_R8G8B8_16, + RGBFB_B8G8R8_16, + RGBFB_R5G6B5PC_16, + RGBFB_R5G5B5PC_16, + RGBFB_R5G6B5_16, + RGBFB_R5G5B5_16, + RGBFB_B5G6R5PC_16, + RGBFB_B5G5R5PC_16, + RGBFB_CLUT_RGBFB_16, + + /* DEST = RGBFB_CLUT,8 */ + RGBFB_CLUT_8 +}; + +static void setconvert (void) +{ + int d = picasso_vidinfo.pixbytes; + int v; + + v = 0; + switch (picasso96_state.RGBFormat) + { + case RGBFB_CLUT: + if (d == 1) + v = RGBFB_CLUT_8; + else if (d == 2) + v = RGBFB_CLUT_RGBFB_16; + else if (d == 4) + v = RGBFB_CLUT_RGBFB_32; + break; + + case RGBFB_B5G6R5PC: + if (d == 2) + v = RGBFB_B5G6R5PC_16; + else if (d == 4) + v = RGBFB_B5G6R5PC_32; + break; + case RGBFB_R5G6B5PC: + if (d == 2) + v = RGBFB_R5G6B5PC_16; + else if (d == 4) + v = RGBFB_R5G6B5PC_32; + break; + + case RGBFB_R5G5B5PC: + if (d == 4) + v = RGBFB_R5G5B5PC_32; + else if (d == 2) + v = RGBFB_R5G5B5PC_16; + break; + case RGBFB_R5G6B5: + if (d == 4) + v = RGBFB_R5G6B5_32; + break; + case RGBFB_R5G5B5: + if (d == 4) + v = RGBFB_R5G5B5_32; + break; + case RGBFB_B5G5R5PC: + if (d == 4) + v = RGBFB_B5G5R5PC_32; + break; + + + case RGBFB_R8G8B8: + if (d == 4) + v = RGBFB_R8G8B8_32; + break; + case RGBFB_B8G8R8: + if (d == 4) + v = RGBFB_B8G8R8_32; + break; + case RGBFB_A8B8G8R8: + if (d == 2) + v = RGBFB_A8B8G8R8_16; + else if (d == 4) + v = RGBFB_A8B8G8R8_32; + break; + case RGBFB_B8G8R8A8: + if (d == 2) + v = RGBFB_B8G8R8A8_16; + else if (d == 4) + v = RGBFB_B8G8R8A8_32; + break; + } + picasso_convert = v; + host_mode = DirectDraw_GetSurfacePixelFormat (NULL); + write_log ("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n", d, host_mode, picasso96_state.RGBFormat, v); +} + /* Clear our screen, since we've got a new Picasso screen-mode, and refresh with the proper contents * This is called on several occasions: * 1. Amiga-->Picasso transition, via SetSwitch() @@ -697,6 +830,7 @@ void picasso_refresh (void) } //end for higher P96 mousedraw rate have_done_picasso = 1; palette_changed = 1; + setconvert (); /* Make sure that the first time we show a Picasso video mode, we don't blit any crap. * We can do this by checking if we have an Address yet. */ @@ -779,6 +913,57 @@ void picasso_refresh (void) #undef BLT_SIZE #undef BLT_MULT +#define BLT_SIZE 3 +#define BLT_MULT 1 +#define BLT_NAME BLIT_FALSE_24 +#define BLT_FUNC(s,d) *d = 0 +#include "p96_blit.c" +#define BLT_NAME BLIT_NOR_24 +#define BLT_FUNC(s,d) *d = ~(*s | * d) +#include "p96_blit.c" +#define BLT_NAME BLIT_ONLYDST_24 +#define BLT_FUNC(s,d) *d = (*d) & ~(*s) +#include "p96_blit.c" +#define BLT_NAME BLIT_NOTSRC_24 +#define BLT_FUNC(s,d) *d = ~(*s) +#include "p96_blit.c" +#define BLT_NAME BLIT_ONLYSRC_24 +#define BLT_FUNC(s,d) *d = (*s) & ~(*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_NOTDST_24 +#define BLT_FUNC(s,d) *d = ~(*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_EOR_24 +#define BLT_FUNC(s,d) *d = (*s) ^ (*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_NAND_24 +#define BLT_FUNC(s,d) *d = ~((*s) & (*d)) +#include "p96_blit.c" +#define BLT_NAME BLIT_AND_24 +#define BLT_FUNC(s,d) *d = (*s) & (*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_NEOR_24 +#define BLT_FUNC(s,d) *d = ~((*s) ^ (*d)) +#include "p96_blit.c" +#define BLT_NAME BLIT_NOTONLYSRC_24 +#define BLT_FUNC(s,d) *d = ~(*s) | (*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_NOTONLYDST_24 +#define BLT_FUNC(s,d) *d = ~(*d) | (*s) +#include "p96_blit.c" +#define BLT_NAME BLIT_OR_24 +#define BLT_FUNC(s,d) *d = (*s) | (*d) +#include "p96_blit.c" +#define BLT_NAME BLIT_TRUE_24 +#define BLT_FUNC(s,d) *d = 0xffffffff +#include "p96_blit.c" +#define BLT_NAME BLIT_30_24 +#define BLT_FUNC(s,d) tmp = *d ; *d = *s; *s = tmp; +#define BLT_TEMP +#include "p96_blit.c" +#undef BLT_SIZE +#undef BLT_MULT + #define BLT_SIZE 2 #define BLT_MULT 2 #define BLT_NAME BLIT_FALSE_16 @@ -894,7 +1079,6 @@ static int do_blitrect_frame_buffer (struct RenderInfo *ri, struct uae_u8 *src, *dst; uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat); unsigned long total_width = width * Bpp; - unsigned long linewidth = (total_width + 15) & ~15; src = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow; dst = dstri->Memory + dstx * Bpp + dsty * dstri->BytesPerRow; @@ -945,6 +1129,27 @@ static int do_blitrect_frame_buffer (struct RenderInfo *ri, struct case BLIT_TRUE: BLIT_TRUE_32 (PARMS); break; case 30: BLIT_30_32 (PARMS); break; } + } else if (Bpp == 3) { + + /* 24-bit (not very) optimized */ + switch (opcode) + { + case BLIT_FALSE: BLIT_FALSE_24 (PARMS); break; + case BLIT_NOR: BLIT_NOR_24 (PARMS); break; + case BLIT_ONLYDST: BLIT_ONLYDST_24 (PARMS); break; + case BLIT_NOTSRC: BLIT_NOTSRC_24 (PARMS); break; + case BLIT_ONLYSRC: BLIT_ONLYSRC_24 (PARMS); break; + case BLIT_NOTDST: BLIT_NOTDST_24 (PARMS); break; + case BLIT_EOR: BLIT_EOR_24 (PARMS); break; + case BLIT_NAND: BLIT_NAND_24 (PARMS); break; + case BLIT_AND: BLIT_AND_24 (PARMS); break; + case BLIT_NEOR: BLIT_NEOR_24 (PARMS); break; + case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_24 (PARMS); break; + case BLIT_NOTONLYDST: BLIT_NOTONLYDST_24 (PARMS); break; + case BLIT_OR: BLIT_OR_24 (PARMS); break; + case BLIT_TRUE: BLIT_TRUE_24 (PARMS); break; + case 30: BLIT_30_24 (PARMS); break; + } } else if (Bpp == 2) { @@ -1151,21 +1356,9 @@ void picasso_clearcursor (void) write_log ("Cursor surface clearblit failed: %s\n", DXError (ddrval)); } -static void putmousepixel (uae_u8 *d, int bpp, int idx) +STATIC_INLINE uae_u16 rgb32torgb16pc (uae_u32 rgb) { - uae_u32 val = cursorrgbn[idx]; - switch (bpp) - { - case 1: - ((uae_u8*)d)[0] = (uae_u8)val; - break; - case 2: - ((uae_u16*)d)[0] = (uae_u16)val; - break; - case 4: - ((uae_u32*)d)[0] = (uae_u32)val; - break; - } + return (((rgb >> (16 + 3)) & 0x1f) << 11) | (((rgb >> (8 + 2)) & 0x3f) << 5) | (((rgb >> (0 + 3)) & 0x1f) << 0); } static void updatesprcolors (void) @@ -1182,9 +1375,9 @@ static void updatesprcolors (void) cursorrgbn[i] = i + 16; break; case 2: - vx = 0xff00ff; - cursorrgbn[0] = p96_rgbx16[(((vx >> (16 + 3)) & 0x1f) << 11) | (((vx >> (8 + 2)) & 0x3f) << 5) | (((vx >> (0 + 3)) & 0x1f) << 0)]; - cursorrgbn[i] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; + vx = 0xff00ff; /* RGB -> B5G6R5 */ + cursorrgbn[0] = rgb32torgb16pc (vx); + cursorrgbn[i] = rgb32torgb16pc (v); break; case 4: cursorrgbn[0] = 0xff00ff; @@ -1194,6 +1387,23 @@ static void updatesprcolors (void) } } +static void putmousepixel (uae_u8 *d, int bpp, int idx) +{ + uae_u32 val = cursorrgbn[idx]; + switch (bpp) + { + case 1: + ((uae_u8*)d)[0] = (uae_u8)val; + break; + case 2: + ((uae_u16*)d)[0] = (uae_u16)val; + break; + case 4: + ((uae_u32*)d)[0] = (uae_u32)val; + break; + } +} + static uae_u32 setspriteimage (uaecptr bi) { DDSURFACEDESC2 desc; @@ -1441,21 +1651,23 @@ static uae_u32 REGPARAM2 picasso_FindCard (TrapContext *ctx) return 0; } -static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struct PicassoResolution *dm) +static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struct PicassoResolution *dm, int depth) { int i; - switch (dm->depth) { - case 1: + switch (depth) + { + case 8: res->Modes[CHUNKY] = amigamemptr; break; - case 2: + case 15: + case 16: res->Modes[HICOLOR] = amigamemptr; break; - case 3: + case 24: res->Modes[TRUECOLOR] = amigamemptr; break; - default: + default: res->Modes[TRUEALPHA] = amigamemptr; break; } @@ -1464,7 +1676,7 @@ static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struc put_word (amigamemptr + PSSO_ModeInfo_Width, dm->res.width); put_word (amigamemptr + PSSO_ModeInfo_Height, dm->res.height); - put_byte (amigamemptr + PSSO_ModeInfo_Depth, dm->depth * 8); + put_byte (amigamemptr + PSSO_ModeInfo_Depth, depth); put_byte (amigamemptr + PSSO_ModeInfo_Flags, 0); put_word (amigamemptr + PSSO_ModeInfo_HorTotal, dm->res.width); put_word (amigamemptr + PSSO_ModeInfo_HorBlankSize, 0); @@ -1588,6 +1800,23 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr put_long (amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo); } +static int p96depth (int depth) +{ + uae_u32 f = currprefs.picasso96_modeflags; + int ok = 0; + + if (depth == 8 && (f & RGBFF_CLUT)) + ok = 1; + if (depth == 15 && (f & (RGBFF_R5G5B5PC | RGBFF_R5G5B5 | RGBFF_B5G5R5PC))) + ok = 2; + if (depth == 16 && (f & (RGBFF_R5G6B5PC | RGBFF_R5G6B5 | RGBFF_B5G6R5PC))) + ok = 2; + if (depth == 24 && (f & (RGBFF_R8G8B8 | RGBFF_B8G8R8))) + ok = 3; + if (depth == 32 && (f & (RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8))) + ok = 4; + return ok; +} static int missmodes[] = { 320, 200, 320, 240, 640, 400, 640, 480, -1 }; @@ -1597,7 +1826,7 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size); void picasso96_alloc (TrapContext *ctx) { int i, j, size, cnt; - int misscnt; + int misscnt, depths; SYSTEM_INFO si; uaegfx_resname = ds ("uaegfx.card"); @@ -1610,6 +1839,19 @@ void picasso96_alloc (TrapContext *ctx) cnt = 0; newmodes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES); size = 0; + + depths = 0; + if (p96depth (8)) + depths++; + if (p96depth (15)) + depths++; + if (p96depth (16)) + depths++; + if (p96depth (24)) + depths++; + if (p96depth (32)) + depths++; + i = 0; while (DisplayModes[i].depth >= 0) { for (j = 0; missmodes[j * 2] >= 0; j++) { @@ -1628,72 +1870,73 @@ void picasso96_alloc (TrapContext *ctx) while (missmodes[misscnt * 2] == 0) misscnt++; if (missmodes[misscnt * 2] >= 0) { - int oldi = i; if (DisplayModes[i].res.width > missmodes[misscnt * 2 + 0] || DisplayModes[i].res.height > missmodes[misscnt * 2 + 1]) { + int depth; int w = DisplayModes[i].res.width; int h = DisplayModes[i].res.height; - do { + for (depth = 8; depth <= 32; depth++) { struct PicassoResolution *pr = &newmodes[cnt]; + if (!p96depth (depth)) + continue; memcpy (pr, &DisplayModes[i], sizeof (struct PicassoResolution)); pr->res.width = missmodes[misscnt * 2 + 0]; pr->res.height = missmodes[misscnt * 2 + 1]; - sprintf (pr->name, "%dx%dx%d FAKE", pr->res.width, pr->res.height, pr->depth * 8); + sprintf (pr->name, "%dx%dx%d FAKE", pr->res.width, pr->res.height, depth); size += PSSO_ModeInfo_sizeof; - i++; - cnt++; - } while (DisplayModes[i].depth >= 0 - && w == DisplayModes[i].res.width - && h == DisplayModes[i].res.height); - - i = oldi; + } misscnt++; continue; } } - do { - memcpy (&newmodes[cnt], &DisplayModes[i], sizeof (struct PicassoResolution)); - size += PSSO_ModeInfo_sizeof; - i++; - cnt++; - } while (DisplayModes[i].depth >= 0 + memcpy (&newmodes[cnt], &DisplayModes[i], sizeof (struct PicassoResolution)); + size += PSSO_ModeInfo_sizeof * depths; + i++; + cnt++; + while (DisplayModes[i].depth >= 0 && DisplayModes[i].res.width == DisplayModes[j].res.width - && DisplayModes[i].res.height == DisplayModes[j].res.height); + && DisplayModes[i].res.height == DisplayModes[j].res.height) + i++; } newmodes[cnt].depth = -1; for (i = 0; i < cnt; i++) { - switch (newmodes[i].depth) { - case 1: - if (newmodes[i].res.width > chunky.width) - chunky.width = newmodes[i].res.width; - if (newmodes[i].res.height > chunky.height) - chunky.height = newmodes[i].res.height; - break; - case 2: - if (newmodes[i].res.width > hicolour.width) - hicolour.width = newmodes[i].res.width; - if (newmodes[i].res.height > hicolour.height) - hicolour.height = newmodes[i].res.height; - break; - case 3: - if (newmodes[i].res.width > truecolour.width) - truecolour.width = newmodes[i].res.width; - if (newmodes[i].res.height > truecolour.height) - truecolour.height = newmodes[i].res.height; - break; - case 4: - if (newmodes[i].res.width > alphacolour.width) - alphacolour.width = newmodes[i].res.width; - if (newmodes[i].res.height > alphacolour.height) - alphacolour.height = newmodes[i].res.height; - break; + int depth; + for (depth = 8; depth <= 32; depth++) { + if (!p96depth (depth)) + continue; + switch (depth) { + case 1: + if (newmodes[i].res.width > chunky.width) + chunky.width = newmodes[i].res.width; + if (newmodes[i].res.height > chunky.height) + chunky.height = newmodes[i].res.height; + break; + case 2: + if (newmodes[i].res.width > hicolour.width) + hicolour.width = newmodes[i].res.width; + if (newmodes[i].res.height > hicolour.height) + hicolour.height = newmodes[i].res.height; + break; + case 3: + if (newmodes[i].res.width > truecolour.width) + truecolour.width = newmodes[i].res.width; + if (newmodes[i].res.height > truecolour.height) + truecolour.height = newmodes[i].res.height; + break; + case 4: + if (newmodes[i].res.width > alphacolour.width) + alphacolour.width = newmodes[i].res.width; + if (newmodes[i].res.height > alphacolour.height) + alphacolour.height = newmodes[i].res.height; + break; + } } } #if 0 ShowSupportedResolutions (); #endif #ifdef UAEGFX_INTERNAL - picasso96_amem = NULL; + picasso96_amem = 0; if (uaegfx_card_install (ctx, size)) { picasso96_amem = get_long (uaegfx_base + CARD_RESLIST); picasso96_amemend = picasso96_amem + size; @@ -1758,6 +2001,12 @@ static void uaegfxversion (uaecptr bi) vers[strlen (vers) - 1] = 0; write_log ("P96: v%d %08X %s\n", version, addr, vers); + if (version == 1) { + static int warned; + if (!warned) + gui_message("Buggy libs:picasso96/uaegfx.card detected.\nPlease replace it with official version.\n"); + warned = 1; + } if (version >= 2) uaegfxcard_old = 0; xfree (vers); @@ -1775,11 +2024,12 @@ static void inituaegfx (uaecptr ABI) { uae_u32 flags; + write_log ("RTG mode mask: %x\n", currprefs.picasso96_modeflags); put_word (ABI + PSSO_BoardInfo_BitsPerCannon, 8); - put_word (ABI + PSSO_BoardInfo_RGBFormats, picasso96_pixel_format); - put_long (ABI + PSSO_BoardInfo_BoardType, BT_uaegfx); - put_long (ABI + PSSO_BoardInfo_GraphicsControllerType, GCT_Unknown); - put_long (ABI + PSSO_BoardInfo_PaletteChipType, PCT_Unknown); + put_word (ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags); + put_long (ABI + PSSO_BoardInfo_BoardType, picasso96_BT); + put_long (ABI + PSSO_BoardInfo_GraphicsControllerType, picasso96_GCT); + put_long (ABI + PSSO_BoardInfo_PaletteChipType, picasso96_PCT); put_long (ABI + PSSO_BoardInfo_BoardName, uaegfx_resname); put_long (ABI + PSSO_BoardInfo_BoardType, 1); @@ -1804,10 +2054,8 @@ static void inituaegfx (uaecptr ABI) flags = get_long (ABI + PSSO_BoardInfo_Flags); flags &= 0xffff0000; - flags |= BIF_HARDWARESPRITE | BIF_BLITTER | BIF_NOMEMORYMODEMIX; - put_long (ABI + PSSO_BoardInfo_Flags, flags); + flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX; #ifndef UAEGFX_INTERNAL - flags = get_long (ABI + PSSO_BoardInfo_Flags); if (flags & BIF_HARDWARESPRITE) { hwsprite = 1; put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, 0); @@ -1815,7 +2063,7 @@ static void inituaegfx (uaecptr ABI) } else { hwsprite = 0; write_log ("P96: uaegfx.card: no hardware sprite support\n"); - put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, picasso96_pixel_format); + put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, currprefs.picasso96_modeflags); } if (uaegfxcard_old && (flags & BIF_HARDWARESPRITE)) { flags &= ~BIF_HARDWARESPRITE; @@ -1823,8 +2071,11 @@ static void inituaegfx (uaecptr ABI) } if (!(flags & BIF_BLITTER)) write_log ("P96: no blitter support, bogus uaegfx.card!?\n"); - put_long (ABI + PSSO_BoardInfo_Flags, flags); +#else + hwsprite = 1; + flags |= BIF_HARDWARESPRITE; #endif + put_long (ABI + PSSO_BoardInfo_Flags, flags); if (flags & BIF_NOBLITTER) write_log ("P96: blitter disabled in devs:monitors/uaegfx!\n"); @@ -1872,6 +2123,7 @@ static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx) i = 0; unkcnt = 0; while (newmodes[i].depth >= 0) { + int depth; j = i; /* Add a LibResolution structure to the ResolutionsList MinList in our BoardInfo */ res.DisplayID = AssignModeID (i, LibResolutionStructureCount, &unkcnt); @@ -1880,25 +2132,28 @@ static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx) res.Height = newmodes[i].res.height; res.Flags = P96F_PUBLIC; memcpy (res.P96ID, "P96-0:", 6); - sprintf (res.Name, "uaegfx:%dx%d", res.Width, res.Height); + sprintf (res.Name, "UAE:%dx%d", res.Width, res.Height); res.Modes[PLANAR] = 0; res.Modes[CHUNKY] = 0; res.Modes[HICOLOR] = 0; res.Modes[TRUECOLOR] = 0; res.Modes[TRUEALPHA] = 0; - do { + for (depth = 8; depth <= 32; depth++) { + if (!p96depth (depth)) + continue; /* Handle this display mode's depth */ /* New: Only add the modes when there is enough P96 RTG memory to hold the bitmap */ - if(allocated_gfxmem >= newmodes[i].res.width * newmodes[i].res.height * newmodes[i].depth) { + if(allocated_gfxmem >= newmodes[i].res.width * newmodes[i].res.height * (depth + 7) / 8) { ModeInfoStructureCount++; - FillBoardInfo(amem, &res, &newmodes[i]); + FillBoardInfo (amem, &res, &newmodes[i], depth); amem += PSSO_ModeInfo_sizeof; } - i++; - } while (newmodes[i].depth >= 0 + } + while (newmodes[i].depth >= 0 && newmodes[i].res.width == newmodes[j].res.width - && newmodes[i].res.height == newmodes[j].res.height); + && newmodes[i].res.height == newmodes[j].res.height) + i++; LibResolutionStructureCount++; CopyLibResolutionStructureU2A (&res, amem); @@ -2022,8 +2277,7 @@ static uae_u32 REGPARAM2 picasso_SetDAC (TrapContext *ctx) return 1; } - -static void init_picasso_screen(void) +static void init_picasso_screen (void) { reloadcursor = 1; if(set_panning_called) { @@ -2042,6 +2296,7 @@ static void init_picasso_screen(void) } init_picasso_screen_called = 1; mman_ResetWatch (p96ram_start + natmem_offset, allocated_gfxmem); + } /* @@ -2124,13 +2379,27 @@ static uae_u32 REGPARAM2 picasso_SetPanning (TrapContext *ctx) uaecptr bi = m68k_areg (regs, 0); uaecptr bmeptr = get_long (bi + PSSO_BoardInfo_BitMapExtra); /* Get our BoardInfo ptr's BitMapExtra ptr */ uae_u16 bme_width, bme_height; + int changed = 0; if(oldscr == 0) { oldscr = start_of_screen; + changed = 1; } if (oldscr != start_of_screen) { set_gc_called = 0; oldscr = start_of_screen; + changed = 1; + } + + if (changed) { +#if P96DX > 0 + freesurface (p96surface); + p96surface = NULL; + if (picasso96_state.BytesPerPixel == picasso_vidinfo.pixbytes) + p96surface = createsurface (get_real_address (picasso96_state.Address), + picasso96_state.Width * picasso96_state.BytesPerPixel, picasso96_state.Width, picasso96_state.Height); + write_log ("P96Surface: %08X %p\n", picasso96_state.Address, p96surface); +#endif } bme_width = get_word (bmeptr + PSSO_BitMapExtra_Width); @@ -2225,10 +2494,8 @@ static uae_u32 REGPARAM2 picasso_InvertRect (TrapContext *ctx) width_in_bytes = Bpp * Width; rectstart = uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; - for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) { + for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) do_xor8 (uae_mem, width_in_bytes, xorval); - } - result = 1; } @@ -2267,9 +2534,6 @@ static uae_u32 REGPARAM2 picasso_FillRect (TrapContext *ctx) if (NOBLITTER) return 0; if (CopyRenderInfoStructureA2U (renderinfo, &ri) && Y != 0xFFFF) { - if (ri.RGBFormat != RGBFormat) - write_log ("Weird Stuff!\n"); - Bpp = GetBytesPerPixel (RGBFormat); P96TRACE(("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n", @@ -2364,8 +2628,6 @@ STATIC_INLINE int BlitRectHelper (void) BLIT_OPCODE opcode = blitrectdata.opcode; uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat); - unsigned long total_width = width * Bpp; - unsigned long linewidth = (total_width + 15) & ~15; if (opcode == BLIT_DST) { write_log ( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" ); @@ -2441,7 +2703,7 @@ static uae_u32 REGPARAM2 picasso_BlitRect (TrapContext *ctx) uae_u8 Mask = (uae_u8)m68k_dreg (regs, 6); uae_u32 result = 0; - if (NOBLITTER) + if (NOBLITTER_BLIT) return 0; P96TRACE(("BlitRect(%d, %d, %d, %d, %d, %d, 0x%x)\n", srcx, srcy, dstx, dsty, width, height, Mask)); result = BlitRect (renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC); @@ -2481,7 +2743,7 @@ static uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete (TrapContext *ctx) uae_u32 RGBFmt = m68k_dreg (regs, 7); uae_u32 result = 0; - if (NOBLITTER) + if (NOBLITTER_BLIT) return 0; P96TRACE(("BlitRectNoMaskComplete() op 0x%02x, %08x:(%4d,%4d) --> %08x:(%4d,%4d), wh(%4d,%4d)\n", @@ -2504,9 +2766,9 @@ STATIC_INLINE void PixelWrite (uae_u8 *mem, int bits, uae_u32 fgpen, int Bpp, ua ((uae_u16 *)mem)[bits] = (uae_u16)fgpen; break; case 3: - mem[bits + 0] = fgpen >> 16; - mem[bits + 1] = fgpen >> 8; - mem[bits + 2] = fgpen >> 0; + mem[bits * 3 + 0] = fgpen >> 0; + mem[bits * 3 + 1] = fgpen >> 8; + mem[bits * 3 + 2] = fgpen >> 16; break; case 4: ((uae_u32 *)mem)[bits] = fgpen; @@ -2558,7 +2820,8 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx) uae_u32 result = 0; if (NOBLITTER) - return 0; + return 1; + if(CopyRenderInfoStructureA2U (rinf, &ri) && CopyPatternStructureA2U (pinf, &pattern)) { Bpp = GetBytesPerPixel(ri.RGBFormat); uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset with address */ @@ -2600,7 +2863,7 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx) if (xshift != 0) d = (d << xshift) | (d >> (16 - xshift)); - for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp << 4) { + for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp * 16) { long bits; long max = W - cols; unsigned int data = d; @@ -2655,7 +2918,7 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx) case 3: { uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3); - do_put_mem_long (addr, do_get_mem_long (addr) ^ 0xffffff); + do_put_mem_long (addr, do_get_mem_long (addr) ^ 0x00ffffff); } break; case 4: @@ -2719,8 +2982,9 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx) if (NOBLITTER) return 0; + if (CopyRenderInfoStructureA2U (rinf, &ri) && CopyTemplateStructureA2U (tmpl, &tmp)) { - Bpp = GetBytesPerPixel(ri.RGBFormat); + Bpp = GetBytesPerPixel (ri.RGBFormat); uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset into address */ if (tmp.DrawMode & INVERS) @@ -2731,7 +2995,6 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx) if (Mask != 0xFF) { if(Bpp > 1) Mask = 0xFF; - if(tmp.DrawMode == COMP) { write_log ("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask); return 0; @@ -2767,7 +3030,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx) uae_u8 *uae_mem2 = uae_mem; unsigned int data = *tmpl_mem; - for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp << 3) { + for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp * 8) { unsigned int byte; long bits; long max = W - cols; @@ -2790,7 +3053,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx) if (inversion) bit_set = !bit_set; if (bit_set) - PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask); + PixelWrite (uae_mem2, bits, fgpen, Bpp, Mask); } break; } @@ -2801,7 +3064,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx) byte <<= 1; if (inversion) bit_set = !bit_set; - PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); + PixelWrite (uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask); } break; } @@ -2889,9 +3152,6 @@ void picasso_handle_hsync (void) { static int p96hsync; -#ifdef RETROPLATFORM - rp_hsync (); -#endif if (currprefs.gfxmem_size == 0) return; if (WIN32GFX_IsPicassoScreen () && currprefs.gfx_pfullscreen && currprefs.gfx_pvsync) { @@ -2903,7 +3163,8 @@ void picasso_handle_hsync (void) if (p96hsync <= 0) { if (uae_boot_rom) { int off = get_long (rtarea_base + 36) + 12 - 1; - rtarea[off]++; + if (off >= 0 && off < 0x10000) + rtarea[off]++; } p96hsync = p96syncrate; } @@ -2936,9 +3197,6 @@ static void PlanarToChunky (struct RenderInfo *ri, struct BitMap *bm, unsigned long rows, bitoffset = srcx & 7; long eol_offset; - /* if (mask != 0xFF) - write_log ("P2C - pixel-width = %d, bit-offset = %d\n", width, bitoffset); */ - /* Set up our bm->Planes[] pointers to the right horizontal offset */ for (j = 0; j < Depth; j++) { uae_u8 *p = bm->Planes[j]; @@ -3094,9 +3352,10 @@ static void PlanarToDirect (struct RenderInfo *ri, struct BitMap *bm, image2 += 2; break; case 3: - do_put_mem_byte (image2++, (uae_u8)cim->Colors[v] ); - do_put_mem_word ((uae_u16 *)image2, (uae_u16)((cim->Colors[v] & 0x00FFFF00) >> 8)); - image2 += 2; + image2[0] = cim->Colors[v] >> 0; + image2[1] = cim->Colors[v] >> 8; + image2[2] = cim->Colors[v] >> 16; + image2 += 3; break; case 4: ((uae_u32 *)image2)[0] = cim->Colors[v]; @@ -3188,10 +3447,160 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (TrapContext *ctx) return result; } +STATIC_INLINE void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width) +{ + uae_u8 *src2 = src + y * picasso96_state.BytesPerRow; + uae_u8 *dst2 = dst + y * picasso_vidinfo.rowbytes; + int endx = x + width; + int dstpix = picasso_vidinfo.pixbytes; + int srcpix = picasso96_state.BytesPerPixel; + + if (picasso96_state.RGBFormat == host_mode) { + memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix); + return; + } + + switch (picasso_convert) + { + case RGBFB_B8G8R8A8_32: + case RGBFB_B5G6R5PC_16: + case RGBFB_R5G6B5PC_16: + case RGBFB_CLUT_8: + memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix); + break; + + case RGBFB_R8G8B8_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = (src2[x * 3 + 0] << 16) | (src2[x * 3 + 1] << 8) | (src2[x * 3 + 2] << 0); + x++; + } + break; + case RGBFB_B8G8R8_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = ((uae_u32*)(src2 + x * 3))[0] & 0x00ffffff; + x++; + } + break; + case RGBFB_R8G8B8A8_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = (src2[x * 4 + 0] << 16) | (src2[x * 4 + 1] << 8) | (src2[x * 4 + 2] << 0); + x++; + } + break; + case RGBFB_A8R8G8B8_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = (src2[x * 4 + 1] << 16) | (src2[x * 4 + 2] << 8) | (src2[x * 4 + 3] << 0); + x++; + } + break; + case RGBFB_A8B8G8R8_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = ((uae_u32*)src2)[0] << 8; + x++; + } + break; + + case RGBFB_R5G6B5PC_32: + case RGBFB_R5G5B5PC_32: + case RGBFB_R5G6B5_32: + case RGBFB_R5G5B5_32: + case RGBFB_B5G6R5PC_32: + case RGBFB_B5G5R5PC_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + } + break; + + case RGBFB_R5G5B5PC_16: + case RGBFB_R5G6B5_16: + case RGBFB_R5G5B5_16: + case RGBFB_B5G5R5PC_16: + while (x < endx) { + ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]]; + x++; + } + break; + + case RGBFB_R8G8B8_16: + break; + case RGBFB_B8G8R8_16: + break; + case RGBFB_R8G8B8A8_16: + break; + case RGBFB_A8R8G8B8_16: + break; + case RGBFB_A8B8G8R8_16: + break; + + case RGBFB_B8G8R8A8_16: + while (x < endx) { + uae_u32 v; + v = ((uae_u32*)src2)[x]; + ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; + x++; + } + break; + + case RGBFB_CLUT_RGBFB_32: + while (x < endx) { + ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + } + break; + case RGBFB_CLUT_RGBFB_16: + while (x < endx) { + ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; + x++; + } + break; + } +} + +static void copyall (uae_u8 *src, uae_u8 *dst) +{ + int y; + + if (picasso96_state.RGBFormat == host_mode) { + int w = picasso96_state.Width * picasso_vidinfo.pixbytes; + for (y = 0; y < picasso96_state.Height; y++) { + memcpy (dst, src, w); + dst += picasso_vidinfo.rowbytes; + src += picasso96_state.BytesPerRow; + } + } else { + for (y = 0; y < picasso96_state.Height; y++) + copyrow (src, dst, 0, y, picasso96_state.Width); + } +} + static void flushpixels (void) { int i; - int rowwidth_dst = picasso_vidinfo.width * picasso_vidinfo.pixbytes; int rowwidth_src = picasso96_state.Width * picasso96_state.BytesPerPixel; uae_u8 *src = p96ram_start + natmem_offset; int off = picasso96_state.XYOffset - gfxmem_start; @@ -3203,6 +3612,7 @@ static void flushpixels (void) uae_u8 *dst = NULL; ULONG_PTR gwwcnt; + if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end) return; @@ -3210,6 +3620,7 @@ static void flushpixels (void) palette_changed = -1; for (;;) { + int dofull; gwwcnt = 0; @@ -3228,13 +3639,22 @@ static void flushpixels (void) } else { ULONG ps; gwwcnt = gwwbufsize; - if (mman_GetWriteWatch (src, allocated_gfxmem, gwwbuf, &gwwcnt, &ps)) + if (mman_GetWriteWatch (src_start, src_end - src_start, gwwbuf, &gwwcnt, &ps)) break; } if (gwwcnt == 0) break; + dofull = gwwcnt >= ((src_end - src_start) / gwwpagesize) * 80 / 100; + +#if P96DX > 0 + if (p96surface && dofull && picasso_vidinfo.pixbytes == picasso96_state.BytesPerPixel) { + flushpixels_surface (gwwbuf, gwwcnt, src_start, src_end); + return; + } +#endif + if (dst == NULL) { if (DirectDraw_IsLocked() == FALSE) { if (!lock) @@ -3250,13 +3670,18 @@ static void flushpixels (void) if (doskip () && p96skipmode == 2) break; + if (dofull) { + copyall (src + off, dst); + miny = 0; + maxy = picasso96_state.Height; + break; + } + for (i = 0; i < gwwcnt; i++) { - int pscnt = gwwpagesize; uae_u8 *p = gwwbuf[i]; if (p >= src_start && p < src_end) { - int y, yend, realoffset; - uae_u8 *src2, *dst2; + int y, x, realoffset; if (p >= src + off) { realoffset = p - (src + off); @@ -3265,106 +3690,25 @@ static void flushpixels (void) } y = realoffset / picasso96_state.BytesPerRow; - src2 = src + y * picasso96_state.BytesPerRow + off; - dst2 = dst + y * picasso_vidinfo.rowbytes; - - /* merge nearby pieces */ - while (i + 1 < gwwcnt && (uae_u8*)gwwbuf[i + 1] <= p + 1 * gwwpagesize) { - pscnt += gwwpagesize; - p += gwwpagesize; - i++; - } - - yend = (realoffset + pscnt + picasso96_state.BytesPerRow - 1) / picasso96_state.BytesPerRow; - if (yend >= picasso96_state.Height) - yend = picasso96_state.Height - 1; - - if (yend > maxy) - maxy = yend; - if (y < miny) - miny = y; - - if (picasso_vidinfo.pixbytes == picasso96_state.BytesPerPixel) { - while (y <= yend) { - memcpy (dst2, src2, rowwidth_dst); - src2 += picasso96_state.BytesPerRow; - dst2 += picasso_vidinfo.rowbytes; - y++; - } - } else if (picasso_vidinfo.pixbytes == 4 && picasso96_state.BytesPerPixel == 2) { /* 16->32 */ - int x; - while (y <= yend) { - for (x = 0; x < picasso96_state.Width;) { - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]]; - x++; - } - src2 += picasso96_state.BytesPerRow; - dst2 += picasso_vidinfo.rowbytes; - y++; - } - } else if (picasso_vidinfo.pixbytes == 4 && picasso96_state.BytesPerPixel == 1) { /* 8->32 */ - int x; - while (y <= yend) { - for (x = 0; x < picasso96_state.Width;) { - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - src2 += picasso96_state.BytesPerRow; - dst2 += picasso_vidinfo.rowbytes; - y++; - } - } else if (picasso_vidinfo.pixbytes == 2 && picasso96_state.BytesPerPixel == 4) { /* 32->16 */ - int x; - while (y <= yend) { - for (x = 0; x < picasso96_state.Width;) { - uae_u32 v; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; - x++; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; - x++; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; - x++; - v = ((uae_u32*)src2)[x]; - ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)]; - x++; - } - src2 += picasso96_state.BytesPerRow; - dst2 += picasso_vidinfo.rowbytes; - y++; - } - } else if (picasso_vidinfo.pixbytes == 2 && picasso96_state.BytesPerPixel == 1) { /* 8->16 */ - int x; - while (y <= yend) { - for (x = 0; x < picasso96_state.Width;) { - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]]; - x++; - } - src2 += picasso96_state.BytesPerRow; - dst2 += picasso_vidinfo.rowbytes; + if (y < picasso96_state.Height) { + int w = gwwpagesize / picasso96_state.BytesPerPixel; + x = (realoffset % picasso96_state.BytesPerRow) / picasso96_state.BytesPerPixel; + if (x < picasso96_state.Width) + copyrow (src + off, dst, x, y, picasso96_state.Width - x); + w = (gwwpagesize - (picasso96_state.BytesPerRow - x * picasso96_state.BytesPerPixel)) / picasso96_state.BytesPerPixel; + if (y < miny) + miny = y; + y++; + while (y < picasso96_state.Height && w > 0) { + int maxw = w > picasso96_state.Width ? picasso96_state.Width : w; + copyrow (src + off, dst, 0, y, maxw); + w -= maxw; y++; } + if (y > maxy) + maxy = y; } + } } @@ -3385,7 +3729,7 @@ static void flushpixels (void) if (doskip () && p96skipmode == 4) { ; } else { - DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny + 1); + DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny); } } } @@ -3628,6 +3972,28 @@ static void inituaegfxfuncs (uaecptr ABI) dl (0xfffffffe); dw (RTS); + /* CalculateBytesPerRow (optimized) */ + put_long (ABI + PSSO_BoardInfo_CalculateBytesPerRow, here ()); + dl (0x0c400140); // cmp.w #320,d0 + dw (0x6504); // bcs.s .l1 + calltrap (deftrap (picasso_CalculateBytesPerRow)); + dw (RTS); + dw (0x0c87); dl (0x00000010); // l1: cmp.l #10,d7 + dw (0x640a); // bcc.s .l2 + dw (0x7200); // moveq #0,d1 + dl (0x123b7010); // move.b table(pc,d7.w),d1 + dw (0x6b04); // bmi.s l3 + dw (0xe368); // lsl.w d1,d0 + dw (RTS); // .l2 + dw (0x3200); // .l3 move.w d0,d1 + dw (0xd041); // add.w d1,d0 + dw (0xd041); // add.w d1,d0 + dw (RTS); + dl (0x0000ffff); // table + dl (0x01010202); + dl (0x02020101); + dl (0x01010100); + RTGNONE(ABI, PSSO_BoardInfo_SetClock); RTGNONE(ABI, PSSO_BoardInfo_SetMemoryMode); RTGNONE(ABI, PSSO_BoardInfo_SetWriteMask); @@ -3657,7 +4023,6 @@ static void inituaegfxfuncs (uaecptr ABI) RTGCALL2(ABI, PSSO_BoardInfo_SetDAC, picasso_SetDAC); RTGCALL2(ABI, PSSO_BoardInfo_SetGC, picasso_SetGC); RTGCALL2(ABI, PSSO_BoardInfo_SetPanning, picasso_SetPanning); - RTGCALL2(ABI, PSSO_BoardInfo_CalculateBytesPerRow, picasso_CalculateBytesPerRow); RTGCALL2(ABI, PSSO_BoardInfo_SetDisplay, picasso_SetDisplay); RTGCALL2(ABI, PSSO_BoardInfo_SetSprite, picasso_SetSprite); @@ -3738,10 +4103,10 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize) m68k_dreg (&ctx->regs, 1) = 0; uaegfx_base = CallLib (ctx, exec, -0x54); /* MakeLibrary */ m68k_areg (&ctx->regs, 2) = a2; - if (uaegfx_base) { - m68k_areg (&ctx->regs, 1) = uaegfx_base; - CallLib (ctx, exec, -0x18c); /* AddLibrary */ - } + if (!uaegfx_base) + return 0; + m68k_areg (&ctx->regs, 1) = uaegfx_base; + CallLib (ctx, exec, -0x18c); /* AddLibrary */ m68k_areg (&ctx->regs, 1) = EXPANSION_explibname; m68k_dreg (&ctx->regs, 0) = 0; put_long (uaegfx_base + CARD_EXPANSIONBASE, CallLib (ctx, exec, -0x228)); /* OpenLibrary */ diff --git a/od-win32/picasso96_win.h b/od-win32/picasso96_win.h index db94f800..441ca555 100755 --- a/od-win32/picasso96_win.h +++ b/od-win32/picasso96_win.h @@ -48,12 +48,12 @@ typedef enum { */ typedef enum { PCT_Unknown, - PCT_S11483, // Sierra S11483: HiColor 15 bit, oMniBus, Domino - PCT_S15025, // Sierra S15025: TrueColor 32 bit, oMniBus + PCT_S11483, // Sierra S11483: HiColor 15 bit, oMniBus, Domino + PCT_S15025, // Sierra S15025: TrueColor 32 bit, oMniBus PCT_CirrusGD542x, // Cirrus GD542x internal: TrueColor 24 bit - PCT_Domino, // is in fact a Sierra S11483 - PCT_BT482, // BrookTree BT482: TrueColor 32 bit, Merlin - PCT_Music, // Music MU9C4910: TrueColor 24 bit, oMniBus + PCT_Domino, // is in fact a Sierra S11483 + PCT_BT482, // BrookTree BT482: TrueColor 32 bit, Merlin + PCT_Music, // Music MU9C4910: TrueColor 24 bit, oMniBus PCT_ICS5300, // ICS 5300: ...., Retina BLT Z3 PCT_CirrusGD5446, // Cirrus GD5446 internal: TrueColor 24 bit PCT_CirrusGD5434, // Cirrus GD5434 internal: TrueColor 32 bit diff --git a/od-win32/resources/resource b/od-win32/resources/resource index fb60e3d5..da6adbee 100755 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -930,6 +930,13 @@ #define IDC_DBG_MEM2 1782 #define IDC_DBG_MEMINPUT2 1783 #define IDC_DBG_ADDRINPUTTXT 1784 +#define IDC_RTG_SCALE 1785 +#define IDC_RTG_MATCH_DEPTH 1786 +#define IDC_RTG_8BIT 1787 +#define IDC_RTG_16BIT 1788 +#define IDC_RTG_24BIT 1789 +#define IDC_RTG_32BIT 1790 +#define IDC_DD_SURFACETYPE 1791 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -973,9 +980,9 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 335 +#define _APS_NEXT_RESOURCE_VALUE 336 #define _APS_NEXT_COMMAND_VALUE 40045 -#define _APS_NEXT_CONTROL_VALUE 1785 +#define _APS_NEXT_CONTROL_VALUE 1788 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 2251cfb8..da6adbee 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -930,6 +930,13 @@ #define IDC_DBG_MEM2 1782 #define IDC_DBG_MEMINPUT2 1783 #define IDC_DBG_ADDRINPUTTXT 1784 +#define IDC_RTG_SCALE 1785 +#define IDC_RTG_MATCH_DEPTH 1786 +#define IDC_RTG_8BIT 1787 +#define IDC_RTG_16BIT 1788 +#define IDC_RTG_24BIT 1789 +#define IDC_RTG_32BIT 1790 +#define IDC_DD_SURFACETYPE 1791 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -975,7 +982,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 336 #define _APS_NEXT_COMMAND_VALUE 40045 -#define _APS_NEXT_CONTROL_VALUE 1785 +#define _APS_NEXT_CONTROL_VALUE 1788 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d28b8948..79af791b 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -118,12 +118,12 @@ BEGIN COMBOBOX IDC_LORES,100,140,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END -IDD_MEMORY DIALOGEX 0, 0, 300, 175 +IDD_MEMORY DIALOGEX 0, 0, 300, 239 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD EXSTYLE WS_EX_CONTEXTHELP FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - GROUPBOX "Memory Settings",-1,14,7,274,91 + GROUPBOX "Memory Settings",-1,14,7,274,69 RTEXT "Chip:",-1,24,26,20,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,22,50,20 EDITTEXT IDC_CHIPRAM,105,25,30,12,ES_CENTER | ES_READONLY @@ -136,16 +136,25 @@ BEGIN RTEXT "Z3 Fast:",IDC_Z3TEXT,139,51,30,10,SS_CENTERIMAGE CONTROL "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,47,60,20 EDITTEXT IDC_Z3FASTRAM,243,50,30,12,ES_CENTER | ES_READONLY - RTEXT "RTG: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,136,76,33,10,SS_NOTIFY | SS_CENTERIMAGE - CONTROL "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,72,60,20 - EDITTEXT IDC_P96RAM,243,75,30,12,ES_CENTER | ES_READONLY - GROUPBOX "Advanced Memory Settings",-1,13,104,275,65 - RTEXT "Motherboard RAM (Low area):",-1,39,123,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,119,59,20 - EDITTEXT IDC_MBRAM1,243,122,30,12,ES_CENTER | ES_READONLY - RTEXT "Motherboard RAM (High area):",-1,39,148,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,144,59,20 - EDITTEXT IDC_MBRAM2,243,147,30,12,ES_CENTER | ES_READONLY + RTEXT "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,25,98,53,10,SS_NOTIFY | SS_CENTERIMAGE + CONTROL "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,94,60,20 + EDITTEXT IDC_P96RAM,152,97,30,12,ES_CENTER | ES_READONLY + GROUPBOX "Advanced Memory Settings",-1,13,171,275,65 + RTEXT "Motherboard RAM (Low area):",-1,39,190,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,186,59,20 + EDITTEXT IDC_MBRAM1,243,189,30,12,ES_CENTER | ES_READONLY + RTEXT "Motherboard RAM (High area):",-1,39,215,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,211,59,20 + EDITTEXT IDC_MBRAM2,243,214,30,12,ES_CENTER | ES_READONLY + GROUPBOX "RTG Graphics Card Settings",-1,14,81,275,87 + CONTROL "Scale instead of switching resolution",IDC_RTG_SCALE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,134,162,10 + CONTROL "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,119,163,10 + COMBOBOX IDC_RTG_8BIT,211,101,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_16BIT,211,117,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_24BIT,211,133,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_RTG_32BIT,211,149,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END IDD_CPU DIALOGEX 0, 0, 300, 226 @@ -401,9 +410,7 @@ BEGIN CONTROL "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,66,117,10 CONTROL "bsdsocket.library emulation",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,15,120,10 CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,27,120,10 - CONTROL "RTG color depth matching [] Do not use color space conversion if possible.",IDC_RTGMATCHDEPTH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,120,10 - CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,53,115,10 + CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,115,10 GROUPBOX "Keyboard LEDs",IDC_STATIC,7,140,85,94 COMBOBOX IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -420,14 +427,16 @@ BEGIN RTEXT "Recording buffer (MB):",IDC_STATIC,160,219,83,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,79,117,10 - CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,115,10 + CONTROL "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,53,115,10 CONTROL "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10 COMBOBOX IDC_SCSIMODE,92,51,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_LANGUAGE,103,121,179,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Language",IDC_STATIC,7,113,285,25 CONTROL "Disable powersaving features",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,92,120,10 - CONTROL "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,119,10 - CONTROL "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,92,94,10 + CONTROL "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,119,10 + CONTROL "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,94,10 + COMBOBOX IDC_DD_SURFACETYPE,217,93,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "Display buffer:",IDC_STATIC,159,94,52,10,SS_CENTERIMAGE END IDD_HARDFILE DIALOGEX 0, 0, 299, 249 diff --git a/od-win32/rp.c b/od-win32/rp.c index 45bf9bea..130760bd 100755 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -40,9 +40,20 @@ static int default_width, default_height; static int hwndset; static int minimized; static DWORD hd_mask, cd_mask; +static int mousecapture, mousemagic; static int recursive_device; +static void outhex (const uae_u8 *s) +{ + for (;;) { + write_log ("%02X%02X ", s[0], s[1]); + if (s[0] == 0 && s[1] == 0) + break; + s += 2; + } + write_log ("\n"); +} static char *ua (const WCHAR *s) { @@ -109,6 +120,7 @@ static const char *getmsg (int msg) case RPIPCHM_MOUSECAPTURE: return "RPIPCHM_MOUSECAPTURE"; case RPIPCHM_DEVICECONTENT: return "RPIPCHM_DEVICECONTENT"; case RPIPCHM_PING: return "RPIPCHM_PING"; + case RPIPCHM_SCREENCLIP: return "RPIPCHM_SCREENCLIP"; default: return "UNKNOWN"; } @@ -117,7 +129,7 @@ static const char *getmsg (int msg) static int port_insert (int num, const char *name) { char tmp1[100], tmp2[200]; - int i; + int i, type; if (num < 0 || num > 1) return FALSE; @@ -127,23 +139,33 @@ static int port_insert (int num, const char *name) } if (strlen (name) >= sizeof (tmp2) - 1) return FALSE; + type = 1; strcpy (tmp2, name); for (i = 1; i <= 4; i++) { sprintf (tmp1, "Mouse%d", i); - if (!strcmp (name, tmp1)) + if (!strcmp (name, tmp1)) { sprintf (tmp2, "mouse%d", i - 1); + type = 0; + break; + } sprintf (tmp1, "Joystick%d", i); - if (!strcmp (name, tmp1)) + if (!strcmp (name, tmp1)) { sprintf (tmp2, "joy%d", i - 1); + type = 0; + break; + } sprintf (tmp1, "KeyboardLayout%d", i); - if (!strcmp (name, tmp1)) + if (!strcmp (name, tmp1)) { sprintf (tmp2, "kbd%d", i); + type = 0; + break; + } } - inputdevice_joyport_config (&changed_prefs, tmp2, num, 1); + inputdevice_joyport_config (&changed_prefs, tmp2, num, type); return TRUE; } -BOOL RPSendMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam, +static BOOL RPSendMessagex (UINT uMessage, WPARAM wParam, LPARAM lParam, LPCVOID pData, DWORD dwDataSize, const RPGUESTINFO *pInfo, LRESULT *plResult) { BOOL v; @@ -179,13 +201,17 @@ static int get_x (void) { int res = currprefs.gfx_resolution; - if (currprefs.gfx_afullscreen) - return RP_SCREENMODE_FULLSCREEN; - if (res == 0) - return RP_SCREENMODE_1X; - if (res == 1) - return RP_SCREENMODE_2X; - return RP_SCREENMODE_4X; + if (WIN32GFX_IsPicassoScreen ()) { + return currprefs.gfx_pfullscreen ? RP_SCREENMODE_FULLSCREEN : RP_SCREENMODE_1X; + } else { + if (currprefs.gfx_afullscreen) + return RP_SCREENMODE_FULLSCREEN; + if (res == 0) + return RP_SCREENMODE_1X; + if (res == 1) + return RP_SCREENMODE_2X; + return RP_SCREENMODE_4X; + } } static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM lParam, @@ -209,13 +235,18 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM uae_reset (wParam == RP_RESET_SOFT ? 0 : -1); return TRUE; case RPIPCHM_TURBO: - warpmode (lParam); + { + if (wParam & RP_TURBO_CPU) + warpmode ((lParam & RP_TURBO_CPU) ? 1 : 0); + if (wParam & RP_TURBO_FLOPPY) + changed_prefs.floppy_speed = (lParam & RP_TURBO_FLOPPY) ? 0 : 100; + } return TRUE; case RPIPCHM_PAUSE: pausemode (wParam ? 1 : 0); return TRUE; case RPIPCHM_VOLUME: - currprefs.sound_volume = changed_prefs.sound_volume = wParam; + currprefs.sound_volume = changed_prefs.sound_volume = 100 - wParam; set_volume (currprefs.sound_volume, 0); return TRUE; case RPIPCHM_ESCAPEKEY: @@ -223,10 +254,12 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM rp_rpescapeholdtime = lParam; return TRUE; case RPIPCHM_MOUSECAPTURE: - if (wParam) - setmouseactive (1); + { + if (wParam & RP_MOUSECAPTURE_CAPTURED) + setmouseactive (1); else setmouseactive (0); + } return TRUE; #if 0 case RPIPCHM_MINIMIZE: @@ -269,21 +302,25 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM { int res = (BYTE)wParam; minimized = 0; - changed_prefs.gfx_afullscreen = 0; - if (res >= RP_SCREENMODE_FULLSCREEN) { - res = 1; - changed_prefs.gfx_afullscreen = 1; + if (WIN32GFX_IsPicassoScreen ()) { + changed_prefs.gfx_pfullscreen = res >= RP_SCREENMODE_FULLSCREEN ? 1 : 0; + } else { + changed_prefs.gfx_afullscreen = 0; + if (res >= RP_SCREENMODE_FULLSCREEN) { + res = 1; + changed_prefs.gfx_afullscreen = 1; + } + changed_prefs.gfx_resolution = res; + if (res == 0) + changed_prefs.gfx_linedbl = 0; + else + changed_prefs.gfx_linedbl = 1; + res = 1 << res; + changed_prefs.gfx_size_win.width = default_width * res; + changed_prefs.gfx_size_win.height = default_height * res; } - changed_prefs.gfx_resolution = res; - if (res == 0) - changed_prefs.gfx_linedbl = 0; - else - changed_prefs.gfx_linedbl = 1; - res = 1 << res; - changed_prefs.gfx_size_win.width = default_width * res; - changed_prefs.gfx_size_win.height = default_height * res; updatewinfsmode (&changed_prefs); - WIN32GFX_DisplayChangeRequested(); + WIN32GFX_DisplayChangeRequested (); hwndset = 0; return (LRESULT)INVALID_HANDLE_VALUE; } @@ -315,7 +352,30 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM xfree (s); return ok ? TRUE : FALSE; } - + case RPIPCHM_SCREENCLIP: + { + RPSCREENCLIP *sc = (RPSCREENCLIP*)pData; + + if (sc->lLeft < 0 || sc->lTop < 0) { + changed_prefs.gfx_xcenter_pos = -1; + changed_prefs.gfx_ycenter_pos = -1; + } else { + changed_prefs.gfx_xcenter_pos = sc->lLeft; + changed_prefs.gfx_ycenter_pos = sc->lTop; + } + if (sc->lWidth <= 0) { + changed_prefs.gfx_size_win.width = default_width; + } else { + changed_prefs.gfx_size_win.width = sc->lWidth << (RES_MAX - currprefs.gfx_resolution); + } + if (sc->lHeight <= 0) { + changed_prefs.gfx_size_win.height = default_height; + } else { + changed_prefs.gfx_size_win.height = sc->lHeight << (currprefs.gfx_linedbl ? 0 : 1); + } + fixup_prefs_dimensions (&changed_prefs); + } + return TRUE; } return FALSE; } @@ -343,6 +403,7 @@ HRESULT rp_init (void) } xfree (rp_param); rp_param = NULL; + mousecapture = 0; return hr; } @@ -351,7 +412,7 @@ void rp_free (void) if (!initialized) return; initialized = 0; - RPSendMessagex(RPIPCGM_CLOSED, 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_CLOSED, 0, 0, NULL, 0, &guestinfo, NULL); RPUninitializeGuest (&guestinfo); } @@ -360,13 +421,23 @@ HWND rp_getparent (void) LRESULT lr; if (!initialized) return 0; - RPSendMessagex(RPIPCGM_PARENT, 0, 0, NULL, 0, &guestinfo, &lr); + RPSendMessagex (RPIPCGM_PARENT, 0, 0, NULL, 0, &guestinfo, &lr); return (HWND)lr; } -void rp_fixup_options (struct uae_prefs *p) +static void sendfeatures (void) { DWORD feat; + + feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN; + feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE; + if (!WIN32GFX_IsPicassoScreen ()) + feat |= RP_FEATURE_SCREEN2X; + RPSendMessagex (RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL); +} + +void rp_fixup_options (struct uae_prefs *p) +{ int i, v; int res; int p96; @@ -401,11 +472,7 @@ void rp_fixup_options (struct uae_prefs *p) else p->gfx_linedbl = 1; - feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN; - feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE; - if (!p96) - feat |= RP_FEATURE_SCREEN2X; - RPSendMessagex(RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL); + sendfeatures (); /* floppy drives */ v = 0; @@ -413,9 +480,9 @@ void rp_fixup_options (struct uae_prefs *p) if (p->dfxtype[i] >= 0) v |= 1 << i; } - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, v, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, v, NULL, 0, &guestinfo, NULL); - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_INPUTPORT, 3, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_INPUTPORT, 3, NULL, 0, &guestinfo, NULL); cd_mask = 0; for (i = 0; i < currprefs.mountitems; i++) { @@ -428,7 +495,7 @@ void rp_fixup_options (struct uae_prefs *p) hd_mask |= 1 << (uci->controller - HD_CONTROLLER_SCSI0); } } - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL); } static void rp_device_change (int dev, int num, const char *name) @@ -477,7 +544,7 @@ void rp_cd_change (int num, int removed) cd_mask &= ~(1 << num); else cd_mask |= 1 << num; - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); } void rp_update_leds (int led, int onoff) @@ -489,13 +556,13 @@ void rp_update_leds (int led, int onoff) switch (led) { case 0: - RPSendMessage(RPIPCGM_POWERLED, onoff ? 100 : 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessage (RPIPCGM_POWERLED, onoff ? 100 : 0, 0, NULL, 0, &guestinfo, NULL); break; case 1: case 2: case 3: case 4: - RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), onoff ? -1 : 0, NULL, 0, &guestinfo, NULL); + RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), onoff ? -1 : 0, NULL, 0, &guestinfo, NULL); break; } } @@ -507,7 +574,7 @@ void rp_hd_activity (int num, int onoff) if (num < 0) return; if (onoff) - RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), 200, NULL, 0, &guestinfo, NULL); + RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), 200, NULL, 0, &guestinfo, NULL); } void rp_cd_activity (int num, int onoff) @@ -518,33 +585,50 @@ void rp_cd_activity (int num, int onoff) return; if ((cd_mask & (1 << num)) != ((onoff ? 1 : 0) << num)) { cd_mask ^= 1 << num; - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); } if (onoff) { - RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), 200, NULL, 0, &guestinfo, NULL); + RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), 200, NULL, 0, &guestinfo, NULL); } } - void rp_update_status (struct uae_prefs *p) { if (!initialized) return; - RPSendMessagex(RPIPCGM_VOLUME, (WPARAM)p->sound_volume, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_VOLUME, (WPARAM)(100 - p->sound_volume), 0, NULL, 0, &guestinfo, NULL); } -void rp_mousecapture (int captured) +static void rp_mouse (void) { - if (!winok()) + int flags = 0; + + if (!initialized) return; - RPSendMessagex(RPIPCGM_MOUSECAPTURE, captured, 0, NULL, 0, &guestinfo, NULL); + if (mousemagic) + flags |= RP_MOUSECAPTURE_MAGICMOUSE; + if (mousecapture) + flags |= RP_MOUSECAPTURE_CAPTURED; + RPSendMessagex (RPIPCGM_MOUSECAPTURE, flags, 0, NULL, 0, &guestinfo, NULL); +} + +void rp_mouse_capture (int captured) +{ + mousecapture = captured; + rp_mouse (); +} + +void rp_mouse_magic (int magic) +{ + mousemagic = magic; + rp_mouse (); } void rp_activate (int active, LPARAM lParam) { if (!initialized) return; - RPSendMessagex(active ? RPIPCGM_ACTIVATED : RPIPCGM_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); + RPSendMessagex (active ? RPIPCGM_ACTIVATED : RPIPCGM_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL); } #if 0 @@ -560,7 +644,7 @@ void rp_turbo (int active) { if (!initialized) return; - RPSendMessagex(RPIPCGM_TURBO, RP_TURBO_CPU, active, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_TURBO, RP_TURBO_CPU, active, NULL, 0, &guestinfo, NULL); } void rp_set_hwnd (HWND hWnd) @@ -570,17 +654,15 @@ void rp_set_hwnd (HWND hWnd) return; rx = get_x (); hwndset = 1; - RPSendMessagex(RPIPCGM_SCREENMODE, rx, (LPARAM)hWnd, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_SCREENMODE, rx, (LPARAM)hWnd, NULL, 0, &guestinfo, NULL); } -#if 0 -void rp_moved (int zorder) +void rp_rtg_switch (void) { - if (!winok()) + if (!initialized) return; - RPSendMessagex(zorder ? RPIPCGM_ZORDER : RPIPCGM_MOVED, 0, 0, NULL, 0, &guestinfo, NULL); + sendfeatures (); } -#endif static uae_u64 esctime; static int ignorerelease; @@ -599,22 +681,19 @@ static uae_u64 gett (void) return li.QuadPart / 10000; } -void rp_hsync (void) +void rp_vsync (void) { uae_u64 t; - static int cnt; if (!initialized) return; - cnt--; - if (cnt > 0) - return; - cnt = 100; + if (magicmouse_alive () != mousemagic) + rp_mouse_magic (magicmouse_alive ()); if (!esctime) return; t = gett (); if (t >= esctime) { - RPSendMessagex(RPIPCGM_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL); ignorerelease = 1; esctime = 0; } diff --git a/od-win32/rp.h b/od-win32/rp.h index 42550abc..9f846c3e 100755 --- a/od-win32/rp.h +++ b/od-win32/rp.h @@ -9,13 +9,15 @@ extern void rp_hd_change (int, int); extern void rp_cd_activity (int, int); extern void rp_cd_change (int, int); extern void rp_activate (int, LPARAM); -extern void rp_mousecapture (int); +extern void rp_mouse_capture (int); +extern void rp_mouse_magic (int); extern void rp_turbo (int); extern void rp_set_hwnd (HWND); extern int rp_checkesc (int, uae_u8*, int, int); extern int rp_isactive (void); -extern void rp_hsync (void); +extern void rp_vsync (void); extern HWND rp_getparent (void); +extern void rp_rtg_switch (void); extern char *rp_param; extern int rp_rpescapekey; diff --git a/od-win32/screenshot.c b/od-win32/screenshot.c index 5fe20d47..8c497a9c 100755 --- a/od-win32/screenshot.c +++ b/od-win32/screenshot.c @@ -236,7 +236,7 @@ int screenshotf (const char *spath, int mode, int doprepare) recursive++; if (!screenshot_prepared || doprepare) { - if (!screenshot_prepare()) + if (!screenshot_prepare ()) goto oops; } diff --git a/od-win32/sys/mman.h b/od-win32/sys/mman.h index 2dfabc7f..fee4ced1 100755 --- a/od-win32/sys/mman.h +++ b/od-win32/sys/mman.h @@ -21,9 +21,11 @@ typedef USHORT ushort; struct shmid_ds { key_t key; size_t size; - void *addr; + void *addr; char name[MAX_PATH]; void *attached; + int mode; + void *natmembase; }; int mprotect (void *addr, size_t len, int prot); diff --git a/od-win32/sysconfig.h b/od-win32/sysconfig.h index db5ef3f3..6b076c06 100755 --- a/od-win32/sysconfig.h +++ b/od-win32/sysconfig.h @@ -47,6 +47,7 @@ #define CPUEMU_12 /* cycle-exact cpu&blitter */ #define ACTION_REPLAY /* Action Replay 1/2/3 support */ #define PICASSO96 /* Picasso96 display card emulation */ +#define UAEGFX_INTERNAL /* built-in libs:picasso96/uaegfx.card */ #define BSDSOCKET /* bsdsocket.library emulation */ #define CAPS /* CAPS-image support */ #define FDI2RAW /* FDI 1.0 and 2.x image support */ diff --git a/od-win32/win32.c b/od-win32/win32.c index b737f239..64430b10 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -387,7 +387,8 @@ void setmouseactive (int active) checkpause (); setmaintitle (hMainWnd); #ifdef RETROPLATFORM - rp_mousecapture (active); + rp_mouse_capture (active); + rp_mouse_magic (magicmouse_alive ()); #endif } @@ -1148,6 +1149,9 @@ void handle_events (void) inputdevicefunc_joystick.read (); inputdevice_handle_inputcode (); check_prefs_changed_gfx (); +#ifdef RETROPLATFORM + rp_vsync (); +#endif while (checkIPC (&currprefs)); if (quit_program) break; @@ -1635,7 +1639,7 @@ uae_u8 *target_load_keyfile (struct uae_prefs *p, char *path, int *sizep, char * extern char *get_aspi_path(int); -static get_aspi(int old) +static get_aspi (int old) { if ((old == UAESCSI_SPTI || old == UAESCSI_SPTISCAN) && os_winnt_admin) return old; @@ -1693,7 +1697,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_automount_cddrives = 0; p->win32_automount_netdrives = 0; p->win32_kbledmode = 0; - p->win32_uaescsimode = get_aspi(p->win32_uaescsimode); + p->win32_uaescsimode = get_aspi (p->win32_uaescsimode); p->win32_borderless = 0; p->win32_powersavedisabled = 1; p->win32_outsidemouse = 0; @@ -1702,13 +1706,14 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_rtgscaleifsmall = 1; } if (type == 1 || type == 0) { - p->win32_uaescsimode = get_aspi(p->win32_uaescsimode); + p->win32_uaescsimode = get_aspi (p->win32_uaescsimode); p->win32_midioutdev = -2; p->win32_midiindev = 0; p->win32_automount_removable = 0; p->win32_automount_drives = 0; p->win32_automount_cddrives = 0; p->win32_automount_netdrives = 0; + p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5PC | RGBFF_B8G8R8A8; } } @@ -1863,12 +1868,17 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value) return result; } +static void createdir (const char *path) +{ + CreateDirectory (path, NULL); +} + void fetch_saveimagepath (char *out, int size, int dir) { fetch_path ("SaveimagePath", out, size); if (dir) { out[strlen (out) - 1] = 0; - CreateDirectory (out, NULL); + createdir (out); fetch_path ("SaveimagePath", out, size); } } @@ -2264,22 +2274,23 @@ static void WIN32_HandleRegistryStuff(void) if (regsetstr (NULL, "ROMCheckVersion", VersionStr)) forceroms = 1; } + regqueryint (NULL, "directdraw_secondary", &ddforceram); regqueryint (NULL, "QuickStartMode", &quickstart); reopen_console(); fetch_path ("ConfigurationPath", path, sizeof (path)); path[strlen (path) - 1] = 0; - CreateDirectory (path, NULL); + createdir (path); strcat (path, "\\Host"); - CreateDirectory (path, NULL); + createdir (path); fetch_path ("ConfigurationPath", path, sizeof (path)); strcat (path, "Hardware"); - CreateDirectory (path, NULL); + createdir (path); fetch_path ("StatefilePath", path, sizeof (path)); - CreateDirectory (path, NULL); + createdir (path); strcat (path, "default.uss"); strcpy (savestate_fname, path); fetch_path ("InputPath", path, sizeof (path)); - CreateDirectory (path, NULL); + createdir (path); regclosetree (read_disk_history ()); read_rom_list (); load_keyring(NULL, NULL); @@ -2514,12 +2525,12 @@ void create_afnewdir(int remove) strcat(tmp, "\\WinUAE"); if (remove) { if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES) { - RemoveDirectory(tmp); - RemoveDirectory(tmp2); + RemoveDirectory (tmp); + RemoveDirectory (tmp2); } } else { - CreateDirectory(tmp2, NULL); - CreateDirectory(tmp, NULL); + CreateDirectory (tmp2, NULL); + CreateDirectory (tmp, NULL); } } } diff --git a/od-win32/win32.h b/od-win32/win32.h index ea2edf09..29fe4888 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 10 +#define WINUAEBETA 11 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 3, 23) +#define WINUAEDATE MAKEBD(2008, 3, 30) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index 4dd4949b..d1a621ef 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -165,11 +165,33 @@ static BOOL doInit (void); uae_u32 default_freq = 0; HWND hStatusWnd = NULL; -uae_u16 picasso96_pixel_format = RGBFF_CHUNKY; static uae_u8 scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */ +static struct MultiDisplay *getdisplay (struct uae_prefs *p) +{ + int i; + int display = p->gfx_display; + + i = 0; + while (Displays[i].name) { + struct MultiDisplay *md = &Displays[i]; + if (p->gfx_display_name[0] && !strcmp (md->name, p->gfx_display_name)) + return md; + if (p->gfx_display_name[0] && !strcmp (md->name2, p->gfx_display_name)) + return md; + i++; + } + if (i == 0) { + gui_message ("no display adapters! Exiting"); + exit (0); + } + if (display >= i) + display = 0; + return &Displays[display]; +} + void centerdstrect (RECT *dr) { if(!(currentmode->flags & (DM_DX_FULLSCREEN | DM_W_FULLSCREEN))) @@ -271,10 +293,10 @@ static HRESULT CALLBACK modesCallback (LPDDSURFACEDESC2 modeDesc, LPVOID context RGBFTYPE colortype; int i, j, ct, depth; - colortype = DirectDraw_GetSurfacePixelFormat(modeDesc); - if (colortype == RGBFB_NONE || colortype == RGBFB_R8G8B8 || colortype == RGBFB_B8G8R8 ) + colortype = DirectDraw_GetSurfacePixelFormat (modeDesc); + if (colortype == RGBFB_NONE) return DDENUMRET_OK; - if (modeDesc->dwWidth > 2048 || modeDesc->dwHeight > 2048) + if (modeDesc->dwWidth > 2560 || modeDesc->dwHeight > 2048) return DDENUMRET_OK; ct = 1 << colortype; depth = 0; @@ -303,7 +325,6 @@ static HRESULT CALLBACK modesCallback (LPDDSURFACEDESC2 modeDesc, LPVOID context } i++; } - picasso96_pixel_format |= ct; i = 0; while (DisplayModes[i].depth >= 0) i++; @@ -386,10 +407,10 @@ BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx, if (guid == 0) { POINT pt = { 0, 0 }; md->primary = 1; - GetMonitorInfo(MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&lpmi); + GetMonitorInfo (MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&lpmi); } else { memcpy (&md->guid, guid, sizeof (GUID)); - GetMonitorInfo(hm, (LPMONITORINFO)&lpmi); + GetMonitorInfo (hm, (LPMONITORINFO)&lpmi); } md->rect = lpmi.rcMonitor; if (md->rect.left == 0 && md->rect.top == 0) @@ -397,6 +418,7 @@ BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx, else sprintf (tmp, "%s (%d*%d) [%d*%d]", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top, md->rect.left, md->rect.top); md->name = my_strdup (tmp); + md->name2 = my_strdup (desc); write_log ("'%s' '%s' %s\n", desc, name, outGUID(guid)); return 1; } @@ -783,7 +805,8 @@ static int open_windows (void) } while (ret < 0); setpriority(&priorities[currprefs.win32_active_priority]); - setmouseactive (-1); + if (!rp_isactive ()) + setmouseactive (-1); for (i = 0; i < NUM_LEDS; i++) gui_led (i, 0); gui_fps (0, 0); @@ -831,9 +854,11 @@ int check_prefs_changed_gfx (void) c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl ? 2 : 0; c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? 1 : 0; c |= currprefs.gfx_display != changed_prefs.gfx_display ? (2|4|8) : 0; + c |= strcmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0; c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 1 : 0; c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 1 : 0; c |= currprefs.win32_rtgmatchdepth != changed_prefs.win32_rtgmatchdepth ? 2 : 0; + c |= currprefs.win32_rtgscaleifsmall != changed_prefs.win32_rtgscaleifsmall ? 2 : 0; if (display_change_requested || c) { @@ -865,9 +890,11 @@ int check_prefs_changed_gfx (void) currprefs.gfx_resolution = changed_prefs.gfx_resolution; currprefs.gfx_linedbl = changed_prefs.gfx_linedbl; currprefs.gfx_display = changed_prefs.gfx_display; + strcpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name); currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop; currprefs.win32_borderless = changed_prefs.win32_borderless; currprefs.win32_rtgmatchdepth = changed_prefs.win32_rtgmatchdepth; + currprefs.win32_rtgscaleifsmall = changed_prefs.win32_rtgscaleifsmall; inputdevice_unacquire (); if (c & 16) { @@ -1098,7 +1125,6 @@ void init_colors (void) AVIOutput_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift); #endif } - alloc_colors_picasso (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0); } #ifdef PICASSO96 @@ -1276,6 +1302,7 @@ void gfx_set_picasso_state (int on) if (screen_is_picasso == on) return; screen_is_picasso = on; + rp_rtg_switch (); memcpy (&wc, currentmode, sizeof (wc)); scalepicasso = 0; @@ -1285,17 +1312,22 @@ void gfx_set_picasso_state (int on) } else { mode = modeswitchneeded (&wc); if (!mode) - return; + goto end; } if (mode < 0) { open_windows (); } else { open_screen (); // reopen everything } +end: +#ifdef RETROPLATFORM + rp_set_hwnd (hAmigaWnd); +#endif } void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt) { + alloc_colors_picasso (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, rgbfmt); if (screen_is_picasso && modeswitchneeded(currentmode)) open_screen (); } @@ -1545,7 +1577,7 @@ static int create_windows (void) } if (fsw) { - rc = Displays[currprefs.gfx_display].rect; + rc = getdisplay (&currprefs)->rect; flags |= WS_EX_TOPMOST; style = WS_POPUP; currentmode->native_width = rc.right - rc.left; @@ -1795,9 +1827,9 @@ static BOOL doInit (void) } #ifdef PICASSO96 - picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch(); - picasso_vidinfo.pixbytes = DirectDraw_GetBytesPerPixel(); - picasso_vidinfo.rgbformat = DirectDraw_GetPixelFormat(); + picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch (); + picasso_vidinfo.pixbytes = DirectDraw_GetBytesPerPixel (); + picasso_vidinfo.rgbformat = DirectDraw_GetPixelFormat (); picasso_vidinfo.extra_mem = 1; picasso_vidinfo.height = currentmode->current_height; picasso_vidinfo.width = currentmode->current_width; @@ -1945,7 +1977,7 @@ void updatedisplayarea (void) void updatewinfsmode (struct uae_prefs *p) { - int i; + struct MultiDisplay *md; fixup_prefs_dimensions (p); if (p->gfx_afullscreen) { @@ -1954,18 +1986,13 @@ void updatewinfsmode (struct uae_prefs *p) p->gfx_size = p->gfx_size_win; } displayGUID = NULL; - i = 0; - while (Displays[i].name) i++; - if (p->gfx_display >= i) - p->gfx_display = 0; - if (Displays[p->gfx_display].disabled) + md = getdisplay (p); + if (md->disabled) { p->gfx_display = 0; - if (i == 0) { - gui_message ("no display adapters! Exiting"); - exit (0); + md = getdisplay (p); } - if (!Displays[p->gfx_display].primary) - displayGUID = &Displays[p->gfx_display].guid; + if (!md->primary) + displayGUID = &md->guid; if (isfullscreen () == 0) displayGUID = NULL; } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 46df619b..babd1eb2 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -113,7 +113,6 @@ extern HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD); #define HtmlHelp(a,b,c,d) if(pHtmlHelp) (*pHtmlHelp)(a,b,c,(LPDWORD)d); else \ { char szMessage[MAX_DPATH]; WIN32GUI_LoadUIString(IDS_NOHELP, szMessage, MAX_DPATH); gui_message(szMessage); } -extern HWND hAmigaWnd; extern char help_file[MAX_DPATH]; extern int mouseactive; @@ -1114,6 +1113,7 @@ static void m(void) mm++; } +static int GetSettings (int all_options, HWND hwnd); /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */ void gui_display (int shortcut) { @@ -1125,11 +1125,11 @@ void gui_display (int shortcut) return; here++; gui_active++; - screenshot_prepare(); + screenshot_prepare (); #ifdef D3D D3D_guimode (TRUE); #endif - setpaused(); + setpaused (); inputdevice_unacquire (); clearallkeys (); setmouseactive (0); @@ -4807,6 +4807,7 @@ static void enable_for_memorydlg (HWND hDlg) { int z3 = ! workprefs.address_space_24; int fast = workprefs.chipmem_size <= 0x200000; + int rtg = workprefs.gfxmem_size && full_property_sheet; #ifndef AUTOCONFIG z3 = FALSE; @@ -4825,6 +4826,13 @@ static void enable_for_memorydlg (HWND hDlg) ew (hDlg, IDC_MBMEM1, z3); ew (hDlg, IDC_MBRAM2, z3); ew (hDlg, IDC_MBMEM2, z3); + + ew (hDlg, IDC_RTG_8BIT, rtg); + ew (hDlg, IDC_RTG_16BIT, rtg); + ew (hDlg, IDC_RTG_24BIT, rtg); + ew (hDlg, IDC_RTG_32BIT, rtg); + ew (hDlg, IDC_RTG_MATCH_DEPTH, rtg); + ew (hDlg, IDC_RTG_SCALE, rtg); } static void values_to_memorydlg (HWND hDlg) @@ -4902,6 +4910,45 @@ static void values_to_memorydlg (HWND hDlg) } SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETPOS, TRUE, mem_size); SetDlgItemText (hDlg, IDC_P96RAM, memsize_names[msi_gfx[mem_size]]); + SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"(8bit)"); + SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"8-bit (*)"); + SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_SETCURSEL, (workprefs.picasso96_modeflags & RGBFF_CLUT) ? 1 : 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"(15/16bit)"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5PC (*)"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5PC"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G6R5PC"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G5R5PC"); + SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_SETCURSEL, + (workprefs.picasso96_modeflags & RGBFF_R5G6B5PC) ? 1 : + (workprefs.picasso96_modeflags & RGBFF_R5G5B5PC) ? 2 : + (workprefs.picasso96_modeflags & RGBFF_R5G6B5) ? 3 : + (workprefs.picasso96_modeflags & RGBFF_R5G5B5) ? 4 : + (workprefs.picasso96_modeflags & RGBFF_B5G6R5PC) ? 5 : + (workprefs.picasso96_modeflags & RGBFF_B5G5R5PC) ? 6 : 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"(24bit)"); + SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8"); + SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8"); + SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_SETCURSEL, + (workprefs.picasso96_modeflags & RGBFF_R8G8B8) ? 1 : + (workprefs.picasso96_modeflags & RGBFF_B8G8R8) ? 2 : 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"(32bit)"); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8R8G8B8"); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8B8G8R8"); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8A8"); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8A8 (*)"); + SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_SETCURSEL, + (workprefs.picasso96_modeflags & RGBFF_A8R8G8B8) ? 1 : + (workprefs.picasso96_modeflags & RGBFF_A8B8G8R8) ? 2 : + (workprefs.picasso96_modeflags & RGBFF_R8G8B8A8) ? 3 : + (workprefs.picasso96_modeflags & RGBFF_B8G8R8A8) ? 4 : 0, 0); + CheckDlgButton (hDlg, IDC_RTG_SCALE, workprefs.win32_rtgscaleifsmall); + CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth); mem_size = 0; switch (workprefs.mbresmem_low_size) { @@ -4940,51 +4987,119 @@ static void fix_values_memorydlg (void) static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + int v; static int recursive = 0; switch (msg) { - case WM_INITDIALOG: - pages[MEMORY_ID] = hDlg; - currentpage = MEMORY_ID; + case WM_INITDIALOG: + pages[MEMORY_ID] = hDlg; + currentpage = MEMORY_ID; - SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM)); - SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM)); - SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM)); - SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_MEM)); - SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM)); - SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM)); - SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM)); + SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM)); + SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM)); + SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM)); + SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_MEM)); + SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM)); + SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM)); + SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM)); - case WM_USER: - recursive++; - fix_values_memorydlg (); - values_to_memorydlg (hDlg); - enable_for_memorydlg (hDlg); - recursive--; + case WM_USER: + recursive++; + fix_values_memorydlg (); + values_to_memorydlg (hDlg); + enable_for_memorydlg (hDlg); + recursive--; break; - case WM_HSCROLL: - workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]]; - workprefs.bogomem_size = memsizes[msi_bogo[SendMessage (GetDlgItem (hDlg, IDC_SLOWMEM), TBM_GETPOS, 0, 0)]]; - workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]]; - workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]]; - workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]]; - workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]]; - workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]]; - fix_values_memorydlg (); - values_to_memorydlg (hDlg); - enable_for_memorydlg (hDlg); + case WM_HSCROLL: + workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]]; + workprefs.bogomem_size = memsizes[msi_bogo[SendMessage (GetDlgItem (hDlg, IDC_SLOWMEM), TBM_GETPOS, 0, 0)]]; + workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]]; + workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]]; + workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]]; + workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]]; + workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]]; + fix_values_memorydlg (); + values_to_memorydlg (hDlg); + enable_for_memorydlg (hDlg); break; - case WM_COMMAND: - if (recursive > 0) - break; - recursive++; - values_to_memorydlg (hDlg); - recursive--; + case WM_COMMAND: + { + uae_u32 mask = workprefs.picasso96_modeflags; + if (recursive > 0) + break; + recursive++; + switch (LOWORD (wParam)) + { + case IDC_RTG_MATCH_DEPTH: + workprefs.win32_rtgmatchdepth = IsDlgButtonChecked (hDlg, IDC_RTG_MATCH_DEPTH); + break; + case IDC_RTG_SCALE: + workprefs.win32_rtgscaleifsmall = IsDlgButtonChecked (hDlg, IDC_RTG_SCALE); + break; + } + if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE) { + switch (LOWORD (wParam)) + { + case IDC_RTG_8BIT: + v = SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + mask &= ~RGBFF_CLUT; + if (v == 1) + mask |= RGBFF_CLUT; + } + break; + case IDC_RTG_16BIT: + v = SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + mask &= ~(RGBFF_R5G6B5PC | RGBFF_R5G5B5PC | RGBFF_R5G6B5 | RGBFF_R5G5B5 | RGBFF_B5G6R5PC | RGBFF_B5G5R5PC); + if (v == 1) + mask |= RGBFF_R5G6B5PC; + if (v == 2) + mask |= RGBFF_R5G5B5PC; + if (v == 3) + mask |= RGBFF_R5G6B5; + if (v == 4) + mask |= RGBFF_R5G5B5; + if (v == 5) + mask |= RGBFF_B5G6R5PC; + if (v == 6) + mask |= RGBFF_B5G5R5PC; + } + break; + case IDC_RTG_24BIT: + v = SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + mask &= ~(RGBFF_R8G8B8 | RGBFF_B8G8R8); + if (v == 1) + mask |= RGBFF_R8G8B8; + if (v == 2) + mask |= RGBFF_B8G8R8; + } + break; + case IDC_RTG_32BIT: + v = SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + mask &= ~(RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8); + if (v == 1) + mask |= RGBFF_A8R8G8B8; + if (v == 2) + mask |= RGBFF_A8B8G8R8; + if (v == 3) + mask |= RGBFF_R8G8B8A8; + if (v == 4) + mask |= RGBFF_B8G8R8A8; + } + break; + } + } + workprefs.picasso96_modeflags = mask; + values_to_memorydlg (hDlg); + recursive--; + } break; - } return FALSE; } @@ -5206,6 +5321,7 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP static void enable_for_miscdlg (HWND hDlg) { + ew (hDlg, IDC_DD_SURFACETYPE, full_property_sheet); if (!full_property_sheet) { ew (hDlg, IDC_JULIAN, TRUE); ew (hDlg, IDC_CTRLF11, TRUE); @@ -5214,7 +5330,6 @@ static void enable_for_miscdlg (HWND hDlg) ew (hDlg, IDC_NOSPEED, TRUE); ew (hDlg, IDC_NOSPEEDPAUSE, TRUE); ew (hDlg, IDC_NOSOUND, TRUE); - ew (hDlg, IDC_RTGMATCHDEPTH, TRUE); ew (hDlg, IDC_DOSAVESTATE, TRUE); ew (hDlg, IDC_SCSIMODE, FALSE); ew (hDlg, IDC_SCSIDEVICE, FALSE); @@ -5362,7 +5477,6 @@ static void values_to_miscdlg (HWND hDlg) CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse); CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile); CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit); - CheckDlgButton (hDlg, IDC_RTGMATCHDEPTH, workprefs.win32_rtgmatchdepth); CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen); CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi == 1); CheckDlgButton (hDlg, IDC_SANA2, workprefs.sana2); @@ -5404,6 +5518,13 @@ static void values_to_miscdlg (HWND hDlg) misc_scsi(hDlg); misc_lang(hDlg); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"NonLocalVRAM"); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"DefaultRAM"); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"LocalVRAM"); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"SystemRAM"); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_SETCURSEL, ddforceram, 0); + } else if (currentpage == MISC2_ID) { CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); @@ -5492,6 +5613,13 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) misc_setlang(v); } break; + case IDC_DD_SURFACETYPE: + v = SendDlgItemMessage(hDlg, IDC_DD_SURFACETYPE, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + ddforceram = v; + regsetint (NULL, "directdraw_secondary", ddforceram); + } + break; } } } else if (currentpage == MISC2_ID) { @@ -5523,9 +5651,6 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_JULIAN: workprefs.win32_middle_mouse = IsDlgButtonChecked(hDlg, IDC_JULIAN); break; - case IDC_RTGMATCHDEPTH: - workprefs.win32_rtgmatchdepth = IsDlgButtonChecked(hDlg, IDC_RTGMATCHDEPTH); - break; case IDC_SHOWLEDS: workprefs.leds_on_screen = IsDlgButtonChecked(hDlg, IDC_SHOWLEDS); break; diff --git a/od-win32/win32gui.h b/od-win32/win32gui.h index 5716ea2e..ed56cc6a 100755 --- a/od-win32/win32gui.h +++ b/od-win32/win32gui.h @@ -10,7 +10,6 @@ #define CONFIG_DELETE 4 void WIN32GUI_LoadUIString( DWORD id, char *string, DWORD dwStringLen ); -extern int GetSettings (int all_options, HWND); extern int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *); void InitializeListView( HWND hDlg ); extern void pre_gui_message (const char*,...); diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 6a92e19a..a3d4c854 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -2542,7 +2542,7 @@ > diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 5c7bada8..db554bd7 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,29 @@ +Beta 11: + +- uaegfx.card is now WinUAE built-in, libs:picasso96/uaegfx.card is not + needed anymore (and is ignored if it exists) +- resolution names in display preferences are now named + "UAE:x" instead of "uaegfx:x" +- added new Picasso96 options to GUI +- 24-bit display depth Picasso96 blitter routines implemented/updated +- added all Picasso96 supported color depth modes, defaults are + old standard PC modes (palette mode, R5G6B5PC and B8G8R8A8) + NOTES: + - only one 8-bit,15/16-bit, 24-bit and 32-bit mode supported + simultaneously + - All "new" modes require color space conversion = slower. + - Not all mode color space conversions yet supported (black screen) + - Can be useful with old RTG compatible demos or games that require + specific "non-pc" display color modes +- added "Display buffer" option to misc-panel (stored to registry) +- "FS" scale setting is now the default +- refresh whole screen using very optimized routine if >80% of + Picasso96 screen needs refreshing (faster than partial update) +- Marvin's Marvellous Adventure clouds/score interference fixed + (It was really stupid bug, can only happen with AGA sprites) +- Skid Marks hires mode car sprite problem fixed (b10) + Beta 10: - MOVEM is not weird in debugger anymore @@ -11,8 +36,11 @@ Beta 10: was shorter than expected - disable hardware sprite if uaegfx.card is old version without hardware sprite support and devs:monitors/info has softsprite=no -- added -ddforceram and -ddforcevram debugging command line params - try -ddforceram if you have slow P96Speed results +- adjusted DirectDraw surface allocation parameters, perhaps helps + with P96Speed differences +- added -ddforcemode command line parameter, if you have slow + P96Speed results compared to 1.4.6, try mode values from 1 to 3 and + report results. Beta 9: diff --git a/od-win32/writelog.c b/od-win32/writelog.c index 4272bd10..660f7313 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -304,7 +304,7 @@ void write_log (const char *format, ...) fprintf(debugfile, ts); fprintf(debugfile, bufp); if (!bootlogmode) - fflush(debugfile); + ;//fflush(debugfile); } lfdetected = 0; if (strlen(bufp) > 0 && bufp[strlen(bufp) - 1] == '\n') diff --git a/p96_blit.c b/p96_blit.c index 62f790d1..5aaf1d27 100755 --- a/p96_blit.c +++ b/p96_blit.c @@ -1,4 +1,39 @@ +#if BLT_SIZE == 3 +static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch) +{ + uae_u8 *src2 = src; + uae_u8 *dst2 = dst; + uae_u32 *src2_32 = (uae_u32*)src; + uae_u32 *dst2_32 = (uae_u32*)dst; + unsigned int y, x, ww, xxd; +#ifdef BLT_TEMP + uae_u32 tmp; +#endif + w *= BLT_SIZE; + ww = w / 4; + xxd = w - (ww * 4); + for(y = 0; y < h; y++) { + uae_u8 *src_8; + uae_u8 *dst_8; + uae_u32 *src_32 = (uae_u32*)src2; + uae_u32 *dst_32 = (uae_u32*)dst2; + for (x = 0; x < ww; x++) { + BLT_FUNC (src_32, dst_32); + src_32++; dst_32++; + } + src_8 = (uae_u8*)src_32; + dst_8 = (uae_u8*)dst_32; + for (x = 0; x < xxd; x++) { + BLT_FUNC (src_8, dst_8); + src_8++; + dst_8++; + } + dst2 += dstpitch; + src2 += srcpitch; + } +} +#else static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch) { uae_u8 *src2 = src; @@ -98,6 +133,7 @@ static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_ src2 += srcpitch; } } +#endif #undef BLT_NAME #undef BLT_FUNC #ifdef BLT_TEMP