Merge pull request #17 from 86Box/master

86box upstream master sync to immersicve86box master
This commit is contained in:
Toni Riikonen
2025-11-23 12:46:05 +02:00
committed by GitHub
187 changed files with 6257 additions and 4152 deletions

View File

@@ -338,7 +338,8 @@ strip_binary=strip
if is_windows
then
# Switch into the correct MSYSTEM if required.
msys=MINGW$arch
msys=UCRT$arch
[ ! -d "/$msys" ] && msys=MINGW$arch
[ ! -d "/$msys" ] && msys=CLANG$arch
if [ -d "/$msys" ]
then

View File

@@ -69,21 +69,21 @@ jobs:
# - msystem: MSYS
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "-MSYS64"
- msystem: MINGW64
prefix: mingw-w64-x86_64
toolchain: ./cmake/flags-gcc-x86_64.cmake
slug: "-64"
runner: windows-2022
# - msystem: MINGW64
# prefix: mingw-w64-x86_64
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "MINGW64"
# runner: windows-2022
# - msystem: CLANG64
# prefix: mingw-w64-clang-x86_64
# toolchain: ./cmake/llvm-win32-x86_64.cmake
# slug: "CLANG64"
# runner: windows-2022
# - msystem: UCRT64
# prefix: mingw-w64-ucrt-x86_64
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "UCRT64"
# runner: windows-2022
- msystem: UCRT64
prefix: mingw-w64-ucrt-x86_64
toolchain: ./cmake/flags-gcc-x86_64.cmake
slug: "-64"
runner: windows-2022
- msystem: CLANGARM64
toolchain: ./cmake/flags-gcc-aarch64.cmake
slug: -arm64

View File

@@ -83,21 +83,21 @@ jobs:
# - msystem: MSYS
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "-MSYS64"
- msystem: MINGW64
prefix: mingw-w64-x86_64
toolchain: ./cmake/flags-gcc-x86_64.cmake
slug: "-64"
runner: windows-2022
# - msystem: MINGW64
# prefix: mingw-w64-x86_64
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "MINGW64"
# runner: windows-2022
# - msystem: CLANG64
# prefix: mingw-w64-clang-x86_64
# toolchain: ./cmake/llvm-win32-x86_64.cmake
# slug: "CLANG64"
# runner: windows-2022
# - msystem: UCRT64
# prefix: mingw-w64-ucrt-x86_64
# toolchain: ./cmake/flags-gcc-x86_64.cmake
# slug: "UCRT64"
# runner: windows-2022
- msystem: UCRT64
prefix: mingw-w64-ucrt-x86_64
toolchain: ./cmake/flags-gcc-x86_64.cmake
slug: "-64"
runner: windows-2022
# - msystem: CLANGARM64
# toolchain: ./cmake/flags-gcc-aarch64.cmake
# slug: -arm64

View File

@@ -186,6 +186,7 @@ cmake_dependent_option(WACOM "Wacom Input Devices"
cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
cmake_dependent_option(NETSWITCH "Network Switch Support" ON "DEV_BRANCH" OFF)
cmake_dependent_option(VFIO "Virtual Function I/O" ON "DEV_BRANCH" OFF)
cmake_dependent_option(SOFTMODEM "AC'97 Softmodem" ON "DEV_BRANCH" OFF)
# Ditto but for Qt
if(QT)

View File

@@ -171,6 +171,7 @@ int vid_api = 0; /* (C) video r
int vid_cga_contrast = 0; /* (C) video */
int video_fullscreen = 0; /* (C) video */
int video_fullscreen_scale = 0; /* (C) video */
int fullscreen_ui_visible = 0; /* (C) video */
int enable_overscan = 0; /* (C) video */
int force_43 = 0; /* (C) video */
int video_filter_method = 1; /* (C) video */
@@ -262,6 +263,11 @@ struct accelKey def_acc_keys[NUM_ACCELS] = {
.desc="Toggle fullscreen",
.seq="Ctrl+Alt+PgUp"
},
{
.name="toggle_ui_fullscreen",
.desc="Toggle UI in fullscreen",
.seq="Ctrl+Alt+PgDown"
},
{
.name="screenshot",
.desc="Screenshot",
@@ -1744,7 +1750,7 @@ update_mouse_msg(void)
plat_get_string(STRING_MOUSE_CAPTURE));
swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i%%%% - %ls",
(mouse_get_buttons() > 2) ? plat_get_string(STRING_MOUSE_RELEASE) : plat_get_string(STRING_MOUSE_RELEASE_MMB));
wcsncpy(mouse_msg[2], L"%i.%i%%", sizeof_w(mouse_msg[2]));
wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2]));
#else
swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls",
EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu,

View File

@@ -218,25 +218,19 @@ cs8220_init(UNUSED(const device_t *info))
dev->ram_banks[0].virt = 0x00000000;
dev->ram_banks[0].phys = 0x00000000;
dev->ram_banks[0].size = 0x00080000;
dev->ram_banks[1].virt = 0x00080000;
dev->ram_banks[1].phys = 0x00080000;
dev->ram_banks[1].size = 0x00020000;
/* Pretend there's a 128k expansion. */
/* Pretend there's a 256k expansion. */
dev->ram_banks[2].virt = 0x00100000;
dev->ram_banks[2].phys = 0x00080000;
dev->ram_banks[2].size = 0x00020000;
dev->ram_banks[2].size = 0x00040000;
break;
case 896:
dev->ram_banks[0].virt = 0x00000000;
dev->ram_banks[0].phys = 0x00000000;
dev->ram_banks[0].size = 0x00080000;
dev->ram_banks[1].virt = 0x00080000;
dev->ram_banks[1].phys = 0x00080000;
dev->ram_banks[1].size = 0x00020000;
/* Pretend there's a 256k expansion. */
/* Pretend there's a 384k expansion. */
dev->ram_banks[2].virt = 0x00100000;
dev->ram_banks[2].phys = 0x00080000;
dev->ram_banks[2].size = 0x00040000;
dev->ram_banks[2].size = 0x00060000;
break;
case 1024:
dev->ram_banks[0].virt = 0x00000000;
@@ -248,23 +242,31 @@ cs8220_init(UNUSED(const device_t *info))
break;
}
if (dev->ram_banks[0].size > 0x00000000)
mem_set_mem_state(0x00000000, (mem_size << 10) + 0x00060000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
if (dev->ram_banks[0].size > 0x00000000) {
mem_mapping_add(&dev->ram_banks[0].mapping, dev->ram_banks[0].virt, dev->ram_banks[0].size,
cs8220_mem_read, cs8220_mem_readw, NULL,
cs8220_mem_write, cs8220_mem_writew, NULL,
ram + dev->ram_banks[0].phys, MEM_MAPPING_INTERNAL, &(dev->ram_banks[0]));
mem_set_mem_state(dev->ram_banks[0].virt, dev->ram_banks[0].size, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
}
if (dev->ram_banks[1].size > 0x00000000)
if (dev->ram_banks[1].size > 0x00000000) {
mem_mapping_add(&dev->ram_banks[1].mapping, dev->ram_banks[1].virt, dev->ram_banks[1].size,
cs8220_mem_read, cs8220_mem_readw, NULL,
cs8220_mem_write, cs8220_mem_writew, NULL,
ram + dev->ram_banks[1].phys, MEM_MAPPING_INTERNAL, &(dev->ram_banks[1]));
mem_set_mem_state(dev->ram_banks[1].virt, dev->ram_banks[1].size, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
}
if (dev->ram_banks[2].size > 0x00000000)
if (dev->ram_banks[2].size > 0x00000000) {
mem_mapping_add(&dev->ram_banks[2].mapping, dev->ram_banks[2].virt, dev->ram_banks[2].size,
cs8220_mem_read, cs8220_mem_readw, NULL,
cs8220_mem_write, cs8220_mem_writew, NULL,
ram + dev->ram_banks[2].phys, MEM_MAPPING_INTERNAL, &(dev->ram_banks[2]));
mem_set_mem_state(dev->ram_banks[2].virt, dev->ram_banks[2].size, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
}
io_sethandler(0x00a4, 0x0002,
cs8220_in, NULL, NULL, cs8220_out, NULL, NULL, dev);

View File

@@ -1376,13 +1376,12 @@ piix_reset_hard(piix_t *dev)
if (dev->type < 5)
fregs[0x20] = 0x01;
fregs[0x3d] = 0x04;
if (dev->type > 4)
fregs[0x60] = (dev->type > 3) ? 0x10 : 0x00;
if (dev->type < 5) {
fregs[0x60] = (dev->type > 3) ? 0x10 : 0x00;
fregs[0x6a] = (dev->type == 3) ? 0x01 : 0x00;
fregs[0xc1] = 0x20;
fregs[0xff] = (dev->type > 3) ? 0x10 : 0x00;
}
} else
dev->max_func = 2; /* It starts with USB disabled, then enables it. */
}

View File

@@ -92,7 +92,7 @@ typedef struct ram_struct_t {
int bank;
} ram_struct_t;
typedef struct card_mem_t {
typedef struct mem_page_t {
int in_ram;
uint32_t virt_addr;
uint32_t phys_addr;
@@ -124,10 +124,6 @@ typedef struct scamp_t {
mem_mapping_t mem_mappings[64]; /* The entire first 1 MB of memory space. */
mem_page_t mem_pages[64];
uint32_t card_mem_size;
uint8_t *card_mem;
mem_page_t card_pages[4];
port_92_t *port_92;
} scamp_t;
@@ -1180,14 +1176,6 @@ scamp_init(UNUSED(const device_t *info))
}
}
dev->card_mem = NULL;
for (uint8_t i = 0; i < 4; i++) {
dev->card_pages[i].virt_addr = i * EMS_PGSIZE;
dev->card_pages[i].phys_addr = dev->card_pages[i].virt_addr;
dev->card_pages[i].mem = dev->card_mem + dev->card_pages[i].phys_addr;
}
dev->port_92 = device_add(&port_92_device);
return dev;

View File

@@ -392,7 +392,6 @@ sis_5571_host_to_pci_reset(void *priv)
dev->pci_conf[0x91] = 0x00;
dev->pci_conf[0x92] = 0x00;
dev->pci_conf[0x93] = 0x00;
dev->pci_conf[0x93] = 0x00;
dev->pci_conf[0x94] = 0x00;
dev->pci_conf[0x95] = 0x00;
dev->pci_conf[0x96] = 0x00;

View File

@@ -348,7 +348,7 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
case 0x58:
if ((dev->id >= VIA_585) || (dev->id < VIA_597) || (dev->id == VIA_597) || ((dev->id >= VIA_693A) || (dev->id < VIA_8601)))
if ((dev->id >= VIA_585) || (dev->id < VIA_597) || (dev->id == VIA_597) || ((dev->id >= VIA_693A) && (dev->id < VIA_8601)))
dev->pci_conf[0x58] = (dev->pci_conf[0x58] & ~0xee) | (val & 0xee);
else
dev->pci_conf[0x58] = val;
@@ -501,14 +501,14 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
break;
case 0x69:
if ((dev->id != VIA_585) || (dev->id != VIA_595)) {
if ((dev->id == VIA_693A) || (dev->id < VIA_8601))
if ((dev->id == VIA_693A) && (dev->id < VIA_8601))
dev->pci_conf[0x69] = (dev->pci_conf[0x69] & ~0xfe) | (val & 0xfe);
else
dev->pci_conf[0x69] = val;
}
break;
case 0x6b:
if ((dev->id == VIA_693A) || (dev->id < VIA_8601))
if ((dev->id == VIA_693A) && (dev->id < VIA_8601))
dev->pci_conf[0x6b] = val;
else if (dev->id == VIA_691)
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xcf) | (val & 0xcf);
@@ -520,7 +520,7 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv)
dev->pci_conf[0x6b] = (dev->pci_conf[0x6b] & ~0xc1) | (val & 0xc1);
break;
case 0x6c:
if ((dev->id == VIA_597) || ((dev->id == VIA_693A) || (dev->id < VIA_8601)))
if ((dev->id == VIA_597) || ((dev->id == VIA_693A) && (dev->id < VIA_8601)))
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x1f) | (val & 0x1f);
else if (dev->id == VIA_598)
dev->pci_conf[0x6c] = (dev->pci_conf[0x6c] & ~0x7f) | (val & 0x7f);

View File

@@ -987,7 +987,7 @@ pipc_read(int func, int addr, void *priv)
}
} else if ((func <= (pm_func + 2)) && !(dev->pci_isa_regs[0x85] & ((func == (pm_func + 1)) ? 0x04 : 0x08))) { /* AC97 / MC97 */
if (addr == 0x40)
ret = ac97_via_read_status(dev->ac97, func - pm_func - 1);
ret = ac97_via_read_status(dev->ac97);
else
ret = dev->ac97_regs[func - pm_func - 1][addr];
}
@@ -1583,7 +1583,7 @@ pipc_write(int func, int addr, uint8_t val, void *priv)
case 0x41:
dev->ac97_regs[func][addr] = val;
ac97_via_write_control(dev->ac97, func, val);
ac97_via_write_control(dev->ac97, val);
break;
case 0x42:

View File

@@ -102,6 +102,10 @@
# define OPCODE_SUB_LSR (0x25a << 21)
# define OPCODE_SUBX_LSL (0x658 << 21)
# define OPCODE_INS_B (0x6e010400)
# define OPCODE_INS_H (0x6e020400)
# define OPCODE_INS_S (0x6e040400)
# define OPCODE_INS_D (0x6e080400)
# define OPCODE_ADD_V8B (0x0e208400)
# define OPCODE_ADD_V4H (0x0e608400)
# define OPCODE_ADD_V2S (0x0ea08400)
@@ -180,6 +184,7 @@
# define OPCODE_SQSUB_V8B (0x0e202c00)
# define OPCODE_SQSUB_V4H (0x0e602c00)
# define OPCODE_SQXTN_V8B_8H (0x0e214800)
# define OPCODE_SQXTUN_V8B_8H (0x2e212800)
# define OPCODE_SQXTN_V4H_4S (0x0e614800)
# define OPCODE_SHL_VD (0x0f005400)
# define OPCODE_SHL_VQ (0x4f005400)
@@ -207,6 +212,7 @@
# define OPCODE_ZIP1_V8B (0x0e003800)
# define OPCODE_ZIP1_V4H (0x0e403800)
# define OPCODE_ZIP1_V2S (0x0e803800)
# define OPCODE_ZIP1_V2D (0x4ec03800)
# define OPCODE_ZIP2_V8B (0x0e007800)
# define OPCODE_ZIP2_V4H (0x0e407800)
# define OPCODE_ZIP2_V2S (0x0e807800)
@@ -225,11 +231,11 @@
# define IMM_LOGICAL(imm) ((imm) << 10)
# define BIT_TBxZ(bit) ((((bit) &0x1f) << 19) | (((bit) &0x20) ? (1 << 31) : 0))
# define BIT_TBxZ(bit) ((((bit) & 0x1f) << 19) | (((bit) & 0x20) ? (1 << 31) : 0))
# define OFFSET14(offset) (((offset >> 2) << 5) & 0x0007ffe0)
# define OFFSET19(offset) (((offset >> 2) << 5) & 0x00ffffe0)
# define OFFSET20(offset) (((offset & 3) << 29) | ((((offset) &0x1fffff) >> 2) << 5))
# define OFFSET20(offset) (((offset & 3) << 29) | ((((offset) & 0x1fffff) >> 2) << 5))
# define OFFSET26(offset) ((offset >> 2) & 0x03ffffff)
# define OFFSET12_B(offset) (offset << 10)
@@ -716,6 +722,12 @@ host_arm64_DUP_V2S(codeblock_t *block, int dst_reg, int src_n_reg, int element)
codegen_addlong(block, OPCODE_DUP_V2S | Rd(dst_reg) | Rn(src_n_reg) | DUP_ELEMENT(element));
}
void
host_arm64_INS_D(codeblock_t *block, int dst_reg, int src_reg, int dst_index, int src_index)
{
codegen_addlong(block, OPCODE_INS_D | Rd(dst_reg) | Rn(src_reg) | ((dst_index & 1) << 20) | ((src_index & 1) << 14));
}
void
host_arm64_EOR_IMM(codeblock_t *block, int dst_reg, int src_n_reg, uint32_t imm_data)
{
@@ -1225,6 +1237,13 @@ host_arm64_SQXTN_V8B_8H(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_addlong(block, OPCODE_SQXTN_V8B_8H | Rd(dst_reg) | Rn(src_reg));
}
void
host_arm64_SQXTUN_V8B_8H(codeblock_t *block, int dst_reg, int src_reg)
{
codegen_addlong(block, OPCODE_SQXTUN_V8B_8H | Rd(dst_reg) | Rn(src_reg));
}
void
host_arm64_SQXTN_V4H_4S(codeblock_t *block, int dst_reg, int src_reg)
{
@@ -1475,6 +1494,11 @@ host_arm64_ZIP1_V2S(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_re
codegen_addlong(block, OPCODE_ZIP1_V2S | Rd(dst_reg) | Rn(src_n_reg) | Rm(src_m_reg));
}
void
host_arm64_ZIP1_V2D(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg)
{
codegen_addlong(block, OPCODE_ZIP1_V2D | Rd(dst_reg) | Rn(src_n_reg) | Rm(src_m_reg));
}
void
host_arm64_ZIP2_V8B(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg)
{
codegen_addlong(block, OPCODE_ZIP2_V8B | Rd(dst_reg) | Rn(src_n_reg) | Rm(src_m_reg));

View File

@@ -72,6 +72,7 @@ void host_arm64_CSEL_EQ(codeblock_t *block, int dst_reg, int src_n_reg, int src_
void host_arm64_CSEL_VS(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_DUP_V2S(codeblock_t *block, int dst_reg, int src_n_reg, int element);
void host_arm64_INS_D(codeblock_t *block, int dst_reg, int src_reg, int dst_index, int src_index);
void host_arm64_EOR_IMM(codeblock_t *block, int dst_reg, int src_n_reg, uint32_t imm_data);
void host_arm64_EOR_REG(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg, int shift);
@@ -184,6 +185,7 @@ void host_arm64_SQSUB_V8B(codeblock_t *block, int dst_reg, int src_n_reg, int sr
void host_arm64_SQSUB_V4H(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_SQXTN_V8B_8H(codeblock_t *block, int dst_reg, int src_reg);
void host_arm64_SQXTUN_V8B_8H(codeblock_t *block, int dst_reg, int src_reg);
void host_arm64_SQXTN_V4H_4S(codeblock_t *block, int dst_reg, int src_reg);
void host_arm64_SHL_V4H(codeblock_t *block, int dst_reg, int src_reg, int shift);
@@ -243,6 +245,7 @@ void host_arm64_USHR_V2D(codeblock_t *block, int dst_reg, int src_reg, int shift
void host_arm64_ZIP1_V8B(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP1_V4H(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP1_V2S(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP1_V2D(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP2_V8B(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP2_V4H(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);
void host_arm64_ZIP2_V2S(codeblock_t *block, int dst_reg, int src_n_reg, int src_m_reg);

View File

@@ -801,7 +801,8 @@ codegen_MMX_ENTER(codeblock_t *block, uop_t *uop)
host_arm64_STR_IMM_W(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.tag[0] - (uintptr_t) &cpu_state);
host_arm64_STR_IMM_W(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.tag[4] - (uintptr_t) &cpu_state);
host_arm64_STR_IMM_W(block, REG_WZR, REG_CPUSTATE, (uintptr_t) &cpu_state.TOP - (uintptr_t) &cpu_state);
host_arm64_STRB_IMM(block, REG_WZR, REG_CPUSTATE, (uintptr_t) &cpu_state.ismmx - (uintptr_t) &cpu_state);
host_arm64_AND_IMM(block, REG_TEMP, REG_TEMP, 1);
host_arm64_STRB_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.ismmx - (uintptr_t) &cpu_state);
return 0;
}
@@ -849,28 +850,28 @@ codegen_LOAD_FUNC_ARG3(codeblock_t *block, uop_t *uop)
static int
codegen_LOAD_FUNC_ARG0_IMM(codeblock_t *block, uop_t *uop)
{
host_arm64_mov_imm(block, REG_ARG0, uop->imm_data);
host_arm64_MOVX_IMM(block, REG_ARG0, uop->imm_data);
return 0;
}
static int
codegen_LOAD_FUNC_ARG1_IMM(codeblock_t *block, uop_t *uop)
{
host_arm64_mov_imm(block, REG_ARG1, uop->imm_data);
host_arm64_MOVX_IMM(block, REG_ARG1, uop->imm_data);
return 0;
}
static int
codegen_LOAD_FUNC_ARG2_IMM(codeblock_t *block, uop_t *uop)
{
host_arm64_mov_imm(block, REG_ARG2, uop->imm_data);
host_arm64_MOVX_IMM(block, REG_ARG2, uop->imm_data);
return 0;
}
static int
codegen_LOAD_FUNC_ARG3_IMM(codeblock_t *block, uop_t *uop)
{
host_arm64_mov_imm(block, REG_ARG3, uop->imm_data);
host_arm64_MOVX_IMM(block, REG_ARG3, uop->imm_data);
return 0;
}
@@ -1448,9 +1449,9 @@ codegen_PACKSSWB(codeblock_t *block, uop_t *uop)
int src_size_b = IREG_GET_SIZE(uop->src_reg_b_real);
if (REG_IS_Q(dest_size) && REG_IS_Q(src_size_b) && uop->dest_reg_a_real == uop->src_reg_a_real) {
host_arm64_SQXTN_V8B_8H(block, REG_V_TEMP, src_reg_b);
host_arm64_SQXTN_V8B_8H(block, dest_reg, dest_reg);
host_arm64_ZIP1_V2S(block, dest_reg, dest_reg, REG_V_TEMP);
host_arm64_INS_D(block, REG_V_TEMP, dest_reg, 0, 0);
host_arm64_INS_D(block, REG_V_TEMP, src_reg_b, 1, 0);
host_arm64_SQXTN_V8B_8H(block, dest_reg, REG_V_TEMP);
} else
fatal("PACKSSWB %02x %02x %02x\n", uop->dest_reg_a_real, uop->src_reg_a_real, uop->src_reg_b_real);
@@ -1465,9 +1466,9 @@ codegen_PACKSSDW(codeblock_t *block, uop_t *uop)
int src_size_b = IREG_GET_SIZE(uop->src_reg_b_real);
if (REG_IS_Q(dest_size) && REG_IS_Q(src_size_b) && uop->dest_reg_a_real == uop->src_reg_a_real) {
host_arm64_SQXTN_V4H_4S(block, REG_V_TEMP, src_reg_b);
host_arm64_SQXTN_V4H_4S(block, dest_reg, dest_reg);
host_arm64_ZIP1_V2S(block, dest_reg, dest_reg, REG_V_TEMP);
host_arm64_INS_D(block, REG_V_TEMP, dest_reg, 0, 0);
host_arm64_INS_D(block, REG_V_TEMP, src_reg_b, 1, 0);
host_arm64_SQXTN_V4H_4S(block, dest_reg, REG_V_TEMP);
} else
fatal("PACKSSDW %02x %02x %02x\n", uop->dest_reg_a_real, uop->src_reg_a_real, uop->src_reg_b_real);
@@ -1480,9 +1481,9 @@ codegen_PACKUSWB(codeblock_t *block, uop_t *uop)
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size_b = IREG_GET_SIZE(uop->src_reg_b_real);
if (REG_IS_Q(dest_size) && REG_IS_Q(src_size_b) && uop->dest_reg_a_real == uop->src_reg_a_real) {
host_arm64_UQXTN_V8B_8H(block, REG_V_TEMP, src_reg_b);
host_arm64_UQXTN_V8B_8H(block, dest_reg, dest_reg);
host_arm64_ZIP1_V2S(block, dest_reg, dest_reg, REG_V_TEMP);
host_arm64_INS_D(block, REG_V_TEMP, dest_reg, 0, 0);
host_arm64_INS_D(block, REG_V_TEMP, src_reg_b, 1, 0);
host_arm64_SQXTUN_V8B_8H(block, dest_reg, REG_V_TEMP);
} else
fatal("PACKUSWB %02x %02x %02x\n", uop->dest_reg_a_real, uop->src_reg_a_real, uop->src_reg_b_real);

View File

@@ -53,6 +53,9 @@ duplicate_uop(ir_data_t *ir, uop_t *uop, int offset)
new_uop->imm_data = uop->imm_data;
new_uop->p = uop->p;
new_uop->pc = uop->pc;
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
new_uop->is_a16 = uop->is_a16;
#endif
if (uop->jump_dest_uop != -1) {
new_uop->jump_dest_uop = uop->jump_dest_uop + offset;

View File

@@ -336,7 +336,11 @@ typedef struct uop_t {
ir_reg_t src_reg_a;
ir_reg_t src_reg_b;
ir_reg_t src_reg_c;
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
uintptr_t imm_data;
#else
uint32_t imm_data;
#endif
void *p;
ir_host_reg_t dest_reg_a_real;
ir_host_reg_t src_reg_a_real, src_reg_b_real, src_reg_c_real;
@@ -601,7 +605,11 @@ uop_gen_reg_src3_imm(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int src_re
}
static inline void
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
uop_gen_imm(uint32_t uop_type, ir_data_t *ir, uintptr_t imm)
#else
uop_gen_imm(uint32_t uop_type, ir_data_t *ir, uint32_t imm)
#endif
{
uop_t *uop = uop_alloc(ir, uop_type);
@@ -660,6 +668,9 @@ uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int sr
uop->p = p;
}
extern int codegen_mmx_enter(void);
extern int codegen_fp_enter(void);
#define uop_LOAD_FUNC_ARG_REG(ir, arg, reg) uop_gen_reg_src1(UOP_LOAD_FUNC_ARG_0 + arg, ir, reg)
#define uop_LOAD_FUNC_ARG_IMM(ir, arg, imm) uop_gen_imm(UOP_LOAD_FUNC_ARG_0_IMM + arg, ir, imm)
@@ -724,6 +735,28 @@ uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int sr
#define uop_FSQRT(ir, dst_reg, src_reg) uop_gen_reg_dst_src1(UOP_FSQRT, ir, dst_reg, src_reg)
#define uop_FTST(ir, dst_reg, src_reg) uop_gen_reg_dst_src1(UOP_FTST, ir, dst_reg, src_reg)
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
#define uop_FP_ENTER(ir) \
do { \
if (!codegen_fpu_entered) { \
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc); \
uop_CALL_FUNC_RESULT(ir, IREG_temp0, codegen_fp_enter); \
uop_CMP_IMM_JZ(ir, IREG_temp0, 1, codegen_exit_rout); \
} \
codegen_fpu_entered = 1; \
codegen_mmx_entered = 0; \
} while (0)
#define uop_MMX_ENTER(ir) \
do { \
if (!codegen_mmx_entered) { \
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc); \
uop_CALL_FUNC_RESULT(ir, IREG_temp0, codegen_mmx_enter); \
uop_CMP_IMM_JZ(ir, IREG_temp0, 1, codegen_exit_rout); \
} \
codegen_mmx_entered = 1; \
codegen_fpu_entered = 0; \
} while (0)
#else
#define uop_FP_ENTER(ir) \
do { \
if (!codegen_fpu_entered) \
@@ -738,6 +771,7 @@ uop_gen_reg_src2_pointer(uint32_t uop_type, ir_data_t *ir, int src_reg_a, int sr
codegen_mmx_entered = 1; \
codegen_fpu_entered = 0; \
} while (0)
#endif
#define uop_JMP(ir, p) uop_gen_pointer(UOP_JMP, ir, p)
#define uop_JMP_DEST(ir) uop_gen(UOP_JMP_DEST, ir)

View File

@@ -86,13 +86,8 @@ RecompOpFn recomp_opcodes_0f[512] = {
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#else
/*60*/ ropPUNPCKLBW, ropPUNPCKLWD, ropPUNPCKLDQ, ropPACKSSWB, ropPCMPGTB, ropPCMPGTW, ropPCMPGTD, ropPACKUSWB, ropPUNPCKHBW, ropPUNPCKHWD, ropPUNPCKHDQ, ropPACKSSDW, NULL, NULL, ropMOVD_r_d, ropMOVQ_r_q,
/*70*/ NULL, ropPSxxW_imm, ropPSxxD_imm, ropPSxxQ_imm, ropPCMPEQB, ropPCMPEQW, ropPCMPEQD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropMOVD_d_r, ropMOVQ_q_r,
#endif
/*80*/ ropJO_16, ropJNO_16, ropJB_16, ropJNB_16, ropJE_16, ropJNE_16, ropJBE_16, ropJNBE_16, ropJS_16, ropJNS_16, ropJP_16, ropJNP_16, ropJL_16, ropJNL_16, ropJLE_16, ropJNLE_16,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -100,13 +95,11 @@ RecompOpFn recomp_opcodes_0f[512] = {
/*b0*/ NULL, NULL, ropLSS_16, NULL, ropLFS_16, ropLGS_16, ropMOVZX_16_8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropMOVSX_16_8, NULL,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#else
/*d0*/ NULL, NULL, NULL, NULL, NULL, ropPMULLW, NULL, NULL, ropPSUBUSB, ropPSUBUSW, NULL, ropPAND, ropPADDUSB, ropPADDUSW, NULL, ropPANDN,
/*e0*/ NULL, NULL, NULL, NULL, NULL, ropPMULHW, NULL, NULL, ropPSUBSB, ropPSUBSW, NULL, ropPOR, ropPADDSB, ropPADDSW, NULL, ropPXOR,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropPSUBB, ropPSUBW, ropPSUBD, NULL, ropPADDB, ropPADDW, ropPADDD, NULL,
#else
/*f0*/ NULL, NULL, NULL, NULL, NULL, ropPMADDWD, NULL, NULL, ropPSUBB, ropPSUBW, ropPSUBD, NULL, ropPADDB, ropPADDW, ropPADDD, NULL,
#endif
@@ -119,13 +112,8 @@ RecompOpFn recomp_opcodes_0f[512] = {
/*40*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*50*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#else
/*60*/ ropPUNPCKLBW, ropPUNPCKLWD, ropPUNPCKLDQ, ropPACKSSWB, ropPCMPGTB, ropPCMPGTW, ropPCMPGTD, ropPACKUSWB, ropPUNPCKHBW, ropPUNPCKHWD, ropPUNPCKHDQ, ropPACKSSDW, NULL, NULL, ropMOVD_r_d, ropMOVQ_r_q,
/*70*/ NULL, ropPSxxW_imm, ropPSxxD_imm, ropPSxxQ_imm, ropPCMPEQB, ropPCMPEQW, ropPCMPEQD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropMOVD_d_r, ropMOVQ_q_r,
#endif
/*80*/ ropJO_32, ropJNO_32, ropJB_32, ropJNB_32, ropJE_32, ropJNE_32, ropJBE_32, ropJNBE_32, ropJS_32, ropJNS_32, ropJP_32, ropJNP_32, ropJL_32, ropJNL_32, ropJLE_32, ropJNLE_32,
/*90*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -133,13 +121,11 @@ RecompOpFn recomp_opcodes_0f[512] = {
/*b0*/ NULL, NULL, ropLSS_32, NULL, ropLFS_32, ropLGS_32, ropMOVZX_32_8, ropMOVZX_32_16, NULL, NULL, NULL, NULL, NULL, NULL, ropMOVSX_32_8, ropMOVSX_32_16,
/*c0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*d0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*e0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#else
/*d0*/ NULL, NULL, NULL, NULL, NULL, ropPMULLW, NULL, NULL, ropPSUBUSB, ropPSUBUSW, NULL, ropPAND, ropPADDUSB, ropPADDUSW, NULL, ropPANDN,
/*e0*/ NULL, NULL, NULL, NULL, NULL, ropPMULHW, NULL, NULL, ropPSUBSB, ropPSUBSW, NULL, ropPOR, ropPADDSB, ropPADDSW, NULL, ropPXOR,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropPSUBB, ropPSUBW, ropPSUBD, NULL, ropPADDB, ropPADDW, ropPADDD, NULL,
#else
/*f0*/ NULL, NULL, NULL, NULL, NULL, ropPMADDWD, NULL, NULL, ropPSUBB, ropPSUBW, ropPSUBD, NULL, ropPADDB, ropPADDW, ropPADDD, NULL,
#endif
// clang-format on

View File

@@ -201,7 +201,11 @@ static const uint8_t native_requested_sizes[9][8] =
[REG_DOUBLE][IREG_SIZE_Q >> IREG_SIZE_SHIFT] = 1,
[REG_FPU_ST_DOUBLE][IREG_SIZE_Q >> IREG_SIZE_SHIFT] = 1,
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM || defined __aarch64__ || defined _M_ARM64
[REG_POINTER][IREG_SIZE_Q >> IREG_SIZE_SHIFT] = 1
#else
[REG_POINTER][(sizeof(void *) == 4) ? (IREG_SIZE_L >> IREG_SIZE_SHIFT) : (IREG_SIZE_Q >> IREG_SIZE_SHIFT)] = 1
#endif
};
void

View File

@@ -947,11 +947,35 @@ load_ports(void)
#endif
}
static char *
memrmem(char *src, char *start, char *what)
{
if ((src == NULL) || (what == NULL))
return NULL;
while (1) {
if (memcmp(src, what, strlen(what)) == 0)
return src;
src--;
if (src < start)
return NULL;
}
}
static int
load_image_file(char *dest, char *p, uint8_t *ui_wp)
{
char *prefix = "";
int ret = 0;
char *slash = NULL;
char *above = NULL;
char *use = NULL;
if ((slash = memrmem(usr_path + strlen(usr_path) - 2, usr_path, "/")) != NULL) {
slash++;
above = (char *) calloc(1, slash - usr_path + 1);
memcpy(above, usr_path, slash - usr_path);
}
if (strstr(p, "wp://") == p) {
p += 5;
@@ -961,7 +985,33 @@ load_image_file(char *dest, char *p, uint8_t *ui_wp)
} else if ((ui_wp != NULL) && *ui_wp)
prefix = "wp://";
if (path_abs(p)) {
if (strstr(p, "ioctl://") == p) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 11))
ret = 1;
else
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s", p);
if (above != NULL)
free(above);
return ret;
}
if (memcmp(p, "<exe_path>/", strlen("<exe_path>/")) == 0) {
if ((strlen(prefix) + strlen(exe_path) + strlen(path_get_slash(exe_path)) + strlen(p + strlen("<exe_path>/"))) >
(MAX_IMAGE_PATH_LEN - 11))
ret = 1;
else
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, exe_path, path_get_slash(exe_path),
p + strlen("<exe_path>/"));
} else if (memcmp(p, "../", strlen("../")) == 0) {
use = (above == NULL) ? usr_path : above;
if ((strlen(prefix) + strlen(use) + strlen(path_get_slash(use)) + strlen(p + strlen("../"))) >
(MAX_IMAGE_PATH_LEN - 11))
ret = 1;
else
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, use, path_get_slash(use), p + strlen("../"));
} else if (path_abs(p)) {
if ((strlen(prefix) + strlen(p)) > (MAX_IMAGE_PATH_LEN - 11))
ret = 1;
else
@@ -975,6 +1025,9 @@ load_image_file(char *dest, char *p, uint8_t *ui_wp)
path_normalize(dest);
if (above != NULL)
free(above);
return ret;
}
@@ -1144,15 +1197,8 @@ load_storage_controllers(void)
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of cartridge_%02i_fn is more than 511\n",
c + 1);
else
strncpy(cart_fns[c], p, 511);
} else
path_append_filename(cart_fns[c], usr_path, p);
path_normalize(cart_fns[c]);
if (load_image_file(cart_fns[c], p, NULL))
fatal("Configuration: Length of cartridge_%02i_fn is more than 511\n", c + 1);
}
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
@@ -1160,16 +1206,9 @@ load_storage_controllers(void)
sprintf(temp, "cartridge_%02i_image_history_%02i", c + 1, i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of cartridge_%02i_image_history_%02i "
"is more than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(cart_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cart_image_history[c][i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cart_image_history[c][i]);
if (load_image_file(cart_image_history[c][i], p, NULL))
fatal("Configuration: Length of cartridge_%02i_image_history_%02i "
"is more than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
}
@@ -1333,17 +1372,15 @@ load_hard_disks(void)
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of hdd_%02i_fn is more "
"than 511\n", c + 1);
else
strncpy(hdd[c].fn, p, 511);
} else
path_append_filename(hdd[c].fn, usr_path, p);
path_normalize(hdd[c].fn);
if (load_image_file(hdd[c].fn, p, NULL))
fatal("Configuration: Length of hdd_%02i_fn is more than 511\n", c + 1);
}
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
if (*p != '\0')
config_log("HDD%d: %ls\n", c, hdd[c].fn);
#endif
sprintf(temp, "hdd_%02i_vhd_blocksize", c + 1);
hdd[c].vhd_blocksize = ini_section_get_int(cat, temp, 0);
@@ -1431,6 +1468,7 @@ load_floppy_and_cdrom_drives(void)
if (*p != '\0')
config_log("Floppy%d: %ls\n", c, floppyfns[c]);
#endif
sprintf(temp, "fdd_%02i_turbo", c + 1);
fdd_set_turbo(c, !!ini_section_get_int(cat, temp, 0));
sprintf(temp, "fdd_%02i_check_bpb", c + 1);
@@ -1586,31 +1624,23 @@ load_floppy_and_cdrom_drives(void)
p[0] = 0x00;
if (p[0] != 0x00) {
if (path_abs(p)) {
if (strlen(p) > 511)
fatal("Configuration: Length of cdrom_%02i_image_path is more than 511\n", c + 1);
else
strncpy(cdrom[c].image_path, p, 511);
} else
path_append_filename(cdrom[c].image_path, usr_path, p);
path_normalize(cdrom[c].image_path);
if (load_image_file(cdrom[c].image_path, p, NULL))
fatal("Configuration: Length of cdrom_%02i_image_path is more than 511\n", c + 1);
}
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
if (*p != '\0')
config_log("CD-ROM%d: %ls\n", c, cdrom[c].image_path);
#endif
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
cdrom[c].image_history[i] = (char *) calloc((MAX_IMAGE_PATH_LEN + 1) << 1, sizeof(char));
sprintf(temp, "cdrom_%02i_image_history_%02i", c + 1, i + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p) {
if (path_abs(p)) {
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("Configuration: Length of cdrom_%02i_image_history_%02i is more "
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
else
snprintf(cdrom[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s", p);
} else
snprintf(cdrom[c].image_history[i], MAX_IMAGE_PATH_LEN, "%s%s%s", usr_path,
path_get_slash(usr_path), p);
path_normalize(cdrom[c].image_history[i]);
if (load_image_file(cdrom[c].image_history[i], p, NULL))
fatal("Configuration: Length of cdrom_%02i_image_history_%02i is more "
"than %i\n", c + 1, i + 1, MAX_IMAGE_PATH_LEN - 1);
}
}
@@ -3053,6 +3083,14 @@ save_image_file(char *cat, char *var, char *src)
{
char temp[2048] = { 0 };
char *prefix = "";
char *slash = NULL;
char *above = NULL;
if ((slash = memrmem(usr_path + strlen(usr_path) - 2, usr_path, "/")) != NULL) {
slash++;
above = (char *) calloc(1, slash - usr_path + 1);
memcpy(above, usr_path, slash - usr_path);
}
path_normalize(src);
@@ -3061,12 +3099,21 @@ save_image_file(char *cat, char *var, char *src)
prefix = "wp://";
}
if (!strnicmp(src, usr_path, strlen(usr_path)))
if (strstr(src, "ioctl://") == src)
sprintf(temp, "%s", src);
else if (!strnicmp(src, usr_path, strlen(usr_path)))
sprintf(temp, "%s%s", prefix, &src[strlen(usr_path)]);
else if ((above != NULL) && !strnicmp(src, above, strlen(above)))
sprintf(temp, "../%s%s", prefix, &src[strlen(above)]);
else if (!strnicmp(src, exe_path, strlen(exe_path)))
sprintf(temp, "<exe_path>/%s%s", prefix, &src[strlen(exe_path)]);
else
sprintf(temp, "%s%s", prefix, src);
ini_section_set_string(cat, var, temp);
if (above != NULL)
free(above);
}
/* Save "Storage Controllers" section. */
@@ -3186,25 +3233,15 @@ save_storage_controllers(void)
if (strlen(cart_fns[c]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(cart_fns[c]);
if (!strnicmp(cart_fns[c], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &cart_fns[c][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, cart_fns[c]);
}
else
save_image_file(cat, temp, cart_fns[c]);
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "cartridge_%02i_image_history_%02i", c + 1, i + 1);
if ((cart_image_history[c][i] == 0) || strlen(cart_image_history[c][i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(cart_image_history[c][i]);
if (!strnicmp(cart_image_history[c][i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &cart_image_history[c][i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, cart_image_history[c][i]);
}
else
save_image_file(cat, temp, cart_image_history[c][i]);
}
}
@@ -3375,13 +3412,9 @@ save_hard_disks(void)
}
sprintf(temp, "hdd_%02i_fn", c + 1);
if (hdd_is_valid(c) && (strlen(hdd[c].fn) != 0)) {
path_normalize(hdd[c].fn);
if (!strnicmp(hdd[c].fn, usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &hdd[c].fn[strlen(usr_path)]);
else
ini_section_set_string(cat, temp, hdd[c].fn);
} else
if (hdd_is_valid(c) && (strlen(hdd[c].fn) != 0))
save_image_file(cat, temp, hdd[c].fn);
else
ini_section_delete_var(cat, temp);
sprintf(temp, "hdd_%02i_vhd_blocksize", c + 1);
@@ -3542,25 +3575,15 @@ save_floppy_and_cdrom_drives(void)
sprintf(temp, "cdrom_%02i_image_path", c + 1);
if ((cdrom[c].bus_type == 0) || (strlen(cdrom[c].image_path) == 0))
ini_section_delete_var(cat, temp);
else {
path_normalize(cdrom[c].image_path);
if (!strnicmp(cdrom[c].image_path, usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &cdrom[c].image_path[strlen(usr_path)]);
else
ini_section_set_string(cat, temp, cdrom[c].image_path);
}
else
save_image_file(cat, temp, cdrom[c].image_path);
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
sprintf(temp, "cdrom_%02i_image_history_%02i", c + 1, i + 1);
if ((cdrom[c].image_history[i] == 0) || strlen(cdrom[c].image_history[i]) == 0)
ini_section_delete_var(cat, temp);
else {
path_normalize(cdrom[c].image_history[i]);
if (!strnicmp(cdrom[c].image_history[i], usr_path, strlen(usr_path)))
ini_section_set_string(cat, temp, &cdrom[c].image_history[i][strlen(usr_path)]);
else
ini_section_set_string(cat, temp, cdrom[c].image_history[i]);
}
else
save_image_file(cat, temp, cdrom[c].image_history[i]);
}
}

View File

@@ -242,6 +242,20 @@ static uint64_t tsc_old = 0;
int32_t acycs = 0;
# endif
int
codegen_mmx_enter(void)
{
MMX_ENTER();
return 0;
}
int
codegen_fp_enter(void)
{
FP_ENTER();
return 0;
}
void
update_tsc(void)
{

View File

@@ -1550,7 +1550,7 @@ cpu_set(void)
if ((cpu_s->cpu_type == CPU_Cx6x86L) || (cpu_s->cpu_type == CPU_Cx6x86MX))
ccr4 = 0x80;
else if (CPU_Cx6x86)
else if (cpu_s->cpu_type == CPU_Cx6x86)
CPUID = 0; /* Disabled on powerup by default */
break;

View File

@@ -115,6 +115,10 @@
#define RAM_UMAMEM (384 << 10) /* upper memory block */
#define RAM_EXTMEM (1024 << 10) /* start of high memory */
#define EV159_BASE_MEM (128 << 10) /* size of EV-159 base memory in cs8220 mode*/
#define EV159_EXT_1536 (1536 << 10) /* start of EV-159 high memory in cs8220 mode*/
#define EV159_EXT_1024 (1024 << 10) /* start of EV-159 high memory in backfill mode*/
#define EMS_MAXSIZE (2048 << 10) /* max EMS memory size */
#define EMS_EV159_MAXSIZE (3072 << 10) /* max EMS memory size for EV-159 cards */
#define EMS_LOTECH_MAXSIZE (4096 << 10) /* max EMS memory size for lotech cards */
@@ -635,6 +639,14 @@ isamem_init(const device_t *info)
* so check this first.
*/
t = (addr < RAM_TOPMEM) ? RAM_TOPMEM - addr : 0;
/* Check for Everex EV-159 cards in CS8220 backfill mode. */
if ((addr == RAM_TOPMEM) && (dev->board == ISAMEM_EV159_CARD)) {
/* Reserve 128K RAM for base memory. */
t = EV159_BASE_MEM;
addr -= t;
}
if (t > 0) {
/*
* We need T bytes to extend that area.
@@ -669,6 +681,15 @@ isamem_init(const device_t *info)
addr += t;
}
/* Assign high memory address for EV-159 in backfill modes. */
if ((addr == RAM_TOPMEM) && (dev->board == ISAMEM_EV159_CARD)) {
if (dev->start_addr == RAM_TOPMEM) {
addr = EV159_EXT_1536;
} else {
addr = EV159_EXT_1024;
}
}
/* Skip to high memory if needed. */
if ((addr == RAM_TOPMEM) && (tot >= RAM_UMAMEM)) {
/*

View File

@@ -1196,7 +1196,7 @@ isapnp_enable_card(void *priv, uint8_t enable)
if ((card->enable) && (dev->current_ld_card != NULL) && (dev->current_ld_card != card)) {
dev->current_ld = NULL;
dev->current_ld_card = NULL;
} if (!card->enable) {
} else if (!card->enable) {
if (dev->isolated_card == card)
dev->isolated_card = NULL;
if ((dev->current_ld_card == card) && (old_enable != ISAPNP_CARD_FORCE_CONFIG)) {

View File

@@ -372,7 +372,7 @@ keyboard_input(int down, uint16_t scan)
/* kbc_at_log("Received scan code: %03X (%s)\n", scan & 0x1ff, down ? "down" : "up"); */
recv_key_ui[scan & 0x1ff] = down;
if (mouse_capture || !kbd_req_capture || video_fullscreen) {
if (mouse_capture || !kbd_req_capture || (video_fullscreen && !fullscreen_ui_visible)) {
recv_key[scan & 0x1ff] = down;
key_process(scan & 0x1ff, down);
}

View File

@@ -481,7 +481,7 @@ bm_poll(void *priv)
int xor;
int b = mouse_get_buttons_ex();
if (!mouse_capture && !video_fullscreen)
if (!mouse_capture && !(video_fullscreen && !fullscreen_ui_visible))
return 1;
if (!(dev->flags & FLAG_ENABLED))
@@ -543,7 +543,7 @@ bm_update_data(mouse_t *dev)
int xor;
/* If the counters are not frozen, update them. */
if ((mouse_capture || video_fullscreen) && !(dev->flags & FLAG_HOLD)) {
if ((mouse_capture || (video_fullscreen && !fullscreen_ui_visible)) && !(dev->flags & FLAG_HOLD)) {
/* Update the deltas and the delays. */
mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0);

View File

@@ -332,7 +332,7 @@ ps2_poll(void *priv)
atkbc_dev_t *dev = (atkbc_dev_t *) priv;
int packet_size = (dev->flags & FLAG_INTMODE) ? 4 : 3;
int cond = (mouse_capture || video_fullscreen) && mouse_scan && (dev->mode == MODE_STREAM) &&
int cond = (mouse_capture || (video_fullscreen && !fullscreen_ui_visible)) && mouse_scan && (dev->mode == MODE_STREAM) &&
mouse_state_changed() && (kbc_at_dev_queue_pos(dev, 1) < (FIFO_SIZE - packet_size));
if (cond)

View File

@@ -288,7 +288,7 @@ struct accelKey {
char desc[64];
char seq[64];
};
#define NUM_ACCELS 8
#define NUM_ACCELS 9
extern struct accelKey acc_keys[NUM_ACCELS];
extern struct accelKey def_acc_keys[NUM_ACCELS];
extern int FindAccelerator(const char *name);

View File

@@ -142,9 +142,10 @@ static const struct cdrom_drive_types_s {
/* TODO: Find an IDENTIFY and/or INQUIRY dump. */
{ "GOLDSTAR", "GCD-R560B", "1.00", "goldstar_r560b", BUS_TYPE_IDE, 0, 6, 36, 0, 0, { 4, 2, 2, -1 } },
{ "HITACHI", "CDR-8130", "0020", "hitachi_r8130", BUS_TYPE_IDE, 0, 16, 36, 0, 0, { 4, 2, 2, -1 } },
{ "HITACHI", "GD-7500", "A1 ", "hitachi_7500", BUS_TYPE_IDE, 0, 40, 36, 0, 0, { 4, 2, 2, 2 } }, /* DVD. */
{ "HITACHI", "CDR-8435", "0010", "hitachi_r8435", BUS_TYPE_IDE, 0, 32, 36, 0, 0, { 4, 2, 2, -1 } },
{ "HITACHI", "GD-7500", "A1 ", "hitachi_7500", BUS_TYPE_IDE, 0, 40, 36, 0, 1, { 4, 2, 2, 2 } }, /* DVD. */
{ "HL-DT-ST", "CD-ROM GCR-8526B", "1.01", "hldtst_8526b", BUS_TYPE_IDE, 0, 52, 36, 0, 0, { 4, 2, 2, 2 } },
{ "HL-DT-ST", "DVDRAM GSA-4160", "A302", "hldtst_4160", BUS_TYPE_IDE, 0, 40, 36, 0, 0, { 4, 2, 2, 2 } },
{ "HL-DT-ST", "DVDRAM GSA-4160", "A302", "hldtst_4160", BUS_TYPE_IDE, 0, 40, 36, 0, 1, { 4, 2, 2, 2 } },
{ "KENWOOD", "CD-ROM UCR-421", "208E", "kenwood_421", BUS_TYPE_IDE, 0, 72, 36, 0, 0, { 4, 2, 2, 4 } },
/*
This is a laptop/notebook drive, as is also evident from the name:
@@ -182,6 +183,7 @@ static const struct cdrom_drive_types_s {
{ "TEAC", "CD-532E", "2.0A", "teac_532e", BUS_TYPE_IDE, 0, 32, 36, 0, 0, { 3, 2, 2, -1 } },
{ "TOSHIBA", "CD-ROM XM-5302TA", "0305", "toshiba_5302ta", BUS_TYPE_IDE, 0, 4, 96, 0, 0, { 0, -1, -1, -1 } },
{ "TOSHIBA", "CD-ROM XM-5702B", "TA70", "toshiba_5702b", BUS_TYPE_IDE, 0, 12, 96, 0, 0, { 3, 2, 1, -1 } },
{ "TOSHIBA", "CD-ROM XM-6102B", "WA70", "toshiba_6102b", BUS_TYPE_IDE, 0, 24, 96, 0, 0, { 4, 2, 2, -1 } },
{ "TOSHIBA", "CD-ROM XM-6202B", "1512", "toshiba_6202b", BUS_TYPE_IDE, 0, 32, 96, 0, 0, { 4, 2, 2, -1 } },
{ "TOSHIBA", "CD-ROM XM-6402B", "1008", "toshiba_6402b", BUS_TYPE_IDE, 0, 32, 96, 0, 0, { 4, 2, 2, 2 } },
{ "TOSHIBA", "CD-ROM XM-6702B", "1007", "toshiba_6720b", BUS_TYPE_IDE, 0, 48, 96, 0, 0, { 4, 2, 2, 2 } },

View File

@@ -55,6 +55,10 @@ extern int isartc_get_from_internal_name(const char *str);
extern const device_t *isartc_get_device(int t);
extern int isartc_has_config(int board);
/* On-board RTC devices */
extern const device_t vendex_xt_rtc_onboard_device;
extern const device_t rtc58167_device;
#ifdef __cplusplus
}
#endif

View File

@@ -926,6 +926,7 @@ extern int machine_at_optiplexgxl_init(const machine_t *);
extern const device_t pt2000_device;
#endif
extern int machine_at_pt2000_init(const machine_t *);
extern int machine_at_morrison32_init(const machine_t *);
extern int machine_at_pc330_65x6_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t zappa_device;
@@ -970,6 +971,7 @@ extern const device_t p54tp4xe_device;
#endif
extern int machine_at_p54tp4xe_init(const machine_t *);
extern int machine_at_exp8551_init(const machine_t *);
extern int machine_at_hpholly_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t vectra52_device;
#endif
@@ -1024,7 +1026,11 @@ extern int machine_at_amis727_init(const machine_t *);
extern const device_t ap5s_device;
#endif
extern int machine_at_ap5s_init(const machine_t *);
extern int machine_at_fm562_init(const machine_t *);
extern int machine_at_pc140_6260_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms5124_device;
#endif
extern int machine_at_ms5124_init(const machine_t *);
/* VLSI Wildcat */
@@ -1038,6 +1044,7 @@ extern int machine_at_p55t2p4_init(const machine_t *);
extern void machine_at_p65up5_common_init(const machine_t *, const device_t *northbridge);
#endif
extern int machine_at_p65up5_cp55t2d_init(const machine_t *);
extern int machine_at_rubyusb_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t cu430hx_device;
#endif
@@ -1248,6 +1255,10 @@ extern int machine_at_ficka6130_init(const machine_t *);
/* VIA Apollo Pro 133 */
extern int machine_at_p3v133_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6199va_device;
#endif
extern int machine_at_ms6199va_init(const machine_t *);
/* VIA Apollo Pro 133A */
extern int machine_at_p3v4x_init(const machine_t *);
@@ -1289,6 +1300,9 @@ extern int machine_at_cubx_init(const machine_t *);
/* i440ZX */
extern int machine_at_63a1_init(const machine_t *);
/* SiS 600 */
extern int machine_at_7sbb_init(const machine_t *);
/* SMSC VictoryBX-66 */
extern int machine_at_atc7020bxii_init(const machine_t *);
extern int machine_at_m773_init(const machine_t *);
@@ -1302,9 +1316,11 @@ extern int machine_at_p6bap_init(const machine_t *);
/* VIA Apollo Pro 133A */
extern int machine_at_6via90ap_init(const machine_t *);
extern int machine_at_cuv4xls_init(const machine_t *);
/* SiS 600 */
extern int machine_at_7sbb_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t ms6318_device;
#endif
extern int machine_at_ms6318_init(const machine_t *);
extern int machine_at_cairo5_init(const machine_t *);
/* m_at_misc.c */
extern int machine_at_vpc2007_init(const machine_t *);
@@ -1446,6 +1462,10 @@ extern int machine_xt_pb8810_init(const machine_t *);
extern int machine_xt_sansx16_init(const machine_t *);
extern int machine_xt_pcxt_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t to16_device;
#endif
extern int machine_xt_to16_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t vendex_device;
#endif
extern int machine_xt_vendex_init(const machine_t *);

View File

@@ -132,6 +132,7 @@ extern int update_icons;
extern int kbd_req_capture;
extern int hide_status_bar;
extern int hide_tool_bar;
extern int fullscreen_ui_visible;
/* System-related functions. */
extern FILE *plat_fopen(const char *path, const char *mode);

View File

@@ -8,9 +8,11 @@
*
* Definitions for AC'97 audio emulation.
*
*
*
* Authors: RichardG, <richardg867@gmail.com>
*
* Copyright 2021 RichardG.
* Copyright 2021-2025 RichardG.
*/
#ifndef SOUND_AC97_H
#define SOUND_AC97_H
@@ -19,23 +21,26 @@
/* Misc support bits (misc_flags). Most of these are not part of any
registers, but control enabling/disabling of registers and bits. */
#define AC97_MASTER_6B (1 << 0) /* register 02 bits [13,5] (ML5/MR5) */
#define AC97_AUXOUT (1 << 1) /* register 04 */
#define AC97_AUXOUT_6B (1 << 2) /* register 04 bits [13,5] (ML5/MR5) */
#define AC97_MONOOUT (1 << 3) /* register 06 */
#define AC97_MONOOUT_6B (1 << 4) /* register 06 bit 5 (MM5) */
#define AC97_PCBEEP (1 << 5) /* register 0A */
#define AC97_PCBEEP_GEN (1 << 6) /* register 0A bits [12:5] (F[7:0]) */
#define AC97_PHONE (1 << 9) /* register 0C */
#define AC97_VIDEO (1 << 10) /* register 14 */
#define AC97_AUXIN (1 << 11) /* register 16 */
#define AC97_AUDIO (1 << 0) /* audio codec */
#define AC97_MODEM (1 << 1) /* modem codec */
#define AC97_MASTER_6B (1 << 2) /* register 02 bits [13,5] (ML5/MR5) */
#define AC97_AUXOUT (1 << 3) /* register 04 */
#define AC97_AUXOUT_6B (1 << 4) /* register 04 bits [13,5] (ML5/MR5) */
#define AC97_MONOOUT (1 << 5) /* register 06 */
#define AC97_MONOOUT_6B (1 << 6) /* register 06 bit 5 (MM5) */
#define AC97_PCBEEP (1 << 9) /* register 0A */
#define AC97_PCBEEP_GEN (1 << 10) /* register 0A bits [12:5] (F[7:0]) */
#define AC97_PHONE (1 << 11) /* register 0C */
#define AC97_VIDEO (1 << 12) /* register 14 */
#define AC97_AUXIN (1 << 13) /* register 16 */
#define AC97_POP (1 << 15) /* register 20 bit 15 (POP) - definition shared with General Purpose bits */
#define AC97_MS (1 << 8) /* register 20 bit 8 (MS) - definition shared with General Purpose bits */
#define AC97_LPBK (1 << 7) /* register 20 bit 7 (LPBK) - definition shared with General Purpose bits */
#define AC97_DSA (1 << 12) /* register 28 bits [5:4] (DSA[1:0]) */
#define AC97_LFE_6B (1 << 13) /* register 36 bit 13 (LFE5) */
#define AC97_CENTER_6B (1 << 14) /* register 36 bit 5 (CNT5) */
#define AC97_SURR_6B (1 << 16) /* register 38 bits [13,5] (LSR5/RSR5) */
#define AC97_DSA (1 << 14) /* register 28 bits [5:4] (DSA[1:0]) */
#define AC97_LFE_6B (1 << 16) /* register 36 bit 13 (LFE5) */
#define AC97_CENTER_6B (1 << 17) /* register 36 bit 5 (CNT5) */
#define AC97_SURR_6B (1 << 18) /* register 38 bits [13,5] (LSR5/RSR5) */
#define AC97_GAIN_3B (1 << 19) /* registers [1C:1E] (audio) or [46:4A] (modem) bits [8,0] are always 0 (spec violation?) if this is set */
/* Reset bits (reset_flags), register 00. */
#define AC97_MICPCM (1 << 0)
@@ -89,6 +94,14 @@
#define AC97_PRK (1 << 13)
#define AC97_PRL (1 << 14)
/* Extended Modem ID bits, register 3C. */
#define AC97_LIN1 (1 << 0)
#define AC97_LIN2 (1 << 1)
#define AC97_HSET (1 << 2)
#define AC97_CID1 (1 << 3)
#define AC97_CID2 (1 << 4)
#define AC97_CIDR (1 << 7) /* special case: not part of register 3C, but rather 56 bit 13 */
/* Codec IDs. */
#define AC97_CODEC_AD1881 AC97_VENDOR_ID('A', 'D', 'S', 0x40)
#define AC97_CODEC_AK4540 AC97_VENDOR_ID('A', 'D', 'S', 0x40)
@@ -100,6 +113,7 @@
#define AC97_CODEC_TR28023 AC97_VENDOR_ID('T', 'R', 'A', 0x03)
#define AC97_CODEC_W83971D AC97_VENDOR_ID('W', 'E', 'C', 0x01)
#define AC97_CODEC_WM9701A AC97_VENDOR_ID('W', 'M', 'L', 0x00)
#define AC97_CODEC_SI3036 AC97_VENDOR_ID('S', 'I', 'L', 0x22)
typedef struct ac97_vendor_reg_t {
uint8_t page; /* for paged registers [60:6F], 0 otherwise */
@@ -115,6 +129,8 @@ typedef struct ac97_codec_t {
uint8_t vendor_reg_page_max;
const ac97_vendor_reg_t *vendor_regs;
uint16_t *vendor_reg_pages;
uint16_t gpi;
uint16_t gpo;
} ac97_codec_t;
extern uint16_t ac97_codec_readw(ac97_codec_t *dev, uint8_t reg);
@@ -122,22 +138,21 @@ extern void ac97_codec_writew(ac97_codec_t *dev, uint8_t reg, uint16_
extern void ac97_codec_reset(void *priv);
extern void ac97_codec_getattn(void *priv, uint8_t reg, int *l, int *r);
extern uint32_t ac97_codec_getrate(void *priv, uint8_t reg);
extern void ac97_codec_setgpi(void *priv, uint16_t gpi);
extern void ac97_codec_setgpo(void *priv, uint16_t gpo);
extern const device_t *ac97_codec_get(uint32_t id);
extern void ac97_via_set_slot(void *priv, int slot, int irq_pin);
extern uint8_t ac97_via_read_status(void *priv, uint8_t modem);
extern void ac97_via_write_control(void *priv, uint8_t modem, uint8_t val);
extern uint8_t ac97_via_read_status(void *priv);
extern void ac97_via_write_control(void *priv, uint8_t val);
extern void ac97_via_remap_audio_sgd(void *priv, uint16_t new_io_base, uint8_t enable);
extern void ac97_via_remap_modem_sgd(void *priv, uint16_t new_io_base, uint8_t enable);
extern void ac97_via_remap_audio_codec(void *priv, uint16_t new_io_base, uint8_t enable);
extern void ac97_via_remap_modem_codec(void *priv, uint16_t new_io_base, uint8_t enable);
extern ac97_codec_t **ac97_codec;
extern ac97_codec_t **ac97_modem_codec;
extern int ac97_codec_count;
extern int ac97_modem_codec_count;
extern int ac97_codec_id;
extern int ac97_modem_codec_id;
#ifdef EMU_DEVICE_H
extern const device_t ad1881_device;
@@ -151,6 +166,9 @@ extern const device_t stac9721_device;
extern const device_t tr28023_device;
extern const device_t w83971d_device;
extern const device_t wm9701a_device;
#ifdef USE_SOFTMODEM
extern const device_t si3036_device;
#endif
extern const device_t ac97_via_device;
#endif

View File

@@ -29,6 +29,7 @@
# define FLAG_512K_MASK 512
# define FLAG_NO_SHIFT3 1024 /* Needed for Bochs VBE. */
# define FLAG_PRECISETIME 2048 /* Needed for Copper demo if on dynarec. */
# define FLAG_PANNING_ATI 4096
struct monitor_t;
typedef struct hwcursor_t {
@@ -136,6 +137,7 @@ typedef struct svga_t {
int ps_bit_bug;
int ati_4color;
int vblankend;
int panning_blank;
int render_line_offset;
int start_retrace_latch;
int vga_mode;

View File

@@ -594,7 +594,16 @@ static const device_config_t ax6bc_config[] = {
.files = { "roms/machines/ax6bc/ax6bc110.bin", "" }
},
{
.name = "Award Modular BIOS v4.60PGM - Revision R2.59",
.name = "Award Modular BIOS v4.60PGMA - Revision R2.20 (RM Accelerator 350P2XB/450P3XB)",
.internal_name = "ax6bc_rm",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ax6bc/ax6bc220.bin", "" }
},
{
.name = "Award Modular BIOS v4.60PGMA - Revision R2.59",
.internal_name = "ax6bc",
.bios_type = BIOS_NORMAL,
.files_no = 1,
@@ -877,6 +886,15 @@ static const device_config_t ms6147_config[] = {
.spinner = { 0 },
.selection = { { 0 } },
.bios = {
{
.name = "Award Modular BIOS v4.51PG - Revision 1.2 (Fujitsu ErgoPro e368)",
.internal_name = "ergoproe368",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6147/W647F412.BIN", "" }
},
{
.name = "Award Modular BIOS v4.51PG - Revision 1.8",
.internal_name = "ms6147",
@@ -904,7 +922,7 @@ static const device_config_t ms6147_config[] = {
const device_t ms6147_device = {
.name = "MSI MS-6147",
.internal_name = "ms6147_device",
.internal_name = "ms6147",
.flags = 0,
.local = 0,
.init = NULL,
@@ -1390,6 +1408,119 @@ machine_at_p3v133_init(const machine_t *model)
return ret;
}
static const device_config_t ms6199va_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ms6199va",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = {
{
.name = "Award Modular BIOS v4.51PG - Revision 3.5",
.internal_name = "ms6199va",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6199va/w6199vms.350", "" }
},
{
.name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM)",
.internal_name = "ms6199va_200",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6199va/W6199VC8.BIN", "" }
},
{
.name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM) [patched for large drives]",
.internal_name = "ms6199va_200p",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6199va/W6199VC8.PCD", "" }
},
{
.name = "Award Modular BIOS v4.51PG - Revision 3.7 (Packard Bell OEM)",
.internal_name = "ms6199va_370",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6199va/w6199VP2.370", "" }
},
{ .files_no = 0 }
}
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t ms6199va_device = {
.name = "MSI MS-6199VA",
.internal_name = "ms6199va_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ms6199va_config
};
int
machine_at_ms6199va_init(const machine_t *model)
{
int ret = 0;
const char *fn;
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000c0000, 262144, 0);
device_context_restore();
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 3, 4);
pci_register_slot(0x0C, PCI_CARD_SOUND, 3, 4, 1, 2);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 1, 4, 3);
pci_register_slot(0x14, PCI_CARD_NORMAL, 2, 1, 4, 3);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&via_apro133a_device);
device_add(&via_vt82c596b_device);
device_add_params(&w83977_device, (void *) (W83977EF | W83977_AMI | W83977_NO_NVR));
device_add(&winbond_flash_w29c020_device);
spd_register(SPD_TYPE_SDRAM, 0x7, 512);
device_add(&w83782d_device); /* fans: Chassis, Power, CPU; temperatures: System, CPU, unused */
hwm_values.temperatures[2] = 0; /* unused */
if (sound_card_current[0] == SOUND_INTERNAL) {
device_add(machine_get_snd_device(machine));
device_add(&w83971d_device);
}
return ret;
}
/* VIA Apollo Pro 133A */
int
machine_at_p3v4x_init(const machine_t *model)

View File

@@ -15,6 +15,7 @@
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#define HAVE_STDARG_H
@@ -333,11 +334,13 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2
int ret;
ret = bios_load_linear("roms/machines/valuepoint433/$IMAGEP.FLH",
0x000e0000, 131072, 0);
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
memcpy(&rom[0x00020000], rom, 131072);
machine_at_common_ide_init(model);
device_add(&sis_85c461_device);
if (gfxcard[0] == VID_INTERNAL)
@@ -350,6 +353,13 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2
if (fdc_current[0] == FDC_INTERNAL)
device_add(&fdc_at_device);
if (gfxcard[0] != VID_INTERNAL) {
for (uint16_t i = 0; i < 32768; i++)
rom[i] = mem_readb_phys(0x000c0000 + i);
}
mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000);
mem_mapping_set_exec(&bios_mapping, rom);
return ret;
}

View File

@@ -215,6 +215,35 @@ machine_at_63a1_init(const machine_t *model)
return ret;
}
/* SiS 600 */
int
machine_at_7sbb_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/7sbb/sbb12aa2.bin",
0x000c0000, 262144, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1 | FLAG_TRC_CONTROLS_CPURST);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x11, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x02, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&sis_5600_device);
device_add(&it8661f_device);
device_add(&sst_flash_29ee020_device); /* assumed */
return ret;
}
/* SMSC VictoryBX-66 */
int
machine_at_atc7020bxii_init(const machine_t *model)
@@ -434,13 +463,168 @@ machine_at_cuv4xls_init(const machine_t *model)
return ret;
}
/* SiS 600 */
static const device_config_t ms6318_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ms6318",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = {
{
.name = "Award Modular BIOS v6.00PG - Revision 1.1",
.internal_name = "ms6318_110",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/w6318vms.110", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 1.2",
.internal_name = "ms6318",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/w6318vms.120", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 7.1B5E (Elonex OEM)",
.internal_name = "ms6318_715",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/w6318ve1.715", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 1.0B9 (Fujitsu-Siemens OEM)",
.internal_name = "ms6318_109",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/ms-6318-ver5.bin", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 1.8 (HP OEM)",
.internal_name = "ms6318_180",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/med2000v2.bin", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 1.9 (HP OEM)",
.internal_name = "ms6318_190",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/med2000.bin", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 2.02 (HP OEM)",
.internal_name = "ms6318_202",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/ms6318hp.bin", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 1.3 (Medion OEM)",
.internal_name = "ms6318_130",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/ms6318.bin", "" }
},
{
.name = "Award Modular BIOS v6.00PG - Revision 7.51 (Medion OEM)",
.internal_name = "ms6318_751",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 262144,
.files = { "roms/machines/ms6318/bios.rom", "" }
},
{ .files_no = 0 }
}
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t ms6318_device = {
.name = "MSI MS-6318",
.internal_name = "ms6318_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ms6318_config
};
int
machine_at_7sbb_init(const machine_t *model)
machine_at_ms6318_init(const machine_t *model)
{
int ret = 0;
const char *fn;
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000c0000, 262144, 0);
device_context_restore();
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x0C, PCI_CARD_SOUND, 3, 4, 1, 2);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x10, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&via_apro133a_device);
device_add(&via_vt82c686b_device); /* fans: CPU1, CPU2; temperatures: CPU, System, unused */
device_add(&sst_flash_39sf020_device); /* assumed */
spd_register(SPD_TYPE_SDRAM, 0x7, 1024);
hwm_values.temperatures[0] += 2; /* CPU offset */
hwm_values.temperatures[1] += 2; /* System offset */
hwm_values.temperatures[2] = 0; /* unused */
if (sound_card_current[0] == SOUND_INTERNAL) {
device_add(machine_get_snd_device(machine));
device_add(&stac9708_device);
}
return ret;
}
int
machine_at_cairo5_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/7sbb/sbb12aa2.bin",
ret = bios_load_linear("roms/machines/cairo5/08BV.BIN",
0x000c0000, 262144, 0);
if (bios_only || !ret)
@@ -448,17 +632,20 @@ machine_at_7sbb_init(const machine_t *model)
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1 | FLAG_TRC_CONTROLS_CPURST);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x11, PCI_CARD_NORMAL, 3, 4, 1, 2);
pci_register_slot(0x02, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 0);
pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 0, 1);
pci_register_slot(0x10, PCI_CARD_NORMAL, 3, 0, 1, 2);
pci_register_slot(0x11, PCI_CARD_NORMAL, 0, 1, 2, 3);
pci_register_slot(0x12, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4);
device_add(&sis_5600_device);
device_add(&it8661f_device);
device_add(&sst_flash_29ee020_device); /* assumed */
device_add(&via_apro133a_device);
device_add(&via_vt82c686b_device);
device_add(&winbond_flash_w29c020_device);
spd_register(SPD_TYPE_SDRAM, 0x7, 1024);
return ret;
}
}

View File

@@ -427,6 +427,79 @@ machine_at_optiplexgxl_init(const machine_t *model)
return ret;
}
static void
machine_at_morrison32_gpio_init(void)
{
uint32_t gpio = 0xffffe2ff;
/* Register 0x0079: */
/* Bit 7: 0 = Clear password, 1 = Keep password. */
/* Bit 6: 0 = NVRAM cleared by jumper, 1 = NVRAM normal. */
/* Bit 5: 0 = CMOS Setup disabled, 1 = CMOS Setup enabled. */
/* Bit 4: External CPU clock (Switch 8). */
/* Bit 3: External CPU clock (Switch 7). */
/* 50 MHz: Switch 7 = Off, Switch 8 = Off. */
/* 60 MHz: Switch 7 = On, Switch 8 = Off. */
/* 66 MHz: Switch 7 = Off, Switch 8 = On. */
/* Bit 2: 0 = No onboard audio, 1 = Onboard audio present. */
/* Bit 1: 0 = Soft Off capable power supply, 1 = Standard power supply. */
/* Bit 0: 2x multiplier, 1 = 1.5x multiplier (Switch 6). */
/* NOTE: A bit is read as 1 if switch is off, and as 0 if switch is on. */
if (cpu_busspeed <= 50000000)
gpio |= 0xffff00ff;
else if ((cpu_busspeed > 50000000) && (cpu_busspeed <= 60000000))
gpio |= 0xffff08ff;
else if (cpu_busspeed > 60000000)
gpio |= 0xffff10ff;
if (cpu_dmulti <= 1.5)
gpio |= 0xffff01ff;
else
gpio |= 0xffff00ff;
if (sound_card_current[0] == SOUND_INTERNAL)
gpio |= 0xffff04ff;
machine_set_gpio_default(gpio);
}
int
machine_at_morrison32_init(const machine_t *model)
{
int ret;
ret = bios_load_linear_combined("roms/machines/morrison32/1011BT0L.BIO",
"roms/machines/morrison32/1011BT0L.BI1",
0x20000, 128);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
machine_at_morrison32_gpio_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0);
pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
if (gfxcard[0] == VID_INTERNAL)
device_add(machine_get_vid_device(machine));
if (sound_card_current[0] == SOUND_INTERNAL)
machine_snd = device_add(machine_get_snd_device(machine));
device_add(&i430fx_device);
device_add(&piix_device);
device_add_params(&pc87306_device, (void *) PCX730X_AMI);
device_add(&intel_flash_bxt_ami_device);
return ret;
}
/* Some stuff taken from Monaco */
static void
machine_at_morrison64_gpio_init(void)

View File

@@ -143,6 +143,77 @@ machine_at_p65up5_cp55t2d_init(const machine_t *model)
return ret;
}
static void
machine_at_rubyusb_gpio_init(void)
{
uint32_t gpio = 0xffffe3ff;
/* Register 0x0079: */
/* Bit 7: 0 = Clear password, 1 = Keep password. */
/* Bit 6: 0 = NVRAM cleared by jumper, 1 = NVRAM normal. */
/* Bit 5: 0 = CMOS Setup disabled, 1 = CMOS Setup enabled. */
/* Bit 4: External CPU clock (Switch 8). */
/* Bit 3: External CPU clock (Switch 7). */
/* 50 MHz: Switch 7 = Off, Switch 8 = Off. */
/* 60 MHz: Switch 7 = On, Switch 8 = Off. */
/* 66 MHz: Switch 7 = Off, Switch 8 = On. */
/* Bit 2: 0 = On-board audio absent, 1 = On-board audio present. */
/* Bit 1: 0 = Soft-off capable power supply present, 1 = Soft-off capable power supply absent. */
/* Bit 0: 0 = Reserved. */
/* NOTE: A bit is read as 1 if switch is off, and as 0 if switch is on. */
if (cpu_busspeed <= 50000000)
gpio |= 0xffff10ff;
else if ((cpu_busspeed > 50000000) && (cpu_busspeed <= 60000000))
gpio |= 0xffff18ff;
else if (cpu_busspeed > 60000000)
gpio |= 0xffff00ff;
if (sound_card_current[0] == SOUND_INTERNAL)
gpio |= 0xffff04ff;
machine_set_gpio_default(gpio);
}
int
machine_at_rubyusb_init(const machine_t *model)
{
int ret;
ret = bios_load_linear_combined2("roms/machines/rubyusb/1005DL0L.BIO",
"roms/machines/rubyusb/1005DL0L.BI1",
"roms/machines/rubyusb/1005DL0L.BI2",
"roms/machines/rubyusb/1005DL0L.BI3",
"roms/machines/rubyusb/1005DL0L.RCV",
/*NULL,*/
0x3a000, 128);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
machine_at_rubyusb_gpio_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0);
pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
if (gfxcard[0] == VID_INTERNAL)
device_add(machine_get_vid_device(machine));
if (sound_card_current[0] == SOUND_INTERNAL)
machine_snd = device_add(machine_get_snd_device(machine));
device_add(&i430hx_device);
device_add(&piix3_device);
device_add_params(&pc87306_device, (void *) PCX730X_AMI);
device_add(&intel_flash_bxt_ami_device);
return ret;
}
static const device_config_t cu430hx_config[] = {
// clang-format off
{

View File

@@ -157,6 +157,77 @@ machine_at_exp8551_init(const machine_t *model)
return ret;
}
static void
machine_at_hpholly_gpio_init(void)
{
uint32_t gpio = 0xffffe2ff;
/* Register 0x0079: */
/* Bit 7: 0 = Clear password, 1 = Keep password. */
/* Bit 6: 0 = NVRAM cleared by jumper, 1 = NVRAM normal. */
/* Bit 5: 0 = CMOS Setup disabled, 1 = CMOS Setup enabled. */
/* Bit 4: External CPU clock (Switch 8). */
/* Bit 3: External CPU clock (Switch 7). */
/* 50 MHz: Switch 7 = Off, Switch 8 = Off. */
/* 60 MHz: Switch 7 = On, Switch 8 = Off. */
/* 66 MHz: Switch 7 = Off, Switch 8 = On. */
/* Bit 2: 0 = 2.5x multiplier, 1 = 1.5x/2x multiplier. */
/* Bit 1: 0 = Soft Off capable power supply, 1 = Standard power supply. */
/* Bit 0: 2x multiplier, 1 = 1.5x multiplier (Switch 6). */
/* NOTE: A bit is read as 1 if switch is off, and as 0 if switch is on. */
if (cpu_busspeed <= 50000000)
gpio |= 0xffff00ff;
else if ((cpu_busspeed > 50000000) && (cpu_busspeed <= 60000000))
gpio |= 0xffff08ff;
else if (cpu_busspeed > 60000000)
gpio |= 0xffff10ff;
if (cpu_dmulti <= 1.5)
gpio |= 0xffff0500;
else if ((cpu_dmulti > 1.5) && (cpu_dmulti <= 2.0))
gpio |= 0xffff0400;
else
gpio |= 0xffff0000;
machine_set_gpio_default(gpio);
}
int
machine_at_hpholly_init(const machine_t *model) /* HP Pavilion Holly, 7070/7090/5100/7100 */
{
int ret;
ret = bios_load_linear_combined("roms/machines/hpholly/1005CA2L.BIO",
"roms/machines/hpholly/1005CA2L.BI1",
0x20000, 128);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
machine_at_hpholly_gpio_init();
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x08, PCI_CARD_VIDEO, 4, 0, 0, 0);
pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 2, 3, 4);
pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1);
pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
if (gfxcard[0] == VID_INTERNAL)
device_add(machine_get_vid_device(machine));
if (sound_card_current[0] == SOUND_INTERNAL)
machine_snd = device_add(machine_get_snd_device(machine));
device_add(&i430fx_device);
device_add(&piix_device);
device_add_params(&pc87306_device, (void *) PCX730X_AMI);
device_add(&intel_flash_bxt_ami_device);
return ret;
}
static void
machine_at_vectra52_gpio_init(void)
{
@@ -1525,6 +1596,37 @@ machine_at_ap5s_init(const machine_t *model)
return ret;
}
int
machine_at_fm562_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/fm562/PR11_US.ROM",
0x000e0000, 131072, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1 | FLAG_TRC_CONTROLS_CPURST);
pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4);
pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x11, PCI_CARD_NORMAL, 1, 3, 2, 4);
pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 1, 3, 4);
pci_register_slot(0x0B, PCI_CARD_VIDEO, 0, 0, 0, 0); /* Onboard video */
if (sound_card_current[0] == SOUND_INTERNAL)
machine_snd = device_add(machine_get_snd_device(machine));
device_add(&sis_5511_device);
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
device_add_params(&fdc37c669_device, (void *) 0);
device_add(&intel_flash_bxt_device);
return ret;
}
int
machine_at_pc140_6260_init(const machine_t *model)
{
@@ -1556,17 +1658,72 @@ machine_at_pc140_6260_init(const machine_t *model)
return ret;
}
static const device_config_t ms5124_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "ms5124",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = {
{
.name = "AMI WinBIOS (101094) - Revision AG77",
.internal_name = "ms5124",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 131072,
.files = { "roms/machines/ms5124/AG77.ROM", "" }
},
{
.name = "Award Modular BIOS v4.51PG - Revision WG72P",
.internal_name = "ms5124_451pg",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 131072,
.files = { "roms/machines/ms5124/WG72P.BIN", "" }
},
{ .files_no = 0 }
}
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t ms5124_device = {
.name = "MSI MS-5124",
.internal_name = "ms5124_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ms5124_config
};
int
machine_at_ms5124_init(const machine_t *model)
{
int ret;
int ret = 0;
const char *fn;
ret = bios_load_linear("roms/machines/ms5124/AG77.ROM",
0x000e0000, 131072, 0);
if (bios_only || !ret)
/* No ROMs available */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000e0000, 131072, 0);
device_context_restore();
machine_at_common_init_ex(model, 2);
pci_init(PCI_CONFIG_TYPE_1 | FLAG_TRC_CONTROLS_CPURST);

View File

@@ -37,6 +37,7 @@
#include <86box/serial.h>
#include <86box/sio.h>
#include <86box/ibm_5161.h>
#include <86box/isartc.h>
#include <86box/keyboard.h>
#include <86box/rom.h>
#include <86box/machine.h>
@@ -45,9 +46,6 @@
#include <86box/port_6x.h>
#include <86box/video.h>
extern const device_t vendex_xt_rtc_onboard_device;
extern const device_t rtc58167_device;
/* 8088 */
static void
machine_xt_common_init(const machine_t *model, int fixed_floppy)
@@ -1251,7 +1249,7 @@ static const device_config_t pc500_config[] = {
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = -1 },
{ .description = "Enabled", .value = 2 },
{ .description = "IRQ 2", .value = 2 },
{ .description = "" }
},
.bios = { { 0 } }
@@ -1371,7 +1369,7 @@ static const device_config_t pc500plus_config[] = {
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = -1 },
{ .description = "Enabled", .value = 2 },
{ .description = "IRQ 2", .value = 2 },
{ .description = "" }
},
.bios = { { 0 } }
@@ -1704,6 +1702,106 @@ machine_xt_pcxt_init(const machine_t *model)
return ret;
}
static const device_config_t to16_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "to16",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.bios = {
{
.name = "1.03",
.internal_name = "to16",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 32768,
.files = { "roms/machines/to16/TO16_103.bin", "" }
},
{ .files_no = 0 }
},
},
{
.name = "rtc_port",
.description = "Onboard RTC",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Not installed", .value = 0 },
{ .description = "RTC0", .value = 0x300 },
{ .description = "RTC1", .value = 0x2c0 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "rtc_irq",
.description = "RTC IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = -1 },
{ .description = "IRQ 2", .value = 2 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t to16_device = {
.name = "Thomson TO16",
.internal_name = "to16_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = to16_config
};
int
machine_xt_to16_init(const machine_t *model)
{
int ret = 0;
int rtc_port = 0;
const char *fn;
/* No ROMs available. */
if (!device_available(model->device))
return ret;
device_context(model->device);
rtc_port = machine_get_config_int("rtc_port");
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000f8000, 32768, 0);
device_context_restore();
if (bios_only || !ret)
return ret;
machine_xt_clone_init(model, 0);
if (rtc_port != 0)
device_add(&rtc58167_device);
return ret;
}
static const device_config_t vendex_config[] = {
// clang-format off
{

View File

@@ -1784,6 +1784,49 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
{
.name = "[8088] Thomson TO16",
.internal_name = "to16",
.type = MACHINE_TYPE_8088,
.chipset = MACHINE_CHIPSET_DISCRETE,
.init = machine_xt_to16_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_8088,
.block = CPU_BLOCK_NONE,
.min_bus = 0,
.max_bus = 0,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_PC,
.flags = MACHINE_FLAGS_NONE,
.ram = {
.min = 64,
.max = 768,
.step = 64
},
.nvrmask = 0,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = &kbc_xtclone_device,
.kbc_params = 0x00000000,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = &to16_device,
.kbd_device = &keyboard_pc_xt_device,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = NULL,
.net_device = NULL
},
{
.name = "[8088] Toshiba T1000",
.internal_name = "t1000",
@@ -12431,6 +12474,52 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* According to tests from real hardware: This has AMI MegaKey KBC firmware on the
PC87306 Super I/O chip, command 0xA1 returns '5'.
Command 0xA0 copyright string: (C)1994 AMI . */
{
.name = "[i430FX] HP Pavilion 50x0/70xx (Morrison32)",
.internal_name = "morrison32",
.type = MACHINE_TYPE_SOCKET5,
.chipset = MACHINE_CHIPSET_INTEL_430FX,
.init = machine_at_morrison32_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET5_7,
.block = CPU_BLOCK(CPU_K5, CPU_5K86, CPU_Cx6x86),
.min_bus = 50000000,
.max_bus = 66666667,
.min_voltage = 3380,
.max_voltage = 3520,
.min_multi = 1.5,
.max_multi = 2.0
},
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_GAMEPORT | MACHINE_APM,
.ram = {
.min = 8192,
.max = 131072,
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = MACHINE_DMA_DISABLED | MACHINE_DMA_1 | MACHINE_DMA_3,
.default_jumpered_ecp_dma = 3,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x000044f0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &s3_phoenix_trio32_onboard_pci_device,
.snd_device = &cs4232_onboard_device,
.net_device = NULL
},
{
.name = "[i430FX] IBM PC 3x0 (type 65x6) (Morrison64)",
.internal_name = "pc330_65x6",
@@ -13333,7 +13422,53 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
{
/* According to tests from real hardware: This has AMI MegaKey KBC firmware on the
PC87306 Super I/O chip, command 0xA1 returns '5'.
Command 0xA0 copyright string: (C)1994 AMI . */
{
.name = "[i430FX] HP Pavilion 51xx/7070/7090/71xx (Holly)",
.internal_name = "hpholly",
.type = MACHINE_TYPE_SOCKET7_3V,
.chipset = MACHINE_CHIPSET_INTEL_430FX,
.init = machine_at_hpholly_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET5_7,
.block = CPU_BLOCK(CPU_K5, CPU_5K86, CPU_Cx6x86),
.min_bus = 50000000,
.max_bus = 66666667,
.min_voltage = 3380,
.max_voltage = 3520,
.min_multi = 1.5,
.max_multi = 2.5
},
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_GAMEPORT | MACHINE_APM,
.ram = {
.min = 8192,
.max = 131072,
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = MACHINE_DMA_DISABLED | MACHINE_DMA_1 | MACHINE_DMA_3,
.default_jumpered_ecp_dma = 3,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x000044f0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &s3_phoenix_trio64vplus_onboard_pci_device,
.snd_device = &cs4232_onboard_device,
.net_device = NULL
},
{
.name = "[i430FX] HP Vectra 500 Series xxx/MT",
.internal_name = "vectra500mt",
.type = MACHINE_TYPE_SOCKET7_3V,
@@ -13361,7 +13496,7 @@ const machine_t machines[] = {
.step = 8192
},
.nvrmask = 511,
.jumpered_ecp_dma = 0,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = NULL,
.kbc_params = 0x00000000,
@@ -13369,7 +13504,7 @@ const machine_t machines[] = {
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &s3_phoenix_trio64_onboard_pci_device,
@@ -13404,7 +13539,7 @@ const machine_t machines[] = {
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = 0,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = NULL,
.kbc_params = 0x00000000,
@@ -13412,7 +13547,7 @@ const machine_t machines[] = {
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = &vectra52_device,
.kbd_device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &gd5436_onboard_pci_device,
@@ -14188,6 +14323,50 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Has AMIKey H KBC firmware (AMIKey-2). */
{
.name = "[SiS 5511] HP Pavilion 52xx/53xx/71xx/72xx (BCM FM562)",
.internal_name = "fm562",
.type = MACHINE_TYPE_SOCKET7_3V,
.chipset = MACHINE_CHIPSET_SIS_5511,
.init = machine_at_fm562_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET5_7,
.block = CPU_BLOCK(CPU_Cx6x86, CPU_Cx6x86L, CPU_Cx6x86MX),
.min_bus = 50000000,
.max_bus = 66666667,
.min_voltage = 3380,
.max_voltage = 3520,
.min_multi = 1.5,
.max_multi = 2.5
},
.bus_flags = MACHINE_PS2_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_SOUND | MACHINE_GAMEPORT | MACHINE_APM, /* Machine has internal sound: Crystal CS4232-KQ, and video: SiS 6205 (not yet emulated) */
.ram = {
.min = 8192,
.max = 524288,
.step = 8192
},
.nvrmask = 127,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = &kbc_at_device,
.kbc_params = KBC_VEN_AMI | 0x00004800,
.kbc_p1 = 0x00000cf0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = &cs4232_onboard_device,
.net_device = NULL
},
/* Has an SMC FDC37C669QF Super I/O. */
{
.name = "[SiS 5511] IBM PC 140 (type 6260)",
@@ -14268,7 +14447,7 @@ const machine_t machines[] = {
.kbc_p1 = 0x00000cf0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.device = &ms5124_device,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
@@ -14593,6 +14772,53 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* According to tests from real hardware: This has AMI MegaKey KBC firmware on the
PC87306 Super I/O chip, command 0xA1 returns '5'.
Command 0xA0 copyright string: (C)1994 AMI . */
{
.name = "[i430HX] HP Pavilion 73xx/74xx (Ruby USB)",
.internal_name = "rubyusb",
.type = MACHINE_TYPE_SOCKET7,
.chipset = MACHINE_CHIPSET_INTEL_430HX,
.init = machine_at_rubyusb_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET5_7,
.block = CPU_BLOCK(CPU_K5, CPU_5K86, CPU_K6, CPU_K6_2, CPU_K6_2C, CPU_K6_3, CPU_K6_2P,
CPU_K6_3P, CPU_Cx6x86, CPU_Cx6x86MX, CPU_Cx6x86L),
.min_bus = 50000000,
.max_bus = 66666667,
.min_voltage = 2800,
.max_voltage = 3520,
.min_multi = 1.5,
.max_multi = 3.0
},
.bus_flags = MACHINE_PS2_PCI | MACHINE_BUS_USB,
.flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_GAMEPORT | MACHINE_APM | MACHINE_USB,
.ram = {
.min = 8192,
.max = 524288,
.step = 4096
},
.nvrmask = 255,
.jumpered_ecp_dma = MACHINE_DMA_DISABLED | MACHINE_DMA_1 | MACHINE_DMA_3,
.default_jumpered_ecp_dma = 3,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x000044f0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &s3_virge_325_onboard_pci_device,
.snd_device = &ymf701_device,
.net_device = NULL
},
/* OEM-only Intel CU430HX, has AMI MegaKey KBC firmware on the PC87306 Super I/O chip. */
{
.name = "[i430HX] Intel CU430HX (Cumberland)",
@@ -17117,7 +17343,7 @@ const machine_t machines[] = {
.flags = MACHINE_IDE_DUAL | MACHINE_APM,
.ram = {
.min = 8192,
.max = 524288,
.max = 262144,
.step = 8192
},
.nvrmask = 127,
@@ -18810,6 +19036,8 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* VIA Apollo Pro 133 */
/* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC
firmware. */
{
@@ -18855,6 +19083,53 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC
firmware. */
{
.name = "[VIA Apollo Pro 133] MSI MS-6199VA",
.internal_name = "ms6199va",
.type = MACHINE_TYPE_SLOT1,
.chipset = MACHINE_CHIPSET_VIA_APOLLO_PRO_133,
.init = machine_at_ms6199va_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SLOT1,
.block = CPU_BLOCK_NONE,
.min_bus = 66666667,
.max_bus = 155000000,
.min_voltage = 1300,
.max_voltage = 3500,
.min_multi = 1.5,
.max_multi = 8.0
},
.bus_flags = MACHINE_PS2_AGP | MACHINE_BUS_USB,
.flags = MACHINE_IDE_DUAL | MACHINE_SOUND | MACHINE_APM | MACHINE_ACPI | MACHINE_USB,
.ram = {
.min = 8192,
.max = 1572864,
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x00000cf0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = &ms6199va_device,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = &es1373_onboard_device,
.net_device = NULL
},
/* VIA Apollo Pro 133A */
/* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC
firmware. */
{
@@ -19778,6 +20053,96 @@ const machine_t machines[] = {
.snd_device = &cmi8738_onboard_device,
.net_device = NULL
},
/* Has the VIA VT82C686B southbridge with on-chip KBC identical to the VIA
VT82C42N. */
{
.name = "[VIA Apollo Pro 133A] MSI MS-6318",
.internal_name = "ms6318",
.type = MACHINE_TYPE_SOCKET370,
.chipset = MACHINE_CHIPSET_VIA_APOLLO_PRO_133A,
.init = machine_at_ms6318_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET370,
.block = CPU_BLOCK_NONE,
.min_bus = 66666667,
.max_bus = 150000000,
.min_voltage = 1300,
.max_voltage = 3500,
.min_multi = MACHINE_MULTIPLIER_FIXED,
.max_multi = MACHINE_MULTIPLIER_FIXED
},
.bus_flags = MACHINE_PS2_A97 | MACHINE_BUS_USB,
.flags = MACHINE_IDE_DUAL | MACHINE_AG | MACHINE_APM | MACHINE_ACPI | MACHINE_GAMEPORT | MACHINE_USB,
.ram = {
.min = 16384,
.max = 2097152,
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x00000cf0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = &ms6318_device,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = &ct5880_onboard_device,
.net_device = NULL
},
/* Has the VIA VT82C686B southbridge with on-chip KBC identical to the VIA
VT82C42N. */
{
.name = "[VIA Apollo Pro 133A] Samsung CAIRO-5 (MSI MS-6309)",
.internal_name = "cairo5",
.type = MACHINE_TYPE_SOCKET370,
.chipset = MACHINE_CHIPSET_VIA_APOLLO_PRO_133A,
.init = machine_at_cairo5_init,
.p1_handler = machine_generic_p1_handler,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET370,
.block = CPU_BLOCK_NONE,
.min_bus = 66666667,
.max_bus = 150000000,
.min_voltage = 1300,
.max_voltage = 3500,
.min_multi = MACHINE_MULTIPLIER_FIXED,
.max_multi = MACHINE_MULTIPLIER_FIXED
},
.bus_flags = MACHINE_PS2_A97 | MACHINE_BUS_USB,
.flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_ACPI | MACHINE_USB,
.ram = {
.min = 16384,
.max = 3145728,
.step = 8192
},
.nvrmask = 255,
.jumpered_ecp_dma = 0,
.default_jumpered_ecp_dma = -1,
.kbc_device = NULL,
.kbc_params = 0x00000000,
.kbc_p1 = 0x00000cf0,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.kbd_device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = NULL,
.snd_device = NULL,
.net_device = NULL
},
/* Miscellaneous/Fake/Hypervisor machines */
/* Has a Winbond W83977F Super I/O chip with on-chip KBC with AMIKey-2 KBC

View File

@@ -34,8 +34,17 @@ l80225_mii_readw(uint16_t *regs, uint16_t addr)
return 0;
}
/* Readonly mask for MDI (PHY) registers */
static const uint16_t tulip_mdi_mask[] = {
0x0000, 0xffff, 0xffff, 0xffff, 0xc01f, 0xffff, 0xffff, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0fff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
void
l80225_mii_writew(uint16_t *regs, uint16_t addr, uint16_t val)
{
regs[addr] = val;
regs[addr] = val & tulip_mdi_mask[addr];
}

View File

@@ -346,10 +346,10 @@ static void
tulip_desc_read(TULIPState *s, uint32_t p,
struct tulip_descriptor *desc)
{
desc->status = mem_readl_phys(p);
desc->control = mem_readl_phys(p + 4);
desc->buf_addr1 = mem_readl_phys(p + 8);
desc->buf_addr2 = mem_readl_phys(p + 12);
dma_bm_read(p , (uint8_t *) &(desc->status) , 4, 4);
dma_bm_read(p + 4, (uint8_t *) &(desc->control) , 4, 4);
dma_bm_read(p + 8, (uint8_t *) &(desc->buf_addr1), 4, 4);
dma_bm_read(p + 12, (uint8_t *) &(desc->buf_addr2), 4, 4);
if (s->csr[0] & CSR0_DBO) {
bswap32s(&desc->status);
@@ -364,15 +364,20 @@ tulip_desc_write(TULIPState *s, uint32_t p,
struct tulip_descriptor *desc)
{
if (s->csr[0] & CSR0_DBO) {
mem_writel_phys(p, bswap32(desc->status));
mem_writel_phys(p + 4, bswap32(desc->control));
mem_writel_phys(p + 8, bswap32(desc->buf_addr1));
mem_writel_phys(p + 12, bswap32(desc->buf_addr2));
uint32_t status = bswap32(desc->status);
uint32_t control = bswap32(desc->control);
uint32_t buf_addr1 = bswap32(desc->buf_addr1);
uint32_t buf_addr2 = bswap32(desc->buf_addr2);
dma_bm_write(p , (uint8_t *) &status , 4, 4);
dma_bm_write(p + 4, (uint8_t *) &control , 4, 4);
dma_bm_write(p + 8, (uint8_t *) &buf_addr1, 4, 4);
dma_bm_write(p + 12, (uint8_t *) &buf_addr2, 4, 4);
} else {
mem_writel_phys(p, desc->status);
mem_writel_phys(p + 4, desc->control);
mem_writel_phys(p + 8, desc->buf_addr1);
mem_writel_phys(p + 12, desc->buf_addr2);
dma_bm_write(p , (uint8_t *) &(desc->status) , 4, 4);
dma_bm_write(p + 4, (uint8_t *) &(desc->control) , 4, 4);
dma_bm_write(p + 8, (uint8_t *) &(desc->buf_addr1), 4, 4);
dma_bm_write(p + 12, (uint8_t *) &(desc->buf_addr2), 4, 4);
}
}
@@ -433,6 +438,10 @@ tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
len = s->rx_frame_len;
}
if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
return;
}
dma_bm_write(desc->buf_addr1, s->rx_frame + (s->rx_frame_size - s->rx_frame_len), len, 4);
s->rx_frame_len -= len;
}
@@ -444,6 +453,10 @@ tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
len = s->rx_frame_len;
}
if (s->rx_frame_len + len > sizeof(s->rx_frame)) {
return;
}
dma_bm_write(desc->buf_addr2, s->rx_frame + (s->rx_frame_size - s->rx_frame_len), len, 4);
s->rx_frame_len -= len;
}
@@ -452,9 +465,7 @@ tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc)
static bool
tulip_filter_address(TULIPState *s, const uint8_t *addr)
{
#ifdef BLOCK_BROADCAST
static const char broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#endif
bool ret = false;
for (uint8_t i = 0; i < 16 && ret == false; i++) {
@@ -463,15 +474,9 @@ tulip_filter_address(TULIPState *s, const uint8_t *addr)
}
}
/*
Do not block broadcast packets - needed for connections to the guest
to succeed when using SLiRP.
*/
#ifdef BLOCK_BROADCAST
if (!memcmp(addr, broadcast, ETH_ALEN)) {
return true;
}
#endif
if (s->csr[6] & (CSR6_PR | CSR6_RA)) {
/* Promiscuous mode enabled */
@@ -576,7 +581,7 @@ static const uint16_t tulip_mdi_default[] = {
0x0600,
0x0001,
0x0000,
0x0000,
0x3b40,
0x0000,
0x0000,
0x0000,

View File

@@ -1,112 +1,112 @@
static std::unordered_map<uint8_t, uint16_t> be_keycodes = {
{B_F1_KEY, 0x3b},
{B_F2_KEY, 0x3c},
{B_F3_KEY, 0x3d},
{B_F4_KEY, 0x3e},
{B_F5_KEY, 0x3f},
{B_F6_KEY, 0x40},
{B_F7_KEY, 0x41},
{B_F8_KEY, 0x42},
{B_F9_KEY, 0x43},
{B_F10_KEY, 0x44},
{B_F11_KEY, 0x57},
{B_F12_KEY, 0x58},
{B_PRINT_KEY, 0x137},
{B_SCROLL_KEY, 0x46},
{B_PAUSE_KEY, 0x145},
{B_KATAKANA_HIRAGANA, 0x70},
{B_HANKAKU_ZENKAKU, 0x76},
{ B_F1_KEY, 0x3b },
{ B_F2_KEY, 0x3c },
{ B_F3_KEY, 0x3d },
{ B_F4_KEY, 0x3e },
{ B_F5_KEY, 0x3f },
{ B_F6_KEY, 0x40 },
{ B_F7_KEY, 0x41 },
{ B_F8_KEY, 0x42 },
{ B_F9_KEY, 0x43 },
{ B_F10_KEY, 0x44 },
{ B_F11_KEY, 0x57 },
{ B_F12_KEY, 0x58 },
{ B_PRINT_KEY, 0x137 },
{ B_SCROLL_KEY, 0x46 },
{ B_PAUSE_KEY, 0x145 },
{ B_KATAKANA_HIRAGANA, 0x70 },
{ B_HANKAKU_ZENKAKU, 0x76 },
{0x01, 0x01}, /* Escape */
{0x11, 0x29},
{0x12, 0x02},
{0x13, 0x03},
{0x14, 0x04},
{0x15, 0x05},
{0x16, 0x06},
{0x17, 0x07},
{0x18, 0x08},
{0x19, 0x09},
{0x1a, 0x0a},
{0x1b, 0x0b},
{0x1c, 0x0c},
{0x1d, 0x0d},
{0x1e, 0x0e}, /* Backspace */
{0x1f, 0x152}, /* Insert */
{0x20, 0x147}, /* Home */
{0x21, 0x149}, /* Page Up */
{0x22, 0x45},
{0x23, 0x135},
{0x24, 0x37},
{0x25, 0x4a},
{0x26, 0x0f}, /* Tab */
{0x27, 0x10},
{0x28, 0x11},
{0x29, 0x12},
{0x2a, 0x13},
{0x2b, 0x14},
{0x2c, 0x15},
{0x2d, 0x16},
{0x2e, 0x17},
{0x2f, 0x18},
{0x30, 0x19},
{0x31, 0x1a},
{0x32, 0x1b},
{0x33, 0x2b},
{0x34, 0x153}, /* Delete */
{0x35, 0x14f}, /* End */
{0x36, 0x151}, /* Page Down */
{0x37, 0x47},
{0x38, 0x48},
{0x39, 0x49},
{0x3a, 0x4e},
{0x3b, 0x3a},
{0x3c, 0x1e},
{0x3d, 0x1f},
{0x3e, 0x20},
{0x3f, 0x21},
{0x40, 0x22},
{0x41, 0x23},
{0x42, 0x24},
{0x43, 0x25},
{0x44, 0x26},
{0x45, 0x27},
{0x46, 0x28},
{0x47, 0x1c}, /* Enter */
{0x48, 0x4b},
{0x49, 0x4c},
{0x4a, 0x4d},
{0x4b, 0x2a},
{0x4c, 0x2c},
{0x4d, 0x2d},
{0x4e, 0x2e},
{0x4f, 0x2f},
{0x50, 0x30},
{0x51, 0x31},
{0x52, 0x32},
{0x53, 0x33},
{0x54, 0x34},
{0x55, 0x35},
{0x56, 0x36},
{0x57, 0x148}, /* up arrow */
{0x58, 0x51},
{0x59, 0x50},
{0x5a, 0x4f},
{0x5b, 0x11c},
{0x5c, 0x1d},
{0x5d, 0x38},
{0x5e, 0x39}, /* space bar */
{0x5f, 0x138},
{0x60, 0x11d},
{0x61, 0x14b}, /* left arrow */
{0x62, 0x150}, /* down arrow */
{0x63, 0x14d}, /* right arrow */
{0x64, 0x52},
{0x65, 0x53},
{0x66, 0x15b},
{0x67, 0x15c},
{0x68, 0x15d},
{0x69, 0x56},
{0x7e, 0x137}, /* System Request */
{0x7f, 0x145}, /* Break */
{ 0x01, 0x01 }, /* Escape */
{ 0x11, 0x29 },
{ 0x12, 0x02 },
{ 0x13, 0x03 },
{ 0x14, 0x04 },
{ 0x15, 0x05 },
{ 0x16, 0x06 },
{ 0x17, 0x07 },
{ 0x18, 0x08 },
{ 0x19, 0x09 },
{ 0x1a, 0x0a },
{ 0x1b, 0x0b },
{ 0x1c, 0x0c },
{ 0x1d, 0x0d },
{ 0x1e, 0x0e }, /* Backspace */
{ 0x1f, 0x152 }, /* Insert */
{ 0x20, 0x147 }, /* Home */
{ 0x21, 0x149 }, /* Page Up */
{ 0x22, 0x45 },
{ 0x23, 0x135 },
{ 0x24, 0x37 },
{ 0x25, 0x4a },
{ 0x26, 0x0f }, /* Tab */
{ 0x27, 0x10 },
{ 0x28, 0x11 },
{ 0x29, 0x12 },
{ 0x2a, 0x13 },
{ 0x2b, 0x14 },
{ 0x2c, 0x15 },
{ 0x2d, 0x16 },
{ 0x2e, 0x17 },
{ 0x2f, 0x18 },
{ 0x30, 0x19 },
{ 0x31, 0x1a },
{ 0x32, 0x1b },
{ 0x33, 0x2b },
{ 0x34, 0x153 }, /* Delete */
{ 0x35, 0x14f }, /* End */
{ 0x36, 0x151 }, /* Page Down */
{ 0x37, 0x47 },
{ 0x38, 0x48 },
{ 0x39, 0x49 },
{ 0x3a, 0x4e },
{ 0x3b, 0x3a },
{ 0x3c, 0x1e },
{ 0x3d, 0x1f },
{ 0x3e, 0x20 },
{ 0x3f, 0x21 },
{ 0x40, 0x22 },
{ 0x41, 0x23 },
{ 0x42, 0x24 },
{ 0x43, 0x25 },
{ 0x44, 0x26 },
{ 0x45, 0x27 },
{ 0x46, 0x28 },
{ 0x47, 0x1c }, /* Enter */
{ 0x48, 0x4b },
{ 0x49, 0x4c },
{ 0x4a, 0x4d },
{ 0x4b, 0x2a },
{ 0x4c, 0x2c },
{ 0x4d, 0x2d },
{ 0x4e, 0x2e },
{ 0x4f, 0x2f },
{ 0x50, 0x30 },
{ 0x51, 0x31 },
{ 0x52, 0x32 },
{ 0x53, 0x33 },
{ 0x54, 0x34 },
{ 0x55, 0x35 },
{ 0x56, 0x36 },
{ 0x57, 0x148 }, /* up arrow */
{ 0x58, 0x51 },
{ 0x59, 0x50 },
{ 0x5a, 0x4f },
{ 0x5b, 0x11c },
{ 0x5c, 0x1d },
{ 0x5d, 0x38 },
{ 0x5e, 0x39 }, /* space bar */
{ 0x5f, 0x138 },
{ 0x60, 0x11d },
{ 0x61, 0x14b }, /* left arrow */
{ 0x62, 0x150 }, /* down arrow */
{ 0x63, 0x14d }, /* right arrow */
{ 0x64, 0x52 },
{ 0x65, 0x53 },
{ 0x66, 0x15b },
{ 0x67, 0x15c },
{ 0x68, 0x15d },
{ 0x69, 0x56 },
{ 0x7e, 0x137 }, /* System Request */
{ 0x7f, 0x145 }, /* Break */
};

View File

@@ -1,4 +1,5 @@
static std::array<uint32_t, 127> cocoa_keycodes = { /* key names in parentheses are not declared by Apple headers */
static std::array<uint32_t, 127> cocoa_keycodes = {
/* key names in parentheses are not declared by Apple headers */
0x1e, /* ANSI_A */
0x1f, /* ANSI_S */
0x20, /* ANSI_D */
@@ -66,9 +67,9 @@ static std::array<uint32_t, 127> cocoa_keycodes = { /* key names in parentheses
0x5e, /* F17 => F14 */
0x53, /* ANSI_KeypadDecimal */
0,
0x37, /* ANSI_KeypadMultiply */
0x37, /* ANSI_KeypadMultiply */
0,
0x4e, /* ANSI_KeypadPlus */
0x4e, /* ANSI_KeypadPlus */
0,
0x45, /* ANSI_KeypadClear => Num Lock (location equivalent) */
0x130, /* VolumeUp */

View File

@@ -16,132 +16,132 @@
#include <QtDebug>
static std::unordered_map<uint32_t, uint16_t> evdev_keycodes = {
{184, 0x46}, /* F14 => Scroll Lock (for Apple keyboards) */
{86, 0x56}, /* 102ND */
{87, 0x57}, /* F11 */
{88, 0x58}, /* F12 */
{186, 0x5d}, /* F16 => F13 */
{187, 0x5e}, /* F17 => F14 */
{188, 0x5f}, /* F18 => F15 */
{ 184, 0x46 }, /* F14 => Scroll Lock (for Apple keyboards) */
{ 86, 0x56 }, /* 102ND */
{ 87, 0x57 }, /* F11 */
{ 88, 0x58 }, /* F12 */
{ 186, 0x5d }, /* F16 => F13 */
{ 187, 0x5e }, /* F17 => F14 */
{ 188, 0x5f }, /* F18 => F15 */
/* Japanese keys. */
{95, 0x5c}, /* KPJPCOMMA */
{93, 0x70}, /* KATAKANAHIRAGANA */
{89, 0x73}, /* RO */
{85, 0x76}, /* ZENKAKUHANKAKU */
{91, 0x77}, /* HIRAGANA */
{90, 0x78}, /* KATAKANA */
{92, 0x79}, /* HENKAN */
{94, 0x7b}, /* MUHENKAN */
{124, 0x7d}, /* YEN */
{121, 0x7e}, /* KPCOMMA */
{ 95, 0x5c }, /* KPJPCOMMA */
{ 93, 0x70 }, /* KATAKANAHIRAGANA */
{ 89, 0x73 }, /* RO */
{ 85, 0x76 }, /* ZENKAKUHANKAKU */
{ 91, 0x77 }, /* HIRAGANA */
{ 90, 0x78 }, /* KATAKANA */
{ 92, 0x79 }, /* HENKAN */
{ 94, 0x7b }, /* MUHENKAN */
{ 124, 0x7d }, /* YEN */
{ 121, 0x7e }, /* KPCOMMA */
/* Korean keys. */
{123, 0xf1}, /* HANJA */
{122, 0xf2}, /* HANGUL */
{ 123, 0xf1 }, /* HANJA */
{ 122, 0xf2 }, /* HANGUL */
{96, 0x11c}, /* KPENTER */
{97, 0x11d}, /* RIGHTCTRL */
{98, 0x135}, /* KPSLASH */
{99, 0x137}, /* SYSRQ */
{183, 0x137}, /* F13 => SysRq (for Apple keyboards) */
{100, 0x138}, /* RIGHTALT */
{119, 0x145}, /* PAUSE */
{411, 0x145}, /* BREAK */
{185, 0x145}, /* F15 => Pause (for Apple keyboards) */
{102, 0x147}, /* HOME */
{103, 0x148}, /* UP */
{104, 0x149}, /* PAGEUP */
{105, 0x14b}, /* LEFT */
{106, 0x14d}, /* RIGHT */
{107, 0x14f}, /* END */
{108, 0x150}, /* DOWN */
{109, 0x151}, /* PAGEDOWN */
{110, 0x152}, /* INSERT */
{111, 0x153}, /* DELETE */
{ 96, 0x11c }, /* KPENTER */
{ 97, 0x11d }, /* RIGHTCTRL */
{ 98, 0x135 }, /* KPSLASH */
{ 99, 0x137 }, /* SYSRQ */
{ 183, 0x137 }, /* F13 => SysRq (for Apple keyboards) */
{ 100, 0x138 }, /* RIGHTALT */
{ 119, 0x145 }, /* PAUSE */
{ 411, 0x145 }, /* BREAK */
{ 185, 0x145 }, /* F15 => Pause (for Apple keyboards) */
{ 102, 0x147 }, /* HOME */
{ 103, 0x148 }, /* UP */
{ 104, 0x149 }, /* PAGEUP */
{ 105, 0x14b }, /* LEFT */
{ 106, 0x14d }, /* RIGHT */
{ 107, 0x14f }, /* END */
{ 108, 0x150 }, /* DOWN */
{ 109, 0x151 }, /* PAGEDOWN */
{ 110, 0x152 }, /* INSERT */
{ 111, 0x153 }, /* DELETE */
{125, 0x15b}, /* LEFTMETA */
{126, 0x15c}, /* RIGHTMETA */
{127, 0x15d}, /* COMPOSE => Menu */
{ 125, 0x15b }, /* LEFTMETA */
{ 126, 0x15c }, /* RIGHTMETA */
{ 127, 0x15d }, /* COMPOSE => Menu */
/* Multimedia keys. Guideline is to try and follow the Microsoft standard, then
fill in remaining scancodes with OEM-specific keys for redundancy sake. Keys
marked with # are not translated into evdev codes by the standard atkbd driver. */
{634, 0x54}, /* SELECTIVE_SCREENSHOT# => Alt+SysRq */
{117, 0x59}, /* KPEQUAL */
{418, 0x6a}, /* ZOOMIN# => Logitech */
{420, 0x6b}, /* ZOOMRESET# => Logitech */
{223, 0x6d}, /* CANCEL# => Logitech */
{132, 0x101}, /* # Logitech Task Select */
{148, 0x102}, /* PROG1# => Samsung */
{149, 0x103}, /* PROG2# => Samsung */
{419, 0x104}, /* ZOOMOUT# => Logitech */
{144, 0x105}, /* FILE# => Messenger/Files */
{216, 0x105}, /* CHAT# => Messenger/Files */
{430, 0x105}, /* MESSENGER# */
{182, 0x107}, /* REDO# */
{131, 0x108}, /* UNDO# */
{135, 0x10a}, /* PASTE# */
{177, 0x10b}, /* SCROLLUP# => normal speed */
{165, 0x110}, /* PREVIOUSSONG */
{136, 0x112}, /* FIND# => Logitech */
{421, 0x113}, /* WORDPROCESSOR# => Word */
{423, 0x114}, /* SPREADSHEET# => Excel */
{397, 0x115}, /* CALENDAR# */
{433, 0x116}, /* LOGOFF# */
{137, 0x117}, /* CUT# */
{133, 0x118}, /* COPY# */
{163, 0x119}, /* NEXTSONG */
{154, 0x11e}, /* CYCLEWINDOWS => Application Right (no left counterpart) */
{113, 0x120}, /* MUTE */
{140, 0x121}, /* CALC */
{164, 0x122}, /* PLAYPAUSE */
{432, 0x123}, /* SPELLCHECK# */
{166, 0x124}, /* STOPCD */
{139, 0x126}, /* MENU# => Shortcut/Menu/Help for a few OEMs */
{114, 0x12e}, /* VOL- */
{160, 0x12f}, /* CLOSECD# => Logitech Eject */
{161, 0x12f}, /* EJECTCD# => Logitech */
{162, 0x12f}, /* EJECTCLOSECD# => Logitech */
{115, 0x130}, /* VOL+ */
{150, 0x132}, /* WWW# */
{172, 0x132}, /* HOMEPAGE */
{138, 0x13b}, /* HELP# */
{213, 0x13c}, /* SOUND# => My Music/Office Home */
{360, 0x13c}, /* VENDOR# => My Music/Office Home */
{204, 0x13d}, /* DASHBOARD# => Task Pane */
{181, 0x13e}, /* NEW# */
{134, 0x13f}, /* OPEN# */
{206, 0x140}, /* CLOSE# */
{232, 0x141}, /* REPLY# */
{233, 0x142}, /* FORWARDMAIL# */
{231, 0x143}, /* SEND# */
{151, 0x144}, /* MSDOS# */
{112, 0x14c}, /* MACRO */
{179, 0x14c}, /* KPLEFTPAREN# */
{118, 0x14e}, /* KPPLUSMINUS */
{235, 0x155}, /* DOCUMENTS# => Logitech */
{234, 0x157}, /* SAVE# */
{210, 0x158}, /* PRINT# */
{116, 0x15e}, /* POWER */
{142, 0x15f}, /* SLEEP */
{143, 0x163}, /* WAKEUP */
{180, 0x164}, /* KPRIGHTPAREN# */
{212, 0x164}, /* CAMERA# => My Pictures */
{217, 0x165}, /* SEARCH */
{156, 0x166}, /* BOOKMARKS => Favorites */
{364, 0x166}, /* FAVORITES# */
{173, 0x167}, /* REFRESH */
{128, 0x168}, /* STOP */
{159, 0x169}, /* FORWARD */
{158, 0x16a}, /* BACK */
{157, 0x16b}, /* COMPUTER */
{155, 0x16c}, /* MAIL */
{215, 0x16c}, /* EMAIL# */
{226, 0x16d}, /* MEDIA */
{167, 0x178}, /* RECORD# => Logitech */
{152, 0x17a}, /* COFFEE/SCREENLOCK# */
{178, 0x18b}, /* SCROLLDOWN# => normal speed */
{ 634, 0x54 }, /* SELECTIVE_SCREENSHOT# => Alt+SysRq */
{ 117, 0x59 }, /* KPEQUAL */
{ 418, 0x6a }, /* ZOOMIN# => Logitech */
{ 420, 0x6b }, /* ZOOMRESET# => Logitech */
{ 223, 0x6d }, /* CANCEL# => Logitech */
{ 132, 0x101 }, /* # Logitech Task Select */
{ 148, 0x102 }, /* PROG1# => Samsung */
{ 149, 0x103 }, /* PROG2# => Samsung */
{ 419, 0x104 }, /* ZOOMOUT# => Logitech */
{ 144, 0x105 }, /* FILE# => Messenger/Files */
{ 216, 0x105 }, /* CHAT# => Messenger/Files */
{ 430, 0x105 }, /* MESSENGER# */
{ 182, 0x107 }, /* REDO# */
{ 131, 0x108 }, /* UNDO# */
{ 135, 0x10a }, /* PASTE# */
{ 177, 0x10b }, /* SCROLLUP# => normal speed */
{ 165, 0x110 }, /* PREVIOUSSONG */
{ 136, 0x112 }, /* FIND# => Logitech */
{ 421, 0x113 }, /* WORDPROCESSOR# => Word */
{ 423, 0x114 }, /* SPREADSHEET# => Excel */
{ 397, 0x115 }, /* CALENDAR# */
{ 433, 0x116 }, /* LOGOFF# */
{ 137, 0x117 }, /* CUT# */
{ 133, 0x118 }, /* COPY# */
{ 163, 0x119 }, /* NEXTSONG */
{ 154, 0x11e }, /* CYCLEWINDOWS => Application Right (no left counterpart) */
{ 113, 0x120 }, /* MUTE */
{ 140, 0x121 }, /* CALC */
{ 164, 0x122 }, /* PLAYPAUSE */
{ 432, 0x123 }, /* SPELLCHECK# */
{ 166, 0x124 }, /* STOPCD */
{ 139, 0x126 }, /* MENU# => Shortcut/Menu/Help for a few OEMs */
{ 114, 0x12e }, /* VOL- */
{ 160, 0x12f }, /* CLOSECD# => Logitech Eject */
{ 161, 0x12f }, /* EJECTCD# => Logitech */
{ 162, 0x12f }, /* EJECTCLOSECD# => Logitech */
{ 115, 0x130 }, /* VOL+ */
{ 150, 0x132 }, /* WWW# */
{ 172, 0x132 }, /* HOMEPAGE */
{ 138, 0x13b }, /* HELP# */
{ 213, 0x13c }, /* SOUND# => My Music/Office Home */
{ 360, 0x13c }, /* VENDOR# => My Music/Office Home */
{ 204, 0x13d }, /* DASHBOARD# => Task Pane */
{ 181, 0x13e }, /* NEW# */
{ 134, 0x13f }, /* OPEN# */
{ 206, 0x140 }, /* CLOSE# */
{ 232, 0x141 }, /* REPLY# */
{ 233, 0x142 }, /* FORWARDMAIL# */
{ 231, 0x143 }, /* SEND# */
{ 151, 0x144 }, /* MSDOS# */
{ 112, 0x14c }, /* MACRO */
{ 179, 0x14c }, /* KPLEFTPAREN# */
{ 118, 0x14e }, /* KPPLUSMINUS */
{ 235, 0x155 }, /* DOCUMENTS# => Logitech */
{ 234, 0x157 }, /* SAVE# */
{ 210, 0x158 }, /* PRINT# */
{ 116, 0x15e }, /* POWER */
{ 142, 0x15f }, /* SLEEP */
{ 143, 0x163 }, /* WAKEUP */
{ 180, 0x164 }, /* KPRIGHTPAREN# */
{ 212, 0x164 }, /* CAMERA# => My Pictures */
{ 217, 0x165 }, /* SEARCH */
{ 156, 0x166 }, /* BOOKMARKS => Favorites */
{ 364, 0x166 }, /* FAVORITES# */
{ 173, 0x167 }, /* REFRESH */
{ 128, 0x168 }, /* STOP */
{ 159, 0x169 }, /* FORWARD */
{ 158, 0x16a }, /* BACK */
{ 157, 0x16b }, /* COMPUTER */
{ 155, 0x16c }, /* MAIL */
{ 215, 0x16c }, /* EMAIL# */
{ 226, 0x16d }, /* MEDIA */
{ 167, 0x178 }, /* RECORD# => Logitech */
{ 152, 0x17a }, /* COFFEE/SCREENLOCK# */
{ 178, 0x18b }, /* SCROLLDOWN# => normal speed */
};
uint16_t

View File

@@ -975,10 +975,10 @@ msgstr ""
msgid "Thrustmaster FCS + Rudder Control System"
msgstr ""
msgid "Thrustmaster Formula T1/T2 with Adaptor"
msgid "Thrustmaster Formula T1/T2 with adapter"
msgstr ""
msgid "Thrustmaster Formula T1/T2 without Adaptor"
msgid "Thrustmaster Formula T1/T2 without adapter"
msgstr ""
msgid "None"
@@ -2253,6 +2253,18 @@ msgstr ""
msgid "WSS DMA"
msgstr ""
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr ""
@@ -2880,6 +2892,9 @@ msgstr ""
msgid "Toggle fullscreen"
msgstr ""
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr ""

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA kanál WSS"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Povolit OPL"
@@ -2880,6 +2892,9 @@ msgstr "Stisknout Ctrl+Alt+Esc"
msgid "Toggle fullscreen"
msgstr "Přepnout režim celé obrazovky"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Pořídit snímek obrazovky"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS-IRQ"
msgid "WSS DMA"
msgstr "WSS-DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPL einschalten"
@@ -2880,6 +2892,9 @@ msgstr "Strg+Alt+Esc senden"
msgid "Toggle fullscreen"
msgstr "Vollbild umschalten"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Bildschirmaufnahme"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ de WSS"
msgid "WSS DMA"
msgstr "DMA de WSS"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Habilitar OPL"
@@ -2880,6 +2892,9 @@ msgstr "Enviar Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Alternar pantalla completa"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Captura de pantalla"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS-IRQ"
msgid "WSS DMA"
msgstr "WSS-DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPL"
@@ -2880,6 +2892,9 @@ msgstr "Lähetä Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Koko näyttö"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Kuvakaappaus"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Activer OPL"
@@ -2880,6 +2892,9 @@ msgstr "Envoyer Ctrl+Alt+Échap"
msgid "Toggle fullscreen"
msgstr "Activer/désactiver le mode plein écran"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Capture d'écran"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS-a"
msgid "WSS DMA"
msgstr "DMA WSS-a"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Omogući OPL"
@@ -2880,6 +2892,9 @@ msgstr "Pošalji Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Uključi/isključi cijelozaslonski način"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Snimka zaslona"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Abilita OPL"
@@ -2880,6 +2892,9 @@ msgstr "Invia Ctrl+Alt+Esc"
msgid "Toggle fullscreen"
msgstr "Attiva/disattiva schermo intero"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Istantanea dello schermo"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPLを有効にする"
@@ -2880,6 +2892,9 @@ msgstr "Ctrl+Alt+Escを送信"
msgid "Toggle fullscreen"
msgstr "フルスクリーン表示を切り替える"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "スクリーンショット"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPL 사용"
@@ -2880,6 +2892,9 @@ msgstr "Ctrl+Alt+Esc 보내기"
msgid "Toggle fullscreen"
msgstr "전체 화면 모드 전환"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "스크린샷"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS-IRQ"
msgid "WSS DMA"
msgstr "WSS-DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Aktiver OPL"
@@ -2880,6 +2892,9 @@ msgstr "Send Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Veksle fullskjerm"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Skjermbilde"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPL inschakelen"
@@ -2880,6 +2892,9 @@ msgstr "Stuur Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Volledig scherm omschakelen"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Schermafbeelding"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Włącz OPL"
@@ -2880,6 +2892,9 @@ msgstr "Wyślij Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Przełącz pełny ekran"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Zrzut ekranu"

View File

@@ -850,7 +850,7 @@ msgid "Invalid PCap device"
msgstr "Dispositivo PCap inválido"
msgid "Generic paddle controller(s)"
msgstr "Controlador(es) genérico(s) de "
msgstr "Controlador(es) genérico(s) de raquete"
msgid "2-axis, 1-button joystick(s)"
msgstr "Joystick(s) de 2 eixos, 1 botões"
@@ -901,7 +901,7 @@ msgid "6-button gamepad"
msgstr "Gamepad de 6 botões"
msgid "Gravis PC GamePad"
msgstr "Gravis PC GamePad"
msgstr "GamePad Gravis PC"
msgid "2-button flight yoke"
msgstr "Manche de voo de 2 botões"
@@ -934,10 +934,10 @@ msgid "CH Flightstick"
msgstr "CH Flightstick"
msgid "CH Flightstick + CH Pedals"
msgstr "CH Flightstick + CH Pedals"
msgstr "CH Flightstick + Pedais CH"
msgid "CH Flightstick + CH Pedals Pro"
msgstr "CH Flightstick + CH Pedals Pro"
msgstr "CH Flightstick + Pedais CH Pro"
msgid "CH Flightstick Pro"
msgstr "CH Flightstick Pro"
@@ -1855,7 +1855,7 @@ msgid "VDE Socket:"
msgstr "Soquete VDE:"
msgid "TAP Bridge Device:"
msgstr ""
msgstr "Dispositivo Ponte TAP"
msgid "86Box Unit Tester"
msgstr "Testador de unidade 86Box"
@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr "IRQ RTC"
msgid "RTC Port Address"
msgstr "Endereço Porta RTC"
msgid "Onboard RTC"
msgstr "RTC Integrado"
msgid "Not installed"
msgstr "Não instalado"
msgid "Enable OPL"
msgstr "Ativar OPL"
@@ -2880,6 +2892,9 @@ msgstr "Enviar Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Alternar tela cheia"
msgid "Toggle UI in fullscreen"
msgstr "Alternar interface em tela cheia"
msgid "Screenshot"
msgstr "Captura de tela"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Ativar OPL"
@@ -2880,6 +2892,9 @@ msgstr "Enviar Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Alternar o modo em ecrã cheio"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Captura de ecrã"

View File

@@ -973,7 +973,7 @@ msgid "Thrustmaster Flight Control System"
msgstr "Система управления полётом Thrustmaster"
msgid "Thrustmaster FCS + Rudder Control System"
msgstr "Thrustmaster FCS + Система управления рулем"
msgstr "Thrustmaster FCS + Система управления рулём"
msgid "Thrustmaster Formula T1/T2 with adapter"
msgstr "Thrustmaster Formula T1/T2 с адаптером"
@@ -2221,7 +2221,7 @@ msgid "Enable Game port"
msgstr "Включить игровой порт"
msgid "Enable Adlib ports"
msgstr "Включить порты Adlib"
msgstr "Включить порты AdLib"
msgid "SID Model"
msgstr "Модель SID"
@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr "IRQ RTC"
msgid "RTC Port Address"
msgstr "Адрес порта RTC"
msgid "Onboard RTC"
msgstr "Встроенный RTC"
msgid "Not installed"
msgstr "Не установлен"
msgid "Enable OPL"
msgstr "Включить OPL"
@@ -2880,6 +2892,9 @@ msgstr "Отправить Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Переключить полноэкранный режим"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Скриншот"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Povolenie OPL"
@@ -2880,6 +2892,9 @@ msgstr "Stlačte Ctrl+Alt+Esc"
msgid "Toggle fullscreen"
msgstr "Prepnúť režim celej obrazovky"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Zhotoviť snímku obrazovky"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Omogoči OPL"
@@ -2880,6 +2892,9 @@ msgstr "Pošlji Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Preklopi celozaslonski način"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Zajem zaslona"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Aktivera OPL"
@@ -2880,6 +2892,9 @@ msgstr "Skicka Ctrl+Alt+Esc"
msgid "Toggle fullscreen"
msgstr "Helskärm"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Skärmbild"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "OPL'yi etkinleştir"
@@ -2880,6 +2892,9 @@ msgstr "Control+Alt+Escape gönder"
msgid "Toggle fullscreen"
msgstr "Tam ekran modunu ayarla"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Ekran görüntüsü"

View File

@@ -2253,6 +2253,18 @@ msgstr "IRQ WSS"
msgid "WSS DMA"
msgstr "DMA WSS"
msgid "RTC IRQ"
msgstr "IRQ RTC"
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Ввімкнути OPL"
@@ -2880,6 +2892,9 @@ msgstr "Надіслати Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Переключити повноекранний режим"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Скріншот"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "Bật OPL"
@@ -2880,6 +2892,9 @@ msgstr "Gửi Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "Bật/tắt toàn màn hình"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "Chụp màn hình"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "启用 OPL"
@@ -2880,6 +2892,9 @@ msgstr "发送 Ctrl+Alt+Esc"
msgid "Toggle fullscreen"
msgstr "切换全屏"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "截图"

View File

@@ -2253,6 +2253,18 @@ msgstr "WSS IRQ"
msgid "WSS DMA"
msgstr "WSS DMA"
msgid "RTC IRQ"
msgstr ""
msgid "RTC Port Address"
msgstr ""
msgid "Onboard RTC"
msgstr ""
msgid "Not installed"
msgstr ""
msgid "Enable OPL"
msgstr "啟用 OPL"
@@ -2880,6 +2892,9 @@ msgstr "傳送 Control+Alt+Escape"
msgid "Toggle fullscreen"
msgstr "切換全螢幕"
msgid "Toggle UI in fullscreen"
msgstr ""
msgid "Screenshot"
msgstr "螢幕截圖"
@@ -2956,7 +2971,7 @@ msgid "Unable to determine release information"
msgstr "無法確定釋放資訊"
msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later."
msgstr "檢查更新時出錯:\n'\n%1\n\n請稍後再試。"
msgstr "檢查更新時出錯:\n\n%1\n\n請稍後再試。"
msgid "Update check complete"
msgstr "更新檢查完成"

View File

@@ -3,8 +3,7 @@
#include <QPushButton>
extern "C"
{
extern "C" {
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/vid_cga_comp.h>
@@ -16,11 +15,11 @@ CGASettingsDialog::CGASettingsDialog(QWidget *parent)
{
ui->setupUi(this);
cga_hue = vid_cga_comp_hue;
cga_hue = vid_cga_comp_hue;
cga_saturation = vid_cga_comp_saturation;
cga_brightness = vid_cga_comp_brightness;
cga_contrast = vid_cga_comp_contrast;
cga_sharpness = vid_cga_comp_sharpness;
cga_contrast = vid_cga_comp_contrast;
cga_sharpness = vid_cga_comp_sharpness;
ui->horizontalSliderHue->setValue(vid_cga_comp_hue);
ui->horizontalSliderSaturation->setValue(vid_cga_comp_saturation);
@@ -29,8 +28,7 @@ CGASettingsDialog::CGASettingsDialog(QWidget *parent)
ui->horizontalSliderSharpness->setValue(vid_cga_comp_sharpness);
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &CGASettingsDialog::applySettings);
connect(ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [this]
{
connect(ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [this] {
ui->horizontalSliderHue->setValue(0);
ui->horizontalSliderSaturation->setValue(100);
ui->horizontalSliderBrightness->setValue(0);
@@ -38,11 +36,11 @@ CGASettingsDialog::CGASettingsDialog(QWidget *parent)
ui->horizontalSliderSharpness->setValue(0);
});
connect(ui->horizontalSliderHue, &QSlider::valueChanged, this, [this] { updateDisplay(); } );
connect(ui->horizontalSliderSaturation, &QSlider::valueChanged, this, [this] { updateDisplay(); } );
connect(ui->horizontalSliderBrightness, &QSlider::valueChanged, this, [this] { updateDisplay(); } );
connect(ui->horizontalSliderContrast, &QSlider::valueChanged, this, [this] { updateDisplay(); } );
connect(ui->horizontalSliderSharpness, &QSlider::valueChanged, this, [this] { updateDisplay(); } );
connect(ui->horizontalSliderHue, &QSlider::valueChanged, this, [this] { updateDisplay(); });
connect(ui->horizontalSliderSaturation, &QSlider::valueChanged, this, [this] { updateDisplay(); });
connect(ui->horizontalSliderBrightness, &QSlider::valueChanged, this, [this] { updateDisplay(); });
connect(ui->horizontalSliderContrast, &QSlider::valueChanged, this, [this] { updateDisplay(); });
connect(ui->horizontalSliderSharpness, &QSlider::valueChanged, this, [this] { updateDisplay(); });
}
CGASettingsDialog::~CGASettingsDialog()
@@ -50,7 +48,8 @@ CGASettingsDialog::~CGASettingsDialog()
delete ui;
}
void CGASettingsDialog::updateDisplay()
void
CGASettingsDialog::updateDisplay()
{
auto temp_cga_comp_hue = ui->horizontalSliderHue->value();
auto temp_cga_comp_saturation = ui->horizontalSliderSaturation->value();
@@ -60,7 +59,8 @@ void CGASettingsDialog::updateDisplay()
cga_comp_reload(temp_cga_comp_brightness, temp_cga_comp_saturation, temp_cga_comp_sharpness, temp_cga_comp_hue, temp_cga_comp_contrast);
}
void CGASettingsDialog::applySettings()
void
CGASettingsDialog::applySettings()
{
vid_cga_comp_hue = ui->horizontalSliderHue->value();
vid_cga_comp_saturation = ui->horizontalSliderSaturation->value();
@@ -69,26 +69,27 @@ void CGASettingsDialog::applySettings()
vid_cga_comp_sharpness = ui->horizontalSliderSharpness->value();
cga_comp_reload(vid_cga_comp_brightness, vid_cga_comp_saturation, vid_cga_comp_sharpness, vid_cga_comp_hue, vid_cga_comp_contrast);
cga_hue = vid_cga_comp_hue;
cga_hue = vid_cga_comp_hue;
cga_saturation = vid_cga_comp_saturation;
cga_brightness = vid_cga_comp_brightness;
cga_contrast = vid_cga_comp_contrast;
cga_sharpness = vid_cga_comp_sharpness;
cga_contrast = vid_cga_comp_contrast;
cga_sharpness = vid_cga_comp_sharpness;
}
void CGASettingsDialog::on_buttonBox_accepted()
void
CGASettingsDialog::on_buttonBox_accepted()
{
applySettings();
}
void CGASettingsDialog::on_buttonBox_rejected()
void
CGASettingsDialog::on_buttonBox_rejected()
{
vid_cga_comp_hue = cga_hue;
vid_cga_comp_hue = cga_hue;
vid_cga_comp_saturation = cga_saturation;
vid_cga_comp_brightness = cga_brightness;
vid_cga_comp_contrast = cga_contrast;
vid_cga_comp_sharpness = cga_sharpness;
vid_cga_comp_contrast = cga_contrast;
vid_cga_comp_sharpness = cga_sharpness;
cga_comp_reload(vid_cga_comp_brightness, vid_cga_comp_saturation, vid_cga_comp_sharpness, vid_cga_comp_hue, vid_cga_comp_contrast);
}

View File

@@ -50,7 +50,7 @@ extern "C" {
# include <sys/sysmacros.h>
#endif
#ifdef Q_OS_WINDOWS
#include <windows.h>
# include <windows.h>
#endif
DeviceConfig::DeviceConfig(QWidget *parent)
@@ -87,15 +87,16 @@ EnumerateSerialDevices()
for (int i = 1; i < 256; i++) {
devstr[0] = 0;
snprintf(devstr.data(), 1024, R"(\\.\COM%d)", i);
const auto handle = CreateFileA(devstr.data(),
GENERIC_READ | GENERIC_WRITE, 0,
nullptr, OPEN_EXISTING,
0, nullptr);
const auto handle = CreateFileA(devstr.data(),
GENERIC_READ | GENERIC_WRITE, 0,
nullptr, OPEN_EXISTING,
0, nullptr);
const auto dwError = GetLastError();
if ((handle != INVALID_HANDLE_VALUE) || (dwError == ERROR_ACCESS_DENIED) ||
(dwError == ERROR_GEN_FAILURE) || (dwError == ERROR_SHARING_VIOLATION) ||
(dwError == ERROR_SEM_TIMEOUT)) {
if (handle != INVALID_HANDLE_VALUE) CloseHandle(handle);
if (handle != INVALID_HANDLE_VALUE)
CloseHandle(handle);
serialDevices.push_back(QString(devstr));
}
}
@@ -114,8 +115,8 @@ EnumerateSerialDevices()
void
DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
{
auto * device_context = static_cast<device_context_t *>(dc);
const auto * config = static_cast<const _device_config_ *>(c);
auto *device_context = static_cast<device_context_t *>(dc);
const auto *config = static_cast<const _device_config_ *>(c);
const QString blank = "";
int p;
int q;
@@ -136,7 +137,7 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
const int config_major_type = (config_type >> CONFIG_SHIFT) << CONFIG_SHIFT;
int value = 0;
int value = 0;
auto selected = blank;
switch (config_major_type) {
@@ -164,210 +165,211 @@ DeviceConfig::ProcessConfig(void *dc, const void *c, const bool is_dep)
default:
break;
case CONFIG_BINARY:
{
auto *cbox = new QCheckBox();
cbox->setObjectName(config->name);
cbox->setChecked(value > 0);
this->ui->formLayout->addRow(tr(config->description), cbox);
break;
}
{
auto *cbox = new QCheckBox();
cbox->setObjectName(config->name);
cbox->setChecked(value > 0);
this->ui->formLayout->addRow(tr(config->description), cbox);
break;
}
#ifdef USE_RTMIDI
case CONFIG_MIDI_OUT:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
for (int i = 0; i < rtmidi_out_get_num_devs(); i++) {
char midiName[512] = { 0 };
rtmidi_out_get_dev_name(i, midiName);
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
for (int i = 0; i < rtmidi_out_get_num_devs(); i++) {
char midiName[512] = { 0 };
rtmidi_out_get_dev_name(i, midiName);
Models::AddEntry(model, midiName, i);
if (i == value)
currentIndex = i;
Models::AddEntry(model, midiName, i);
if (i == value)
currentIndex = i;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
case CONFIG_MIDI_IN:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
for (int i = 0; i < rtmidi_in_get_num_devs(); i++) {
char midiName[512] = { 0 };
rtmidi_in_get_dev_name(i, midiName);
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
for (int i = 0; i < rtmidi_in_get_num_devs(); i++) {
char midiName[512] = { 0 };
rtmidi_in_get_dev_name(i, midiName);
Models::AddEntry(model, midiName, i);
if (i == value)
currentIndex = i;
Models::AddEntry(model, midiName, i);
if (i == value)
currentIndex = i;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
#endif
case CONFIG_INT:
case CONFIG_SELECTION:
case CONFIG_HEX16:
case CONFIG_HEX20:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
for (auto *sel = config->selection; (sel != nullptr) && (sel->description != nullptr) &&
(strlen(sel->description) > 0); ++sel) {
int row = Models::AddEntry(model, tr(sel->description), sel->value);
for (auto *sel = config->selection; (sel != nullptr) && (sel->description != nullptr) &&
(strlen(sel->description) > 0); ++sel) {
int row = Models::AddEntry(model, tr(sel->description), sel->value);
if (sel->value == value)
currentIndex = row;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
case CONFIG_BIOS:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
q = 0;
for (auto *bios = config->bios; (bios != nullptr) &&
(bios->name != nullptr) &&
(bios->internal_name != nullptr) &&
(strlen(bios->name) > 0) &&
(strlen(bios->internal_name) > 0) &&
(bios->files_no > 0); ++bios) {
p = 0;
for (int d = 0; d < bios->files_no; d++)
p += !!rom_present(const_cast<char *>(bios->files[d]));
if (p == bios->files_no) {
const int row = Models::AddEntry(model, tr(bios->name), q);
if (!strcmp(selected.toUtf8().constData(), bios->internal_name))
if (sel->value == value)
currentIndex = row;
}
q++;
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
case CONFIG_BIOS:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = -1;
q = 0;
for (auto *bios = config->bios; (bios != nullptr) &&
(bios->name != nullptr) &&
(bios->internal_name != nullptr) &&
(strlen(bios->name) > 0) &&
(strlen(bios->internal_name) > 0) &&
(bios->files_no > 0); ++bios) {
p = 0;
for (int d = 0; d < bios->files_no; d++)
p += !!rom_present(const_cast<char *>(bios->files[d]));
if (p == bios->files_no) {
const int row = Models::AddEntry(model, tr(bios->name), q);
if (!strcmp(selected.toUtf8().constData(), bios->internal_name))
currentIndex = row;
}
q++;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
case CONFIG_SPINNER:
{
auto *spinBox = new QSpinBox();
spinBox->setObjectName(config->name);
spinBox->setMaximum(config->spinner.max);
spinBox->setMinimum(config->spinner.min);
if (config->spinner.step > 0)
spinBox->setSingleStep(config->spinner.step);
spinBox->setValue(value);
this->ui->formLayout->addRow(tr(config->description), spinBox);
break;
}
{
auto *spinBox = new QSpinBox();
spinBox->setObjectName(config->name);
spinBox->setMaximum(config->spinner.max);
spinBox->setMinimum(config->spinner.min);
if (config->spinner.step > 0)
spinBox->setSingleStep(config->spinner.step);
spinBox->setValue(value);
this->ui->formLayout->addRow(tr(config->description), spinBox);
break;
}
case CONFIG_FNAME:
{
auto *fileField = new FileField(this);
fileField->setObjectName(config->name);
fileField->setFileName(selected);
/* Get the actually used part of the filter */
{
auto *fileField = new FileField(this);
fileField->setObjectName(config->name);
fileField->setFileName(selected);
/* Get the actually used part of the filter */
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QString filter = QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter, "|")));
QString filter = QString(config->file_filter).left(static_cast<int>(strcspn(config->file_filter, "|")));
#else
QString filter = QString(config->file_filter).split("|").at(0);
QString filter = QString(config->file_filter).split("|").at(0);
#endif
/* Extract the description and the extension list */
QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter);
QString description = match.captured(1);
QString extensions = match.captured(2);
/* Split the extension list up and strip the filename globs */
QRegularExpression re("\\*\\.(.*)");
/* Extract the description and the extension list */
QRegularExpressionMatch match = QRegularExpression("(.+) \\((.+)\\)$").match(filter);
QString description = match.captured(1);
QString extensions = match.captured(2);
/* Split the extension list up and strip the filename globs */
QRegularExpression re("\\*\\.(.*)");
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QStringList extensionList;
int i = 0;
while (extensions.section(' ', i, i) != "") {
QString extension = re.match(extensions.section(' ', i, i)).captured(1);
extensionList.append(extension);
i++;
QStringList extensionList;
int i = 0;
while (extensions.section(' ', i, i) != "") {
QString extension = re.match(extensions.section(' ', i, i)).captured(1);
extensionList.append(extension);
i++;
}
#else
QStringList extensionList = extensions.split(" ");
for (int i = 0; i < extensionList.count(); i++)
extensionList[i] = re.match(extensionList[i]).captured(1);
#endif
fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true));
this->ui->formLayout->addRow(tr(config->description), fileField);
break;
}
#else
QStringList extensionList = extensions.split(" ");
for (int i = 0; i < extensionList.count(); i++)
extensionList[i] = re.match(extensionList[i]).captured(1);
#endif
fileField->setFilter(tr(description.toUtf8().constData()) % util::DlgFilter(extensionList) % tr("All files") % util::DlgFilter({ "*" }, true));
this->ui->formLayout->addRow(tr(config->description), fileField);
break;
}
case CONFIG_STRING:
{
const auto lineEdit = new QLineEdit;
lineEdit->setObjectName(config->name);
lineEdit->setCursor(Qt::IBeamCursor);
lineEdit->setText(selected);
this->ui->formLayout->addRow(tr(config->description), lineEdit);
break;
}
{
const auto lineEdit = new QLineEdit;
lineEdit->setObjectName(config->name);
lineEdit->setCursor(Qt::IBeamCursor);
lineEdit->setText(selected);
this->ui->formLayout->addRow(tr(config->description), lineEdit);
break;
}
case CONFIG_SERPORT:
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = 0;
auto serialDevices = EnumerateSerialDevices();
{
auto *cbox = new QComboBox();
cbox->setObjectName(config->name);
cbox->setMaxVisibleItems(30);
auto *model = cbox->model();
int currentIndex = 0;
auto serialDevices = EnumerateSerialDevices();
Models::AddEntry(model, tr("None"), -1);
for (int i = 0; i < serialDevices.size(); i++) {
const int row = Models::AddEntry(model, serialDevices[i], i);
if (selected == serialDevices[i])
currentIndex = row;
Models::AddEntry(model, tr("None"), -1);
for (int i = 0; i < serialDevices.size(); i++) {
const int row = Models::AddEntry(model, serialDevices[i], i);
if (selected == serialDevices[i])
currentIndex = row;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
this->ui->formLayout->addRow(tr(config->description), cbox);
cbox->setCurrentIndex(currentIndex);
break;
}
case CONFIG_MAC:
{
// QHBoxLayout for the line edit widget and the generate button
const auto hboxLayout = new QHBoxLayout();
const auto generateButton = new QPushButton(tr("Generate"));
const auto lineEdit = new QLineEdit;
// Allow the line edit to expand and fill available space
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred);
lineEdit->setInputMask("HH:HH:HH;0");
lineEdit->setObjectName(config->name);
// Display the current or generated MAC in uppercase
// When stored it will be converted to lowercase
if (config_get_mac(device_context->name, config->name,
config->default_int) & 0xFF000000) {
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
random_generate(), random_generate()));
} else {
auto current_mac = QString(config_get_string(device_context->name, config->name,
const_cast<char *>(config->default_string)));
lineEdit->setText(current_mac.toUpper());
{
// QHBoxLayout for the line edit widget and the generate button
const auto hboxLayout = new QHBoxLayout();
const auto generateButton = new QPushButton(tr("Generate"));
const auto lineEdit = new QLineEdit;
// Allow the line edit to expand and fill available space
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
lineEdit->setInputMask("HH:HH:HH;0");
lineEdit->setObjectName(config->name);
// Display the current or generated MAC in uppercase
// When stored it will be converted to lowercase
if (config_get_mac(device_context->name, config->name,
config->default_int)
& 0xFF000000) {
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
random_generate(), random_generate()));
} else {
auto current_mac = QString(config_get_string(device_context->name, config->name,
const_cast<char *>(config->default_string)));
lineEdit->setText(current_mac.toUpper());
}
// Action for the generate button
connect(generateButton, &QPushButton::clicked, [lineEdit] {
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
random_generate(), random_generate()));
});
hboxLayout->addWidget(lineEdit);
hboxLayout->addWidget(generateButton);
this->ui->formLayout->addRow(tr(config->description), hboxLayout);
break;
}
// Action for the generate button
connect(generateButton, &QPushButton::clicked, [lineEdit] {
lineEdit->setText(QString::asprintf("%02X:%02X:%02X", random_generate(),
random_generate(), random_generate()));
});
hboxLayout->addWidget(lineEdit);
hboxLayout->addWidget(generateButton);
this->ui->formLayout->addRow(tr(config->description), hboxLayout);
break;
}
}
++config;
}

View File

@@ -28,7 +28,7 @@ public:
private:
Ui::DeviceConfig *ui;
void ProcessConfig(void *dc, const void *c, bool is_dep);
void ProcessConfig(void *dc, const void *c, bool is_dep);
};
#endif // QT_DEVICECONFIG_HPP

View File

@@ -23,8 +23,7 @@ extern "C" {
#include <86box/plat.h>
}
Downloader::
Downloader(const DownloadLocation downloadLocation, QObject *parent)
Downloader::Downloader(const DownloadLocation downloadLocation, QObject *parent)
: QObject(parent)
, file(nullptr)
, reply(nullptr)
@@ -51,7 +50,9 @@ Downloader(const DownloadLocation downloadLocation, QObject *parent)
Downloader::~Downloader() { delete file; }
void Downloader::download(const QUrl &url, const QString &filepath, const QVariant &varData) {
void
Downloader::download(const QUrl &url, const QString &filepath, const QVariant &varData)
{
variantData = varData;
// temporary until I get the plat stuff fixed
@@ -62,7 +63,7 @@ void Downloader::download(const QUrl &url, const QString &filepath, const QVaria
const auto final_path = downloadDirectory.filePath(filepath);
file = new QFile(final_path);
if(!file->open(QIODevice::WriteOnly)) {
if (!file->open(QIODevice::WriteOnly)) {
qWarning() << "Unable to open file " << final_path;
return;
}
@@ -70,7 +71,7 @@ void Downloader::download(const QUrl &url, const QString &filepath, const QVaria
const auto nam = new QNetworkAccessManager(this);
// Create the network request and execute
const auto request = QNetworkRequest(url);
reply = nam->get(request);
reply = nam->get(request);
// Connect to the finished signal
connect(reply, &QNetworkReply::finished, this, &Downloader::onResult);
}
@@ -93,4 +94,3 @@ Downloader::onResult()
qDebug() << Q_FUNC_INFO << "Downloaded complete: file written to " << file->fileName();
emit downloadCompleted(file->fileName(), variantData);
}

View File

@@ -20,7 +20,6 @@
#include <QString>
#include <QFile>
class Downloader final : public QObject {
Q_OBJECT
public:
@@ -38,17 +37,17 @@ signals:
// Signal emitted when the download is successful
void downloadCompleted(QString filename, QVariant varData);
// Signal emitted when an error occurs
void errorOccurred(const QString&);
void errorOccurred(const QString &);
private slots:
void onResult();
private:
QFile *file;
QFile *file;
QNetworkAccessManager nam;
QNetworkReply *reply;
QVariant variantData;
QDir downloadDirectory;
QNetworkReply *reply;
QVariant variantData;
QDir downloadDirectory;
};
#endif

View File

@@ -3,15 +3,14 @@
#include <QWindow>
#include <QCoreApplication>
extern MainWindow* main_window;
extern MainWindow *main_window;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdint.h>
extern "C"
{
extern "C" {
#include <86box/86box.h>
#include <86box/ini.h>
#include <86box/config.h>
@@ -19,25 +18,32 @@ extern "C"
#include <86box/path.h>
#include <86box/plat.h>
extern void startblit();
extern void endblit();
extern void startblit();
extern void endblit();
extern ssize_t local_getline(char **buf, size_t *bufsiz, FILE *fp);
extern char* trim(char* str);
extern char *trim(char *str);
}
#define safe_strncpy(a, b, n) \
do { \
strncpy((a), (b), (n)-1); \
(a)[(n)-1] = 0; \
} while (0)
#define safe_strncpy(a, b, n) \
do { \
strncpy((a), (b), (n) - 1); \
(a)[(n) - 1] = 0; \
} while (0)
static inline void *
wx_config_load(const char *path)
{
ini_t ini = ini_read(path);
if (ini)
ini_strip_quotes(ini);
return (void *) ini;
}
static inline void *wx_config_load(const char *path) { ini_t ini = ini_read(path); if (ini) ini_strip_quotes(ini); return (void*)ini; }
static inline int wx_config_get_string(void *config, const char *name, char *dst, int size, const char *defVal) {
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
char* str = ini_get_string((ini_t)config, "", name, (char*)defVal);
static inline int
wx_config_get_string(void *config, const char *name, char *dst, int size, const char *defVal)
{
int res = ini_has_entry(ini_find_or_create_section((ini_t) config, ""), name);
char *str = ini_get_string((ini_t) config, "", name, (char *) defVal);
if (size == 0)
return res;
if (str != NULL)
@@ -47,40 +53,56 @@ static inline int wx_config_get_string(void *config, const char *name, char *dst
return res;
}
static inline int wx_config_get_int(void *config, const char *name, int *dst, int defVal) {
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
*dst = ini_get_int((ini_t)config, "", name, defVal);
static inline int
wx_config_get_int(void *config, const char *name, int *dst, int defVal)
{
int res = ini_has_entry(ini_find_or_create_section((ini_t) config, ""), name);
*dst = ini_get_int((ini_t) config, "", name, defVal);
return res;
}
static inline int wx_config_get_float(void *config, const char *name, float *dst, float defVal) {
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
*dst = (float)ini_get_double((ini_t)config, "", name, defVal);
static inline int
wx_config_get_float(void *config, const char *name, float *dst, float defVal)
{
int res = ini_has_entry(ini_find_or_create_section((ini_t) config, ""), name);
*dst = (float) ini_get_double((ini_t) config, "", name, defVal);
return res;
}
static inline int wx_config_get_bool(void *config, const char *name, int *dst, int defVal) {
int res = ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name);
*dst = !!ini_get_int((ini_t)config, "", name, defVal);
static inline int
wx_config_get_bool(void *config, const char *name, int *dst, int defVal)
{
int res = ini_has_entry(ini_find_or_create_section((ini_t) config, ""), name);
*dst = !!ini_get_int((ini_t) config, "", name, defVal);
return res;
}
static inline int wx_config_has_entry(void *config, const char *name) { return ini_has_entry(ini_find_or_create_section((ini_t)config, ""), name); }
static inline void wx_config_free(void *config) { ini_close(config); };
static inline int
wx_config_has_entry(void *config, const char *name)
{
return ini_has_entry(ini_find_or_create_section((ini_t) config, ""), name);
}
static inline void
wx_config_free(void *config)
{
ini_close(config);
};
static int endswith(const char *str, const char *ext) {
const char *p;
int elen = strlen(ext);
int slen = strlen(str);
if (slen >= elen) {
p = &str[slen - elen];
for (int i = 0; i < elen; ++i) {
if (tolower(p[i]) != tolower(ext[i]))
return 0;
}
return 1;
static int
endswith(const char *str, const char *ext)
{
const char *p;
int elen = strlen(ext);
int slen = strlen(str);
if (slen >= elen) {
p = &str[slen - elen];
for (int i = 0; i < elen; ++i) {
if (tolower(p[i]) != tolower(ext[i]))
return 0;
}
return 0;
return 1;
}
return 0;
}
static int
@@ -101,326 +123,355 @@ glsl_detect_bom(const char *fn)
return 0;
}
static char *load_file(const char *fn) {
int bom = glsl_detect_bom(fn);
FILE *fp = plat_fopen(fn, "rb");
if (!fp)
return 0;
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
static char *
load_file(const char *fn)
{
int bom = glsl_detect_bom(fn);
FILE *fp = plat_fopen(fn, "rb");
if (!fp)
return 0;
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
if (bom) {
fsize -= 3;
fseek(fp, 3, SEEK_SET);
}
char *data = (char *) malloc(fsize + 1);
size_t read_bytes = fread(data, fsize, 1, fp);
if (read_bytes != 1) {
fclose(fp);
free(data);
return nullptr;
} else {
fclose(fp);
data[fsize] = 0;
return data;
}
}
static void
strip_lines(const char *program, const char *starts_with)
{
/* strip parameters */
char *ptr = (char *) strstr(program, starts_with);
while (ptr != nullptr) {
while (*ptr != '\n' && *ptr != '\0')
*ptr++ = ' ';
ptr = (char *) strstr(program, starts_with);
}
}
static void
strip_parameters(const char *program)
{
/* strip parameters */
strip_lines(program, "#pragma parameter");
}
static void
strip_defines(const char *program)
{
/* strip texture define */
strip_lines(program, "#define texture");
}
static int
has_parameter(glslp_t *glsl, char *id)
{
for (int i = 0; i < glsl->num_parameters; ++i)
if (!strcmp(glsl->parameters[i].id, id))
return 1;
return 0;
}
static int
get_parameters(glslp_t *glsl)
{
struct parameter p;
for (int i = 0; i < glsl->num_shaders; ++i) {
size_t size = 0;
char *line = NULL;
struct shader *shader = &glsl->shaders[i];
int bom = glsl_detect_bom(shader->shader_fn);
FILE *f = plat_fopen(shader->shader_fn, "rb");
if (!f)
return 0;
if (bom) {
fsize -= 3;
fseek(fp, 3, SEEK_SET);
fseek(f, 3, SEEK_SET);
}
while (local_getline(&line, &size, f) != -1 && glsl->num_parameters < MAX_PARAMETERS) {
line[strcspn(line, "\r\n")] = '\0';
trim(line);
int num = sscanf(line, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f", p.id, p.description,
&p.default_value, &p.min, &p.max, &p.step);
if (num < 5)
continue;
p.id[63] = 0;
p.description[63] = 0;
if (num == 5)
p.step = 0.1f * (p.max - p.min);
p.value = p.default_value;
if (!has_parameter(glsl, p.id)) {
memcpy(&glsl->parameters[glsl->num_parameters++], &p, sizeof(struct parameter));
pclog("Read parameter: %s (%s) %f, %f -> %f (%f)\n", p.id, p.description, p.default_value, p.min,
p.max, p.step);
}
}
char *data = (char*)malloc(fsize + 1);
fclose(f);
}
size_t read_bytes = fread(data, fsize, 1, fp);
if (read_bytes != 1) {
fclose(fp);
free(data);
return nullptr;
} else {
fclose(fp);
return 1;
}
data[fsize] = 0;
return data;
static struct parameter *
get_parameter(glslp_t *glslp, const char *id)
{
for (int i = 0; i < glslp->num_parameters; ++i) {
if (!strcmp(glslp->parameters[i].id, id)) {
return &glslp->parameters[i];
}
}
return 0;
}
static void strip_lines(const char *program, const char *starts_with) {
/* strip parameters */
char *ptr = (char *) strstr(program, starts_with);
while (ptr != nullptr) {
while (*ptr != '\n' && *ptr != '\0')
*ptr++ = ' ';
ptr = (char *) strstr(program, starts_with);
}
}
static void strip_parameters(const char *program) {
/* strip parameters */
strip_lines(program, "#pragma parameter");
}
static void strip_defines(const char *program) {
/* strip texture define */
strip_lines(program, "#define texture");
}
static int has_parameter(glslp_t *glsl, char *id) {
for (int i = 0; i < glsl->num_parameters; ++i)
if (!strcmp(glsl->parameters[i].id, id))
return 1;
static glslp_t *
glsl_parse(const char *f)
{
glslp_t *glslp = (glslp_t *) calloc(1, sizeof(glslp_t));
glslp->num_shaders = 1;
struct shader *shader = &glslp->shaders[0];
strcpy(shader->shader_fn, f);
shader->shader_program = load_file(f);
if (!shader->shader_program) {
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), QObject::tr("GLSL error"), QObject::tr("Could not load shader: %1").arg(shader->shader_fn));
// wx_simple_messagebox("GLSL error", "Could not load shader %s\n", shader->shader_fn);
glslp_free(glslp);
return 0;
}
static int get_parameters(glslp_t *glsl) {
struct parameter p;
for (int i = 0; i < glsl->num_shaders; ++i) {
size_t size = 0;
char* line = NULL;
struct shader *shader = &glsl->shaders[i];
int bom = glsl_detect_bom(shader->shader_fn);
FILE *f = plat_fopen(shader->shader_fn, "rb");
if (!f)
return 0;
if (bom) {
fseek(f, 3, SEEK_SET);
}
while (local_getline(&line, &size, f) != -1 && glsl->num_parameters < MAX_PARAMETERS) {
line[strcspn(line, "\r\n")] = '\0';
trim(line);
int num = sscanf(line, "#pragma parameter %63s \"%63[^\"]\" %f %f %f %f", p.id, p.description,
&p.default_value, &p.min, &p.max, &p.step);
if (num < 5)
continue;
p.id[63] = 0;
p.description[63] = 0;
if (num == 5)
p.step = 0.1f * (p.max - p.min);
p.value = p.default_value;
if (!has_parameter(glsl, p.id)) {
memcpy(&glsl->parameters[glsl->num_parameters++], &p, sizeof(struct parameter));
pclog("Read parameter: %s (%s) %f, %f -> %f (%f)\n", p.id, p.description, p.default_value, p.min,
p.max, p.step);
}
}
fclose(f);
}
return 1;
}
static struct parameter *get_parameter(glslp_t *glslp, const char *id) {
for (int i = 0; i < glslp->num_parameters; ++i) {
if (!strcmp(glslp->parameters[i].id, id)) {
return &glslp->parameters[i];
}
}
return 0;
}
static glslp_t *glsl_parse(const char *f) {
glslp_t *glslp = (glslp_t*) calloc(1, sizeof(glslp_t));
glslp->num_shaders = 1;
struct shader *shader = &glslp->shaders[0];
strcpy(shader->shader_fn, f);
shader->shader_program = load_file(f);
if (!shader->shader_program) {
QMessageBox::critical((QWidget *) qApp->findChild<QWindow *>(), QObject::tr("GLSL error"), QObject::tr("Could not load shader: %1").arg(shader->shader_fn));
//wx_simple_messagebox("GLSL error", "Could not load shader %s\n", shader->shader_fn);
glslp_free(glslp);
return 0;
}
strip_parameters(shader->shader_program);
strip_defines(shader->shader_program);
shader->scale_x = shader->scale_y = 1.0f;
strcpy(shader->scale_type_x, "source");
strcpy(shader->scale_type_y, "source");
get_parameters(glslp);
return glslp;
}
strip_parameters(shader->shader_program);
strip_defines(shader->shader_program);
shader->scale_x = shader->scale_y = 1.0f;
strcpy(shader->scale_type_x, "source");
strcpy(shader->scale_type_y, "source");
get_parameters(glslp);
return glslp;
}
extern "C" {
void get_glslp_name(const char *f, char *s, int size) { safe_strncpy(s, path_get_filename((char *)f), size); }
glslp_t *glslp_parse(const char *f) {
int j;
int len;
int sublen;
char s[2049], t[2049], z[2076];
memset(s, 0, sizeof(s));
if (endswith(f, ".glsl"))
return glsl_parse(f);
void *cfg = wx_config_load(f);
if (!cfg) {
fprintf(stderr, "GLSLP Error: Could not load GLSLP-file %s\n", f);
return 0;
}
glslp_t *glslp = (glslp_t*) calloc(1, sizeof(glslp_t));
get_glslp_name(f, glslp->name, sizeof(glslp->name));
wx_config_get_int(cfg, "shaders", &glslp->num_shaders, 0);
wx_config_get_bool(cfg, "filter_linear0", &glslp->input_filter_linear, -1);
for (int i = 0; i < glslp->num_shaders; ++i) {
struct shader *shader = &glslp->shaders[i];
snprintf(s, sizeof(s) - 1, "shader%d", i);
if (!wx_config_get_string(cfg, s, t, sizeof(t), 0)) {
/* shader doesn't exist, lets break here */
glslp->num_shaders = i;
break;
}
strcpy(s, f);
*path_get_filename(s) = 0;
size_t max_len = sizeof(shader->shader_fn);
size_t s_len = strlen(s);
if (s_len >= max_len) {
// s alone fills or overflows the buffer, truncate and null-terminate
size_t copy_len = max_len - 1 < s_len ? max_len - 1 : s_len;
memcpy(shader->shader_fn, s, copy_len);
shader->shader_fn[copy_len] = '\0';
} else {
// Copy s fully
memcpy(shader->shader_fn, s, s_len);
// Copy as much of t as fits after s
size_t avail = max_len - 1 - s_len; // space left for t + null terminator
// Copy as much of t as fits into the remaining space
memcpy(shader->shader_fn + s_len, t, avail);
// Null-terminate
shader->shader_fn[s_len + avail] = '\0';
}
shader->shader_program = load_file(shader->shader_fn);
if (!shader->shader_program) {
fprintf(stderr, "GLSLP Error: Could not load shader %s\n", shader->shader_fn);
glslp_free(glslp);
return 0;
}
strip_parameters(shader->shader_program);
strip_defines(shader->shader_program);
snprintf(s, sizeof(s) - 1, "alias%d", i);
wx_config_get_string(cfg, s, shader->alias, sizeof(shader->alias), 0);
snprintf(s, sizeof(s) - 1, "filter_linear%d", i + 1);
wx_config_get_bool(cfg, s, &shader->filter_linear, 0);
snprintf(s, sizeof(s) - 1, "wrap_mode%d", i);
wx_config_get_string(cfg, s, shader->wrap_mode, sizeof(shader->wrap_mode), 0);
snprintf(s, sizeof(s) - 1, "float_framebuffer%d", i);
wx_config_get_bool(cfg, s, &shader->float_framebuffer, 0);
snprintf(s, sizeof(s) - 1, "srgb_framebuffer%d", i);
wx_config_get_bool(cfg, s, &shader->srgb_framebuffer, 0);
snprintf(s, sizeof(s) - 1, "mipmap_input%d", i);
wx_config_get_bool(cfg, s, &shader->mipmap_input, 0);
strcpy(shader->scale_type_x, "source");
snprintf(s, sizeof(s) - 1, "scale_type_x%d", i);
wx_config_get_string(cfg, s, shader->scale_type_x, sizeof(shader->scale_type_x), 0);
strcpy(shader->scale_type_y, "source");
snprintf(s, sizeof(s) - 1, "scale_type_y%d", i);
wx_config_get_string(cfg, s, shader->scale_type_y, sizeof(shader->scale_type_y), 0);
snprintf(s, sizeof(s) - 1, "scale_type%d", i);
if (wx_config_has_entry(cfg, s)) {
wx_config_get_string(cfg, s, shader->scale_type_x, sizeof(shader->scale_type_x), 0);
wx_config_get_string(cfg, s, shader->scale_type_y, sizeof(shader->scale_type_y), 0);
}
snprintf(s, sizeof(s) - 1, "scale_x%d", i);
wx_config_get_float(cfg, s, &shader->scale_x, 1.0f);
snprintf(s, sizeof(s) - 1, "scale_y%d", i);
wx_config_get_float(cfg, s, &shader->scale_y, 1.0f);
snprintf(s, sizeof(s) - 1, "scale%d", i);
if (wx_config_has_entry(cfg, s)) {
wx_config_get_float(cfg, s, &shader->scale_x, 1.0f);
wx_config_get_float(cfg, s, &shader->scale_y, 1.0f);
}
snprintf(s, sizeof(s) - 1, "frame_count_mod%d", i);
wx_config_get_int(cfg, s, &shader->frame_count_mod, 0);
}
/* textures */
glslp->num_textures = 0;
wx_config_get_string(cfg, "textures", t, sizeof(t), 0);
len = strlen(t);
j = 0;
sublen = 0;
for (int i = 0; i < len; ++i) {
if (t[i] == ';' || i == len - 1) {
sublen = (i - j) + ((i == len - 1) ? 1 : 0) + 1;
safe_strncpy(s, t + j, sublen);
s[511 < sublen ? 511 : sublen] = 0;
if (s[strlen(s) - 1] == ';') s[strlen(s) - 1] = 0;
struct texture *tex = &glslp->textures[glslp->num_textures++];
strcpy(tex->name, s);
wx_config_get_string(cfg, s, tex->path, sizeof(tex->path), 0);
snprintf(z, sizeof(z) - 1, "%s_linear", s);
wx_config_get_bool(cfg, z, &tex->linear, 0);
snprintf(z, sizeof(z) - 1, "%s_mipmap", s);
wx_config_get_bool(cfg, z, &tex->mipmap, 0);
snprintf(z, sizeof(z) - 1, "%s_wrap_mode", s);
wx_config_get_string(cfg, z, tex->wrap_mode, sizeof(tex->wrap_mode), 0);
j = i + 1;
}
}
/* parameters */
get_parameters(glslp);
wx_config_get_string(cfg, "parameters", t, sizeof(t), 0);
len = strlen(t);
j = 0;
sublen = 0;
for (int i = 0; i < len; ++i) {
if (t[i] == ';' || i == len - 1) {
sublen = (i - j) + ((i == len - 1) ? 1 : 0) + 1;
safe_strncpy(s, t + j, sublen);
s[511 < sublen ? 511 : sublen] = 0;
struct parameter *p = get_parameter(glslp, s);
if (p)
wx_config_get_float(cfg, s, &p->default_value, 0);
j = i + 1;
}
}
wx_config_free(cfg);
return glslp;
void
get_glslp_name(const char *f, char *s, int size)
{
safe_strncpy(s, path_get_filename((char *) f), size);
}
void glslp_free(glslp_t *p) {
for (int i = 0; i < p->num_shaders; ++i)
if (p->shaders[i].shader_program)
free(p->shaders[i].shader_program);
free(p);
glslp_t *
glslp_parse(const char *f)
{
int j;
int len;
int sublen;
char s[2049], t[2049], z[2076];
memset(s, 0, sizeof(s));
if (endswith(f, ".glsl"))
return glsl_parse(f);
void *cfg = wx_config_load(f);
if (!cfg) {
fprintf(stderr, "GLSLP Error: Could not load GLSLP-file %s\n", f);
return 0;
}
glslp_t *glslp = (glslp_t *) calloc(1, sizeof(glslp_t));
get_glslp_name(f, glslp->name, sizeof(glslp->name));
wx_config_get_int(cfg, "shaders", &glslp->num_shaders, 0);
wx_config_get_bool(cfg, "filter_linear0", &glslp->input_filter_linear, -1);
for (int i = 0; i < glslp->num_shaders; ++i) {
struct shader *shader = &glslp->shaders[i];
snprintf(s, sizeof(s) - 1, "shader%d", i);
if (!wx_config_get_string(cfg, s, t, sizeof(t), 0)) {
/* shader doesn't exist, lets break here */
glslp->num_shaders = i;
break;
}
strcpy(s, f);
*path_get_filename(s) = 0;
size_t max_len = sizeof(shader->shader_fn);
size_t s_len = strlen(s);
if (s_len >= max_len) {
// s alone fills or overflows the buffer, truncate and null-terminate
size_t copy_len = max_len - 1 < s_len ? max_len - 1 : s_len;
memcpy(shader->shader_fn, s, copy_len);
shader->shader_fn[copy_len] = '\0';
} else {
// Copy s fully
memcpy(shader->shader_fn, s, s_len);
// Copy as much of t as fits after s
size_t avail = max_len - 1 - s_len; // space left for t + null terminator
// Copy as much of t as fits into the remaining space
memcpy(shader->shader_fn + s_len, t, avail);
// Null-terminate
shader->shader_fn[s_len + avail] = '\0';
}
shader->shader_program = load_file(shader->shader_fn);
if (!shader->shader_program) {
fprintf(stderr, "GLSLP Error: Could not load shader %s\n", shader->shader_fn);
glslp_free(glslp);
return 0;
}
strip_parameters(shader->shader_program);
strip_defines(shader->shader_program);
snprintf(s, sizeof(s) - 1, "alias%d", i);
wx_config_get_string(cfg, s, shader->alias, sizeof(shader->alias), 0);
snprintf(s, sizeof(s) - 1, "filter_linear%d", i + 1);
wx_config_get_bool(cfg, s, &shader->filter_linear, 0);
snprintf(s, sizeof(s) - 1, "wrap_mode%d", i);
wx_config_get_string(cfg, s, shader->wrap_mode, sizeof(shader->wrap_mode), 0);
snprintf(s, sizeof(s) - 1, "float_framebuffer%d", i);
wx_config_get_bool(cfg, s, &shader->float_framebuffer, 0);
snprintf(s, sizeof(s) - 1, "srgb_framebuffer%d", i);
wx_config_get_bool(cfg, s, &shader->srgb_framebuffer, 0);
snprintf(s, sizeof(s) - 1, "mipmap_input%d", i);
wx_config_get_bool(cfg, s, &shader->mipmap_input, 0);
strcpy(shader->scale_type_x, "source");
snprintf(s, sizeof(s) - 1, "scale_type_x%d", i);
wx_config_get_string(cfg, s, shader->scale_type_x, sizeof(shader->scale_type_x), 0);
strcpy(shader->scale_type_y, "source");
snprintf(s, sizeof(s) - 1, "scale_type_y%d", i);
wx_config_get_string(cfg, s, shader->scale_type_y, sizeof(shader->scale_type_y), 0);
snprintf(s, sizeof(s) - 1, "scale_type%d", i);
if (wx_config_has_entry(cfg, s)) {
wx_config_get_string(cfg, s, shader->scale_type_x, sizeof(shader->scale_type_x), 0);
wx_config_get_string(cfg, s, shader->scale_type_y, sizeof(shader->scale_type_y), 0);
}
snprintf(s, sizeof(s) - 1, "scale_x%d", i);
wx_config_get_float(cfg, s, &shader->scale_x, 1.0f);
snprintf(s, sizeof(s) - 1, "scale_y%d", i);
wx_config_get_float(cfg, s, &shader->scale_y, 1.0f);
snprintf(s, sizeof(s) - 1, "scale%d", i);
if (wx_config_has_entry(cfg, s)) {
wx_config_get_float(cfg, s, &shader->scale_x, 1.0f);
wx_config_get_float(cfg, s, &shader->scale_y, 1.0f);
}
snprintf(s, sizeof(s) - 1, "frame_count_mod%d", i);
wx_config_get_int(cfg, s, &shader->frame_count_mod, 0);
}
/* textures */
glslp->num_textures = 0;
wx_config_get_string(cfg, "textures", t, sizeof(t), 0);
len = strlen(t);
j = 0;
sublen = 0;
for (int i = 0; i < len; ++i) {
if (t[i] == ';' || i == len - 1) {
sublen = (i - j) + ((i == len - 1) ? 1 : 0) + 1;
safe_strncpy(s, t + j, sublen);
s[511 < sublen ? 511 : sublen] = 0;
if (s[strlen(s) - 1] == ';')
s[strlen(s) - 1] = 0;
struct texture *tex = &glslp->textures[glslp->num_textures++];
strcpy(tex->name, s);
wx_config_get_string(cfg, s, tex->path, sizeof(tex->path), 0);
snprintf(z, sizeof(z) - 1, "%s_linear", s);
wx_config_get_bool(cfg, z, &tex->linear, 0);
snprintf(z, sizeof(z) - 1, "%s_mipmap", s);
wx_config_get_bool(cfg, z, &tex->mipmap, 0);
snprintf(z, sizeof(z) - 1, "%s_wrap_mode", s);
wx_config_get_string(cfg, z, tex->wrap_mode, sizeof(tex->wrap_mode), 0);
j = i + 1;
}
}
/* parameters */
get_parameters(glslp);
wx_config_get_string(cfg, "parameters", t, sizeof(t), 0);
len = strlen(t);
j = 0;
sublen = 0;
for (int i = 0; i < len; ++i) {
if (t[i] == ';' || i == len - 1) {
sublen = (i - j) + ((i == len - 1) ? 1 : 0) + 1;
safe_strncpy(s, t + j, sublen);
s[511 < sublen ? 511 : sublen] = 0;
struct parameter *p = get_parameter(glslp, s);
if (p)
wx_config_get_float(cfg, s, &p->default_value, 0);
j = i + 1;
}
}
wx_config_free(cfg);
return glslp;
}
void glslp_read_shader_config(glslp_t *shader) {
char s[512];
void
glslp_free(glslp_t *p)
{
for (int i = 0; i < p->num_shaders; ++i)
if (p->shaders[i].shader_program)
free(p->shaders[i].shader_program);
free(p);
}
void
glslp_read_shader_config(glslp_t *shader)
{
char s[512];
char *name = shader->name;
snprintf(s, sizeof(s) -1, "GL3 Shaders - %s", name);
snprintf(s, sizeof(s) - 1, "GL3 Shaders - %s", name);
for (int i = 0; i < shader->num_parameters; ++i) {
struct parameter *param = &shader->parameters[i];
param->value = config_get_double(s, param->id, param->default_value);
param->value = config_get_double(s, param->id, param->default_value);
}
}
void glslp_write_shader_config(glslp_t *shader) {
char s[512];
void
glslp_write_shader_config(glslp_t *shader)
{
char s[512];
char *name = shader->name;
startblit();
@@ -431,5 +482,4 @@ void glslp_write_shader_config(glslp_t *shader) {
}
endblit();
}
}

View File

@@ -19,7 +19,7 @@
extern "C" {
#ifdef __unix__
#include <unistd.h>
# include <unistd.h>
#endif
#include <86box/86box.h>
#include <86box/hdd.h>
@@ -75,7 +75,7 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent)
for (int i = 0; i < 127; i++) {
uint64_t size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2];
uint32_t size_mb = size >> 11LL;
QString text = tr("%1 MB (CHS: %2, %3, %4)").arg(size_mb).arg(hdd_table[i][0]).arg(hdd_table[i][1]).arg(hdd_table[i][2]);
QString text = tr("%1 MB (CHS: %2, %3, %4)").arg(size_mb).arg(hdd_table[i][0]).arg(hdd_table[i][1]).arg(hdd_table[i][2]);
Models::AddEntry(model, text, i);
}
Models::AddEntry(model, tr("Custom..."), 127);
@@ -85,11 +85,11 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent)
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
filters = QStringList({ tr("Raw image") % util::DlgFilter({ "img" }, true),
tr("HDI image") % util::DlgFilter({ "hdi" }, true),
tr("HDX image") % util::DlgFilter({ "hdx" }, true),
tr("Fixed-size VHD") % util::DlgFilter({ "vhd" }, true),
tr("Dynamic-size VHD") % util::DlgFilter({ "vhd" }, true),
tr("Differencing VHD") % util::DlgFilter({ "vhd" }, true) });
tr("HDI image") % util::DlgFilter({ "hdi" }, true),
tr("HDX image") % util::DlgFilter({ "hdx" }, true),
tr("Fixed-size VHD") % util::DlgFilter({ "vhd" }, true),
tr("Dynamic-size VHD") % util::DlgFilter({ "vhd" }, true),
tr("Differencing VHD") % util::DlgFilter({ "vhd" }, true) });
if (existing) {
ui->fileField->setFilter(tr("Hard disk images") % util::DlgFilter({ "hd?", "im?", "vhd" }) % tr("All files") % util::DlgFilter({ "*" }, true));
@@ -317,7 +317,6 @@ create_drive_vhd_diff(const QString &fileName, const QString &parentFileName, in
_86box_geometry.spt = vhd_geometry.spt;
}
mvhd_close(vhd);
}
@@ -414,7 +413,7 @@ HarddiskDialog::onCreateNewFile()
file.close();
_86BoxGeom _86box_geometry {};
int block_size = ui->comboBoxBlockSize->currentIndex() == 0 ? MVHD_BLOCK_LARGE : MVHD_BLOCK_SMALL;
int block_size = ui->comboBoxBlockSize->currentIndex() == 0 ? MVHD_BLOCK_LARGE : MVHD_BLOCK_SMALL;
switch (img_format) {
case IMG_FMT_VHD_FIXED:
{
@@ -568,7 +567,7 @@ HarddiskDialog::onExistingFileSelected(const QString &fileName, bool precheck)
if (!file.open(QIODevice::ReadOnly)) {
// No message box during precheck (performed when the file input loses focus and this function is called)
// If precheck is false, the file has been chosen from a file dialog and the alert should display.
if(!precheck) {
if (!precheck) {
QMessageBox::critical(this, tr("Unable to read file"), tr("Make sure the file exists and is readable."));
}
return;

View File

@@ -123,10 +123,10 @@ Harddrives::populateBusChannels(QAbstractItemModel *model, int bus, SettingsBusT
{
model->removeRows(0, model->rowCount());
int busRows = 0;
int shifter = 1;
int orer = 1;
int subChannelWidth = 1;
int busRows = 0;
int shifter = 1;
int orer = 1;
int subChannelWidth = 1;
QList<int> busesToCheck;
QList<int> channelsInUse;
switch (bus) {
@@ -160,15 +160,15 @@ Harddrives::populateBusChannels(QAbstractItemModel *model, int bus, SettingsBusT
busesToCheck.append(HDD_BUS_SCSI);
break;
case CDROM_BUS_MKE:
shifter = 2;
orer = 3;
busRows = 4;
shifter = 2;
orer = 3;
busRows = 4;
busesToCheck.append(CDROM_BUS_MKE);
break;
default:
break;
}
if(sbt != nullptr && !busesToCheck.empty()) {
if (sbt != nullptr && !busesToCheck.empty()) {
for (auto const &checkBus : busesToCheck) {
channelsInUse.append(sbt->busChannelsInUse(checkBus));
}
@@ -179,9 +179,9 @@ Harddrives::populateBusChannels(QAbstractItemModel *model, int bus, SettingsBusT
auto idx = model->index(i, 0);
model->setData(idx, QString("%1:%2").arg(i >> shifter).arg(i & orer, subChannelWidth, 10, QChar('0')));
model->setData(idx, ((i >> shifter) << shifter) | (i & orer), Qt::UserRole);
const auto *channelModel = qobject_cast<QStandardItemModel*>(model);
auto *channelItem = channelModel->item(i);
if(channelItem) {
const auto *channelModel = qobject_cast<QStandardItemModel *>(model);
auto *channelItem = channelModel->item(i);
if (channelItem) {
channelItem->setEnabled(!channelsInUse.contains(i));
}
}

View File

@@ -35,7 +35,7 @@ getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode,
if (indicator == None)
return iconPixmap;
auto painter = QPainter(&iconPixmap);
auto painter = QPainter(&iconPixmap);
auto indicatorPixmap = getIndicatorIcon((indicator == ReadWriteActive || indicator == WriteProtectedActive) ? Active : indicator).pixmap(size);
if (indicator == WriteProtectedBrowse)

View File

@@ -1,5 +1,5 @@
#ifndef QT_ICONINDICATORS_HPP
# define QT_ICONINDICATORS_HPP
#define QT_ICONINDICATORS_HPP
#include <QPixmap>
#include <QIcon>

View File

@@ -52,7 +52,7 @@ extern "C" {
# include <sys/sysmacros.h>
#endif
#ifdef Q_OS_WINDOWS
#include <windows.h>
# include <windows.h>
#endif
KeyBinder::KeyBinder(QWidget *parent)
@@ -60,10 +60,10 @@ KeyBinder::KeyBinder(QWidget *parent)
, ui(new Ui::KeyBinder)
{
ui->setupUi(this);
singleKeySequenceEdit *seq = new singleKeySequenceEdit();
ui->formLayout->addRow(seq);
seq->setObjectName("keySequence");
this->setTabOrder(seq, ui->buttonBox);
singleKeySequenceEdit *seq = new singleKeySequenceEdit();
ui->formLayout->addRow(seq);
seq->setObjectName("keySequence");
this->setTabOrder(seq, ui->buttonBox);
}
KeyBinder::~KeyBinder()
@@ -72,29 +72,31 @@ KeyBinder::~KeyBinder()
}
void
KeyBinder::showEvent( QShowEvent* event ) {
QWidget::showEvent( event );
this->findChild<QKeySequenceEdit*>()->setFocus();
}
bool KeyBinder::eventFilter(QObject *obj, QEvent *event)
KeyBinder::showEvent(QShowEvent *event)
{
return QObject::eventFilter(obj, event);
QWidget::showEvent(event);
this->findChild<QKeySequenceEdit *>()->setFocus();
}
bool
KeyBinder::eventFilter(QObject *obj, QEvent *event)
{
return QObject::eventFilter(obj, event);
}
QKeySequence
KeyBinder::BindKey(QWidget* widget, QString CurValue)
KeyBinder::BindKey(QWidget *widget, QString CurValue)
{
KeyBinder kb(widget);
kb.setWindowTitle(tr("Bind Key"));
KeyBinder kb(widget);
kb.setWindowTitle(tr("Bind Key"));
kb.setFixedSize(kb.minimumSizeHint());
kb.findChild<QKeySequenceEdit*>()->setKeySequence(QKeySequence::fromString(CurValue, QKeySequence::NativeText));
kb.setEnabled(true);
kb.findChild<QKeySequenceEdit *>()->setKeySequence(QKeySequence::fromString(CurValue, QKeySequence::NativeText));
kb.setEnabled(true);
if (kb.exec() == QDialog::Accepted) {
QKeySequenceEdit *seq = kb.findChild<QKeySequenceEdit*>();
return (seq->keySequence());
QKeySequenceEdit *seq = kb.findChild<QKeySequenceEdit *>();
return (seq->keySequence());
} else {
return (false);
}
return (false);
}
}

View File

@@ -22,12 +22,12 @@ public:
explicit KeyBinder(QWidget *parent = nullptr);
~KeyBinder() override;
static QKeySequence BindKey(QWidget* widget, QString CurValue);
static QKeySequence BindKey(QWidget *widget, QString CurValue);
private:
Ui::KeyBinder *ui;
bool eventFilter(QObject *obj, QEvent *event) override;
void showEvent( QShowEvent* event ) override;
bool eventFilter(QObject *obj, QEvent *event) override;
void showEvent(QShowEvent *event) override;
};
#endif // QT_KeyBinder_HPP

View File

@@ -109,9 +109,9 @@ struct Pixmaps {
struct StateActive {
std::unique_ptr<QLabel> label;
PixmapSetActive *pixmaps = nullptr;
bool active = false;
bool write_active = false;
PixmapSetActive *pixmaps = nullptr;
bool active = false;
bool write_active = false;
void setActive(bool b)
{
@@ -164,11 +164,11 @@ struct StateEmpty {
};
struct StateEmptyActive {
std::unique_ptr<QLabel> label;
PixmapSetEmptyActive *pixmaps = nullptr;
bool empty = false;
bool active = false;
bool write_active = false;
bool wp = false;
PixmapSetEmptyActive *pixmaps = nullptr;
bool empty = false;
bool active = false;
bool write_active = false;
bool wp = false;
void setActive(bool b)
{
@@ -222,7 +222,7 @@ struct StateEmptyActive {
}
};
static QSize pixmap_size(16, 16);
static QSize pixmap_size(16, 16);
void
PixmapSetEmpty::load(const QIcon &icon)
@@ -236,8 +236,8 @@ PixmapSetActive::load(const QIcon &icon)
{
normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None);
active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Active);
write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteActive);
write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteActive);
read_write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, ReadWriteActive);
}
@@ -326,7 +326,7 @@ MachineStatus::MachineStatus(QObject *parent)
: QObject(parent)
, refreshTimer(new QTimer(this))
{
d = std::make_unique<MachineStatus::States>(this);
d = std::make_unique<MachineStatus::States>(this);
soundMenu = nullptr;
connect(refreshTimer, &QTimer::timeout, this, &MachineStatus::refreshIcons);
refreshTimer->start(75);
@@ -335,7 +335,7 @@ MachineStatus::MachineStatus(QObject *parent)
MachineStatus::~MachineStatus() = default;
void
MachineStatus::setSoundMenu(QMenu* menu)
MachineStatus::setSoundMenu(QMenu *menu)
{
soundMenu = menu;
}
@@ -768,7 +768,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_MFM && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_MFM].label->setToolTip(tooltip);
@@ -784,7 +784,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_ESDI && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_ESDI].label->setToolTip(tooltip);
@@ -800,7 +800,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_XTA && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_XTA].label->setToolTip(tooltip);
@@ -819,7 +819,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_IDE && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_IDE].label->setToolTip(tooltip);
@@ -835,7 +835,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_ATAPI && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 1), QString::number(hdd[i].channel & 1), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_ATAPI].label->setToolTip(tooltip);
@@ -855,7 +855,7 @@ MachineStatus::refresh(QStatusBar *sbar)
tooltip.append("\n");
for (int i = 0; i < HDD_NUM; i++) {
if (hdd[i].bus_type == HDD_BUS_SCSI && hdd[i].fn[0] != 0) {
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 4), QString::asprintf("%02d", hdd[i].channel & 15), QString::number((((qulonglong)hdd[i].hpc * (qulonglong)hdd[i].spt * (qulonglong)hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
tooltip.append(QString("\n%5:%6: %1 (C:H:S = %2:%3:%4, %7 %8)").arg(QString::fromUtf8(hdd[i].fn), QString::number(hdd[i].tracks), QString::number(hdd[i].hpc), QString::number(hdd[i].spt), QString::number(hdd[i].channel >> 4), QString::asprintf("%02d", hdd[i].channel & 15), QString::number((((qulonglong) hdd[i].hpc * (qulonglong) hdd[i].spt * (qulonglong) hdd[i].tracks) * 512ull) / 1048576ull), tr("MB")));
}
}
d->hdds[HDD_BUS_SCSI].label->setToolTip(tooltip);

View File

@@ -78,7 +78,7 @@ public:
QString getMessage();
void clearActivity();
void setSoundMenu(QMenu* menu);
void setSoundMenu(QMenu *menu);
public slots:
void refresh(QStatusBar *sbar);
void message(const QString &msg);

View File

@@ -50,14 +50,14 @@ extern "C" {
#include <86box/ui.h>
#include <86box/video.h>
#ifdef DISCORD
# include <86box/discord.h>
# include <86box/discord.h>
#endif
#include <86box/gdbstub.h>
#include <86box/version.h>
#include <86box/renderdefs.h>
#ifdef Q_OS_LINUX
#define GAMEMODE_AUTO
#include "../unix/gamemode/gamemode_client.h"
# define GAMEMODE_AUTO
# include "../unix/gamemode/gamemode_client.h"
#endif
}
@@ -96,7 +96,7 @@ extern "C" {
#include "cpu.h"
#include <86box/timer.h>
#include <86box/nvr.h>
extern int qt_nvr_save(void);
extern int qt_nvr_save(void);
extern void exit_pause(void);
bool cpu_thread_running = false;
@@ -210,19 +210,19 @@ win_keyboard_handle(uint32_t scancode, int up, int e0, int e1)
static LRESULT CALLBACK
emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
LPKBDLLHOOKSTRUCT lpKdhs = (LPKBDLLHOOKSTRUCT) lParam;
LPKBDLLHOOKSTRUCT lpKdhs = (LPKBDLLHOOKSTRUCT) lParam;
/* Checks if CTRL was pressed. */
BOOL bCtrlDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);
BOOL is_over_window = (GetForegroundWindow() == ((HWND) main_window->winId()));
BOOL ret = TRUE;
BOOL bCtrlDown = GetAsyncKeyState(VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);
BOOL is_over_window = (GetForegroundWindow() == ((HWND) main_window->winId()));
BOOL ret = TRUE;
static int last = 0;
static int last = 0;
if (show_second_monitors) for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
const auto &secondaryRenderer = main_window->renderers[monitor_index];
is_over_window = is_over_window || ((secondaryRenderer != nullptr) &&
(GetForegroundWindow() == ((HWND) secondaryRenderer->winId())));
}
if (show_second_monitors)
for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
const auto &secondaryRenderer = main_window->renderers[monitor_index];
is_over_window = is_over_window || ((secondaryRenderer != nullptr) && (GetForegroundWindow() == ((HWND) secondaryRenderer->winId())));
}
bool skip = ((nCode < 0) || (nCode != HC_ACTION) || !is_over_window || (kbd_req_capture && !mouse_capture));
@@ -235,179 +235,173 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
Only a handful of keys can be handled via Virtual Key
detection; rest can't be reliably detected. */
DWORD vkCode = lpKdhs->vkCode;
bool up = !!(lpKdhs->flags & LLKHF_UP);
bool up = !!(lpKdhs->flags & LLKHF_UP);
if (inhibit_multimedia_keys
&& (lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE
|| lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK
|| lpKdhs->vkCode == VK_MEDIA_PREV_TRACK
|| lpKdhs->vkCode == VK_VOLUME_DOWN
|| lpKdhs->vkCode == VK_VOLUME_UP
|| lpKdhs->vkCode == VK_VOLUME_MUTE
|| lpKdhs->vkCode == VK_MEDIA_STOP
|| lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT
|| lpKdhs->vkCode == VK_LAUNCH_MAIL
|| lpKdhs->vkCode == VK_LAUNCH_APP1
|| lpKdhs->vkCode == VK_LAUNCH_APP2
|| lpKdhs->vkCode == VK_HELP
|| lpKdhs->vkCode == VK_BROWSER_BACK
|| lpKdhs->vkCode == VK_BROWSER_FORWARD
|| lpKdhs->vkCode == VK_BROWSER_FAVORITES
|| lpKdhs->vkCode == VK_BROWSER_HOME
|| lpKdhs->vkCode == VK_BROWSER_REFRESH
|| lpKdhs->vkCode == VK_BROWSER_SEARCH
|| lpKdhs->vkCode == VK_BROWSER_STOP))
if (inhibit_multimedia_keys &&
(lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE ||
lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK ||
lpKdhs->vkCode == VK_MEDIA_PREV_TRACK ||
lpKdhs->vkCode == VK_VOLUME_DOWN ||
lpKdhs->vkCode == VK_VOLUME_UP ||
lpKdhs->vkCode == VK_VOLUME_MUTE ||
lpKdhs->vkCode == VK_MEDIA_STOP ||
lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT ||
lpKdhs->vkCode == VK_LAUNCH_MAIL ||
lpKdhs->vkCode == VK_LAUNCH_APP1 ||
lpKdhs->vkCode == VK_LAUNCH_APP2 ||
lpKdhs->vkCode == VK_HELP ||
lpKdhs->vkCode == VK_BROWSER_BACK ||
lpKdhs->vkCode == VK_BROWSER_FORWARD ||
lpKdhs->vkCode == VK_BROWSER_FAVORITES ||
lpKdhs->vkCode == VK_BROWSER_HOME ||
lpKdhs->vkCode == VK_BROWSER_REFRESH ||
lpKdhs->vkCode == VK_BROWSER_SEARCH ||
lpKdhs->vkCode == VK_BROWSER_STOP))
ret = TRUE;
else
ret = CallNextHookEx(NULL, nCode, wParam, lParam);
switch (vkCode)
{
switch (vkCode) {
case VK_MEDIA_PLAY_PAUSE:
{
win_keyboard_handle(0x22, up, 1, 0);
break;
}
{
win_keyboard_handle(0x22, up, 1, 0);
break;
}
case VK_MEDIA_STOP:
{
win_keyboard_handle(0x24, up, 1, 0);
break;
}
{
win_keyboard_handle(0x24, up, 1, 0);
break;
}
case VK_VOLUME_UP:
{
win_keyboard_handle(0x30, up, 1, 0);
break;
}
{
win_keyboard_handle(0x30, up, 1, 0);
break;
}
case VK_VOLUME_DOWN:
{
win_keyboard_handle(0x2E, up, 1, 0);
break;
}
{
win_keyboard_handle(0x2E, up, 1, 0);
break;
}
case VK_VOLUME_MUTE:
{
win_keyboard_handle(0x20, up, 1, 0);
break;
}
{
win_keyboard_handle(0x20, up, 1, 0);
break;
}
case VK_MEDIA_NEXT_TRACK:
{
win_keyboard_handle(0x19, up, 1, 0);
break;
}
{
win_keyboard_handle(0x19, up, 1, 0);
break;
}
case VK_MEDIA_PREV_TRACK:
{
win_keyboard_handle(0x10, up, 1, 0);
break;
}
{
win_keyboard_handle(0x10, up, 1, 0);
break;
}
case VK_LAUNCH_MEDIA_SELECT:
{
win_keyboard_handle(0x6D, up, 1, 0);
break;
}
{
win_keyboard_handle(0x6D, up, 1, 0);
break;
}
case VK_LAUNCH_MAIL:
{
win_keyboard_handle(0x6C, up, 1, 0);
break;
}
{
win_keyboard_handle(0x6C, up, 1, 0);
break;
}
case VK_LAUNCH_APP1:
{
win_keyboard_handle(0x6B, up, 1, 0);
break;
}
{
win_keyboard_handle(0x6B, up, 1, 0);
break;
}
case VK_LAUNCH_APP2:
{
win_keyboard_handle(0x21, up, 1, 0);
break;
}
{
win_keyboard_handle(0x21, up, 1, 0);
break;
}
case VK_BROWSER_BACK:
{
win_keyboard_handle(0x6A, up, 1, 0);
break;
}
{
win_keyboard_handle(0x6A, up, 1, 0);
break;
}
case VK_BROWSER_FORWARD:
{
win_keyboard_handle(0x69, up, 1, 0);
break;
}
{
win_keyboard_handle(0x69, up, 1, 0);
break;
}
case VK_BROWSER_STOP:
{
win_keyboard_handle(0x68, up, 1, 0);
break;
}
{
win_keyboard_handle(0x68, up, 1, 0);
break;
}
case VK_BROWSER_HOME:
{
win_keyboard_handle(0x32, up, 1, 0);
break;
}
{
win_keyboard_handle(0x32, up, 1, 0);
break;
}
case VK_BROWSER_SEARCH:
{
win_keyboard_handle(0x65, up, 1, 0);
break;
}
{
win_keyboard_handle(0x65, up, 1, 0);
break;
}
case VK_BROWSER_REFRESH:
{
win_keyboard_handle(0x67, up, 1, 0);
break;
}
{
win_keyboard_handle(0x67, up, 1, 0);
break;
}
case VK_BROWSER_FAVORITES:
{
win_keyboard_handle(0x66, up, 1, 0);
break;
}
{
win_keyboard_handle(0x66, up, 1, 0);
break;
}
case VK_HELP:
{
win_keyboard_handle(0x3b, up, 1, 0);
break;
}
{
win_keyboard_handle(0x3b, up, 1, 0);
break;
}
}
return ret;
}
else if ((lpKdhs->scanCode == 0x01) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
} else if ((lpKdhs->scanCode == 0x01) && (lpKdhs->flags & LLKHF_ALTDOWN) && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode == 0x01) && bCtrlDown && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode == 0x0f) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
else if ((lpKdhs->scanCode == 0x0f) && (lpKdhs->flags & LLKHF_ALTDOWN) && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode == 0x0f) && bCtrlDown && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode == 0x39) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
else if ((lpKdhs->scanCode == 0x39) && (lpKdhs->flags & LLKHF_ALTDOWN) && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode == 0x3e) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
else if ((lpKdhs->scanCode == 0x3e) && (lpKdhs->flags & LLKHF_ALTDOWN) && !(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
ret = TRUE;
else if ((lpKdhs->scanCode >= 0x5b) && (lpKdhs->scanCode <= 0x5d) && (lpKdhs->flags & LLKHF_EXTENDED))
ret = TRUE;
else if (inhibit_multimedia_keys
&& (lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE
|| lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK
|| lpKdhs->vkCode == VK_MEDIA_PREV_TRACK
|| lpKdhs->vkCode == VK_VOLUME_DOWN
|| lpKdhs->vkCode == VK_VOLUME_UP
|| lpKdhs->vkCode == VK_VOLUME_MUTE
|| lpKdhs->vkCode == VK_MEDIA_STOP
|| lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT
|| lpKdhs->vkCode == VK_LAUNCH_MAIL
|| lpKdhs->vkCode == VK_LAUNCH_APP1
|| lpKdhs->vkCode == VK_LAUNCH_APP2
|| lpKdhs->vkCode == VK_HELP
|| lpKdhs->vkCode == VK_BROWSER_BACK
|| lpKdhs->vkCode == VK_BROWSER_FORWARD
|| lpKdhs->vkCode == VK_BROWSER_FAVORITES
|| lpKdhs->vkCode == VK_BROWSER_HOME
|| lpKdhs->vkCode == VK_BROWSER_REFRESH
|| lpKdhs->vkCode == VK_BROWSER_SEARCH
|| lpKdhs->vkCode == VK_BROWSER_STOP))
else if (inhibit_multimedia_keys &&
(lpKdhs->vkCode == VK_MEDIA_PLAY_PAUSE ||
lpKdhs->vkCode == VK_MEDIA_NEXT_TRACK ||
lpKdhs->vkCode == VK_MEDIA_PREV_TRACK ||
lpKdhs->vkCode == VK_VOLUME_DOWN ||
lpKdhs->vkCode == VK_VOLUME_UP ||
lpKdhs->vkCode == VK_VOLUME_MUTE ||
lpKdhs->vkCode == VK_MEDIA_STOP ||
lpKdhs->vkCode == VK_LAUNCH_MEDIA_SELECT ||
lpKdhs->vkCode == VK_LAUNCH_MAIL ||
lpKdhs->vkCode == VK_LAUNCH_APP1 ||
lpKdhs->vkCode == VK_LAUNCH_APP2 ||
lpKdhs->vkCode == VK_HELP ||
lpKdhs->vkCode == VK_BROWSER_BACK ||
lpKdhs->vkCode == VK_BROWSER_FORWARD ||
lpKdhs->vkCode == VK_BROWSER_FAVORITES ||
lpKdhs->vkCode == VK_BROWSER_HOME ||
lpKdhs->vkCode == VK_BROWSER_REFRESH ||
lpKdhs->vkCode == VK_BROWSER_SEARCH ||
lpKdhs->vkCode == VK_BROWSER_STOP))
ret = TRUE;
else
ret = CallNextHookEx(NULL, nCode, wParam, lParam);
if (lpKdhs->scanCode == 0x00000045) {
if ((lpKdhs->flags & LLKHF_EXTENDED) && (lpKdhs->vkCode == 0x00000090)) {
/* NumLock. */
lpKdhs->flags &= ~LLKHF_EXTENDED;
/* NumLock. */
lpKdhs->flags &= ~LLKHF_EXTENDED;
} else if (!(lpKdhs->flags & LLKHF_EXTENDED) && (lpKdhs->vkCode == 0x00000013)) {
/* Pause - send E1 1D. */
win_keyboard_handle(0xe1, 0, 0, 0);
@@ -433,21 +427,21 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
#endif
#ifdef Q_OS_WINDOWS
static HHOOK llhook = NULL;
static HHOOK llhook = NULL;
#endif
void
main_thread_fn()
{
int frames;
int frames;
QThread::currentThread()->setPriority(QThread::HighestPriority);
plat_set_thread_name(nullptr, "main_thread");
framecountx = 0;
// title_update = 1;
uint64_t old_time = elapsed_timer.elapsed();
int drawits = frames = 0;
is_cpu_thread = 1;
int drawits = frames = 0;
is_cpu_thread = 1;
while (!is_quit && cpu_thread_run) {
/* See if it is time to run a frame of code. */
const uint64_t new_time = elapsed_timer.elapsed();
@@ -505,8 +499,8 @@ main_thread_fn()
}
cpu_thread_running = false;
is_quit = 1;
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
is_quit = 1;
for (uint8_t i = 1; i < GFXCARD_MAX; i++) {
if (gfxcard[i]) {
ui_deinit_monitor(i);
plat_delay_ms(500);
@@ -520,7 +514,7 @@ static std::thread *main_thread;
QTimer discordupdate;
#ifdef Q_OS_WINDOWS
WindowsDarkModeFilter* vmm_dark_mode_filter = nullptr;
WindowsDarkModeFilter *vmm_dark_mode_filter = nullptr;
#endif
int
@@ -530,9 +524,9 @@ main(int argc, char *argv[])
bool wasDarkTheme = false;
/* Check if Windows supports UTF-8 */
if (GetACP() == CP_UTF8)
acp_utf8 = 1;
acp_utf8 = 1;
else
acp_utf8 = 0;
acp_utf8 = 0;
#endif
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, false);
@@ -568,9 +562,9 @@ main(int argc, char *argv[])
if (!util::isWindowsLightTheme()) {
QFile f(":qdarkstyle/dark/darkstyle.qss");
if (!f.exists()) {
if (!f.exists()) {
printf("Unable to set stylesheet, file not found\n");
} else {
} else {
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
@@ -685,7 +679,7 @@ main(int argc, char *argv[])
pc_init_modules();
// UUID / copy / move detection
if(!util::compareUuid()) {
if (!util::compareUuid()) {
QMessageBox movewarnbox;
movewarnbox.setIcon(QMessageBox::Icon::Warning);
movewarnbox.setText(QObject::tr("This machine might have been moved or copied."));
@@ -721,7 +715,7 @@ main(int argc, char *argv[])
warningbox.addButton(QObject::tr("Exit"), QMessageBox::RejectRole);
warningbox.exec();
if (warningbox.result() == QDialog::Accepted)
return 0;
return 0;
}
#endif
@@ -748,7 +742,7 @@ main(int argc, char *argv[])
warningbox.addButton(QObject::tr("Exit"), QMessageBox::RejectRole);
warningbox.exec();
if (warningbox.result() == QDialog::Accepted)
return 0;
return 0;
}
#ifdef DISCORD
@@ -760,7 +754,7 @@ main(int argc, char *argv[])
// https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod
exit_pause();
timeBeginPeriod(1);
atexit([] () -> void { timeEndPeriod(1); });
atexit([]() -> void { timeEndPeriod(1); });
#endif
main_window = new MainWindow();
@@ -772,13 +766,12 @@ main(int argc, char *argv[])
#ifdef WAYLAND
if (QApplication::platformName().contains("wayland")) {
/* Force a sync. */
(void)main_window->winId();
(void) main_window->winId();
QApplication::sync();
extern void wl_keyboard_grab(QWindow *window);
extern void wl_keyboard_grab(QWindow * window);
wl_keyboard_grab(main_window->windowHandle());
}
#endif
app.installEventFilter(main_window);
@@ -826,7 +819,7 @@ main(int argc, char *argv[])
if (hook_enabled) {
/* Yes, low-level hooks *DO* work with raw input, at least global ones. */
llhook = SetWindowsHookEx(WH_KEYBOARD_LL, emu_LowLevelKeyboardProc, NULL, 0);
atexit([] () -> void {
atexit([]() -> void {
if (llhook)
UnhookWindowsHookEx(llhook);
});
@@ -920,10 +913,10 @@ main(int argc, char *argv[])
plat_pause(0);
cpu_thread_running = true;
main_thread = new std::thread(main_thread_fn);
main_thread = new std::thread(main_thread_fn);
});
const auto ret = app.exec();
const auto ret = app.exec();
cpu_thread_run = 0;
main_thread->join();
pc_close(nullptr);

View File

@@ -40,7 +40,7 @@ extern "C" {
#include <86box/plat.h>
#include <86box/ui.h>
#ifdef DISCORD
# include <86box/discord.h>
# include <86box/discord.h>
#endif
#include <86box/device.h>
#include <86box/video.h>
@@ -124,8 +124,8 @@ void qt_set_sequence_auto_mnemonic(bool b);
#endif
#if defined Q_OS_UNIX && !defined Q_OS_HAIKU && !defined Q_OS_MACOS
#include <qpa/qplatformwindow.h>
#include "x11_util.h"
# include <qpa/qplatformwindow.h>
# include "x11_util.h"
#endif
#ifdef Q_OS_MACOS
@@ -143,7 +143,7 @@ namespace IOKit {
# include "be_keyboard.hpp"
extern MainWindow *main_window;
QShortcut *windowedShortcut;
QShortcut *windowedShortcut;
filter_result
keyb_filter(BMessage *message, BHandler **target, BMessageFilter *filter)
@@ -191,8 +191,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->stackedWidget->setMouseTracking(true);
statusBar()->setVisible(!hide_status_bar);
auto hertz_label = new QLabel;
QTimer* frameRateTimer = new QTimer(this);
auto hertz_label = new QLabel;
QTimer *frameRateTimer = new QTimer(this);
frameRateTimer->setInterval(1000);
frameRateTimer->setSingleShot(false);
connect(frameRateTimer, &QTimer::timeout, [hertz_label] {
@@ -205,14 +205,14 @@ MainWindow::MainWindow(QWidget *parent)
statusBar()->addPermanentWidget(hertz_label);
frameRateTimer->start(1000);
num_icon = QIcon(":/settings/qt/icons/num_lock_on.ico");
num_icon_off = QIcon(":/settings/qt/icons/num_lock_off.ico");
scroll_icon = QIcon(":/settings/qt/icons/scroll_lock_on.ico");
num_icon = QIcon(":/settings/qt/icons/num_lock_on.ico");
num_icon_off = QIcon(":/settings/qt/icons/num_lock_off.ico");
scroll_icon = QIcon(":/settings/qt/icons/scroll_lock_on.ico");
scroll_icon_off = QIcon(":/settings/qt/icons/scroll_lock_off.ico");
caps_icon = QIcon(":/settings/qt/icons/caps_lock_on.ico");
caps_icon_off = QIcon(":/settings/qt/icons/caps_lock_off.ico");
kana_icon = QIcon(":/settings/qt/icons/kana_lock_on.ico");
kana_icon_off = QIcon(":/settings/qt/icons/kana_lock_off.ico");
caps_icon = QIcon(":/settings/qt/icons/caps_lock_on.ico");
caps_icon_off = QIcon(":/settings/qt/icons/caps_lock_off.ico");
kana_icon = QIcon(":/settings/qt/icons/kana_lock_on.ico");
kana_icon_off = QIcon(":/settings/qt/icons/kana_lock_off.ico");
num_label = new QLabel;
num_label->setPixmap(num_icon_off.pixmap(QSize(16, 16)));
@@ -234,10 +234,10 @@ MainWindow::MainWindow(QWidget *parent)
kana_label->setToolTip(QShortcut::tr("Kana Lock"));
statusBar()->addPermanentWidget(kana_label);
QTimer* ledKeyboardTimer = new QTimer(this);
QTimer *ledKeyboardTimer = new QTimer(this);
ledKeyboardTimer->setTimerType(Qt::CoarseTimer);
ledKeyboardTimer->setInterval(1);
connect(ledKeyboardTimer, &QTimer::timeout, this, [this] () {
connect(ledKeyboardTimer, &QTimer::timeout, this, [this]() {
uint8_t caps, num, scroll, kana;
keyboard_get_states(&caps, &num, &scroll, &kana);
@@ -246,12 +246,10 @@ MainWindow::MainWindow(QWidget *parent)
if (caps_label->isVisible())
caps_label->setPixmap(caps ? this->caps_icon.pixmap(QSize(16, 16)) : this->caps_icon_off.pixmap(QSize(16, 16)));
if (scroll_label->isVisible())
scroll_label->setPixmap(scroll ? this->scroll_icon.pixmap(QSize(16, 16)) :
this->scroll_icon_off.pixmap(QSize(16, 16)));
scroll_label->setPixmap(scroll ? this->scroll_icon.pixmap(QSize(16, 16)) : this->scroll_icon_off.pixmap(QSize(16, 16)));
if (kana_label->isVisible())
kana_label->setPixmap(kana ? this->kana_icon.pixmap(QSize(16, 16)) :
this->kana_icon_off.pixmap(QSize(16, 16)));
kana_label->setPixmap(kana ? this->kana_icon.pixmap(QSize(16, 16)) : this->kana_icon_off.pixmap(QSize(16, 16)));
});
ledKeyboardTimer->start();
@@ -285,10 +283,8 @@ MainWindow::MainWindow(QWidget *parent)
num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
scroll_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
int ext_ax_kbd = machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD) &&
(keyboard_type == KEYBOARD_TYPE_AX);
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) &&
!machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
int ext_ax_kbd = machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD) && (keyboard_type == KEYBOARD_TYPE_AX);
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) && !machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
kana_label->setVisible(ext_ax_kbd || int_ax_kbd);
while (QApplication::overrideCursor())
QApplication::restoreOverrideCursor();
@@ -300,7 +296,10 @@ MainWindow::MainWindow(QWidget *parent)
bool enable_comp_option = false;
for (int i = 0; i < MONITORS_NUM; i++) {
if (monitors[i].mon_composite) { enable_comp_option = true; break; }
if (monitors[i].mon_composite) {
enable_comp_option = true;
break;
}
}
ui->actionCGA_composite_settings->setEnabled(enable_comp_option);
@@ -398,8 +397,7 @@ MainWindow::MainWindow(QWidget *parent)
if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) {
w = static_cast<int>(w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
const int modifiedHeight =
static_cast<int>(h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.))
const int modifiedHeight = static_cast<int>(h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.))
+ menuBar()->height()
+ (statusBar()->height() * !hide_status_bar)
+ (ui->toolBar->height() * !hide_tool_bar);
@@ -576,17 +574,27 @@ MainWindow::MainWindow(QWidget *parent)
actGroup->addAction(ui->action_6x_2);
actGroup->addAction(ui->action_7x_2);
actGroup->addAction(ui->action_8x_2);
connect(actGroup, &QActionGroup::triggered, this, [this](QAction* action) {
if (action == ui->action_0_5x_2) video_gl_input_scale = 0.5;
if (action == ui->action_1x_2) video_gl_input_scale = 1;
if (action == ui->action1_5x_2) video_gl_input_scale = 1.5;
if (action == ui->action_2x_2) video_gl_input_scale = 2;
if (action == ui->action_3x_2) video_gl_input_scale = 3;
if (action == ui->action_4x_2) video_gl_input_scale = 4;
if (action == ui->action_5x_2) video_gl_input_scale = 5;
if (action == ui->action_6x_2) video_gl_input_scale = 6;
if (action == ui->action_7x_2) video_gl_input_scale = 7;
if (action == ui->action_8x_2) video_gl_input_scale = 8;
connect(actGroup, &QActionGroup::triggered, this, [this](QAction *action) {
if (action == ui->action_0_5x_2)
video_gl_input_scale = 0.5;
if (action == ui->action_1x_2)
video_gl_input_scale = 1;
if (action == ui->action1_5x_2)
video_gl_input_scale = 1.5;
if (action == ui->action_2x_2)
video_gl_input_scale = 2;
if (action == ui->action_3x_2)
video_gl_input_scale = 3;
if (action == ui->action_4x_2)
video_gl_input_scale = 4;
if (action == ui->action_5x_2)
video_gl_input_scale = 5;
if (action == ui->action_6x_2)
video_gl_input_scale = 6;
if (action == ui->action_7x_2)
video_gl_input_scale = 7;
if (action == ui->action_8x_2)
video_gl_input_scale = 8;
});
switch (scale) {
@@ -697,12 +705,17 @@ MainWindow::MainWindow(QWidget *parent)
actGroup->addAction(ui->action_Square_pixels_keep_ratio_gl);
actGroup->addAction(ui->action_Integer_scale_gl);
actGroup->addAction(ui->action4_3_Integer_scale_gl);
connect(actGroup, &QActionGroup::triggered, this, [this](QAction* action) {
if (action == ui->action_Full_screen_stretch_gl) video_gl_input_scale_mode = FULLSCR_SCALE_FULL;
if (action == ui->action_4_3_gl) video_gl_input_scale_mode = FULLSCR_SCALE_43;
if (action == ui->action_Square_pixels_keep_ratio_gl) video_gl_input_scale_mode = FULLSCR_SCALE_KEEPRATIO;
if (action == ui->action_Integer_scale_gl) video_gl_input_scale_mode = FULLSCR_SCALE_INT;
if (action == ui->action4_3_Integer_scale_gl) video_gl_input_scale_mode = FULLSCR_SCALE_INT43;
connect(actGroup, &QActionGroup::triggered, this, [this](QAction *action) {
if (action == ui->action_Full_screen_stretch_gl)
video_gl_input_scale_mode = FULLSCR_SCALE_FULL;
if (action == ui->action_4_3_gl)
video_gl_input_scale_mode = FULLSCR_SCALE_43;
if (action == ui->action_Square_pixels_keep_ratio_gl)
video_gl_input_scale_mode = FULLSCR_SCALE_KEEPRATIO;
if (action == ui->action_Integer_scale_gl)
video_gl_input_scale_mode = FULLSCR_SCALE_INT;
if (action == ui->action4_3_Integer_scale_gl)
video_gl_input_scale_mode = FULLSCR_SCALE_INT43;
});
switch (video_grayscale) {
default:
@@ -770,7 +783,7 @@ MainWindow::MainWindow(QWidget *parent)
video_setblit(qt_blit);
if (start_in_fullscreen) {
connect(ui->stackedWidget, &RendererStack::blitToRenderer, this, [this] () {
connect(ui->stackedWidget, &RendererStack::blitToRenderer, this, [this]() {
if (start_in_fullscreen) {
QTimer::singleShot(100, ui->actionFullscreen, &QAction::trigger);
start_in_fullscreen = 0;
@@ -820,9 +833,9 @@ MainWindow::MainWindow(QWidget *parent)
setContextMenuPolicy(Qt::PreventContextMenu);
/* Remove default Shift+F10 handler, which unfocuses keyboard input even with no context menu. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(new QShortcut(QKeySequence(Qt::SHIFT | Qt::Key_F10), this), &QShortcut::activated, this, [](){});
connect(new QShortcut(QKeySequence(Qt::SHIFT | Qt::Key_F10), this), &QShortcut::activated, this, []() {});
#else
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F10), this), &QShortcut::activated, this, [](){});
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F10), this), &QShortcut::activated, this, []() {});
#endif
connect(this, &MainWindow::initRendererMonitor, this, &MainWindow::initRendererMonitorSlot);
@@ -880,18 +893,19 @@ MainWindow::MainWindow(QWidget *parent)
else
# endif
# ifdef WAYLAND
if (QApplication::platformName().contains("wayland"))
if (QApplication::platformName().contains("wayland"))
xkbcommon_wl_init();
else
# endif
{}
{
}
#endif
#if defined Q_OS_UNIX && !defined Q_OS_MACOS && !defined Q_OS_HAIKU
if (QApplication::platformName().contains("xcb")) {
QTimer::singleShot(0, this, [this] {
auto whandle = windowHandle();
if (! whandle) {
if (!whandle) {
qWarning() << "No window handle";
} else {
QPlatformWindow *window = whandle->handle();
@@ -901,7 +915,7 @@ MainWindow::MainWindow(QWidget *parent)
}
#endif
updateShortcuts();
updateShortcuts();
}
void
@@ -914,7 +928,7 @@ MainWindow::closeEvent(QCloseEvent *event)
if (confirm_exit && confirm_exit_cmdl && cpu_thread_run) {
QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", tr("Are you sure you want to exit 86Box?"), QMessageBox::Yes | QMessageBox::No, this);
auto chkbox = new QCheckBox(tr("Don't show this message again"));
auto chkbox = new QCheckBox(tr("Don't show this message again"));
questionbox.setCheckBox(chkbox);
chkbox->setChecked(!confirm_exit);
@@ -967,57 +981,57 @@ MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
void MainWindow::updateShortcuts()
void
MainWindow::updateShortcuts()
{
/*
Update menu shortcuts from accelerator table
Note that these only work in windowed mode. If you add any new shortcuts,
you have to go duplicate them in MainWindow::eventFilter()
*/
// First we need to wipe all existing accelerators, otherwise Qt will
// run into conflicts with old ones.
ui->actionTake_screenshot->setShortcut(QKeySequence());
ui->actionCtrl_Alt_Del->setShortcut(QKeySequence());
ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence());
ui->actionHard_Reset->setShortcut(QKeySequence());
ui->actionPause->setShortcut(QKeySequence());
ui->actionMute_Unmute->setShortcut(QKeySequence());
int accID;
QKeySequence seq;
accID = FindAccelerator("screenshot");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionTake_screenshot->setShortcut(seq);
accID = FindAccelerator("send_ctrl_alt_del");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionCtrl_Alt_Del->setShortcut(seq);
accID = FindAccelerator("send_ctrl_alt_esc");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionCtrl_Alt_Esc->setShortcut(seq);
accID = FindAccelerator("hard_reset");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionHard_Reset->setShortcut(seq);
accID = FindAccelerator("fullscreen");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionFullscreen->setShortcut(seq);
accID = FindAccelerator("pause");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionPause->setShortcut(seq);
accID = FindAccelerator("mute");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionMute_Unmute->setShortcut(seq);
/*
Update menu shortcuts from accelerator table
Note that these only work in windowed mode. If you add any new shortcuts,
you have to go duplicate them in MainWindow::eventFilter()
*/
// First we need to wipe all existing accelerators, otherwise Qt will
// run into conflicts with old ones.
ui->actionTake_screenshot->setShortcut(QKeySequence());
ui->actionCtrl_Alt_Del->setShortcut(QKeySequence());
ui->actionCtrl_Alt_Esc->setShortcut(QKeySequence());
ui->actionHard_Reset->setShortcut(QKeySequence());
ui->actionPause->setShortcut(QKeySequence());
ui->actionMute_Unmute->setShortcut(QKeySequence());
int accID;
QKeySequence seq;
accID = FindAccelerator("screenshot");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionTake_screenshot->setShortcut(seq);
accID = FindAccelerator("send_ctrl_alt_del");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionCtrl_Alt_Del->setShortcut(seq);
accID = FindAccelerator("send_ctrl_alt_esc");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionCtrl_Alt_Esc->setShortcut(seq);
accID = FindAccelerator("hard_reset");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionHard_Reset->setShortcut(seq);
accID = FindAccelerator("fullscreen");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionFullscreen->setShortcut(seq);
accID = FindAccelerator("pause");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionPause->setShortcut(seq);
accID = FindAccelerator("mute");
seq = QKeySequence::fromString(acc_keys[accID].seq);
ui->actionMute_Unmute->setShortcut(seq);
}
void
MainWindow::resizeEvent(QResizeEvent *event)
{
@@ -1031,24 +1045,26 @@ MainWindow::resizeEvent(QResizeEvent *event)
int newY = pos().y();
if (((frameGeometry().x() + event->size().width() + 1) > util::screenOfWidget(this)->availableGeometry().right())) {
//move(util::screenOfWidget(this)->availableGeometry().right() - size().width() - 1, pos().y());
// move(util::screenOfWidget(this)->availableGeometry().right() - size().width() - 1, pos().y());
newX = util::screenOfWidget(this)->availableGeometry().right() - frameGeometry().width() - 1;
if (newX < 1) newX = 1;
if (newX < 1)
newX = 1;
}
if (((frameGeometry().y() + event->size().height() + 1) > util::screenOfWidget(this)->availableGeometry().bottom())) {
newY = util::screenOfWidget(this)->availableGeometry().bottom() - frameGeometry().height() - 1;
if (newY < 1) newY = 1;
if (newY < 1)
newY = 1;
}
move(newX, newY);
#endif
#endif /*MOVE_WINDOW*/
}
void
MainWindow::initRendererMonitorSlot(int monitor_index)
{
auto &secondaryRenderer = this->renderers[monitor_index];
secondaryRenderer = std::make_unique<RendererStack>(nullptr, monitor_index);
secondaryRenderer = std::make_unique<RendererStack>(nullptr, monitor_index);
if (secondaryRenderer) {
connect(secondaryRenderer.get(), &RendererStack::rendererChanged, this, [this, monitor_index] {
this->renderers[monitor_index]->show();
@@ -1083,7 +1099,7 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
if (monitor_settings[monitor_index].mon_window_maximized) {
if (renderers[monitor_index])
renderers[monitor_index]->onResize(renderers[monitor_index]->width(),
renderers[monitor_index]->height());
renderers[monitor_index]->height());
device_force_redraw();
}
@@ -1258,7 +1274,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
# ifdef EVDEV_KEYBOARD_HPP
keycode = evdev_translate(keycode - 8);
# else
keycode = 0;
keycode = 0;
# endif
#endif
@@ -1277,11 +1293,11 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
}
break;
case 0x80 ... 0xff: /* regular break codes */
case 0x10b: /* Microsoft scroll up normal */
case 0x80 ... 0xff: /* regular break codes */
case 0x10b: /* Microsoft scroll up normal */
case 0x180 ... 0x1ff: /* E0 break codes (including Microsoft scroll down normal) */
/* This key uses a break code as make. Send it manually, only on press. */
if (down && (mouse_capture || !kbd_req_capture || video_fullscreen)) {
if (down && (mouse_capture || !kbd_req_capture || (video_fullscreen && !fullscreen_ui_visible))) {
if (keycode & 0x100)
keyboard_send(0xe0);
keyboard_send(keycode & 0xff);
@@ -1293,7 +1309,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
keycode = 0x38; /* map to Left Alt */
break;
case 0x137: /* Print Screen */
case 0x137: /* Print Screen */
if (keyboard_recv_ui(0x38) || keyboard_recv_ui(0x138)) { /* Alt+ */
keycode = 0x54;
} else if (down) {
@@ -1304,7 +1320,7 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
}
break;
case 0x145: /* Pause */
case 0x145: /* Pause */
if (keyboard_recv_ui(0x1d) || keyboard_recv_ui(0x11d)) { /* Ctrl+ */
keycode = 0x146;
} else {
@@ -1322,15 +1338,15 @@ MainWindow::processKeyboardInput(bool down, uint32_t keycode)
// that's followed up with "(really?)". It's the only way to distinguish
// left and right modifiers with Qt 6 on macOS, so let's just roll with it.
static std::unordered_map<uint32_t, uint16_t> mac_modifiers_to_xt = {
{NX_DEVICELCTLKEYMASK, 0x1D },
{ NX_DEVICELSHIFTKEYMASK, 0x2A },
{ NX_DEVICERSHIFTKEYMASK, 0x36 },
{ NX_DEVICELCMDKEYMASK, 0x15B},
{ NX_DEVICERCMDKEYMASK, 0x15C},
{ NX_DEVICELALTKEYMASK, 0x38 },
{ NX_DEVICERALTKEYMASK, 0x138},
{ NX_DEVICE_ALPHASHIFT_STATELESS_MASK, 0x3A },
{ NX_DEVICERCTLKEYMASK, 0x11D},
{ NX_DEVICELCTLKEYMASK, 0x1D },
{ NX_DEVICELSHIFTKEYMASK, 0x2A },
{ NX_DEVICERSHIFTKEYMASK, 0x36 },
{ NX_DEVICELCMDKEYMASK, 0x15B },
{ NX_DEVICERCMDKEYMASK, 0x15C },
{ NX_DEVICELALTKEYMASK, 0x38 },
{ NX_DEVICERALTKEYMASK, 0x138 },
{ NX_DEVICE_ALPHASHIFT_STATELESS_MASK, 0x3A },
{ NX_DEVICERCTLKEYMASK, 0x11D },
};
static bool mac_iso_swap = false;
@@ -1391,45 +1407,44 @@ MainWindow::processMacKeyboardInput(bool down, const QKeyEvent *event)
- Romanian third level ANSI_Grave is unknown
- Russian clusters <>, plusminus and paragraph into a four-level ANSI_Grave, with the aforementioned `~ on ISO_Section */
auto key = event->key();
if ((nvk == 0x32) && ( /* system reports ANSI_Grave for ISO_Section keys: */
(key == Qt::Key_Less) || (key == Qt::Key_Greater) || /* Croatian, French, German, Icelandic, Italian, Norwegian, Portuguese, Spanish, Spanish Latin America, Turkish Q */
(key == Qt::Key_Ugrave) || /* French Canadian */
(key == Qt::Key_Icircumflex) || /* Romanian */
(key == Qt::Key_Iacute) || /* Hungarian */
(key == Qt::Key_BracketLeft) || (key == Qt::Key_BracketRight) || /* Russian upper two levels */
(key == Qt::Key_W) /* Turkish F */
))
if ((nvk == 0x32) && ( /* system reports ANSI_Grave for ISO_Section keys: */
(key == Qt::Key_Less) || (key == Qt::Key_Greater) || /* Croatian, French, German, Icelandic, Italian, Norwegian, Portuguese, Spanish, Spanish Latin America, Turkish Q */
(key == Qt::Key_Ugrave) || /* French Canadian */
(key == Qt::Key_Icircumflex) || /* Romanian */
(key == Qt::Key_Iacute) || /* Hungarian */
(key == Qt::Key_BracketLeft) || (key == Qt::Key_BracketRight) || /* Russian upper two levels */
(key == Qt::Key_W) /* Turkish F */
))
mac_iso_swap = true;
else if ((nvk == 0x0a) && ( /* system reports ISO_Section for ANSI_Grave keys: */
(key == Qt::Key_paragraph) || (key == Qt::Key_plusminus) || /* Arabic, British, Bulgarian, Danish shifted, Dutch, Greek, Hebrew, Hungarian shifted, International English, Norwegian shifted, Portuguese, Russian lower two levels, Swiss unshifted, Swedish unshifted, Turkish F */
(key == Qt::Key_At) || (key == Qt::Key_NumberSign) || /* Belgian, French */
(key == Qt::Key_Apostrophe) || /* Brazilian unshifted */
(key == Qt::Key_QuoteDbl) || /* Brazilian shifted, Turkish Q unshifted */
(key == Qt::Key_QuoteLeft) || /* Croatian (right quote unknown) */
(key == Qt::Key_Dollar) || /* Danish unshifted */
(key == Qt::Key_AsciiCircum) || (key == 0x1ffffff) || /* German unshifted (0x1ffffff according to one tester), Polish unshifted */
(key == Qt::Key_degree) || /* German shifted, Icelandic unshifted, Spanish Latin America shifted, Swiss shifted, Swedish shifted */
(key == Qt::Key_0) || /* Hungarian unshifted */
(key == Qt::Key_diaeresis) || /* Icelandic shifted */
(key == Qt::Key_acute) || /* Norwegian unshifted */
(key == Qt::Key_Asterisk) || /* Polish shifted */
(key == Qt::Key_masculine) || (key == Qt::Key_ordfeminine) || /* Spanish (masculine unconfirmed) */
(key == Qt::Key_Eacute) || /* Turkish Q shifted */
(key == Qt::Key_Slash) /* French Canadian unshifted, Ukrainian shifted */
))
else if ((nvk == 0x0a) && ( /* system reports ISO_Section for ANSI_Grave keys: */
(key == Qt::Key_paragraph) || (key == Qt::Key_plusminus) || /* Arabic, British, Bulgarian, Danish shifted, Dutch, Greek, Hebrew, Hungarian shifted, International English, Norwegian shifted, Portuguese, Russian lower two levels, Swiss unshifted, Swedish unshifted, Turkish F */
(key == Qt::Key_At) || (key == Qt::Key_NumberSign) || /* Belgian, French */
(key == Qt::Key_Apostrophe) || /* Brazilian unshifted */
(key == Qt::Key_QuoteDbl) || /* Brazilian shifted, Turkish Q unshifted */
(key == Qt::Key_QuoteLeft) || /* Croatian (right quote unknown) */
(key == Qt::Key_Dollar) || /* Danish unshifted */
(key == Qt::Key_AsciiCircum) || (key == 0x1ffffff) || /* German unshifted (0x1ffffff according to one tester), Polish unshifted */
(key == Qt::Key_degree) || /* German shifted, Icelandic unshifted, Spanish Latin America shifted, Swiss shifted, Swedish shifted */
(key == Qt::Key_0) || /* Hungarian unshifted */
(key == Qt::Key_diaeresis) || /* Icelandic shifted */
(key == Qt::Key_acute) || /* Norwegian unshifted */
(key == Qt::Key_Asterisk) || /* Polish shifted */
(key == Qt::Key_masculine) || (key == Qt::Key_ordfeminine) || /* Spanish (masculine unconfirmed) */
(key == Qt::Key_Eacute) || /* Turkish Q shifted */
(key == Qt::Key_Slash) /* French Canadian unshifted, Ukrainian shifted */
))
mac_iso_swap = true;
#if 0
# if 0
if (down) {
QMessageBox questionbox(QMessageBox::Icon::Information, QString("Mac key swap test"), QString("nativeVirtualKey 0x%1\nnativeScanCode 0x%2\nkey 0x%3\nmac_iso_swap %4").arg(nvk, 0, 16).arg(event->nativeScanCode(), 0, 16).arg(key, 0, 16).arg(mac_iso_swap ? "yes" : "no"), QMessageBox::Ok, this);
questionbox.exec();
}
#endif
# endif
if (mac_iso_swap)
nvk = (nvk == 0x0a) ? 0x32 : 0x0a;
}
// Special case for command + forward delete to send insert.
if ((event->nativeModifiers() & NSEventModifierFlagCommand) &&
((event->nativeVirtualKey() == nvk_Delete) || event->key() == Qt::Key_Delete)) {
if ((event->nativeModifiers() & NSEventModifierFlagCommand) && ((event->nativeVirtualKey() == nvk_Delete) || event->key() == Qt::Key_Delete)) {
nvk = nvk_Insert; // Qt::Key_Help according to event->key()
}
@@ -1449,6 +1464,7 @@ MainWindow::on_actionFullscreen_triggered()
if (!hide_tool_bar)
ui->toolBar->show();
video_fullscreen = 0;
fullscreen_ui_visible = 0;
if (vid_resize != 1) {
emit resizeContents(vid_resize == 2 ? fixed_size_x : monitors[0].mon_scrnsz_x, vid_resize == 2 ? fixed_size_y : monitors[0].mon_scrnsz_y);
}
@@ -1461,7 +1477,7 @@ MainWindow::on_actionFullscreen_triggered()
ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
showFullScreen();
}
fs_on_signal = false;
fs_on_signal = false;
fs_off_signal = false;
ui->stackedWidget->onResize(width(), height());
}
@@ -1482,85 +1498,75 @@ MainWindow::getTitle(wchar_t *title)
}
}
// Helper to find an accelerator key and return it's sequence
// TODO: Is there a more central place to put this?
QKeySequence
MainWindow::FindAcceleratorSeq(const char *name)
{
int accID = FindAccelerator(name);
if(accID == -1)
return false;
return(QKeySequence::fromString(acc_keys[accID].seq));
int accID = FindAccelerator(name);
if (accID == -1)
return false;
return (QKeySequence::fromString(acc_keys[accID].seq));
}
bool
MainWindow::eventFilter(QObject *receiver, QEvent *event)
{
// Detect shortcuts when menubar is hidden
// TODO: Could this be simplified by proxying the event and manually
// shoving it into the menubar?
if (event->type() == QEvent::KeyPress)
{
this->keyPressEvent((QKeyEvent *) event);
// Detect shortcuts when menubar is hidden
// TODO: Could this be simplified by proxying the event and manually
// shoving it into the menubar?
if (event->type() == QEvent::KeyPress) {
this->keyPressEvent((QKeyEvent *) event);
// We check for mouse release even if we aren't fullscreen,
// because it's not a menu accelerator.
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *ke = (QKeyEvent *) event;
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("release_mouse") ||
(QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("release_mouse"))
{
plat_mouse_capture(0);
}
}
// We check for mouse release even if we aren't fullscreen,
// because it's not a menu accelerator.
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = (QKeyEvent *) event;
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("release_mouse") || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("release_mouse")) {
plat_mouse_capture(0);
}
}
if (event->type() == QEvent::KeyPress && video_fullscreen != 0)
{
QKeyEvent *ke = (QKeyEvent *) event;
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("screenshot")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot"))
{
ui->actionTake_screenshot->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("fullscreen")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen"))
{
ui->actionFullscreen->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("hard_reset")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset"))
{
ui->actionHard_Reset->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("send_ctrl_alt_del")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del"))
{
ui->actionCtrl_Alt_Del->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("send_ctrl_alt_esc")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_esc"))
{
ui->actionCtrl_Alt_Esc->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("pause")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("pause"))
{
ui->actionPause->trigger();
}
if ((QKeySequence)(ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("mute")
|| (QKeySequence)(ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute"))
{
ui->actionMute_Unmute->trigger();
}
if (event->type() == QEvent::KeyPress && video_fullscreen != 0) {
QKeyEvent *ke = (QKeyEvent *) event;
return true;
}
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("screenshot")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot")) {
ui->actionTake_screenshot->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("fullscreen")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen")) {
ui->actionFullscreen->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("hard_reset")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset")) {
ui->actionHard_Reset->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("send_ctrl_alt_del")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del")) {
ui->actionCtrl_Alt_Del->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("send_ctrl_alt_esc")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_esc")) {
ui->actionCtrl_Alt_Esc->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("pause")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("pause")) {
ui->actionPause->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("mute")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("mute")) {
ui->actionMute_Unmute->trigger();
}
if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("toggle_ui_fullscreen")
|| (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("toggle_ui_fullscreen")) {
toggleFullscreenUI();
}
return true;
}
}
if (!dopause && (!kbd_req_capture || mouse_capture)) {
if (event->type() == QEvent::Shortcut) {
@@ -1571,8 +1577,8 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
}
}
if (event->type() == QEvent::KeyPress) {
event->accept();
event->accept();
return true;
}
if (event->type() == QEvent::KeyRelease) {
@@ -1586,7 +1592,7 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
static auto curdopause = dopause;
if (event->type() == QEvent::WindowBlocked) {
window_blocked = true;
curdopause = dopause;
curdopause = dopause;
plat_pause(isNonPause ? dopause : (isShowMessage ? 2 : 1));
emit setMouseCapture(false);
releaseKeyboard();
@@ -1595,7 +1601,7 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event)
plat_pause(curdopause);
}
}
return QMainWindow::eventFilter(receiver, event);
}
@@ -1615,15 +1621,16 @@ MainWindow::refreshMediaMenu()
caps_label->setToolTip(QShortcut::tr("Caps Lock"));
caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD));
kana_label->setToolTip(QShortcut::tr("Kana Lock"));
int ext_ax_kbd = machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD) &&
(keyboard_type == KEYBOARD_TYPE_AX);
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) &&
!machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
int ext_ax_kbd = machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD) && (keyboard_type == KEYBOARD_TYPE_AX);
int int_ax_kbd = machine_has_flags(machine, MACHINE_KEYBOARD_JIS) && !machine_has_bus(machine, MACHINE_BUS_PS2_PORTS);
kana_label->setVisible(ext_ax_kbd || int_ax_kbd);
bool enable_comp_option = false;
for (int i = 0; i < MONITORS_NUM; i++) {
if (monitors[i].mon_composite) { enable_comp_option = true; break; }
if (monitors[i].mon_composite) {
enable_comp_option = true;
break;
}
}
ui->actionCGA_composite_settings->setEnabled(enable_comp_option);
@@ -1635,12 +1642,11 @@ MainWindow::showMessage(int flags, const QString &header, const QString &message
if (QThread::currentThread() == this->thread()) {
if (!cpu_thread_running) {
showMessageForNonQtThread(flags, header, message, richText, nullptr);
}
else
} else
showMessage_(flags, header, message, richText);
} else {
std::atomic_bool done = false;
emit showMessageForNonQtThread(flags, header, message, richText, &done);
emit showMessageForNonQtThread(flags, header, message, richText, &done);
while (!done) {
QThread::msleep(1);
}
@@ -1681,7 +1687,7 @@ MainWindow::keyPressEvent(QKeyEvent *event)
processKeyboardInput(true, event->nativeScanCode());
#endif
}
event->accept();
}
@@ -1724,13 +1730,13 @@ MainWindow::getRenderWidgetSize()
void
MainWindow::focusInEvent(QFocusEvent *event)
{
//this->grabKeyboard();
// this->grabKeyboard();
}
void
MainWindow::focusOutEvent(QFocusEvent *event)
{
//this->releaseKeyboard();
// this->releaseKeyboard();
}
void
@@ -2205,11 +2211,37 @@ MainWindow::on_actionUpdate_status_bar_icons_triggered()
status->clearActivity();
}
void
MainWindow::toggleFullscreenUI()
{
if (video_fullscreen == 0)
return;
fullscreen_ui_visible ^= 1;
if (fullscreen_ui_visible) {
// UI is being shown - save mouse capture state and release if captured
mouse_was_captured = (mouse_capture != 0);
if (mouse_was_captured) {
plat_mouse_capture(0);
}
} else {
// UI is being hidden - restore previous mouse capture state
if (mouse_was_captured) {
plat_mouse_capture(1);
}
}
ui->menubar->setVisible(fullscreen_ui_visible);
ui->statusbar->setVisible(fullscreen_ui_visible && !hide_status_bar);
ui->toolBar->setVisible(fullscreen_ui_visible && !hide_tool_bar);
}
void
MainWindow::on_actionTake_screenshot_triggered()
{
startblit();
for (auto & monitor : monitors)
for (auto &monitor : monitors)
++monitor.mon_screenshots;
endblit();
device_force_redraw();
@@ -2240,16 +2272,13 @@ MainWindow::setSendKeyboardInput(bool enabled)
void
MainWindow::updateUiPauseState()
{
const auto pause_icon = dopause ? QIcon(":/menuicons/qt/icons/run.ico") :
QIcon(":/menuicons/qt/icons/pause.ico");
const auto tooltip_text = dopause ? QString(tr("Resume execution")) :
QString(tr("Pause execution"));
const auto menu_text = dopause ? QString(tr("Re&sume")) :
QString(tr("&Pause"));
const auto pause_icon = dopause ? QIcon(":/menuicons/qt/icons/run.ico") : QIcon(":/menuicons/qt/icons/pause.ico");
const auto tooltip_text = dopause ? QString(tr("Resume execution")) : QString(tr("Pause execution"));
const auto menu_text = dopause ? QString(tr("Re&sume")) : QString(tr("&Pause"));
ui->actionPause->setIcon(pause_icon);
ui->actionPause->setToolTip(tooltip_text);
ui->actionPause->setText(menu_text);
emit vmmRunningStateChanged(static_cast<VMManagerProtocol::RunningState>(window_blocked ? (dopause ? VMManagerProtocol::RunningState::PausedWaiting : VMManagerProtocol::RunningState::RunningWaiting) : (VMManagerProtocol::RunningState)dopause));
emit vmmRunningStateChanged(static_cast<VMManagerProtocol::RunningState>(window_blocked ? (dopause ? VMManagerProtocol::RunningState::PausedWaiting : VMManagerProtocol::RunningState::RunningWaiting) : (VMManagerProtocol::RunningState) dopause));
}
void
@@ -2345,10 +2374,11 @@ MainWindow::on_actionRenderer_options_triggered()
}
}
}
} else for (int i = 1; i < MONITORS_NUM; i++) {
if (renderers[i] && renderers[i]->hasOptions())
renderers[i]->reloadOptions();
}
} else
for (int i = 1; i < MONITORS_NUM; i++) {
if (renderers[i] && renderers[i]->hasOptions())
renderers[i]->reloadOptions();
}
} else if (reload_renderers && ui->stackedWidget->reloadRendererOption()) {
reload_renderers = false;
ui->stackedWidget->switchRenderer(static_cast<RendererStack::Renderer>(vid_api));
@@ -2437,24 +2467,28 @@ MainWindow::on_actionApply_fullscreen_stretch_mode_when_maximized_triggered(bool
config_save();
}
void MainWindow::on_actionCursor_Puck_triggered()
void
MainWindow::on_actionCursor_Puck_triggered()
{
tablet_tool_type = 0;
config_save();
}
void MainWindow::on_actionPen_triggered()
void
MainWindow::on_actionPen_triggered()
{
tablet_tool_type = 1;
config_save();
}
void MainWindow::on_actionACPI_Shutdown_triggered()
void
MainWindow::on_actionACPI_Shutdown_triggered()
{
acpi_pwrbut_pressed = 1;
}
void MainWindow::on_actionCGA_composite_settings_triggered()
void
MainWindow::on_actionCGA_composite_settings_triggered()
{
isNonPause = true;
CGASettingsDialog dialog;
@@ -2463,4 +2497,3 @@ void MainWindow::on_actionCGA_composite_settings_triggered()
isNonPause = false;
config_save();
}

View File

@@ -33,16 +33,15 @@ public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void showMessage(int flags, const QString &header, const QString &message, bool richText);
void getTitle(wchar_t *title);
void blitToWidget(int x, int y, int w, int h, int monitor_index);
QSize getRenderWidgetSize();
void setSendKeyboardInput(bool enabled);
void reloadAllRenderers();
QShortcut *windowedShortcut;
QKeySequence FindAcceleratorSeq(const char *name);
void showMessage(int flags, const QString &header, const QString &message, bool richText);
void getTitle(wchar_t *title);
void blitToWidget(int x, int y, int w, int h, int monitor_index);
QSize getRenderWidgetSize();
void setSendKeyboardInput(bool enabled);
void reloadAllRenderers();
QShortcut *windowedShortcut;
QKeySequence FindAcceleratorSeq(const char *name);
std::array<std::unique_ptr<RendererStack>, 8> renderers;
signals:
void paint(const QImage &image);
@@ -65,7 +64,7 @@ signals:
void setFullscreen(bool state);
void setMouseCapture(bool state);
void showMessageForNonQtThread(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool* done);
void showMessageForNonQtThread(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool *done);
void getTitleForNonQtThread(wchar_t *title);
void vmmRunningStateChanged(VMManagerProtocol::RunningState state);
@@ -131,6 +130,7 @@ private slots:
void on_actionHide_tool_bar_triggered();
void on_actionUpdate_status_bar_icons_triggered();
void on_actionTake_screenshot_triggered();
void toggleFullscreenUI();
void on_actionMute_Unmute_triggered();
void on_actionSound_gain_triggered();
void on_actionPreferences_triggered();
@@ -138,7 +138,7 @@ private slots:
void on_actionRenderer_options_triggered();
void refreshMediaMenu();
void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool* done = nullptr);
void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool *done = nullptr);
void getTitle_(wchar_t *title);
void on_actionMCA_devices_triggered();
@@ -178,8 +178,8 @@ private:
std::unique_ptr<MachineStatus> status;
std::shared_ptr<MediaMenu> mm;
void updateShortcuts();
void processKeyboardInput(bool down, uint32_t keycode);
void updateShortcuts();
void processKeyboardInput(bool down, uint32_t keycode);
#ifdef Q_OS_MACOS
uint32_t last_modifiers = 0;
void processMacKeyboardInput(bool down, const QKeyEvent *event);
@@ -192,24 +192,27 @@ private:
bool vnc_enabled = false;
/* Full screen ON and OFF signals */
bool fs_on_signal = false;
bool fs_off_signal = false;
bool fs_on_signal = false;
bool fs_off_signal = false;
/* Reload the renderers after closing renderer options dialog. */
bool reload_renderers = false;
bool reload_renderers = false;
/* Mouse capture state before showing fullscreen UI */
bool mouse_was_captured = false;
friend class SpecifyDimensions;
friend class ProgSettings;
friend class RendererCommon;
friend class RendererStack; // For UI variable access by non-primary renderer windows.
friend class RendererStack; // For UI variable access by non-primary renderer windows.
friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes.
QLabel *caps_label, *scroll_label, *num_label, *kana_label;
QIcon caps_icon, scroll_icon, num_icon, kana_icon;
QIcon caps_icon_off, scroll_icon_off, num_icon_off, kana_icon_off;
QIcon caps_icon, scroll_icon, num_icon, kana_icon;
QIcon caps_icon_off, scroll_icon_off, num_icon_off, kana_icon_off;
bool isShowMessage = false;
bool isNonPause = false;
bool isShowMessage = false;
bool isNonPause = false;
bool window_blocked = false;
};

View File

@@ -19,7 +19,7 @@
#include <utility>
#include "qt_mediahistorymanager.hpp"
#ifdef Q_OS_WINDOWS
#include <windows.h>
# include <windows.h>
#endif
extern "C" {
@@ -371,7 +371,7 @@ MediaHistoryManager::removeMissingImages(device_index_list_t &device_history)
path_normalize(temp);
}
QString qstr = QString::fromUtf8(temp);
QString qstr = QString::fromUtf8(temp);
QFileInfo new_fi(qstr);
bool file_exists = new_fi.exists();

View File

@@ -28,10 +28,10 @@
extern "C" {
#ifdef Q_OS_WINDOWS
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#include <windowsx.h>
#undef BITMAP
# define BITMAP WINDOWS_BITMAP
# include <windows.h>
# include <windowsx.h>
# undef BITMAP
#endif
#include <inttypes.h>
#include <stdarg.h>
@@ -70,7 +70,7 @@ extern "C" {
std::shared_ptr<MediaMenu> MediaMenu::ptr;
static QSize pixmap_size(16, 16);
static QSize pixmap_size(16, 16);
MediaMenu::MediaMenu(QWidget *parent)
: QObject(parent)
@@ -85,7 +85,7 @@ MediaMenu::refresh(QMenu *parentMenu)
parentMenu->clear();
if (MachineStatus::hasCassette()) {
cassetteMenu = parentMenu->addMenu("");
cassetteMenu = parentMenu->addMenu("");
QIcon img_icon = QIcon(":/settings/qt/icons/cassette_image.ico");
cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this]() { cassetteNewImage(); });
cassetteMenu->addSeparator();
@@ -114,7 +114,7 @@ MediaMenu::refresh(QMenu *parentMenu)
cartridgeMenus.clear();
if (machine_has_cartridge(machine)) {
for (int i = 0; i < 2; i++) {
auto *menu = parentMenu->addMenu("");
auto *menu = parentMenu->addMenu("");
QIcon img_icon = QIcon(":/settings/qt/icons/cartridge_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cartridgeSelectImage(i); });
menu->addSeparator();
@@ -132,9 +132,8 @@ MediaMenu::refresh(QMenu *parentMenu)
floppyMenus.clear();
MachineStatus::iterateFDD([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
QIcon img_icon = fdd_is_525(i) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
QIcon(":/settings/qt/icons/floppy_35_image.ico");
auto *menu = parentMenu->addMenu("");
QIcon img_icon = fdd_is_525(i) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") : QIcon(":/settings/qt/icons/floppy_35_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { floppyNewImage(i); });
menu->addSeparator();
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); });
@@ -186,7 +185,7 @@ MediaMenu::refresh(QMenu *parentMenu)
rdiskMenus.clear();
MachineStatus::iterateRDisk([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
auto *menu = parentMenu->addMenu("");
QIcon img_icon = QIcon(":/settings/qt/icons/rdisk_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { rdiskNewImage(i); });
menu->addSeparator();
@@ -206,7 +205,7 @@ MediaMenu::refresh(QMenu *parentMenu)
moMenus.clear();
MachineStatus::iterateMO([this, parentMenu](int i) {
auto *menu = parentMenu->addMenu("");
auto *menu = parentMenu->addMenu("");
QIcon img_icon = QIcon(":/settings/qt/icons/mo_image.ico");
menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { moNewImage(i); });
menu->addSeparator();
@@ -316,15 +315,15 @@ MediaMenu::cassetteEject()
void
MediaMenu::cassetteUpdateMenu()
{
QString name = cassette_fname;
QFileInfo fi(cassette_fname);
const QString mode = cassette_mode;
auto childs = cassetteMenu->children();
auto *recordMenu = dynamic_cast<QAction *>(childs[cassetteRecordPos]);
auto *playMenu = dynamic_cast<QAction *>(childs[cassettePlayPos]);
auto *rewindMenu = dynamic_cast<QAction *>(childs[cassetteRewindPos]);
auto *fastFwdMenu = dynamic_cast<QAction *>(childs[cassetteFastFwdPos]);
auto *ejectMenu = dynamic_cast<QAction *>(childs[cassetteEjectPos]);
QString name = cassette_fname;
QFileInfo fi(cassette_fname);
const QString mode = cassette_mode;
auto childs = cassetteMenu->children();
auto *recordMenu = dynamic_cast<QAction *>(childs[cassetteRecordPos]);
auto *playMenu = dynamic_cast<QAction *>(childs[cassettePlayPos]);
auto *rewindMenu = dynamic_cast<QAction *>(childs[cassetteRewindPos]);
auto *fastFwdMenu = dynamic_cast<QAction *>(childs[cassetteFastFwdPos]);
auto *ejectMenu = dynamic_cast<QAction *>(childs[cassetteEjectPos]);
recordMenu->setEnabled(!name.isEmpty());
playMenu->setEnabled(!name.isEmpty());
@@ -400,9 +399,9 @@ MediaMenu::cartridgeUpdateMenu(int i)
{
const QString name = cart_fns[i];
QFileInfo fi(cart_fns[i]);
auto *menu = cartridgeMenus[i];
auto childs = menu->children();
auto *ejectMenu = dynamic_cast<QAction *>(childs[cartridgeEjectPos]);
auto *menu = cartridgeMenus[i];
auto childs = menu->children();
auto *ejectMenu = dynamic_cast<QAction *>(childs[cartridgeEjectPos]);
ejectMenu->setEnabled(!name.isEmpty());
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
menu->setTitle(tr("Car&tridge %1: %2").arg(QString::number(i + 1), name.isEmpty() ? tr("(empty)") : name));
@@ -447,7 +446,8 @@ MediaMenu::floppySelectImage(int i, bool wp)
tr("All files") %
util::DlgFilter({ "*" }, true));
if (!filename.isEmpty()) floppyMount(i, filename, wp);
if (!filename.isEmpty())
floppyMount(i, filename, wp);
}
void
@@ -525,7 +525,6 @@ MediaMenu::floppyUpdateMenu(int i)
int type = fdd_get_type(i);
floppyMenus[i]->setTitle(tr("&Floppy %1 (%2): %3").arg(QString::number(i + 1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
floppyMenus[i]->setToolTip(tr("Floppy %1 (%2): %3").arg(QString::number(i + 1), fdd_getname(type), name.isEmpty() ? tr("(empty)") : name));
}
void
@@ -597,7 +596,7 @@ MediaMenu::cdromMount(int i, int dir, const QString &arg)
else {
filename = QFileDialog::getOpenFileName(parentWidget, QString(),
QString(),
tr("CD-ROM images") % util::DlgFilter({ "iso", "cue", "mds" }) % tr("All files") % util::DlgFilter({ "*" }, true));
tr("CD-ROM images") % util::DlgFilter({ "iso", "cue", "mds" }) % tr("All files") % util::DlgFilter({ "*" }, true));
}
if (filename.isEmpty())
@@ -649,7 +648,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
QObjectList children;
QFileInfo fi;
QIcon menu_icon;
const auto fn = mhm.getImageForSlot(index, slot, type);
const auto fn = mhm.getImageForSlot(index, slot, type);
QString menu_item_name;
@@ -691,8 +690,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
menu = floppyMenus[index];
children = menu->children();
imageHistoryUpdatePos = dynamic_cast<QAction *>(children[floppyImageHistoryPos[slot]]);
menu_icon = fdd_is_525(index) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") :
QIcon(":/settings/qt/icons/floppy_35_image.ico");
menu_icon = fdd_is_525(index) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") : QIcon(":/settings/qt/icons/floppy_35_image.ico");
if (fn.left(5) == "wp://")
fi.setFile(fn.right(fn.length() - 5));
else
@@ -720,7 +718,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
#endif
} else {
fi.setFile(fn);
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
menu_item_name = fn.isEmpty() ? tr("Reload previous image") : fn;
}
imageHistoryUpdatePos->setIcon(menu_icon);
@@ -770,7 +768,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type)
imageHistoryUpdatePos->setText(menu_item_name.prepend("&%1 ").arg((slot == 9) ? 0 : (slot + 1)));
else
#endif
imageHistoryUpdatePos->setText(menu_item_name);
imageHistoryUpdatePos->setText(menu_item_name);
if (fn.left(8) == "ioctl://")
imageHistoryUpdatePos->setVisible(true);
@@ -788,9 +786,9 @@ MediaMenu::clearImageHistory()
void
MediaMenu::cdromUpdateMenu(int i)
{
QString name = cdrom[i].image_path;
QString name2;
QIcon menu_icon;
QString name = cdrom[i].image_path;
QString name2;
QIcon menu_icon;
if (!cdromMenus.contains(i))
return;
@@ -810,17 +808,17 @@ MediaMenu::cdromUpdateMenu(int i)
#else
menu_item_name = tr("Host CD/DVD Drive (%1)").arg(name.right(name.length() - 8));
#endif
name2 = menu_item_name;
menu_icon = QIcon(":/settings/qt/icons/cdrom_host.ico");
name2 = menu_item_name;
menu_icon = QIcon(":/settings/qt/icons/cdrom_host.ico");
} else {
QFileInfo fi(cdrom[i].image_path);
menu_item_name = name.isEmpty() ? QString() : fi.fileName();
name2 = name;
if (name.isEmpty())
menu_icon = QIcon(":/settings/qt/icons/cdrom.ico");
menu_icon = QIcon(":/settings/qt/icons/cdrom.ico");
else
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
menu_icon = fi.isDir() ? QIcon(":/settings/qt/icons/cdrom_folder.ico") : QIcon(":/settings/qt/icons/cdrom_image.ico");
}
ejectMenu->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, Eject));
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(menu_item_name));
@@ -846,8 +844,8 @@ MediaMenu::cdromUpdateMenu(int i)
break;
}
menu->setTitle(tr("&CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name2));
menu->setToolTip(tr("CD-ROM %1 (%2): %3").arg(QString::number(i+1), busName, name.isEmpty() ? tr("(empty)") : name2));
menu->setTitle(tr("&CD-ROM %1 (%2): %3").arg(QString::number(i + 1), busName, name.isEmpty() ? tr("(empty)") : name2));
menu->setToolTip(tr("CD-ROM %1 (%2): %3").arg(QString::number(i + 1), busName, name.isEmpty() ? tr("(empty)") : name2));
}
void
@@ -970,7 +968,7 @@ MediaMenu::moUpdateMenu(int i)
auto *menu = moMenus[i];
auto childs = menu->children();
auto *ejectMenu = dynamic_cast<QAction *>(childs[moEjectPos]);
auto *ejectMenu = dynamic_cast<QAction *>(childs[moEjectPos]);
ejectMenu->setEnabled(!name.isEmpty());
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));
@@ -1004,7 +1002,7 @@ MediaMenu::rdiskUpdateMenu(int i)
auto *menu = rdiskMenus[i];
auto childs = menu->children();
auto *ejectMenu = dynamic_cast<QAction *>(childs[rdiskEjectPos]);
auto *ejectMenu = dynamic_cast<QAction *>(childs[rdiskEjectPos]);
ejectMenu->setEnabled(!name.isEmpty());
ejectMenu->setText(name.isEmpty() ? tr("E&ject") : tr("E&ject %1").arg(fi.fileName()));

View File

@@ -69,5 +69,4 @@ plat_midi_in_get_dev_name(int num, char *s)
s[0] = ' ';
s[1] = 0;
}
}

View File

@@ -3,5 +3,5 @@
class QString;
class QAbstractItemModel;
namespace Models {
int AddEntry(QAbstractItemModel *model, const QString &displayRole, int userRole);
int AddEntry(QAbstractItemModel *model, const QString &displayRole, int userRole);
};

View File

@@ -83,7 +83,7 @@ static const disk_size_t disk_sizes[14] = {
{ 0, 8, 0, 0, 0, 963, 32, 2, 0, 0, 0, 0, 0 }, /* LS-120 */
{ 0, 32, 0, 0, 0, 262, 56, 2, 0, 0, 0, 0, 0 } /* LS-240 */
#endif
// clang-format on
// clang-format on
};
static const QStringList rpmModes = {
@@ -198,7 +198,7 @@ NewFloppyDialog::onCreate()
QFileInfo fi(filename);
filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? (usr_path + fi.filePath()) : fi.filePath();
ui->fileField->setFileName(filename);
FileType fileType;
FileType fileType;
QProgressDialog progress("Creating floppy image", QString(), 0, 100, this);
connect(this, &NewFloppyDialog::fileProgress, &progress, &QProgressDialog::setValue);
@@ -646,8 +646,8 @@ NewFloppyDialog::createRDiskSectorImage(const QString &filename, const disk_size
bool
NewFloppyDialog::createMoSectorImage(const QString &filename, int8_t disk_size, FileType type, QProgressDialog &pbar)
{
const mo_type_t *dp = &mo_types[disk_size];
uint64_t total_size = 0;
const mo_type_t *dp = &mo_types[disk_size];
uint64_t total_size = 0;
uint64_t total_size2;
uint32_t total_sectors = 0;
uint32_t sector_bytes = 0;

View File

@@ -21,7 +21,7 @@
#include "qt_renderercommon.hpp"
#include "qt_mainwindow.hpp"
extern MainWindow* main_window;
extern MainWindow *main_window;
#include <QCoreApplication>
#include <QMessageBox>
@@ -58,7 +58,7 @@ extern "C" {
#include <86box/config.h>
#include <86box/qt-glslp-parser.h>
char gl3_shader_file[MAX_USER_SHADERS][512];
char gl3_shader_file[MAX_USER_SHADERS][512];
extern bool cpu_thread_running;
}
@@ -73,76 +73,76 @@ extern int video_vsync;
extern int video_focus_dim;
extern int video_refresh_rate;
const char* vertex_shader_default_tex_src =
const char *vertex_shader_default_tex_src =
#ifdef __APPLE__
"#version 150\n"
"#version 150\n"
#else
"#version 130\n"
"#version 130\n"
#endif
"\n"
"in vec4 VertexCoord;\n"
"in vec2 TexCoord;\n"
"\n"
"out vec2 texCoord;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = VertexCoord;\n"
" texCoord = TexCoord;\n"
"}\n";
"\n"
"in vec4 VertexCoord;\n"
"in vec2 TexCoord;\n"
"\n"
"out vec2 texCoord;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = VertexCoord;\n"
" texCoord = TexCoord;\n"
"}\n";
const char* fragment_shader_default_tex_src =
const char *fragment_shader_default_tex_src =
#ifdef __APPLE__
"#version 150\n"
"#version 150\n"
#else
"#version 130\n"
"#version 130\n"
#endif
"\n"
"in vec2 texCoord;\n"
"uniform sampler2D Texture;\n"
"\n"
"out vec4 color;"
"\n"
"void main()\n"
"{\n"
" color = texture(Texture, texCoord);\n"
" color.a = 1.0;\n"
"}\n";
"\n"
"in vec2 texCoord;\n"
"uniform sampler2D Texture;\n"
"\n"
"out vec4 color;"
"\n"
"void main()\n"
"{\n"
" color = texture(Texture, texCoord);\n"
" color.a = 1.0;\n"
"}\n";
const char* vertex_shader_default_color_src =
const char *vertex_shader_default_color_src =
#ifdef __APPLE__
"#version 150\n"
"#version 150\n"
#else
"#version 130\n"
"#version 130\n"
#endif
"\n"
"in vec4 VertexCoord;\n"
"in vec4 Color;\n"
"\n"
"out vec4 color;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = VertexCoord;\n"
" color = Color;\n"
"}\n";
"\n"
"in vec4 VertexCoord;\n"
"in vec4 Color;\n"
"\n"
"out vec4 color;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = VertexCoord;\n"
" color = Color;\n"
"}\n";
const char* fragment_shader_default_color_src =
const char *fragment_shader_default_color_src =
#ifdef __APPLE__
"#version 150\n"
"#version 150\n"
#else
"#version 130\n"
"#version 130\n"
#endif
"\n"
"in vec4 color;\n"
"\n"
"out vec4 outColor;"
"\n"
"void main()\n"
"{\n"
" outColor = color;\n"
" outColor.a = 1.0;\n"
"}\n";
"\n"
"in vec4 color;\n"
"\n"
"out vec4 outColor;"
"\n"
"void main()\n"
"{\n"
" outColor = color;\n"
" outColor.a = 1.0;\n"
"}\n";
#ifdef ENABLE_OGL3_LOG
int ogl3_do_log = ENABLE_OGL3_LOG;
@@ -212,11 +212,11 @@ int
OpenGLRenderer::compile_shader(GLenum shader_type, const char *prepend, const char *program, int *dst)
{
QRegularExpression versionRegex("^\\s*(#version\\s+\\w+)", QRegularExpression::MultilineOption);
QString progSource = QString(program);
QByteArray finalSource = nullptr;
const char *source[5];
char version[50];
char *version_loc = (char *) strstr(program, "#version");
QString progSource = QString(program);
QByteArray finalSource = nullptr;
const char *source[5];
char version[50];
char *version_loc = (char *) strstr(program, "#version");
if (version_loc) {
snprintf(version, 49, "%s\n", versionRegex.match(progSource).captured(1).toLatin1().data());
progSource.remove(versionRegex);
@@ -230,7 +230,7 @@ OpenGLRenderer::compile_shader(GLenum shader_type, const char *prepend, const ch
ver = 150;
snprintf(version, 49, "#version %d\n", ver);
}
/* Remove parameter lines. */
progSource.remove(QRegularExpression("^\\s*#pragma parameter.*?\\n", QRegularExpression::MultilineOption));
@@ -309,27 +309,27 @@ OpenGLRenderer::find_uniforms(struct glsl_shader *glsl, int num_pass)
u->orig.texture_size = get_uniform(p, "OrigTextureSize");
for (i = 0; i < glsl->num_passes; ++i) {
snprintf(s, sizeof(s) -1, "Pass%dTexture", (i + 1));
snprintf(s, sizeof(s) - 1, "Pass%dTexture", (i + 1));
u->pass[i].texture = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "Pass%dInputSize", (i + 1));
snprintf(s, sizeof(s) - 1, "Pass%dInputSize", (i + 1));
u->pass[i].input_size = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "Pass%dTextureSize", (i + 1));
snprintf(s, sizeof(s) - 1, "Pass%dTextureSize", (i + 1));
u->pass[i].texture_size = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "PassPrev%dTexture", num_pass - i);
snprintf(s, sizeof(s) - 1, "PassPrev%dTexture", num_pass - i);
u->prev_pass[i].texture = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "PassPrev%dInputSize", num_pass - i);
snprintf(s, sizeof(s) - 1, "PassPrev%dInputSize", num_pass - i);
u->prev_pass[i].input_size = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "PassPrev%dTextureSize", num_pass - i);
snprintf(s, sizeof(s) - 1, "PassPrev%dTextureSize", num_pass - i);
u->prev_pass[i].texture_size = get_uniform(p, s);
}
u->prev[0].texture = get_uniform(p, "PrevTexture");
u->prev[0].tex_coord = get_attrib(p, "PrevTexCoord");
for (i = 1; i < MAX_PREV; ++i) {
snprintf(s, sizeof(s) -1, "Prev%dTexture", i);
snprintf(s, sizeof(s) - 1, "Prev%dTexture", i);
u->prev[i].texture = get_uniform(p, s);
snprintf(s, sizeof(s) -1, "Prev%dTexCoord", i);
snprintf(s, sizeof(s) - 1, "Prev%dTexCoord", i);
u->prev[i].tex_coord = get_attrib(p, s);
}
for (i = 0; i < MAX_PREV; ++i)
@@ -653,7 +653,7 @@ OpenGLRenderer::load_glslp(glsl_t *glsl, int num_shader, const char *f)
ogl3_log("Load texture %s...\n", file);
if (!load_texture(file, &tex->texture)) {
//QMessageBox::critical(main_window, tr("GLSL Error"), tr("Could not load texture: %s").arg(file));
// QMessageBox::critical(main_window, tr("GLSL Error"), tr("Could not load texture: %s").arg(file));
main_window->showMessage(MBX_ERROR | MBX_FATAL, tr("GLSL Error"), tr("Could not load texture: %1").arg(file), false);
ogl3_log("Could not load texture %s!\n", file);
failed = 1;
@@ -805,7 +805,7 @@ OpenGLRenderer::read_shader_config()
for (int i = 0; i < active_shader->num_shaders; ++i) {
struct glsl_shader *shader = &active_shader->shaders[i];
char *name = shader->name;
snprintf(s, sizeof(s) -1, "GL3 Shaders - %s", name);
snprintf(s, sizeof(s) - 1, "GL3 Shaders - %s", name);
// shader->shader_refresh_rate = config_get_float(CFG_MACHINE, s, "shader_refresh_rate", -1);
for (int j = 0; j < shader->num_parameters; ++j) {
struct shader_parameter *param = &shader->parameters[j];
@@ -818,7 +818,7 @@ OpenGLRenderer::OpenGLRenderer(QWidget *parent)
: QWindow((QWindow*)nullptr)
, renderTimer(new QTimer(this))
{
connect(renderTimer, &QTimer::timeout, this, [this]() { this->render(); } );
connect(renderTimer, &QTimer::timeout, this, [this]() { this->render(); });
imagebufs[0] = std::unique_ptr<uint8_t>(new uint8_t[2048 * 2048 * 4]);
imagebufs[1] = std::unique_ptr<uint8_t>(new uint8_t[2048 * 2048 * 4]);
@@ -846,8 +846,8 @@ OpenGLRenderer::OpenGLRenderer(QWidget *parent)
source.setRect(0, 0, 100, 100);
isInitialized = false;
isFinalized = false;
context = nullptr;
isFinalized = false;
context = nullptr;
}
OpenGLRenderer::~OpenGLRenderer() { finalize(); }
@@ -897,9 +897,9 @@ OpenGLRenderer::initialize()
glw.glEnable(GL_TEXTURE_2D);
//renderTimer->start(75);
// renderTimer->start(75);
if (video_framerate != -1) {
renderTimer->start(ceilf(1000.f / (float)video_framerate));
renderTimer->start(ceilf(1000.f / (float) video_framerate));
}
scene_texture.data = NULL;
@@ -1105,7 +1105,7 @@ OpenGLRenderer::initialize()
emit initialized();
glw.glClearColor(0, 0, 0, 1);
glw.glClear(GL_COLOR_BUFFER_BIT);
context->swapBuffers(this);
@@ -1227,7 +1227,7 @@ OpenGLRenderer::resizeEvent(QResizeEvent *event)
destination.y(),
destination.width(),
destination.height());
if (video_framerate == -1)
render();
}
@@ -1387,7 +1387,7 @@ OpenGLRenderer::event(QEvent *event)
return res;
}
QDialog*
QDialog *
OpenGLRenderer::getOptions(QWidget *parent)
{
return new OpenGLShaderManagerDialog(parent);
@@ -1426,7 +1426,7 @@ OpenGLRenderer::render()
glw.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, video_filter_method ? GL_LINEAR : GL_NEAREST);
glw.glBindTexture(GL_TEXTURE_2D, 0);
GLfloat orig_output_size[] = { (GLfloat)window_rect.w, (GLfloat)window_rect.h };
GLfloat orig_output_size[] = { (GLfloat) window_rect.w, (GLfloat) window_rect.h };
if (active_shader->srgb)
glw.glEnable(GL_FRAMEBUFFER_SRGB);
@@ -1507,8 +1507,8 @@ OpenGLRenderer::render()
/* loop through each pass */
for (int i = 0; i < shader->num_passes; ++i) {
bool resetFiltering = false;
struct shader_pass *pass = &shader->passes[i];
bool resetFiltering = false;
struct shader_pass *pass = &shader->passes[i];
memcpy(pass->state.input_size, input->state.output_size, 2 * sizeof(GLfloat));
memcpy(pass->state.input_texture_size, input->state.output_texture_size, 2 * sizeof(GLfloat));
@@ -1696,27 +1696,27 @@ OpenGLRenderer::render()
}
if (monitors[r_monitor_index].mon_screenshots) {
int width = destination.width(), height = destination.height();
int width = destination.width(), height = destination.height();
char path[1024];
char fn[256];
memset(fn, 0, sizeof(fn));
memset(path, 0, sizeof(path));
path_append_filename(path, usr_path, SCREENSHOT_PATH);
if (!plat_dir_check(path))
plat_dir_create(path);
path_slash(path);
strcat(path, "Monitor_");
snprintf(&path[strlen(path)], 42, "%d_", r_monitor_index + 1);
plat_tempfile(fn, NULL, (char*)".png");
plat_tempfile(fn, NULL, (char *) ".png");
strcat(path, fn);
unsigned char *rgb = (unsigned char *) calloc(1, (size_t) width * height * 4);
glw.glFinish();
glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb);

View File

@@ -39,8 +39,7 @@
#include "qt_renderercommon.hpp"
extern "C"
{
extern "C" {
#include <86box/qt-glslp-parser.h>
}
@@ -83,10 +82,9 @@ protected:
bool event(QEvent *event) override;
private:
std::array<std::unique_ptr<uint8_t>, 2> imagebufs;
QTimer *renderTimer;
QTimer *renderTimer;
QString glslVersion = "";
@@ -98,7 +96,7 @@ private:
QOpenGLExtraFunctions glw;
struct shader_texture scene_texture;
glsl_t *active_shader;
glsl_t *active_shader;
void *unpackBuffer = nullptr;
@@ -108,20 +106,20 @@ private:
void initializeExtensions();
void initializeBuffers();
void applyOptions();
void create_scene_shader();
void create_texture(struct shader_texture *tex);
void create_fbo(struct shader_fbo *fbo);
void recreate_fbo(struct shader_fbo *fbo, int width, int height);
void setup_fbo(struct shader *shader, struct shader_fbo *fbo);
bool notReady() const { return !isInitialized || isFinalized; }
glsl_t* load_glslp(glsl_t *glsl, int num_shader, const char *f);
glsl_t* load_shaders(int num, char shaders[MAX_USER_SHADERS][512]);
int compile_shader(GLenum shader_type, const char *prepend, const char *program, int *dst);
int create_default_shader_tex(struct shader_pass *pass);
int create_default_shader_color(struct shader_pass *pass);
int create_program(struct shader_program *program);
bool notReady() const { return !isInitialized || isFinalized; }
glsl_t *load_glslp(glsl_t *glsl, int num_shader, const char *f);
glsl_t *load_shaders(int num, char shaders[MAX_USER_SHADERS][512]);
int compile_shader(GLenum shader_type, const char *prepend, const char *program, int *dst);
int create_default_shader_tex(struct shader_pass *pass);
int create_default_shader_color(struct shader_pass *pass);
int create_program(struct shader_program *program);
GLuint get_uniform(GLuint program, const char *name);
GLuint get_attrib(GLuint program, const char *name);

View File

@@ -3,16 +3,15 @@
#include "qt_mainwindow.hpp"
extern MainWindow* main_window;
extern MainWindow *main_window;
extern "C"
{
extern "C" {
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/config.h>
}
OpenGLShaderConfig::OpenGLShaderConfig(QWidget *parent, glslp_t* shader)
OpenGLShaderConfig::OpenGLShaderConfig(QWidget *parent, glslp_t *shader)
: QDialog(parent)
, ui(new Ui::OpenGLShaderConfig)
{
@@ -32,7 +31,7 @@ OpenGLShaderConfig::OpenGLShaderConfig(QWidget *parent, glslp_t* shader)
spinBox->setRange(currentShader->parameters[i].min, currentShader->parameters[i].max);
spinBox->setValue(currentShader->parameters[i].value);
spinBox->setSingleStep(currentShader->parameters[i].step);
QFormLayout* layout = (QFormLayout*)ui->scrollAreaWidgetContents->layout();
QFormLayout *layout = (QFormLayout *) ui->scrollAreaWidgetContents->layout();
layout->addRow(currentShader->parameters[i].description, spinBox);
}
}
@@ -42,11 +41,12 @@ OpenGLShaderConfig::~OpenGLShaderConfig()
delete ui;
}
void OpenGLShaderConfig::on_buttonBox_clicked(QAbstractButton *button)
void
OpenGLShaderConfig::on_buttonBox_clicked(QAbstractButton *button)
{
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole) {
for (int i = 0; i < currentShader->num_parameters; i++) {
QDoubleSpinBox* box = this->findChild<QDoubleSpinBox*>(QString(currentShader->parameters[i].id));
QDoubleSpinBox *box = this->findChild<QDoubleSpinBox *>(QString(currentShader->parameters[i].id));
if (box) {
box->setValue(currentShader->parameters[i].default_value);
}
@@ -54,9 +54,9 @@ void OpenGLShaderConfig::on_buttonBox_clicked(QAbstractButton *button)
} else if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) {
startblit();
for (int i = 0; i < currentShader->num_parameters; i++) {
QDoubleSpinBox* box = this->findChild<QDoubleSpinBox*>(QString(currentShader->parameters[i].id));
QDoubleSpinBox *box = this->findChild<QDoubleSpinBox *>(QString(currentShader->parameters[i].id));
if (box) {
float val = (float)box->value();
float val = (float) box->value();
currentShader->parameters[i].value = val;
}
}
@@ -67,14 +67,14 @@ void OpenGLShaderConfig::on_buttonBox_clicked(QAbstractButton *button)
}
}
void OpenGLShaderConfig::on_OpenGLShaderConfig_accepted()
void
OpenGLShaderConfig::on_OpenGLShaderConfig_accepted()
{
startblit();
for (int i = 0; i < currentShader->num_parameters; i++) {
QDoubleSpinBox* box = (QDoubleSpinBox*)this->findChild<QDoubleSpinBox*>(QString(currentShader->parameters[i].id));
QDoubleSpinBox *box = (QDoubleSpinBox *) this->findChild<QDoubleSpinBox *>(QString(currentShader->parameters[i].id));
if (box) {
float val = (float)box->value();
float val = (float) box->value();
currentShader->parameters[i].value = val;
}
}

View File

@@ -9,8 +9,7 @@
#include <map>
#include <string>
extern "C"
{
extern "C" {
#include <86box/qt-glslp-parser.h>
}
@@ -22,7 +21,7 @@ class OpenGLShaderConfig : public QDialog {
Q_OBJECT
public:
explicit OpenGLShaderConfig(QWidget *parent = nullptr, glslp_t* shader = nullptr);
explicit OpenGLShaderConfig(QWidget *parent = nullptr, glslp_t *shader = nullptr);
~OpenGLShaderConfig();
private slots:
@@ -32,7 +31,7 @@ private slots:
private:
Ui::OpenGLShaderConfig *ui;
glslp_t* currentShader;
glslp_t *currentShader;
std::map<std::string, double> defaultValues;
};

View File

@@ -3,7 +3,7 @@
#include "qt_mainwindow.hpp"
#include "qt_util.hpp"
extern MainWindow* main_window;
extern MainWindow *main_window;
#include "qt_openglshaderconfig.hpp"
@@ -41,14 +41,14 @@ OpenGLShaderManagerDialog::OpenGLShaderManagerDialog(QWidget *parent)
for (int i = 0; i < MAX_USER_SHADERS; i++) {
if (gl3_shader_file[i][0] != 0) {
char* filename = path_get_filename(gl3_shader_file[i]);
char *filename = path_get_filename(gl3_shader_file[i]);
if (filename[0] != 0) {
glslp_t* shaderfile = glslp_parse(gl3_shader_file[i]);
glslp_t *shaderfile = glslp_parse(gl3_shader_file[i]);
if (shaderfile) {
QListWidgetItem* item = new QListWidgetItem(ui->shaderListWidget);
QListWidgetItem *item = new QListWidgetItem(ui->shaderListWidget);
item->setText(filename);
item->setData(Qt::UserRole + 1, QString(gl3_shader_file[i]));
item->setData(Qt::UserRole + 2, (qulonglong)(uintptr_t)shaderfile);
item->setData(Qt::UserRole + 2, (qulonglong) (uintptr_t) shaderfile);
}
}
}
@@ -57,7 +57,7 @@ OpenGLShaderManagerDialog::OpenGLShaderManagerDialog(QWidget *parent)
ui->shaderListWidget->setCurrentRow(ui->shaderListWidget->count() - 1);
auto current = ui->shaderListWidget->currentItem();
if (current) {
glslp_t* shader = (glslp_t*)current->data(Qt::UserRole + 2).toULongLong();
glslp_t *shader = (glslp_t *) current->data(Qt::UserRole + 2).toULongLong();
if (shader->num_parameters > 0)
ui->buttonConfigure->setEnabled(true);
else
@@ -78,13 +78,14 @@ OpenGLShaderManagerDialog::~OpenGLShaderManagerDialog()
{
for (int i = 0; i < ui->shaderListWidget->count(); i++) {
if (ui->shaderListWidget->item(i) && ui->shaderListWidget->item(i)->data(Qt::UserRole + 2).toULongLong()) {
glslp_free((glslp_t*)ui->shaderListWidget->item(i)->data(Qt::UserRole + 2).toULongLong());
glslp_free((glslp_t *) ui->shaderListWidget->item(i)->data(Qt::UserRole + 2).toULongLong());
}
}
delete ui;
}
void OpenGLShaderManagerDialog::on_buttonBox_clicked(QAbstractButton *button)
void
OpenGLShaderManagerDialog::on_buttonBox_clicked(QAbstractButton *button)
{
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
accept();
@@ -96,20 +97,20 @@ void OpenGLShaderManagerDialog::on_buttonBox_clicked(QAbstractButton *button)
}
}
void OpenGLShaderManagerDialog::on_buttonMoveUp_clicked()
void
OpenGLShaderManagerDialog::on_buttonMoveUp_clicked()
{
if (ui->shaderListWidget->currentRow() == 0)
return;
int row = ui->shaderListWidget->currentRow();
int row = ui->shaderListWidget->currentRow();
auto item = ui->shaderListWidget->takeItem(row);
ui->shaderListWidget->insertItem(row - 1, item);
ui->shaderListWidget->setCurrentItem(item);
}
void OpenGLShaderManagerDialog::on_shaderListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
void
OpenGLShaderManagerDialog::on_shaderListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
{
if (current == nullptr) {
ui->buttonRemove->setDisabled(true);
@@ -121,7 +122,7 @@ void OpenGLShaderManagerDialog::on_shaderListWidget_currentItemChanged(QListWidg
ui->buttonRemove->setDisabled(false);
ui->buttonConfigure->setDisabled(true);
if (current) {
glslp_t* shader = (glslp_t*)current->data(Qt::UserRole + 2).toULongLong();
glslp_t *shader = (glslp_t *) current->data(Qt::UserRole + 2).toULongLong();
if (shader->num_parameters > 0)
ui->buttonConfigure->setEnabled(true);
}
@@ -130,8 +131,8 @@ void OpenGLShaderManagerDialog::on_shaderListWidget_currentItemChanged(QListWidg
ui->buttonMoveDown->setDisabled(ui->shaderListWidget->currentRow() == (ui->shaderListWidget->count() - 1));
}
void OpenGLShaderManagerDialog::on_shaderListWidget_currentRowChanged(int currentRow)
void
OpenGLShaderManagerDialog::on_shaderListWidget_currentRowChanged(int currentRow)
{
auto current = ui->shaderListWidget->currentItem();
if (current == nullptr) {
@@ -144,7 +145,7 @@ void OpenGLShaderManagerDialog::on_shaderListWidget_currentRowChanged(int curren
ui->buttonRemove->setDisabled(false);
ui->buttonConfigure->setDisabled(true);
if (current) {
glslp_t* shader = (glslp_t*)current->data(Qt::UserRole + 2).toULongLong();
glslp_t *shader = (glslp_t *) current->data(Qt::UserRole + 2).toULongLong();
if (shader->num_parameters > 0)
ui->buttonConfigure->setEnabled(true);
}
@@ -153,32 +154,32 @@ void OpenGLShaderManagerDialog::on_shaderListWidget_currentRowChanged(int curren
ui->buttonMoveDown->setDisabled(ui->shaderListWidget->currentRow() == (ui->shaderListWidget->count() - 1));
}
void OpenGLShaderManagerDialog::on_buttonMoveDown_clicked()
void
OpenGLShaderManagerDialog::on_buttonMoveDown_clicked()
{
if (ui->shaderListWidget->currentRow() == (ui->shaderListWidget->count() - 1))
return;
int row = ui->shaderListWidget->currentRow();
int row = ui->shaderListWidget->currentRow();
auto item = ui->shaderListWidget->takeItem(row);
ui->shaderListWidget->insertItem(row + 1, item);
ui->shaderListWidget->setCurrentItem(item);
}
void OpenGLShaderManagerDialog::on_buttonAdd_clicked()
void
OpenGLShaderManagerDialog::on_buttonAdd_clicked()
{
auto res = QFileDialog::getOpenFileName(this, QString(), QString(),
tr("GLSL shaders") % util::DlgFilter({ "glslp", "glsl" }) % tr("All files") % util::DlgFilter({ "*" }, true));
if (!res.isEmpty()) {
auto glslp_file = res.toUtf8();
glslp_t* shaderfile = glslp_parse(glslp_file.data());
auto glslp_file = res.toUtf8();
glslp_t *shaderfile = glslp_parse(glslp_file.data());
if (shaderfile) {
auto filename = path_get_filename(glslp_file.data());
QListWidgetItem* item = new QListWidgetItem(ui->shaderListWidget);
auto filename = path_get_filename(glslp_file.data());
QListWidgetItem *item = new QListWidgetItem(ui->shaderListWidget);
item->setText(filename);
item->setData(Qt::UserRole + 1, res);
item->setData(Qt::UserRole + 2, (qulonglong)(uintptr_t)shaderfile);
item->setData(Qt::UserRole + 2, (qulonglong) (uintptr_t) shaderfile);
if (ui->shaderListWidget->count()) {
ui->shaderListWidget->setCurrentRow(ui->shaderListWidget->count() - 1);
ui->buttonAdd->setDisabled(ui->shaderListWidget->count() >= MAX_USER_SHADERS);
@@ -189,14 +190,14 @@ void OpenGLShaderManagerDialog::on_buttonAdd_clicked()
}
}
void OpenGLShaderManagerDialog::on_buttonRemove_clicked()
void
OpenGLShaderManagerDialog::on_buttonRemove_clicked()
{
if (ui->shaderListWidget->currentItem()) {
auto item = ui->shaderListWidget->takeItem(ui->shaderListWidget->currentRow());
if (item->data(Qt::UserRole + 2).toULongLong()) {
glslp_free((glslp_t*)item->data(Qt::UserRole + 2).toULongLong());
glslp_free((glslp_t *) item->data(Qt::UserRole + 2).toULongLong());
}
delete item;
@@ -205,7 +206,8 @@ void OpenGLShaderManagerDialog::on_buttonRemove_clicked()
ui->buttonAdd->setDisabled(ui->shaderListWidget->count() >= MAX_USER_SHADERS);
}
void OpenGLShaderManagerDialog::on_OpenGLShaderManagerDialog_accepted()
void
OpenGLShaderManagerDialog::on_OpenGLShaderManagerDialog_accepted()
{
memset(gl3_shader_file, 0, sizeof(gl3_shader_file));
for (int i = 0; i < ui->shaderListWidget->count(); i++) {
@@ -222,43 +224,43 @@ void OpenGLShaderManagerDialog::on_OpenGLShaderManagerDialog_accepted()
endblit();
}
void OpenGLShaderManagerDialog::on_buttonConfigure_clicked()
void
OpenGLShaderManagerDialog::on_buttonConfigure_clicked()
{
auto item = ui->shaderListWidget->currentItem();
if (item) {
glslp_t* shader = (glslp_t*)item->data(Qt::UserRole + 2).toULongLong();
glslp_t *shader = (glslp_t *) item->data(Qt::UserRole + 2).toULongLong();
auto configDialog = new OpenGLShaderConfig(this, shader);
configDialog->exec();
}
}
void OpenGLShaderManagerDialog::on_radioButtonVideoSync_clicked()
void
OpenGLShaderManagerDialog::on_radioButtonVideoSync_clicked()
{
ui->targetFrameRate->setDisabled(true);
}
void OpenGLShaderManagerDialog::on_radioButtonTargetFramerate_clicked()
void
OpenGLShaderManagerDialog::on_radioButtonTargetFramerate_clicked()
{
ui->targetFrameRate->setDisabled(false);
}
void OpenGLShaderManagerDialog::on_horizontalSliderFramerate_sliderMoved(int position)
void
OpenGLShaderManagerDialog::on_horizontalSliderFramerate_sliderMoved(int position)
{
(void)position;
(void) position;
if (ui->horizontalSliderFramerate->value() != ui->targetFrameRate->value())
ui->targetFrameRate->setValue(ui->horizontalSliderFramerate->value());
}
void OpenGLShaderManagerDialog::on_targetFrameRate_valueChanged(int arg1)
void
OpenGLShaderManagerDialog::on_targetFrameRate_valueChanged(int arg1)
{
(void)arg1;
(void) arg1;
if (ui->horizontalSliderFramerate->value() != ui->targetFrameRate->value())
ui->horizontalSliderFramerate->setValue(ui->targetFrameRate->value());

View File

@@ -17,7 +17,7 @@
* Copyright 2021-2022 Teemu Korhonen
*/
#ifdef __HAIKU__
#include <OS.h>
# include <OS.h>
#endif
#include <cstdio>
@@ -125,7 +125,7 @@ extern "C" {
#include <86box/config.h>
#include <86box/ui.h>
#ifdef DISCORD
# include <86box/discord.h>
# include <86box/discord.h>
#endif
#include "../cpu/cpu.h"
@@ -186,9 +186,9 @@ plat_get_exe_name(char *s, int size)
if (acp_utf8)
GetModuleFileNameA(NULL, s, size);
else {
temp = (wchar_t*)calloc(size, sizeof(wchar_t));
temp = (wchar_t *) calloc(size, sizeof(wchar_t));
GetModuleFileNameW(NULL, temp, size);
c16stombs(s, (uint16_t*)temp, size);
c16stombs(s, (uint16_t *) temp, size);
free(temp);
}
#else
@@ -254,7 +254,7 @@ plat_file_check(const char *path)
{
#ifdef _WIN32
auto data = QString::fromUtf8(path).toStdWString();
auto res = GetFileAttributesW(data.c_str());
auto res = GetFileAttributesW(data.c_str());
return (res != INVALID_FILE_ATTRIBUTES) && !(res & FILE_ATTRIBUTE_DIRECTORY);
#else
struct stat stats;
@@ -269,12 +269,12 @@ plat_getcwd(char *bufp, int max)
{
#ifdef __APPLE__
/* Working directory for .app bundles is undefined. */
#ifdef USE_EXE_PATH
# ifdef USE_EXE_PATH
strncpy(bufp, exe_path, max);
#else
# else
CharPointer(bufp, max) = QDir::homePath().toUtf8();
path_append_filename(bufp, bufp, "Library/86Box");
#endif
# endif
#else
CharPointer(bufp, max) = QDir::currentPath().toUtf8();
#endif
@@ -320,7 +320,7 @@ path_get_filename(char *s)
return s;
#else
auto idx = QByteArray::fromRawData(s, strlen(s)).lastIndexOf(QDir::separator().toLatin1());
auto idx = QByteArray::fromRawData(s, strlen(s)).lastIndexOf(QDir::separator().toLatin1());
if (idx >= 0) {
return s + idx + 1;
}
@@ -390,7 +390,7 @@ path_append_filename(char *dest, const char *s1, const char *s2)
if (len > 0 && dest[len - 1] != '/' && dest[len - 1] != '\\') {
if (len + 1 < dest_size) {
dest[len++] = '/';
dest[len] = '\0';
dest[len] = '\0';
}
}
@@ -453,58 +453,58 @@ extern bool cpu_thread_running;
#ifdef Q_OS_WINDOWS
/* SetThreadDescription was added in 14393 and SetProcessInformation in 8. Revisit if we ever start requiring 10. */
static void *kernel32_handle = NULL;
static HRESULT(WINAPI *pSetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription) = NULL;
static void *kernel32_handle = NULL;
static HRESULT(WINAPI *pSetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription) = NULL;
static HRESULT(WINAPI *pSetProcessInformation)(HANDLE hProcess, PROCESS_INFORMATION_CLASS ProcessInformationClass, LPVOID ProcessInformation, DWORD ProcessInformationSize) = NULL;
static dllimp_t kernel32_imports[] = {
// clang-format off
static dllimp_t kernel32_imports[] = {
// clang-format off
{ "SetThreadDescription", &pSetThreadDescription },
{ "SetProcessInformation", &pSetProcessInformation },
{ NULL, NULL }
// clang-format on
// clang-format on
};
static void
enter_pause(void)
{
PROCESS_POWER_THROTTLING_STATE state{};
state.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
PROCESS_POWER_THROTTLING_STATE state {};
state.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
state.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
state.StateMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
state.StateMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
if (!kernel32_handle) {
kernel32_handle = dynld_module("kernel32.dll", kernel32_imports);
if (!kernel32_handle) {
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
pSetProcessInformation = NULL;
}
}
if (pSetProcessInformation) {
pSetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, (LPVOID)&state, sizeof(state));
pSetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, (LPVOID) &state, sizeof(state));
}
}
void
exit_pause(void)
{
PROCESS_POWER_THROTTLING_STATE state{};
state.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
PROCESS_POWER_THROTTLING_STATE state {};
state.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;
state.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED | PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION;
state.StateMask = 0;
state.StateMask = 0;
if (!kernel32_handle) {
kernel32_handle = dynld_module("kernel32.dll", kernel32_imports);
if (!kernel32_handle) {
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
pSetProcessInformation = NULL;
}
}
if (pSetProcessInformation) {
pSetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, (LPVOID)&state, sizeof(state));
pSetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, (LPVOID) &state, sizeof(state));
}
}
#endif
@@ -695,13 +695,13 @@ c16stombs(char dst[], const uint16_t src[], int len)
#endif
#ifdef _WIN32
# define LIB_NAME_GS "gsdll64.dll"
# define LIB_NAME_GPCL "gpcl6dll64.dll"
# define LIB_NAME_PCAP "Npcap"
# define LIB_NAME_GS "gsdll64.dll"
# define LIB_NAME_GPCL "gpcl6dll64.dll"
# define LIB_NAME_PCAP "Npcap"
#else
# define LIB_NAME_GS "libgs"
# define LIB_NAME_GPCL "libgpcl6"
# define LIB_NAME_PCAP "libpcap"
# define LIB_NAME_GS "libgs"
# define LIB_NAME_GPCL "libgpcl6"
# define LIB_NAME_PCAP "libpcap"
#endif
QMap<int, std::wstring> ProgSettings::translatedstrings;
@@ -837,15 +837,16 @@ plat_init_rom_paths(void)
}
void
plat_get_cpu_string(char *outbuf, uint8_t len) {
plat_get_cpu_string(char *outbuf, uint8_t len)
{
auto cpu_string = QString("Unknown");
/* Write the default string now in case we have to exit early from an error */
qstrncpy(outbuf, cpu_string.toUtf8().constData(), len);
#if defined(Q_OS_MACOS)
auto *process = new QProcess(nullptr);
auto *process = new QProcess(nullptr);
QStringList arguments;
QString program = "/usr/sbin/sysctl";
QString program = "/usr/sbin/sysctl";
arguments << "machdep.cpu.brand_string";
process->start(program, arguments);
if (!process->waitForStarted()) {
@@ -854,9 +855,9 @@ plat_get_cpu_string(char *outbuf, uint8_t len) {
if (!process->waitForFinished()) {
return;
}
QByteArray result = process->readAll();
auto command_result = QString(result).split(": ").last().trimmed();
if(!command_result.isEmpty()) {
QByteArray result = process->readAll();
auto command_result = QString(result).split(": ").last().trimmed();
if (!command_result.isEmpty()) {
cpu_string = command_result;
}
#elif defined(Q_OS_WINDOWS)
@@ -868,38 +869,36 @@ plat_get_cpu_string(char *outbuf, uint8_t len) {
bufSize = 32768;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, 1, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueExA(hKey, valueName, NULL, NULL, buf, &bufSize) == ERROR_SUCCESS) {
cpu_string = reinterpret_cast<const char*>(buf);
cpu_string = reinterpret_cast<const char *>(buf);
}
RegCloseKey(hKey);
}
#elif defined(Q_OS_LINUX)
auto cpuinfo = QString("/proc/cpuinfo");
auto cpuinfo = QString("/proc/cpuinfo");
auto cpuinfo_fi = QFileInfo(cpuinfo);
if(!cpuinfo_fi.isReadable()) {
if (!cpuinfo_fi.isReadable()) {
return;
}
QFile file(cpuinfo);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream textStream(&file);
while(true) {
while (true) {
QString line = textStream.readLine();
if (line.isNull()) {
break;
}
if(QRegularExpression("model name.*:").match(line).hasMatch()) {
if (QRegularExpression("model name.*:").match(line).hasMatch()) {
auto list = line.split(": ");
if(!list.last().isEmpty()) {
if (!list.last().isEmpty()) {
cpu_string = list.last();
break;
}
}
}
}
#endif
qstrncpy(outbuf, cpu_string.toUtf8().constData(), len);
}
void
@@ -909,14 +908,14 @@ plat_set_thread_name(void *thread, const char *name)
if (!kernel32_handle) {
kernel32_handle = dynld_module("kernel32.dll", kernel32_imports);
if (!kernel32_handle) {
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
kernel32_handle = kernel32_imports; /* store dummy pointer to avoid trying again */
pSetThreadDescription = NULL;
pSetProcessInformation = NULL;
}
}
if (pSetThreadDescription) {
size_t len = strlen(name) + 1;
size_t len = strlen(name) + 1;
wchar_t wname[2048];
mbstowcs(wname, name, (len >= 1024) ? 1024 : len);
pSetThreadDescription(thread ? (HANDLE) thread : GetCurrentThread(), wname);
@@ -935,7 +934,7 @@ plat_set_thread_name(void *thread, const char *name)
# if defined(Q_OS_DARWIN)
pthread_setname_np(truncated);
# elif defined(Q_OS_NETBSD)
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, (void*)"%s");
pthread_setname_np(thread ? *((pthread_t *) thread) : pthread_self(), truncated, (void *) "%s");
# elif defined(__HAIKU__)
rename_thread(find_thread(NULL), truncated);
# elif defined(Q_OS_OPENBSD)

View File

@@ -40,7 +40,7 @@ extern "C" {
#include <86box/video.h>
}
extern MainWindow *main_window;
extern MainWindow *main_window;
ProgSettings::CustomTranslator *ProgSettings::translator = nullptr;
QTranslator *ProgSettings::qtTranslator = nullptr;

View File

@@ -17,10 +17,10 @@ public:
#ifdef Q_OS_WINDOWS
static QString getFontName(int langId);
#endif
static int languageCodeToId(QString langCode);
static QString languageIdToCode(int id);
static void loadTranslators(QObject *parent = nullptr);
static void reloadStrings();
static int languageCodeToId(QString langCode);
static QString languageIdToCode(int id);
static void loadTranslators(QObject *parent = nullptr);
static void reloadStrings();
class CustomTranslator : public QTranslator {
public:
CustomTranslator(QObject *parent = nullptr)
@@ -33,10 +33,10 @@ public:
return QTranslator::translate("", sourceText, disambiguation, n);
}
};
static CustomTranslator *translator;
static QTranslator *qtTranslator;
static QVector<QPair<QString, QString>> languages;
static QMap<int, std::wstring> translatedstrings;
static CustomTranslator *translator;
static QTranslator *qtTranslator;
static QVector<QPair<QString, QString>> languages;
static QMap<int, std::wstring> translatedstrings;
protected slots:
void accept() override;
@@ -49,7 +49,7 @@ private slots:
private:
Ui::ProgSettings *ui;
static bool loadQtTranslations(const QString name);
static bool loadQtTranslations(const QString name);
friend class MainWindow;
double mouseSensitivity;

Some files were not shown because too many files have changed in this diff Show More