diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 37615a32e..31f875a77 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -737,8 +737,8 @@ cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, in static int track_type_is_valid(uint8_t id, int type, int flags, int audio, int mode2) { - if (!(flags & 0x70)) { /* 0x00/0x08/0x80/0x88 are illegal modes */ - cdrom_log("CD-ROM %i: [Any Mode] 0x00/0x08/0x80/0x88 are illegal modes\n", id); + if (!(flags & 0x70) && (flags & 0xf8)) { /* 0x08/0x80/0x88 are illegal modes */ + cdrom_log("CD-ROM %i: [Any Mode] 0x08/0x80/0x88 are illegal modes\n", id); return 0; } @@ -1031,8 +1031,8 @@ cdrom_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf, int c memset(raw_buffer, 0, 2448); memset(extra_buffer, 0, 296); - if (!(cdrom_sector_flags & 0xf0)) { /* 0x00 and 0x08 are illegal modes */ - cdrom_log("CD-ROM %i: [Mode 1] 0x00 and 0x08 are illegal modes\n", dev->id); + if ((cdrom_sector_flags & 0xf8) == 0x08) { /* 0x08 is an illegal mode */ + cdrom_log("CD-ROM %i: [Mode 1] 0x08 is an illegal mode\n", dev->id); return 0; } diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index a69413596..8a443dd77 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -1623,7 +1623,22 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) dev->sector_len -= dev->sector_pos; dev->sector_len++; + msf = 1; + + if ((cdb[9] & 0xf8) == 0x08) { + /* 0x08 is an illegal mode */ + scsi_cdrom_invalid_field(dev); + return; + } + + /* If all the flag bits are cleared, then treat it as a non-data command. */ + if ((cdb[9] == 0x00) && ((cdb[10] & 0x07) == 0x00)) + dev->sector_len = 0; + else if ((cdb[9] == 0x00) && ((cdb[10] & 0x07) != 0x00)) { + scsi_cdrom_invalid_field(dev); + return; + } break; case GPCMD_READ_CD_OLD: case GPCMD_READ_CD: @@ -1632,6 +1647,20 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) dev->sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5]; msf = 0; + + if ((cdb[9] & 0xf8) == 0x08) { + /* 0x08 is an illegal mode */ + scsi_cdrom_invalid_field(dev); + return; + } + + /* If all the flag bits are cleared, then treat it as a non-data command. */ + if ((cdb[9] == 0x00) && ((cdb[10] & 0x07) == 0x00)) + dev->sector_len = 0; + else if ((cdb[9] == 0x00) && ((cdb[10] & 0x07) != 0x00)) { + scsi_cdrom_invalid_field(dev); + return; + } break; } diff --git a/src/win/languages/pt-BR.rc b/src/win/languages/pt-BR.rc index 58ae5f6b4..e2a9a856e 100644 --- a/src/win/languages/pt-BR.rc +++ b/src/win/languages/pt-BR.rc @@ -369,7 +369,7 @@ END #define STR_SIZE_MB "Tamanho (MB):" #define STR_TYPE "Tipo:" #define STR_IMG_FORMAT "Formato:" -#define STR_BLOCK_SIZE "Tamanho do bloco:" +#define STR_BLOCK_SIZE "Bloco:" #define STR_FLOPPY_DRIVES "Unidades de disquete:" #define STR_TURBO "Turbo" @@ -479,7 +479,7 @@ BEGIN IDS_2115 "Magneto-óptico %i (%ls): %ls" IDS_2116 "Imagens magneto-ópticas (*.IM?;*.MDI)\0*.IM?;*.MDI\0Todos os arquivos (*.*)\0*.*\0" IDS_2117 "Bem-vindo ao 86Box!" - IDS_2118 "Controle interno" + IDS_2118 "Controlador interno" IDS_2119 "Sair" IDS_2120 "Nenhum ROM encontrada" IDS_2121 "Você deseja salvar as configurações?" diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index 4f328c097..99843cd9f 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -200,8 +200,9 @@ static void set_parent_binding(int enable) * @param wParam * @param lParam * @param fullscreen + * @return Was message handled */ -static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, int fullscreen) +static int handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, int fullscreen) { switch (message) { @@ -219,7 +220,7 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i /* Mouse events that enter and exit capture. */ PostMessage(parent, message, wParam, lParam); } - break; + return 1; case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: @@ -228,7 +229,7 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i { PostMessage(parent, message, wParam, lParam); } - break; + return 1; case WM_INPUT: if (fullscreen) { @@ -256,8 +257,17 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i } free(raw); } - break; + return 1; + case WM_MOUSELEAVE: + if (fullscreen) + { + /* Leave fullscreen if mouse leaves the renderer window. */ + PostMessage(GetAncestor(parent, GA_ROOT), WM_LEAVEFULLSCREEN, 0, 0); + } + return 0; } + + return 0; } /** @@ -638,12 +648,13 @@ static void opengl_main(void* param) /* Handle window messages */ MSG msg; - if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if (msg.hwnd == window_hwnd) - handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen); - TranslateMessage(&msg); - DispatchMessage(&msg); + if (msg.hwnd != window_hwnd || !handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } /* Wait for synchronized events for 1ms before going back to window events */ @@ -722,7 +733,14 @@ static void opengl_main(void* param) { SetForegroundWindow(window_hwnd); SetFocus(window_hwnd); + + /* Clip cursor to prevent it moving to another monitor. */ + RECT rect; + GetWindowRect(window_hwnd, &rect); + ClipCursor(&rect); } + else + ClipCursor(NULL); } if (fullscreen) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 63b3c64b8..0c1fbc930 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -974,6 +974,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_WINDOWPOSCHANGED: + if (video_fullscreen & 1) + PostMessage(hwndMain, WM_LEAVEFULLSCREEN, 0, 0); + pos = (WINDOWPOS*)lParam; GetClientRect(hwndMain, &rect); @@ -1174,6 +1177,13 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } break; + case WM_ACTIVATEAPP: + /* Leave full screen on switching application except + for OpenGL Core and VNC renderers. */ + if (video_fullscreen & 1 && wParam == FALSE && vid_api < 3) + PostMessage(hwndMain, WM_LEAVEFULLSCREEN, 0, 0); + break; + case WM_ENTERSIZEMOVE: user_resize = 1; break;