This commit was manufactured by cvs2svn to create tag 'release-1_4'.

git-svn-id: svn://svn.code.sf.net/p/stella/code/tags/release-1_4@323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
(no author) 2004-07-15 19:59:55 +00:00
parent 52a79c583a
commit d797125e57
79 changed files with 0 additions and 13112 deletions

View File

@ -1,14 +0,0 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
syncmail Couldn't check out syncmail script.

View File

@ -1,15 +0,0 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,11 +0,0 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Set `PreservePermissions' to `yes' to save file status information
# in the repository.
#PreservePermissions=no
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no

View File

@ -1,23 +0,0 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

View File

@ -1,21 +0,0 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

View File

@ -1,29 +0,0 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
CVSROOT $CVSROOT/CVSROOT/syncmail %{sVv} bwmott@acm.org
DEFAULT $CVSROOT/CVSROOT/syncmail %{sVv} stella-commits@lists.sourceforge.net

View File

@ -1,26 +0,0 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

View File

@ -1,12 +0,0 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

View File

@ -1,13 +0,0 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,221 +0,0 @@
#! /usr/bin/python
# -*- Python -*-
"""Complicated notification for CVS checkins.
This script is used to provide email notifications of changes to the CVS
repository. These email changes will include context diffs of the changes.
Really big diffs will be trimmed.
This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo). To
set this up, create a loginfo entry that looks something like this:
mymodule /path/to/this/script %%s some-email-addr@your.domain
In this example, whenever a checkin that matches `mymodule' is made, this
script is invoked, which will generate the diff containing email, and send it
to some-email-addr@your.domain.
Note: This module used to also do repository synchronizations via
rsync-over-ssh, but since the repository has been moved to SourceForge,
this is no longer necessary. The syncing functionality has been ripped
out in the 3.0, which simplifies it considerably. Access the 2.x versions
to refer to this functionality. Because of this, the script is misnamed.
It no longer makes sense to run this script from the command line. Doing so
will only print out this usage information.
Usage:
%(PROGRAM)s [options] <%%S> email-addr [email-addr ...]
Where options is:
--cvsroot=<path>
Use <path> as the environment variable CVSROOT. Otherwise this
variable must exist in the environment.
--help
-h
Print this text.
--context=#
-C #
Include # lines of context around lines that differ (default: 2).
-c
Produce a context diff (default).
-u
Produce a unified diff (smaller, but harder to read).
<%%S>
CVS %%s loginfo expansion. When invoked by CVS, this will be a single
string containing the directory the checkin is being made in, relative
to $CVSROOT, followed by the list of files that are changing. If the
%%s in the loginfo file is %%{sVv}, context diffs for each of the
modified files are included in any email messages that are generated.
email-addrs
At least one email address.
"""
import os
import sys
import string
import time
import getopt
# Notification command
MAILCMD = '/bin/mail -s "CVS: %(SUBJECT)s" %(PEOPLE)s 2>&1 > /dev/null'
# Diff trimming stuff
DIFF_HEAD_LINES = 20
DIFF_TAIL_LINES = 20
DIFF_TRUNCATE_IF_LARGER = 1000
PROGRAM = sys.argv[0]
def usage(code, msg=''):
print __doc__ % globals()
if msg:
print msg
sys.exit(code)
def calculate_diff(filespec, contextlines):
try:
file, oldrev, newrev = string.split(filespec, ',')
except ValueError:
# No diff to report
return '***** Bogus filespec: %s' % filespec
if oldrev == 'NONE':
try:
if os.path.exists(file):
fp = open(file)
else:
update_cmd = 'cvs -fn update -r %s -p %s' % (newrev, file)
fp = os.popen(update_cmd)
lines = fp.readlines()
fp.close()
lines.insert(0, '--- NEW FILE: %s ---\n' % file)
except IOError, e:
lines = ['***** Error reading new file: ',
str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
elif newrev == 'NONE':
lines = ['--- %s DELETED ---\n' % file]
else:
# This /has/ to happen in the background, otherwise we'll run into CVS
# lock contention. What a crock.
if contextlines > 0:
difftype = "-C " + str(contextlines)
else:
difftype = "-u"
diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -r %s -r %s '%s'" % (
difftype, oldrev, newrev, file)
fp = os.popen(diffcmd)
lines = fp.readlines()
sts = fp.close()
# ignore the error code, it always seems to be 1 :(
## if sts:
## return 'Error code %d occurred during diff\n' % (sts >> 8)
if len(lines) > DIFF_TRUNCATE_IF_LARGER:
removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES
del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES]
lines.insert(DIFF_HEAD_LINES,
'[...%d lines suppressed...]\n' % removedlines)
return string.join(lines, '')
def blast_mail(mailcmd, filestodiff, contextlines):
# cannot wait for child process or that will cause parent to retain cvs
# lock for too long. Urg!
if not os.fork():
# in the child
# give up the lock you cvs thang!
time.sleep(2)
fp = os.popen(mailcmd, 'w')
fp.write(sys.stdin.read())
fp.write('\n')
# append the diffs if available
for file in filestodiff:
fp.write(calculate_diff(file, contextlines))
fp.write('\n')
fp.close()
# doesn't matter what code we return, it isn't waited on
os._exit(0)
# scan args for options
def main():
contextlines = 2
try:
opts, args = getopt.getopt(sys.argv[1:], 'hC:cu',
['context=', 'cvsroot=', 'help'])
except getopt.error, msg:
usage(1, msg)
# parse the options
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
elif opt == '--cvsroot':
os.environ['CVSROOT'] = arg
elif opt in ('-C', '--context'):
contextlines = int(arg)
elif opt == '-c':
if contextlines <= 0:
contextlines = 2
elif opt == '-u':
contextlines = 0
# What follows is the specification containing the files that were
# modified. The argument actually must be split, with the first component
# containing the directory the checkin is being made in, relative to
# $CVSROOT, followed by the list of files that are changing.
if not args:
usage(1, 'No CVS module specified')
SUBJECT = args[0]
specs = string.split(args[0])
del args[0]
# The remaining args should be the email addresses
if not args:
usage(1, 'No recipients specified')
# Now do the mail command
PEOPLE = string.join(args)
mailcmd = MAILCMD % vars()
print 'Mailing %s...' % PEOPLE
if specs == ['-', 'Imported', 'sources']:
return
if specs[-3:] == ['-', 'New', 'directory']:
del specs[-3:]
elif len(specs) > 2:
L = specs[:2]
for s in specs[2:]:
prev = L[-1]
if string.count(prev, ",") < 2:
L[-1] = "%s %s" % (prev, s)
else:
L.append(s)
specs = L
print 'Generating notification message...'
blast_mail(mailcmd, specs[1:], contextlines)
print 'Generating notification message... done.'
if __name__ == '__main__':
main()
sys.exit(0)

View File

@ -1,20 +0,0 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,21 +0,0 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

File diff suppressed because it is too large Load Diff

View File

@ -1,345 +0,0 @@
##============================================================================
##
## SSSS tt lll lll
## SS SS tt ll ll
## SS tttttt eeee ll ll aaaa
## SSSS tt ee ee ll ll aa
## SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
## SS SS tt ee ll ll aa aa
## SSSS ttt eeeee llll llll aaaaa
##
## Copyright (c) 1995-1999 by Bradford W. Mott
##
## See the file "license" for information on usage and redistribution of
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
##
## $Id: makefile,v 1.56 2004-07-14 16:49:45 stephena Exp $
##============================================================================
##============================================================================
## Development environment options
##
## The following options are used during compiling.
## Comment a line out to disable that option, remove comment to enable it.
##============================================================================
### add your own compiler optimizations here
### if none are provided, the defaults will be used
OPTIMIZATIONS =
### to include joystick support
JOYSTICK_SUPPORT = 1
### to include support for saving snapshots in png format
### (requires PNG library)
SNAPSHOT_SUPPORT = 1
### to include support for game developers
### enables some extra commandline options that allow the user
### to override some emulation defaults
DEVELOPER_SUPPORT = 1
### to build on SMP (or distcc-based) machines
### change to number of CPU's you have
NUMBER_CPU = 1
##============================================================================
## All done, type make to get a list of frontends
## No configurable options below this line ...
##============================================================================
CXX = g++
LD = g++
LDFLAGS = `sdl-config --cflags`
LDLIBS = `sdl-config --libs`
OBJECTS = mainSDL.o SoundSDL.o FrameBufferSDL.o FrameBufferSoft.o
OPTIONS =
EXE_NAME =
SMP =
SRC = ..
CORE = $(SRC)/emucore
COMMON = $(SRC)/common
INCLUDES = -I. -I$(CORE) -I$(CORE)/m6502/src \
-I$(CORE)/m6502/src/bspf/src -I$(COMMON) -I$(SRC)/unix -I$(SRC)/win32
## set some sane optimizations if none have been provided
ifndef OPTIMIZATIONS
ifdef CXXFLAGS
OPTIMIZATIONS = $(CXXFLAGS)
else
OPTIMIZATIONS = -O2
endif
endif
ifndef NUMBER_CPU
SMP = -j1
else
SMP = -j$(NUMBER_CPU)
endif
FLAGS = $(OPTIMIZATIONS) -Wall -Wunused $(INCLUDES) $(SYS_INCLUDES)
ifdef JOYSTICK_SUPPORT
OPTIONS += -DJOYSTICK_SUPPORT
endif
ifdef SNAPSHOT_SUPPORT
OBJECTS += Snapshot.o
OPTIONS += -DSNAPSHOT_SUPPORT
LDLIBS += -lpng -lz
endif
ifdef DEVELOPER_SUPPORT
OPTIONS += -DDEVELOPER_SUPPORT
endif
default:
@echo ""
@echo "To build Stella type: 'make <version>'"
@echo "You should edit the makefile for extra options"
@echo ""
@echo "<version> is one of:"
@echo ""
@echo " linux Linux/UNIX version"
@echo " linux-gl Linux/UNIX version with OpenGL support"
@echo " win32 Windows 9x/ME/2000/XP version"
@echo " win32-gl Windows 9x/ME/2000/XP version with OpenGL support"
@echo ""
@echo "Hopefully new versions will be added soon!"
@echo ""
linux:
$(MAKE) $(SMP) stella \
EXE_NAME="stella" \
OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY" \
OBJS="$(OBJECTS) SettingsUNIX.o"
linux-gl:
$(MAKE) $(SMP) stella \
EXE_NAME="stella" \
LDFLAGS="$(LDFLAGS) -L/usr/X11R6/lib" \
LDLIBS="$(LDLIBS) -lGL" \
OPTIONS="$(OPTIONS) -DBSPF_UNIX -DUNIX -DHAVE_GETTIMEOFDAY -DDISPLAY_OPENGL" \
OBJS="$(OBJECTS) FrameBufferGL.o SettingsUNIX.o"
win32:
$(MAKE) $(SMP) stella \
EXE_NAME="stella.exe" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32" \
OBJS="$(OBJECTS) SettingsWin32.o"
win32-gl:
$(MAKE) $(SMP) stella \
EXE_NAME="stella.exe" \
LDLIBS="$(LDLIBS) -lopengl32" \
OPTIONS="$(OPTIONS) -DBSPF_WIN32 -DWIN32 -DDISPLAY_OPENGL -DTEXTURES_ARE_LOST" \
OBJS="$(OBJECTS) FrameBufferGL.o SettingsWin32.o"
###############################################################################
## List of "core" object files
###############################################################################
M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o
CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \
CartF8.o CartF8SC.o CartFASC.o CartFE.o CartMC.o CartCV.o \
CartMB.o CartUA.o Console.o Control.o Driving.o \
Event.o Joystick.o Keyboard.o M6532.o MD5.o MediaSrc.o Paddles.o \
Props.o PropsSet.o Random.o Sound.o Switches.o Settings.o TIA.o \
Serializer.o Deserializer.o TIASound.o EventHandler.o FrameBuffer.o \
$(M6502_OBJS)
stella: $(CORE_OBJS) $(OBJS)
$(LD) -o $(EXE_NAME) $(CORE_OBJS) $(OBJS) $(LDFLAGS) $(LDLIBS)
strip $(EXE_NAME)
M6502Low.ins: $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4
m4 $(CORE)/m6502/src/M6502Low.m4 $(CORE)/m6502/src/M6502.m4 > $(CORE)/m6502/src/M6502Low.ins
M6502Hi.ins: $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4
m4 $(CORE)/m6502/src/M6502Hi.m4 $(CORE)/m6502/src/M6502.m4 > $(CORE)/m6502/src/M6502Hi.ins
#M6502Low.o: M6502Low.ins
#M6502Hi.o: M6502Hi.ins
clean:
rm -f *.o stella stella.exe core
Driving.o: $(CORE)/Driving.cxx $(CORE)/Driving.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Driving.cxx
Event.o: $(CORE)/Event.cxx $(CORE)/Event.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Event.cxx
EventHandler.o: $(CORE)/EventHandler.cxx $(CORE)/EventHandler.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/EventHandler.cxx
Control.o: $(CORE)/Control.cxx $(CORE)/Control.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Control.cxx
Joystick.o: $(CORE)/Joystick.cxx $(CORE)/Joystick.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Joystick.cxx
Keyboard.o: $(CORE)/Keyboard.cxx $(CORE)/Keyboard.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Keyboard.cxx
Paddles.o: $(CORE)/Paddles.cxx $(CORE)/Paddles.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Paddles.cxx
Booster.o: $(CORE)/Booster.cxx $(CORE)/Booster.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Booster.cxx
Cart.o: $(CORE)/Cart.cxx $(CORE)/Cart.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart.cxx
Cart2K.o: $(CORE)/Cart2K.cxx $(CORE)/Cart2K.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart2K.cxx
Cart3F.o: $(CORE)/Cart3F.cxx $(CORE)/Cart3F.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart3F.cxx
Cart4K.o: $(CORE)/Cart4K.cxx $(CORE)/Cart4K.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Cart4K.cxx
CartAR.o: $(CORE)/CartAR.cxx $(CORE)/CartAR.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartAR.cxx
CartCV.o: $(CORE)/CartCV.cxx $(CORE)/CartCV.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartCV.cxx
CartDPC.o: $(CORE)/CartDPC.cxx $(CORE)/CartDPC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartDPC.cxx
CartE0.o: $(CORE)/CartE0.cxx $(CORE)/CartE0.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE0.cxx
CartE7.o: $(CORE)/CartE7.cxx $(CORE)/CartE7.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartE7.cxx
CartF4.o: $(CORE)/CartF4.cxx $(CORE)/CartF4.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4.cxx
CartF4SC.o: $(CORE)/CartF4SC.cxx $(CORE)/CartF4SC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF4SC.cxx
CartF6.o: $(CORE)/CartF6.cxx $(CORE)/CartF6.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6.cxx
CartF6SC.o: $(CORE)/CartF6SC.cxx $(CORE)/CartF6SC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF6SC.cxx
CartF8.o: $(CORE)/CartF8.cxx $(CORE)/CartF8.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8.cxx
CartF8SC.o: $(CORE)/CartF8SC.cxx $(CORE)/CartF8SC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartF8SC.cxx
CartFASC.o: $(CORE)/CartFASC.cxx $(CORE)/CartFASC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFASC.cxx
CartFE.o: $(CORE)/CartFE.cxx $(CORE)/CartFE.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartFE.cxx
CartMB.o: $(CORE)/CartMB.cxx $(CORE)/CartMB.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMB.cxx
CartMC.o: $(CORE)/CartMC.cxx $(CORE)/CartMC.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartMC.cxx
CartUA.o: $(CORE)/CartUA.cxx $(CORE)/CartUA.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/CartUA.cxx
M6532.o: $(CORE)/M6532.cxx $(CORE)/M6532.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/M6532.cxx
TIA.o: $(CORE)/TIA.cxx $(CORE)/TIA.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/TIA.cxx
TIASound.o: $(CORE)/TIASound.c $(CORE)/TIASound.h
$(CXX) -c -DWIN32 $(FLAGS) $(OPTIONS) $(CORE)/TIASound.c
Console.o: $(CORE)/Console.cxx $(CORE)/Console.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Console.cxx
MD5.o: $(CORE)/MD5.cxx $(CORE)/MD5.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MD5.cxx
MediaSrc.o: $(CORE)/MediaSrc.cxx $(CORE)/MediaSrc.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/MediaSrc.cxx
FrameBuffer.o: $(CORE)/FrameBuffer.cxx $(CORE)/FrameBuffer.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/FrameBuffer.cxx
PropsSet.o: $(CORE)/PropsSet.cxx $(CORE)/PropsSet.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/PropsSet.cxx
Props.o: $(CORE)/Props.cxx $(CORE)/Props.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Props.cxx
Random.o: $(CORE)/Random.cxx $(CORE)/Random.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Random.cxx
Sound.o: $(CORE)/Sound.cxx $(CORE)/Sound.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Sound.cxx
Switches.o: $(CORE)/Switches.cxx $(CORE)/Switches.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Switches.cxx
Serializer.o: $(CORE)/Serializer.cxx $(CORE)/Serializer.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Serializer.cxx
Deserializer.o: $(CORE)/Deserializer.cxx $(CORE)/Deserializer.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/Deserializer.cxx
Settings.o: $(CORE)/Settings.cxx $(CORE)/Settings.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(CORE)/Settings.cxx
SettingsUNIX.o: $(SRC)/unix/SettingsUNIX.cxx $(SRC)/unix/SettingsUNIX.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/unix/SettingsUNIX.cxx
SettingsWin32.o: $(SRC)/win32/SettingsWin32.cxx $(SRC)/win32/SettingsWin32.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(SRC)/win32/SettingsWin32.cxx
SoundSDL.o: $(COMMON)/SoundSDL.cxx $(COMMON)/SoundSDL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/SoundSDL.cxx
mainSDL.o: $(COMMON)/mainSDL.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/mainSDL.cxx
FrameBufferSDL.o: $(COMMON)/FrameBufferSDL.cxx $(COMMON)/FrameBufferSDL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/FrameBufferSDL.cxx
FrameBufferSoft.o: $(COMMON)/FrameBufferSoft.cxx $(COMMON)/FrameBufferSoft.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/FrameBufferSoft.cxx
FrameBufferGL.o: $(COMMON)/FrameBufferGL.cxx $(COMMON)/FrameBufferGL.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/FrameBufferGL.cxx
Snapshot.o: $(COMMON)/Snapshot.cxx $(COMMON)/Snapshot.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(COMMON)/Snapshot.cxx
D6502.o: $(CORE)/m6502/src/D6502.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/D6502.cxx
Device.o: $(CORE)/m6502/src/Device.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/Device.cxx
M6502.o: $(CORE)/m6502/src/M6502.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502.cxx
M6502Low.o: $(CORE)/m6502/src/M6502Low.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Low.cxx
M6502Hi.o: $(CORE)/m6502/src/M6502Hi.cxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/M6502Hi.cxx
NullDev.o: $(CORE)/m6502/src/NullDev.cxx $(CORE)/m6502/src/NullDev.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/NullDev.cxx
System.o: $(CORE)/m6502/src/System.cxx $(CORE)/m6502/src/System.hxx
$(CXX) -c $(FLAGS) $(OPTIONS) $(CORE)/m6502/src/System.cxx

View File

@ -1,268 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSDL.cxx,v 1.1 2004-05-24 17:18:22 stephena Exp $
//============================================================================
#include <SDL.h>
#include <SDL_syswm.h>
#include <sstream>
#include "Console.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferSDL.hxx"
#include "MediaSrc.hxx"
#include "Settings.hxx"
#include "stella.xpm" // The Stella icon
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSDL::FrameBufferSDL()
: x11Available(false),
theZoomLevel(1),
theMaxZoomLevel(1),
theAspectRatio(1.0),
myPauseStatus(false)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSDL::~FrameBufferSDL()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::pauseEvent(bool status)
{
myPauseStatus = status;
setupPalette();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::setupPalette()
{
// Shade the palette to 75% normal value in pause mode
float shade = 1.0;
if(myPauseStatus)
shade = 0.75;
const uInt32* gamePalette = myMediaSource->palette();
for(uInt32 i = 0; i < 256; ++i)
{
Uint8 r, g, b;
r = (Uint8) (((gamePalette[i] & 0x00ff0000) >> 16) * shade);
g = (Uint8) (((gamePalette[i] & 0x0000ff00) >> 8) * shade);
b = (Uint8) ((gamePalette[i] & 0x000000ff) * shade);
myPalette[i] = mapRGB(r, g, b);
}
theRedrawEntireFrameIndicator = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::toggleFullscreen()
{
bool isFullscreen = !myConsole->settings().getBool("fullscreen");
// Update the settings
myConsole->settings().setBool("fullscreen", isFullscreen);
if(isFullscreen)
mySDLFlags |= SDL_FULLSCREEN;
else
mySDLFlags &= ~SDL_FULLSCREEN;
if(!createScreen())
return;
if(isFullscreen) // now in fullscreen mode
{
grabMouse(true);
showCursor(false);
}
else // now in windowed mode
{
grabMouse(myConsole->settings().getBool("grabmouse"));
showCursor(!myConsole->settings().getBool("hidecursor"));
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::resize(int mode)
{
// reset size to that given in properties
// this is a special case of allowing a resize while in fullscreen mode
if(mode == 0)
{
myWidth = myMediaSource->width() << 1;
myHeight = myMediaSource->height();
}
else if(mode == 1) // increase size
{
if(myConsole->settings().getBool("fullscreen"))
return;
if(theZoomLevel == theMaxZoomLevel)
theZoomLevel = 1;
else
theZoomLevel++;
}
else if(mode == -1) // decrease size
{
if(myConsole->settings().getBool("fullscreen"))
return;
if(theZoomLevel == 1)
theZoomLevel = theMaxZoomLevel;
else
theZoomLevel--;
}
if(!createScreen())
return;
// Update the settings
myConsole->settings().setInt("zoom", theZoomLevel);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::showCursor(bool show)
{
if(show)
SDL_ShowCursor(SDL_ENABLE);
else
SDL_ShowCursor(SDL_DISABLE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::grabMouse(bool grab)
{
if(grab)
SDL_WM_GrabInput(SDL_GRAB_ON);
else
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL::fullScreen()
{
return myConsole->settings().getBool("fullscreen");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FrameBufferSDL::maxWindowSizeForScreen()
{
if(!x11Available)
return 4;
#ifdef UNIX
// Otherwise, lock the screen and get the width and height
myWMInfo.info.x11.lock_func();
Display* theX11Display = myWMInfo.info.x11.display;
myWMInfo.info.x11.unlock_func();
int screenWidth = DisplayWidth(theX11Display, DefaultScreen(theX11Display));
int screenHeight = DisplayHeight(theX11Display, DefaultScreen(theX11Display));
uInt32 multiplier = screenWidth / myWidth;
bool found = false;
while(!found && (multiplier > 0))
{
// Figure out the desired size of the window
int width = (int) (myWidth * multiplier * theAspectRatio);
int height = myHeight * multiplier;
if((width < screenWidth) && (height < screenHeight))
found = true;
else
multiplier--;
}
if(found)
return multiplier;
else
return 1;
#endif
return 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL::setWindowAttributes()
{
// Set the window title
ostringstream name;
name << "Stella: \"" << myConsole->properties().get("Cartridge.Name") << "\"";
SDL_WM_SetCaption(name.str().c_str(), "stella");
#ifndef MAC_OSX
// Set the window icon
uInt32 w, h, ncols, nbytes;
uInt32 rgba[256], icon[32 * 32];
uInt8 mask[32][4];
sscanf(stella_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes);
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
for(uInt32 i = 0; i < ncols; i++)
{
unsigned char code;
char color[32];
uInt32 col;
sscanf(stella_icon[1 + i], "%c c %s", &code, color);
if(!strcmp(color, "None"))
col = 0x00000000;
else if(!strcmp(color, "black"))
col = 0xFF000000;
else if (color[0] == '#')
{
sscanf(color + 1, "%06x", &col);
col |= 0xFF000000;
}
else
{
cerr << "ERROR: Couldn't load the icon.\n";
return;
}
rgba[code] = col;
}
memset(mask, 0, sizeof(mask));
for(h = 0; h < 32; h++)
{
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[(int)line[w]];
if(rgba[(int)line[w]] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32,
32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
SDL_WM_SetIcon(surface, (unsigned char *) mask);
SDL_FreeSurface(surface);
#endif
}

View File

@ -1,176 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferSDL.hxx,v 1.3 2004-06-23 00:15:32 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SDL_HXX
#define FRAMEBUFFER_SDL_HXX
#include <SDL.h>
#include <SDL_syswm.h>
#include "FrameBuffer.hxx"
#include "Settings.hxx"
#include "bspf.hxx"
/**
This class is a base class for the SDL framebuffer and is derived from
the core FrameBuffer class.
It defines all common code shared between the software
and OpenGL video modes, as well as required methods defined in
the core FrameBuffer.
@author Stephen Anthony
@version $Id: FrameBufferSDL.hxx,v 1.3 2004-06-23 00:15:32 stephena Exp $
*/
class FrameBufferSDL : public FrameBuffer
{
public:
/**
Creates a new SDL framebuffer
*/
FrameBufferSDL();
/**
Destructor
*/
virtual ~FrameBufferSDL();
/**
Toggles between fullscreen and window mode. Grabmouse and hidecursor
activated when in fullscreen mode.
*/
void toggleFullscreen();
/**
This routine is called when the user wants to resize the window.
A '1' argument indicates that the window should increase in size, while '-1'
indicates that the windows should decrease in size. A '0' indicates that
the window should be sized according to the current properties.
Can't resize in fullscreen mode. Will only resize up to the maximum size
of the screen.
*/
void resize(int mode);
/**
Shows or hides the cursor based on the given boolean value.
*/
void showCursor(bool show);
/**
Grabs or ungrabs the mouse based on the given boolean value.
*/
void grabMouse(bool grab);
/**
Answers if the display is currently in fullscreen mode.
*/
bool fullScreen();
/**
Answers the current zoom level of the SDL
*/
uInt32 zoomLevel() { return theZoomLevel; }
/**
Calculate the maximum window size that the current screen can hold.
Only works in X11 for now. If not running under X11, always return 4.
*/
uInt32 maxWindowSizeForScreen();
/**
This routine is called to get the width of the onscreen image.
*/
uInt32 imageWidth() { return myDimensions.w; }
/**
This routine is called to get the height of the onscreen image.
*/
uInt32 imageHeight() { return myDimensions.h; }
/**
Set the title and icon for the main SDL window.
*/
void setWindowAttributes();
/**
Set up the palette for a screen of any depth > 8.
*/
void setupPalette();
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called when the emulation has been paused.
@param status Toggle pause based on status
*/
void pauseEvent(bool status);
//////////////////////////////////////////////////////////////////////
// The following methods must be defined in child classes
//////////////////////////////////////////////////////////////////////
/**
This routine is called whenever the screen needs to be recreated.
It updates the global screen variable.
*/
virtual bool createScreen() = 0;
/**
This routine is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b) = 0;
protected:
// The SDL video buffer
SDL_Surface* myScreen;
// SDL initialization flags
uInt32 mySDLFlags;
// SDL palette
Uint32 myPalette[256];
// Used to get window-manager specifics
SDL_SysWMinfo myWMInfo;
// Indicates the width/height and origin x/y of the onscreen image
// (these may be different than the screen/window dimensions)
SDL_Rect myDimensions;
// Indicates if we are running under X11
bool x11Available;
// Indicates the current zoom level of the SDL screen
uInt32 theZoomLevel;
// Indicates the maximum zoom of the SDL screen
uInt32 theMaxZoomLevel;
// The aspect ratio of the window
float theAspectRatio;
// Indicates whether the emulation has paused
bool myPauseStatus;
};
#endif

View File

@ -1,44 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1998 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MediaSrc.cxx,v 1.1.1.1 2001-12-27 19:54:22 bwmott Exp $
//============================================================================
#include <assert.h>
#include "MediaSrc.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MediaSource::MediaSource()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MediaSource::~MediaSource()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MediaSource::MediaSource(const MediaSource&)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MediaSource& MediaSource::operator = (const MediaSource&)
{
assert(false);
return *this;
}

View File

@ -1,109 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MediaSrc.hxx,v 1.8 2004-07-14 16:15:06 stephena Exp $
//============================================================================
#ifndef MEDIASOURCE_HXX
#define MEDIASOURCE_HXX
#include <string>
class MediaSource;
#include "bspf.hxx"
/**
This class provides an interface for accessing graphics and audio data.
@author Bradford W. Mott
@version $Id: MediaSrc.hxx,v 1.8 2004-07-14 16:15:06 stephena Exp $
*/
class MediaSource
{
public:
/**
Create a new media source
*/
MediaSource();
/**
Destructor
*/
virtual ~MediaSource();
public:
/**
This method should be called at an interval corresponding to the
desired frame rate to update the media source. Invoking this method
will update the graphics buffer and generate the corresponding audio
samples.
*/
virtual void update() = 0;
/**
Answers the current frame buffer
@return Pointer to the current frame buffer
*/
virtual uInt8* currentFrameBuffer() const = 0;
/**
Answers the previous frame buffer
@return Pointer to the previous frame buffer
*/
virtual uInt8* previousFrameBuffer() const = 0;
public:
/**
Get the palette which maps frame data to RGB values.
@return Array of integers which represent the palette (RGB)
*/
virtual const uInt32* palette() const = 0;
/**
Answers the height of the frame buffer
@return The frame's height
*/
virtual uInt32 height() const = 0;
/**
Answers the width of the frame buffer
@return The frame's width
*/
virtual uInt32 width() const = 0;
public:
/**
Answers the total number of scanlines the media source generated
in producing the current frame buffer.
@return The total number of scanlines generated
*/
virtual uInt32 scanlines() const = 0;
private:
// Copy constructor isn't supported by this class so make it private
MediaSource(const MediaSource&);
// Assignment operator isn't supported by this class so make it private
MediaSource& operator = (const MediaSource&);
};
#endif

View File

@ -1,114 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2004 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Sound.cxx,v 1.12 2004-06-13 04:54:25 bwmott Exp $
//============================================================================
#include "Serializer.hxx"
#include "Deserializer.hxx"
#include "Sound.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sound::Sound(uInt32 fragsize)
: myLastRegisterSetCycle(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sound::~Sound()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::adjustCycleCounter(Int32 amount)
{
myLastRegisterSetCycle += amount;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::mute(bool state)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::init(Console* console, MediaSource* mediasrc, System* system)
{
myConsole = console;
myMediaSource = mediasrc;
mySystem = system;
myLastRegisterSetCycle = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Sound::isSuccessfullyInitialized() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::reset()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::set(uInt16 addr, uInt8 value, Int32 cycle)
{
myLastRegisterSetCycle = cycle;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Sound::setVolume(Int32 volume)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Sound::load(Deserializer& in)
{
string soundDevice = "TIASound";
if(in.getString() != soundDevice)
return false;
uInt8 reg;
reg = (uInt8) in.getLong();
reg = (uInt8) in.getLong();
reg = (uInt8) in.getLong();
reg = (uInt8) in.getLong();
reg = (uInt8) in.getLong();
reg = (uInt8) in.getLong();
myLastRegisterSetCycle = (Int32)in.getLong();
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Sound::save(Serializer& out)
{
out.putString("TIASound");
uInt8 reg = 0;
out.putLong(reg);
out.putLong(reg);
out.putLong(reg);
out.putLong(reg);
out.putLong(reg);
out.putLong(reg);
out.putLong(myLastRegisterSetCycle);
return true;
}

View File

@ -1,97 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1998 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaEvent.hxx,v 1.9 2004-05-06 00:06:19 stephena Exp $
//============================================================================
#ifndef STELLAEVENT_HXX
#define STELLAEVENT_HXX
/**
This file defines the global STELLA events that the frontends
will use to communicate with the Event Handler.
Only the standard keys are defined here. Function and
navigation (HOME, END, etc) keys are special and must be handled
by the frontends directly.
@author Stephen Anthony
@version $Id: StellaEvent.hxx,v 1.9 2004-05-06 00:06:19 stephena Exp $
*/
class StellaEvent
{
public:
/**
Enumeration of keyboard keycodes
Note that the order of these codes is related to
UserInterface::ourEventName. If these are ever changed or rearranged,
that array must be updated as well.
*/
enum KeyCode
{
KCODE_a, KCODE_b, KCODE_c, KCODE_d, KCODE_e, KCODE_f, KCODE_g, KCODE_h,
KCODE_i, KCODE_j, KCODE_k, KCODE_l, KCODE_m, KCODE_n, KCODE_o, KCODE_p,
KCODE_q, KCODE_r, KCODE_s, KCODE_t, KCODE_u, KCODE_v, KCODE_w, KCODE_x,
KCODE_y, KCODE_z,
KCODE_0, KCODE_1, KCODE_2, KCODE_3, KCODE_4, KCODE_5, KCODE_6, KCODE_7,
KCODE_8, KCODE_9,
KCODE_KP0, KCODE_KP1, KCODE_KP2, KCODE_KP3, KCODE_KP4, KCODE_KP5, KCODE_KP6,
KCODE_KP7, KCODE_KP8, KCODE_KP9, KCODE_KP_PERIOD, KCODE_KP_DIVIDE,
KCODE_KP_MULTIPLY, KCODE_KP_MINUS, KCODE_KP_PLUS, KCODE_KP_ENTER,
KCODE_KP_EQUALS,
KCODE_BACKSPACE, KCODE_TAB, KCODE_CLEAR, KCODE_RETURN,
KCODE_ESCAPE, KCODE_SPACE, KCODE_COMMA, KCODE_MINUS, KCODE_PERIOD,
KCODE_SLASH, KCODE_BACKSLASH, KCODE_SEMICOLON, KCODE_EQUALS,
KCODE_QUOTE, KCODE_BACKQUOTE, KCODE_LEFTBRACKET, KCODE_RIGHTBRACKET,
KCODE_PRTSCREEN, KCODE_SCRLOCK, KCODE_PAUSE,
KCODE_INSERT, KCODE_HOME, KCODE_PAGEUP,
KCODE_DELETE, KCODE_END, KCODE_PAGEDOWN,
KCODE_LCTRL, KCODE_RCTRL, KCODE_LALT, KCODE_RALT, KCODE_LWIN,
KCODE_RWIN, KCODE_MENU, KCODE_UP, KCODE_DOWN, KCODE_LEFT, KCODE_RIGHT,
KCODE_F1, KCODE_F2, KCODE_F3, KCODE_F4, KCODE_F5, KCODE_F6, KCODE_F7,
KCODE_F8, KCODE_F9, KCODE_F10, KCODE_F11, KCODE_F12, KCODE_F13,
KCODE_F14, KCODE_F15,
LastKCODE
};
/**
Enumeration of joystick codes and states
*/
enum JoyStick
{
JSTICK_0, JSTICK_1, JSTICK_2, JSTICK_3, JSTICK_4, JSTICK_5,
LastJSTICK
};
enum JoyCode
{
JAXIS_UP, JAXIS_DOWN, JAXIS_LEFT, JAXIS_RIGHT,
JBUTTON_0, JBUTTON_1, JBUTTON_2, JBUTTON_3, JBUTTON_4,
JBUTTON_5, JBUTTON_6, JBUTTON_7, JBUTTON_8, JBUTTON_9,
JBUTTON_10, JBUTTON_11, JBUTTON_12, JBUTTON_13, JBUTTON_14,
JBUTTON_15, JBUTTON_16, JBUTTON_17, JBUTTON_18, JBUTTON_19,
LastJCODE
};
};
#endif

View File

@ -1,689 +0,0 @@
/*****************************************************************************/
/* */
/* Module: TIA Chip Sound Simulator */
/* Purpose: To emulate the sound generation hardware of the Atari TIA chip. */
/* Author: Ron Fries */
/* */
/* Revision History: */
/* 10-Sep-96 - V1.0 - Initial Release */
/* 14-Jan-97 - V1.1 - Cleaned up sound output by eliminating counter */
/* reset. */
/* */
/*****************************************************************************/
/* */
/* License Information and Copyright Notice */
/* ======================================== */
/* */
/* TiaSound is Copyright(c) 1996 by Ron Fries */
/* */
/* This library is free software; you can redistribute it and/or modify it */
/* under the terms of version 2 of the GNU Library General Public License */
/* as published by the Free Software Foundation. */
/* */
/* This library is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library */
/* General Public License for more details. */
/* To obtain a copy of the GNU Library General Public License, write to the */
/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* */
/* Any permitted reproduction of these routines, in whole or in part, must */
/* bear this legend. */
/* */
/*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* define some data types to keep it platform independent */
#ifdef WIN32
#define int8 char
#define int16 short
#define int32 int
#else
#define int8 char
#define int16 int
#define int32 long
#endif
#define uint8 unsigned int8
#define uint16 unsigned int16
#define uint32 unsigned int32
/* CONSTANT DEFINITIONS */
/* definitions for AUDCx (15, 16) */
#define SET_TO_1 0x00 /* 0000 */
#define POLY4 0x01 /* 0001 */
#define DIV31_POLY4 0x02 /* 0010 */
#define POLY5_POLY4 0x03 /* 0011 */
#define PURE 0x04 /* 0100 */
#define PURE2 0x05 /* 0101 */
#define DIV31_PURE 0x06 /* 0110 */
#define POLY5_2 0x07 /* 0111 */
#define POLY9 0x08 /* 1000 */
#define POLY5 0x09 /* 1001 */
#define DIV31_POLY5 0x0a /* 1010 */
#define POLY5_POLY5 0x0b /* 1011 */
#define DIV3_PURE 0x0c /* 1100 */
#define DIV3_PURE2 0x0d /* 1101 */
#define DIV93_PURE 0x0e /* 1110 */
#define DIV3_POLY5 0x0f /* 1111 */
#define DIV3_MASK 0x0c
#define AUDC0 0x15
#define AUDC1 0x16
#define AUDF0 0x17
#define AUDF1 0x18
#define AUDV0 0x19
#define AUDV1 0x1a
/* the size (in entries) of the 4 polynomial tables */
#define POLY4_SIZE 0x000f
#define POLY5_SIZE 0x001f
#define POLY9_SIZE 0x01ff
/* channel definitions */
#define CHAN1 0
#define CHAN2 1
#define FALSE 0
#define TRUE 1
/* LOCAL GLOBAL VARIABLE DEFINITIONS */
/* structures to hold the 6 tia sound control bytes */
static uint8 AUDC[2]; /* AUDCx (15, 16) */
static uint8 AUDF[2]; /* AUDFx (17, 18) */
static uint8 AUDV[2]; /* AUDVx (19, 1A) */
static uint8 Outvol[2]; /* last output volume for each channel */
static uint32 volume; /* output sample volume percentage */
/* Initialze the bit patterns for the polynomials. */
/* The 4bit and 5bit patterns are the identical ones used in the tia chip. */
/* Though the patterns could be packed with 8 bits per byte, using only a */
/* single bit per byte keeps the math simple, which is important for */
/* efficient processing. */
static uint8 Bit4[POLY4_SIZE] =
{ 1,1,0,1,1,1,0,0,0,0,1,0,1,0,0 };
static uint8 Bit5[POLY5_SIZE] =
{ 0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1 };
/* I've treated the 'Div by 31' counter as another polynomial because of */
/* the way it operates. It does not have a 50% duty cycle, but instead */
/* has a 13:18 ratio (of course, 13+18 = 31). This could also be */
/* implemented by using counters. */
static uint8 Div31[POLY5_SIZE] =
{ 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 };
/* Rather than have a table with 511 entries, I use a random number */
/* generator. */
static uint8 Bit9[POLY9_SIZE];
static uint8 P4[2]; /* Position pointer for the 4-bit POLY array */
static uint8 P5[2]; /* Position pointer for the 5-bit POLY array */
static uint16 P9[2]; /* Position pointer for the 9-bit POLY array */
static uint8 Div_n_cnt[2]; /* Divide by n counter. one for each channel */
static uint8 Div_n_max[2]; /* Divide by n maximum, one for each channel */
/* In my routines, I treat the sample output as another divide by N counter. */
/* For better accuracy, the Samp_n_cnt has a fixed binary decimal point */
/* which has 8 binary digits to the right of the decimal point. */
static uint16 Samp_n_max; /* Sample max, multiplied by 256 */
static uint16 Samp_n_cnt; /* Sample cnt. */
/*****************************************************************************/
/* Module: Tia_sound_init() */
/* Purpose: to handle the power-up initialization functions */
/* these functions should only be executed on a cold-restart */
/* */
/* Author: Ron Fries */
/* Date: September 10, 1996 */
/* */
/* Inputs: sample_freq - the value for the '30 Khz' Tia audio clock */
/* playback_freq - the playback frequency in samples per second */
/* */
/* Outputs: Adjusts local globals - no return value */
/* */
/*****************************************************************************/
void Tia_sound_init (uint16 sample_freq, uint16 playback_freq)
{
uint8 chan;
int16 n;
/* fill the 9bit polynomial with random bits */
for (n=0; n<POLY9_SIZE; n++)
{
Bit9[n] = rand() & 0x01; /* fill poly9 with random bits */
}
/* calculate the sample 'divide by N' value based on the playback freq. */
Samp_n_max = (uint16)(((uint32)sample_freq<<8)/playback_freq);
Samp_n_cnt = 0; /* initialize all bits of the sample counter */
/* initialize the local globals */
for (chan = CHAN1; chan <= CHAN2; chan++)
{
Outvol[chan] = 0;
Div_n_cnt[chan] = 0;
Div_n_max[chan] = 0;
AUDC[chan] = 0;
AUDF[chan] = 0;
AUDV[chan] = 0;
P4[chan] = 0;
P5[chan] = 0;
P9[chan] = 0;
}
volume = 100;
}
/*****************************************************************************/
/* Module: Update_tia_sound() */
/* Purpose: To process the latest control values stored in the AUDF, AUDC, */
/* and AUDV registers. It pre-calculates as much information as */
/* possible for better performance. This routine has not been */
/* optimized. */
/* */
/* Author: Ron Fries */
/* Date: January 14, 1997 */
/* */
/* Inputs: addr - the address of the parameter to be changed */
/* val - the new value to be placed in the specified address */
/* */
/* Outputs: Adjusts local globals - no return value */
/* */
/*****************************************************************************/
void Update_tia_sound (uint16 addr, uint8 val)
{
uint16 new_val = 0;
uint8 chan;
/* determine which address was changed */
switch (addr)
{
case AUDC0:
AUDC[0] = val & 0x0f;
chan = 0;
break;
case AUDC1:
AUDC[1] = val & 0x0f;
chan = 1;
break;
case AUDF0:
AUDF[0] = val & 0x1f;
chan = 0;
break;
case AUDF1:
AUDF[1] = val & 0x1f;
chan = 1;
break;
case AUDV0:
AUDV[0] = (val & 0x0f) << 3;
chan = 0;
break;
case AUDV1:
AUDV[1] = (val & 0x0f) << 3;
chan = 1;
break;
default:
chan = 255;
break;
}
/* if the output value changed */
if (chan != 255)
{
/* an AUDC value of 0 is a special case */
if (AUDC[chan] == SET_TO_1)
{
/* indicate the clock is zero so no processing will occur */
new_val = 0;
/* and set the output to the selected volume */
Outvol[chan] = AUDV[chan];
}
else
{
/* otherwise calculate the 'divide by N' value */
new_val = AUDF[chan] + 1;
/* if bits 2 & 3 are set, then multiply the 'div by n' count by 3 */
if ((AUDC[chan] & DIV3_MASK) == DIV3_MASK)
{
new_val *= 3;
}
}
/* only reset those channels that have changed */
if (new_val != Div_n_max[chan])
{
/* reset the divide by n counters */
Div_n_max[chan] = new_val;
/* if the channel is now volume only or was volume only */
if ((Div_n_cnt[chan] == 0) || (new_val == 0))
{
/* reset the counter (otherwise let it complete the previous) */
Div_n_cnt[chan] = new_val;
}
}
}
}
/*****************************************************************************/
/* Module: Tia_process_2() */
/* Purpose: To fill the output buffer with the sound output based on the */
/* tia chip parameters. This routine has not been optimized. */
/* Though it is not used by the program, I've left it for reference.*/
/* */
/* Author: Ron Fries */
/* Date: September 10, 1996 */
/* */
/* Inputs: *buffer - pointer to the buffer where the audio output will */
/* be placed */
/* n - size of the playback buffer */
/* */
/* Outputs: the buffer will be filled with n bytes of audio - no return val */
/* */
/*****************************************************************************/
void Tia_process_2 (register unsigned char *buffer, register uint16 n)
{
register uint8 chan;
/* loop until the buffer is filled */
while (n)
{
/* loop through the channels */
for (chan = CHAN1; chan <= CHAN2; chan++)
{
/* NOTE: this routine intentionally does not count down to zero */
/* since 0 is used as a special case - no clock */
/* if the divide by N counter can count down */
if (Div_n_cnt[chan] > 1)
{
/* decrement and loop */
Div_n_cnt[chan]--;
}
/* otherwise if we've reached the bottom */
else if (Div_n_cnt[chan] == 1)
{
/* reset the counter */
Div_n_cnt[chan] = Div_n_max[chan];
/* the P5 counter has multiple uses, so we inc it here */
P5[chan]++;
if (P5[chan] == POLY5_SIZE)
P5[chan] = 0;
/* check clock modifier for clock tick */
/* if we're using pure tones OR
we're using DIV31 and the DIV31 bit is set OR
we're using POLY5 and the POLY5 bit is set */
if (((AUDC[chan] & 0x02) == 0) ||
(((AUDC[chan] & 0x01) == 0) && Div31[P5[chan]]) ||
(((AUDC[chan] & 0x01) == 1) && Bit5[P5[chan]]))
{
if (AUDC[chan] & 0x04) /* pure modified clock selected */
{
if (Outvol[chan]) /* if the output was set */
Outvol[chan] = 0; /* turn it off */
else
Outvol[chan] = AUDV[chan]; /* else turn it on */
}
else if (AUDC[chan] & 0x08) /* check for p5/p9 */
{
if (AUDC[chan] == POLY9) /* check for poly9 */
{
/* inc the poly9 counter */
P9[chan]++;
if (P9[chan] == POLY9_SIZE)
P9[chan] = 0;
if (Bit9[P9[chan]]) /* if poly9 bit is set */
Outvol[chan] = AUDV[chan];
else
Outvol[chan] = 0;
}
else /* must be poly5 */
{
if (Bit5[P5[chan]])
Outvol[chan] = AUDV[chan];
else
Outvol[chan] = 0;
}
}
else /* poly4 is the only remaining option */
{
/* inc the poly4 counter */
P4[chan]++;
if (P4[chan] == POLY4_SIZE)
P4[chan] = 0;
if (Bit4[P4[chan]])
Outvol[chan] = AUDV[chan];
else
Outvol[chan] = 0;
}
}
}
}
/* decrement the sample counter - value is 256 since the lower
byte contains the fractional part */
Samp_n_cnt -= 256;
/* if the count down has reached zero */
if (Samp_n_cnt < 256)
{
/* adjust the sample counter */
Samp_n_cnt += Samp_n_max;
/* calculate the latest output value and place in buffer */
*(buffer++) = Outvol[0] + Outvol[1];
/* and indicate one less byte to process */
n--;
}
}
}
/*****************************************************************************/
/* Module: Tia_process() */
/* Purpose: To fill the output buffer with the sound output based on the */
/* tia chip parameters. This routine has been optimized. */
/* */
/* Author: Ron Fries */
/* Date: September 10, 1996 */
/* */
/* Inputs: *buffer - pointer to the buffer where the audio output will */
/* be placed */
/* n - size of the playback buffer */
/* */
/* Outputs: the buffer will be filled with n bytes of audio - no return val */
/* */
/*****************************************************************************/
void Tia_process (register unsigned char *buffer, register uint16 n)
{
register uint8 audc0,audv0,audc1,audv1;
register uint8 div_n_cnt0,div_n_cnt1;
register uint8 p5_0, p5_1,outvol_0,outvol_1;
audc0 = AUDC[0];
audv0 = AUDV[0];
audc1 = AUDC[1];
audv1 = AUDV[1];
/* make temporary local copy */
p5_0 = P5[0];
p5_1 = P5[1];
outvol_0 = Outvol[0];
outvol_1 = Outvol[1];
div_n_cnt0 = Div_n_cnt[0];
div_n_cnt1 = Div_n_cnt[1];
/* loop until the buffer is filled */
while (n)
{
/* Process channel 0 */
if (div_n_cnt0 > 1)
{
div_n_cnt0--;
}
else if (div_n_cnt0 == 1)
{
div_n_cnt0 = Div_n_max[0];
/* the P5 counter has multiple uses, so we inc it here */
p5_0++;
if (p5_0 == POLY5_SIZE)
p5_0 = 0;
/* check clock modifier for clock tick */
if (((audc0 & 0x02) == 0) ||
(((audc0 & 0x01) == 0) && Div31[p5_0]) ||
(((audc0 & 0x01) == 1) && Bit5[p5_0]))
{
if (audc0 & 0x04) /* pure modified clock selected */
{
if (outvol_0) /* if the output was set */
outvol_0 = 0; /* turn it off */
else
outvol_0 = audv0; /* else turn it on */
}
else if (audc0 & 0x08) /* check for p5/p9 */
{
if (audc0 == POLY9) /* check for poly9 */
{
/* inc the poly9 counter */
P9[0]++;
if (P9[0] == POLY9_SIZE)
P9[0] = 0;
if (Bit9[P9[0]])
outvol_0 = audv0;
else
outvol_0 = 0;
}
else /* must be poly5 */
{
if (Bit5[p5_0])
outvol_0 = audv0;
else
outvol_0 = 0;
}
}
else /* poly4 is the only remaining option */
{
/* inc the poly4 counter */
P4[0]++;
if (P4[0] == POLY4_SIZE)
P4[0] = 0;
if (Bit4[P4[0]])
outvol_0 = audv0;
else
outvol_0 = 0;
}
}
}
/* Process channel 1 */
if (div_n_cnt1 > 1)
{
div_n_cnt1--;
}
else if (div_n_cnt1 == 1)
{
div_n_cnt1 = Div_n_max[1];
/* the P5 counter has multiple uses, so we inc it here */
p5_1++;
if (p5_1 == POLY5_SIZE)
p5_1 = 0;
/* check clock modifier for clock tick */
if (((audc1 & 0x02) == 0) ||
(((audc1 & 0x01) == 0) && Div31[p5_1]) ||
(((audc1 & 0x01) == 1) && Bit5[p5_1]))
{
if (audc1 & 0x04) /* pure modified clock selected */
{
if (outvol_1) /* if the output was set */
outvol_1 = 0; /* turn it off */
else
outvol_1 = audv1; /* else turn it on */
}
else if (audc1 & 0x08) /* check for p5/p9 */
{
if (audc1 == POLY9) /* check for poly9 */
{
/* inc the poly9 counter */
P9[1]++;
if (P9[1] == POLY9_SIZE)
P9[1] = 0;
if (Bit9[P9[1]])
outvol_1 = audv1;
else
outvol_1 = 0;
}
else /* must be poly5 */
{
if (Bit5[p5_1])
outvol_1 = audv1;
else
outvol_1 = 0;
}
}
else /* poly4 is the only remaining option */
{
/* inc the poly4 counter */
P4[1]++;
if (P4[1] == POLY4_SIZE)
P4[1] = 0;
if (Bit4[P4[1]])
outvol_1 = audv1;
else
outvol_1 = 0;
}
}
}
/* decrement the sample counter - value is 256 since the lower
byte contains the fractional part */
Samp_n_cnt -= 256;
/* if the count down has reached zero */
if (Samp_n_cnt < 256)
{
/* adjust the sample counter */
Samp_n_cnt += Samp_n_max;
/* calculate the latest output value and place in buffer */
#ifdef MAC_OSX
*(buffer++) = ((uint8) ((((uint32)outvol_0 + (uint32)outvol_1) * volume) / 100))/2 + 128;
#else
*(buffer++) = ((((uint32)outvol_0 + (uint32)outvol_1) * volume) / 100);
#endif
/* and indicate one less byte to process */
n--;
}
}
/* save for next round */
P5[0] = p5_0;
P5[1] = p5_1;
Outvol[0] = outvol_0;
Outvol[1] = outvol_1;
Div_n_cnt[0] = div_n_cnt0;
Div_n_cnt[1] = div_n_cnt1;
}
/*****************************************************************************/
/* Module: Tia_get_registers() */
/* Purpose: Returns the 6 TIA sound registers for use in state */
/* loading and saving. */
/* */
/* Author: Stephen Anthony */
/* Date: October 31, 2002 */
/* */
/* Inputs: reg .. reg6 - pointers to the variables where the registers */
/* will be placed */
/* */
/*****************************************************************************/
void Tia_get_registers (unsigned char *reg1, unsigned char *reg2, unsigned char *reg3,
unsigned char *reg4, unsigned char *reg5, unsigned char *reg6)
{
*reg1 = AUDC[0];
*reg2 = AUDC[1];
*reg3 = AUDF[0];
*reg4 = AUDF[1];
*reg5 = AUDV[0];
*reg6 = AUDV[1];
}
/*****************************************************************************/
/* Module: Tia_set_registers() */
/* Purpose: Sets the 6 TIA sound registers for use in state */
/* loading and saving. */
/* */
/* Author: Stephen Anthony */
/* Date: October 31, 2002 */
/* */
/* Inputs: reg .. reg6 - the registers to be set */
/* */
/*****************************************************************************/
void Tia_set_registers (unsigned char reg1, unsigned char reg2, unsigned char reg3,
unsigned char reg4, unsigned char reg5, unsigned char reg6)
{
AUDC[0] = reg1;
AUDC[1] = reg2;
AUDF[0] = reg3;
AUDF[1] = reg4;
AUDV[0] = reg5;
AUDV[1] = reg6;
}
/*****************************************************************************/
/* Module: Tia_volume() */
/* Purpose: Set volume to the specified percentage */
/* */
/* Author: Bradford W. Mott */
/* Date: June 12, 2004 */
/* */
/*****************************************************************************/
void Tia_volume (unsigned int percent)
{
if((percent >= 0) && (percent <= 100))
{
volume = percent;
}
}
#ifdef __cplusplus
}
#endif

View File

@ -1,61 +0,0 @@
/*****************************************************************************/
/* */
/* Module: TIA Chip Sound Simulator Includes, V1.1 */
/* Purpose: Define global function prototypes and structures for the TIA */
/* Chip Sound Simulator. */
/* Author: Ron Fries */
/* */
/* Revision History: */
/* 10-Sep-96 - V1.0 - Initial Release */
/* 14-Jan-97 - V1.1 - Added compiler directives to facilitate compilation */
/* on a C++ compiler. */
/* */
/*****************************************************************************/
/* */
/* License Information and Copyright Notice */
/* ======================================== */
/* */
/* TiaSound is Copyright(c) 1997 by Ron Fries */
/* */
/* This library is free software; you can redistribute it and/or modify it */
/* under the terms of version 2 of the GNU Library General Public License */
/* as published by the Free Software Foundation. */
/* */
/* This library is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library */
/* General Public License for more details. */
/* To obtain a copy of the GNU Library General Public License, write to the */
/* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* */
/* Any permitted reproduction of these routines, in whole or in part, must */
/* bear this legend. */
/* */
/*****************************************************************************/
#ifndef _TIASOUND_H
#define _TIASOUND_H
#ifdef __cplusplus
extern "C" {
#endif
void Tia_sound_init (unsigned int sample_freq, unsigned int playback_freq);
void Update_tia_sound (unsigned int addr, unsigned char val);
void Tia_process_2 (register unsigned char *buffer,
register unsigned int n);
void Tia_process (register unsigned char *buffer,
register unsigned int n);
void Tia_get_registers (unsigned char *reg1, unsigned char *reg2, unsigned char *reg3,
unsigned char *reg4, unsigned char *reg5, unsigned char *reg6);
void Tia_set_registers (unsigned char reg1, unsigned char reg2, unsigned char reg3,
unsigned char reg4, unsigned char reg5, unsigned char reg6);
void Tia_volume (unsigned int percent);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,297 +0,0 @@
TIASOUND.C - TIA SOUND EMULATION V1.0
=====================================
As I'm sure you've already discovered, the Stella manual isn't always
correct. My observations show what I believe to be several discrepancies
in the description of the distortions. Of course, I could be wrong on a few
of these, so if some of the games don't sound right, please let me know
which ones. If possible, it would be best if you could send me a wave file
of what it is supposed to sound like, preferably at 44 KHz. Only a few
seconds should be necessary.
TIA AUDIO CIRCUITRY
===================
THE HARDWARE
------------
In general, the sound hardware can be described as follows:
Selecting the Clock Modifier - Bits D0 and D1
---------------------------------------------
Bits D0 and D1 select the output clock modifier:
D1 D0
-------
0 0 - direct clock (pure)
0 1 - direct clock (pure)
1 0 - divide by 31
1 1 - 5-bit polynomial
The 'divide by 31' isn't simply the input clock divided by 31. It is, in
essence, a 5-bit polynomial with only two bits set. The resulting square
wave actually has a 13:18 ratio. This may be implemented in the hardware
as a pair of traps on a 5-bit counter.
Selecting the Source Pattern - Bits D2 and D3
---------------------------------------------
Bits D2 and D3 select the source to be clocked:
D3 D2
-------
0 0 - 4-bit polynomial
0 1 - pure (Q')
1 0 - 5-bit polynomial
1 1 - pure (Q')
The 'pure' tones are generated by toggling the output. Whenever a clock
tick is received, the output will change states. I've used the notation Q'
to indicate the 'logical NOT of the last output'. Note that since the output
toggles, this can be thought of as a divide by 2 since the output frequency
will be half of the input frequency. This is only true for the pure tones.
Selecting the Source Clock - Bits D2 and D3
-------------------------------------------
When bits D2 and D3 are both set, it affects the source clock. I believe
the '30KHz' clock is actually the 3.58MHz clock divided by 114. When bits
D2 and D3 are set, the input source is switched to the 1.19MHz clock, so the
'30KHz' source clock is reduced to approximately 10KHz.
Exceptions - Selecting No Output or the 9-bit Polynomial
--------------------------------------------------------
There are two exceptions that occur when bits D0-D2 are all 0. If AUDC is
zero (0000), then I believe the output is set equal to the volume. If AUDC is
equal to 8 (1000), the 9-bit polynomial is selected as the source to be
clocked.
Updated Detailed Functions for AUDC
-----------------------------------
From my observations, I would describe the distortion selections as follows:
HEX D3 D2 D1 D0 Clock Source Clock Modifier Source Pattern
--- ------------- -------------- ---------------- ----------------
0 0 0 0 0 3.58 MHz/114 -> none (pure) -> none
1 0 0 0 1 3.58 MHz/114 -> none (pure) -> 4-bit poly
2 0 0 1 0 3.58 MHz/114 -> divide by 31 -> 4-bit poly
3 0 0 1 1 3.58 MHz/114 -> 5-bit poly -> 4-bit poly
4 0 1 0 0 3.58 MHz/114 -> none (pure) -> pure (~Q)
5 0 1 0 1 3.58 MHz/114 -> none (pure) -> pure (~Q)
6 0 1 1 0 3.58 MHz/114 -> divide by 31 -> pure (~Q)
7 0 1 1 1 3.58 MHz/114 -> 5-bit poly -> pure (~Q)
8 1 0 0 0 3.58 MHz/114 -> none (pure) -> 9-bit poly
9 1 0 0 1 3.58 MHz/114 -> none (pure) -> 5-bit poly
A 1 0 1 0 3.58 MHz/114 -> divide by 31 -> 5-bit poly
B 1 0 1 1 3.58 MHz/114 -> 5-bit poly -> 5-bit poly
C 1 1 0 0 1.19 MHz/114 -> none (pure) -> pure (~Q)
D 1 1 0 1 1.19 MHz/114 -> none (pure) -> pure (~Q)
E 1 1 1 0 1.19 MHz/114 -> divide by 31 -> pure (~Q)
F 1 1 1 1 1.19 MHz/114 -> 5-bit poly -> pure (~Q)
For the most part, this follows the Stella manual, but there are a few
differences. Probably the most notable are hex entries 'A' and 'B', which
are listed in the Stella manual as 'div 31: pure tone' and 'set last 4 bits
to 1'.
On entries 'A' and 'B', both the data source and the clock have the same
number of entries (31). Because of this, they will always align in the
same way. Entry 'A' will then reduce to a pure 'div by 31' output which
is identical to entry '6'. On 'B', both the source and the clock align
in such a way that the output will always be 1.
THE POLYNOMIALS
---------------
The 4-bit, 5-bit, and 9-bit polynomials are essentially tables containing
a random series of bits (they are implemented in hardware as shift
registers). Because the tables are fixed in length, the 'random' pattern
will repeat periodically.
The size of the table is described by its name. The actual size of the
table is 2^x - 1, where x is either the 4, 5 or 9. The 4-bit polynomial
has 15 entries, the 5-bit polynomial has 31 entries, and the 9-bit
polynomial has 511 entries.
I've performed some analysis on the output of the actual Atari 2600, and
believe I have the actual 4-bit and 5-bit polynomials used by the Atari.
These have been encoded as byte arrays in my routines. For the 9-bit
polynomial, I use a random number generator which should produce
approximately the same results.
THE CLOCK
---------
I believe the input clock for the audio is a division of the main system
clock. With this assumption, I determined that the input clock for the
audio is equal to the 3.58MHz system clock divided by 114. Note that this
produces an actual audio clock of 31.4 KHz. This value closely matches the
frequencies I recorded from my unit. The Stella manual describes the Audio
Clock as approximately 30KHz, which I suppose is correct if you consider 5%
to be approximate.
If both bits D2 and D3 of the AUDC register are set, I believe the TIA chip
uses the 1.19MHz clock for the base audio clock instead of the 3.58MHz.
This, of course, produces the 'divide by 3' functionality described in the
Stella manual.
TIASOUND.C
==========
The TIASOUND.C file is the heart of the TIA Sound Emulation program.
Although the routines in the file must work together, no other files are
modules are required for operation. A header file, 'TIASOUND.H', has
been included for use in other modules, and provides the necessary
function prototypes. I've attempted to make the routines as portable as
possible, so the file should compile on almost any compiler with little
or no modification.
I have made some attempts at optimizing the routines, though I am sure
more optimization can be done. They are currently only available in 'C'.
I'll be happy to convert them to assembly language if desired. Please feel
free to send me e-mail (see below).
The routines are easy to use. Detailed descriptions on the function calls
are listed below.
GENERAL OVERVIEW
----------------
On start-up of the system, a single call should be made to Tia_sound_init.
This routine will prepare the structures for sound output. This routine
can be called again if necessary during warm-start or other reset.
Once in the main loop, there are two other functions that will be used.
Whenever the system needs to write to either the AUDC, AUDV or AUDF values,
a call should be made to the Update_tia_sound routine. This routine will
take care of updating the internal registers. It will pre-calculate several
values to help with optimization.
The only other routine that is called is the Tia_process function. This
function will fill a audio buffer with a specified number of bytes. This
function should be called whenever a new audio buffer is required.
For best results, I recommend using at least two output buffers. Using this
scheme, the sound card can be playing one buffer while the system is filling
the other.
DETAILED FUNCTION DESCRIPTIONS
------------------------------
Tia_sound_init(uint16 sample_freq, uint16 playback_freq)
--------------------------------------------------------
This function initializes the structures used by the TiaSound.C routines.
This function takes two parameters: the sample frequency and the playback
frequency. The sample frequency is the frequency of the 30KHz source clock.
For my calculations, this clock is about 31.4 KHz, though any 16-bit
unsigned integer value can be used (1-65535).
The playback frequency is the frequency of the sound playback (the frequency
used by the sound card). For best results, both the playback frequency and
the sample frequency should be identical. In the case where the sound card
cannot support 31.4 KHz (i.e. the original SB and many 'SB compatible' cards),
there are three options:
1) Set the sample frequency to 31400 and the playback frequency to the
maximum possible (e.g. 22050). Though the system will reproduce all
output values, a significant amount of aliasing is introduced.
2) Set the sample frequency and the playback frequency to the maximum possible
(e.g. 22050). In this case, all output values are reproduced with no
distortions; however, the pitch is about 2/3 of an octave low.
3) Set the sample frequency to 31400 and the playback frequency to exactly
1/2 of the sample frequency (15700). In this case, the output frequency
is correct and the aliasing is minimized. The aliasing is only
noticeable on the higher frequencies. Most notably, the highest pure tone
(AUDF = 0) is inaudible.
Feel free to experiment to find other alternatives as well.
This function has no return value (void).
Update_tia_sound (uint16 addr, uint8 val)
-----------------------------------------
This function should be called each time an AUDC, AUDF or AUDV value
changes. This function takes two parameters: the address to change and
the new value. The address should be one of the following values:
Addr Description
---- -----------
0x15 AUDC0
0x16 AUDC1
0x17 AUDF0
0x18 AUDF1
0x19 AUDV0
0x1A AUDV1
Any values outside of this range will be ignored.
The routine pre-calculates several values that are needed by the
processing function. This is done to optimize performance.
This function has no return value (void).
Tia_process (unsigned char *buffer, uint16 n)
---------------------------------------------
This function calculates and fills a buffer with unsigned 8-bit mono audio.
This function takes two parameters: a pointer to the buffer to fill and
the size of the buffer (limited to 65535). This function fills the
buffer based on the requested size and returns. It automatically
updates the pointers for the next call, so subsequent calls to this function
will provide a continuous stream of data.
The size of the buffer that is needed depends on the playback frequency.
It is best to keep the buffer as small as possible to maximize response time
to changes in the sound. Of course, the minimum size is dependent on
system and emulator performance.
Selecting the correct buffer size is a careful balance. Selecting a buffer
size that is too small will produce noticeable clicks in the output, though
selecting a size that is too large will cause a poor response time and
possible delays in the system when the new buffer is filled.
This function has no return value (void).
License Information and Copyright Notice
========================================
TiaSound is Copyright(c) 1996 by Ron Fries
This library is free software; you can redistribute it and/or modify it under
the terms of version 2 of the GNU Library General Public License as published
by the Free Software Foundation.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
details.
To obtain a copy of the GNU Library General Public License, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Any permitted reproduction of these routines, in whole or in part, must bear
this legend.

View File

@ -1,187 +0,0 @@
//============================================================================
//
// MM MM 6666 555555 0000 2222
// MMMM MMMM 66 66 55 00 00 22 22
// MM MMM MM 66 55 00 00 22
// MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
// MM MM 66 66 55 00 00 22
// MM MM 66 66 55 55 00 00 22
// MM MM 6666 5555 0000 222222
//
// Copyright (c) 1995-1998 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: D6502.cxx,v 1.1.1.1 2001-12-27 19:54:29 bwmott Exp $
//============================================================================
#include <stdio.h>
#include "D6502.hxx"
#include "M6502.hxx"
#include "System.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
D6502::D6502(System* system)
: mySystem(system)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
D6502::~D6502()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static uInt16 dpeek(System* system, uInt16 address)
{
return (uInt16)system->peek(address) |
(((uInt16)system->peek(address + 1)) << 8);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 D6502::disassemble(uInt16 address, char* buffer)
{
uInt8 opcode = mySystem->peek(address);
switch(M6502::ourAddressingModeTable[opcode])
{
case M6502::Absolute:
sprintf(buffer, "%s $%04X", M6502::ourInstructionMnemonicTable[opcode],
dpeek(mySystem, address + 1));
return 3;
case M6502::AbsoluteX:
sprintf(buffer, "%s $%04X,x", M6502::ourInstructionMnemonicTable[opcode],
dpeek(mySystem, address + 1));
return 3;
case M6502::AbsoluteY:
sprintf(buffer, "%s $%04X,y", M6502::ourInstructionMnemonicTable[opcode],
dpeek(mySystem, address + 1));
return 3;
case M6502::Immediate:
sprintf(buffer, "%s #$%02X", M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
case M6502::Implied:
sprintf(buffer, "%s", M6502::ourInstructionMnemonicTable[opcode]);
return 1;
case M6502::Indirect:
sprintf(buffer, "%s ($%04X)", M6502::ourInstructionMnemonicTable[opcode],
dpeek(mySystem, address + 1));
return 3;
case M6502::IndirectX:
sprintf(buffer, "%s ($%02X,x)",
M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
case M6502::IndirectY:
sprintf(buffer, "%s ($%02X),y",
M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
case M6502::Relative:
sprintf(buffer, "%s $%04X", M6502::ourInstructionMnemonicTable[opcode],
address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)));
return 2;
case M6502::Zero:
sprintf(buffer, "%s $%02X", M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
case M6502::ZeroX:
sprintf(buffer, "%s $%02X,x", M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
case M6502::ZeroY:
sprintf(buffer, "%s $%02X,y", M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1));
return 2;
default:
sprintf(buffer, "dc $%02X", opcode);
return 1;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 D6502::a()
{
return mySystem->m6502().A;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::a(uInt8 value)
{
mySystem->m6502().A = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 D6502::pc()
{
return mySystem->m6502().PC;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::pc(uInt16 value)
{
mySystem->m6502().PC = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 D6502::ps()
{
return mySystem->m6502().PS();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::ps(uInt8 value)
{
mySystem->m6502().PS(value);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 D6502::sp()
{
return mySystem->m6502().SP;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::sp(uInt8 value)
{
mySystem->m6502().SP = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 D6502::x()
{
return mySystem->m6502().X;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::x(uInt8 value)
{
mySystem->m6502().X = value;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 D6502::y()
{
return mySystem->m6502().Y;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void D6502::y(uInt8 value)
{
mySystem->m6502().Y = value;
}

View File

@ -1,152 +0,0 @@
//============================================================================
//
// MM MM 6666 555555 0000 2222
// MMMM MMMM 66 66 55 00 00 22 22
// MM MMM MM 66 55 00 00 22
// MM M MM 66666 55555 00 00 22222 -- "A 6502 Microprocessor Emulator"
// MM MM 66 66 55 00 00 22
// MM MM 66 66 55 55 00 00 22
// MM MM 6666 5555 0000 222222
//
// Copyright (c) 1995-1998 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: D6502.hxx,v 1.1.1.1 2001-12-27 19:54:29 bwmott Exp $
//============================================================================
#ifndef D6502_HXX
#define D6502_HXX
class D6502;
class M6502;
class System;
#include "bspf.hxx"
/**
This is a base class for 6502 debuggers. This class provides the
basic functionality needed for interactive debuggers.
@author Bradford W. Mott
@version $Id: D6502.hxx,v 1.1.1.1 2001-12-27 19:54:29 bwmott Exp $
*/
class D6502
{
public:
/**
Create a new 6502 debugger for the specified system
@param system The system the debugger should operate on
*/
D6502(System* system);
/**
Destructor
*/
virtual ~D6502();
public:
/**
Disassemble a single instruction at the specified address into
the given buffer and answer the number of bytes disassembled.
The buffer should be at least 20 characters long.
@param address The address to disassemble code at
@param buffer The buffer where the ASCII disassemble should be stored
@return The number of bytes disassembled
*/
uInt16 disassemble(uInt16 address, char* buffer);
public:
/**
Get the value of the accumulator
@return The accumulator's value
*/
uInt8 a();
/**
Change value of the accumulator
@param value The value to set the accumulator to
*/
void a(uInt8 value);
/**
Get value of the program counter
@return The program counter's value
*/
uInt16 pc();
/**
Change value of the program counter
@param value The value to set the program counter to
*/
void pc(uInt16 value);
/**
Get the value of the processor status register
@return The processor status register's value
*/
uInt8 ps();
/**
Change value of the processor status register
@param value The value to set the processor status register to
*/
void ps(uInt8 value);
/**
Get the value of the stack pointer
@return The stack pointer's value
*/
uInt8 sp();
/**
Change value of the stack pointer
@param value The value to set the stack pointer to
*/
void sp(uInt8 value);
/**
Get the value of the X index register
@return The X register's value
*/
uInt8 x();
/**
Change value of the X index register
@param value The value to set the X register to
*/
void x(uInt8 value);
/**
Get the value of the Y index register
@return The Y register's value
*/
uInt8 y();
/**
Change value of the Y index register
@param value The value to set the Y register to
*/
void y(uInt8 value);
protected:
// Pointer to the system I'm debugging
System* mySystem;
};
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,47 +0,0 @@
Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
designed to make it easy to write multi-media software, such as games and
emulators.
The Simple DirectMedia Layer library source code is available from:
http://www.libsdl.org/
This library is distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html
---------------------------------------------------------------------------
The SDL.dll library included in this package has been modified to
automatically work with the Stelladaptor device.
As per the GPL, all modifications to SDL must be provided and documented.
The included patchfile 'SDL_mmjoystick_1.2.7.diff' can be used with
SDL-1.2.7.zip (located on the main SDL web page).
To rebuild the SDL.dll file, follow the instructions below:
1) Get the 'SDL-1.2.7.zip' package from the main SDL website and
unzip it.
2) Apply the patchfile 'SDL_mmjoystick_1.2.7.diff' to the SDL-1.2.7
directory (under Linux: patch -p0 < SDL_mmjoystick_1.2.7.diff).
3) Build the SDL.dll library from within Visual C++ (you may need the DX5
development files).
Notes:
1) Credit for the bulk of the patchfile goes to Glenn Maynard.
2) Future versions of SDL will hopefully have this patch integrated.
3) The included SDL.dll file has not been extensively tested. It is
believed to be compatible with the most common input devices,
but support may not be present for buttons on esoteric devices
(hats, sliders, etc). If the included version of SDL.dll doesn't
support your particular input device (and you have no need for
Stelladaptor support), you can use the standard SDL.dll from
the main SDL website.

View File

@ -1,696 +0,0 @@
--- SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c 2004-02-18 09:22:02.000000000 -0330
+++ SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c 2004-07-15 14:43:57.623276184 -0230
@@ -22,12 +22,19 @@
#ifdef SAVE_RCSID
static char rcsid =
- "@(#) $Id: SDL_mmjoystick_1.2.7.diff,v 1.1 2004-07-15 18:08:55 stephena Exp $";
+ "@(#) $Id: SDL_mmjoystick_1.2.7.diff,v 1.1 2004-07-15 18:08:55 stephena Exp $";
#endif
-/* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */
+/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
+ * A. Formiga's WINMM driver.
+ *
+ * Hats and sliders are completely untested; the app I'm writing this for mostly
+ * doesn't use them and I don't own any joysticks with them.
+ *
+ * We don't bother to use event notification here. It doesn't seem to work
+ * with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and
+ * let it return 0 events. */
-#include <stdlib.h>
#include <stdio.h> /* For the definition of NULL */
#include "SDL_error.h"
@@ -35,12 +42,28 @@
#include "SDL_sysjoystick.h"
#include "SDL_joystick_c.h"
-#include <windows.h>
-#include <mmsystem.h>
+#ifdef _XBOX
+ #include <xtl.h>
+#else
+ #include <windows.h>
+#endif
+
+#define DIRECTINPUT_VERSION 0x0500
+#include <dinput.h>
+
+#include "SDL_active.h"
+
+#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */
+
+extern HRESULT (WINAPI *DInputCreate)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT *ppDI, LPUNKNOWN punkOuter);
+
+static LPDIRECTINPUT dinput = NULL;
+extern HINSTANCE SDL_Instance;
#define MAX_JOYSTICKS 16
#define MAX_AXES 6 /* each joystick can have up to 6 axes */
#define MAX_BUTTONS 32 /* and 32 buttons */
+#define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
#define AXIS_MIN -32768 /* minimum value for axis coordinate */
#define AXIS_MAX 32767 /* maximum value for axis coordinate */
/* limit axis to 256 possible positions to filter out noise */
@@ -48,27 +71,148 @@
#define JOY_BUTTON_FLAG(n) (1<<n)
+typedef enum Type { BUTTON, AXIS, HAT } Type;
+
/* array to hold joystick ID values */
-static UINT SYS_JoystickID[MAX_JOYSTICKS];
-static JOYCAPS SYS_Joystick[MAX_JOYSTICKS];
+static DIDEVICEINSTANCE SYS_Joystick[MAX_JOYSTICKS];
+static int SYS_NumJoysticks;
+
+extern HWND SDL_Window;
+
+typedef struct input_t
+{
+ /* DirectInput offset for this input type: */
+ DWORD ofs;
+
+ /* Button, axis or hat: */
+ Type type;
+
+ /* SDL input offset: */
+ Uint8 num;
+} input_t;
/* The private structure used to keep track of a joystick */
struct joystick_hwdata
{
- /* joystick ID */
- UINT id;
+ LPDIRECTINPUTDEVICE2 InputDevice;
+ int buffered;
- /* values used to translate device-specific coordinates into
- SDL-standard ranges */
- struct _transaxis {
- int offset;
- float scale;
- } transaxis[6];
+ input_t Inputs[MAX_INPUTS];
+ int NumInputs;
};
-/* Convert a win32 Multimedia API return code to a text message */
-static void SetMMerror(char *function, int code);
+/* Convert a DirectInput return code to a text message */
+static void SetDIerror(char *function, int code)
+{
+ static char *error;
+ static char errbuf[1024];
+
+ errbuf[0] = 0;
+ switch (code) {
+ case DIERR_GENERIC:
+ error = "Undefined error!";
+ break;
+ case DIERR_OLDDIRECTINPUTVERSION:
+ error = "Your version of DirectInput needs upgrading";
+ break;
+ case DIERR_INVALIDPARAM:
+ error = "Invalid parameters";
+ break;
+ case DIERR_OUTOFMEMORY:
+ error = "Out of memory";
+ break;
+ case DIERR_DEVICENOTREG:
+ error = "Device not registered";
+ break;
+ case DIERR_NOINTERFACE:
+ error = "Interface not supported";
+ break;
+ case DIERR_NOTINITIALIZED:
+ error = "Device not initialized";
+ break;
+ default:
+ sprintf(errbuf, "%s: Unknown DirectInput error: 0x%x",
+ function, code);
+ break;
+ }
+ if ( ! errbuf[0] ) {
+ sprintf(errbuf, "%s: %s", function, error);
+ }
+ SDL_SetError("%s", errbuf);
+ return;
+}
+
+
+BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance,
+ VOID* pContext )
+{
+ memcpy(&SYS_Joystick[SYS_NumJoysticks], pdidInstance, sizeof(DIDEVICEINSTANCE));
+ SYS_NumJoysticks++;
+
+ if( SYS_NumJoysticks >= MAX_JOYSTICKS )
+ return DIENUM_STOP;
+ return DIENUM_CONTINUE;
+}
+
+static BOOL CALLBACK DIJoystick_EnumDevObjectsProc(LPCDIDEVICEOBJECTINSTANCE dev,
+ LPVOID pvRef)
+{
+ SDL_Joystick *joystick = (SDL_Joystick*)pvRef;
+ HRESULT result;
+ input_t *in = &joystick->hwdata->Inputs[joystick->hwdata->NumInputs];
+ const int SupportedMask = DIDFT_BUTTON | DIDFT_POV | DIDFT_AXIS;
+ if(!(dev->dwType & SupportedMask))
+ return DIENUM_CONTINUE; /* unsupported */
+
+ in->ofs = dev->dwOfs;
+
+ if(dev->dwType & DIDFT_BUTTON) {
+ in->type = BUTTON;
+ in->num = joystick->nbuttons;
+ joystick->nbuttons++;
+ } else if(dev->dwType & DIDFT_POV) {
+ in->type = HAT;
+ in->num = joystick->nhats;
+ joystick->nhats++;
+ } else { /* dev->dwType & DIDFT_AXIS */
+ DIPROPRANGE diprg;
+ DIPROPDWORD dilong;
+
+ in->type = AXIS;
+ in->num = joystick->naxes;
+
+ diprg.diph.dwSize = sizeof(diprg);
+ diprg.diph.dwHeaderSize = sizeof(diprg.diph);
+ diprg.diph.dwObj = dev->dwOfs;
+ diprg.diph.dwHow = DIPH_BYOFFSET;
+ diprg.lMin = AXIS_MIN;
+ diprg.lMax = AXIS_MAX;
+
+ result = IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, DIPROP_RANGE, &diprg.diph);
+ if ( result != DI_OK )
+ return DIENUM_CONTINUE; /* don't use this axis */
+
+ /* Set dead zone to 0. */
+ dilong.diph.dwSize = sizeof(dilong);
+ dilong.diph.dwHeaderSize = sizeof(dilong.diph);
+ dilong.diph.dwObj = dev->dwOfs;
+ dilong.diph.dwHow = DIPH_BYOFFSET;
+ dilong.dwData = 0;
+ result = IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, DIPROP_DEADZONE, &dilong.diph);
+ if ( result != DI_OK )
+ return DIENUM_CONTINUE; /* don't use this axis */
+
+ joystick->naxes++;
+ }
+
+ joystick->hwdata->NumInputs++;
+
+ if(joystick->hwdata->NumInputs == MAX_INPUTS)
+ return DIENUM_STOP; /* too many */
+
+ return DIENUM_CONTINUE;
+}
/* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available
@@ -77,51 +221,32 @@
*/
int SDL_SYS_JoystickInit(void)
{
- int i;
- int maxdevs;
- int numdevs;
- JOYINFOEX joyinfo;
- JOYCAPS joycaps;
- MMRESULT result;
+ HRESULT result;
- numdevs = 0;
- maxdevs = joyGetNumDevs();
-
- if ( maxdevs > MAX_JOYSTICKS ) {
- maxdevs = MAX_JOYSTICKS;
- }
+ SYS_NumJoysticks = 0;
-
- for ( i = 0; i < MAX_JOYSTICKS; i++ ) {
- SYS_JoystickID[i] = JOYSTICKID1 + i;
+ /* Create the DirectInput object */
+ result = DInputCreate(SDL_Instance, DIRECTINPUT_VERSION,
+ &dinput, NULL);
+ if ( result != DI_OK ) {
+ SetDIerror("DirectInputCreate", result);
+ return(-1);
}
+ result = IDirectInput_EnumDevices(dinput,
+ DIDEVTYPE_JOYSTICK,
+ EnumJoysticksCallback,
+ NULL,
+ DIEDFL_ATTACHEDONLY );
- for ( i = 0; (i < maxdevs); ++i ) {
-
- /* added 8/31/2001 By Vitaliy Mikitchenko */
- joyinfo.dwSize = sizeof(joyinfo);
- joyinfo.dwFlags = JOY_RETURNALL;
- /* end addition */
-
- result = joyGetPosEx(SYS_JoystickID[i], &joyinfo);
- if ( result == JOYERR_NOERROR ) {
- result = joyGetDevCaps(SYS_JoystickID[i], &joycaps, sizeof(joycaps));
- if ( result == JOYERR_NOERROR ) {
- SYS_JoystickID[numdevs] = SYS_JoystickID[i];
- SYS_Joystick[numdevs] = joycaps;
- numdevs++;
- }
- }
- }
- return(numdevs);
+ return SYS_NumJoysticks;
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
/***-> test for invalid index ? */
- return(SYS_Joystick[index].szPname);
+ return(SYS_Joystick[index].tszProductName);
}
/* Function to open a joystick for use.
@@ -131,26 +256,8 @@
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
- int index, i;
- int caps_flags[MAX_AXES-2] =
- { JOYCAPS_HASZ, JOYCAPS_HASR, JOYCAPS_HASU, JOYCAPS_HASV };
- int axis_min[MAX_AXES], axis_max[MAX_AXES];
-
-
- /* shortcut */
- index = joystick->index;
- axis_min[0] = SYS_Joystick[index].wXmin;
- axis_max[0] = SYS_Joystick[index].wXmax;
- axis_min[1] = SYS_Joystick[index].wYmin;
- axis_max[1] = SYS_Joystick[index].wYmax;
- axis_min[2] = SYS_Joystick[index].wZmin;
- axis_max[2] = SYS_Joystick[index].wZmax;
- axis_min[3] = SYS_Joystick[index].wRmin;
- axis_max[3] = SYS_Joystick[index].wRmax;
- axis_min[4] = SYS_Joystick[index].wUmin;
- axis_max[4] = SYS_Joystick[index].wUmax;
- axis_min[5] = SYS_Joystick[index].wVmin;
- axis_max[5] = SYS_Joystick[index].wVmax;
+ HRESULT result;
+ LPDIRECTINPUTDEVICE device;
/* allocate memory for system specific hardware data */
joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata));
@@ -160,52 +267,114 @@
return(-1);
}
memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
+ joystick->hwdata->buffered = 1;
+
+ result = IDirectInput_CreateDevice(dinput, &SYS_Joystick[joystick->index].guidInstance,
+ &device, NULL);
+ if ( result != DI_OK ) {
+ SetDIerror("DirectInput::CreateDevice", result);
+ return(-1);
+ }
- /* set hardware data */
- joystick->hwdata->id = SYS_JoystickID[index];
- for ( i = 0; i < MAX_AXES; ++i ) {
- if ( (i<2) || (SYS_Joystick[index].wCaps & caps_flags[i-2]) ) {
- joystick->hwdata->transaxis[i].offset =
- AXIS_MIN - axis_min[i];
- joystick->hwdata->transaxis[i].scale =
- (float)(AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]);
- } else {
- joystick->hwdata->transaxis[i].offset = 0;
- joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */
- }
+ result = IDirectInputDevice_QueryInterface(device,
+ &IID_IDirectInputDevice2, (LPVOID *)&joystick->hwdata->InputDevice);
+ IDirectInputDevice_Release(device);
+ if ( result != DI_OK ) {
+ SetDIerror("DirectInputDevice::QueryInterface", result);
+ return(-1);
}
- /* fill nbuttons, naxes, and nhats fields */
- joystick->nbuttons = SYS_Joystick[index].wNumButtons;
- joystick->naxes = SYS_Joystick[index].wNumAxes;
- if ( SYS_Joystick[index].wCaps & JOYCAPS_HASPOV ) {
- joystick->nhats = 1;
- } else {
- joystick->nhats = 0;
+ result = IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->InputDevice, SDL_Window,
+ DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
+ if ( result != DI_OK ) {
+ SetDIerror("DirectInputDevice::SetCooperativeLevel", result);
+ return(-1);
+ }
+
+ result = IDirectInputDevice2_SetDataFormat(joystick->hwdata->InputDevice, &c_dfDIJoystick);
+ if ( result != DI_OK ) {
+ SetDIerror("DirectInputDevice::SetDataFormat", result);
+ return(-1);
+ }
+
+ IDirectInputDevice2_EnumObjects(joystick->hwdata->InputDevice,
+ DIJoystick_EnumDevObjectsProc,
+ joystick,
+ DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV);
+
+ {
+ DIPROPDWORD dipdw;
+ memset(&dipdw, 0, sizeof(dipdw));
+ dipdw.diph.dwSize = sizeof(dipdw);
+ dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = INPUT_QSIZE;
+ result = IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice,
+ DIPROP_BUFFERSIZE, &dipdw.diph);
+
+ if ( result == DI_POLLEDDEVICE )
+ {
+ /* This device doesn't support buffering, so we're forced
+ * to use less reliable polling. */
+ joystick->hwdata->buffered = 0;
+ } else if ( result != DI_OK ) {
+ SetDIerror("DirectInputDevice::SetProperty", result);
+ return(-1);
+ }
}
+
return(0);
}
static Uint8 TranslatePOV(DWORD value)
{
- Uint8 pos;
+ const int HAT_VALS[] = {
+ SDL_HAT_UP,
+ SDL_HAT_UP | SDL_HAT_RIGHT,
+ SDL_HAT_RIGHT,
+ SDL_HAT_DOWN | SDL_HAT_RIGHT,
+ SDL_HAT_DOWN,
+ SDL_HAT_DOWN | SDL_HAT_LEFT,
+ SDL_HAT_LEFT,
+ SDL_HAT_UP | SDL_HAT_LEFT
+ };
+
+ if(LOWORD(value) == 0xFFFF)
+ return SDL_HAT_CENTERED;
+
+ /* Round the value up: */
+ value += 4500 / 2;
+ value %= 36000;
+ value /= 4500;
+
+ if(value >= 8)
+ return SDL_HAT_CENTERED; /* shouldn't happen */
+
+ return HAT_VALS[value];
+}
- pos = SDL_HAT_CENTERED;
- if ( value != JOY_POVCENTERED ) {
- if ( (value > JOY_POVLEFT) || (value < JOY_POVRIGHT) ) {
- pos |= SDL_HAT_UP;
- }
- if ( (value > JOY_POVFORWARD) && (value < JOY_POVBACKWARD) ) {
- pos |= SDL_HAT_RIGHT;
- }
- if ( (value > JOY_POVRIGHT) && (value < JOY_POVLEFT) ) {
- pos |= SDL_HAT_DOWN;
- }
- if ( value > JOY_POVBACKWARD ) {
- pos |= SDL_HAT_LEFT;
- }
- }
- return(pos);
+/* SDL_PrivateJoystick* doesn't discard duplicate events, so we need to
+ * do it. */
+static int SDL_PrivateJoystickAxis_Int(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
+{
+ if(joystick->axes[axis] != value)
+ return SDL_PrivateJoystickAxis(joystick, axis, value);
+ return 0;
+}
+
+static int SDL_PrivateJoystickHat_Int(SDL_Joystick *joystick, Uint8 hat, Uint8 value)
+{
+ if(joystick->hats[hat] != value)
+ return SDL_PrivateJoystickHat(joystick, hat, value);
+ return 0;
+}
+
+static int SDL_PrivateJoystickButton_Int(SDL_Joystick *joystick, Uint8 button, Uint8 state)
+{
+ if(joystick->buttons[button] != state)
+ return SDL_PrivateJoystickButton(joystick, button, state);
+ return 0;
}
/* Function to update the state of a joystick - called as a device poll.
@@ -213,76 +382,126 @@
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
-void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
+void SDL_SYS_JoystickUpdate_Polled(SDL_Joystick *joystick)
{
- MMRESULT result;
+ DIJOYSTATE state;
+ HRESULT result;
int i;
- DWORD flags[MAX_AXES] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
- JOY_RETURNR, JOY_RETURNU, JOY_RETURNV };
- DWORD pos[MAX_AXES];
- struct _transaxis *transaxis;
- int value, change;
- JOYINFOEX joyinfo;
-
- joyinfo.dwSize = sizeof(joyinfo);
- joyinfo.dwFlags = JOY_RETURNALL|JOY_RETURNPOVCTS;
- if ( ! joystick->hats ) {
- joyinfo.dwFlags &= ~(JOY_RETURNPOV|JOY_RETURNPOVCTS);
- }
- result = joyGetPosEx(joystick->hwdata->id, &joyinfo);
- if ( result != JOYERR_NOERROR ) {
- SetMMerror("joyGetPosEx", result);
- return;
- }
-
- /* joystick motion events */
- pos[0] = joyinfo.dwXpos;
- pos[1] = joyinfo.dwYpos;
- pos[2] = joyinfo.dwZpos;
- pos[3] = joyinfo.dwRpos;
- pos[4] = joyinfo.dwUpos;
- pos[5] = joyinfo.dwVpos;
-
- transaxis = joystick->hwdata->transaxis;
- for (i = 0; i < joystick->naxes; i++) {
- if (joyinfo.dwFlags & flags[i]) {
- value = (int)(((float)pos[i] + transaxis[i].offset) * transaxis[i].scale);
- change = (value - joystick->axes[i]);
- if ( (change < -JOY_AXIS_THRESHOLD) || (change > JOY_AXIS_THRESHOLD) ) {
- SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)value);
+
+ result = IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice, sizeof(state), &state);
+ if ( result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED ) {
+ IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
+ result = IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice, sizeof(state), &state);
+ }
+
+ /* Set each known axis, button and POV. */
+ for(i = 0; i < joystick->hwdata->NumInputs; ++i)
+ {
+ const input_t *in = &joystick->hwdata->Inputs[i];
+
+ switch(in->type)
+ {
+ case AXIS:
+ switch(in->ofs)
+ {
+ case DIJOFS_X: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lX); break;
+ case DIJOFS_Y: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lY); break;
+ case DIJOFS_Z: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lZ); break;
+ case DIJOFS_RX: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lRx); break;
+ case DIJOFS_RY: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lRy); break;
+ case DIJOFS_RZ: SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.lRz); break;
+ case DIJOFS_SLIDER(0): SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.rglSlider[0]); break;
+ case DIJOFS_SLIDER(1): SDL_PrivateJoystickAxis_Int(joystick, in->num, (Sint16)state.rglSlider[0]); break;
}
+
+ break;
+
+ case BUTTON:
+ SDL_PrivateJoystickButton_Int(joystick, in->num, (Uint8) (state.rgbButtons[in->ofs - DIJOFS_BUTTON0]?SDL_PRESSED:SDL_RELEASED));
+ break;
+ case HAT:
+ {
+ Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs - DIJOFS_POV(0)]);
+ SDL_PrivateJoystickHat_Int(joystick, in->num, pos);
+ break;
+ }
}
}
+}
+
+void SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick *joystick)
+{
+ int i;
+ HRESULT result;
+ DWORD numevents;
+ DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE];
+
+ numevents = INPUT_QSIZE;
+ result = IDirectInputDevice2_GetDeviceData(
+ joystick->hwdata->InputDevice, sizeof(DIDEVICEOBJECTDATA),
+ evtbuf, &numevents, 0);
+ if ( result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED ) {
+ IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
+ result = IDirectInputDevice2_GetDeviceData(
+ joystick->hwdata->InputDevice, sizeof(DIDEVICEOBJECTDATA),
+ evtbuf, &numevents, 0);
+ }
+
+ /* Handle the events */
+ if ( result != DI_OK )
+ return;
+
+ for(i = 0; i < (int) numevents; ++i)
+ {
+ int j;
+
+ for(j = 0; j < joystick->hwdata->NumInputs; ++j)
+ {
+ const input_t *in = &joystick->hwdata->Inputs[j];
- /* joystick button events */
- if ( joyinfo.dwFlags & JOY_RETURNBUTTONS ) {
- for ( i = 0; i < joystick->nbuttons; ++i ) {
- if ( joyinfo.dwButtons & JOY_BUTTON_FLAG(i) ) {
- if ( ! joystick->buttons[i] ) {
- SDL_PrivateJoystickButton(joystick, (Uint8)i, SDL_PRESSED);
- }
- } else {
- if ( joystick->buttons[i] ) {
- SDL_PrivateJoystickButton(joystick, (Uint8)i, SDL_RELEASED);
- }
+ if(evtbuf[i].dwOfs != in->ofs)
+ continue;
+
+ switch(in->type)
+ {
+ case AXIS:
+ SDL_PrivateJoystickAxis(joystick, in->num, (Sint16)evtbuf[i].dwData);
+ break;
+ case BUTTON:
+ SDL_PrivateJoystickButton(joystick, in->num, (Uint8) (evtbuf[i].dwData?SDL_PRESSED:SDL_RELEASED));
+ break;
+ case HAT:
+ {
+ Uint8 pos = TranslatePOV(evtbuf[i].dwData);
+ SDL_PrivateJoystickHat(joystick, in->num, pos);
+ }
}
}
}
+}
- /* joystick hat events */
- if ( joyinfo.dwFlags & JOY_RETURNPOV ) {
- Uint8 pos;
-
- pos = TranslatePOV(joyinfo.dwPOV);
- if ( pos != joystick->hats[0] ) {
- SDL_PrivateJoystickHat(joystick, 0, pos);
- }
+void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
+{
+ HRESULT result;
+
+ result = IDirectInputDevice2_Poll(joystick->hwdata->InputDevice);
+ if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) {
+ IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice2_Poll(joystick->hwdata->InputDevice);
}
+
+ if(joystick->hwdata->buffered)
+ SDL_SYS_JoystickUpdate_Buffered(joystick);
+ else
+ SDL_SYS_JoystickUpdate_Polled(joystick);
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
+ IDirectInputDevice2_Unacquire(joystick->hwdata->InputDevice);
+ IDirectInputDevice2_Release(joystick->hwdata->InputDevice);
+
if (joystick->hwdata != NULL) {
/* free system specific hardware data */
free(joystick->hwdata);
@@ -292,48 +511,6 @@
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
- return;
-}
-
-
-/* implementation functions */
-void SetMMerror(char *function, int code)
-{
- static char *error;
- static char errbuf[BUFSIZ];
-
- errbuf[0] = 0;
- switch (code)
- {
- case MMSYSERR_NODRIVER:
- error = "Joystick driver not present";
- break;
-
- case MMSYSERR_INVALPARAM:
- case JOYERR_PARMS:
- error = "Invalid parameter(s)";
- break;
-
- case MMSYSERR_BADDEVICEID:
- error = "Bad device ID";
- break;
-
- case JOYERR_UNPLUGGED:
- error = "Joystick not attached";
- break;
-
- case JOYERR_NOCANDO:
- error = "Can't capture joystick input";
- break;
-
- default:
- sprintf(errbuf, "%s: Unknown Multimedia system error: 0x%x",
- function, code);
- break;
- }
-
- if ( ! errbuf[0] ) {
- sprintf(errbuf, "%s: %s", function, error);
- }
- SDL_SetError("%s", errbuf);
+ IDirectInput_Release(dinput);
+ dinput = NULL;
}

Binary file not shown.

View File

@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stella", "Stella.vcproj", "{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Debug.ActiveCfg = Debug|Win32
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Debug.Build.0 = Debug|Win32
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Release.ActiveCfg = Release|Win32
{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@ -1,487 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Stella"
ProjectGUID="{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
RootNamespace="Stella"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\emucore\m6502\src\bspf\src;..\..\emucore\m6502\src;..\..\emucore;..\..\common;..\..\win32"
PreprocessorDefinitions="BSPF_WIN32;WIN32;_DEBUG;JOYSTICK_SUPPORT;DEVELOPER_SUPPORT;SNAPSHOT_SUPPORT;DISPLAY_OPENGL;TEXTURES_ARE_LOST"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="2"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="SDL.lib
SDLmain.lib
libpng.lib
opengl32.lib"
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib opengl32.lib"
OutputFile="$(OutDir)/Stella.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Stella.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\emucore\m6502\src\bspf\src;..\..\emucore\m6502\src;..\..\emucore;..\..\common;..\..\win32"
PreprocessorDefinitions="BSPF_WIN32;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEVELOPER_SUPPORT;SNAPSHOT_SUPPORT;DISPLAY_OPENGL;TEXTURES_ARE_LOST"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="2"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="SDL.lib
SDLmain.lib
libpng.lib
opengl32.lib"
AdditionalDependencies="sdl.lib sdlmain.lib libpng.lib opengl32.lib"
OutputFile="$(OutDir)/Stella.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\emucore\Booster.cxx">
</File>
<File
RelativePath="..\..\emucore\Cart.cxx">
</File>
<File
RelativePath="..\..\emucore\Cart2K.cxx">
</File>
<File
RelativePath="..\..\emucore\Cart3F.cxx">
</File>
<File
RelativePath="..\..\emucore\Cart4K.cxx">
</File>
<File
RelativePath="..\..\emucore\CartAR.cxx">
</File>
<File
RelativePath="..\..\emucore\CartCV.cxx">
</File>
<File
RelativePath="..\..\emucore\CartDPC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartE0.cxx">
</File>
<File
RelativePath="..\..\emucore\CartE7.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF4.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF4SC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF6.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF6SC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF8.cxx">
</File>
<File
RelativePath="..\..\emucore\CartF8SC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartFASC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartFE.cxx">
</File>
<File
RelativePath="..\..\emucore\CartMB.cxx">
</File>
<File
RelativePath="..\..\emucore\CartMC.cxx">
</File>
<File
RelativePath="..\..\emucore\CartUA.cxx">
</File>
<File
RelativePath="..\..\emucore\Console.cxx">
</File>
<File
RelativePath="..\..\emucore\Control.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\D6502.cxx">
</File>
<File
RelativePath="..\..\emucore\Deserializer.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\Device.cxx">
</File>
<File
RelativePath="..\..\emucore\Driving.cxx">
</File>
<File
RelativePath="..\..\emucore\Event.cxx">
</File>
<File
RelativePath="..\..\emucore\EventHandler.cxx">
</File>
<File
RelativePath="..\..\emucore\FrameBuffer.cxx">
</File>
<File
RelativePath="..\..\common\FrameBufferGL.cxx">
</File>
<File
RelativePath="..\..\common\FrameBufferSDL.cxx">
</File>
<File
RelativePath="..\..\common\FrameBufferSoft.cxx">
</File>
<File
RelativePath="..\..\emucore\Joystick.cxx">
</File>
<File
RelativePath="..\..\emucore\Keyboard.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502Hi.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502Low.cxx">
</File>
<File
RelativePath="..\..\emucore\M6532.cxx">
</File>
<File
RelativePath="..\..\common\mainSDL.cxx">
</File>
<File
RelativePath="..\..\emucore\MD5.cxx">
</File>
<File
RelativePath="..\..\emucore\MediaSrc.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\NullDev.cxx">
</File>
<File
RelativePath="..\..\emucore\Paddles.cxx">
</File>
<File
RelativePath="..\..\emucore\Props.cxx">
</File>
<File
RelativePath="..\..\emucore\PropsSet.cxx">
</File>
<File
RelativePath="..\..\emucore\Random.cxx">
</File>
<File
RelativePath="..\..\emucore\Serializer.cxx">
</File>
<File
RelativePath="..\..\emucore\Settings.cxx">
</File>
<File
RelativePath="..\..\win32\SettingsWin32.cxx">
</File>
<File
RelativePath="..\..\common\Snapshot.cxx">
</File>
<File
RelativePath="..\..\emucore\Sound.cxx">
</File>
<File
RelativePath="..\..\common\SoundSDL.cxx">
</File>
<File
RelativePath="..\..\emucore\Switches.cxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\System.cxx">
</File>
<File
RelativePath="..\..\emucore\TIA.cxx">
</File>
<File
RelativePath="..\..\emucore\TIASound.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\..\emucore\Booster.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\bspf\src\bspf.hxx">
</File>
<File
RelativePath="..\..\emucore\Cart.hxx">
</File>
<File
RelativePath="..\..\emucore\Cart2K.hxx">
</File>
<File
RelativePath="..\..\emucore\Cart3F.hxx">
</File>
<File
RelativePath="..\..\emucore\Cart4K.hxx">
</File>
<File
RelativePath="..\..\emucore\CartAR.hxx">
</File>
<File
RelativePath="..\..\emucore\CartCV.hxx">
</File>
<File
RelativePath="..\..\emucore\CartDPC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartE0.hxx">
</File>
<File
RelativePath="..\..\emucore\CartE7.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF4.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF4SC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF6.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF6SC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF8.hxx">
</File>
<File
RelativePath="..\..\emucore\CartF8SC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartFASC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartFE.hxx">
</File>
<File
RelativePath="..\..\emucore\CartMB.hxx">
</File>
<File
RelativePath="..\..\emucore\CartMC.hxx">
</File>
<File
RelativePath="..\..\emucore\CartUA.hxx">
</File>
<File
RelativePath="..\..\emucore\Console.hxx">
</File>
<File
RelativePath="..\..\emucore\Control.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\D6502.hxx">
</File>
<File
RelativePath="..\..\emucore\Deserializer.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\Device.hxx">
</File>
<File
RelativePath="..\..\emucore\Driving.hxx">
</File>
<File
RelativePath="..\..\emucore\Event.hxx">
</File>
<File
RelativePath="..\..\emucore\EventHandler.hxx">
</File>
<File
RelativePath="..\..\emucore\FrameBuffer.hxx">
</File>
<File
RelativePath="..\..\common\FrameBufferGL.hxx">
</File>
<File
RelativePath="..\..\common\FrameBufferSDL.hxx">
</File>
<File
RelativePath="..\..\common\FrameBufferSoft.hxx">
</File>
<File
RelativePath="..\..\emucore\Joystick.hxx">
</File>
<File
RelativePath="..\..\emucore\Keyboard.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502Hi.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\M6502Low.hxx">
</File>
<File
RelativePath="..\..\emucore\M6532.hxx">
</File>
<File
RelativePath="..\..\emucore\MD5.hxx">
</File>
<File
RelativePath="..\..\emucore\MediaSrc.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\NullDev.hxx">
</File>
<File
RelativePath="..\..\emucore\Paddles.hxx">
</File>
<File
RelativePath="..\..\emucore\Props.hxx">
</File>
<File
RelativePath="..\..\emucore\PropsSet.hxx">
</File>
<File
RelativePath="..\..\emucore\Random.hxx">
</File>
<File
RelativePath="..\..\emucore\Serializer.hxx">
</File>
<File
RelativePath="..\..\emucore\Settings.hxx">
</File>
<File
RelativePath="..\..\win32\SettingsWin32.hxx">
</File>
<File
RelativePath="..\..\common\Snapshot.hxx">
</File>
<File
RelativePath="..\..\emucore\Sound.hxx">
</File>
<File
RelativePath="..\..\common\SoundSDL.hxx">
</File>
<File
RelativePath="..\..\emucore\StellaEvent.hxx">
</File>
<File
RelativePath="..\..\emucore\Switches.hxx">
</File>
<File
RelativePath="..\..\emucore\m6502\src\System.hxx">
</File>
<File
RelativePath="..\..\emucore\TIA.hxx">
</File>
<File
RelativePath="..\..\emucore\TIASound.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,47 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.cxx,v 1.2 2004-07-15 03:03:26 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "AboutPage.hxx"
#include "resource.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHelpPage::CHelpPage()
: CPropertyPage(IDD_ABOUT_PAGE)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHelpPage::OnInitDialog( HWND hwnd )
{
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
m_hlMail_JSM.SetURL( _T("mailto:sa666_666@hotmail.com?Subject=StellaX") );
m_hlWWW_JSM.SubclassDlgItem( hwnd, IDC_WEB_MAINTAINER );
m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
m_hlMail_Stella.SubclassDlgItem( hwnd, IDC_EMAIL_STELLA );
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA );
m_hlWWW_Stella.SetURL( _T("http://stella.sf.net") );
// return FALSE if SetFocus is called
return TRUE;
}

View File

@ -1,44 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef ABOUT_PAGE_HXX
#define ABOUT_PAGE_HXX
#include "PropertySheet.hxx"
#include "HyperLink.hxx"
class CHelpPage : public CPropertyPage
{
public:
CHelpPage();
protected:
virtual BOOL OnInitDialog( HWND hwnd );
private:
CHyperLink m_hlMail_JSM;
CHyperLink m_hlWWW_JSM;
CHyperLink m_hlMail_Stella;
CHyperLink m_hlWWW_Stella;
CHelpPage( const CHelpPage& ); // no implementation
void operator=( const CHelpPage& ); // no implementation
};
#endif

View File

@ -1,121 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1998 Scott D. Killen
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowseForFolder.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "BrowseForFolder.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CBrowseForFolder::CBrowseForFolder(
const HWND hParent,
const LPITEMIDLIST pidl,
LPCTSTR strTitle)
{
myHwnd = NULL;
myBrowseInfo.pidlRoot = pidl;
myBrowseInfo.hwndOwner = NULL;
myBrowseInfo.pszDisplayName = mySelected;
myBrowseInfo.lpszTitle = strTitle;
myBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS|BIF_RETURNFSANCESTORS;
myBrowseInfo.lParam = reinterpret_cast<LPARAM>( this );
myBrowseInfo.lpfn = BrowseCallbackProc;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CBrowseForFolder::~CBrowseForFolder()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR CBrowseForFolder::GetSelectedFolder() const
{
return mySelected;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CBrowseForFolder::SelectFolder()
{
bool bRet = false;
LPITEMIDLIST pidl;
if ((pidl = SHBrowseForFolder(&myBrowseInfo)) != NULL)
{
if (SUCCEEDED(SHGetPathFromIDList(pidl, mySelected)))
bRet = true;
LPMALLOC pMalloc;
//Retrieve a pointer to the shell's IMalloc interface
if (SUCCEEDED(SHGetMalloc(&pMalloc)))
{
// free the PIDL that SHBrowseForFolder returned to us.
pMalloc->Free(pidl);
// release the shell's IMalloc interface
(void)pMalloc->Release();
}
}
myHwnd = NULL;
return bRet;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
{
(void)pidl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::EnableOK(const bool bEnable) const
{
if (myHwnd == NULL)
return;
// (void)SendMessage(myHwnd, BFFM_ENABLEOK, static_cast(bEnable), NULL);
(void)SendMessage( myHwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
{
if (myHwnd == NULL)
return;
(void)SendMessage(myHwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CBrowseForFolder::SetSelection(LPCTSTR strPath) const
{
if (myHwnd == NULL)
return;
(void)SendMessage(myHwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );
pbff->myHwnd = hwnd;
if (uMsg == BFFM_SELCHANGED)
pbff->OnSelChanged( reinterpret_cast<LPITEMIDLIST>( lParam ));
return 0;
}

View File

@ -1,74 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowseForFolder.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef BROWSE_FOR_FOLDER_HXX
#define BROWSE_FOR_FOLDER_HXX
#include <shlobj.h>
class CBrowseForFolder
{
public:
CBrowseForFolder(const HWND hParent = NULL,
const LPITEMIDLIST pidl = NULL,
LPCTSTR strTitle = NULL );
virtual ~CBrowseForFolder();
public:
// Call GetSelectedFolder to retrieve the folder selected by the user.
LPCTSTR GetSelectedFolder() const;
// Call SelectFolder to display the dialog and get a selection from the user. Use
// GetSelectedFolder and GetImage to get the results of the dialog.
bool SelectFolder();
protected:
// OnSelChanged is called whenever the user selects a different directory. pidl is
// the LPITEMIDLIST of the new selection. Use SHGetPathFromIDList to retrieve the
// path of the selection.
virtual void OnSelChanged(const LPITEMIDLIST pidl) const;
// Call EnableOK to enable the OK button on the active dialog. If bEnable is true
// then the button is enabled, otherwise it is disabled.
// NOTE -- This function should only be called within overrides of OnInit and
// OnSelChanged.
void EnableOK(const bool bEnable) const;
// Call SetSelection to set the selection in the active dialog. pidl is the
// LPITEMIDLIST
// of the path to be selected. strPath is a CString containing the path to be
// selected.
// NOTE -- This function should only be called within overrides of OnInit and
// OnSelChanged.
void SetSelection(const LPITEMIDLIST pidl) const;
void SetSelection(LPCTSTR strPath) const;
private:
static int __stdcall BrowseCallbackProc(HWND hwnd,
UINT uMsg,
LPARAM lParam,
LPARAM lpData);
BROWSEINFO myBrowseInfo;
char mySelected[MAX_PATH];
HWND myHwnd;
};
#endif

View File

@ -1,260 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "ConfigPage.hxx"
#include "resource.h"
#include "BrowseForFolder.hxx"
#include "bspf.hxx"
#include "Settings.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
: myGlobalData( rGlobalData ),
CPropertyPage( IDD_CONFIG_PAGE )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CConfigPage::OnInitDialog( HWND hwnd )
{
m_hwnd = hwnd;
HWND hwndCtrl;
// Reload settings just in case the emulation changed them
myGlobalData.settings().loadConfig();
// Get romdir
hwndCtrl = GetDlgItem( hwnd, IDC_ROMPATH );
SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
SetWindowText( hwndCtrl, myGlobalData.settings().getString("romdir").c_str() );
// Get ssname
int ssname = 0;
hwndCtrl = GetDlgItem( hwnd, IDC_SNAPSHOT_TYPE );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"ROM Name" );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"ROM MD5" );
if(myGlobalData.settings().getString("ssname") == "romname")
ssname = 0;
else if(myGlobalData.settings().getString("ssname") == "md5sum")
ssname = 1;
SendMessage( hwndCtrl, CB_SETCURSEL, ssname, 0 );
// Get sssingle
hwndCtrl = GetDlgItem( hwnd, IDC_SNAPSHOT_MULTIPLE );
SendMessage( hwndCtrl, BM_SETCHECK,
myGlobalData.settings().getBool("sssingle")
? BST_UNCHECKED : BST_CHECKED, 0 );
// Get paddle
hwndCtrl = GetDlgItem( hwnd, IDC_PADDLE );
TCHAR psz[4] = _T("0");
TCHAR i;
for ( i = 0; i < 4; ++i )
{
psz[0] = _T('0') + i;
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
}
SendMessage( hwndCtrl, CB_SETCURSEL, myGlobalData.settings().getInt("paddle"), 0 );
// Get video
int videomode = 0;
hwndCtrl = GetDlgItem( hwnd, IDC_VIDEO );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"Software" );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"OpenGL" );
if(myGlobalData.settings().getString("video") == "soft")
videomode = 0;
else if(myGlobalData.settings().getString("video") == "gl")
videomode = 1;
SendMessage( hwndCtrl, CB_SETCURSEL, videomode, 0 );
// Get gl_aspect
hwndCtrl = GetDlgItem( hwnd, IDC_GL_ASPECT );
SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
SetWindowText( hwndCtrl, myGlobalData.settings().getString("gl_aspect").c_str() );
// Get gl_fsmax
hwndCtrl = GetDlgItem( hwnd, IDC_GL_FSMAX );
SendMessage( hwndCtrl, BM_SETCHECK,
myGlobalData.settings().getBool("gl_fsmax")
? BST_CHECKED : BST_UNCHECKED, 0 );
// Get volume
// hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_VOLUME_SPIN );
// CSpinButtonCtrl spin = (CSpinButtonCtrl) hwndCtrl;
hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_VOLUME );
SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
SetWindowText( hwndCtrl, myGlobalData.settings().getString("volume").c_str() );
// Get fragsize
int fragindex = 2, fragsize = 2048;
hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_FRAGSIZE );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"512" );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"1024" );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"2048" );
SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"4096" );
fragsize = myGlobalData.settings().getInt("fragsize");
if(fragsize == 512)
fragindex = 0;
else if(fragsize == 1024)
fragindex = 1;
else if(fragsize == 2048)
fragindex = 2;
else if(fragsize == 4096)
fragindex = 3;
SendMessage( hwndCtrl, CB_SETCURSEL, fragindex, 0 );
// Get sound
hwndCtrl = GetDlgItem( hwnd, IDC_SOUND_ENABLE );
SendMessage( hwndCtrl, BM_SETCHECK,
myGlobalData.settings().getBool("sound")
? BST_UNCHECKED : BST_CHECKED, 0 );
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CConfigPage::OnDestroy( void )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
{
UNUSED_ALWAYS( lppsn );
HWND hwndCtrl;
TCHAR buffer[ MAX_PATH ];
string str;
int i;
bool b;
// Set romdir
hwndCtrl = GetDlgItem( m_hwnd, IDC_ROMPATH );
ASSERT( hwndCtrl );
GetWindowText( hwndCtrl, buffer, MAX_PATH );
myGlobalData.settings().setString( "romdir", buffer );
// Set ssname
hwndCtrl = GetDlgItem( m_hwnd, IDC_SNAPSHOT_TYPE );
ASSERT( hwndCtrl );
i = SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
if( i == 0 )
str = "romname";
else if( i == 1 )
str = "md5sum";
else
str = "romname";
myGlobalData.settings().setString( "ssname", str );
// Set sssingle
hwndCtrl = GetDlgItem( m_hwnd, IDC_SNAPSHOT_MULTIPLE );
ASSERT( hwndCtrl );
if( SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
b = false;
else
b = true;
myGlobalData.settings().setBool( "sssingle", b );
// Set paddle
hwndCtrl = GetDlgItem( m_hwnd, IDC_PADDLE );
ASSERT( hwndCtrl );
myGlobalData.settings().setInt( "paddle",
SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ) );
// Set video
hwndCtrl = GetDlgItem( m_hwnd, IDC_VIDEO );
ASSERT( hwndCtrl );
i = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
if( i == 0 )
str = "soft";
else if( i == 1 )
str = "gl";
else
str = "soft";
myGlobalData.settings().setString( "video", str );
// Set gl_aspect
hwndCtrl = GetDlgItem( m_hwnd, IDC_GL_ASPECT );
ASSERT( hwndCtrl );
GetWindowText( hwndCtrl, buffer, MAX_PATH );
myGlobalData.settings().setString( "gl_aspect", buffer );
// Set gl_fsmax
hwndCtrl = GetDlgItem( m_hwnd, IDC_GL_FSMAX );
ASSERT( hwndCtrl );
if( SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
b = true;
else
b = false;
myGlobalData.settings().setBool( "gl_fsmax", b );
// Set volume
hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_VOLUME );
ASSERT( hwndCtrl );
GetWindowText( hwndCtrl, buffer, MAX_PATH );
myGlobalData.settings().setString( "volume", buffer );
// Set fragsize
hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_FRAGSIZE );
ASSERT( hwndCtrl );
i = SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
if( i == 0 )
str = "512";
else if( i == 1 )
str = "1024";
else if( i == 2 )
str = "2048";
else if( i == 3 )
str = "4096";
else
str = "2048";
myGlobalData.settings().setString( "fragsize", str );
// Set sound
hwndCtrl = GetDlgItem( m_hwnd, IDC_SOUND_ENABLE );
ASSERT( hwndCtrl );
if( SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
b = false;
else
b = true;
myGlobalData.settings().setBool( "sound", b );
// Finally, save the config file
myGlobalData.settings().saveConfig();
return PSNRET_NOERROR;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
{
UNUSED_ALWAYS( wNotifyCode );
UNUSED_ALWAYS( hwndCtl );
if ( wID == IDC_BROWSE )
{
CBrowseForFolder bff( m_hwnd, NULL, "Open ROM Folder " );
if ( bff.SelectFolder() )
SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
}
return FALSE;
}

View File

@ -1,46 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef CONFIG_PAGE_HXX
#define CONFIG_PAGE_HXX
#include "PropertySheet.hxx"
#include "GlobalData.hxx"
class CConfigPage : public CPropertyPage
{
public:
CConfigPage( CGlobalData& rGlobalData );
protected:
virtual BOOL OnInitDialog( HWND hwnd );
virtual void OnDestroy();
virtual LONG OnApply( LPPSHNOTIFY lppsn );
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
private:
CGlobalData& myGlobalData;
HWND m_hwnd;
CConfigPage( const CConfigPage& ); // no implementation
void operator=( const CConfigPage& ); // no implementation
};
#endif

View File

@ -1,249 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "CoolCaption.hxx"
// MAKE SURE STYLE IS JUST "TITLE BAR" !
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CCoolCaption::CCoolCaption()
: m_hfont( NULL ),
m_tszCaption( NULL ),
m_fIsActive( FALSE ),
m_hDlg( NULL )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnInitDialog( HWND hDlg )
{
m_hDlg = hDlg;
CalculateNCArea();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnDestroy( void )
{
if ( m_hDlg == NULL )
return;
if ( m_hfont )
DeleteObject( m_hfont );
delete[] m_tszCaption;
m_tszCaption = NULL;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::CalculateNCArea()
{
if ( m_hDlg == NULL )
return;
GetWindowRect(m_hDlg, &m_rcWindow);
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
m_cxFrame = ::GetSystemMetrics(SM_CXFRAME);
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
// calculate position of buttons
SetRect(&m_rcClose,
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
m_rcCaption.top + m_cyFrame + 1,
m_cxWindow - m_cxFrame - 1,
m_rcCaption.bottom - m_cyFrame
);
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
// Make bold caption font
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(m_hfont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
m_hfont = CreateFontIndirect(&lf);
// Get caption text
int nCaptionLength = GetWindowTextLength(m_hDlg);
m_tszCaption = new TCHAR[nCaptionLength + 2];
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcPaint( HRGN hrgn )
{
UNUSED_ALWAYS( hrgn );
if ( m_hDlg == NULL )
return;
HDC hdc = GetWindowDC(m_hDlg);
// Fill in the NC area with the proper color
HPEN hpen, hpenOld;
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
GetSysColor(COLOR_ACTIVECAPTION) : \
GetSysColor(COLOR_INACTIVECAPTION));
hpenOld = (HPEN)SelectObject(hdc, hpen);
for (long x = 0; x < m_cxWindow; ++x)
{
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
{
// left, right must go from top to bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcWindow.bottom);
}
else
{
// otherwise just do top and bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcCaption.bottom);
MoveToEx(hdc, x, m_cyWindow-m_cyFrame, NULL);
LineTo(hdc, x, m_cyWindow);
}
}
SelectObject(hdc, hpenOld);
DeleteObject(hpen);
// Draw the close button
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
// draw the minimize button
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
// Draw the caption text
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
SetBkMode(hdc, TRANSPARENT);
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
// calculate width / height of text
SIZE sizeText;
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
DrawText(hdc, m_tszCaption, -1, &m_rcTextArea,
DT_END_ELLIPSIS | DT_EXTERNALLEADING |
DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
SelectObject(hdc, hfontOld);
// Draw the docking grippers
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
// right top
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
Draw3dRect(hdc, nTextRight+m_cxFrame, 8,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
// right bottom
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
ReleaseDC(m_hDlg, hdc);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::OnNcActivate( BOOL fActive )
{
if (m_hDlg == NULL)
return;
m_fIsActive = fActive;
// This fixes a problem where alt-tab wont repaint the NC area
RedrawWindow(m_hDlg, NULL, NULL,
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CCoolCaption::OnNCLButtonDown( INT nHitTest, POINTS pts )
{
UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL )
return FALSE;
// Get the point in client units
RECT rcWindow;
GetWindowRect(m_hDlg, &rcWindow);
POINT pt = { pts.x, pts.y };
pt.x -= rcWindow.left;
pt.y -= rcWindow.top;
if (PtInRect(&m_rcClose, pt))
{
SendMessage(m_hDlg, WM_CLOSE, 0, 0);
return TRUE;
}
if (PtInRect(&m_rcMin, pt))
{
ShowWindow(m_hDlg, SW_MINIMIZE);
return TRUE;
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::FillSolidRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clr )
{
COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy };
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(hdc, cr);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CCoolCaption::Draw3dRect( HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight )
{
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
}

View File

@ -1,62 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CoolCaption.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef COOL_CAPTION_HXX
#define COOL_CAPTION_HXX
class CCoolCaption
{
public:
CCoolCaption();
void OnInitDialog(HWND hDlg);
void OnDestroy();
void OnNcPaint(HRGN);
void OnNcActivate(BOOL);
BOOL OnNCLButtonDown(INT, POINTS);
protected:
HWND m_hDlg;
private:
void CalculateNCArea(void);
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight);
BOOL m_fIsActive;
RECT m_rcWindow;
int m_cxWindow;
int m_cyWindow;
int m_cxFrame;
int m_cyFrame;
int m_cxButtonSize;
RECT m_rcClose;
RECT m_rcMin;
RECT m_rcCaption;
RECT m_rcTextArea;
HFONT m_hfont;
LPTSTR m_tszCaption;
CCoolCaption( const CCoolCaption& ); // no implementation
void operator=( const CCoolCaption& ); // no implementation
};
#endif

View File

@ -1,69 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "FileDialog.hxx"
CFileDialog::CFileDialog(
BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
LPCTSTR lpszDefExt /* = NULL */,
LPCTSTR lpszFileName /* = NULL */,
DWORD dwFlags /* = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT */,
LPCTSTR lpszFilter /* = NULL */,
HWND hwndParent /* = NULL */
)
{
UNUSED_ALWAYS( hwndParent );
memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL
m_szFileName[0] = '\0';
m_szFileTitle[0] = '\0';
m_bOpenFileDialog = bOpenFileDialog;
m_ofn.lStructSize = sizeof(m_ofn);
m_ofn.lpstrFile = m_szFileName;
m_ofn.nMaxFile = _countof(m_szFileName);
m_ofn.lpstrDefExt = lpszDefExt;
m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle;
m_ofn.nMaxFileTitle = _countof(m_szFileTitle);
m_ofn.Flags = (dwFlags | OFN_EXPLORER);
m_ofn.hInstance = NULL;
// setup initial file name
if (lpszFileName != NULL)
lstrcpyn(m_szFileName, lpszFileName, _countof(m_szFileName));
// Translate filter into commdlg format (lots of \0)
if (lpszFilter != NULL)
{
lstrcpy(m_szFilter, lpszFilter);
LPTSTR pch = m_szFilter; // modify the buffer in place
// MFC delimits with '|' not '\0'
while ((pch = _tcschr(pch, '|')) != NULL)
*pch++ = '\0';
m_ofn.lpstrFilter = m_szFilter;
// do not call ReleaseBuffer() since the string contains '\0' characters
}
}
int CFileDialog::DoModal(
void
)
{
int nResult;
if (m_bOpenFileDialog)
{
nResult = ::GetOpenFileName(&m_ofn);
}
else
{
nResult = ::GetSaveFileName(&m_ofn);
}
return nResult ? nResult : IDCANCEL;
}

View File

@ -1,51 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef FILEDLG_H
#define FILEDLG_H
#pragma once
class CFileDialog
{
public:
OPENFILENAME m_ofn;
CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
HWND hwndParent = NULL);
virtual int DoModal();
LPCTSTR GetPathName() const
{
return m_ofn.lpstrFile;
}
LPCTSTR GetFileName() const
{
return m_ofn.lpstrFileTitle;
}
protected:
BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save
TCHAR m_szFilter[1024]; // filter string
// separate fields with '|', terminate with '||\0'
TCHAR m_szFileTitle[64]; // contains file title after return
TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return
private:
CFileDialog( const CFileDialog& ); // no implementation
void operator=( const CFileDialog& ); // no implementation
};
#endif

View File

@ -1,37 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Game.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "Game.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::Game( void )
{
_available = false;
_rom = " ";
_md5 = " ";
_name = " ";
_rarity = " ";
_manufacturer = " ";
_note = " ";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Game::~Game( void )
{
}

View File

@ -1,77 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Game.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef GAME_HXX
#define GAME_HXX
#include "bspf.hxx"
/** Hold game info for an Atari2600 game. */
class Game
{
public:
Game( void );
~Game( void );
/** sets the rom of a game */
void setAvailable( bool available ) { _available = available; }
/** returns the rom of a game */
bool isAvailable( void ) { return _available; }
/** sets the rom of a game */
void setRom( const string& rom ) { _rom = rom; };
/** returns the rom of a game */
string rom( void ) const { return _rom; }
/** sets the md5 sum of a game */
void setMd5( const string& md5 ) { _md5 = md5; };
/** returns the md5 sum of a game */
string md5( void ) const { return _md5; }
/** sets the name of a game */
void setName( const string& name ) { _name = name; }
/** returns the name of a game */
string name( void ) const { return _name; }
/** sets the rarity of a game */
void setRarity( const string& rarity ) { _rarity = rarity; }
/** returns the rarity of a game */
string rarity( void ) const { return _rarity; }
/** sets the manufacturer of a game */
void setManufacturer( const string& manufacturer) { _manufacturer = manufacturer; }
/** returns the manufacturer of a game */
string manufacturer( void ) const { return _manufacturer; }
/** sets the note of a game */
void setNote( const string& note ) { _note = note; }
/** returns the note of a game */
string note( void ) const { return _note; }
protected:
bool _available;
string _rom;
string _md5;
string _name;
string _rarity;
string _manufacturer;
string _note;
};
#endif

View File

@ -1,42 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.cxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "resource.h"
#include "bspf.hxx"
#include "Settings.hxx"
#include "SettingsWin32.hxx"
#include "GlobalData.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::CGlobalData( HINSTANCE hInstance )
: mySettings(0),
myInstance(hInstance)
{
mySettings = new SettingsWin32();
mySettings->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData::~CGlobalData()
{
if(mySettings)
delete mySettings;
}

View File

@ -1,56 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef GLOBAL_DATA_HXX
#define GLOBAL_DATA_HXX
#include "pch.hxx"
#include "bspf.hxx"
class CConfigPage;
class Settings;
class CGlobalData
{
friend CConfigPage;
public:
CGlobalData( HINSTANCE hInstance );
~CGlobalData( void );
HINSTANCE ModuleInstance( void ) const
{
return myInstance;
}
Settings& settings( void )
{
return *mySettings;
}
private:
Settings* mySettings;
HINSTANCE myInstance;
CGlobalData( const CGlobalData& ); // no implementation
void operator=( const CGlobalData& ); // no implementation
};
#endif

View File

@ -1,168 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HeaderCtrl.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "HeaderCtrl.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHeaderCtrl::CHeaderCtrl()
: m_nSortCol(0),
m_fSortAsc(TRUE)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHeaderCtrl::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch ( msg )
{
case WM_DRAWITEM:
rfHandled = TRUE;
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::SetSortCol( int nCol, BOOL bAsc )
{
m_nSortCol = nCol;
m_fSortAsc = bAsc;
// change this item to owner draw
HWND hwndHeader = ::GetDlgItem( *this, 0 );
HDITEM hdi;
hdi.mask = HDI_FORMAT;
Header_GetItem(hwndHeader, nCol, &hdi);
hdi.fmt |= HDF_OWNERDRAW;
Header_SetItem(hwndHeader, nCol, &hdi);
// repaint the header
InvalidateRect(hwndHeader, NULL, TRUE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHeaderCtrl::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
{
UNUSED_ALWAYS( idCtl );
HDC hdc = lpdis->hDC;
RECT rcLabel;
CopyRect( &rcLabel, &(lpdis->rcItem) );
/* save the DC */
int nSavedDC = ::SaveDC( hdc );
/* set clip region to column */
HRGN hrgn = ::CreateRectRgnIndirect( &rcLabel );
SelectObject( hdc, hrgn );
DeleteObject( hrgn );
/* draw the background */
FillRect( hdc, &rcLabel, ::GetSysColorBrush(COLOR_3DFACE) );
/* offset the label */
SIZE size;
GetTextExtentPoint32( hdc, _T(" "), 1, &size );
int nOffset = size.cx * 2;
/* get the column text and format */
TCHAR tszText[255 + 1];
HDITEM hdi;
hdi.mask = HDI_TEXT | HDI_FORMAT;
hdi.pszText = tszText;
hdi.cchTextMax = 255;
Header_GetItem( GetDlgItem(hwnd, 0), lpdis->itemID, &hdi );
/* determine format for drawing label */
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER | DT_END_ELLIPSIS;
/* determine justification */
if (hdi.fmt & HDF_CENTER)
uFormat |= DT_CENTER;
else if (hdi.fmt & HDF_RIGHT)
uFormat |= DT_RIGHT;
else
uFormat |= DT_LEFT;
/* adjust the rect if selected */
if (lpdis->itemState & ODS_SELECTED)
{
rcLabel.left++;
rcLabel.top += 2;
rcLabel.right++;
}
/* adjust rect for sort arrow */
if ( lpdis->itemID == m_nSortCol )
rcLabel.right -= (3 * nOffset);
rcLabel.left += nOffset;
rcLabel.right -= nOffset;
/* draw label */
if ( rcLabel.left < rcLabel.right )
DrawText(hdc, tszText, -1, &rcLabel, uFormat );
/* draw the arrow */
if ( lpdis->itemID == m_nSortCol )
{
RECT rcIcon;
HPEN hpenLight, hpenShadow, hpenOld;
CopyRect( &rcIcon, &(lpdis->rcItem) );
hpenLight = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) );
hpenShadow = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW) );
hpenOld = (HPEN)::SelectObject( hdc, hpenLight );
if (m_fSortAsc)
{
/* draw triangle pointing up */
MoveToEx( hdc, rcIcon.right - 2 * nOffset, nOffset - 1, NULL );
LineTo( hdc, rcIcon.right - 3 * nOffset / 2, rcIcon.bottom - nOffset );
LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 2, rcIcon.bottom - nOffset );
MoveToEx( hdc, rcIcon.right - 5 * nOffset / 2 - 1, rcIcon.bottom - nOffset, NULL );
SelectObject( hdc, hpenShadow );
LineTo( hdc, rcIcon.right - 2 * nOffset, nOffset - 2 );
}
else
{
/* draw triangle pointing down */
MoveToEx( hdc, rcIcon.right - 3 * nOffset / 2, nOffset - 1, NULL );
LineTo( hdc, rcIcon.right - 2 * nOffset - 1, rcIcon.bottom - nOffset );
LineTo( hdc, rcIcon.right - 2 * nOffset - 1, rcIcon.bottom - nOffset );
MoveToEx( hdc, rcIcon.right - 2 * nOffset - 1, rcIcon.bottom - nOffset, NULL );
SelectObject( hdc, hpenShadow );
LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 1, nOffset - 1 );
LineTo( hdc, rcIcon.right - 3 * nOffset / 2, nOffset - 1 );
}
SelectObject( hdc, hpenOld );
DeleteObject( hpenShadow );
DeleteObject( hpenLight );
}
RestoreDC( hdc, nSavedDC );
}

View File

@ -1,57 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HeaderCtrl.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef HEADER_CTRL_HXX
#define HEADER_CTRL_HXX
#include "Wnd.hxx"
class CHeaderCtrl : public CWnd
{
public:
CHeaderCtrl();
void SetSortCol(int col, BOOL fAscending);
int GetSortCol(void) const;
BOOL GetSortAsc(void) const;
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled);
private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
UINT m_nSortCol;
BOOL m_fSortAsc;
CHeaderCtrl( const CHeaderCtrl& ); // no implementation
void operator=( const CHeaderCtrl& ); // no implementation
};
inline int CHeaderCtrl::GetSortCol( void ) const
{
return m_nSortCol;
}
inline BOOL CHeaderCtrl::GetSortAsc( void ) const
{
return m_fSortAsc;
}
#endif

View File

@ -1,334 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "HyperLink.hxx"
#include <shellapi.h>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::CHyperLink()
: m_bOverControl(FALSE),
m_bVisited(FALSE),
m_hFont(NULL),
m_hLinkCursor(NULL)
{
m_crLinkColor = RGB( 0, 0, 238); // Blue
m_crVisitedColor = RGB( 85, 26, 139); // Purple
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
SetDefaultCursor();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHyperLink::~CHyperLink()
{
if (m_hFont)
{
DeleteObject( m_hFont );
m_hFont = NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::SetURL( LPCTSTR ctszURL )
{
if (ctszURL == NULL)
return;
lstrcpy(m_tszURL, ctszURL);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::PreSubclassWindow( HWND hwnd )
{
GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::WndProc( HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
case WM_PAINT:
rfHandled = TRUE;
return OnPaint(hwnd);
case WM_SETCURSOR:
rfHandled = TRUE;
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
case WM_LBUTTONUP:
rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
case WM_MOUSEMOVE:
rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam), HIWORD(lParam));
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnPaint( HWND hwnd )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, m_hFont);
if (m_bOverControl)
SetTextColor(hdc, m_crHoverColor);
else if (m_bVisited)
SetTextColor(hdc, m_crVisitedColor);
else
SetTextColor(hdc, m_crLinkColor);
SetBkMode( hdc, TRANSPARENT );
TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
EndPaint(hwnd, &ps);
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CHyperLink::OnSetCursor( HWND hwnd, WORD nHittest, WORD wMouseMsg )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest );
UNUSED_ALWAYS( wMouseMsg );
if (m_hLinkCursor)
{
SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnLButtonUp( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
UNUSED_ALWAYS( xPos );
UNUSED_ALWAYS( yPos );
int result = (int)GotoURL(m_tszURL, SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited)
{
MessageBeep(MB_ICONEXCLAMATION);
ReportError(result);
}
else
{
m_bVisited = TRUE;
InvalidateRect(hwnd, NULL, FALSE);
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CHyperLink::OnMouseMove( HWND hwnd, WPARAM fwKeys, WORD xPos, WORD yPos )
{
UNUSED_ALWAYS( fwKeys );
// call defwindowproc?
if (m_bOverControl)
{
RECT rc;
GetClientRect(hwnd, &rc);
POINT pt = { xPos, yPos };
if (!PtInRect(&rc, pt))
{
m_bOverControl = FALSE;
ReleaseCapture();
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
}
else
{
m_bOverControl = TRUE;
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
SetCapture(hwnd);
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
TCHAR tszWndDir[MAX_PATH + 1];
GetWindowsDirectory(tszWndDir, MAX_PATH);
lstrcat(tszWndDir, _T("\\winhlp32.exe"));
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(tszWndDir);
if (hModule)
{
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
}
FreeLibrary(hModule);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LONG CHyperLink::GetRegKey( HKEY key, LPCTSTR subkey, LPTSTR retdata )
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS)
{
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
lstrcpy(retdata,data);
RegCloseKey(hkey);
}
return retval;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CHyperLink::ReportError( int nError )
{
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
switch (nError)
{
case 0:
lstrcpy(tsz, _T("The operating system is out\nof memory or resources."));
break;
case SE_ERR_PNF:
lstrcpy(tsz, _T("The specified path was not found."));
break;
case SE_ERR_FNF:
lstrcpy(tsz, _T("The specified file was not found."));
break;
case ERROR_BAD_FORMAT:
lstrcpy(tsz, _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."));
break;
case SE_ERR_ACCESSDENIED:
lstrcpy(tsz, _T("The operating system denied\naccess to the specified file."));
break;
case SE_ERR_ASSOCINCOMPLETE:
lstrcpy(tsz,_T("The filename association is\nincomplete or invalid."));
break;
case SE_ERR_DDEBUSY:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."));
break;
case SE_ERR_DDEFAIL:
lstrcpy(tsz, _T("The DDE transaction failed."));
break;
case SE_ERR_DDETIMEOUT:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because the request timed out."));
break;
case SE_ERR_DLLNOTFOUND:
lstrcpy(tsz, _T("The specified dynamic-link library was not found."));
break;
case SE_ERR_NOASSOC:
lstrcpy(tsz, __T("There is no application associated\nwith the given filename extension."));
break;
case SE_ERR_OOM:
lstrcpy(tsz, _T("There was not enough memory to complete the operation."));
break;
case SE_ERR_SHARE:
lstrcpy(tsz, _T("A sharing violation occurred."));
break;
default:
wsprintf(tsz, _T("Unknown error %d occurred."), nError);
break;
}
TCHAR tszCaption[MAX_HYPERLINK_TEXT_LEN + 1];
lstrcpy(tszCaption, _T("Unable to open hyperlink"));
MessageBox(NULL, tsz, tszCaption, MB_ICONEXCLAMATION | MB_OK);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HINSTANCE CHyperLink::GotoURL( LPCTSTR url, int showcmd )
{
TCHAR key[MAX_PATH + MAX_PATH];
// First try ShellExecute()
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
// If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR)
{
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS)
{
lstrcat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
if (pos == NULL)
{ // No quotes found
pos = strstr(key, _T("%1")); // Check for %1, without quotes
if (pos == NULL) // No parameter at all...
pos = key+lstrlen(key)-1;
else
*pos = '\0'; // Remove the parameter
}
else
*pos = '\0'; // Remove the parameter
lstrcat(pos, _T(" "));
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key,showcmd);
}
}
}
return result;
}

View File

@ -1,76 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: HyperLink.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef HYPER_LINK_HXX
#define HYPER_LINK_HXX
#define MAX_HYPERLINK_TEXT_LEN 256
#define MAX_HYPERLINK_URL 256
#include "Wnd.hxx"
class CHyperLink : public CWnd
{
public:
CHyperLink();
~CHyperLink();
void SetURL(LPCTSTR ctszURL);
protected:
virtual void PreSubclassWindow(HWND hwnd);
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
void SetDefaultCursor();
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void ReportError(int nError);
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam);
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
LRESULT OnPaint(HWND hwnd);
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
// Stuff from the control
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
// link specific
COLORREF m_crLinkColor;
COLORREF m_crVisitedColor;
COLORREF m_crHoverColor;
BOOL m_bOverControl;
BOOL m_bVisited;
HCURSOR m_hLinkCursor;
TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
CHyperLink( const CHyperLink& ); // no implementation
void operator=( const CHyperLink& ); // no implementation
};
#endif

View File

@ -1,877 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainDlg.cxx,v 1.7 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "MainDlg.hxx"
#include "Game.hxx"
#include "GlobalData.hxx"
#include "PropertySheet.hxx"
#include "AboutPage.hxx"
#include "ConfigPage.hxx"
#include "resource.h"
#include "Settings.hxx"
#include "PropsSet.hxx"
#include "MD5.hxx"
#define BKGND_BITMAP_TOP 64
#define BKGND_BITMAP_BOTTOM 355
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MainDlg::MainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance )
: myGlobalData(rGlobalData),
myHInstance(hInstance)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MainDlg::~MainDlg( void )
{
// Just to be safe, make sure we don't have a memory leak
ListView_Clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int MainDlg::DoModal( HWND hwndParent )
{
return DialogBoxParam( myHInstance,
MAKEINTRESOURCE(IDD),
hwndParent,
StaticDialogFunc,
(LPARAM)this );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
MainDlg::StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
MainDlg* pDlg;
switch ( uMsg )
{
case WM_INITDIALOG:
pDlg = reinterpret_cast<MainDlg*>( lParam );
pDlg->myHwnd = hDlg;
(void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast<LONG>( pDlg ) );
break;
default:
pDlg = reinterpret_cast<MainDlg*>( ::GetWindowLong( hDlg, DWL_USER ) );
if ( pDlg == NULL )
return FALSE;
break;
}
return pDlg->DialogFunc( uMsg, wParam, lParam );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
BOOL b;
switch (uMsg)
{
case WM_COMMAND:
return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) );
case WM_CTLCOLORSTATIC:
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
if (b)
return b;
break;
case WM_ERASEBKGND:
if ( OnEraseBkgnd( (HDC)wParam ) )
return TRUE;
break;
case WM_INITDIALOG:
return OnInitDialog();
case WM_NOTIFY:
return OnNotify( (int)wParam, (LPNMHDR)lParam );
case WM_PALETTECHANGED:
TRACE( "WM_PALETTECHANGED from maindlg" );
return FALSE;
case WM_QUERYNEWPALETTE:
TRACE( "WM_QUERYNEWPALETTE from maindlg" );
return FALSE;
// Cool caption handlers
case WM_DESTROY:
OnDestroy();
break;
case WM_DRAWITEM:
// Forward this onto the control
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, wParam, lParam );
return TRUE;
case WM_NCPAINT:
// DefWindowProc(hDlg, uMsg, wParam, lParam);
OnNcPaint( (HRGN)wParam );
return TRUE;
case WM_NCACTIVATE:
OnNcActivate( (BOOL)wParam );
// When the fActive parameter is FALSE, an application should return
// TRUE to indicate that the system should proceed with the default
// processing
SetWindowLong( myHwnd, DWL_MSGRESULT, TRUE );
return TRUE;
case WM_NCLBUTTONDOWN:
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
case WM_CLOSE:
Quit();
break;
}
// Message not handled
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnInitDialog( void )
{
DWORD dwRet;
HWND hwnd = *this;
// Set dialog icon
HICON hicon = ::LoadIcon(myHInstance, MAKEINTRESOURCE(IDI_APP));
::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon );
::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon );
// Make the Rom note have bold text
HWND hwndCtrl;
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE );
HFONT hfont = (HFONT)::SendMessage( hwndCtrl, WM_GETFONT, 0, 0 );
LOGFONT lf;
::GetObject( hfont, sizeof(LOGFONT), &lf );
lf.lfWeight = FW_BOLD;
m_hfontRomNote = ::CreateFontIndirect( &lf );
if ( m_hfontRomNote )
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
// Do subclassing
myCoolCaption.OnInitDialog( hwnd );
myHeader.SubclassDlgItem( hwnd, IDC_ROMLIST );
myAppTitle.SubclassDlgItem( hwnd, IDC_TITLE );
myPlayButton.SubclassDlgItem( hwnd, IDC_PLAY );
myReloadButton.SubclassDlgItem( hwnd, IDC_RELOAD );
myHelpButton.SubclassDlgItem( hwnd, IDC_ABOUT );
myConfigButton.SubclassDlgItem( hwnd, IDC_CONFIG );
myExitButton.SubclassDlgItem( hwnd, IDC_EXIT );
const int nMaxString = 256;
TCHAR psz[nMaxString + 1];
// Initialize the list view
myHwndList = ::GetDlgItem( hwnd, IDC_ROMLIST );
ASSERT( myHwndList );
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
::SendMessage( myHwndList, LVM_SETEXTENDEDLISTVIEWSTYLE,
0, LVS_EX_FULLROWSELECT );
RECT rc;
::GetClientRect( myHwndList, &rc );
// Declare the column headings
int columnHeader[] = { IDS_NAME, IDS_MANUFACTURER, IDS_RARITY };
// Set the column widths
int columnWidth[3];
columnWidth[0] = myGlobalData.settings().getInt("namecolwidth");
columnWidth[1] = myGlobalData.settings().getInt("manufacturercolwidth");
columnWidth[2] = myGlobalData.settings().getInt("raritycolwidth");
// Make sure there are sane values for the column widths
if (columnWidth[0] <= 0 || columnWidth[1] <= 0 || columnWidth[2] <= 0)
{
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
columnWidth[0] = (int) (0.58 * lTotalWidth);
columnWidth[1] = (int) (0.25 * lTotalWidth);
columnWidth[2] = lTotalWidth - columnWidth[0] - columnWidth[1];
}
// Set up the column headings
for (int i = 0; i < 3; ++i)
{
LoadString( myHInstance, columnHeader[i], psz, nMaxString );
LV_COLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = columnWidth[i];
lvc.pszText = psz;
ListView_InsertColumn( myHwndList, i, &lvc );
}
// Update the ROM game list
UpdateRomList();
// Set default button
SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
// return FALSE if SetFocus is called
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
{
UNUSED_ALWAYS( hwndCtl );
UNUSED_ALWAYS( codeNotify );
HWND hwnd = *this;
Game* g;
string romfile;
int nItem;
switch (id)
{
case IDC_PLAY:
nItem = (int)::SendMessage( myHwndList, LVM_GETNEXTITEM,
(WPARAM)-1, MAKELPARAM( LVNI_SELECTED, 0 ) );
ASSERT( nItem != -1 );
if ( nItem == -1 )
{
MessageBox( myHInstance, hwnd, IDS_NO_ITEM_SELECTED );
return TRUE;
}
g = (Game*) ListView_GetItemData( myHwndList, nItem );
romfile = myGlobalData.settings().getString("romdir") + "\\" + g->rom();
(void)m_stella.PlayROM( romfile, myGlobalData );
// Set focus back to the rom list
SetFocus( myHwndList );
return TRUE;
break; // case IDC_PLAY
case IDC_EXIT:
Quit();
return TRUE;
break; // case IDC_EXIT
case IDC_CONFIG:
{
CPropertySheet ps( _T("Configure"), hwnd );
CConfigPage pgConfig( myGlobalData );
ps.AddPage( &pgConfig );
(void)ps.DoModal();
return TRUE;
break; // case IDC_CONFIG
}
case IDC_ABOUT:
{
CPropertySheet ps(_T("Help"), hwnd);
CHelpPage pgAbout;
ps.AddPage(&pgAbout);
ps.DoModal();
return TRUE;
break; // case IDC_ABOUT
}
case IDC_RELOAD:
{
UpdateRomList( true );
return TRUE;
break; // case IDC_RELOAD
}
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnNotify( int idCtrl, LPNMHDR pnmh )
{
UNUSED_ALWAYS( idCtrl );
switch ( pnmh->code )
{
case LVN_ITEMCHANGED:
OnItemChanged( (LPNMLISTVIEW)pnmh );
return TRUE;
case LVN_COLUMNCLICK:
OnColumnClick( (LPNMLISTVIEW)pnmh );
return TRUE;
case NM_DBLCLK:
// send out an ok click to play
SendDlgItemMessage( *this, IDC_PLAY, BM_CLICK, 0, 0 );
return TRUE;
}
// not handled
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnItemChanged( LPNMLISTVIEW pnmv )
{
HWND hwnd = *this;
HWND hwndNote = ::GetDlgItem( hwnd, IDC_ROMNOTE );
RECT rc;
GetWindowRect(hwndNote, &rc);
ScreenToClient( hwnd, (LPPOINT)&rc );
ScreenToClient( hwnd, ((LPPOINT)&rc)+1 );
int iItem = ListView_GetNextItem(pnmv->hdr.hwndFrom, -1, LVNI_SELECTED);
if (iItem == -1)
{
SetWindowText( hwndNote, _T("") );
EnableWindow( GetDlgItem( hwnd, IDC_PLAY ), FALSE );
InvalidateRect( hwnd, &rc, TRUE );
return;
}
Game* g = (Game*)ListView_GetItemData( pnmv->hdr.hwndFrom, pnmv->iItem );
SetWindowText( hwndNote, g->note().c_str() );
InvalidateRect( hwnd, &rc, TRUE );
EnableWindow( GetDlgItem( hwnd, IDC_PLAY ), TRUE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnColumnClick( LPNMLISTVIEW pnmv )
{
ListView_SortByColumn( pnmv->hdr.hwndFrom, pnmv->iSubItem );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
{
::ScreenToClient(hwnd, (LPPOINT)lpRect);
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
{
COLORREF crOld = ::SetBkColor(hdc, clr);
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
::SetBkColor(hdc, crOld);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnEraseBkgnd( HDC hdc )
{
// don't do this in 256 color
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
return FALSE;
RECT rcWindow;
::GetWindowRect( *this, &rcWindow );
::ScreenToClient( *this, &rcWindow );
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
RECT rc;
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, rcWindow.right, BKGND_BITMAP_BOTTOM );
long lWidth = rc.right - rc.left;
long lHeight = rc.bottom - rc.top;
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmpTile = LoadBitmap( myHInstance, MAKEINTRESOURCE(IDB_TILE) );
BITMAP bm;
GetObject(hbmpTile, sizeof(bm), &bm);
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpTile);
for (long x = 0; x < lWidth; x += bm.bmWidth)
{
for (long y = 0; y < lHeight; y += bm.bmHeight)
{
::BitBlt( hdc,
rc.left + x, rc.top + y,
( (rc.left + x + bm.bmWidth) > rc.right ) ? rc.right-(rc.left+x) : bm.bmWidth,
( (rc.top + y + bm.bmHeight) > rc.bottom ) ? rc.bottom-(rc.top+y) : bm.bmHeight,
hdcMem,
0, 0, SRCCOPY );
}
}
SelectObject(hdcMem, hbmpOld);
DeleteObject(hbmpTile);
DeleteDC(hdcMem);
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HBRUSH MainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
{
// don't do this in 256 color
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
return FALSE;
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
return NULL;
SetBkMode(hdcStatic, TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::Quit()
{
// OK, reload the settings to make sure we have the most current ones
myGlobalData.settings().loadConfig();
// Save the current sort column
int sortcol = myHeader.GetSortCol();
myGlobalData.settings().setInt("sortcol", sortcol);
// Save the column widths
myGlobalData.settings().setInt("namecolwidth",
ListView_GetColWidth( myHwnd, 0 ));
myGlobalData.settings().setInt("manufacturercolwidth",
ListView_GetColWidth( myHwnd, 1 ));
myGlobalData.settings().setInt("raritycolwidth",
ListView_GetColWidth( myHwnd, 2 ));
// Now, save the settings
myGlobalData.settings().saveConfig();
ListView_Clear();
EndDialog( myHwnd, IDCANCEL );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::UpdateRomList( bool forceReload )
{
HWND hwndText;
RECT rc;
TCHAR psz[256 + 1];
TCHAR pszStatus[256 + 1];
// Erase status text
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, 0 );
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, psz );
InvalidateRect( *this, &rc, TRUE );
// Erase rom path
hwndText = GetDlgItem( *this, IDC_ROMPATH );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, "" );
InvalidateRect( *this, &rc, TRUE );
// Get the ROM gamelist, either from disk or cache
PopulateRomList( forceReload );
// if items added, select first item and enable play button
int nCount = ListView_GetItemCount( myHwndList );
if (nCount == 0)
EnableWindow(GetDlgItem( *this, IDC_PLAY), FALSE );
// Show status text
LoadString(myHInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, nCount );
hwndText = GetDlgItem( *this, IDC_ROMCOUNT );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, psz );
InvalidateRect( *this, &rc, TRUE );
// Show rom path
hwndText = GetDlgItem( *this, IDC_ROMPATH );
GetWindowRect(hwndText, &rc);
ScreenToClient( *this, (LPPOINT)&rc );
ScreenToClient( *this, ((LPPOINT)&rc)+1 );
SetWindowText( hwndText, myGlobalData.settings().getString("romdir").c_str() );
InvalidateRect( *this, &rc, TRUE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool MainDlg::PopulateRomList( bool forceReload )
{
bool result = false;
bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache");
bool cacheIsStale = false; // FIXME - add romdir status checking
if (forceReload)
result = LoadRomListFromDisk();
else if (cacheFileExists && !cacheIsStale)
{
result = LoadRomListFromCache();
if (!result)
{
MessageBox( myHInstance, myHwnd, IDS_CORRUPT_CACHE_FILE );
result = LoadRomListFromDisk();
}
}
else
{
if (!cacheFileExists)
MessageBox( myHInstance, myHwnd, IDS_NO_CACHE_FILE );
else if (cacheIsStale)
MessageBox( myHInstance, myHwnd, IDS_ROMDIR_CHANGED );
result = LoadRomListFromDisk();
}
ListView_SortByColumn( myHwndList, myGlobalData.settings().getInt("sortcol") );
return result;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool MainDlg::LoadRomListFromDisk()
{
ListView_Clear();
// Get the location of the romfiles (*.bin)
string romdir = myGlobalData.settings().getString("romdir");
romdir += "\\";
string romfiles = romdir + "*.bin";
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile( romfiles.c_str(), &ffd );
ListView_SetItemCount( myHwndList, 100 );
int iItem = 0;
bool done = (hFind == INVALID_HANDLE_VALUE);
while(!done)
{
Game* g = new Game();
if( g == NULL )
return false;
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = iItem++;
lvi.iSubItem = 0;
lvi.pszText = "";
lvi.lParam = (LPARAM) g;
int nItem = ListView_InsertItem( myHwndList, &lvi );
ASSERT( nItem != -1 );
g->setAvailable( true );
g->setRom( ffd.cFileName );
// Set the name (shown onscreen) to be the rom
// It will be overwritten later if a name is found in the properties set
g->setName( ffd.cFileName );
// go to the next rom file
done = !FindNextFile(hFind, &ffd);
}
if( hFind != INVALID_HANDLE_VALUE )
VERIFY( ::FindClose( hFind ) );
// Create a propertiesset object and load the properties
// We don't create the propsSet until we need it, since it's
// a time-consuming process
PropertiesSet propsSet;
string theUserProFile = myGlobalData.settings().userPropertiesFilename();
string theSystemProFile = myGlobalData.settings().systemPropertiesFilename();
if(theUserProFile != "")
propsSet.load(theUserProFile, true);
else if(theSystemProFile != "")
propsSet.load(theSystemProFile, true);
else
propsSet.load("", false);
// Now, rescan the items in the listview and update the onscreen
// text and game properties
// Also generate a cache file so the program will start faster next time
ofstream cache("stellax.cache");
int count = ListView_GetItemCount( myHwndList );
cache << count << endl;
for (int i = 0; i < count; ++i)
{
Game* g = (Game*) ListView_GetItemData(myHwndList, i);
// Get the MD5sum for this rom
// Use it to lookup the rom in the properties set
string rom = romdir + g->rom();
ifstream in(rom.c_str(), ios_base::binary);
if(!in)
return false;
uInt8* image = new uInt8[512 * 1024];
in.read((char*)image, 512 * 1024);
uInt32 size = in.gcount();
in.close();
string md5 = MD5( image, size );
delete[] image;
// Get the properties for this rom
Properties props;
propsSet.getMD5( md5, props );
// For some braindead reason, the ListView_SetItemText won't
// allow std::string::c_str(), so we create C-strings instead
char name[256], manufacturer[256], rarity[256];
strncpy(name, props.get("Cartridge.Name").c_str(), 255);
strncpy(manufacturer, props.get("Cartridge.Manufacturer").c_str(), 255);
strncpy(rarity, props.get("Cartridge.Rarity").c_str(), 255);
// Make sure the onscreen 'Name' field isn't blank
if(props.get("Cartridge.Name") == "")
strncpy(name, g->name().c_str(), 255);
// Update the current game
g->setMd5( md5 );
g->setName( name );
g->setRarity( rarity );
g->setManufacturer( manufacturer );
g->setNote( props.get("Cartridge.Note") );
// Update the cachefile with this game
cache << g->rom() << endl
<< md5 << endl
<< name << endl
<< rarity << endl
<< manufacturer << endl
<< g->note() << endl;
// Finally, update the listview itself
ListView_SetItemText( myHwndList, i, 0, name );
ListView_SetItemText( myHwndList, i, 1, manufacturer );
ListView_SetItemText( myHwndList, i, 2, rarity );
}
cache.close();
SetFocus( myHwndList );
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool MainDlg::LoadRomListFromCache()
{
ListView_Clear();
char count[10], rom[256], md5[256], name[256], rarity[256],
manufacturer[256], note[256];
// We don't scan the roms at all; just load directly from the cache file
ifstream in("stellax.cache");
if (!in)
return false;
in.getline(count, 9);
int numRoms = atoi(count);
ListView_SetItemCount( myHwndList, 100 );
int iItem = 0;
for(int i = 0; i < numRoms; i++)
{
string line;
Game* g = new Game();
if( g == NULL )
return false;
// Get the data from the cache file
in.getline(rom, 255);
in.getline(md5, 255);
in.getline(name, 255);
in.getline(rarity, 255);
in.getline(manufacturer, 255);
in.getline(note, 255);
// And save it to this game object
g->setAvailable( true );
g->setRom( rom );
g->setMd5( md5 );
g->setName( name );
g->setRarity( rarity );
g->setManufacturer( manufacturer );
g->setNote( note );
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = iItem++;
lvi.iSubItem = 0;
lvi.pszText = "";
lvi.lParam = (LPARAM) g;
int nItem = ListView_InsertItem( myHwndList, &lvi );
ASSERT( nItem != -1 );
ListView_SetItemText( myHwndList, nItem, 0, name );
ListView_SetItemText( myHwndList, nItem, 1, manufacturer );
ListView_SetItemText( myHwndList, nItem, 2, rarity );
}
SetFocus( myHwndList );
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Cool caption message handlers
void MainDlg::OnDestroy( void )
{
myCoolCaption.OnDestroy();
if ( m_hfontRomNote )
{
DeleteObject( m_hfontRomNote );
m_hfontRomNote = NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnNcPaint( HRGN hrgn )
{
myCoolCaption.OnNcPaint( hrgn );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::OnNcActivate( BOOL fActive )
{
myCoolCaption.OnNcActivate( fActive );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL MainDlg::OnNcLButtonDown( INT nHitTest, POINTS pts )
{
return myCoolCaption.OnNCLButtonDown( nHitTest, pts );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPARAM MainDlg::ListView_GetItemData( HWND hwndList, int iItem )
{
LVITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iItem = iItem;
lvi.iSubItem = 0;
ListView_GetItem(hwndList, &lvi);
return lvi.lParam;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::ListView_SortByColumn( HWND hwndList, int col )
{
HCURSOR hcur = SetCursor(LoadCursor(NULL, IDC_WAIT));
int nCount = ListView_GetItemCount( hwndList );
if (nCount != 0)
{
myHeader.SetSortCol( col, TRUE );
ListView_SortItems( hwndList, ListViewCompareFunc, (LPARAM)this );
ListView_SetItemState( hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED );
}
// ensure the selected item is visible
int nItem = ListView_GetNextItem( myHwndList, -1, LVNI_SELECTED );
if (nItem != -1)
ListView_EnsureVisible( myHwndList, nItem, TRUE );
SetCursor(hcur);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int MainDlg::ListView_GetColWidth( HWND hwndList, int col )
{
// Although there seems to be a similar function in the Win32 API
// to do this, I couldn't get it to work, so it's quicker to
// write this one and use it ...
LV_COLUMN lvc;
lvc.mask = LVCF_WIDTH;
if (ListView_GetColumn( myHwndList, col, &lvc ) == TRUE)
return lvc.cx;
else
return 0; // the next time StellaX starts, it will recreate a sane value
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainDlg::ListView_Clear( void )
{
int nCount = ListView_GetItemCount( myHwndList );
for (int i = 0; i < nCount; ++i)
delete (Game*) ListView_GetItemData( myHwndList, i );
ListView_DeleteAllItems( myHwndList );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CALLBACK
MainDlg::ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort )
{
MainDlg* dlg = reinterpret_cast<MainDlg*>( lParamSort );
int sortCol = dlg->myHeader.GetSortCol();
Game* g1 = reinterpret_cast<Game*>( lParam1 );
Game* g2 = reinterpret_cast<Game*>( lParam2 );
string s1 = "", s2 = "";
switch (sortCol)
{
case 0:
s1 = g1->name();
s2 = g2->name();
break;
case 1:
s1 = g1->manufacturer();
s2 = g2->manufacturer();
break;
case 2:
s1 = g1->rarity();
s2 = g2->rarity();
break;
}
if (s1 > s2)
return 1;
else if (s1 < s2)
return -1;
else
return 0;
}

View File

@ -1,101 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainDlg.hxx,v 1.6 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef MAIN_DLG_HXX
#define MAIN_DLG_HXX
#include "resource.h"
class CGlobalData;
#include "StellaXMain.hxx"
#include "CoolCaption.hxx"
#include "TextButton3d.hxx"
#include "HeaderCtrl.hxx"
#include "RoundButton.hxx"
class MainDlg
{
public:
enum { IDD = IDD_MAIN };
MainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance );
virtual ~MainDlg( void );
virtual int DoModal( HWND hwndParent );
operator HWND( void ) const { return myHwnd; }
private:
HWND myHwnd;
CCoolCaption myCoolCaption;
CTextButton3d myAppTitle;
CHeaderCtrl myHeader;
CRoundButton myPlayButton;
CRoundButton myHelpButton;
CRoundButton myReloadButton;
CRoundButton myConfigButton;
CRoundButton myExitButton;
// Message handlers
BOOL OnInitDialog( void );
BOOL OnCommand( int id, HWND hwndCtl, UINT codeNotify );
BOOL OnNotify( int idCtrl, LPNMHDR pnmh );
BOOL OnEraseBkgnd( HDC hdc );
HBRUSH OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic );
// wm_notify handlers
void OnItemChanged( LPNMLISTVIEW pnmv );
void OnColumnClick( LPNMLISTVIEW pnmv );
// cool caption handlers
void OnDestroy( void );
void OnNcPaint( HRGN hrgn );
void OnNcActivate( BOOL fActive );
void Quit();
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
// callback methods
BOOL CALLBACK DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam );
static BOOL CALLBACK StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
// internal data
void UpdateRomList( bool forceReload = false );
bool PopulateRomList( bool forceReload = false );
bool LoadRomListFromDisk();
bool LoadRomListFromCache();
HINSTANCE myHInstance;
HWND myHwndList;
LPARAM ListView_GetItemData( HWND hwndList, int iItem );
void ListView_SortByColumn( HWND hwndList, int col );
int ListView_GetColWidth( HWND hwndList, int col );
void ListView_Clear();
HFONT m_hfontRomNote;
// Stella stuff
CGlobalData& myGlobalData;
CStellaXMain m_stella;
};
#endif

View File

@ -1,233 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PropertySheet.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "PropertySheet.hxx"
#pragma comment(lib, "comctl32")
#include <pshpack1.h>
typedef struct DLGTEMPLATEEX
{
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h>
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertyPage::CPropertyPage( UINT nIDTemplate, UINT nIDCaption /* = 0 */ )
{
UNUSED_ALWAYS( nIDCaption );
ZeroMemory(&m_psp, sizeof(m_psp));
m_psp.dwSize = sizeof(m_psp);
m_psp.dwFlags = PSP_USECALLBACK;
// m_psp.hInstance = hInstance;
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
m_psp.pfnDlgProc = StaticDlgProc;
m_psp.lParam = (LPARAM)this;
m_psp.pfnCallback = StaticCallback;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT CALLBACK
CPropertyPage::StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp )
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp );
switch (uMsg)
{
case PSPCB_CREATE:
// ppsp->lParam holds create lParam
return TRUE;
case PSPCB_RELEASE:
break;
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::StaticDlgProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
CPropertyPage* pPage = NULL;
switch ( uMsg )
{
case WM_INITDIALOG:
pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd, DWL_USER, reinterpret_cast<LONG>( pPage ) );
break;
default:
pPage = reinterpret_cast<CPropertyPage*>( GetWindowLong( hwnd, DWL_USER ) );
if ( pPage == NULL )
return FALSE;
break;
}
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CALLBACK
CPropertyPage::DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch (msg)
{
case WM_ACTIVATE:
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
return TRUE;
case WM_INITDIALOG:
return OnInitDialog( hwnd );
case WM_DESTROY:
OnDestroy( );
return TRUE;
case WM_COMMAND:
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
case WM_NOTIFY:
// Handle PSN_QUERYCANCEL?
// Handle PSN_KILLACTIVE?
switch (((LPNMHDR)lParam)->code)
{
case PSN_SETACTIVE:
SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE:
SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_APPLY:
SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE;
case PSN_RESET:
OnReset( (LPPSHNOTIFY)lParam );
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
return FALSE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::CPropertySheet( LPCTSTR pszCaption, HWND hwndParent,
UINT nStartPage /* = 0 */ )
: m_strCaption( pszCaption )
{
ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh);
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
m_psh.hwndParent = hwndParent;
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
m_psh.pszCaption = m_strCaption.c_str();
m_psh.nStartPage = nStartPage;
m_psh.pfnCallback = StaticCallback;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CPropertySheet::~CPropertySheet()
{
// BUGBUG: This is static!
/* if ( m_hfontLogo )
{
DeleteObject( m_hfontLogo );
m_hfontLogo = NULL;
}*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CPropertySheet::AddPage( CPropertyPage* pPage )
{
if (pPage)
m_pages.push_back(pPage);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CPropertySheet::DoModal()
{
int nSize = m_pages.size();
if (nSize == 0)
return IDCANCEL;
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
for (int i = 0; i < nSize; ++i)
{
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
sizeof(PROPSHEETPAGE));
pspage[i].hInstance = m_psh.hInstance;
}
m_psh.nPages = nSize;
m_psh.ppsp = pspage;
int nRet = ::PropertySheet( &m_psh );
delete[] pspage;
return nRet;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CALLBACK
CPropertySheet::StaticCallback( HWND hwnd, UINT uMsg, LPARAM lParam )
{
UNUSED_ALWAYS( hwnd );
switch (uMsg)
{
case PSCB_INITIALIZED:
// Property sheet is being initialized
return TRUE;
case PSCB_PRECREATE:
// Property sheet is about to be created
// Remove the DS_CONTEXTHELP style from the dialog template
// (This will remove the "?" in the top right corner)
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
else
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
return TRUE;
}
return 0;
}

View File

@ -1,92 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PropertySheet.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef PROPERTY_SHEET_HXX
#define PROPERTY_SHEET_HXX
#include <prsht.h>
#include <vector>
#include <string>
class CPropertyPage
{
public:
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
const PROPSHEETPAGE* GetPropSheetPage();
protected:
// Overridable callbacks
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized ) {}
virtual BOOL OnInitDialog( HWND /* hwnd */ ) { return FALSE; }
virtual void OnDestroy( void ) {}
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ ) { return 0; }
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ ) { return FALSE; }
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ ) { return PSNRET_NOERROR; }
virtual void OnReset( LPPSHNOTIFY /* lppsn */ ) {}
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */,
HWND /* hwndCtl */ ) { return FALSE; }
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ ) { return FALSE; }
private:
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
PROPSHEETPAGE m_psp;
CPropertyPage( const CPropertyPage& ); // no implementation
void operator=( const CPropertyPage& ); // no implementation
};
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage()
{
return &m_psp;
}
class CPropertySheet
{
public:
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
~CPropertySheet( );
void AddPage( CPropertyPage* pPage );
virtual int DoModal( void );
private:
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
PROPSHEETHEADER m_psh;
std::vector<CPropertyPage*> m_pages;
std::string m_strCaption;
CPropertySheet( const CPropertySheet& ); // no implementation
void operator=( const CPropertySheet& ); // no implementation
};
#endif

View File

@ -1,553 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RoundButton.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "RoundButton.hxx"
#include <math.h>
#include <limits.h>
// prototypes
COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark);
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crColour, BOOL bDashed = FALSE);
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crBright, COLORREF crDark);
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crBright, COLORREF crDark);
// Calculate colour for a point at the given angle by performing a linear
// interpolation between the colours crBright and crDark based on the cosine
// of the angle between the light source and the point.
//
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
// But remember: +y points down!
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
COLORREF GetColour( double dAngle, COLORREF crBright, COLORREF crDark )
{
#define Rad2Deg 180.0/3.1415
// For better light-continuity along the edge of a stretched button:
// LIGHT_SOURCE_ANGLE == -1.88
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#define LIGHT_SOURCE_ANGLE -1.88
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
if (dAngleDifference < -3.1415)
dAngleDifference = 6.293 + dAngleDifference;
else if (dAngleDifference > 3.1415)
dAngleDifference = 6.293 - dAngleDifference;
double Weight = 0.5*(cos(dAngleDifference)+1.0);
BYTE Red = (BYTE) (Weight*GetRValue(crBright) + (1.0-Weight)*GetRValue(crDark));
BYTE Green = (BYTE) (Weight*GetGValue(crBright) + (1.0-Weight)*GetGValue(crDark));
BYTE Blue = (BYTE) (Weight*GetBValue(crBright) + (1.0-Weight)*GetBValue(crDark));
//TRACE("LightAngle = %0.0f, Angle = %3.0f, Diff = %3.0f, Weight = %0.2f, RGB %3d,%3d,%3d\n",
// LIGHT_SOURCE_ANGLE*Rad2Deg, dAngle*Rad2Deg, dAngleDifference*Rad2Deg, Weight,Red,Green,Blue);
return RGB(Red, Green, Blue);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius, COLORREF crColour,
BOOL bDashed )
{
const int nDashLength = 1;
LONG lError, lXoffset, lYoffset;
int nDash = 0;
BOOL bDashOn = TRUE;
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
if (bDashOn)
{
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
}
// Advance the error term and the constant X axis step
lError += lYoffset++;
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
if (bDashed && (++nDash == nDashLength))
{
nDash = 0;
bDashOn = !bDashOn;
}
} while (lYoffset <= lXoffset); // Continue until halfway point
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The original Drawcircle function is split up into DrawCircleRight and
// DrawCircleLeft to make stretched buttons
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
COLORREF crDark )
{
LONG lError, lXoffset, lYoffset;
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
COLORREF crColour;
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
// Draw the current pixel, reflected across all four arcs
crColour = GetColour(dAngle, crBright, crDark);
SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
crColour = GetColour(-dAngle, crBright, crDark);
SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
// Advance the error term and the constant X axis step
lError += lYoffset++;
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); // Continue until halfway point
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// The original Drawcircle function is split up into DrawCircleRight and
// DrawCircleLeft to make stretched buttons
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius, COLORREF crBright,
COLORREF crDark )
{
LONG lError, lXoffset, lYoffset;
// Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
// Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654, Pi_on_2 = Pi * 0.5;
COLORREF crColour;
long double dAngle = atan2((long double)lYoffset, (long double)lXoffset);
// Draw the current pixel, reflected across all eight arcs
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(Pi - dAngle, crBright, crDark);
SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(-Pi + dAngle, crBright, crDark);
SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
// Advance the error term and the constant X axis step
lError += lYoffset++;
// Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); // Continue until halfway point
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void ClientToScreen( HWND hwnd, LPRECT lpRect )
{
ClientToScreen(hwnd, (LPPOINT)lpRect);
ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
{
ScreenToClient(hwnd, (LPPOINT)lpRect);
ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
{
COLORREF crOld = ::SetBkColor(hdc, clr);
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
SetBkColor(hdc, crOld);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CRoundButton::CRoundButton()
: m_hrgn( NULL ),
m_fDrawDashedFocusCircle( TRUE ),
m_fStretch( FALSE )
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CRoundButton::~CRoundButton()
{
if ( m_hrgn )
DeleteObject( m_hrgn );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CRoundButton::PreSubclassWindow( HWND hwnd )
{
RECT rect;
GetClientRect( hwnd, &rect );
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
if ( ! m_fStretch )
rect.bottom = rect.right = min ( rect.bottom, rect.right );
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
m_nRadius = rect.bottom/2 - 1;
m_ptLeft.x = m_nRadius;
m_ptRight.x = rect.right - m_nRadius - 1;
SetWindowRgn( hwnd, NULL, FALSE );
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
SetWindowRgn( hwnd, m_hrgn, TRUE );
ClientToScreen( hwnd, &rect );
HWND hwndParent = ::GetParent( hwnd );
if ( hwndParent )
ScreenToClient( hwndParent, &rect );
if ( ! m_fStretch )
MoveWindow( hwnd, rect.left, rect.top,
rect.right-rect.left, rect.bottom-rect.top, TRUE );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CRoundButton::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
case WM_DRAWITEM:
rfHandled = TRUE;
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
case WM_ERASEBKGND:
// don't do erasing
return TRUE;
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CRoundButton::OnDrawItem( HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis )
{
UNUSED_ALWAYS( idCtl );
HDC hdc = lpdis->hDC;
RECT& rect = lpdis->rcItem;
UINT state = lpdis->itemState;
UINT nStyle = GetWindowLong(hwnd, GWL_STYLE);
int nRadius = m_nRadius;
int nSavedDC = ::SaveDC( hdc );
SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
// Draw the focus circle around the button for non-stretched buttons
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
// Draw the raised/sunken edges of the button (unless flat)
if ( nStyle & BS_FLAT )
{
if ( m_fStretch )
{
// for stretched buttons: draw left and right arcs and connect the with lines
HPEN hpenOld;
RECT rectLeftBound;
SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
RECT rectRightBound;
SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
hpenOld = (HPEN)::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
rectLeftBound.bottom, m_ptLeft.x, 0, m_ptLeft.x, nRadius*2 );
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
MoveToEx( hdc, m_ptLeft.x, 0, NULL );
LineTo( hdc, m_ptRight.x, 0 );
MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
LineTo( hdc, m_ptRight.x, nRadius*2-1 );
nRadius--;
InflateRect( &rectLeftBound, -1, -1 );
InflateRect( &rectRightBound, -1, -1 );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
Arc( hdc, rectLeftBound.left, rectLeftBound.top, rectLeftBound.right,
rectLeftBound.bottom, m_ptLeft.x, 1, m_ptLeft.x, nRadius*2 );
Arc( hdc, rectRightBound.left, rectRightBound.top, rectRightBound.right,
rectRightBound.bottom, m_ptRight.x, nRadius*2, m_ptRight.x, 0 );
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x, 1 );
MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
LineTo( hdc, m_ptRight.x, nRadius*2 );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
else
{
// for non-stretched buttons: draw two circles
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
}
}
else
{
if (state & ODS_SELECTED)
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius,
GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius-1,
GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
if ( m_fStretch )
{
// draw connecting lines for stretched buttons only
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x, 1 );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
LineTo( hdc, m_ptRight.x, 2 );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
DeleteObject( ::SelectObject( hdc,
CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
else
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius,
GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
// draw connecting lines for stretch buttons
if ( m_fStretch )
{
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
CreatePen( PS_SOLID, 1,
GetPixel( hdc, m_ptLeft.x, 1 ) ) );
MoveToEx( hdc, m_ptLeft.x, 1, NULL );
LineTo( hdc, m_ptRight.x , 1);
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
MoveToEx( hdc, m_ptLeft.x, 2, NULL );
LineTo( hdc, m_ptRight.x, 2 );
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
}
// Draw the text if there is any
TCHAR pszText[ 256 ];
int cch = ::GetWindowText( hwnd, pszText, 255 );
if ( cch != 0 )
{
HRGN hrgn;
if ( m_fStretch )
hrgn = CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
else
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
SelectClipRgn( hdc, hrgn );
SIZE size;
GetTextExtentPoint32( hdc, pszText, cch, &size );
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
if ( state & ODS_SELECTED )
{
++( pt.x );
++( pt.y );
}
SetBkMode( hdc, TRANSPARENT );
#if 0
if ( state & ODS_DISABLED )
DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
else
#endif
{
// give text a 3d-look
RECT pos;
SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
COLORREF crOld = SetTextColor( hdc,
( state & ODS_DISABLED ) ?
GetSysColor( COLOR_GRAYTEXT ) :
GetSysColor( COLOR_WINDOWTEXT ) );
if ( state & ODS_FOCUS )
{
LOGFONT lf;
GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ), sizeof(LOGFONT), &lf );
lf.lfWeight = FW_BOLD;
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
DeleteObject( ::SelectObject( hdc, hfontOld) );
}
else
DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
SetTextColor( hdc, crOld );
}
SelectClipRgn( hdc, NULL );
DeleteObject( hrgn );
}
#if 0
// draw the focus circle on the inside
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
#endif
RestoreDC( hdc, nSavedDC );
}

View File

@ -1,50 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: RoundButton.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef ROUND_BUTTON_HXX
#define ROUND_BUTTON_HXX
#include "Wnd.hxx"
class CRoundButton : public CWnd
{
public:
CRoundButton();
~CRoundButton();
protected:
LRESULT WndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled );
virtual void PreSubclassWindow(HWND hwnd);
private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
HRGN m_hrgn;
POINT m_ptCenter;
POINT m_ptLeft;
POINT m_ptRight;
int m_nRadius;
BOOL m_fDrawDashedFocusCircle;
BOOL m_fStretch;
CRoundButton( const CRoundButton& ); // no implementation
void operator=( const CRoundButton& ); // no implementation
};
#endif

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,299 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "winresrc.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""winresrc.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,0,0
PRODUCTVERSION 1,4,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x29L
#else
FILEFLAGS 0x28L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "This version of StellaX is released under the GPL."
VALUE "CompanyName", "Stephen Anthony (sa666_666@hotmail.com)"
VALUE "FileDescription", "StellaX"
VALUE "FileVersion", "1, 4, 0, 0"
VALUE "InternalName", "StellaX"
VALUE "LegalCopyright", "Copyright (C) 2000 Jeff Miller, Copyright (C) 2004 Stephen Anthony"
VALUE "LegalTrademarks", "n/a"
VALUE "OriginalFilename", "StellaX.exe"
VALUE "PrivateBuild", "n/a"
VALUE "ProductName", "StellaX"
VALUE "ProductVersion", "1, 4, 0, 0"
VALUE "SpecialBuild", "n/a"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOGEX 0, 0, 409, 249
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
WS_VISIBLE | WS_CAPTION
CAPTION "StellaX"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,7,45,44,8
CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
WS_BORDER | WS_TABSTOP,7,57,395,143,WS_EX_STATICEDGE
CONTROL "&Play",IDC_PLAY,"Button",BS_OWNERDRAW | WS_TABSTOP,7,
226,149,16
CONTROL "&Options",IDC_CONFIG,"Button",BS_OWNERDRAW | WS_TABSTOP,
230,226,54,16
CONTROL "&Help",IDC_ABOUT,"Button",BS_OWNERDRAW | WS_TABSTOP,289,
226,54,16
CONTROL "E&xit",IDC_EXIT,"Button",BS_OWNERDRAW | WS_TABSTOP,348,
226,54,16
CTEXT "Written by Jeff Miller (miller@zipcon.net)\nUpdated by Stephen Anthony (sa666_666@hotmail.com)\nStella core by Bradford W. Mott (bwmott@acm.org)",
IDC_STATIC_TEXT,175,7,227,28,SS_NOPREFIX
RTEXT "<status>",IDC_ROMCOUNT,322,45,80,8,SS_NOPREFIX
CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,39,411,1
CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,218,411,1
CONTROL "StellaX v1.4",IDC_TITLE,"Button",BS_OWNERDRAW |
BS_CENTER | BS_TOP | WS_DISABLED | WS_TABSTOP,7,7,145,22
CONTROL "Static",IDC_ROMPATH,"Static",SS_LEFTNOWORDWRAP |
SS_NOPREFIX | WS_GROUP,57,45,254,8
CONTROL "",IDC_ROMNOTE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,105,205,297,8
LTEXT "Game notes (if available):",-1,7,205,98,8
CONTROL "&Reload",IDC_RELOAD,"Button",BS_OWNERDRAW | WS_TABSTOP,
172,226,54,16
END
IDD_ABOUT_PAGE DIALOGEX 0, 0, 299, 86
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Information"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "You must own legal copies of all ROM images you are using. The Stella team can't tell you where to find ROM images so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities. StellaX is GPL software.",
-1,7,7,284,30,SS_NOPREFIX
LTEXT "If you have a question or a problem, please try one of these contacts:",
-1,7,44,284,8,SS_NOPREFIX
LTEXT "Steve Anthony:",-1,7,58,53,8,SS_NOPREFIX
LTEXT "sa666_666@hotmail.com",IDC_EMAIL_MAINTAINER,73,58,122,8,
SS_NOPREFIX | SS_NOTIFY
LTEXT "http://minbar.org",IDC_WEB_MAINTAINER,202,58,72,8,
SS_NOPREFIX | SS_NOTIFY
LTEXT "Stella dev team:",-1,7,70,60,8,SS_NOPREFIX
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
70,122,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "http://stella.sf.net",IDC_WEB_STELLA,202,70,68,8,
SS_NOPREFIX | SS_NOTIFY
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,37,284,1
END
IDD_CONFIG_PAGE DIALOGEX 0, 0, 269, 158
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Options"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX "File Locations",-1,7,7,254,39
LTEXT "ROM Directory:",-1,14,25,55,8
EDITTEXT IDC_ROMPATH,67,23,171,13,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BROWSE,241,23,13,12
GROUPBOX "Snapshot Settings",-1,7,49,148,43
LTEXT "Save Snapshot as:",-1,14,61,67,10
COMBOBOX IDC_SNAPSHOT_TYPE,86,60,60,37,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Generate multiple snapshots",IDC_SNAPSHOT_MULTIPLE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,75,109,11
GROUPBOX "Paddle Emulation",-1,161,49,100,43
LTEXT "Mouse is paddle:",-1,167,61,65,8
COMBOBOX IDC_PADDLE,225,60,30,82,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
GROUPBOX "Video Settings",-1,7,95,118,57
LTEXT "Driver:",-1,14,108,28,10
COMBOBOX IDC_VIDEO,62,106,52,35,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
LTEXT "Aspect Ratio:",-1,14,122,50,10
EDITTEXT IDC_GL_ASPECT,62,120,51,12,ES_AUTOHSCROLL
CONTROL "Maximize FS OpenGL",IDC_GL_FSMAX,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,25,135,86,12
GROUPBOX "Sound Settings",-1,132,95,96,57
LTEXT "Volume:",-1,140,108,28,8
EDITTEXT IDC_SOUND_VOLUME,176,106,29,12,ES_AUTOHSCROLL
CONTROL "",IDC_SOUND_VOLUME_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,205,106,11,12
LTEXT "Frag Size:",-1,140,122,36,8
COMBOBOX IDC_SOUND_FRAGSIZE,176,120,41,51,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Disable &Sound",IDC_SOUND_ENABLE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,135,62,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 402
TOPMARGIN, 7
BOTTOMMARGIN, 242
END
IDD_ABOUT_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 291
TOPMARGIN, 7
BOTTOMMARGIN, 78
END
IDD_CONFIG_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 262
TOPMARGIN, 7
BOTTOMMARGIN, 152
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP ICON "STELLAX.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_TILE BITMAP "tile.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_STATUSTEXT "%d files found"
IDS_STELLA "StellaX"
IDS_NO_CACHE_FILE "No ROM cache file was found. Regenerating the cache will take some time."
IDS_CORRUPT_CACHE_FILE "The ROM cache file was corrupt. Regenerating the cache will take some time."
IDS_ROMDIR_CHANGED "The ROM directory has changed. The ROM cache will be regenerated."
END
STRINGTABLE
BEGIN
IDS_ALREADYRUNNING "StellaX is already running!"
END
STRINGTABLE
BEGIN
IDS_FILENAME "Filename"
IDS_MANUFACTURER "Manufacturer"
IDS_NAME "Name"
IDS_RARITY "Rarity"
END
STRINGTABLE
BEGIN
IDS_NO_ITEM_SELECTED "Before pressing play you must first select a game from the list!"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,275 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="StellaX"
ProjectGUID="{EB852944-92EA-4A83-B13F-E800ADA48A4D}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\emucore;..\..\emucore\m6502\src\bspf\src;..\..\win32"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BSPF_WIN32;JOYSTICK_SUPPORT;SNAPSHOT_SUPPORT;DISPLAY_OPENGL"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="1"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/StellaX.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/StellaX.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\emucore;..\..\emucore\m6502\src\bspf\src;..\..\win32"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;BSPF_WIN32;JOYSTICK_SUPPORT;SNAPSHOT_SUPPORT;DISPLAY_OPENGL"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="1"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/StellaX.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\AboutPage.cxx">
</File>
<File
RelativePath=".\BrowseForFolder.cxx">
</File>
<File
RelativePath=".\ConfigPage.cxx">
</File>
<File
RelativePath=".\CoolCaption.cxx">
</File>
<File
RelativePath=".\debug.cxx">
</File>
<File
RelativePath=".\Game.cxx">
</File>
<File
RelativePath=".\GlobalData.cxx">
</File>
<File
RelativePath=".\HeaderCtrl.cxx">
</File>
<File
RelativePath=".\HyperLink.cxx">
</File>
<File
RelativePath=".\main.cxx">
</File>
<File
RelativePath=".\MainDlg.cxx">
</File>
<File
RelativePath="..\..\emucore\MD5.cxx">
</File>
<File
RelativePath=".\pch.cxx">
</File>
<File
RelativePath=".\PropertySheet.cxx">
</File>
<File
RelativePath="..\..\emucore\Props.cxx">
</File>
<File
RelativePath="..\..\emucore\PropsSet.cxx">
</File>
<File
RelativePath=".\RoundButton.cxx">
</File>
<File
RelativePath="..\..\emucore\Settings.cxx">
</File>
<File
RelativePath="..\SettingsWin32.cxx">
</File>
<File
RelativePath=".\StellaXMain.cxx">
</File>
<File
RelativePath=".\TextButton3d.cxx">
</File>
<File
RelativePath=".\Wnd.cxx">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\AboutPage.hxx">
</File>
<File
RelativePath=".\BrowseForFolder.hxx">
</File>
<File
RelativePath=".\ConfigPage.hxx">
</File>
<File
RelativePath=".\CoolCaption.hxx">
</File>
<File
RelativePath=".\debug.hxx">
</File>
<File
RelativePath=".\Game.hxx">
</File>
<File
RelativePath=".\GlobalData.hxx">
</File>
<File
RelativePath=".\HeaderCtrl.hxx">
</File>
<File
RelativePath=".\HyperLink.hxx">
</File>
<File
RelativePath=".\MainDlg.hxx">
</File>
<File
RelativePath="..\..\emucore\MD5.hxx">
</File>
<File
RelativePath=".\pch.hxx">
</File>
<File
RelativePath=".\PropertySheet.hxx">
</File>
<File
RelativePath="..\..\emucore\Props.hxx">
</File>
<File
RelativePath="..\..\emucore\PropsSet.hxx">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\RoundButton.hxx">
</File>
<File
RelativePath="..\..\emucore\Settings.hxx">
</File>
<File
RelativePath="..\SettingsWin32.hxx">
</File>
<File
RelativePath=".\StellaXMain.hxx">
</File>
<File
RelativePath=".\TextButton3d.hxx">
</File>
<File
RelativePath=".\Wnd.hxx">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\StellaX.ico">
</File>
<File
RelativePath=".\StellaX.rc">
</File>
<File
RelativePath=".\tile.bmp">
</File>
</Filter>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="StellaX.rc"/>
</Globals>
</VisualStudioProject>

View File

@ -1,60 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaXMain.cxx,v 1.5 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include <iostream>
#include <sstream>
#include <string>
#include <windows.h>
#include <shellapi.h>
#include "GlobalData.hxx"
#include "Settings.hxx"
#include "pch.hxx"
#include "StellaXMain.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::CStellaXMain()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CStellaXMain::~CStellaXMain()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CStellaXMain::PlayROM( string& romfile, CGlobalData& globaldata )
{
ostringstream buf;
// Make sure the specfied ROM exists
if(!globaldata.settings().fileExists(romfile))
{
buf << "\"" << romfile << "\" doesn't exist";
MessageBox( NULL, buf.str().c_str(), "Unknown ROM", MB_ICONEXCLAMATION|MB_OK);
return;
}
// Assume that the ROM file does exist, attempt to run external Stella
// Since all settings are saved to the stella.ini file, we don't need
// to pass any arguments here ...
buf << "\"" << romfile << "\"";
ShellExecute(NULL, "open", "stella.exe", buf.str().c_str(), NULL, 0);
}

View File

@ -1,40 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaXMain.hxx,v 1.4 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef STELLAX_MAIN_HXX
#define STELLAX_MAIN_HXX
#include "bspf.hxx"
class CGlobalData;
class CStellaXMain
{
public:
CStellaXMain();
~CStellaXMain();
void PlayROM( string& romfile, CGlobalData& globaldata );
private:
CStellaXMain( const CStellaXMain& ); // no implementation
void operator=( const CStellaXMain& ); // no implementation
};
#endif

View File

@ -1,178 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "TextButton3d.hxx"
// button style should be VISIBLE / DISABLED / OWNERDRAW
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CTextButton3d::CTextButton3d()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CTextButton3d::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL& rfHandled )
{
switch (msg)
{
#if 0
// TODO: re do this now that I send this message here
case WM_DRAWITEM:
rfHandled = TRUE;
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
#endif
case WM_PAINT:
rfHandled = TRUE;
OnPaint(hWnd, (HDC)wParam);
return TRUE;
case WM_ERASEBKGND:
rfHandled = TRUE;
return OnEraseBkgnd(hWnd, (HDC)wParam);
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CTextButton3d::OnPaint( HWND hwnd, HDC hdcPaint )
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
int cxClient, cyClient;
RECT rc;
GetClientRect(hwnd, &rc);
RECT rcClient;
CopyRect(&rcClient, &rc);
// lpdis->rcItem, lpdis->itemState
int l = GetWindowTextLength(hwnd);
LPTSTR text = new TCHAR[l + 2];
if (text == NULL)
{
EndPaint(hwnd, &ps);
return;
}
GetWindowText(hwnd, text, l+1);
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(hfont, sizeof(lf), &lf);
if (lf.lfHeight == 0)
lf.lfHeight = 20;
lf.lfWidth = 0;
lf.lfWeight = FW_BLACK;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
HFONT hfontTry = CreateFontIndirect(&lf);
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
rcClient.left += 3;
rcClient.top += 3;
rcClient.right -= 3;
rcClient.bottom -= 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
else
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
lf.lfHeight--;
rcClient.left -= 3;
rcClient.top -= 3;
rcClient.right += 3;
rcClient.bottom += 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text), &sizeTextClient);
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
COLORREF crText = GetSysColor(COLOR_BTNTEXT);
COLORREF crOldText = SetTextColor(hdc, crText);
int cx = minx;
int cy = miny;
int s = 1;
cx += 3;
cy += 3;
// draw 3D highlights
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW));
TextOut(hdc, cx-s*2, cy+s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy+s*2, text, lstrlen(text));
SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
TextOut(hdc, cx+s*1, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy-s*2, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DSHADOW));
TextOut(hdc, cx-s*1, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy+s*1, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DLIGHT));
TextOut(hdc, cx, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy-s*1, text, lstrlen(text));
SetTextColor(hdc, crText);
// draw the text
TextOut(hdc, cx, cy, text, lstrlen(text));
// restore dc
SetTextColor(hdc, crOldText);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
DeleteObject(hfont);
DeleteObject(hfontTry);
delete[] text;
EndPaint(hwnd, &ps);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CTextButton3d::OnEraseBkgnd( HWND hwnd, HDC hdc )
{
// dont do any erasing
return TRUE;
}

View File

@ -1,43 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TextButton3d.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef TEXT_BUTTON_HXX
#define TEXT_BUTTON_HXX
// derived from Roger Onslow's code
#include "Wnd.hxx"
class CTextButton3d : public CWnd
{
public:
CTextButton3d();
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled);
private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);
CTextButton3d( const CTextButton3d& ); // no implementation
void operator=( const CTextButton3d& ); // no implementation
};
#endif

View File

@ -1,77 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "Wnd.hxx"
// REVIEW: Need to reset old wnd proc?
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CWnd::CWnd()
: m_pOldWindowProc(NULL),
m_hwnd(NULL)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL CWnd::SubclassDlgItem( HWND hwndParent, UINT nID )
{
if ( nID == 0 || hwndParent == NULL )
return FALSE;
// can't subclass twice!
if ( m_pOldWindowProc != NULL )
return FALSE;
m_hwnd = GetDlgItem( hwndParent, nID );
if (m_hwnd == NULL)
{
ASSERT( FALSE );
return FALSE;
}
PreSubclassWindow( m_hwnd );
m_pOldWindowProc = (WNDPROC)GetWindowLong( m_hwnd, GWL_WNDPROC );
SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this );
SetWindowLong( m_hwnd, GWL_WNDPROC, (LONG)StaticWndProc );
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CWnd::PreSubclassWindow( HWND hwnd )
{
// no default behavior
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CALLBACK CWnd::StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam )
{
CWnd* pThis = (CWnd*)GetWindowLong(hWnd, GWL_USERDATA);
BOOL fHandled = FALSE;
LRESULT lRes = pThis->WndProc( hWnd, msg, wParam, lParam, fHandled );
if (fHandled)
return lRes;
return CallWindowProc( pThis->m_pOldWindowProc, hWnd, msg, wParam, lParam );
}

View File

@ -1,46 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Wnd.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef WND_HXX
#define WND_HXX
class CWnd
{
public:
CWnd();
BOOL SubclassDlgItem( HWND hwndParent, UINT nID );
operator HWND() const { return m_hwnd; }
protected:
virtual void PreSubclassWindow( HWND hwnd );
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL& rfHandled ) = 0;
private:
static LRESULT CALLBACK StaticWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
WNDPROC m_pOldWindowProc;
HWND m_hwnd;
CWnd( const CWnd& ); // no implementation
void operator=( const CWnd& ); // no implementation
};
#endif

View File

@ -1,80 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: debug.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "debug.hxx"
#ifdef _DEBUG // entire file
// log file name (or NULL for no log) -- must be defined by client
extern LPCTSTR g_ctszDebugLog;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AFX_CDECL AfxTrace( LPCTSTR lpszFormat, ... )
{
va_list args;
va_start(args, lpszFormat);
int nBuf;
TCHAR szBuffer[512];
nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
// was there an error? was the expanded string too long?
ASSERT(nBuf >= 0);
if (nBuf < 511)
lstrcat(szBuffer, _T("\r\n"));
_RPT0(_CRT_WARN, szBuffer);
if (g_ctszDebugLog)
{
HANDLE hfile = CreateFile(g_ctszDebugLog, GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hfile != INVALID_HANDLE_VALUE)
{
SetFilePointer(hfile, 0, NULL, FILE_END);
DWORD dw;
WriteFile(hfile, szBuffer, (lstrlen(szBuffer)+1)*sizeof(TCHAR),
&dw, NULL);
CloseHandle(hfile);
}
}
va_end(args);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL AFXAPI AfxAssertFailedLine( LPCSTR lpszFileName, int nLine,
LPCTSTR lpszCondition )
{
// we remove WM_QUIT because if it is in the queue then the message box
// won't display
MSG msg;
BOOL bQuit = PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
BOOL bResult = _CrtDbgReport(_CRT_ASSERT, lpszFileName, nLine, NULL, lpszCondition);
if (bQuit)
PostQuitMessage(msg.wParam);
return bResult;
}
#endif

View File

@ -1,111 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: debug.hxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef _AFX
#define _AFX
#include <windows.h>
#include <tchar.h>
// ---------------------------------------------------------------------------
// This file defines:
// _countof
// TRACE, TRACE0, TRACE1, TRACE2, TRACE3
// ASSERT
// VERIFY
// DEBUG_ONLY
// determine number of elements in an array (not bytes)
#define _countof(array) (sizeof(array)/sizeof(array[0]))
// AFXAPI is used on global public functions
#ifndef AFXAPI
#define AFXAPI __stdcall
#endif
// AFX_CDECL is used for rare functions taking variable arguments
#ifndef AFX_CDECL
#define AFX_CDECL __cdecl
#endif
#ifdef _DEBUG
// ---------------------------------------------------------------------------
// DEBUG DEFINED
#include <tchar.h>
#include <stdio.h>
#include <stdarg.h>
#include <crtdbg.h>
#ifndef AfxDebugBreak
#define AfxDebugBreak() _CrtDbgBreak()
#endif
BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine, LPCTSTR lpszCondition);
void AFX_CDECL AfxTrace(LPCTSTR lpszFormat, ...);
#define TRACE ::AfxTrace
#define THIS_FILE __FILE__
#define ASSERT(f) \
do \
{ \
if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__, #f)) \
AfxDebugBreak(); \
} while (0) \
#define VERIFY(f) ASSERT(f)
#define DEBUG_ONLY(f) (f)
// The following trace macros are provided for backward compatiblity
// (they also take a fixed number of parameters which provides
// some amount of extra error checking)
#define TRACE0(sz) ::AfxTrace(_T("%s"), _T(sz))
#define TRACE1(sz, p1) ::AfxTrace(_T(sz), p1)
#define TRACE2(sz, p1, p2) ::AfxTrace(_T(sz), p1, p2)
#define TRACE3(sz, p1, p2, p3) ::AfxTrace(_T(sz), p1, p2, p3)
#else // _DEBUG
// ---------------------------------------------------------------------------
// DEBUG NOT DEFINED
#ifdef AfxDebugBreak
#undef AfxDebugBreak
#endif
#define AfxDebugBreak()
#define ASSERT(f) ((void)0)
#define VERIFY(f) ((void)(f))
#define DEBUG_ONLY(f) ((void)0)
inline void AFX_CDECL AfxTrace(LPCTSTR, ...) { }
#define TRACE 1 ? (void)0 : ::AfxTrace
#define TRACE0(sz)
#define TRACE1(sz, p1)
#define TRACE2(sz, p1, p2)
#define TRACE3(sz, p1, p2, p3)
#endif // !_DEBUG
#endif

View File

@ -1,94 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: main.cxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "resource.h"
#include "GlobalData.hxx"
#include "MainDlg.hxx"
class CSingleInstance
{
public:
CSingleInstance( LPCTSTR pszName )
{
::SetLastError( ERROR_SUCCESS );
m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
m_dwError = ::GetLastError();
}
~CSingleInstance()
{
if ( m_hMutex != INVALID_HANDLE_VALUE && m_dwError != ERROR_ALREADY_EXISTS )
{
VERIFY( ::ReleaseMutex( m_hMutex ) );
VERIFY( ::CloseHandle( m_hMutex ) );
}
}
BOOL AlreadyExists( void ) const
{
return ( m_dwError == ERROR_ALREADY_EXISTS );
}
private:
HANDLE m_hMutex;
DWORD m_dwError;
CSingleInstance( const CSingleInstance& ); // no implementation
void operator=( const CSingleInstance& ); // no implementation
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LPCTSTR g_ctszDebugLog = _T("stella.log");
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow )
{
UNUSED_ALWAYS( hPrevInstance );
UNUSED_ALWAYS( lpCmdLine );
UNUSED_ALWAYS( nCmdShow );
(void)::DeleteFile(g_ctszDebugLog);
CSingleInstance mutex( _T("StellaXMutex") );
if ( mutex.AlreadyExists() )
{
MessageBox( hInstance, NULL, IDS_ALREADYRUNNING );
return 1;
}
HRESULT hrCoInit = ::CoInitialize( NULL );
if ( FAILED(hrCoInit) )
MessageBox( hInstance, NULL, IDS_COINIT_FAILED );
::InitCommonControls();
CGlobalData globaldata( hInstance );
// show the ui
MainDlg dlg( globaldata, hInstance );
dlg.DoModal( NULL );
if ( hrCoInit == S_OK )
::CoUninitialize();
return 0;
}

View File

@ -1,75 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.cxx,v 1.2 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#include "pch.hxx"
#include <stdio.h>
#include <stdarg.h>
#include "resource.h"
// Bring in the common control library
#pragma comment( lib, "comctl32" )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText )
{
const int nMaxStrLen = 1024;
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
TCHAR tszText[nMaxStrLen + 1] = { 0 };
// Caption is always "StellaX"
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
if (hwndParent == NULL)
hwndParent = ::GetForegroundWindow();
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ )
{
const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
if ( pszCaption == NULL )
{
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
lstrcpy( pszCaptionStellaX, _T("StellaX") );
}
LPTSTR pszText = NULL;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText, 0, NULL);
::MessageBox(::GetForegroundWindow(), pszText,
pszCaption ? pszCaption : pszCaptionStellaX,
MB_ICONWARNING | MB_OK);
LocalFree( pszText );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ )
{
MessageBoxFromWinError( GetLastError(), pszCaption );
}

View File

@ -1,60 +0,0 @@
//============================================================================
//
// SSSS tt lll lll XX XX
// SS SS tt ll ll XX XX
// SS tttttt eeee ll ll aaaa XX XX
// SSSS tt ee ee ll ll aa XXX
// SS tt eeeeee ll ll aaaaa XX XX
// SS SS tt ee ll ll aa aa XX XX
// SSSS ttt eeeee llll llll aaaaa XX XX
//
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: pch.hxx,v 1.3 2004-07-15 03:03:27 stephena Exp $
//============================================================================
#ifndef PCH_HXX
#define PCH_HXX
#define WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 5
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <dinput.h>
#include "debug.hxx"
// ---------------------------------------------------------------------------
// Conditional defines
// Macros
//
#ifdef _DEBUG
#define UNUSED(x)
#else
#define UNUSED(x) x
#endif
#define UNUSED_ALWAYS(x) x
// Utility methods
//
void MessageBox( HINSTANCE hInstance, HWND hwndParent, UINT uIDText );
void MessageBoxFromWinError( DWORD dwError, LPCTSTR pszCaption /* = NULL */ );
void MessageBoxFromGetLastError( LPCTSTR pszCaption /* = NULL */ );
#endif

View File

@ -1,75 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by StellaX.rc
//
#define IDB_TILE 101
#define IDI_APP 102
#define IDD_ABOUT 103
#define IDD_MAIN 104
#define IDD_ABOUT_PAGE 106
#define IDD_CONFIG_PAGE 108
#define IDS_ALREADYRUNNING 200
#define IDS_CANTOPEN 204
#define IDS_CW_FAILED 208
#define IDS_FATALERROR 275
#define IDS_FILENAME 277
#define IDS_MANUFACTURER 278
#define IDS_NAME 280
#define IDS_OUTOFMEMORY 283
#define IDS_RARITY 284
#define IDS_STATUSTEXT 289
#define IDS_STELLA 290
#define IDS_UNKNOWNERROR 291
#define IDS_NO_CACHE_FILE 291
#define IDS_DEBUGBUILD 292
#define IDS_CORRUPT_CACHE_FILE 292
#define IDS_ROMDIR_CHANGED 293
#define IDS_COINIT_FAILED 296
#define IDS_ASS_FAILED 297
#define IDS_PAS_FAILED 298
#define IDS_NO_ITEM_SELECTED 305
#define IDC_ABOUT 1001
#define IDC_EMAIL_MAINTAINER 1002
#define IDC_EMAIL_STELLA 1003
#define IDC_EXIT 1004
#define IDC_PLAY 1005
#define IDC_ROMCOUNT 1006
#define IDC_ROMLIST 1007
#define IDC_STATIC_TEXT 1008
#define IDC_TITLE 1009
#define IDC_WEB_MAINTAINER 1010
#define IDC_WEB_STELLA 1011
#define IDC_WWW_MAME 1012
#define IDC_ROMPATH 1013
#define IDC_ROMNOTE 1014
#define IDC_CONFIG 1015
#define IDC_CONFIG2 1016
#define IDC_PADDLE 1017
#define IDC_VOLUME 1019
#define IDC_BROWSE 1022
#define IDC_EDIT2 1027
#define IDC_RELOAD 1028
#define IDC_SNAPSHOT_TYPE 1029
#define IDC_SNAPSHOT_LOCATION 1030
#define IDC_SNAPSHOT_MULTIPLE 1031
#define IDC_SOUND_ENABLE 1032
#define IDC_SOUND_VOLUME 1033
#define IDC_LIST1 1033
#define IDC_VIDEO 1034
#define IDC_GL_ASPECT 1035
#define IDC_GL_FSMAX 1036
#define IDC_SOUND_VOLUME_SPIN 1044
#define IDC_SOUND_FRAGSIZE 1045
#define IDC_TAB1 1046
#define ID_FILE_EXIT 32771
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 296
#define _APS_NEXT_COMMAND_VALUE 32772
#define _APS_NEXT_CONTROL_VALUE 1047
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,29 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StellaX", "StellaX\StellaX.vcproj", "{EB852944-92EA-4A83-B13F-E800ADA48A4D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stella", "Stella\Stella.vcproj", "{45875C96-4084-4C54-B570-FC92F8791A2F}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Debug.ActiveCfg = Debug|Win32
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Debug.Build.0 = Debug|Win32
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Release.ActiveCfg = Release|Win32
{EB852944-92EA-4A83-B13F-E800ADA48A4D}.Release.Build.0 = Release|Win32
{45875C96-4084-4C54-B570-FC92F8791A2F}.Debug.ActiveCfg = Debug|Win32
{45875C96-4084-4C54-B570-FC92F8791A2F}.Debug.Build.0 = Debug|Win32
{45875C96-4084-4C54-B570-FC92F8791A2F}.Release.ActiveCfg = Release|Win32
{45875C96-4084-4C54-B570-FC92F8791A2F}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal