Applied PCem patch #d12b9ef.

Applied PCem patch #ef2c34c.
Updated vidapi to enable/disable the renderers on resize (patch from 86Box.)
Re-worked the D2D renderer to actually work when dynloaded.
Some more changes to the VNC renderer.  Not done yet, the library is horrible.
Updated the Travis work files to allow for downloadable dependencies.
This commit is contained in:
waltje
2019-04-30 04:14:13 -05:00
parent bbab8fecd7
commit 2e079b67a3
14 changed files with 409 additions and 283 deletions

View File

@@ -9,7 +9,7 @@
#
# Build script for the Travis CI remote builder service.
#
# Version: @(#).travis-build.sh 1.0.6 2019/04/27
# Version: @(#).travis-build.sh 1.0.7 2019/04/30
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -45,6 +45,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Define the build options here.
OPTS=D2D=d SDL=d VNC=d PNG=d
if [ "x${DEV_BUILD}" = "xy" ]; then
TARGET="win-${TRAVIS_BUILD_NUMBER}_dev-x86"
elif [ "x${DEBUG}" = "xy" ]; then
@@ -54,21 +57,26 @@
else
TARGET="win-${TRAVIS_BUILD_NUMBER}-x86"
fi
echo "Building VARCem, build #${TRAVIS_BUILD_NUMBER} target ${TARGET}"
cd src
# We only need the first few characters of the commit ID.
export COMMIT=${TRAVIS_COMMIT::7}
echo "Downloading VARCem build dependencies.."
curl -# ${EXTDEP_URL} | tar xzf - 2>/dev/null
# Build the project.
make -f win/mingw/Makefile.MinGW BUILD=${TRAVIS_BUILD_NUMBER}
echo "Building VARCem, build #${TRAVIS_BUILD_NUMBER} target ${TARGET}"
cd src
make -f win/mingw/Makefile.MinGW ${OPTS} BUILD=${TRAVIS_BUILD_NUMBER}
if [ $? != 0 ]; then
echo "Build failed, not uploading."
exit 1
fi
# Package the results so we can upload them.
echo "Build #${TRAVIS_BUILD_NUMBER} OK, packing up."
zip -9 ../${TARGET}.zip *.exe

View File

@@ -9,7 +9,7 @@
#
# Deployment script for the Travis CI remote builder service.
#
# Version: @(#).travis-deploy.sh 1.0.4 2019/04/27
# Version: @(#).travis-deploy.sh 1.0.5 2019/04/30
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -62,17 +62,16 @@
BTYPE=regular
fi
# We only need the first few characters of the commit ID.
export COMMIT=${TRAVIS_COMMIT::7}
if [ ! -f ${TARGET}.zip ]; then
echo "Target file ${TARGET}.zip not found, giving up."
exit 1
fi
# We only need the first few characters of the commit ID.
export COMMIT=${TRAVIS_COMMIT::7}
echo "Uploading VARCem build #${TRAVIS_BUILD_NUMBER} target ${TARGET}"
curl -# -X POST \
-F "type=${BTYPE}" \
-F "build=${TRAVIS_BUILD_NUMBER}" \

View File

@@ -8,7 +8,7 @@
*
* x86 CPU segment emulation.
*
* Version: @(#)x86seg.c 1.0.6 2019/04/20
* Version: @(#)x86seg.c 1.0.7 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -456,8 +456,10 @@ void loadseg(uint16_t seg, x86seg *s)
s->access = (3 << 5) | 2 | 0x80;
s->base = seg << 4;
s->seg = seg;
#if 0
if (s == &_ss)
set_stack32(0);
#endif
s->checked = 1;
#ifdef USE_DYNAREC
if (s == &_ds)

View File

@@ -8,7 +8,7 @@
*
* Define the various platform support functions.
*
* Version: @(#)plat.h 1.0.24 2019/04/26
* Version: @(#)plat.h 1.0.25 2019/04/29
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -125,6 +125,7 @@ typedef struct {
void (*reset)(int fs);
void (*resize)(int x, int y);
int (*pause)(void);
void (*enable)(int yes);
void (*screenshot)(const wchar_t *fn);
int (*is_available)(void);
} vidapi_t;

View File

@@ -8,7 +8,7 @@
*
* Define the various UI functions.
*
* Version: @(#)ui.h 1.0.17 2019/04/26
* Version: @(#)ui.h 1.0.18 2019/04/29
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -201,6 +201,7 @@ extern const char *vidapi_getname(int api);
extern int vidapi_set(int api);
extern void vidapi_resize(int x, int y);
extern int vidapi_pause(void);
extern void vidapi_enable(int yes);
extern void vidapi_reset(void);
extern void vidapi_screenshot(void);
extern void plat_startblit(void);

View File

@@ -8,7 +8,7 @@
*
* Handle the various video renderer modules.
*
* Version: @(#)ui_vidapi.c 1.0.5 2019/03/07
* Version: @(#)ui_vidapi.c 1.0.6 2019/04/29
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -181,6 +181,25 @@ vidapi_pause(void)
}
void
vidapi_enable(int yes)
{
/* If not defined, assume not needed. */
if (plat_vidapis[vid_api]->enable == NULL) return;
/* Lock the blitter. */
plat_startblit();
/* Wait for it to be ours. */
video_blit_wait();
plat_vidapis[vid_api]->enable(yes);
/* Release the blitter. */
plat_endblit();
}
void
vidapi_reset(void)
{

View File

@@ -10,7 +10,7 @@
*
* TODO: Implement screenshots, and Audio Redirection.
*
* Version: @(#)vnc.c 1.0.10 2019/04/28
* Version: @(#)vnc.c 1.0.11 2019/04/29
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Based on raw code by RichardG, <richardg867@gmail.com>
@@ -464,11 +464,10 @@ const vidapi_t vnc_vidapi = {
"vnc",
"VNC",
0,
vnc_init,
vnc_close,
NULL,
vnc_init, vnc_close, NULL,
vnc_resize,
vnc_pause,
NULL,
vnc_screenshot,
vnc_available
};

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows systems using the MinGW32 environment.
#
# Version: @(#)Makefile.mingw 1.0.83 2019/04/28
# Version: @(#)Makefile.mingw 1.0.84 2019/04/29
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -359,11 +359,11 @@ ifneq ($(VNS), n)
ifeq ($(VNS_PATH), )
VNS_PATH := $(EXT_PATH)/vns
endif
OPTS += -I$(VNS_PATH)/include/mingw -I$(VNS_PATH)/include
OPTS += -I$(VNS_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(VNS_PATH)/lib/mingw/x64
LIBS += -L$(VNS_PATH)/lib/x64
else
LIBS += -L$(VNS_PATH)/lib/mingw/x86
LIBS += -L$(VNS_PATH)/lib/x86
endif
ifeq ($(VNS), y)
LIBS += -lvns.dll
@@ -414,11 +414,11 @@ ifneq ($(SDL), n)
ifeq ($(SDL_PATH), )
SDL_PATH := $(EXT_PATH)/sdl
endif
OPTS += -I$(SDL_PATH)/include/mingw -I$(SDL_PATH)/include
OPTS += -I$(SDL_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(SDL_PATH)/lib/mingw/x64
LIBS += -L$(SDL_PATH)/lib/x64
else
LIBS += -L$(SDL_PATH)/lib/mingw/x86
LIBS += -L$(SDL_PATH)/lib/x86
endif
ifeq ($(SDL), y)
LIBS += -lsdl2.dll
@@ -440,11 +440,11 @@ ifneq ($(D2D), n)
OPTS += -DUSE_D2D=1
endif
ifneq ($(D2D_PATH), )
OPTS += -I$(D2D_PATH)/include/mingw -I$(D2D_PATH)/include
OPTS += -I$(D2D_PATH)/include
ifeq ($(X64), y)
LOPTS += -L$(D2D_PATH)/lib/mingw/x64
LOPTS += -L$(D2D_PATH)/lib/x64
else
LOPTS += -L$(D2D_PATH)/lib/mingw/x86
LOPTS += -L$(D2D_PATH)/lib/x86
endif
endif
ifeq ($(D2D), y)
@@ -487,6 +487,7 @@ ifndef VNC
VNC := n
endif
ifneq ($(VNC), n)
ZLIB := (VNC)
ifeq ($(VNC), d)
OPTS += -DUSE_VNC=2
else
@@ -495,7 +496,7 @@ ifneq ($(VNC), n)
ifeq ($(VNC_PATH), )
VNC_PATH := $(EXT_PATH)/vnc
endif
OPTS += -I$(VNC_PATH)/include/mingw -I$(VNC_PATH)/include
OPTS += -I$(VNC_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(VNC_PATH)/lib/x64
else
@@ -523,7 +524,7 @@ ifneq ($(RDP), n)
ifeq ($(RDP_PATH), )
RDP_PATH := $(EXT_PATH)/rdp
endif
OPTS += -I$(RDP_PATH)/include/mingw -I$(RDP_PATH)/include
OPTS += -I$(RDP_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(RDP_PATH)/lib/x64
else
@@ -543,6 +544,7 @@ ifndef PNG
PNG := n
endif
ifneq ($(PNG), n)
ZLIB := $(PNG)
ifeq ($(PNG), d)
OPTS += -DUSE_LIBPNG=2
else
@@ -551,7 +553,7 @@ ifneq ($(PNG), n)
ifeq ($(PNG_PATH), )
PNG_PATH := $(EXT_PATH)/png
endif
OPTS += -I$(PNG_PATH)/include/mingw -I$(PNG_PATH)/include
OPTS += -I$(PNG_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(PNG_PATH)/lib/x64
else
@@ -567,6 +569,33 @@ ifneq ($(PNG), n)
MISCOBJ += png.o
endif
# ZLIB: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifndef ZLIB
ZLIB := n
endif
ifneq ($(ZLIB), n)
ifeq ($(ZLIB), d)
OPTS += -DUSE_ZLIB=2
else
OPTS += -DUSE_ZLIB=1
endif
ifeq ($(ZLIB_PATH), )
ZLIB_PATH := $(EXT_PATH)/zlib
endif
OPTS += -I$(ZLIB_PATH)/include
ifeq ($(X64), y)
LIBS += -L$(ZLIB_PATH)/lib/x64
else
LIBS += -L$(ZLIB_PATH)/lib/x86
endif
ifeq ($(ZLIB), y)
LIBS += -lz
endif
ifeq ($(ZLIB), s)
LIBS += -lz_static
endif
endif
# WX: N=no, Y=yes,linked, D=yes,dynamic, S=yes,static
ifneq ($(WX), n)
OPTS += -DUSE_WX=$(WX) $(WX_FLAGS)

View File

@@ -8,7 +8,7 @@
#
# Makefile for Windows using Visual Studio 2015.
#
# Version: @(#)Makefile.VC 1.0.67 2019/04/28
# Version: @(#)Makefile.VC 1.0.68 2019/04/29
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
@@ -55,159 +55,10 @@ ifndef EXTRAS
EXTRAS :=
endif
# Defaults for several build options (possibly defined in a chained file.)
ifndef AUTODEP
AUTODEP := n
endif
ifndef CRASHDUMP
CRASHDUMP := 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
WX := n
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.
@@ -230,6 +81,12 @@ ifeq ($(DEV_BUILD), y)
endif
# What is the location of our external dependencies?
ifeq ($(EXT_PATH), )
EXT_PATH := ../external
endif
# WxWidgets basic info. Extract using the config program.
ifneq ($(WX), n)
EXPATH += wx
@@ -282,6 +139,28 @@ VPATH := $(EXPATH) . cpu \
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.
#
@@ -328,6 +207,9 @@ else
LOPTS_C := -SUBSYSTEM:CONSOLE,5.01
LOPTS_W := -SUBSYSTEM:WINDOWS,5.01
endif
# Add general build options from the environment.
ifdef BUILD
OPTS += -DBUILD=$(BUILD)
endif
@@ -385,25 +267,24 @@ else
CGOPS := codegen_ops_x86.h
VCG := vid_voodoo_codegen_x86.h
endif
LIBS := ddraw.lib dxguid.lib d3d9.lib version.lib winmm.lib
ifeq ($(DINPUT), y)
LIBS += dinput8.lib
else
LIBS += xinput.lib
endif
ifeq ($(D3DX), y)
LIBS += d3dx9.lib
endif
LIBS += comctl32.lib comdlg32.lib advapi32.lib gdi32.lib \
LIBS := ddraw.lib dxguid.lib d3d9.lib version.lib winmm.lib \
comctl32.lib comdlg32.lib advapi32.lib gdi32.lib \
shell32.lib user32.lib
LIBS += ws2_32.lib wsock32.lib iphlpapi.lib psapi.lib
ifeq ($(DEBUG), y)
LIBS += libcmtd.lib libvcruntimed.lib libucrtd.lib
endif
# Optional modules.
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)
OPTS += -DUSE_DYNAREC
RFLAGS += -DUSE_DYNAREC
@@ -415,20 +296,51 @@ ifeq ($(DYNAREC), y)
codegen_timing_winchip.obj $(PLATCG)
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
ifeq ($(VNS_PATH), )
VNS_PATH := $(EXT_PATH)/vns
endif
OPTS += -I$(VNS_PATH)/include
ifeq ($(X64), y)
LIBS += -LIBPATH:$(VNS_PATH)/lib/x64
else
LIBS += -LIBPATH:$(VNS_PATH)/lib/x86
endif
ifeq ($(VNS), y)
LIBS += libvns.lib
endif
ifeq ($(VNS), s)
LIBS += libvns_static.lib
endif
MISCOBJ += net_vns.obj
endif
# OpenAL (always dynamic)
ifndef OPENAL
OPENAL := y
endif
ifeq ($(OPENAL), y)
OPTS += -DUSE_OPENAL
endif
# FluidSynth (always dynamic)
ifndef FLUIDSYNTH
FLUIDSYNTH := y
endif
ifeq ($(FLUIDSYNTH), y)
OPTS += -DUSE_FLUIDSYNTH
MISCOBJ += midi_fluidsynth.obj
endif
# MunT (compiled-in)
ifndef MUNT
MUNT := y
endif
ifeq ($(MUNT), y)
OPTS += -DUSE_MUNT
MISCOBJ += midi_mt32.obj \
@@ -440,24 +352,34 @@ ifeq ($(MUNT), y)
TVA.obj TVF.obj TVP.obj sha1.obj c_interface.obj
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)
OPTS += -DUSE_SDL
ifneq ($(SDL_PATH), )
OPTS += -I$(SDL_PATH)/include/msvc -I$(SDL_PATH)/include
ifeq ($(X64), y)
LOPTS += -LIBPATH:$(SDL_PATH)\lib\msvc\x64
else
LOPTS += -LIBPATH:$(SDL_PATH)\lib\msvc\x86
endif
ifeq ($(SDL_PATH), )
SDL_PATH := $(EXT_PATH)/sdl
endif
OPTS += -I$(SDL_PATH)/include
ifeq ($(X64), y)
LIBS += -LIBPATH:$(SDL_PATH)/lib/x64
else
LIBS += -LIBPATH:$(SDL_PATH)/lib/x86
endif
ifeq ($(SDL), y)
LIBS += sdl2.lib
endif
ifeq ($(SDL), s)
LIBS += sdl2_static.lib
endif
SDLOBJ := win_sdl.obj
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)
ifeq ($(D2D), d)
OPTS += -DUSE_D2D=2
@@ -465,11 +387,11 @@ ifneq ($(D2D), n)
OPTS += -DUSE_D2D=1
endif
ifneq ($(D2D_PATH), )
OPTS += -I$(D2D_PATH)/include/msvc -I$(D2D_PATH)/include
OPTS += -I$(D2D_PATH)/include
ifeq ($(X64), y)
LOPTS += -LIBPATH:$(D2D_PATH)\lib\msvc\x64
LOPTS += -LIBPATH:$(D2D_PATH)/lib/x64
else
LOPTS += -LIBPATH:$(D2D_PATH)\lib\msvc\x86
LOPTS += -LIBPATH:$(D2D_PATH)/lib/x86
endif
endif
ifeq ($(D2D), y)
@@ -478,73 +400,123 @@ ifneq ($(D2D), n)
D2DOBJ := win_d2d.obj
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)
OPTS += -DUSE_D3DX
OPTS += -DUSE_D3DX
LIBS += d3dx9.lib
endif
# DINPUT and XInput (always hard-linked)
ifndef DINPUT
DINPUT := y
ifeq ($(ARM), y)
DINPUT := n
endif
endif
ifeq ($(DINPUT), y)
OPTS += -DUSE_DINPUT
OPTS += -DUSE_DINPUT
LIBS += dinput8.lib
else
LIBS += xinput.lib
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)
OPTS += -DUSE_VNC
ifneq ($(VNC_PATH), )
OPTS += -I$(VNC_PATH)/include/msvc -I$(VNC_PATH)/include
ifeq ($(X64), y)
LOPTS += -LIBPATH:$(VNC_PATH)\lib\x64
else
LOPTS += -LIBPATH:$(VNC_PATH)\lib\x86
endif
ifeq ($(VNC), d)
OPTS += -DUSE_VNC=2
else
OPTS += -DUSE_VNC=1
endif
ifeq ($(VNC_PATH), )
VNC_PATH := $(EXT_PATH)/vnc
endif
OPTS += -I$(VNC_PATH)/include
ifeq ($(X64), y)
LIBS += -LIBPATH:$(VNC_PATH)/lib/x64
else
LIBS += -LIBPATH:$(VNC_PATH)/lib/x86
endif
ifeq ($(VNC), y)
LIBS += libvncserver.lib
endif
ifeq ($(VNC), s)
LIBS += libvncserver_static.lib zlib.lib
endif
MISCOBJ += vnc.obj vnc_keymap.obj
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)
OPTS += -DUSE_RDP
ifneq ($(RDP_PATH), )
OPTS += -I$(RDP_PATH)/include/msvc -I$(RDP_PATH)/include
ifeq ($(X64), y)
LOPTS += -LIBPATH:$(RDP_PATH)\lib\x64
else
LOPTS += -LIBPATH:$(RDP_PATH)\lib\x86
endif
ifeq ($(RDP), d)
OPTS += -DUSE_RDP=2
else
OPTS += -DUSE_RDP=1
endif
ifeq ($(RDP_PATH), )
RDP_PATH := $(EXT_PATH)/rdp
endif
OPTS += -I$(RDP_PATH)/include
ifeq ($(X64), y)
LIBS += -LIBPATH:$(RDP_PATH)/lib/x64
else
LIBS += -LIBPATH:$(RDP_PATH)/lib/x86
endif
ifeq ($(RDP), y)
LIBS += rdpsrvr.lib
endif
ifeq ($(RDP), s)
LIBS += rdpsrvr_static.lib
endif
MISCOBJ += rdp.obj
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)
ifeq ($(PNG), d)
OPTS += -DUSE_LIBPNG=2
else
OPTS += -DUSE_LIBPNG=1
endif
ifneq ($(PNG_PATH), )
OPTS += -I$(PNG_PATH)/include/msvc -I$(PNG_PATH)/include
ifeq ($(X64), y)
LOPTS += -LIBPATH:$(PNG_PATH)\lib\x64
else
LOPTS += -LIBPATH:$(PNG_PATH)\lib\x86
endif
ifeq ($(PNG_PATH), )
PNG_PATH := $(EXT_PATH)/png
endif
OPTS += -I$(PNG_PATH)/include
ifeq ($(X64), y)
LIBS += -LIBPATH:$(PNG_PATH)/lib/x64
else
LIBS += -LIBPATH:$(PNG_PATH)/lib/x86
endif
ifeq ($(PNG), y)
LIBS += libpng16_dll.lib #zlib.lib
endif
ifeq ($(PNG), s)
LIBS += libpng16.lib zlib.lib
endif
MISCOBJ += png.obj
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)
OPTS += -DUSE_WX $(WX_FLAGS)
LIBS += $(WX_LIBS) -lm
OPTS += -DUSE_WX=$(WX) $(WX_FLAGS)
LIBS += $(WX_LIBS)
UIOBJ := wx_main.obj wx_ui.obj wx_stbar.obj wx_render.obj
else
UIOBJ := win_ui.obj \
@@ -629,6 +601,13 @@ ifeq ($(DEV_BRANCH), y)
endif
# Finalize the list of libraries to load.
LIBS += ws2_32.lib wsock32.lib iphlpapi.lib psapi.lib
ifeq ($(DEBUG), y)
LIBS += libcmtd.lib libvcruntimed.lib libucrtd.lib
endif
# Final versions of the toolchain flags.
LDFLAGS := $(LOPTS)
CFLAGS := $(WX_FLAGS) $(OPTS) $(COPTS) $(COPTIM) $(DOPTS) $(AFLAGS)

View File

@@ -8,10 +8,7 @@
*
* Rendering module for Microsoft Direct2D.
*
* **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
* Version: @(#)win_d2d.cpp 1.0.6 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* David Hrdlicka, <hrdlickadavid@outlook.com>
@@ -68,10 +65,8 @@
/* Pointers to the real functions. */
static HRESULT (*D2D1_CreateFactory)(D2D1_FACTORY_TYPE facType,
REFIID riid,
CONST D2D1_FACTORY_OPTIONS *pFacOptions,
void **ppIFactory);
typedef HRESULT (WINAPI *MyCreateFactory_t)(D2D1_FACTORY_TYPE, REFIID, CONST D2D1_FACTORY_OPTIONS*, void**);
static MyCreateFactory_t D2D1_CreateFactory;
static const dllimp_t d2d_imports[] = {
{ "D2D1CreateFactory", &D2D1_CreateFactory },
@@ -92,6 +87,7 @@ static ID2D1Bitmap *d2d_bitmap;
static int d2d_width, d2d_height,
d2d_screen_width, d2d_screen_height,
d2d_fs;
static int d2d_enabled;
static void
@@ -199,6 +195,11 @@ d2d_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
DEBUG("D2D: blit(x=%d, y=%d, y1=%d, y2=%d, w=%d, h=%d)\n", x,y, y1,y2, w,h);
if (! d2d_enabled) {
video_blit_done();
return;
}
// TODO: Detect double scanned mode and resize render target
// appropriately for more clear picture
if (w != d2d_width || h != d2d_height) {
@@ -333,6 +334,8 @@ d2d_close(void)
d2d_handle = NULL;
}
#endif
d2d_enabled = 0;
}
@@ -341,7 +344,8 @@ d2d_init(int fs)
{
WCHAR title[200];
D2D1_HWND_RENDER_TARGET_PROPERTIES props;
HRESULT hr = S_OK;
D2D1_FACTORY_OPTIONS options;
HRESULT hr;
INFO("D2D: init(fs=%d)\n", fs);
@@ -356,6 +360,16 @@ d2d_init(int fs)
INFO("D2D: module '%s' loaded.\n", PATH_D2D_DLL);
#endif
ZeroMemory(&options, sizeof(D2D1_FACTORY_OPTIONS));
if (FAILED(DLLFUNC(CreateFactory)(D2D1_FACTORY_TYPE_MULTI_THREADED,
__uuidof(ID2D1Factory),
&options,
reinterpret_cast <void **>(&d2d_factory)))) {
ERRLOG("D2D: unable to load factory, D2D not available.\n");
d2d_close();
return(0);
}
if (fs) {
/*
* Direct2D seems to lack any proper fullscreen mode,
@@ -391,27 +405,20 @@ d2d_init(int fs)
props = D2D1::HwndRenderTargetProperties(hwndRender);
}
hr = DLLFUNC(CreateFactory)(D2D1_FACTORY_TYPE_MULTI_THREADED,
__uuidof(ID2D1Factory),
NULL,
reinterpret_cast <void **>(&d2d_factory));
hr = d2d_factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),
props, &d2d_hwndRT);
if (FAILED(hr)) {
ERRLOG("D2D: unable to load factory, D2D not available.\n");
ERRLOG("D2D: unable to create target: error 0x%08lx\n", hr);
d2d_close();
return(0);
}
hr = d2d_factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(),
props, &d2d_hwndRT);
if (SUCCEEDED(hr)) {
// Create a bitmap for storing intermediate data
hr = d2d_hwndRT->CreateBitmap(D2D1::SizeU(2048, 2048),
D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE)),
&d2d_bitmap);
}
// Create a bitmap for storing intermediate data
hr = d2d_hwndRT->CreateBitmap(D2D1::SizeU(2048, 2048),
D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE)),
&d2d_bitmap);
if (FAILED(hr)) {
ERRLOG("D2D: init: error 0x%08lx\n", hr);
ERRLOG("D2D: unable to create bitmap: error 0x%08lx\n", hr);
d2d_close();
return(0);
}
@@ -426,6 +433,8 @@ d2d_init(int fs)
/* Register our renderer! */
video_blit_set(d2d_blit);
d2d_enabled = 1;
return(1);
}
@@ -456,15 +465,21 @@ d2d_available(void)
}
static void
d2d_enable(int yes)
{
d2d_enabled = yes;
}
const vidapi_t d2d_vidapi = {
"d2d",
"Direct 2D",
1,
d2d_init,
d2d_close,
NULL,
d2d_init, d2d_close, NULL,
NULL,
NULL,
d2d_enable,
d2d_screenshot,
d2d_available
};

View File

@@ -8,7 +8,7 @@
*
* Rendering module for Microsoft Direct3D 9.
*
* Version: @(#)win_d3d.cpp 1.0.16 2019/04/07
* Version: @(#)win_d3d.cpp 1.0.17 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -69,6 +69,7 @@ static HWND d3d_hwnd;
static HWND d3d_device_window;
static int d3d_w,
d3d_h;
static int is_enabled;
static CUSTOMVERTEX d3d_verts[] = {
{ 0.0f, 0.0f, 1.0f, 1.0f, 0xffffff, 0.0f, 0.0f},
@@ -193,6 +194,11 @@ d3d_blit_fs(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
int yy;
double l = 0, t = 0, r = 0, b = 0;
if (! is_enabled) {
video_blit_done();
return;
}
if ((y1 == y2) || (h <= 0)) {
video_blit_done();
return; /*Nothing to do*/
@@ -306,6 +312,11 @@ d3d_blit(bitmap_t *b, int x, int y, int y1, int y2, int w, int h)
RECT r;
int yy;
if (! is_enabled) {
video_blit_done();
return;
}
if ((y1 == y2) || (h <= 0)) {
video_blit_done();
return; /*Nothing to do*/
@@ -470,6 +481,8 @@ d3d_close(void)
DestroyWindow(d3d_device_window);
d3d_device_window = NULL;
}
is_enabled = 0;
}
@@ -589,6 +602,8 @@ d3d_init(int fs)
else
video_blit_set(d3d_blit);
is_enabled = 1;
return(1);
}
@@ -605,6 +620,13 @@ d3d_resize(int x, int y)
}
static void
d3d_enable(int yes)
{
is_enabled = yes;
}
static void
d3d_screenshot(const wchar_t *fn)
{
@@ -629,11 +651,10 @@ const vidapi_t d3d_vidapi = {
"d3d",
"DirectDraw 3D",
1,
d3d_init,
d3d_close,
d3d_reset,
d3d_init, d3d_close, d3d_reset,
d3d_resize,
NULL,
d3d_enable,
d3d_screenshot,
NULL
};

View File

@@ -8,7 +8,7 @@
*
* Rendering module for Microsoft DirectDraw 9.
*
* Version: @(#)win_ddraw.cpp 1.0.20 2019/04/27
* Version: @(#)win_ddraw.cpp 1.0.21 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -63,6 +63,7 @@ static LPDIRECTDRAWCLIPPER lpdd_clipper = NULL;
static HWND ddraw_hwnd;
static int ddraw_w, ddraw_h,
xs, ys, ys2;
static int is_enabled;
static const char *
@@ -253,6 +254,11 @@ ddraw_blit_fs(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
HRESULT hr;
int yy;
if (! is_enabled) {
video_blit_done();
return;
}
if ((lpdds_back == NULL) || (y1 == y2) || (h <= 0)) {
video_blit_done();
return;
@@ -327,6 +333,11 @@ ddraw_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
POINT po;
int yy;
if (! is_enabled) {
video_blit_done();
return;
}
if ((lpdds_back == NULL) || (y1 == y2) || (h <= 0)) {
video_blit_done();
return;
@@ -418,6 +429,8 @@ ddraw_close(void)
lpdd4->Release();
lpdd4 = NULL;
}
is_enabled = 0;
}
@@ -562,10 +575,19 @@ ddraw_init(int fs)
else
video_blit_set(ddraw_blit);
is_enabled = 1;
return(1);
}
static void
ddraw_enable(int yes)
{
is_enabled = yes;
}
static int
SaveBMP(const wchar_t *fn, BITMAPINFO *bmi, uint8_t *pixels)
{
@@ -753,11 +775,10 @@ const vidapi_t ddraw_vidapi = {
"ddraw",
"DirectDraw 9+",
1,
ddraw_init,
ddraw_close,
NULL,
ddraw_init, ddraw_close, NULL,
NULL,
NULL,
ddraw_enable,
ddraw_screenshot,
NULL
};

View File

@@ -12,7 +12,7 @@
* we will not use that, but, instead, use a new window which
* coverrs the entire desktop.
*
* Version: @(#)win_sdl.c 1.0.9 2019/04/27
* Version: @(#)win_sdl.c 1.0.10 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Michael Dr<44>ing, <michael@drueing.de>
@@ -90,6 +90,7 @@ static HWND sdl_parent_hwnd = NULL;
static int sdl_w, sdl_h;
static int cur_w, cur_h;
static int sdl_fs;
static int is_enabled;
/* Pointers to the real functions. */
@@ -255,6 +256,11 @@ sdl_blit(bitmap_t *scr, int x, int y, int y1, int y2, int w, int h)
int xx, yy, ret;
int pitch;
if (! is_enabled) {
video_blit_done();
return;
}
if ((y1 == y2) || (scr == NULL)) {
video_blit_done();
return;
@@ -344,6 +350,8 @@ sdl_close(void)
dynld_close(sdl_handle);
sdl_handle = NULL;
}
is_enabled = 0;
}
@@ -462,6 +470,8 @@ sdl_init(int fs)
/* Register our renderer! */
video_blit_set(sdl_blit);
is_enabled = 1;
return(1);
}
@@ -520,15 +530,21 @@ sdl_available(void)
}
static void
sdl_enable(int yes)
{
is_enabled = yes;
}
const vidapi_t sdl_vidapi = {
"sdl",
"SDL2",
1,
sdl_init,
sdl_close,
NULL,
sdl_init, sdl_close, NULL,
sdl_resize,
NULL,
sdl_enable,
sdl_screenshot,
sdl_available
};

View File

@@ -8,7 +8,7 @@
*
* Implement the user Interface module.
*
* Version: @(#)win_ui.c 1.0.35 2019/04/26
* Version: @(#)win_ui.c 1.0.36 2019/04/29
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -86,6 +86,7 @@ static HMENU menuMain = NULL, /* application menu bar */
*sb_menu = NULL;
static int sb_nparts = 0;
static const sbpart_t *sb_parts = NULL;
static int minimized = 0;
static int infocus = 1;
static int hook_enabled = 0;
static int save_window_pos = 0;
@@ -422,11 +423,23 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
x += cruft_x;
y += (cruft_y + cruft_sb);
}
y -= cruft_sb;
if ((x <= 0) || (y <= 0)) {
minimized = 1;
break;
} else if (minimized == 1) {
minimized = 0;
video_force_resize_set(1);
}
/* Disable the renderer for now. */
vidapi_enable(0);
/* Request a re-size if needed. */
if ((x != scrnsz_x) || (y != scrnsz_y)) doresize = 1;
y -= cruft_sb;
/* Set the new panel size. */
scrnsz_x = x;
scrnsz_y = y;
@@ -442,6 +455,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Update the renderer if needed. */
vidapi_resize(scrnsz_x, scrnsz_y);
/* OK, safe to enable the renderer again. */
vidapi_enable(1);
/* Re-clip the mouse area if needed. */
if (mouse_capture) {
GetWindowRect(hwndRender, &rect);