diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index 0b9e85eab..75d0bf73c 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -1084,13 +1084,10 @@ write_output(atkbd_t *dev, uint8_t val) flushmmucache(); } - /* Do this here to avoid an infinite reset loop. */ - dev->output_port = val; - /* 0 holds the CPU in the RESET state, 1 releases it. To simplify this, we just do everything on release. */ - if ((val & 0x01) && !(old & 0x01)) { - if (val & 0x01) { + if ((dev->output_port ^ val) & 0x01) { /*Reset*/ + if (! (val & 0x01)) { /* Pin 0 selected. */ /* Pin 0 selected. */ kbd_log("write_output(): Pulse reset!\n"); softresetx86(); /*Pulse reset!*/ @@ -1098,6 +1095,9 @@ write_output(atkbd_t *dev, uint8_t val) flushmmucache(); } } + + /* Do this here to avoid an infinite reset loop. */ + dev->output_port = val; } diff --git a/src/include/86box/language.h b/src/include/86box/language.h index a1f3ce3aa..467a5704c 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -125,6 +125,8 @@ #define IDS_2149 2149 // "Cassette images (*.PCM;*.RAW;*..." #define IDS_2150 2150 // "Cartridge %i: %ls" #define IDS_2151 2151 // "Cartridge images (*.JRC)\0*.JRC\0..." +#define IDS_2152 2152 // "Error initializing renderer" +#define IDS_2153 2153 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -233,7 +235,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 104 +#define STR_NUM_2048 106 #define STR_NUM_3072 11 #define STR_NUM_4096 40 #define STR_NUM_4352 6 diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index ed44b35a7..e6e659176 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -82,9 +82,8 @@ static struct uint8_t memory_bank[8]; uint8_t io_id; - uint16_t planar_id; - - mem_mapping_t shadow_mapping; + uint16_t planar_id; + mem_mapping_t split_mapping; mem_mapping_t expansion_mapping; mem_mapping_t cache_mapping; @@ -203,7 +202,7 @@ static uint32_t ps2_read_cache_raml(uint32_t addr, void *priv) } static void ps2_write_cache_ram(uint32_t addr, uint8_t val, void *priv) { - ps2_mca_log("ps2_write_cache_ram: addr=%08x val=%02x %04x:%04x %i\n", addr, val, CS,cpu_state.pc, ins); + ps2_mca_log("ps2_write_cache_ram: addr=%08x val=%02x %04x:%04x %i\n", addr, val, CS,cpu_state.pc); ps2_cache[addr] = val; } @@ -212,37 +211,6 @@ void ps2_cache_clean(void) memset(ps2_cache_valid, 0, sizeof(ps2_cache_valid)); } -static uint8_t ps2_read_shadow_ram(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_ram(addr, priv); -} -static uint16_t ps2_read_shadow_ramw(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_ramw(addr, priv); -} -static uint32_t ps2_read_shadow_raml(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_raml(addr, priv); -} -static void ps2_write_shadow_ram(uint32_t addr, uint8_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_ram(addr, val, priv); -} -static void ps2_write_shadow_ramw(uint32_t addr, uint16_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_ramw(addr, val, priv); -} -static void ps2_write_shadow_raml(uint32_t addr, uint32_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_raml(addr, val, priv); -} - static uint8_t ps2_read_split_ram(uint32_t addr, void *priv) { addr = (addr % (ps2.split_size << 10)) + ps2.split_phys; @@ -430,6 +398,85 @@ static void model_50_write(uint16_t port, uint8_t val) } } + +static void model_55sx_mem_recalc(void) +{ + int i, j, state, enabled_mem = 0; + int base = 0, remap_size = (ps2.option[3] & 0x10) ? 384 : 256; + int bit_mask = 0x00, max_rows = 4; + int bank_to_rows[16] = { 4, 2, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 2, 1, 0 }; + + ps2_mca_log("%02X %02X\n", ps2.option[1], ps2.option[3]); + + mem_remap_top(remap_size); + mem_set_mem_state(0x00000000, (mem_size + 384) * 1024, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); + mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_DISABLED); + + for (i = 0; i < 2; i++) + { + max_rows = bank_to_rows[(ps2.memory_bank[i] >> 4) & 0x0f]; + + if (max_rows == 0) + continue; + + for (j = 0; j < max_rows; j++) + { + if (ps2.memory_bank[i] & (1 << j)) { + ps2_mca_log("Set memory at %06X-%06X to internal\n", (base * 1024), (base * 1024) + (((base > 0) ? 1024 : 640) * 1024) - 1); + mem_set_mem_state(base * 1024, ((base > 0) ? 1024 : 640) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + enabled_mem += 1024; + bit_mask |= (1 << (j + (i << 2))); + } + base += 1024; + } + } + + ps2_mca_log("Enabled memory: %i kB (%02X)\n", enabled_mem, bit_mask); + + if (ps2.option[3] & 0x10) + { + /* Enable ROM. */ + ps2_mca_log("Enable ROM\n"); + state = MEM_READ_EXTANY; + } + else + { + /* Disable ROM. */ + if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20) && (bit_mask & 0x01)) + { + /* Disable RAM between 640 kB and 1 MB. */ + ps2_mca_log("Disable ROM, enable RAM\n"); + state = MEM_READ_INTERNAL; + } + else + { + ps2_mca_log("Disable ROM, disable RAM\n"); + state = MEM_READ_DISABLED; + } + } + + /* Write always disabled. */ + state |= MEM_WRITE_DISABLED; + + mem_set_mem_state(0xe0000, 0x20000, state); + + /* if (!(ps2.option[3] & 0x08)) + { + ps2_mca_log("Memory not yet configured\n"); + return; + } */ + + ps2_mca_log("Enable shadow mapping at %06X-%06X\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1); + + if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20) && (bit_mask & 0x01)) { + ps2_mca_log("Set memory at %06X-%06X to internal\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1); + mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + } + + flushmmucache_nopc(); +} + + static void model_55sx_write(uint16_t port, uint8_t val) { switch (port) @@ -467,38 +514,20 @@ static void model_55sx_write(uint16_t port, uint8_t val) ps2.option[0] = val; break; case 0x103: + ps2_mca_log("Write POS1: %02X\n", val); ps2.option[1] = val; - break; + model_55sx_mem_recalc(); + break; case 0x104: ps2.memory_bank[ps2.option[3] & 7] &= ~0xf; ps2.memory_bank[ps2.option[3] & 7] |= (val & 0xf); - ps2_mca_log("Write memory bank %i %02x\n", ps2.option[3] & 7, val); + ps2_mca_log("Write memory bank %i: %02X\n", ps2.option[3] & 7, val); + model_55sx_mem_recalc(); break; case 0x105: - ps2_mca_log("Write POS3 %02x\n", val); + ps2_mca_log("Write POS3: %02X\n", val); ps2.option[3] = val; - shadowbios = !(val & 0x10); - shadowbios_write = val & 0x10; - - if (shadowbios) - { - mem_set_mem_state(0xe0000, 0x20000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); - mem_set_mem_state((mem_size+256) * 1024, 128 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); - mem_mapping_disable(&ps2.shadow_mapping); - } - else - { - mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTANY | MEM_WRITE_INTERNAL); - mem_set_mem_state((mem_size+256) * 1024, 128 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - mem_mapping_enable(&ps2.shadow_mapping); - } - - if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20)) - mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - else - mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); - - flushmmucache_nopc(); + model_55sx_mem_recalc(); break; case 0x106: ps2.subaddr_lo = val; @@ -914,22 +943,9 @@ static void ps2_mca_board_model_50_init() static void ps2_mca_board_model_55sx_init() { ps2_mca_board_common_init(); - - mem_mapping_add(&ps2.shadow_mapping, - (mem_size+256) * 1024, - 128*1024, - ps2_read_shadow_ram, - ps2_read_shadow_ramw, - ps2_read_shadow_raml, - ps2_write_shadow_ram, - ps2_write_shadow_ramw, - ps2_write_shadow_raml, - &ram[0xe0000], - MEM_MAPPING_INTERNAL, - NULL); - - mem_remap_top(256); + ps2.option[1] = 0x00; + ps2.option[2] = 0x00; ps2.option[3] = 0x10; memset(ps2.memory_bank, 0xf0, 8); @@ -975,6 +991,8 @@ static void ps2_mca_board_model_55sx_init() if (gfxcard == VID_INTERNAL) device_add(&ps1vga_mca_device); + + model_55sx_mem_recalc(); } static void mem_encoding_update() diff --git a/src/pit.c b/src/pit.c index 582c748a7..fe256f53d 100644 --- a/src/pit.c +++ b/src/pit.c @@ -154,6 +154,8 @@ ctr_tick(ctr_t *ctr) /* This is true for all modes */ ctr_load_count(ctr); ctr->state = 2; + if ((ctr->m & 0x07) == 0x01) + ctr_set_out(ctr, 0); return; } diff --git a/src/video/vid_ega.c b/src/video/vid_ega.c index 1e66743ec..43f157f29 100644 --- a/src/video/vid_ega.c +++ b/src/video/vid_ega.c @@ -69,6 +69,9 @@ int egaswitchread, egaswitches=9; int update_overscan = 0; +uint8_t ega_in(uint16_t addr, void *p); + + void ega_out(uint16_t addr, uint8_t val, void *p) { @@ -145,6 +148,9 @@ ega_out(uint16_t addr, uint8_t val, void *p) ega->vidclock = val & 4; ega->miscout = val; ega->overscan_color = ega->vres ? pallook16[ega->attrregs[0x11] & 0x0f] : pallook64[ega->attrregs[0x11] & 0x3f]; + io_removehandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); + if (!(val & 1)) + io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); if ((o ^ val) & 0x80) ega_recalctimings(ega); break; @@ -237,10 +243,13 @@ ega_out(uint16_t addr, uint8_t val, void *p) } } -uint8_t ega_in(uint16_t addr, void *p) + +uint8_t +ega_in(uint16_t addr, void *p) { ega_t *ega = (ega_t *)p; uint8_t ret = 0xff; + uint16_t port = addr; if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(ega->miscout & 1)) addr ^= 0x60; @@ -979,6 +988,8 @@ ega_init(ega_t *ega, int monitor_type, int is_mono) break; } } + + io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); } else { for (c = 0; c < 256; c++) { pallook64[c] = makecol32(((c >> 2) & 1) * 0xaa, ((c >> 1) & 1) * 0xaa, (c & 1) * 0xaa); @@ -988,6 +999,8 @@ ega_init(ega_t *ega, int monitor_type, int is_mono) if ((c & 0x17) == 6) pallook16[c] = makecol32(0xaa, 0x55, 0); } + + ega->miscout |= 1; } ega->pallook = pallook16; @@ -1078,7 +1091,7 @@ ega_standalone_init(const device_t *info) ega->vrammask = ega->vram_limit - 1; mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, ega); - io_sethandler(0x03a0, 0x0040, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); + io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); if (info->local == EGA_ATI) { io_sethandler(0x01ce, 0x0002, ega_in, NULL, NULL, ega_out, NULL, NULL, ega); diff --git a/src/win/languages/cs-CZ.rc b/src/win/languages/cs-CZ.rc index 200c5c9d4..b63d8a176 100644 --- a/src/win/languages/cs-CZ.rc +++ b/src/win/languages/cs-CZ.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Kazetové nahrávky (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Všechny soubory (*.*)\0*.*\0" IDS_2150 "Cartridge %i: %ls" IDS_2151 "Obrazy cartridge (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Všechny soubory (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/de-DE.rc b/src/win/languages/de-DE.rc index 9f7925854..eaaa28171 100644 --- a/src/win/languages/de-DE.rc +++ b/src/win/languages/de-DE.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Kassettenimages (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Alle Dateien (*.*)\0*.*\0" IDS_2150 "Cartridge %i: %ls" IDS_2151 "Cartridgeimages (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Alle Dateien (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/en-GB.rc b/src/win/languages/en-GB.rc index 7ceeeed2b..61749d954 100644 --- a/src/win/languages/en-GB.rc +++ b/src/win/languages/en-GB.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Cassette images (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0All files (*.*)\0*.*\0" IDS_2150 "Cartridge %i: %ls" IDS_2151 "Cartridge images (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/en-US.rc b/src/win/languages/en-US.rc index 05616379f..3bee70556 100644 --- a/src/win/languages/en-US.rc +++ b/src/win/languages/en-US.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Cassette images (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0All files (*.*)\0*.*\0" IDS_2150 "Cartridge %i: %ls" IDS_2151 "Cartridge images (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/es-ES.rc b/src/win/languages/es-ES.rc index 7f2e2c2e4..2232e69c5 100644 --- a/src/win/languages/es-ES.rc +++ b/src/win/languages/es-ES.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Imágenes de Cassette (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0All files (*.*)\0*.*\0" IDS_2150 "Cartucho %i: %ls" IDS_2151 "Imágenes de Cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/fi-FI.rc b/src/win/languages/fi-FI.rc index f3e4f10bf..56430464d 100644 --- a/src/win/languages/fi-FI.rc +++ b/src/win/languages/fi-FI.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Kasetti-tiedostot (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2150 "ROM-moduuli %i: %ls" IDS_2151 "ROM-moduulikuvat (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Kaikki tiedostot (*.*)\0*.*\0" + IDS_2152 "Virhe renderöijän alustuksessa" + IDS_2153 "OpenGL (3.0 Core) renderöijän alustus epäonnistui. Käytä toista renderöijää." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/fr-FR.rc b/src/win/languages/fr-FR.rc index 1a212d5cc..997eefec4 100644 --- a/src/win/languages/fr-FR.rc +++ b/src/win/languages/fr-FR.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Images cassette (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Tous les fichiers (*.*)\0*.*\0" IDS_2150 "Cartouche %i: %ls" IDS_2151 "Images cartouche (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tous les fichiers (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/hr-HR.rc b/src/win/languages/hr-HR.rc index 0c4f4d38c..c6d4c4cc5 100644 --- a/src/win/languages/hr-HR.rc +++ b/src/win/languages/hr-HR.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Slike audio kasete (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Sve datoteke (*.*)\0*.*\0" IDS_2150 "Kaseta %i: %ls" IDS_2151 "Slike kasete (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Sve datoteke (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/hu-HU.rc b/src/win/languages/hu-HU.rc index 4081389b7..3a8dfe756 100644 --- a/src/win/languages/hu-HU.rc +++ b/src/win/languages/hu-HU.rc @@ -532,6 +532,8 @@ BEGIN IDS_2149 "Magnókazetta-képek (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Minden fájl (*.*)\0*.*\0" IDS_2150 "ROM-kazetta %i: %ls" IDS_2151 "ROM-kazetta képek (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Minden fájl (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/it-IT.rc b/src/win/languages/it-IT.rc index 1397da930..461b76e71 100644 --- a/src/win/languages/it-IT.rc +++ b/src/win/languages/it-IT.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Immagini cassetta (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Tutti i file (*.*)\0*.*\0" IDS_2150 "Cartuccia %i: %ls" IDS_2151 "Immagini cartuccia (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tutti i file (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ja-JP.rc b/src/win/languages/ja-JP.rc index 044f48c3e..f5fef7e3f 100644 --- a/src/win/languages/ja-JP.rc +++ b/src/win/languages/ja-JP.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "カセットイメージ (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0すべてのファイル (*.*)\0*.*\0" IDS_2150 "カートリッジ %i: %ls" IDS_2151 "カートリッジイメージ (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0すべてのファイル (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ko-KR.rc b/src/win/languages/ko-KR.rc index 0c0924b84..a46c8f6d7 100644 --- a/src/win/languages/ko-KR.rc +++ b/src/win/languages/ko-KR.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "카세트 이미지 (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0모든 파일 (*.*)\0*.*\0" IDS_2150 "카트리지 %i: %ls" IDS_2151 "카트리지 이미지 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0모든 파일 (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/pt-BR.rc b/src/win/languages/pt-BR.rc index 16eb2e48f..44968872e 100644 --- a/src/win/languages/pt-BR.rc +++ b/src/win/languages/pt-BR.rc @@ -531,6 +531,8 @@ BEGIN IDS_2149 "Imagens de cassete (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Todos os arquivos (*.*)\0*.*\0" IDS_2150 "Cartucho %i: %ls" IDS_2151 "Imagens de cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Todos os arquivos (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/pt-PT.rc b/src/win/languages/pt-PT.rc index f983fd24e..a424ad141 100644 --- a/src/win/languages/pt-PT.rc +++ b/src/win/languages/pt-PT.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Imagens de cassete (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Todos os ficheiros (*.*)\0*.*\0" IDS_2150 "Cartucho %i: %ls" IDS_2151 "Imagens de cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Todos os ficheiros (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ru-RU.rc b/src/win/languages/ru-RU.rc index 9f78a06b3..36ebf4ee3 100644 --- a/src/win/languages/ru-RU.rc +++ b/src/win/languages/ru-RU.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Образы кассет (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Все файлы (*.*)\0*.*\0" IDS_2150 "Картридж %i: %ls" IDS_2151 "Образы картриджей (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Все файлы (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/sl-SI.rc b/src/win/languages/sl-SI.rc index e2cc77005..fb1c80b8b 100644 --- a/src/win/languages/sl-SI.rc +++ b/src/win/languages/sl-SI.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Slike kaset (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Vse datoteke (*.*)\0*.*\0" IDS_2150 "Spominski vložek %i: %ls" IDS_2151 "Slike spominskega vložka (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Vse datoteke (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/tr-TR.rc b/src/win/languages/tr-TR.rc index 76a14fb1d..5d2ef2c50 100644 --- a/src/win/languages/tr-TR.rc +++ b/src/win/languages/tr-TR.rc @@ -530,6 +530,8 @@ BEGIN IDS_2149 "Kaset imajları (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0Tüm dosyalar (*.*)\0*.*\0" IDS_2150 "Kartuş %i: %ls" IDS_2151 "Kartuş imajları (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tüm dosyalar (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/zh-CN.rc b/src/win/languages/zh-CN.rc index c6bf385e6..10a0a1672 100644 --- a/src/win/languages/zh-CN.rc +++ b/src/win/languages/zh-CN.rc @@ -29,7 +29,7 @@ BEGIN MENUITEM SEPARATOR MENUITEM "退出(&x)...", IDM_ACTION_EXIT END - POPUP "视图(&V)" + POPUP "显示(&V)" BEGIN MENUITEM "隐藏状态栏(&H)", IDM_VID_HIDE_STATUS_BAR MENUITEM SEPARATOR @@ -69,7 +69,7 @@ BEGIN MENUITEM "全屏拉伸(&F)", IDM_VID_FS_FULL MENUITEM "&4:3", IDM_VID_FS_43 MENUITEM "保持比例(&S)", IDM_VID_FS_KEEPRATIO - MENUITEM "整数倍放大&I", IDM_VID_FS_INT + MENUITEM "整数倍放大(&I)", IDM_VID_FS_INT END POPUP "E&GA/(S)VGA 设置" BEGIN @@ -115,7 +115,7 @@ BEGIN POPUP "记录日志(&L)" BEGIN # ifdef ENABLE_BUSLOGIC_LOG - MENUITEM "启用 总线Logic 日志\tCtrl+F4", IDM_LOG_BUSLOGIC + MENUITEM "启用 BusLogic 日志\tCtrl+F4", IDM_LOG_BUSLOGIC # endif # ifdef ENABLE_CDROM_LOG MENUITEM "启用 CD-ROM 日志\tCtrl+F5", IDM_LOG_CDROM @@ -382,7 +382,7 @@ END #define STR_ISAMEM_2 "扩展卡 2:" #define STR_ISAMEM_3 "扩展卡 3:" #define STR_ISAMEM_4 "扩展卡 4:" -#define STR_BUGGER "ISABugger device" +#define STR_BUGGER "ISABugger 设备" #define STR_POSTCARD "自检卡(POST)" #define FONT_SIZE 9 @@ -408,7 +408,7 @@ BEGIN IDS_2056 "86Box 找不到支持的 ROM 镜像.\n\n请下载ROM包并解压到 ""roms"" 文件夹." IDS_2057 "(空)" IDS_2058 "ZIP 镜像 (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0所有文件 (*.*)\0*.*\0" - IDS_2059 "Turbo" + IDS_2059 "加速" IDS_2060 "开" IDS_2061 "关" IDS_2062 "所有镜像 (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0基本扇区镜像 (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0表面镜像 (*.86F)\0*.86F\0" @@ -530,6 +530,8 @@ BEGIN IDS_2149 "磁带镜像 (*.PCM;*.RAW;*.WAV;*.CAS)\0*.PCM;*.RAW;*.WAV;*.CAS\0所有文件 (*.*)\0*.*\0" IDS_2150 "卡带 %i: %ls" IDS_2151 "卡带镜像 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0所有文件 (*.*)\0*.*\0" + IDS_2152 "Error initializing renderer" + IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." END STRINGTABLE DISCARDABLE diff --git a/src/win/win.c b/src/win/win.c index d2a5003ec..650e43ba8 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -249,28 +249,28 @@ has_language_changed(uint32_t id) void set_language(uint32_t id) { - if (id == 0xFFFF) - { - set_language(lang_sys); - lang_id = id; - return; - } - + if (id == 0xFFFF) { + set_language(lang_sys); + lang_id = id; + return; + } + if (lang_id != id) { - /* Set our new language ID. */ - lang_id = id; - SetThreadUILanguage(lang_id); + /* Set our new language ID. */ + lang_id = id; + SetThreadUILanguage(lang_id); - /* Load the strings table for this ID. */ - LoadCommonStrings(); + /* Load the strings table for this ID. */ + LoadCommonStrings(); - /* Reload main menu */ - menuMain = LoadMenu(hinstance, L"MainMenu"); + /* Reload main menu */ + menuMain = LoadMenu(hinstance, L"MainMenu"); + if (hwndMain != NULL) SetMenu(hwndMain, menuMain); - - /* Re-init all the menus */ - ResetAllMenus(); - media_menu_init(); + + /* Re-init all the menus */ + ResetAllMenus(); + media_menu_init(); } } diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index 4a2db844f..13b8c4fb7 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -56,6 +56,7 @@ typedef LONG atomic_flag; #include <86box/plat.h> #include <86box/video.h> #include <86box/win.h> +#include <86box/language.h> #include <86box/win_opengl.h> #include <86box/win_opengl_glslp.h> @@ -445,7 +446,9 @@ static void opengl_fail() window = NULL; } - /* TODO: Notify user. */ + wchar_t* message = plat_get_string(IDS_2152); + wchar_t* header = plat_get_string(IDS_2153); + MessageBox(parent, header, message, MB_OK); WaitForSingleObject(sync_objects.closing, INFINITE); @@ -476,7 +479,7 @@ static void opengl_main(void* param) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - if (GLAD_GL_ARB_debug_output) + if (GLAD_GL_ARB_debug_output && log_path[0] != '\0') SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); else SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); @@ -527,7 +530,7 @@ static void opengl_main(void* param) opengl_fail(); } - if (GLAD_GL_ARB_debug_output) + if (GLAD_GL_ARB_debug_output && log_path[0] != '\0') { glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glDebugMessageControlARB(GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE_ARB, GL_DONT_CARE, 0, 0, GL_FALSE); @@ -539,6 +542,33 @@ static void opengl_main(void* param) pclog("OpenGL version: %s\n", glGetString(GL_VERSION)); pclog("OpenGL shader language version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION)); + /* Check that the driver actually reports version 3.0 or later */ + GLint major = -1; + glGetIntegerv(GL_MAJOR_VERSION, &major); + if (major < 3) + { + pclog("OpenGL: Minimum OpenGL version 3.0 is required.\n"); + SDL_GL_DeleteContext(context); + opengl_fail(); + } + + /* Check if errors have been generated at this point */ + GLenum gl_error = glGetError(); + if (gl_error != GL_NO_ERROR) + { + /* Log up to 10 errors */ + int i = 0; + do + { + pclog("OpenGL: Error %u\n", gl_error); + i++; + } + while((gl_error = glGetError()) != GL_NO_ERROR && i < 10); + + SDL_GL_DeleteContext(context); + opengl_fail(); + } + gl_identifiers gl = { 0 }; if (!initialize_glcontext(&gl)) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index b6a22fe50..703e3e414 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -54,8 +54,8 @@ /* Platform Public data, specific. */ -HWND hwndMain, /* application main window */ - hwndRender; /* machine render window */ +HWND hwndMain = NULL, /* application main window */ + hwndRender = NULL; /* machine render window */ HMENU menuMain; /* application main menu */ RECT oldclip; /* mouse rect */ int sbar_height = 23; /* statusbar height */