From 0fad1af67c7e8fdc92df87404b51cd688da88f1c Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 25 May 2004 21:38:34 +0300 Subject: [PATCH] imported winuaesrc0827b2.zip --- cfgfile.c | 4 ++ cia.c | 29 ++++++++++++++- custom.c | 41 ++++++++++++++++---- debug.c | 2 +- drawing.c | 13 ++----- filesys.c | 13 ++++--- include/custom.h | 2 +- include/inputdevice.h | 3 ++ include/keyboard.h | 12 +++++- inputdevice.c | 58 +++++++++++++++++++++++++++-- inputevents.def | 7 +++- memory.c | 2 + newcpu.c | 18 +++++++-- od-win32/keyboard_win32.c | 69 +++++++++++++++------------------- od-win32/parser.c | 22 +++++++---- od-win32/picasso96_win.c | 15 ++++---- od-win32/resources/winuae.rc | 26 ++----------- od-win32/serial_win32.c | 18 ++------- od-win32/win32.c | 36 ++++++++++++------ od-win32/win32.h | 2 +- od-win32/win32gfx.c | 11 ++++-- od-win32/win32gfx.h | 1 + od-win32/win32gui.c | 72 +++++++++++------------------------- 23 files changed, 281 insertions(+), 195 deletions(-) diff --git a/cfgfile.c b/cfgfile.c index 022aacee..0f4124f9 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -563,8 +563,10 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value) for (i = 0; i < MAX_SPARE_DRIVES; i++) { sprintf (tmpbuf, "diskimage%d", i); if (cfgfile_string (option, value, tmpbuf, p->dfxlist[i], 256)) { +#if 0 if (i < 4 && !p->df[i][0]) strcpy (p->df[i], p->dfxlist[i]); +#endif return 1; } } @@ -844,7 +846,9 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu for (i = 0; i < 4; i++) { sprintf (tmpbuf, "floppy%d", i); if (cfgfile_string (option, value, tmpbuf, p->df[i], 256)) { +#if 0 strcpy (p->dfxlist[i], p->df[i]); +#endif return 1; } } diff --git a/cia.c b/cia.c index a271c8ce..94fce460 100755 --- a/cia.c +++ b/cia.c @@ -86,6 +86,7 @@ static int tod_hack; #endif static uae_u8 serbits; +static int warned = 10; static void setclr (unsigned int *p, unsigned int val) { @@ -1029,7 +1030,15 @@ uae_u32 REGPARAM2 cia_bget (uaecptr addr) case 2: v = (addr & 1) ? ReadCIAA (r) : 0xff; break; - } + case 3: + if (currprefs.cpu_level == 0 && currprefs.cpu_compatible) + v = (addr & 1) ? regs.irc : regs.irc >> 8; + if (warned > 0) { + write_log ("cia_bget: unknown CIA address %x PC=%x\n", addr, m68k_getpc()); + warned--; + } + break; + } cia_wait_post (); return v; } @@ -1059,6 +1068,15 @@ uae_u32 REGPARAM2 cia_wget (uaecptr addr) case 2: v = (0xff << 8) | ReadCIAA (r); break; + case 3: + if (currprefs.cpu_level == 0 && currprefs.cpu_compatible) + v = regs.irc; + if (warned > 0) { + write_log ("cia_wget: unknown CIA address %x PC=%x\n", addr, m68k_getpc()); + warned--; + } + break; + } cia_wait_post (); return v; @@ -1082,6 +1100,7 @@ uae_u32 REGPARAM2 cia_lget (uaecptr addr) void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value) { int r = (addr & 0xf00) >> 8; + #ifdef JIT special_mem |= S_WRITE; #endif @@ -1096,6 +1115,10 @@ void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value) WriteCIAB (r, value); if ((addr & 0x1000) == 0) WriteCIAA (r, value); + if (((addr & 0x3000) == 0x3000) && warned > 0) { + write_log ("cia_bput: unknown CIA address %x %x\n", addr, value); + warned--; + } cia_wait_post (); } @@ -1116,6 +1139,10 @@ void REGPARAM2 cia_wput (uaecptr addr, uae_u32 value) WriteCIAB (r, value >> 8); if ((addr & 0x1000) == 0) WriteCIAA (r, value & 0xff); + if (((addr & 0x3000) == 0x3000) && warned > 0) { + write_log ("cia_wput: unknown CIA address %x %x\n", addr, value); + warned--; + } cia_wait_post (); } diff --git a/custom.c b/custom.c index 965055b8..ae2c7646 100755 --- a/custom.c +++ b/custom.c @@ -2037,7 +2037,7 @@ static void finish_decisions (void) changed = thisline_changed; if (thisline_decision.plfleft != -1) { - record_diw_line (thisline_decision.diwfirstword, thisline_decision.diwlastword); + record_diw_line (diwfirstword, diwlastword); decide_sprites (hpos); } @@ -2446,7 +2446,7 @@ static int intlev_2 (void) { uae_u16 imask = intreq & intena; unsigned long cycles = get_cycles (); - int c = currprefs.cpu_level >= 2 ? (compiled_code ? 4 : 20) : 4; + int c = currprefs.cpu_level >= 2 ? 20 : 4; int i; if (!(imask && (intena & 0x4000))) { @@ -2481,9 +2481,32 @@ static int intlev_2 (void) int intlev (void) { - int il = intlev_2 (); - if (il >= 0 && il <= regs.intmask) - unset_special (SPCFLAG_INT); + int il = -1; +#ifdef JIT + if (compiled_code) { + uae_u16 imask = intreq & intena; + if (imask && (intena & 0x4000)) { + if (imask & 0x2000) + il = 6; + if (imask & 0x1800) + il = 5; + if (imask & 0x0780) + il = 4; + if (imask & 0x0070) + il = 3; + if (imask & 0x0008) + il = 2; + if (imask & 0x0007) + il = 1; + } + } else { +#endif + il = intlev_2 (); + if (il >= 0 && il <= regs.intmask) + unset_special (SPCFLAG_INT); +#ifdef JIT + } +#endif return il; } @@ -2493,6 +2516,10 @@ static void doint (void) uae_u16 imask = intreq & intena; set_special (SPCFLAG_INT); +#ifdef JIT + if (compiled_code) + return; +#endif if (imask && (intena & 0x4000)) { for (i = 0; i < 14; i++) { if ((imask & (1 << i)) && irqdelay[i] == 0) { @@ -2526,8 +2553,8 @@ void INTREQ (uae_u16 v) serial_check_irq (); rethink_cias (); #if 0 - if (1 || (v & 0x100)) - write_log("INTREQ %04.4X (%04.4X) %p\n", intreq, v, m68k_getpc()); + if (1 || (v & (0x10))) + write_log("%d INTREQ %04.4X (%04.4X) %x %x %x\n", vpos, intreq, v, m68k_getpc(), cop1lc, cop2lc); #endif } diff --git a/debug.c b/debug.c index 9cf8de65..592891c4 100755 --- a/debug.c +++ b/debug.c @@ -1253,7 +1253,7 @@ static void debug_1 (void) break; case 'a': if (more_params (&inptr)) { - char nc = toupper((inptr)[0]); + char nc = next_char (&inptr); if (nc == 'm') audio_channel_mask = readint (&inptr); } diff --git a/drawing.c b/drawing.c index e758bb86..433de995 100755 --- a/drawing.c +++ b/drawing.c @@ -1530,15 +1530,12 @@ static void center_image (void) prev_y_adjust = thisframe_y_adjust; if (currprefs.gfx_xcenter) { -#if 0 - if (min_diwstart && (max_diwstop - min_diwstart < gfxvidinfo.width) && (currprefs.gfx_xcenter == 2)) - visible_left_border = ((max_diwstop - min_diwstart - gfxvidinfo.width) / 2 + min_diwstart) & ~1; -#endif + if (max_diwstop - min_diwstart < gfxvidinfo.width && currprefs.gfx_xcenter == 2) /* Try to center. */ visible_left_border = ((max_diwstop - min_diwstart - gfxvidinfo.width) / 2 + min_diwstart) & ~1; else - visible_left_border = max_diwstop - gfxvidinfo.width; + visible_left_border = max_diwstop - gfxvidinfo.width - ((max_diwstop - min_diwstart) - gfxvidinfo.width) / 2; /* Would the old value be good enough? If so, leave it as it is if we want to * be clever. */ @@ -1561,15 +1558,11 @@ static void center_image (void) thisframe_y_adjust = minfirstline; if (currprefs.gfx_ycenter && thisframe_first_drawn_line != -1) { -#if 0 - if (thisframe_first_drawn_line && (thisframe_last_drawn_line - thisframe_first_drawn_line < max_drawn_amiga_line) && currprefs.gfx_ycenter == 2) - thisframe_y_adjust = (thisframe_last_drawn_line - thisframe_first_drawn_line - max_drawn_amiga_line) / 2 + thisframe_first_drawn_line; -#endif if (thisframe_last_drawn_line - thisframe_first_drawn_line < max_drawn_amiga_line && currprefs.gfx_ycenter == 2) thisframe_y_adjust = (thisframe_last_drawn_line - thisframe_first_drawn_line - max_drawn_amiga_line) / 2 + thisframe_first_drawn_line; else - thisframe_y_adjust = thisframe_first_drawn_line; + thisframe_y_adjust = thisframe_first_drawn_line + ((thisframe_last_drawn_line - thisframe_first_drawn_line) - max_drawn_amiga_line) / 2; /* Would the old value be good enough? If so, leave it as it is if we want to * be clever. */ diff --git a/filesys.c b/filesys.c index 9bd1df53..c4bdaaff 100755 --- a/filesys.c +++ b/filesys.c @@ -315,14 +315,15 @@ static char *set_filesys_unit_1 (struct uaedev_mount_info *mountinfo, int nr, ui->hf.readonly = readonly; if (ui->hf.handle == 0) return "Hardfile not found"; - if ((blocksize & (blocksize - 1)) != 0 || blocksize <= 0) + if ((ui->hf.blocksize & (ui->hf.blocksize - 1)) != 0 || ui->hf.blocksize == 0) return "Bad blocksize"; - if ((secspertrack || surfaces || reserved) && - (secspertrack < 1 || surfaces < 1 || surfaces > 1023 || reserved < 0 || reserved > 1023) != 0) + if ((ui->hf.secspertrack || ui->hf.surfaces || ui->hf.reservedblocks) && + (ui->hf.secspertrack < 1 || ui->hf.surfaces < 1 || ui->hf.surfaces > 1023 || + ui->hf.reservedblocks < 0 || ui->hf.reservedblocks > 1023) != 0) return "Bad hardfile geometry"; - if (blocksize > ui->hf.size || ui->hf.size == 0) + if (ui->hf.blocksize > ui->hf.size || ui->hf.size == 0) return "Hardfile too small"; - ui->hf.nrcyls = (int)(secspertrack * surfaces ? (ui->hf.size / blocksize) / (secspertrack * surfaces) : 0); + ui->hf.nrcyls = (int)(ui->hf.secspertrack * ui->hf.surfaces ? (ui->hf.size / ui->hf.blocksize) / (ui->hf.secspertrack * ui->hf.surfaces) : 0); } ui->self = 0; ui->reset_state = FS_STARTUP; @@ -3788,6 +3789,8 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke if (lastblock * hfd->blocksize > hfd->size) return -2; + if (hfd->blocksize == 0) + return -2; for (rdblock = 0; rdblock < lastblock; rdblock++) { hdf_read (hfd, bufrdb, rdblock * hfd->blocksize, hfd->blocksize); if (rdb_checksum ("RDSK", bufrdb, rdblock)) diff --git a/include/custom.h b/include/custom.h index c3133b03..38b6650d 100755 --- a/include/custom.h +++ b/include/custom.h @@ -57,7 +57,7 @@ STATIC_INLINE int dmaen (unsigned int dmamask) #define SPCFLAG_EXTRA_CYCLES 32 #define SPCFLAG_TRACE 64 #define SPCFLAG_DOTRACE 128 -/* #define SPCFLAG_DOINT 256 obsolete hack */ +#define SPCFLAG_DOINT 256 /* arg, JIT fails without this.. */ #define SPCFLAG_BLTNASTY 512 #define SPCFLAG_EXEC 1024 #define SPCFLAG_ACTION_REPLAY 2048 diff --git a/include/inputdevice.h b/include/inputdevice.h index 3ddbfdee..a7d77aa1 100755 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -127,3 +127,6 @@ extern void indicator_leds (int num, int state); extern void warpmode (int mode); extern void pausemode (int mode); + +extern void inputdevice_add_inputcode (int code); +extern void inputdevice_handle_inputcode (void); diff --git a/include/keyboard.h b/include/keyboard.h index dd1b4b0c..074c787b 100755 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -135,5 +135,15 @@ enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT, AKS_FREEZEBUTTON, AKS_TOGGLEFULLSCREEN, AKS_ENTERDEBUGGER, AKS_IRQ7, AKS_PAUSE, AKS_WARP, AKS_INHIBITSCREEN, AKS_STATEREWIND, AKS_VOLDOWN, AKS_VOLUP, AKS_VOLMUTE, AKS_QUIT, - AKS_STATESAVE, AKS_STATERESTORE + AKS_STATESAVEQUICK, AKS_STATERESTOREQUICK, + AKS_STATESAVEQUICK1, AKS_STATERESTOREQUICK1, + AKS_STATESAVEQUICK2, AKS_STATERESTOREQUICK2, + AKS_STATESAVEQUICK3, AKS_STATERESTOREQUICK3, + AKS_STATESAVEQUICK4, AKS_STATERESTOREQUICK4, + AKS_STATESAVEQUICK5, AKS_STATERESTOREQUICK5, + AKS_STATESAVEQUICK6, AKS_STATERESTOREQUICK6, + AKS_STATESAVEQUICK7, AKS_STATERESTOREQUICK7, + AKS_STATESAVEQUICK8, AKS_STATERESTOREQUICK8, + AKS_STATESAVEQUICK9, AKS_STATERESTOREQUICK9, + AKS_STATESAVEDIALOG, AKS_STATERESTOREDIALOG }; diff --git a/inputdevice.c b/inputdevice.c index aa27ae7b..a6dbd246 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -1083,6 +1083,12 @@ static void queue_input_event (int event, int state, int max, int framecnt, int } static uae_u8 keybuf[256]; +static int inputcode_pending; + +void inputdevice_add_inputcode (int code) +{ + inputcode_pending = code; +} void inputdevice_do_keyboard (int code, int state) { @@ -1100,6 +1106,18 @@ void inputdevice_do_keyboard (int code, int state) } if (state == 0) return; + inputdevice_add_inputcode (code); +} + +void inputdevice_handle_inputcode (void) +{ + int code = inputcode_pending; + inputcode_pending = 0; + if (code == 0) + return; + if (vpos != 0) + write_log ("inputcode=%d but vpos = %d", code, vpos); + switch (code) { case AKS_ENTERGUI: @@ -1164,12 +1182,43 @@ void inputdevice_do_keyboard (int code, int state) case AKS_QUIT: uae_quit (); break; - case AKS_STATESAVE: - savestate_quick (0, 1); + case AKS_STATESAVEQUICK: + case AKS_STATESAVEQUICK1: + case AKS_STATESAVEQUICK2: + case AKS_STATESAVEQUICK3: + case AKS_STATESAVEQUICK4: + case AKS_STATESAVEQUICK5: + case AKS_STATESAVEQUICK6: + case AKS_STATESAVEQUICK7: + case AKS_STATESAVEQUICK8: + case AKS_STATESAVEQUICK9: + savestate_quick ((code - AKS_STATESAVEQUICK) / 2, 1); + break; + case AKS_STATERESTOREQUICK: + case AKS_STATERESTOREQUICK1: + case AKS_STATERESTOREQUICK2: + case AKS_STATERESTOREQUICK3: + case AKS_STATERESTOREQUICK4: + case AKS_STATERESTOREQUICK5: + case AKS_STATERESTOREQUICK6: + case AKS_STATERESTOREQUICK7: + case AKS_STATERESTOREQUICK8: + case AKS_STATERESTOREQUICK9: + savestate_quick ((code - AKS_STATESAVEQUICK) / 2, 0); + break; + case AKS_TOGGLEFULLSCREEN: + fullscreentoggle (); break; - case AKS_STATERESTORE: - savestate_quick (0, 0); + case AKS_ENTERDEBUGGER: + activate_debugger (); break; + case AKS_STATESAVEDIALOG: + gui_display (5); + break; + case AKS_STATERESTOREDIALOG: + gui_display (4); + break; + } } @@ -1308,6 +1357,7 @@ void inputdevice_vsync (void) idev[IDTYPE_MOUSE].read (); input_read = 1; input_vpos = 0; + inputdevice_handle_inputcode (); } static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state) diff --git a/inputevents.def b/inputevents.def index aa0e99d6..1ed64855 100755 --- a/inputevents.def +++ b/inputevents.def @@ -268,6 +268,9 @@ DEFEVENT(SPC_VOLUME_DOWN,"Decrease volume level",AM_K,0,0,AKS_VOLDOWN) DEFEVENT(SPC_VOLUME_UP,"Increase volume level",AM_K,0,0,AKS_VOLUP) DEFEVENT(SPC_VOLUME_MUTE,"Mute/unmute volume",AM_K,0,0,AKS_VOLMUTE) DEFEVENT(SPC_QUIT,"Quit emulator",AM_K,0,0,AKS_QUIT) -DEFEVENT(SPC_STATESAVE,"Save state",AM_K,0,0,AKS_STATESAVE) -DEFEVENT(SPC_STATERESTORE,"Restore state",AM_K,0,0,AKS_STATERESTORE) +DEFEVENT(SPC_STATESAVE,"Quick save state",AM_K,0,0,AKS_STATESAVEQUICK) +DEFEVENT(SPC_STATERESTORE,"Quick restore state",AM_K,0,0,AKS_STATERESTOREQUICK) +DEFEVENT(SPC_STATESAVEDIALOG,"Save state",AM_K,0,0,AKS_STATESAVEDIALOG) +DEFEVENT(SPC_STATERESTOREDIALOG,"Restore state",AM_K,0,0,AKS_STATERESTOREDIALOG) +DEFEVENT(SPC_TOGGLEFULLSCREEN,"Toggle windowed/fullscreen",AM_K,0,0,AKS_TOGGLEFULLSCREEN) diff --git a/memory.c b/memory.c index 8075f377..889d5326 100755 --- a/memory.c +++ b/memory.c @@ -1037,6 +1037,8 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu gui_message ("Error while reading Kickstart.\n"); return 0; } + if (i == size / 2) + memcpy (mem + size / 2, mem, size / 2); if (cr) decode_cloanto_rom (mem, size, i); diff --git a/newcpu.c b/newcpu.c index a3b4002c..c2ef975a 100755 --- a/newcpu.c +++ b/newcpu.c @@ -27,6 +27,7 @@ #include "ar.h" #ifdef JIT +extern uae_u8* compiled_code; #include "compemu.h" #include extern void vec(int x, struct siginfo* si, struct sigcontext* sc); @@ -1712,7 +1713,7 @@ static int do_specialties (int cycles) do_cycles (4 * CYCLE_UNIT); if (regs.spcflags & SPCFLAG_COPPER) do_copper (); - if (regs.spcflags & SPCFLAG_INT) { + if (regs.spcflags & (SPCFLAG_INT | SPCFLAG_DOINT)) { int intr = intlev (); if (intr != -1 && intr > regs.intmask) Interrupt (intr); @@ -1725,7 +1726,6 @@ static int do_specialties (int cycles) if (currprefs.cpu_idle && currprefs.m68k_speed != 0 && ((regs.spcflags & SPCFLAG_STOP)) == SPCFLAG_STOP) { /* sleep 1ms if STOP-instruction is executed */ if (1) { - extern uae_u8* compiled_code; static int sleepcnt, lvpos, zerocnt; if (vpos != lvpos) { sleepcnt--; @@ -1749,12 +1749,24 @@ static int do_specialties (int cycles) /* interrupt takes at least 2 cycles (maybe 4) to reach the CPU and * there are programs that require this delay (which is not too surprising..) */ - if (regs.spcflags & SPCFLAG_INT) { + if ((regs.spcflags & SPCFLAG_DOINT) +#ifdef JIT + || (!compiled_code && (regs.spcflags & SPCFLAG_INT)) +#endif + ) { int intr = intlev (); + unset_special (SPCFLAG_DOINT); if (intr != -1 && intr > regs.intmask) Interrupt (intr); } +#ifdef JIT + if ((regs.spcflags & SPCFLAG_INT) && compiled_code) { + unset_special (SPCFLAG_INT); + set_special (SPCFLAG_DOINT); + } +#endif + if ((regs.spcflags & (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE))) { unset_special (SPCFLAG_BRK | SPCFLAG_MODE_CHANGE); return 1; diff --git a/od-win32/keyboard_win32.c b/od-win32/keyboard_win32.c index f91bdb1c..8e7ade1d 100755 --- a/od-win32/keyboard_win32.c +++ b/od-win32/keyboard_win32.c @@ -260,26 +260,26 @@ static int np[] = { DIK_NUMPAD0, 0, DIK_NUMPADPERIOD, 0, DIK_NUMPAD1, 1, DIK_NUM void my_kbd_handler (int keyboard, int scancode, int newstate) { + int code = 0; + // write_log( "keyboard = %d scancode = 0x%02.2x state = %d\n", keyboard, scancode, newstate ); if (newstate) { switch (scancode) { case DIK_F12: if (ctrlpressed ()) { - fullscreentoggle(); + code = AKS_TOGGLEFULLSCREEN; } else if (shiftpressed () || endpressed ()) { disablecapture (); - activate_debugger (); + code = AKS_ENTERDEBUGGER; } else { - gui_display (-1); + code = AKS_ENTERGUI; } - return; + break; case DIK_F11: if (currprefs.win32_ctrl_F11_is_quit) { - if (ctrlpressed()) { - uae_quit(); - return; - } + if (ctrlpressed()) + code = AKS_QUIT; } break; case DIK_F1: @@ -288,31 +288,18 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) case DIK_F4: if (endpressed ()) { if (shiftpressed ()) - disk_eject (scancode - DIK_F1); + code = AKS_EFLOPPY0 + (scancode - DIK_F1); else - gui_display (scancode - DIK_F1); - return; + code = AKS_FLOPPY0 + (scancode - DIK_F1); } break; case DIK_F5: if (endpressed ()) { - gui_display (shiftpressed () ? 5 : 4); - return; - } - break; -#if 0 - case DIK_F6: - if (endpressed ()) { - if (shiftpressed ()) { - if(savestate_filename && strlen (savestate_filename)) - savestate_state = STATE_DOSAVE; - } else { - if(savestate_filename && strlen (savestate_filename)) - savestate_state = STATE_DORESTORE; - } - return; + if (shiftpressed ()) + code = AKS_STATESAVEDIALOG; + else + code = AKS_STATERESTOREDIALOG; } -#endif break; case DIK_NUMPAD0: case DIK_NUMPAD1: @@ -331,11 +318,10 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) v = np[i + 1]; if (np[i] == scancode) break; - i+=2; + i += 2; } if (v >= 0) - savestate_quick (v, shiftpressed() || ctrlpressed ()); - return; + code = AKS_STATESAVEQUICK + v * 2 + ((shiftpressed () || ctrlpressed()) ? 0 : 1); } break; case DIK_SYSRQ: @@ -343,39 +329,42 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) break; case DIK_PAUSE: if (endpressed ()) - warpmode (-1); + code = AKS_WARP; else - pausemode (-1); + code = AKS_PAUSE; break; case DIK_SCROLL: - toggle_inhibit_frame (IHF_SCROLLLOCK); - return; + code = AKS_INHIBITSCREEN; + break; case DIK_PRIOR: #ifdef ACTION_REPLAY - if (action_replay_freeze ()) - return; + code = AKS_FREEZEBUTTON; #endif break; case DIK_NEXT: break; case DIK_NUMPADMINUS: if (endpressed ()) - sound_volume (-1); + code = AKS_VOLDOWN; break; case DIK_NUMPADPLUS: if (endpressed ()) - sound_volume (1); + code = AKS_VOLUP; break; case DIK_NUMPADSTAR: if (endpressed ()) - sound_volume (0); + code = AKS_VOLMUTE; break; case DIK_NUMPADSLASH: if (endpressed ()) - savestate_dorewind (1); + code = AKS_STATEREWIND; break; } } + if (code) { + inputdevice_add_inputcode (code); + return; + } if (endpressed ()) return; diff --git a/od-win32/parser.c b/od-win32/parser.c index 0c3c8ad2..415fc9c3 100755 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -307,6 +307,8 @@ void writeser (int c) } else { + if (!currprefs.use_serial) + return; if (datainoutput + 1 < sizeof(outputbuffer)) { outputbuffer[datainoutput++] = c; } else { @@ -319,10 +321,10 @@ void writeser (int c) int checkserwrite (void) { - if (hCom == INVALID_HANDLE_VALUE) - return 1; if (midi_ready) { return 1; + if (hCom == INVALID_HANDLE_VALUE || !currprefs.use_serial) + return 1; } else { outser (); if (datainoutput >= sizeof (outputbuffer) - 1) @@ -339,6 +341,8 @@ int readseravail (void) if (ismidibyte ()) return 1; } else { + if (!currprefs.use_serial) + return 0; if (dataininput > dataininputcnt) return 1; if (hCom != INVALID_HANDLE_VALUE) { @@ -366,6 +370,8 @@ int readser (int *buffer) } else { + if (!currprefs.use_serial) + return 0; if (dataininput > dataininputcnt) { *buffer = inputbuffer[dataininputcnt++]; return 1; @@ -398,7 +404,7 @@ int readser (int *buffer) void serialuartbreak (int v) { - if (hCom == INVALID_HANDLE_VALUE) + if (hCom == INVALID_HANDLE_VALUE || !currprefs.use_serial) return; if (v) @@ -413,7 +419,7 @@ void getserstat (int *pstatus) int status = 0; *pstatus = 0; - if (hCom == INVALID_HANDLE_VALUE) + if (hCom == INVALID_HANDLE_VALUE || !currprefs.use_serial) return; GetCommModemStatus (hCom, &stat); @@ -431,7 +437,7 @@ void getserstat (int *pstatus) void setserstat (int mask, int onoff) { - if (hCom == INVALID_HANDLE_VALUE) + if (!currprefs.use_serial || hCom == INVALID_HANDLE_VALUE) return; if (mask & TIOCM_DTR) @@ -444,7 +450,7 @@ void setserstat (int mask, int onoff) int setbaud (long baud) { - if( baud == 31400 ) /* MIDI baud-rate */ + if( baud == 31400 && currprefs.win32_midioutdev >= -1) /* MIDI baud-rate */ { if (!midi_ready) { @@ -459,7 +465,9 @@ int setbaud (long baud) { Midi_Close(); } - if (hCom != INVALID_HANDLE_VALUE) + if (!currprefs.use_serial) + return 1; + if (hCom != INVALID_HANDLE_VALUE) { if (GetCommState (hCom, &dcb)) { diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index 0bd9bb69..7812225d 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -2849,6 +2849,8 @@ void picasso_handle_hsync (void) { static int p96hsync; + if (currprefs.gfxmem_size == 0) + return; if (WIN32GFX_IsPicassoScreen () && currprefs.gfx_pfullscreen && currprefs.gfx_vsync) { if (DirectDraw_GetVerticalBlankStatus ()) p96hsync = 0; @@ -2856,7 +2858,7 @@ void picasso_handle_hsync (void) p96hsync--; } if (p96hsync <= 0) { - rtarea[get_long(RTAREA_BASE + 36) + 12 - 1]++; + rtarea[get_long (RTAREA_BASE + 36) + 12 - 1]++; p96hsync = p96syncrate; } } @@ -2865,15 +2867,12 @@ void init_hz_p96 (void) { int rate; p96syncrate = maxvpos * vblank_hz; - if (isfullscreen ()) { + if (isfullscreen ()) rate = DirectDraw_CurrentRefreshRate (); - if (rate == 0) - rate = 60; - } else { + else rate = currprefs.gfx_refreshrate; - if (rate <= 0) - rate = 60; - } + if (rate <= 0) + rate = 60; p96syncrate /= rate; } diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 4f950970..a458c5e6 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -107,7 +107,7 @@ BEGIN CBS_HASSTRINGS | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_DA_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | - TBS_TOP | NOT WS_VISIBLE | WS_TABSTOP,97,159,101,20 + TBS_TOP | NOT WS_VISIBLE | WS_TABSTOP,97,161,101,20 PUSHBUTTON "Detect pixel format",IDC_TEST16BIT,221,163,67,14,0,0, HIDC_TEST16BIT END @@ -626,7 +626,7 @@ BEGIN "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,113,114,10 CONTROL "Full",IDC_COLLISION3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,104,129,27,10 - GROUPBOX "Sound emulation",IDC_STATIC,13,150,268,65 + GROUPBOX "Sound emulation",IDC_STATIC,13,151,268,65 CONTROL "Disabled",IDC_CS_SOUND0,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,39,167,102,10 CONTROL "Emulated",IDC_CS_SOUND1,"Button",BS_AUTORADIOBUTTON | @@ -802,7 +802,7 @@ BEGIN CONTROL "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,6,262,211 - PUSHBUTTON "Remove disk image",IDC_DISKLISTREMOVE,94,222,93,15 + PUSHBUTTON "Remove disk image",IDC_DISKLISTREMOVE,94,223,93,15 PUSHBUTTON "",IDC_UP,270,66,25,15,BS_ICON PUSHBUTTON "",IDC_DOWN,270,146,25,15,BS_ICON END @@ -934,11 +934,6 @@ IDC_MYHAND CURSOR "H_arrow.cur" #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN - IDD_DISPLAY, DIALOG - BEGIN - BOTTOMMARGIN, 175 - END - IDD_FLOPPY, DIALOG BEGIN BOTTOMMARGIN, 175 @@ -954,11 +949,6 @@ BEGIN BOTTOMMARGIN, 206 END - IDD_PORTS, DIALOG - BEGIN - BOTTOMMARGIN, 175 - END - IDD_CONTRIBUTORS, DIALOG BEGIN RIGHTMARGIN, 370 @@ -970,11 +960,6 @@ BEGIN BOTTOMMARGIN, 215 END - IDD_CHIPSET, DIALOG - BEGIN - BOTTOMMARGIN, 215 - END - IDD_INPUT, DIALOG BEGIN BOTTOMMARGIN, 187 @@ -985,11 +970,6 @@ BEGIN BOTTOMMARGIN, 175 END - IDD_DISK, DIALOG - BEGIN - BOTTOMMARGIN, 193 - END - IDD_PANEL, DIALOG BEGIN LEFTMARGIN, 7 diff --git a/od-win32/serial_win32.c b/od-win32/serial_win32.c index 224b1343..6092195d 100755 --- a/od-win32/serial_win32.c +++ b/od-win32/serial_win32.c @@ -84,9 +84,6 @@ void SERPER (uae_u16 w) write_log ("SERIAL: period=%d, baud=%d, hsyncs=%d PC=%x\n", w, baud, serial_period_hsyncs, m68k_getpc()); - if (!currprefs.use_serial) - return; - if (ninebit) baud *= 2; if (currprefs.serial_direct) { @@ -114,9 +111,6 @@ static void checkreceive (int mode) struct timeval tv; int recdata; - if (!currprefs.use_serial) - return; - if (!readseravail()) return; @@ -178,9 +172,6 @@ static void checksend (int mode) if (!data_in_serdat && !data_in_sershift) return; - if (!currprefs.use_serial) - bufstate = 1; - if (data_in_sershift && mode == 0 && bufstate) data_in_sershift = 0; @@ -188,11 +179,9 @@ static void checksend (int mode) data_in_sershift = 1; serdatshift = serdat; #ifdef SERIAL_PORT - if (currprefs.use_serial) { - if (ninebit) - writeser (((serdatshift >> 8) & 1) | 0xa8); - writeser (serdatshift); - } + if (ninebit) + writeser (((serdatshift >> 8) & 1) | 0xa8); + writeser (serdatshift); #endif data_in_serdat = 0; INTREQ (0x8000 | 0x0001); @@ -468,7 +457,6 @@ void serial_init (void) if (!currprefs.serial_demand) serial_open (); - serdat = 0x2000; #endif } diff --git a/od-win32/win32.c b/od-win32/win32.c index be0215ad..fcee1dad 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -432,7 +432,7 @@ static void winuae_active (HWND hWnd, int minimized) timeend(); focus = 1; - write_log( "WinUAE now active via WM_ACTIVATE\n" ); + write_log ("WinUAE now active via WM_ACTIVATE\n"); pri = priorities[currprefs.win32_inactive_priority].value; #ifndef _DEBUG if (!minimized) @@ -442,7 +442,7 @@ static void winuae_active (HWND hWnd, int minimized) if (!minimized) { if (!avioutput_video) { - clear_inhibit_frame( IHF_WINDOWHIDDEN ); + clear_inhibit_frame (IHF_WINDOWHIDDEN); } } if (emulation_paused > 0) @@ -495,7 +495,7 @@ static void winuae_inactive (HWND hWnd, int minimized) #endif } if (!avioutput_video) { - set_inhibit_frame( IHF_WINDOWHIDDEN ); + set_inhibit_frame (IHF_WINDOWHIDDEN); } if (currprefs.win32_iconified_pause) { close_sound (); @@ -542,6 +542,7 @@ void disablecapture (void) static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + static int ignorenextactivateapp; PAINTSTRUCT ps; HDC hDC; BOOL minimized; @@ -560,17 +561,25 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, { case WM_ACTIVATE: minimized = HIWORD( wParam ); - if (LOWORD (wParam) != WA_INACTIVE) + if (LOWORD (wParam) != WA_INACTIVE) { winuae_active (hWnd, minimized); - else + if (ignorenextactivateapp > 0) + ignorenextactivateapp--; + } else winuae_inactive (hWnd, minimized); break; case WM_ACTIVATEAPP: - if (!wParam) + if (!wParam) { setmouseactive (0); - else if (gui_active && isfullscreen()) - exit_gui (0); + } else { + if (!ignorenextactivateapp && isfullscreen () && is3dmode ()) { + WIN32GFX_DisplayChangeRequested (); + ignorenextactivateapp = 2; + } + if (gui_active && isfullscreen()) + exit_gui (0); + } manual_palette_refresh_needed = 1; break; @@ -799,19 +808,19 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, disk_eject (3); break; case ID_ST_DF0: - DiskSelection (hWnd, IDC_DF0, 0, &changed_prefs, 0); + DiskSelection (isfullscreen() ? NULL : hWnd, IDC_DF0, 0, &changed_prefs, 0); disk_insert (0, changed_prefs.df[0]); break; case ID_ST_DF1: - DiskSelection (hWnd, IDC_DF1, 0, &changed_prefs, 0); + DiskSelection (isfullscreen() ? NULL : hWnd, IDC_DF1, 0, &changed_prefs, 0); disk_insert (1, changed_prefs.df[0]); break; case ID_ST_DF2: - DiskSelection (hWnd, IDC_DF2, 0, &changed_prefs, 0); + DiskSelection (isfullscreen() ? NULL : hWnd, IDC_DF2, 0, &changed_prefs, 0); disk_insert (2, changed_prefs.df[0]); break; case ID_ST_DF3: - DiskSelection (hWnd, IDC_DF3, 0, &changed_prefs, 0); + DiskSelection (isfullscreen() ? NULL : hWnd, IDC_DF3, 0, &changed_prefs, 0); disk_insert (3, changed_prefs.df[0]); break; } @@ -960,6 +969,7 @@ void handle_events (void) inputdevicefunc_keyboard.read(); inputdevicefunc_mouse.read(); inputdevicefunc_joystick.read(); + inputdevice_handle_inputcode (); } while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage (&msg); @@ -1413,6 +1423,8 @@ void target_default_options (struct uae_prefs *p) p->win32_active_priority = 1; p->win32_inactive_priority = 2; p->win32_iconified_priority = 3; + p->win32_midioutdev = 0; + p->win32_midiindev = -2; } void target_save_options (FILE *f, struct uae_prefs *p) diff --git a/od-win32/win32.h b/od-win32/win32.h index 7891a308..0bda75b2 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -21,7 +21,7 @@ extern int manual_painting_needed; extern int manual_palette_refresh_needed; extern int mouseactive, focus; #define WINUAEBETA 1 -#define WINUAEBETASTR " Beta 1" +#define WINUAEBETASTR " Beta 2" extern void my_kbd_handler (int, int, int); extern void clearallkeys(void); diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index 9aef00f8..6d9a3811 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -225,6 +225,11 @@ int isfullscreen (void) return currprefs.gfx_afullscreen; } +int is3dmode (void) +{ + return currentmode->flags & (DM_D3D | DM_OPENGL); +} + int WIN32GFX_GetDepth (int real) { if (!currentmode->real_depth) @@ -779,10 +784,10 @@ void flush_screen (int a, int b) S2X_render (); if( currentmode->flags & DM_DX_FULLSCREEN ) DX_Flip (); - else if(DirectDraw_GetLockableType() != overlay_surface) + else if (DirectDraw_GetLockableType() != overlay_surface) DX_Blit( 0, 0, 0, 0, WIN32GFX_GetWidth(), WIN32GFX_GetHeight(), BLIT_SRC ); - } else if((currentmode->flags & DM_DDRAW) && DirectDraw_GetLockableType() == secondary_surface ) { - if( currentmode->flags & DM_DX_FULLSCREEN ) { + } else if ((currentmode->flags & DM_DDRAW) && DirectDraw_GetLockableType() == secondary_surface ) { + if (currentmode->flags & DM_DX_FULLSCREEN) { if( turbo_emulation || DX_Flip() == 0 ) DX_Blit (0, a, 0, a, currentmode->current_width, b - a + 1, BLIT_SRC); } else if(DirectDraw_GetLockableType() != overlay_surface) diff --git a/od-win32/win32gfx.h b/od-win32/win32gfx.h index 99c89714..40fa7566 100755 --- a/od-win32/win32gfx.h +++ b/od-win32/win32gfx.h @@ -35,5 +35,6 @@ extern HDC gethdc (void); extern void releasehdc (HDC hdc); extern void close_windows (void); extern void updatewinfsmode (struct uae_prefs *p); +extern int is3dmode (void); #endif diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 6b3ce57b..f902f78f 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -187,28 +187,26 @@ void gui_display( int shortcut ) ) { flipflop = 1; } + WIN32GFX_ClearPalette(); manual_painting_needed++; /* So that WM_PAINT will refresh the display */ hr = DirectDraw_FlipToGDISurface(); - if (hr != DD_OK) { + if (hr != DD_OK) write_log ("FlipToGDISurface failed, %s\n", DXError (hr)); - } if( shortcut == -1 ) { int ret; - if( flipflop ) - ShowWindow( hAmigaWnd, SW_MINIMIZE ); + if (flipflop) + ShowWindow (hAmigaWnd, SW_MINIMIZE); ret = GetSettings (0, flipflop ? GetDesktopWindow () : hAmigaWnd); - if( flipflop ) - ShowWindow( hAmigaWnd, SW_RESTORE ); + if (flipflop > 0) + ShowWindow (hAmigaWnd, SW_RESTORE); if (!ret) { savestate_state = 0; } } else if (shortcut >= 0 && shortcut < 4) { - write_log("1\n"); DiskSelection( hAmigaWnd, IDC_DF0+shortcut, 0, &changed_prefs, 0 ); - write_log("2\n"); } else if (shortcut == 5) { if (DiskSelection( hAmigaWnd, IDC_DOSAVESTATE, 9, &changed_prefs, 0 )) save_state (savestate_fname, "Description!"); @@ -229,7 +227,8 @@ void gui_display( int shortcut ) #ifdef CD32 akiko_exitgui (); #endif - setmouseactive (1); + if (flipflop >= 0) + setmouseactive (1); #ifdef D3D D3D_guimode (FALSE); #endif @@ -494,7 +493,6 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, if( !(result = GetOpenFileName (&openFileName)) ) write_log ("GetOpenFileName() failed.\n"); } - write_log("result=%d\n", result); // xxx if (result) { switch (wParam) @@ -512,13 +510,9 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, SetDlgItemText (hDlg, wParam, full_path); break; case IDC_DF0: - write_log("x1\n"); SetDlgItemText (hDlg, IDC_DF0TEXT, full_path); - write_log("x2\n"); strcpy( prefs->df[0], full_path ); - write_log("x3\n"); DISK_history_add (full_path, -1); - write_log("x4\n"); break; case IDC_DF1: SetDlgItemText (hDlg, IDC_DF1TEXT, full_path); @@ -618,7 +612,6 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, } } } - write_log("return=%d\n", result); return result; } @@ -4235,6 +4228,8 @@ static void addfloppytype (HWND hDlg, int n) } if (!strcmp (workprefs.df[n], s)) SendDlgItemMessage (hDlg, f_text, CB_SETCURSEL, i - 1, 0); + if (nn <= 0) + break; } if (fkey) RegCloseKey (fkey); @@ -4340,7 +4335,7 @@ static BOOL CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l if (recursive > 0) break; recursive++; - if (HIWORD (wParam) == CBN_SELCHANGE) { + if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { switch (LOWORD (wParam)) { case IDC_DF0TEXT: @@ -4685,7 +4680,7 @@ static void values_from_portsdlg (HWND hDlg) } workprefs.win32_midioutdev = SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_GETCURSEL, 0, 0 ); - workprefs.win32_midioutdev--; /* selection zero is always 'default midi device', so we make it -1 */ + workprefs.win32_midioutdev -= 2; if( bNoMidiIn ) { @@ -4695,6 +4690,7 @@ static void values_from_portsdlg (HWND hDlg) { workprefs.win32_midiindev = SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_GETCURSEL, 0, 0 ); } + EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE); item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L); switch( item ) @@ -4709,15 +4705,11 @@ static void values_from_portsdlg (HWND hDlg) case 8: workprefs.use_serial = 1; strcpy (workprefs.sername, comports[item - 1]); - EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE ); - EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), TRUE ); break; default: workprefs.use_serial = 0; strcpy( workprefs.sername, "none" ); - EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE ); - EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE ); break; } workprefs.serial_demand = 0; @@ -4733,8 +4725,7 @@ static void values_from_portsdlg (HWND hDlg) static void values_to_portsdlg (HWND hDlg) { - LONG item_height, result = 0; - RECT rect; + LONG result = 0; if( strcmp (workprefs.prtname, "none")) { @@ -4764,11 +4755,12 @@ static void values_to_portsdlg (HWND hDlg) } } SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_SETCURSEL, result, 0 ); - SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_SETCURSEL, workprefs.win32_midioutdev + 1, 0 ); /* we +1 here because 1st entry is 'default' */ - if( !bNoMidiIn && ( workprefs.win32_midiindev >= 0 ) ) + SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_SETCURSEL, workprefs.win32_midioutdev + 2, 0 ); + if (!bNoMidiIn && workprefs.win32_midiindev >= 0) SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_SETCURSEL, workprefs.win32_midiindev, 0 ); else SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_SETCURSEL, 0, 0 ); + EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), workprefs.win32_midioutdev < -1 ? FALSE : TRUE); CheckDlgButton( hDlg, IDC_SHARED, workprefs.serial_demand ); CheckDlgButton( hDlg, IDC_SER_CTSRTS, workprefs.serial_hwctsrts ); @@ -4809,29 +4801,6 @@ static void values_to_portsdlg (HWND hDlg) workprefs.use_serial = 1; } } - - if( workprefs.use_serial ) - { - EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE ); - if( !bNoMidiIn ) - EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), TRUE ); - } - else - { - EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE ); - EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE ); - } - /* Retrieve the height, in pixels, of a list item. */ - item_height = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, 0, 0L); - if (item_height != CB_ERR) { - /* Get actual box position and size. */ - GetWindowRect (GetDlgItem (hDlg, IDC_SERIAL), &rect); - rect.bottom = (rect.top + item_height * 5 - + SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETITEMHEIGHT, (WPARAM) - 1, 0L) - + item_height); - SetWindowPos (GetDlgItem (hDlg, IDC_SERIAL), 0, 0, 0, rect.right - rect.left, - rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); - } } static void init_portsdlg( HWND hDlg ) @@ -4892,6 +4861,8 @@ static void init_portsdlg( HWND hDlg ) } } + SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L ); + SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone ); if( ( numdevs = midiOutGetNumDevs() ) == 0 ) { EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), FALSE ); @@ -4900,7 +4871,6 @@ static void init_portsdlg( HWND hDlg ) { char szMidiOut[ MAX_DPATH ]; WIN32GUI_LoadUIString( IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH ); - SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L ); SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut ); for( port = 0; port < numdevs; port++ ) @@ -4910,8 +4880,10 @@ static void init_portsdlg( HWND hDlg ) SendDlgItemMessage( hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname ); } } + EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST ), TRUE ); } + SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L ); if( ( numdevs = midiInGetNumDevs() ) == 0 ) { EnableWindow( GetDlgItem( hDlg, IDC_MIDIINLIST ), FALSE ); @@ -4919,8 +4891,6 @@ static void init_portsdlg( HWND hDlg ) } else { - SendDlgItemMessage( hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L ); - for( port = 0; port < numdevs; port++ ) { if( midiInGetDevCaps( port, &midiInCaps, sizeof( midiInCaps ) ) == MMSYSERR_NOERROR ) -- 2.47.3