Merge branch 'master' into feature/toolbar

This commit is contained in:
David Hrdlička
2022-01-12 21:12:43 +01:00
5 changed files with 72 additions and 15 deletions

View File

@@ -737,8 +737,8 @@ cdrom_read_disc_info_toc(cdrom_t *dev, unsigned char *b, unsigned char track, in
static int static int
track_type_is_valid(uint8_t id, int type, int flags, int audio, int mode2) 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 */ if (!(flags & 0x70) && (flags & 0xf8)) { /* 0x08/0x80/0x88 are illegal modes */
cdrom_log("CD-ROM %i: [Any Mode] 0x00/0x08/0x80/0x88 are illegal modes\n", id); cdrom_log("CD-ROM %i: [Any Mode] 0x08/0x80/0x88 are illegal modes\n", id);
return 0; 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(raw_buffer, 0, 2448);
memset(extra_buffer, 0, 296); memset(extra_buffer, 0, 296);
if (!(cdrom_sector_flags & 0xf0)) { /* 0x00 and 0x08 are illegal modes */ if ((cdrom_sector_flags & 0xf8) == 0x08) { /* 0x08 is an illegal mode */
cdrom_log("CD-ROM %i: [Mode 1] 0x00 and 0x08 are illegal modes\n", dev->id); cdrom_log("CD-ROM %i: [Mode 1] 0x08 is an illegal mode\n", dev->id);
return 0; return 0;
} }

View File

@@ -1623,7 +1623,22 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb)
dev->sector_len -= dev->sector_pos; dev->sector_len -= dev->sector_pos;
dev->sector_len++; dev->sector_len++;
msf = 1; 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; break;
case GPCMD_READ_CD_OLD: case GPCMD_READ_CD_OLD:
case GPCMD_READ_CD: 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]; dev->sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
msf = 0; 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; break;
} }

View File

@@ -369,7 +369,7 @@ END
#define STR_SIZE_MB "Tamanho (MB):" #define STR_SIZE_MB "Tamanho (MB):"
#define STR_TYPE "Tipo:" #define STR_TYPE "Tipo:"
#define STR_IMG_FORMAT "Formato:" #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_FLOPPY_DRIVES "Unidades de disquete:"
#define STR_TURBO "Turbo" #define STR_TURBO "Turbo"
@@ -479,7 +479,7 @@ BEGIN
IDS_2115 "Magneto-óptico %i (%ls): %ls" IDS_2115 "Magneto-óptico %i (%ls): %ls"
IDS_2116 "Imagens magneto-ópticas (*.IM?;*.MDI)\0*.IM?;*.MDI\0Todos os arquivos (*.*)\0*.*\0" IDS_2116 "Imagens magneto-ópticas (*.IM?;*.MDI)\0*.IM?;*.MDI\0Todos os arquivos (*.*)\0*.*\0"
IDS_2117 "Bem-vindo ao 86Box!" IDS_2117 "Bem-vindo ao 86Box!"
IDS_2118 "Controle interno" IDS_2118 "Controlador interno"
IDS_2119 "Sair" IDS_2119 "Sair"
IDS_2120 "Nenhum ROM encontrada" IDS_2120 "Nenhum ROM encontrada"
IDS_2121 "Você deseja salvar as configurações?" IDS_2121 "Você deseja salvar as configurações?"

View File

@@ -200,8 +200,9 @@ static void set_parent_binding(int enable)
* @param wParam * @param wParam
* @param lParam * @param lParam
* @param fullscreen * @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) 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. */ /* Mouse events that enter and exit capture. */
PostMessage(parent, message, wParam, lParam); PostMessage(parent, message, wParam, lParam);
} }
break; return 1;
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
@@ -228,7 +229,7 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i
{ {
PostMessage(parent, message, wParam, lParam); PostMessage(parent, message, wParam, lParam);
} }
break; return 1;
case WM_INPUT: case WM_INPUT:
if (fullscreen) if (fullscreen)
{ {
@@ -256,8 +257,17 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i
} }
free(raw); 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 */ /* Handle window messages */
MSG msg; MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{ {
if (msg.hwnd == window_hwnd) if (msg.hwnd != window_hwnd || !handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen))
handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen); {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
}
} }
/* Wait for synchronized events for 1ms before going back to window events */ /* 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); SetForegroundWindow(window_hwnd);
SetFocus(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) if (fullscreen)

View File

@@ -974,6 +974,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break; break;
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
if (video_fullscreen & 1)
PostMessage(hwndMain, WM_LEAVEFULLSCREEN, 0, 0);
pos = (WINDOWPOS*)lParam; pos = (WINDOWPOS*)lParam;
GetClientRect(hwndMain, &rect); GetClientRect(hwndMain, &rect);
@@ -1174,6 +1177,13 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
break; 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: case WM_ENTERSIZEMOVE:
user_resize = 1; user_resize = 1;
break; break;