From 4f16a29e873e4122afc375d8210b279aabcf78f6 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 25 Oct 2007 18:37:58 +0300 Subject: [PATCH] imported winuaesrc1450b4.zip --- cdtv.c | 45 +++- cfgfile.c | 14 +- custom.c | 124 +++++----- drawing.c | 313 ++++++++++++++++++------ fdi2raw.c | 8 +- genlinetoscr.c | 98 ++++++-- include/drawing.h | 1 - include/options.h | 2 +- memory.c | 39 ++- newcpu.c | 2 +- od-win32/dinput.c | 129 ++++++---- od-win32/direct3d.c | 6 +- od-win32/opengl.c | 6 +- od-win32/resources/resource | 2 +- od-win32/resources/winuae.rc | 7 +- od-win32/scaler_more.c | 2 +- od-win32/win32.c | 23 +- od-win32/win32.h | 5 +- od-win32/win32gfx.c | 12 +- od-win32/win32gui.c | 19 +- od-win32/winuae_msvc/winuae_msvc.vcproj | 4 + od-win32/winuaechangelog.txt | 32 +++ sana2.c | 35 +++ 23 files changed, 668 insertions(+), 260 deletions(-) diff --git a/cdtv.c b/cdtv.c index de93d5ce..42c7f20f 100755 --- a/cdtv.c +++ b/cdtv.c @@ -29,7 +29,6 @@ #include "a2091.h" #include "uae.h" - /* DMAC CNTR bits. */ #define CNTR_TCEN (1<<7) #define CNTR_PREST (1<<6) @@ -74,13 +73,14 @@ static volatile uae_u32 dmac_acr; static volatile int dmac_wtc; static volatile int dmac_dma; -static volatile int activate_stch, cdrom_command_done, play_state, play_statewait; +static volatile int activate_stch, cdrom_command_done, play_state, play_state_cmd, play_statewait; static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset; static volatile int cd_playing, cd_paused, cd_motor, cd_media, cd_error, cd_finished, cd_isready, cd_hunt; static volatile int cdtv_hsync, dma_finished, cdtv_sectorsize; static volatile uae_u64 dma_wait; static int first; +static int cd_volume; static void do_stch(void); @@ -136,6 +136,15 @@ static int get_toc(void) return 1; } +static void finished_cdplay (void) +{ + cd_audio_status = AUDIO_STATUS_PLAY_COMPLETE; + cd_playing = 0; + cd_finished = 1; + cd_paused = 0; + do_stch (); +} + static int get_qcode(void) { uae_u8 *s; @@ -149,15 +158,10 @@ static int get_qcode(void) if (cd_playing) { if (s[1] == AUDIO_STATUS_IN_PROGRESS) { int end = msf2lsn((s[5 + 4] << 16) | (s[6 + 4] << 8) | (s[7 + 4])); - if (end >= play_end - 75) { - cd_audio_status = AUDIO_STATUS_PLAY_COMPLETE; - cd_playing = 0; - do_stch(); - } + if (end >= play_end - 75) + finished_cdplay (); } else if (s[1] == AUDIO_STATUS_PLAY_COMPLETE) { - cd_audio_status = AUDIO_STATUS_PLAY_COMPLETE; - cd_playing = 0; - do_stch(); + finished_cdplay (); } } s[1] = cd_audio_status; @@ -251,6 +255,7 @@ static int play_cdtrack (uae_u8 *p) write_log ("PLAY CD AUDIO from %d-%d, %06.6X (%d) to %06.6X (%d)\n", track_start, track_end, start, msf2lsn(start), end, msf2lsn(end)); play_state = 1; + play_state_cmd = 1; return 0; } @@ -289,6 +294,7 @@ static int play_cd(uae_u8 *p) write_log ("PLAY CD AUDIO from %06.6X (%d) to %06.6X (%d)\n", start, msf2lsn(start), end, msf2lsn(end)); play_state = 1; + play_state_cmd = 1; return 0; } @@ -692,6 +698,7 @@ static void tp_check_interrupts(void) static void tp_bput (int addr, uae_u8 v) { + static int volstrobe1, volstrobe2; #ifdef CDTV_DEBUG_6525 write_log ("6525 write %x=%02.2X PC=%x\n", addr, v, M68K_GETPC); #endif @@ -726,6 +733,23 @@ static void tp_bput (int addr, uae_u8 v) enable = (tp_b >> 1) & 1; xaen = (tp_b >> 2) & 1; dten = (tp_b >> 3) & 1; + + if (!volstrobe1 && ((tp_b >> 6) & 1)) { + cd_volume >>= 1; + cd_volume |= ((tp_b >> 5) & 1) << 11; + volstrobe1 = 1; + } else if (volstrobe1 && !((tp_b >> 6) & 1)) { + volstrobe1 = 0; + } + if (!volstrobe2 && ((tp_b >> 7) & 1)) { +#ifdef CDTV_DEBUG_CMD + write_log ("CDTV CD volume = %d\n", cd_volume); +#endif + cd_volume = 0; + volstrobe2 = 1; + } else if (volstrobe2 && !((tp_b >> 7) & 1)) { + volstrobe2 = 0; + } } static uae_u8 tp_bget(int addr) @@ -872,6 +896,7 @@ void CDTV_hsync_handler(void) if (play_state == 1) { play_state = 2; cd_playing = 1; + cd_motor = 1; activate_stch = 1; play_statewait = 5; } else if (play_statewait > 0) { diff --git a/cfgfile.c b/cfgfile.c index ae1fde39..93384eaf 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -136,6 +136,8 @@ static const char *flushmode[] = { "soft", "hard", 0 }; static const char *kbleds[] = { "none", "POWER", "DF0", "DF1", "DF2", "DF3", "HD", "CD", 0 }; static const char *soundfiltermode1[] = { "off", "emulated", "on", 0 }; static const char *soundfiltermode2[] = { "standard", "enhanced", 0 }; +static const char *lorestype1[] = { "lores", "hires", "superhires" }; +static const char *lorestype2[] = { "true", "false" }; static const char *loresmode[] = { "normal", "filtered", 0 }; #ifdef GFXFILTER static const char *filtermode1[] = { "no_16", "bilinear_16", "no_32", "bilinear_32", 0 }; @@ -492,7 +494,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite (f, "gfx_autoresolution=%d\n", p->gfx_autoresolution); cfgfile_dwrite (f, "gfx_vsync=%s\n", p->gfx_avsync ? "true" : "false"); cfgfile_dwrite (f, "gfx_vsync_picasso=%s\n", p->gfx_pvsync ? "true" : "false"); - cfgfile_dwrite (f, "gfx_lores=%s\n", p->gfx_lores ? "true" : "false"); + cfgfile_dwrite (f, "gfx_lores=%s\n", p->gfx_resolution == 0 ? "true" : "false"); + cfgfile_dwrite (f, "gfx_resolution=%s\n", lorestype1[p->gfx_resolution]); cfgfile_dwrite (f, "gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]); cfgfile_dwrite (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]); cfgfile_dwrite (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false"); @@ -884,7 +887,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) || cfgfile_yesno (option, value, "filesys_no_fsdb", &p->filesys_no_uaefsdb) || cfgfile_yesno (option, value, "gfx_vsync", &p->gfx_avsync) || cfgfile_yesno (option, value, "gfx_vsync_picasso", &p->gfx_pvsync) - || cfgfile_yesno (option, value, "gfx_lores", &p->gfx_lores) || cfgfile_yesno (option, value, "gfx_correct_aspect", &p->gfx_correct_aspect) || cfgfile_yesno (option, value, "show_leds", &p->leds_on_screen) || cfgfile_yesno (option, value, "synchronize_clock", &p->tod_hack) @@ -899,9 +901,11 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode1, 1) || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode2, 1) || cfgfile_strval (option, value, "use_gui", &p->start_gui, guimode3, 0) + || cfgfile_strval (option, value, "gfx_resolution", &p->gfx_resolution, lorestype1, 0) + || cfgfile_strval (option, value, "gfx_lores", &p->gfx_resolution, lorestype2, 0) + || cfgfile_strval (option, value, "gfx_lores_mode", &p->gfx_lores_mode, loresmode, 0) || cfgfile_strval (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen, fullmodes, 0) || cfgfile_strval (option, value, "gfx_fullscreen_picasso", &p->gfx_pfullscreen, fullmodes, 0) - || cfgfile_strval (option, value, "gfx_lores_mode", &p->gfx_lores_mode, loresmode, 0) || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode1, 1) || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode2, 0) || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1) @@ -1959,7 +1963,7 @@ static void parse_gfx_specs (struct uae_prefs *p, char *spec) p->gfx_size_win.width = p->gfx_size_fs.width = atoi (x0); p->gfx_size_win.height = p->gfx_size_fs.height = atoi (x1); - p->gfx_lores = strchr (x2, 'l') != 0; + p->gfx_resolution = strchr (x2, 'l') != 0 ? 1 : 0; p->gfx_xcenter = strchr (x2, 'x') != 0 ? 1 : strchr (x2, 'X') != 0 ? 2 : 0; p->gfx_ycenter = strchr (x2, 'y') != 0 ? 1 : strchr (x2, 'Y') != 0 ? 2 : 0; p->gfx_linedbl = strchr (x2, 'd') != 0; @@ -2820,7 +2824,7 @@ void default_prefs (struct uae_prefs *p, int type) p->gfx_size_win_xtra[i].width = 0; p->gfx_size_win_xtra[i].height = 0; } - p->gfx_lores = 0; + p->gfx_resolution = 1; p->gfx_linedbl = 1; p->gfx_afullscreen = 0; p->gfx_pfullscreen = 0; diff --git a/custom.c b/custom.c index a92f2fc9..3466edf9 100755 --- a/custom.c +++ b/custom.c @@ -200,7 +200,8 @@ static uae_u16 sprdata[MAX_SPRITES][1], sprdatb[MAX_SPRITES][1]; #endif static int sprite_last_drawn_at[MAX_SPRITES]; static int last_sprite_point, nr_armed; -static int sprite_width, sprres, sprite_buffer_res; +static int sprite_width, sprres; +int sprite_buffer_res; #ifdef CPUEMU_12 uae_u8 cycle_line[256]; @@ -788,6 +789,8 @@ static void compute_toscr_delay_1 (void) { int delay1 = (bplcon1 & 0x0f) | ((bplcon1 & 0x0c00) >> 6); int delay2 = ((bplcon1 >> 4) & 0x0f) | (((bplcon1 >> 4) & 0x0c00) >> 6); + int shdelay1 = (bplcon1 >> 12) & 3; + int shdelay2 = (bplcon1 >> 8) & 3; int delaymask; int fetchwidth = 16 << fetchmode; @@ -795,7 +798,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_delay2x = (delay2 & delaymask) << toscr_res; + toscr_delay2x |= shdelay2 >> (2 - toscr_res); } static void compute_toscr_delay (int hpos) @@ -1651,6 +1656,31 @@ static void record_register_change (int hpos, int regno, unsigned long value) typedef int sprbuf_res_t, cclockres_t, hwres_t, bplres_t; +static int expand_sprres (uae_u16 con0, uae_u16 con3) +{ + int res; + + switch ((con3 >> 6) & 3) { + case 0: /* ECS defaults (LORES,HIRES=LORES sprite,SHRES=HIRES sprite) */ + if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && GET_RES (con0) == RES_SUPERHIRES) + res = RES_HIRES; + else + res = RES_LORES; + break; + /* AGA */ + case 1: + res = RES_LORES; + break; + case 2: + res = RES_HIRES; + break; + case 3: + res = RES_SUPERHIRES; + break; + } + return res; +} + /* handle very rarely needed playfield collision (CLXDAT bit 0) */ static void do_playfield_collisions (void) { @@ -1817,39 +1847,21 @@ static void do_sprite_collisions (void) #endif } -static void expand_sprres (void) -{ - switch ((bplcon3 >> 6) & 3) { - case 0: /* ECS defaults (LORES,HIRES=140ns,SHRES=70ns) */ - if ((currprefs.chipset_mask & CSMASK_ECS_DENISE) && GET_RES (bplcon0) == RES_SUPERHIRES) - sprres = RES_HIRES; - else - sprres = RES_LORES; - break; - case 1: - sprres = RES_LORES; - break; - case 2: - sprres = RES_HIRES; - break; - case 3: - sprres = RES_SUPERHIRES; - break; - } -} - STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int dbl, - unsigned int mask, int do_collisions, uae_u32 collision_mask) + int do_collisions, uae_u32 collision_mask) { int j = 0; while (datab) { unsigned int tmp = *buf; unsigned int col = (datab & 3) << (2 * num); tmp |= col; - if ((j & mask) == 0) + *buf++ = tmp; + if (dbl > 0) *buf++ = tmp; - if (dbl) + if (dbl > 1) { *buf++ = tmp; + *buf++ = tmp; + } j++; datab >>= 2; if (do_collisions) { @@ -1868,8 +1880,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 ECS), or in hires pixels - (if AGA). No support for SHRES sprites. */ + The data is recorded either in lores pixels (if ECS), or in superhires + pixels (if AGA). */ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl) { @@ -1878,24 +1890,15 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 int word_offs; uae_u16 *buf; uae_u32 collision_mask; - int width = sprite_width; - int dbl = 0, half = 0; - unsigned int mask = 0; + int width, dbl, half; - if (sprres != RES_LORES) - thisline_decision.any_hires_sprites = 1; - -#ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) { - width = (width << 1) >> sprres; - dbl = sprite_buffer_res - sprres; - if (dbl < 0) { - half = -dbl; - dbl = 0; - } - mask = sprres == RES_SUPERHIRES ? 1 : 0; + half = 0; + dbl = sprite_buffer_res - sprres; + if (dbl < 0) { + half = -dbl; + dbl = 0; } -#endif + width = (sprite_width << sprite_buffer_res) >> sprres; /* Try to coalesce entries if they aren't too far apart. */ if (! next_sprite_forced && e[-1].max + 16 >= sprxp) { @@ -1924,9 +1927,9 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 buf = spixels + word_offs + ((i << dbl) >> half); if (currprefs.collision_level > 0 && collision_mask) - record_sprite_1 (buf, datab, num, dbl, mask, 1, collision_mask); + record_sprite_1 (buf, datab, num, dbl, 1, collision_mask); else - record_sprite_1 (buf, datab, num, dbl, mask, 0, collision_mask); + record_sprite_1 (buf, datab, num, dbl, 0, collision_mask); data++; datb++; } @@ -1971,15 +1974,19 @@ static void decide_sprites (int hpos) count = 0; for (i = 0; i < MAX_SPRITES; i++) { int sprxp = spr[i].xpos; - int hw_xp = (sprxp >> sprite_buffer_res); + int hw_xp = sprxp >> sprite_buffer_res; int window_xp = coord_hw_to_window_x (hw_xp) + (DIW_DDF_OFFSET << lores_shift); int j, bestp; if (!((debug_sprite_mask) & (1 << i))) continue; - if (! spr[i].armed || sprxp < 0 || hw_xp <= last_sprite_point || hw_xp > point) + if (! spr[i].armed) + continue; + + if (sprxp < 0 || hw_xp <= last_sprite_point || hw_xp > point) continue; + if ( !(bplcon3 & 2) && /* sprites outside playfields enabled? */ ((thisline_decision.diwfirstword >= 0 && window_xp + window_width < thisline_decision.diwfirstword) || (thisline_decision.diwlastword >= 0 && window_xp > thisline_decision.diwlastword))) @@ -2100,7 +2107,7 @@ static void finish_decisions (void) record_diw_line (thisline_decision.plfleft, diwfirstword, diwlastword); if (thisline_decision.plfleft != -1 || (bplcon3 & 2)) - decide_sprites (hpos); + decide_sprites (hpos + 1); dip->last_sprite_entry = next_sprite_entry; dip->last_color_change = next_color_change; @@ -2138,7 +2145,6 @@ static void reset_decisions (void) return; thisline_decision.bplres = GET_RES (bplcon0); - thisline_decision.any_hires_sprites = 0; thisline_decision.nr_planes = 0; thisline_decision.plfleft = -1; @@ -2297,7 +2303,7 @@ void init_hz (void) minfirstline = maxvpos - 1; sprite_vblank_endline = minfirstline - 2; maxvpos_max = maxvpos; - doublescan = htotal <= MAXHPOS / 2; + doublescan = htotal <= 140; dumpsync(); reset_drawing (); } @@ -2844,7 +2850,7 @@ static void BPLCON0 (int hpos, uae_u16 v) #ifdef AGA if (currprefs.chipset_mask & CSMASK_AGA) { decide_sprites (hpos); - expand_sprres (); + sprres = expand_sprres (bplcon0, bplcon3); } #endif @@ -2886,7 +2892,7 @@ STATIC_INLINE void BPLCON3 (int hpos, uae_u16 v) decide_line (hpos); decide_sprites (hpos); bplcon3 = v; - expand_sprres (); + sprres = expand_sprres (bplcon0, bplcon3); record_register_change (hpos, 0x106, v); } @@ -3144,15 +3150,11 @@ STATIC_INLINE void SPRxCTLPOS (int num) sprstartstop (s); sprxp = (sprpos[num] & 0xFF) * 2 + (sprctl[num] & 1); + sprxp <<= sprite_buffer_res; /* Quite a bit salad in this register... */ #ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) { - /* We ignore the SHRES 35ns increment for now; SHRES support doesn't - work anyway, so we may as well restrict AGA sprites to a 70ns - resolution. */ - sprxp <<= 1; - sprxp |= (sprctl[num] >> 4) & 1; - } + if (currprefs.chipset_mask & CSMASK_AGA) + sprxp |= ((sprctl[num] >> 3) & 3) >> (2 - sprite_buffer_res); #endif s->xpos = sprxp; s->vstart = (sprpos[num] >> 8) | ((sprctl[num] << 6) & 0x100); @@ -4717,7 +4719,7 @@ void customreset (int hardreset) bogusframe = 1; - sprite_buffer_res = currprefs.chipset_mask & CSMASK_AGA ? RES_HIRES : RES_LORES; + sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : ((currprefs.chipset_mask & CSMASK_ECS_DENISE) ? RES_HIRES : RES_LORES); if (savestate_state == STATE_RESTORE) { uae_u16 v; uae_u32 vv; @@ -4765,7 +4767,7 @@ void customreset (int hardreset) events_schedule (); } } - expand_sprres (); + sprres = expand_sprres (bplcon0, bplcon3); #ifdef ACTION_REPLAY /* Doing this here ensures we can use the 'reset' command from within AR */ diff --git a/drawing.c b/drawing.c index dbd639cb..698fc252 100755 --- a/drawing.c +++ b/drawing.c @@ -50,7 +50,21 @@ #endif #include "savestate.h" +extern int sprite_buffer_res; + int lores_factor, lores_shift; + +static void lores_reset (void) +{ + lores_factor = currprefs.gfx_resolution ? 2 : 1; + lores_shift = currprefs.gfx_resolution; + if (doublescan) { + if (lores_shift < 2) + lores_shift++; + lores_factor = 2; + } +} + int aga_mode; /* mirror of chipset_mask & CSMASK_AGA */ int direct_rgb; @@ -93,8 +107,9 @@ struct vidbuf_description gfxvidinfo; /* OCS/ECS color lookup table. */ xcolnr xcolors[4096]; +static uae_u8 spritepixels[MAX_PIXELS_PER_LINE * 4]; /* used when sprite resolution > lores */ + #ifdef AGA -static uae_u8 spriteagadpfpixels[MAX_PIXELS_PER_LINE * 2]; /* AGA dualplayfield sprite */ /* AGA mode color lookup tables */ unsigned int xredcolors[256], xgreencolors[256], xbluecolors[256]; static int dblpf_ind1_aga[256], dblpf_ind2_aga[256]; @@ -116,8 +131,8 @@ union { double uupzuq; long int cruxmedo; uae_u8 apixels[MAX_PIXELS_PER_LINE * 2]; - uae_u16 apixels_w[MAX_PIXELS_PER_LINE * 2 / 2]; - uae_u32 apixels_l[MAX_PIXELS_PER_LINE * 2 / 4]; + uae_u16 apixels_w[MAX_PIXELS_PER_LINE * 2 / sizeof (uae_u16)]; + uae_u32 apixels_l[MAX_PIXELS_PER_LINE * 2 / sizeof (uae_u32)]; } pixdata; #ifdef OS_WITHOUT_MEMORY_MANAGEMENT @@ -178,7 +193,7 @@ static int first_block_line, last_block_line; /* These are generated by the drawing code from the line_decisions array for each line that needs to be drawn. These are basically extracted out of bit fields in the hardware registers. */ -static int bplehb, bplham, bpldualpf, bpldualpfpri, bpldualpf2of, bplplanecnt, bplres; +static int bplehb, bplham, bpldualpf, bpldualpfpri, bpldualpf2of, bplplanecnt, bplres, issprites; static int plf1pri, plf2pri; static uae_u32 plf_sprite_mask; static int sbasecol[2] = { 16, 16 }; @@ -242,10 +257,18 @@ STATIC_INLINE void count_frame (void) framecnt = 1; } +STATIC_INLINE int xshift (int x, int shift) +{ + if (shift < 0) + return x >> (-shift); + else + return x << shift; +} + int coord_native_to_amiga_x (int x) { x += visible_left_border; - x <<= (1 - lores_shift); + x = xshift (x, 1 - lores_shift); return x + 2 * DISPLAY_LEFT_SHIFT - 2 * DIW_DDF_OFFSET; } @@ -302,7 +325,7 @@ void record_diw_line (int plfstrt, int first, int last) static int playfield_start, playfield_end; static int real_playfield_start, real_playfield_end; -static int pixels_offset; +static int pixels_offset, sprite_pixels_offset; static int src_pixel; /* How many pixels in window coordinates which are to the left of the left border. */ static int unpainted; @@ -373,8 +396,11 @@ static void pfield_init_linetoscr (void) res_shift = lores_shift - bplres; ddf_left -= DISPLAY_LEFT_SHIFT; + pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres); + sprite_pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << sprite_buffer_res); + if (sprite_pixels_offset > pixels_offset) + sprite_pixels_offset = pixels_offset; ddf_left <<= bplres; - pixels_offset = MAX_PIXELS_PER_LINE - ddf_left; unpainted = visible_left_border < playfield_start ? 0 : visible_left_border - playfield_start; src_pixel = MAX_PIXELS_PER_LINE + res_shift_from_window (playfield_start - native_ddf_left + unpainted); @@ -530,21 +556,62 @@ static int linetoscr_double_offset; static void pfield_do_linetoscr (int start, int stop) { xlinecheck(start, stop); + if (issprites && ((currprefs.chipset_mask & CSMASK_AGA) || sprite_buffer_res > 0)) { + if (res_shift == 0) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_aga_spr (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_aga_spr (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_aga_spr (src_pixel, start, stop); break; + } + } else if (res_shift == 2) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_stretch2_aga_spr (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_stretch2_aga_spr (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_stretch2_aga_spr (src_pixel, start, stop); break; + } + } else if (res_shift == 1) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_stretch1_aga_spr (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_stretch1_aga_spr (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_stretch1_aga_spr (src_pixel, start, stop); break; + } + } else if (res_shift < 0) { + if (currprefs.gfx_lores_mode) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_shrink2_aga_spr (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_shrink2_aga_spr (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_shrink2_aga_spr (src_pixel, start, stop); break; + } + } else { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_shrink1_aga_spr (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_shrink1_aga_spr (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_shrink1_aga_spr (src_pixel, start, stop); break; + } + } + } + } else #ifdef AGA if (currprefs.chipset_mask & CSMASK_AGA) { - if (res_shift == 0) + if (res_shift == 0) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_aga (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16_aga (src_pixel, start, stop); break; case 4: src_pixel = linetoscr_32_aga (src_pixel, start, stop); break; } - else if (res_shift > 0) + } else if (res_shift == 2) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_stretch2_aga (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_stretch2_aga (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_stretch2_aga (src_pixel, start, stop); break; + } + } else if (res_shift == 1) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_stretch1_aga (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16_stretch1_aga (src_pixel, start, stop); break; case 4: src_pixel = linetoscr_32_stretch1_aga (src_pixel, start, stop); break; } - else if (res_shift < 0) + } else if (res_shift < 0) { if (currprefs.gfx_lores_mode) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_shrink2_aga (src_pixel, start, stop); break; @@ -558,21 +625,29 @@ static void pfield_do_linetoscr (int start, int stop) case 4: src_pixel = linetoscr_32_shrink1_aga (src_pixel, start, stop); break; } } - } else { + } + } else #endif - if (res_shift == 0) + if (1) { + if (res_shift == 0) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8 (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16 (src_pixel, start, stop); break; case 4: src_pixel = linetoscr_32 (src_pixel, start, stop); break; } - else if (res_shift > 0) + } else if (res_shift == 2) { + switch (gfxvidinfo.pixbytes) { + case 1: src_pixel = linetoscr_8_stretch2 (src_pixel, start, stop); break; + case 2: src_pixel = linetoscr_16_stretch2 (src_pixel, start, stop); break; + case 4: src_pixel = linetoscr_32_stretch2 (src_pixel, start, stop); break; + } + } else if (res_shift == 1) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_stretch1 (src_pixel, start, stop); break; case 2: src_pixel = linetoscr_16_stretch1 (src_pixel, start, stop); break; case 4: src_pixel = linetoscr_32_stretch1 (src_pixel, start, stop); break; } - else if (res_shift < 0) + } else if (res_shift < 0) { if (currprefs.gfx_lores_mode) { switch (gfxvidinfo.pixbytes) { case 1: src_pixel = linetoscr_8_shrink2 (src_pixel, start, stop); break; @@ -586,9 +661,8 @@ static void pfield_do_linetoscr (int start, int stop) case 4: src_pixel = linetoscr_32_shrink1 (src_pixel, start, stop); break; } } -#ifdef AGA + } } -#endif } static void pfield_do_fill_line (int start, int stop) @@ -768,17 +842,27 @@ static void gen_pfield_tables (void) #define SPRITE_DEBUG 0 +STATIC_INLINE void sprpixel (int *xpos, int *spr_level, int spr_level_max, uae_u8 col) +{ + spritepixels[(*spr_level) * MAX_PIXELS_PER_LINE + (*xpos)] = col; + (*spr_level)++; + if ((*spr_level) >= spr_level_max) { + *spr_level = 0; + (*xpos)++; + } +} + /* When looking at this function and the ones that inline it, bear in mind what an optimizing compiler will do with this code. All callers of this function only pass in constant arguments (except for E). This means that many of the if statements will go away completely after inlining. */ -STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, - int doubling, int skip, int has_attach, int aga) +STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf, + int posdoubling, int posskip, int sizedoubling, int sizeskip, int has_attach, int aga) { int *shift_lookup = dualpf ? (bpldualpfpri ? dblpf_ms2 : dblpf_ms1) : dblpf_ms; uae_u16 *buf = spixels + e->first_pixel; uae_u8 *stbuf = spixstate.bytes + e->first_pixel; - int pos, window_pos; + int pos, window_pos, spr_level, spr_level_max; #ifdef AGA uae_u8 xor_val = (uae_u8)(dp_for_drawing->bplcon4 >> 8); #endif @@ -786,13 +870,21 @@ STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, buf -= e->pos; stbuf -= e->pos; - window_pos = e->pos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << (aga ? 1 : 0)); - if (skip) - window_pos >>= 1; - else if (doubling) - window_pos <<= 1; + 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) { + spr_level_max = 1 << res_shift; + spr_level = window_pos & (spr_level_max - 1); + } + + if (posskip) + window_pos >>= posskip; + else if (posdoubling) + window_pos <<= posdoubling; window_pos += pixels_offset; - for (pos = e->pos; pos < e->max; pos += 1 << skip) { + + for (pos = e->pos; pos < e->max; pos += 1 << sizeskip) { int maskshift, plfmask; unsigned int v = buf[pos]; @@ -853,72 +945,143 @@ STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, } col += (offs * 2); } + if (dualpf) { #ifdef AGA if (aga) { - spriteagadpfpixels[window_pos] = col; - if (doubling) - spriteagadpfpixels[window_pos + 1] = col; + + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling) + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling > 1) { + sprpixel (&window_pos, &spr_level, spr_level_max, col); + sprpixel (&window_pos, &spr_level, spr_level_max, col); + } + } else { #endif col += 128; - if (doubling) + if (sizedoubling) pixdata.apixels_w[window_pos >> 1] = col | (col << 8); else pixdata.apixels[window_pos] = col; + window_pos += 1 << sizedoubling; #ifdef AGA } #endif } else if (ham) { + col = color_reg_get (&colors_for_drawing, col); #ifdef AGA - if (aga) - col ^= xor_val; + if (aga) { + + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling) + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling > 1) { + sprpixel (&window_pos, &spr_level, spr_level_max, col); + sprpixel (&window_pos, &spr_level, spr_level_max, col); + } + + } else { +#endif + ham_linebuf[window_pos] = col; + if (sizedoubling) + ham_linebuf[window_pos + 1] = col; + if (sizedoubling > 1) { + ham_linebuf[window_pos + 2] = col; + ham_linebuf[window_pos + 3] = col; + } + window_pos += 1 << sizedoubling; +#ifdef AGA + } #endif - ham_linebuf[window_pos] = col; - if (doubling) - ham_linebuf[window_pos + 1] = col; } else { #ifdef AGA - if (aga) - col ^= xor_val; + if (aga) { + + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling) + sprpixel (&window_pos, &spr_level, spr_level_max, col); + if (sizedoubling > 1) { + sprpixel (&window_pos, &spr_level, spr_level_max, col); + sprpixel (&window_pos, &spr_level, spr_level_max, col); + } + + } else { +#endif + if (sizedoubling > 1) { + pixdata.apixels_w[window_pos >> 1] = col | (col << 8); + pixdata.apixels_w[(window_pos >> 1) + 1] = col | (col << 8); + } else if (sizedoubling) { + pixdata.apixels_w[window_pos >> 1] = col | (col << 8); + } else { + pixdata.apixels[window_pos] = col; + } + window_pos += 1 << sizedoubling; +#ifdef AGA + } #endif - if (doubling) - pixdata.apixels_w[window_pos >> 1] = col | (col << 8); - else - pixdata.apixels[window_pos] = col; + } + + } else { + + if (aga) { + if (spr_level_max) { + spr_level += 1 << sizedoubling; + while(spr_level >= spr_level_max) { + spr_level -= spr_level_max; + window_pos++; + } + } else { + window_pos += 1 << sizedoubling; + } + } else { + window_pos += 1 << sizedoubling; } } - window_pos += 1 << doubling; + } } +STATIC_INLINE void draw_sprites_1 (struct sprite_entry *e, int ham, int dualpf, + int doubling, int skip, int has_attach) +{ + draw_sprites_2 (e, ham, dualpf, doubling, skip, doubling, skip, has_attach, 0); +} /* See comments above. Do not touch if you don't know what's going on. * (We do _not_ want the following to be inlined themselves). */ /* lores bitplane, lores sprites */ -static void NOINLINE draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0, 0); } -static void NOINLINE draw_sprites_normal_dp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 0, 0); } -static void NOINLINE draw_sprites_ham_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 0, 0); } -static void NOINLINE draw_sprites_normal_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 1, 0); } -static void NOINLINE draw_sprites_normal_dp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 1, 0); } -static void NOINLINE draw_sprites_ham_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_dp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 0); } +static void NOINLINE draw_sprites_ham_sp_lo_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 0); } +static void NOINLINE draw_sprites_normal_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 0, 0, 1); } +static void NOINLINE draw_sprites_normal_dp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 0, 0, 1); } +static void NOINLINE draw_sprites_ham_sp_lo_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 0, 0, 1); } /* hires bitplane, lores sprites */ -static void NOINLINE draw_sprites_normal_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 0, 0); } -static void NOINLINE draw_sprites_normal_dp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 0, 0); } -static void NOINLINE draw_sprites_ham_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 0, 0); } -static void NOINLINE draw_sprites_normal_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 1, 0); } -static void NOINLINE draw_sprites_normal_dp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 1, 0); } -static void NOINLINE draw_sprites_ham_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 1, 0); } +static void NOINLINE draw_sprites_normal_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 0); } +static void NOINLINE draw_sprites_normal_dp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 0); } +static void NOINLINE draw_sprites_ham_sp_hi_nat (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 0); } +static void NOINLINE draw_sprites_normal_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 0, 1, 0, 1); } +static void NOINLINE draw_sprites_normal_dp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 0, 1, 1, 0, 1); } +static void NOINLINE draw_sprites_ham_sp_hi_at (struct sprite_entry *e) { draw_sprites_1 (e, 1, 0, 1, 0, 1); } #ifdef AGA /* not very optimized */ STATIC_INLINE void draw_sprites_aga (struct sprite_entry *e) { - int diff = RES_HIRES - bplres; - if (diff > 0) - draw_sprites_1 (e, dp_for_drawing->ham_seen, bpldualpf, 0, diff, e->has_attached, 1); - else - draw_sprites_1 (e, dp_for_drawing->ham_seen, bpldualpf, -diff, 0, e->has_attached, 1); + int sizediff = sprite_buffer_res - lores_shift; + int posdiff = sprite_buffer_res - bplres; + int sizediff2 = 0, posdiff2 = 0; + if (sizediff < 0) { + sizediff2 = -sizediff; + sizediff = 0; + } + if (posdiff < 0) { + posdiff2 = -posdiff; + posdiff = 0; + } + draw_sprites_2 (e, dp_for_drawing->ham_seen, bpldualpf, posdiff2, posdiff, sizediff2, sizediff, e->has_attached, 1); } #endif @@ -988,12 +1151,12 @@ static void weird_bitplane_fix (void) if (shift < 0) { shift = -shift; - for (i = playfield_start << lores_shift; i < playfield_end << lores_shift; i++) { + for (i = xshift (playfield_start, lores_shift); i < xshift (playfield_end, lores_shift); i++) { if (pixdata.apixels[pixels_offset + i] > 16) pixdata.apixels[pixels_offset + i] = 16; } } else { - for (i = playfield_start >> lores_shift; i < playfield_end >> lores_shift; i++) { + for (i = xshift (playfield_start, lores_shift); i < xshift (playfield_end, lores_shift); i++) { if (pixdata.apixels[pixels_offset + i] > 16) pixdata.apixels[pixels_offset + i] = 16; } @@ -1154,7 +1317,7 @@ static void init_aspect_maps (void) if (currprefs.gfx_correct_aspect) native_lines_per_amiga_line = ((double)gfxvidinfo.height - * (currprefs.gfx_lores ? 320 : 640) + * (320 << lores_shift) / (linedbld ? 512 : 256) / gfxvidinfo.width); else @@ -1274,9 +1437,8 @@ static void pfield_expand_dp_bplcon (void) bplres = dp_for_drawing->bplres; bplplanecnt = dp_for_drawing->nr_planes; bplham = dp_for_drawing->ham_seen; + issprites = dip_for_drawing->nr_sprites; - if (doublescan) - bplres >>= 1; if (bplres > 0) frame_res = 1; if (bplres > 0) @@ -1504,10 +1666,6 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) if (border == 0) { pfield_expand_dp_bplcon (); - - if (bplres == RES_LORES && ! currprefs.gfx_lores) - currprefs.gfx_lores = 2; - pfield_init_linetoscr (); pfield_doline (lineno); @@ -1538,7 +1696,7 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) #endif for (i = 0; i < dip_for_drawing->nr_sprites; i++) { #ifdef AGA - if (currprefs.chipset_mask & CSMASK_AGA) + if ((currprefs.chipset_mask & CSMASK_AGA) || sprite_buffer_res > RES_LORES) draw_sprites_aga (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i); else #endif @@ -1559,8 +1717,6 @@ static void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) memcpy (row_map[follow_ypos], row_map[gfx_ypos], gfxvidinfo.pixbytes * gfxvidinfo.width); do_flush_line (follow_ypos); } - if (currprefs.gfx_lores == 2) - currprefs.gfx_lores = 0; } else if (border == 1) { int dosprites = 0; @@ -1646,7 +1802,7 @@ static void center_image (void) visible_left_border = (max_diwstop - min_diwstart - w) / 2 + min_diwstart; else visible_left_border = max_diwstop - w - (max_diwstop - min_diwstart - w) / 2; - visible_left_border &= ~((1 << lores_shift) - 1); + visible_left_border &= ~((xshift (1, lores_shift)) - 1); /* Would the old value be good enough? If so, leave it as it is if we want to * be clever. */ @@ -1654,8 +1810,11 @@ static void center_image (void) if (visible_left_border < prev_x_adjust && prev_x_adjust < min_diwstart && min_diwstart - visible_left_border <= 32) visible_left_border = prev_x_adjust; } - } else + } else { visible_left_border = max_diwlastword - gfxvidinfo.width; + if (doublescan) + visible_left_border = max_diwlastword / 2 - gfxvidinfo.width; + } if (visible_left_border > max_diwlastword - 32) visible_left_border = max_diwlastword - 32; if (visible_left_border < 0) @@ -1707,12 +1866,6 @@ static void center_image (void) min_diwstart = 10000; } -static void lores_reset (void) -{ - lores_factor = currprefs.gfx_lores ? 1 : 2; - lores_shift = currprefs.gfx_lores ? 0 : 1; -} - #define FRAMES_UNTIL_RES_SWITCH 5 static int frame_res_cnt; static void init_drawing_frame (void) @@ -1728,10 +1881,10 @@ static void init_drawing_frame (void) while (m < 4) { struct wh *src = currprefs.gfx_afullscreen ? &currprefs.gfx_size_fs_xtra[m] : &currprefs.gfx_size_win_xtra[m]; if ((src->width > 0 && src->height > 0) || (currprefs.gfx_autoresolution && currprefs.gfx_filter > 0)) { - changed_prefs.gfx_lores = (m & 2) == 0 ? 1 : 0; + changed_prefs.gfx_resolution = (m & 2) == 0 ? 0 : 1; changed_prefs.gfx_linedbl = (m & 1) == 0 ? 0 : 1; if (currprefs.gfx_autoresolution) { - changed_prefs.gfx_filter_horiz_zoom_mult = 1000 / (changed_prefs.gfx_lores + 1); + changed_prefs.gfx_filter_horiz_zoom_mult = 1000 / (changed_prefs.gfx_resolution); changed_prefs.gfx_filter_vert_zoom_mult = (changed_prefs.gfx_linedbl + 1) * 500; } else { *dst = *src; diff --git a/fdi2raw.c b/fdi2raw.c index 69014b59..87ab7a9c 100755 --- a/fdi2raw.c +++ b/fdi2raw.c @@ -113,7 +113,7 @@ static void *fdi_malloc (int size) #define MAX_DST_BUFFER 40000 #define MAX_MFM_SYNC_BUFFER 60000 #define MAX_TIMING_BUFFER 400000 -#define MAX_TRACKS 166 +#define MAX_TRACKS 168 struct fdi_cache { uae_u32 *avgp, *minp, *maxp; @@ -2046,8 +2046,10 @@ FDI *fdi2raw_header(struct zfile *f) fdi->last_track = ((fdi->header[142] << 8) + fdi->header[143]) + 1; fdi->last_track *= fdi->header[144] + 1; - if (fdi->last_track > MAX_TRACKS) - fdi->last_track = MAX_TRACKS; + if (fdi->last_track >= MAX_TRACKS) { + write_log ("FDI: last_track >= MAX_TRACKS (%d >= %d)\n", fdi->last_track, MAX_TRACKS); + fdi->last_track = MAX_TRACKS - 1; + } fdi->last_head = fdi->header[144]; fdi->disk_type = fdi->header[145]; fdi->rotation_speed = fdi->header[146] + 128; diff --git a/genlinetoscr.c b/genlinetoscr.c index 0bf5c6e6..b94a8537 100755 --- a/genlinetoscr.c +++ b/genlinetoscr.c @@ -46,6 +46,7 @@ typedef enum { HMODE_NORMAL, HMODE_DOUBLE, + HMODE_DOUBLE2X, HMODE_HALVE, HMODE_HALVE2 } HMODE_T; @@ -55,6 +56,8 @@ static const char *get_hmode_str (HMODE_T hmode) { if (hmode == HMODE_DOUBLE) return "_stretch1"; + else if (hmode == HMODE_DOUBLE2X) + return "_stretch2"; else if (hmode == HMODE_HALVE) return "_shrink1"; else if (hmode == HMODE_HALVE2) @@ -108,11 +111,11 @@ void outlnf (const char *s, ...) fputc ('\n', outfile); } -static void out_linetoscr_decl (DEPTH_T bpp, HMODE_T hmode, int aga) +static void out_linetoscr_decl (DEPTH_T bpp, HMODE_T hmode, int aga, int spr) { - outlnf ("static int NOINLINE linetoscr_%s%s%s (int spix, int dpix, int stoppos)", + outlnf ("static int NOINLINE linetoscr_%s%s%s%s (int spix, int dpix, int stoppos)", get_depth_str (bpp), - get_hmode_str (hmode), aga ? "_aga" : ""); + get_hmode_str (hmode), aga ? "_aga" : "", spr ? "_spr" : ""); } static void out_linetoscr_do_srcpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode) @@ -130,9 +133,9 @@ static void out_linetoscr_do_dstpix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_ else if (cmode == CMODE_HAM) outln ( " dpix_val = xcolors[ham_linebuf[spix]];"); else if (aga && cmode == CMODE_DUALPF) { - outln ( " if (spriteagadpfpixels[spix]) {"); - outln ( " dpix_val = colors_for_drawing.acolors[spriteagadpfpixels[spix]];"); - outln ( " spriteagadpfpixels[spix] = 0;"); + outln ( " if (spritepixels[spix]) {"); + outln ( " dpix_val = colors_for_drawing.acolors[spritepixels[spix]];"); + outln ( " spritepixels[spix] = 0;"); outln ( " } else {"); outln ( " unsigned int val = lookup[spix_val];"); outln ( " if (lookup_no[spix_val] == 2)"); @@ -172,7 +175,18 @@ static void out_linetoscr_do_incspix (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE outln ( " spix++;"); } -static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmode) +static void out_sprite (int off) +{ + outlnf ( " if (spritepixels[sprx + MAX_PIXELS_PER_LINE * %d]) {", off); + outlnf ( " buf[dpix] = colors_for_drawing.acolors[spritepixels[sprx + MAX_PIXELS_PER_LINE * %d]];", off); + outlnf ( " spritepixels[sprx + MAX_PIXELS_PER_LINE * %d] = 0;", off); + outlnf ( " } else {"); + outlnf ( " buf[dpix] = out_val;"); + outlnf ( " }"); + outlnf ( " dpix++;"); +} + +static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CMODE_T cmode) { int old_indent = set_indent (8); @@ -185,7 +199,7 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmo /* TODO: add support for combining pixel writes in 8-bpp modes. */ - if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE) { + if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && spr == 0) { outln ( "int rem;"); outln ( "if (((long)&buf[dpix]) & 2) {"); outln ( " uae_u32 spix_val;"); @@ -208,6 +222,8 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmo outln ( "while (dpix < stoppos) {"); + if (spr) + outln ( " int sprx = spix;"); outln ( " uae_u32 spix_val;"); outln ( " uae_u32 dpix_val;"); outln ( " uae_u32 out_val;"); @@ -221,7 +237,7 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmo outln ( " out_val = dpix_val;"); - if (hmode != HMODE_DOUBLE && bpp == DEPTH_16BPP) { + if (hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && bpp == DEPTH_16BPP && spr == 0) { out_linetoscr_do_srcpix (bpp, hmode, aga, cmode); out_linetoscr_do_dstpix (bpp, hmode, aga, cmode); out_linetoscr_do_incspix (bpp, hmode, aga, cmode); @@ -240,21 +256,53 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmo outln ( " *((uae_u32 *)&buf[dpix]) = out_val;"); outln ( " dpix += 2;"); } else { - outln ( " buf[dpix++] = out_val;"); - outln ( " buf[dpix++] = out_val;"); + if (spr) { + out_sprite (0); + out_sprite (1); + } else { + outln ( " buf[dpix++] = out_val;"); + outln ( " buf[dpix++] = out_val;"); + } + } + } else if (hmode == HMODE_DOUBLE2X) { + if (bpp == DEPTH_8BPP) { + outln ( " *((uae_u32 *)&buf[dpix]) = (uae_u32) out_val;"); + outln ( " dpix += 4;"); + } else if (bpp == DEPTH_16BPP) { + outln ( " *((uae_u32 *)&buf[dpix]) = out_val;"); + outln ( " dpix += 2;"); + outln ( " *((uae_u32 *)&buf[dpix]) = out_val;"); + outln ( " dpix += 2;"); + } else { + if (spr) { + out_sprite (0); + out_sprite (1); + out_sprite (2); + out_sprite (3); + } else { + outln ( " buf[dpix++] = out_val;"); + outln ( " buf[dpix++] = out_val;"); + outln ( " buf[dpix++] = out_val;"); + outln ( " buf[dpix++] = out_val;"); + } } } else { if (bpp == DEPTH_16BPP) { outln ( " *((uae_u32 *)&buf[dpix]) = out_val;"); outln ( " dpix += 2;"); - } else - outln ( " buf[dpix++] = out_val;"); + } else { + if (spr) { + out_sprite (0); + } else { + outln ( " buf[dpix++] = out_val;"); + } + } } outln ( "}"); - if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE) { + if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && spr == 0) { outln ( "if (rem) {"); outln ( " uae_u32 spix_val;"); outln ( " uae_u32 dpix_val;"); @@ -274,12 +322,12 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, CMODE_T cmo return; } -static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga) +static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga, int spr) { if (aga) outln ("#ifdef AGA"); - out_linetoscr_decl (bpp, hmode, aga); + out_linetoscr_decl (bpp, hmode, aga, spr); outln ( "{"); outlnf ( " %s *buf = (%s *) xlinebuffer;", get_depth_type_str (bpp), get_depth_type_str (bpp)); @@ -288,13 +336,13 @@ static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga) outln ( ""); outln ( " if (dp_for_drawing->ham_seen) {"); - out_linetoscr_mode (bpp, hmode, aga, CMODE_HAM); + out_linetoscr_mode (bpp, hmode, aga, spr, CMODE_HAM); outln ( " } else if (bpldualpf) {"); - out_linetoscr_mode (bpp, hmode, aga, CMODE_DUALPF); + out_linetoscr_mode (bpp, hmode, aga, spr, CMODE_DUALPF); outln ( " } else if (bplehb) {"); - out_linetoscr_mode (bpp, hmode, aga, CMODE_EXTRAHB); + out_linetoscr_mode (bpp, hmode, aga, spr, CMODE_EXTRAHB); outln ( " } else {"); - out_linetoscr_mode (bpp, hmode, aga, CMODE_NORMAL); + out_linetoscr_mode (bpp, hmode, aga, spr, CMODE_NORMAL); outln ( " }\n"); outln ( " return spix;"); @@ -308,7 +356,7 @@ static void out_linetoscr (DEPTH_T bpp, HMODE_T hmode, int aga) int main (int argc, char *argv[]) { DEPTH_T bpp; - int aga; + int aga, spr; HMODE_T hmode; unsigned int i; @@ -332,8 +380,12 @@ int main (int argc, char *argv[]) for (bpp = DEPTH_8BPP; bpp <= DEPTH_MAX; bpp++) { for (aga = 0; aga <= 1 ; aga++) { - for (hmode = HMODE_NORMAL; hmode <= HMODE_MAX; hmode++) - out_linetoscr (bpp, hmode, aga); + for (spr = 0; spr <= 1; spr++) { + if (spr && !aga) + continue; + for (hmode = HMODE_NORMAL; hmode <= HMODE_MAX; hmode++) + out_linetoscr (bpp, hmode, aga, spr); + } } } return 0; diff --git a/include/drawing.h b/include/drawing.h index 027d1f06..083fe5d2 100755 --- a/include/drawing.h +++ b/include/drawing.h @@ -219,7 +219,6 @@ struct decision { #endif uae_u8 nr_planes; uae_u8 bplres; - unsigned int any_hires_sprites:1; unsigned int ham_seen:1; unsigned int ham_at_start:1; unsigned int valid:1; diff --git a/include/options.h b/include/options.h index d0241ef6..1751034d 100755 --- a/include/options.h +++ b/include/options.h @@ -151,7 +151,7 @@ struct uae_prefs { int gfx_autoresolution; int gfx_refreshrate; int gfx_avsync, gfx_pvsync; - int gfx_lores; + int gfx_resolution; int gfx_lores_mode; int gfx_linedbl; int gfx_correct_aspect; diff --git a/memory.c b/memory.c index c417e5d6..478d6dfa 100755 --- a/memory.c +++ b/memory.c @@ -124,6 +124,9 @@ static struct romheader romheaders[] = { { NULL, 0 } }; +#define ALTROM(id,grp,num,size,flags,crc32,a,b,c,d,e) \ + { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, crc32, a, b, c, d, e }, + static struct romdata roms[] = { { "Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 2069, 0, 0, 1, ROMTYPE_KEY, 0, 0, 0x869ae1b1, 0x801bbab3,0x2e3d3738,0x6dd1636d,0x4f1d6fa7,0xe21d5874 }, @@ -186,6 +189,8 @@ static struct romdata roms[] = { { "CDTV extended ROM v1.00", 1, 0, 1, 0, "CDTV\0", 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0, 0x42baa124, 0x7BA40FFA,0x17E500ED,0x9FED041F,0x3424BD81,0xD9C907BE }, + ALTROM(20, 1, 1, 131072, ROMTYPE_EVEN, 0x791cb14b,0x277a1778,0x92449635,0x3ffe56be,0x68063d2a,0x334360e4) + ALTROM(20, 1, 2, 131072, ROMTYPE_ODD, 0xaccbbc2e,0x41b06d16,0x79c6e693,0x3c3378b7,0x626025f7,0x641ebc5c) { "CDTV extended ROM v2.07", 2, 7, 2, 7, "CDTV\0", 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0, 0xceae68d2, 0x5BC114BB,0xA29F60A6,0x14A31174,0x5B3E2464,0xBFA06846 }, { "CDTV extended ROM v2.30", 2, 30, 2, 30, "CDTV\0", 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0, @@ -195,6 +200,9 @@ static struct romdata roms[] = { 0x62f11c04, 0xC87F9FAD,0xA4EE4E69,0xF3CCA0C3,0x6193BE82,0x2B9F5FE6 }, { "A1000 bootstrap ROM", 0, 0, 0, 0, "A1000\0", 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0, 0x0b1ad2d0, 0xBA93B8B8,0x5CA0D83A,0x68225CC3,0x3B95050D,0x72D2FDD7 }, + ALTROM(23, 1, 1, 65536, 0, 0x0b1ad2d0,0xBA93B8B8,0x5CA0D83A,0x68225CC3,0x3B95050D,0x72D2FDD7) + ALTROM(23, 2, 1, 4096, ROMTYPE_EVEN, 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b) + ALTROM(23, 2, 2, 4096, ROMTYPE_ODD , 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3) { "Freezer: Action Replay Mk I v1.00", 1, 0, 1, 0, "AR\0", 65536, 52, 0, 0, ROMTYPE_AR, 0, 1, 0x2d921771, 0x1EAD9DDA,0x2DAD2914,0x6441F5EF,0x72183750,0x22E01248 }, @@ -219,15 +227,24 @@ static struct romdata roms[] = { 0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 }, { "Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1, 0x9e70c231, 0xa2977a1c,0x41a8ca7d,0x4af4a168,0x726da542,0x179d5963 }, + ALTROM(65, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0xf98742e4,0xe8e683ba,0xd8b38d1f,0x79f3ad83,0xa9e67c6f,0xa91dc96c) + ALTROM(65, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED, 0xdfb9984b,0x8d6bdd49,0x469ec8e2,0x0143fbb3,0x72e92500,0x99f07910) { "Freezer: X-Power Professional 500 v1.3", 1, 2, 1, 2, "XPOWER\0", 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1, 0x31e057f0, 0x84650266,0x465d1859,0x7fd71dee,0x00775930,0xb7e450ee }, + ALTROM(68, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0x0b2ce0c7,0x45ad5456,0x89192404,0x956f47ce,0xf66a5274,0x57ace33b) + ALTROM(68, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED, 0x34580c35,0x8ad42566,0x7364f238,0x978f4381,0x08f8d5ec,0x470e72ea) { "Freezer: Nordic Power v1.5", 1, 5, 1, 5, "NPOWER\0", 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1, 0x83b4b21c, 0xc56ced25,0x506a5aab,0x3fa13813,0x4fc9e5ae,0x0f9d3709 }, + ALTROM(69, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0xdd207174,0xae67652d,0x64f5db20,0x0f4b2110,0xee59567f,0xfbd90a1b) + ALTROM(69, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED, 0x8f93d85d,0x73c62d21,0x40c0c092,0x6315b702,0xdd5d0f05,0x3dad7fab) { "Freezer: Nordic Power v2.0", 2, 0, 2, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, 0xa4db2906, 0x0aec68f7,0x25470c89,0x6b699ff4,0x6623dec5,0xc777466e }, + ALTROM(67, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0xb21be46c,0x50dc607c,0xce976bbd,0x3841eaf0,0x591ddc7e,0xa1939ad2) + ALTROM(67, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED, 0x96057aed,0xdd9209e2,0x1d5edfc1,0xcdb52abe,0x93de0f35,0xc43da696) { "Freezer: Nordic Power v3.0", 3, 0, 3, 0, "NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, 0x72850aef, 0x59c91d1f,0xa8f118f9,0x0bdba05a,0x9ae788d7,0x7a6cc7c9 }, - + ALTROM(70, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0xf3330e1f,0x3a597db2,0xb7d11b6c,0xb8e13496,0xc215f223,0x88c4ca3c) + ALTROM(70, 1, 2, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED, 0xee58e0f9,0x4148f4cb,0xb42cec33,0x8ca144de,0xd4f54118,0xe0f185dd) { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, 0xffffffff, 0, 0, 0, 0, 0, "HRTMon" }, @@ -289,6 +306,8 @@ struct romlist **getromlistbyident(int ver, int rev, int subver, int subrev, cha rd = rl[i].rd; else rd = &roms[i]; + if (rd->group) + continue; if (model && !strcmpi(model, rd->name)) ok = 2; if (rd->ver == ver && (rev < 0 || rd->rev == rev)) { @@ -348,7 +367,7 @@ struct romdata *getarcadiarombyname (char *name) { int i; for (i = 0; roms[i].name; i++) { - if (roms[i].type == ROMTYPE_ARCADIAGAME || roms[i].type == ROMTYPE_ARCADIAGAME) { + if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIAGAME || roms[i].type == ROMTYPE_ARCADIAGAME)) { char *p = roms[i].name; p = p + strlen (p) + 1; if (strlen (name) >= strlen (p) + 4) { @@ -369,7 +388,7 @@ struct romlist **getarcadiaroms(void) max = 0; for (i = 0; roms[i].name; i++) { - if (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME) + if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME)) max++; } buf = xmalloc((sizeof (struct romlist*) + sizeof (struct romlist)) * (max + 1)); @@ -377,7 +396,7 @@ struct romlist **getarcadiaroms(void) rltmp = (struct romlist*)((uae_u8*)buf + (max + 1) * sizeof (struct romlist*)); out = 0; for (i = 0; roms[i].name; i++) { - if (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME) { + if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME)) { rdout[out++] = rltmp; rltmp->path = NULL; rltmp->rd = &roms[i]; @@ -594,9 +613,11 @@ struct romdata *getromdatabyname (char *name) char tmp[MAX_PATH]; int i = 0; while (roms[i].name) { - getromname (&roms[i], tmp); - if (!strcmp (tmp, name) || !strcmp (roms[i].name, name)) - return &roms[i]; + if (!roms[i].group) { + getromname (&roms[i], tmp); + if (!strcmp (tmp, name) || !strcmp (roms[i].name, name)) + return &roms[i]; + } i++; } return 0; @@ -606,7 +627,7 @@ struct romdata *getromdatabyid (int id) { int i = 0; while (roms[i].name) { - if (id == roms[i].id) + if (id == roms[i].id && roms[i].group == 0) return &roms[i]; i++; } @@ -624,7 +645,7 @@ struct romdata *getromdatabycrc (uae_u32 crc32) { int i = 0; while (roms[i].name) { - if (crc32 == roms[i].crc32 && !notcrc32(crc32)) + if (roms[i].group == 0 && crc32 == roms[i].crc32 && !notcrc32(crc32)) return &roms[i]; i++; } diff --git a/newcpu.c b/newcpu.c index 561b5e64..81db3cb1 100755 --- a/newcpu.c +++ b/newcpu.c @@ -2238,7 +2238,7 @@ void exec_nostats (void) do_cycles (cpu_cycles); - if (end_block (opcode) || r->spcflags) + if (end_block (opcode) || r->spcflags || uae_int_requested) return; /* We will deal with the spcflags in the caller */ } } diff --git a/od-win32/dinput.c b/od-win32/dinput.c index 84acd5cb..3a62b953 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -91,7 +91,7 @@ static int dd_inited, mouse_inited, keyboard_inited, joystick_inited; static int stopoutput; static HANDLE kbhandle = INVALID_HANDLE_VALUE; static int oldleds, oldusedleds, newleds, oldusbleds; -static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode; +static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode, winmousewheelbuttonstart; static int normalkb, superkb, rawkb; int no_rawinput, dinput_enum_all; @@ -102,6 +102,10 @@ int dinput_winmouse (void) return winmousenumber; return -1; } +int dinput_wheelbuttonstart (void) +{ + return winmousewheelbuttonstart; +} int dinput_winmousemode (void) { if (winmouse) @@ -120,29 +124,40 @@ static void fixbuttons (struct didata *did) did->buttons++; } -#define AXISBUTTON 0x20000 -#define AXISBUTTON_2 0x10000 +static void addplusminus (struct didata *did, int i) +{ + char tmp[256]; + int j; + + if (did->buttons + 1 >= MAX_MAPPINGS) + return; + for (j = 0; j < 2; j++) { + sprintf (tmp, "%s [%c]", did->axisname[i], j ? '+' : '-'); + did->buttonname[did->buttons] = my_strdup (tmp); + did->buttonmappings[did->buttons] = did->axismappings[i]; + did->buttonsort[did->buttons] = 1000 + (did->axismappings[i] + did->axistype[i]) * 2 + j; + did->axisparent[did->buttons] = i; + did->axisparentdir[did->buttons] = j; + did->buttons++; + } +} static void fixthings (struct didata *did) { - int i, j; - char tmp[256]; + int i; + + for (i = 0; i < did->axles; i++) + addplusminus (did, i); +} +static void fixthings_mouse (struct didata *did) +{ + int i; for (i = 0; i < did->axles; i++) { - if (did->buttons + 1 >= MAX_MAPPINGS) - break; - for (j = 0; j < 2; j++) { - sprintf (tmp, "%s [%c]", did->axisname[i], j ? '+' : '-'); - did->buttonname[did->buttons] = my_strdup (tmp); - did->buttonmappings[did->buttons] = did->axismappings[i]; - did->buttonsort[did->buttons] = 1000 + (did->axismappings[i] + did->axistype[i]) * 2 + j; - did->axisparent[did->buttons] = i; - did->axisparentdir[did->buttons] = j; - did->buttons++; - } + if (did->axissort[i] == -97) + addplusminus (did, i); } } - typedef BOOL (CALLBACK* REGISTERRAWINPUTDEVICES) (PCRAWINPUTDEVICE, UINT, UINT); static REGISTERRAWINPUTDEVICES pRegisterRawInputDevices; @@ -396,6 +411,11 @@ static int initialize_rawinput (void) write_log ("id=%d buttons=%d hw=%d rate=%d\n", rdim->dwId, rdim->dwNumberOfButtons, rdim->fHasHorizontalWheel, rdim->dwSampleRate); did->buttons = rdim->dwNumberOfButtons; + for (j = 0; j < did->buttons; j++) { + did->buttonsort[j] = j; + sprintf (tmp, "Button %d", j + 1); + did->buttonname[j] = my_strdup (tmp); + } did->axles = 3; did->axissort[0] = 0; did->axisname[0] = my_strdup ("X-Axis"); @@ -403,15 +423,12 @@ static int initialize_rawinput (void) did->axisname[1] = my_strdup ("Y-Axis"); did->axissort[2] = 2; did->axisname[2] = my_strdup ("Wheel"); + addplusminus (did, 2); if (rdim->fHasHorizontalWheel) { did->axissort[3] = 3; did->axisname[3] = my_strdup ("HWheel"); did->axles++; - } - for (j = 0; j < did->buttons; j++) { - did->buttonsort[j] = j; - sprintf (tmp, "Button %d", j + 1); - did->buttonname[j] = my_strdup (tmp); + addplusminus (did, 3); } did->priority = -1; } else { @@ -459,6 +476,12 @@ static void initialize_windowsmouse (void) did->buttons = 5; /* no non-direcinput support for >5 buttons */ if (did->buttons > 3 && !os_winnt) did->buttons = 3; /* Windows 98/ME support max 3 non-DI buttons */ + for (j = 0; j < did->buttons; j++) { + did->buttonsort[j] = j; + sprintf (tmp, "Button %d", j + 1); + did->buttonname[j] = my_strdup (tmp); + } + winmousewheelbuttonstart = did->buttons; did->axles = os_vista ? 4 : 3; did->axissort[0] = 0; did->axisname[0] = my_strdup ("X-Axis"); @@ -467,15 +490,12 @@ static void initialize_windowsmouse (void) if (did->axles > 2) { did->axissort[2] = 2; did->axisname[2] = my_strdup ("Wheel"); + addplusminus (did, 2); } if (did->axles > 3) { did->axissort[3] = 3; did->axisname[3] = my_strdup ("HWheel"); - } - for (j = 0; j < did->buttons; j++) { - did->buttonsort[j] = j; - sprintf (tmp, "Button %d", j + 1); - did->buttonname[j] = my_strdup (tmp); + addplusminus (did, 3); } did->priority = 2; did->wininput = i + 1; @@ -530,8 +550,17 @@ static void handle_rawinput_2 (RAWINPUT *raw) } } } - if (rm->usButtonFlags & RI_MOUSE_WHEEL) - setmousestate (num, 2, (int)rm->usButtonData, 0); + if (rm->usButtonFlags & RI_MOUSE_WHEEL) { + int val = (int)rm->usButtonData; + int bnum = did->buttons - 2; + if (did->axles == 3) + bnum -= 2; + setmousestate (num, 2, val, 0); + if (val < 0) + setmousebuttonstate (num, bnum + 0, -1); + else if (val > 0) + setmousebuttonstate (num, bnum + 1, -1); + } setmousestate (num, 0, rm->lLastX, (rm->usFlags & MOUSE_MOVE_ABSOLUTE) ? 1 : 0); setmousestate (num, 1, rm->lLastY, (rm->usFlags & MOUSE_MOVE_ABSOLUTE) ? 1 : 0); } @@ -776,7 +805,7 @@ static BOOL CALLBACK EnumObjectsCallback (const DIDEVICEOBJECTINSTANCE* pdidoi, static BOOL CALLBACK di_enumcallback (LPCDIDEVICEINSTANCE lpddi, LPVOID *dd) { struct didata *did; - int i, len, type; + int len, type; char *typetxt; type = lpddi->dwDevType & 0xff; @@ -821,11 +850,7 @@ static BOOL CALLBACK di_enumcallback (LPCDIDEVICEINSTANCE lpddi, LPVOID *dd) } else return DIENUM_CONTINUE; - memset (did, 0, sizeof (*did)); - for (i = 0; i < MAX_MAPPINGS; i++) { - did->axismappings[i] = -1; - did->buttonmappings[i] = -1; - } + cleardid (did); if (lpddi->tszInstanceName) { len = strlen (lpddi->tszInstanceName) + 5 + 1; did->name = malloc (len); @@ -985,6 +1010,7 @@ static int init_mouse (void) hr = IDirectInputDevice8_SetDataFormat(lpdi, &c_dfDIMouse); IDirectInputDevice8_EnumObjects (lpdi, EnumObjectsCallback, (void*)did, DIDFT_ALL); fixbuttons (did); + fixthings_mouse (did); sortobjects (did, did->axismappings, did->axissort, did->axisname, did->axistype, did->axles); sortobjects (did, did->buttonmappings, did->buttonsort, did->buttonname, 0, did->buttons); did->lpdi = lpdi; @@ -1112,20 +1138,27 @@ static void read_mouse (void) if (focus) { if (mouseactive || fs) { for (k = 0; k < did->axles; k++) { - if (did->axismappings[k] == dimofs) { + if (did->axismappings[k] == dimofs) setmousestate (i, k, data, 0); - break; - } } for (k = 0; k < did->buttons; k++) { if (did->buttonmappings[k] == dimofs) { + if (did->axisparent[k] >= 0) { + int dir = did->axisparentdir[k]; + int bstate = 0; + if (dir) + bstate = data > 0 ? 1 : 0; + else + bstate = data < 0 ? 1 : 0; + if (bstate) + setmousebuttonstate (i, k, -1); + } else { #ifdef SINGLEFILE - if (k == 0) - uae_quit (); + if (k == 0) + uae_quit (); #endif - if ((currprefs.win32_middle_mouse && k != 2) || !(currprefs.win32_middle_mouse)) { - setmousebuttonstate (i, k, state); - break; + if ((currprefs.win32_middle_mouse && k != 2) || !(currprefs.win32_middle_mouse)) + setmousebuttonstate (i, k, state); } } } @@ -1764,8 +1797,9 @@ static void read_joystick (void) for (k = 0; k < did->buttons; k++) { - if (did->axisparent >= 0 && did->buttonmappings[k] == dimofs) { - int bstate = 0; + if (did->axisparent[k] >= 0 && did->buttonmappings[k] == dimofs) { + + int bstate = -1; int axis = did->axisparent[k]; int dir = did->axisparentdir[k]; @@ -1785,13 +1819,14 @@ static void read_joystick (void) else bstate = data < -20000 ? 1 : 0; } - setjoybuttonstate (i, k, bstate); + if (bstate >= 0) + setjoybuttonstate (i, k, bstate); #ifdef DI_DEBUG2 write_log ("AB:NUM=%d OFF=%d AXIS=%d DIR=%d NAME=%s VAL=%d STATE=%d\n", k, dimofs, axis, dir, did->buttonname[k], data, state); #endif - } else if (did->buttonmappings[k] == dimofs) { + } else if (did->axisparent[k] < 0 && did->buttonmappings[k] == dimofs) { #ifdef DI_DEBUG2 write_log ("B:NUM=%d OFF=%d NAME=%s VAL=%d STATE=%d\n", k, dimofs, did->buttonname[k], data, state); diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 197fb98e..58e01981 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -517,7 +517,7 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) int fx, fy; float x, y, sx, sy; - xm = currprefs.gfx_lores ? 2 : 1; + xm = 2 >> currprefs.gfx_resolution; ym = currprefs.gfx_linedbl ? 1 : 2; if (window_w >= 1024) xm *= 2; @@ -527,6 +527,10 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) ym *= 2; else if (window_h < 350) ym /= 2; + if (xm < 1) + xm = 1; + if (ym < 1) + ym = 1; fx = (tin_w * xm - window_w) / 2; fy = (tin_h * ym - window_h) / 2; x = (float)(window_w * currprefs.gfx_filter_horiz_offset / 1000.0); diff --git a/od-win32/opengl.c b/od-win32/opengl.c index b6bae926..8a69ec14 100755 --- a/od-win32/opengl.c +++ b/od-win32/opengl.c @@ -491,7 +491,7 @@ static void OGL_dorender (int newtex) #else - xm = currprefs.gfx_lores ? 2 : 1; + xm = 2 >> currprefs.gfx_resolution; ym = currprefs.gfx_linedbl ? 1 : 2; if (w_width >= 1024) xm *= 2; @@ -501,6 +501,10 @@ static void OGL_dorender (int newtex) ym *= 2; else if (w_height < 350) ym /= 2; + if (xm < 1) + xm = 1; + if (ym < 1) + ym = 1; fx = (t_width * xm - w_width) / 2; fy = (t_height * ym - w_height) / 2; diff --git a/od-win32/resources/resource b/od-win32/resources/resource index 6a57d370..53226b34 100755 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -320,6 +320,7 @@ #define IDC_PORT1_JOYS 1027 #define IDC_SCREENMODE_RTG 1027 #define IDC_MBMEM1 1028 +#define IDC_SCREENMODE_RTG2 1028 #define IDC_SLOWMEM 1030 #define IDC_MBMEM2 1031 #define IDC_PARALLEL 1033 @@ -670,7 +671,6 @@ #define IDC_MOUSETRICK 1613 #define IDC_AVIOUTPUT_AUDIO 1614 #define IDC_INPUTCOPYFROM 1614 -#define IDC_MOUSETRICK2 1614 #define IDC_SANA2 1614 #define IDC_AVIOUTPUT_VIDEO_CODEC 1615 #define IDC_INPUTDEVICEDISABLE 1615 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d40d236d..104f21dd 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1,6 +1,6 @@ // Microsoft Visual C++ generated resource script. // -#include "resource." +#include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,6 @@ BEGIN EDITTEXT IDC_YSIZE,114,48,47,12,ES_NUMBER GROUPBOX "Settings",IDC_SETTINGSTEXT,12,73,199,125 CONTROL "Correct aspect ratio",IDC_ASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,19,126,92,10 - CONTROL "Force low resolution",IDC_LORES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,126,89,10 LTEXT "Refresh:",IDC_REFRESHTEXT,18,162,28,8 CONTROL "Slider1",IDC_FRAMERATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,47,157,75,20 EDITTEXT IDC_RATETEXT,127,161,77,12,ES_CENTER | ES_READONLY @@ -105,13 +104,15 @@ BEGIN CONTROL "",IDC_FRAMERATE2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,47,177,127,20 EDITTEXT IDC_RATE2TEXT,178,181,26,12,ES_CENTER | ES_READONLY COMBOBOX IDC_RESOLUTIONDEPTH,135,27,46,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Filtered low resolution",IDC_LORES_SMOOTHED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,140,89,10 + CONTROL "Filtered low resolution",IDC_LORES_SMOOTHED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,126,89,10 COMBOBOX IDC_SCREENMODE_NATIVE,100,85,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_SCREENMODE_RTG,100,103,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP RTEXT "Native mode:",IDC_STATIC,19,85,59,15,SS_CENTERIMAGE RTEXT "Windowed:",IDC_WINDOWEDTEXT,15,51,40,8 RTEXT "RTG mode:",IDC_STATIC,19,101,59,15,SS_CENTERIMAGE PUSHBUTTON "Reset to defaults",IDC_DA_RESET,212,211,73,14 + RTEXT "Resolution:",IDC_STATIC,27,140,59,15,SS_CENTERIMAGE + COMBOBOX IDC_LORES,100,140,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END IDD_MEMORY DIALOGEX 0, 0, 300, 175 diff --git a/od-win32/scaler_more.c b/od-win32/scaler_more.c index 90e3a047..2e479da5 100755 --- a/od-win32/scaler_more.c +++ b/od-win32/scaler_more.c @@ -30,7 +30,7 @@ void PAL_init(void) pgrec = &grec[1 * 256]; pbluc = &bluc[1 * 256]; - if (currprefs.gfx_lores) { + if (currprefs.gfx_resolution == 0) { xx1 = 1; xx2 = 2; xx3 = 3; diff --git a/od-win32/win32.c b/od-win32/win32.c index d3d3e81e..834afda1 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -878,12 +878,26 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, } return 0; case WM_MOUSEWHEEL: - if (dinput_winmouse () >= 0) - setmousestate (dinput_winmouse(), 2, ((short)HIWORD(wParam)), 0); + if (dinput_winmouse () >= 0) { + int val = ((short)HIWORD(wParam)); + setmousestate (dinput_winmouse(), 2, val, 0); + if (val < 0) + setmousebuttonstate (dinput_winmouse(), dinput_wheelbuttonstart() + 0, -1); + else if (val > 0) + setmousebuttonstate (dinput_winmouse(), dinput_wheelbuttonstart() + 1, -1); + return TRUE; + } return 0; case WM_MOUSEHWHEEL: - if (dinput_winmouse () >= 0) - setmousestate (dinput_winmouse(), 3, ((short)HIWORD(wParam)), 0); + if (dinput_winmouse () >= 0) { + int val = ((short)HIWORD(wParam)); + setmousestate (dinput_winmouse(), 3, val, 0); + if (val < 0) + setmousebuttonstate (dinput_winmouse(), dinput_wheelbuttonstart() + 2, -1); + else if (val > 0) + setmousebuttonstate (dinput_winmouse(), dinput_wheelbuttonstart() + 3, -1); + return TRUE; + } return 0; case WM_PAINT: @@ -1195,6 +1209,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, { case WM_MOUSEMOVE: case WM_MOUSEWHEEL: + case WM_MOUSEHWHEEL: case WM_ACTIVATEAPP: case WM_DROPFILES: case WM_ACTIVATE: diff --git a/od-win32/win32.h b/od-win32/win32.h index bf2b69c4..e2625a8a 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 3 +#define WINUAEBETA 4 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2007, 10, 13) +#define WINUAEDATE MAKEBD(2007, 10, 25) #define WINUAEEXTRA "" #define WINUAEREV "" @@ -105,6 +105,7 @@ extern void setpriority (struct threadpriorities *pri); extern int dinput_wmkey (uae_u32 key); extern int dinput_winmouse (void); +extern int dinput_wheelbuttonstart (void); extern int dinput_winmousemode (void); void addnotifications (HWND hwnd, int remove); diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index e2fd57f0..c290e9dd 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1119,7 +1119,7 @@ int check_prefs_changed_gfx (void) c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1|8) : 0; //c |= currprefs.gfx_filter_ != changed_prefs.gfx_filter_ ? (1|8) : 0; - c |= currprefs.gfx_lores != changed_prefs.gfx_lores ? 2 : 0; + c |= currprefs.gfx_resolution != changed_prefs.gfx_resolution ? 2 : 0; 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; @@ -1165,7 +1165,7 @@ int check_prefs_changed_gfx (void) //currprefs.gfx_filter_ = changed_prefs.gfx_filter_; currprefs.gfx_lores_mode = changed_prefs.gfx_lores_mode; - currprefs.gfx_lores = changed_prefs.gfx_lores; + currprefs.gfx_resolution = changed_prefs.gfx_resolution; currprefs.gfx_linedbl = changed_prefs.gfx_linedbl; currprefs.gfx_display = changed_prefs.gfx_display; currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop; @@ -2220,7 +2220,7 @@ static BOOL doInit (void) currentmode->native_depth = currentmode->current_depth; #if defined (GFXFILTER) if (currentmode->flags & (DM_OPENGL | DM_D3D | DM_SWSCALE)) { - currentmode->amiga_width = AMIGA_WIDTH_MAX >> (currprefs.gfx_lores ? 1 : 0); + currentmode->amiga_width = AMIGA_WIDTH_MAX >> (currprefs.gfx_resolution ? 0 : 1); currentmode->amiga_height = AMIGA_HEIGHT_MAX >> (currprefs.gfx_linedbl ? 0 : 1); if (usedfilter) { if (usedfilter->x[0]) { @@ -2263,6 +2263,7 @@ static BOOL doInit (void) } if ((currentmode->flags & DM_DDRAW) && !(currentmode->flags & (DM_D3D | DM_SWSCALE))) { + int flags; if(!DirectDraw_SurfaceLock (lockable_surface)) goto oops; @@ -2277,12 +2278,16 @@ static BOOL doInit (void) gui_message(szMessage); goto oops; } + } else if (!(currentmode->flags & DM_SWSCALE)) { + int size = currentmode->amiga_width * currentmode->amiga_height * gfxvidinfo.pixbytes; gfxvidinfo.realbufmem = xmalloc (size); gfxvidinfo.bufmem = gfxvidinfo.realbufmem; gfxvidinfo.rowbytes = currentmode->amiga_width * gfxvidinfo.pixbytes; + } else if (!(currentmode->flags & DM_D3D)) { + int w = currentmode->amiga_width * 2; int h = currentmode->amiga_height * 2; int size = (w * 2) * (h * 3) * gfxvidinfo.pixbytes; @@ -2291,6 +2296,7 @@ static BOOL doInit (void) gfxvidinfo.bufmem = gfxvidinfo.realbufmem + (w + (w * 2) * h) * gfxvidinfo.pixbytes; gfxvidinfo.rowbytes = w * 2 * gfxvidinfo.pixbytes; gfxvidinfo.bufmemend = gfxvidinfo.realbufmem + size - gfxvidinfo.rowbytes; + } init_row_map (); diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index f16d8752..bebc3bdd 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -468,7 +468,12 @@ static struct romdata *scan_single_rom (char *path) static int addrom (HKEY fkey, struct romdata *rd, char *name) { char tmp1[MAX_DPATH], tmp2[MAX_DPATH]; + sprintf (tmp1, "ROM%03d", rd->id); + if (rd->group) { + char *p = tmp1 + strlen (tmp1); + sprintf (p, "_%02d_%02d", rd->group >> 16, rd->group & 65535); + } if (RegQueryValueEx (fkey, tmp1, 0, NULL, NULL, NULL) == ERROR_SUCCESS) return 0; tmp2[0] = 0; @@ -3857,8 +3862,13 @@ static void values_to_displaydlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_ADDSTRING, 0, (LPARAM)buffer); SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_SETCURSEL, display_toselect(workprefs.gfx_pfullscreen, workprefs.gfx_pvsync, 1), 0); + SendDlgItemMessage(hDlg, IDC_LORES, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"Lores"); + SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"Hires (normal)"); + SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)"SuperHires"); + SendDlgItemMessage (hDlg, IDC_LORES, CB_SETCURSEL, workprefs.gfx_resolution, 0); + CheckDlgButton (hDlg, IDC_ASPECT, workprefs.gfx_correct_aspect); - CheckDlgButton (hDlg, IDC_LORES, workprefs.gfx_lores); CheckDlgButton (hDlg, IDC_LORES_SMOOTHED, workprefs.gfx_lores_mode); CheckDlgButton (hDlg, IDC_XCENTER, workprefs.gfx_xcenter); @@ -3908,7 +3918,6 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l display_fromselect(SendDlgItemMessage (hDlg, IDC_SCREENMODE_RTG, CB_GETCURSEL, 0, 0), &workprefs.gfx_pfullscreen, &workprefs.gfx_pvsync, 1); - workprefs.gfx_lores = IsDlgButtonChecked (hDlg, IDC_LORES); workprefs.gfx_lores_mode = IsDlgButtonChecked (hDlg, IDC_LORES_SMOOTHED); workprefs.gfx_correct_aspect = IsDlgButtonChecked (hDlg, IDC_ASPECT); workprefs.gfx_linedbl = (IsDlgButtonChecked(hDlg, IDC_LM_SCANLINES) ? 2 : @@ -3964,6 +3973,10 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l init_display_mode (hDlg); } return; + } else if (LOWORD (wParam) == IDC_LORES) { + posn = SendDlgItemMessage (hDlg, IDC_LORES, CB_GETCURSEL, 0, 0); + if (posn != CB_ERR) + workprefs.gfx_resolution = posn; } else if (LOWORD (wParam) == IDC_RESOLUTION || LOWORD(wParam) == IDC_RESOLUTIONDEPTH) { LRESULT posn1, posn2; posn1 = SendDlgItemMessage (hDlg, IDC_RESOLUTION, CB_GETCURSEL, 0, 0); @@ -8411,7 +8424,7 @@ static int *filtervars[] = { &workprefs.gfx_filter_vert_zoom_mult, &workprefs.gfx_filter_horiz_zoom_mult, &workprefs.gfx_filter_vert_offset, &workprefs.gfx_filter_horiz_offset, &workprefs.gfx_filter_scanlines, &workprefs.gfx_filter_scanlinelevel, &workprefs.gfx_filter_scanlineratio, - &workprefs.gfx_lores, &workprefs.gfx_linedbl, &workprefs.gfx_correct_aspect, + &workprefs.gfx_resolution, &workprefs.gfx_linedbl, &workprefs.gfx_correct_aspect, &workprefs.gfx_xcenter, &workprefs.gfx_ycenter, &workprefs.gfx_filter_luminance, &workprefs.gfx_filter_contrast, &workprefs.gfx_filter_saturation, &workprefs.gfx_filter_gamma, &workprefs.gfx_filter_blur, &workprefs.gfx_filter_noise, diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 101c777d..d92abb55 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -2507,6 +2507,10 @@ RelativePath="..\hq2x32.obj" > + + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index df4b0104..2e2949af 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,36 @@ +Beta 4: + +- fixed completely broken joystick buttons (b3) +- input panel mouse wheel "buttons" added. Sends button/key down + event, waits one frame, sends button/key up event +- started implementing "real" ROM image ROM scanner support + (2xROM setups like CDTV extended ROM or A1200, Nordic Power etc..) +- big superhires resolution and hires/superhires sprite update +* full SuperHires resolution support (without dropped pixels) +* Doublescan hires modes are now also properly displayed (hires + doublescan is really "half-scan" superhires mode) +* Replaced lores checkbox with lores/hires/superhires selection. + SuperHires mode uses 4xdoubling in lores, 2xdoubling in hires and + no doubling (and no dropped pixels) in superhires + Hires = old non-lores mode, 2xdoubling in lores, no doubling in + hires and drop every other pixel in superhires (*) + Lores = no doubling in lores, drop every other pixel in hires (*), + superhires not supported + * = lores smooth filtering supported + NOTE: regular (non-doublescan) superhires aspect ratio is wrong, + use filters if you need correct aspect ratio + NOTE2: interlaced doublescan modes are buggy +* AGA superhires sprite resolution supported (previously hires only) +* hires sprites are not converted to lores (and then doubled again..) + anymore if screen is doubled (lores program, hires/shres in GUI) + Check Super Stardust AGA if you want to see the difference. +* AGA hires/shres "smooth" scroll BPLCON1 bits supported +* OCS/ECS (no ECS Denise) uses old code path = no performance change. + ECS-Denise and AGA uses new more complex and slower sprite/bitplane + drawing code path +* Probably breaks something... + Beta 3: - autoboot/donotmount checkbox problems fixed diff --git a/sana2.c b/sana2.c index f42246e0..777fa635 100755 --- a/sana2.c +++ b/sana2.c @@ -357,6 +357,39 @@ static void abort_async (struct devstruct *dev, uaecptr request, int errcode, in write_log ("%s: asyncronous request=%08.8X aborted, error=%d\n", SANA2NAME, request, errcode); } +struct sanapacket +{ + uae_u8 *data; + int len; + uae_u8 srcaddr[ADDR_SIZE], dstaddr[ADDR_SIZE]; +}; + +static void frees2packet (struct sanapacket *sp) +{ + if (!sp) + return; + xfree (sp->data); + xfree (sp); +} + +static int writes2packet (uaecptr data, int datalen, uaecptr srcaddr, uaecptr dstaddr) +{ + struct sanapacket *sp = NULL; + + sp = xcalloc (sizeof (struct sanapacket), 1); + if (!sp) + goto err; + sp->data = xmalloc (datalen); + memcpyah_safe (sp->data, data, datalen); + memcpyah_safe (sp->srcaddr, srcaddr, ADDR_SIZE); + memcpyah_safe (sp->dstaddr, dstaddr, ADDR_SIZE); + //writes2packetqueue (sp); + //return 0; +err: + frees2packet (sp); + return S2ERR_NO_RESOURCES; +} + static int dev_do_io (struct devstruct *dev, uaecptr request) { uae_u32 command = get_word (request + 28); @@ -395,6 +428,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) case CMD_READ: if (!pdev->online) goto offline; + io_error = S2ERR_NO_RESOURCES; break; case S2_READORPHAN: @@ -415,6 +449,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request) case CMD_WRITE: if (!pdev->online) goto offline; + io_error = writes2packet (data, datalength, srcaddr, dstaddr); break; case S2_MULTICAST: -- 2.47.3