Skip to content
Snippets Groups Projects
Commit d95b5e91 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Eliminate GDI scaling. It's ugly and I hate it.

Also, fix up window behaviour... allow dragging it larger and smaller,
disable maximize, and don't allow snapping bigger or smaller than
the user area.

Finally, when r2y tables aren't installed, set the aspect ratio to
xsize x ysize so all the aspect "stuff" works properly.

With this, GDI is now the default output mode for Windows.  Auto
order is now:

X11 -> GDI -> SDL -> Win32 Console or Curses -> ANSI

Maybe for 2.0 I'll do a Wayland and Core Graphics driver too. :D
parent a9042e65
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4184 failed
......@@ -1615,9 +1615,24 @@ static int init_screens(int *width, int *height)
/***********************/
// Must be called with vstatlock
static void
get_scaled_win_size(int scale, bool wc, int *w, int *h, int maxwidth, int maxheight)
static bool
bitmap_width_controls(void)
{
bool wc;
if (vstat.aspect_width == 0 || vstat.aspect_height == 0)
wc = true;
else
wc = lround((double)(vstat.scrnheight * vstat.aspect_width) / vstat.aspect_height) <= vstat.scrnwidth;
return wc;
}
// Must be called with vstatlock
void
bitmap_get_scaled_win_size(int scale, int *w, int *h, int maxwidth, int maxheight)
{
bool wc = bitmap_width_controls();
*w = vstat.scrnwidth * scale;
*h = vstat.scrnheight * scale;
if (wc)
......@@ -1631,6 +1646,26 @@ get_scaled_win_size(int scale, bool wc, int *w, int *h, int maxwidth, int maxhei
aspect_fix_wc(w, h, wc, vstat.aspect_width, vstat.aspect_height);
}
// Must be called with vstatlock
int
bitmap_largest_mult_inside(int maxwidth, int maxheight)
{
bool wc = bitmap_width_controls();
int mult = 1;
int w, h;
if (wc)
mult = maxwidth / vstat.scrnwidth;
else
mult = maxheight / vstat.scrnheight;
for (;mult > 1; mult--) {
bitmap_get_scaled_win_size(mult, &w, &h, 0, 0);
if (w <= maxwidth && h <= maxheight)
break;
}
return mult;
}
// Must be called with vstatlock
void
bitmap_snap(bool grow, int maxwidth, int maxheight)
......@@ -1643,10 +1678,7 @@ bitmap_snap(bool grow, int maxwidth, int maxheight)
w = vstat.winwidth;
h = vstat.winheight;
if (vstat.aspect_width == 0 || vstat.aspect_height == 0)
wc = true;
else
wc = lround((double)(vstat.scrnheight * vstat.aspect_width) / vstat.aspect_height) <= vstat.scrnwidth;
wc = bitmap_width_controls();
if (wc) {
mult = vstat.winwidth / vstat.scrnwidth;
cw = vstat.winwidth;
......@@ -1667,7 +1699,7 @@ bitmap_snap(bool grow, int maxwidth, int maxheight)
if (mult < 1)
mult = 1;
do {
get_scaled_win_size(mult, wc, &vstat.winwidth, &vstat.winheight, maxwidth, maxheight);
bitmap_get_scaled_win_size(mult, &vstat.winwidth, &vstat.winheight, maxwidth, maxheight);
mult--;
} while ((vstat.winwidth > maxwidth || vstat.winheight > maxheight) && mult > 1);
}
......@@ -1693,7 +1725,6 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
int64_t bs;
int w, h;
int mult;
bool wc;
if(!bitmap_initialized)
return(-1);
......@@ -1745,18 +1776,14 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
cio_textinfo.winbottom=cio_textinfo.screenheight;
// Now calculate the closest diagonal new size that's smaller than max...
if (vstat.aspect_width == 0 || vstat.aspect_height == 0)
wc = true;
else
wc = lround((double)(vstat.scrnheight * vstat.aspect_width) / vstat.aspect_height) <= vstat.scrnwidth;
mult = 1;
get_scaled_win_size(mult, wc, &w, &h, maxwidth, maxheight);
bitmap_get_scaled_win_size(mult, &w, &h, maxwidth, maxheight);
bs = ((int64_t)w * w) + ((int64_t)h * h);
ls = bs;
ns = bs;
while (ns < os) {
mult++;
get_scaled_win_size(mult, wc, &w, &h, maxwidth, maxheight);
bitmap_get_scaled_win_size(mult, &w, &h, maxwidth, maxheight);
if ((maxwidth > 0) && (w > maxwidth)) {
mult--;
ns = ls;
......@@ -1775,7 +1802,7 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
if (mult > 1)
mult--;
}
get_scaled_win_size(mult, wc, &w, &h, maxwidth, maxheight);
bitmap_get_scaled_win_size(mult, &w, &h, maxwidth, maxheight);
vstat.winwidth = w;
vstat.winheight = h;
......
......@@ -57,6 +57,8 @@ void bitmap_drv_request_pixels(void);
void bitmap_drv_request_some_pixels(int x, int y, int width, int height);
void bitmap_drv_free_rect(struct rectlist *rect);
void bitmap_snap(bool grow, int maxwidth, int maxheight);
void bitmap_get_scaled_win_size(int scale, int *w, int *h, int maxwidth, int maxheight);
int bitmap_largest_mult_inside(int maxwidth, int maxheight);
#endif
#endif
......@@ -454,6 +454,9 @@ CIOLIBEXPORT int initciolib(int mode)
#ifndef NO_X
if(!try_x_init(mode))
#endif
#if defined(WITH_GDI)
if (!try_gdi_init(mode))
#endif
#if defined(WITH_SDL)
if(!try_sdl_init(CIOLIB_MODE_SDL))
#endif
......@@ -461,9 +464,6 @@ CIOLIBEXPORT int initciolib(int mode)
if(!try_conio_init(mode))
#else
if(!try_curses_init(mode))
#endif
#if defined(WITH_GDI)
if (!try_gdi_init(mode))
#endif
try_ansi_init(mode);
break;
......
......@@ -37,14 +37,8 @@ aspect_fix_wc(int *x, int *y, bool wc, int aspect_width, int aspect_height)
if (aspect_width == 0 || aspect_height == 0)
return;
if (r2yptr != NULL && y2rptr != NULL) {
bestx = lround((double)*y * aspect_width / aspect_height);
besty = lround((double)*x * aspect_height / aspect_width);
}
else {
bestx = lround((double)*y * *x / *y);
besty = lround((double)*x * *y / *x);
}
if (wc)
*y = besty;
......@@ -63,14 +57,8 @@ aspect_fix_inside(int *x, int *y, int aspect_width, int aspect_height)
if (aspect_width == 0 || aspect_height == 0)
return;
if (r2yptr != NULL && y2rptr != NULL) {
bestx = lround((double)*y * aspect_width / aspect_height);
besty = lround((double)*x * aspect_height / aspect_width);
}
else {
bestx = lround((double)*y * *x / *y);
besty = lround((double)*x * *y / *x);
}
if (besty <= *y)
*y = besty;
......@@ -92,14 +80,8 @@ aspect_fix(int *x, int *y, int aspect_width, int aspect_height)
// Nothing we can do here...
if (aspect_width == 0 || aspect_height == 0)
return;
if (r2yptr != NULL && y2rptr != NULL) {
bestx = lround((double)*y * aspect_width / aspect_height);
besty = lround((double)*x * aspect_height / aspect_width);
}
else {
bestx = lround((double)*y * *x / *y);
besty = lround((double)*x * *y / *x);
}
if (bestx < *x && besty > 0)
*y = besty;
......@@ -118,13 +100,8 @@ aspect_fix_low(int *x, int *y, int aspect_width, int aspect_height)
// Nothing we can do here...
if (aspect_width == 0 || aspect_height == 0)
return;
if (r2yptr != NULL && y2rptr != NULL) {
bestx = lround((double)*y * aspect_width / aspect_height);
besty = lround((double)*x * aspect_height / aspect_width);
} else {
bestx = lround((double)*y * *x / *y);
besty = lround((double)*x * *y / *x);
}
if (bestx < *x && bestx > 0)
*x = bestx;
......@@ -142,8 +119,6 @@ aspect_correct(int *x, int *y, int aspect_width, int aspect_height)
int width = *x;
int height;
if (r2yptr == NULL || y2rptr == NULL)
return;
if (!aspect_height || !aspect_width)
return;
height = lround((double)(width * aspect_height) / aspect_width);
......@@ -172,8 +147,6 @@ aspect_reverse(int *x, int *y, int scrnwidth, int scrnheight, int aspect_width,
int cheight;
int cwidth;
if (r2yptr == NULL || y2rptr == NULL)
return;
if (!aspect_height || !aspect_width) {
width = scrnwidth * (*x / scrnwidth);
if (width < scrnwidth)
......
......@@ -6,6 +6,7 @@
/* xpdev: */
#include <gen_defs.h> /* FREE_AND_NULL */
#include "scale.h"
#include "vidmodes.h"
// TODO: Pretty much all the 1:1 aspect ratios are wrong...
......@@ -374,7 +375,7 @@ int load_vmode(struct video_stats *vs, int mode)
vs->currattr = vparams[i].default_attr;
vs->aspect_width = vparams[i].aspect_width;
vs->aspect_height = vparams[i].aspect_height;
if (vs->aspect_width == 0 || vs->aspect_height == 0) {
if (vs->aspect_width == 0 || vs->aspect_height == 0 || r2yptr == NULL || y2rptr == NULL) {
vs->aspect_width = vs->scrnwidth;
vs->aspect_height = vs->scrnheight;
}
......@@ -386,6 +387,10 @@ int load_vmode(struct video_stats *vs, int mode)
vs->scrnheight = vparams[i].yres;
else
vs->scrnheight = vs->charheight * vs->rows;
if (vs->aspect_width == 0 || vs->aspect_height == 0 || r2yptr == NULL || y2rptr == NULL) {
vs->aspect_width = vs->scrnwidth;
vs->aspect_height = vs->scrnheight;
}
vs->forced_font = NULL;
return(0);
}
......@@ -17,7 +17,7 @@ static HANDLE rch;
static HANDLE wch;
static bool maximized = false;
static uint16_t winxpos, winypos;
static const DWORD style = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
static const DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_VISIBLE;
static HCURSOR cursor;
static HANDLE init_sem;
static int xoff, yoff;
......@@ -56,7 +56,6 @@ static pthread_mutex_t gdi_headlock;
static pthread_mutex_t winpos_lock;
static pthread_mutex_t rect_lock;
static pthread_mutex_t off_lock;
static bool ciolib_scaling = false;
// Internal implementation
......@@ -166,29 +165,6 @@ sp_to_codepoint(uint16_t high, uint16_t low)
return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;
}
// vstatlock must be held
static void
set_ciolib_scaling(void)
{
int w, h;
int fw, fh;
w = vstat.winwidth;
h = vstat.winheight;
aspect_fix_inside(&w, &h, vstat.aspect_width, vstat.aspect_height);
fw = w;
fh = h;
aspect_reverse(&w, &h, vstat.scrnwidth, vstat.scrnheight, vstat.aspect_width, vstat.aspect_height);
if ((fw == w) || (fh == h)) {
if (fw > vstat.winwidth || fh > vstat.winheight)
ciolib_scaling = false;
else
ciolib_scaling = true;
}
else
ciolib_scaling = false;
}
static bool
UnadjustWindowSize(int *w, int *h)
{
......@@ -206,8 +182,9 @@ UnadjustWindowSize(int *w, int *h)
static LRESULT
gdi_handle_wm_size(WPARAM wParam, LPARAM lParam)
{
RECT r;
int w, h;
int ww, wh;
int mult;
switch (wParam) {
case SIZE_MAXIMIZED:
......@@ -218,19 +195,53 @@ gdi_handle_wm_size(WPARAM wParam, LPARAM lParam)
maximized = false;
break;
}
if (wParam == SIZE_MINIMIZED)
return 0;
w = lParam & 0xffff;
h = (lParam >> 16) & 0xffff;
pthread_mutex_lock(&vstatlock);
vstat.winwidth = w;
vstat.winheight = h;
set_ciolib_scaling();
mult = bitmap_largest_mult_inside(w, h);
bitmap_get_scaled_win_size(mult, &w, &h, 0, 0);
if (w != vstat.winwidth || h != vstat.winheight) {
gdi_setwinsize(w, h);
}
pthread_mutex_unlock(&vstatlock);
return 0;
}
static LRESULT
gdi_handle_wm_sizing(WPARAM wParam, RECT *rect)
{
int w, h;
int mult;
mult = bitmap_largest_mult_inside(w, h);
bitmap_get_scaled_win_size(mult, &w, &h, 0, 0);
switch(wParam) {
case WMSZ_BOTTOM:
case WMSZ_BOTTOMLEFT:
case WMSZ_LEFT:
rect->bottom = rect->top + h;
rect->left = rect->right - w;
break;
case WMSZ_BOTTOMRIGHT:
case WMSZ_RIGHT:
rect->bottom = rect->top + h;
rect->right = rect->left + w;
break;
case WMSZ_TOP:
case WMSZ_TOPLEFT:
rect->top = rect->bottom - h;
rect->left = rect->right - w;
break;
case WMSZ_TOPRIGHT:
rect->right = rect->left + w;
break;
}
return TRUE;
}
static LRESULT
gdi_handle_wm_paint(HWND hwnd)
{
......@@ -261,7 +272,6 @@ gdi_handle_wm_paint(HWND hwnd)
sw = vstat.scrnwidth;
sh = vstat.scrnheight;
pthread_mutex_unlock(&vstatlock);
if (ciolib_scaling) {
calc_scaling_factors(&xscale, &yscale, w, h, aw, ah, sw, sh);
gb = do_scale(list, xscale, yscale, aw, ah);
if (di == NULL || diw != gb->w || dih != gb->h) {
......@@ -281,38 +291,12 @@ gdi_handle_wm_paint(HWND hwnd)
pthread_mutex_unlock(&off_lock);
}
pthread_mutex_lock(&off_lock);
if (maximized) {
xoff = (w - diw) / 2;
yoff = (h - dih) / 2;
pthread_mutex_unlock(&off_lock);
data = gb->data;
}
else {
if (di != NULL || diw != list->rect.width || dih != list->rect.height) {
if (di != NULL) {
DeleteObject(di);
di = NULL;
}
diw = list->rect.width;
b5hdr.bV5Width = list->rect.width;
dih = list->rect.height;
b5hdr.bV5Height = -list->rect.height;
b5hdr.bV5SizeImage = list->rect.width * list->rect.height * 4;
}
data = list->data;
if (lww != w || lwh != h) {
sww = w;
swh = h;
aspect_fix_inside(&sww, &swh, aw, ah);
pthread_mutex_lock(&off_lock);
xoff = (w - sww) / 2;
yoff = (h - swh) / 2;
dwidth = sww;
dheight = swh;
pthread_mutex_unlock(&off_lock);
lww = w;
lwh = h;
}
}
data = gb->data;
winDC = BeginPaint(hwnd, &ps);
if (memDC == NULL) {
memDC = CreateCompatibleDC(winDC);
......@@ -324,26 +308,27 @@ gdi_handle_wm_paint(HWND hwnd)
// Clear to black first
di = SelectObject(memDC, di);
pthread_mutex_lock(&off_lock);
if (ciolib_scaling) {
BitBlt(winDC, xoff, yoff, dwidth, dheight, memDC, 0, 0, SRCCOPY);
}
else {
StretchBlt(winDC, xoff, yoff, dwidth, dheight, memDC, 0, 0, diw, dih, SRCCOPY);
}
if (xoff > 0) {
BitBlt(winDC, 0, 0, xoff - 1, dheight, memDC, 0, 0, BLACKNESS);
BitBlt(winDC, 0, 0, xoff - 1, h, memDC, 0, 0, BLACKNESS);
BitBlt(winDC, xoff + dwidth, 0, w, h, memDC, 0, 0, BLACKNESS);
}
else if (yoff > 0) {
else {
if (dwidth != w)
BitBlt(winDC, dwidth, 0, w, h, memDC, 0, 0, BLACKNESS);
}
if (yoff > 0) {
BitBlt(winDC, 0, 0, w, yoff - 1, memDC, 0, 0, BLACKNESS);
BitBlt(winDC, 0, yoff + dheight, w, h, memDC, 0, 0, BLACKNESS);
}
else {
if (dheight != h)
BitBlt(winDC, 0, dheight, w, h, memDC, 0, 0, BLACKNESS);
}
pthread_mutex_unlock(&off_lock);
EndPaint(hwnd, &ps);
di = SelectObject(memDC, di);
if (ciolib_scaling) {
release_buffer(gb);
}
return 0;
}
......@@ -457,6 +442,63 @@ gdi_handle_activate(HWND hwnd, WPARAM wParam)
return 0;
}
static bool
gdi_get_monitor_size(int *w, int *h)
{
HMONITOR mon;
MONITORINFO mi;
bool ret;
mon = MonitorFromWindow(win, MONITOR_DEFAULTTOPRIMARY);
mi.cbSize = sizeof(mi);
ret = GetMonitorInfoW(mon, &mi);
*w = mi.rcWork.right - mi.rcWork.left;
*h = mi.rcWork.bottom - mi.rcWork.top;
return ret;
}
static LRESULT
handle_wm_getminmaxinfo(MINMAXINFO *inf)
{
int monw, monh;
int minw, minh;
int maxw, maxh;
int mult;
RECT r;
gdi_get_monitor_size(&monw, &monh);
maxw = monw;
maxh = monh;
UnadjustWindowSize(&maxw, &maxh);
pthread_mutex_lock(&vstatlock);
mult = bitmap_largest_mult_inside(maxw, maxh);
bitmap_get_scaled_win_size(mult, &maxw, &maxh, 0, 0);
bitmap_get_scaled_win_size(1, &minw, &minh, 0, 0);
pthread_mutex_unlock(&vstatlock);
r.top = 0;
r.left = 0;
r.right = maxw;
r.bottom = maxh;
AdjustWindowRect(&r, style, FALSE);
inf->ptMaxTrackSize.x = r.right - r.left;
inf->ptMaxTrackSize.y = r.bottom - r.top;
inf->ptMaxSize.x = inf->ptMaxTrackSize.x;
inf->ptMaxSize.y = inf->ptMaxTrackSize.y;
inf->ptMaxPosition.x = (monw - inf->ptMaxTrackSize.x) / 2;
inf->ptMaxPosition.y = (monh - inf->ptMaxTrackSize.y) / 2;
r.top = 0;
r.left = 0;
r.right = minw;
r.bottom = minh;
AdjustWindowRect(&r, style, FALSE);
inf->ptMinTrackSize.x = r.right - r.left;
inf->ptMinTrackSize.y = r.bottom - r.top;
return 0;
}
static LRESULT CALLBACK
gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
POINT p;
......@@ -475,6 +517,8 @@ gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return 0;
case WM_SIZE:
return gdi_handle_wm_size(wParam, lParam);
//case WM_SIZING:
// return gdi_handle_wm_sizing(wParam, (RECT *)lParam);
case WM_DESTROY:
PostQuitMessage(0);
return 0;
......@@ -496,6 +540,14 @@ gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return gdi_handle_mouse_button(lParam, CIOLIB_BUTTON_RELEASE(3));
case WM_ACTIVATE:
return gdi_handle_activate(hwnd, wParam);
case WM_GETMINMAXINFO:
return handle_wm_getminmaxinfo((MINMAXINFO *)lParam);
case WM_SETCURSOR:
if ((lParam & 0xffff) == HTCLIENT) {
SetCursor(cursor);
return 0;
}
break;
case WM_USER_SETCURSOR:
if (!GetClientRect(hwnd, &r))
break;
......@@ -507,32 +559,27 @@ gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
break;
SetCursor(cursor);
break;
case WM_SETCURSOR:
if ((lParam & 0xffff) == HTCLIENT) {
SetCursor(cursor);
return 0;
}
break;
case WM_USER_INVALIDATE:
InvalidateRect(win, NULL, FALSE);
return true;
case WM_USER_SETSIZE:
pthread_mutex_lock(&vstatlock);
// Now make the inside of the window the size we want (sigh)
r.left = r.top = 0;
r.right = wParam;
r.bottom = lParam;
pthread_mutex_unlock(&vstatlock);
AdjustWindowRect(&r, style, FALSE);
SetWindowPos(win, NULL, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
return true;
case WM_USER_SETPOS:
SetWindowPos(win, NULL, wParam, lParam, 0, 0, SWP_NOSIZE|SWP_NOOWNERZORDER|SWP_NOZORDER);
return true;
}
return DefWindowProcW(hwnd, msg, wParam, lParam);
}
static bool
gdi_get_monitor_size(int *w, int *h)
{
HMONITOR mon;
MONITORINFO mi;
bool ret;
mon = MonitorFromWindow(win, MONITOR_DEFAULTTOPRIMARY);
mi.cbSize = sizeof(mi);
ret = GetMonitorInfoW(mon, &mi);
*w = mi.rcWork.right - mi.rcWork.left;
*h = mi.rcWork.bottom - mi.rcWork.top;
return ret;
}
static void
gdi_snap(bool grow)
{
......@@ -544,7 +591,6 @@ gdi_snap(bool grow)
UnadjustWindowSize(&mw, &mh);
pthread_mutex_lock(&vstatlock);
bitmap_snap(grow, mw, mh);
set_ciolib_scaling();
gdi_setwinsize(vstat.winwidth, vstat.winheight);
pthread_mutex_unlock(&vstatlock);
}
......@@ -564,25 +610,10 @@ magic_message(MSG msg)
int *hack;
RECT r;
/* Note that some messages go directly to gdi_WndProc(), so we can't
* put generic stuff in here.
*/
switch(msg.message) {
// User messages
case WM_USER_INVALIDATE:
InvalidateRect(win, NULL, FALSE);
return true;
case WM_USER_SETSIZE:
pthread_mutex_lock(&vstatlock);
// Now make the inside of the window the size we want (sigh)
r.left = r.top = 0;
r.right = vstat.winwidth = msg.wParam;
r.bottom = vstat.winheight = msg.lParam;
pthread_mutex_unlock(&vstatlock);
AdjustWindowRect(&r, style, FALSE);
SetWindowPos(win, NULL, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
return true;
case WM_USER_SETPOS:
SetWindowPos(win, NULL, msg.wParam, msg.lParam, 0, 0, SWP_NOSIZE|SWP_NOOWNERZORDER|SWP_NOZORDER);
return true;
// Keyboard stuff
case WM_KEYDOWN:
case WM_KEYUP:
......@@ -671,7 +702,9 @@ gdi_thread(void *arg)
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = gdi_WndProc;
// This is actually required or the link will fail (it can be overwritten though)
wc.hInstance = WinMainHInst;
//wc.hInstance = GetModuleHandleW(NULL);
wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(1));
wc.hCursor = LoadCursor(NULL, IDC_IBEAM);
wc.hbrBackground = NULL;
......@@ -687,7 +720,7 @@ gdi_thread(void *arg)
r.bottom = vstat.winheight;
pthread_mutex_unlock(&vstatlock);
AdjustWindowRect(&r, style, FALSE);
win = CreateWindowW(wc.lpszClassName, L"SyncConsole", style, CW_USEDEFAULT, CW_USEDEFAULT, r.right - r.left, r.bottom - r.top, NULL, NULL, wc.hInstance, NULL);
win = CreateWindowW(wc.lpszClassName, L"SyncConsole", style, CW_USEDEFAULT, CW_USEDEFAULT, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
ReleaseSemaphore(init_sem, 1, NULL);
while (GetMessage(&msg, NULL, 0, 0)) {
......@@ -750,7 +783,6 @@ gdi_textmode(int mode)
gdi_get_monitor_size(&mw, &mh);
UnadjustWindowSize(&mw, &mh);
bitmap_drv_init_mode(mode, NULL, NULL, mw, mh);
set_ciolib_scaling();
gdi_setwinsize(vstat.winwidth, vstat.winheight);
pthread_mutex_unlock(&vstatlock);
bitmap_drv_request_pixels();
......@@ -901,7 +933,7 @@ gdi_init(int mode)
CreatePipe(&rch, &wch, NULL, 0);
bitmap_drv_init(gdi_drawrect, gdi_flush);
gdi_textmode(mode);
gdi_textmode(C80);
// code that tells windows we're High DPI aware so it doesn't scale our windows
// taken from Yamagi Quake II
......@@ -944,6 +976,7 @@ gdi_init(int mode)
_beginthread(gdi_thread, 0, NULL);
WaitForSingleObject(init_sem, INFINITE);
CloseHandle(init_sem);
gdi_textmode(C80);
cio_api.mode=CIOLIB_MODE_GDI;
FreeConsole();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment