DPMS screen blanking support

This commit is contained in:
RichardG867
2021-04-13 14:07:21 -03:00
parent 71cbebb662
commit 76395e9fb6
5 changed files with 54 additions and 16 deletions

View File

@@ -115,6 +115,7 @@
#define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..." #define IDS_2139 2139 // "MO images (*.IM?)\0*.IM?..."
#define IDS_2140 2140 // "CD-ROM images (*.ISO;*.CU.." #define IDS_2140 2140 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2141 2141 // "%hs Device Configuration" #define IDS_2141 2141 // "%hs Device Configuration"
#define IDS_2142 2142 // "Monitor in sleep mode"
#define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i" #define IDS_4097 4097 // "%01i:%01i"
@@ -222,7 +223,7 @@
#define IDS_LANG_ENUS IDS_7168 #define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 94 #define STR_NUM_2048 95
#define STR_NUM_3072 11 #define STR_NUM_3072 11
#define STR_NUM_4096 39 #define STR_NUM_4096 39
#define STR_NUM_4352 6 #define STR_NUM_4352 6

View File

@@ -135,6 +135,7 @@ typedef struct svga_t
plane_mask, writemask, plane_mask, writemask,
colourcompare, colournocare, colourcompare, colournocare,
dac_mask, dac_status, dac_mask, dac_status,
dpms, dpms_ui,
ksc5601_sbyte_mask, ksc5601_udc_area_msb[2]; ksc5601_sbyte_mask, ksc5601_udc_area_msb[2];
int ksc5601_swap_mode; int ksc5601_swap_mode;

View File

@@ -34,6 +34,8 @@
#include <86box/pit.h> #include <86box/pit.h>
#include <86box/mem.h> #include <86box/mem.h>
#include <86box/rom.h> #include <86box/rom.h>
#include <86box/plat.h>
#include <86box/ui.h>
#include <86box/video.h> #include <86box/video.h>
#include <86box/vid_svga.h> #include <86box/vid_svga.h>
#include <86box/vid_svga_render.h> #include <86box/vid_svga_render.h>
@@ -574,12 +576,29 @@ svga_recalctimings(svga_t *svga)
svga->dispontime = TIMER_USEC; svga->dispontime = TIMER_USEC;
if (svga->dispofftime < TIMER_USEC) if (svga->dispofftime < TIMER_USEC)
svga->dispofftime = TIMER_USEC; svga->dispofftime = TIMER_USEC;
/* Inform the user interface of any DPMS mode changes. */
if (svga->dpms) {
if (!svga->dpms_ui) {
svga->dpms_ui = 1;
ui_sb_set_text_w(plat_get_string(IDS_2142));
}
} else if (svga->dpms_ui) {
svga->dpms_ui = 0;
ui_sb_set_text_w(NULL);
}
} }
static void static void
svga_do_render(svga_t *svga) svga_do_render(svga_t *svga)
{ {
/* Always render a blank screen and nothing else while in DPMS mode. */
if (svga->dpms) {
svga_render_blank(svga);
return;
}
if (!svga->override) { if (!svga->override) {
svga->render(svga); svga->render(svga);
@@ -1361,7 +1380,10 @@ svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
} else } else
suppress_overscan = 0; suppress_overscan = 0;
set_screen_size(xsize + x_add, ysize + y_add); /* Block resolution changes while in DPMS mode to avoid getting a bogus
screen width (320). We're already rendering a blank screen anyway. */
if (!svga->dpms)
set_screen_size(xsize + x_add, ysize + y_add);
if (video_force_resize_get()) if (video_force_resize_get())
video_force_resize_set(0); video_force_resize_set(0);

View File

@@ -1054,6 +1054,7 @@ BEGIN
IDS_2139 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0" IDS_2139 "MO images (*.IM?;*.MDI)\0*.IM?;*.MDI\0All files (*.*)\0*.*\0"
IDS_2140 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" IDS_2140 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0"
IDS_2141 "%hs Device Configuration" IDS_2141 "%hs Device Configuration"
IDS_2142 "Monitor in sleep mode"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE

View File

@@ -72,6 +72,8 @@ static int sb_ready = 0;
static uint8_t sb_map[256]; static uint8_t sb_map[256];
static int dpi = 96; static int dpi = 96;
static int icon_width = 24; static int icon_width = 24;
static wchar_t sb_text[512] = L"\0";
static wchar_t sb_bugtext[512] = L"\0";
/* Also used by win_settings.c */ /* Also used by win_settings.c */
intptr_t intptr_t
@@ -933,9 +935,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
} }
/* API */ static void
void ui_sb_update_text()
ui_sb_set_text_w(wchar_t *wstr)
{ {
uint8_t part = 0xff; uint8_t part = 0xff;
@@ -945,7 +946,19 @@ ui_sb_set_text_w(wchar_t *wstr)
part = sb_map[SB_TEXT]; part = sb_map[SB_TEXT];
if (part != 0xff) if (part != 0xff)
SendMessage(hwndSBAR, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM)wstr); SendMessage(hwndSBAR, SB_SETTEXT, part | SBT_NOBORDERS, (LPARAM)((sb_text[0] != L'\0') ? sb_text : sb_bugtext));
}
/* API */
void
ui_sb_set_text_w(wchar_t *wstr)
{
if (wstr)
wcscpy(sb_text, wstr);
else
memset(sb_text, 0x00, sizeof(sb_text));
ui_sb_update_text();
} }
@@ -953,11 +966,11 @@ ui_sb_set_text_w(wchar_t *wstr)
void void
ui_sb_set_text(char *str) ui_sb_set_text(char *str)
{ {
static wchar_t wstr[512]; if (str)
mbstowcs(sb_text, str, strlen(str) + 1);
memset(wstr, 0x00, sizeof(wstr)); else
mbstowcs(wstr, str, strlen(str) + 1); memset(sb_text, 0x00, sizeof(sb_text));
ui_sb_set_text_w(wstr); ui_sb_update_text();
} }
@@ -965,9 +978,9 @@ ui_sb_set_text(char *str)
void void
ui_sb_bugui(char *str) ui_sb_bugui(char *str)
{ {
static wchar_t wstr[512]; if (str)
mbstowcs(sb_bugtext, str, strlen(str) + 1);
memset(wstr, 0x00, sizeof(wstr)); else
mbstowcs(wstr, str, strlen(str) + 1); memset(sb_bugtext, 0x00, sizeof(sb_bugtext));
ui_sb_set_text_w(wstr); ui_sb_update_text();
} }