From: Toni Wilen Date: Sun, 5 Sep 2010 15:47:03 +0000 (+0300) Subject: 2300b15 X-Git-Tag: 2300~6 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=a6a9f7d51258e08d008cb0d02ab60e01d44bb379;p=francis%2Fwinuae.git 2300b15 --- diff --git a/disk.cpp b/disk.cpp index e80be580..1692a035 100644 --- a/disk.cpp +++ b/disk.cpp @@ -198,12 +198,20 @@ static drive floppy[MAX_FLOPPY_DRIVES]; static TCHAR dfxhistory[2][MAX_PREVIOUS_FLOPPIES][MAX_DPATH]; static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00}; -static uae_u8 bootblock[]={ +static uae_u8 bootblock_ofs[]={ 0x44,0x4f,0x53,0x00,0xc0,0x20,0x0f,0x19,0x00,0x00,0x03,0x70,0x43,0xfa,0x00,0x18, 0x4e,0xae,0xff,0xa0,0x4a,0x80,0x67,0x0a,0x20,0x40,0x20,0x68,0x00,0x16,0x70,0x00, 0x4e,0x75,0x70,0xff,0x60,0xfa,0x64,0x6f,0x73,0x2e,0x6c,0x69,0x62,0x72,0x61,0x72, 0x79 }; +static uae_u8 bootblock_ffs[]={ + 0x44, 0x4F, 0x53, 0x01, 0xE3, 0x3D, 0x0E, 0x72, 0x00, 0x00, 0x03, 0x70, 0x43, 0xFA, 0x00, 0x3E, + 0x70, 0x25, 0x4E, 0xAE, 0xFD, 0xD8, 0x4A, 0x80, 0x67, 0x0C, 0x22, 0x40, 0x08, 0xE9, 0x00, 0x06, + 0x00, 0x22, 0x4E, 0xAE, 0xFE, 0x62, 0x43, 0xFA, 0x00, 0x18, 0x4E, 0xAE, 0xFF, 0xA0, 0x4A, 0x80, + 0x67, 0x0A, 0x20, 0x40, 0x20, 0x68, 0x00, 0x16, 0x70, 0x00, 0x4E, 0x75, 0x70, 0xFF, 0x4E, 0x75, + 0x64, 0x6F, 0x73, 0x2E, 0x6C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x00, 0x65, 0x78, 0x70, 0x61, + 0x6E, 0x73, 0x69, 0x6F, 0x6E, 0x2E, 0x6C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x00, 0x00, 0x00, +}; #define FS_OFS_DATABLOCKSIZE 488 #define FS_FLOPPY_BLOCKSIZE 512 @@ -276,7 +284,7 @@ static void createbootblock (uae_u8 *sector, int bootable) memset (sector, 0, FS_FLOPPY_BLOCKSIZE); memcpy (sector, "DOS", 3); if (bootable) - memcpy (sector, bootblock, sizeof bootblock); + memcpy (sector, bootblock_ofs, sizeof bootblock_ofs); } static void createrootblock (uae_u8 *sector, char *disk_name) @@ -2034,18 +2042,46 @@ void DISK_ersatz_read (int tr, int sec, uaecptr dest) zfile_fread (dptr, 1, 512, floppy[0].diskfile); } +static void floppy_get_bootblock (uae_u8 *dst, bool ffs, bool bootable) +{ + strcpy ((char*)dst, "DOS"); + dst[3] = ffs ? 1 : 0; + if (bootable) + memcpy (dst, ffs ? bootblock_ffs : bootblock_ofs, ffs ? sizeof bootblock_ffs : sizeof bootblock_ofs); +} +static void floppy_get_rootblock (uae_u8 *dst, int block, const TCHAR *disk_name, drive_type adftype) +{ + dst[0+3] = 2; + dst[12+3] = 0x48; + dst[312] = dst[313] = dst[314] = dst[315] = (uae_u8)0xff; + dst[316+2] = (block + 1) >> 8; dst[316+3] = (block + 1) & 255; + char *s = ua ((disk_name && _tcslen (disk_name) > 0) ? disk_name : L"empty"); + dst[432] = strlen (s); + strcpy ((char*)dst + 433, s); + xfree (s); + dst[508 + 3] = 1; + disk_date (dst + 420); + memcpy (dst + 472, dst + 420, 3 * 4); + memcpy (dst + 484, dst + 420, 3 * 4); + disk_checksum (dst, dst + 20); + /* bitmap block */ + memset (dst + 512 + 4, 0xff, 2 * block / 8); + if (adftype == 0) + dst[512 + 0x72] = 0x3f; + else + dst[512 + 0xdc] = 0x3f; + disk_checksum (dst + 512, dst + 512); +} + /* type: 0=regular, 1=ext2adf */ /* adftype: 0=DD,1=HD,2=DD PC,3=HD PC,4=525SD */ -void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk_name) +void disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable) { + int size = 32768; struct zfile *f; int i, l, file_size, tracks, track_len, sectors; uae_u8 *chunk = NULL; - uae_u8 tmp[3*4]; - uae_char *s; - - if (disk_name == NULL || _tcslen (disk_name) == 0) - disk_name = L"empty"; + int ddhd = 1; if (type == 1) tracks = 2 * 83; @@ -2061,64 +2097,64 @@ void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk if (adftype == 1 || adftype == 3) { file_size *= 2; track_len *= 2; + ddhd = 2; } else if (adftype == 4) { file_size /= 2; tracks /= 2; } f = zfile_fopen (name, L"wb", 0); - chunk = xmalloc (uae_u8, 32768); + chunk = xmalloc (uae_u8, size); if (f && chunk) { int cylsize = sectors * 2 * 512; - memset (chunk, 0, 32768); + memset (chunk, 0, size); if (type == 0) { for (i = 0; i < file_size; i += cylsize) { memset(chunk, 0, cylsize); if (adftype <= 1) { if (i == 0) { /* boot block */ - strcpy ((char*)chunk, "DOS"); + floppy_get_bootblock (chunk, ffs, bootable); } else if (i == file_size / 2) { - int block = file_size / 1024; /* root block */ - chunk[0+3] = 2; - chunk[12+3] = 0x48; - chunk[312] = chunk[313] = chunk[314] = chunk[315] = (uae_u8)0xff; - chunk[316+2] = (block + 1) >> 8; chunk[316+3] = (block + 1) & 255; - s = ua (disk_name); - chunk[432] = strlen (s); - strcpy ((char*)chunk + 433, s); - xfree (s); - chunk[508 + 3] = 1; - disk_date (chunk + 420); - memcpy (chunk + 472, chunk + 420, 3 * 4); - memcpy (chunk + 484, chunk + 420, 3 * 4); - disk_checksum(chunk, chunk + 20); - /* bitmap block */ - memset (chunk + 512 + 4, 0xff, 2 * file_size / (1024 * 8)); - if (adftype == 0) - chunk[512 + 0x72] = 0x3f; - else - chunk[512 + 0xdc] = 0x3f; - disk_checksum(chunk + 512, chunk + 512); + floppy_get_rootblock (chunk, file_size / 1024, disk_name, adftype); } } zfile_fwrite (chunk, cylsize, 1, f); } } else { + uae_u8 root[4]; + uae_u8 rawtrack[3 * 4], dostrack[3 * 4]; l = track_len; zfile_fwrite ("UAE-1ADF", 8, 1, f); - tmp[0] = 0; tmp[1] = 0; /* flags (reserved) */ - tmp[2] = 0; tmp[3] = tracks; /* number of tracks */ - zfile_fwrite (tmp, 4, 1, f); - tmp[0] = 0; tmp[1] = 0; /* flags (reserved) */ - tmp[2] = 0; tmp[3] = 1; /* track type */ - tmp[4] = 0; tmp[5] = 0; tmp[6]=(uae_u8)(l >> 8); tmp[7] = (uae_u8)l; - tmp[8] = 0; tmp[9] = 0; tmp[10] = 0; tmp[11] = 0; - for (i = 0; i < tracks; i++) + root[0] = 0; root[1] = 0; /* flags (reserved) */ + root[2] = 0; root[3] = tracks; /* number of tracks */ + zfile_fwrite (root, 4, 1, f); + rawtrack[0] = 0; rawtrack[1] = 0; /* flags (reserved) */ + rawtrack[2] = 0; rawtrack[3] = 1; /* track type */ + rawtrack[4] = 0; rawtrack[5] = 0; rawtrack[6]=(uae_u8)(l >> 8); rawtrack[7] = (uae_u8)l; + rawtrack[8] = 0; rawtrack[9] = 0; rawtrack[10] = 0; rawtrack[11] = 0; + memcpy (dostrack, rawtrack, sizeof rawtrack); + dostrack[3] = 0; + dostrack[9] = (l * 8) >> 16; dostrack[10] = (l * 8) >> 8; dostrack[11] = (l * 8) >> 0; + bool dodos = ffs || bootable || (disk_name && _tcslen (disk_name) > 0); + for (i = 0; i < tracks; i++) { + uae_u8 tmp[3 * 4]; + memcpy (tmp, rawtrack, sizeof rawtrack); + if (dodos) + memcpy (tmp, dostrack, sizeof dostrack); zfile_fwrite (tmp, sizeof tmp, 1, f); - for (i = 0; i < tracks; i++) + } + for (i = 0; i < tracks; i++) { + memset (chunk, 0, size); + if (dodos) { + if (i == 0) + floppy_get_bootblock (chunk, ffs, bootable); + else if (i == 80) + floppy_get_rootblock (chunk, 80 * 11 * ddhd, disk_name, adftype); + } zfile_fwrite (chunk, l, 1, f); + } } } xfree (chunk); @@ -2192,7 +2228,7 @@ int disk_setwriteprotect (int num, const TCHAR *name, bool writeprotected) name2 = DISK_get_saveimagepath (name); if (needwritefile && zf2 == 0) - disk_creatediskfile (name2, 1, drvtype, NULL); + disk_creatediskfile (name2, 1, drvtype, NULL, false, false); zfile_fclose (zf2); if (writeprotected && iswritefileempty (name)) { for (i = 0; i < MAX_FLOPPY_DRIVES; i++) { @@ -2523,16 +2559,16 @@ uae_u8 DISK_status (void) return st; } -static int unformatted (drive *drv) +static bool unformatted (drive *drv) { int tr = drv->cyl * 2 + side; if (tr >= drv->num_tracks) - return 1; - if (drv->filetype == ADF_EXT2 && drv->trackdata[tr].bitlen == 0) - return 1; + return true; + if (drv->filetype == ADF_EXT2 && drv->trackdata[tr].bitlen == 0 && drv->trackdata[tr].type != TRACK_AMIGADOS) + return true; if (drv->trackdata[tr].type == TRACK_NONE) - return 1; - return 0; + return true; + return false; } /* get one bit from MFM bit stream */ diff --git a/gayle.cpp b/gayle.cpp index febb4454..347bf6be 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -194,7 +194,7 @@ STATIC_INLINE void pw (int offset, uae_u16 w) ide->secbuf[offset * 2 + 0] = (uae_u8)w; ide->secbuf[offset * 2 + 1] = w >> 8; } -static void ps (int offset, TCHAR *src, int max) +static void ps (int offset, const TCHAR *src, int max) { int i, len; char *s; diff --git a/include/disk.h b/include/disk.h index 4ec56ac4..4e30a5a6 100644 --- a/include/disk.h +++ b/include/disk.h @@ -28,7 +28,7 @@ extern void DISK_hsync (void); extern void DISK_reset (void); extern int disk_getwriteprotect (const TCHAR *name); extern int disk_setwriteprotect (int num, const TCHAR *name, bool writeprotected); -extern void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk_name); +extern void disk_creatediskfile (const TCHAR *name, int type, drive_type adftype, const TCHAR *disk_name, bool ffs, bool bootable); extern void dumpdisk (void); extern int DISK_history_add (const TCHAR *name, int idx, int type, int donotcheck); extern TCHAR *DISK_history_get (int idx, int type); diff --git a/include/keyboard.h b/include/keyboard.h index fd45a90c..7ce9f6d9 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -124,10 +124,13 @@ #define AK_TERM_POWERUP 0xfe // KB LED stuff +#define KBLED_NUMLOCKB 0 +#define KBLED_CAPSLOCKB 1 +#define KBLED_SCROLLLOCKB 2 -#define KBLED_NUMLOCK 1 -#define KBLED_CAPSLOCK 2 -#define KBLED_SCROLLLOCK 4 +#define KBLED_NUMLOCKM (1 << KBLED_NUMLOCKB) +#define KBLED_CAPSLOCKM (1 << KBLED_CAPSLOCKB) +#define KBLED_SCROLLLOCKM (1 << KBLED_SCROLLLOCKB) enum aks { AKS_ENTERGUI = 0x200, AKS_SCREENSHOT_FILE, AKS_SCREENSHOT_CLIPBOARD, AKS_FREEZEBUTTON, AKS_FLOPPY0, AKS_FLOPPY1, AKS_FLOPPY2, AKS_FLOPPY3, diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 4e705a70..f92992f2 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -110,7 +110,7 @@ static int num_mouse, num_keyboard, num_joystick; static int dd_inited, mouse_inited, keyboard_inited, joystick_inited; static int stopoutput; static HANDLE kbhandle = INVALID_HANDLE_VALUE; -static int oldleds, oldusedleds, newleds, oldusbleds; +static int oldleds, oldusedleds, newleds, disabledleds; static int normalmouse, supermouse, rawmouse, winmouse, winmousenumber, winmousemode, winmousewheelbuttonstart; static int normalkb, superkb, rawkb; static bool rawinput_enabled_mouse, rawinput_enabled_keyboard; @@ -136,6 +136,116 @@ int dinput_winmousemode (void) return 0; } + +static BYTE ledkeystate[256]; + +static uae_u32 get_leds (void) +{ + uae_u32 led = 0; + + GetKeyboardState (ledkeystate); + if (ledkeystate[VK_NUMLOCK] & 1) + led |= KBLED_NUMLOCKM; + if (ledkeystate[VK_CAPITAL] & 1) + led |= KBLED_CAPSLOCKM; + if (ledkeystate[VK_SCROLL] & 1) + led |= KBLED_SCROLLLOCKM; + + if (currprefs.win32_kbledmode) { + oldleds = led; + } else if (!currprefs.win32_kbledmode && kbhandle != INVALID_HANDLE_VALUE) { +#ifdef WINDDK + KEYBOARD_INDICATOR_PARAMETERS InputBuffer; + KEYBOARD_INDICATOR_PARAMETERS OutputBuffer; + ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS); + ULONG ReturnedLength; + + memset (&InputBuffer, 0, sizeof (InputBuffer)); + memset (&OutputBuffer, 0, sizeof (OutputBuffer)); + if (!DeviceIoControl (kbhandle, IOCTL_KEYBOARD_QUERY_INDICATORS, + &InputBuffer, DataLength, &OutputBuffer, DataLength, &ReturnedLength, NULL)) + return 0; + led = 0; + if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) + led |= KBLED_NUMLOCKM; + if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON) + led |= KBLED_CAPSLOCKM; + if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) + led |= KBLED_SCROLLLOCKM; +#endif + } + return led; +} + +static void kbevt (uae_u8 vk, uae_u8 sc) +{ + keybd_event (vk, 0, 0, 0); + keybd_event (vk, 0, KEYEVENTF_KEYUP, 0); +} + +static void set_leds (uae_u32 led) +{ + if (currprefs.win32_kbledmode) { + if ((oldleds & KBLED_NUMLOCKM) != (led & KBLED_NUMLOCKM) && !(disabledleds & KBLED_NUMLOCKM)) { + kbevt (VK_NUMLOCK, 0x45); + oldleds ^= KBLED_NUMLOCKM; + } + if ((oldleds & KBLED_CAPSLOCKM) != (led & KBLED_CAPSLOCKM) && !(disabledleds & KBLED_CAPSLOCKM)) { + kbevt (VK_CAPITAL, 0x3a); + oldleds ^= KBLED_CAPSLOCKM; + } + if ((oldleds & KBLED_SCROLLLOCKM) != (led & KBLED_SCROLLLOCKM) && !(disabledleds & KBLED_SCROLLLOCKM)) { + kbevt (VK_SCROLL, 0x46); + oldleds ^= KBLED_SCROLLLOCKM; + } + } else if (kbhandle != INVALID_HANDLE_VALUE) { +#ifdef WINDDK + KEYBOARD_INDICATOR_PARAMETERS InputBuffer; + ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS); + ULONG ReturnedLength; + + memset (&InputBuffer, 0, sizeof (InputBuffer)); + if (led & KBLED_NUMLOCKM) + InputBuffer.LedFlags |= KEYBOARD_NUM_LOCK_ON; + if (led & KBLED_CAPSLOCKM) + InputBuffer.LedFlags |= KEYBOARD_CAPS_LOCK_ON; + if (led & KBLED_SCROLLLOCKM) + InputBuffer.LedFlags |= KEYBOARD_SCROLL_LOCK_ON; + if (!DeviceIoControl (kbhandle, IOCTL_KEYBOARD_SET_INDICATORS, + &InputBuffer, DataLength, NULL, 0, &ReturnedLength, NULL)) + write_log (L"kbleds: DeviceIoControl() failed %d\n", GetLastError()); +#endif + } +} + +static void update_leds (void) +{ + if (!currprefs.keyboard_leds_in_use) + return; + if (newleds != oldusedleds) { + oldusedleds = newleds; + set_leds (newleds); + } +} + +void indicator_leds (int num, int state) +{ + int i; + + if (!currprefs.keyboard_leds_in_use) + return; + disabledleds = 0; + for (i = 0; i < 3; i++) { + if (currprefs.keyboard_leds[i] == num + 1) { + newleds &= ~(1 << i); + if (state) + newleds |= 1 << i; + } else if (currprefs.keyboard_leds[i] <= 0) { + disabledleds |= 1 << i; + } + } +} + static int isrealbutton (struct didata *did, int num) { if (num >= did->buttons) @@ -1184,6 +1294,37 @@ static void handle_rawinput_2 (RAWINPUT *raw) if (scancode == 0xaa || scancode == 0) return; + if (!istest) { + if (h == NULL) { + // swallow led key fake messages + if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0 && scancode == DIK_NUMLOCK) + return; + if (currprefs.keyboard_leds[KBLED_CAPSLOCKB] > 0 && scancode == DIK_CAPITAL) + return; + if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0 && scancode == DIK_SCROLL) + return; + } else { + static bool ch; + if (pressed) { + if (currprefs.keyboard_leds[KBLED_NUMLOCKB] > 0 && scancode == DIK_NUMLOCK) { + oldleds ^= KBLED_NUMLOCKM; + ch = true; + } + if (currprefs.keyboard_leds[KBLED_CAPSLOCKB] > 0 && scancode == DIK_CAPITAL) { + oldleds ^= KBLED_CAPSLOCKM; + ch = true; + } + if (currprefs.keyboard_leds[KBLED_SCROLLLOCKB] > 0 && scancode == DIK_SCROLL) { + oldleds ^= KBLED_SCROLLLOCKM; + ch = true; + } + } else if (ch && isfocus ()) { + ch = false; + set_leds (newleds); + } + } + } + for (num = 0; num < num_keyboard; num++) { did = &di_keyboard[num]; if (did->connection != DIDC_RAW) @@ -1967,120 +2108,6 @@ static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code) return IDEV_WIDGET_KEY; } -static BYTE ledkeystate[256]; - -static uae_u32 get_leds (void) -{ - uae_u32 led = 0; - - GetKeyboardState (ledkeystate); - if (ledkeystate[VK_NUMLOCK] & 1) - led |= KBLED_NUMLOCK; - if (ledkeystate[VK_CAPITAL] & 1) - led |= KBLED_CAPSLOCK; - if (ledkeystate[VK_SCROLL] & 1) - led |= KBLED_SCROLLLOCK; - - if (currprefs.win32_kbledmode) { - oldusbleds = led; - } else if (!currprefs.win32_kbledmode && kbhandle != INVALID_HANDLE_VALUE) { -#ifdef WINDDK - KEYBOARD_INDICATOR_PARAMETERS InputBuffer; - KEYBOARD_INDICATOR_PARAMETERS OutputBuffer; - ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS); - ULONG ReturnedLength; - - memset (&InputBuffer, 0, sizeof (InputBuffer)); - memset (&OutputBuffer, 0, sizeof (OutputBuffer)); - if (!DeviceIoControl (kbhandle, IOCTL_KEYBOARD_QUERY_INDICATORS, - &InputBuffer, DataLength, &OutputBuffer, DataLength, &ReturnedLength, NULL)) - return 0; - led = 0; - if (OutputBuffer.LedFlags & KEYBOARD_NUM_LOCK_ON) - led |= KBLED_NUMLOCK; - if (OutputBuffer.LedFlags & KEYBOARD_CAPS_LOCK_ON) - led |= KBLED_CAPSLOCK; - if (OutputBuffer.LedFlags & KEYBOARD_SCROLL_LOCK_ON) - led |= KBLED_SCROLLLOCK; -#endif - } - return led; -} - -static void kbevt (uae_u8 vk, uae_u8 sc) -{ - if (0) { - INPUT inp[2] = { 0 }; - int i; - - for (i = 0; i < 2; i++) { - inp[i].type = INPUT_KEYBOARD; - inp[i].ki.wVk = vk; - } - inp[1].ki.dwFlags |= KEYEVENTF_KEYUP; - SendInput (1, inp, sizeof (INPUT)); - SendInput (1, inp + 1, sizeof (INPUT)); - } else { - keybd_event (vk, 0, 0, 0); - keybd_event (vk, 0, KEYEVENTF_KEYUP, 0); - } -} - -static void set_leds (uae_u32 led) -{ - if (currprefs.win32_kbledmode) { - if ((oldusbleds & KBLED_NUMLOCK) != (led & KBLED_NUMLOCK)) - kbevt (VK_NUMLOCK, 0x45); - if ((oldusbleds & KBLED_CAPSLOCK) != (led & KBLED_CAPSLOCK)) - kbevt (VK_CAPITAL, 0x3a); - if ((oldusbleds & KBLED_SCROLLLOCK) != (led & KBLED_SCROLLLOCK)) - kbevt (VK_SCROLL, 0x46); - oldusbleds = led; - } else if (kbhandle != INVALID_HANDLE_VALUE) { -#ifdef WINDDK - KEYBOARD_INDICATOR_PARAMETERS InputBuffer; - ULONG DataLength = sizeof(KEYBOARD_INDICATOR_PARAMETERS); - ULONG ReturnedLength; - - memset (&InputBuffer, 0, sizeof (InputBuffer)); - if (led & KBLED_NUMLOCK) - InputBuffer.LedFlags |= KEYBOARD_NUM_LOCK_ON; - if (led & KBLED_CAPSLOCK) - InputBuffer.LedFlags |= KEYBOARD_CAPS_LOCK_ON; - if (led & KBLED_SCROLLLOCK) - InputBuffer.LedFlags |= KEYBOARD_SCROLL_LOCK_ON; - if (!DeviceIoControl (kbhandle, IOCTL_KEYBOARD_SET_INDICATORS, - &InputBuffer, DataLength, NULL, 0, &ReturnedLength, NULL)) - write_log (L"kbleds: DeviceIoControl() failed %d\n", GetLastError()); -#endif - } -} - -static void update_leds (void) -{ - if (!currprefs.keyboard_leds_in_use) - return; - if (newleds != oldusedleds) { - oldusedleds = newleds; - set_leds (newleds); - } -} - -void indicator_leds (int num, int state) -{ - int i; - - if (!currprefs.keyboard_leds_in_use) - return; - for (i = 0; i < 3; i++) { - if (currprefs.keyboard_leds[i] == num + 1) { - newleds &= ~(1 << i); - if (state) - newleds |= (1 << i); - } - } -} - static int init_kb (void) { int i; diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 0e4f2fd0..b7625154 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -90,6 +90,7 @@ static void rdbdump (HANDLE h, uae_u64 offset, uae_u8 *buf, int blocksize) FILE *f; bool needfree = false; + write_log (L"creating rdb dump.. offset=%I64X blocksize=%d\n", offset, blocksize); if (buf) { blocks = (buf[132] << 24) | (buf[133] << 16) | (buf[134] << 8) | (buf[135] << 0); if (blocks < 0 || blocks > 100000) @@ -101,8 +102,10 @@ static void rdbdump (HANDLE h, uae_u64 offset, uae_u8 *buf, int blocksize) } _stprintf (name, L"rdb_dump_%d.rdb", cnt); f = _tfopen (name, L"wb"); - if (!f) + if (!f) { + write_log (L"failed to create file '%s'\n", name); return; + } for (i = 0; i <= blocks; i++) { DWORD outlen; LONG high; diff --git a/od-win32/lib/prowizard.lib b/od-win32/lib/prowizard.lib index 2881840e..48c358c8 100644 Binary files a/od-win32/lib/prowizard.lib and b/od-win32/lib/prowizard.lib differ diff --git a/od-win32/lib/prowizard_x64.lib b/od-win32/lib/prowizard_x64.lib index 5827edc6..6f3aeaed 100644 Binary files a/od-win32/lib/prowizard_x64.lib and b/od-win32/lib/prowizard_x64.lib differ diff --git a/od-win32/resources/resource b/od-win32/resources/resource index d1613508..d973831b 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -998,9 +998,12 @@ #define IDC_DF1ENABLE 1774 #define IDC_FS_SELECT_DIR 1774 #define IDC_FS_SELECT_FILE 1775 +#define IDC_FLOPPY_FFS 1775 #define IDC_DF2ENABLE 1776 #define IDC_FS_SELECT_EJECT 1776 #define IDC_FS_RW 1777 +#define IDC_FLOPPY_FFS2 1777 +#define IDC_FLOPPY_BOOTABLE 1777 #define IDC_DF3ENABLE 1778 #define IDC_HDF_RW 1778 #define IDC_HDFINFO 1779 @@ -1034,7 +1037,6 @@ #define IDC_DXMODE 1792 #define IDC_RTG_VBLANKRATE 1793 #define IDC_DF0WPTEXTQ 1793 -#define IDC_DXMODE2 1793 #define IDC_WINDOWEDMODE 1793 #define IDC_DF1WPTEXTQ 1794 #define IDC_INPUTMAPLIST 1797 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index fa65fddc..be133cc3 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -265,7 +265,7 @@ BEGIN PUSHBUTTON "...",IDC_DF3,287,109,10,15 GROUPBOX "New Floppy Disk Image",IDC_SETTINGSTEXT,5,183,289,49 COMBOBOX IDC_FLOPPYTYPE,12,197,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Create Standard Disk [] Creates a standard 880 or 1760 KB ADF disk image.",IDC_CREATE,81,196,97,15 + PUSHBUTTON "Create Standard Disk [] Creates a standard 880 or 1760 KB ADF disk image.",IDC_CREATE,85,196,97,15 PUSHBUTTON "Create Custom Disk [] Creates a low level (MFM) ADF disk image (about 2MB). Useful for programs that use non-standard disk formats (for example some save disks or DOS-formatted floppies)",IDC_CREATE_RAW,187,196,101,15 GROUPBOX "Floppy Drive Emulation Speed",IDC_SETTINGSTEXT2,5,144,289,35 CONTROL "",IDC_FLOPPYSPD,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,32,154,116,20 @@ -274,12 +274,14 @@ BEGIN PUSHBUTTON "Delete save image",IDC_SAVEIMAGE1,43,40,70,15,NOT WS_VISIBLE PUSHBUTTON "Delete save image",IDC_SAVEIMAGE2,43,75,70,15,NOT WS_VISIBLE PUSHBUTTON "Delete save image",IDC_SAVEIMAGE3,43,110,70,15,NOT WS_VISIBLE - EDITTEXT IDC_CREATE_NAME,81,215,97,13,ES_AUTOHSCROLL - RTEXT "Disk label:",IDC_STATIC,15,216,52,10,SS_CENTERIMAGE + EDITTEXT IDC_CREATE_NAME,85,215,97,13,ES_AUTOHSCROLL + RTEXT "Disk label:",IDC_STATIC,15,216,58,10,SS_CENTERIMAGE CONTROL "DF0:",IDC_DF0ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,3,6,34,15 CONTROL "DF1:",IDC_DF1ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,3,41,34,15 CONTROL "DF2:",IDC_DF2ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,3,76,34,15 CONTROL "DF3:",IDC_DF3ENABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,3,111,34,15 + CONTROL "FFS",IDC_FLOPPY_FFS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,255,214,34,15 + CONTROL "Bootblock",IDC_FLOPPY_BOOTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,214,59,15 END IDD_HARDDISK DIALOGEX 0, 0, 300, 243 @@ -1213,6 +1215,10 @@ BEGIN BEGIN END + IDD_FLOPPY, DIALOG + BEGIN + END + IDD_HARDDISK, DIALOG BEGIN END diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 3cac039d..0345a736 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -2186,9 +2186,9 @@ void logging_init (void) write_log (L"%s (%d.%d %s%s[%d])", VersionStr, osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion, _tcslen (osVersion.szCSDVersion) > 0 ? L" " : L"", os_winnt_admin); - write_log (L" %d-bit %X.%X %d", + write_log (L" %d-bit %X.%X.%X %d", wow64 ? 64 : 32, - SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision, + SystemInfo.wProcessorArchitecture, SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision, SystemInfo.dwNumberOfProcessors); write_log (L"\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation." L"\n(c) 1998-2010 Toni Wilen - Win32 port, core code updates." @@ -2394,14 +2394,14 @@ static int get_aspi (int old) static void __cdecl wparse_cmdline ( - _TSCHAR *cmdstart, + const _TSCHAR *cmdstart, _TSCHAR **argv, _TSCHAR *args, int *numargs, int *numchars ) { - _TSCHAR *p; + const _TSCHAR *p; _TUCHAR c; int inquote; /* 1 = inside quotes */ int copychar; /* 1 = copy char to *args */ @@ -2571,7 +2571,7 @@ static void __cdecl wparse_cmdline ( #define MAX_ARGUMENTS 128 -static TCHAR **parseargstring (TCHAR *s) +static TCHAR **parseargstring (const TCHAR *s) { TCHAR **p; int numa, numc; @@ -2594,7 +2594,7 @@ static TCHAR **parseargstring (TCHAR *s) } -static void shellexecute (TCHAR *command) +static void shellexecute (const TCHAR *command) { STARTUPINFO si = { 0 }; PROCESS_INFORMATION pi = { 0 }; @@ -2702,7 +2702,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_automount_removabledrives = 0; p->win32_automount_cddrives = 0; p->win32_automount_netdrives = 0; - p->win32_kbledmode = 0; + p->win32_kbledmode = 1; p->win32_uaescsimode = UAESCSI_CDEMU; p->win32_borderless = 0; p->win32_powersavedisabled = 1; @@ -2715,6 +2715,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_commandpathstart[0] = 0; p->win32_commandpathend[0] = 0; p->win32_statusbar = 1; + p->gfx_api = 1; } if (type == 1 || type == 0) { p->win32_uaescsimode = UAESCSI_CDEMU; @@ -4269,22 +4270,24 @@ static void getstartpaths (void) fullpath (start_path_data, sizeof start_path_data / sizeof (TCHAR)); SetCurrentDirectory (start_path_data); + // use path via command line? if (!start_path_plugins[0]) { + // default path _tcscpy (start_path_plugins, start_path_data); _tcscat (start_path_plugins, WIN32_PLUGINDIR); + } + v = GetFileAttributes (start_path_plugins); + if (!start_path_plugins[0] || v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY)) { + // not found, exe path? + _tcscpy (start_path_plugins, start_path_exe); + _tcscat (start_path_plugins, WIN32_PLUGINDIR); v = GetFileAttributes (start_path_plugins); if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY)) - _tcscpy (start_path_plugins, start_path_data); - } else { - v = GetFileAttributes (start_path_plugins); - if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY) || start_data == 0 || start_data == -2) { - _tcscpy (start_path_plugins, start_path_exe); - } + _tcscpy (start_path_plugins, start_path_data); // not found, very default path } fixtrailing (start_path_plugins); fullpath (start_path_plugins, sizeof start_path_plugins / sizeof (TCHAR)); setpathmode (path_type); - } extern void test (void); diff --git a/od-win32/win32.h b/od-win32/win32.h index 12184f17..14ab8a44 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"14" -#define WINUAEDATE MAKEBD(2010, 8, 31) +#define WINUAEBETA L"15" +#define WINUAEDATE MAKEBD(2010, 9, 5) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 626e0756..dcf47ae1 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -193,6 +193,10 @@ static bool ischecked (HWND hDlg, DWORD id) { return IsDlgButtonChecked (hDlg, id) == BST_CHECKED; } +static void setchecked (HWND hDlg, DWORD id, bool checked) +{ + CheckDlgButton (hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); +} static void setfocus (HWND hDlg, int id) { SendMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem (hDlg, id), TRUE); @@ -1564,7 +1568,6 @@ int scan_roms (HWND hDlg, int show) int id, i, ret, keys, cnt; UAEREG *fkey, *fkey2; TCHAR *paths[MAX_ROM_PATHS]; - HWND hwnd = 0; MSG msg; if (recursive) @@ -1577,10 +1580,13 @@ int scan_roms (HWND hDlg, int show) goto end; infoboxdialogstate = true; - hwnd = CreateDialog (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_INFOBOX), hDlg, InfoBoxDialogProc); - if (!hwnd) - goto end; - infoboxhwnd = hwnd; + infoboxhwnd = NULL; + if (!rp_isactive ()) { + HWND hwnd = CreateDialog (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDD_INFOBOX), hDlg, InfoBoxDialogProc); + if (!hwnd) + goto end; + infoboxhwnd = hwnd; + } cnt = 0; ret = 0; @@ -1631,8 +1637,9 @@ int scan_roms (HWND hDlg, int show) } end: - infoboxhwnd = NULL; - if (hwnd) { + if (infoboxhwnd) { + HWND hwnd = infoboxhwnd; + infoboxhwnd = NULL; DestroyWindow (hwnd); while (PeekMessage (&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage (&msg); @@ -2337,11 +2344,14 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs TCHAR disk_name[32]; disk_name[0] = 0; disk_name[31] = 0; GetDlgItemText (hDlg, IDC_CREATE_NAME, disk_name, 30); - disk_creatediskfile (full_path, 0, (drive_type)SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L), disk_name); + disk_creatediskfile (full_path, 0, (drive_type)SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L), disk_name, ischecked (hDlg, IDC_FLOPPY_FFS), ischecked (hDlg, IDC_FLOPPY_BOOTABLE)); } break; case IDC_CREATE_RAW: - disk_creatediskfile (full_path, 1, (drive_type)SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L), NULL); + TCHAR disk_name[32]; + disk_name[0] = 0; disk_name[31] = 0; + GetDlgItemText (hDlg, IDC_CREATE_NAME, disk_name, 30); + disk_creatediskfile (full_path, 1, (drive_type)SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L), disk_name, ischecked (hDlg, IDC_FLOPPY_FFS), ischecked (hDlg, IDC_FLOPPY_BOOTABLE)); break; case IDC_LOAD: if (target_cfgfile_load (&workprefs, full_path, 0, 0) == 0) { @@ -4082,7 +4092,7 @@ static void checkautoload (HWND hDlg, struct ConfigStruct *config) ct = 0; ConfigToRegistry2 (ct, configtypepanel, -1); } - CheckDlgButton(hDlg, IDC_CONFIGAUTO, ct ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton (hDlg, IDC_CONFIGAUTO, ct ? BST_CHECKED : BST_UNCHECKED); ew (hDlg, IDC_CONFIGAUTO, configtypepanel > 0 && config && !config->Directory ? TRUE : FALSE); regqueryint (NULL, L"ConfigFile_NoAuto", &ct); CheckDlgButton(hDlg, IDC_CONFIGNOLINK, ct ? BST_CHECKED : BST_UNCHECKED); @@ -7047,7 +7057,7 @@ static void init_kickstart (HWND hDlg) ew (hDlg, IDC_FLASHCHOOSER), FALSE); #endif if (!regexiststree (NULL , L"DetectedROMs")) - scan_roms (NULL, 1); + scan_roms (NULL, rp_isactive () ? 0 : 1); } static void kickstartfilebuttons (HWND hDlg, WPARAM wParam, TCHAR *path) @@ -9810,7 +9820,7 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA { static int recursive = 0; int i; - static TCHAR diskname[40] = { L"empty" }; + static TCHAR diskname[40] = { L"" }; switch (msg) { @@ -9908,6 +9918,17 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA case IDC_DF3TYPE: getfloppytype (hDlg, 3); break; + case IDC_FLOPPYTYPE: + int val = SendDlgItemMessage (hDlg, IDC_FLOPPYTYPE, CB_GETCURSEL, 0, 0L); + bool afloppy = val >= 0 && val <= 1; + ew (hDlg, IDC_FLOPPY_FFS, afloppy); + ew (hDlg, IDC_FLOPPY_BOOTABLE, afloppy); + ew (hDlg, IDC_CREATE_NAME, afloppy); + if (!afloppy) { + setchecked (hDlg, IDC_FLOPPY_FFS, false); + setchecked (hDlg, IDC_FLOPPY_BOOTABLE, false); + } + break; } } switch (LOWORD (wParam)) @@ -9999,6 +10020,7 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA addfloppyhistory (hDlg); break; } + GetDlgItemText (hDlg, IDC_CREATE_NAME, diskname, 30); recursive--; break; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 43a758f2..2bf393bb 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,13 @@ +Beta 15: + +- swallow USB keyboard led mode phantom keypresses, do not touch non-enabled keyboard leds, + key pressess do not cause lost led state sync anymore. rawinput mode only. +- floppy panel disk image creator can now create FFS and bootable images, pre-formatted + extended adf ("custom floppy") will be created if label is set or FFS or bootblock is ticked. + (empty label box = label will be "empty" when creation standard adf) +- b1 plugin path detection didn't check exe location\plugins + Beta 14: - DSKSTEP and DSKSELx going inactive at the same time steps the rw-head normally