From: Toni Wilen Date: Fri, 29 Jan 2010 18:21:53 +0000 (+0200) Subject: imported winuaesrc2020b6.zip X-Git-Tag: 2100~33 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=adb13230c9712085dfa5635440b1ec9fc57e9f74;p=francis%2Fwinuae.git imported winuaesrc2020b6.zip --- diff --git a/blkdev_cdimage.c b/blkdev_cdimage.c index d53f5ca1..31b21811 100644 --- a/blkdev_cdimage.c +++ b/blkdev_cdimage.c @@ -1059,8 +1059,11 @@ static struct device_info *info_device (int unitnum, struct device_info *di) di->lun = 0; di->media_inserted = 0; di->bytespersector = 2048; - if (ismedia (unitnum, 1)) + di->mediapath[0] = 0; + if (ismedia (unitnum, 1)) { di->media_inserted = 1; + _tcscpy (di->mediapath, currprefs.cdimagefile); + } di->write_protected = 1; di->type = INQ_ROMD; di->id = 1; diff --git a/cfgfile.c b/cfgfile.c index 8edaed63..e3ff7f63 100644 --- a/cfgfile.c +++ b/cfgfile.c @@ -176,6 +176,7 @@ static const TCHAR *dongles[] = L"rugby coach", L"cricket captain", L"leviathan", NULL }; +static const TCHAR *parportsampler[] = { L"none", L"mono", L"stereo", NULL }; static const TCHAR *obsolete[] = { L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits", @@ -624,6 +625,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_bool (f, L"parallel_postscript_detection", p->parallel_postscript_detection); cfgfile_write_str (f, L"ghostscript_parameters", p->ghostscript_parameters); cfgfile_write (f, L"parallel_autoflush", L"%d", p->parallel_autoflush_time); + cfgfile_dwrite_str (f, L"parallel_sampler", parportsampler[p->parallel_sampler]); cfgfile_dwrite (f, L"uae_hide", L"%d", p->uae_hide); cfgfile_dwrite_bool (f, L"magic_mouse", p->input_magic_mouse); cfgfile_dwrite_str (f, L"magic_mousecursor", magiccursors[p->input_magic_mouse_cursor]); @@ -864,6 +866,14 @@ int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, *location = _tcstol (value, &endptr, base) * scale; if (*endptr != '\0' || *value == '\0') { + if (strcasecmp (value, L"false") == 0 || strcasecmp (value, L"no") == 0) { + *location = 0; + return 1; + } + if (strcasecmp (value, L"true") == 0 || strcasecmp (value, L"yes") == 0) { + *location = 1; + return 1; + } write_log (L"Option '%s' requires a numeric argument but got '%s'\n", option, value); return -1; } @@ -1669,6 +1679,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va || cfgfile_strval (option, value, L"comp_trustnaddr", &p->comptrustnaddr, compmode, 0) || cfgfile_strval (option, value, L"collision_level", &p->collision_level, collmode, 0) || cfgfile_strval (option, value, L"parallel_matrix_emulation", &p->parallel_matrix_emulation, epsonprinter, 0) + || cfgfile_strval (option, value, L"parallel_sampler", &p->parallel_sampler, parportsampler, 0) || cfgfile_strval (option, value, L"comp_flushmode", &p->comp_hardflush, flushmode, 0)) return 1; @@ -3170,6 +3181,7 @@ void default_prefs (struct uae_prefs *p, int type) p->parallel_postscript_emulation = 0; p->parallel_postscript_detection = 0; p->parallel_autoflush_time = 5; + p->parallel_sampler = 0; p->ghostscript_parameters[0] = 0; p->uae_hide = 0; diff --git a/cia.c b/cia.c index e0c6d8b6..aaa18735 100644 --- a/cia.c +++ b/cia.c @@ -36,6 +36,7 @@ #include "uae.h" #include "amax.h" #include "ersatz.h" +#include "sampler.h" #include "dongle.h" #define CIAA_DEBUG_R 0 @@ -640,8 +641,13 @@ static uae_u8 ReadCIAA (unsigned int addr) } else if (arcadia_bios) { tmp = arcadia_parport (0, ciaaprb, ciaadrb); #endif + } else if (currprefs.parallel_sampler) { + + tmp = sampler_getsample (); + } else #endif + { tmp = handle_parport_joystick (0, ciaaprb, ciaadrb); tmp = dongle_cia_read (1, reg, tmp); diff --git a/custom.c b/custom.c index 3af8f31f..b64dce17 100644 --- a/custom.c +++ b/custom.c @@ -581,7 +581,7 @@ static void decide_diw (int hpos) { /* Last hpos = hpos + 0.5, eg. normal PAL end hpos is 227.5 * 2 = 455 OCS Denise: 9 bit hdiw counter does not reset during lines 0 to 9 - (PAL) or lines 0 to 10 (NTSC) + (PAL) or lines 0 to 10 (NTSC). A1000 PAL: 1 to 9, NTSC: 1 to 10. ECS Denise and AGA: no above "features" */ diff --git a/drawing.c b/drawing.c index 2e5ac4ae..4ba9c468 100644 --- a/drawing.c +++ b/drawing.c @@ -2462,11 +2462,11 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u cb = ledcolor (TD_BORDER, rc, gc, bc, alpha); if (td_pos & TD_RIGHT) - x_start = totalwidth - TD_PADX - NUM_LEDS * TD_WIDTH; + x_start = totalwidth - TD_PADX - VISIBLE_LEDS * TD_WIDTH; else x_start = TD_PADX; - for (led = 0; led < NUM_LEDS; led++) { + for (led = 0; led < VISIBLE_LEDS; led++) { int side, pos, num1 = -1, num2 = -1, num3 = -1, num4 = -1; int x, c, on = 0, am = 2; xcolnr on_rgb, on_rgb2, off_rgb, pen_rgb; diff --git a/filesys.c b/filesys.c index 25343605..6792db0c 100644 --- a/filesys.c +++ b/filesys.c @@ -5362,17 +5362,17 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke write_log (L"%s:\n", uip->rootdir); if (hfd->drive_empty) { rdbmnt - write_log (L"ignored, drive is empty\n"); + write_log (L"ignored, drive is empty\n"); return -2; } if (hfd->blocksize == 0) { rdbmnt - write_log (L"failed, blocksize == 0\n"); + write_log (L"failed, blocksize == 0\n"); return -1; } if (lastblock * hfd->blocksize > hfd->virtsize) { rdbmnt - write_log (L"failed, too small (%d*%d > %I64u)\n", lastblock, hfd->blocksize, hfd->virtsize); + write_log (L"failed, too small (%d*%d > %I64u)\n", lastblock, hfd->blocksize, hfd->virtsize); return -2; } for (rdblock = 0; rdblock < lastblock; rdblock++) { @@ -5394,7 +5394,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } if (rdblock == lastblock) { rdbmnt - write_log (L"failed, no RDB detected\n"); + write_log (L"failed, no RDB detected\n"); return -2; } blocksize = rl (bufrdb + 16); @@ -5402,13 +5402,13 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke badblock = rl (bufrdb + 24); if (badblock != -1) { rdbmnt - write_log (L"RDB: badblock list is not yet supported. Contact the author.\n"); + write_log (L"RDB: badblock list is not yet supported. Contact the author.\n"); return -2; } driveinitblock = rl (bufrdb + 36); if (driveinitblock != -1) { rdbmnt - write_log (L"RDB: driveinit is not yet supported. Contact the author.\n"); + write_log (L"RDB: driveinit is not yet supported. Contact the author.\n"); return -2; } hfd->cylinders = rl (bufrdb + 64); @@ -5440,7 +5440,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke } rdbmnt - flags = rl (buf + 20); + flags = rl (buf + 20); if (flags & 2) { /* do not mount */ err = -1; write_log (L"RDB: Automount disabled, not mounting\n"); @@ -5547,6 +5547,8 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke lsegblock = rl (buf + 16); if (lsegblock == pb) goto error; + if ((i + 1) * (blocksize - 20) >= 262144) + goto error; memcpy (fsmem + i * (blocksize - 20), buf + 20, blocksize - 20); i++; if (lsegblock == -1) diff --git a/gencpu.c b/gencpu.c index 8376962c..40da5667 100644 --- a/gencpu.c +++ b/gencpu.c @@ -905,13 +905,13 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha if (using_ce020) { switch (size) { case sz_byte: - printf ("\tput_byte_ce020 (%sa,%s);\n", to, from); + printf ("\tput_byte_ce020 (%sa, %s);\n", to, from); count_write++; break; case sz_word: if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); - printf ("\tput_word_ce020 (%sa,%s);\n", to, from); + printf ("\tput_word_ce020 (%sa, %s);\n", to, from); count_write++; break; case sz_long: @@ -926,13 +926,13 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha } else if (using_ce) { switch (size) { case sz_byte: - printf ("\tput_byte_ce (%sa,%s);\n", to, from); + printf ("\tput_byte_ce (%sa, %s);\n", to, from); count_write++; break; case sz_word: if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); - printf ("\tput_word_ce (%sa,%s);\n", to, from); + printf ("\tput_word_ce (%sa, %s);\n", to, from); count_write++; break; case sz_long: @@ -952,27 +952,27 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha case sz_byte: insn_n_cycles += 4; if (flags & GF_FC) - printf ("\tdfc_put_byte (%sa,%s);\n", to, from); + printf ("\tdfc_put_byte (%sa, %s);\n", to, from); else - printf ("\tput_byte_mmu (%sa,%s);\n", to, from); + printf ("\tput_byte_mmu (%sa, %s);\n", to, from); break; case sz_word: insn_n_cycles += 4; if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); if (flags & GF_FC) - printf ("\tdfc_put_word (%sa,%s);\n", to, from); + printf ("\tdfc_put_word (%sa, %s);\n", to, from); else - printf ("\tput_word_mmu (%sa,%s);\n", to, from); + printf ("\tput_word_mmu (%sa, %s);\n", to, from); break; case sz_long: insn_n_cycles += 8; if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); if (flags & GF_FC) - printf ("\tdfc_put_long (%sa,%s);\n", to, from); + printf ("\tdfc_put_long (%sa, %s);\n", to, from); else - printf ("\tput_long_mmu (%sa,%s);\n", to, from); + printf ("\tput_long_mmu (%sa, %s);\n", to, from); break; default: abort (); @@ -981,21 +981,21 @@ static void genastore_2 (char *from, amodes mode, char *reg, wordsizes size, cha switch (size) { case sz_byte: insn_n_cycles += 4; - printf ("\tput_byte (%sa,%s);\n", to, from); + printf ("\tput_byte (%sa, %s);\n", to, from); count_write++; break; case sz_word: insn_n_cycles += 4; if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); - printf ("\tput_word (%sa,%s);\n", to, from); + printf ("\tput_word (%sa, %s);\n", to, from); count_write++; break; case sz_long: insn_n_cycles += 8; if (cpu_level < 2 && (mode == PC16 || mode == PC8r)) abort (); - printf ("\tput_long (%sa,%s);\n", to, from); + printf ("\tput_long (%sa, %s);\n", to, from); count_write += 2; break; default: @@ -2217,19 +2217,26 @@ static void gen_opcode (unsigned long int opcode) printf ("\t}\n"); need_endlabel = 1; } - if (curi->smode == Ad16 || curi->smode == absw || curi->smode == PC16) - addcycles000 (2); - setpc ("srca"); - m68k_pc_offset = 0; - fill_prefetch_1 (0); - if (curi->smode == Ad8r || curi->smode == PC8r) - addcycles000 (6); - printf ("\tm68k_areg (regs, 7) -= 4;\n"); - if (using_ce) { - printf ("\tput_word_ce (m68k_areg (regs, 7), oldpc >> 16);\n"); - printf ("\tput_word_ce (m68k_areg (regs, 7) + 2, oldpc);\n"); + if (using_mmu) { + printf ("\t%s (m68k_areg (regs, 7) - 4, oldpc);\n", dstl); + printf ("\tm68k_areg (regs, 7) -= 4;\n"); + setpc ("srca"); + m68k_pc_offset = 0; } else { - printf ("\t%s (m68k_areg (regs, 7), oldpc);\n", dstl); + if (curi->smode == Ad16 || curi->smode == absw || curi->smode == PC16) + addcycles000 (2); + setpc ("srca"); + m68k_pc_offset = 0; + fill_prefetch_1 (0); + if (curi->smode == Ad8r || curi->smode == PC8r) + addcycles000 (6); + printf ("\tm68k_areg (regs, 7) -= 4;\n"); + if (using_ce) { + printf ("\tput_word_ce (m68k_areg (regs, 7), oldpc >> 16);\n"); + printf ("\tput_word_ce (m68k_areg (regs, 7) + 2, oldpc);\n"); + } else { + printf ("\t%s (m68k_areg (regs, 7), oldpc);\n", dstl); + } } count_write += 2; fill_prefetch_next (); diff --git a/hardfile.c b/hardfile.c index 516fc9da..152f5af7 100644 --- a/hardfile.c +++ b/hardfile.c @@ -28,13 +28,13 @@ #include "execio.h" #include "zfile.h" -//#undef DEBUGME +#undef DEBUGME #define hf_log #define hf_log2 #define scsi_log #define hf_log3 -#define DEBUGME +//#define DEBUGME #ifdef DEBUGME #undef hf_log #define hf_log write_log @@ -1112,7 +1112,7 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u case 0x25: /* READ_CAPACITY */ { int pmi = cmdbuf[8] & 1; - uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[2] << 8) | cmdbuf[3]; + uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5]; uae_u32 blocks; int cyl, cylsec, head, tracksec; if (nodisk (hfd)) @@ -1126,6 +1126,8 @@ int scsi_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, uae_u } else { getchs (hfd, &cyl, &cylsec, &head, &tracksec); } + if (pmi == 0 && lba != 0) + goto errreq; if (pmi) { lba += tracksec * head; lba /= tracksec * head; @@ -1239,8 +1241,9 @@ nodisk: default: err: - lr = -1; write_log (L"UAEHF: unsupported scsi command 0x%02X\n", cmdbuf[0]); +errreq: + lr = -1; status = 2; /* CHECK CONDITION */ s[0] = 0x70; s[2] = 5; /* ILLEGAL REQUEST */ diff --git a/include/blkdev.h b/include/blkdev.h index d6d61b38..c5eda1c4 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -41,7 +41,7 @@ struct device_info { int bus, target, lun; int id; TCHAR label[MAX_DPATH]; - TCHAR ident[16]; + TCHAR mediapath[MAX_DPATH]; }; struct device_scsi_info { diff --git a/include/gui.h b/include/gui.h index ec2dca0d..8bed90c6 100644 --- a/include/gui.h +++ b/include/gui.h @@ -58,6 +58,7 @@ struct gui_info uae_u32 crc32[4]; /* crc32 of image */ }; #define NUM_LEDS (LED_MAX) +#define VISIBLE_LEDS (LED_MAX - 1) extern struct gui_info gui_data; diff --git a/include/options.h b/include/options.h index 572a1c6d..4858455b 100644 --- a/include/options.h +++ b/include/options.h @@ -111,6 +111,7 @@ struct uae_prefs { int parallel_postscript_emulation; int parallel_postscript_detection; int parallel_autoflush_time; + int parallel_sampler; TCHAR ghostscript_parameters[256]; int use_gfxlib; int socket_emu; diff --git a/include/sampler.h b/include/sampler.h new file mode 100644 index 00000000..141e131c --- /dev/null +++ b/include/sampler.h @@ -0,0 +1,6 @@ + +extern uae_u8 sampler_getsample (void); +extern int sampler_init (void); +extern void sampler_free (void); + + diff --git a/main.c b/main.c index 7cb3bcd6..99bb03be 100644 --- a/main.c +++ b/main.c @@ -51,6 +51,7 @@ #include "gfxfilter.h" #include "uaeresource.h" #include "dongle.h" +#include "sampler.h" #include "consolehook.h" #ifdef USE_SDL @@ -623,6 +624,7 @@ void reset_all_systems (void) #endif native2amiga_reset (); dongle_reset (); + sampler_init (); } /* Okay, this stuff looks strange, but it is here to encourage people who @@ -652,6 +654,7 @@ void do_start_program (void) void do_leave_program (void) { + sampler_free (); graphics_leave (); inputdevice_close (); DISK_free (); diff --git a/newcpu.c b/newcpu.c index bffbb6cb..9ec4b90e 100644 --- a/newcpu.c +++ b/newcpu.c @@ -4042,6 +4042,10 @@ void m68k_resumestopped (void) if (!regs.stopped) return; regs.stopped = 0; + if (currprefs.cpu_cycle_exact) { + if (currprefs.cpu_model == 68000) + do_cycles_ce000 (6); + } fill_prefetch_slow (); unset_special (SPCFLAG_STOP); } diff --git a/od-win32/blkdev_win32_ioctl.c b/od-win32/blkdev_win32_ioctl.c index 84daaf6b..b867d1dc 100644 --- a/od-win32/blkdev_win32_ioctl.c +++ b/od-win32/blkdev_win32_ioctl.c @@ -1198,6 +1198,7 @@ static struct device_info *info_device (int unitnum, struct device_info *di) di->lun = 0; di->media_inserted = 0; di->bytespersector = 2048; + _stprintf (di->mediapath, L"\\\\.\\%s", ciw32[unitnum].drvletter); if (fetch_geometry (unitnum, di)) { // || ioctl_command_toc (unitnum)) di->media_inserted = 1; ciw32[unitnum].blocksize = di->bytespersector; diff --git a/od-win32/blkdev_win32_spti.c b/od-win32/blkdev_win32_spti.c index 7a63ea61..923ca7c8 100644 --- a/od-win32/blkdev_win32_spti.c +++ b/od-win32/blkdev_win32_spti.c @@ -486,6 +486,7 @@ static struct device_info *info_device (int unitnum, struct device_info *di) return NULL; dispti = &dev_info[unitnum]; _tcscpy (di->label, dispti->name); + _tcscpy (di->mediapath, dispti->drvpath); di->bus = 0; di->target = unitnum; di->lun = 0; diff --git a/od-win32/direct3d.c b/od-win32/direct3d.c index 3784c1c4..21cc7fb2 100644 --- a/od-win32/direct3d.c +++ b/od-win32/direct3d.c @@ -39,6 +39,7 @@ static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture; static IDirect3DVertexBuffer9 *vertexBuffer; static ID3DXSprite *sprite; static HWND d3dhwnd; +static int devicelost; static D3DXMATRIX m_matProj; static D3DXMATRIX m_matWorld; @@ -50,7 +51,7 @@ static D3DXMATRIX m_matPreWorld; static int ledwidth, ledheight; static int twidth, theight, max_texture_w, max_texture_h; static int tin_w, tin_h, window_h, window_w; -static int t_depth; +static int t_depth, mult; static int required_sl_texture_w, required_sl_texture_h; static int vsync2, guimode; static int needclear; @@ -711,8 +712,8 @@ static int createtexture (int w, int h) write_log (L"D3D: Failed to lock box of volume texture: %s\n", D3D_ErrorString (hr)); return 0; } - //BuildHq2xLookupTexture(tin_w, tin_w, window_w, window_h, (unsigned char*)lockedBox.pBits); - BuildHq2xLookupTexture(window_w, window_h, tin_w, tin_w, (unsigned char*)lockedBox.pBits); + //BuildHq2xLookupTexture(tin_w / mult, tin_w / mult, window_w, window_h, (unsigned char*)lockedBox.pBits); + BuildHq2xLookupTexture(window_w, window_h, tin_w / mult, tin_w / mult, (unsigned char*)lockedBox.pBits); IDirect3DVolumeTexture9_UnlockBox (lpHq2xLookupTexture, 0); } @@ -824,7 +825,7 @@ static void setupscenecoords (void) //write_log (L"%dx%d %dx%d %dx%d\n", twidth, theight, tin_w, tin_h, window_w, window_h); - getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w, tin_h, 1, tin_w, tin_h); + getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / mult, tin_h / mult, mult, tin_w, tin_h); //write_log (L"(%d %d %d %d) - (%d %d %d %d) (%d %d)\n", // dr.left, dr.top, dr.right, dr.bottom, sr.left, sr.top, sr.right, sr.bottom, zr.left, zr.top); @@ -861,7 +862,7 @@ uae_u8 *getfilterbuffer3d (int *widthp, int *heightp, int *pitch, int *depth) int w, h; *depth = t_depth; - getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w, tin_h, 1, tin_w, tin_h); + getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w, tin_h, mult, tin_w, tin_h); w = sr.right - sr.left; h = sr.bottom - sr.top; p = gfxvidinfo.bufmem; @@ -1130,6 +1131,7 @@ void D3D_free (void) psPreProcess = 0; psActive = 0; resetcount = 0; + devicelost = 0; changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen & ~STATUSLINE_TARGET; } @@ -1246,7 +1248,7 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth flags = D3DCREATE_HARDWARE_VERTEXPROCESSING; else flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; - flags |= D3DCREATE_NOWINDOWCHANGES | D3DCREATE_FPU_PRESERVE; + flags |= D3DCREATE_FPU_PRESERVE; if (d3d_ex && D3DEX) { ret = IDirect3D9Ex_CreateDeviceEx (d3dex, adapter, D3DDEVTYPE_HAL, d3dhwnd, flags, &dpp, &modeex, &d3ddevex); @@ -1293,8 +1295,9 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth tex_square, tex_pow2, tex_dynamic, max_texture_w, max_texture_h); - t_w *= S2X_getmult (); - t_h *= S2X_getmult (); + mult = S2X_getmult (); + t_w *= mult; + t_h *= mult; if (max_texture_w < t_w || max_texture_h < t_h) { _stprintf (errmsg, L"Direct3D: %d * %d or bigger texture support required\nYour card's maximum texture size is only %d * %d", @@ -1350,19 +1353,44 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth return 0; } +static int isd3d (void) +{ + if (devicelost || !d3ddev || !d3d_enabled) + return 0; + return 1; +} + int D3D_needreset (void) { - HRESULT hr = IDirect3DDevice9_TestCooperativeLevel (d3ddev); + HRESULT hr; + + if (!devicelost) + return -1; + hr = IDirect3DDevice9_TestCooperativeLevel (d3ddev); if (hr == D3DERR_DEVICENOTRESET) { + write_log (L"D3D: DEVICENOTRESET\n"); + devicelost = 2; + invalidatedeviceobjects (); hr = IDirect3DDevice9_Reset (d3ddev, &dpp); if (FAILED (hr)) { write_log (L"D3D: Reset failed %s\n", D3D_ErrorString (hr)); resetcount++; - if (resetcount > 2) - changed_prefs.gfx_filter = 0; + if (resetcount > 2) { + changed_prefs.gfx_api = 0; + write_log (L"D3D: Too many failed resets, disabling Direct3D mode\n"); + } + return 1; } + write_log (L"D3D: Reset succeeded\n"); + restoredeviceobjects (); return 1; + } else if (hr == D3DERR_DEVICELOST) { + invalidatedeviceobjects (); + Sleep (500); + } else if (SUCCEEDED (hr)) { + return -1; } + write_log (L"D3D: TestCooperativeLevel %s\n", D3D_ErrorString (hr)); return 0; } @@ -1371,14 +1399,11 @@ void D3D_clear (void) int i; HRESULT hr; - if (!d3ddev) - return; - hr = IDirect3DDevice9_TestCooperativeLevel (d3ddev); - if (FAILED (hr)) + if (!isd3d ()) return; for (i = 0; i < 2; i++) { - IDirect3DDevice9_Clear (d3ddev, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 0, 0); - IDirect3DDevice9_Present (d3ddev, NULL, NULL, NULL, NULL); + hr = IDirect3DDevice9_Clear (d3ddev, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 0, 0); + hr = IDirect3DDevice9_Present (d3ddev, NULL, NULL, NULL, NULL); } } @@ -1386,9 +1411,7 @@ static void D3D_render22 (int clear) { HRESULT hr; - if (!d3d_enabled) - return; - if (FAILED (IDirect3DDevice9_TestCooperativeLevel (d3ddev))) + if (!isd3d ()) return; if (clear) { @@ -1486,6 +1509,10 @@ pass2: hr = IDirect3DDevice9_EndScene (d3ddev); hr = IDirect3DDevice9_Present (d3ddev, NULL, NULL, NULL, NULL); + if (hr == D3DERR_DEVICELOST) { + write_log (L"D3D: DEVICELOST\n"); + devicelost = 1; + } } @@ -1506,15 +1533,13 @@ void D3D_render (void) void D3D_unlocktexture (void) { HRESULT hr; - RECT r; + if (!isd3d ()) + return; if (currprefs.leds_on_screen & STATUSLINE_CHIPSET) updateleds (); hr = IDirect3DTexture9_UnlockRect (texture, 0); - r.left = 0; r.right = window_w; - r.top = 0; r.bottom = window_h; - hr = IDirect3DTexture9_AddDirtyRect (texture, &r); D3D_render2 (0); if (vsync2 && !currprefs.turbo_emulation) @@ -1526,20 +1551,12 @@ uae_u8 *D3D_locktexture (int *pitch) D3DLOCKED_RECT locked; HRESULT hr; - hr = IDirect3DDevice9_TestCooperativeLevel (d3ddev); - if (FAILED (hr)) { - if (hr == D3DERR_DEVICELOST) { - if (!dpp.Windowed && IsWindow (d3dhwnd) && !IsIconic (d3dhwnd)) { - write_log (L"D3D: minimize\n"); - ShowWindow (d3dhwnd, SW_MINIMIZE); - } - } + if (!isd3d ()) return NULL; - } locked.pBits = NULL; locked.Pitch = 0; - hr = IDirect3DTexture9_LockRect (texture, 0, &locked, NULL, D3DLOCK_NO_DIRTY_UPDATE); + hr = IDirect3DTexture9_LockRect (texture, 0, &locked, NULL, 0); if (FAILED (hr)) { if (hr != D3DERR_DRIVERINTERNALERROR) { write_log (L"IDirect3DTexture9_LockRect failed: %s\n", D3D_ErrorString (hr)); @@ -1548,7 +1565,7 @@ uae_u8 *D3D_locktexture (int *pitch) } } if (locked.pBits == NULL || locked.Pitch == 0) { - write_log (L"IDirect3DTexture9_LockRect return NULL texture\n"); + write_log (L"IDirect3DTexture9_LockRect returned NULL texture\n"); D3D_unlocktexture (); return NULL; } @@ -1558,7 +1575,7 @@ uae_u8 *D3D_locktexture (int *pitch) void D3D_refresh (void) { - if (!d3d_enabled) + if (!isd3d ()) return; createscanlines (1); D3D_render2 (1); @@ -1597,7 +1614,7 @@ void D3D_getpixelformat (int depth,int *rb, int *gb, int *bb, int *rs, int *gs, void D3D_guimode (int guion) { HRESULT hr; - if (!d3d_enabled) + if (!isd3d ()) return; hr = IDirect3DDevice9_SetDialogBoxMode (d3ddev, guion); if (FAILED (hr)) @@ -1610,7 +1627,7 @@ HDC D3D_getDC (HDC hdc) static LPDIRECT3DSURFACE9 bb; HRESULT hr; - if (!d3d_enabled) + if (!isd3d ()) return 0; if (!hdc) { hr = IDirect3DDevice9_GetBackBuffer (d3ddev, 0, 0, D3DBACKBUFFER_TYPE_MONO, &bb); diff --git a/od-win32/fsdb_mywin32.c b/od-win32/fsdb_mywin32.c index e5993cec..384d9ee9 100644 --- a/od-win32/fsdb_mywin32.c +++ b/od-win32/fsdb_mywin32.c @@ -326,6 +326,7 @@ int dos_errno (void) case ERROR_SHARING_VIOLATION: case ERROR_BUSY: case ERROR_INVALID_HANDLE: + case ERROR_USER_MAPPED_FILE: return ERROR_OBJECT_IN_USE; case ERROR_CURRENT_DIRECTORY: @@ -337,7 +338,10 @@ int dos_errno (void) default: { - gui_message (L"Unimplemented error %d\nContact author!", e); + static int done; + if (!done) + gui_message (L"Unimplemented error %d\nContact author!", e); + done = 1; } return ERROR_NOT_IMPLEMENTED; } diff --git a/od-win32/parser.c b/od-win32/parser.c index 991b4eac..de775518 100644 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -479,7 +479,7 @@ static void openprinter (void) // Fill in the structure with info about this "document." DocInfo.pDocName = L"WinUAE Document"; DocInfo.pOutputFile = NULL; - DocInfo.pDatatype = currprefs.parallel_matrix_emulation ? L"TEXT" : L"RAW"; + DocInfo.pDatatype = (currprefs.parallel_matrix_emulation || currprefs.parallel_postscript_detection) ? L"TEXT" : L"RAW"; // Inform the spooler the document is beginning. if ((dwJob = StartDocPrinter (hPrt, 1, (LPSTR)&DocInfo)) == 0) { ClosePrinter (hPrt ); diff --git a/od-win32/rp.c b/od-win32/rp.c index 381d15ad..2ed1fcf0 100644 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -187,6 +187,14 @@ static int port_insert (int num, const TCHAR *name) } } +static int cd_insert (int num, const TCHAR *name) +{ + if (num != 0) + return 0; + _tcscpy (changed_prefs.cdimagefile, name); + return 1; +} + static BOOL RPPostMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam, const RPGUESTINFO *pInfo) { BOOL v = FALSE; @@ -567,7 +575,9 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM case RP_DEVICE_INPUTPORT: ok = port_insert (num, n); break; - + case RP_DEVICE_CD: + ok = cd_insert (num, n); + break; } xfree (n); return ok; @@ -774,7 +784,7 @@ void rp_fixup_options (struct uae_prefs *p) sys_command_info (DF_IOCTL, i, &di); cd_mask |= 1 << i; RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); - rp_cd_image_change (i, v == 0 ? L"" : di.ident); + rp_cd_image_change (i, di.mediapath); } } diff --git a/od-win32/win32.c b/od-win32/win32.c index dc5fe567..6653d4f4 100644 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -806,20 +806,20 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, winuae_active (hWnd, minimized); minimized = 0; dx_check (); - return 0; + break; case WM_ACTIVATE: if (LOWORD (wParam) == WA_INACTIVE) { minimized = HIWORD (wParam) ? 1 : 0; winuae_inactive (hWnd, minimized); } dx_check (); - return 0; + break; case WM_ACTIVATEAPP: #ifdef RETROPLATFORM rp_activate (wParam, lParam); #endif dx_check (); - return 0; + break; case WM_PALETTECHANGED: if ((HWND)wParam != hWnd) @@ -1376,7 +1376,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_DISPLAYCHANGE: if (isfullscreen() <= 0 && !currprefs.gfx_filter && (wParam + 7) / 8 != DirectDraw_GetBytesPerPixel ()) - WIN32GFX_DisplayChangeRequested(); + WIN32GFX_DisplayChangeRequested (); break; case WM_GETMINMAXINFO: @@ -1424,15 +1424,18 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, } changed_prefs.gfx_size_win.x = left; changed_prefs.gfx_size_win.y = top; - if (canstretch () && mainwin_rect.right - mainwin_rect.left != width && mainwin_rect.bottom - mainwin_rect.top != height) { + if (canstretch () && (mainwin_rect.right - mainwin_rect.left != width || mainwin_rect.bottom - mainwin_rect.top != height)) { changed_prefs.gfx_size_win.width = width - window_extra_width; changed_prefs.gfx_size_win.height = height - window_extra_height; } } + if (hStatusWnd) + SendMessage (hStatusWnd, WM_SIZE, wParam, lParam); GetWindowRect (hMainWnd, &mainwin_rect); return 0; } - GetWindowRect (hMainWnd, &mainwin_rect); + if (!iconic) + GetWindowRect (hMainWnd, &mainwin_rect); } break; @@ -1629,7 +1632,7 @@ static int WIN32_RegisterClasses (void) wc.lpfnWndProc = AmigaWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; - wc.hInstance = 0; + wc.hInstance = hInst; wc.hIcon = LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE (IDI_APPICON)); wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW); wc.lpszMenuName = 0; @@ -1642,7 +1645,7 @@ static int WIN32_RegisterClasses (void) wc.lpfnWndProc = MainWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; - wc.hInstance = 0; + wc.hInstance = hInst; wc.hIcon = LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE (IDI_APPICON)); wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = CreateSolidBrush (black); @@ -1655,7 +1658,7 @@ static int WIN32_RegisterClasses (void) wc.lpfnWndProc = HiddenWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; - wc.hInstance = 0; + wc.hInstance = hInst; wc.hIcon = LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE (IDI_APPICON)); wc.hCursor = NULL; //LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = CreateSolidBrush (g_dwBackgroundColor); diff --git a/od-win32/win32.h b/od-win32/win32.h index d9f69898..b674ca8a 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -18,8 +18,8 @@ #define WINUAEPUBLICBETA 1 #define LANG_DLL 1 -#define WINUAEBETA L"Beta 5" -#define WINUAEDATE MAKEBD(2010, 1, 22) +#define WINUAEBETA L"Beta 6" +#define WINUAEDATE MAKEBD(2010, 1, 29) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index 705dab61..1394a951 100644 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -837,8 +837,12 @@ int lockscr (void) ret = 1; if (currentmode->flags & DM_D3D) { #ifdef D3D - if (D3D_needreset ()) + int v; + v = D3D_needreset (); + if (v > 0) WIN32GFX_DisplayChangeRequested (); + if (v >= 0) + return 0; if (currentmode->flags & DM_SWSCALE) { ret = 1; } else { @@ -2073,7 +2077,6 @@ static int create_windows_2 (void) int fsw = currentmode->flags & (DM_W_FULLSCREEN); DWORD exstyle = currprefs.win32_notaskbarbutton ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW; DWORD flags = 0; - HWND hhWnd = NULL;//currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL; int borderless = currprefs.win32_borderless; DWORD style = NORMAL_WINDOW_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; int cymenu = GetSystemMetrics (SM_CYMENU); @@ -2226,7 +2229,7 @@ static int create_windows_2 (void) style, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, - hhWnd, NULL, hInst, NULL); + NULL, NULL, hInst, NULL); if (!hMainWnd) { write_log (L"main window creation failed\n"); return 0; @@ -2268,13 +2271,13 @@ static int create_windows_2 (void) x, y, w, h, parent, NULL, hInst, NULL); } else { - hAmigaWnd = CreateWindowEx (dxfs || d3dfs ? -WS_EX_TOPMOST : - WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0), + hAmigaWnd = CreateWindowEx ( + ((dxfs || d3dfs || currprefs.win32_alwaysontop) ? WS_EX_TOPMOST : WS_EX_ACCEPTFILES) | exstyle, L"AmigaPowah", L"WinUAE", - (dxfs || d3dfs || currprefs.headless ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))), + ((dxfs || d3dfs || currprefs.headless) ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))), x, y, w, h, - borderless ? NULL : (hMainWnd ? hMainWnd : hhWnd), NULL, hInst, NULL); + borderless ? NULL : (hMainWnd ? hMainWnd : NULL), + NULL, hInst, NULL); } if (!hAmigaWnd) { write_log (L"creation of amiga window failed\n"); diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 55bf7ce5..628b41f6 100644 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -1548,11 +1548,10 @@ static UINT_PTR CALLBACK ofnhook (HWND hDlg, UINT message, WPARAM wParam, LPARAM { HWND hWnd; RECT windowRect; - int width, height, w2, h2; + int width, height, w2, h2, x, y; struct MultiDisplay *md; NMHDR *nmhdr; int doit = FALSE; - static int prevwidth, prevheight; if (message == WM_NOTIFY) { nmhdr = (LPNMHDR)lParam; @@ -1567,12 +1566,6 @@ static UINT_PTR CALLBACK ofnhook (HWND hDlg, UINT message, WPARAM wParam, LPARAM return FALSE; w2 = WIN32GFX_GetWidth (); h2 = WIN32GFX_GetHeight (); - if (w2 == prevwidth && h2 == prevheight) { - write_log (L"SAME %dx%d\n", w2, h2); - return FALSE; - } - prevwidth = w2; - prevheight = h2; write_log (L"MOVEWINDOW %dx%d %dx%d (%dx%d)\n", md->rect.left, md->rect.top, md->rect.right, md->rect.bottom, w2, h2); hWnd = GetParent (hDlg); windowRect.left = windowRect.right = windowRect.top = windowRect.bottom = -1; @@ -1584,7 +1577,10 @@ static UINT_PTR CALLBACK ofnhook (HWND hDlg, UINT message, WPARAM wParam, LPARAM width = w2; if (height > h2) height = h2; - SetWindowPos (hWnd, NULL, md->rect.left + (w2 - width) / 2, md->rect.top + (h2 - height) / 2, width, height, SWP_NOZORDER | SWP_NOACTIVATE); + x = md->rect.left + (w2 - width) / 2; + y = md->rect.top + (h2 - height) / 2; + write_log (L"X=%d Y=%d W=%d H=%d\n", x, y, width, height); + SetWindowPos (hWnd, NULL, x, y, width, height, SWP_NOZORDER | SWP_NOACTIVATE); return FALSE; } @@ -2043,7 +2039,7 @@ static int loopmulti (TCHAR *s, TCHAR *out) return 1; } -static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, TCHAR *dostype, TCHAR *newpath) +static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, TCHAR *dostype, TCHAR *newpath, TCHAR *outpath) { HANDLE hf; int i = 0; @@ -2056,6 +2052,7 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, TCHAR *dostype, TCHAR *newp uae_u8 b; int sparse, dynamic; + outpath[0] = 0; sparse = 0; dynamic = 0; hfsize = (uae_u64)hfsizem * 1024 * 1024; @@ -2118,6 +2115,8 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, TCHAR *dostype, TCHAR *newp WIN32GUI_LoadUIString (IDS_FAILEDHARDFILECREATION, szMessage, MAX_DPATH); WIN32GUI_LoadUIString (IDS_CREATIONERROR, szTitle, MAX_DPATH); MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); + } else { + _tcscpy (outpath, init_path); } return result; } @@ -4208,7 +4207,7 @@ static void load_quickstart (HWND hDlg, int romcheck) ew (guiDlg, IDC_RESETAMIGA, FALSE); workprefs.nr_floppies = quickstart_floppy; quickstart_ok = built_in_prefs (&workprefs, quickstart_model, quickstart_conf, quickstart_compa, romcheck); - quickstart_cd = workprefs.dfxtype[0] == DRV_NONE; + quickstart_cd = workprefs.dfxtype[0] == DRV_NONE && (quickstart_model == 8 || quickstart_model == 9); enable_for_quickstart (hDlg); addfloppytype (hDlg, 0); addfloppytype (hDlg, 1); @@ -8084,6 +8083,7 @@ static void hardfileselecthdf (HWND hDlg, TCHAR *newpath) static void hardfilecreatehdf (HWND hDlg, TCHAR *newpath) { + TCHAR hdfpath[MAX_DPATH]; LRESULT res; UINT setting = CalculateHardfileSize (hDlg); TCHAR dostype[16]; @@ -8091,7 +8091,10 @@ static void hardfilecreatehdf (HWND hDlg, TCHAR *newpath) res = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0); if (res == 0) dostype[0] = 0; - CreateHardFile (hDlg, setting, dostype, newpath); + if (CreateHardFile (hDlg, setting, dostype, newpath, hdfpath)) { + if (!current_hfdlg.filename[0]) + _tcscpy (current_hfdlg.filename, hdfpath); + } sethardfile (hDlg); } @@ -10747,7 +10750,7 @@ static struct filterxtra filter_pal_extra[] = }; static struct filterxtra filter_3d_extra[] = { - L"Bilinear", &workprefs.gfx_filter_bilinear, &currprefs.gfx_filter_bilinear, 0, 1, 1, + L"Point/Bilinear", &workprefs.gfx_filter_bilinear, &currprefs.gfx_filter_bilinear, 0, 1, 1, L"Scanline transparency", &workprefs.gfx_filter_scanlines, &currprefs.gfx_filter_scanlines, 0, 100, 10, L"Scanline level", &workprefs.gfx_filter_scanlinelevel, &currprefs.gfx_filter_scanlinelevel, 0, 100, 10, NULL @@ -10818,7 +10821,6 @@ static void setfiltermult2 (HWND hDlg, int id, int val) int i, got; got = 0; - SendDlgItemMessage (hDlg, id, CB_SETCURSEL, 0, 0); for (i = 0; filtermultnames[i]; i++) { if (filtermults[i] == val) { SendDlgItemMessage (hDlg, id, CB_SETCURSEL, i, 0); @@ -10830,20 +10832,13 @@ static void setfiltermult2 (HWND hDlg, int id, int val) tmp[0] = 0; if (val > 0) _stprintf (tmp, L"%.2f", 1000.0 / val); + SendDlgItemMessage (hDlg, id, CB_SETCURSEL, 0, 0); SetDlgItemText (hDlg, id, tmp); } } static void setfiltermult (HWND hDlg) { - int i; - - 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]); - } setfiltermult2 (hDlg, IDC_FILTERHZMULT, workprefs.gfx_filter_horiz_zoom_mult); setfiltermult2 (hDlg, IDC_FILTERVZMULT, workprefs.gfx_filter_vert_zoom_mult); } @@ -10853,7 +10848,7 @@ static void values_to_hw3ddlg (HWND hDlg) TCHAR txt[100], tmp[100]; int i, j, fltnum, modenum; struct uae_filter *uf; - int fxidx = 0, fxcnt; + int fxidx, fxcnt; UAEREG *fkey; SendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_SETCURSEL, @@ -10926,6 +10921,7 @@ static void values_to_hw3ddlg (HWND hDlg) } SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_SETCURSEL, fltnum, 0); + fxidx = 0; filter_extra[fxidx] = NULL; SendDlgItemMessage (hDlg, IDC_FILTERFILTER, CB_RESETCONTENT, 0, 0L); if (workprefs.gfx_api) { @@ -10969,6 +10965,7 @@ static void values_to_hw3ddlg (HWND hDlg) if (idx == 0) { filter_selected = &fx[i]; filter_selected_num = fxcnt; + prev = NULL; } fxcnt++; idx--; @@ -11178,6 +11175,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM static int recursive; LRESULT item; TCHAR tmp[100]; + int i; switch (msg) { @@ -11201,6 +11199,13 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)L"VGA"); SendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)L"TV"); + 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]); + } + enable_for_hw3ddlg (hDlg); case WM_USER: @@ -11235,6 +11240,8 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM break; case IDC_FILTERD3D: workprefs.gfx_api = IsDlgButtonChecked (hDlg, IDC_FILTERD3D) ? 1 : 0; + enable_for_hw3ddlg (hDlg); + values_to_hw3ddlg (hDlg); break; case IDC_FILTERKEEPASPECT: { diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 177d12f3..0156c89c 100644 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -52,7 +52,7 @@ AdditionalOptions="" Optimization="0" AdditionalIncludeDirectories="..\..\include,..\..,..\,..\resources,..\osdep,..\sounddep,..\..\prowizard\include,..\tun" - PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="WINVER=0x0500,_DEBUG,WIN32_IE=0x0700;WIN32;CINTERFACE;COBJMACROS;_CRT_SECURE_NO_WARNINGS;D3D_DEBUG_INFO" GeneratePreprocessedFile="0" KeepComments="false" ExceptionHandling="0" @@ -1883,6 +1883,10 @@ RelativePath="..\..\rommgr.c" > + + diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 306d1788..7ee49da8 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,17 @@ +Beta 6: + +- filter panel GUI issues fixed +- arcadia quickstart incorrectly enabled CD mode (b5) +- directory filesystem ERROR_USER_MAPPED_FILE mapped to OBJECT_IN_USE +- directory filesystem: complain about unimplemented error(s) only once +- unminimize changed display size (update to b4 fix) +- window resize was ignored unless both width and height changed (b4) +- OSD had extra gap in right border (b1) +- D3D fullscreen handling update, device loss handling improved, + possible ALT-TAB weirdness should be gone now, D3D debug runtime + warnings fixed + Beta 5: - save cdimage path to statefile (if set) diff --git a/sampler.c b/sampler.c new file mode 100644 index 00000000..c8c7a323 --- /dev/null +++ b/sampler.c @@ -0,0 +1,127 @@ +/* + * Parallel port audio digitizer + * + * Toni Wilen 2010 + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "options.h" +#include "events.h" + +#include "dxwrap.h" + +#include + +#define RECORDBUFFER (10000 * 4) +#define SAMPLEBUFFER (1024 * 4) + +static LPDIRECTSOUNDCAPTURE lpDS2r = NULL; +static LPDIRECTSOUNDCAPTUREBUFFER lpDSBprimary2r = NULL; +static LPDIRECTSOUNDCAPTUREBUFFER lpDSB2r = NULL; +static int inited; +static uae_u8 *samplebuffer; + +static int capture_init (void) +{ + HRESULT hr; + DSCBUFFERDESC sound_buffer_rec; + WAVEFORMATEX wavfmt; + + wavfmt.wFormatTag = WAVE_FORMAT_PCM; + wavfmt.nChannels = 2; + wavfmt.nSamplesPerSec = 44100; + wavfmt.wBitsPerSample = 16; + wavfmt.nBlockAlign = wavfmt.wBitsPerSample / 8 * wavfmt.nChannels; + wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec; + wavfmt.cbSize = 0; + + hr = DirectSoundCaptureCreate (NULL, &lpDS2r, NULL); + if (FAILED (hr)) { + write_log (L"SAMPLER: DirectSoundCaptureCreate() failure: %s\n", DXError (hr)); + return 0; + } + memset (&sound_buffer_rec, 0, sizeof (DSCBUFFERDESC)); + sound_buffer_rec.dwSize = sizeof (DSCBUFFERDESC); + sound_buffer_rec.dwBufferBytes = RECORDBUFFER; + sound_buffer_rec.lpwfxFormat = &wavfmt; + sound_buffer_rec.dwFlags = 0 ; + + hr = IDirectSoundCapture_CreateCaptureBuffer (lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL); + if (FAILED (hr)) { + write_log (L"SAMPLER: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr)); + return 0; + } + + hr = IDirectSoundCaptureBuffer_Start (lpDSB2r, DSCBSTART_LOOPING); + if (FAILED (hr)) { + write_log (L"SAMPLER: DirectSoundCaptureBuffer_Start failed: %s\n", DXError (hr)); + return 0; + } + samplebuffer = xcalloc (SAMPLEBUFFER, 1); + write_log (L"SAMPLER: Parallel port sampler initialized\n"); + return 1; +} + +static void capture_free (void) +{ + if (lpDSB2r) + IDirectSoundCaptureBuffer_Release (lpDSB2r); + lpDSB2r = NULL; + if (lpDS2r) + IDirectSound_Release (lpDS2r); + lpDS2r = NULL; + xfree (samplebuffer); + samplebuffer = NULL; +} + +static evt oldcycles; + +uae_u8 sampler_getsample (void) +{ + HRESULT hr; + DWORD t, cur_pos, cap_pos; + void *p1, *p2; + DWORD len1, len2; + evt cycles; + int offset; + + if (!inited) { + if (!capture_init ()) + return 0; + inited = 1; + } + cycles = get_cycles (); + offset = (cycles - oldcycles) / CYCLE_UNIT; + if (offset >= SAMPLEBUFFER || offset < 0) { + oldcycles = cycles; + offset = 0; + cap_pos = 0; + hr = IDirectSoundCaptureBuffer_GetCurrentPosition (lpDSB2r, &t, &cur_pos); + if (FAILED (hr)) + return 0; + hr = IDirectSoundCaptureBuffer_Lock (lpDSB2r, cap_pos, SAMPLEBUFFER, &p1, &len1, &p2, &len2, 0); + if (FAILED (hr)) + return 0; + memcpy (samplebuffer, p1, len1); + if (p2) + memcpy (samplebuffer + len1, p2, len2); + IDirectSoundCaptureBuffer_Unlock (lpDSB2r, p1, len1, p2, len2); + } + return samplebuffer[offset * 4 + 1]; +} + +int sampler_init (void) +{ + if (!currprefs.parallel_sampler) + return 0; + return 0; +} + +void sampler_free (void) +{ + inited = 0; + capture_free (); +} +