Updates to no longer have the selected machine's data as a global variable.

Fixed the 'crash on unknown machine name in config' bug.
Fixed some issues with the ROM loader, PS/2 M50 still doesnt work.
Made the error message from dynld.c a DEBUG message.
Fixed some stuff in the VNC driver (pending changes in the VNC DLL.)
Cleaned up the MinGW Makefile, VC will follow.
Added screenshots code to the D2D renderer.
This commit is contained in:
waltje
2019-04-29 21:02:42 -05:00
parent e82c985f7a
commit bbab8fecd7
18 changed files with 418 additions and 376 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.45 2019/04/08 * Version: @(#)config.c 1.0.46 2019/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>
@@ -397,7 +397,8 @@ load_machine(const char *cat)
machine_type = machine_get_from_internal_name(p); machine_type = machine_get_from_internal_name(p);
else else
machine_type = -1; machine_type = -1;
(void)machine_load(); if (machine_load() == NULL)
machine_type = -1;
cpu_manufacturer = config_get_int(cat, "cpu_manufacturer", 0); cpu_manufacturer = config_get_int(cat, "cpu_manufacturer", 0);
cpu_type = config_get_int(cat, "cpu", 0); cpu_type = config_get_int(cat, "cpu", 0);
@@ -464,13 +465,13 @@ load_video(const char *cat)
{ {
char *p; char *p;
if (machine->flags_fixed & MACHINE_VIDEO) { if (machine_get_flags_fixed() & MACHINE_VIDEO) {
config_delete_var(cat, "video_card"); config_delete_var(cat, "video_card");
video_card = VID_INTERNAL; video_card = VID_INTERNAL;
} else { } else {
p = config_get_string(cat, "video_card", NULL); p = config_get_string(cat, "video_card", NULL);
if (p == NULL) { if (p == NULL) {
if (machine->flags & MACHINE_VIDEO) if (machine_get_flags() & MACHINE_VIDEO)
p = "internal"; p = "internal";
else else
p = "none"; p = "none";
@@ -800,7 +801,7 @@ load_other(const char *cat)
p = config_get_string(cat, "hdc", NULL); p = config_get_string(cat, "hdc", NULL);
if (p == NULL) { if (p == NULL) {
if (machine->flags & MACHINE_HDC) if (machine_get_flags() & MACHINE_HDC)
p = "internal"; p = "internal";
else else
p = "none"; p = "none";

View File

@@ -8,7 +8,7 @@
* *
* Common code to handle all sorts of disk controllers. * Common code to handle all sorts of disk controllers.
* *
* Version: @(#)hdc.c 1.0.18 2019/04/20 * Version: @(#)hdc.c 1.0.19 2019/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>
@@ -129,7 +129,7 @@ void
hdc_reset(void) hdc_reset(void)
{ {
INFO("HDC: reset(current=%d, internal=%d)\n", INFO("HDC: reset(current=%d, internal=%d)\n",
hdc_type, !!(machine->flags & MACHINE_HDC)); hdc_type, !!(machine_get_flags() & MACHINE_HDC));
/* If we have a valid controller, add its device. */ /* If we have a valid controller, add its device. */
if (controllers[hdc_type].device != NULL) if (controllers[hdc_type].device != NULL)

View File

@@ -189,7 +189,7 @@
* including the later update (DS12887A) which implemented a * including the later update (DS12887A) which implemented a
* "century" register to be compatible with Y2K. * "century" register to be compatible with Y2K.
* *
* Version: @(#)nvr_at.c 1.0.16 2019/04/26 * Version: @(#)nvr_at.c 1.0.17 2019/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>
@@ -515,6 +515,7 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
local_t *local = (local_t *)nvr->data; local_t *local = (local_t *)nvr->data;
struct tm tm; struct tm tm;
uint8_t old; uint8_t old;
int f;
cycles -= ISA_CYCLES(8); cycles -= ISA_CYCLES(8);
@@ -562,7 +563,8 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
} }
} else { } else {
local->addr = (val & (nvr->size - 1)); local->addr = (val & (nvr->size - 1));
if (!(machine->flags&MACHINE_MCA) && !(machine->flags&MACHINE_NONMI)) f = machine_get_flags();
if (!(f & MACHINE_MCA) && !(f & MACHINE_NONMI))
nmi_mask = (~val & 0x80); nmi_mask = (~val & 0x80);
} }
} }
@@ -667,7 +669,7 @@ nvr_at_init(const device_t *info, UNUSED(void *parent))
nvr->data = local; nvr->data = local;
/* This is machine specific. */ /* This is machine specific. */
nvr->size = machine->nvrsz; nvr->size = machine_get_nvrsize();
switch(info->local) { switch(info->local) {
case 0: /* standard AT (no century register) */ case 0: /* standard AT (no century register) */
nvr->irq = 8; nvr->irq = 8;

View File

@@ -8,7 +8,7 @@
* *
* Main video-rendering module. * Main video-rendering module.
* *
* Version: @(#)video.c 1.0.28 2019/04/19 * Version: @(#)video.c 1.0.29 2019/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>
@@ -811,15 +811,14 @@ video_reset(void)
const device_t *dev; const device_t *dev;
INFO("VIDEO: reset (video_card=%i, internal=%i)\n", INFO("VIDEO: reset (video_card=%i, internal=%i)\n",
video_card, (machine->flags & MACHINE_VIDEO) ? 1 : 0); video_card, (machine_get_flags() & MACHINE_VIDEO) ? 1 : 0);
/* Initialize the video font tables. */ /* Initialize the video font tables. */
video_load_font(MDA_FONT_ROM_PATH, FONT_MDA); video_load_font(MDA_FONT_ROM_PATH, FONT_MDA);
/* Do not initialize internal cards here. */ /* Do not initialize internal cards here. */
if ((video_card == VID_NONE) || \ if ((video_card == VID_NONE) || (video_card == VID_INTERNAL) || \
(video_card == VID_INTERNAL) || \ (machine_get_flags_fixed() & MACHINE_VIDEO)) return;
(machine->flags_fixed & MACHINE_VIDEO)) return;
/* Configure default timing parameters for the card. */ /* Configure default timing parameters for the card. */
video_inform(VID_TYPE_SPEC, NULL); video_inform(VID_TYPE_SPEC, NULL);

View File

@@ -69,7 +69,7 @@
* FIXME: Find a new way to handle the switching of color/mono on * FIXME: Find a new way to handle the switching of color/mono on
* external cards. New video_get_type(int card) function? * external cards. New video_get_type(int card) function?
* *
* Version: @(#)m_europc.c 1.0.22 2019/04/23 * Version: @(#)m_europc.c 1.0.23 2019/04/29
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -561,7 +561,7 @@ europc_init(const device_t *info, void *arg)
dev->jim = (i == 1) ? 0x0350 : 0x0250; dev->jim = (i == 1) ? 0x0350 : 0x0250;
/* Set up and initialize the NVR. */ /* Set up and initialize the NVR. */
dev->nvr.size = machine->nvrsz; dev->nvr.size = machine_get_nvrsize();
dev->nvr.irq = -1; dev->nvr.irq = -1;
dev->nvr.reset = rtc_reset; dev->nvr.reset = rtc_reset;
dev->nvr.start = rtc_start; dev->nvr.start = rtc_start;

View File

@@ -48,7 +48,7 @@
* *
* This works around the timing loop mentioned above. * This works around the timing loop mentioned above.
* *
* Version: @(#)m_ps2_mca.c 1.0.23 2019/04/27 * Version: @(#)m_ps2_mca.c 1.0.24 2019/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>
@@ -1493,12 +1493,9 @@ ps2_init(const device_t *info, void *arg)
} }
static const CPU cpus_ps2_m30_286[] = { static const CPU cpus_ps2_m50[] = {
{ "286/10", CPU_286, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2, 1 }, { "286/10", CPU_286, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2, 1 },
{ "286/12", CPU_286, 12000000, 1, 0, 0, 0, 0, 0, 3,3,3,3, 2 }, { "286/12", CPU_286, 12000000, 1, 0, 0, 0, 0, 0, 3,3,3,3, 2 },
{ "286/16", CPU_286, 16000000, 1, 0, 0, 0, 0, 0, 3,3,3,3, 2 },
{ "286/20", CPU_286, 20000000, 1, 0, 0, 0, 0, 0, 4,4,4,4, 3 },
{ "286/25", CPU_286, 25000000, 1, 0, 0, 0, 0, 0, 4,4,4,4, 3 },
{ NULL } { NULL }
}; };
@@ -1506,11 +1503,11 @@ static const machine_t m50_info = {
MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO | MACHINE_HDC_PS2, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_VIDEO | MACHINE_HDC_PS2,
0, 0,
1, 10, 1, 64, -1, 1, 10, 1, 64, -1,
{{"",cpus_ps2_m30_286}} //FIXME:??? is for M30-286! {{"",cpus_ps2_m50}}
}; };
const device_t m_ps2_m50 = { const device_t m_ps2_m50 = {
"IBM PS/2 M50", "IBM PS/2 M50 Type 1",
DEVICE_ROOT, DEVICE_ROOT,
50, 50,
L"ibm/ps2_m50", L"ibm/ps2_m50",
@@ -1529,7 +1526,7 @@ static const machine_t m55_info = {
}; };
const device_t m_ps2_m55sx = { const device_t m_ps2_m55sx = {
"IBM PS/2 M50", "IBM PS/2 M55SX",
DEVICE_ROOT, DEVICE_ROOT,
55, 55,
L"ibm/ps2_m55sx", L"ibm/ps2_m55sx",

View File

@@ -96,7 +96,7 @@
* *
* FIXME: The ROM drive should be re-done using the "option file". * FIXME: The ROM drive should be re-done using the "option file".
* *
* Version: @(#)m_tosh1x00.c 1.0.18 2019/04/11 * Version: @(#)m_tosh1x00.c 1.0.19 2019/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>
@@ -1027,7 +1027,7 @@ t1000_init(const device_t *info, void *arg)
device_add(&keyboard_xt_device); device_add(&keyboard_xt_device);
tc8521_init(&dev->nvr, machine->nvrsz); tc8521_init(&dev->nvr, machine_get_nvrsize());
if (dev->is_t1200) { if (dev->is_t1200) {
dev->fdc = (fdc_t *)device_add(&fdc_toshiba_device); dev->fdc = (fdc_t *)device_add(&fdc_toshiba_device);

View File

@@ -8,7 +8,7 @@
* *
* Handling of the emulated machines. * Handling of the emulated machines.
* *
* Version: @(#)machine.c 1.0.20 2019/04/19 * Version: @(#)machine.c 1.0.21 2019/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>
@@ -56,10 +56,7 @@
#include "machine.h" #include "machine.h"
const machine_t *machine; static const machine_t *machine = NULL;
static void *m_priv;
/* Get the machine definition for the selected machine. */ /* Get the machine definition for the selected machine. */
@@ -124,7 +121,7 @@ machine_reset(void)
rom_add_bios(); rom_add_bios();
/* All good, boot the machine! */ /* All good, boot the machine! */
m_priv = dev->init(dev, &roms); (void)dev->init(dev, &roms);
} }
@@ -141,14 +138,56 @@ machine_get_flags(void)
} }
/* Return the current machine's 'fixed devices' flags. */
int
machine_get_flags_fixed(void)
{
int ret = 0;
if (machine != NULL)
ret = machine->flags_fixed;
return(ret);
}
/* Return a machine's maximum memory size. */
int
machine_get_maxmem(void)
{
int ret = 0;
if (machine != NULL)
ret = machine->max_ram;
return(ret);
}
/* Return a machine's NVR size. */
int
machine_get_nvrsize(void)
{
int ret = 0;
if (machine != NULL)
ret = machine->nvrsz;
return(ret);
}
/* Return a machine's (adjusted) memory size. */ /* Return a machine's (adjusted) memory size. */
int int
machine_get_memsize(int mem) machine_get_memsize(int mem)
{ {
int k; int k = 0;
k = ((machine->flags & MACHINE_AT) && (machine->ram_granularity < 128)) if (machine != NULL) {
? machine->min_ram * 1024 : machine->min_ram; k = machine->min_ram;
if ((machine->flags & MACHINE_AT) && (machine->ram_granularity < 128))
k *= 1024;
}
if (mem < k) if (mem < k)
mem = k; mem = k;

View File

@@ -8,7 +8,7 @@
* *
* Handling of the emulated machines. * Handling of the emulated machines.
* *
* Version: @(#)machine.h 1.0.31 2019/04/23 * Version: @(#)machine.h 1.0.32 2019/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>
@@ -83,9 +83,6 @@ typedef struct {
/* Global variables. */ /* Global variables. */
extern const machine_t *machine;
#ifdef EMU_DEVICE_H #ifdef EMU_DEVICE_H
extern const device_t m_pc81, extern const device_t m_pc81,
m_pc82; m_pc82;
@@ -242,7 +239,10 @@ extern const char *machine_get_internal_name(void);
extern const device_t *machine_get_device(void); extern const device_t *machine_get_device(void);
#endif #endif
extern int machine_get_flags(void); extern int machine_get_flags(void);
extern int machine_get_flags_fixed(void);
extern int machine_get_maxmem(void);
extern int machine_get_memsize(int memsz); extern int machine_get_memsize(int memsz);
extern int machine_get_nvrsize(void);
extern uint32_t machine_get_speed(int turbo); extern uint32_t machine_get_speed(int turbo);
extern const char *machine_get_name_ex(int m); extern const char *machine_get_name_ex(int m);

View File

@@ -12,7 +12,7 @@
* The Port92 stuff should be moved to devices/system/memctl.c * The Port92 stuff should be moved to devices/system/memctl.c
* as a standard device. * as a standard device.
* *
* Version: @(#)mem.c 1.0.33 2019/04/27 * Version: @(#)mem.c 1.0.34 2019/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>
@@ -1441,7 +1441,7 @@ mem_reset(void)
* nasty crashes all over the place. * nasty crashes all over the place.
*/ */
m = mem_size; m = mem_size;
c = machine->max_ram; c = machine_get_maxmem();
if (AT) if (AT)
c <<= 10; /* make KB */ c <<= 10; /* make KB */
if (m > c) { if (m > c) {

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.71 2019/04/26 * Version: @(#)pc.c 1.0.72 2019/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>
@@ -226,16 +226,20 @@ pclog_ex(const char *fmt, va_list ap)
} }
} }
if (logdetect) {
vsprintf(temp, fmt, ap); vsprintf(temp, fmt, ap);
if (logdetect && !strcmp(logbuff, temp)) { if (strcmp(logbuff, temp)) {
logseen++;
} else {
if (logseen) if (logseen)
fprintf(logfp, "*** %i repeats ***\n", logseen); fprintf(logfp, "*** %i repeats ***\n", logseen);
logseen = 0; logseen = 0;
if (logdetect) if (logdetect)
strcpy(logbuff, temp); strcpy(logbuff, temp);
fprintf(logfp, temp, ap); fprintf(logfp, temp);
} else
logseen++;
} else {
/* Not detecting duplicates, do not buffer. */
vfprintf(logfp, fmt, ap);
} }
fflush(logfp); fflush(logfp);

View File

@@ -282,6 +282,7 @@ rom_load_interleaved(const wchar_t *fnl, const wchar_t *fnh, uint32_t addr, int
addr = 0; addr = 0;
else else
addr &= 0x03ffff; addr &= 0x03ffff;
INFO("ROM: loading %i bytes at %06lx\n", sz, addr);
(void)fseek(fl, off, SEEK_SET); (void)fseek(fl, off, SEEK_SET);
(void)fseek(fh, off, SEEK_SET); (void)fseek(fh, off, SEEK_SET);

View File

@@ -421,13 +421,14 @@ rom_load_bios(romdef_t *r, const wchar_t *fn, int test_only)
case 1: /* interleaved file(s) */ case 1: /* interleaved file(s) */
/* We loop on all files. */ /* We loop on all files. */
for (c = 0; c < r->nfiles / 2; c += 2) { for (c = 0; c < r->nfiles; c += 2) {
/* If this is a no-load file, skip. */ /* If this is a no-load file, skip. */
if (r->files[c].offset == 0xffffffff) if (r->files[c].offset == 0xffffffff)
continue; continue;
pc_path(script, sizeof_w(script), r->files[c].path); pc_path(script, sizeof_w(script), r->files[c].path);
pc_path(temp, sizeof_w(temp), r->files[c+1].path); pc_path(temp, sizeof_w(temp), r->files[c+1].path);
INFO("ROM: loading '%ls'/'%ls' at %06lx, size=%i, skip=%i\n", script, temp, r->files[c].offset, r->files[c].size, r->files[c].skip);
i = rom_load_interleaved(script, temp, i = rom_load_interleaved(script, temp,
r->files[c].offset, r->files[c].offset,
@@ -439,11 +440,25 @@ rom_load_bios(romdef_t *r, const wchar_t *fn, int test_only)
} }
/* Update BIOS mask. */ /* Update BIOS mask. */
if (r->total >= 0x10000) if (r->total >= 0x010000)
biosmask = (r->total - 1); biosmask = (r->total - 1);
else else
biosmask = 0x00ffff; biosmask = 0x00ffff;
#if defined(WALTJE) && defined(_DEBUG)
//FIXME: this will go away again!
{
char foo[32768];
INFO("ROM loaded, total=%i, mask=%06x\n", r->total, biosmask);
pclog_repeat(0);
for (i = 0; i < r->total; i += 4096) {
hexdump_p(foo, i, &bios[i], 4096);
pclog(0, foo);
}
pclog_repeat(1);
}
#endif
/* Create a full pathname for the video font file. */ /* Create a full pathname for the video font file. */
if (r->fontnum != -1) { if (r->fontnum != -1) {
plat_append_filename(temp, path, r->fontfn); plat_append_filename(temp, path, r->fontfn);

154
src/vnc.c
View File

@@ -10,7 +10,7 @@
* *
* TODO: Implement screenshots, and Audio Redirection. * TODO: Implement screenshots, and Audio Redirection.
* *
* Version: @(#)vnc.c 1.0.9 2019/03/08 * Version: @(#)vnc.c 1.0.10 2019/04/28
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Based on raw code by RichardG, <richardg867@gmail.com> * Based on raw code by RichardG, <richardg867@gmail.com>
@@ -53,6 +53,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
//#define LIBVNCSERVER_HAVE_LIBPTHREAD
#include <rfb/rfb.h> #include <rfb/rfb.h>
#include "emu.h" #include "emu.h"
#include "device.h" #include "device.h"
@@ -61,15 +62,14 @@
#include "devices/input/mouse.h" #include "devices/input/mouse.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "plat.h" #include "plat.h"
#if USE_LIBPNG
# include "png.h"
#endif
#include "vnc.h" #include "vnc.h"
#ifdef _WIN32 #ifdef _WIN32
# ifdef _DEBUG
# define PATH_VNC_DLL "libvncserver-debug.dll"
# else
# define PATH_VNC_DLL "libvncserver.dll" # define PATH_VNC_DLL "libvncserver.dll"
# endif
#else #else
# define PATH_VNC_DLL "libvncserver.so" # define PATH_VNC_DLL "libvncserver.so"
#endif #endif
@@ -80,7 +80,6 @@
#define VNC_MAX_Y 2048 #define VNC_MAX_Y 2048
static void *vnc_handle = NULL; /* handle to libVNCserver DLL */
static rfbScreenInfoPtr rfb = NULL; static rfbScreenInfoPtr rfb = NULL;
static int clients; static int clients;
static int updatingSize; static int updatingSize;
@@ -89,35 +88,48 @@ static int allowedX,
static int ptr_x, ptr_y, ptr_but; static int ptr_x, ptr_y, ptr_but;
#if USE_VNC == 2
# define DLLFUNC(x) rfb_##x
static void *vnc_handle = NULL; /* handle to libVNCserver DLL */
/* Pointers to the real functions. */ /* Pointers to the real functions. */
static rfbScreenInfoPtr (*f_rfbGetScreen)(int* argc,char** argv,int width, static rfbScreenInfoPtr (*rfb_GetScreen)(int *,char **,int,int,int,int,int);
int height,int bitsPerSample, static void (*rfb_InitServer)(rfbScreenInfoPtr);
int samplesPerPixel, static void (*rfb_RunEventLoop)(rfbScreenInfoPtr, long, rfbBool);
int bytesPerPixel); static void (*rfb_ScreenCleanup)(rfbScreenInfoPtr);
static void (*f_rfbInitServer)(rfbScreenInfoPtr rfbScreen); static rfbClientIteratorPtr (*rfb_GetClientIterator)(rfbScreenInfoPtr);
static void (*f_rfbRunEventLoop)(rfbScreenInfoPtr screenInfo, static rfbClientPtr (*rfb_ClientIteratorNext)(rfbClientIteratorPtr);
long usec, static void (*rfb_MarkRectAsModified)(rfbScreenInfoPtr,
rfbBool runInBackground); int,int,int,int);
static void (*f_rfbScreenCleanup)(rfbScreenInfoPtr screenInfo); static void (*rfb_DefaultPtrAddEvent)(int,int,int,rfbClientPtr);
static rfbClientIteratorPtr (*f_rfbGetClientIterator)(rfbScreenInfoPtr rfbScreen); static void (*rfb_ClientLock)(rfbClientPtr);
static rfbClientPtr (*f_rfbClientIteratorNext)(rfbClientIteratorPtr iterator); static void (*rfb_ClientUnlock)(rfbClientPtr);
static void (*f_rfbMarkRectAsModified)(rfbScreenInfoPtr rfbScreen, static void (*rfb_LogEnable)(int);
int x1,int y1,int x2,int y2); static void (*rfb_Log)(const char *fmt, ...);
static void (*f_rfbDefaultPtrAddEvent)(int buttonMask,int x, static void (*rfb_Err)(const char *fmt, ...);
int y,rfbClientPtr cl);
static dllimp_t vnc_imports[] = { static const dllimp_t vnc_imports[] = {
{ "rfbGetScreen", &f_rfbGetScreen }, { "rfbGetScreen", &rfb_GetScreen },
{ "rfbInitServerWithPthreadsAndZRLE", &f_rfbInitServer }, { "rfbInitServerWithPthreadsAndZRLE", &rfb_InitServer },
{ "rfbRunEventLoop", &f_rfbRunEventLoop }, { "rfbRunEventLoop", &rfb_RunEventLoop },
{ "rfbScreenCleanup", &f_rfbScreenCleanup }, { "rfbScreenCleanup", &rfb_ScreenCleanup },
{ "rfbGetClientIterator", &f_rfbGetClientIterator }, { "rfbGetClientIterator", &rfb_GetClientIterator },
{ "rfbClientIteratorNext", &f_rfbClientIteratorNext }, { "rfbClientIteratorNext", &rfb_ClientIteratorNext },
{ "rfbMarkRectAsModified", &f_rfbMarkRectAsModified }, { "rfbMarkRectAsModified", &rfb_MarkRectAsModified },
{ "rfbDefaultPtrAddEvent", &f_rfbDefaultPtrAddEvent }, { "rfbDefaultPtrAddEvent", &rfb_DefaultPtrAddEvent },
{ "rfbClientLock", &rfb_ClientLock },
{ "rfbClientUnlock", &rfb_ClientUnlock },
{ "rfbLogEnable", &rfb_LogEnable },
{ "rfbLog", &rfb_Log },
{ "rfbErr", &rfb_Err },
{ NULL, NULL } { NULL, NULL }
}; };
#else
# define DLLFUNC(x) rfb##x
#endif
/* Local handlers for VNCserver event logging. */ /* Local handlers for VNCserver event logging. */
@@ -178,7 +190,7 @@ vnc_ptrevent(int but, int x, int y, rfbClientPtr cl)
} }
} }
f_rfbDefaultPtrAddEvent(but, x, y, cl); DLLFUNC(DefaultPtrAddEvent)(but, x, y, cl);
} }
@@ -250,6 +262,8 @@ vnc_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
uint32_t *p; uint32_t *p;
int yy; int yy;
INFO("VNC: blit(%i,%i, %i,%i, %i,%i)\n", x,y, y1,y2, w,h);
for (yy = y1; yy < y2; yy++) { for (yy = y1; yy < y2; yy++) {
p = (uint32_t *)&(((uint32_t *)rfb->frameBuffer)[yy*VNC_MAX_X]); p = (uint32_t *)&(((uint32_t *)rfb->frameBuffer)[yy*VNC_MAX_X]);
@@ -264,7 +278,30 @@ vnc_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
video_blit_done(); video_blit_done();
if (! updatingSize) if (! updatingSize)
f_rfbMarkRectAsModified(rfb, 0,0, allowedX,allowedY); DLLFUNC(MarkRectAsModified)(rfb, 0,0, allowedX,allowedY);
}
static void
vnc_close(void)
{
video_blit_set(NULL);
if (rfb != NULL) {
free(rfb->frameBuffer);
DLLFUNC(ScreenCleanup)(rfb);
rfb = NULL;
}
#if USE_VNC == 2
/* Unload the DLL if possible. */
if (vnc_handle != NULL) {
dynld_close(vnc_handle);
vnc_handle = NULL;
}
#endif
} }
@@ -285,8 +322,10 @@ vnc_init(int fs)
*/ */
32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0 32, 32, 0, 1, 255,255,255, 16, 8, 0, 0, 0
}; };
#if USE_VNC == 2
wchar_t temp[512]; wchar_t temp[512];
const char *fn = PATH_VNC_DLL; const char *fn = PATH_VNC_DLL;
#endif
/* We do not support fullscreen, folks. */ /* We do not support fullscreen, folks. */
if (fs) { if (fs) {
@@ -294,6 +333,7 @@ vnc_init(int fs)
return(0); return(0);
} }
#if USE_VNC == 2
/* Try loading the DLL. */ /* Try loading the DLL. */
vnc_handle = dynld_module(fn, vnc_imports); vnc_handle = dynld_module(fn, vnc_imports);
if (vnc_handle == NULL) { if (vnc_handle == NULL) {
@@ -302,14 +342,17 @@ vnc_init(int fs)
ui_msgbox(MBX_ERROR, temp); ui_msgbox(MBX_ERROR, temp);
vnc_errlog("unable to load '%s', VNC not available.\n", fn); vnc_errlog("unable to load '%s', VNC not available.\n", fn);
return(0); return(0);
} else {
INFO("VNC: module '%s' loaded.\n", fn);
} }
#endif
#ifdef _WIN32 #ifdef _WIN32
//FIXME: these are defined in Linux version, but not present.. --FvK //FIXME: these are defined in Linux version, but not present.. --FvK
/* Set up and enable VNC server logging. */ /* Set up and enable VNC server logging. */
rfbLog = vnc_dbglog; DLLFUNC(Log) = vnc_dbglog;
rfbErr = vnc_errlog; DLLFUNC(Err) = vnc_errlog;
rfbLogEnable(1); DLLFUNC(LogEnable)(1);
#endif #endif
if (rfb == NULL) { if (rfb == NULL) {
@@ -318,7 +361,7 @@ vnc_init(int fs)
allowedX = scrnsz_x; allowedX = scrnsz_x;
allowedY = scrnsz_y; allowedY = scrnsz_y;
rfb = f_rfbGetScreen(0, NULL, VNC_MAX_X, VNC_MAX_Y, 8, 3, 4); rfb = DLLFUNC(GetScreen)(0, NULL, VNC_MAX_X, VNC_MAX_Y, 8, 3, 4);
rfb->desktopName = title; rfb->desktopName = title;
rfb->frameBuffer = (char *)mem_alloc(VNC_MAX_X*VNC_MAX_Y*4); rfb->frameBuffer = (char *)mem_alloc(VNC_MAX_X*VNC_MAX_Y*4);
@@ -333,9 +376,9 @@ vnc_init(int fs)
rfb->width = allowedX; rfb->width = allowedX;
rfb->height = allowedY; rfb->height = allowedY;
f_rfbInitServer(rfb); DLLFUNC(InitServer)(rfb);
f_rfbRunEventLoop(rfb, -1, TRUE); DLLFUNC(RunEventLoop)(rfb, -1, TRUE);
} }
/* Set up our BLIT handlers. */ /* Set up our BLIT handlers. */
@@ -349,27 +392,6 @@ vnc_init(int fs)
} }
static void
vnc_close(void)
{
video_blit_set(NULL);
if (rfb != NULL) {
free(rfb->frameBuffer);
f_rfbScreenCleanup(rfb);
rfb = NULL;
}
/* Unload the DLL if possible. */
if (vnc_handle != NULL) {
dynld_close(vnc_handle);
vnc_handle = NULL;
}
}
static void static void
vnc_resize(int x, int y) vnc_resize(int x, int y)
{ {
@@ -380,7 +402,7 @@ vnc_resize(int x, int y)
/* TightVNC doesn't like certain sizes.. */ /* TightVNC doesn't like certain sizes.. */
if (x < VNC_MIN_X || x > VNC_MAX_X || y < VNC_MIN_Y || y > VNC_MAX_Y) { if (x < VNC_MIN_X || x > VNC_MAX_X || y < VNC_MIN_Y || y > VNC_MAX_Y) {
vnc_errlog("invalid resoltion %ix%i requested!\n", x, y); vnc_errlog("invalid resolution %ix%i requested!\n", x, y);
return; return;
} }
@@ -393,11 +415,11 @@ vnc_resize(int x, int y)
rfb->width = x; rfb->width = x;
rfb->height = y; rfb->height = y;
iterator = f_rfbGetClientIterator(rfb); iterator = DLLFUNC(GetClientIterator)(rfb);
while ((cl = f_rfbClientIteratorNext(iterator)) != NULL) { while ((cl = DLLFUNC(ClientIteratorNext)(iterator)) != NULL) {
LOCK(cl->updateMutex); DLLFUNC(ClientLock)(cl);
cl->newFBSizePending = 1; cl->newFBSizePending = 1;
UNLOCK(cl->updateMutex); DLLFUNC(ClientUnlock)(cl);
} }
} }
} }
@@ -422,6 +444,7 @@ vnc_screenshot(const wchar_t *fn)
static int static int
vnc_available(void) vnc_available(void)
{ {
#if USE_VNC == 2
void *handle; void *handle;
handle = dynld_module(PATH_VNC_DLL, NULL); handle = dynld_module(PATH_VNC_DLL, NULL);
@@ -431,6 +454,9 @@ vnc_available(void)
} }
return(0); return(0);
#else
return(1);
#endif
} }

View File

@@ -8,7 +8,7 @@
# #
# Makefile for Windows systems using the MinGW32 environment. # Makefile for Windows systems using the MinGW32 environment.
# #
# Version: @(#)Makefile.mingw 1.0.82 2019/04/23 # Version: @(#)Makefile.mingw 1.0.83 2019/04/28
# #
# Author: Fred N. van Kempen, <decwiz@yahoo.com> # Author: Fred N. van Kempen, <decwiz@yahoo.com>
# #
@@ -56,161 +56,9 @@ ifndef EXTRAS
endif endif
# Defaults for several build options (possibly defined in a chained file.) # Defaults for several build options (possibly defined in a chained file.)
ifndef AUTODEP
AUTODEP := n
endif
ifndef CRASHDUMP
CRASHDUMP := n
endif
ifndef CROSS
CROSS := n
endif
ifndef DEBUG
DEBUG := n
endif
ifndef LOGGING
LOGGING := n
endif
ifndef PROFILER
PROFILER := n
endif
ifndef OPTIM
OPTIM := n
endif
ifndef RELEASE
RELEASE := n
endif
ifndef X64
X64 := n
endif
ifndef ARM
ARM := n
endif
ifndef ARM64
ARM64 := n
endif
ifndef DYNAREC
DYNAREC := y
ifeq ($(ARM), y)
DYNAREC := n
endif
ifeq ($(ARM64), y)
DYNAREC := n
endif
endif
ifndef WX ifndef WX
WX := n WX := n
endif endif
ifndef USB
USB := n
endif
ifndef VNS
VNS := n
endif
ifndef SDL
SDL := n
endif
ifndef D2D
D2D := n
endif
ifndef VNC
VNC := n
endif
ifndef RDP
RDP := n
endif
ifndef PNG
PNG := n
endif
ifndef DEV_BUILD
DEV_BUILD := n
endif
ifndef DEV_BRANCH
DEV_BRANCH := n
endif
ifndef AMD_K
AMD_K := n
endif
ifndef SIS471
SIS471 := n
endif
ifndef SIS496
SIS496 := n
endif
ifndef COMPAQ
COMPAQ := n
endif
ifndef MICRAL
MICRAL := n
endif
ifndef SUPERSPORT
SUPERSPORT := n
endif
ifndef DINPUT
DINPUT := y
ifeq ($(ARM), y)
DINPUT := n
endif
endif
ifndef D3DX
D3DX := y
ifeq ($(ARM), y)
D3DX := n
endif
ifeq ($(ARM64), y)
D3DX := n
endif
endif
ifndef OPENAL
OPENAL := y
endif
ifndef FLUIDSYNTH
FLUIDSYNTH := y
endif
ifndef MUNT
MUNT := y
endif
ifndef PAS16
PAS16 := n
endif
ifndef GUSMAX
GUSMAX := n
endif
ifndef XL24
XL24 := n
endif
ifndef WONDER
WONDER := n
endif
ifndef PRINTER
PRINTER := n
endif
ifndef HOSTCD
HOSTCD := n
endif
ifndef CASSETTE
CASSETTE := n
endif
# Name of the executable.
NETIF := pcap_if
ifndef PROG
ifneq ($(WX), n)
PROG := WxVARCem
else
PROG := VARCem
endif
endif
ifeq ($(DEBUG), y)
PROG := $(PROG)-d
NETIF := $(NETIF)-d
LOGGING := y
else
ifeq ($(LOGGING), y)
PROG := $(PROG)-l
endif
endif
# Which modules to include a development build. # Which modules to include a development build.
@@ -233,6 +81,12 @@ ifeq ($(DEV_BUILD), y)
endif endif
# What is the location of our external dependencies?
ifeq ($(EXT_PATH), )
EXT_PATH := ../external
endif
# WxWidgets basic info. Extract using the config program. # WxWidgets basic info. Extract using the config program.
ifneq ($(WX), n) ifneq ($(WX), n)
EXPATH += wx EXPATH += wx
@@ -283,11 +137,31 @@ VPATH := $(EXPATH) . cpu \
devices/video \ devices/video \
machines ui win machines ui win
#
# Name of the executable.
#
NETIF := pcap_if
ifndef PROG
ifneq ($(WX), n)
PROG := WxVARCem
else
PROG := VARCem
endif
endif
ifeq ($(DEBUG), y)
PROG := $(PROG)-d
NETIF := $(NETIF)-d
LOGGING := y
else
ifeq ($(LOGGING), y)
PROG := $(PROG)-l
endif
endif
# #
# Select the required build environment. We have, uhm, many.. # Select the required build environment. We have, uhm, many..
# #
ifneq ($(CROSS), n) ifeq ($(CROSS), y)
# Cross-compiling (under Linux), select proper version. # Cross-compiling (under Linux), select proper version.
ifeq ($(X64), y) ifeq ($(X64), y)
MINGW := x86_64-w64-mingw32 MINGW := x86_64-w64-mingw32
@@ -386,6 +260,7 @@ ifeq ($(ARM64), y)
endif endif
# Add general build options from the environment.
ifdef BUILD ifdef BUILD
OPTS += -DBUILD=$(BUILD) OPTS += -DBUILD=$(BUILD)
endif endif
@@ -402,7 +277,7 @@ ifdef EXINC
OPTS += -I$(EXINC) OPTS += -I$(EXINC)
endif endif
OPTS += $(SYSINC) OPTS += $(SYSINC)
ifneq ($(CROSS), n) ifeq ($(CROSS), y)
OPTS += -DUSE_CROSS OPTS += -DUSE_CROSS
endif endif
ifeq ($(DEBUG), y) ifeq ($(DEBUG), y)
@@ -438,10 +313,6 @@ ifeq ($(RELEASE), y)
OPTS += -DRELEASE_BUILD OPTS += -DRELEASE_BUILD
RFLAGS += -DRELEASE_BUILD RFLAGS += -DRELEASE_BUILD
endif endif
ifeq ($(VRAMDUMP), y)
OPTS += -DENABLE_VRAM_DUMP
RFLAGS += -DENABLE_VRAM_DUMP
endif
ifeq ($(X64), y) ifeq ($(X64), y)
PLATCG := codegen_x86-64.o PLATCG := codegen_x86-64.o
CGOPS := codegen_ops_x86-64.h CGOPS := codegen_ops_x86-64.h
@@ -453,23 +324,21 @@ else
endif endif
LIBS := -mwindows \ LIBS := -mwindows \
-lddraw -ldxguid -ld3d9 -lversion -lcomctl32 -lwinmm -lddraw -ldxguid -ld3d9 -lversion -lcomctl32 -lwinmm
ifeq ($(DINPUT), y)
LIBS += -ldinput8
else
LIBS += -lxinput
endif
ifeq ($(D3DX), y)
LIBS += -ld3dx9
endif
LIBS += -lws2_32 -lwsock32 -liphlpapi -lpsapi
LIBS += -static -lstdc++ -lgcc
#ifneq ($(X64), y)
# LIBS += -Wl,--large-address-aware
#endif
# Optional modules. # Optional modules.
MISCOBJ := MISCOBJ :=
# Dynamic Recompiler (compiled-in)
ifndef DYNAREC
DYNAREC := y
ifeq ($(ARM), y)
DYNAREC := n
endif
ifeq ($(ARM64), y)
DYNAREC := n
endif
endif
ifeq ($(DYNAREC), y) ifeq ($(DYNAREC), y)
OPTS += -DUSE_DYNAREC OPTS += -DUSE_DYNAREC
RFLAGS += -DUSE_DYNAREC RFLAGS += -DUSE_DYNAREC
@@ -481,20 +350,51 @@ ifeq ($(DYNAREC), y)
codegen_timing_winchip.o $(PLATCG) codegen_timing_winchip.o $(PLATCG)
endif endif
ifeq ($(VNS), y) # VNS: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef VNS
VNS := n
endif
ifneq ($(VNS), n)
OPTS += -DUSE_VNS OPTS += -DUSE_VNS
ifeq ($(VNS_PATH), )
VNS_PATH := $(EXT_PATH)/vns
endif
OPTS += -I$(VNS_PATH)/include/mingw -I$(VNS_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(VNS_PATH)/lib/mingw/x64
else
LIBS += -L$(VNS_PATH)/lib/mingw/x86
endif
ifeq ($(VNS), y)
LIBS += -lvns.dll
endif
ifeq ($(VNS), s)
LIBS += -lvns
endif
MISCOBJ += net_vns.o MISCOBJ += net_vns.o
endif endif
# OpenAL (always dynamic)
ifndef OPENAL
OPENAL := y
endif
ifeq ($(OPENAL), y) ifeq ($(OPENAL), y)
OPTS += -DUSE_OPENAL OPTS += -DUSE_OPENAL
endif endif
# FluidSynth (always dynamic)
ifndef FLUIDSYNTH
FLUIDSYNTH := y
endif
ifeq ($(FLUIDSYNTH), y) ifeq ($(FLUIDSYNTH), y)
OPTS += -DUSE_FLUIDSYNTH OPTS += -DUSE_FLUIDSYNTH
MISCOBJ += midi_fluidsynth.o MISCOBJ += midi_fluidsynth.o
endif endif
# MunT (compiled-in)
ifndef MUNT
MUNT := y
endif
ifeq ($(MUNT), y) ifeq ($(MUNT), y)
OPTS += -DUSE_MUNT OPTS += -DUSE_MUNT
MISCOBJ += midi_mt32.o \ MISCOBJ += midi_mt32.o \
@@ -505,32 +405,40 @@ ifeq ($(MUNT), y)
Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # SDL: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef SDL
SDL := n
endif
ifneq ($(SDL), n) ifneq ($(SDL), n)
OPTS += -DUSE_SDL OPTS += -DUSE_SDL
RFLAGS += -DUSE_SDL ifeq ($(SDL_PATH), )
ifneq ($(SDL_PATH), ) SDL_PATH := $(EXT_PATH)/sdl
endif
OPTS += -I$(SDL_PATH)/include/mingw -I$(SDL_PATH)/include OPTS += -I$(SDL_PATH)/include/mingw -I$(SDL_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
LIBS += -L$(SDL_PATH)/lib/mingw/x64 LIBS += -L$(SDL_PATH)/lib/mingw/x64
else else
LIBS += -L$(SDL_PATH)/lib/mingw/x86 LIBS += -L$(SDL_PATH)/lib/mingw/x86
endif endif
endif
ifeq ($(SDL), y) ifeq ($(SDL), y)
LIBS += -lsdl2.dll
endif
ifeq ($(SDL), s)
LIBS += -lsdl2 LIBS += -lsdl2
endif endif
SDLOBJ := win_sdl.o SDLOBJ := win_sdl.o
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # D2D: N=no, Y=yes,linked, D=yes,dynamic
ifndef D2D
D2D := n
endif
ifneq ($(D2D), n) ifneq ($(D2D), n)
ifeq ($(D2D), d) ifeq ($(D2D), d)
OPTS += -DUSE_D2D=2 OPTS += -DUSE_D2D=2
else else
OPTS += -DUSE_D2D=1 OPTS += -DUSE_D2D=1
endif endif
RFLAGS += -DUSE_D2D
ifneq ($(D2D_PATH), ) ifneq ($(D2D_PATH), )
OPTS += -I$(D2D_PATH)/include/mingw -I$(D2D_PATH)/include OPTS += -I$(D2D_PATH)/include/mingw -I$(D2D_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
@@ -545,73 +453,121 @@ ifneq ($(D2D), n)
D2DOBJ := win_d2d.o D2DOBJ := win_d2d.o
endif endif
# D3DX (always hard-linked)
ifndef D3DX
D3DX := y
ifeq ($(ARM), y)
D3DX := n
endif
ifeq ($(ARM64), y)
D3DX := n
endif
endif
ifeq ($(D3DX), y) ifeq ($(D3DX), y)
OPTS += -DUSE_D3DX OPTS += -DUSE_D3DX
LIBS += -ld3dx9
endif endif
# DINPUT and XInput (always hard-linked)
ifndef DINPUT
DINPUT := y
ifeq ($(ARM), y)
DINPUT := n
endif
endif
ifeq ($(DINPUT), y) ifeq ($(DINPUT), y)
OPTS += -DUSE_DINPUT OPTS += -DUSE_DINPUT
LIBS += -ldinput8
else
LIBS += -lxinput
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # VNC: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef VNC
VNC := n
endif
ifneq ($(VNC), n) ifneq ($(VNC), n)
OPTS += -DUSE_VNC ifeq ($(VNC), d)
RFLAGS += -DUSE_VNC OPTS += -DUSE_VNC=2
ifneq ($(VNC_PATH), ) else
OPTS += -DUSE_VNC=1
endif
ifeq ($(VNC_PATH), )
VNC_PATH := $(EXT_PATH)/vnc
endif
OPTS += -I$(VNC_PATH)/include/mingw -I$(VNC_PATH)/include OPTS += -I$(VNC_PATH)/include/mingw -I$(VNC_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
LIBS += -L$(VNC_PATH)/lib/x64 LIBS += -L$(VNC_PATH)/lib/x64
else else
LIBS += -L$(VNC_PATH)/lib/x86 LIBS += -L$(VNC_PATH)/lib/x86
endif endif
endif
ifeq ($(VNC), y) ifeq ($(VNC), y)
LIBS += -lvncserver_shared #-static -lpthreads LIBS += -lvncserver.dll
endif
ifeq ($(VNC), s)
LIBS += -lvncserver -lz -static -lpthread
endif endif
MISCOBJ += vnc.o vnc_keymap.o MISCOBJ += vnc.o vnc_keymap.o
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # RDP: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef RDP
RDP := n
endif
ifneq ($(RDP), n) ifneq ($(RDP), n)
OPTS += -DUSE_RDP ifeq ($(RDP), d)
RFLAGS += -DUSE_RDP OPTS += -DUSE_RDP=2
ifneq ($(RDP_PATH), ) else
OPTS += -DUSE_RDP=1
endif
ifeq ($(RDP_PATH), )
RDP_PATH := $(EXT_PATH)/rdp
endif
OPTS += -I$(RDP_PATH)/include/mingw -I$(RDP_PATH)/include OPTS += -I$(RDP_PATH)/include/mingw -I$(RDP_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
LIBS += -L$(RDP_PATH)/lib/x64 LIBS += -L$(RDP_PATH)/lib/x64
else else
LIBS += -L$(RDP_PATH)/lib/x86 LIBS += -L$(RDP_PATH)/lib/x86
endif endif
endif
ifeq ($(RDP), y) ifeq ($(RDP), y)
LIBS += -lrdp.dll
endif
ifeq ($(RDP), s)
LIBS += -lrdp LIBS += -lrdp
endif endif
MISCOBJ += rdp.o MISCOBJ += rdp.o
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # PNG: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef PNG
PNG := n
endif
ifneq ($(PNG), n) ifneq ($(PNG), n)
ifeq ($(PNG), d) ifeq ($(PNG), d)
OPTS += -DUSE_LIBPNG=2 OPTS += -DUSE_LIBPNG=2
else else
OPTS += -DUSE_LIBPNG=1 OPTS += -DUSE_LIBPNG=1
endif endif
RFLAGS += -DUSE_PNG ifeq ($(PNG_PATH), )
ifneq ($(PNG_PATH), ) PNG_PATH := $(EXT_PATH)/png
endif
OPTS += -I$(PNG_PATH)/include/mingw -I$(PNG_PATH)/include OPTS += -I$(PNG_PATH)/include/mingw -I$(PNG_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
LIBS += -L$(PNG_PATH)/lib/x64 LIBS += -L$(PNG_PATH)/lib/x64
else else
LIBS += -L$(PNG_PATH)/lib/x86 LIBS += -L$(PNG_PATH)/lib/x86
endif endif
endif
ifeq ($(PNG), y) ifeq ($(PNG), y)
# FIXME: should be -lpng.dll
LIBS += -lpng -lz
endif
ifeq ($(PNG), s)
LIBS += -lpng -lz LIBS += -lpng -lz
endif endif
MISCOBJ += png.o MISCOBJ += png.o
endif endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # WX: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifneq ($(WX), n) ifneq ($(WX), n)
OPTS += -DUSE_WX=$(WX) $(WX_FLAGS) OPTS += -DUSE_WX=$(WX) $(WX_FLAGS)
LIBS += $(WX_LIBS) -lm LIBS += $(WX_LIBS) -lm
@@ -699,17 +655,27 @@ ifeq ($(DEV_BRANCH), y)
endif endif
# Finalize the list of libraries to load.
LIBS += -lws2_32 -lwsock32 -liphlpapi -lpsapi
LIBS += -static -lstdc++ -lgcc
#ifneq ($(X64), y)
# LIBS += -Wl,--large-address-aware
#endif
# Final versions of the toolchain flags. # Final versions of the toolchain flags.
# FIXME: add the -Wsign-compare option soon! # FIXME: add the -Wsign-compare option soon!
CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \ CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
$(AFLAGS) -fomit-frame-pointer -mstackrealign \ $(AFLAGS) -fomit-frame-pointer -mstackrealign \
-fno-strict-aliasing \
-Wall -Wundef #-Wshadow #-Wunused-parameter -Wmissing-declarations -Wall -Wundef #-Wshadow #-Wunused-parameter -Wmissing-declarations
CXXFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \ CXXFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
$(AFLAGS) -fno-strict-aliasing -fvisibility=hidden \ $(AFLAGS) -fomit-frame-pointer -mstackrealign \
-fvisibility-inlines-hidden \ -fno-strict-aliasing \
-Wall -Wundef -Wunused-parameter -Wmissing-declarations \ -Wall -Wundef -Wunused-parameter -Wmissing-declarations \
-Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-ctor-dtor-privacy -Woverloaded-virtual
# -fvisibility=hidden -fvisibility-inlines-hidden
######################################################################### #########################################################################

View File

@@ -8,7 +8,7 @@
# #
# Makefile for Windows using Visual Studio 2015. # Makefile for Windows using Visual Studio 2015.
# #
# Version: @(#)Makefile.VC 1.0.66 2019/04/23 # Version: @(#)Makefile.VC 1.0.67 2019/04/28
# #
# Author: Fred N. van Kempen, <decwiz@yahoo.com> # Author: Fred N. van Kempen, <decwiz@yahoo.com>
# #
@@ -63,9 +63,6 @@ endif
ifndef CRASHDUMP ifndef CRASHDUMP
CRASHDUMP := n CRASHDUMP := n
endif endif
ifndef CROSS
CROSS := n
endif
ifndef DEBUG ifndef DEBUG
DEBUG := n DEBUG := n
endif endif
@@ -379,10 +376,6 @@ endif
ifeq ($(PROFILER), y) ifeq ($(PROFILER), y)
LOPTS += /MAP LOPTS += /MAP
endif endif
ifeq ($(VRAMDUMP), y)
OPTS += -DENABLE_VRAM_DUMP
RFLAGS += -DENABLE_VRAM_DUMP
endif
ifeq ($(X64), y) ifeq ($(X64), y)
PLATCG := codegen_x86-64.obj PLATCG := codegen_x86-64.obj
CGOPS := codegen_ops_x86-64.h CGOPS := codegen_ops_x86-64.h
@@ -450,7 +443,6 @@ endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifneq ($(SDL), n) ifneq ($(SDL), n)
OPTS += -DUSE_SDL OPTS += -DUSE_SDL
RFLAGS += -DUSE_SDL
ifneq ($(SDL_PATH), ) ifneq ($(SDL_PATH), )
OPTS += -I$(SDL_PATH)/include/msvc -I$(SDL_PATH)/include OPTS += -I$(SDL_PATH)/include/msvc -I$(SDL_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
@@ -472,7 +464,6 @@ ifneq ($(D2D), n)
else else
OPTS += -DUSE_D2D=1 OPTS += -DUSE_D2D=1
endif endif
RFLAGS += -DUSE_D2D
ifneq ($(D2D_PATH), ) ifneq ($(D2D_PATH), )
OPTS += -I$(D2D_PATH)/include/msvc -I$(D2D_PATH)/include OPTS += -I$(D2D_PATH)/include/msvc -I$(D2D_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
@@ -498,7 +489,6 @@ endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifneq ($(VNC), n) ifneq ($(VNC), n)
OPTS += -DUSE_VNC OPTS += -DUSE_VNC
RFLAGS += -DUSE_VNC
ifneq ($(VNC_PATH), ) ifneq ($(VNC_PATH), )
OPTS += -I$(VNC_PATH)/include/msvc -I$(VNC_PATH)/include OPTS += -I$(VNC_PATH)/include/msvc -I$(VNC_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
@@ -516,7 +506,6 @@ endif
# N=no, Y=yes,linked, D=yes,dynamic, S=yes,static # N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifneq ($(RDP), n) ifneq ($(RDP), n)
OPTS += -DUSE_RDP OPTS += -DUSE_RDP
RFLAGS += -DUSE_RDP
ifneq ($(RDP_PATH), ) ifneq ($(RDP_PATH), )
OPTS += -I$(RDP_PATH)/include/msvc -I$(RDP_PATH)/include OPTS += -I$(RDP_PATH)/include/msvc -I$(RDP_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)
@@ -538,7 +527,6 @@ ifneq ($(PNG), n)
else else
OPTS += -DUSE_LIBPNG=1 OPTS += -DUSE_LIBPNG=1
endif endif
RFLAGS += -DUSE_LIBPNG
ifneq ($(PNG_PATH), ) ifneq ($(PNG_PATH), )
OPTS += -I$(PNG_PATH)/include/msvc -I$(PNG_PATH)/include OPTS += -I$(PNG_PATH)/include/msvc -I$(PNG_PATH)/include
ifeq ($(X64), y) ifeq ($(X64), y)

View File

@@ -8,7 +8,10 @@
* *
* Rendering module for Microsoft Direct2D. * Rendering module for Microsoft Direct2D.
* *
* Version: @(#)win_d2d.cpp 1.0.4 2019/03/08 * **NOTE** This module currently does not work when compiled using
* the GCC compiler (MinGW) and when used in dynamic mode.
*
* Version: @(#)win_d2d.cpp 1.0.5 2019/04/28
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* David Hrdlicka, <hrdlickadavid@outlook.com> * David Hrdlicka, <hrdlickadavid@outlook.com>
@@ -338,12 +341,13 @@ d2d_init(int fs)
{ {
WCHAR title[200]; WCHAR title[200];
D2D1_HWND_RENDER_TARGET_PROPERTIES props; D2D1_HWND_RENDER_TARGET_PROPERTIES props;
HRESULT hr; HRESULT hr = S_OK;
INFO("D2D: init(fs=%d)\n", fs); INFO("D2D: init(fs=%d)\n", fs);
#if USE_D2D == 2 #if USE_D2D == 2
/* Try loading the DLL. */ /* Try loading the DLL. */
if (d2d_handle == NULL)
d2d_handle = dynld_module(PATH_D2D_DLL, d2d_imports); d2d_handle = dynld_module(PATH_D2D_DLL, d2d_imports);
if (d2d_handle == NULL) { if (d2d_handle == NULL) {
ERRLOG("D2D: unable to load '%s', D2D not available.\n", PATH_D2D_DLL); ERRLOG("D2D: unable to load '%s', D2D not available.\n", PATH_D2D_DLL);
@@ -352,16 +356,6 @@ d2d_init(int fs)
INFO("D2D: module '%s' loaded.\n", PATH_D2D_DLL); INFO("D2D: module '%s' loaded.\n", PATH_D2D_DLL);
#endif #endif
hr = DLLFUNC(CreateFactory)(D2D1_FACTORY_TYPE_MULTI_THREADED,
__uuidof(ID2D1Factory),
NULL,
reinterpret_cast <void **>(&d2d_factory));
if (FAILED(hr)) {
ERRLOG("D2D: unable to load factory, D2D not available.\n");
d2d_close();
return(0);
}
if (fs) { if (fs) {
/* /*
* Direct2D seems to lack any proper fullscreen mode, * Direct2D seems to lack any proper fullscreen mode,
@@ -397,6 +391,16 @@ d2d_init(int fs)
props = D2D1::HwndRenderTargetProperties(hwndRender); props = D2D1::HwndRenderTargetProperties(hwndRender);
} }
hr = DLLFUNC(CreateFactory)(D2D1_FACTORY_TYPE_MULTI_THREADED,
__uuidof(ID2D1Factory),
NULL,
reinterpret_cast <void **>(&d2d_factory));
if (FAILED(hr)) {
ERRLOG("D2D: unable to load factory, D2D not available.\n");
d2d_close();
return(0);
}
hr = d2d_factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(), hr = d2d_factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),
props, &d2d_hwndRT); props, &d2d_hwndRT);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {

View File

@@ -8,11 +8,11 @@
* *
* Try to load a support DLL. * Try to load a support DLL.
* *
* Version: @(#)win_dynld.c 1.0.7 2018/10/05 * Version: @(#)win_dynld.c 1.0.8 2019/04/28
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2017,2018 Fred N. van Kempen. * Copyright 2017-2019 Fred N. van Kempen.
* *
* Redistribution and use in source and binary forms, with * Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the * or without modification, are permitted provided that the
@@ -64,7 +64,7 @@ dynld_module(const char *name, const dllimp_t *table)
/* See if we can load the desired module. */ /* See if we can load the desired module. */
if ((h = LoadLibrary(name)) == NULL) { if ((h = LoadLibrary(name)) == NULL) {
ERRLOG("DynLd(\"%s\"): library not found!\n", name); DEBUG("DynLd(\"%s\"): library not found!\n", name);
return(NULL); return(NULL);
} }