Fixed CD-ROM ATAPI DMA and made ATAPI PIO much less of a mess;
Fixed MCA write bugs for the AHA-1640 and BT-640; Fixed a warning in the PC87306 Super I/O chip emulation; Each renderer now only has a 32-bit blitter - video_blit_memtoscreen_8() now only converts buffer to buffer32 and then calls video_blit_memtoscreen(), 8-bit blitters are now gone.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||||
* commands, for both ATAPI and SCSI usage.
|
* commands, for both ATAPI and SCSI usage.
|
||||||
*
|
*
|
||||||
* Version: @(#)cdrom.c 1.0.18 2017/10/15
|
* Version: @(#)cdrom.c 1.0.19 2017/10/22
|
||||||
*
|
*
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -845,7 +845,7 @@ void cdrom_init(int id, int cdb_len_setting)
|
|||||||
cdrom[id].sense[0] = 0xf0;
|
cdrom[id].sense[0] = 0xf0;
|
||||||
cdrom[id].sense[7] = 10;
|
cdrom[id].sense[7] = 10;
|
||||||
cdrom_drives[id].bus_mode = 0;
|
cdrom_drives[id].bus_mode = 0;
|
||||||
if (cdrom_drives[id].bus_type > CDROM_BUS_ATAPI_PIO_AND_DMA)
|
if (cdrom_drives[id].bus_type >= CDROM_BUS_ATAPI_PIO_AND_DMA)
|
||||||
{
|
{
|
||||||
cdrom_drives[id].bus_mode |= 2;
|
cdrom_drives[id].bus_mode |= 2;
|
||||||
}
|
}
|
||||||
@@ -890,6 +890,7 @@ int cdrom_current_mode(int id)
|
|||||||
}
|
}
|
||||||
if (cdrom_supports_pio(id) && !cdrom_supports_dma(id))
|
if (cdrom_supports_pio(id) && !cdrom_supports_dma(id))
|
||||||
{
|
{
|
||||||
|
cdrom_log("CD-ROM %i: Drive does not support DMA, setting to PIO\n", id);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!cdrom_supports_pio(id) && cdrom_supports_dma(id))
|
if (!cdrom_supports_pio(id) && cdrom_supports_dma(id))
|
||||||
@@ -898,6 +899,7 @@ int cdrom_current_mode(int id)
|
|||||||
}
|
}
|
||||||
if (cdrom_supports_pio(id) && cdrom_supports_dma(id))
|
if (cdrom_supports_pio(id) && cdrom_supports_dma(id))
|
||||||
{
|
{
|
||||||
|
cdrom_log("CD-ROM %i: Drive supports both, setting to %s\n", id, (cdrom[id].features & 1) ? "DMA" : "PIO", id);
|
||||||
return (cdrom[id].features & 1) ? 2 : 1;
|
return (cdrom[id].features & 1) ? 2 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,6 +1368,8 @@ uint32_t cdrom_mode_sense(uint8_t id, uint8_t *buf, uint32_t pos, uint8_t type,
|
|||||||
|
|
||||||
void cdrom_update_request_length(uint8_t id, int len, int block_len)
|
void cdrom_update_request_length(uint8_t id, int len, int block_len)
|
||||||
{
|
{
|
||||||
|
uint32_t bt;
|
||||||
|
|
||||||
/* For media access commands, make sure the requested DRQ length matches the block length. */
|
/* For media access commands, make sure the requested DRQ length matches the block length. */
|
||||||
switch (cdrom[id].current_cdb[0])
|
switch (cdrom[id].current_cdb[0])
|
||||||
{
|
{
|
||||||
@@ -1378,17 +1382,11 @@ void cdrom_update_request_length(uint8_t id, int len, int block_len)
|
|||||||
{
|
{
|
||||||
cdrom[id].request_length = block_len;
|
cdrom[id].request_length = block_len;
|
||||||
}
|
}
|
||||||
/* Make sure we respect the limit of how many blocks we can transfer at once. */
|
bt = (cdrom[id].requested_blocks * block_len);
|
||||||
if (cdrom[id].requested_blocks > cdrom_drives[id].max_blocks_at_once)
|
if (len > bt)
|
||||||
{
|
{
|
||||||
cdrom[id].requested_blocks = cdrom_drives[id].max_blocks_at_once;
|
len = bt;
|
||||||
}
|
}
|
||||||
cdrom[id].block_total = (cdrom[id].requested_blocks * block_len);
|
|
||||||
if (len > cdrom[id].block_total)
|
|
||||||
{
|
|
||||||
len = cdrom[id].block_total;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
cdrom[id].packet_len = len;
|
cdrom[id].packet_len = len;
|
||||||
break;
|
break;
|
||||||
@@ -1406,21 +1404,6 @@ void cdrom_update_request_length(uint8_t id, int len, int block_len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cdrom_is_media_access(uint8_t id)
|
|
||||||
{
|
|
||||||
switch (cdrom[id].current_cdb[0])
|
|
||||||
{
|
|
||||||
case 0x08:
|
|
||||||
case 0x28:
|
|
||||||
case 0xa8:
|
|
||||||
case 0xb9:
|
|
||||||
case 0xbe:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cdrom_command_common(uint8_t id)
|
static void cdrom_command_common(uint8_t id)
|
||||||
{
|
{
|
||||||
cdrom[id].status = BUSY_STAT;
|
cdrom[id].status = BUSY_STAT;
|
||||||
@@ -1489,6 +1472,11 @@ static int cdrom_request_length_is_zero(uint8_t id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* id = Current CD-ROM device ID;
|
||||||
|
len = Total transfer length;
|
||||||
|
block_len = Length of a single block (why does it matter?!);
|
||||||
|
alloc_len = Allocated transfer length;
|
||||||
|
direction = Transfer direction (0 = read from host, 1 = write to host). */
|
||||||
static void cdrom_data_command_finish(uint8_t id, int len, int block_len, int alloc_len, int direction)
|
static void cdrom_data_command_finish(uint8_t id, int len, int block_len, int alloc_len, int direction)
|
||||||
{
|
{
|
||||||
cdrom_log("CD-ROM %i: Finishing command (%02X): %i, %i, %i, %i, %i\n", id, cdrom[id].current_cdb[0], len, block_len, alloc_len, direction, cdrom[id].request_length);
|
cdrom_log("CD-ROM %i: Finishing command (%02X): %i, %i, %i, %i, %i\n", id, cdrom[id].current_cdb[0], len, block_len, alloc_len, direction, cdrom[id].request_length);
|
||||||
@@ -2547,15 +2535,9 @@ cdrom_readtoc_fallback:
|
|||||||
}
|
}
|
||||||
|
|
||||||
max_len = cdrom[id].sector_len;
|
max_len = cdrom[id].sector_len;
|
||||||
/* if (cdrom_drives[id].bus_type == CDROM_BUS_SCSI) */
|
cdrom[id].requested_blocks = max_len; /* If we're reading all blocks in one go for DMA, why not also for PIO, it should NOT
|
||||||
if (cdrom_current_mode(id) == 2)
|
matter anyway, this step should be identical and only the way the read dat is
|
||||||
{
|
transferred to the host should be different. */
|
||||||
cdrom[id].requested_blocks = max_len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cdrom[id].requested_blocks = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdrom[id].packet_len = max_len * alloc_length;
|
cdrom[id].packet_len = max_len * alloc_length;
|
||||||
cdrom_buf_alloc(id, cdrom[id].packet_len);
|
cdrom_buf_alloc(id, cdrom[id].packet_len);
|
||||||
@@ -2566,27 +2548,13 @@ cdrom_readtoc_fallback:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cdrom_current_mode(id) == 2)
|
cdrom[id].requested_blocks = max_len;
|
||||||
{
|
cdrom[id].packet_len = alloc_length;
|
||||||
cdrom[id].requested_blocks = max_len;
|
|
||||||
cdrom[id].packet_len = alloc_length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cdrom[id].requested_blocks = 1;
|
|
||||||
cdrom[id].packet_len = max_len * alloc_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
cdrom_set_buf_len(id, BufLen, &cdrom[id].packet_len);
|
cdrom_set_buf_len(id, BufLen, &cdrom[id].packet_len);
|
||||||
|
|
||||||
if (cdrom[id].requested_blocks > 1)
|
cdrom_data_command_finish(id, alloc_length, alloc_length / cdrom[id].requested_blocks, alloc_length, 0);
|
||||||
{
|
|
||||||
cdrom_data_command_finish(id, alloc_length, alloc_length / cdrom[id].requested_blocks, alloc_length, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cdrom_data_command_finish(id, alloc_length, alloc_length, alloc_length, 0);
|
|
||||||
}
|
|
||||||
cdrom[id].all_blocks_total = cdrom[id].block_total;
|
cdrom[id].all_blocks_total = cdrom[id].block_total;
|
||||||
if (cdrom[id].packet_status != CDROM_PHASE_COMPLETE)
|
if (cdrom[id].packet_status != CDROM_PHASE_COMPLETE)
|
||||||
{
|
{
|
||||||
@@ -3434,63 +3402,6 @@ atapi_out:
|
|||||||
/* cdrom_log("CD-ROM %i: Phase: %02X, request length: %i\n", cdrom[id].phase, cdrom[id].request_length); */
|
/* cdrom_log("CD-ROM %i: Phase: %02X, request length: %i\n", cdrom[id].phase, cdrom[id].request_length); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is for block reads. */
|
|
||||||
int cdrom_block_check(uint8_t id)
|
|
||||||
{
|
|
||||||
uint32_t alloc_length = 0;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
/* If this is a media access command, and we hit the end of the block but not the entire length,
|
|
||||||
read the next block. */
|
|
||||||
if (cdrom_is_media_access(id))
|
|
||||||
{
|
|
||||||
/* We have finished the current block. */
|
|
||||||
cdrom_log("CD-ROM %i: %i bytes total read, %i bytes all total\n", id, cdrom[id].total_read, cdrom[id].all_blocks_total);
|
|
||||||
if (cdrom[id].total_read >= cdrom[id].all_blocks_total)
|
|
||||||
{
|
|
||||||
cdrom_log("CD-ROM %i: %i bytes read, current block finished\n", id, cdrom[id].total_read);
|
|
||||||
/* Read the next block. */
|
|
||||||
ret = cdrom_read_blocks(id, &alloc_length, 0);
|
|
||||||
if (ret == -1)
|
|
||||||
{
|
|
||||||
/* Return value is -1 - there are no further blocks to read. */
|
|
||||||
cdrom_log("CD-ROM %i: %i bytes read, no further blocks to read\n", id, cdrom[id].total_read);
|
|
||||||
cdrom[id].status = BUSY_STAT;
|
|
||||||
cdrom_buf_free(id);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (ret == 0)
|
|
||||||
{
|
|
||||||
/* Return value is 0 - an error has occurred. */
|
|
||||||
cdrom_log("CD-ROM %i: %i bytes read, error while reading blocks\n", id, cdrom[id].total_read);
|
|
||||||
cdrom[id].status = BUSY_STAT | (cdrom[id].status & ERR_STAT);
|
|
||||||
cdrom_buf_free(id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Return value is 1 - sectors have been read successfully. */
|
|
||||||
cdrom[id].pos = 0;
|
|
||||||
cdrom[id].all_blocks_total += cdrom[id].block_total;
|
|
||||||
cdrom_log("CD-ROM %i: %i bytes read, next block(s) read successfully, %i bytes are still left\n", id, cdrom[id].total_read, cdrom[id].all_blocks_total - cdrom[id].total_read);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Blocks not exhausted, tell the host to check for buffer length. */
|
|
||||||
cdrom_log("CD-ROM %i: Blocks not yet finished\n", id);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Not a media access command, ALWAYS do the callback. */
|
|
||||||
cdrom_log("CD-ROM %i: Not a media access command\n", id);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is the general ATAPI callback. */
|
/* This is the general ATAPI callback. */
|
||||||
void cdrom_callback(uint8_t id) /* Callback for non-Read CD commands */
|
void cdrom_callback(uint8_t id) /* Callback for non-Read CD commands */
|
||||||
{
|
{
|
||||||
@@ -3831,7 +3742,6 @@ uint32_t cdrom_read(uint8_t channel, int length)
|
|||||||
uint8_t id = atapi_cdrom_drives[channel];
|
uint8_t id = atapi_cdrom_drives[channel];
|
||||||
|
|
||||||
uint32_t temp = 0;
|
uint32_t temp = 0;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (id > CDROM_NUM)
|
if (id > CDROM_NUM)
|
||||||
{
|
{
|
||||||
@@ -3844,20 +3754,23 @@ uint32_t cdrom_read(uint8_t channel, int length)
|
|||||||
if (!cdbufferb)
|
if (!cdbufferb)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Make sure we return a 0 and don't attempt to read from the buffer if we're transferring bytes beyond it,
|
||||||
|
which can happen when issuing media access commands with an allocated length below minimum request length
|
||||||
|
(which is 1 sector = 2048 bytes). */
|
||||||
switch(length)
|
switch(length)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
temp = cdbufferb[cdrom[id].pos];
|
temp = (cdrom[id].pos < cdrom[id].packet_len) ? cdbufferb[cdrom[id].pos] : 0;
|
||||||
cdrom[id].pos++;
|
cdrom[id].pos++;
|
||||||
cdrom[id].request_pos++;
|
cdrom[id].request_pos++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
temp = cdbufferw[cdrom[id].pos >> 1];
|
temp = (cdrom[id].pos < cdrom[id].packet_len) ? cdbufferw[cdrom[id].pos >> 1] : 0;
|
||||||
cdrom[id].pos += 2;
|
cdrom[id].pos += 2;
|
||||||
cdrom[id].request_pos += 2;
|
cdrom[id].request_pos += 2;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
temp = cdbufferl[cdrom[id].pos >> 2];
|
temp = (cdrom[id].pos < cdrom[id].packet_len) ? cdbufferl[cdrom[id].pos >> 2] : 0;
|
||||||
cdrom[id].pos += 4;
|
cdrom[id].pos += 4;
|
||||||
cdrom[id].request_pos += 4;
|
cdrom[id].request_pos += 4;
|
||||||
break;
|
break;
|
||||||
@@ -3867,26 +3780,12 @@ uint32_t cdrom_read(uint8_t channel, int length)
|
|||||||
|
|
||||||
if (cdrom[id].packet_status == CDROM_PHASE_DATA_IN)
|
if (cdrom[id].packet_status == CDROM_PHASE_DATA_IN)
|
||||||
{
|
{
|
||||||
cdrom[id].total_read += length;
|
if (cdrom[id].request_pos >= cdrom[id].request_length)
|
||||||
ret = cdrom_block_check(id);
|
|
||||||
/* If the block check has returned 0, this means all the requested blocks have been read, therefore the command has finished. */
|
|
||||||
if (ret)
|
|
||||||
{
|
{
|
||||||
cdrom_log("CD-ROM %i: Return value is 1 (request length: %i)\n", id, cdrom[id].request_length);
|
/* Time for a DRQ. */
|
||||||
if (cdrom[id].request_pos >= cdrom[id].request_length)
|
cdrom_log("CD-ROM %i: Issuing read callback\n", id);
|
||||||
{
|
cdrom[id].total_read += cdrom[id].request_length;
|
||||||
/* Time for a DRQ. */
|
cdrom_callback(id);
|
||||||
cdrom_log("CD-ROM %i: Issuing read callback\n", id);
|
|
||||||
cdrom_callback(id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cdrom_log("CD-ROM %i: Doing nothing\n", id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cdrom_log("CD-ROM %i: Return value is 0\n", id);
|
|
||||||
}
|
}
|
||||||
cdrom_log("CD-ROM %i: Returning: %02X (buffer position: %i, request position: %i, total: %i)\n", id, temp, cdrom[id].pos, cdrom[id].request_pos, cdrom[id].total_read);
|
cdrom_log("CD-ROM %i: Returning: %02X (buffer position: %i, request position: %i, total: %i)\n", id, temp, cdrom[id].pos, cdrom[id].request_pos, cdrom[id].total_read);
|
||||||
return temp;
|
return temp;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* made by Adaptec, Inc. These controllers were designed for
|
* made by Adaptec, Inc. These controllers were designed for
|
||||||
* the ISA bus.
|
* the ISA bus.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_aha154x.c 1.0.31 2017/10/19
|
* Version: @(#)scsi_aha154x.c 1.0.32 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Original Buslogic version by SA1988 and Miran Grca.
|
* Original Buslogic version by SA1988 and Miran Grca.
|
||||||
@@ -547,15 +547,15 @@ aha_mca_write(int port, uint8_t val, void *priv)
|
|||||||
* pos[2]=111xxxxx = 7
|
* pos[2]=111xxxxx = 7
|
||||||
* pos[2]=000xxxxx = 0
|
* pos[2]=000xxxxx = 0
|
||||||
*/
|
*/
|
||||||
dev->HostID = (dev->pos_regs[2] >> 5) & 0x07;
|
dev->HostID = (dev->pos_regs[4] >> 5) & 0x07;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SYNC mode is pos[2]=xxxx1xxx.
|
* SYNC mode is pos[2]=xxxx1xxx.
|
||||||
*
|
*
|
||||||
* SCSI Parity is pos[2]=xxx1xxxx.
|
* SCSI Parity is pos[2]=xxx1xxxx.
|
||||||
*/
|
*/
|
||||||
dev->sync = (dev->pos_regs[2] >> 3) & 1;
|
dev->sync = (dev->pos_regs[4] >> 3) & 1;
|
||||||
dev->parity = (dev->pos_regs[2] >> 4) & 1;
|
dev->parity = (dev->pos_regs[4] >> 4) & 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The PS/2 Model 80 BIOS always enables a card if it finds one,
|
* The PS/2 Model 80 BIOS always enables a card if it finds one,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* 1 - BT-545S ISA;
|
* 1 - BT-545S ISA;
|
||||||
* 2 - BT-958D PCI
|
* 2 - BT-958D PCI
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_buslogic.c 1.0.24 2017/10/16
|
* Version: @(#)scsi_buslogic.c 1.0.25 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -1295,12 +1295,16 @@ buslogic_mca_write(int port, uint8_t val, void *priv)
|
|||||||
x54x_io_remove(dev, dev->Base);
|
x54x_io_remove(dev, dev->Base);
|
||||||
|
|
||||||
/* Get the new assigned I/O base address. */
|
/* Get the new assigned I/O base address. */
|
||||||
dev->Base = dev->pos_regs[1] << 8;
|
if (dev->pos_regs[3]) {
|
||||||
dev->Base |= ((dev->pos_regs[0] & 0x10) ? 4 : 0);
|
dev->Base = dev->pos_regs[3] << 8;
|
||||||
|
dev->Base |= ((dev->pos_regs[2] & 0x10) ? 4 : 0);
|
||||||
|
} else {
|
||||||
|
dev->Base = 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the new IRQ and DMA channel values. */
|
/* Save the new IRQ and DMA channel values. */
|
||||||
dev->Irq = ((dev->pos_regs[0] >> 1) & 0x07) + 8;
|
dev->Irq = ((dev->pos_regs[2] >> 1) & 0x07) + 8;
|
||||||
dev->DmaChannel = dev->pos_regs[3] & 0x0f;
|
dev->DmaChannel = dev->pos_regs[5] & 0x0f;
|
||||||
|
|
||||||
/* Extract the BIOS ROM address info. */
|
/* Extract the BIOS ROM address info. */
|
||||||
if (dev->pos_regs[0] & 0xe0) switch(dev->pos_regs[0] & 0xe0) {
|
if (dev->pos_regs[0] & 0xe0) switch(dev->pos_regs[0] & 0xe0) {
|
||||||
@@ -1347,7 +1351,7 @@ buslogic_mca_write(int port, uint8_t val, void *priv)
|
|||||||
* pos[2]=111xxxxx = 7
|
* pos[2]=111xxxxx = 7
|
||||||
* pos[2]=000xxxxx = 0
|
* pos[2]=000xxxxx = 0
|
||||||
*/
|
*/
|
||||||
dev->HostID = (dev->pos_regs[2] >> 5) & 0x07;
|
dev->HostID = (dev->pos_regs[4] >> 5) & 0x07;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SYNC mode is pos[2]=xxxxxx1x.
|
* SYNC mode is pos[2]=xxxxxx1x.
|
||||||
@@ -1358,14 +1362,14 @@ buslogic_mca_write(int port, uint8_t val, void *priv)
|
|||||||
*/
|
*/
|
||||||
/* Parity. */
|
/* Parity. */
|
||||||
HALR->structured.autoSCSIData.uSCSIConfiguration &= ~2;
|
HALR->structured.autoSCSIData.uSCSIConfiguration &= ~2;
|
||||||
HALR->structured.autoSCSIData.uSCSIConfiguration |= (dev->pos_regs[2] & 2);
|
HALR->structured.autoSCSIData.uSCSIConfiguration |= (dev->pos_regs[4] & 2);
|
||||||
|
|
||||||
/* Sync. */
|
/* Sync. */
|
||||||
HALR->structured.autoSCSIData.u16SynchronousPermittedMask = (dev->pos_regs[2] & 0x10) ? 0xffff : 0x0000;
|
HALR->structured.autoSCSIData.u16SynchronousPermittedMask = (dev->pos_regs[4] & 0x10) ? 0xffff : 0x0000;
|
||||||
|
|
||||||
/* DOS Disk Space > 1GBytes */
|
/* DOS Disk Space > 1GBytes */
|
||||||
HALR->structured.autoSCSIData.uBIOSConfiguration &= ~4;
|
HALR->structured.autoSCSIData.uBIOSConfiguration &= ~4;
|
||||||
HALR->structured.autoSCSIData.uBIOSConfiguration |= (dev->pos_regs[2] & 8) ? 4 : 0;
|
HALR->structured.autoSCSIData.uBIOSConfiguration |= (dev->pos_regs[4] & 8) ? 4 : 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The PS/2 Model 80 BIOS always enables a card if it finds one,
|
* The PS/2 Model 80 BIOS always enables a card if it finds one,
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void pc87306_write(uint16_t port, uint8_t val, void *priv)
|
|||||||
{
|
{
|
||||||
val = 0x4b;
|
val = 0x4b;
|
||||||
}
|
}
|
||||||
if (pc87306_curreg <= 28) valxor = val ^ pc87306_regs[pc87306_curreg];
|
valxor = val ^ pc87306_regs[pc87306_curreg];
|
||||||
tries = 0;
|
tries = 0;
|
||||||
if ((pc87306_curreg == 0x19) && !(pc87306_regs[0x1B] & 0x40))
|
if ((pc87306_curreg == 0x19) && !(pc87306_regs[0x1B] & 0x40))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of the old and new IBM CGA graphics cards.
|
* Emulation of the old and new IBM CGA graphics cards.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_cga.c 1.0.7 2017/10/18
|
* Version: @(#)vid_cga.c 1.0.8 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -411,7 +411,7 @@ void cga_poll(void *p)
|
|||||||
if (cga->composite)
|
if (cga->composite)
|
||||||
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||||
else
|
else
|
||||||
video_blit_memtoscreen_8(0, cga->firstline - 4, xsize, (cga->lastline - cga->firstline) + 8);
|
video_blit_memtoscreen_8(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Plantronics ColorPlus emulation.
|
* Plantronics ColorPlus emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_colorplus.c 1.0.3 2017/10/18
|
* Version: @(#)vid_colorplus.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -327,7 +327,7 @@ void colorplus_poll(void *p)
|
|||||||
if (colorplus->cga.composite)
|
if (colorplus->cga.composite)
|
||||||
video_blit_memtoscreen(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
video_blit_memtoscreen(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
||||||
else
|
else
|
||||||
video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* MDSI Genius VHR emulation.
|
* MDSI Genius VHR emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_genius.c 1.0.3 2017/10/18
|
* Version: @(#)vid_genius.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -562,7 +562,7 @@ void genius_poll(void *p)
|
|||||||
if (video_force_resize_get())
|
if (video_force_resize_get())
|
||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
video_blit_memtoscreen_8(0, 0, xsize, ysize);
|
video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize);
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
/* Fixed 728x1008 resolution */
|
/* Fixed 728x1008 resolution */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Hercules emulation.
|
* Hercules emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_hercules.c 1.0.4 2017/10/18
|
* Version: @(#)vid_hercules.c 1.0.5 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -295,7 +295,7 @@ void hercules_poll(void *p)
|
|||||||
if (video_force_resize_get())
|
if (video_force_resize_get())
|
||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
video_blit_memtoscreen_8(0, hercules->firstline, xsize, ysize);
|
video_blit_memtoscreen_8(0, hercules->firstline, 0, ysize, xsize, ysize);
|
||||||
frames++;
|
frames++;
|
||||||
if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1))
|
if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* MDA emulation.
|
* MDA emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_mda.c 1.0.4 2017/10/18
|
* Version: @(#)vid_mda.c 1.0.5 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -254,7 +254,7 @@ void mda_poll(void *p)
|
|||||||
if (video_force_resize_get())
|
if (video_force_resize_get())
|
||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
video_blit_memtoscreen_8(0, mda->firstline, xsize, mda->lastline - mda->firstline);
|
video_blit_memtoscreen_8(0, mda->firstline, 0, ysize, xsize, ysize);
|
||||||
frames++;
|
frames++;
|
||||||
video_res_x = mda->crtc[1];
|
video_res_x = mda->crtc[1];
|
||||||
video_res_y = mda->crtc[6];
|
video_res_y = mda->crtc[6];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Olivetti M24 video emulation- essentially double-res CGA.
|
* Olivetti M24 video emulation- essentially double-res CGA.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_olivetti_m24.c 1.0.3 2017/10/18
|
* Version: @(#)vid_olivetti_m24.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -416,7 +416,7 @@ void m24_poll(void *p)
|
|||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16);
|
video_blit_memtoscreen_8(0, m24->firstline - 8, 0, (m24->lastline - m24->firstline) + 16, xsize, (m24->lastline - m24->firstline) + 16);
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* time as between 12 and 46 cycles. We currently always use
|
* time as between 12 and 46 cycles. We currently always use
|
||||||
* the lower number.
|
* the lower number.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_pc1512.c 1.0.3 2017/10/18
|
* Version: @(#)vid_pc1512.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -425,7 +425,7 @@ static void pc1512_poll(void *p)
|
|||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8);
|
video_blit_memtoscreen_8(0, pc1512->firstline - 4, 0, (pc1512->lastline - pc1512->firstline) + 8, xsize, (pc1512->lastline - pc1512->firstline) + 8);
|
||||||
|
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
video_res_y = ysize;
|
video_res_y = ysize;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Video emulation for IBM PCjr.
|
* Video emulation for IBM PCjr.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_pcjr.c 1.0.3 2017/10/18
|
* Version: @(#)vid_pcjr.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -518,7 +518,7 @@ void pcjr_poll(void *p)
|
|||||||
if (pcjr->composite)
|
if (pcjr->composite)
|
||||||
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||||
else
|
else
|
||||||
video_blit_memtoscreen_8(0, pcjr->firstline-4, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
video_blit_memtoscreen_8(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of the Tandy Model 1000 video.
|
* Emulation of the Tandy Model 1000 video.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_tandy.c 1.0.2 2017/10/18
|
* Version: @(#)vid_tandy.c 1.0.3 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -555,7 +555,7 @@ void tandy_poll(void *p)
|
|||||||
if (tandy->composite)
|
if (tandy->composite)
|
||||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||||
else
|
else
|
||||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
video_blit_memtoscreen_8(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of the Tandy Model 1000/SL video.
|
* Emulation of the Tandy Model 1000/SL video.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_tandysl.c 1.0.3 2017/10/18
|
* Version: @(#)vid_tandysl.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -621,7 +621,7 @@ static void tandysl_poll(void *p)
|
|||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
video_blit_memtoscreen_8(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
video_res_x = xsize - 16;
|
video_res_x = xsize - 16;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Wyse-700 emulation.
|
* Wyse-700 emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)vid_wy700.c 1.0.3 2017/10/18
|
* Version: @(#)vid_wy700.c 1.0.4 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -871,7 +871,7 @@ void wy700_poll(void *p)
|
|||||||
if (video_force_resize_get())
|
if (video_force_resize_get())
|
||||||
video_force_resize_set(0);
|
video_force_resize_set(0);
|
||||||
}
|
}
|
||||||
video_blit_memtoscreen_8(0, 0, xsize, ysize);
|
video_blit_memtoscreen_8(0, 0, 0, ysize, xsize, ysize);
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
/* Fixed 1280x800 resolution */
|
/* Fixed 1280x800 resolution */
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
* W = 3 bus clocks
|
* W = 3 bus clocks
|
||||||
* L = 4 bus clocks
|
* L = 4 bus clocks
|
||||||
*
|
*
|
||||||
* Version: @(#)video.c 1.0.4 2017/10/18
|
* Version: @(#)video.c 1.0.5 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -179,7 +179,7 @@ PALETTE cgapal_mono[6] = {
|
|||||||
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int x, y, y1, y2, w, h, blit8;
|
int x, y, y1, y2, w, h;
|
||||||
int busy;
|
int busy;
|
||||||
int buffer_in_use;
|
int buffer_in_use;
|
||||||
|
|
||||||
@@ -191,7 +191,6 @@ static struct {
|
|||||||
|
|
||||||
|
|
||||||
static void (*blit_func)(int x, int y, int y1, int y2, int w, int h);
|
static void (*blit_func)(int x, int y, int y1, int y2, int w, int h);
|
||||||
static void (*blit8_func)(int x, int y, int w, int h);
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
@@ -201,10 +200,7 @@ void blit_thread(void *param)
|
|||||||
thread_wait_event(blit_data.wake_blit_thread, -1);
|
thread_wait_event(blit_data.wake_blit_thread, -1);
|
||||||
thread_reset_event(blit_data.wake_blit_thread);
|
thread_reset_event(blit_data.wake_blit_thread);
|
||||||
|
|
||||||
if (blit_data.blit8)
|
blit_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
||||||
blit8_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h);
|
|
||||||
else
|
|
||||||
blit_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
|
||||||
|
|
||||||
blit_data.busy = 0;
|
blit_data.busy = 0;
|
||||||
thread_set_event(blit_data.blit_complete);
|
thread_set_event(blit_data.blit_complete);
|
||||||
@@ -213,10 +209,9 @@ void blit_thread(void *param)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
video_setblit(void(*blit8)(int,int,int,int),void(*blit)(int,int,int,int,int,int))
|
video_setblit(void(*blit)(int,int,int,int,int,int))
|
||||||
{
|
{
|
||||||
blit_func = blit;
|
blit_func = blit;
|
||||||
blit8_func = blit8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -262,27 +257,28 @@ video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||||||
blit_data.y2 = y2;
|
blit_data.y2 = y2;
|
||||||
blit_data.w = w;
|
blit_data.w = w;
|
||||||
blit_data.h = h;
|
blit_data.h = h;
|
||||||
blit_data.blit8 = 0;
|
|
||||||
|
|
||||||
thread_set_event(blit_data.wake_blit_thread);
|
thread_set_event(blit_data.wake_blit_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
video_blit_memtoscreen_8(int x, int y, int w, int h)
|
video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h)
|
||||||
{
|
{
|
||||||
|
int yy, xx;
|
||||||
|
|
||||||
if (h <= 0) return;
|
if (h <= 0) return;
|
||||||
|
|
||||||
video_wait_for_blit();
|
for (yy = 0; yy < h; yy++)
|
||||||
|
{
|
||||||
|
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||||
|
{
|
||||||
|
for (xx = 0; xx < w; xx++)
|
||||||
|
*(uint32_t *) &(buffer32->line[y + yy][(x + xx) << 2]) = pal_lookup[buffer->line[y + yy][x + xx]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
blit_data.busy = 1;
|
video_blit_memtoscreen(x, y, y1, y2, w, h);
|
||||||
blit_data.x = x;
|
|
||||||
blit_data.y = y;
|
|
||||||
blit_data.w = w;
|
|
||||||
blit_data.h = h;
|
|
||||||
blit_data.blit8 = 1;
|
|
||||||
|
|
||||||
thread_set_event(blit_data.wake_blit_thread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,10 +90,9 @@ extern char *video_get_internal_name(int card);
|
|||||||
extern int video_get_video_from_internal_name(char *s);
|
extern int video_get_video_from_internal_name(char *s);
|
||||||
|
|
||||||
|
|
||||||
extern void video_setblit(void(*blit8)(int,int,int,int),
|
extern void video_setblit(void(*blit)(int,int,int,int,int,int));
|
||||||
void(*blit)(int,int,int,int,int,int));
|
|
||||||
extern void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
extern void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||||
extern void video_blit_memtoscreen_8(int x, int y, int w, int h);
|
extern void video_blit_memtoscreen_8(int x, int y, int y1, int y2, int w, int h);
|
||||||
extern void video_blit_complete(void);
|
extern void video_blit_complete(void);
|
||||||
extern void video_wait_for_blit(void);
|
extern void video_wait_for_blit(void);
|
||||||
extern void video_wait_for_buffer(void);
|
extern void video_wait_for_buffer(void);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Direct3D 9 rendererer and screenshots taking.
|
* Direct3D 9 rendererer and screenshots taking.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_d3d.cc 1.0.4 2017/10/13
|
* Version: @(#)win_d3d.cc 1.0.5 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -33,7 +33,6 @@ void d3d_init_objects(void);
|
|||||||
void d3d_close_objects(void);
|
void d3d_close_objects(void);
|
||||||
|
|
||||||
static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||||
static void blit_memtoscreen_8(int x, int y, int w, int h);
|
|
||||||
|
|
||||||
static LPDIRECT3D9 d3d = NULL;
|
static LPDIRECT3D9 d3d = NULL;
|
||||||
static LPDIRECT3DDEVICE9 d3ddev = NULL;
|
static LPDIRECT3DDEVICE9 d3ddev = NULL;
|
||||||
@@ -101,7 +100,7 @@ int d3d_init(HWND h)
|
|||||||
|
|
||||||
d3d_init_objects();
|
d3d_init_objects();
|
||||||
|
|
||||||
video_setblit(blit_memtoscreen_8, blit_memtoscreen);
|
video_setblit(blit_memtoscreen);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -327,101 +326,6 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||||||
PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0);
|
PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blit_memtoscreen_8(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
VOID* pVoid;
|
|
||||||
D3DLOCKED_RECT dr;
|
|
||||||
RECT r;
|
|
||||||
int yy, xx;
|
|
||||||
HRESULT hr = D3D_OK;
|
|
||||||
|
|
||||||
if (h == 0)
|
|
||||||
{
|
|
||||||
video_blit_complete();
|
|
||||||
return; /*Nothing to do*/
|
|
||||||
}
|
|
||||||
|
|
||||||
r.top = 0;
|
|
||||||
r.left = 0;
|
|
||||||
r.bottom = h;
|
|
||||||
r.right = 2047;
|
|
||||||
|
|
||||||
hr = d3dTexture->LockRect(0, &dr, &r, 0);
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
{
|
|
||||||
for (yy = 0; yy < h; yy++)
|
|
||||||
{
|
|
||||||
uint32_t *p = (uint32_t *)((uintptr_t)dr.pBits + (yy * dr.Pitch));
|
|
||||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
|
||||||
{
|
|
||||||
for (xx = 0; xx < w; xx++)
|
|
||||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
video_blit_complete();
|
|
||||||
|
|
||||||
d3dTexture->UnlockRect(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
video_blit_complete();
|
|
||||||
|
|
||||||
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2048.0;
|
|
||||||
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;//0.5 / 2048.0;
|
|
||||||
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2048.0;
|
|
||||||
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2048.0;
|
|
||||||
d3d_verts[0].color = d3d_verts[1].color = d3d_verts[2].color =
|
|
||||||
d3d_verts[3].color = d3d_verts[4].color = d3d_verts[5].color =
|
|
||||||
d3d_verts[6].color = d3d_verts[7].color = d3d_verts[8].color =
|
|
||||||
d3d_verts[9].color = d3d_verts[10].color = d3d_verts[11].color = 0xffffff;
|
|
||||||
|
|
||||||
GetClientRect(d3d_hwnd, &r);
|
|
||||||
d3d_verts[0].x = d3d_verts[2].x = d3d_verts[3].x = -0.5;
|
|
||||||
d3d_verts[0].y = d3d_verts[3].y = d3d_verts[4].y = -0.5;
|
|
||||||
d3d_verts[1].x = d3d_verts[4].x = d3d_verts[5].x = (r.right - r.left) - 0.5;
|
|
||||||
d3d_verts[1].y = d3d_verts[2].y = d3d_verts[5].y = (r.bottom - r.top) - 0.5;
|
|
||||||
d3d_verts[6].x = d3d_verts[8].x = d3d_verts[9].x = (r.right - r.left) - 40.5;
|
|
||||||
d3d_verts[6].y = d3d_verts[9].y = d3d_verts[10].y = 8.5;
|
|
||||||
d3d_verts[7].x = d3d_verts[10].x = d3d_verts[11].x = (r.right - r.left) - 8.5;
|
|
||||||
d3d_verts[7].y = d3d_verts[8].y = d3d_verts[11].y = 14.5;
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0); // lock the vertex buffer
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
memcpy(pVoid, d3d_verts, sizeof(d3d_verts)); // copy the vertices to the locked buffer
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = v_buffer->Unlock(); // unlock the vertex buffer
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->BeginScene();
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
{
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetTexture(0, d3dTexture);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetTexture(0, NULL);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->EndScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->Present(NULL, NULL, d3d_hwnd, NULL);
|
|
||||||
|
|
||||||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
|
||||||
PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void d3d_take_screenshot(wchar_t *fn)
|
void d3d_take_screenshot(wchar_t *fn)
|
||||||
{
|
{
|
||||||
LPDIRECT3DSURFACE9 d3dSurface = NULL;
|
LPDIRECT3DSURFACE9 d3dSurface = NULL;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Direct3D 9 full-screen rendererer.
|
* Direct3D 9 full-screen rendererer.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_d3d_fs.cc 1.0.6 2017/10/13
|
* Version: @(#)win_d3d_fs.cc 1.0.7 2017/10/22
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -36,7 +36,6 @@ extern "C" void d3d_fs_take_screenshot(wchar_t *fn);
|
|||||||
static void d3d_fs_init_objects(void);
|
static void d3d_fs_init_objects(void);
|
||||||
static void d3d_fs_close_objects(void);
|
static void d3d_fs_close_objects(void);
|
||||||
static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||||
static void blit_memtoscreen_8(int x, int y, int w, int h);
|
|
||||||
|
|
||||||
|
|
||||||
static LPDIRECT3D9 d3d = NULL;
|
static LPDIRECT3D9 d3d = NULL;
|
||||||
@@ -130,7 +129,7 @@ int d3d_fs_init(HWND h)
|
|||||||
|
|
||||||
d3d_fs_init_objects();
|
d3d_fs_init_objects();
|
||||||
|
|
||||||
video_setblit(blit_memtoscreen_8, blit_memtoscreen);
|
video_setblit(blit_memtoscreen);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -416,124 +415,6 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||||||
PostMessage(hwndMain, WM_RESETD3D, 0, 0);
|
PostMessage(hwndMain, WM_RESETD3D, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blit_memtoscreen_8(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
HRESULT hr = D3D_OK;
|
|
||||||
VOID* pVoid;
|
|
||||||
D3DLOCKED_RECT dr;
|
|
||||||
RECT window_rect;
|
|
||||||
int xx, yy;
|
|
||||||
double l = 0, t = 0, r = 0, b = 0;
|
|
||||||
|
|
||||||
if (!h)
|
|
||||||
{
|
|
||||||
video_blit_complete();
|
|
||||||
return; /*Nothing to do*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
{
|
|
||||||
RECT lock_rect;
|
|
||||||
|
|
||||||
lock_rect.top = 0;
|
|
||||||
lock_rect.left = 0;
|
|
||||||
lock_rect.bottom = 2047;
|
|
||||||
lock_rect.right = 2047;
|
|
||||||
|
|
||||||
hr = d3dTexture->LockRect(0, &dr, &lock_rect, 0);
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
{
|
|
||||||
for (yy = 0; yy < h; yy++)
|
|
||||||
{
|
|
||||||
uint32_t *p = (uint32_t *)((uintptr_t)dr.pBits + (yy * dr.Pitch));
|
|
||||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
|
||||||
{
|
|
||||||
for (xx = 0; xx < w; xx++)
|
|
||||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
video_blit_complete();
|
|
||||||
d3dTexture->UnlockRect(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
video_blit_complete();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
video_blit_complete();
|
|
||||||
|
|
||||||
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;
|
|
||||||
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;
|
|
||||||
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2048.0;
|
|
||||||
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2048.0;
|
|
||||||
d3d_verts[0].color = d3d_verts[1].color = d3d_verts[2].color =
|
|
||||||
d3d_verts[3].color = d3d_verts[4].color = d3d_verts[5].color =
|
|
||||||
d3d_verts[6].color = d3d_verts[7].color = d3d_verts[8].color =
|
|
||||||
d3d_verts[9].color = d3d_verts[10].color = d3d_verts[11].color = 0xffffff;
|
|
||||||
|
|
||||||
GetClientRect(d3d_device_window, &window_rect);
|
|
||||||
d3d_fs_size(window_rect, &l, &t, &r, &b, w, h);
|
|
||||||
|
|
||||||
d3d_verts[0].x = l;
|
|
||||||
d3d_verts[0].y = t;
|
|
||||||
d3d_verts[1].x = r;
|
|
||||||
d3d_verts[1].y = b;
|
|
||||||
d3d_verts[2].x = l;
|
|
||||||
d3d_verts[2].y = b;
|
|
||||||
d3d_verts[3].x = l;
|
|
||||||
d3d_verts[3].y = t;
|
|
||||||
d3d_verts[4].x = r;
|
|
||||||
d3d_verts[4].y = t;
|
|
||||||
d3d_verts[5].x = r;
|
|
||||||
d3d_verts[5].y = b;
|
|
||||||
d3d_verts[6].x = d3d_verts[8].x = d3d_verts[9].x = r - 40.5;
|
|
||||||
d3d_verts[6].y = d3d_verts[9].y = d3d_verts[10].y = t + 8.5;
|
|
||||||
d3d_verts[7].x = d3d_verts[10].x = d3d_verts[11].x = r - 8.5;
|
|
||||||
d3d_verts[7].y = d3d_verts[8].y = d3d_verts[11].y = t + 14.5;
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0);
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
memcpy(pVoid, d3d_verts, sizeof(d3d_verts));
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = v_buffer->Unlock();
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->BeginScene();
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
{
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0, 0);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetTexture(0, d3dTexture);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->SetTexture(0, NULL);
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->EndScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hr == D3D_OK)
|
|
||||||
hr = d3ddev->Present(NULL, NULL, d3d_device_window, NULL);
|
|
||||||
|
|
||||||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
|
||||||
PostMessage(hwndMain, WM_RESETD3D, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void d3d_fs_take_screenshot(wchar_t *fn)
|
void d3d_fs_take_screenshot(wchar_t *fn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -236,70 +236,6 @@ blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
blit_memtoscreen_8(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
RECT r_src;
|
|
||||||
RECT r_dest;
|
|
||||||
int xx, yy;
|
|
||||||
POINT po;
|
|
||||||
uint32_t *p;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
if (lpdds_back == NULL) {
|
|
||||||
video_blit_complete();
|
|
||||||
return; /*Nothing to do*/
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
hr = lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
|
||||||
if (hr == DDERR_SURFACELOST) {
|
|
||||||
lpdds_back->Restore();
|
|
||||||
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
|
||||||
device_force_redraw();
|
|
||||||
}
|
|
||||||
if (!ddsd.lpSurface) {
|
|
||||||
video_blit_complete();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (yy = 0; yy < h; yy++) {
|
|
||||||
if ((y + yy) >= 0 && (y + yy) < buffer->h) {
|
|
||||||
p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
|
|
||||||
for (xx = 0; xx < w; xx++)
|
|
||||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = &(((uint32_t *) ddsd.lpSurface)[4 * ddsd.lPitch]);
|
|
||||||
lpdds_back->Unlock(NULL);
|
|
||||||
video_blit_complete();
|
|
||||||
|
|
||||||
po.x = po.y = 0;
|
|
||||||
ClientToScreen(ddraw_hwnd, &po);
|
|
||||||
GetClientRect(ddraw_hwnd, &r_dest);
|
|
||||||
OffsetRect(&r_dest, po.x, po.y);
|
|
||||||
|
|
||||||
r_src.left = 0;
|
|
||||||
r_src.top = 0;
|
|
||||||
r_src.right = w;
|
|
||||||
r_src.bottom = h;
|
|
||||||
|
|
||||||
hr = lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
if (hr == DDERR_SURFACELOST) {
|
|
||||||
lpdds_back2->Restore();
|
|
||||||
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
if (hr == DDERR_SURFACELOST) {
|
|
||||||
lpdds_pri->Restore();
|
|
||||||
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ddraw_init(HWND h)
|
ddraw_init(HWND h)
|
||||||
{
|
{
|
||||||
@@ -361,7 +297,7 @@ ddraw_init(HWND h)
|
|||||||
|
|
||||||
ddraw_hwnd = h;
|
ddraw_hwnd = h;
|
||||||
|
|
||||||
video_setblit(blit_memtoscreen_8, blit_memtoscreen);
|
video_setblit(blit_memtoscreen);
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ extern void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSu
|
|||||||
|
|
||||||
|
|
||||||
static void blit_memtoscreen(int, int, int, int, int, int);
|
static void blit_memtoscreen(int, int, int, int, int, int);
|
||||||
static void blit_memtoscreen_8(int, int, int, int);
|
|
||||||
|
|
||||||
|
|
||||||
int ddraw_fs_init(HWND h)
|
int ddraw_fs_init(HWND h)
|
||||||
@@ -92,7 +91,7 @@ int ddraw_fs_init(HWND h)
|
|||||||
pclog("DDRAW_INIT complete\n");
|
pclog("DDRAW_INIT complete\n");
|
||||||
ddraw_hwnd = h;
|
ddraw_hwnd = h;
|
||||||
|
|
||||||
video_setblit(blit_memtoscreen_8, blit_memtoscreen);
|
video_setblit(blit_memtoscreen);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -244,77 +243,6 @@ static void blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blit_memtoscreen_8(int x, int y, int w, int h)
|
|
||||||
{
|
|
||||||
RECT r_src;
|
|
||||||
RECT r_dest;
|
|
||||||
RECT window_rect;
|
|
||||||
int xx, yy;
|
|
||||||
HRESULT hr;
|
|
||||||
DDBLTFX ddbltfx;
|
|
||||||
|
|
||||||
if (lpdds_back == NULL)
|
|
||||||
{
|
|
||||||
video_blit_complete();
|
|
||||||
return; /*Nothing to do*/
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
hr = lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
|
||||||
|
|
||||||
if (hr == DDERR_SURFACELOST)
|
|
||||||
{
|
|
||||||
lpdds_back->Restore();
|
|
||||||
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
|
||||||
device_force_redraw();
|
|
||||||
}
|
|
||||||
if (!ddsd.lpSurface)
|
|
||||||
{
|
|
||||||
video_blit_complete();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (yy = 0; yy < h; yy++)
|
|
||||||
{
|
|
||||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
|
||||||
{
|
|
||||||
uint32_t *p = (uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]);
|
|
||||||
for (xx = 0; xx < w; xx++)
|
|
||||||
{
|
|
||||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
video_blit_complete();
|
|
||||||
lpdds_back->Unlock(NULL);
|
|
||||||
|
|
||||||
window_rect.left = 0;
|
|
||||||
window_rect.top = 0;
|
|
||||||
window_rect.right = ddraw_w;
|
|
||||||
window_rect.bottom = ddraw_h;
|
|
||||||
ddraw_fs_size(window_rect, &r_dest, w, h);
|
|
||||||
|
|
||||||
r_src.left = 0;
|
|
||||||
r_src.top = 0;
|
|
||||||
r_src.right = w;
|
|
||||||
r_src.bottom = h;
|
|
||||||
|
|
||||||
ddbltfx.dwSize = sizeof(ddbltfx);
|
|
||||||
ddbltfx.dwFillColor = 0;
|
|
||||||
|
|
||||||
lpdds_back2->Blt(&window_rect, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
|
|
||||||
|
|
||||||
hr = lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
if (hr == DDERR_SURFACELOST)
|
|
||||||
{
|
|
||||||
lpdds_back2->Restore();
|
|
||||||
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ddraw_fs_pause(void)
|
ddraw_fs_pause(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user