Split generic CD-ROM from SCSI-style CD-ROM;
Redid the way SCSI and ATAPI devices are handled; Slight timings change in the NCR 5380; Devices are now closed by device_close_all() in the reverse order of the one in which they were started; Slight changes to some code in win/; Added the WM_HARDRESET and WM_SHUTDOWN window messages for configuration manager purposes.
This commit is contained in:
@@ -477,7 +477,7 @@ USBOBJ := usb.o
|
||||
endif
|
||||
|
||||
SCSIOBJ := scsi.o scsi_device.o \
|
||||
scsi_disk.o \
|
||||
scsi_cdrom.o scsi_disk.o \
|
||||
scsi_x54x.o \
|
||||
scsi_aha154x.o scsi_buslogic.o \
|
||||
scsi_ncr5380.o scsi_ncr53c810.o
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.19 2018/07/19
|
||||
* Version: @(#)win.h 1.0.20 2018/10/10
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -50,6 +50,8 @@
|
||||
#define WM_SHOWSETTINGS 0x8889
|
||||
#define WM_PAUSE 0x8890
|
||||
#define WM_SENDHWND 0x8891
|
||||
#define WM_HARDRESET 0x8892
|
||||
#define WM_SHUTDOWN 0x8893
|
||||
|
||||
#ifdef USE_VNC
|
||||
#define RENDERERS_NUM 5
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the platform-side of CDROM drives.
|
||||
*
|
||||
* Version: @(#)win_cdrom.c 1.0.9 2018/10/02
|
||||
* Version: @(#)win_cdrom.c 1.0.10 2018/10/09
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -43,32 +43,35 @@
|
||||
void
|
||||
cdrom_eject(uint8_t id)
|
||||
{
|
||||
if (cdrom_drives[id].host_drive == 0) {
|
||||
cdrom_drive_t *drv = &cdrom_drives[id];
|
||||
cdrom_image_t *img = &cdrom_image[id];
|
||||
|
||||
if (drv->host_drive == 0) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (cdrom_image[id].prev_image_path) {
|
||||
free(cdrom_image[id].prev_image_path);
|
||||
cdrom_image[id].prev_image_path = NULL;
|
||||
if (img->prev_image_path) {
|
||||
free(img->prev_image_path);
|
||||
img->prev_image_path = NULL;
|
||||
}
|
||||
|
||||
if (cdrom_drives[id].host_drive == 200) {
|
||||
cdrom_image[id].prev_image_path = (wchar_t *) malloc(1024);
|
||||
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
|
||||
if (drv->host_drive == 200) {
|
||||
img->prev_image_path = (wchar_t *) malloc(1024);
|
||||
wcscpy(img->prev_image_path, img->image_path);
|
||||
}
|
||||
cdrom_drives[id].prev_host_drive = cdrom_drives[id].host_drive;
|
||||
cdrom[id]->handler->exit(id);
|
||||
drv->prev_host_drive = drv->host_drive;
|
||||
drv->handler->exit(id);
|
||||
cdrom_close_handler(id);
|
||||
memset(cdrom_image[id].image_path, 0, 2048);
|
||||
memset(img->image_path, 0, 2048);
|
||||
cdrom_null_open(id);
|
||||
if (cdrom_drives[id].bus_type) {
|
||||
if (drv->insert) {
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(cdrom[id]);
|
||||
drv->insert(drv->p);
|
||||
}
|
||||
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
|
||||
cdrom_drives[id].host_drive=0;
|
||||
drv->host_drive=0;
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
|
||||
ui_sb_update_icon_state(SB_CDROM|id, 1);
|
||||
ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
|
||||
@@ -81,31 +84,34 @@ cdrom_eject(uint8_t id)
|
||||
void
|
||||
cdrom_reload(uint8_t id)
|
||||
{
|
||||
if ((cdrom_drives[id].host_drive == cdrom_drives[id].prev_host_drive) || (cdrom_drives[id].prev_host_drive == 0) || (cdrom_drives[id].host_drive != 0)) {
|
||||
cdrom_drive_t *drv = &cdrom_drives[id];
|
||||
cdrom_image_t *img = &cdrom_image[id];
|
||||
|
||||
if ((drv->host_drive == drv->prev_host_drive) || !drv->prev_host_drive || drv->host_drive) {
|
||||
/* Switch from empty to empty. Do nothing. */
|
||||
return;
|
||||
}
|
||||
|
||||
cdrom_close_handler(id);
|
||||
memset(cdrom_image[id].image_path, 0, 2048);
|
||||
memset(img->image_path, 0, 2048);
|
||||
|
||||
if (cdrom_drives[id].prev_host_drive == 200) {
|
||||
wcscpy(cdrom_image[id].image_path, cdrom_image[id].prev_image_path);
|
||||
free(cdrom_image[id].prev_image_path);
|
||||
cdrom_image[id].prev_image_path = NULL;
|
||||
image_open(id, cdrom_image[id].image_path);
|
||||
if (cdrom_drives[id].bus_type) {
|
||||
if (drv->prev_host_drive == 200) {
|
||||
wcscpy(img->image_path, img->prev_image_path);
|
||||
free(img->prev_image_path);
|
||||
img->prev_image_path = NULL;
|
||||
image_open(id, img->image_path);
|
||||
if (drv->insert) {
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(cdrom[id]);
|
||||
drv->insert(drv->p);
|
||||
}
|
||||
if (wcslen(cdrom_image[id].image_path) == 0) {
|
||||
if (wcslen(img->image_path) == 0) {
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED);
|
||||
cdrom_drives[id].host_drive = 0;
|
||||
drv->host_drive = 0;
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
|
||||
ui_sb_update_icon_state(SB_CDROM|id, 1);
|
||||
} else {
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
||||
cdrom_drives[id].host_drive = 200;
|
||||
drv->host_drive = 200;
|
||||
ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED);
|
||||
ui_sb_update_icon_state(SB_CDROM|id, 0);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../video/video.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* NOTES: This code should be re-merged into a single init() with a
|
||||
* 'fullscreen' argument, indicating FS mode is requested.
|
||||
*
|
||||
* Version: @(#)win_ddraw.cpp 1.0.10 2018/07/17
|
||||
* Version: @(#)win_ddraw.cpp 1.0.11 2018/10/10
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -178,7 +178,8 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
|
||||
bmpInfo.bmiHeader.biSizeImage =
|
||||
bmpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.biHeight)*(bmpInfo.bmiHeader.biBitCount+7)/8;
|
||||
|
||||
if ((pBuf = malloc(bmpInfo.bmiHeader.biSizeImage)) == NULL) {
|
||||
pBuf = malloc(bmpInfo.bmiHeader.biSizeImage);
|
||||
if (pBuf == NULL) {
|
||||
ddraw_log("[SavePNG] Unable to Allocate Bitmap Memory");
|
||||
fclose(fp);
|
||||
return;
|
||||
@@ -187,7 +188,8 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
|
||||
if (ys2 <= 250) {
|
||||
bmpInfo.bmiHeader.biSizeImage <<= 1;
|
||||
|
||||
if ((pBuf2 = malloc(bmpInfo.bmiHeader.biSizeImage)) == NULL) {
|
||||
pBuf2 = malloc(bmpInfo.bmiHeader.biSizeImage);
|
||||
if (pBuf2 == NULL) {
|
||||
ddraw_log("[SavePNG] Unable to Allocate Secondary Bitmap Memory");
|
||||
free(pBuf);
|
||||
fclose(fp);
|
||||
@@ -207,7 +209,8 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
if ((b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * bmpInfo.bmiHeader.biHeight)) == NULL) {
|
||||
b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * bmpInfo.bmiHeader.biHeight);
|
||||
if (b_rgb == NULL) {
|
||||
ddraw_log("[SavePNG] Unable to Allocate RGB Bitmap Memory");
|
||||
free(pBuf2);
|
||||
free(pBuf);
|
||||
@@ -215,8 +218,9 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < bmpInfo.bmiHeader.biHeight; i++)
|
||||
for (i = 0; i < bmpInfo.bmiHeader.biHeight; i++) {
|
||||
b_rgb[i] = (png_byte *) malloc(png_get_rowbytes(png_ptr, info_ptr));
|
||||
}
|
||||
|
||||
if (pBuf2) {
|
||||
DoubleLines((uint8_t *) pBuf2, (uint8_t *) pBuf);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows device configuration dialog implementation.
|
||||
*
|
||||
* Version: @(#)win_devconf.c 1.0.18 2018/04/01
|
||||
* Version: @(#)win_devconf.c 1.0.19 2018/10/10
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../86box.h"
|
||||
@@ -459,10 +460,13 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
uint8_t deviceconfig_open(HWND hwnd, const device_t *device)
|
||||
{
|
||||
const device_config_t *config = device->config;
|
||||
uint16_t *data_block = malloc(16384);
|
||||
uint16_t *data_block;
|
||||
uint16_t *data;
|
||||
DLGTEMPLATE *dlg = (DLGTEMPLATE *)data_block;
|
||||
DLGTEMPLATE *dlg;
|
||||
DLGITEMTEMPLATE *item;
|
||||
|
||||
data_block = malloc(16384);
|
||||
dlg = (DLGTEMPLATE *)data_block;
|
||||
int y = 10;
|
||||
int id = IDC_CONFIG_BASE;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* we will not use that, but, instead, use a new window which
|
||||
* coverrs the entire desktop.
|
||||
*
|
||||
* Version: @(#)win_sdl.c 1.0.0 2018/05/26
|
||||
* Version: @(#)win_sdl.c 1.0.1 2018/10/10
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Michael Dr<44>ing, <michael@drueing.de>
|
||||
@@ -551,7 +551,8 @@ sdl_take_screenshot(const wchar_t *fn)
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
if ((rgba = (unsigned char *)malloc(width * height * 4)) == NULL) {
|
||||
rgba = (unsigned char *) malloc(width * height * 4);
|
||||
if (rgba == NULL) {
|
||||
sdl_log("[sdl_take_screenshot] Unable to Allocate RGBA Bitmap Memory");
|
||||
fclose(fp);
|
||||
return;
|
||||
@@ -564,7 +565,8 @@ sdl_take_screenshot(const wchar_t *fn)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * height)) == NULL) {
|
||||
b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * height);
|
||||
if (b_rgb == NULL) {
|
||||
sdl_log("[sdl_take_screenshot] Unable to Allocate RGB Bitmap Memory");
|
||||
free(rgba);
|
||||
fclose(fp);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the application's Status Bar.
|
||||
*
|
||||
* Version: @(#)win_stbar.c 1.0.19 2018/10/02
|
||||
* Version: @(#)win_stbar.c 1.0.20 2018/10/09
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -286,7 +286,7 @@ StatusBarCreateCdromTip(int part)
|
||||
free(sbTips[part]);
|
||||
sbTips[part] = NULL;
|
||||
}
|
||||
sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2);
|
||||
sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 4);
|
||||
wcscpy(sbTips[part], tempTip);
|
||||
}
|
||||
|
||||
@@ -882,12 +882,13 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if (!cdrom_image[id].prev_image_path)
|
||||
cdrom_image[id].prev_image_path = (wchar_t *) malloc(1024);
|
||||
wcscpy(cdrom_image[id].prev_image_path, cdrom_image[id].image_path);
|
||||
cdrom[id]->handler->exit(id);
|
||||
cdrom_drives[id].handler->exit(id);
|
||||
cdrom_close_handler(id);
|
||||
memset(cdrom_image[id].image_path, 0, 2048);
|
||||
image_open(id, temp_path);
|
||||
/* Signal media change to the emulated machine. */
|
||||
cdrom_insert(cdrom[id]);
|
||||
if (cdrom_drives[id].insert)
|
||||
cdrom_drives[id].insert(cdrom_drives[id].p);
|
||||
CheckMenuItem(sb_menu_handles[part], IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
||||
cdrom_drives[id].host_drive = (wcslen(cdrom_image[id].image_path) == 0) ? 0 : 200;
|
||||
if (cdrom_drives[id].host_drive == 200) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* user Interface module for WinAPI on Windows.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.31 2018/10/07
|
||||
* Version: @(#)win_ui.c 1.0.32 2018/10/10
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -644,6 +644,14 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
CheckMenuItem(menuMain, IDM_ACTION_PAUSE, dopause ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case WM_HARDRESET:
|
||||
pc_reset(1);
|
||||
break;
|
||||
|
||||
case WM_SHUTDOWN:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
/*
|
||||
* Disable ALT key *ALWAYS*,
|
||||
|
||||
Reference in New Issue
Block a user