Re-did the VIDAPI stuff and moved to the common code.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* it on Windows XP, and possibly also Vista. Use the
|
||||
* -DANSI_CFG for use on these systems.
|
||||
*
|
||||
* Version: @(#)config.c 1.0.23 2018/05/07
|
||||
* Version: @(#)config.c 1.0.24 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -256,7 +256,7 @@ load_general(const char *cat)
|
||||
vid_resize = !!config_get_int(cat, "vid_resize", 0);
|
||||
|
||||
p = config_get_string(cat, "vid_renderer", "default");
|
||||
vid_api = plat_vidapi_from_internal_name(p);
|
||||
vid_api = vidapi_from_internal_name(p);
|
||||
|
||||
vid_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0);
|
||||
|
||||
@@ -311,7 +311,7 @@ save_general(const char *cat)
|
||||
if (vid_resize == 0)
|
||||
config_delete_var(cat, "vid_resize");
|
||||
|
||||
str = plat_vidapi_internal_name(vid_api);
|
||||
str = vidapi_internal_name(vid_api);
|
||||
if (! strcmp(str, "default")) {
|
||||
config_delete_var(cat, "vid_renderer");
|
||||
} else {
|
||||
@@ -1548,7 +1548,7 @@ config_default(void)
|
||||
#endif
|
||||
scale = 1;
|
||||
video_card = VID_CGA;
|
||||
vid_api = plat_vidapi_from_internal_name("default");;
|
||||
vid_api = vidapi_from_internal_name("default");;
|
||||
enable_sync = 1;
|
||||
joystick_type = 0;
|
||||
hdc_type = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Interface to the OpenAL sound processing library.
|
||||
*
|
||||
* Version: @(#)openal.c 1.0.11 2018/05/06
|
||||
* Version: @(#)openal.c 1.0.12 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -133,12 +133,12 @@ al_set_midi(int freq, int buf_size)
|
||||
|
||||
|
||||
#ifdef USE_OPENAL
|
||||
ALvoid alutInit(ALint *argc, ALbyte **argv)
|
||||
ALvoid
|
||||
alutInit(ALint *argc, ALbyte **argv)
|
||||
{
|
||||
ALCcontext *Context;
|
||||
ALCdevice *Device;
|
||||
|
||||
pclog("SOUND: alutInit(%08lx)\n", openal_handle);
|
||||
/* Only if DLL is loaded. */
|
||||
if (openal_handle == NULL) return;
|
||||
|
||||
@@ -161,7 +161,6 @@ alutExit(ALvoid)
|
||||
ALCcontext *Context;
|
||||
ALCdevice *Device;
|
||||
|
||||
pclog("SOUND: alutExit(%08lx)\n", openal_handle);
|
||||
/* Only if DLL is loaded. */
|
||||
if (openal_handle == NULL) return;
|
||||
|
||||
@@ -196,7 +195,6 @@ pclog("SOUND: alutExit(%08lx)\n", openal_handle);
|
||||
void
|
||||
closeal(void)
|
||||
{
|
||||
pclog("SOUND: closeal()\n");
|
||||
#ifdef USE_OPENAL
|
||||
alutExit();
|
||||
#endif
|
||||
@@ -206,7 +204,6 @@ pclog("SOUND: closeal()\n");
|
||||
void
|
||||
initalmain(int argc, char *argv[])
|
||||
{
|
||||
pclog("SOUND: initalmain()\n");
|
||||
#ifdef USE_OPENAL
|
||||
/* Try loading the DLL if needed. */
|
||||
if (openal_handle == NULL) {
|
||||
@@ -236,7 +233,6 @@ inital(void)
|
||||
int init_midi = 0;
|
||||
const char *str;
|
||||
|
||||
pclog("SOUND: inital()\n");
|
||||
/*
|
||||
* If the current MIDI device is neither "none", nor system MIDI,
|
||||
* initialize the MIDI buffer and source, otherwise, do not.
|
||||
|
||||
8
src/pc.c
8
src/pc.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main emulator module where most things are controlled.
|
||||
*
|
||||
* Version: @(#)pc.c 1.0.38 2018/05/08
|
||||
* Version: @(#)pc.c 1.0.39 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -801,7 +801,7 @@ pc_close(thread_t *ptr)
|
||||
plat_delay_ms(200);
|
||||
|
||||
/* Claim the video blitter. */
|
||||
startblit();
|
||||
plat_startblit();
|
||||
|
||||
/* Terminate the main thread. */
|
||||
if (ptr != NULL) {
|
||||
@@ -1020,7 +1020,7 @@ pc_thread(void *param)
|
||||
drawits = 0;
|
||||
|
||||
/* Run a block of code. */
|
||||
startblit();
|
||||
plat_startblit();
|
||||
clockrate = machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].rspeed;
|
||||
|
||||
if (is386) {
|
||||
@@ -1040,7 +1040,7 @@ pc_thread(void *param)
|
||||
|
||||
joystick_process();
|
||||
|
||||
endblit();
|
||||
plat_endblit();
|
||||
|
||||
/* Done with this frame, update statistics. */
|
||||
framecount++;
|
||||
|
||||
19
src/plat.h
19
src/plat.h
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Define the various platform support functions.
|
||||
*
|
||||
* Version: @(#)plat.h 1.0.13 2018/05/07
|
||||
* Version: @(#)plat.h 1.0.14 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -111,6 +111,7 @@ GLOBAL int dopause, /* system is paused */
|
||||
mouse_capture; /* mouse is captured in app */
|
||||
GLOBAL uint64_t timer_freq;
|
||||
GLOBAL int infocus;
|
||||
GLOBAL const vidapi_t *plat_vidapis[];
|
||||
|
||||
|
||||
/* System-related functions. */
|
||||
@@ -139,16 +140,6 @@ extern void plat_mouse_capture(int on);
|
||||
extern void plat_setfullscreen(int on);
|
||||
extern int plat_fdd_icon(int);
|
||||
|
||||
/* Platform VidApi. */
|
||||
extern int plat_vidapi_count(void);
|
||||
extern int plat_vidapi_available(int api);
|
||||
extern int plat_vidapi_from_internal_name(const char *name);
|
||||
extern const char *plat_vidapi_internal_name(int api);
|
||||
extern int plat_vidapi_set(int api);
|
||||
extern void plat_vidapi_resize(int x, int y);
|
||||
extern int plat_vidapi_pause(void);
|
||||
extern void plat_vidapi_reset(void);
|
||||
|
||||
/* Resource management. */
|
||||
extern void set_language(int id);
|
||||
extern wchar_t *plat_get_string(int id);
|
||||
@@ -214,12 +205,6 @@ extern void thread_close_mutex(mutex_t *arg);
|
||||
extern int thread_wait_mutex(mutex_t *arg);
|
||||
extern int thread_release_mutex(mutex_t *mutex);
|
||||
|
||||
|
||||
/* Other stuff. */
|
||||
extern void startblit(void);
|
||||
extern void endblit(void);
|
||||
extern void take_screenshot(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
17
src/ui/ui.h
17
src/ui/ui.h
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Define the various UI functions.
|
||||
*
|
||||
* Version: @(#)ui.h 1.0.7 2018/05/07
|
||||
* Version: @(#)ui.h 1.0.8 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -132,6 +132,8 @@ extern int voodoo_do_log;
|
||||
#endif
|
||||
|
||||
/* Main GUI functions. */
|
||||
extern void ui_show_cursor(int on);
|
||||
extern void ui_show_render(int on);
|
||||
extern void ui_resize(int x, int y);
|
||||
extern int ui_msgbox(int type, void *arg);
|
||||
extern void ui_menu_reset_all(void);
|
||||
@@ -183,6 +185,19 @@ extern void dlg_sound_gain(void);
|
||||
extern int dlg_file(const wchar_t *filt, const wchar_t *ifn,
|
||||
wchar_t *fn, int save);
|
||||
|
||||
/* Platform VidApi. */
|
||||
extern int vidapi_count(void);
|
||||
extern int vidapi_available(int api);
|
||||
extern int vidapi_from_internal_name(const char *name);
|
||||
extern const char *vidapi_internal_name(int api);
|
||||
extern int vidapi_set(int api);
|
||||
extern void vidapi_resize(int x, int y);
|
||||
extern int vidapi_pause(void);
|
||||
extern void vidapi_reset(void);
|
||||
extern void vidapi_screenshot(void);
|
||||
extern void plat_startblit(void);
|
||||
extern void plat_endblit(void);
|
||||
|
||||
/* Floppy image creation. */
|
||||
extern int floppy_create_86f(const wchar_t *, int8_t sz, int8_t rpm_mode);
|
||||
extern int floppy_create_image(const wchar_t *, int8_t sz, int8_t is_zip, int8_t is_fdi);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* This code is called by the UI frontend modules, and, also,
|
||||
* depends on those same modules for lower-level functions.
|
||||
*
|
||||
* Version: @(#)ui_main.c 1.0.12 2018/05/08
|
||||
* Version: @(#)ui_main.c 1.0.13 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -228,10 +228,10 @@ ui_menu_set_logging_item(int idm, int val)
|
||||
void
|
||||
ui_menu_toggle_video_item(int idm, int *val)
|
||||
{
|
||||
startblit();
|
||||
plat_startblit();
|
||||
video_wait_for_blit();
|
||||
*val ^= 1;
|
||||
endblit();
|
||||
plat_endblit();
|
||||
|
||||
menu_set_item(idm, *val);
|
||||
|
||||
@@ -263,11 +263,11 @@ ui_menu_reset_all(void)
|
||||
* items that are configured in the code. We then
|
||||
* disable items that are currently unavailable.
|
||||
*/
|
||||
for (i = 0; i < plat_vidapi_count(); i++) {
|
||||
if (! plat_vidapi_available(i))
|
||||
for (i = 0; i < vidapi_count(); i++) {
|
||||
if (! vidapi_available(i))
|
||||
menu_enable_item(IDM_RENDER_1 + i, 0);
|
||||
}
|
||||
menu_set_radio_item(IDM_RENDER_1, plat_vidapi_count(), vid_api);
|
||||
menu_set_radio_item(IDM_RENDER_1, vidapi_count(), vid_api);
|
||||
|
||||
menu_set_radio_item(IDM_SCALE_1, 4, scale);
|
||||
|
||||
@@ -365,7 +365,7 @@ ui_menu_command(int idm)
|
||||
case IDM_RENDER_6:
|
||||
case IDM_RENDER_7:
|
||||
case IDM_RENDER_8:
|
||||
plat_vidapi_set(idm - IDM_RENDER_1);
|
||||
vidapi_set(idm - IDM_RENDER_1);
|
||||
config_save();
|
||||
break;
|
||||
|
||||
@@ -518,7 +518,7 @@ ui_menu_command(int idm)
|
||||
break;
|
||||
|
||||
case IDM_SCREENSHOT: /* TOOLS menu */
|
||||
take_screenshot();
|
||||
vidapi_screenshot();
|
||||
break;
|
||||
|
||||
case IDM_ABOUT: /* HELP menu */
|
||||
|
||||
210
src/ui/ui_vidapi.c
Normal file
210
src/ui/ui_vidapi.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Handle the various video renderer modules.
|
||||
*
|
||||
* Version: @(#)ui_vidapi.c 1.0.1 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <time.h>
|
||||
#include "../emu.h"
|
||||
#include "../device.h"
|
||||
#include "../plat.h"
|
||||
#include "../devices/video/video.h"
|
||||
#include "ui.h"
|
||||
|
||||
|
||||
/* Get availability of a VidApi entry. */
|
||||
int
|
||||
vidapi_available(int api)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
if (plat_vidapis[api]->available != NULL)
|
||||
ret = plat_vidapis[api]->available();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Return the VIDAPI number for the given name. */
|
||||
int
|
||||
vidapi_from_internal_name(const char *name)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (!strcasecmp(name, "default") ||
|
||||
!strcasecmp(name, "system")) return(0);
|
||||
|
||||
while(plat_vidapis[i] != NULL) {
|
||||
if (! strcasecmp(plat_vidapis[i]->name, name)) return(i);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Default value. */
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Return the VIDAPI name for the given number. */
|
||||
const char *
|
||||
vidapi_internal_name(int api)
|
||||
{
|
||||
const char *name = "default";
|
||||
|
||||
if (plat_vidapis[api] != NULL)
|
||||
return(plat_vidapis[api]->name);
|
||||
|
||||
return(name);
|
||||
}
|
||||
|
||||
|
||||
/* Set (initialize) a (new) API to use. */
|
||||
int
|
||||
vidapi_set(int api)
|
||||
{
|
||||
int i;
|
||||
|
||||
pclog("Initializing VIDAPI: api=%d\n", api);
|
||||
|
||||
/* Lock the blitter. */
|
||||
plat_startblit();
|
||||
|
||||
/* Wait for it to be ours. */
|
||||
video_wait_for_blit();
|
||||
|
||||
/* Close the (old) API. */
|
||||
plat_vidapis[vid_api]->close();
|
||||
|
||||
/* Initialize the (new) API. */
|
||||
vid_api = api;
|
||||
i = plat_vidapis[vid_api]->init(vid_fullscreen);
|
||||
|
||||
/* Enable or disable the Render window. */
|
||||
ui_show_render(plat_vidapis[vid_api]->local);
|
||||
|
||||
/* Update the menu item. */
|
||||
menu_set_radio_item(IDM_RENDER_1, vidapi_count(), vid_api);
|
||||
|
||||
/* OK, release the blitter. */
|
||||
plat_endblit();
|
||||
|
||||
/* If all OK, redraw the rendering area. */
|
||||
if (i)
|
||||
device_force_redraw();
|
||||
|
||||
return(i);
|
||||
}
|
||||
|
||||
|
||||
/* Tell the renderers about a new screen resolution. */
|
||||
void
|
||||
vidapi_resize(int x, int y)
|
||||
{
|
||||
/* If not defined, not supported or needed. */
|
||||
if (plat_vidapis[vid_api]->resize == NULL) return;
|
||||
|
||||
/* Lock the blitter. */
|
||||
plat_startblit();
|
||||
|
||||
/* Wait for it to be ours. */
|
||||
video_wait_for_blit();
|
||||
|
||||
plat_vidapis[vid_api]->resize(x, y);
|
||||
|
||||
/* Release the blitter. */
|
||||
plat_endblit();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
vidapi_pause(void)
|
||||
{
|
||||
/* If not defined, assume always OK. */
|
||||
if (plat_vidapis[vid_api]->pause == NULL) return(0);
|
||||
|
||||
return(plat_vidapis[vid_api]->pause());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vidapi_reset(void)
|
||||
{
|
||||
/* If not defined, assume always OK. */
|
||||
if (plat_vidapis[vid_api]->reset == NULL) return;
|
||||
|
||||
plat_vidapis[vid_api]->reset(vid_fullscreen);
|
||||
}
|
||||
|
||||
|
||||
/* Try to get a screen-shot of the active rendering surface. */
|
||||
void
|
||||
vidapi_screenshot(void)
|
||||
{
|
||||
wchar_t path[1024], fn[128];
|
||||
struct tm *info;
|
||||
time_t now;
|
||||
|
||||
pclog("Screenshot: video API is: %i\n", vid_api);
|
||||
if (vid_api < 0) return;
|
||||
|
||||
(void)time(&now);
|
||||
info = localtime(&now);
|
||||
|
||||
plat_append_filename(path, usr_path, SCREENSHOT_PATH);
|
||||
|
||||
if (! plat_dir_check(path))
|
||||
plat_dir_create(path);
|
||||
|
||||
wcscat(path, L"\\");
|
||||
|
||||
wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info);
|
||||
wcscat(path, fn);
|
||||
|
||||
if (plat_vidapis[vid_api]->screenshot != NULL)
|
||||
plat_vidapis[vid_api]->screenshot(path);
|
||||
}
|
||||
332
src/win/mingw/include/zconf.h
Normal file
332
src/win/mingw/include/zconf.h
Normal file
@@ -0,0 +1,332 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
# define zError z_zError
|
||||
|
||||
# define alloc_func z_alloc_func
|
||||
# define free_func z_free_func
|
||||
# define in_func z_in_func
|
||||
# define out_func z_out_func
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
||||
1357
src/win/mingw/include/zlib.h
Normal file
1357
src/win/mingw/include/zlib.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Windows using Visual Studio 2015.
|
||||
#
|
||||
# Version: @(#)Makefile.VC 1.0.27 2018/05/08
|
||||
# Version: @(#)Makefile.VC 1.0.28 2018/05/09
|
||||
#
|
||||
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -384,9 +384,9 @@ RDPOBJ := rdp.obj
|
||||
endif
|
||||
|
||||
ifeq ($(PNG), y)
|
||||
OPTS += -DUSE_PNG
|
||||
RFLAGS += -DUSE_PNG
|
||||
LIBS += -lpng -lz
|
||||
OPTS += -DUSE_LIBPNG
|
||||
RFLAGS += -DUSE_LIBPNG
|
||||
LIBS += libpng16.lib zlib.lib
|
||||
endif
|
||||
|
||||
# Options for the DEV branch.
|
||||
@@ -459,7 +459,7 @@ MAINOBJ := pc.obj config.obj \
|
||||
memregs.obj rom.obj rom_load.obj device.obj nvr.obj \
|
||||
nvr_at.obj nvr_ps2.obj $(VNCOBJ) $(RDPOBJ)
|
||||
|
||||
UIOBJ += ui_main.obj ui_new_floppy.obj ui_stbar.obj
|
||||
UIOBJ += ui_main.obj ui_new_floppy.obj ui_stbar.obj ui_vidapi.obj
|
||||
|
||||
INTELOBJ := intel.obj \
|
||||
intel_flash.obj \
|
||||
|
||||
212
src/win/win.c
212
src/win/win.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.10 2018/05/08
|
||||
* Version: @(#)win.c 1.0.11 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../version.h"
|
||||
@@ -99,7 +98,8 @@ static rc_str_t *lpRCstr2048,
|
||||
*lpRCstr7168;
|
||||
|
||||
|
||||
const vidapi_t *vid_apis[] = {
|
||||
/* The list with supported VidAPI modules. */
|
||||
const vidapi_t *plat_vidapis[] = {
|
||||
#ifdef USE_WX
|
||||
&wx_vidapi,
|
||||
#else
|
||||
@@ -121,6 +121,7 @@ const vidapi_t *vid_apis[] = {
|
||||
};
|
||||
|
||||
|
||||
/* Pre-load the strings from our resource file. */
|
||||
static void
|
||||
LoadCommonStrings(void)
|
||||
{
|
||||
@@ -627,210 +628,29 @@ plat_delay_ms(uint32_t count)
|
||||
}
|
||||
|
||||
|
||||
/* Get number of VidApi entries. */
|
||||
/*
|
||||
* Get number of VidApi entries.
|
||||
*
|
||||
* This has to be in this module because only we know
|
||||
* the actual size of the plat_vidapis[] array. Not a
|
||||
* nice way to do it, but so it is...
|
||||
*/
|
||||
int
|
||||
plat_vidapi_count(void)
|
||||
vidapi_count(void)
|
||||
{
|
||||
return((sizeof(vid_apis)/sizeof(vidapi_t *)) - 1);
|
||||
}
|
||||
|
||||
|
||||
/* Get availability of a VidApi entry. */
|
||||
int
|
||||
plat_vidapi_available(int api)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
if (vid_apis[api]->available != NULL)
|
||||
ret = vid_apis[api]->available();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Return the VIDAPI number for the given name. */
|
||||
int
|
||||
plat_vidapi_from_internal_name(const char *name)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (!strcasecmp(name, "default") ||
|
||||
!strcasecmp(name, "system")) return(0);
|
||||
|
||||
while(vid_apis[i] != NULL) {
|
||||
if (! strcasecmp(vid_apis[i]->name, name)) return(i);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Default value. */
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Return the VIDAPI name for the given number. */
|
||||
const char *
|
||||
plat_vidapi_internal_name(int api)
|
||||
{
|
||||
const char *name = "default";
|
||||
|
||||
if (vid_apis[api] != NULL)
|
||||
return(vid_apis[api]->name);
|
||||
|
||||
return(name);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
plat_vidapi_set(int api)
|
||||
{
|
||||
int i;
|
||||
|
||||
pclog("Initializing VIDAPI: api=%d\n", api);
|
||||
|
||||
startblit();
|
||||
video_wait_for_blit();
|
||||
|
||||
/* Close the (old) API. */
|
||||
vid_apis[vid_api]->close();
|
||||
|
||||
/* Show or hide the render window. */
|
||||
#ifndef USE_WX
|
||||
if (vid_apis[api]->local)
|
||||
ShowWindow(hwndRender, SW_SHOW);
|
||||
else
|
||||
ShowWindow(hwndRender, SW_HIDE);
|
||||
#endif
|
||||
|
||||
/* Initialize the (new) API. */
|
||||
vid_api = api;
|
||||
i = vid_apis[vid_api]->init(vid_fullscreen);
|
||||
|
||||
/* Update the menu item. */
|
||||
menu_set_radio_item(IDM_RENDER_1, plat_vidapi_count(), vid_api);
|
||||
|
||||
endblit();
|
||||
if (! i) return(0);
|
||||
|
||||
device_force_redraw();
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Tell the renderers about a new screen resolution. */
|
||||
void
|
||||
plat_vidapi_resize(int x, int y)
|
||||
{
|
||||
/* If not defined, not supported or needed. */
|
||||
if (vid_apis[vid_api]->resize == NULL) return;
|
||||
|
||||
startblit();
|
||||
|
||||
video_wait_for_blit();
|
||||
|
||||
vid_apis[vid_api]->resize(x, y);
|
||||
|
||||
endblit();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
plat_vidapi_pause(void)
|
||||
{
|
||||
/* If not defined, assume always OK. */
|
||||
if (vid_apis[vid_api]->pause == NULL) return(0);
|
||||
|
||||
return(vid_apis[vid_api]->pause());
|
||||
return((sizeof(plat_vidapis)/sizeof(vidapi_t *)) - 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_vidapi_reset(void)
|
||||
{
|
||||
/* If not defined, assume always OK. */
|
||||
if (vid_apis[vid_api]->reset == NULL) return;
|
||||
|
||||
vid_apis[vid_api]->reset(vid_fullscreen);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_setfullscreen(int on)
|
||||
{
|
||||
/* Want off and already off? */
|
||||
if (!on && !vid_fullscreen) return;
|
||||
|
||||
/* Want on and already on? */
|
||||
if (on && vid_fullscreen) return;
|
||||
|
||||
if (on && vid_fullscreen_first) {
|
||||
vid_fullscreen_first = 0;
|
||||
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2107);
|
||||
}
|
||||
|
||||
/* OK, claim the video. */
|
||||
startblit();
|
||||
video_wait_for_blit();
|
||||
|
||||
win_mouse_close();
|
||||
|
||||
/* Close the current mode, and open the new one. */
|
||||
vid_apis[vid_api]->close();
|
||||
vid_fullscreen = on;
|
||||
vid_apis[vid_api]->init(vid_fullscreen);
|
||||
|
||||
#ifdef USE_WX
|
||||
wx_set_fullscreen(on);
|
||||
#endif
|
||||
|
||||
win_mouse_init();
|
||||
|
||||
/* Release video and make it redraw the screen. */
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
|
||||
/* Finally, handle the host's mouse cursor. */
|
||||
ui_show_cursor(vid_fullscreen ? 0 : -1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
take_screenshot(void)
|
||||
{
|
||||
wchar_t path[1024], fn[128];
|
||||
struct tm *info;
|
||||
time_t now;
|
||||
|
||||
pclog("Screenshot: video API is: %i\n", vid_api);
|
||||
if (vid_api < 0) return;
|
||||
|
||||
(void)time(&now);
|
||||
info = localtime(&now);
|
||||
|
||||
plat_append_filename(path, usr_path, SCREENSHOT_PATH);
|
||||
|
||||
if (! plat_dir_check(path))
|
||||
plat_dir_create(path);
|
||||
|
||||
wcscat(path, L"\\");
|
||||
|
||||
wcsftime(fn, 128, L"%Y%m%d_%H%M%S.png", info);
|
||||
wcscat(path, fn);
|
||||
|
||||
vid_apis[vid_api]->screenshot(path);
|
||||
}
|
||||
|
||||
|
||||
void /* plat_ */
|
||||
startblit(void)
|
||||
plat_startblit(void)
|
||||
{
|
||||
WaitForSingleObject(hBlitMutex, INFINITE);
|
||||
}
|
||||
|
||||
|
||||
void /* plat_ */
|
||||
endblit(void)
|
||||
void
|
||||
plat_endblit(void)
|
||||
{
|
||||
ReleaseMutex(hBlitMutex);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.12 2018/05/07
|
||||
* Version: @(#)win.h 1.0.13 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -109,7 +109,6 @@ extern int fdd_type_icon(int type);
|
||||
/* Platform UI support functions. */
|
||||
extern int ui_init(int nCmdShow);
|
||||
extern void ui_menu_update(void);
|
||||
extern void ui_show_cursor(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -180,6 +180,18 @@ CopySurface(IDirectDrawSurface4 *pDDSurface)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DoubleLines(uint8_t *dst, uint8_t *src)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < ys; i++) {
|
||||
memcpy(dst + (i * xs * 8), src + (i * xs * 4), xs * 4);
|
||||
memcpy(dst + ((i * xs * 8) + (xs * 4)), src + (i * xs * 4), xs * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_LIBPNG
|
||||
static void
|
||||
bgra_to_rgb(png_bytep *b_rgb, uint8_t *bgra, int width, int height)
|
||||
@@ -290,7 +302,7 @@ SavePNG(const wchar_t *fn, HBITMAP hBitmap)
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
b_rgb = (png_bytep *)malloc(sizeof(png_bytep)*bmpInfo.bmiHeader.biHeight));
|
||||
b_rgb = (png_bytep *)malloc(sizeof(png_bytep)*bmpInfo.bmiHeader.biHeight);
|
||||
if (b_rgb == NULL) {
|
||||
(void)fclose(fp);
|
||||
free(pBuf);
|
||||
@@ -302,7 +314,7 @@ SavePNG(const wchar_t *fn, HBITMAP hBitmap)
|
||||
}
|
||||
|
||||
for (i = 0; i < bmpInfo.bmiHeader.biHeight; i++)
|
||||
b_rgb[i] = (png_byte *)malloc(png_get_rowbytes(png_ptr, info_ptr));
|
||||
b_rgb[i] = (png_byte *)malloc(png_get_rowbytes(png_ptr, png_info_ptr));
|
||||
|
||||
if (pBuf2) {
|
||||
DoubleLines((uint8_t *)pBuf2, (uint8_t *)pBuf);
|
||||
@@ -333,18 +345,6 @@ SavePNG(const wchar_t *fn, HBITMAP hBitmap)
|
||||
if (fp != NULL) fclose(fp);
|
||||
}
|
||||
#else
|
||||
static void
|
||||
DoubleLines(uint8_t *dst, uint8_t *src)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < ys; i++) {
|
||||
memcpy(dst + (i * xs * 8), src + (i * xs * 4), xs * 4);
|
||||
memcpy(dst + ((i * xs * 8) + (xs * 4)), src + (i * xs * 4), xs * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SaveBMP(const wchar_t *fn, HBITMAP hBitmap)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Based on old original code @(#)dir_win32.c 1.2.0 2007/04/19
|
||||
*
|
||||
* Version: @(#)win_opendir.c 1.0.5 2018/05/07
|
||||
* Version: @(#)win_opendir.c 1.0.6 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -57,7 +57,7 @@
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../plat.h"
|
||||
#include "plat_dir.h"
|
||||
#include "win_opendir.h"
|
||||
|
||||
|
||||
#define SUFFIX L"\\*"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the platform OpenDir module.
|
||||
*
|
||||
* Version: @(#)plat_dir.h 1.0.1 2018/02/14
|
||||
* Version: @(#)win_opendir.h 1.0.2 2018/05/09
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -44,8 +44,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef PLAT_DIR_H
|
||||
# define PLAT_DIR_H
|
||||
#ifndef WIN_OPENDIR_H
|
||||
# define WIN_OPENDIR_H
|
||||
|
||||
|
||||
#ifdef _MAX_FNAME
|
||||
@@ -60,11 +60,7 @@ struct direct {
|
||||
long d_ino;
|
||||
unsigned short d_reclen;
|
||||
unsigned short d_off;
|
||||
#ifdef UNICODE
|
||||
wchar_t d_name[MAXNAMLEN + 1];
|
||||
#else
|
||||
char d_name[MAXNAMLEN + 1];
|
||||
#endif
|
||||
};
|
||||
#define d_namlen d_reclen
|
||||
|
||||
@@ -75,11 +71,7 @@ typedef struct {
|
||||
long handle; /* open handle to Win32 system */
|
||||
short sts; /* last known status code */
|
||||
char *dta; /* internal work data */
|
||||
#ifdef UNICODE
|
||||
wchar_t dir[MAXDIRLEN+1]; /* open dir */
|
||||
#else
|
||||
char dir[MAXDIRLEN+1]; /* open dir */
|
||||
#endif
|
||||
struct direct dent; /* actual directory entry */
|
||||
} DIR;
|
||||
|
||||
@@ -91,11 +83,7 @@ typedef struct {
|
||||
|
||||
|
||||
/* Function prototypes. */
|
||||
#ifdef UNICODE
|
||||
extern DIR *opendirw(const wchar_t *);
|
||||
#else
|
||||
extern DIR *opendir(const char *);
|
||||
#endif
|
||||
extern struct direct *readdir(DIR *);
|
||||
extern long telldir(DIR *);
|
||||
extern void seekdir(DIR *, long);
|
||||
@@ -104,4 +92,4 @@ extern int closedir(DIR *);
|
||||
#define rewinddir(dirp) seekdir(dirp, 0L)
|
||||
|
||||
|
||||
#endif /*PLAT_DIR_H*/
|
||||
#endif /*WIN_OPENDIR_H*/
|
||||
198
src/win/win_ui.c
198
src/win/win_ui.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the user Interface module.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.21 2018/05/07
|
||||
* Version: @(#)win_ui.c 1.0.22 2018/05/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
#include "../emu.h"
|
||||
#include "../version.h"
|
||||
@@ -405,7 +404,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
MoveWindow(hwndSBAR, 0, scrnsz_y, scrnsz_x, cruft_sb, TRUE);
|
||||
|
||||
/* Update the renderer if needed. */
|
||||
plat_vidapi_resize(scrnsz_x, scrnsz_y);
|
||||
vidapi_resize(scrnsz_x, scrnsz_y);
|
||||
|
||||
/* Re-clip the mouse area if needed. */
|
||||
if (mouse_capture) {
|
||||
@@ -452,15 +451,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case WM_RESETD3D:
|
||||
startblit();
|
||||
plat_vidapi_reset();
|
||||
endblit();
|
||||
plat_startblit();
|
||||
vidapi_reset();
|
||||
plat_endblit();
|
||||
break;
|
||||
|
||||
case WM_LEAVEFULLSCREEN:
|
||||
#if 0
|
||||
pclog("leave full screen on window message\n");
|
||||
#endif
|
||||
plat_setfullscreen(0);
|
||||
config_save();
|
||||
break;
|
||||
@@ -515,6 +511,7 @@ SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the Win32 User Interface module. */
|
||||
int
|
||||
ui_init(int nCmdShow)
|
||||
{
|
||||
@@ -654,7 +651,7 @@ ui_init(int nCmdShow)
|
||||
|
||||
/* Initialize the configured Video API. */
|
||||
again:
|
||||
if (! plat_vidapi_set(vid_api)) {
|
||||
if (! vidapi_set(vid_api)) {
|
||||
/*
|
||||
* Selected renderer is not available.
|
||||
*
|
||||
@@ -666,14 +663,14 @@ again:
|
||||
* to the system default one instead.
|
||||
*/
|
||||
_swprintf(title, plat_get_string(IDS_2095),
|
||||
plat_vidapi_internal_name(vid_api));
|
||||
vidapi_internal_name(vid_api));
|
||||
if (ui_msgbox(MBX_CONFIG, title) != 0) {
|
||||
/* Nope, they don't, so just exit. */
|
||||
return(5);
|
||||
}
|
||||
|
||||
/* OK, reset to the default one and retry. */
|
||||
vid_api = plat_vidapi_from_internal_name("default");
|
||||
vid_api = vidapi_from_internal_name("default");
|
||||
goto again;
|
||||
}
|
||||
|
||||
@@ -839,6 +836,119 @@ ui_show_cursor(int val)
|
||||
}
|
||||
|
||||
|
||||
/* Show or hide the render window. */
|
||||
void
|
||||
ui_show_render(int on)
|
||||
{
|
||||
#ifndef USE_WX
|
||||
if (on)
|
||||
ShowWindow(hwndRender, SW_SHOW);
|
||||
else
|
||||
ShowWindow(hwndRender, SW_HIDE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Set the desired fullscreen/windowed mode. */
|
||||
void
|
||||
plat_setfullscreen(int on)
|
||||
{
|
||||
/* Want off and already off? */
|
||||
if (!on && !vid_fullscreen) return;
|
||||
|
||||
/* Want on and already on? */
|
||||
if (on && vid_fullscreen) return;
|
||||
|
||||
if (on && vid_fullscreen_first) {
|
||||
vid_fullscreen_first = 0;
|
||||
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2107);
|
||||
}
|
||||
|
||||
/* OK, claim the video. */
|
||||
plat_startblit();
|
||||
video_wait_for_blit();
|
||||
|
||||
// win_mouse_close();
|
||||
|
||||
/* Close the current mode, and open the new one. */
|
||||
plat_vidapis[vid_api]->close();
|
||||
vid_fullscreen = on;
|
||||
plat_vidapis[vid_api]->init(vid_fullscreen);
|
||||
|
||||
#ifdef USE_WX
|
||||
wx_set_fullscreen(on);
|
||||
#endif
|
||||
|
||||
// win_mouse_init();
|
||||
|
||||
/* Release video and make it redraw the screen. */
|
||||
plat_endblit();
|
||||
device_force_redraw();
|
||||
|
||||
/* Finally, handle the host's mouse cursor. */
|
||||
ui_show_cursor(vid_fullscreen ? 0 : -1);
|
||||
}
|
||||
|
||||
|
||||
/* Pause or unpause the emulator. */
|
||||
void
|
||||
plat_pause(int p)
|
||||
{
|
||||
static wchar_t oldtitle[512];
|
||||
wchar_t title[512];
|
||||
|
||||
/* If un-pausing, as the renderer if that's OK. */
|
||||
if (p == 0)
|
||||
p = vidapi_pause();
|
||||
|
||||
/* If already so, done. */
|
||||
if (dopause == p) return;
|
||||
|
||||
if (p) {
|
||||
wcscpy(oldtitle, ui_window_title(NULL));
|
||||
wcscpy(title, oldtitle);
|
||||
wcscat(title, L" - PAUSED -");
|
||||
ui_window_title(title);
|
||||
} else {
|
||||
ui_window_title(oldtitle);
|
||||
}
|
||||
|
||||
dopause = p;
|
||||
|
||||
/* Update the actual menu item. */
|
||||
menu_set_item(IDM_PAUSE, dopause);
|
||||
}
|
||||
|
||||
|
||||
/* Enable or disable mouse clipping. */
|
||||
void
|
||||
plat_mouse_capture(int on)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
/* Do not try to capture the mouse if no mouse configured. */
|
||||
if (mouse_type == MOUSE_NONE) return;
|
||||
|
||||
if (on && !mouse_capture) {
|
||||
/* Enable the in-app mouse. */
|
||||
GetClipCursor(&oldclip);
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
ClipCursor(&rect);
|
||||
|
||||
ui_show_cursor(0);
|
||||
|
||||
mouse_capture = 1;
|
||||
} else if (!on && mouse_capture) {
|
||||
/* Disable the in-app mouse. */
|
||||
ClipCursor(&oldclip);
|
||||
|
||||
ui_show_cursor(-1);
|
||||
|
||||
mouse_capture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Enable or disable a menu item. */
|
||||
void
|
||||
menu_enable_item(int idm, int val)
|
||||
@@ -870,63 +980,7 @@ menu_set_radio_item(int idm, int num, int val)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_pause(int p)
|
||||
{
|
||||
static wchar_t oldtitle[512];
|
||||
wchar_t title[512];
|
||||
|
||||
/* If un-pausing, as the renderer if that's OK. */
|
||||
if (p == 0)
|
||||
p = plat_vidapi_pause();
|
||||
|
||||
/* If already so, done. */
|
||||
if (dopause == p) return;
|
||||
|
||||
if (p) {
|
||||
wcscpy(oldtitle, ui_window_title(NULL));
|
||||
wcscpy(title, oldtitle);
|
||||
wcscat(title, L" - PAUSED -");
|
||||
ui_window_title(title);
|
||||
} else {
|
||||
ui_window_title(oldtitle);
|
||||
}
|
||||
|
||||
dopause = p;
|
||||
|
||||
/* Update the actual menu item. */
|
||||
menu_set_item(IDM_PAUSE, dopause);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
plat_mouse_capture(int on)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
/* Do not try to capture the mouse if no mouse configured. */
|
||||
if (mouse_type == MOUSE_NONE) return;
|
||||
|
||||
if (on && !mouse_capture) {
|
||||
/* Enable the in-app mouse. */
|
||||
GetClipCursor(&oldclip);
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
ClipCursor(&rect);
|
||||
|
||||
ui_show_cursor(0);
|
||||
|
||||
mouse_capture = 1;
|
||||
} else if (!on && mouse_capture) {
|
||||
/* Disable the in-app mouse. */
|
||||
ClipCursor(&oldclip);
|
||||
|
||||
ui_show_cursor(-1);
|
||||
|
||||
mouse_capture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the status bar. */
|
||||
void
|
||||
sb_setup(int parts, const int *widths)
|
||||
{
|
||||
@@ -942,6 +996,7 @@ sb_setup(int parts, const int *widths)
|
||||
}
|
||||
|
||||
|
||||
/* Delete all menus from the status bar. */
|
||||
void
|
||||
sb_menu_destroy(void)
|
||||
{
|
||||
@@ -983,6 +1038,7 @@ sb_menu_add_item(int part, int idm, const wchar_t *str)
|
||||
}
|
||||
|
||||
|
||||
/* Enable or disable a status bar menu item. */
|
||||
void
|
||||
sb_menu_enable_item(int part, int idm, int val)
|
||||
{
|
||||
@@ -991,6 +1047,7 @@ sb_menu_enable_item(int part, int idm, int val)
|
||||
}
|
||||
|
||||
|
||||
/* Set or reset a status bar menu item. */
|
||||
void
|
||||
sb_menu_set_item(int part, int idm, int val)
|
||||
{
|
||||
@@ -998,6 +1055,7 @@ sb_menu_set_item(int part, int idm, int val)
|
||||
}
|
||||
|
||||
|
||||
/* Set the icon ID for a status bar field. */
|
||||
void
|
||||
sb_set_icon(int part, int icon)
|
||||
{
|
||||
@@ -1010,6 +1068,7 @@ sb_set_icon(int part, int icon)
|
||||
}
|
||||
|
||||
|
||||
/* Set a text label for a status bar field. */
|
||||
void
|
||||
sb_set_text(int part, const wchar_t *str)
|
||||
{
|
||||
@@ -1017,6 +1076,7 @@ sb_set_text(int part, const wchar_t *str)
|
||||
}
|
||||
|
||||
|
||||
/* Set a tooltip for a status bar field. */
|
||||
void
|
||||
sb_set_tooltip(int part, const wchar_t *str)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user