More UI cleanups and fixes. 95% of the UI code is now common.

Added missing "invert_display" config item.
Added some more local logging functions.
This commit is contained in:
waltje
2018-04-30 17:43:18 -04:00
parent f4fb5ca1b9
commit 2eb86d639b
18 changed files with 414 additions and 305 deletions

View File

@@ -12,7 +12,7 @@
* it on Windows XP, and possibly also Vista. Use the * it on Windows XP, and possibly also Vista. Use the
* -DANSI_CFG for use on these systems. * -DANSI_CFG for use on these systems.
* *
* Version: @(#)config.c 1.0.20 2018/04/27 * Version: @(#)config.c 1.0.21 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -267,6 +267,7 @@ load_general(const char *cat)
if (scale > 3) if (scale > 3)
scale = 3; scale = 3;
invert_display = !!config_get_int(cat, "invert_display", 0);
enable_overscan = !!config_get_int(cat, "enable_overscan", 0); enable_overscan = !!config_get_int(cat, "enable_overscan", 0);
vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0); vid_cga_contrast = !!config_get_int(cat, "vid_cga_contrast", 0);
vid_grayscale = config_get_int(cat, "video_grayscale", 0); vid_grayscale = config_get_int(cat, "video_grayscale", 0);
@@ -337,6 +338,11 @@ save_general(const char *cat)
else else
config_set_int(cat, "scale", scale); config_set_int(cat, "scale", scale);
if (invert_display == 0)
config_delete_var(cat, "invert_display");
else
config_set_int(cat, "invert_display", invert_display);
if (enable_overscan == 0) if (enable_overscan == 0)
config_delete_var(cat, "enable_overscan"); config_delete_var(cat, "enable_overscan");
else else

View File

@@ -10,7 +10,7 @@
* *
* TODO: Implement the ENABLE_FDD_LOG stuff. * TODO: Implement the ENABLE_FDD_LOG stuff.
* *
* Version: @(#)fdd.c 1.0.10 2018/04/28 * Version: @(#)fdd.c 1.0.11 2018/04/29
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -76,6 +76,10 @@ int defaultwriteprot = 0;
int curdrive = 0; int curdrive = 0;
int motorspin; int motorspin;
int fdc_indexcount = 52; int fdc_indexcount = 52;
#ifdef ENABLE_FDD_LOG
int fdd_do_log = ENABLE_FDD_LOG;
#endif
static fdc_t *fdd_fdc; static fdc_t *fdd_fdc;

View File

@@ -10,7 +10,7 @@
* *
* TODO: Add the Genius bus- and serial mouse. * TODO: Add the Genius bus- and serial mouse.
* *
* Version: @(#)mouse.c 1.0.9 2018/04/26 * Version: @(#)mouse.c 1.0.10 2018/04/29
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -63,6 +63,9 @@ typedef struct {
} mouse_t; } mouse_t;
#ifdef ENABLE_MOUSE_LOG
int mouse_do_log = ENABLE_MOUSE_LOG;
#endif
int mouse_x, int mouse_x,
mouse_y, mouse_y,
mouse_z, mouse_z,

View File

@@ -12,7 +12,7 @@
* - Realtek RTL8019AS (ISA 16-bit, PnP); * - Realtek RTL8019AS (ISA 16-bit, PnP);
* - Realtek RTL8029AS (PCI). * - Realtek RTL8029AS (PCI).
* *
* Version: @(#)net_ne2000.c 1.0.6 2018/04/28 * Version: @(#)net_ne2000.c 1.0.7 2018/04/29
* *
* Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy * Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy
* *
@@ -291,10 +291,10 @@ static void nic_tx(nic_t *, uint32_t);
static void static void
nelog(int lvl, const char *fmt, ...) nelog(int lvl, const char *fmt, ...)
{ {
#ifdef ENABLE_NIC_LOG #ifdef ENABLE_NETWORK_DEV_LOG
va_list ap; va_list ap;
if (nic_do_log >= lvl) { if (network_dev_do_log >= lvl) {
va_start(ap, fmt); va_start(ap, fmt);
pclog_ex(fmt, ap); pclog_ex(fmt, ap);
va_end(ap); va_end(ap);

View File

@@ -12,7 +12,7 @@
* it should be malloc'ed and then linked to the NETCARD def. * it should be malloc'ed and then linked to the NETCARD def.
* Will be done later. * Will be done later.
* *
* Version: @(#)network.c 1.0.7 2018/04/28 * Version: @(#)network.c 1.0.8 2018/04/29
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -52,10 +52,12 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h>
#include <wchar.h> #include <wchar.h>
#ifdef WALTJE #ifdef WALTJE
# include <ctype.h> # include <ctype.h>
#endif #endif
#define HAVE_STDARG_H
#include "../emu.h" #include "../emu.h"
#include "../device.h" #include "../device.h"
#include "../ui/ui.h" #include "../ui/ui.h"
@@ -80,8 +82,11 @@ int network_ndev;
int network_card; int network_card;
char network_pcap[512]; char network_pcap[512];
netdev_t network_devs[32]; netdev_t network_devs[32];
#ifdef ENABLE_NIC_LOG #ifdef ENABLE_NETWORK_LOG
int nic_do_log = ENABLE_NIC_LOG; int network_do_log = ENABLE_NETWORK_LOG;
#endif
#ifdef ENABLE_NETWORK_DEV_LOG
int network_dev_do_log = ENABLE_NETWORK_DEV_LOG;
#endif #endif
static mutex_t *network_mutex; static mutex_t *network_mutex;
static uint8_t *network_mac; static uint8_t *network_mac;
@@ -178,6 +183,21 @@ hexdump_p(char *ptr, uint8_t *bufp, int len)
#endif #endif
static void
net_log(int lvl, const char *fmt, ...)
{
#ifdef ENABLE_NETWORK_LOG
va_list ap;
if (network_do_log >= lvl) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
void void
network_wait(uint8_t wait) network_wait(uint8_t wait)
{ {
@@ -305,7 +325,7 @@ network_close(void)
network_mutex = NULL; network_mutex = NULL;
network_mac = NULL; network_mac = NULL;
pclog("NETWORK: closed.\n"); net_log(1, "NETWORK: closed.\n");
} }
@@ -322,9 +342,9 @@ network_reset(void)
{ {
int i = -1; int i = -1;
#ifdef ENABLE_NIC_LOG #ifdef ENABLE_NETWORK_LOG
pclog("NETWORK: reset (type=%d, card=%d) debug=%d\n", pclog("NETWORK: reset (type=%d, card=%d) debug=%d\n",
network_type, network_card, nic_do_log); network_type, network_card, network_do_log);
#else #else
pclog("NETWORK: reset (type=%d, card=%d)\n", pclog("NETWORK: reset (type=%d, card=%d)\n",
network_type, network_card); network_type, network_card);
@@ -364,13 +384,13 @@ network_reset(void)
return; return;
} }
pclog("NETWORK: set up for %s, card='%s'\n", net_log(0, "NETWORK: set up for %s, card='%s'\n",
(network_type==NET_TYPE_SLIRP)?"SLiRP":"Pcap", (network_type==NET_TYPE_SLIRP)?"SLiRP":"Pcap",
net_cards[network_card].name); net_cards[network_card].name);
/* Add the (new?) card to the I/O system. */ /* Add the (new?) card to the I/O system. */
if (net_cards[network_card].device) { if (net_cards[network_card].device) {
pclog("NETWORK: adding device '%s'\n", net_log(1, "NETWORK: adding device '%s'\n",
net_cards[network_card].name); net_cards[network_card].name);
device_add(net_cards[network_card].device); device_add(net_cards[network_card].device);
} }
@@ -410,7 +430,7 @@ network_dev_to_id(const char *devname)
{ {
int i = 0; int i = 0;
for (i=0; i<network_ndev; i++) { for (i = 0; i < network_ndev; i++) {
if (! strcmp(network_devs[i].device, devname)) { if (! strcmp(network_devs[i].device, devname)) {
return(i); return(i);
} }

View File

@@ -8,7 +8,7 @@
* *
* Definitions for the network module. * Definitions for the network module.
* *
* Version: @(#)network.h 1.0.3 2018/04/10 * Version: @(#)network.h 1.0.4 2018/04/29
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -87,7 +87,8 @@ extern "C" {
#endif #endif
/* Global variables. */ /* Global variables. */
extern int nic_do_log; /* config */ extern int network_do_log, /* config */
network_dev_log;
extern int network_ndev; extern int network_ndev;
extern netdev_t network_devs[32]; extern netdev_t network_devs[32];

View File

@@ -66,8 +66,10 @@
/* XXX: Define according to how time.h should be included */ /* XXX: Define according to how time.h should be included */
#undef TIME_WITH_SYS_TIME #undef TIME_WITH_SYS_TIME
#define TIME_WITH_SYS_TIME 0 #ifndef _MSC_VER
#undef HAVE_SYS_TIME_H # define TIME_WITH_SYS_TIME 0
# undef HAVE_SYS_TIME_H
#endif
/* Define if your sprintf returns char * instead of int */ /* Define if your sprintf returns char * instead of int */
#undef BAD_SPRINTF #undef BAD_SPRINTF

View File

@@ -8,7 +8,7 @@
* *
* Main emulator module where most things are controlled. * Main emulator module where most things are controlled.
* *
* Version: @(#)pc.c 1.0.30 2018/04/28 * Version: @(#)pc.c 1.0.31 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>

View File

@@ -8,7 +8,7 @@
* *
* Implement the PCI bus. * Implement the PCI bus.
* *
* Version: @(#)pci.c 1.0.3 2018/04/26 * Version: @(#)pci.c 1.0.4 2018/04/29
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -92,15 +92,15 @@ static int trc_reg = 0;
PCI_RESET pci_reset_handler; PCI_RESET pci_reset_handler;
#ifdef ENABLE_PCI_LOG #ifdef ENABLE_BUS_LOG
int pci_do_log = ENABLE_PCI_LOG; int pci_do_log = ENABLE_BUS_LOG;
#endif #endif
static void static void
pcilog(const char *fmt, ...) pcilog(const char *fmt, ...)
{ {
#ifdef ENABLE_PCI_LOG #ifdef ENABLE_BUS_LOG
va_list ap; va_list ap;
if (pci_do_log) if (pci_do_log)

View File

@@ -8,7 +8,7 @@
* *
* Implementation of a generic Game Port. * Implementation of a generic Game Port.
* *
* Version: @(#)game.c 1.0.9 2018/04/26 * Version: @(#)game.c 1.0.11 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk> * Sarah Walker, <tommowalker@tommowalker.co.uk>
@@ -38,7 +38,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h>
#include <wchar.h> #include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h" #include "../emu.h"
#include "../machine/machine.h" #include "../machine/machine.h"
#include "../cpu/cpu.h" #include "../cpu/cpu.h"
@@ -66,9 +68,29 @@ typedef struct _game_ {
} game_t; } game_t;
#ifdef ENABLE_GAME_LOG
int game_do_log = ENABLE_GAME_LOG;
#endif
static game_t *game_global = NULL; static game_t *game_global = NULL;
static void
gamelog(const char *fmt, ...)
{
#ifdef ENABLE_GAME_LOG
va_list ap;
if (game_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
static int static int
game_time(int axis) game_time(int axis)
{ {
@@ -88,6 +110,10 @@ game_write(uint16_t addr, uint8_t val, void *priv)
game_t *dev = (game_t *)priv; game_t *dev = (game_t *)priv;
int i; int i;
#ifdef ENABLE_GAME_LOG
gamelog("GAME: write(%04x, %02x)\n", addr, val);
#endif
timer_clock(); timer_clock();
dev->state |= 0x0f; dev->state |= 0x0f;
@@ -115,6 +141,10 @@ game_read(uint16_t addr, void *priv)
cycles -= ISA_CYCLES(8); cycles -= ISA_CYCLES(8);
#ifdef ENABLE_GAME_LOG
gamelog("GAME: read(%04x) = %02x\n", addr, ret);
#endif
return(ret); return(ret);
} }

View File

@@ -8,7 +8,7 @@
* *
* Implementation of the "LPT" style parallel ports. * Implementation of the "LPT" style parallel ports.
* *
* Version: @(#)parallel.c 1.0.8 2018/04/26 * Version: @(#)parallel.c 1.0.9 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -39,7 +39,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
#include <wchar.h> #include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h" #include "../emu.h"
#include "../io.h" #include "../io.h"
#include "../device.h" #include "../device.h"
@@ -76,6 +78,21 @@ int parallel_do_log = ENABLE_PARALLEL_LOG;
static parallel_t ports[PARALLEL_MAX]; /* the ports */ static parallel_t ports[PARALLEL_MAX]; /* the ports */
static void
parlog(const char *fmt, ...)
{
#ifdef ENABLE_PARALLEL_LOG
va_list ap;
if (parallel_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
/* Write a value to a port (and/or its attached device.) */ /* Write a value to a port (and/or its attached device.) */
static void static void
parallel_write(uint16_t port, uint8_t val, void *priv) parallel_write(uint16_t port, uint8_t val, void *priv)
@@ -83,7 +100,7 @@ parallel_write(uint16_t port, uint8_t val, void *priv)
parallel_t *dev = (parallel_t *)priv; parallel_t *dev = (parallel_t *)priv;
#ifdef ENABLE_PARALLEL_LOG #ifdef ENABLE_PARALLEL_LOG
pclog("PARALLEL: write(%04X, %02X)\n", port, val); parlog("PARALLEL: write(%04X, %02X)\n", port, val);
#endif #endif
switch (port & 3) { switch (port & 3) {
@@ -125,7 +142,7 @@ parallel_read(uint16_t port, void *priv)
break; break;
} }
#ifdef ENABLE_PARALLEL_LOG #ifdef ENABLE_PARALLEL_LOG
pclog("PARALLEL: read(%04X) => %02X\n", port, ret); parlog("PARALLEL: read(%04X) => %02X\n", port, ret);
#endif #endif
return(ret); return(ret);
@@ -224,7 +241,7 @@ parallel_reset(void)
int i; int i;
#ifdef ENABLE_PARALLEL_LOG #ifdef ENABLE_PARALLEL_LOG
pclog("PARALLEL: reset ([%d] [%d] [%d])\n", parlog("PARALLEL: reset ([%d] [%d] [%d])\n",
parallel_enabled[0], parallel_enabled[1], parallel_enabled[2]); parallel_enabled[0], parallel_enabled[1], parallel_enabled[2]);
#endif #endif
@@ -245,7 +262,7 @@ parallel_setup(int id, uint16_t port)
parallel_t *dev = &ports[id-1]; parallel_t *dev = &ports[id-1];
#if defined(ENABLE_PARALLEL_LOG) && defined(_DEBUG) #if defined(ENABLE_PARALLEL_LOG) && defined(_DEBUG)
pclog("PARALLEL: setting up LPT%d as %04X [enabled=%d]\n", parlog("PARALLEL: setting up LPT%d as %04X [enabled=%d]\n",
id, port, parallel_enabled[id-1]); id, port, parallel_enabled[id-1]);
#endif #endif
if (! parallel_enabled[id-1]) return; if (! parallel_enabled[id-1]) return;

View File

@@ -8,7 +8,7 @@
* *
* Implementation of 8250-style serial port. * Implementation of 8250-style serial port.
* *
* Version: @(#)serial.c 1.0.5 2018/04/26 * Version: @(#)serial.c 1.0.6 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -40,7 +40,9 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h>
#include <wchar.h> #include <wchar.h>
#define HAVE_STDARG_H
#include "../emu.h" #include "../emu.h"
#include "../machine/machine.h" #include "../machine/machine.h"
#include "../io.h" #include "../io.h"
@@ -76,6 +78,21 @@ static const struct {
static SERIAL ports[SERIAL_MAX]; /* the ports */ static SERIAL ports[SERIAL_MAX]; /* the ports */
static void
serlog(const char *fmt, ...)
{
#ifdef ENABLE_SERIAL_LOG
va_list ap;
if (serial_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
#endif
}
static void static void
update_ints(SERIAL *dev) update_ints(SERIAL *dev)
{ {
@@ -401,7 +418,7 @@ serial_reset(void)
int i; int i;
#ifdef ENABLE_SERIAL_LOG #ifdef ENABLE_SERIAL_LOG
pclog("SERIAL: reset ([%d] [%d])\n", serial_enabled[0], serial_enabled[1]); serlog("SERIAL: reset ([%d] [%d])\n", serial_enabled[0], serial_enabled[1]);
#endif #endif
for (i = 0; i < SERIAL_MAX; i++) { for (i = 0; i < SERIAL_MAX; i++) {
@@ -425,7 +442,7 @@ serial_setup(int id, uint16_t port, int8_t irq)
SERIAL *dev = &ports[id-1]; SERIAL *dev = &ports[id-1];
#if defined(ENABLE_SERIAL_LOG) && defined(_DEBUG) #if defined(ENABLE_SERIAL_LOG) && defined(_DEBUG)
pclog("SERIAL: setting up COM%d as %04X [enabled=%d]\n", serlog("SERIAL: setting up COM%d as %04X [enabled=%d]\n",
id, port, serial_enabled[id-1]); id, port, serial_enabled[id-1]);
#endif #endif
if (! serial_enabled[id-1]) return; if (! serial_enabled[id-1]) return;

View File

@@ -131,13 +131,13 @@ extern int voodoo_do_log;
extern int ui_msgbox(int type, void *arg); extern int ui_msgbox(int type, void *arg);
extern void ui_menu_reset_all(void); extern void ui_menu_reset_all(void);
extern int ui_menu_command(int idm); extern int ui_menu_command(int idm);
extern void ui_menu_set_radio_item(int idm, int num, int val);
extern void ui_menu_set_logging_item(int idm, int val); extern void ui_menu_set_logging_item(int idm, int val);
extern void ui_menu_toggle_video_item(int idm, int *val); extern void ui_menu_toggle_video_item(int idm, int *val);
/* Main GUI helper functions. */ /* Main GUI helper functions. */
extern void menu_enable_item(int idm, int val); extern void menu_enable_item(int idm, int val);
extern void menu_set_item(int idm, int val); extern void menu_set_item(int idm, int val);
extern void menu_set_radio_item(int idm, int num, int val);
extern wchar_t *ui_window_title(wchar_t *s); extern wchar_t *ui_window_title(wchar_t *s);
/* Status Bar functions. */ /* Status Bar functions. */

View File

@@ -11,7 +11,7 @@
* This code is called by the UI frontend modules, and, also, * This code is called by the UI frontend modules, and, also,
* depends on those same modules for lower-level functions. * depends on those same modules for lower-level functions.
* *
* Version: @(#)ui_main.c 1.0.4 2018/04/28 * Version: @(#)ui_main.c 1.0.5 2018/04/30
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -61,18 +61,6 @@
#include "ui_resource.h" #include "ui_resource.h"
/* Set a radio group menu item. */
void
ui_menu_set_radio_item(int idm, int num, int val)
{
int i;
for (i = 0; i < num; i++)
menu_set_item(idm + i, 0);
menu_set_item(idm + val, 1);
}
#if defined(ENABLE_LOG_TOGGLES) || defined(ENABLE_LOG_COMMANDS) #if defined(ENABLE_LOG_TOGGLES) || defined(ENABLE_LOG_COMMANDS)
/* Simplest way to handle all these, for now.. */ /* Simplest way to handle all these, for now.. */
void void
@@ -267,29 +255,29 @@ ui_menu_reset_all(void)
menu_set_item(IDM_RESIZE, vid_resize); menu_set_item(IDM_RESIZE, vid_resize);
menu_set_item(IDM_REMEMBER, window_remember); menu_set_item(IDM_REMEMBER, window_remember);
ui_menu_set_radio_item(IDM_VID_DDRAW, 4, -1); menu_set_radio_item(IDM_RENDER_1, 4, -1);
ui_menu_set_radio_item(IDM_SCALE_1, 4, scale); menu_set_radio_item(IDM_SCALE_1, 4, scale);
menu_set_item(IDM_FULLSCREEN, vid_fullscreen); menu_set_item(IDM_FULLSCREEN, vid_fullscreen);
ui_menu_set_radio_item(IDM_STRETCH, 5, vid_fullscreen_scale); menu_set_radio_item(IDM_STRETCH, 5, vid_fullscreen_scale);
menu_set_item(IDM_VGA_INVERT, invert_display);
menu_set_item(IDM_VGA_OVERSCAN, enable_overscan);
ui_menu_set_radio_item(IDM_SCREEN_RGB, 5, vid_grayscale);
ui_menu_set_radio_item(IDM_GRAY_601, 3, vid_graytype);
menu_set_item(IDM_FORCE_43, force_43);
menu_set_item(IDM_CGA_CONTR, vid_cga_contrast);
menu_set_item(IDM_RCTRL_IS_LALT, rctrl_is_lalt); menu_set_item(IDM_RCTRL_IS_LALT, rctrl_is_lalt);
menu_set_item(IDM_UPDATE_ICONS, update_icons); menu_set_item(IDM_UPDATE_ICONS, update_icons);
menu_set_item(IDM_INVERT, invert_display);
menu_set_item(IDM_OVERSCAN, enable_overscan);
menu_set_radio_item(IDM_SCREEN_RGB, 5, vid_grayscale);
menu_set_radio_item(IDM_GRAY_601, 3, vid_graytype);
menu_set_item(IDM_FORCE_43, force_43);
menu_set_item(IDM_CGA_CONTR, vid_cga_contrast);
#ifdef ENABLE_LOG_TOGGLES #ifdef ENABLE_LOG_TOGGLES
for (i = IDM_LOG_BEGIN; i < IDM_LOG_END; i++) for (i = IDM_LOG_BEGIN; i < IDM_LOG_END; i++)
ui_menu_set_logging_item(i, 0xff); ui_menu_set_logging_item(i, 0xff);
@@ -301,66 +289,48 @@ ui_menu_reset_all(void)
int int
ui_menu_command(int idm) ui_menu_command(int idm)
{ {
wchar_t temp[512];
int i; int i;
switch (idm) { switch (idm) {
case IDM_SCREENSHOT: case IDM_RESET_HARD: /* ACTION menu */
take_screenshot();
break;
case IDM_RESET_HARD:
pc_reset(1); pc_reset(1);
break; break;
case IDM_RESET: case IDM_RESET: /* ACTION menu */
pc_reset(0); pc_reset(0);
break; break;
case IDM_EXIT: case IDM_CAE: /* ACTION menu */
/*NOTHANDLED*/
return(0);
case IDM_CAE:
keyboard_send_cae(); keyboard_send_cae();
break; break;
case IDM_CAB: case IDM_CAB: /* ACTION menu */
keyboard_send_cab(); keyboard_send_cab();
break; break;
case IDM_PAUSE: case IDM_PAUSE: /* ACTION menu */
plat_pause(dopause ^ 1); plat_pause(dopause ^ 1);
menu_set_item(idm, dopause); menu_set_item(idm, dopause);
break; break;
case IDM_SETTINGS: #ifdef IDM_Test
plat_pause(1); case IDM_Test: /* ACTION menu */
if (dlg_settings(1) == 2) pclog("TEST\n");
pc_reset_hard_init();
plat_pause(0);
break; break;
#endif
case IDM_ABOUT: case IDM_EXIT: /* ACTION menu */
dlg_about(); /*NOTHANDLED*/
break; return(0);
case IDM_STATUS: case IDM_RESIZE: /* VIEW menu */
dlg_status();
break;
case IDM_UPDATE_ICONS:
update_icons ^= 1;
menu_set_item(idm, update_icons);
config_save();
break;
case IDM_RESIZE:
vid_resize ^= 1; vid_resize ^= 1;
menu_set_item(idm, vid_resize); menu_set_item(idm, vid_resize);
if (vid_resize) { if (vid_resize) {
/* Force scaling to 1.0. */ /* Force scaling to 1.0. */
scale = 1; scale = 1;
ui_menu_set_radio_item(IDM_SCALE_1, 4, scale); menu_set_radio_item(IDM_SCALE_1, 4, scale);
} }
/* Disable scaling settings. */ /* Disable scaling settings. */
@@ -370,106 +340,112 @@ ui_menu_command(int idm)
config_save(); config_save();
return(0); return(0);
case IDM_REMEMBER: case IDM_REMEMBER: /* VIEW menu */
window_remember ^= 1; window_remember ^= 1;
menu_set_item(idm, window_remember); menu_set_item(idm, window_remember);
return(0); return(0);
case IDM_VID_DDRAW: case IDM_RENDER_1: /* VIEW menu */
case IDM_VID_D3D: case IDM_RENDER_2:
#ifdef USE_VNC case IDM_RENDER_3:
case IDM_VID_VNC: case IDM_RENDER_4:
#endif plat_setvid(idm - IDM_RENDER_1);
#ifdef USE_RDP menu_set_radio_item(IDM_RENDER_1, 4, vid_api);
case IDM_VID_RDP:
#endif
plat_setvid(idm - IDM_VID_DDRAW);
ui_menu_set_radio_item(IDM_VID_DDRAW, 4, vid_api);
config_save(); config_save();
break; break;
case IDM_FULLSCREEN: case IDM_FULLSCREEN: /* VIEW menu */
plat_setfullscreen(1); plat_setfullscreen(1);
config_save(); config_save();
break; break;
case IDM_STRETCH: case IDM_STRETCH: /* VIEW menu */
case IDM_STRETCH_43: case IDM_STRETCH_43:
case IDM_STRETCH_SQ: case IDM_STRETCH_SQ:
case IDM_STRETCH_INT: case IDM_STRETCH_INT:
case IDM_STRETCH_KEEP: case IDM_STRETCH_KEEP:
vid_fullscreen_scale = (idm - IDM_STRETCH); vid_fullscreen_scale = (idm - IDM_STRETCH);
ui_menu_set_radio_item(IDM_STRETCH, 5, vid_fullscreen_scale); menu_set_radio_item(IDM_STRETCH, 5, vid_fullscreen_scale);
device_force_redraw(); device_force_redraw();
config_save(); config_save();
break; break;
case IDM_SCALE_1: case IDM_SCALE_1: /* VIEW menu */
case IDM_SCALE_2: case IDM_SCALE_2:
case IDM_SCALE_3: case IDM_SCALE_3:
case IDM_SCALE_4: case IDM_SCALE_4:
scale = (idm - IDM_SCALE_1); scale = (idm - IDM_SCALE_1);
ui_menu_set_radio_item(IDM_SCALE_1, 4, scale); menu_set_radio_item(IDM_SCALE_1, 4, scale);
device_force_redraw(); device_force_redraw();
video_force_resize_set(1); video_force_resize_set(1);
config_save(); config_save();
break; break;
case IDM_FORCE_43: case IDM_FORCE_43: /* VIEW menu */
ui_menu_toggle_video_item(idm, &force_43); ui_menu_toggle_video_item(idm, &force_43);
video_force_resize_set(1); video_force_resize_set(1);
config_save();
break; break;
case IDM_VGA_INVERT: case IDM_RCTRL_IS_LALT: /* VIEW menu */
rctrl_is_lalt ^= 1;
menu_set_item(idm, rctrl_is_lalt);
config_save();
break;
case IDM_UPDATE_ICONS: /* VIEW menu */
update_icons ^= 1;
menu_set_item(idm, update_icons);
config_save();
break;
case IDM_INVERT: /* DISPLAY menu */
ui_menu_toggle_video_item(idm, &invert_display); ui_menu_toggle_video_item(idm, &invert_display);
config_save();
break; break;
case IDM_VGA_OVERSCAN: case IDM_OVERSCAN: /* DISPLAY menu */
ui_menu_toggle_video_item(idm, &enable_overscan); ui_menu_toggle_video_item(idm, &enable_overscan);
video_force_resize_set(1); video_force_resize_set(1);
config_save();
break; break;
case IDM_CGA_CONTR: case IDM_SCREEN_RGB: /* DISPLAY menu */
case IDM_SCREEN_GRAYSCALE:
case IDM_SCREEN_AMBER:
case IDM_SCREEN_GREEN:
case IDM_SCREEN_WHITE:
vid_grayscale = (idm - IDM_SCREEN_RGB);
menu_set_radio_item(IDM_SCREEN_RGB, 5, vid_grayscale);
device_force_redraw();
config_save();
break;
case IDM_GRAY_601: /* DISPLAY menu */
case IDM_GRAY_709:
case IDM_GRAY_AVE:
vid_graytype = (idm - IDM_GRAY_601);
menu_set_radio_item(IDM_GRAY_601, 3, vid_graytype);
device_force_redraw();
config_save();
break;
case IDM_CGA_CONTR: /* DISPLAY menu */
vid_cga_contrast ^= 1; vid_cga_contrast ^= 1;
menu_set_item(idm, vid_cga_contrast); menu_set_item(idm, vid_cga_contrast);
cgapal_rebuild(); cgapal_rebuild();
config_save(); config_save();
break; break;
case IDM_GRAY_601: case IDM_SETTINGS: /* TOOLS menu */
case IDM_GRAY_709: plat_pause(1);
case IDM_GRAY_AVE: if (dlg_settings(1) == 2)
vid_graytype = (idm - IDM_GRAY_601); pc_reset_hard_init();
ui_menu_set_radio_item(IDM_GRAY_601, 3, vid_graytype); plat_pause(0);
device_force_redraw();
config_save();
break; break;
case IDM_SCREEN_RGB:
case IDM_SCREEN_GRAYSCALE:
case IDM_SCREEN_AMBER:
case IDM_SCREEN_GREEN:
case IDM_SCREEN_WHITE:
vid_grayscale = (idm - IDM_SCREEN_RGB);
ui_menu_set_radio_item(IDM_SCREEN_RGB, 5, vid_grayscale);
device_force_redraw();
config_save();
break;
case IDM_RCTRL_IS_LALT:
rctrl_is_lalt ^= 1;
menu_set_item(idm, rctrl_is_lalt);
config_save();
break;
#ifdef ENABLE_LOG_BREAKPOINT
case IDM_LOG_BREAKPOINT:
pclog("---- LOG BREAKPOINT ----\n");
break;
#endif
#ifdef ENABLE_LOG_TOGGLES #ifdef ENABLE_LOG_TOGGLES
case IDM_LOG_BUS: case IDM_LOG_BUS: /* TOOLS menu */
case IDM_LOG_KEYBOARD: case IDM_LOG_KEYBOARD:
case IDM_LOG_MOUSE: case IDM_LOG_MOUSE:
case IDM_LOG_GAME: case IDM_LOG_GAME:
@@ -497,26 +473,42 @@ ui_menu_command(int idm)
break; break;
#endif #endif
#if 0 #ifdef ENABLE_LOG_BREAKPOINT
case IDM_LOG_BREAKPOINT: /* TOOLS menu */
pclog("---- LOG BREAKPOINT ----\n");
break;
#endif
/* FIXME: need to fix these.. */ /* FIXME: need to fix these.. */
case IDM_LOAD: case IDM_LOAD: /* TOOLS menu */
plat_pause(1); plat_pause(1);
if (! file_dlg_st(hwnd, IDS_2160, L"", 0) && if (! dlg_file(plat_get_string(IDS_2160), NULL, temp, 0) &&
(ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES)) { (ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == 0)) {
pc_reload(wopenfilestring); pc_reload(temp);
ResetAllMenus(); ui_menu_reset_all();
} }
plat_pause(0); plat_pause(0);
break; break;
case IDM_SAVE: case IDM_SAVE: /* TOOLS menu */
plat_pause(1); plat_pause(1);
if (! file_dlg_st(hwnd, IDS_2160, L"", 1)) { if (! dlg_file(plat_get_string(IDS_2160), NULL, temp, 1)) {
config_write(wopenfilestring); config_write(temp);
} }
plat_pause(0); plat_pause(0);
break; break;
#endif
case IDM_STATUS: /* TOOLS menu */
dlg_status();
break;
case IDM_SCREENSHOT: /* TOOLS menu */
take_screenshot();
break;
case IDM_ABOUT: /* HELP menu */
dlg_about();
break;
} }
return(1); return(1);

View File

@@ -8,7 +8,7 @@
* *
* Platform-independent resource identifiers. * Platform-independent resource identifiers.
* *
* Version: @(#)ui_resource.h 1.0.2 2018/04/29 * Version: @(#)ui_resource.h 1.0.4 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -50,24 +50,31 @@
# define EMU_UI_RESOURCE_H # define EMU_UI_RESOURCE_H
#ifdef _WIN32
# define IDM_BASE 40960
#else
# define IDM_BASE 16384
#endif
/* ACTION menu. */ /* ACTION menu. */
#define IDM_ACTION 40100 #define IDM_ACTION IDM_BASE
#define IDM_RESET_HARD (IDM_ACTION+1) #define IDM_RESET_HARD (IDM_ACTION+1)
#define IDM_RESET (IDM_ACTION+2) #define IDM_RESET (IDM_ACTION+2)
#define IDM_CAE (IDM_ACTION+3) #define IDM_CAE (IDM_ACTION+3)
#define IDM_CAB (IDM_ACTION+4) #define IDM_CAB (IDM_ACTION+4)
#define IDM_PAUSE (IDM_ACTION+5) #define IDM_PAUSE (IDM_ACTION+5)
#define IDM_ACTION_END (IDM_PAUSE+1)
#define IDM_EXIT (IDM_ACTION+99) /* fixed on WxWidgets */ #define IDM_EXIT (IDM_ACTION+99) /* fixed on WxWidgets */
/* VIEW menu. */ /* VIEW menu. */
#define IDM_VIEW 40200 #define IDM_VIEW (IDM_BASE+100)
#define IDM_RESIZE (IDM_VIEW+1) #define IDM_RESIZE (IDM_VIEW+1)
#define IDM_REMEMBER (IDM_VIEW+2) #define IDM_REMEMBER (IDM_VIEW+2)
#define IDM_RENDER (IDM_VIEW+10) #define IDM_RENDER (IDM_VIEW+10)
# define IDM_VID_DDRAW (IDM_RENDER+1) # define IDM_RENDER_1 (IDM_RENDER+1) /* DDraw */
# define IDM_VID_D3D (IDM_RENDER+2) # define IDM_RENDER_2 (IDM_RENDER+2) /* D3D */
# define IDM_VID_VNC (IDM_RENDER+3) # define IDM_RENDER_3 (IDM_RENDER+3) /* VNC */
# define IDM_VID_RDP (IDM_RENDER+4) # define IDM_RENDER_4 (IDM_RENDER+4) /* RDP */
#define IDM_SCALE (IDM_VIEW+20) #define IDM_SCALE (IDM_VIEW+20)
# define IDM_SCALE_1 (IDM_SCALE+1) # define IDM_SCALE_1 (IDM_SCALE+1)
# define IDM_SCALE_2 (IDM_SCALE+2) # define IDM_SCALE_2 (IDM_SCALE+2)
@@ -80,26 +87,30 @@
# define IDM_STRETCH_SQ (IDM_FULLSCREEN+4) # define IDM_STRETCH_SQ (IDM_FULLSCREEN+4)
# define IDM_STRETCH_INT (IDM_FULLSCREEN+5) # define IDM_STRETCH_INT (IDM_FULLSCREEN+5)
# define IDM_STRETCH_KEEP (IDM_FULLSCREEN+6) # define IDM_STRETCH_KEEP (IDM_FULLSCREEN+6)
#define IDM_VGA_SETTINGS (IDM_VIEW+40)
# define IDM_VGA_INVERT (IDM_VGA_SETTINGS+1)
# define IDM_VGA_OVERSCAN (IDM_VGA_SETTINGS+2)
# define IDM_VGA_SCREEN (IDM_VIEW+50)
# define IDM_SCREEN_RGB (IDM_VGA_SCREEN+1)
# define IDM_SCREEN_GRAYSCALE (IDM_VGA_SCREEN+2)
# define IDM_SCREEN_AMBER (IDM_VGA_SCREEN+3)
# define IDM_SCREEN_GREEN (IDM_VGA_SCREEN+4)
# define IDM_SCREEN_WHITE (IDM_VGA_SCREEN+5)
#define IDM_VGA_GRAYSCALE (IDM_VIEW+60)
# define IDM_GRAY_601 (IDM_VGA_GRAYSCALE+1)
# define IDM_GRAY_709 (IDM_VGA_GRAYSCALE+2)
# define IDM_GRAY_AVE (IDM_VGA_GRAYSCALE+3)
# define IDM_FORCE_43 (IDM_VIEW+3)
# define IDM_CGA_CONTR (IDM_VIEW+4)
#define IDM_RCTRL_IS_LALT (IDM_VIEW+5) #define IDM_RCTRL_IS_LALT (IDM_VIEW+5)
#define IDM_UPDATE_ICONS (IDM_VIEW+6) #define IDM_UPDATE_ICONS (IDM_VIEW+6)
#define IDM_VIEW_END (IDM_UPDATE_ICONS+1)
/* DISPLAY menu. */
#define IDM_DISPLAY (IDM_BASE+200)
# define IDM_INVERT (IDM_DISPLAY+1)
# define IDM_OVERSCAN (IDM_DISPLAY+2)
# define IDM_SCREEN (IDM_DISPLAY+10)
# define IDM_SCREEN_RGB (IDM_SCREEN+1)
# define IDM_SCREEN_GRAYSCALE (IDM_SCREEN+2)
# define IDM_SCREEN_AMBER (IDM_SCREEN+3)
# define IDM_SCREEN_GREEN (IDM_SCREEN+4)
# define IDM_SCREEN_WHITE (IDM_SCREEN+5)
#define IDM_GRAYSCALE (IDM_DISPLAY+20)
# define IDM_GRAY_601 (IDM_GRAYSCALE+1)
# define IDM_GRAY_709 (IDM_GRAYSCALE+2)
# define IDM_GRAY_AVE (IDM_GRAYSCALE+3)
#define IDM_FORCE_43 (IDM_DISPLAY+3)
#define IDM_CGA_CONTR (IDM_DISPLAY+4)
#define IDM_DISPLAY_END (IDM_CGA_CONTR+1)
/* TOOLS menu. */ /* TOOLS menu. */
#define IDM_TOOLS 40300 #define IDM_TOOLS (IDM_BASE+300)
#define IDM_SETTINGS (IDM_TOOLS+1) #define IDM_SETTINGS (IDM_TOOLS+1)
#define IDM_LOAD (IDM_TOOLS+2) #define IDM_LOAD (IDM_TOOLS+2)
#define IDM_SAVE (IDM_TOOLS+3) #define IDM_SAVE (IDM_TOOLS+3)
@@ -133,10 +144,13 @@
# define IDM_LOG_BREAKPOINT (IDM_LOGGING+99) # define IDM_LOG_BREAKPOINT (IDM_LOGGING+99)
#define IDM_STATUS (IDM_TOOLS+4) #define IDM_STATUS (IDM_TOOLS+4)
#define IDM_SCREENSHOT (IDM_TOOLS+5) #define IDM_SCREENSHOT (IDM_TOOLS+5)
#define IDM_TOOLS_END (IDM_SCREENSHOT+1)
/* HELP menu. */ /* HELP menu. */
#define IDM_HELP 40400 #define IDM_HELP (IDM_BASE+400)
# define IDM_ABOUT (IDM_HELP+1) #define IDM_ABOUT (IDM_HELP+1) /* fixed on WxWidgets */
#define IDM_END (IDM_HELP+99)
/* /*
* Status Bar commands. * Status Bar commands.
@@ -145,7 +159,7 @@
* and 5 bits for Removable Disks (5 bits for ID), so we use an * and 5 bits for Removable Disks (5 bits for ID), so we use an
* 8bit (256 entries) space for these devices. * 8bit (256 entries) space for these devices.
*/ */
#define IDM_SBAR 40960 /* 0x0a000 */ #define IDM_SBAR (IDM_BASE+1024)
#define IDM_FLOPPY_IMAGE_NEW (IDM_SBAR + 0x0000) #define IDM_FLOPPY_IMAGE_NEW (IDM_SBAR + 0x0000)
#define IDM_FLOPPY_IMAGE_EXISTING (IDM_SBAR + 0x0100) #define IDM_FLOPPY_IMAGE_EXISTING (IDM_SBAR + 0x0100)

View File

@@ -8,7 +8,7 @@
* *
* Common UI support functions for the Status Bar module. * Common UI support functions for the Status Bar module.
* *
* Version: @(#)ui_stbar.c 1.0.1 2018/04/29 * Version: @(#)ui_stbar.c 1.0.2 2018/04/29
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -210,76 +210,73 @@ ui_sb_tip_update(int tag)
drive = sb_tags[part] & 0x0f; drive = sb_tags[part] & 0x0f;
stransi = fdd_getname(fdd_get_type(drive)); stransi = fdd_getname(fdd_get_type(drive));
mbstowcs(temp, stransi, sizeof_w(temp)); mbstowcs(temp, stransi, sizeof_w(temp));
if (wcslen(floppyfns[drive]) == 0) { str = floppyfns[drive];
_swprintf(tip, plat_get_string(IDS_2158), if (*str == L'\0')
drive+1, temp, plat_get_string(IDS_2057)); str = plat_get_string(IDS_2057); /*"empty"*/
} else { swprintf(tip, sizeof_w(tip),
_swprintf(tip, plat_get_string(IDS_2158), plat_get_string(IDS_2158), drive+1, temp, str);
drive+1, temp, floppyfns[drive]);
}
break; break;
case SB_CDROM: case SB_CDROM:
drive = sb_tags[part] & 0x0f; drive = sb_tags[part] & 0x0f;
bus = cdrom_drives[drive].bus_type; bus = cdrom_drives[drive].bus_type;
id = IDS_4352 + (bus - 1); id = IDS_4352 + (bus - 1);
str = plat_get_string(id); wcscpy(temp, plat_get_string(id));
str = cdrom_image[drive].image_path;
if (*str == L'\0')
str = plat_get_string(IDS_2057); /*"empty"*/
if (cdrom_drives[drive].host_drive == 200) { if (cdrom_drives[drive].host_drive == 200) {
if (wcslen(cdrom_image[drive].image_path) == 0) { swprintf(tip, sizeof_w(tip),
_swprintf(tip, plat_get_string(IDS_5120), plat_get_string(IDS_5120),
drive+1, str, plat_get_string(IDS_2057)); drive+1, temp, str);
} else {
_swprintf(tip, plat_get_string(IDS_5120),
drive+1, str, cdrom_image[drive].image_path);
}
} else if ((cdrom_drives[drive].host_drive >= 'A') && } else if ((cdrom_drives[drive].host_drive >= 'A') &&
(cdrom_drives[drive].host_drive <= 'Z')) { (cdrom_drives[drive].host_drive <= 'Z')) {
_swprintf(temp, plat_get_string(IDS_2058), swprintf(temp, sizeof_w(temp),
plat_get_string(IDS_2058),
cdrom_drives[drive].host_drive & ~0x20); cdrom_drives[drive].host_drive & ~0x20);
_swprintf(tip, plat_get_string(IDS_5120), swprintf(tip, sizeof_w(tip),
drive+1, str, temp); plat_get_string(IDS_5120),
drive+1, plat_get_string(id), temp);
} else { } else {
_swprintf(tip, plat_get_string(IDS_5120), swprintf(tip, sizeof_w(tip),
drive+1, str, plat_get_string(IDS_2057)); plat_get_string(IDS_5120),
drive+1, temp, str);
} }
break; break;
case SB_ZIP: case SB_ZIP:
drive = sb_tags[part] & 0x0f; drive = sb_tags[part] & 0x0f;
type = zip_drives[drive].is_250 ? 250 : 100; type = zip_drives[drive].is_250 ? 250 : 100;
if (wcslen(zip_drives[drive].image_path) == 0) { str = zip_drives[drive].image_path;
_swprintf(tip, plat_get_string(IDS_2177), if (*str == L'\0')
drive+1, type, plat_get_string(IDS_2057)); str = plat_get_string(IDS_2057); /*"empty"*/
} else { swprintf(tip, sizeof_w(tip),
_swprintf(tip, plat_get_string(IDS_2177), plat_get_string(IDS_2177), drive+1, type, str);
drive+1, type, zip_drives[drive].image_path);
}
break; break;
case SB_RDISK: case SB_RDISK:
drive = sb_tags[part] & 0x1f; drive = sb_tags[part] & 0x1f;
if (wcslen(hdd[drive].fn) == 0) { str = hdd[drive].fn;
_swprintf(tip, plat_get_string(IDS_4115), if (*str == L'\0')
drive, plat_get_string(IDS_2057)); str = plat_get_string(IDS_2057); /*"empty"*/
} else { swprintf(tip, sizeof_w(tip),
_swprintf(tip, plat_get_string(IDS_4115), plat_get_string(IDS_4115), drive, str);
drive, hdd[drive].fn);
}
break; break;
case SB_HDD: case SB_HDD:
bus = sb_tags[part] & 0x0f; bus = sb_tags[part] & 0x0f;
id = IDS_4352 + (bus - 1); id = IDS_4352 + (bus - 1);
str = plat_get_string(id); str = plat_get_string(id);
_swprintf(tip, plat_get_string(IDS_4096), str); swprintf(tip, sizeof_w(tip),
plat_get_string(IDS_4096), str);
break; break;
case SB_NETWORK: case SB_NETWORK:
_swprintf(tip, plat_get_string(IDS_2069)); swprintf(tip, sizeof_w(tip), plat_get_string(IDS_2069));
break; break;
case SB_SOUND: case SB_SOUND:
_swprintf(tip, plat_get_string(IDS_2068)); swprintf(tip, sizeof_w(tip), plat_get_string(IDS_2068));
break; break;
default: default:
@@ -376,7 +373,7 @@ menu_cdrom(int part, int drive)
sb_menu_add_item(part, -1, NULL); sb_menu_add_item(part, -1, NULL);
for (i = 3; i < 26; i++) { for (i = 3; i < 26; i++) {
_swprintf(temp, L"Host CD/DVD Drive (%c:)", i+'A'); swprintf(temp, sizeof_w(temp), L"Host CD/DVD Drive (%c:)", i+'A');
if (host_cdrom_drive_available[i]) if (host_cdrom_drive_available[i])
sb_menu_add_item(part, IDM_CDROM_HOST_DRIVE | (i << 3)|drive, temp); sb_menu_add_item(part, IDM_CDROM_HOST_DRIVE | (i << 3)|drive, temp);
} }

View File

@@ -8,7 +8,7 @@
* *
* Application resource script for Windows. * Application resource script for Windows.
* *
* Version: @(#)VARCem.rc 1.0.22 2018/04/27 * Version: @(#)VARCem.rc 1.0.23 2018/04/30
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -35,20 +35,14 @@
* USA. * USA.
*/ */
#include <inttypes.h> #include <inttypes.h>
#define IN_RESOURCE_H #include <windows.h>
#include "../emu.h" #include "../emu.h"
#include "../version.h" #include "../version.h"
#include "../ui/ui.h" #include "../ui/ui.h"
#include "../ui/ui_resource.h" #include "../ui/ui_resource.h"
#include "../plat.h" #include "../plat.h"
#include "resource.h" #include "resource.h"
#undef IN_RESOURCE_H
//#define APSTUDIO_READONLY_SYMBOLS
//#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
//#undef APSTUDIO_READONLY_SYMBOLS
//#undef APSTUDIO_HIDDEN_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (U.S.) resources
@@ -71,8 +65,8 @@ BEGIN
MENUITEM "&Hard Reset", IDM_RESET_HARD MENUITEM "&Hard Reset", IDM_RESET_HARD
MENUITEM "&Ctrl+Alt+Del", IDM_RESET MENUITEM "&Ctrl+Alt+Del", IDM_RESET
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Ctrl+Alt+&Esc", IDM_CAE MENUITEM "Send Ctrl+Alt+&Esc", IDM_CAE
MENUITEM "Ctrl+Alt+&Break", IDM_CAB MENUITEM "Send Ctrl+Alt+&Break", IDM_CAB
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Pause", IDM_PAUSE MENUITEM "&Pause", IDM_PAUSE
MENUITEM SEPARATOR MENUITEM SEPARATOR
@@ -85,13 +79,13 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
POPUP "Re&nderer" POPUP "Re&nderer"
BEGIN BEGIN
MENUITEM "&DirectDraw", IDM_VID_DDRAW MENUITEM "&DirectDraw", IDM_RENDER_1
MENUITEM "Direct&3D 9", IDM_VID_D3D MENUITEM "Direct&3D 9", IDM_RENDER_2
#ifdef USE_VNC #ifdef USE_VNC
MENUITEM "&VNC", IDM_VID_VNC MENUITEM "&VNC", IDM_RENDER_3
#endif #endif
#ifdef USE_RDP #ifdef USE_RDP
MENUITEM "&RDP", IDM_VID_RDP MENUITEM "&RDP", IDM_RENDER_4
#endif #endif
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
@@ -112,32 +106,32 @@ BEGIN
MENUITEM "&Integer scale", IDM_STRETCH_INT MENUITEM "&Integer scale", IDM_STRETCH_INT
MENUITEM "&Keep size", IDM_STRETCH_KEEP MENUITEM "&Keep size", IDM_STRETCH_KEEP
END END
POPUP "E&GA/(S)VGA settings" MENUITEM SEPARATOR
MENUITEM "R&ight CTRL is left ALT", IDM_RCTRL_IS_LALT
MENUITEM SEPARATOR
MENUITEM "&Update status bar icons", IDM_UPDATE_ICONS
END
POPUP "&Display"
BEGIN BEGIN
MENUITEM "&Inverted VGA monitor", IDM_VGA_INVERT MENUITEM "&Inverted display", IDM_INVERT
MENUITEM "E&GA/(S)VGA overscan", IDM_VGA_OVERSCAN MENUITEM "Enable &overscan", IDM_OVERSCAN
POPUP "VGA screen &type" POPUP "Display &type"
BEGIN BEGIN
MENUITEM "RGB &Color", IDM_SCREEN_RGB MENUITEM "RGB &Color monitor", IDM_SCREEN_RGB
MENUITEM "&RGB Grayscale", IDM_SCREEN_GRAYSCALE MENUITEM "&Grayscale monitor", IDM_SCREEN_GRAYSCALE
MENUITEM "&Amber monitor", IDM_SCREEN_AMBER MENUITEM "&Amber monitor", IDM_SCREEN_AMBER
MENUITEM "&Green monitor", IDM_SCREEN_GREEN MENUITEM "&Green monitor", IDM_SCREEN_GREEN
MENUITEM "&White monitor", IDM_SCREEN_WHITE MENUITEM "&White monitor", IDM_SCREEN_WHITE
END END
POPUP "Grayscale &conversion type" POPUP "&Grayscale conversion type"
BEGIN BEGIN
MENUITEM "BT&601 (NTSC/PAL)", IDM_GRAY_601 MENUITEM "BT&601 (NTSC/PAL)", IDM_GRAY_601
MENUITEM "BT&709 (HDTV)", IDM_GRAY_709 MENUITEM "BT&709 (HDTV)", IDM_GRAY_709
MENUITEM "&Average", IDM_GRAY_AVE MENUITEM "&Average", IDM_GRAY_AVE
END END
END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "F&orce 4:3 display ratio", IDM_FORCE_43 MENUITEM "F&orce 4:3 display ratio", IDM_FORCE_43
MENUITEM "Change contrast for &monochrome display", IDM_CGA_CONTR MENUITEM "Change &contrast for monochrome display", IDM_CGA_CONTR
MENUITEM SEPARATOR
MENUITEM "R&ight CTRL is left ALT", IDM_RCTRL_IS_LALT
MENUITEM SEPARATOR
MENUITEM "&Update status bar icons", IDM_UPDATE_ICONS
END END
POPUP "&Tools" POPUP "&Tools"
BEGIN BEGIN
@@ -229,7 +223,11 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
END END
#endif #endif
MENUITEM "L&oad configuration", IDM_LOAD
MENUITEM "S&ave configuration", IDM_SAVE
MENUITEM SEPARATOR
MENUITEM "S&tatus", IDM_STATUS MENUITEM "S&tatus", IDM_STATUS
MENUITEM SEPARATOR
MENUITEM "Take s&creenshot\tCtrl+Home", IDM_SCREENSHOT MENUITEM "Take s&creenshot\tCtrl+Home", IDM_SCREENSHOT
END END
POPUP "&Help" POPUP "&Help"
@@ -474,11 +472,11 @@ DLG_CFG_INPUT DIALOG DISCARDABLE 97, 0, 267, 65
STYLE DS_CONTROL | WS_CHILD STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI" FONT 9, "Segoe UI"
BEGIN BEGIN
LTEXT "Mouse :",IDT_1709,7,8,57,10 LTEXT "Mouse:",IDT_1709,7,8,57,10
COMBOBOX IDC_COMBO_MOUSE,71,7,140,120,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_MOUSE,71,7,140,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_MOUSE,214,7,46,12 PUSHBUTTON "Configure",IDC_CONFIGURE_MOUSE,214,7,46,12
LTEXT "Joystick :",IDT_1710,7,26,58,10 LTEXT "Joystick:",IDT_1710,7,26,58,10
COMBOBOX IDC_COMBO_JOYSTICK,71,25,189,120,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_JOYSTICK,71,25,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Joystick 1...",IDC_JOY1,7,44,50,14 PUSHBUTTON "Joystick 1...",IDC_JOY1,7,44,50,14
@@ -748,7 +746,7 @@ END
261 ICON DISCARDABLE "icons/ports.ico" 261 ICON DISCARDABLE "icons/ports.ico"
262 ICON DISCARDABLE "icons/other_peripherals.ico" 262 ICON DISCARDABLE "icons/other_peripherals.ico"
263 ICON DISCARDABLE "icons/hard_disk.ico" 263 ICON DISCARDABLE "icons/hard_disk.ico"
264 ICON DISCARDABLE "/icons/floppy_drives.ico" 264 ICON DISCARDABLE "icons/floppy_drives.ico"
265 ICON DISCARDABLE "icons/other_removable_devices.ico" 265 ICON DISCARDABLE "icons/other_removable_devices.ico"
384 ICON DISCARDABLE "icons/floppy_525_empty.ico" 384 ICON DISCARDABLE "icons/floppy_525_empty.ico"
385 ICON DISCARDABLE "icons/floppy_525_empty_active.ico" 385 ICON DISCARDABLE "icons/floppy_525_empty_active.ico"

View File

@@ -8,7 +8,7 @@
* *
* Implement the user Interface module. * Implement the user Interface module.
* *
* Version: @(#)win_ui.c 1.0.15 2018/04/28 * Version: @(#)win_ui.c 1.0.16 2018/04/29
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -68,10 +68,6 @@ HMENU menuMain; /* application main menu */
HICON hIcon[512]; /* icon data loaded from resources */ HICON hIcon[512]; /* icon data loaded from resources */
RECT oldclip; /* mouse rect */ RECT oldclip; /* mouse rect */
int infocus = 1; int infocus = 1;
int rctrl_is_lalt = 0;
char openfilestring[260];
WCHAR wopenfilestring[260];
/* Local data. */ /* Local data. */
@@ -82,27 +78,6 @@ static int hook_enabled = 0;
static int save_window_pos = 0; static int save_window_pos = 0;
static int vis = -1;
/* Set host cursor visible or not. */
void
show_cursor(int val)
{
if (val == vis)
return;
if (val == 0) {
while (1) {
if (ShowCursor(FALSE) < 0) break;
}
} else {
ShowCursor(TRUE);
}
vis = val;
}
HICON HICON
LoadIconEx(PCTSTR pszIconName) LoadIconEx(PCTSTR pszIconName)
{ {
@@ -128,22 +103,6 @@ menu_update(void)
#endif #endif
/* Enable or disable a menu item. */
void
menu_enable_item(int idm, int val)
{
EnableMenuItem(menuMain, idm, (val) ? MF_ENABLED : MF_DISABLED);
}
/* Set (check) or clear (uncheck) a menu item. */
void
menu_set_item(int idm, int val)
{
CheckMenuItem(menuMain, idm, val ? MF_CHECKED : MF_UNCHECKED);
}
static LRESULT CALLBACK static LRESULT CALLBACK
LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{ {
@@ -180,7 +139,6 @@ LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK static LRESULT CALLBACK
MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
// HMENU hmenu;
RECT rect; RECT rect;
int sb_borders[3]; int sb_borders[3];
int temp_x, temp_y; int temp_x, temp_y;
@@ -197,8 +155,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND: case WM_COMMAND:
UpdateWindow(hwnd); UpdateWindow(hwnd);
// We may need this later.
// hmenu = GetMenu(hwnd);
idm = LOWORD(wParam); idm = LOWORD(wParam);
/* Let the general UI handle it first, and then we do. */ /* Let the general UI handle it first, and then we do. */
@@ -675,6 +631,58 @@ ui_window_title(wchar_t *s)
} }
/* Set host cursor visible or not. */
void
show_cursor(int val)
{
static int vis = -1;
if (val == vis)
return;
if (val == 0) {
while (1) {
if (ShowCursor(FALSE) < 0) break;
}
} else {
ShowCursor(TRUE);
}
vis = val;
}
/* Enable or disable a menu item. */
void
menu_enable_item(int idm, int val)
{
EnableMenuItem(menuMain, idm, (val) ? MF_ENABLED : MF_DISABLED);
}
/* Set (check) or clear (uncheck) a menu item. */
void
menu_set_item(int idm, int val)
{
CheckMenuItem(menuMain, idm, val ? MF_CHECKED : MF_UNCHECKED);
}
/* Set a radio group menu item. */
void
menu_set_radio_item(int idm, int num, int val)
{
int i;
if (val < 0) return;
for (i = 0; i < num; i++)
menu_set_item(idm + i, 0);
menu_set_item(idm + val, 1);
}
/* We should have the language ID as a parameter. */ /* We should have the language ID as a parameter. */
void void
plat_pause(int p) plat_pause(int p)