From 7cc60d5bd23f1f58b1a537c9a65777366b08cb5b Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 11 Dec 2005 15:11:30 +0200 Subject: [PATCH] imported winuaesrc1200b3.zip --- blitter.c | 2 +- cfgfile.c | 11 +- cia.c | 6 +- compemu_fpp.c | 619 ++++++++++++++-------------------- compemu_raw_x86.c | 86 ++++- compemu_support.c | 44 ++- custom.c | 18 +- debug.c | 6 + drawing.c | 4 +- fpp.c | 28 +- gencomp.c | 10 +- include/compemu.h | 33 +- include/debug.h | 1 + include/newcpu.h | 2 + include/options.h | 1 + newcpu.c | 4 +- od-win32/direct3d.c | 18 +- od-win32/keyboard_win32.c | 2 +- od-win32/md-fpp.h | 6 +- od-win32/opengl.c | 12 +- od-win32/resources/resource.h | 3 + od-win32/resources/winuae.rc | 34 +- od-win32/win32.c | 34 +- od-win32/win32.h | 2 +- od-win32/win32_scale2x.c | 30 +- od-win32/win32gfx.c | 38 ++- od-win32/win32gui.c | 204 +++++++---- prowizard/misc/testbag.c | 4 +- 28 files changed, 675 insertions(+), 587 deletions(-) diff --git a/blitter.c b/blitter.c index 8180a44b..e787f135 100755 --- a/blitter.c +++ b/blitter.c @@ -4,7 +4,7 @@ * Custom chip emulation * * (c) 1995 Bernd Schmidt, Alessandro Bissacco - * (c) 2002 - 2003 Toni Wilen + * (c) 2002 - 2005 Toni Wilen */ //#define BLITTER_DEBUG diff --git a/cfgfile.c b/cfgfile.c index 780e5e89..6ab85147 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -139,6 +139,7 @@ static const char *compmode[] = { "direct", "indirect", "indirectKS", "afterPic" static const char *flushmode[] = { "soft", "hard", 0 }; static const char *kbleds[] = { "none", "POWER", "DF0", "DF1", "DF2", "DF3", "HD", "CD", 0 }; static const char *soundfiltermode[] = { "off", "emulated", "on", 0 }; +static const char *loresmode[] = { "normal", "filtered", 0 }; #ifdef GFXFILTER static const char *filtermode1[] = { "no_16", "bilinear_16", "no_32", "bilinear_32", 0 }; static const char *filtermode2[] = { "0x", "1x", "2x", "3x", "4x", 0 }; @@ -352,7 +353,7 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "gfx_refreshrate=%d\n", p->gfx_refreshrate); cfgfile_write (f, "gfx_vsync=%s\n", p->gfx_vsync ? "true" : "false"); cfgfile_write (f, "gfx_lores=%s\n", p->gfx_lores ? "true" : "false"); - cfgfile_write (f, "gfx_lores_mode=%s\n", p->gfx_lores_mode ? 1 : 0); + cfgfile_write (f, "gfx_lores_mode=%s\n", loresmode[p->gfx_lores_mode]); cfgfile_write (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]); cfgfile_write (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false"); cfgfile_write (f, "gfx_fullscreen_amiga=%s\n", p->gfx_afullscreen ? "true" : "false"); @@ -390,6 +391,8 @@ static void save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, "gfx_filter_vert_zoom=%d\n", p->gfx_filter_vert_zoom); cfgfile_write (f, "gfx_filter_horiz_zoom=%d\n", p->gfx_filter_horiz_zoom); + cfgfile_write (f, "gfx_filter_vert_zoom_mult=%d\n", p->gfx_filter_vert_zoom_mult); + cfgfile_write (f, "gfx_filter_horiz_zoom_mult=%d\n", p->gfx_filter_horiz_zoom_mult); cfgfile_write (f, "gfx_filter_vert_offset=%d\n", p->gfx_filter_vert_offset); cfgfile_write (f, "gfx_filter_horiz_offset=%d\n", p->gfx_filter_horiz_offset); cfgfile_write (f, "gfx_filter_scanlines=%d\n", p->gfx_filter_scanlines); @@ -647,6 +650,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) #ifdef GFXFILTER || cfgfile_intval (option, value, "gfx_filter_vert_zoom", &p->gfx_filter_vert_zoom, 1) || cfgfile_intval (option, value, "gfx_filter_horiz_zoom", &p->gfx_filter_horiz_zoom, 1) + || cfgfile_intval (option, value, "gfx_filter_vert_zoom_mult", &p->gfx_filter_vert_zoom_mult, 1) + || cfgfile_intval (option, value, "gfx_filter_horiz_zoom_mult", &p->gfx_filter_horiz_zoom_mult, 1) || cfgfile_intval (option, value, "gfx_filter_vert_offset", &p->gfx_filter_vert_offset, 1) || cfgfile_intval (option, value, "gfx_filter_horiz_offset", &p->gfx_filter_horiz_offset, 1) || cfgfile_intval (option, value, "gfx_filter_scanlines", &p->gfx_filter_scanlines, 1) @@ -678,7 +683,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_vsync) || cfgfile_yesno (option, value, "gfx_lores", &p->gfx_lores) - || cfgfile_yesno (option, value, "gfx_lores_mode", &p->gfx_lores_mode) || cfgfile_yesno (option, value, "gfx_correct_aspect", &p->gfx_correct_aspect) || cfgfile_yesno (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen) || cfgfile_yesno (option, value, "gfx_fullscreen_picasso", &p->gfx_pfullscreen) @@ -694,6 +698,7 @@ 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_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) @@ -2390,6 +2395,8 @@ void default_prefs (struct uae_prefs *p, int type) p->filesys_custom_uaefsdb = 1; p->gfx_filter = 0; + p->gfx_filter_horiz_zoom_mult = 1000; + p->gfx_filter_vert_zoom_mult = 1000; p->gfx_filter_filtermode = 1; p->gfx_filter_scanlineratio = (1 << 4) | 1; diff --git a/cia.c b/cia.c index 754be449..8d2cb867 100755 --- a/cia.c +++ b/cia.c @@ -774,12 +774,14 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val) CIA_update (); ciaasdr = val; if (ciaacra & 0x40) { + if (!kback && (ciaacra & 0x41) == 0x41) + ciaasdr_cnt = 8 * 2; kback = 1; } else { ciaasdr_cnt = 0; + if ((ciaacra & 0x41) == 0x41) + ciaasdr_cnt = 8 * 2; } - if ((ciaacra & 0x41) == 0x41) - ciaasdr_cnt = 8 * 2; CIA_calctimers (); break; case 13: diff --git a/compemu_fpp.c b/compemu_fpp.c index 82e96df2..91b78797 100755 --- a/compemu_fpp.c +++ b/compemu_fpp.c @@ -26,10 +26,7 @@ #define MAKE_FPSR(r) do { fmov_rr(FP_RESULT,r); } while (0) -#define delay //nop() ;nop() /* Who tried this with the JIT ? */ -#define delay2 //nop() ;nop() /* the delays will have to emit( ;-) */ - -uae_s32 temp_fp[3]; /* To convert between FP/integer */ +uae_s32 temp_fp[] = {0,0,0}; /* To convert between FP and */ /* 128 words, indexed through the low byte of the 68k fpu control word */ static uae_u16 x86_fpucw[]={ @@ -57,240 +54,235 @@ static uae_u16 x86_fpucw[]={ /* return register number, or -1 for failure */ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra) { - uaecptr tmppc; - uae_u16 tmp; - int size; - int mode; - int reg; - double* src; - uae_u32 ad = 0; static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 }; static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 }; + int reg = opcode & 7; + int mode = (opcode >> 3) & 7; + int size = (extra >> 10) & 7; - if ((extra & 0x4000) == 0) { - return (extra >> 10) & 7; - } + if (!(extra & 0x4000)) /* R/M=0, from FPx to FPy */ + return size; /* size is the source register FPx */ + if (size == 3) /* packed decimal is not supported on 68040 */ + return -1; + if (size == 7) /* this size is not defined */ + return -1; - mode = (opcode >> 3) & 7; - reg = opcode & 7; - size = (extra >> 10) & 7; switch (mode) { - case 0: + case 0: /* Dn */ switch (size) { - case 6: - sign_extend_8_rr(S1,reg); - mov_l_mr((uae_u32)temp_fp,S1); - delay2; + case 0: /* Long */ + mov_l_mr((uae_u32)temp_fp,reg); fmovi_rm(FS1,(uae_u32)temp_fp); return FS1; - case 4: + case 1: /* Single */ + mov_l_mr((uae_u32)temp_fp,reg); + fmovs_rm(FS1,(uae_u32)temp_fp); + return FS1; + case 4: /* Word */ sign_extend_16_rr(S1,reg); mov_l_mr((uae_u32)temp_fp,S1); - delay2; fmovi_rm(FS1,(uae_u32)temp_fp); return FS1; - case 0: - mov_l_mr((uae_u32)temp_fp,reg); - delay2; + case 6: /* Byte */ + sign_extend_8_rr(S1,reg); + mov_l_mr((uae_u32)temp_fp,S1); fmovi_rm(FS1,(uae_u32)temp_fp); return FS1; - case 1: - mov_l_mr((uae_u32)temp_fp,reg); - delay2; - fmovs_rm(FS1,(uae_u32)temp_fp); - return FS1; default: return -1; } - return -1; /* Should be unreachable */ - case 1: - return -1; /* Genuine invalid instruction */ - default: - break; - } - /* OK, we *will* have to load something from an address. Let's make - sure we know how to handle that, or quit early --- i.e. *before* - we do any postincrement/predecrement that we may regret */ - - switch (size) { - case 3: - return -1; - case 0: - case 1: - case 2: - case 4: - case 5: - case 6: - break; - default: + case 1: /* An, invalid mode */ return -1; - } - - switch (mode) { - case 2: - ad=S1; /* We will change it, anyway ;-) */ - mov_l_rr(ad,reg+8); + case 2: /* (An) */ + mov_l_rr(S1,reg+8); break; - case 3: - ad=S1; - mov_l_rr(ad,reg+8); + case 3: /* (An)+ */ + mov_l_rr(S1,reg+8); lea_l_brr(reg+8,reg+8,(reg == 7?sz2[size]:sz1[size])); break; - case 4: - ad=S1; - + case 4: /* -(An) */ lea_l_brr(reg+8,reg+8,-(reg == 7?sz2[size]:sz1[size])); - mov_l_rr(ad,reg+8); + mov_l_rr(S1,reg+8); break; - case 5: - { - uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_rr(ad,reg+8); - lea_l_brr(ad,ad,off); - break; - } - case 6: - { + case 5: /* (d16,An) */ + { + uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); + mov_l_rr(S1,reg+8); + lea_l_brr(S1,S1,off); + break; + } + case 6: /* (d8,An,Xn) or (bd,An,Xn) or ([bd,An,Xn],od) or ([bd,An],Xn,od) */ + { uae_u32 dp=comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - calc_disp_ea_020(reg+8,dp,ad,S2); + calc_disp_ea_020(reg+8,dp,S1,S2); break; - } + } case 7: switch (reg) { - case 0: - { + case 0: /* (xxx).W */ + { uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_ri(ad,off); + mov_l_ri(S1,off); break; - } - case 1: - { + } + case 1: /* (xxx).L */ + { uae_u32 off=comp_get_ilong((m68k_pc_offset+=4)-4); - ad=S1; - mov_l_ri(ad,off); + mov_l_ri(S1,off); break; - } - case 2: - { + } + case 2: /* (d16,PC) */ + { uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; + m68k_pc_offset; uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_ri(ad,address+PC16off); - break; - } - case 3: - return -1; - tmppc = m68k_getpc (); - tmp = next_iword (); - ad = get_disp_ea_020 (tmppc, tmp); - break; - case 4: - { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; - ad=S1; - if (size == 6) - address++; - mov_l_ri(ad,address); - m68k_pc_offset+=sz2[size]; + mov_l_ri(S1,address+PC16off); break; - } - default: + } + case 3: /* (d8,PC,Xn) or (bd,PC,Xn) or ([bd,PC,Xn],od) or ([bd,PC],Xn,od) */ + return -1; /* rarely used, fallback to non-JIT */ + case 4: /* # < data >; Constants should be converted just once by the JIT */ + m68k_pc_offset+=sz2[size]; + switch (size) { + case 0: + { + uae_s32 li = comp_get_ilong(m68k_pc_offset-4); + float si = (float) li; + + if (li == (int) si) { + //write_log ("converted immediate LONG constant to SINGLE\n"); + fmovs_ri(FS1,*(uae_u32 *)&si); + return FS1; + } + //write_log ("immediate LONG constant\n"); + fmovl_ri(FS1,li); + return FS1; + } + case 1: + //write_log ("immediate SINGLE constant\n"); + fmovs_ri(FS1,comp_get_ilong(m68k_pc_offset-4)); + return FS1; + case 2: + //write_log ("immediate LONG DOUBLE constant\n"); + fmov_ext_ri(FS1,comp_get_ilong(m68k_pc_offset-4), + comp_get_ilong(m68k_pc_offset-8), + (comp_get_ilong(m68k_pc_offset-12)>>16)&0xffff); + return FS1; + case 4: + { + float si = (float)(uae_s16)comp_get_iword(m68k_pc_offset-2); + + //write_log ("converted immediate WORD constant to SINGLE\n"); + fmovs_ri(FS1,*(uae_u32 *)&si); + return FS1; + } + case 5: + { + uae_u32 longarray[] = {comp_get_ilong(m68k_pc_offset-4), + comp_get_ilong(m68k_pc_offset-8)}; + float si = (float)*(double *)longarray; + + if (*(double *)longarray == (double)si) { + //write_log ("SPEED GAIN: converted a DOUBLE constant to SINGLE\n"); + fmovs_ri(FS1,*(uae_u32 *)&si); + return FS1; + } + //write_log ("immediate DOUBLE constant\n"); + fmov_ri(FS1,longarray[0],longarray[1]); + return FS1; + } + case 6: + { + float si = (float)(uae_s8)comp_get_ibyte(m68k_pc_offset-2); + + //write_log ("immediate BYTE constant converted to SINGLE\n"); + fmovs_ri(FS1,*(uae_u32 *)&si); + return FS1; + } + default: /* never reached */ + return -1; + } + default: /* never reached */ return -1; } } switch (size) { - case 0: - readlong(ad,S2,S3); + case 0: /* Long */ + readlong(S1,S2,S3); mov_l_mr((uae_u32)temp_fp,S2); - delay2; fmovi_rm(FS1,(uae_u32)temp_fp); - break; - case 1: - readlong(ad,S2,S3); + return FS1; + case 1: /* Single */ + readlong(S1,S2,S3); mov_l_mr((uae_u32)temp_fp,S2); - delay2; fmovs_rm(FS1,(uae_u32)temp_fp); - break; - case 2: - readword(ad,S2,S3); + return FS1; + case 2: /* Long Double */ + readword(S1,S2,S3); mov_w_mr(((uae_u32)temp_fp)+8,S2); - add_l_ri(ad,4); - readlong(ad,S2,S3); + add_l_ri(S1,4); + readlong(S1,S2,S3); mov_l_mr((uae_u32)(temp_fp)+4,S2); - add_l_ri(ad,4); - readlong(ad,S2,S3); + add_l_ri(S1,4); + readlong(S1,S2,S3); mov_l_mr((uae_u32)(temp_fp),S2); - delay2; fmov_ext_rm(FS1,(uae_u32)(temp_fp)); - break; - case 3: - return -1; /* Some silly "packed" stuff */ - case 4: - readword(ad,S2,S3); + return FS1; + case 4: /* Word */ + readword(S1,S2,S3); sign_extend_16_rr(S2,S2); mov_l_mr((uae_u32)temp_fp,S2); - delay2; fmovi_rm(FS1,(uae_u32)temp_fp); - break; - case 5: - readlong(ad,S2,S3); + return FS1; + case 5: /* Double */ + readlong(S1,S2,S3); mov_l_mr(((uae_u32)temp_fp)+4,S2); - add_l_ri(ad,4); - readlong(ad,S2,S3); + add_l_ri(S1,4); + readlong(S1,S2,S3); mov_l_mr((uae_u32)(temp_fp),S2); - delay2; fmov_rm(FS1,(uae_u32)(temp_fp)); - break; - case 6: - readbyte(ad,S2,S3); + return FS1; + case 6: /* Byte */ + readbyte(S1,S2,S3); sign_extend_8_rr(S2,S2); mov_l_mr((uae_u32)temp_fp,S2); - delay2; fmovi_rm(FS1,(uae_u32)temp_fp); - break; + return FS1; default: return -1; } - return FS1; + return -1; } /* return of -1 means failure, >=0 means OK */ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) { - uae_u16 tmp; - uaecptr tmppc; - int size; - int mode; - int reg; - uae_u32 ad; static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 }; static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 }; + int reg = opcode & 7; + int mode = (opcode >> 3) & 7; + int size = (extra >> 10) & 7; - if ((extra & 0x4000) == 0) { - fmov_rr((extra>>10)&7,val); + if (!(extra & 0x4000)) { /* R/M=0, from FPx to FPy */ + fmov_rr(size,val); return 0; } + if (size == 3) /* packed decimal is not supported on 68040 */ + return -1; + if (size == 7) /* this size is not defined */ + return -1; - mode = (opcode >> 3) & 7; - reg = opcode & 7; - size = (extra >> 10) & 7; - ad = -1; switch (mode) { - case 0: + case 0: /* Dn */ switch (size) { - case 6: /* FMOVE.B FPx, reg */ + case 0: /* FMOVE.L FPx, Dn */ #if USE_X86_FPUCW if (!(regs.fpcr & 0xf0)) { /* if extended round to nearest */ mov_l_ri(S1,0x10); /* use extended round to zero mode */ fldcw_m_indexed(S1,(uae_u32)x86_fpucw); fmovi_mr((uae_u32)temp_fp,val); - mov_b_rm(reg,(uae_u32)temp_fp); + mov_l_rm(reg,(uae_u32)temp_fp); mov_l_rm(S1,(uae_u32)®s.fpcr); and_l_ri(S1,0xf0); /* restore control word */ fldcw_m_indexed(S1,(uae_u32)x86_fpucw); @@ -298,9 +290,13 @@ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) } #endif fmovi_mr((uae_u32)temp_fp,val); - mov_b_rm(reg,(uae_u32)temp_fp); + mov_l_rm(reg,(uae_u32)temp_fp); + return 0; + case 1: /* FMOVE.S FPx, Dn */ + fmovs_mr((uae_u32)temp_fp,val); + mov_l_rm(reg,(uae_u32)temp_fp); return 0; - case 4: /* FMOVE.W FPx, reg */ + case 4: /* FMOVE.W FPx, Dn */ #if USE_X86_FPUCW if (!(regs.fpcr & 0xf0)) { /* if extended round to nearest */ mov_l_ri(S1,0x10); /* use extended round to zero mode */ @@ -316,13 +312,13 @@ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) fmovi_mr((uae_u32)temp_fp,val); mov_w_rm(reg,(uae_u32)temp_fp); return 0; - case 0: /* FMOVE.L FPx, reg */ + case 6: /* FMOVE.B FPx, Dn */ #if USE_X86_FPUCW if (!(regs.fpcr & 0xf0)) { /* if extended round to nearest */ mov_l_ri(S1,0x10); /* use extended round to zero mode */ fldcw_m_indexed(S1,(uae_u32)x86_fpucw); fmovi_mr((uae_u32)temp_fp,val); - mov_l_rm(reg,(uae_u32)temp_fp); + mov_b_rm(reg,(uae_u32)temp_fp); mov_l_rm(S1,(uae_u32)®s.fpcr); and_l_ri(S1,0xf0); /* restore control word */ fldcw_m_indexed(S1,(uae_u32)x86_fpucw); @@ -330,174 +326,109 @@ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) } #endif fmovi_mr((uae_u32)temp_fp,val); - mov_l_rm(reg,(uae_u32)temp_fp); - return 0; - case 1: - fmovs_mr((uae_u32)temp_fp,val); - mov_l_rm(reg,(uae_u32)temp_fp); + mov_b_rm(reg,(uae_u32)temp_fp); return 0; default: return -1; } - case 1: - return -1; /* genuine invalid instruction */ - default: break; - } - - /* Let's make sure we get out *before* doing something silly if - we can't handle the size */ - switch (size) { - case 0: - case 4: - case 5: - case 6: - case 2: - case 1: - break; - case 3: - default: + case 1: /* An, invalid mode */ return -1; - } - - switch (mode) { - case 2: - ad=S1; - mov_l_rr(ad,reg+8); + case 2: /* (An) */ + mov_l_rr(S1,reg+8); break; - case 3: - ad=S1; - mov_l_rr(ad,reg+8); + case 3: /* (An)+ */ + mov_l_rr(S1,reg+8); lea_l_brr(reg+8,reg+8,(reg == 7?sz2[size]:sz1[size])); break; - case 4: - ad=S1; + case 4: /* -(An) */ lea_l_brr(reg+8,reg+8,-(reg == 7?sz2[size]:sz1[size])); - mov_l_rr(ad,reg+8); + mov_l_rr(S1,reg+8); break; - case 5: - { - uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_rr(ad,reg+8); - add_l_ri(ad,off); - break; - } - case 6: - { + case 5: /* (d16,An) */ + { + uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); + mov_l_rr(S1,reg+8); + add_l_ri(S1,off); + break; + } + case 6: /* (d8,An,Xn) or (bd,An,Xn) or ([bd,An,Xn],od) or ([bd,An],Xn,od) */ + { uae_u32 dp=comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - calc_disp_ea_020(reg+8,dp,ad,S2); + calc_disp_ea_020(reg+8,dp,S1,S2); break; - } + } case 7: switch (reg) { - case 0: - { + case 0: /* (xxx).W */ + { uae_u32 off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_ri(ad,off); + mov_l_ri(S1,off); break; - } - case 1: - { + } + case 1: /* (xxx).L */ + { uae_u32 off=comp_get_ilong((m68k_pc_offset+=4)-4); - ad=S1; - mov_l_ri(ad,off); - break; - } - case 2: - { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; - uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - ad=S1; - mov_l_ri(ad,address+PC16off); - break; - } - case 3: - return -1; - tmppc = m68k_getpc (); - tmp = next_iword (); - ad = get_disp_ea_020 (tmppc, tmp); - break; - case 4: - { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; - ad=S1; - mov_l_ri(ad,address); - m68k_pc_offset+=sz2[size]; + mov_l_ri(S1,off); break; - } - default: + } + default: /* All other modes are not allowed for FPx to */ + write_log ("JIT FMOVE FPx, Mode is not allowed %04x %04x\n",opcode,extra); return -1; } } switch (size) { - case 0: + case 0: /* Long */ fmovi_mr((uae_u32)temp_fp,val); - delay; mov_l_rm(S2,(uae_u32)temp_fp); - writelong_clobber(ad,S2,S3); - break; - case 1: + writelong_clobber(S1,S2,S3); + return 0; + case 1: /* Single */ fmovs_mr((uae_u32)temp_fp,val); - delay; mov_l_rm(S2,(uae_u32)temp_fp); - writelong_clobber(ad,S2,S3); - break; - case 2: + writelong_clobber(S1,S2,S3); + return 0; + case 2:/* Long Double */ fmov_ext_mr((uae_u32)temp_fp,val); - delay; mov_w_rm(S2,(uae_u32)temp_fp+8); - writeword_clobber(ad,S2,S3); - add_l_ri(ad,4); + writeword_clobber(S1,S2,S3); + add_l_ri(S1,4); mov_l_rm(S2,(uae_u32)temp_fp+4); - writelong_clobber(ad,S2,S3); - add_l_ri(ad,4); + writelong_clobber(S1,S2,S3); + add_l_ri(S1,4); mov_l_rm(S2,(uae_u32)temp_fp); - writelong_clobber(ad,S2,S3); - break; - case 3: return -1; /* Packed */ - - case 4: + writelong_clobber(S1,S2,S3); + return 0; + case 4: /* Word */ fmovi_mr((uae_u32)temp_fp,val); - delay; mov_l_rm(S2,(uae_u32)temp_fp); - writeword_clobber(ad,S2,S3); - break; - case 5: + writeword_clobber(S1,S2,S3); + return 0; + case 5: /* Double */ fmov_mr((uae_u32)temp_fp,val); - delay; mov_l_rm(S2,(uae_u32)temp_fp+4); - writelong_clobber(ad,S2,S3); - add_l_ri(ad,4); + writelong_clobber(S1,S2,S3); + add_l_ri(S1,4); mov_l_rm(S2,(uae_u32)temp_fp); - writelong_clobber(ad,S2,S3); - break; - case 6: + writelong_clobber(S1,S2,S3); + return 0; + case 6: /* Byte */ fmovi_mr((uae_u32)temp_fp,val); - delay; mov_l_rm(S2,(uae_u32)temp_fp); - writebyte(ad,S2,S3); - break; + writebyte(S1,S2,S3); + return 0; default: return -1; } - return 0; + return -1; } /* return -1 for failure, or register number for success */ -STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad) +STATIC_INLINE int get_fp_ad (uae_u32 opcode) { - uae_u16 tmp; - uaecptr tmppc; - int mode; - int reg; uae_s32 off; + int mode = (opcode >> 3) & 7; + int reg = opcode & 7; - mode = (opcode >> 3) & 7; - reg = opcode & 7; switch (mode) { case 0: case 1: @@ -507,17 +438,13 @@ STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad) case 4: mov_l_rr(S1,8+reg); return S1; - *ad = m68k_areg (regs, reg); - break; case 5: off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); - mov_l_rr(S1,8+reg); add_l_ri(S1,off); return S1; case 6: return -1; - break; case 7: switch (reg) { case 0: @@ -528,17 +455,6 @@ STATIC_INLINE int get_fp_ad (uae_u32 opcode, uae_u32 * ad) off=comp_get_ilong((m68k_pc_offset+=4)-4); mov_l_ri(S1,off); return S1; - case 2: - return -1; - *ad = m68k_getpc (); - *ad += (uae_s32) (uae_s16) next_iword (); - break; - case 3: - return -1; - tmppc = m68k_getpc (); - tmp = next_iword (); - *ad = get_disp_ea_020 (tmppc, tmp); - break; default: return -1; } @@ -550,11 +466,6 @@ void comp_fdbcc_opp (uae_u32 opcode, uae_u16 extra) { FAIL(1); return; - - if (!currprefs.compfpu) { - FAIL(1); - return; - } } void comp_fscc_opp (uae_u32 opcode, uae_u16 extra) @@ -613,22 +524,21 @@ void comp_fscc_opp (uae_u32 opcode, uae_u16 extra) case 15: mov_l_rr(S4,S1); break; } - if ((opcode & 0x38) == 0) { + if (!(opcode & 0x38)) mov_b_rr(reg,S4); - } else { + else { abort(); - if (get_fp_ad (opcode, &ad) == 0) { + if (!get_fp_ad (opcode)) { m68k_setpc (m68k_getpc () - 4); op_illg (opcode); - } else + } + else put_byte (ad, cc ? 0xff : 0x00); } } void comp_ftrapcc_opp (uae_u32 opcode, uaecptr oldpc) { - int cc; - FAIL(1); return; } @@ -638,10 +548,7 @@ extern unsigned long foink3, oink; void comp_fbcc_opp (uae_u32 opcode) { uae_u32 start_68k_offset=m68k_pc_offset; - uae_u32 off; - uae_u32 v1; - uae_u32 v2; - uae_u32 nh; + uae_u32 off, v1, v2; int cc; if (!currprefs.compfpu) { @@ -653,7 +560,7 @@ void comp_fbcc_opp (uae_u32 opcode) FAIL(1); return; } - if ((opcode&0x40)==0) { + if (!(opcode&0x40)) { off=(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); } else { @@ -800,7 +707,7 @@ void comp_fsave_opp (uae_u32 opcode) printf ("fsave_opp at %08lx\n", m68k_getpc ()); fflush (stdout); #endif - if (get_fp_ad (opcode, &ad) == 0) { + if (!get_fp_ad (opcode)) { m68k_setpc (m68k_getpc () - 2); op_illg (opcode); return; @@ -860,7 +767,7 @@ void comp_frestore_opp (uae_u32 opcode) printf ("frestore_opp at %08lx\n", m68k_getpc ()); fflush (stdout); #endif - if (get_fp_ad (opcode, &ad) == 0) { + if (!get_fp_ad (opcode)) { m68k_setpc (m68k_getpc () - 2); op_illg (opcode); return; @@ -871,8 +778,8 @@ void comp_frestore_opp (uae_u32 opcode) /* @@@ This may be wrong. */ ad -= 4; d = get_long (ad); - if ((d & 0xff000000) != 0) { /* Not a NULL frame? */ - if ((d & 0x00ff0000) == 0) { /* IDLE */ + if (d & 0xff000000) { /* Not a NULL frame? */ + if (!(d & 0x00ff0000)) { /* IDLE */ } else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */ ad -= 44; } else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */ @@ -882,8 +789,8 @@ void comp_frestore_opp (uae_u32 opcode) } else { d = get_long (ad); ad += 4; - if ((d & 0xff000000) != 0) { /* Not a NULL frame? */ - if ((d & 0x00ff0000) == 0) { /* IDLE */ + if (d & 0xff000000) { /* Not a NULL frame? */ + if (!(d & 0x00ff0000)) { /* IDLE */ } else if ((d & 0x00ff0000) == 0x00300000) { /* UNIMP */ ad += 44; } else if ((d & 0x00ff0000) == 0x00600000) { /* BUSY */ @@ -895,7 +802,7 @@ void comp_frestore_opp (uae_u32 opcode) if (incr < 0) { ad -= 4; d = get_long (ad); - if ((d & 0xff000000) != 0) { + if (d & 0xff000000) { if ((d & 0x00ff0000) == 0x00180000) ad -= 6 * 4; else if ((d & 0x00ff0000) == 0x00380000) @@ -906,7 +813,7 @@ void comp_frestore_opp (uae_u32 opcode) } else { d = get_long (ad); ad += 4; - if ((d & 0xff000000) != 0) { + if (d & 0xff000000) { if ((d & 0x00ff0000) == 0x00180000) ad += 6 * 4; else if ((d & 0x00ff0000) == 0x00380000) @@ -922,10 +829,10 @@ void comp_frestore_opp (uae_u32 opcode) m68k_areg (regs, opcode & 7) = ad; } -extern uae_u32 *xhex_pi, *xhex_exp_1, *xhex_l2_e, *xhex_ln_2, *xhex_ln_10; -extern uae_u32 *xhex_l10_2, *xhex_l10_e, *xhex_1e16, *xhex_1e32, *xhex_1e64; -extern uae_u32 *xhex_1e128, *xhex_1e256, *xhex_1e512, *xhex_1e1024; -extern uae_u32 *xhex_1e2048, *xhex_1e4096; +extern uae_u32 xhex_pi, xhex_exp_1, xhex_l2_e, xhex_ln_2, xhex_ln_10; +extern uae_u32 xhex_l10_2, xhex_l10_e, xhex_1e16, xhex_1e32, xhex_1e64; +extern uae_u32 xhex_1e128, xhex_1e256, xhex_1e512, xhex_1e1024; +extern uae_u32 xhex_1e2048, xhex_1e4096; extern double fp_1e8; extern float fp_1e1, fp_1e2, fp_1e4; @@ -938,9 +845,9 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) FAIL(1); return; } - switch ((extra >> 13) & 0x7) { + switch ((extra >> 13) & 7) { case 3: /* 2nd most common */ - if (put_fp_value ((extra >> 7)&7 , opcode, extra) < 0) { + if (put_fp_value ((extra >> 7) & 7, opcode, extra) < 0) { FAIL(1); return; } @@ -948,7 +855,7 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) case 6: case 7: { - uae_u32 ad, list = 0; + uae_u32 list = 0; int incr = 0; if (extra & 0x2000) { int ad; @@ -963,7 +870,7 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) default: FAIL(1); return; } - ad=get_fp_ad (opcode, &ad); + ad=get_fp_ad (opcode); if (ad<0) { FAIL(1); #if 0 @@ -986,10 +893,8 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) abort(); } while (list) { - uae_u32 wrd1, wrd2, wrd3; if (incr < 0) { /* Predecrement */ fmov_ext_mr((uae_u32)temp_fp,fpp_movem_index2[list]); - delay; sub_l_ri(ad,4); mov_l_rm(S2,(uae_u32)temp_fp); writelong_clobber(ad,S2,S3); @@ -1001,7 +906,6 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) writeword_clobber(ad,S2,S3); } else { /* postinc */ fmov_ext_mr((uae_u32)temp_fp,fpp_movem_index2[list]); - delay; mov_w_rm(S2,(uae_u32)temp_fp+8); writeword_clobber(ad,S2,S3); add_l_ri(ad,4); @@ -1031,7 +935,7 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) default: FAIL(1); return; } - ad=get_fp_ad (opcode, &ad); + ad=get_fp_ad (opcode); if (ad<0) { FAIL(1); #if 0 @@ -1055,7 +959,6 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) } while (list) { - uae_u32 wrd1, wrd2, wrd3; if (incr < 0) { sub_l_ri(ad,4); readlong(ad,S2,S3); @@ -1066,7 +969,6 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) sub_l_ri(ad,4); readword(ad,S2,S3); mov_w_mr(((uae_u32)temp_fp)+8,S2); - delay2; fmov_ext_rm(fpp_movem_index2[list],(uae_u32)(temp_fp)); } else { readword(ad,S2,S3); @@ -1078,7 +980,6 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) readlong(ad,S2,S3); mov_l_mr((uae_u32)(temp_fp),S2); add_l_ri(ad,4); - delay2; fmov_ext_rm(fpp_movem_index1[list],(uae_u32)(temp_fp)); } list = fpp_movem_next[list]; @@ -1171,13 +1072,13 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) fmov_log10_2(dreg); break; case 0x0c: - fmov_ext_rm(dreg,&xhex_exp_1); + fmov_ext_rm(dreg,(uae_u32)&xhex_exp_1); break; case 0x0d: fmov_log2_e(dreg); break; case 0x0e: - fmov_ext_rm(dreg,&xhex_l10_e); + fmov_ext_rm(dreg,(uae_u32)&xhex_l10_e); break; case 0x0f: fmov_0(dreg); @@ -1186,49 +1087,49 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) fmov_loge_2(dreg); break; case 0x31: - fmov_ext_rm(dreg,&xhex_ln_10); + fmov_ext_rm(dreg,(uae_u32)&xhex_ln_10); break; case 0x32: fmov_1(dreg); break; case 0x33: - fmovs_rm(dreg,&fp_1e1); + fmovs_rm(dreg,(uae_u32)&fp_1e1); break; case 0x34: - fmovs_rm(dreg,&fp_1e2); + fmovs_rm(dreg,(uae_u32)&fp_1e2); break; case 0x35: - fmovs_rm(dreg,&fp_1e4); + fmovs_rm(dreg,(uae_u32)&fp_1e4); break; case 0x36: - fmov_rm(dreg,&fp_1e8); + fmov_rm(dreg,(uae_u32)&fp_1e8); break; case 0x37: - fmov_ext_rm(dreg,&xhex_1e16); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e16); break; case 0x38: - fmov_ext_rm(dreg,&xhex_1e32); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e32); break; case 0x39: - fmov_ext_rm(dreg,&xhex_1e64); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e64); break; case 0x3a: - fmov_ext_rm(dreg,&xhex_1e128); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e128); break; case 0x3b: - fmov_ext_rm(dreg,&xhex_1e256); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e256); break; case 0x3c: - fmov_ext_rm(dreg,&xhex_1e512); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e512); break; case 0x3d: - fmov_ext_rm(dreg,&xhex_1e1024); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e1024); break; case 0x3e: - fmov_ext_rm(dreg,&xhex_1e2048); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e2048); break; case 0x3f: - fmov_ext_rm(dreg,&xhex_1e4096); + fmov_ext_rm(dreg,(uae_u32)&xhex_1e4096); break; default: FAIL(1); @@ -1261,10 +1162,10 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) /* If we have control over the CW, we can do this */ dont_care_fflags(); if ((sreg=get_fp_value(opcode,extra)) < 0) {FAIL(1);return;} - if ((regs.fpcr & 0x30) == 0x10) /* maybe unsafe, because this test is done */ + if ((regs.fpcr & 0xf0) == 0x10) /* maybe unsafe, because this test is done */ frndint_rr(dreg,sreg); /* during the JIT compilation and not at runtime */ else { - mov_l_ri(S1,(regs.fpcr & 0xC0) | 0x10); /* use round to zero */ + mov_l_ri(S1,0x10); /* extended round to zero */ fldcw_m_indexed(S1,(uae_u32)x86_fpucw); frndint_rr(dreg,sreg); mov_l_rm(S1,(uae_u32)®s.fpcr); diff --git a/compemu_raw_x86.c b/compemu_raw_x86.c index e06cc39d..950bc61f 100755 --- a/compemu_raw_x86.c +++ b/compemu_raw_x86.c @@ -1860,7 +1860,6 @@ int EvalException ( LPEXCEPTION_POINTERS blah, int n_except ) int size=4; int dir=-1; int len=0; - int j; if( n_except != STATUS_ACCESS_VIOLATION || !canbang) return EXCEPTION_CONTINUE_SEARCH; @@ -2136,6 +2135,8 @@ int EvalException ( LPEXCEPTION_POINTERS blah, int n_except ) #if 0 if (i) { + int j; + for (j=0;j<10;j++) { write_log("JIT: instruction byte %2d is 0x%02x\n",j,i[j]); } @@ -2942,6 +2943,68 @@ LOWFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r)) } LENDFUNC(NONE,WRITE,2,raw_fmovs_mr,(MEMW m, FR r)) +LOWFUNC(NONE,READ,2,raw_fmovl_ri,(FW r, IMMS i)) +{ + emit_byte(0x68); + emit_long(i); /* push immediate32 onto [esp] */ + emit_byte(0xdb); + emit_byte(0x04); + emit_byte(0x24); /* fild load m32int from [esp] */ + emit_byte(0x83); + emit_byte(0xc4); + emit_byte(0x04); /* add +4 to esp */ + tos_make(r); +} +LENDFUNC(NONE,READ,2,raw_fmovl_ri,(FW r, IMMS i)) + +LOWFUNC(NONE,READ,2,raw_fmovs_ri,(FW r, IMM i)) +{ + emit_byte(0x68); + emit_long(i); /* push immediate32 onto [esp] */ + emit_byte(0xd9); + emit_byte(0x04); + emit_byte(0x24); /* fld load m32real from [esp] */ + emit_byte(0x83); + emit_byte(0xc4); + emit_byte(0x04); /* add +4 to esp */ + tos_make(r); +} +LENDFUNC(NONE,READ,2,raw_fmovs_ri,(FW r, IMM i)) + +LOWFUNC(NONE,READ,3,raw_fmov_ri,(FW r, IMM i1, IMM i2)) +{ + emit_byte(0x68); + emit_long(i2); /* push immediate32 onto [esp] */ + emit_byte(0x68); + emit_long(i1); /* push immediate32 onto [esp] */ + emit_byte(0xdd); + emit_byte(0x04); + emit_byte(0x24); /* fld load m64real from [esp] */ + emit_byte(0x83); + emit_byte(0xc4); + emit_byte(0x08); /* add +8 to esp */ + tos_make(r); +} +LENDFUNC(NONE,READ,3,raw_fmov_ri,(FW r, IMM i1, IMM i2)) + +LOWFUNC(NONE,READ,4,raw_fmov_ext_ri,(FW r, IMM i1, IMM i2, IMM i3)) +{ + emit_byte(0x68); + emit_long(i3); /* push immediate32 onto [esp] */ + emit_byte(0x68); + emit_long(i2); /* push immediate32 onto [esp] */ + emit_byte(0x68); + emit_long(i1); /* push immediate32 onto [esp] */ + emit_byte(0xdb); + emit_byte(0x2c); + emit_byte(0x24); /* fld load m80real from [esp] */ + emit_byte(0x83); + emit_byte(0xc4); + emit_byte(0x0c); /* add +12 to esp */ + tos_make(r); +} +LENDFUNC(NONE,READ,4,raw_fmov_ext_ri,(FW r, IMM i1, IMM i2, IMMi3)) + LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r)) { int rs; @@ -2961,8 +3024,6 @@ LENDFUNC(NONE,WRITE,2,raw_fmov_ext_mr,(MEMW m, FR r)) LOWFUNC(NONE,WRITE,2,raw_fmov_ext_mr_drop,(MEMW m, FR r)) { - int rs; - make_tos(r); emit_byte(0xdb); /* store and pop it */ emit_byte(0x3d); @@ -3996,7 +4057,6 @@ LOWFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s)) } LENDFUNC(NONE,NONE,2,raw_frem1_rr,(FRW d, FR s)) - LOWFUNC(NONE,NONE,1,raw_ftst_r,(FR r)) { make_tos(r); @@ -4017,17 +4077,17 @@ static __inline__ void raw_fflags_into_flags(int r) emit_byte(0xd9); emit_byte(0xc9+p); /* swap top two around */ if (have_cmov) { - // gb-- fucomi is for P6 cores only, not K6-2 then... - emit_byte(0xdb); - emit_byte(0xe9+p); /* fucomi them */ + // gb-- fucomi is for P6 cores only, not K6-2 then... + emit_byte(0xdb); + emit_byte(0xe9+p); /* fucomi them */ } else { - emit_byte(0xdd); - emit_byte(0xe1+p); /* fucom them */ - emit_byte(0x9b); - emit_byte(0xdf); - emit_byte(0xe0); /* fstsw ax */ - raw_sahf(0); /* sahf */ + emit_byte(0xdd); + emit_byte(0xe1+p); /* fucom them */ + emit_byte(0x9b); + emit_byte(0xdf); + emit_byte(0xe0); /* fstsw ax */ + raw_sahf(0); /* sahf */ } emit_byte(0xdd); emit_byte(0xd9+p); /* store value back, and get rid of 0 */ diff --git a/compemu_support.c b/compemu_support.c index 343e823e..620c23f1 100755 --- a/compemu_support.c +++ b/compemu_support.c @@ -1035,7 +1035,6 @@ static void mov_nregs(int d, int s) static __inline__ void make_exclusive(int r, int size, int spec) { - int clobber; reg_status oldstate; int rr=live.state[r].realreg; int nr; @@ -1112,7 +1111,6 @@ static __inline__ void add_offset(int r, uae_u32 off) static __inline__ void remove_offset(int r, int spec) { - reg_status oldstate; int rr; if (isconst(r)) @@ -4099,6 +4097,38 @@ MIDFUNC(2,fmovs_mr,(MEMW m, FR r)) } MENDFUNC(2,fmovs_mr,(MEMW m, FR r)) +MIDFUNC(2,fmovl_ri,(FW r, IMMS i)) +{ + r=f_writereg(r); + raw_fmovl_ri(r,i); + f_unlock(r); +} +MENDFUNC(2,fmovl_ri,(FW r, IMMS i)) + +MIDFUNC(2,fmovs_ri,(FW r, IMM i)) +{ + r=f_writereg(r); + raw_fmovs_ri(r,i); + f_unlock(r); +} +MENDFUNC(2,fmovs_ri,(FW r, IMM i)) + +MIDFUNC(3,fmov_ri,(FW r, IMM i1, IMM i2)) +{ + r=f_writereg(r); + raw_fmov_ri(r,i1,i2); + f_unlock(r); +} +MENDFUNC(3,fmov_ri,(FW r, IMM i1, IMM i2)) + +MIDFUNC(4,fmov_ext_ri,(FW r, IMM i1, IMM i2, IMM i3)) +{ + r=f_writereg(r); + raw_fmov_ext_ri(r,i1,i2,i3); + f_unlock(r); +} +MENDFUNC(4,fmov_ext_ri,(FW r, IMM i1, IMM i2, IMM i3)) + MIDFUNC(2,fmov_ext_mr,(MEMW m, FR r)) { r=f_readreg(r); @@ -4542,7 +4572,7 @@ void sync_m68k_pc(void) ********************************************************************/ uae_u32 scratch[VREGS]; -fptype fscratch[VFREGS]; +fptype fscratch[VFREGS]; void init_comp(void) { @@ -4844,7 +4874,7 @@ static __inline__ void match_states(smallstate* s) /* Only do this if you really mean it! The next call should be to init!*/ void flush(int save_regs) { - int fi,i; + int i; log_flush(); flush_flags(); /* low level */ @@ -4898,7 +4928,7 @@ void flush(int save_regs) static void flush_keepflags(void) { - int fi,i; + int i; for (i=0;i point) continue; if ( !(bplcon3 & 2) && /* sprites outside playfields enabled? */ @@ -4274,15 +4271,16 @@ static void hsync_handler (void) cycle_line[5] = CYCLE_REFRESH; cycle_line[7] = CYCLE_REFRESH; } -#else +#endif +#if 0 { int i; for (i = 12; i < 0x16; i += 2) cycle_line[i] = CYCLE_NOCPU; - cycle_line[4] = CYCLE_REFRESH; - cycle_line[6] = CYCLE_REFRESH; - cycle_line[8] = CYCLE_REFRESH; - cycle_line[10] = CYCLE_REFRESH; + //cycle_line[4] = CYCLE_REFRESH; + //cycle_line[6] = CYCLE_REFRESH; + //cycle_line[8] = CYCLE_REFRESH; + //cycle_line[10] = CYCLE_REFRESH; } #endif } diff --git a/debug.c b/debug.c index 1fd13117..6265c773 100755 --- a/debug.c +++ b/debug.c @@ -43,6 +43,7 @@ static int memwatch_enabled, memwatch_triggered; int debugging; int exception_debugging; int debug_copper; +int debug_sprite_mask = 0xff; static uaecptr debug_copper_pc; extern int audio_channel_mask; @@ -1363,6 +1364,11 @@ static void debug_1 (void) case 's': if (*inptr == 'c') { screenshot (1, 1); + } else if (*inptr == 'm') { + next_char(&inptr); + if (more_params(&inptr)) + debug_sprite_mask = readint(&inptr); + console_out("sprite mask: %02.2X\n", debug_sprite_mask); } else { searchmem (&inptr); } diff --git a/drawing.c b/drawing.c index b81f708c..f0266b91 100755 --- a/drawing.c +++ b/drawing.c @@ -207,7 +207,7 @@ int coord_native_to_amiga_x (int x) { x += visible_left_border; x <<= (1 - lores_shift); - return x + 2*DISPLAY_LEFT_SHIFT - 2*DIW_DDF_OFFSET; + return x + 2 * DISPLAY_LEFT_SHIFT - 2 * DIW_DDF_OFFSET; } int coord_native_to_amiga_y (int y) @@ -1721,7 +1721,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; + visible_left_border &= ~((1 << lores_shift) - 1); /* Would the old value be good enough? If so, leave it as it is if we want to * be clever. */ diff --git a/fpp.c b/fpp.c index 78bce48e..f1365d00 100755 --- a/fpp.c +++ b/fpp.c @@ -287,19 +287,17 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src) { uaecptr tmppc; uae_u16 tmp; - int size; - int mode; - int reg; + int size, mode, reg; uae_u32 ad = 0; static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 }; static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 }; - if ((extra & 0x4000) == 0) { + if (!(extra & 0x4000)) { *src = regs.fp[(extra >> 10) & 7]; return 1; } - mode = (opcode >> 3) & 7; reg = opcode & 7; + mode = (opcode >> 3) & 7; size = (extra >> 10) & 7; switch (mode) { case 0: @@ -353,6 +351,7 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra, fptype *src) break; case 3: tmppc = m68k_getpc (); + write_log ("####### tpmpc %08lx\n", tmppc); tmp = next_iword (); ad = get_disp_ea_020 (tmppc, tmp); break; @@ -417,9 +416,7 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra) { uae_u16 tmp; uaecptr tmppc; - int size; - int mode; - int reg; + int size, mode, reg; uae_u32 ad; static int sz1[8] = { 4, 4, 12, 12, 2, 8, 1, 0 }; static int sz2[8] = { 4, 4, 12, 12, 2, 8, 2, 0 }; @@ -428,15 +425,14 @@ STATIC_INLINE int put_fp_value (fptype value, uae_u32 opcode, uae_u16 extra) if (!isinrom ()) write_log ("PUTFP: %f %04.4X %04.4X\n", value, opcode, extra); #endif - if ((extra & 0x4000) == 0) { + if (!(extra & 0x4000)) { regs.fp[(extra >> 10) & 7] = value; return 1; } - mode = (opcode >> 3) & 7; reg = opcode & 7; + mode = (opcode >> 3) & 7; size = (extra >> 10) & 7; ad = -1; - switch (mode) { case 0: switch (size) { @@ -1244,15 +1240,9 @@ void fpp_opp (uae_u32 opcode, uae_u16 extra) fptype tmp_fp; __asm { -#if USE_LONG_DOUBLE - fld tbyte ptr src + fld LDPTR src frndint - fstp tbyte ptr tmp_fp -#else - fld qword ptr src - frndint - fstp qword ptr tmp_fp -#endif + fstp LDPTR tmp_fp } regs.fp[reg] = tmp_fp; } diff --git a/gencomp.c b/gencomp.c index 1573cc4a..64e00591 100755 --- a/gencomp.c +++ b/gencomp.c @@ -1785,7 +1785,7 @@ gen_opcode (unsigned long int opcode) comprintf("\tcomp_pc_p=(void*)get_const(PC_P);\n"); break; case i_Bcc: - comprintf("\tuae_u32 v,v1,v2;\n"); + comprintf("\tuae_u32 v1,v2;\n"); genamode (curi->smode, "srcreg", curi->size, "src", 1, 0); /* That source is an immediate, so we can clobber it with abandon */ switch(curi->size) { @@ -1899,7 +1899,7 @@ gen_opcode (unsigned long int opcode) comprintf("\tsub_w_ri(src,1);\n"); comprintf("\t end_needflags();\n"); start_brace(); - comprintf("\tuae_u32 v2,v;\n" + comprintf("\tuae_u32 v2;\n" "\tuae_u32 v1=get_const(PC_P);\n"); comprintf("\tv2=get_const(offs);\n" "\tregister_branch(v1,v2,3);\n"); @@ -3057,7 +3057,11 @@ generate_func (int noflags) "#define PART_6 1\n" "#define PART_7 1\n" "#define PART_8 1\n" - "#endif\n\n"); + "#endif\n\n" + "extern void setzflg_l();\n" + "extern void comp_fpp_opp();\n" + "extern void comp_fscc_opp();\n" + "extern void comp_fbcc_opp();\n\n"); rp = 0; for (j = 1; j <= 8; ++j) diff --git a/include/compemu.h b/include/compemu.h index ada579b4..93e1f2b1 100755 --- a/include/compemu.h +++ b/include/compemu.h @@ -108,7 +108,7 @@ typedef struct { double val; uae_u8 status; uae_u8 realreg; - uae_u8 realind; + uae_u8 realind; uae_u8 needflush; } freg_status; @@ -207,6 +207,7 @@ extern bigstate live; extern int touchcnt; +#define IMMS uae_s32 #define IMM uae_u32 #define R1 uae_u32 #define R2 uae_u32 @@ -226,11 +227,11 @@ extern int touchcnt; #define FRW uae_u32 #define MIDFUNC(nargs,func,args) void func args -#define MENDFUNC(nargs,func,args) +#define MENDFUNC(nargs,func,args) #define COMPCALL(func) func #define LOWFUNC(flags,mem,nargs,func,args) static __inline__ void func args -#define LENDFUNC(flags,mem,nargs,func,args) +#define LENDFUNC(flags,mem,nargs,func,args) #if USE_OPTIMIZER #define REGALLOC_O 2 @@ -414,11 +415,15 @@ DECLARE(fmov_loge_2(FW r)); DECLARE(fmov_1(FW r)); DECLARE(fmov_0(FW r)); DECLARE(fmov_rm(FW r, MEMR m)); +DECLARE(fmov_mr(MEMW m, FR r)); DECLARE(fmovi_rm(FW r, MEMR m)); DECLARE(fmovi_mr(MEMW m, FR r)); DECLARE(fmovs_rm(FW r, MEMR m)); DECLARE(fmovs_mr(MEMW m, FR r)); -DECLARE(fmov_mr(MEMW m, FR r)); +DECLARE(fmovl_ri(FW r, IMMS i)); +DECLARE(fmovs_ri(FW r, IMM i)); +DECLARE(fmov_ri(FW r, IMM i1, IMM i2)); +DECLARE(fmov_ext_ri(FW r, IMM i1, IMM i2, IMM i3)); DECLARE(fmov_ext_mr(MEMW m, FR r)); DECLARE(fmov_ext_rm(FW r, MEMR m)); DECLARE(fmov_rr(FW d, FR s)); @@ -505,7 +510,7 @@ typedef struct blockinfo_t { cpuop_func* handler_to_use; /* The direct handler does not check for the correct address */ - cpuop_func* handler; + cpuop_func* handler; cpuop_func* direct_handler; cpuop_func* direct_pen; @@ -513,22 +518,22 @@ typedef struct blockinfo_t { uae_u8* nexthandler; uae_u8* pc_p; - - uae_u32 c1; + + uae_u32 c1; uae_u32 c2; uae_u32 len; struct blockinfo_t* next_same_cl; - struct blockinfo_t** prev_same_cl_p; + struct blockinfo_t** prev_same_cl_p; struct blockinfo_t* next; - struct blockinfo_t** prev_p; + struct blockinfo_t** prev_p; - uae_u32 min_pcp; - uae_u8 optlevel; - uae_u8 needed_flags; - uae_u8 status; + uae_u32 min_pcp; + uae_u8 optlevel; + uae_u8 needed_flags; + uae_u8 status; uae_u8 havestate; - + dependency dep[2]; /* Holds things we depend on */ dependency* deplist; /* List of things that depend on this */ smallstate env; diff --git a/include/debug.h b/include/debug.h index 0a229541..c3b460b3 100755 --- a/include/debug.h +++ b/include/debug.h @@ -14,6 +14,7 @@ extern int debugging; extern int exception_debugging; extern int debug_copper; +extern int debug_sprite_mask; extern void debug(void); extern void activate_debugger(void); diff --git a/include/newcpu.h b/include/newcpu.h index 88154c3d..6f501530 100755 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -72,8 +72,10 @@ typedef char flagtype; #if USE_LONG_DOUBLE typedef long double fptype; +#define LDPTR tbyte ptr #else typedef double fptype; +#define LDPTR qword ptr #endif #endif diff --git a/include/options.h b/include/options.h index 23a635c6..e09870ca 100755 --- a/include/options.h +++ b/include/options.h @@ -134,6 +134,7 @@ struct uae_prefs { int gfx_filter_scanlineratio; int gfx_filter_scanlinelevel; int gfx_filter_horiz_zoom, gfx_filter_vert_zoom; + int gfx_filter_horiz_zoom_mult, gfx_filter_vert_zoom_mult; int gfx_filter_horiz_offset, gfx_filter_vert_offset; int gfx_filter_filtermode; int color_mode; diff --git a/newcpu.c b/newcpu.c index 62d2f371..04ed254a 100755 --- a/newcpu.c +++ b/newcpu.c @@ -2549,8 +2549,8 @@ uae_u8 *save_cpu (int *len, uae_u8 *dstptr) MakeSR (); save_u32 (!regs.s ? regs.regs[15] : regs.usp); /* USP */ save_u32 (regs.s ? regs.regs[15] : regs.isp); /* ISP */ - save_u16 (regs.sr); /* SR/CCR */ - save_u32 (regs.stopped ? CPUMODE_HALT : 0); /* flags */ + save_u16 (regs.sr); /* SR/CCR */ + save_u32 (regs.stopped ? CPUMODE_HALT : 0); /* flags */ if(model >= 68010) { save_u32 (regs.dfc); /* DFC */ save_u32 (regs.sfc); /* SFC */ diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 5c1024f3..8ae54798 100755 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -426,10 +426,12 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) { int xm, ym; int fx, fy; - float x, y, sx, sy; + float x, y, sx, sy, tx, ty; + double mx, my; xm = currprefs.gfx_lores ? 2 : 1; ym = currprefs.gfx_linedbl ? 1 : 2; +#if 0 if (window_w >= 1024) xm *= 2; else if (window_w < 500) @@ -438,12 +440,18 @@ static void calc (float *xp, float *yp, float *sxp, float *syp) ym *= 2; else if (window_h < 350) ym /= 2; +#endif fx = (tin_w * xm - window_w) / 2; fy = (tin_h * ym - window_h) / 2; - x = (float)(window_w * currprefs.gfx_filter_horiz_offset / 100.0); - y = (float)(window_h * currprefs.gfx_filter_vert_offset / 100.0); - sx = x + (float)(twidth * window_w / tin_w) * ((currprefs.gfx_filter_horiz_zoom + 100) / 100.0); - sy = y + (float)(theight * window_h / tin_h) * ((currprefs.gfx_filter_vert_zoom + 100) / 100.0); + + mx = (currprefs.gfx_filter_horiz_zoom_mult * (currprefs.gfx_filter_horiz_zoom + 100)) / (100.0 * 1000.0); + my = (currprefs.gfx_filter_vert_zoom_mult * (currprefs.gfx_filter_vert_zoom + 100)) / (100.0 * 1000.0); + + tx = x = (float)((window_w * currprefs.gfx_filter_horiz_offset / 100.0) * mx); + ty = y = (float)((window_h * currprefs.gfx_filter_vert_offset / 100.0) * my); + sx = x + (float)((twidth * window_w / tin_w) * mx); + sy = y + (float)((theight * window_h / tin_h) * my); + x -= fx; y -= fy; sx += 2 * fx; sy += 2 * fy; *xp = x; *yp = y; diff --git a/od-win32/keyboard_win32.c b/od-win32/keyboard_win32.c index 832706bf..0fa560c1 100755 --- a/od-win32/keyboard_win32.c +++ b/od-win32/keyboard_win32.c @@ -163,7 +163,7 @@ static struct uae_input_device_kbr_default keytrans[] = { { DIK_HOME, INPUTEVENT_KEY_70 }, { DIK_END, INPUTEVENT_KEY_71 }, { DIK_SYSRQ, INPUTEVENT_KEY_6E }, - { DIK_F12, INPUTEVENT_KEY_6F }, +// { DIK_F12, INPUTEVENT_KEY_6F }, { DIK_INSERT, INPUTEVENT_KEY_47 }, { DIK_PRIOR, INPUTEVENT_KEY_48 }, { DIK_NEXT, INPUTEVENT_KEY_49 }, diff --git a/od-win32/md-fpp.h b/od-win32/md-fpp.h index 45ff78fb..aa0f1091 100755 --- a/od-win32/md-fpp.h +++ b/od-win32/md-fpp.h @@ -13,7 +13,7 @@ STATIC_INLINE long double to_exten(uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3) { uae_u32 longarray[] = {wrd3,wrd2,((wrd1>>16)&0xffff)}; // little endian - register long double *longdoublewords = longarray; + register long double *longdoublewords = (long double *)longarray; return(*longdoublewords); } @@ -21,8 +21,8 @@ STATIC_INLINE long double to_exten(uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3) STATIC_INLINE void from_exten(long double src, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3) { - register uae_u32 *longarray = &src; - register uae_u16 *finalword = &src + 8; + register uae_u32 *longarray = (uae_u32 *)&src; + register uae_u16 *finalword = (uae_u16 *)(&src + 8); *wrd1 = ((uae_u32)*finalword)<<16; *wrd2 = longarray[1]; diff --git a/od-win32/opengl.c b/od-win32/opengl.c index 4f66462e..2f145281 100755 --- a/od-win32/opengl.c +++ b/od-win32/opengl.c @@ -459,7 +459,7 @@ void OGL_resize (int width, int height) static void OGL_dorender (int newtex) { - float x1, y1, x2, y2; + float x1, y1, x2, y2, tx, ty; uae_u8 *data = gfxvidinfo.bufmem; int fx, fy, xm, ym; @@ -483,10 +483,12 @@ static void OGL_dorender (int newtex) glMatrixMode (GL_MODELVIEW); glLoadIdentity (); - x1 = (float)(w_width * currprefs.gfx_filter_horiz_offset / 100.0); - y1 = (float)(w_height * currprefs.gfx_filter_vert_offset / 100.0); - x2 = x1 + (float)((required_texture_size * w_width / t_width) * (currprefs.gfx_filter_horiz_zoom + 100) / 100.0); - y2 = y1 + (float)((required_texture_size * w_height / t_height) * (currprefs.gfx_filter_vert_zoom + 100)/ 100.0); + tx = x1 = (float)(w_width * currprefs.gfx_filter_horiz_offset / 100.0); + ty = y1 = (float)(w_height * currprefs.gfx_filter_vert_offset / 100.0); + x2 = x1 + (float)((required_texture_size * w_width / t_width) * ((currprefs.gfx_filter_horiz_zoom_mult * (currprefs.gfx_filter_horiz_zoom + 100)) / (100.0 * 1000.0))); + y2 = y1 + (float)((required_texture_size * w_height / t_height) * ((currprefs.gfx_filter_vert_zoom_mult * (currprefs.gfx_filter_vert_zoom + 100)) / (100.0 * 1000.0))); + x1 += (x2 - tx) / 2; + y1 += (y2 - ty) / 2; x1 -= fx; y1 -= fy; x2 += 2 * fx; y2 += 2 * fy; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 1adc0dba..bd28b008 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -695,6 +695,7 @@ #define IDC_OPENGLSLR 1625 #define IDC_FILTERSLR 1625 #define IDC_OPENGLSLV 1626 +#define IDC_FILTERHZMULT 1626 #define IDC_OPENGLBITS 1627 #define IDC_OPENGLMODE 1627 #define IDC_FILTERMODE 1627 @@ -717,6 +718,8 @@ #define IDC_FILTERPRESETDELETE 1634 #define IDC_HARDDRIVE 1635 #define IDC_INACTIVE_PRI 1635 +#define IDC_FILTERSLR3 1635 +#define IDC_FILTERVZMULT 1635 #define IDC_SOUNDPRIMARY 1636 #define IDC_MINIMIZED_PRI 1636 #define IDC_VOLUME_BOOTPRI_TEXT 1637 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 6a89fc0c..a84020ad 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -551,29 +551,31 @@ BEGIN COMBOBOX IDC_FILTERMODE,67,15,56,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERFILTER,128,15,65,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,197,15,73,14 - RTEXT "Horizontal size:",-1,21,44,61,10,SS_CENTERIMAGE - CONTROL "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,37,158,19 - EDITTEXT IDC_FILTERHZV,248,40,34,12,ES_CENTER | ES_READONLY - RTEXT "Vertical size:",-1,22,64,61,10,SS_CENTERIMAGE - CONTROL "Slider1",IDC_FILTERVZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,57,157,19 - EDITTEXT IDC_FILTERVZV,248,59,34,12,ES_CENTER | ES_READONLY - RTEXT "Horizontal position:",-1,22,84,61,10,SS_CENTERIMAGE - CONTROL "Slider1",IDC_FILTERHO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,77,157,19 - EDITTEXT IDC_FILTERHOV,248,79,34,12,ES_CENTER | ES_READONLY - RTEXT "Vertical position:",-1,22,103,61,10,SS_CENTERIMAGE - CONTROL "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,97,157,19 - EDITTEXT IDC_FILTERVOV,248,101,34,12,ES_CENTER | ES_READONLY + RTEXT "Horizontal size:",-1,9,44,59,10,SS_CENTERIMAGE + CONTROL "Slider1",IDC_FILTERHZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,108,37,142,19 + EDITTEXT IDC_FILTERHZV,253,40,34,12,ES_CENTER | ES_READONLY + RTEXT "Vertical size:",-1,10,64,59,10,SS_CENTERIMAGE + CONTROL "Slider1",IDC_FILTERVZ,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,108,57,142,19 + EDITTEXT IDC_FILTERVZV,253,59,34,12,ES_CENTER | ES_READONLY + RTEXT "Horizontal position:",-1,10,84,59,10,SS_CENTERIMAGE + CONTROL "Slider1",IDC_FILTERHO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,108,77,141,19 + EDITTEXT IDC_FILTERHOV,253,79,34,12,ES_CENTER | ES_READONLY + RTEXT "Vertical position:",-1,10,103,59,10,SS_CENTERIMAGE + CONTROL "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,108,99,141,19 + EDITTEXT IDC_FILTERVOV,253,101,34,12,ES_CENTER | ES_READONLY RTEXT "Scanlines:",-1,27,133,57,10,SS_CENTERIMAGE - CONTROL "Slider1",IDC_FILTERSL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,126,157,19 - EDITTEXT IDC_FILTERSLV,248,128,34,12,ES_CENTER | ES_READONLY + CONTROL "Slider1",IDC_FILTERSL,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,94,126,157,19 + EDITTEXT IDC_FILTERSLV,253,128,34,12,ES_CENTER | ES_READONLY COMBOBOX IDC_FILTERSLR,56,146,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - CONTROL "Slider1",IDC_FILTERSL2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,89,146,157,19 - EDITTEXT IDC_FILTERSL2V,248,151,34,12,ES_CENTER | ES_READONLY + CONTROL "Slider1",IDC_FILTERSL2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,94,146,157,19 + EDITTEXT IDC_FILTERSL2V,253,151,34,12,ES_CENTER | ES_READONLY GROUPBOX "Presets",-1,0,176,296,36 COMBOBOX IDC_FILTERPRESETS,8,190,119,150,CBS_DROPDOWN | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Load",IDC_FILTERPRESETLOAD,132,189,47,14 PUSHBUTTON "Save",IDC_FILTERPRESETSAVE,184,189,47,14 PUSHBUTTON "Delete",IDC_FILTERPRESETDELETE,236,189,47,14 + COMBOBOX IDC_FILTERHZMULT,77,43,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERVZMULT,77,63,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END IDD_HARDDRIVE DIALOGEX 0, 0, 300, 66 diff --git a/od-win32/win32.c b/od-win32/win32.c index 49a4830c..5d7deb2e 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -2179,13 +2179,13 @@ static int dxdetect (void) #if !defined(WIN64) /* believe or not but this is MS supported way of detecting DX8+ */ HMODULE h = LoadLibrary("D3D8.DLL"); - char szWrongDXVersion[ MAX_DPATH ]; + char szWrongDXVersion[MAX_DPATH]; if (h) { FreeLibrary (h); return 1; } - WIN32GUI_LoadUIString( IDS_WRONGDXVERSION, szWrongDXVersion, MAX_DPATH ); - pre_gui_message( szWrongDXVersion ); + WIN32GUI_LoadUIString(IDS_WRONGDXVERSION, szWrongDXVersion, MAX_DPATH); + pre_gui_message(szWrongDXVersion); return 0; #else return 1; @@ -2205,49 +2205,49 @@ static int isadminpriv (void) int isadmin = 0; // Open a handle to the access token for the calling process. - if (!OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &hToken )) { - write_log ( "OpenProcessToken Error %u\n", GetLastError() ); + if (!OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &hToken)) { + write_log ("OpenProcessToken Error %u\n", GetLastError()); return FALSE; } // Call GetTokenInformation to get the buffer size. if(!GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize)) { dwResult = GetLastError(); - if( dwResult != ERROR_INSUFFICIENT_BUFFER ) { - write_log( "GetTokenInformation Error %u\n", dwResult ); + if(dwResult != ERROR_INSUFFICIENT_BUFFER) { + write_log("GetTokenInformation Error %u\n", dwResult); return FALSE; } } // Allocate the buffer. - pGroupInfo = (PTOKEN_GROUPS) GlobalAlloc( GPTR, dwSize ); + pGroupInfo = (PTOKEN_GROUPS)GlobalAlloc(GPTR, dwSize); // Call GetTokenInformation again to get the group information. - if(! GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize ) ) { - write_log ( "GetTokenInformation Error %u\n", GetLastError() ); + if(!GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) { + write_log ("GetTokenInformation Error %u\n", GetLastError()); return FALSE; } // Create a SID for the BUILTIN\Administrators group. - if(! AllocateAndInitializeSid( &SIDAuth, 2, + if(!AllocateAndInitializeSid(&SIDAuth, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, - &pSID) ) { + &pSID)) { write_log( "AllocateAndInitializeSid Error %u\n", GetLastError() ); return FALSE; } // Loop through the group SIDs looking for the administrator SID. - for(i=0; iGroupCount; i++) { - if ( EqualSid(pSID, pGroupInfo->Groups[i].Sid) ) + for(i = 0; i < pGroupInfo->GroupCount; i++) { + if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) isadmin = 1; } if (pSID) FreeSid(pSID); - if ( pGroupInfo ) - GlobalFree( pGroupInfo ); + if (pGroupInfo) + GlobalFree(pGroupInfo); return isadmin; } @@ -2357,7 +2357,7 @@ static void getstartpaths(int start_data) } p = getenv("AMIGAFOREVERDATA"); - if (p && 0) { + if (p) { strcpy (tmp, p); fixtrailing(tmp); strcpy (start_path_af, p); diff --git a/od-win32/win32.h b/od-win32/win32.h index 8fdb8e63..3dbae2c1 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed; extern int mouseactive, focus; extern int ignore_messages_all; #define WINUAEBETA 1 -#define WINUAEBETASTR " Beta 2" +#define WINUAEBETASTR " Beta 3" extern char start_path_exe[MAX_DPATH]; extern char start_path_data[MAX_DPATH]; diff --git a/od-win32/win32_scale2x.c b/od-win32/win32_scale2x.c index cc9f4cc6..837570c2 100755 --- a/od-win32/win32_scale2x.c +++ b/od-win32/win32_scale2x.c @@ -109,12 +109,12 @@ void S2X_render (void) sptr = gfxvidinfo.bufmem; endsptr = gfxvidinfo.realbufmem + (amiga_height - 1) * 3 * gfxvidinfo.rowbytes; - v = currprefs.gfx_filter_horiz_offset; + v = currprefs.gfx_filter_horiz_offset / 10; v += (dst_width / scale - amiga_width) / 8; sptr += -v * (amiga_depth / 8) * 4; aw -= -v * 4; - v = currprefs.gfx_filter_vert_offset; + v = currprefs.gfx_filter_vert_offset / 10; v += (dst_height / scale - amiga_height) / 8; sptr += -v * gfxvidinfo.rowbytes * 4; ah -= -v * 4; @@ -129,11 +129,17 @@ void S2X_render (void) if (aw < 16) return; - if (currprefs.gfx_filter_horiz_zoom || currprefs.gfx_filter_vert_zoom) { - sr.left = currprefs.gfx_filter_horiz_zoom * 2; - sr.top = currprefs.gfx_filter_vert_zoom * 2; - sr.right = dst_width - currprefs.gfx_filter_horiz_zoom * 2; - sr.bottom = dst_height - currprefs.gfx_filter_vert_zoom * 2; + if (currprefs.gfx_filter_horiz_zoom || currprefs.gfx_filter_vert_zoom || + currprefs.gfx_filter_horiz_zoom_mult != 1000 || + currprefs.gfx_filter_vert_zoom_mult != 1000) { + int wz = dst_width * currprefs.gfx_filter_horiz_zoom_mult / 1000; + int hz = dst_height * currprefs.gfx_filter_vert_zoom_mult / 1000; + wz += currprefs.gfx_filter_horiz_zoom / 4; + hz += currprefs.gfx_filter_vert_zoom / 4; + sr.left = (dst_width - wz) / 2; + sr.top = (dst_height - hz) / 2; + sr.right = sr.left + wz; + sr.bottom = sr.top + hz; dr.left = dr.top = 0; dr.right = dst_width; dr.bottom = dst_height; @@ -145,9 +151,9 @@ void S2X_render (void) dr.left = -sr.left; sr.left = 0; } - if (sr.right > dst_width) { + if (sr.right - sr.left > dst_width) { dr.right = dst_width - (sr.right - dst_width); - sr.right = dst_width; + sr.right = sr.left + dst_width; } if (sr.top >= sr.bottom) { sr.top = dst_height / 2 - 1; @@ -157,9 +163,9 @@ void S2X_render (void) dr.top = -sr.top; sr.top = 0; } - if (sr.bottom > dst_height) { + if (sr.bottom - sr.top > dst_height) { dr.bottom = dst_height - (sr.bottom - dst_height); - sr.bottom = dst_height; + sr.bottom = sr.top + dst_height; } if (tempsurf && sr.left != 0 || sr.top != 0 || sr.right != dst_width || sr.bottom != dst_height || @@ -255,7 +261,7 @@ void S2X_render (void) if (amiga_depth == dst_depth) { int y; for (y = 0; y < dst_height; y++) { - if (sptr < endsptr) + if (sptr < endsptr && sptr >= gfxvidinfo.bufmem) memcpy (dptr, sptr, dst_width * dst_depth / 8); else memset (dptr, 0, dst_width * dst_depth / 8); diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index a8a7b936..473ac666 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -114,6 +114,7 @@ static struct winuae_modes wmodes[] = }, { 1, "Fullscreen", +// DM_OVERLAY | DM_W_FULLSCREEN | DM_DX_DIRECT | DM_DDRAW, DM_DX_FULLSCREEN | DM_DX_DIRECT | DM_DDRAW, DM_DX_FULLSCREEN | DM_DX_DIRECT | DM_DDRAW | DM_PICASSO96 }, @@ -338,11 +339,6 @@ static int set_ddraw (void) write_log( "set_ddraw: Couldn't GetDisplayMode()\n" ); goto oops; } -#if 0 - } else if (wfullscreen) { - if (!do_changedisplaysettings (width, height, bits, currentmode->frequency)) - goto oops2; -#endif } if (dd) { @@ -528,6 +524,7 @@ static void modesList (void) BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx, HMONITOR hm) { struct MultiDisplay *md = Displays; + MONITORINFOEX lpmi; while (md->name) { if (md - Displays >= MAX_DISPLAYS) @@ -535,10 +532,15 @@ BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx, md++; } md->name = my_strdup (desc); - if (guid == 0) + if (guid == 0) { + POINT pt = { 0, 0 }; md->primary = 1; - else + lpmi.cbSize = sizeof (lpmi); + GetMonitorInfo(MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&lpmi); + md->rect = lpmi.rcMonitor; + } else { memcpy (&md->guid, guid, sizeof (GUID)); + } write_log ("'%s' '%s' %s\n", desc, name, outGUID(guid)); return 1; } @@ -1723,7 +1725,8 @@ static void createstatuswindow (void) static int create_windows (void) { - int fs = currentmode->flags & (DM_W_FULLSCREEN | DM_DX_FULLSCREEN | DM_D3D_FULLSCREEN); + int dxfs = currentmode->flags & (DM_DX_FULLSCREEN | DM_D3D_FULLSCREEN); + int fsw = currentmode->flags & (DM_W_FULLSCREEN); DWORD exstyle = currprefs.win32_notaskbarbutton ? 0 : WS_EX_APPWINDOW; DWORD flags = 0; HWND hhWnd = currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL; @@ -1740,7 +1743,7 @@ static int create_windows (void) if (borderless) cymenu = cyborder = cxborder = 0; - if (!fs) { + if (!dxfs) { RECT rc; LONG stored_x = 1, stored_y = cymenu + cyborder; DWORD regkeytype; @@ -1748,8 +1751,8 @@ static int create_windows (void) int oldx, oldy; int first = 2; - RegQueryValueEx( hWinUAEKey, "xPos", 0, ®keytype, (LPBYTE)&stored_x, ®keysize ); - RegQueryValueEx( hWinUAEKey, "yPos", 0, ®keytype, (LPBYTE)&stored_y, ®keysize ); + RegQueryValueEx(hWinUAEKey, "xPos", 0, ®keytype, (LPBYTE)&stored_x, ®keysize); + RegQueryValueEx(hWinUAEKey, "yPos", 0, ®keytype, (LPBYTE)&stored_y, ®keysize); while (first) { first--; @@ -1784,13 +1787,15 @@ static int create_windows (void) } break; } -#if 0 - if (currprefs.gfx_display > 0) { + + if (fsw) { rc = Displays[currprefs.gfx_display].rect; flags |= WS_EX_TOPMOST; style = WS_POPUP; + currentmode->current_width = rc.right - rc.left; + currentmode->current_height = rc.bottom - rc.top; } -#endif + flags |= (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0); if (!borderless) { @@ -1805,7 +1810,8 @@ static int create_windows (void) write_log ("main window creation failed\n"); return 0; } - createstatuswindow (); + if (!(currentmode->flags & DM_W_FULLSCREEN)) + createstatuswindow (); } else { x = rc.left; y = rc.top; @@ -1813,7 +1819,7 @@ static int create_windows (void) } - hAmigaWnd = CreateWindowEx (fs ? WS_EX_ACCEPTFILES | WS_EX_TOPMOST : WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0), + hAmigaWnd = CreateWindowEx (dxfs ? WS_EX_ACCEPTFILES | WS_EX_TOPMOST : WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0), "AmigaPowah", "WinUAE", WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP), x, y, diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 2752bbcb..a60ac10e 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -684,11 +684,15 @@ static void m(void) } /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */ -void gui_display( int shortcut ) +void gui_display(int shortcut) { + static int here; int flipflop = 0; HRESULT hr; + if (here) + return; + here++; screenshot_prepare(); #ifdef D3D D3D_guimode (TRUE); @@ -767,6 +771,7 @@ void gui_display( int shortcut ) DX_SetPalette (0, 256); #endif screenshot_free(); + here--; } static void prefs_to_gui (struct uae_prefs *p) @@ -4408,62 +4413,73 @@ static void values_to_miscdlg (HWND hDlg) char txt[100]; int cw; - CheckDlgButton (hDlg, IDC_SOCKETS, workprefs.socket_emu); - CheckDlgButton (hDlg, IDC_ILLEGAL, workprefs.illegal_mem); - CheckDlgButton (hDlg, IDC_SHOWGUI, workprefs.start_gui); - CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse); - CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile); - CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); - CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause); - CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause); - CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause); - CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit); - CheckDlgButton (hDlg, IDC_NOOVERLAY, workprefs.win32_no_overlay); - CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen); - CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi); - CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton); - CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop); - CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack); - cw = catweasel_detect(); - EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), cw); - if (!cw && workprefs.catweasel < 100) - workprefs.catweasel = 0; - CheckDlgButton (hDlg, IDC_CATWEASEL, workprefs.catweasel); - CheckDlgButton (hDlg, IDC_STATE_CAPTURE, workprefs.statecapture); - - misc_kbled (hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]); - misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]); - misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]); - - misc_addpri (hDlg, IDC_ACTIVE_PRIORITY, workprefs.win32_active_priority); - misc_addpri (hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority); - misc_addpri (hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority); - - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"1"); - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"5"); - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"10"); - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"20"); - SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"30"); - sprintf (txt, "%d", workprefs.statecapturerate / 50); - SendDlgItemMessage( hDlg, IDC_STATE_RATE, WM_SETTEXT, 0, (LPARAM)txt); - - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"5"); - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"10"); - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"20"); - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"50"); - SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"100"); - sprintf (txt, "%d", workprefs.statecapturebuffersize / (1024 * 1024)); - SendDlgItemMessage( hDlg, IDC_STATE_BUFFERSIZE, WM_SETTEXT, 0, (LPARAM)txt); - - misc_scsi(hDlg); + if (currentpage == MISC1_ID) { + + CheckDlgButton (hDlg, IDC_SOCKETS, workprefs.socket_emu); + CheckDlgButton (hDlg, IDC_ILLEGAL, workprefs.illegal_mem); + CheckDlgButton (hDlg, IDC_SHOWGUI, workprefs.start_gui); + CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse); + CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile); + CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); + CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause); + CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause); + CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause); + CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit); + CheckDlgButton (hDlg, IDC_NOOVERLAY, workprefs.win32_no_overlay); + CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen); + CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi); + CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton); + CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop); + CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack); + cw = catweasel_detect(); + EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), cw); + if (!cw && workprefs.catweasel < 100) + workprefs.catweasel = 0; + CheckDlgButton (hDlg, IDC_CATWEASEL, workprefs.catweasel); + CheckDlgButton (hDlg, IDC_STATE_CAPTURE, workprefs.statecapture); + + misc_kbled (hDlg, IDC_KBLED1, workprefs.keyboard_leds[0]); + misc_kbled (hDlg, IDC_KBLED2, workprefs.keyboard_leds[1]); + misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]); + + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"1"); + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"5"); + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"10"); + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"20"); + SendDlgItemMessage (hDlg, IDC_STATE_RATE, CB_ADDSTRING, 0, (LPARAM)"30"); + sprintf (txt, "%d", workprefs.statecapturerate / 50); + SendDlgItemMessage( hDlg, IDC_STATE_RATE, WM_SETTEXT, 0, (LPARAM)txt); + + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"5"); + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"10"); + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"20"); + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"50"); + SendDlgItemMessage (hDlg, IDC_STATE_BUFFERSIZE, CB_ADDSTRING, 0, (LPARAM)"100"); + sprintf (txt, "%d", workprefs.statecapturebuffersize / (1024 * 1024)); + SendDlgItemMessage( hDlg, IDC_STATE_BUFFERSIZE, WM_SETTEXT, 0, (LPARAM)txt); + + misc_scsi(hDlg); + + } else if (currentpage == MISC2_ID) { + + misc_addpri (hDlg, IDC_ACTIVE_PRIORITY, workprefs.win32_active_priority); + misc_addpri (hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority); + misc_addpri (hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority); + + } } static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { char txt[100]; int v; + static int recursive; + + if (recursive) + return FALSE; + recursive++; switch (msg) { @@ -4471,6 +4487,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_USER: values_to_miscdlg (hDlg); enable_for_miscdlg (hDlg); + recursive--; return TRUE; case WM_COMMAND: @@ -4585,16 +4602,18 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) workprefs.win32_kbledmode = IsDlgButtonChecked (hDlg, IDC_KBLED_USB) ? 1 : 0; break; } + recursive--; return TRUE; } + recursive--; return FALSE; } static INT_PTR CALLBACK MiscDlgProc1 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + currentpage = MISC1_ID; if (msg == WM_INITDIALOG) { pages[MISC1_ID] = hDlg; - currentpage = MISC1_ID; values_to_miscdlg (hDlg); enable_for_miscdlg (hDlg); return TRUE; @@ -4604,9 +4623,9 @@ static INT_PTR CALLBACK MiscDlgProc1 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM static INT_PTR CALLBACK MiscDlgProc2 (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + currentpage = MISC2_ID; if (msg == WM_INITDIALOG) { pages[MISC2_ID] = hDlg; - currentpage = MISC2_ID; values_to_miscdlg (hDlg); enable_for_miscdlg (hDlg); return TRUE; @@ -7497,6 +7516,8 @@ static void enable_for_hw3ddlg (HWND hDlg) CheckDlgButton( hDlg, IDC_FILTERENABLE, v ); EnableWindow (GetDlgItem (hDlg, IDC_FILTERHZ), v); EnableWindow (GetDlgItem (hDlg, IDC_FILTERVZ), v); + EnableWindow (GetDlgItem (hDlg, IDC_FILTERHZMULT), v); + EnableWindow (GetDlgItem (hDlg, IDC_FILTERVZMULT), v); EnableWindow (GetDlgItem (hDlg, IDC_FILTERHO), v); EnableWindow (GetDlgItem (hDlg, IDC_FILTERVO), v); EnableWindow (GetDlgItem (hDlg, IDC_FILTERSLR), vv2); @@ -7522,6 +7543,8 @@ static void makefilter(char *s, int x, int flags) strcat (s, " (32bit)"); } +static char *filtermultnames[] = { "1", "2", "4", "6", "8", NULL }; +static int filtermults[] = { 1000, 500, 250, 167, 125 }; static void values_to_hw3ddlg (HWND hDlg) { char txt[100], tmp[100]; @@ -7529,18 +7552,18 @@ static void values_to_hw3ddlg (HWND hDlg) struct uae_filter *uf; HKEY fkey; - SendDlgItemMessage( hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-99, +99) ); - SendDlgItemMessage( hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1 ); - SendDlgItemMessage( hDlg, IDC_FILTERVZ, TBM_SETRANGE, TRUE, MAKELONG (-99, +99) ); - SendDlgItemMessage( hDlg, IDC_FILTERVZ, TBM_SETPAGESIZE, 0, 1 ); - SendDlgItemMessage( hDlg, IDC_FILTERHO, TBM_SETRANGE, TRUE, MAKELONG (-99, +99) ); - SendDlgItemMessage( hDlg, IDC_FILTERHO, TBM_SETPAGESIZE, 0, 1 ); - SendDlgItemMessage( hDlg, IDC_FILTERVO, TBM_SETRANGE, TRUE, MAKELONG (-50, +50) ); - SendDlgItemMessage( hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 1 ); - SendDlgItemMessage( hDlg, IDC_FILTERSL, TBM_SETRANGE, TRUE, MAKELONG ( 0, +100) ); - SendDlgItemMessage( hDlg, IDC_FILTERSL, TBM_SETPAGESIZE, 0, 10 ); - SendDlgItemMessage( hDlg, IDC_FILTERSL2, TBM_SETRANGE, TRUE, MAKELONG ( 0, +100) ); - SendDlgItemMessage( hDlg, IDC_FILTERSL2, TBM_SETPAGESIZE, 0, 10 ); + SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999)); + SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999)); + SendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hDlg, IDC_FILTERHO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999)); + SendDlgItemMessage(hDlg, IDC_FILTERHO, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999)); + SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hDlg, IDC_FILTERSL, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000)); + SendDlgItemMessage(hDlg, IDC_FILTERSL, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hDlg, IDC_FILTERSL2, TBM_SETRANGE, TRUE, MAKELONG ( 0, +1000)); + SendDlgItemMessage(hDlg, IDC_FILTERSL2, TBM_SETPAGESIZE, 0, 10); SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_RESETCONTENT, 0, 0L); uf = &uaefilters[0]; @@ -7573,7 +7596,7 @@ static void values_to_hw3ddlg (HWND hDlg) } i++; } - SendDlgItemMessage( hDlg, IDC_FILTERMODE, CB_SETCURSEL, fltnum, 0 ); + SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_SETCURSEL, fltnum, 0); SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L); if (uf->x[0]) { @@ -7604,6 +7627,21 @@ static void values_to_hw3ddlg (HWND hDlg) workprefs.gfx_filter_filtermode = 0; SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_SETCURSEL, workprefs.gfx_filter_filtermode, 0); + SendDlgItemMessage (hDlg, IDC_FILTERHZMULT, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage (hDlg, IDC_FILTERVZMULT, CB_RESETCONTENT, 0, 0L); + for (i = 0; filtermultnames[i]; i++) { + SendDlgItemMessage (hDlg, IDC_FILTERHZMULT, CB_ADDSTRING, 0, (LPARAM)filtermultnames[i]); + SendDlgItemMessage (hDlg, IDC_FILTERVZMULT, CB_ADDSTRING, 0, (LPARAM)filtermultnames[i]); + } + SendDlgItemMessage (hDlg, IDC_FILTERHZMULT, CB_SETCURSEL, 0, 0); + SendDlgItemMessage (hDlg, IDC_FILTERVZMULT, CB_SETCURSEL, 0, 0); + for (i = 0; filtermultnames[i]; i++) { + if (filtermults[i] == workprefs.gfx_filter_horiz_zoom_mult) + SendDlgItemMessage (hDlg, IDC_FILTERHZMULT, CB_SETCURSEL, i, 0); + if (filtermults[i] == workprefs.gfx_filter_vert_zoom_mult) + SendDlgItemMessage (hDlg, IDC_FILTERVZMULT, CB_SETCURSEL, i, 0); + } + SendDlgItemMessage (hDlg, IDC_FILTERSLR, CB_RESETCONTENT, 0, 0L); i = j = 0; while (scanlineratios[i * 2]) { @@ -7691,9 +7729,10 @@ static void filter_preset (HWND hDlg, WPARAM wParam) ok = 1; if (wParam == IDC_FILTERPRESETSAVE) { - sprintf (tmp2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", + sprintf (tmp2, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", p->gfx_filter, p->gfx_filter_filtermode, p->gfx_filter_vert_zoom, p->gfx_filter_horiz_zoom, + p->gfx_filter_vert_zoom_mult, p->gfx_filter_horiz_zoom_mult, p->gfx_filter_vert_offset, p->gfx_filter_horiz_offset, p->gfx_filter_scanlines, p->gfx_filter_scanlinelevel, p->gfx_filter_scanlineratio, p->gfx_lores, p->gfx_linedbl, p->gfx_correct_aspect, @@ -7727,6 +7766,10 @@ static void filter_preset (HWND hDlg, WPARAM wParam) s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0; p->gfx_filter_horiz_zoom = atol (s); s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0; + p->gfx_filter_vert_zoom_mult = atol (s); + s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0; + p->gfx_filter_horiz_zoom_mult = atol (s); + s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0; p->gfx_filter_vert_offset = atol (s); s = t; t = strchr (s, ','); if (!t) goto end; *t++ = 0; p->gfx_filter_horiz_offset = atol (s); @@ -7779,6 +7822,14 @@ static void filter_handle (HWND hDlg) updatedisplayarea (); } +static int getfiltermult(HWND hDlg, DWORD dlg) +{ + int v = SendDlgItemMessage (hDlg, dlg, CB_GETCURSEL, 0, 0L); + if (v == CB_ERR) + return 1000; + return filtermults[v]; +} + static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive; @@ -7838,6 +7889,13 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_FILTERFILTER: filter_handle (hDlg); break; + case IDC_FILTERHZMULT: + case IDC_FILTERVZMULT: + currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = getfiltermult(hDlg, IDC_FILTERHZMULT); + currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = getfiltermult(hDlg, IDC_FILTERVZMULT); + updatedisplayarea (); + WIN32GFX_WindowMove (); + break; } } break; @@ -7845,12 +7903,12 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l recursive--; break; case WM_HSCROLL: - currprefs.gfx_filter_horiz_zoom = workprefs.gfx_filter_horiz_zoom = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERHZ ), TBM_GETPOS, 0, 0 ); - currprefs.gfx_filter_vert_zoom = workprefs.gfx_filter_vert_zoom = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERVZ ), TBM_GETPOS, 0, 0 ); - currprefs.gfx_filter_horiz_offset = workprefs.gfx_filter_horiz_offset = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERHO ), TBM_GETPOS, 0, 0 ); - currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERVO ), TBM_GETPOS, 0, 0 ); - currprefs.gfx_filter_scanlines = workprefs.gfx_filter_scanlines = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERSL ), TBM_GETPOS, 0, 0 ); - currprefs.gfx_filter_scanlinelevel = workprefs.gfx_filter_scanlinelevel = (int)SendMessage( GetDlgItem( hDlg, IDC_FILTERSL2 ), TBM_GETPOS, 0, 0 ); + currprefs.gfx_filter_horiz_zoom = workprefs.gfx_filter_horiz_zoom = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERHZ), TBM_GETPOS, 0, 0 ); + currprefs.gfx_filter_vert_zoom = workprefs.gfx_filter_vert_zoom = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERVZ), TBM_GETPOS, 0, 0 ); + currprefs.gfx_filter_horiz_offset = workprefs.gfx_filter_horiz_offset = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0); + currprefs.gfx_filter_vert_offset = workprefs.gfx_filter_vert_offset = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0); + currprefs.gfx_filter_scanlines = workprefs.gfx_filter_scanlines = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERSL), TBM_GETPOS, 0, 0); + currprefs.gfx_filter_scanlinelevel = workprefs.gfx_filter_scanlinelevel = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERSL2), TBM_GETPOS, 0, 0); SetDlgItemInt (hDlg, IDC_FILTERHZV, workprefs.gfx_filter_horiz_zoom, TRUE); SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE); SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE); diff --git a/prowizard/misc/testbag.c b/prowizard/misc/testbag.c index 10149bb4..7e4307ff 100755 --- a/prowizard/misc/testbag.c +++ b/prowizard/misc/testbag.c @@ -1,5 +1,5 @@ -#include "globals.h" -#include "extern.h" +#include "../rippers/globals.h" +#include "../rippers/extern.h" /* -- 2.47.3