mirror of
https://github.com/sarah-walker-pcem/pcem.git
synced 2025-07-23 19:50:35 +02:00
Initial port to Linux (using Allegro).
64-bit fixes. Some changes to aid portability. A few other tweaks.
This commit is contained in:
2
Makefile.am
Normal file
2
Makefile.am
Normal file
@@ -0,0 +1,2 @@
|
||||
SUBDIRS = src
|
||||
|
659
Makefile.in
Normal file
659
Makefile.in
Normal file
@@ -0,0 +1,659 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
|
||||
ChangeLog INSTALL NEWS compile depcomp install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLEGRO_CONFIG = @ALLEGRO_CONFIG@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
allegro_CFLAGS = @allegro_CFLAGS@
|
||||
allegro_LIBS = @allegro_LIBS@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
|
||||
install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||
distclean distclean-generic distclean-tags distcleancheck \
|
||||
distdir distuninstallcheck dvi dvi-am html html-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
31
Readme-LINUX.txt
Normal file
31
Readme-LINUX.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
PCem v8.1 Linux supplement
|
||||
|
||||
|
||||
You will need the following libraries :
|
||||
|
||||
Allegro 4.x
|
||||
OpenAL
|
||||
ALut
|
||||
|
||||
and their dependencies.
|
||||
|
||||
Open a terminal window, navigate to the PCem directory then enter
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
then ./pcem to run.
|
||||
|
||||
|
||||
The Linux port is currently entirely unpolished, and mainly exists as a starting point for
|
||||
anyone who wants to make a better port.
|
||||
|
||||
The menu is not available all the time. Press CTRL-ALT-PGDN to open it.
|
||||
|
||||
The mouse does not work very well, at least on my machine. This is most likely an Allegro issue.
|
||||
|
||||
Fullscreen mode is not present.
|
||||
|
||||
Video acceleration is not used at all, so performance is inferior to the Windows version.
|
||||
|
||||
CD-ROM support currently only accesses /dev/cdrom. It has not been heavily tested.
|
1179
aclocal.m4
vendored
Normal file
1179
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
48
configure.ac
Normal file
48
configure.ac
Normal file
@@ -0,0 +1,48 @@
|
||||
# configure.ac for PCem
|
||||
#
|
||||
|
||||
AC_PREREQ([2.61])
|
||||
AC_INIT(PCem, v9, Tom Walker <tommowalker@tommowalker.co.uk>, pcem)
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether to enable debugging])
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([--enable-debug], [build debug executable]))
|
||||
if test "$enable_debug" = "yes"; then
|
||||
CFLAGS="-Wall -O0 -g -D_DEBUG"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
CFLAGS="-O3"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#AC_MSG_CHECKING([for libz])
|
||||
#AX_CHECK_ZLIB
|
||||
|
||||
AM_CONDITIONAL(OS_WIN, test "$OS" = "win")
|
||||
AM_CONDITIONAL(OS_LINUX, test "$OS" = "linux")
|
||||
|
||||
# Do not run test for Allegro with Win32/MinGW version, as binary builds have
|
||||
# `allegro-config' missing.
|
||||
# NOTE: For the following Autoconf macro to be supported, you need to extract
|
||||
# allegro.m4 from the DOS/Windows Allegro sources (the file is contained
|
||||
# in `misc') and copy it to this directory or MSYS's `/share/aclocal'.
|
||||
if test "$OS" != "win"; then
|
||||
AM_PATH_ALLEGRO(, , AC_MSG_ERROR(building B-em requires Allegro to be installed))
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([openal], [alGetError], [], \
|
||||
[echo "You need to install the OpenAL library."
|
||||
exit -1])
|
||||
AC_CHECK_LIB([alut], [alutInit], [], \
|
||||
[echo "You need to install the ALUT library."
|
||||
exit -1])
|
||||
|
||||
|
||||
AC_OUTPUT([Makefile src/Makefile])
|
1
install-sh
Normal file
1
install-sh
Normal file
@@ -0,0 +1 @@
|
||||
/usr/share/automake-1.11/install-sh
|
17
src/386.c
17
src/386.c
@@ -8,7 +8,6 @@
|
||||
#include "cpu.h"
|
||||
#include "fdc.h"
|
||||
#include "timer.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
x86seg *ea_seg;
|
||||
@@ -79,12 +78,12 @@ int cgate32;
|
||||
#undef writememb
|
||||
|
||||
|
||||
#define readmemb(s,a) ((readlookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF)?readmemb386l(s,a): *(uint8_t *)(readlookup2[((s)+(a))>>12] + (s) + (a)) )
|
||||
#define readmemb(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)?readmemb386l(s,a): *(uint8_t *)(readlookup2[((s)+(a))>>12] + (s) + (a)) )
|
||||
|
||||
#define writememb(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememb(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
|
||||
#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
|
||||
|
||||
uint8_t romext[32768];
|
||||
@@ -292,9 +291,9 @@ static inline void fetch_ea_32_long(uint32_t rmdat)
|
||||
}
|
||||
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||
{
|
||||
if ( readlookup2[(easeg + eaaddr) >> 12] != 0xFFFFFFFF)
|
||||
if ( readlookup2[(easeg + eaaddr) >> 12] != -1)
|
||||
eal_r = (uint32_t *)(readlookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
||||
if (writelookup2[(easeg + eaaddr) >> 12] != 0xFFFFFFFF)
|
||||
if (writelookup2[(easeg + eaaddr) >> 12] != -1)
|
||||
eal_w = (uint32_t *)(writelookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
||||
}
|
||||
}
|
||||
@@ -333,9 +332,9 @@ static inline void fetch_ea_16_long(uint32_t rmdat)
|
||||
}
|
||||
if (easeg != 0xFFFFFFFF && ((easeg + eaaddr) & 0xFFF) <= 0xFFC)
|
||||
{
|
||||
if ( readlookup2[(easeg + eaaddr) >> 12] != 0xFFFFFFFF)
|
||||
if ( readlookup2[(easeg + eaaddr) >> 12] != -1)
|
||||
eal_r = (uint32_t *)(readlookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
||||
if (writelookup2[(easeg + eaaddr) >> 12] != 0xFFFFFFFF)
|
||||
if (writelookup2[(easeg + eaaddr) >> 12] != -1)
|
||||
eal_w = (uint32_t *)(writelookup2[(easeg + eaaddr) >> 12] + easeg + eaaddr);
|
||||
}
|
||||
}
|
||||
|
12
src/808x.c
12
src/808x.c
@@ -42,20 +42,20 @@ void writememll(uint32_t seg, uint32_t addr, uint32_t val);
|
||||
uint8_t readmemb(uint32_t a)
|
||||
{
|
||||
if (a!=(cs+pc)) memcycs+=4;
|
||||
if (readlookup2[(a)>>12]==0xFFFFFFFF) return readmembl(a);
|
||||
if (readlookup2[(a)>>12]==-1) return readmembl(a);
|
||||
else return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
|
||||
}
|
||||
|
||||
uint8_t readmembf(uint32_t a)
|
||||
{
|
||||
if (readlookup2[(a)>>12]==0xFFFFFFFF) return readmembl(a);
|
||||
if (readlookup2[(a)>>12]==-1) return readmembl(a);
|
||||
else return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
|
||||
}
|
||||
|
||||
uint16_t readmemw(uint32_t s, uint16_t a)
|
||||
{
|
||||
if (a!=(cs+pc)) memcycs+=(8>>is8086);
|
||||
if ((readlookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF)) return readmemwl(s,a);
|
||||
if ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)) return readmemwl(s,a);
|
||||
else return *(uint16_t *)(readlookup2[(s + a) >> 12] + s + a);
|
||||
}
|
||||
|
||||
@@ -72,20 +72,20 @@ void writemembl(uint32_t addr, uint8_t val);
|
||||
void writememb(uint32_t a, uint8_t v)
|
||||
{
|
||||
memcycs+=4;
|
||||
if (writelookup2[(a)>>12]==0xFFFFFFFF) writemembl(a,v);
|
||||
if (writelookup2[(a)>>12]==-1) writemembl(a,v);
|
||||
else *(uint8_t *)(writelookup2[a >> 12] + a) = v;
|
||||
}
|
||||
void writememwl(uint32_t seg, uint32_t addr, uint16_t val);
|
||||
void writememw(uint32_t s, uint32_t a, uint16_t v)
|
||||
{
|
||||
memcycs+=(8>>is8086);
|
||||
if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememwl(s,a,v);
|
||||
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememwl(s,a,v);
|
||||
else *(uint16_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
||||
}
|
||||
void writememll(uint32_t seg, uint32_t addr, uint32_t val);
|
||||
void writememl(uint32_t s, uint32_t a, uint32_t v)
|
||||
{
|
||||
if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememll(s,a,v);
|
||||
if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememll(s,a,v);
|
||||
else *(uint32_t *)(writelookup2[(s + a) >> 12] + s + a) = v;
|
||||
}
|
||||
|
||||
|
41
src/Makefile.am
Normal file
41
src/Makefile.am
Normal file
@@ -0,0 +1,41 @@
|
||||
# Makefile.am for PCem
|
||||
|
||||
bin_PROGRAMS = pcem
|
||||
noinst_SCRIPTS = ../pcem
|
||||
CLEANFILES = $(noinst_SCRIPTS)
|
||||
|
||||
../pcem: pcem
|
||||
cp pcem ..
|
||||
|
||||
amrefresh:
|
||||
|
||||
|
||||
pcem_CFLAGS = $(allegro_CFLAGS)
|
||||
|
||||
pcem_LDADD = $(allegro_LIBS) -lopenal -lalut
|
||||
|
||||
pcem_SOURCES = 386.c 808x.c acer386sx.c ali1429.c allegro-gui.c allegro-gui-configure.c \
|
||||
allegro-gui-hdconf.c allegro-joystick.c allegro-keyboard.c allegro-main.c \
|
||||
allegro-midi.c allegro-mouse.c allegro-video.c amstrad.c cdrom-ioctl-linux.c cdrom-null.c \
|
||||
config.c cpu.c dac.c device.c dma.c fdc.c gameport.c headland.c i430vx.c ide.c io.c jim.c \
|
||||
keyboard.c keyboard_amstrad.c keyboard_at.c keyboard_olim24.c keyboard_pcjr.c keyboard_xt.c \
|
||||
linux-time.c lpt.c mcr.c mem.c model.c mouse.c mouse_ps2.c mouse_serial.c neat.c nvr.c \
|
||||
olivetti_m24.c opti.c pc.c pci.c pic.c piix.c pit.c ppi.c rom.c serial.c sis496.c sound.c \
|
||||
sound_ad1848.c sound_adlib.c sound_adlibgold.c sound_cms.c sound_emu8k.c sound_gus.c \
|
||||
sound_mpu401_uart.c sound_opl.c sound_pas16.c sound_sb.c sound_sb_dsp.c sound_sn76489.c \
|
||||
sound_speaker.c sound_ssi2001.c sound_wss.c soundopenal.c thread-pthread.c timer.c um8669f.c \
|
||||
um8881f.c vid_ati_eeprom.c vid_ati_mach64.c vid_ati18800.c vid_ati28800.c vid_ati68860_ramdac.c \
|
||||
vid_cga.c vid_cl5429.c vid_ega.c vid_et4000.c vid_et4000w32.c vid_hercules.c vid_icd2061.c \
|
||||
vid_ics2595.c vid_mda.c vid_olivetti_m24.c vid_oti067.c vid_paradise.c vid_pc200.c \
|
||||
vid_pc1512.c vid_pc1640.c vid_pcjr.c vid_s3.c vid_s3_virge.c vid_sdac_ramdac.c \
|
||||
vid_stg_ramdac.c vid_svga.c vid_svga_render.c vid_tandy.c vid_tgui9440.c \
|
||||
vid_tkd8001_ramdac.c vid_tvga.c vid_unk_ramdac.c vid_vga.c vid_voodoo.c video.c wd76c10.c \
|
||||
x86seg.c x87.c xtide.c sound_dbopl.cc sound_resid.cc dosbox/dbopl.cpp \
|
||||
resid-fp/convolve.cc resid-fp/convolve-sse.cc resid-fp/envelope.cc \
|
||||
resid-fp/extfilt.cc resid-fp/filter.cc resid-fp/pot.cc resid-fp/sid.cc \
|
||||
resid-fp/voice.cc resid-fp/wave6581_PS_.cc resid-fp/wave6581_PST.cc \
|
||||
resid-fp/wave6581_P_T.cc resid-fp/wave6581__ST.cc resid-fp/wave8580_PS_.cc \
|
||||
resid-fp/wave8580_PST.cc resid-fp/wave8580_P_T.cc resid-fp/wave8580__ST.cc \
|
||||
resid-fp/wave.cc
|
||||
|
||||
|
2581
src/Makefile.in
Normal file
2581
src/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ OBJ = 386.o 808x.o acer386sx.o ali1429.o amstrad.o cdrom-ioctl.o \
|
||||
vid_tandy.o vid_tgui9440.o vid_tkd8001_ramdac.o vid_tvga.o vid_unk_ramdac.o vid_vga.o \
|
||||
vid_voodoo.o video.o wd76c10.o win.o win-config.o win-d3d.o win-d3d-fs.o win-ddraw.o \
|
||||
win-ddraw-fs.o win-deviceconfig.o win-hdconf.o win-joystick.o win-keyboard.o win-midi.o win-mouse.o \
|
||||
win-status.o win-video.o x86seg.o x87.o xtide.o pc.res
|
||||
win-status.o win-time.o win-video.o x86seg.o x87.o xtide.o pc.res
|
||||
FMOBJ = dbopl.o
|
||||
SIDOBJ = convolve.o envelope.o extfilt.o filter.o pot.o sid.o voice.o wave6581__ST.o wave6581_P_T.o wave6581_PS_.o wave6581_PST.o wave8580__ST.o wave8580_P_T.o wave8580_PS_.o wave8580_PST.o wave.o
|
||||
|
||||
|
464
src/allegro-gui-configure.c
Normal file
464
src/allegro-gui-configure.c
Normal file
@@ -0,0 +1,464 @@
|
||||
#include "ibm.h"
|
||||
#include "allegro-main.h"
|
||||
#include "allegro-gui.h"
|
||||
#include "cpu.h"
|
||||
#include "model.h"
|
||||
#include "sound.h"
|
||||
#include "video.h"
|
||||
|
||||
static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], modeltolist[ROM_MAX];
|
||||
static int settings_sound_to_list[20], settings_list_to_sound[20];
|
||||
|
||||
#if 0
|
||||
DEFPUSHBUTTON "OK",IDOK,64,232,50,14, WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",IDCANCEL,128,232,50,14, WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO1,62,16,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBOVID,62,36,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure", IDC_CONFIGUREVID, 224, 36, 40, 14, WS_TABSTOP
|
||||
COMBOBOX IDC_COMBOCPUM,62,56,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO3,62,76,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBOCHC,62,96,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBOSPD,62,116,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBOSND,62,136,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure", IDC_CONFIGURESND, 224, 136, 40, 14, WS_TABSTOP
|
||||
EDITTEXT IDC_MEMTEXT, 62, 152, 36, 14, ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "", IDC_MEMSPIN, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 98, 152, 12, 14
|
||||
LTEXT "MB", IDC_STATIC, 98, 152, 40, 10
|
||||
CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,172,118,10
|
||||
CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,188,118,10
|
||||
CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,204,118,10
|
||||
CONTROL "Composite CGA",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,220,118,10
|
||||
LTEXT "Machine :",IDC_STATIC,15,16,40,10
|
||||
LTEXT "Video :",IDC_STATIC,15,36,34,10
|
||||
LTEXT "CPU type :",IDC_STATIC,15,56,34,10
|
||||
LTEXT "CPU :",IDC_STATIC,15,76,34,10
|
||||
LTEXT "Cache :",IDC_STATIC,15,96,40,10
|
||||
LTEXT "Video speed :",IDC_STATIC,15,116,40,10
|
||||
LTEXT "Soundcard :",IDC_STATIC,15,136,40,10
|
||||
LTEXT "Memory :",IDC_STATIC,15,156,40,10
|
||||
#endif
|
||||
|
||||
typedef struct allegro_list_t
|
||||
{
|
||||
char name[256];
|
||||
int num;
|
||||
} allegro_list_t;
|
||||
|
||||
static allegro_list_t model_list[ROM_MAX+1];
|
||||
static allegro_list_t video_list[GFX_MAX+1];
|
||||
static allegro_list_t sound_list[GFX_MAX+1];
|
||||
static allegro_list_t cpumanu_list[4];
|
||||
static allegro_list_t cpu_list[32];
|
||||
|
||||
static char mem_size_str[10];
|
||||
|
||||
static allegro_list_t cache_list[] =
|
||||
{
|
||||
{"A little", 0},
|
||||
{"A bit", 1},
|
||||
{"Some", 2},
|
||||
{"A lot", 3},
|
||||
{"Infinite", 4},
|
||||
{"", -1}
|
||||
};
|
||||
|
||||
static allegro_list_t vidspeed_list[] =
|
||||
{
|
||||
{"8-bit", 0},
|
||||
{"Slow 16-bit", 1},
|
||||
{"Fast 16-bit", 2},
|
||||
{"Slow VLB/PCI", 3},
|
||||
{"Mid VLB/PCI", 4},
|
||||
{"Fast VLB/PCI", 5},
|
||||
{"", -1}
|
||||
};
|
||||
|
||||
static void reset_list();
|
||||
|
||||
static char *list_proc_model(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (model_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return model_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_video(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (video_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return video_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_cache(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (cache_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cache_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_vidspeed(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (vidspeed_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return vidspeed_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_sound(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (sound_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sound_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_cpumanu(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (cpumanu_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cpumanu_list[index].name;
|
||||
}
|
||||
|
||||
static char *list_proc_cpu(int index, int *list_size)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (cpu_list[c].name[0])
|
||||
c++;
|
||||
|
||||
*list_size = c;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return cpu_list[index].name;
|
||||
}
|
||||
|
||||
static int list_proc(int msg, DIALOG *d, int c);
|
||||
|
||||
static DIALOG configure_dialog[] =
|
||||
{
|
||||
{d_shadow_box_proc, 0, 0, 236*2,256,0,0xffffff,0,0, 0,0,0,0,0}, // 0
|
||||
|
||||
{d_button_proc, 176, 232, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1
|
||||
{d_button_proc, 246, 232, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2
|
||||
|
||||
{list_proc, 70*2, 12, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_model, 0, 0},
|
||||
|
||||
{list_proc, 70*2, 32, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_video, 0, 0},
|
||||
|
||||
{list_proc, 70*2, 52, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cpumanu, 0, 0}, //5
|
||||
{d_list_proc, 70*2, 72, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cpu, 0, 0},
|
||||
{d_list_proc, 70*2, 92, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_cache, 0, 0},
|
||||
{d_list_proc, 70*2, 112, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_vidspeed, 0, 0},
|
||||
{list_proc, 70*2, 132, 152*2, 20, 0, 0xffffff, 0, 0, 0, 0, list_proc_sound, 0, 0}, //9
|
||||
|
||||
{d_edit_proc, 70*2, 156, 32, 14, 0, 0xffffff, 0, 0, 3, 0, mem_size_str, 0, 0},
|
||||
|
||||
{d_text_proc, 98*2, 156, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "MB", 0, 0},
|
||||
|
||||
{d_check_proc, 14*2, 172, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "CMS / Game Blaster", 0, 0},
|
||||
{d_check_proc, 14*2, 188, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Gravis Ultrasound", 0, 0},
|
||||
{d_check_proc, 14*2, 204, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Innovation SSI-2001", 0, 0},
|
||||
{d_check_proc, 14*2, 220, 118*2, 10, 0, 0xffffff, 0, 0, 0, 0, "Composite CGA", 0, 0},
|
||||
|
||||
{d_text_proc, 16*2, 16, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Machine :", 0, 0},
|
||||
{d_text_proc, 16*2, 36, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Video :", 0, 0},
|
||||
{d_text_proc, 16*2, 56, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "CPU type :", 0, 0},
|
||||
{d_text_proc, 16*2, 76, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "CPU :", 0, 0},
|
||||
{d_text_proc, 16*2, 96, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Cache :", 0, 0},
|
||||
{d_text_proc, 16*2, 116, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Video speed :", 0, 0},
|
||||
{d_text_proc, 16*2, 136, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Soundcard :", 0, 0},
|
||||
{d_text_proc, 16*2, 156, 40, 10, 0, 0xffffff, 0, 0, 0, 0, "Memory :", 0, 0},
|
||||
|
||||
{0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
static int list_proc(int msg, DIALOG *d, int c)
|
||||
{
|
||||
int old = d->d1;
|
||||
int ret = d_list_proc(msg, d, c);
|
||||
|
||||
if (d->d1 != old)
|
||||
{
|
||||
int new_model = model_list[configure_dialog[3].d1].num;
|
||||
|
||||
reset_list();
|
||||
|
||||
if (models[new_model].fixed_gfxcard)
|
||||
configure_dialog[4].flags |= D_DISABLED;
|
||||
else
|
||||
configure_dialog[4].flags &= ~D_DISABLED;
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void reset_list()
|
||||
{
|
||||
int model = model_list[configure_dialog[3].d1].num;
|
||||
int cpumanu = configure_dialog[5].d1;
|
||||
int cpu = configure_dialog[6].d1;
|
||||
int c;
|
||||
|
||||
memset(cpumanu_list, 0, sizeof(cpumanu_list));
|
||||
memset(cpu_list, 0, sizeof(cpu_list));
|
||||
|
||||
c = 0;
|
||||
while (models[model].cpu[c].cpus != NULL && c < 3)
|
||||
{
|
||||
strcpy(cpumanu_list[c].name, models[model].cpu[c].name);
|
||||
cpumanu_list[c].num = c;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (cpumanu >= c)
|
||||
cpumanu = configure_dialog[6].d1 = c-1;
|
||||
|
||||
c = 0;
|
||||
while (models[model].cpu[cpumanu].cpus[c].cpu_type != -1)
|
||||
{
|
||||
strcpy(cpu_list[c].name, models[model].cpu[cpumanu].cpus[c].name);
|
||||
cpu_list[c].num = c;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (cpu >= c)
|
||||
cpu = configure_dialog[7].d1 = c-1;
|
||||
}
|
||||
|
||||
int settings_configure()
|
||||
{
|
||||
int c, d;
|
||||
|
||||
memset(model_list, 0, sizeof(model_list));
|
||||
memset(video_list, 0, sizeof(video_list));
|
||||
memset(sound_list, 0, sizeof(sound_list));
|
||||
|
||||
for (c = 0; c < ROM_MAX; c++)
|
||||
romstolist[c] = 0;
|
||||
c = d = 0;
|
||||
while (models[c].id != -1)
|
||||
{
|
||||
pclog("INITDIALOG : %i %i %i\n",c,models[c].id,romspresent[models[c].id]);
|
||||
if (romspresent[models[c].id])
|
||||
{
|
||||
strcpy(model_list[d].name, models[c].name);
|
||||
model_list[d].num = c;
|
||||
if (c == model)
|
||||
configure_dialog[3].d1 = d;
|
||||
d++;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
|
||||
if (models[model].fixed_gfxcard)
|
||||
configure_dialog[4].flags |= D_DISABLED;
|
||||
else
|
||||
configure_dialog[4].flags &= ~D_DISABLED;
|
||||
|
||||
c = d = 0;
|
||||
while (1)
|
||||
{
|
||||
char *s = video_card_getname(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
pclog("video_card_available : %i\n", c);
|
||||
if (video_card_available(c))
|
||||
{
|
||||
strcpy(video_list[d].name, video_card_getname(c));
|
||||
video_list[d].num = video_new_to_old(c);
|
||||
if (video_new_to_old(c) == gfxcard)
|
||||
configure_dialog[4].d1 = d;
|
||||
d++;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
c = d = 0;
|
||||
while (1)
|
||||
{
|
||||
char *s = sound_card_getname(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
|
||||
if (sound_card_available(c))
|
||||
{
|
||||
strcpy(sound_list[d].name, sound_card_getname(c));
|
||||
sound_list[d].num = c;
|
||||
if (c == sound_card_current)
|
||||
configure_dialog[9].d1 = d;
|
||||
d++;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
configure_dialog[5].d1 = cpu_manufacturer;
|
||||
configure_dialog[6].d1 = cpu;
|
||||
configure_dialog[7].d1 = cache;
|
||||
configure_dialog[8].d1 = video_speed;
|
||||
reset_list();
|
||||
// strcpy(cpumanu_str, models[romstomodel[romset]].cpu[cpu_manufacturer].name);
|
||||
// strcpy(cpu_str, models[romstomodel[romset]].cpu[cpu_manufacturer].cpus[cpu].name);
|
||||
// strcpy(cache_str, cache_str_list[cache]);
|
||||
// strcpy(vidspeed_str, vidspeed_str_list[video_speed]);
|
||||
|
||||
// strcpy(soundcard_str, sound_card_getname(sound_card_current));
|
||||
|
||||
if (GAMEBLASTER)
|
||||
configure_dialog[12].flags |= D_SELECTED;
|
||||
else
|
||||
configure_dialog[12].flags &= ~D_SELECTED;
|
||||
|
||||
if (GUS)
|
||||
configure_dialog[13].flags |= D_SELECTED;
|
||||
else
|
||||
configure_dialog[13].flags &= ~D_SELECTED;
|
||||
|
||||
if (SSI2001)
|
||||
configure_dialog[14].flags |= D_SELECTED;
|
||||
else
|
||||
configure_dialog[14].flags &= ~D_SELECTED;
|
||||
|
||||
if (cga_comp)
|
||||
configure_dialog[15].flags |= D_SELECTED;
|
||||
else
|
||||
configure_dialog[15].flags &= ~D_SELECTED;
|
||||
|
||||
sprintf(mem_size_str, "%i", mem_size);
|
||||
|
||||
while (1)
|
||||
{
|
||||
position_dialog(configure_dialog, SCREEN_W/2 - 272, SCREEN_H/2 - 256/2);
|
||||
|
||||
c = popup_dialog(configure_dialog, 1);
|
||||
|
||||
position_dialog(configure_dialog, -(SCREEN_W/2 - 272), -(SCREEN_H/2 - 256/2));
|
||||
|
||||
if (c == 1)
|
||||
{
|
||||
int new_model = model_list[configure_dialog[3].d1].num;
|
||||
int new_gfxcard = video_list[configure_dialog[4].d1].num;
|
||||
int new_sndcard = sound_list[configure_dialog[9].d1].num;
|
||||
int new_cpu_m = configure_dialog[5].d1;
|
||||
int new_cpu = configure_dialog[6].d1;
|
||||
int new_mem_size;
|
||||
int new_has_fpu = (models[new_model].cpu[new_cpu_m].cpus[new_cpu].cpu_type >= CPU_i486DX) ? 1 : 0;
|
||||
int new_GAMEBLASTER = (configure_dialog[12].flags & D_SELECTED) ? 1 : 0;
|
||||
int new_GUS = (configure_dialog[13].flags & D_SELECTED) ? 1 : 0;
|
||||
int new_SSI2001 = (configure_dialog[14].flags & D_SELECTED) ? 1 : 0;
|
||||
|
||||
sscanf(mem_size_str, "%i", &new_mem_size);
|
||||
if (new_mem_size < 1 || new_mem_size > 256)
|
||||
{
|
||||
alert("Invalid memory size", "Memory must be between 1 and 256 MB", NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (new_model != model || new_gfxcard != gfxcard || new_mem_size != mem_size ||
|
||||
new_has_fpu != hasfpu || new_GAMEBLASTER != GAMEBLASTER || new_GUS != GUS ||
|
||||
new_SSI2001 != SSI2001 || new_sndcard != sound_card_current)
|
||||
{
|
||||
if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) != 1)
|
||||
continue;
|
||||
|
||||
model = new_model;
|
||||
romset = model_getromset();
|
||||
gfxcard = new_gfxcard;
|
||||
mem_size = new_mem_size;
|
||||
cpu_manufacturer = new_cpu_m;
|
||||
cpu = new_cpu;
|
||||
GAMEBLASTER = new_GAMEBLASTER;
|
||||
GUS = new_GUS;
|
||||
SSI2001 = new_SSI2001;
|
||||
sound_card_current = new_sndcard;
|
||||
|
||||
mem_resize();
|
||||
loadbios();
|
||||
resetpchard();
|
||||
}
|
||||
|
||||
video_speed = configure_dialog[8].d1;
|
||||
|
||||
cga_comp = (configure_dialog[15].flags & D_SELECTED) ? 1 : 0;
|
||||
|
||||
cpu_manufacturer = new_cpu_m;
|
||||
cpu = new_cpu;
|
||||
cpu_set();
|
||||
|
||||
cache = configure_dialog[9].d1;
|
||||
mem_updatecache();
|
||||
|
||||
saveconfig();
|
||||
|
||||
speedchanged();
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
if (c == 2)
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
370
src/allegro-gui-hdconf.c
Normal file
370
src/allegro-gui-hdconf.c
Normal file
@@ -0,0 +1,370 @@
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
#include "allegro-main.h"
|
||||
#include "allegro-gui.h"
|
||||
|
||||
static char hd_path[2][260];
|
||||
static char hd_sectors[2][10];
|
||||
static char hd_heads[2][10];
|
||||
static char hd_cylinders[2][10];
|
||||
static char hd_size[2][20];
|
||||
|
||||
static char hd_path_new[260];
|
||||
static char hd_sectors_new[10];
|
||||
static char hd_heads_new[10];
|
||||
static char hd_cylinders_new[10];
|
||||
static char hd_size_new[20];
|
||||
|
||||
static PcemHDC hdc_new[2];
|
||||
|
||||
static DIALOG hdparams_dialog[]=
|
||||
{
|
||||
{d_shadow_box_proc, 0, 0, 194*2,86,0,0xffffff,0,0, 0,0,0,0,0}, // 0
|
||||
|
||||
{d_button_proc, 126, 66, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1
|
||||
{d_button_proc, 196, 66, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2
|
||||
|
||||
{d_text_proc, 7*2, 6, 170, 10, 0, 0xffffff, 0, 0, 0, 0, "Initial settings are based on file size", 0, 0},
|
||||
|
||||
{d_text_proc, 7*2, 22, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0},
|
||||
{d_text_proc, 63*2, 22, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0},
|
||||
{d_text_proc, 120*2, 22, 28, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0},
|
||||
{d_edit_proc, 44*2, 22, 16*2, 12, 0, 0xffffff, 0, 0, 2, 0, hd_sectors_new, 0, 0},
|
||||
{d_edit_proc, 92*2, 22, 16*2, 12, 0, 0xffffff, 0, 0, 3, 0, hd_heads_new, 0, 0},
|
||||
{d_edit_proc, 168*2, 22, 24*2, 12, 0, 0xffffff, 0, 0, 5, 0, hd_cylinders_new, 0, 0},
|
||||
{d_text_proc, 7*2, 54, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size_new, 0, 0},
|
||||
|
||||
{0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
static int hdconf_open(int msg, DIALOG *d, int c)
|
||||
{
|
||||
int drv = d->d2;
|
||||
int ret = d_button_proc(msg, d, c);
|
||||
|
||||
if (ret == D_EXIT)
|
||||
{
|
||||
char fn[260];
|
||||
int xsize = SCREEN_W - 32, ysize = SCREEN_H - 64;
|
||||
|
||||
strcpy(fn, hd_path[drv]);
|
||||
ret = file_select_ex("Please choose a disc image", fn, "IMG", 260, xsize, ysize);
|
||||
if (ret)
|
||||
{
|
||||
uint64_t sz;
|
||||
FILE *f = fopen64(fn, "rb");
|
||||
if (!f)
|
||||
{
|
||||
return D_REDRAW;
|
||||
}
|
||||
fseeko64(f, -1, SEEK_END);
|
||||
sz = ftello64(f) + 1;
|
||||
fclose(f);
|
||||
sprintf(hd_sectors_new, "63");
|
||||
sprintf(hd_heads_new, "16");
|
||||
sprintf(hd_cylinders_new, "%i", (int)((sz / 512) / 16) / 63);
|
||||
|
||||
while (1)
|
||||
{
|
||||
position_dialog(hdparams_dialog, SCREEN_W/2 - 186, SCREEN_H/2 - 86/2);
|
||||
|
||||
ret = popup_dialog(hdparams_dialog, 1);
|
||||
|
||||
position_dialog(hdparams_dialog, -(SCREEN_W/2 - 186), -(SCREEN_H/2 - 86/2));
|
||||
|
||||
if (ret == 1)
|
||||
{
|
||||
int spt, hpc, cyl;
|
||||
sscanf(hd_sectors_new, "%i", &spt);
|
||||
sscanf(hd_heads_new, "%i", &hpc);
|
||||
sscanf(hd_cylinders_new, "%i", &cyl);
|
||||
|
||||
if (spt > 63)
|
||||
{
|
||||
alert("Drive has too many sectors (maximum is 63)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
if (hpc > 128)
|
||||
{
|
||||
alert("Drive has too many heads (maximum is 128)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
if (cyl > 16383)
|
||||
{
|
||||
alert("Drive has too many cylinders (maximum is 16383)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
hdc_new[drv].spt = spt;
|
||||
hdc_new[drv].hpc = hpc;
|
||||
hdc_new[drv].tracks = cyl;
|
||||
|
||||
strcpy(hd_path[drv], fn);
|
||||
sprintf(hd_sectors[drv], "%i", hdc_new[drv].spt);
|
||||
sprintf(hd_heads[drv], "%i", hdc_new[drv].hpc);
|
||||
sprintf(hd_cylinders[drv], "%i", hdc_new[drv].tracks);
|
||||
sprintf(hd_size[drv], "Size : %imb", (((((uint64_t)hdc_new[drv].tracks*(uint64_t)hdc_new[drv].hpc)*(uint64_t)hdc_new[drv].spt)*512)/1024)/1024);
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
if (ret == 2)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hdconf_new_file(int msg, DIALOG *d, int c)
|
||||
{
|
||||
int ret = d_button_proc(msg, d, c);
|
||||
|
||||
if (ret == D_EXIT)
|
||||
{
|
||||
char fn[260];
|
||||
int xsize = SCREEN_W - 32, ysize = SCREEN_H - 64;
|
||||
|
||||
strcpy(fn, hd_path_new);
|
||||
ret = file_select_ex("Please choose a disc image", fn, "IMG", 260, xsize, ysize);
|
||||
if (ret)
|
||||
strcpy(hd_path_new, fn);
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DIALOG hdnew_dialog[]=
|
||||
{
|
||||
{d_shadow_box_proc, 0, 0, 194*2,86,0,0xffffff,0,0, 0,0,0,0,0}, // 0
|
||||
|
||||
{d_button_proc, 126, 66, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1
|
||||
{d_button_proc, 196, 66, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2
|
||||
|
||||
{d_edit_proc, 7*2, 6, 136*2, 10, 0, 0xffffff, 0, 0, 0, 0, hd_path_new, 0, 0},
|
||||
{hdconf_new_file, 143*2, 6, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "...", 0, 0},
|
||||
|
||||
{d_text_proc, 7*2, 22, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0},
|
||||
{d_text_proc, 63*2, 22, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0},
|
||||
{d_text_proc, 120*2, 22, 28, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0},
|
||||
{d_edit_proc, 44*2, 22, 16*2, 12, 0, 0xffffff, 0, 0, 2, 0, hd_sectors_new, 0, 0},
|
||||
{d_edit_proc, 92*2, 22, 16*2, 12, 0, 0xffffff, 0, 0, 3, 0, hd_heads_new, 0, 0},
|
||||
{d_edit_proc, 168*2, 22, 24*2, 12, 0, 0xffffff, 0, 0, 5, 0, hd_cylinders_new, 0, 0},
|
||||
// {d_text_proc, 7*2, 54, 136, 12, 0, -1, 0, 0, 0, 0, hd_size_new, 0, 0},
|
||||
|
||||
{0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
static int create_hd(char *fn, int cyl, int hpc, int spt)
|
||||
{
|
||||
int c;
|
||||
int e;
|
||||
uint8_t buf[512];
|
||||
FILE *f = fopen64(hd_path_new, "wb");
|
||||
e = errno;
|
||||
if (!f)
|
||||
{
|
||||
alert("Can't open file for write", NULL, NULL, "OK", NULL, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
memset(buf, 0, 512);
|
||||
for (c = 0; c < (cyl * hpc * spt); c++)
|
||||
{
|
||||
fwrite(buf, 512, 1, f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static int hdconf_new(int msg, DIALOG *d, int c)
|
||||
{
|
||||
int drv = d->d2;
|
||||
int ret = d_button_proc(msg, d, c);
|
||||
|
||||
if (ret == D_EXIT)
|
||||
{
|
||||
sprintf(hd_sectors_new, "63");
|
||||
sprintf(hd_heads_new, "16");
|
||||
sprintf(hd_cylinders_new, "511");
|
||||
strcpy(hd_path_new, "");
|
||||
|
||||
while (1)
|
||||
{
|
||||
position_dialog(hdnew_dialog, SCREEN_W/2 - 186, SCREEN_H/2 - 86/2);
|
||||
|
||||
ret = popup_dialog(hdnew_dialog, 1);
|
||||
|
||||
position_dialog(hdnew_dialog, -(SCREEN_W/2 - 186), -(SCREEN_H/2 - 86/2));
|
||||
|
||||
if (ret == 1)
|
||||
{
|
||||
int spt, hpc, cyl;
|
||||
int c, d;
|
||||
FILE *f;
|
||||
uint8_t *buf;
|
||||
|
||||
sscanf(hd_sectors_new, "%i", &spt);
|
||||
sscanf(hd_heads_new, "%i", &hpc);
|
||||
sscanf(hd_cylinders_new, "%i", &cyl);
|
||||
|
||||
if (spt > 63)
|
||||
{
|
||||
alert("Drive has too many sectors (maximum is 63)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
if (hpc > 128)
|
||||
{
|
||||
alert("Drive has too many heads (maximum is 128)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
if (cyl > 16383)
|
||||
{
|
||||
alert("Drive has too many cylinders (maximum is 16383)", NULL, NULL, "OK", NULL, 0, 0);
|
||||
continue;
|
||||
}
|
||||
if (create_hd(hd_path_new, cyl, hpc, spt))
|
||||
return D_REDRAW;
|
||||
|
||||
alert("Remember to partition and format the new drive", NULL, NULL, "OK", NULL, 0, 0);
|
||||
|
||||
hdc_new[drv].spt = spt;
|
||||
hdc_new[drv].hpc = hpc;
|
||||
hdc_new[drv].tracks = cyl;
|
||||
|
||||
strcpy(hd_path[drv], hd_path_new);
|
||||
sprintf(hd_sectors[drv], "%i", hdc_new[drv].spt);
|
||||
sprintf(hd_heads[drv], "%i", hdc_new[drv].hpc);
|
||||
sprintf(hd_cylinders[drv], "%i", hdc_new[drv].tracks);
|
||||
sprintf(hd_size[drv], "Size : %imb", (((((uint64_t)hdc_new[drv].tracks*(uint64_t)hdc_new[drv].hpc)*(uint64_t)hdc_new[drv].spt)*512)/1024)/1024);
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
if (ret == 2)
|
||||
break;
|
||||
}
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hdconf_eject(int msg, DIALOG *d, int c)
|
||||
{
|
||||
int drv = d->d2;
|
||||
int ret = d_button_proc(msg, d, c);
|
||||
|
||||
if (ret == D_EXIT)
|
||||
{
|
||||
hdc_new[drv].spt = 0;
|
||||
hdc_new[drv].hpc = 0;
|
||||
hdc_new[drv].tracks = 0;
|
||||
strcpy(hd_path[drv], "");
|
||||
sprintf(hd_sectors[drv], "%i", hdc_new[drv].spt);
|
||||
sprintf(hd_heads[drv], "%i", hdc_new[drv].hpc);
|
||||
sprintf(hd_cylinders[drv], "%i", hdc_new[drv].tracks);
|
||||
sprintf(hd_size[drv], "Size : %imb", (((((uint64_t)hdc_new[drv].tracks*(uint64_t)hdc_new[drv].hpc)*(uint64_t)hdc_new[drv].spt)*512)/1024)/1024);
|
||||
|
||||
return D_REDRAW;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DIALOG hdconf_dialog[]=
|
||||
{
|
||||
{d_shadow_box_proc, 0, 0, 210*2,172,0,0xffffff,0,0, 0,0,0,0,0}, // 0
|
||||
|
||||
{d_button_proc, 150, 152, 50, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "OK", 0, 0}, // 1
|
||||
{d_button_proc, 220, 152, 50, 16, 0, 0xffffff, 0, D_EXIT, 0, 0, "Cancel", 0, 0}, // 2
|
||||
|
||||
{d_text_proc, 7*2, 6, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "C:", 0, 0},
|
||||
{d_edit_proc, 7*2, 22, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[0], 0, 0},
|
||||
{hdconf_open, 143*2, 22, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "...", 0, 0},
|
||||
{hdconf_new, 159*2, 22, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "New", 0, 0},
|
||||
{hdconf_eject, 183*2, 22, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 0, "Eject", 0, 0},
|
||||
|
||||
{d_text_proc, 7*2, 38, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0},
|
||||
{d_text_proc, 63*2, 38, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0},
|
||||
{d_text_proc, 120*2, 38, 28, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0},
|
||||
{d_edit_proc, 44*2, 38, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[0], 0, 0},
|
||||
{d_edit_proc, 92*2, 38, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[0], 0, 0},
|
||||
{d_edit_proc, 168*2, 38, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[0], 0, 0},
|
||||
{d_text_proc, 7*2, 54, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[0], 0, 0},
|
||||
|
||||
{d_text_proc, 7*2, 76, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "D:", 0, 0},
|
||||
{d_edit_proc, 7*2, 92, 136*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_path[1], 0, 0},
|
||||
{hdconf_open, 143*2, 92, 16*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "...", 0, 0},
|
||||
{hdconf_new, 159*2, 92, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "New", 0, 0},
|
||||
{hdconf_eject, 183*2, 92, 24*2, 14, 0, 0xffffff, 0, D_EXIT, 0, 1, "Eject", 0, 0},
|
||||
|
||||
{d_edit_proc, 44*2, 108, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_sectors[1], 0, 0},
|
||||
{d_edit_proc, 92*2, 108, 16*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_heads[1], 0, 0},
|
||||
{d_edit_proc, 168*2, 108, 24*2, 12, 0, 0xffffff, 0, D_DISABLED, 0, 0, hd_cylinders[1], 0, 0},
|
||||
{d_text_proc, 7*2, 108, 27, 10, 0, 0xffffff, 0, 0, 0, 0, "Sectors:", 0, 0},
|
||||
{d_text_proc, 63*2, 108, 29, 8, 0, 0xffffff, 0, 0, 0, 0, "Heads:", 0, 0},
|
||||
{d_text_proc, 120*2, 108, 32, 12, 0, 0xffffff, 0, 0, 0, 0, "Cylinders:", 0, 0},
|
||||
{d_text_proc, 7*2, 124, 136, 12, 0, 0xffffff, 0, 0, 0, 0, hd_size[1], 0, 0},
|
||||
|
||||
{0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
int disc_hdconf()
|
||||
{
|
||||
int c;
|
||||
int changed=0;
|
||||
|
||||
hdc_new[0] = hdc[0];
|
||||
hdc_new[1] = hdc[1];
|
||||
strcpy(hd_path[0], ide_fn[0]);
|
||||
strcpy(hd_path[1], ide_fn[1]);
|
||||
sprintf(hd_sectors[0], "%i", hdc[0].spt);
|
||||
sprintf(hd_sectors[1], "%i", hdc[1].spt);
|
||||
sprintf(hd_heads[0], "%i", hdc[0].hpc);
|
||||
sprintf(hd_heads[1], "%i", hdc[1].hpc);
|
||||
sprintf(hd_cylinders[0], "%i", hdc[0].tracks);
|
||||
sprintf(hd_cylinders[1], "%i", hdc[1].tracks);
|
||||
sprintf(hd_size[0], "Size : %imb", (((((uint64_t)hdc[0].tracks*(uint64_t)hdc[0].hpc)*(uint64_t)hdc[0].spt)*512)/1024)/1024);
|
||||
sprintf(hd_size[1], "Size : %imb", (((((uint64_t)hdc[1].tracks*(uint64_t)hdc[1].hpc)*(uint64_t)hdc[1].spt)*512)/1024)/1024);
|
||||
|
||||
while (1)
|
||||
{
|
||||
position_dialog(hdconf_dialog, SCREEN_W/2 - 210, SCREEN_H/2 - 172/2);
|
||||
|
||||
c = popup_dialog(hdconf_dialog, 1);
|
||||
|
||||
position_dialog(hdconf_dialog, -(SCREEN_W/2 - 210), -(SCREEN_H/2 - 172/2));
|
||||
|
||||
if (c == 1)
|
||||
{
|
||||
if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1)
|
||||
{
|
||||
hdc[0] = hdc_new[0];
|
||||
hdc[1] = hdc_new[1];
|
||||
|
||||
strcpy(ide_fn[0], hd_path[0]);
|
||||
strcpy(ide_fn[1], hd_path[1]);
|
||||
|
||||
saveconfig();
|
||||
|
||||
resetpchard();
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
}
|
||||
if (c == 2)
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
return D_O_K;
|
||||
}
|
219
src/allegro-gui.c
Normal file
219
src/allegro-gui.c
Normal file
@@ -0,0 +1,219 @@
|
||||
#include "ibm.h"
|
||||
#include "allegro-main.h"
|
||||
#include "allegro-gui.h"
|
||||
#include "device.h"
|
||||
#include "ide.h"
|
||||
|
||||
static int file_return(void)
|
||||
{
|
||||
return D_CLOSE;
|
||||
}
|
||||
|
||||
static int file_exit(void)
|
||||
{
|
||||
quited = 1;
|
||||
return D_CLOSE;
|
||||
}
|
||||
|
||||
static int file_reset(void)
|
||||
{
|
||||
resetpchard();
|
||||
return D_CLOSE;
|
||||
}
|
||||
|
||||
static MENU file_menu[]=
|
||||
{
|
||||
{"&Return", file_return, NULL, 0, NULL},
|
||||
{"&Hard Reset", file_reset, NULL, 0, NULL},
|
||||
{"E&xit", file_exit, NULL, 0, NULL},
|
||||
{NULL,NULL,NULL,0,NULL}
|
||||
};
|
||||
|
||||
static int disc_load_a()
|
||||
{
|
||||
char fn[260];
|
||||
int ret;
|
||||
int xsize = SCREEN_W - 32, ysize = SCREEN_H - 64;
|
||||
strcpy(fn, discfns[0]);
|
||||
ret = file_select_ex("Please choose a disc image", fn, "IMG;IMA", 260, xsize, ysize);
|
||||
if (ret)
|
||||
{
|
||||
savedisc(0);
|
||||
loaddisc(0, fn);
|
||||
saveconfig();
|
||||
}
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static int disc_load_b()
|
||||
{
|
||||
char fn[260];
|
||||
int ret;
|
||||
int xsize = SCREEN_W - 32, ysize = SCREEN_H - 64;
|
||||
strcpy(fn, discfns[1]);
|
||||
ret = file_select_ex("Please choose a disc image", fn, "IMG;IMA", 260, xsize, ysize);
|
||||
if (ret)
|
||||
{
|
||||
savedisc(1);
|
||||
loaddisc(1, fn);
|
||||
saveconfig();
|
||||
}
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static int disc_eject_a()
|
||||
{
|
||||
savedisc(0);
|
||||
ejectdisc(0);
|
||||
saveconfig();
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static int disc_eject_b()
|
||||
{
|
||||
savedisc(1);
|
||||
ejectdisc(1);
|
||||
saveconfig();
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static MENU disc_menu[]=
|
||||
{
|
||||
{"Load drive &A:...", disc_load_a, NULL, 0, NULL},
|
||||
{"Load drive &B:...", disc_load_b, NULL, 0, NULL},
|
||||
{"&Eject drive &A:", disc_eject_a, NULL, 0, NULL},
|
||||
{"Eject drive &B:", disc_eject_b, NULL, 0, NULL},
|
||||
{"&Configure hard discs...", disc_hdconf, NULL, 0, NULL},
|
||||
{NULL,NULL,NULL,0,NULL}
|
||||
};
|
||||
|
||||
static MENU cdrom_menu[];
|
||||
|
||||
static void cdrom_update()
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; cdrom_menu[c].text; c++)
|
||||
cdrom_menu[c].flags = 0;
|
||||
|
||||
if (!cdrom_enabled)
|
||||
cdrom_menu[0].flags = D_SELECTED;
|
||||
else
|
||||
cdrom_menu[1].flags = D_SELECTED;
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static int cdrom_disabled()
|
||||
{
|
||||
if (!cdrom_enabled)
|
||||
return D_O_K;
|
||||
|
||||
if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1)
|
||||
{
|
||||
atapi->exit();
|
||||
cdrom_enabled = 0;
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
cdrom_update();
|
||||
}
|
||||
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
static int cdrom_empty()
|
||||
{
|
||||
if (cdrom_enabled)
|
||||
{
|
||||
atapi->exit();
|
||||
cdrom_drive = -1;
|
||||
cdrom_null_open(cdrom_drive);
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1)
|
||||
{
|
||||
cdrom_drive = -1;
|
||||
cdrom_enabled = 1;
|
||||
cdrom_null_open(cdrom_drive);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
cdrom_update();
|
||||
}
|
||||
}
|
||||
|
||||
static int cdrom_dev()
|
||||
{
|
||||
if (cdrom_enabled)
|
||||
{
|
||||
atapi->exit();
|
||||
cdrom_drive = 0;
|
||||
ioctl_open(cdrom_drive);
|
||||
return D_O_K;
|
||||
}
|
||||
|
||||
if (alert("This will reset PCem!", "Okay to continue?", NULL, "OK", "Cancel", 0, 0) == 1)
|
||||
{
|
||||
cdrom_drive = 0;
|
||||
cdrom_enabled = 1;
|
||||
ioctl_open(cdrom_drive);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
cdrom_update();
|
||||
}
|
||||
}
|
||||
|
||||
static MENU cdrom_menu[] =
|
||||
{
|
||||
{"&Disabled", cdrom_disabled, NULL, 0, NULL},
|
||||
{"&Empty", cdrom_empty, NULL, 0, NULL},
|
||||
{"/dev/cdrom", cdrom_dev, NULL, 0, NULL},
|
||||
{NULL,NULL,NULL,0,NULL}
|
||||
};
|
||||
|
||||
static MENU settings_menu[]=
|
||||
{
|
||||
{"&Configure...", settings_configure, NULL, 0, NULL},
|
||||
{"CD-ROM", NULL, cdrom_menu, 0, NULL},
|
||||
{NULL,NULL,NULL,0,NULL}
|
||||
};
|
||||
|
||||
static MENU main_menu[]=
|
||||
{
|
||||
{"&File", NULL, file_menu, 0, NULL},
|
||||
{"&Disc", NULL, disc_menu, 0, NULL},
|
||||
{"&Settings", NULL, settings_menu, 0, NULL},
|
||||
{NULL,NULL,NULL,0,NULL}
|
||||
};
|
||||
|
||||
static DIALOG pcem_gui[]=
|
||||
{
|
||||
{d_menu_proc, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, main_menu, NULL, NULL},
|
||||
{d_yield_proc, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, NULL, NULL, NULL},
|
||||
{0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,NULL}
|
||||
};
|
||||
|
||||
void gui_enter()
|
||||
{
|
||||
DIALOG_PLAYER *dp;
|
||||
int x = 1;
|
||||
infocus = 0;
|
||||
|
||||
dp = init_dialog(pcem_gui, 0);
|
||||
show_mouse(screen);
|
||||
while (x && !(mouse_b & 2) && !key[KEY_ESC])
|
||||
{
|
||||
x = update_dialog(dp);
|
||||
}
|
||||
show_mouse(NULL);
|
||||
shutdown_dialog(dp);
|
||||
|
||||
clear(screen);
|
||||
clear_keybuf();
|
||||
|
||||
infocus = 1;
|
||||
|
||||
device_force_redraw();
|
||||
}
|
10
src/allegro-gui.h
Normal file
10
src/allegro-gui.h
Normal file
@@ -0,0 +1,10 @@
|
||||
void gui_enter();
|
||||
|
||||
extern int quited;
|
||||
|
||||
extern int romspresent[ROM_MAX];
|
||||
extern int gfx_present[GFX_MAX];
|
||||
|
||||
int disc_hdconf();
|
||||
|
||||
int settings_configure();
|
30
src/allegro-joystick.c
Normal file
30
src/allegro-joystick.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "allegro-main.h"
|
||||
#include "plat-joystick.h"
|
||||
|
||||
joystick_t joystick_state[2];
|
||||
int joysticks_present;
|
||||
|
||||
void joystick_init()
|
||||
{
|
||||
install_joystick(JOY_TYPE_AUTODETECT);
|
||||
joysticks_present = MIN(num_joysticks, 2);
|
||||
}
|
||||
void joystick_close()
|
||||
{
|
||||
}
|
||||
void joystick_poll()
|
||||
{
|
||||
int c;
|
||||
|
||||
poll_joystick();
|
||||
|
||||
for (c = 0; c < MIN(num_joysticks, 2); c++)
|
||||
{
|
||||
joystick_state[c].x = joy[c].stick[0].axis[0].pos * 256;
|
||||
joystick_state[c].y = joy[c].stick[0].axis[1].pos * 256;
|
||||
joystick_state[c].b[0] = joy[c].button[0].b;
|
||||
joystick_state[c].b[1] = joy[c].button[1].b;
|
||||
joystick_state[c].b[2] = joy[c].button[2].b;
|
||||
joystick_state[c].b[3] = joy[c].button[3].b;
|
||||
}
|
||||
}
|
49
src/allegro-keyboard.c
Normal file
49
src/allegro-keyboard.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "allegro-main.h"
|
||||
#include "plat-keyboard.h"
|
||||
|
||||
int pcem_key[272];
|
||||
int rawinputkey[272];
|
||||
|
||||
static int key_convert[128] =
|
||||
{
|
||||
-1, 0x1e, 0x30, 0x2e, 0x20, 0x12, 0x21, 0x22, /* , A, B, C, D, E, F, G*/
|
||||
0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18, /* H, I, J, K, L, M, N, O*/
|
||||
0x19, 0x10, 0x13, 0x1f, 0x14, 0x16, 0x2f, 0x11, /* P, Q, R, S, T, U, V, W*/
|
||||
0x2d, 0x15, 0x2c, 0x0b, 0x02, 0x03, 0x04, 0x05, /* X, Y, Z, 0, 1, 2, 3, 4*/
|
||||
0x06, 0x07, 0x08, 0x09, 0x0a, 0x52, 0x4f, 0x50, /* 5, 6, 7, 8, 9, p0, p1, p2*/
|
||||
0x51, 0x4b, 0x4c, 0x4d, 0x47, 0x48, 0x49, 0x3b, /* p3, p4, p5, p6, p7, p8, p9, F1*/
|
||||
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, /* F2, F3, F4, F5, F6, F7, F8, F9*/
|
||||
0x44, 0x57, 0x58, 0x01, 0x29, 0x0c, 0x0d, 0x0e, /*F10, F11, F12, ESC, `<60>, -_, =+, backspace*/
|
||||
0x0f, 0x1a, 0x1b, 0x1c, 0x27, 0x28, 0x2b, 0x56, /*TAB, [{, ]}, ENT, ;:, '@, \|, #~*/
|
||||
0x33, 0x34, 0x35, 0x39, 0xd2, 0xd3, 0xc7, 0xcf, /* ,<, .>, /?, SPC, INS, DEL, HOME, END*/
|
||||
0xc9, 0xd1, 0xcb, 0xcd, 0xc8, 0xd0, 0xb5, 0x37, /*PGU, PGD, LFT, RHT, UP, DN, /, * */
|
||||
0x4a, 0x4e, 0x53, 0x9c, 0xff, -1, -1, -1, /* p-, p+, pDL, pEN, psc, pse, abnt, yen*/
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, /*kana, convert, noconvert, at, circumflex, colon2, kanji, pad equals*/
|
||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 0x2a, 0x36, 0x1d, 0x9d, 0x38, /*, , lshift, rshift, lctrl, rctrl, alt*/
|
||||
0xb8, 0xdb, 0xdc, 0xdd, 0x46, 0x45, 0x3a, -1 /*altgr, lwin, rwin, menu, scrlock, numlock, capslock*/
|
||||
};
|
||||
|
||||
void keyboard_init()
|
||||
{
|
||||
install_keyboard();
|
||||
}
|
||||
|
||||
void keyboard_close()
|
||||
{
|
||||
}
|
||||
|
||||
void keyboard_poll_host()
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < 128; c++)
|
||||
{
|
||||
int key_idx = key_convert[c];
|
||||
if (key_idx == -1)
|
||||
continue;
|
||||
|
||||
if (key[c] != pcem_key[key_idx])
|
||||
pcem_key[key_idx] = key[c];
|
||||
}
|
||||
}
|
167
src/allegro-main.c
Normal file
167
src/allegro-main.c
Normal file
@@ -0,0 +1,167 @@
|
||||
#include "allegro-main.h"
|
||||
#include "ibm.h"
|
||||
#include "cpu.h"
|
||||
#include "model.h"
|
||||
#include "nvr.h"
|
||||
#include "video.h"
|
||||
|
||||
#undef printf
|
||||
|
||||
int mousecapture = 0;
|
||||
int quited = 0;
|
||||
int winsizex = -1, winsizey = -1;
|
||||
|
||||
int romspresent[ROM_MAX];
|
||||
int gfx_present[GFX_MAX];
|
||||
|
||||
void updatewindowsize(int x, int y)
|
||||
{
|
||||
if (x < 128)
|
||||
x = 128;
|
||||
if (y < 128)
|
||||
y = 128;
|
||||
if (winsizex != x || winsizey != y)
|
||||
{
|
||||
winsizex = x;
|
||||
winsizey = y;
|
||||
allegro_video_update_size(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void startblit()
|
||||
{
|
||||
}
|
||||
|
||||
void endblit()
|
||||
{
|
||||
}
|
||||
|
||||
static int ticks = 0;
|
||||
static void timer_rout()
|
||||
{
|
||||
ticks++;
|
||||
}
|
||||
|
||||
uint64_t timer_freq;
|
||||
uint64_t timer_read()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int frames = 0;
|
||||
int c, d;
|
||||
allegro_init();
|
||||
allegro_video_init();
|
||||
install_timer();
|
||||
install_int_ex(timer_rout, BPS_TO_TIMER(100));
|
||||
install_int_ex(onesec, BPS_TO_TIMER(1));
|
||||
midi_init();
|
||||
|
||||
initpc();
|
||||
|
||||
d = romset;
|
||||
for (c = 0; c < ROM_MAX; c++)
|
||||
{
|
||||
romset = c;
|
||||
romspresent[c] = loadbios();
|
||||
pclog("romset %i - %i\n", c, romspresent[c]);
|
||||
}
|
||||
|
||||
for (c = 0; c < ROM_MAX; c++)
|
||||
{
|
||||
if (romspresent[c])
|
||||
break;
|
||||
}
|
||||
if (c == ROM_MAX)
|
||||
{
|
||||
printf("No ROMs present!\nYou must have at least one romset to use PCem.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
romset=d;
|
||||
c=loadbios();
|
||||
|
||||
if (!c)
|
||||
{
|
||||
if (romset != -1)
|
||||
printf("Configured romset not available.\nDefaulting to available romset.");
|
||||
for (c = 0; c < ROM_MAX; c++)
|
||||
{
|
||||
if (romspresent[c])
|
||||
{
|
||||
romset = c;
|
||||
model = model_getmodel(romset);
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c < GFX_MAX; c++)
|
||||
gfx_present[c] = video_card_available(video_old_to_new(c));
|
||||
|
||||
if (!video_card_available(video_old_to_new(gfxcard)))
|
||||
{
|
||||
if (gfxcard) printf("Configured video BIOS not available.\nDefaulting to available romset.");
|
||||
for (c = GFX_MAX-1; c >= 0; c--)
|
||||
{
|
||||
if (gfx_present[c])
|
||||
{
|
||||
gfxcard = c;
|
||||
saveconfig();
|
||||
resetpchard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ticks = 0;
|
||||
while (!quited)
|
||||
{
|
||||
if (ticks)
|
||||
{
|
||||
ticks--;
|
||||
runpc();
|
||||
frames++;
|
||||
if (frames >= 200 && nvr_dosave)
|
||||
{
|
||||
frames = 0;
|
||||
nvr_dosave = 0;
|
||||
savenvr();
|
||||
}
|
||||
}
|
||||
else
|
||||
rest(1);
|
||||
|
||||
if (ticks > 10)
|
||||
ticks = 0;
|
||||
|
||||
if ((mouse_b & 1) && !mousecapture)
|
||||
mousecapture = 1;
|
||||
|
||||
if (((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_END]) || (mouse_b & 4))
|
||||
mousecapture = 0;
|
||||
|
||||
if ((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_ALT] && key[KEY_PGDN])
|
||||
{
|
||||
int old_winsizex = winsizex, old_winsizey = winsizey;
|
||||
if (winsizex < 512 || winsizey < 350)
|
||||
updatewindowsize(512, 350);
|
||||
gui_enter();
|
||||
if (old_winsizex < 512 || old_winsizey < 350)
|
||||
updatewindowsize(old_winsizex, old_winsizey);
|
||||
ticks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
closepc();
|
||||
|
||||
midi_close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
END_OF_MAIN();
|
15
src/allegro-main.h
Normal file
15
src/allegro-main.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#define getr8 allegro_getr8
|
||||
#define setr8 allegro_setr8
|
||||
#define get_filename allegro_get_filename
|
||||
#define append_filename allegro_append_filename
|
||||
#define put_backslash allegro_put_backslash
|
||||
#define GFX_VGA allegro_GFX_VGA
|
||||
|
||||
#include <allegro.h>
|
||||
|
||||
#undef GFX_VGA
|
||||
#undef getr8
|
||||
#undef setr8
|
||||
#undef get_filename
|
||||
#undef append_filename
|
||||
#undef put_backslash
|
45
src/allegro-midi.c
Normal file
45
src/allegro-midi.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "allegro-main.h"
|
||||
#include "ibm.h"
|
||||
#include "plat-midi.h"
|
||||
|
||||
//#define USE_ALLEGRO_MIDI
|
||||
|
||||
void midi_init()
|
||||
{
|
||||
#ifdef USE_ALLEGRO_MIDI
|
||||
install_sound(DIGI_NONE, MIDI_AUTODETECT, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void midi_close()
|
||||
{
|
||||
#ifdef USE_ALLEGRO_MIDI
|
||||
remove_sound();
|
||||
#endif
|
||||
}
|
||||
|
||||
static int midi_cmd_pos, midi_len;
|
||||
static uint8_t midi_command[3];
|
||||
static int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 0};
|
||||
|
||||
void midi_write(uint8_t val)
|
||||
{
|
||||
if (val & 0x80)
|
||||
{
|
||||
midi_cmd_pos = 0;
|
||||
midi_len = midi_lengths[(val >> 4) & 7];
|
||||
midi_command[0] = midi_command[1] = midi_command[2] = 0;
|
||||
}
|
||||
|
||||
if (midi_len && midi_cmd_pos < 3)
|
||||
{
|
||||
midi_command[midi_cmd_pos] = val;
|
||||
|
||||
midi_cmd_pos++;
|
||||
|
||||
#ifdef USE_ALLEGRO_MIDI
|
||||
if (midi_cmd_pos == midi_len)
|
||||
midi_out(midi_command, midi_len);
|
||||
#endif
|
||||
}
|
||||
}
|
31
src/allegro-mouse.c
Normal file
31
src/allegro-mouse.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "allegro-main.h"
|
||||
#include "plat-mouse.h"
|
||||
|
||||
int mouse_buttons;
|
||||
|
||||
void mouse_init()
|
||||
{
|
||||
install_mouse();
|
||||
}
|
||||
|
||||
void mouse_close()
|
||||
{
|
||||
}
|
||||
|
||||
void mouse_poll_host()
|
||||
{
|
||||
//poll_mouse();
|
||||
mouse_buttons = mouse_b;
|
||||
}
|
||||
|
||||
void mouse_get_mickeys(int *x, int *y)
|
||||
{
|
||||
if (mousecapture)
|
||||
{
|
||||
get_mouse_mickeys(x, y);
|
||||
// position_mouse(64, 64);
|
||||
}
|
||||
else
|
||||
*x = *y = 0;
|
||||
}
|
||||
|
109
src/allegro-video.c
Normal file
109
src/allegro-video.c
Normal file
@@ -0,0 +1,109 @@
|
||||
#include "allegro-main.h"
|
||||
#include "ibm.h"
|
||||
#include "video.h"
|
||||
|
||||
#include "allegro-video.h"
|
||||
|
||||
static PALETTE cgapal=
|
||||
{
|
||||
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
|
||||
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
|
||||
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
|
||||
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
|
||||
|
||||
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
|
||||
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
|
||||
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
|
||||
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
|
||||
|
||||
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
|
||||
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
|
||||
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
|
||||
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
|
||||
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
};
|
||||
|
||||
static uint32_t pal_lookup[256];
|
||||
|
||||
static void allegro_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
static void allegro_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
static BITMAP *buffer32_vscale;
|
||||
void allegro_video_init()
|
||||
{
|
||||
int c;
|
||||
|
||||
set_color_depth(32);
|
||||
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
|
||||
video_blit_memtoscreen = allegro_blit_memtoscreen;
|
||||
video_blit_memtoscreen_8 = allegro_blit_memtoscreen_8;
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
|
||||
|
||||
buffer32_vscale = create_bitmap(2048, 2048);
|
||||
}
|
||||
|
||||
void allegro_video_close()
|
||||
{
|
||||
destroy_bitmap(buffer32_vscale);
|
||||
}
|
||||
|
||||
void allegro_video_update_size(int x, int y)
|
||||
{
|
||||
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, x, y, 0, 0))
|
||||
fatal("Failed to set gfx mode %i,%i : %s\n", x, y, allegro_error);
|
||||
}
|
||||
|
||||
static void allegro_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
||||
{
|
||||
if (h < winsizey)
|
||||
{
|
||||
int yy;
|
||||
|
||||
for (yy = y+y1; yy < y+y2; yy++)
|
||||
{
|
||||
if (yy >= 0)
|
||||
{
|
||||
memcpy(&((uint32_t *)buffer32_vscale->line[yy*2])[x], &((uint32_t *)buffer32->line[yy])[x], w*4);
|
||||
memcpy(&((uint32_t *)buffer32_vscale->line[(yy*2)+1])[x], &((uint32_t *)buffer32->line[yy])[x], w*4);
|
||||
}
|
||||
}
|
||||
|
||||
blit(buffer32_vscale, screen, x, (y+y1)*2, 0, y1, w, (y2-y1)*2);
|
||||
}
|
||||
else
|
||||
blit(buffer32, screen, x, y+y1, 0, y1, w, y2-y1);
|
||||
}
|
||||
|
||||
static void allegro_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
int xx, yy;
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
h += y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
for (yy = y; yy < y+h; yy++)
|
||||
{
|
||||
int dy = yy*2;
|
||||
for (xx = x; xx < x+w; xx++)
|
||||
{
|
||||
((uint32_t *)buffer32->line[dy])[xx] =
|
||||
((uint32_t *)buffer32->line[dy + 1])[xx] = pal_lookup[buffer->line[yy][xx]];
|
||||
}
|
||||
}
|
||||
|
||||
if (readflash)
|
||||
{
|
||||
rectfill(buffer32, x+SCREEN_W-40, y*2+8, SCREEN_W-8, y*2+14, makecol(255, 255, 255));
|
||||
readflash = 0;
|
||||
}
|
||||
|
||||
blit(buffer32, screen, x, y*2, 0, 0, w, h*2);
|
||||
}
|
3
src/allegro-video.h
Normal file
3
src/allegro-video.h
Normal file
@@ -0,0 +1,3 @@
|
||||
void allegro_video_init();
|
||||
void allegro_video_close();
|
||||
void allegro_video_update_size(int x, int y);
|
501
src/cdrom-ioctl-linux.c
Normal file
501
src/cdrom-ioctl-linux.c
Normal file
@@ -0,0 +1,501 @@
|
||||
/*Linux CD-ROM support via IOCTL*/
|
||||
|
||||
#include <linux/cdrom.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
#include "cdrom-ioctl.h"
|
||||
|
||||
static ATAPI ioctl_atapi;
|
||||
|
||||
static uint32_t last_block = 0;
|
||||
static int ioctl_inited = 0;
|
||||
static char ioctl_path[8];
|
||||
static void ioctl_close(void);
|
||||
static int tocvalid = 0;
|
||||
static struct cdrom_tocentry toc[100];
|
||||
static int first_track, last_track;
|
||||
|
||||
#define MSFtoLBA(m,s,f) (((((m*60)+s)*75)+f)-150)
|
||||
|
||||
enum
|
||||
{
|
||||
CD_STOPPED = 0,
|
||||
CD_PLAYING,
|
||||
CD_PAUSED
|
||||
};
|
||||
|
||||
static int ioctl_cd_state = CD_STOPPED;
|
||||
static uint32_t ioctl_cd_pos = 0, ioctl_cd_end = 0;
|
||||
|
||||
#define BUF_SIZE 32768
|
||||
static int16_t cd_buffer[BUF_SIZE];
|
||||
static int cd_buflen = 0;
|
||||
void ioctl_audio_callback(int16_t *output, int len)
|
||||
{
|
||||
int fd;
|
||||
struct cdrom_read_audio read_audio;
|
||||
|
||||
// pclog("Audio callback %08X %08X %i %i %i %04X %i\n", ioctl_cd_pos, ioctl_cd_end, ioctl_cd_state, cd_buflen, len, cd_buffer[4], GetTickCount());
|
||||
if (ioctl_cd_state != CD_PLAYING)
|
||||
{
|
||||
memset(output, 0, len * 2);
|
||||
return;
|
||||
}
|
||||
fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
{
|
||||
memset(output, 0, len * 2);
|
||||
return;
|
||||
}
|
||||
|
||||
while (cd_buflen < len)
|
||||
{
|
||||
if (ioctl_cd_pos < ioctl_cd_end)
|
||||
{
|
||||
read_audio.addr.lba = ioctl_cd_pos;
|
||||
read_audio.addr_format = CDROM_LBA;
|
||||
read_audio.nframes = 1;
|
||||
read_audio.buf = (__u8 *)&cd_buffer[cd_buflen];
|
||||
|
||||
if (ioctl(fd, CDROMREADAUDIO, &read_audio) < 0)
|
||||
{
|
||||
// pclog("DeviceIoControl returned false\n");
|
||||
memset(&cd_buffer[cd_buflen], 0, (BUF_SIZE - cd_buflen) * 2);
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
cd_buflen = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
// pclog("DeviceIoControl returned true\n");
|
||||
ioctl_cd_pos++;
|
||||
cd_buflen += (2352 / 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&cd_buffer[cd_buflen], 0, (BUF_SIZE - cd_buflen) * 2);
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
cd_buflen = len;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
memcpy(output, cd_buffer, len * 2);
|
||||
// for (c = 0; c < BUF_SIZE - len; c++)
|
||||
// cd_buffer[c] = cd_buffer[c + cd_buflen];
|
||||
memcpy(&cd_buffer[0], &cd_buffer[len], (BUF_SIZE - len) * 2);
|
||||
cd_buflen -= len;
|
||||
// pclog("Done %i\n", GetTickCount());
|
||||
}
|
||||
|
||||
void ioctl_audio_stop()
|
||||
{
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
}
|
||||
|
||||
static int get_track_nr(uint32_t pos)
|
||||
{
|
||||
int c;
|
||||
int track = 0;
|
||||
|
||||
if (!tocvalid)
|
||||
return 0;
|
||||
|
||||
for (c = first_track; c < last_track; c++)
|
||||
{
|
||||
uint32_t track_address = toc[c].cdte_addr.msf.frame +
|
||||
(toc[c].cdte_addr.msf.second * 75) +
|
||||
(toc[c].cdte_addr.msf.minute * 75 * 60);
|
||||
//pclog("get_track_nr: track=%i pos=%x track_address=%x\n", c, pos, track_address);
|
||||
if (track_address <= pos)
|
||||
track = c;
|
||||
}
|
||||
return track;
|
||||
}
|
||||
|
||||
static void ioctl_playaudio(uint32_t pos, uint32_t len, int ismsf)
|
||||
{
|
||||
// pclog("Play audio - %08X %08X %i\n", pos, len, ismsf);
|
||||
if (ismsf)
|
||||
{
|
||||
pos = (pos & 0xff) + (((pos >> 8) & 0xff) * 75) + (((pos >> 16) & 0xff) * 75 * 60);
|
||||
len = (len & 0xff) + (((len >> 8) & 0xff) * 75) + (((len >> 16) & 0xff) * 75 * 60);
|
||||
// pclog("MSF - pos = %08X len = %08X\n", pos, len);
|
||||
}
|
||||
else
|
||||
len += pos;
|
||||
ioctl_cd_pos = pos;// + 150;
|
||||
ioctl_cd_end = pos+len;// + 150;
|
||||
ioctl_cd_state = CD_PLAYING;
|
||||
// pclog("Audio start %08X %08X %i %i %i\n", ioctl_cd_pos, ioctl_cd_end, ioctl_cd_state, 0, len);
|
||||
}
|
||||
|
||||
static void ioctl_pause(void)
|
||||
{
|
||||
if (ioctl_cd_state == CD_PLAYING)
|
||||
ioctl_cd_state = CD_PAUSED;
|
||||
}
|
||||
|
||||
static void ioctl_resume(void)
|
||||
{
|
||||
if (ioctl_cd_state == CD_PAUSED)
|
||||
ioctl_cd_state = CD_PLAYING;
|
||||
}
|
||||
|
||||
static void ioctl_stop(void)
|
||||
{
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
}
|
||||
|
||||
static void ioctl_seek(uint32_t pos)
|
||||
{
|
||||
// pclog("Seek %08X\n", pos);
|
||||
ioctl_cd_pos = pos;
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
}
|
||||
|
||||
static int read_toc(int fd)
|
||||
{
|
||||
struct cdrom_tochdr toc_hdr;
|
||||
int track, err;
|
||||
//pclog("read_toc\n");
|
||||
err = ioctl(fd, CDROMREADTOCHDR, &toc_hdr);
|
||||
if (err == -1)
|
||||
{
|
||||
pclog("read_toc: CDROMREADTOCHDR failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
first_track = toc_hdr.cdth_trk0;
|
||||
last_track = toc_hdr.cdth_trk1;
|
||||
//pclog("read_toc: first_track=%i last_track=%i\n", first_track, last_track);
|
||||
memset(toc, 0, sizeof(toc));
|
||||
|
||||
for (track = toc_hdr.cdth_trk0; track <= toc_hdr.cdth_trk1; track++)
|
||||
{
|
||||
toc[track].cdte_track = track;
|
||||
toc[track].cdte_format = CDROM_MSF;
|
||||
err = ioctl(fd, CDROMREADTOCENTRY, &toc[track]);
|
||||
if (err == -1)
|
||||
{
|
||||
// pclog("read_toc: CDROMREADTOCENTRY failed on track %i\n", track);
|
||||
return 0;
|
||||
}
|
||||
// pclog("read_toc: Track %02X - number %02X control %02X adr %02X address %02X %02X %02X %02X\n", track, toc[track].cdte_track, toc[track].cdte_ctrl, toc[track].cdte_adr, 0, toc[track].cdte_addr.msf.minute, toc[track].cdte_addr.msf.second, toc[track].cdte_addr.msf.frame);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ioctl_ready(void)
|
||||
{
|
||||
long size;
|
||||
int temp;
|
||||
struct cdrom_tochdr toc_hdr;
|
||||
struct cdrom_tocentry toc_entry;
|
||||
int err;
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
return 0;
|
||||
|
||||
err = ioctl(fd, CDROMREADTOCHDR, &toc_hdr);
|
||||
if (err == -1)
|
||||
{
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
// pclog("CDROMREADTOCHDR: start track=%i end track=%i\n", toc_hdr.cdth_trk0, toc_hdr.cdth_trk1);
|
||||
toc_entry.cdte_track = toc_hdr.cdth_trk1;
|
||||
toc_entry.cdte_format = CDROM_MSF;
|
||||
err = ioctl(fd, CDROMREADTOCENTRY, &toc_entry);
|
||||
if (err == -1)
|
||||
{
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
// pclog("CDROMREADTOCENTRY: addr=%02i:%02i:%02i\n", toc_entry.cdte_addr.msf.minute, toc_entry.cdte_addr.msf.second, toc_entry.cdte_addr.msf.frame);
|
||||
if ((toc_entry.cdte_addr.msf.minute != toc[toc_hdr.cdth_trk1].cdte_addr.msf.minute) ||
|
||||
(toc_entry.cdte_addr.msf.second != toc[toc_hdr.cdth_trk1].cdte_addr.msf.second) ||
|
||||
(toc_entry.cdte_addr.msf.frame != toc[toc_hdr.cdth_trk1].cdte_addr.msf.frame ) ||
|
||||
!tocvalid)
|
||||
{
|
||||
int track;
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
|
||||
tocvalid = read_toc(fd);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t ioctl_getcurrentsubchannel(uint8_t *b, int msf)
|
||||
{
|
||||
struct cdrom_subchnl sub;
|
||||
uint32_t cdpos = ioctl_cd_pos;
|
||||
int track = get_track_nr(cdpos);
|
||||
uint32_t track_address = toc[track].cdte_addr.msf.frame +
|
||||
(toc[track].cdte_addr.msf.second * 75) +
|
||||
(toc[track].cdte_addr.msf.minute * 75 * 60);
|
||||
long size;
|
||||
int pos=0;
|
||||
int err;
|
||||
uint8_t ret;
|
||||
//pclog("ioctl_getsubchannel: cdpos=%x track_address=%x track=%i\n", cdpos, track_address, track);
|
||||
if (ioctl_cd_state == CD_PLAYING)
|
||||
ret = 0x11;
|
||||
else if (ioctl_cd_state == CD_PAUSED)
|
||||
ret = 0x12;
|
||||
else
|
||||
ret = 0x13;
|
||||
|
||||
b[pos++] = (toc[track].cdte_adr << 4) | toc[track].cdte_ctrl;
|
||||
b[pos++] = track;
|
||||
b[pos++] = 0;
|
||||
|
||||
if (msf)
|
||||
{
|
||||
uint32_t dat = cdpos;
|
||||
b[pos + 3] = (uint8_t)(dat % 75); dat /= 75;
|
||||
b[pos + 2] = (uint8_t)(dat % 60); dat /= 60;
|
||||
b[pos + 1] = (uint8_t)dat;
|
||||
b[pos] = 0;
|
||||
pos += 4;
|
||||
dat = cdpos - track_address;
|
||||
b[pos + 3] = (uint8_t)(dat % 75); dat /= 75;
|
||||
b[pos + 2] = (uint8_t)(dat % 60); dat /= 60;
|
||||
b[pos + 1] = (uint8_t)dat;
|
||||
b[pos] = 0;
|
||||
pos += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
b[pos++] = (cdpos >> 24) & 0xff;
|
||||
b[pos++] = (cdpos >> 16) & 0xff;
|
||||
b[pos++] = (cdpos >> 8) & 0xff;
|
||||
b[pos++] = cdpos & 0xff;
|
||||
cdpos -= track_address;
|
||||
b[pos++] = (cdpos >> 24) & 0xff;
|
||||
b[pos++] = (cdpos >> 16) & 0xff;
|
||||
b[pos++] = (cdpos >> 8) & 0xff;
|
||||
b[pos++] = cdpos & 0xff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ioctl_eject(void)
|
||||
{
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
return;
|
||||
|
||||
ioctl(fd, CDROMEJECT);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void ioctl_load(void)
|
||||
{
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
return;
|
||||
|
||||
ioctl(fd, CDROMEJECT);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void ioctl_readsector(uint8_t *b, int sector)
|
||||
{
|
||||
int cdrom = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
if (cdrom <= 0)
|
||||
return;
|
||||
lseek(cdrom, sector*2048, SEEK_SET);
|
||||
read(cdrom, b, 2048);
|
||||
close(cdrom);
|
||||
}
|
||||
|
||||
static int ioctl_readtoc(unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single)
|
||||
{
|
||||
int len=4;
|
||||
long size;
|
||||
int c,d;
|
||||
uint32_t temp;
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
return 0;
|
||||
|
||||
ioctl_cd_state = CD_STOPPED;
|
||||
|
||||
tocvalid = read_toc(fd);
|
||||
|
||||
close(fd);
|
||||
|
||||
if (!tocvalid)
|
||||
return 4;
|
||||
|
||||
// pclog("Read TOC done! %i\n",single);
|
||||
b[2] = first_track;
|
||||
b[3] = last_track;
|
||||
d = 0;
|
||||
//pclog("Read TOC starttrack=%i\n", starttrack);
|
||||
for (c = 1; c <= last_track; c++)
|
||||
{
|
||||
if (toc[c].cdte_track >= starttrack)
|
||||
{
|
||||
d = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
b[2] = toc[c].cdte_track;
|
||||
last_block = 0;
|
||||
for (c = d; c <= last_track; c++)
|
||||
{
|
||||
uint32_t address;
|
||||
if ((len + 8) > maxlen)
|
||||
break;
|
||||
// pclog("Len %i max %i Track %02X - %02X %02X %02i:%02i:%02i %08X\n",len,maxlen,toc[c].cdte_track,toc[c].cdte_adr,toc[c].cdte_ctrl,toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame,MSFtoLBA(toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame));
|
||||
b[len++] = 0; /*Reserved*/
|
||||
b[len++] = (toc[c].cdte_adr << 4) | toc[c].cdte_ctrl;
|
||||
b[len++] = toc[c].cdte_track;
|
||||
b[len++] = 0; /*Reserved*/
|
||||
address = MSFtoLBA(toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame);
|
||||
if (address > last_block)
|
||||
last_block = address;
|
||||
|
||||
if (msf)
|
||||
{
|
||||
b[len++] = 0;
|
||||
b[len++] = toc[c].cdte_addr.msf.minute;
|
||||
b[len++] = toc[c].cdte_addr.msf.second;
|
||||
b[len++] = toc[c].cdte_addr.msf.frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = MSFtoLBA(toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame);
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
b[len++] = temp;
|
||||
}
|
||||
if (single)
|
||||
break;
|
||||
}
|
||||
b[0] = (uint8_t)(((len-2) >> 8) & 0xff);
|
||||
b[1] = (uint8_t)((len-2) & 0xff);
|
||||
/* pclog("Table of Contents (%i bytes) : \n", size);
|
||||
pclog("First track - %02X\n", first_track);
|
||||
pclog("Last track - %02X\n", last_track);
|
||||
for (c = 0; c <= last_track; c++)
|
||||
pclog("Track %02X - number %02X control %02X adr %02X address %02X %02X %02X %02X\n", c, toc[c].cdte_track, toc[c].cdte_ctrl, toc[c].cdte_adr, 0, toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame);
|
||||
for (c = 0;c <= last_track; c++)
|
||||
pclog("Track %02X - number %02X control %02X adr %02X address %06X\n", c, toc[c].cdte_track, toc[c].cdte_ctrl, toc[c].cdte_adr, MSFtoLBA(toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame));*/
|
||||
return len;
|
||||
}
|
||||
|
||||
static void ioctl_readtoc_session(unsigned char *b, int msf, int maxlen)
|
||||
{
|
||||
struct cdrom_multisession session;
|
||||
int len = 4;
|
||||
int err;
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
|
||||
if (fd <= 0)
|
||||
return;
|
||||
|
||||
session.addr_format = CDROM_MSF;
|
||||
err = ioctl(fd, CDROMMULTISESSION, &session);
|
||||
|
||||
if (err == -1)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
b[len++] = 0; /*Reserved*/
|
||||
b[len++] = (toc[0].cdte_adr << 4) | toc[0].cdte_ctrl;
|
||||
b[len++] = toc[0].cdte_track;
|
||||
b[len++] = 0; /*Reserved*/
|
||||
if (msf)
|
||||
{
|
||||
b[len++] = 0;
|
||||
b[len++] = session.addr.msf.minute;
|
||||
b[len++] = session.addr.msf.second;
|
||||
b[len++] = session.addr.msf.frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t temp = MSFtoLBA(session.addr.msf.minute, session.addr.msf.second, session.addr.msf.frame);
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
b[len++] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t ioctl_size()
|
||||
{
|
||||
unsigned char b[4096];
|
||||
|
||||
atapi->readtoc(b, 0, 0, 4096, 0);
|
||||
|
||||
return last_block;
|
||||
}
|
||||
|
||||
void ioctl_reset()
|
||||
{
|
||||
int fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK);
|
||||
//pclog("ioctl_reset: fd=%i\n", fd);
|
||||
tocvalid = 0;
|
||||
|
||||
if (fd <= 0)
|
||||
return;
|
||||
|
||||
tocvalid = read_toc(fd);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
int ioctl_open(char d)
|
||||
{
|
||||
atapi=&ioctl_atapi;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ioctl_close(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void ioctl_exit(void)
|
||||
{
|
||||
ioctl_stop();
|
||||
ioctl_inited = 0;
|
||||
tocvalid=0;
|
||||
}
|
||||
|
||||
static ATAPI ioctl_atapi=
|
||||
{
|
||||
ioctl_ready,
|
||||
ioctl_readtoc,
|
||||
ioctl_readtoc_session,
|
||||
ioctl_getcurrentsubchannel,
|
||||
ioctl_readsector,
|
||||
ioctl_playaudio,
|
||||
ioctl_seek,
|
||||
ioctl_load,
|
||||
ioctl_eject,
|
||||
ioctl_pause,
|
||||
ioctl_resume,
|
||||
ioctl_size,
|
||||
ioctl_stop,
|
||||
ioctl_exit
|
||||
};
|
108
src/cdrom-null.c
Normal file
108
src/cdrom-null.c
Normal file
@@ -0,0 +1,108 @@
|
||||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
#include "cdrom-ioctl.h"
|
||||
|
||||
int cdrom_drive;
|
||||
|
||||
static ATAPI null_atapi;
|
||||
|
||||
void cdrom_null_audio_callback(int16_t *output, int len)
|
||||
{
|
||||
memset(output, 0, len * 2);
|
||||
}
|
||||
|
||||
void cdrom_null_audio_stop()
|
||||
{
|
||||
}
|
||||
|
||||
static void null_playaudio(uint32_t pos, uint32_t len, int ismsf)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_pause(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_resume(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_stop(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_seek(uint32_t pos)
|
||||
{
|
||||
}
|
||||
|
||||
static int null_ready(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t null_getcurrentsubchannel(uint8_t *b, int msf)
|
||||
{
|
||||
return 0x13;
|
||||
}
|
||||
|
||||
static void null_eject(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_load(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_readsector(uint8_t *b, int sector)
|
||||
{
|
||||
}
|
||||
|
||||
static int null_readtoc(unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void null_readtoc_session(unsigned char *b, int msf, int maxlen)
|
||||
{
|
||||
}
|
||||
|
||||
static uint32_t null_size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cdrom_null_reset()
|
||||
{
|
||||
}
|
||||
|
||||
int cdrom_null_open(char d)
|
||||
{
|
||||
atapi = &null_atapi;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void null_close(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void null_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
static ATAPI null_atapi =
|
||||
{
|
||||
null_ready,
|
||||
null_readtoc,
|
||||
null_readtoc_session,
|
||||
null_getcurrentsubchannel,
|
||||
null_readsector,
|
||||
null_playaudio,
|
||||
null_seek,
|
||||
null_load,
|
||||
null_eject,
|
||||
null_pause,
|
||||
null_resume,
|
||||
null_size,
|
||||
null_stop,
|
||||
null_exit
|
||||
};
|
10
src/cdrom-null.h
Normal file
10
src/cdrom-null.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef CDROM_IOCTL_H
|
||||
#define CDROM_IOCTL_H
|
||||
|
||||
/* this header file lists the functions provided by
|
||||
various platform specific cdrom-ioctl files */
|
||||
|
||||
extern int cdrom_null_open(char d);
|
||||
extern void cdrom_null_reset();
|
||||
|
||||
#endif /* ! CDROM_IOCTL_H */
|
13
src/config.c
13
src/config.c
@@ -191,11 +191,6 @@ void config_load(char *fn)
|
||||
|
||||
|
||||
|
||||
void set_config_file(char *s)
|
||||
{
|
||||
strcpy(config_file, s);
|
||||
}
|
||||
|
||||
void config_new()
|
||||
{
|
||||
FILE *f = fopen(config_file, "wt");
|
||||
@@ -258,7 +253,7 @@ static entry_t *create_entry(section_t *section, char *name)
|
||||
return new_entry;
|
||||
}
|
||||
|
||||
int get_config_int(char *head, char *name, int def)
|
||||
int config_get_int(char *head, char *name, int def)
|
||||
{
|
||||
section_t *section;
|
||||
entry_t *entry;
|
||||
@@ -279,7 +274,7 @@ int get_config_int(char *head, char *name, int def)
|
||||
return value;
|
||||
}
|
||||
|
||||
char *get_config_string(char *head, char *name, char *def)
|
||||
char *config_get_string(char *head, char *name, char *def)
|
||||
{
|
||||
section_t *section;
|
||||
entry_t *entry;
|
||||
@@ -298,7 +293,7 @@ char *get_config_string(char *head, char *name, char *def)
|
||||
return entry->data;
|
||||
}
|
||||
|
||||
void set_config_int(char *head, char *name, int val)
|
||||
void config_set_int(char *head, char *name, int val)
|
||||
{
|
||||
section_t *section;
|
||||
entry_t *entry;
|
||||
@@ -316,7 +311,7 @@ void set_config_int(char *head, char *name, int val)
|
||||
sprintf(entry->data, "%i", val);
|
||||
}
|
||||
|
||||
void set_config_string(char *head, char *name, char *val)
|
||||
void config_set_string(char *head, char *name, char *val)
|
||||
{
|
||||
section_t *section;
|
||||
entry_t *entry;
|
||||
|
@@ -1,8 +1,7 @@
|
||||
void set_config_file(char *s);
|
||||
int get_config_int(char *head, char *name, int def);
|
||||
char *get_config_string(char *head, char *name, char *def);
|
||||
void set_config_int(char *head, char *name, int val);
|
||||
void set_config_string(char *head, char *name, char *val);
|
||||
int config_get_int(char *head, char *name, int def);
|
||||
char *config_get_string(char *head, char *name, char *def);
|
||||
void config_set_int(char *head, char *name, int val);
|
||||
void config_set_string(char *head, char *name, char *val);
|
||||
|
||||
char *get_filename(char *s);
|
||||
void append_filename(char *dest, char *s1, char *s2, int size);
|
||||
|
@@ -112,7 +112,7 @@ int device_get_config_int(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return get_config_int(current_device->name, s, config->default_int);
|
||||
return config_get_int(current_device->name, s, config->default_int);
|
||||
|
||||
config++;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ char *device_get_config_string(char *s)
|
||||
while (config->type != -1)
|
||||
{
|
||||
if (!strcmp(s, config->name))
|
||||
return get_config_string(current_device->name, s, config->default_string);
|
||||
return config_get_string(current_device->name, s, config->default_string);
|
||||
|
||||
config++;
|
||||
}
|
||||
|
@@ -1442,7 +1442,7 @@ void InitTables( void ) {
|
||||
//Add back the bits for highest ones
|
||||
if ( i >= 16 )
|
||||
index += 9;
|
||||
Bitu blah = reinterpret_cast<Bitu>( &(chip->chan[ index ]) );
|
||||
intptr_t blah = reinterpret_cast<intptr_t>( &(chip->chan[ index ]) );
|
||||
ChanOffsetTable[i] = blah;
|
||||
}
|
||||
//Same for operators
|
||||
@@ -1457,7 +1457,7 @@ void InitTables( void ) {
|
||||
chNum += 16 - 12;
|
||||
Bitu opNum = ( i % 8 ) / 3;
|
||||
DBOPL::Channel* chan = 0;
|
||||
Bitu blah = reinterpret_cast<Bitu>( &(chan->op[opNum]) );
|
||||
intptr_t blah = reinterpret_cast<intptr_t>( &(chan->op[opNum]) );
|
||||
OpOffsetTable[i] = ChanOffsetTable[ chNum ] + blah;
|
||||
}
|
||||
#if 0
|
||||
|
15
src/ibm.h
15
src/ibm.h
@@ -9,17 +9,17 @@ uint8_t *ram,*vram;
|
||||
uint32_t rammask;
|
||||
|
||||
int readlookup[256],readlookupp[256];
|
||||
uint32_t *readlookup2;
|
||||
uintptr_t *readlookup2;
|
||||
int readlnext;
|
||||
int writelookup[256],writelookupp[256];
|
||||
uint32_t *writelookup2;
|
||||
uintptr_t *writelookup2;
|
||||
int writelnext;
|
||||
|
||||
extern int mmu_perm;
|
||||
|
||||
#define readmemb(a) ((readlookup2[(a)>>12]==0xFFFFFFFF)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a)))
|
||||
#define readmemw(s,a) ((readlookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE)?readmemwl(s,a):*(uint16_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
||||
#define readmeml(s,a) ((readlookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC)?readmemll(s,a):*(uint32_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
||||
#define readmemb(a) ((readlookup2[(a)>>12]==-1)?readmembl(a):*(uint8_t *)(readlookup2[(a) >> 12] + (a)))
|
||||
#define readmemw(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE)?readmemwl(s,a):*(uint16_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
||||
#define readmeml(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC)?readmemll(s,a):*(uint32_t *)(readlookup2[((s)+(a))>>12]+(s)+(a)))
|
||||
|
||||
//#define writememb(a,v) if (writelookup2[(a)>>12]==0xFFFFFFFF) writemembl(a,v); else ram[writelookup2[(a)>>12]+((a)&0xFFF)]=v
|
||||
//#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememwl(s,a,v); else *((uint16_t *)(&ram[writelookup2[((s)+(a))>>12]+(((s)+(a))&0xFFF)]))=v
|
||||
@@ -473,3 +473,8 @@ extern uint64_t timer_freq;
|
||||
|
||||
|
||||
void loadconfig(char *fn);
|
||||
|
||||
extern int infocus;
|
||||
|
||||
void onesec();
|
||||
|
||||
|
@@ -248,22 +248,24 @@ void keyboard_process()
|
||||
|
||||
for (c = 0; c < 272; c++)
|
||||
{
|
||||
if (key[c]) keydelay[c]++;
|
||||
else keydelay[c] = 0;
|
||||
if (pcem_key[c])
|
||||
keydelay[c]++;
|
||||
else
|
||||
keydelay[c] = 0;
|
||||
}
|
||||
|
||||
for (c = 0; c < 272; c++)
|
||||
{
|
||||
if (key[c] != oldkey[c])
|
||||
if (pcem_key[c] != oldkey[c])
|
||||
{
|
||||
oldkey[c] = key[c];
|
||||
if ( key[c] && scancodes[c].scancodes_make[0] == -1)
|
||||
oldkey[c] = pcem_key[c];
|
||||
if ( pcem_key[c] && scancodes[c].scancodes_make[0] == -1)
|
||||
continue;
|
||||
if (!key[c] && scancodes[c].scancodes_break[0] == -1)
|
||||
if (!pcem_key[c] && scancodes[c].scancodes_break[0] == -1)
|
||||
continue;
|
||||
// pclog("Key %02X start\n", c);
|
||||
d = 0;
|
||||
if (key[c])
|
||||
if (pcem_key[c])
|
||||
{
|
||||
while (scancodes[c].scancodes_make[d] != -1)
|
||||
keyboard_send(scancodes[c].scancodes_make[d++]);
|
||||
|
@@ -1,3 +1,5 @@
|
||||
extern void (*keyboard_send)(uint8_t val);
|
||||
extern void (*keyboard_poll)();
|
||||
extern int keyboard_scan;
|
||||
|
||||
extern int pcem_key[272];
|
||||
|
48
src/linux-time.c
Normal file
48
src/linux-time.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include "ibm.h"
|
||||
#include "nvr.h"
|
||||
|
||||
void time_get(char *nvrram)
|
||||
{
|
||||
int c,d;
|
||||
uint8_t baknvr[10];
|
||||
time_t cur_time;
|
||||
struct tm cur_time_tm;
|
||||
|
||||
memcpy(baknvr,nvrram,10);
|
||||
|
||||
cur_time = time(NULL);
|
||||
localtime_r(&cur_time, &cur_time_tm);
|
||||
|
||||
d = cur_time_tm.tm_sec % 10;
|
||||
c = cur_time_tm.tm_sec / 10;
|
||||
nvrram[0] = d | (c << 4);
|
||||
d = cur_time_tm.tm_min % 10;
|
||||
c = cur_time_tm.tm_min / 10;
|
||||
nvrram[2] = d | (c << 4);
|
||||
d = cur_time_tm.tm_hour % 10;
|
||||
c = cur_time_tm.tm_hour / 10;
|
||||
nvrram[4] = d | (c << 4);
|
||||
d = cur_time_tm.tm_wday % 10;
|
||||
c = cur_time_tm.tm_wday / 10;
|
||||
nvrram[6] = d | (c << 4);
|
||||
d = cur_time_tm.tm_mday % 10;
|
||||
c = cur_time_tm.tm_mday / 10;
|
||||
nvrram[7] = d | (c << 4);
|
||||
d = cur_time_tm.tm_mon % 10;
|
||||
c = cur_time_tm.tm_mon / 10;
|
||||
nvrram[8] = d | (c << 4);
|
||||
d = cur_time_tm.tm_year % 10;
|
||||
c = (cur_time_tm.tm_year / 10) % 10;
|
||||
nvrram[9] = d | (c << 4);
|
||||
if (baknvr[0] != nvrram[0] ||
|
||||
baknvr[2] != nvrram[2] ||
|
||||
baknvr[4] != nvrram[4] ||
|
||||
baknvr[6] != nvrram[6] ||
|
||||
baknvr[7] != nvrram[7] ||
|
||||
baknvr[8] != nvrram[8] ||
|
||||
baknvr[9] != nvrram[9])
|
||||
nvrram[0xA] |= 0x80;
|
||||
}
|
||||
|
57
src/mem.c
57
src/mem.c
@@ -430,10 +430,10 @@ void resetreadlookup()
|
||||
{
|
||||
int c;
|
||||
// /*if (output) */pclog("resetreadlookup\n");
|
||||
memset(readlookup2,0xFF,1024*1024*4);
|
||||
memset(readlookup2,0xFF,1024*1024*sizeof(uintptr_t));
|
||||
for (c=0;c<256;c++) readlookup[c]=0xFFFFFFFF;
|
||||
readlnext=0;
|
||||
memset(writelookup2,0xFF,1024*1024*4);
|
||||
memset(writelookup2,0xFF,1024*1024*sizeof(uintptr_t));
|
||||
for (c=0;c<256;c++) writelookup[c]=0xFFFFFFFF;
|
||||
writelnext=0;
|
||||
pccache=0xFFFFFFFF;
|
||||
@@ -671,7 +671,7 @@ void addreadlookup(uint32_t virt, uint32_t phys)
|
||||
readlookup2[readlookup[readlnext]]=0xFFFFFFFF;
|
||||
// readlnum--;
|
||||
}
|
||||
readlookup2[virt>>12] = (uint32_t)&ram[(phys & ~0xFFF) - (virt & ~0xfff)];
|
||||
readlookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)];
|
||||
readlookupp[readlnext]=mmu_perm;
|
||||
readlookup[readlnext++]=virt>>12;
|
||||
readlnext&=(cachesize-1);
|
||||
@@ -712,7 +712,7 @@ void addwritelookup(uint32_t virt, uint32_t phys)
|
||||
writelookup2[writelookup[writelnext]]=0xFFFFFFFF;
|
||||
// writelnum--;
|
||||
}
|
||||
writelookup2[virt>>12] = (uint32_t)&ram[(phys & ~0xFFF) - (virt & ~0xfff)];
|
||||
writelookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)];
|
||||
writelookupp[writelnext]=mmu_perm;
|
||||
writelookup[writelnext++]=virt>>12;
|
||||
writelnext&=(cachesize-1);
|
||||
@@ -721,56 +721,31 @@ void addwritelookup(uint32_t virt, uint32_t phys)
|
||||
#undef printf
|
||||
uint8_t *getpccache(uint32_t a)
|
||||
{
|
||||
// int logit=(a>0xFFFFF);
|
||||
uint32_t a2=a;
|
||||
//if (readlookup2[a>>12]!=0xFFFFFFFF) return &ram[(uint8_t *)readlookup2[a>>12] - (uint8_t *)(a&~0xFFF)];
|
||||
|
||||
if (cr0>>31)
|
||||
{
|
||||
// if (output==3) pclog("Translate GetPCCache %08X\n",a);
|
||||
pctrans=1;
|
||||
pctrans=1;
|
||||
a = mmutranslate_read(a);
|
||||
pctrans=0;
|
||||
// if (output==3) pclog("GetPCCache output %08X\n",a);
|
||||
|
||||
if (a==0xFFFFFFFF) return ram;
|
||||
/* {
|
||||
printf("Bad getpccache %08X\n",a);
|
||||
dumpregs();
|
||||
exit(-1);
|
||||
}*/
|
||||
}
|
||||
a&=rammask;
|
||||
//if (output==3) pclog("Getpccache %08X %i\n",a,shadowbios);
|
||||
|
||||
if (isram[a>>16])
|
||||
{
|
||||
//if (readlookup2[a>>12]!=0xFFFFFFFF) return &ram[readlookup2[a>>12]];
|
||||
if ((a>>16)!=0xF || shadowbios)
|
||||
addreadlookup(a2,a);
|
||||
// if (a > 0xc0000000)
|
||||
// printf("%016X %016X %016X\n", ((long)a&0xFFFFF000), ((long)a2&~0xFFF), (uint8_t *)(a&0xFFFFF000) - (uint8_t *)(a2&~0xFFF));
|
||||
// pclog("getpccache: virt=%08x phys=%08x RAM\n", a2, a);
|
||||
return &ram[(uint8_t *)(a&0xFFFFF000) - (uint8_t *)(a2&~0xFFF)];
|
||||
if ((a >> 16) != 0xF || shadowbios)
|
||||
addreadlookup(a2, a);
|
||||
return &ram[(uintptr_t)(a & 0xFFFFF000) - (uintptr_t)(a2 & ~0xFFF)];
|
||||
}
|
||||
// if (logit) printf("PCCACHE - %08X -> %08X\n",a2,a);
|
||||
|
||||
if (_mem_exec[a >> 14])
|
||||
{
|
||||
// pclog("getpccache: %p %p %p\n", ram, rom, &_mem_exec[a >> 14][(a & 0x3000) - (a2 & ~0xFFF)]);
|
||||
// pclog("getpccache: virt=%08x phys=%08x %08x %08x %08x %08x\n", a2, a, _mem_exec[a >> 14], &_mem_exec[a >> 14][(a & 0x3000) - (a2 & ~0xFFF)], &_mem_exec[a >> 14][(a & 0x3000) - (a2 & ~0xFFF)] + 0xf0000, rom);
|
||||
return &_mem_exec[a >> 14][(a & 0x3000) - (a2 & ~0xFFF)];
|
||||
return &_mem_exec[a >> 14][(uintptr_t)(a & 0x3000) - (uintptr_t)(a2 & ~0xFFF)];
|
||||
}
|
||||
/* switch (a>>16)
|
||||
{
|
||||
case 0xC: if (a&0x8000) return &romext[(uint8_t *)(a&0x7000) - (uint8_t *)(a2&~0xFFF)];
|
||||
return &vrom[(uint8_t *)(a&0x7000) - (uint8_t *)(a2&~0xFFF)];
|
||||
case 0xE: if (shadowbios) return &ram[(uint8_t *)(a&0xFFF000) - (uint8_t *)(a2&~0xFFF)];
|
||||
return &rom[(uint8_t *)((a & biosmask) & ~ 0xfff) - (uint8_t *)(a2 & ~0xFFF)];
|
||||
case 0xF: if (shadowbios) return &ram[(uint8_t *)(a&0xFFF000) - (uint8_t *)(a2&~0xFFF)];
|
||||
return &rom[(uint8_t *)((a & biosmask) & ~ 0xfff) - (uint8_t *)(a2 & ~0xFFF)];
|
||||
}
|
||||
return &rom[(long)(a&0xF000) - (long)(a2&~0xFFF)];*/
|
||||
|
||||
fatal("Bad getpccache %08X\n", a);
|
||||
/*printf("Bad getpccache %08X\n",a);
|
||||
dumpregs();
|
||||
exit(-1);*/
|
||||
}
|
||||
#define printf pclog
|
||||
|
||||
@@ -1396,8 +1371,8 @@ void mem_init()
|
||||
ram = malloc(mem_size * 1024 * 1024);
|
||||
rom = malloc(0x20000);
|
||||
vram = malloc(0x800000);
|
||||
readlookup2 = malloc(1024 * 1024 * 4);
|
||||
writelookup2 = malloc(1024 * 1024 * 4);
|
||||
readlookup2 = malloc(1024 * 1024 * sizeof(uintptr_t));
|
||||
writelookup2 = malloc(1024 * 1024 * sizeof(uintptr_t));
|
||||
cachelookup2 = malloc(1024 * 1024);
|
||||
biosmask = 0xffff;
|
||||
|
||||
|
@@ -124,11 +124,11 @@ void mouse_ps2_poll(int x, int y, int b)
|
||||
packet[0] |= 0x10;
|
||||
if (ps2_y < 0)
|
||||
packet[0] |= 0x20;
|
||||
if (mouse_b & 1)
|
||||
if (mouse_buttons & 1)
|
||||
packet[0] |= 1;
|
||||
if (mouse_b & 2)
|
||||
if (mouse_buttons & 2)
|
||||
packet[0] |= 2;
|
||||
if (mouse_b & 4)
|
||||
if (mouse_buttons & 4)
|
||||
packet[0] |= 4;
|
||||
packet[1] = ps2_x & 0xff;
|
||||
packet[2] = ps2_y & 0xff;
|
||||
|
38
src/nvr.c
38
src/nvr.c
@@ -1,5 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "nvr.h"
|
||||
@@ -11,46 +10,11 @@ int nvrmask=63;
|
||||
uint8_t nvrram[128];
|
||||
int nvraddr;
|
||||
|
||||
SYSTEMTIME systemtime;
|
||||
|
||||
int nvr_dosave = 0;
|
||||
|
||||
void getnvrtime()
|
||||
{
|
||||
int c,d;
|
||||
uint8_t baknvr[10];
|
||||
// memset(nvrram,0,10);
|
||||
// return;
|
||||
memcpy(baknvr,nvrram,10);
|
||||
GetLocalTime(&systemtime);
|
||||
d=systemtime.wSecond%10;
|
||||
c=systemtime.wSecond/10;
|
||||
nvrram[0]=d|(c<<4);
|
||||
d=systemtime.wMinute%10;
|
||||
c=systemtime.wMinute/10;
|
||||
nvrram[2]=d|(c<<4);
|
||||
d=systemtime.wHour%10;
|
||||
c=systemtime.wHour/10;
|
||||
nvrram[4]=d|(c<<4);
|
||||
d=systemtime.wDayOfWeek%10;
|
||||
c=systemtime.wDayOfWeek/10;
|
||||
nvrram[6]=d|(c<<4);
|
||||
d=systemtime.wDay%10;
|
||||
c=systemtime.wDay/10;
|
||||
nvrram[7]=d|(c<<4);
|
||||
d=systemtime.wMonth%10;
|
||||
c=systemtime.wMonth/10;
|
||||
nvrram[8]=d|(c<<4);
|
||||
d=systemtime.wYear%10;
|
||||
c=(systemtime.wYear/10)%10;
|
||||
nvrram[9]=d|(c<<4);
|
||||
if (baknvr[0]!=nvrram[0] ||
|
||||
baknvr[2]!=nvrram[2] ||
|
||||
baknvr[4]!=nvrram[4] ||
|
||||
baknvr[6]!=nvrram[6] ||
|
||||
baknvr[7]!=nvrram[7] ||
|
||||
baknvr[8]!=nvrram[8] ||
|
||||
baknvr[9]!=nvrram[9]) nvrram[0xA]|=0x80;
|
||||
time_get(nvrram);
|
||||
}
|
||||
|
||||
void nvr_recalc()
|
||||
|
@@ -1,3 +1,6 @@
|
||||
void nvr_init();
|
||||
|
||||
extern int nvr_dosave;
|
||||
|
||||
void time_get(char *nvrram);
|
||||
|
||||
|
150
src/pc.c
150
src/pc.c
@@ -7,6 +7,7 @@
|
||||
#include "ali1429.h"
|
||||
#include "amstrad.h"
|
||||
#include "cdrom-ioctl.h"
|
||||
#include "cdrom-null.h"
|
||||
#include "config.h"
|
||||
#include "cpu.h"
|
||||
#include "dma.h"
|
||||
@@ -70,7 +71,7 @@ void pclog(const char *format, ...)
|
||||
vsprintf(buf, format, ap);
|
||||
va_end(ap);
|
||||
fputs(buf,pclogf);
|
||||
fflush(pclogf);
|
||||
//fflush(pclogf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -102,11 +103,11 @@ void pollmouse()
|
||||
pollmouse_delay--;
|
||||
if (pollmouse_delay) return;
|
||||
pollmouse_delay = 2;
|
||||
poll_mouse();
|
||||
get_mouse_mickeys(&x,&y);
|
||||
mouse_poll_host();
|
||||
mouse_get_mickeys(&x,&y);
|
||||
if (mouse_poll)
|
||||
mouse_poll(x, y, mouse_b);
|
||||
if (mousecapture) position_mouse(64,64);
|
||||
mouse_poll(x, y, mouse_buttons);
|
||||
// if (mousecapture) position_mouse(64,64);
|
||||
}
|
||||
|
||||
/*PC1512 languages -
|
||||
@@ -223,6 +224,11 @@ void initpc()
|
||||
loadnvr();
|
||||
sound_init();
|
||||
resetide();
|
||||
#if __unix
|
||||
if (cdrom_drive == -1)
|
||||
cdrom_null_open(cdrom_drive);
|
||||
else
|
||||
#endif
|
||||
ioctl_open(cdrom_drive);
|
||||
model_init();
|
||||
video_init();
|
||||
@@ -246,6 +252,11 @@ void initpc()
|
||||
shadowbios=0;
|
||||
voodoo_init();
|
||||
|
||||
#if __unix
|
||||
if (cdrom_drive == -1)
|
||||
cdrom_null_reset();
|
||||
else
|
||||
#endif
|
||||
ioctl_reset();
|
||||
}
|
||||
|
||||
@@ -295,6 +306,11 @@ void resetpchard()
|
||||
|
||||
// output=3;
|
||||
|
||||
#if __unix
|
||||
if (cdrom_drive == -1)
|
||||
cdrom_null_reset();
|
||||
else
|
||||
#endif
|
||||
ioctl_reset();
|
||||
}
|
||||
|
||||
@@ -329,7 +345,7 @@ void runpc()
|
||||
keyboard_process();
|
||||
// checkkeys();
|
||||
pollmouse();
|
||||
poll_joystick();
|
||||
joystick_poll();
|
||||
endblit();
|
||||
|
||||
framecountx++;
|
||||
@@ -360,7 +376,7 @@ void runpc()
|
||||
if (win_title_update)
|
||||
{
|
||||
win_title_update=0;
|
||||
sprintf(s, "PCem v8.1 - %s - %s - %s - %i%%", model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse", fps);
|
||||
sprintf(s, "PCem v8.1 - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : "Press CTRL-END or middle button to release mouse");
|
||||
set_window_title(s);
|
||||
}
|
||||
done++;
|
||||
@@ -438,94 +454,94 @@ void loadconfig(char *fn)
|
||||
else
|
||||
config_load(fn);
|
||||
|
||||
GAMEBLASTER = get_config_int(NULL, "gameblaster", 0);
|
||||
GUS = get_config_int(NULL, "gus", 0);
|
||||
SSI2001 = get_config_int(NULL, "ssi2001", 0);
|
||||
GAMEBLASTER = config_get_int(NULL, "gameblaster", 0);
|
||||
GUS = config_get_int(NULL, "gus", 0);
|
||||
SSI2001 = config_get_int(NULL, "ssi2001", 0);
|
||||
|
||||
model = get_config_int(NULL, "model", 14);
|
||||
model = config_get_int(NULL, "model", 14);
|
||||
|
||||
if (model >= model_count())
|
||||
model = model_count() - 1;
|
||||
|
||||
romset = model_getromset();
|
||||
cpu_manufacturer = get_config_int(NULL, "cpu_manufacturer", 0);
|
||||
cpu = get_config_int(NULL, "cpu", 0);
|
||||
cpu_manufacturer = config_get_int(NULL, "cpu_manufacturer", 0);
|
||||
cpu = config_get_int(NULL, "cpu", 0);
|
||||
|
||||
gfxcard = get_config_int(NULL, "gfxcard", 0);
|
||||
video_speed = get_config_int(NULL, "video_speed", 3);
|
||||
sound_card_current = get_config_int(NULL, "sndcard", SB2);
|
||||
gfxcard = config_get_int(NULL, "gfxcard", 0);
|
||||
video_speed = config_get_int(NULL, "video_speed", 3);
|
||||
sound_card_current = config_get_int(NULL, "sndcard", SB2);
|
||||
|
||||
p = (char *)get_config_string(NULL, "disc_a", "");
|
||||
p = (char *)config_get_string(NULL, "disc_a", "");
|
||||
if (p) strcpy(discfns[0], p);
|
||||
else strcpy(discfns[0], "");
|
||||
|
||||
p = (char *)get_config_string(NULL, "disc_b", "");
|
||||
p = (char *)config_get_string(NULL, "disc_b", "");
|
||||
if (p) strcpy(discfns[1], p);
|
||||
else strcpy(discfns[1], "");
|
||||
|
||||
mem_size = get_config_int(NULL, "mem_size", 4);
|
||||
cdrom_drive = get_config_int(NULL, "cdrom_drive", 0);
|
||||
cdrom_enabled = get_config_int(NULL, "cdrom_enabled", 0);
|
||||
mem_size = config_get_int(NULL, "mem_size", 4);
|
||||
cdrom_drive = config_get_int(NULL, "cdrom_drive", 0);
|
||||
cdrom_enabled = config_get_int(NULL, "cdrom_enabled", 0);
|
||||
|
||||
slowega = get_config_int(NULL, "slow_video", 1);
|
||||
cache = get_config_int(NULL, "cache", 3);
|
||||
cga_comp = get_config_int(NULL, "cga_composite", 0);
|
||||
slowega = config_get_int(NULL, "slow_video", 1);
|
||||
cache = config_get_int(NULL, "cache", 3);
|
||||
cga_comp = config_get_int(NULL, "cga_composite", 0);
|
||||
|
||||
vid_resize = get_config_int(NULL, "vid_resize", 0);
|
||||
vid_api = get_config_int(NULL, "vid_api", 0);
|
||||
video_fullscreen_scale = get_config_int(NULL, "video_fullscreen_scale", 0);
|
||||
video_fullscreen_first = get_config_int(NULL, "video_fullscreen_first", 1);
|
||||
vid_resize = config_get_int(NULL, "vid_resize", 0);
|
||||
vid_api = config_get_int(NULL, "vid_api", 0);
|
||||
video_fullscreen_scale = config_get_int(NULL, "video_fullscreen_scale", 0);
|
||||
video_fullscreen_first = config_get_int(NULL, "video_fullscreen_first", 1);
|
||||
|
||||
hdc[0].spt = get_config_int(NULL, "hdc_sectors", 0);
|
||||
hdc[0].hpc = get_config_int(NULL, "hdc_heads", 0);
|
||||
hdc[0].tracks = get_config_int(NULL, "hdc_cylinders", 0);
|
||||
p = (char *)get_config_string(NULL, "hdc_fn", "");
|
||||
hdc[0].spt = config_get_int(NULL, "hdc_sectors", 0);
|
||||
hdc[0].hpc = config_get_int(NULL, "hdc_heads", 0);
|
||||
hdc[0].tracks = config_get_int(NULL, "hdc_cylinders", 0);
|
||||
p = (char *)config_get_string(NULL, "hdc_fn", "");
|
||||
if (p) strcpy(ide_fn[0], p);
|
||||
else strcpy(ide_fn[0], "");
|
||||
hdc[1].spt = get_config_int(NULL, "hdd_sectors", 0);
|
||||
hdc[1].hpc = get_config_int(NULL, "hdd_heads", 0);
|
||||
hdc[1].tracks = get_config_int(NULL, "hdd_cylinders", 0);
|
||||
p = (char *)get_config_string(NULL, "hdd_fn", "");
|
||||
hdc[1].spt = config_get_int(NULL, "hdd_sectors", 0);
|
||||
hdc[1].hpc = config_get_int(NULL, "hdd_heads", 0);
|
||||
hdc[1].tracks = config_get_int(NULL, "hdd_cylinders", 0);
|
||||
p = (char *)config_get_string(NULL, "hdd_fn", "");
|
||||
if (p) strcpy(ide_fn[1], p);
|
||||
else strcpy(ide_fn[1], "");
|
||||
}
|
||||
|
||||
void saveconfig()
|
||||
{
|
||||
set_config_int(NULL, "gameblaster", GAMEBLASTER);
|
||||
set_config_int(NULL, "gus", GUS);
|
||||
set_config_int(NULL, "ssi2001", SSI2001);
|
||||
config_set_int(NULL, "gameblaster", GAMEBLASTER);
|
||||
config_set_int(NULL, "gus", GUS);
|
||||
config_set_int(NULL, "ssi2001", SSI2001);
|
||||
|
||||
set_config_int(NULL, "model", model);
|
||||
set_config_int(NULL, "cpu_manufacturer", cpu_manufacturer);
|
||||
set_config_int(NULL, "cpu", cpu);
|
||||
config_set_int(NULL, "model", model);
|
||||
config_set_int(NULL, "cpu_manufacturer", cpu_manufacturer);
|
||||
config_set_int(NULL, "cpu", cpu);
|
||||
|
||||
set_config_int(NULL, "gfxcard", gfxcard);
|
||||
set_config_int(NULL, "video_speed", video_speed);
|
||||
set_config_int(NULL, "sndcard", sound_card_current);
|
||||
set_config_int(NULL, "cpu_speed", cpuspeed);
|
||||
set_config_int(NULL, "has_fpu", hasfpu);
|
||||
set_config_int(NULL, "slow_video", slowega);
|
||||
set_config_int(NULL, "cache", cache);
|
||||
set_config_int(NULL, "cga_composite", cga_comp);
|
||||
set_config_string(NULL, "disc_a", discfns[0]);
|
||||
set_config_string(NULL, "disc_b", discfns[1]);
|
||||
set_config_int(NULL, "mem_size", mem_size);
|
||||
set_config_int(NULL, "cdrom_drive", cdrom_drive);
|
||||
set_config_int(NULL, "cdrom_enabled", cdrom_enabled);
|
||||
set_config_int(NULL, "vid_resize", vid_resize);
|
||||
set_config_int(NULL, "vid_api", vid_api);
|
||||
set_config_int(NULL, "video_fullscreen_scale", video_fullscreen_scale);
|
||||
set_config_int(NULL, "video_fullscreen_first", video_fullscreen_first);
|
||||
config_set_int(NULL, "gfxcard", gfxcard);
|
||||
config_set_int(NULL, "video_speed", video_speed);
|
||||
config_set_int(NULL, "sndcard", sound_card_current);
|
||||
config_set_int(NULL, "cpu_speed", cpuspeed);
|
||||
config_set_int(NULL, "has_fpu", hasfpu);
|
||||
config_set_int(NULL, "slow_video", slowega);
|
||||
config_set_int(NULL, "cache", cache);
|
||||
config_set_int(NULL, "cga_composite", cga_comp);
|
||||
config_set_string(NULL, "disc_a", discfns[0]);
|
||||
config_set_string(NULL, "disc_b", discfns[1]);
|
||||
config_set_int(NULL, "mem_size", mem_size);
|
||||
config_set_int(NULL, "cdrom_drive", cdrom_drive);
|
||||
config_set_int(NULL, "cdrom_enabled", cdrom_enabled);
|
||||
config_set_int(NULL, "vid_resize", vid_resize);
|
||||
config_set_int(NULL, "vid_api", vid_api);
|
||||
config_set_int(NULL, "video_fullscreen_scale", video_fullscreen_scale);
|
||||
config_set_int(NULL, "video_fullscreen_first", video_fullscreen_first);
|
||||
|
||||
set_config_int(NULL, "hdc_sectors", hdc[0].spt);
|
||||
set_config_int(NULL, "hdc_heads", hdc[0].hpc);
|
||||
set_config_int(NULL, "hdc_cylinders", hdc[0].tracks);
|
||||
set_config_string(NULL, "hdc_fn", ide_fn[0]);
|
||||
set_config_int(NULL, "hdd_sectors", hdc[1].spt);
|
||||
set_config_int(NULL, "hdd_heads", hdc[1].hpc);
|
||||
set_config_int(NULL, "hdd_cylinders", hdc[1].tracks);
|
||||
set_config_string(NULL, "hdd_fn", ide_fn[1]);
|
||||
config_set_int(NULL, "hdc_sectors", hdc[0].spt);
|
||||
config_set_int(NULL, "hdc_heads", hdc[0].hpc);
|
||||
config_set_int(NULL, "hdc_cylinders", hdc[0].tracks);
|
||||
config_set_string(NULL, "hdc_fn", ide_fn[0]);
|
||||
config_set_int(NULL, "hdd_sectors", hdc[1].spt);
|
||||
config_set_int(NULL, "hdd_heads", hdc[1].hpc);
|
||||
config_set_int(NULL, "hdd_cylinders", hdc[1].tracks);
|
||||
config_set_string(NULL, "hdd_fn", ide_fn[1]);
|
||||
|
||||
config_save(config_file_default);
|
||||
}
|
||||
|
@@ -117,9 +117,9 @@ struct
|
||||
|
||||
static void piix_bus_master_next_addr(int channel)
|
||||
{
|
||||
piix_busmaster[channel].addr = (*(unsigned long *)(&ram[piix_busmaster[channel].ptr_cur])) & ~1;
|
||||
piix_busmaster[channel].count = (*(unsigned long *)(&ram[piix_busmaster[channel].ptr_cur + 4])) & 0xfffe;
|
||||
piix_busmaster[channel].eot = (*(unsigned long *)(&ram[piix_busmaster[channel].ptr_cur + 4])) >> 31;
|
||||
piix_busmaster[channel].addr = (*(uint32_t *)(&ram[piix_busmaster[channel].ptr_cur])) & ~1;
|
||||
piix_busmaster[channel].count = (*(uint32_t *)(&ram[piix_busmaster[channel].ptr_cur + 4])) & 0xfffe;
|
||||
piix_busmaster[channel].eot = (*(uint32_t *)(&ram[piix_busmaster[channel].ptr_cur + 4])) >> 31;
|
||||
piix_busmaster[channel].ptr_cur += 8;
|
||||
// pclog("New DMA settings on channel %i - Addr %08X Count %04X EOT %i\n", channel, piix_busmaster[channel].addr, piix_busmaster[channel].count, piix_busmaster[channel].eot);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ extern "C" {
|
||||
#endif
|
||||
void joystick_init();
|
||||
void joystick_close();
|
||||
void poll_joystick();
|
||||
void joystick_poll();
|
||||
|
||||
typedef struct joystick_t
|
||||
{
|
||||
@@ -16,4 +16,3 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -4,14 +4,16 @@ extern "C" {
|
||||
void keyboard_init();
|
||||
void keyboard_close();
|
||||
void keyboard_poll_host();
|
||||
int key[272];
|
||||
int rawinputkey[272];
|
||||
extern int pcem_key[272];
|
||||
extern int rawinputkey[272];
|
||||
|
||||
#ifndef __unix
|
||||
#define KEY_LCONTROL 0x1d
|
||||
#define KEY_RCONTROL (0x1d | 0x80)
|
||||
#define KEY_END (0x4f | 0x80)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
void midi_init();
|
||||
void midi_close();
|
||||
void midi_out(uint8_t val);
|
||||
void midi_write(uint8_t val);
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mouse_init();
|
||||
void mouse_close();
|
||||
extern int mouse_b;
|
||||
void poll_mouse();
|
||||
void position_mouse(int x, int y);
|
||||
void get_mouse_mickeys(int *x, int *y);
|
||||
extern int mouse_buttons;
|
||||
void mouse_poll_host();
|
||||
void mouse_get_mickeys(int *x, int *y);
|
||||
extern int mousecapture;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -33,7 +33,7 @@ static void mpu401_uart_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
/*Data*/
|
||||
if (mpu->uart_mode)
|
||||
midi_out(val);
|
||||
midi_write(val);
|
||||
}
|
||||
|
||||
static uint8_t mpu401_uart_read(uint16_t addr, void *p)
|
||||
|
89
src/thread-pthread.c
Normal file
89
src/thread-pthread.c
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include "thread.h"
|
||||
|
||||
typedef struct event_pthread_t
|
||||
{
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
} event_pthread_t;
|
||||
|
||||
thread_t *thread_create(void (*thread_rout)(void *param), void *param)
|
||||
{
|
||||
pthread_t *thread = malloc(sizeof(pthread_t));
|
||||
|
||||
pthread_create(thread, NULL, thread_rout, param);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
void thread_kill(thread_t *handle)
|
||||
{
|
||||
pthread_t *thread = (pthread_t *)handle;
|
||||
|
||||
pthread_cancel(*thread);
|
||||
pthread_join(*thread, NULL);
|
||||
|
||||
free(thread);
|
||||
}
|
||||
|
||||
event_t *thread_create_event()
|
||||
{
|
||||
event_pthread_t *event = malloc(sizeof(event_pthread_t));
|
||||
|
||||
pthread_cond_init(&event->cond, NULL);
|
||||
pthread_mutex_init(&event->mutex, NULL);
|
||||
|
||||
return (event_t *)event;
|
||||
}
|
||||
|
||||
void thread_set_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_broadcast(&event->cond);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
}
|
||||
|
||||
void thread_reset_event(event_t *handle)
|
||||
{
|
||||
}
|
||||
|
||||
int thread_wait_event(event_t *handle, int timeout)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
struct timespec abstime;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
abstime.tv_nsec += (timeout % 1000) * 1000000;
|
||||
abstime.tv_sec += (timeout / 1000);
|
||||
if (abstime.tv_nsec > 1000000000)
|
||||
{
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
abstime.tv_sec++;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&event->mutex);
|
||||
pthread_cond_timedwait(&event->cond, &event->mutex, &abstime);
|
||||
pthread_mutex_unlock(&event->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void thread_destroy_event(event_t *handle)
|
||||
{
|
||||
event_pthread_t *event = (event_pthread_t *)handle;
|
||||
|
||||
pthread_cond_destroy(&event->cond);
|
||||
pthread_mutex_destroy(&event->mutex);
|
||||
|
||||
free(event);
|
||||
}
|
||||
|
||||
void thread_sleep(int t)
|
||||
{
|
||||
usleep(t * 1000);
|
||||
}
|
@@ -430,8 +430,6 @@ startblit();
|
||||
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, cga->firstline - 4, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
if (readflash) rectfill(screen, winsizex - 40, 8, winsizex - 8, 14, 0xffffffff);
|
||||
readflash = 0;
|
||||
frames++;
|
||||
endblit();
|
||||
video_res_x = xsize - 16;
|
||||
|
@@ -146,7 +146,7 @@ void *et4000_init()
|
||||
et4000_t *et4000 = malloc(sizeof(et4000_t));
|
||||
memset(et4000, 0, sizeof(et4000_t));
|
||||
|
||||
rom_init(&et4000->bios_rom, "roms/et4000.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
rom_init(&et4000->bios_rom, "roms/et4000.BIN", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
io_sethandler(0x03c0, 0x0020, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000);
|
||||
|
||||
@@ -161,7 +161,7 @@ void *et4000_init()
|
||||
|
||||
static int et4000_available()
|
||||
{
|
||||
return rom_present("roms/et4000.bin");
|
||||
return rom_present("roms/et4000.BIN");
|
||||
}
|
||||
|
||||
void et4000_close(void *p)
|
||||
@@ -200,7 +200,7 @@ device_t et4000_device =
|
||||
0,
|
||||
et4000_init,
|
||||
et4000_close,
|
||||
NULL,
|
||||
et4000_available,
|
||||
et4000_speed_changed,
|
||||
et4000_force_redraw,
|
||||
et4000_add_status_info
|
||||
|
@@ -396,10 +396,7 @@ void m24_poll(void *p)
|
||||
updatewindowsize(xsize, ysize + 16);
|
||||
}
|
||||
startblit();
|
||||
pclog("m24 blit %i %i\n", m24->firstline, m24->lastline);
|
||||
video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16);
|
||||
if (readflash) rectfill(screen, winsizex - 40, 8, winsizex - 8, 14, 0xFFFFFFFF);
|
||||
readflash = 0;
|
||||
frames++;
|
||||
endblit();
|
||||
video_res_x = xsize - 16;
|
||||
|
@@ -1381,6 +1381,7 @@ void s3_accel_start(int count, int cpu_input, uint32_t mix_dat, uint32_t cpu_dat
|
||||
{
|
||||
READ(s3->accel.dest + s3->accel.cx, dest_dat);
|
||||
|
||||
|
||||
// if (CS != 0xc000) pclog("Write %05X %02X %02X %04X (%02X %02X) ", s3->accel.dest + s3->accel.cx, src_dat, dest_dat, mix_dat, s3->accel.frgd_mix, s3->accel.bkgd_mix);
|
||||
|
||||
MIX
|
||||
@@ -1955,7 +1956,7 @@ static void *s3_init(char *bios_fn, int chip)
|
||||
|
||||
void *s3_bahamas64_init()
|
||||
{
|
||||
s3_t *s3 = s3_init("roms/bahamas64.bin", S3_VISION864);
|
||||
s3_t *s3 = s3_init("roms/bahamas64.BIN", S3_VISION864);
|
||||
|
||||
s3->id = 0xc1; /*Vision864P*/
|
||||
s3->id_ext = s3->id_ext_pci = 0xc1;
|
||||
@@ -1969,7 +1970,7 @@ void *s3_bahamas64_init()
|
||||
|
||||
int s3_bahamas64_available()
|
||||
{
|
||||
return rom_present("roms/bahamas64.bin");
|
||||
return rom_present("roms/bahamas64.BIN");
|
||||
}
|
||||
|
||||
void *s3_9fx_init()
|
||||
|
@@ -1174,7 +1174,6 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
|
||||
ysize = wy + 1;
|
||||
}
|
||||
video_blit_memtoscreen(32, 0, y1, y2, xsize, ysize);
|
||||
if (readflash) rectfill(screen,winsizex-40,8,winsizex-8,14,0xFFFFFFFF);
|
||||
// pclog("svga_doblit end\n");
|
||||
}
|
||||
|
||||
|
@@ -279,7 +279,7 @@ void *tvga8900d_init()
|
||||
tvga->vram_size = device_get_config_int("memory") << 10;
|
||||
tvga->vram_mask = tvga->vram_size - 1;
|
||||
|
||||
rom_init(&tvga->bios_rom, "roms/trident.bin", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
rom_init(&tvga->bios_rom, "roms/TRIDENT.BIN", 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
svga_init(&tvga->svga, tvga, tvga->vram_size,
|
||||
tvga_recalctimings,
|
||||
@@ -294,7 +294,7 @@ void *tvga8900d_init()
|
||||
|
||||
static int tvga8900d_available()
|
||||
{
|
||||
return rom_present("roms/trident.bin");
|
||||
return rom_present("roms/TRIDENT.BIN");
|
||||
}
|
||||
|
||||
void tvga_close(void *p)
|
||||
|
54
src/video.h
54
src/video.h
@@ -1,3 +1,34 @@
|
||||
#ifdef __unix
|
||||
|
||||
#include "allegro-main.h"
|
||||
|
||||
#else
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int w, h;
|
||||
uint8_t *dat;
|
||||
uint8_t *line[0];
|
||||
} BITMAP;
|
||||
|
||||
extern BITMAP *screen;
|
||||
|
||||
BITMAP *create_bitmap(int w, int h);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
} RGB;
|
||||
|
||||
typedef RGB PALETTE[256];
|
||||
|
||||
#define makecol(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
#define makecol32(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
|
||||
#endif
|
||||
|
||||
extern BITMAP *buffer, *buffer32;
|
||||
|
||||
int video_card_available(int card);
|
||||
char *video_card_getname(int card);
|
||||
struct device_t *video_card_getdevice(int card);
|
||||
@@ -21,19 +52,6 @@ extern int egareads,egawrites;
|
||||
extern int fullchange;
|
||||
extern int changeframecount;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int w, h;
|
||||
uint8_t *dat;
|
||||
uint8_t *line[0];
|
||||
} BITMAP;
|
||||
|
||||
extern BITMAP *buffer, *buffer32;
|
||||
|
||||
extern BITMAP *screen;
|
||||
|
||||
BITMAP *create_bitmap(int w, int h);
|
||||
|
||||
extern uint8_t fontdat[256][8];
|
||||
extern uint8_t fontdatm[256][16];
|
||||
|
||||
@@ -41,20 +59,10 @@ extern uint32_t *video_15to32, *video_16to32;
|
||||
|
||||
extern int xsize,ysize;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t r, g, b;
|
||||
} RGB;
|
||||
|
||||
typedef RGB PALETTE[256];
|
||||
|
||||
extern float cpuclock;
|
||||
|
||||
extern int emu_fps, frames;
|
||||
|
||||
#define makecol(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
#define makecol32(r, g, b) ((b) | ((g) << 8) | ((r) << 16))
|
||||
|
||||
extern int readflash;
|
||||
|
||||
extern void (*video_recalctimings)();
|
||||
|
@@ -31,7 +31,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
val_int = get_config_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
|
||||
SendMessage(h, BM_SETCHECK, val_int, 0);
|
||||
|
||||
@@ -39,7 +39,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
val_int = get_config_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
|
||||
c = 0;
|
||||
while (selection->description[0])
|
||||
@@ -79,7 +79,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
val_int = get_config_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
|
||||
if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
|
||||
changed = 1;
|
||||
@@ -88,7 +88,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
break;
|
||||
|
||||
case CONFIG_SELECTION:
|
||||
val_int = get_config_int(config_device->name, config->name, config->default_int);
|
||||
val_int = config_get_int(config_device->name, config->name, config->default_int);
|
||||
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
@@ -129,7 +129,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
switch (config->type)
|
||||
{
|
||||
case CONFIG_BINARY:
|
||||
set_config_int(config_device->name, config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||
config_set_int(config_device->name, config->name, SendMessage(h, BM_GETCHECK, 0, 0));
|
||||
|
||||
id++;
|
||||
break;
|
||||
@@ -138,7 +138,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
for (; c > 0; c--)
|
||||
selection++;
|
||||
set_config_int(config_device->name, config->name, selection->value);
|
||||
config_set_int(config_device->name, config->name, selection->value);
|
||||
|
||||
id += 2;
|
||||
break;
|
||||
|
@@ -101,7 +101,7 @@ void joystick_close()
|
||||
}
|
||||
}
|
||||
|
||||
void poll_joystick()
|
||||
void joystick_poll()
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "win.h"
|
||||
#include "video.h"
|
||||
|
||||
extern "C" int key[272];
|
||||
extern "C" int pcem_key[272];
|
||||
|
||||
extern "C" void fatal(const char *format, ...);
|
||||
extern "C" void pclog(const char *format, ...);
|
||||
@@ -18,11 +18,13 @@ extern "C" void keyboard_init();
|
||||
extern "C" void keyboard_close();
|
||||
extern "C" void keyboard_poll();
|
||||
|
||||
int pcem_key[272];
|
||||
|
||||
void keyboard_init()
|
||||
{
|
||||
atexit(keyboard_close);
|
||||
|
||||
memset(key, 0, sizeof(key));
|
||||
memset(pcem_key, 0, sizeof(pcem_key));
|
||||
pclog("Keyboard initialized!\n");
|
||||
}
|
||||
|
||||
@@ -35,7 +37,7 @@ void keyboard_poll_host()
|
||||
int c;
|
||||
|
||||
for (c = 0; c < 272; c++)
|
||||
key[c] = rawinputkey[c];
|
||||
pcem_key[c] = rawinputkey[c];
|
||||
|
||||
if ((rawinputkey[0x1D] || rawinputkey[0x9D]) &&
|
||||
(rawinputkey[0x38] || rawinputkey[0xB8]) &&
|
||||
|
@@ -41,7 +41,7 @@ static int midi_pos, midi_len;
|
||||
static uint32_t midi_command;
|
||||
static int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 0};
|
||||
|
||||
void midi_out(uint8_t val)
|
||||
void midi_write(uint8_t val)
|
||||
{
|
||||
if (val & 0x80)
|
||||
{
|
||||
|
@@ -10,15 +10,14 @@ extern "C" void pclog(const char *format, ...);
|
||||
|
||||
extern "C" void mouse_init();
|
||||
extern "C" void mouse_close();
|
||||
extern "C" void poll_mouse();
|
||||
extern "C" void position_mouse(int x, int y);
|
||||
extern "C" void get_mouse_mickeys(int *x, int *y);
|
||||
extern "C" void mouse_poll_host();
|
||||
extern "C" void mouse_get_mickeys(int *x, int *y);
|
||||
|
||||
static LPDIRECTINPUT lpdi;
|
||||
static LPDIRECTINPUTDEVICE lpdi_mouse = NULL;
|
||||
static DIMOUSESTATE mousestate;
|
||||
static int mouse_x = 0, mouse_y = 0;
|
||||
int mouse_b = 0;
|
||||
int mouse_buttons = 0;
|
||||
|
||||
void mouse_init()
|
||||
{
|
||||
@@ -45,31 +44,27 @@ void mouse_close()
|
||||
}
|
||||
}
|
||||
|
||||
void poll_mouse()
|
||||
void mouse_poll_host()
|
||||
{
|
||||
if (FAILED(lpdi_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate)))
|
||||
{
|
||||
lpdi_mouse->Acquire();
|
||||
lpdi_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mousestate);
|
||||
}
|
||||
mouse_b = 0;
|
||||
mouse_buttons = 0;
|
||||
if (mousestate.rgbButtons[0] & 0x80)
|
||||
mouse_b |= 1;
|
||||
mouse_buttons |= 1;
|
||||
if (mousestate.rgbButtons[1] & 0x80)
|
||||
mouse_b |= 2;
|
||||
mouse_buttons |= 2;
|
||||
if (mousestate.rgbButtons[2] & 0x80)
|
||||
mouse_b |= 4;
|
||||
mouse_buttons |= 4;
|
||||
mouse_x += mousestate.lX;
|
||||
mouse_y += mousestate.lY;
|
||||
if (!mousecapture && !video_fullscreen)
|
||||
mouse_x = mouse_y = mouse_b = 0;
|
||||
mouse_x = mouse_y = mouse_buttons = 0;
|
||||
}
|
||||
|
||||
void position_mouse(int x, int y)
|
||||
{
|
||||
}
|
||||
|
||||
void get_mouse_mickeys(int *x, int *y)
|
||||
void mouse_get_mickeys(int *x, int *y)
|
||||
{
|
||||
*x = mouse_x;
|
||||
*y = mouse_y;
|
||||
|
43
src/win-time.c
Normal file
43
src/win-time.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <windows.h>
|
||||
#include "ibm.h"
|
||||
#include "nvr.h"
|
||||
|
||||
void time_get(char *nvrram)
|
||||
{
|
||||
SYSTEMTIME systemtime;
|
||||
int c, d;
|
||||
uint8_t baknvr[10];
|
||||
|
||||
memcpy(baknvr,nvrram,10);
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
d = systemtime.wSecond % 10;
|
||||
c = systemtime.wSecond / 10;
|
||||
nvrram[0] = d | (c << 4);
|
||||
d = systemtime.wMinute % 10;
|
||||
c = systemtime.wMinute / 10;
|
||||
nvrram[2] = d | (c << 4);
|
||||
d = systemtime.wHour % 10;
|
||||
c = systemtime.wHour / 10;
|
||||
nvrram[4] = d | (c << 4);
|
||||
d = systemtime.wDayOfWeek % 10;
|
||||
c = systemtime.wDayOfWeek / 10;
|
||||
nvrram[6] = d | (c << 4);
|
||||
d = systemtime.wDay % 10;
|
||||
c = systemtime.wDay / 10;
|
||||
nvrram[7] = d | (c << 4);
|
||||
d = systemtime.wMonth % 10;
|
||||
c = systemtime.wMonth / 10;
|
||||
nvrram[8] = d | (c << 4);
|
||||
d = systemtime.wYear % 10;
|
||||
c = (systemtime.wYear / 10) % 10;
|
||||
nvrram[9] = d | (c << 4);
|
||||
if (baknvr[0] != nvrram[0] ||
|
||||
baknvr[2] != nvrram[2] ||
|
||||
baknvr[4] != nvrram[4] ||
|
||||
baknvr[6] != nvrram[6] ||
|
||||
baknvr[7] != nvrram[7] ||
|
||||
baknvr[8] != nvrram[8] ||
|
||||
baknvr[9] != nvrram[9])
|
||||
nvrram[0xA]|=0x80;
|
||||
}
|
@@ -40,6 +40,8 @@
|
||||
|
||||
uint64_t timer_freq;
|
||||
|
||||
int rawinputkey[272];
|
||||
|
||||
static RAWINPUTDEVICE device;
|
||||
static uint16_t scancode_map[65536];
|
||||
|
||||
@@ -571,7 +573,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
}
|
||||
//; else
|
||||
// sleep(0);
|
||||
if ((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_END] && mousecapture)
|
||||
if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[KEY_END] && mousecapture)
|
||||
{
|
||||
ClipCursor(&oldclip);
|
||||
mousecapture=0;
|
||||
@@ -583,7 +585,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
if (messages.message==WM_QUIT) quited=1;
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
if ((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_END] && mousecapture)
|
||||
if ((pcem_key[KEY_LCONTROL] || pcem_key[KEY_RCONTROL]) && pcem_key[KEY_END] && mousecapture)
|
||||
{
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
|
@@ -19,11 +19,11 @@
|
||||
#undef readmemb
|
||||
#undef writememb
|
||||
|
||||
#define readmemb(s,a) ((readlookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF)?readmemb386l(s,a): *((uint8_t *)readlookup2[((s)+(a))>>12]+ (s) + (a)) )
|
||||
#define writememb(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define readmemb(s,a) ((readlookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF)?readmemb386l(s,a): *((uint8_t *)readlookup2[((s)+(a))>>12]+ (s) + (a)) )
|
||||
#define writememb(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF) writememb386l(s,a,v); else *(uint8_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
|
||||
#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==0xFFFFFFFF || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememw(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFE) writememwl(s,a,v); else *(uint16_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
#define writememl(s,a,v) if (writelookup2[((s)+(a))>>12]==-1 || (s)==0xFFFFFFFF || (((s)+(a))&0xFFF)>0xFFC) writememll(s,a,v); else *(uint32_t *)(writelookup2[((s) + (a)) >> 12] + (s) + (a)) = v
|
||||
|
||||
static inline uint8_t geteab()
|
||||
{
|
||||
|
Reference in New Issue
Block a user