From: Toni Wilen Date: Thu, 21 Dec 2006 18:55:41 +0000 (+0200) Subject: imported winuaesrc1340b5.zip X-Git-Tag: 2100~259 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2542138096da9984782277294bca92dbdc55fa24;p=francis%2Fwinuae.git imported winuaesrc1340b5.zip --- diff --git a/bsdsocket.c b/bsdsocket.c index 440ca79b..e5224bd3 100644 --- a/bsdsocket.c +++ b/bsdsocket.c @@ -274,6 +274,7 @@ static uae_u32 REGPARAM2 bsdsock_int_handler (TrapContext *context) SB; locksigqueue (); + bsd_int_requested = 0; if (sbsigqueue != NULL) { @@ -292,7 +293,6 @@ static uae_u32 REGPARAM2 bsdsock_int_handler (TrapContext *context) sbsigqueue = NULL; } - bsd_int_requested = 0; unlocksigqueue (); return 0; diff --git a/custom.c b/custom.c index bcd4ed72..c72a6516 100644 --- a/custom.c +++ b/custom.c @@ -4383,7 +4383,6 @@ static void hsync_handler (void) #if 1 #ifdef FILESYS if (uae_int_requested) { - set_uae_int_flag (); INTREQ (0x8000 | 0x0008); } #endif diff --git a/drawing.c b/drawing.c index e0d8ae8b..dd7936af 100644 --- a/drawing.c +++ b/drawing.c @@ -146,6 +146,7 @@ static void xlinecheck (int start, int end) static int *amiga2aspect_line_map, *native2amiga_line_map; static uae_u8 *row_map[MAX_VIDHEIGHT + 1]; +static uae_u8 row_tmp[MAX_PIXELS_PER_LINE * 32 / 8]; static int max_drawn_amiga_line; /* line_draw_funcs: pfield_do_linetoscr, pfield_do_fill_line, decode_ham */ @@ -1088,6 +1089,8 @@ void init_row_map (void) abort (); } j = 0; + for (i = 0; i < MAX_VIDHEIGHT + 1; i++) + row_map[i] = row_tmp; for (i = 0; i < gfxvidinfo.height + 1; i++, j += gfxvidinfo.rowbytes) row_map[i] = gfxvidinfo.bufmem + j; } @@ -2094,6 +2097,7 @@ STATIC_INLINE void check_picasso (void) notice_screen_contents_lost (); notice_new_xcolors (); + count_frame (); #endif } diff --git a/fpp.c b/fpp.c index 7eb57a3b..79fd0a5d 100644 --- a/fpp.c +++ b/fpp.c @@ -1267,24 +1267,24 @@ void fpp_opp (uae_u32 opcode, struct regstruct *regs, uae_u16 extra) regs->fp[reg] = tmp_fp; } #else /* no X86_MSVC */ - switch ((regs.fpcr >> 4) & 3) { + switch ((regs->fpcr >> 4) & 3) { case 0: /* to nearest */ - regs.fp[reg] = floor (src + 0.5); + regs->fp[reg] = floor (src + 0.5); break; case 1: /* to zero */ if (src >= 0.0) - regs.fp[reg] = floor (src); + regs->fp[reg] = floor (src); else - regs.fp[reg] = ceil (src); + regs->fp[reg] = ceil (src); break; case 2: /* down */ - regs.fp[reg] = floor (src); + regs->fp[reg] = floor (src); break; case 3: /* up */ - regs.fp[reg] = ceil (src); + regs->fp[reg] = ceil (src); break; default: /* never reached */ - regs.fp[reg] = src; + regs->fp[reg] = src; } #endif /* X86_MSVC */ break; diff --git a/include/newcpu.h b/include/newcpu.h index f5924797..58c15f0b 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -175,13 +175,13 @@ STATIC_INLINE void m68k_setpc (struct regstruct *regs, uaecptr newpc) STATIC_INLINE uaecptr m68k_getpc (struct regstruct *regs) { - return regs->pc + ((char *)regs->pc_p - (char *)regs->pc_oldp); + return (uaecptr)(regs->pc + ((char *)regs->pc_p - (char *)regs->pc_oldp)); } #define M68K_GETPC m68k_getpc(®s) STATIC_INLINE uaecptr m68k_getpc_p (struct regstruct *regs, uae_u8 *p) { - return regs->pc + ((char *)p - (char *)regs->pc_oldp); + return (uaecptr)(regs->pc + ((char *)p - (char *)regs->pc_oldp)); } STATIC_INLINE void m68k_setpci(struct regstruct *regs, uaecptr newpc) diff --git a/newcpu.c b/newcpu.c index b10137bc..27468d47 100644 --- a/newcpu.c +++ b/newcpu.c @@ -1901,6 +1901,8 @@ void exec_nostats(void) static int triggered; +extern volatile int bsd_int_requested; + void execute_normal(void) { struct regstruct *r = ®s; @@ -1930,7 +1932,7 @@ void execute_normal(void) total_cycles += cpu_cycles; pc_hist[blocklen].specmem = special_mem; blocklen++; - if (end_block(opcode) || blocklen >= MAXRUN || r->spcflags) { + if (end_block(opcode) || blocklen >= MAXRUN || r->spcflags || uae_int_requested || bsd_int_requested) { compile_block(pc_hist,blocklen,total_cycles); return; /* We will deal with the spcflags in the caller */ } @@ -1946,6 +1948,14 @@ static void m68k_run_2a (void) for (;;) { ((compiled_handler*)(pushall_call_handler))(); /* Whenever we return from that, we should check spcflags */ + if (uae_int_requested) { + intreq |= 0x0008; + set_special (®s, SPCFLAG_INT); + } + if (bsd_int_requested) { + intreq |= 0x2000; + set_special (®s, SPCFLAG_INT); + } if (regs.spcflags) { if (do_specialties (0, ®s)) { return; diff --git a/od-win32/mman.c b/od-win32/mman.c index 613620ea..ce5fcf29 100644 --- a/od-win32/mman.c +++ b/od-win32/mman.c @@ -98,6 +98,7 @@ void init_shm(void) blah = VirtualAlloc(NULL, size + add, MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (blah) break; + write_log("NATMEM: %dM area failed to allocate, err=%d\n", (size + add) >> 20, GetLastError()); size >>= 1; if (size < 0x10000000) { write_log("NATMEM: No special area could be allocated (2)!\n"); diff --git a/od-win32/posixemu.c b/od-win32/posixemu.c index 17130348..45517d7f 100644 --- a/od-win32/posixemu.c +++ b/od-win32/posixemu.c @@ -34,6 +34,7 @@ void gettimeofday (struct timeval *tv, void *blah) { #if 1 struct timeb time; + ftime (&time); tv->tv_sec = time.time; @@ -56,7 +57,7 @@ void gettimeofday (struct timeval *tv, void *blah) #define secs_per_day (24 * 60 * 60) #define diff ((8 * 365 + 2) * secs_per_day) -static void get_time(time_t t, long* days, long* mins, long* ticks) +static void get_time(time_t t, long *days, long *mins, long *ticks) { /* time_t is secs since 1-1-1970 */ /* days since 1-1-1978 */ @@ -163,7 +164,8 @@ static int setfiletime(const char *name, unsigned int days, int minute, int tick int posixemu_utime( const char *name, struct utimbuf *ttime ) { int result = -1, tolocal; - long days, mins, ticks, actime; + long days, mins, ticks; + time_t actime; if (!ttime) { actime = time (NULL); @@ -232,7 +234,7 @@ int uae_start_thread (void *(*f)(void *), void *arg, uae_thread_id *tid) return result; } -int cpu_affinity = 1; +DWORD_PTR cpu_affinity = 1; void uae_set_thread_priority (int pri) { diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index 07caf807..e625e4ce 100644 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -36,6 +36,9 @@ #define ADJUST_SIZE 30 #define EXP 2.1 +#define ADJUST_VSSIZE 10 +#define EXPVS 1.3 + int sound_debug = 0; static int obtainedfreq; @@ -80,6 +83,11 @@ int setup_sound (void) return 1; } +static int isvsync(void) +{ + return (currprefs.gfx_vsync && currprefs.gfx_afullscreen) ? 1 : 0; +} + int scaled_sample_evtime_orig; static int lastfreq; void update_sound (int freq) @@ -88,7 +96,7 @@ void update_sound (int freq) freq = lastfreq; lastfreq = freq; if (have_sound) { - if ((currprefs.gfx_vsync && currprefs.gfx_afullscreen) || currprefs.chipset_refreshrate) { + if (isvsync() || currprefs.chipset_refreshrate) { if (currprefs.ntscmode) scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_NTSC * MAXVPOS_NTSC * freq * CYCLE_UNIT + obtainedfreq - 1) / obtainedfreq; else @@ -309,12 +317,13 @@ static int open_audio_ds (int size) dsoundbuf = DSBSIZE_MIN; if (dsoundbuf > DSBSIZE_MAX) dsoundbuf = DSBSIZE_MAX; - if (max_sndbufsize > dsoundbuf) - max_sndbufsize = dsoundbuf; + + if (max_sndbufsize * 2 > dsoundbuf) + max_sndbufsize = dsoundbuf / 2; snd_writeoffset = max_sndbufsize * 5 / 8; snd_maxoffset = max_sndbufsize; - snd_totalmaxoffset_of = max_sndbufsize + (dsoundbuf - max_sndbufsize) / 3; + snd_totalmaxoffset_of = max_sndbufsize + (dsoundbuf - max_sndbufsize) * 1 / 3; snd_totalmaxoffset_uf = max_sndbufsize + (dsoundbuf - max_sndbufsize) * 2 / 3; memset (&sound_buffer, 0, sizeof (sound_buffer)); @@ -467,7 +476,7 @@ void sound_setadjust (double v) vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0); scaled_sample_evtime = scaled_sample_evtime_orig; } else { - vsynctime = vsynctime_orig * mult / 1000.0; + vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0); scaled_sample_evtime = scaled_sample_evtime_orig; } } @@ -637,14 +646,28 @@ static void finish_sound_buffer_ds (void) vdiff = diff - snd_writeoffset; m = 100.0 * vdiff / max_sndbufsize; - skipmode = pow (m < 0 ? -m : m, EXP) / 2; - - if (m < 0) - skipmode = -skipmode; - if (skipmode < -ADJUST_SIZE) - skipmode = -ADJUST_SIZE; - if (skipmode > ADJUST_SIZE) - skipmode = ADJUST_SIZE; + + if (isvsync()) { + + skipmode = pow (m < 0 ? -m : m, EXP) / 10; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_VSSIZE) + skipmode = -ADJUST_VSSIZE; + if (skipmode > ADJUST_VSSIZE) + skipmode = ADJUST_VSSIZE; + + } else { + + skipmode = pow (m < 0 ? -m : m, EXP) / 2; + if (m < 0) + skipmode = -skipmode; + if (skipmode < -ADJUST_SIZE) + skipmode = -ADJUST_SIZE; + if (skipmode > ADJUST_SIZE) + skipmode = ADJUST_SIZE; + + } if (tfprev != timeframes) { if (sound_debug && !(tfprev % 10)) diff --git a/od-win32/win32.c b/od-win32/win32.c index ee5c6209..8247be5e 100644 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -2529,9 +2529,10 @@ static void getstartpaths(int start_data) extern void test (void); extern int screenshotmode, b0rken_ati_overlay, postscript_print_debugging, sound_debug, log_uaeserial; -extern int force_direct_catweasel, cpu_affinity, max_allowed_mman; +extern int force_direct_catweasel, max_allowed_mman; -static int original_affinity; +extern DWORD_PTR cpu_affinity; +static DWORD_PTR original_affinity; static int getval(char *s) { diff --git a/od-win32/win32.h b/od-win32/win32.h index 307308bd..7339e6de 100644 --- 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 4 +#define WINUAEBETA 5 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2006, 12, 20) +#define WINUAEDATE MAKEBD(2006, 12, 21) #define IHF_WINDOWHIDDEN 6 #define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU) diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index 40bef5b2..1a3647f1 100644 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -889,7 +889,7 @@ static int DX_Flip(void) } #endif result = DirectDraw_Flip(0); - if( result ) + if (result) { // result = DirectDraw_BltFast(primary_surface, 0, 0, secondary_surface, NULL); // result = DirectDraw_BltFast(primary_surface, 0, 0, tertiary_surface, NULL); diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index e81b0025..676c191f 100644 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -367,7 +367,7 @@ static HWND cachedlist = NULL; #define MIN_SLOW_MEM 0 #define MAX_SLOW_MEM 4 #define MIN_Z3_MEM 0 -#define MAX_Z3_MEM ((max_z3fastmem >> 20) <= 512 ? 10 : ((max_z3fastmem >> 20) == 1024) ? 11 : 12) +#define MAX_Z3_MEM ((max_z3fastmem >> 20) < 1024 ? 10 : ((max_z3fastmem >> 20) < 2048) ? 11 : 12) #define MIN_P96_MEM 0 #define MAX_P96_MEM 7 #define MIN_M68K_PRIORITY 1 @@ -7974,7 +7974,7 @@ static void filter_handle (HWND hDlg) static int getfiltermult(HWND hDlg, DWORD dlg) { - int v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L); + LRESULT v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L); if (v == CB_ERR) return 1000; return filtermults[v]; diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 76e65829..bda12a29 100644 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -765,7 +765,7 @@ /> native switching crash +- added -maxmem command line parameter, "-maxmem 1024" enables 1G + Z3Fast support. (32-bit max) Note: can cause random side-effects + depending on total memory and/or Windows version.. Large RTG RAM + sizes require larger maxmem parameter (but values over ~1060 may + not work, check winuaebootlog.txt). Pointless but fun option :) +- vsync mode sound pitch shifting fixed. Pitch can still shift + slightly in some cases. +- bsdsocket stability fix Beta 4: