From 0511e255984b9514aabbc81b81a22894aed2faf3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 20 Mar 2005 15:01:10 +0200 Subject: [PATCH] imported winuaesrc1000b4.zip --- catweasel.c | 33 +++++++- cfgfile.c | 2 +- custom.c | 13 ++- disk.c | 40 +++++---- filesys.c | 7 ++ include/catweasel.h | 1 + include/disk.h | 1 + od-win32/blkdev_win32_aspi.c | 23 +++++- od-win32/dxwrap.c | 2 +- od-win32/mman.c | 4 +- od-win32/resources/resource.h | 3 +- od-win32/resources/winuae.rc | 46 +++-------- od-win32/win32.c | 73 +++++++++-------- od-win32/win32.h | 2 +- od-win32/win32gfx.c | 48 ++++++++--- od-win32/win32gui.c | 147 ++++++++++++++++++++++++++-------- 16 files changed, 299 insertions(+), 146 deletions(-) diff --git a/catweasel.c b/catweasel.c index 49c3b9a2..6fc18133 100755 --- a/catweasel.c +++ b/catweasel.c @@ -22,7 +22,8 @@ static HANDLE handle = INVALID_HANDLE_VALUE; void catweasel_hsync (void) { - int x, y, i; + int i; + uae_u8 x, y; if (cwc.type < CATWEASEL_TYPE_MK3) return; @@ -31,9 +32,13 @@ void catweasel_hsync (void) return; cwhsync = 10; if (handshake) { + /* keyboard handshake */ catweasel_do_bput (0xd0, 0); handshake = 0; } + if (cwc.type < CATWEASEL_TYPE_MK4) + return; + /* read MK4 mouse counters */ catweasel_do_bput (3, 0x81); for (i = 0; i < 2; i++) { x = catweasel_do_bget (0xc4 + i * 8); @@ -140,9 +145,10 @@ int catweasel_init (void) } model = *((uae_u32*)(buffer + 4)); base = *((uae_u32*)(buffer + 0)); - cwc.type = model == 0 ? 1 : model == 2 ? 4 : 2; + cwc.type = model == 0 ? 1 : model == 2 ? 4 : 3; cwc.iobase = base; - write_log ("Catweasel MK%d @%p (%s) detected and enabled\n", cwc.type, cwc.iobase, name); + write_log ("Catweasel MK%d @%p (%s) detected and enabled\n", + cwc.type, cwc.iobase, name); catweasel_do_bput (3, 0x41); /* enable MK3-mode */ catweasel_init_controller (&cwc); return 1; @@ -160,6 +166,27 @@ void catweasel_free (void) cwc.type = 0; } +int catweasel_detect (void) +{ + char name[32]; + int i; + + if (handle != INVALID_HANDLE_VALUE) + return TRUE; + for (i = 0; i < 4; i++) { + sprintf (name, "\\\\.\\CAT%d_F0", i); + handle = CreateFile (name, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + if (handle != INVALID_HANDLE_VALUE) + break; + } + if (handle == INVALID_HANDLE_VALUE) + return FALSE; + CloseHandle (handle); + handle = INVALID_HANDLE_VALUE; + return TRUE; +} + #define outb(v,port) catweasel_do_bput(port,v) #define inb(port) catweasel_do_bget(port) diff --git a/cfgfile.c b/cfgfile.c index 1cbce89a..e7236236 100755 --- a/cfgfile.c +++ b/cfgfile.c @@ -2166,7 +2166,7 @@ static void default_prefs_mini (struct uae_prefs *p, int type) void default_prefs (struct uae_prefs *p, int type) { - int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1 }; + int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 }; memset (p, 0, sizeof (*p)); strcpy (p->description, "UAE default configuration"); diff --git a/custom.c b/custom.c index f357e1ef..2beffb92 100755 --- a/custom.c +++ b/custom.c @@ -58,14 +58,19 @@ void uae_abort (const char *format,...) { + static int nomore; va_list parms; char buffer[1000]; va_start (parms, format); _vsnprintf( buffer, sizeof (buffer) -1, format, parms ); va_end (parms); + if (nomore) { + write_log(buffer); + return; + } gui_message (buffer); - activate_debugger (); + nomore = 1; } #if 0 @@ -1949,7 +1954,9 @@ static void decide_sprites (int hpos) { int nrs[MAX_SPRITES], posns[MAX_SPRITES]; int count, i; - int point = hpos * 2; + /* apparantly writes to custom registers happen in the 3/4th of cycle + * and sprite xpos comparator sees it immediately */ + int point = hpos * 2 - 4; int width = sprite_width; int window_width = (width << lores_shift) >> sprres; @@ -4466,7 +4473,7 @@ static void hsync_handler (void) vsync_handler (); } - DISK_update (maxhpos); + DISK_hsync (maxhpos); #ifdef JIT if (compiled_code) { diff --git a/disk.c b/disk.c index 860318e0..789b6bf0 100755 --- a/disk.c +++ b/disk.c @@ -156,6 +156,7 @@ typedef struct { int dskready_time; int dskready_down_time; int steplimit; + frame_time_t steplimitcycle; int indexhack, indexhackmode; int ddhd; /* 1=DD 2=HD */ int drive_id_scnt; /* drive id shift counter */ @@ -175,6 +176,8 @@ typedef struct { #endif } drive; +#define MIN_STEPLIMIT_CYCLE (CYCLE_UNIT * 150) + static uae_u16 bigmfmbufw[0x4000 * DDHDMULT]; static drive floppy[MAX_FLOPPY_DRIVES]; #define MAX_PREVIOUS_FLOPPIES 99 @@ -987,9 +990,9 @@ static void drive_step (drive * drv) return; } #endif - if (drv->steplimit) { + if (drv->steplimit && get_cycles() - drv->steplimitcycle < MIN_STEPLIMIT_CYCLE) { #ifdef DISK_DEBUG2 - write_dlog (" step ignored"); + write_dlog (" step ignored %d", (get_cycles() - drv->steplimitcycle) / CYCLE_UNIT); #endif return; } @@ -997,7 +1000,8 @@ static void drive_step (drive * drv) * but we'll use very small value for better compatibility with faster CPU emulation * (stupid trackloaders with CPU delay loops) */ - drv->steplimit = 2; + drv->steplimit = 10; + drv->steplimitcycle = get_cycles (); if (!drive_empty (drv)) drv->dskchange = 0; if (direction) { @@ -2353,20 +2357,9 @@ static void DISK_start (void) static int linecounter; -void DISK_update (int tohpos) +void DISK_hsync (int tohpos) { int dr; - int cycles = (tohpos << 8) - disk_hpos; - int startcycle = disk_hpos; - - disk_jitter = ((rand () >> 4) & 3) + 1; - if (disk_jitter > 2) - disk_jitter = 1; - if (cycles <= 0) - return; - disk_hpos += cycles; - if (disk_hpos >= (maxhpos << 8)) - disk_hpos -= maxhpos << 8; for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { drive *drv = &floppy[dr]; @@ -2379,6 +2372,23 @@ void DISK_update (int tohpos) disk_dmafinished (); return; } + DISK_update (tohpos); +} + +void DISK_update (int tohpos) +{ + int dr; + int cycles = (tohpos << 8) - disk_hpos; + int startcycle = disk_hpos; + + disk_jitter = ((rand () >> 4) & 3) + 1; + if (disk_jitter > 2) + disk_jitter = 1; + if (cycles <= 0) + return; + disk_hpos += cycles; + if (disk_hpos >= (maxhpos << 8)) + disk_hpos -= maxhpos << 8; #if 0 dodmafetch (); diff --git a/filesys.c b/filesys.c index 25f96dbf..977472dd 100755 --- a/filesys.c +++ b/filesys.c @@ -393,6 +393,9 @@ void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mounti sprintf (tmp, "filesystem2=%s,%s:%s:%s,%d\n", uip[i].readonly ? "ro" : "rw", uip[i].devname ? uip[i].devname : "", uip[i].volname, str, uip[i].bootpri); zfile_fputs (f, tmp); + sprintf (tmp, "filesystem=%s,%s:%s\n", uip[i].readonly ? "ro" : "rw", + uip[i].volname, str); + zfile_fputs (f, tmp); } else { sprintf (tmp, "hardfile2=%s,%s:%s,%d,%d,%d,%d,%d,%s\n", uip[i].readonly ? "ro" : "rw", @@ -400,6 +403,10 @@ void write_filesys_config (struct uae_prefs *p, struct uaedev_mount_info *mounti uip[i].hf.secspertrack, uip[i].hf.surfaces, uip[i].hf.reservedblocks, uip[i].hf.blocksize, uip[i].bootpri,uip[i].filesysdir ? uip[i].filesysdir : ""); zfile_fputs (f, tmp); + sprintf (tmp, "hardfile=%s,%d,%d,%d,%d,%s\n", + uip[i].readonly ? "ro" : "rw", uip[i].hf.secspertrack, + uip[i].hf.surfaces, uip[i].hf.reservedblocks, uip[i].hf.blocksize, str); + zfile_fputs (f, tmp); } xfree (str); } diff --git a/include/catweasel.h b/include/catweasel.h index 29c5de0c..8ff11704 100755 --- a/include/catweasel.h +++ b/include/catweasel.h @@ -5,6 +5,7 @@ extern struct catweasel_contr cwc; extern int catweasel_read_keyboard (uae_u8 *keycode); extern int catweasel_init (void); extern void catweasel_free (void); +extern int catweasel_detect (void); extern uae_u32 catweasel_do_bget (uaecptr addr); extern void catweasel_do_bput (uaecptr addr, uae_u32 b); extern int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons); diff --git a/include/disk.h b/include/disk.h index 8ca975a1..73f68f73 100755 --- a/include/disk.h +++ b/include/disk.h @@ -19,6 +19,7 @@ extern void DISK_check_change (void); extern struct zfile *DISK_validate_filename (const char *, int, int *, uae_u32 *); extern void DISK_handler (void); extern void DISK_update (int hpos); +extern void DISK_hsync (int hpos); extern void DISK_reset (void); extern int disk_getwriteprotect (const char *name); extern int disk_setwriteprotect (int num, const char *name, int protect); diff --git a/od-win32/blkdev_win32_aspi.c b/od-win32/blkdev_win32_aspi.c index 34d914b4..f17937af 100755 --- a/od-win32/blkdev_win32_aspi.c +++ b/od-win32/blkdev_win32_aspi.c @@ -65,20 +65,41 @@ static int ha_inquiry (SCSI *scgp, int id, SRB_HAInquiry *ip) static int open_driver (SCSI *scgp) { + char path[MAX_DPATH]; DWORD astatus; BYTE HACount; BYTE ASPIStatus; int i; + int nero; + HKEY key; + DWORD type = REG_SZ; + DWORD size = sizeof (path); /* * Check if ASPI library is already loaded yet */ if (AspiLoaded == TRUE) return TRUE; + + nero = 0; + strcpy (path, "WNASPI32"); + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Ahead\\shared", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS) { + if (RegQueryValueEx (key, "NeroAPI", 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) { + strcat (path, "\\wnaspi32.dll"); + RegCloseKey (key); + nero = 1; + } + } /* * Load the ASPI library */ - hAspiLib = LoadLibrary("WNASPI32"); + write_log ("ASPI: driver location '%s'\n", path); + hAspiLib = LoadLibrary(path); + if (hAspiLib == NULL && nero) { + write_log ("ASPI: NERO ASPI failed to load, falling back to default\n"); + hAspiLib = LoadLibrary("WNASPI32"); + } + /* * Check if ASPI library is loaded correctly */ diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index fbe763cd..d263329f 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -738,8 +738,8 @@ void DirectDraw_Release( void ) if (DirectDrawState.directdraw.dd && DirectDrawState.modeset) { - IDirectDraw7_RestoreDisplayMode( DirectDrawState.directdraw.dd ); IDirectDraw7_SetCooperativeLevel( DirectDrawState.directdraw.dd, hAmigaWnd, DDSCL_NORMAL); + IDirectDraw7_RestoreDisplayMode( DirectDrawState.directdraw.dd ); } DirectDrawState.modeset = 0; diff --git a/od-win32/mman.c b/od-win32/mman.c index 75e25874..49bea7b6 100755 --- a/od-win32/mman.c +++ b/od-win32/mman.c @@ -53,12 +53,12 @@ void init_shm( void ) write_log ("NATMEM: Our special area: 0x%x-0x%x\n", natmem_offset, natmem_offset + size); VirtualFree (blah, 0, MEM_RELEASE); while (address < (LPBYTE)0xa0000000) { - address += add * 8; + address += add * 32; if (!os_winnt) /* Windows 9x/ME sucks */ break; blah = VirtualAlloc (address, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (blah == NULL) { - address -= add * 8; + address -= add * 32; break; } VirtualFree (blah, 0, MEM_RELEASE); diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index b5ff88d3..22d09a19 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -213,6 +213,7 @@ #define IDS_SOUND_4CHANNEL 242 #define IDS_HF_FS_CUSTOM 243 #define IDS_SELECTFS 244 +#define IDS_KEYJOY 245 #define IDB_XARCADE 246 #define IDS_NUMSG_NEEDEXT2 300 #define IDS_NUMSG_NOROMKEY 301 @@ -622,12 +623,12 @@ #define IDC_AVIOUTPUT_FPS 1609 #define IDC_INPUTDEVICE 1609 #define IDC_MAPROM 1609 +#define IDC_NORECYCLEBIN 1609 #define IDC_AVIOUTPUT_FILETEXT 1610 #define IDC_INPUTDEVICETEXT 1610 #define IDC_ALWAYSONTOP 1610 #define IDC_AVIOUTPUT_FILE 1611 #define IDC_INPUTLIST 1611 -#define IDC_CLOCKSYNC2 1611 #define IDC_CATWEASEL 1611 #define IDC_AVIOUTPUT_FPS_STATIC 1612 #define IDC_INPUTAMIGA 1612 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d8bafe15..8c05ae72 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -300,6 +300,8 @@ BEGIN HIDC_MAPDRIVES CONTROL "Disable UAEFSDB-support",IDC_NOUAEFSDB,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,5,229,115,10 + CONTROL "Don't use Windows Recycle Bin",IDC_NORECYCLEBIN,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,114,216,115,10 END IDD_SOUND DIALOGEX 0, 0, 300, 244 @@ -398,7 +400,7 @@ BEGIN PUSHBUTTON "Delete",IDC_DELETE,255,225,40,15 END -IDD_PORTS DIALOGEX 0, 0, 300, 242 +IDD_PORTS DIALOGEX 0, 0, 300, 222 STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN @@ -433,43 +435,14 @@ BEGIN RTEXT "In:",IDC_MIDI2,150,115,29,15,SS_CENTERIMAGE COMBOBOX IDC_MIDIINLIST,185,115,95,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Amiga Mouse/Joystick Port 0",IDC_PORT0,4,139,142,97 - CONTROL "",IDC_PORT0_JOYSC,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,10,156,9,11 - CONTROL "Keyboard Layout ""A"" []Numeric keypad, 0 and 5 = fire", - IDC_PORT0_KBDA,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 10,173,90,10 - CONTROL "Keyboard Layout ""B"" []Cursor keys, right CTRL and ALT = fire", - IDC_PORT0_KBDB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 10,186,90,10 - CONTROL "Keyboard Layout ""C"" []T = up, B = down, F = left, H = right, left ALT = fire", - IDC_PORT0_KBDC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 10,198,90,10 - CONTROL "X-Arcade (left) []#1",IDC_PORT0_KBDD,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,10,210,90,10 - CONTROL "X-Arcade (right) []#1",IDC_PORT0_KBDE,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,10,222,90,10 - COMBOBOX IDC_PORT0_JOYS,23,153,117,130,CBS_DROPDOWNLIST | + GROUPBOX "Amiga Mouse/Joystick Ports",IDC_PORT0,4,139,292,77 + COMBOBOX IDC_PORT0_JOYS,45,155,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Amiga Joystick/Mouse Port 1",IDC_PORT1,150,139,146,98 - CONTROL "",IDC_PORT1_JOYSC,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,155,156,9,11 - CONTROL "Keyboard Layout ""A"" []Numeric keypad, 0 and 5 = fire", - IDC_PORT1_KBDA,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 155,173,90,10 - CONTROL "Keyboard Layout ""B"" []Cursor keys, right CTRL and ALT = fire", - IDC_PORT1_KBDB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 155,186,90,10 - CONTROL "Keyboard Layout ""C"" []T = up, B = down, F = left, H = right, left ALT = fire", - IDC_PORT1_KBDC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, - 155,198,90,10 - CONTROL "X-Arcade (left) []#1",IDC_PORT1_KBDD,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,155,210,90,10 - CONTROL "X-Arcade (right) []#1",IDC_PORT1_KBDE,"Button", - BS_AUTORADIOBUTTON | WS_TABSTOP,155,222,90,10 - COMBOBOX IDC_PORT1_JOYS,168,153,123,130,CBS_DROPDOWNLIST | + COMBOBOX IDC_PORT1_JOYS,45,176,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Swap",IDC_SWAP,256,213,33,14 + PUSHBUTTON "Swap Ports",IDC_SWAP,114,195,75,14 + RTEXT "Port 0:",IDC_STATIC,11,154,25,15,SS_CENTERIMAGE + RTEXT "Port 1:",IDC_STATIC,11,175,25,15,SS_CENTERIMAGE END IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242 @@ -1394,6 +1367,7 @@ BEGIN IDS_SOUND_4CHANNEL "4 Channels" IDS_HF_FS_CUSTOM "Custom" IDS_SELECTFS "Select filesystem handler (FastFileSystem, SmartFilesystem,...)" + IDS_KEYJOY "Keyboard Layout A (Numeric keypad, 0 and 5 = fire)\nKeyboard Layout B (Cursor keys, right CTRL and ALT = fire)\nKeyboard Layout C (T=up B=down F=left H=right, left ALT = fire)\nX-Arcade (Left)\nX-Arcade (Right)" END STRINGTABLE diff --git a/od-win32/win32.c b/od-win32/win32.c index e3c21ace..12d90320 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -252,7 +252,7 @@ static int figure_processor_speed (void) } init_mmtimer(); - SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); sleep_millis (100); dummythread_die = -1; @@ -581,7 +581,7 @@ static void handleXbutton (WPARAM wParam, int updown) setmousebuttonstate (dinput_winmouse(), num, updown); } -static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hDC; @@ -851,10 +851,10 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, inserted = 1; else if (wParam == DBT_DEVICEREMOVECOMPLETE) inserted = 0; - #ifdef WINDDK +#ifdef WINDDK win32_spti_media_change (drive, inserted); win32_ioctl_media_change (drive, inserted); - #endif +#endif win32_aspi_media_change (drive, inserted); } } @@ -935,6 +935,7 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, break; } break; + case WM_COMMAND: switch (wParam & 0xffff) { @@ -985,14 +986,14 @@ static long FAR PASCAL AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, return DefWindowProc (hWnd, message, wParam, lParam); } -static long FAR PASCAL MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; RECT rc; HDC hDC; - switch (message) { - + switch (message) + { case WM_MOUSEMOVE: case WM_MOUSEWHEEL: case WM_ACTIVATEAPP: @@ -1044,28 +1045,24 @@ static long FAR PASCAL MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, L case WM_WINDOWPOSCHANGED: WIN32GFX_WindowMove(); - if( hAmigaWnd && GetWindowRect (hAmigaWnd, &amigawin_rect) ) - { + if( hAmigaWnd && GetWindowRect(hAmigaWnd, &amigawin_rect)) { if (in_sizemove > 0) break; - if( !isfullscreen() && hAmigaWnd ) - { + if (!isfullscreen() && hAmigaWnd) { static int store_xy; RECT rc2; - if( GetWindowRect( hMainWnd, &rc2 )) { - if (amigawin_rect.left & 3) - { + if (GetWindowRect(hMainWnd, &rc2)) { + if (amigawin_rect.left & 3) { MoveWindow (hMainWnd, rc2.left+ 4 - amigawin_rect.left % 4, rc2.top, rc2.right - rc2.left, rc2.bottom - rc2.top, TRUE); } - if( hWinUAEKey && store_xy++) - { + if (hWinUAEKey && store_xy++) { DWORD left = rc2.left - win_x_diff; DWORD top = rc2.top - win_y_diff; - RegSetValueEx( hWinUAEKey, "xPos", 0, REG_DWORD, (LPBYTE)&left, sizeof( LONG ) ); - RegSetValueEx( hWinUAEKey, "yPos", 0, REG_DWORD, (LPBYTE)&top, sizeof( LONG ) ); + RegSetValueEx(hWinUAEKey, "xPos", 0, REG_DWORD, (LPBYTE)&left, sizeof(LONG)); + RegSetValueEx(hWinUAEKey, "yPos", 0, REG_DWORD, (LPBYTE)&top, sizeof(LONG)); } } return 0; @@ -1098,7 +1095,7 @@ static long FAR PASCAL MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, L return DefWindowProc (hWnd, message, wParam, lParam); } -static long FAR PASCAL HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { return DefWindowProc (hWnd, message, wParam, lParam); } @@ -1222,13 +1219,13 @@ static HINSTANCE hRichEdit = NULL, hHtmlHelp = NULL; int WIN32_CleanupLibraries( void ) { if (hRichEdit) - FreeLibrary (hRichEdit); + FreeLibrary(hRichEdit); - if( hHtmlHelp ) - FreeLibrary( hHtmlHelp ); + if (hHtmlHelp) + FreeLibrary(hHtmlHelp); - if( hUIDLL ) - FreeLibrary( hUIDLL ); + if (hUIDLL) + FreeLibrary(hUIDLL); return 1; } @@ -1238,9 +1235,8 @@ int WIN32_InitHtmlHelp( void ) { int result = 0; if (zfile_exists (help_file)) { - if( hHtmlHelp = LoadLibrary( "HHCTRL.OCX" ) ) - { - pHtmlHelp = ( HWND(WINAPI *)(HWND, LPCSTR, UINT, LPDWORD ) )GetProcAddress( hHtmlHelp, "HtmlHelpA" ); + if (hHtmlHelp = LoadLibrary("HHCTRL.OCX")) { + pHtmlHelp = (HWND(WINAPI *)(HWND, LPCSTR, UINT, LPDWORD))GetProcAddress(hHtmlHelp, "HtmlHelpA"); result = 1; } } @@ -1487,17 +1483,17 @@ static HMODULE LoadGUI( void ) result = WIN32_LoadLibrary (dllbuf); if( result) { - dwFileVersionInfoSize = GetFileVersionInfoSize(dllbuf, &dwVersionHandle ); - if( dwFileVersionInfoSize ) + dwFileVersionInfoSize = GetFileVersionInfoSize(dllbuf, &dwVersionHandle); + if (dwFileVersionInfoSize) { - if( lpFileVersionData = calloc( 1, dwFileVersionInfoSize ) ) + if (lpFileVersionData = calloc(1, dwFileVersionInfoSize)) { - if( GetFileVersionInfo (dllbuf, dwVersionHandle, dwFileVersionInfoSize, lpFileVersionData ) ) + if (GetFileVersionInfo(dllbuf, dwVersionHandle, dwFileVersionInfoSize, lpFileVersionData)) { VS_FIXEDFILEINFO *vsFileInfo = NULL; UINT uLen; fail = 0; - if( VerQueryValue( lpFileVersionData, TEXT("\\"), (void **)&vsFileInfo, &uLen ) ) + if (VerQueryValue(lpFileVersionData, TEXT("\\"), (void **)&vsFileInfo, &uLen)) { if( vsFileInfo && HIWORD(vsFileInfo->dwProductVersionMS) == UAEMAJOR @@ -1514,7 +1510,7 @@ static HMODULE LoadGUI( void ) } } } - free( lpFileVersionData ); + free(lpFileVersionData); } } } @@ -1600,11 +1596,11 @@ void logging_init( void ) #ifndef SINGLEFILE if (currprefs.win32_logfile) { sprintf (debugfilename, "%swinuaelog.txt", start_path); - if( !debugfile ) + if (!debugfile) debugfile = fopen (debugfilename, "wt"); } else if (!first) { sprintf (debugfilename, "%swinuaebootlog.txt", start_path); - if( !debugfile ) + if (!debugfile) debugfile = fopen (debugfilename, "wt"); } #endif @@ -1614,7 +1610,7 @@ void logging_init( void ) osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion, os_winnt_admin ? " Admin" : ""); write_log ("\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation." - "\n(c) 1998-2004 Toni Wilen - Win32 port, core code updates." + "\n(c) 1998-2005 Toni Wilen - Win32 port, core code updates." "\n(c) 1996-2001 Brian King - Win32 port, Picasso96 RTG, and GUI." "\n(c) 1996-1999 Mathias Ortmann - Win32 port and bsdsocket support." "\n(c) 2000-2001 Bernd Meyer - JIT engine." @@ -1680,6 +1676,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_write (f, "win32.cpu_idle=%d\n", p->cpu_idle); cfgfile_write (f, "win32.notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false"); cfgfile_write (f, "win32.always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false"); + cfgfile_write (f, "win32.no_recyclebin=%s\n", p->win32_norecyclebin ? "true" : "false"); } static int fetchpri (int pri, int defpri) @@ -1715,6 +1712,7 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value) || cfgfile_yesno (option, value, "iconified_pause", &p->win32_iconified_pause) || cfgfile_yesno (option, value, "iconified_nosound", &p->win32_iconified_nosound) || cfgfile_yesno (option, value, "ctrl_f11_is_quit", &p->win32_ctrl_F11_is_quit) + || cfgfile_yesno (option, value, "no_recyclebin", &p->win32_norecyclebin) || cfgfile_intval (option, value, "midi_device", &p->win32_midioutdev, 1) || cfgfile_intval (option, value, "midiout_device", &p->win32_midioutdev, 1) || cfgfile_intval (option, value, "midiin_device", &p->win32_midiindev, 1) @@ -2147,7 +2145,8 @@ static int osdetect (void) return 1; } - extern void test (void); +extern void test (void); + static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { diff --git a/od-win32/win32.h b/od-win32/win32.h index 49e72954..a851395d 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 3" +#define WINUAEBETASTR " Beta 4" 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 e61eccae..adad967c 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -409,6 +409,26 @@ oops2: return 0; } +/* +static void dhack(void) +{ + int i = 0; + while (DisplayModes[i].depth >= 0) + i++; + if (i >= MAX_PICASSO_MODES - 1) + return; + DisplayModes[i].res.width = 480; + DisplayModes[i].res.height = 640; + DisplayModes[i].depth = DisplayModes[i - 1].depth; + DisplayModes[i].refresh[0] = 0; + DisplayModes[i].refresh[1] = 0; + DisplayModes[i].colormodes = DisplayModes[i - 1].colormodes; + DisplayModes[i + 1].depth = -1; + sprintf(DisplayModes[i].name, "%dx%d, %d-bit", + DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8); +} +*/ + static HRESULT CALLBACK modesCallback( LPDDSURFACEDESC2 modeDesc, LPVOID context ) { RGBFTYPE colortype; @@ -562,6 +582,7 @@ void sortdisplays (void) int b = DirectDraw_GetSurfaceBitCount (); write_log ("W=%d H=%d B=%d\n", w, h, b); DirectDraw_EnumDisplayModes (DDEDM_REFRESHRATES , modesCallback); + //dhack(); sortmodes (); modesList (); DirectDraw_Release (); @@ -664,7 +685,7 @@ RGBFTYPE WIN32GFX_FigurePixelFormats( RGBFTYPE colortype ) /* DirectX will fail with "Mode not supported" if we try to switch to a full * screen mode that doesn't match one of the dimensions we got during enumeration. * So try to find a best match for the given resolution in our list. */ -int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits ) +int WIN32GFX_AdjustScreenmode(uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixbits) { struct PicassoResolution *best; uae_u32 selected_mask = (*ppixbits == 8 ? RGBMASK_8BIT @@ -674,8 +695,7 @@ int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixb : RGBMASK_32BIT); int pass, i = 0, index = 0; - for (pass = 0; pass < 2; pass++) - { + for (pass = 0; pass < 2; pass++) { struct PicassoResolution *dm; uae_u32 mask = (pass == 0 ? selected_mask @@ -686,10 +706,13 @@ int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixb best = &DisplayModes[0]; dm = &DisplayModes[1]; - while (dm->depth >= 0) - { - if ((dm->colormodes & mask) != 0) - { + while (dm->depth >= 0) { + + /* do we already have supported resolution? */ + if (dm->res.width == *pwidth && dm->res.height == *pheight && dm->depth == (*ppixbits / 8)) + return i; + + if ((dm->colormodes & mask) != 0) { if (dm->res.width <= best->res.width && dm->res.height <= best->res.height && dm->res.width >= *pwidth && dm->res.height >= *pheight) { @@ -706,8 +729,7 @@ int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixb dm++; i++; } - if (best->res.width == *pwidth && best->res.height == *pheight) - { + if (best->res.width == *pwidth && best->res.height == *pheight) { selected_mask = mask; /* %%% - BERND, I added this - does it make sense? Otherwise, I'd specify a 16-bit display-mode for my Workbench (using -H 2, but SHOULD have been -H 1), and end up with an 8-bit mode instead*/ break; @@ -715,7 +737,7 @@ int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixb } *pwidth = best->res.width; *pheight = best->res.height; - if( best->colormodes & selected_mask ) + if (best->colormodes & selected_mask) return index; /* Ordering here is done such that 16-bit is preferred, followed by 15-bit, 8-bit, 32-bit and 24-bit */ @@ -2186,13 +2208,13 @@ void updatedisplayarea (void) else #endif { - if( !isfullscreen() ) { + if (!isfullscreen()) { surface_type_e s; s = DirectDraw_GetLockableType(); if (s != overlay_surface && s != invalid_surface) - DX_Blit( 0, 0, 0, 0, WIN32GFX_GetWidth(), WIN32GFX_GetHeight(), BLIT_SRC ); + DX_Blit(0, 0, 0, 0, WIN32GFX_GetWidth(), WIN32GFX_GetHeight(), BLIT_SRC); } else { - DirectDraw_Blt( primary_surface, NULL, secondary_surface, NULL, DDBLT_WAIT, NULL ); + DirectDraw_Blt(primary_surface, NULL, secondary_surface, NULL, DDBLT_WAIT, NULL); } } } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index dc8c962f..4ea57909 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -65,6 +65,7 @@ #ifdef PROWIZARD #include "moduleripper.h" #endif +#include "catweasel.h" #define DISK_FORMAT_STRING "(*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.rar;*.7z;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.rar;*.7z;*.exe\0" #define ROM_FORMAT_STRING "(*.rom;*.zip;*.rar;*.7z;*.roz)\0*.rom;*.zip;*.rar;*.7z;*.roz\0" @@ -658,6 +659,16 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde static int gui_width = 640, gui_height = 480; +static int mm = 0; +static void m(void) +{ + write_log ("%d:0: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_width, currprefs.gfx_height, + workprefs.gfx_width, workprefs.gfx_height, changed_prefs.gfx_width, changed_prefs.gfx_height); + write_log ("%d:1: %dx%d %dx%d %dx%d\n", mm, currprefs.gfx_width_fs, currprefs.gfx_height_fs, + workprefs.gfx_width_fs, workprefs.gfx_height_fs, changed_prefs.gfx_width_fs, changed_prefs.gfx_height_fs); + mm++; +} + /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */ void gui_display( int shortcut ) { @@ -678,9 +689,9 @@ void gui_display( int shortcut ) pause_sound (); setmouseactive (0); - if( ( !WIN32GFX_IsPicassoScreen() && currprefs.gfx_afullscreen && ( currprefs.gfx_width < gui_width || currprefs.gfx_height < gui_height ) ) + if ((!WIN32GFX_IsPicassoScreen() && currprefs.gfx_afullscreen && (currprefs.gfx_width < gui_width || currprefs.gfx_height < gui_height)) #ifdef PICASSO96 - || ( WIN32GFX_IsPicassoScreen() && currprefs.gfx_pfullscreen && ( picasso96_state.Width < gui_width || picasso96_state.Height < gui_height ) ) + || (WIN32GFX_IsPicassoScreen() && currprefs.gfx_pfullscreen && (picasso96_state.Width < gui_width || picasso96_state.Height < gui_height)) #endif ) { flipflop = 1; @@ -695,7 +706,7 @@ void gui_display( int shortcut ) write_log ("FlipToGDISurface failed, %s\n", DXError (hr)); } - if( shortcut == -1 ) { + if (shortcut == -1) { int ret; if (flipflop) ShowWindow (hAmigaWnd, SW_MINIMIZE); @@ -740,7 +751,6 @@ void gui_display( int shortcut ) #ifdef PICASSO96 DX_SetPalette (0, 256); #endif - } static void prefs_to_gui (struct uae_prefs *p) @@ -3273,9 +3283,10 @@ static void init_frequency_combo (HWND hDlg, int dmode) #define MAX_FRAMERATE_LENGTH 40 #define MAX_NTH_LENGTH 20 -static int display_mode_index( uae_u32 x, uae_u32 y, uae_u32 d ) +static int display_mode_index(uae_u32 x, uae_u32 y, uae_u32 d) { int i; + i = 0; while (DisplayModes[i].depth >= 0) { if( DisplayModes[i].res.width == x && @@ -3363,7 +3374,7 @@ static void init_display_mode (HWND hDlg) { int d, d2, index; - switch( workprefs.color_mode ) + switch (workprefs.color_mode) { case 2: d = 16; @@ -3376,12 +3387,12 @@ static void init_display_mode (HWND hDlg) break; } - if( workprefs.gfx_afullscreen ) + if (workprefs.gfx_afullscreen) { d2 = d; - if( ( index = WIN32GFX_AdjustScreenmode( &workprefs.gfx_width_fs, &workprefs.gfx_height_fs, &d2 ) ) >= 0 ) + if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_width_fs, &workprefs.gfx_height_fs, &d2)) >= 0) { - switch( d2 ) + switch (d2) { case 15: workprefs.color_mode = 1; @@ -4240,6 +4251,7 @@ static void misc_addpri (HWND hDlg, int v, int pri) 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); @@ -4258,6 +4270,10 @@ static void values_to_miscdlg (HWND hDlg) CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop); CheckDlgButton (hDlg, IDC_ASPI, workprefs.win32_aspi); CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack); + cw = catweasel_detect(); + EnableWindow (GetDlgItem (hDlg, IDC_CATWEASEL), cw); + if (!cw) + workprefs.catweasel = 0; CheckDlgButton (hDlg, IDC_CATWEASEL, workprefs.catweasel); CheckDlgButton (hDlg, IDC_STATE_CAPTURE, workprefs.statecapture); @@ -5573,12 +5589,17 @@ static void harddiskdlg_button (HWND hDlg, int button) break; case IDC_MAPDRIVES: - workprefs.win32_automount_drives = IsDlgButtonChecked( hDlg, button ); + workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, button); break; case IDC_NOUAEFSDB: - workprefs.filesys_no_uaefsdb = IsDlgButtonChecked( hDlg, IDC_NOUAEFSDB ); + workprefs.filesys_no_uaefsdb = IsDlgButtonChecked(hDlg, IDC_NOUAEFSDB); + break; + + case IDC_NORECYCLEBIN: + workprefs.win32_norecyclebin = IsDlgButtonChecked(hDlg, IDC_NORECYCLEBIN); break; + } } @@ -5635,6 +5656,7 @@ static BOOL CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM case WM_USER: CheckDlgButton (hDlg, IDC_MAPDRIVES, workprefs.win32_automount_drives); CheckDlgButton (hDlg, IDC_NOUAEFSDB, workprefs.filesys_no_uaefsdb); + CheckDlgButton (hDlg, IDC_NORECYCLEBIN, workprefs.win32_norecyclebin); InitializeListView (hDlg); hilitehd (); break; @@ -6377,8 +6399,7 @@ static DWORD dwEnumeratedPrinters = 0; static char comports[MAX_SERIALS][8]; static int ghostscript_available; -#define NUM_JOYKBD 5 - +/* static int joy0idc[] = { IDC_PORT0_JOYSC, IDC_PORT0_KBDA, IDC_PORT0_KBDB, IDC_PORT0_KBDC, IDC_PORT0_KBDD, IDC_PORT0_KBDE, IDC_PORT0_JOYS, -1 @@ -6388,19 +6409,23 @@ static int joy1idc[] = { IDC_PORT1_JOYSC, IDC_PORT1_KBDA, IDC_PORT1_KBDB, IDC_PORT1_KBDC, IDC_PORT1_KBDD, IDC_PORT1_KBDE, IDC_PORT1_JOYS, -1 }; +*/ static int joy0previous, joy1previous; + static BOOL bNoMidiIn = FALSE; static void enable_for_portsdlg( HWND hDlg ) { - int i, v; + int v; v = workprefs.input_selected_setting > 0 ? FALSE : TRUE; +/* for (i = 0; joy0idc[i] >= 0; i++) { EnableWindow (GetDlgItem (hDlg, joy0idc[i]), v); EnableWindow (GetDlgItem (hDlg, joy1idc[i]), v); } +*/ EnableWindow (GetDlgItem (hDlg, IDC_SWAP), v); #if !defined (SERIAL_PORT) EnableWindow( GetDlgItem( hDlg, IDC_MIDIOUTLIST), FALSE ); @@ -6431,9 +6456,11 @@ static void enable_for_portsdlg( HWND hDlg ) static void updatejoyport (HWND hDlg) { - int i, j, v; - + int i, j; + char tmp[MAX_DPATH]; + enable_for_portsdlg (hDlg); +/* for (i = 0; i < 2; i++) { int *idcs1 = i == 0 ? joy0idc : joy1idc; int *idcs2 = i == 0 ? joy1idc : joy0idc; @@ -6446,37 +6473,55 @@ static void updatejoyport (HWND hDlg) for (j = 1; j < NUM_JOYKBD + 2; j++) EnableWindow (GetDlgItem (hDlg, idcs2[j]), workprefs.input_selected_setting == 0 && j != v); } - +*/ if (joy0previous < 0) joy0previous = inputdevice_get_device_total (IDTYPE_JOYSTICK) + 1; if (joy1previous < 0) - joy1previous = 1; + joy1previous = JSEM_LASTKBD + 1; for (i = 0; i < 2; i++) { int total = 1; int idx = i == 0 ? joy0previous : joy1previous; - int id1 = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS; - int id2 = i == 0 ? IDC_PORT0_JOYSC : IDC_PORT1_JOYSC; + int id = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS; int v = i == 0 ? workprefs.jport0 : workprefs.jport1; - SendDlgItemMessage (hDlg, id1, CB_RESETCONTENT, 0, 0L); - SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)""); + char *p1, *p2; + + SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)""); + WIN32GUI_LoadUIString (IDS_KEYJOY, tmp, sizeof (tmp)); + strcat (tmp, "\n"); + p1 = tmp; + for (;;) { + p2 = strchr (p1, '\n'); + if (p2 && strlen (p2) > 0) { + *p2++ = 0; + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)p1); + total++; + p1 = p2; + } else break; + } for (j = 0; j < inputdevice_get_device_total (IDTYPE_JOYSTICK); j++, total++) - SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, j)); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_JOYSTICK, j)); for (j = 0; j < inputdevice_get_device_total (IDTYPE_MOUSE); j++, total++) - SendDlgItemMessage (hDlg, id1, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, j)); + SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)inputdevice_get_device_name(IDTYPE_MOUSE, j)); if (v >= JSEM_MICE) { - idx = (v - JSEM_MICE) + 1; - if (idx > inputdevice_get_device_total (IDTYPE_MOUSE)) + idx = v - JSEM_MICE; + if (idx >= inputdevice_get_device_total (IDTYPE_MOUSE)) idx = 0; else idx += inputdevice_get_device_total (IDTYPE_JOYSTICK); + idx += JSEM_LASTKBD; } else if (v >= JSEM_JOYS) { - idx = v - JSEM_JOYS + 1; - if (idx > inputdevice_get_device_total (IDTYPE_JOYSTICK)) + idx = v - JSEM_JOYS; + if (idx >= inputdevice_get_device_total (IDTYPE_JOYSTICK)) idx = 0; + idx += JSEM_LASTKBD; + } else { + idx = v - JSEM_KBDLAYOUT; } + idx++; if (idx >= total) idx = 0; - SendDlgItemMessage (hDlg, id1, CB_SETCURSEL, idx, 0); + SendDlgItemMessage (hDlg, id, CB_SETCURSEL, idx, 0); } } @@ -6499,15 +6544,50 @@ static void fixjport (int *port, int v) vv = 0; vv += JSEM_MICE; } + if (vv >= JSEM_KBDLAYOUT && vv < JSEM_LASTKBD) { + vv -= JSEM_KBDLAYOUT; + vv++; + if (vv >= JSEM_LASTKBD) + vv = 0; + vv += JSEM_KBDLAYOUT; + } *port = vv; } static void values_from_portsdlg (HWND hDlg) { - int item, i, j, lastside = 0, changed = 0, v; + int item, i, lastside = 0, changed = 0, v; char tmp[256]; BOOL success; - + + for (i = 0; i < 2; i++) { + int idx = 0; + int *port = i == 0 ? &workprefs.jport0 : &workprefs.jport1; + int prevport = *port; + int id = i == 0 ? IDC_PORT0_JOYS : IDC_PORT1_JOYS; + int v = SendDlgItemMessage (hDlg, id, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR && v > 0) { + v--; + if (v < JSEM_LASTKBD) + *port = JSEM_KBDLAYOUT + v; + else if (v >= JSEM_LASTKBD + inputdevice_get_device_total (IDTYPE_JOYSTICK)) + *port = JSEM_MICE + v - inputdevice_get_device_total (IDTYPE_JOYSTICK) - JSEM_LASTKBD; + else + *port = JSEM_JOYS + v - JSEM_LASTKBD; + } + if (*port != prevport) { + lastside = i; + changed = 1; + } + } + if (changed) { + if (lastside) + fixjport (&workprefs.jport0, workprefs.jport1); + else + fixjport (&workprefs.jport1, workprefs.jport0); + } + +/* for (i = 0; i < 2; i++) { int *idcs = i == 0 ? joy0idc : joy1idc; int *port = i == 0 ? &workprefs.jport0 : &workprefs.jport1; @@ -6543,6 +6623,7 @@ static void values_from_portsdlg (HWND hDlg) else fixjport (&workprefs.jport1, workprefs.jport0); } +*/ item = SendDlgItemMessage( hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L ); if( item != CB_ERR ) @@ -7471,8 +7552,10 @@ static void filter_preset (HWND hDlg, WPARAM wParam) } end: RegCloseKey (fkey); - if (load) + if (load) { values_to_hw3ddlg (hDlg); + SendMessage (hDlg, WM_HSCROLL, 0, 0); + } enable_for_hw3ddlg (hDlg); } -- 2.47.3