Cyberstella finally compiles! After a year of inactivity, I decided that

someone had to look at the code and do something with it.

As of now, joysticks and mouse aren't working.  Settings aren't saved.
And sound support is patchy.  Definitely a work-in-progress.

It looks like I'll be the maintainer for this as well, at least until
we can find someone who is willing to take over full time.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@185 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-09-21 14:33:34 +00:00
parent e25d504c02
commit dd6d7f7981
22 changed files with 9528 additions and 793 deletions

View File

@ -1,12 +1,7 @@
Cyberstella V1.2 What needs to be done ASAP (will be done eventually):
Urgent: - More Columns / Advanced sorting
- Reasonably reduce the appearance of advertisment MessgageBoxes. - Make whole screen resizable
- Check if games are running without stella.pro (?!?)
Later:
- More Columns / Advanced sorting
- Make whole screen resizable
like this: like this:
void CViewList::OnSize(UINT nType, int cx, int cy) void CViewList::OnSize(UINT nType, int cx, int cy)
@ -15,80 +10,40 @@ Later:
if ( m_listCtrl.m_hWnd ) m_listCtrl.MoveWindow (0, 0, cx, cy); if ( m_listCtrl.m_hWnd ) m_listCtrl.MoveWindow (0, 0, cx, cy);
} }
??????? ???????
- Check other versions command line params - Add Fullscreen / Windowed mode - Alt-Enter
- Check other versions keyboard mapping - Check Direct Draw implementation / upgrade to DX8
- Add Screenshots - F12 - Improve the DirectSound support
- Add Pause - F3 - Can you have two PC controllers connected?
- Add Fullscreen / Windowed mode -F4 - Make all dialog boxes resizable for any size text
- Check Direct Draw implementation / upgrade to DX8
- Integrate manuals for the built in games
- Think about french localisation
ToDos from Brad Mott: Integrated into the core, but not necessarily active in Cyberstella:
- Is the keyboard mapping correct (e.g., do both of the Joysticks
work via the keyboard)
- Can you have two PC controllers connected?
- Finish the windowed version of StellaX (e.g., so that it'll run in
a window as well as fullscreen)
- Improve the DirectSound support
- Provide custom keyboard / controller mapping (e.g., be able to
map joystick buttons to the 2600 Select/Reset as well as the
other 2600 functions...)
ToDos from Stephen Anthony: - Check other versions command line params
1) In the information dialog box, could you change the - Check other versions keyboard mapping
Stella homepage to - Add Screenshots - F12
stella.sourceforge.net, and change the mailing list to - Add Pause - Pause
stella-main@lists.sourceforge.net? These are the new - Is the keyboard mapping correct (e.g., do both of the Joysticks
addresses, and the work via the keyboard)
older ones you have used will be eventually phased out. - Provide custom keyboard / controller mapping (e.g., be able to
map joystick buttons to the 2600 Select/Reset as well as the
other 2600 functions...)
2) Sometimes, when resizing the window, the inner file- Future / never (depending on user enthusiasm and developer availability):
list contents aren't
resized. Maybe you haven't associated the resize event
with the resize
listview event?
3) There seems to be some lines of text missing in the - Add a Sprite/Animation Editor
various dialog boxes. - Add a PF Editor
I'm not sure if that is a problem with the version of - Add a Sourcecode Editor
Windows I using (Win98 - Either Support DASM as frontend or integrate a 6507 Assembler
under VMWare) or not. - Either Support Distella as frontend or integrate a 6507 Disassembler
- AVI/MPEG export
ToDos from Thomas Jetzsch: - WAV/MP3 export
-> Private Mail + (Update path earlier, etc...) - Client/Server networked play for up to 4 Computers via LAN/Internet
>> Maybe just adding some friendly game-info menu, that - Tracking Hiscores
>> doesn't pop-up on remote at all. - Record and Playback games - not as real movie, but by logging
Input/RAM/processor states in given intervals.
>Auch 'ne gute Idee, könnte man auch schön mit den Anleitungen - Cheatcodes
>kombinieren. Und bei jedem Spiel vielleicht nur einmalig darauf - Improve frontend by adding snapshots, labels, manuals, etc.
>verweisen. Like KStella for Linux. (Suggestion from Brian Luttrull)
Own Ideas:
- Add a Sprite/Animation Editor
- Add a PF Editor
- Add a Sourcecode Editor
- Either Support DASM as frontend or integrate a 6507
Assembler
- Either Support Distella as frontend or integrate a
6507 Disassembler
- AVI/MPEG export
- WAV/MP3 export
- Client/Server networked play for up to 4 Computers via
LAN/Internet
- Tracking Hiscores
- Record and Playback games - not as real movie, but by
logging Input/RAM/processor states in given intervals.
- Cheatcodes
Suggestions from Brian Luttrull:
Are you planning or would you be interested in adding
more features to the front end of Stella? For
example, the ability to display screenshots, cart
pics, docs, details, etc. The Kstella frontend has
these features and the very friendly and helpful
author, Stephen Anthony, said you would be free to
take ideas and code from his frontend (under GPL).
Suggestions from Glenn Saunders: Suggestions from Glenn Saunders:
A couple things I'd like to see in a 2600 emulator that Brad was working on A couple things I'd like to see in a 2600 emulator that Brad was working on

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CartMC.cxx,v 1.3 2002-12-01 15:59:47 stephena Exp $ // $Id: CartMC.cxx,v 1.4 2003-09-21 14:33:33 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -222,6 +222,7 @@ void CartridgeMC::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::save(Serializer& out) bool CartridgeMC::save(Serializer& out)
{ {
uInt32 i;
string cart = name(); string cart = name();
try try
@ -230,12 +231,12 @@ bool CartridgeMC::save(Serializer& out)
// The currentBlock array // The currentBlock array
out.putLong(4); out.putLong(4);
for(uInt32 i = 0; i < 4; ++i) for(i = 0; i < 4; ++i)
out.putLong(myCurrentBlock[i]); out.putLong(myCurrentBlock[i]);
// The 32K of RAM // The 32K of RAM
out.putLong(32 * 1024); out.putLong(32 * 1024);
for(uInt32 i = 0; i < 32 * 1024; ++i) for(i = 0; i < 32 * 1024; ++i)
out.putLong(myRAM[i]); out.putLong(myRAM[i]);
} }
catch(char *msg) catch(char *msg)
@ -255,6 +256,7 @@ bool CartridgeMC::save(Serializer& out)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::load(Deserializer& in) bool CartridgeMC::load(Deserializer& in)
{ {
uInt32 i;
string cart = name(); string cart = name();
try try
@ -266,12 +268,12 @@ bool CartridgeMC::load(Deserializer& in)
// The currentBlock array // The currentBlock array
limit = (uInt32) in.getLong(); limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i) for(i = 0; i < limit; ++i)
myCurrentBlock[i] = (uInt8) in.getLong(); myCurrentBlock[i] = (uInt8) in.getLong();
// The 32K of RAM // The 32K of RAM
limit = (uInt32) in.getLong(); limit = (uInt32) in.getLong();
for(uInt32 i = 0; i < limit; ++i) for(i = 0; i < limit; ++i)
myRAM[i] = (uInt8) in.getLong(); myRAM[i] = (uInt8) in.getLong();
} }
catch(char *msg) catch(char *msg)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.7 2003-09-19 15:45:01 stephena Exp $ // $Id: EventHandler.cxx,v 1.8 2003-09-21 14:33:33 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -37,20 +37,22 @@ EventHandler::EventHandler(Console* console)
: myConsole(console), : myConsole(console),
myCurrentState(0) myCurrentState(0)
{ {
Int32 i;
// Create the event object which will be used for this handler // Create the event object which will be used for this handler
myEvent = new Event(); myEvent = new Event();
// Erase the KeyEvent array // Erase the KeyEvent array
for(Int32 i = 0; i < StellaEvent::LastKCODE; ++i) for(i = 0; i < StellaEvent::LastKCODE; ++i)
myKeyTable[i] = Event::LastType; myKeyTable[i] = Event::LastType;
// Erase the JoyEvent array // Erase the JoyEvent array
for(Int32 i = 0; i < StellaEvent::LastJSTICK; ++i) for(i = 0; i < StellaEvent::LastJSTICK; ++i)
for(Int32 j = 0; j < StellaEvent::LastJCODE; ++j) for(Int32 j = 0; j < StellaEvent::LastJCODE; ++j)
myJoyTable[i][j] = Event::LastType; myJoyTable[i][j] = Event::LastType;
// Erase the Message array // Erase the Message array
for(Int32 i = 0; i < Event::LastType; ++i) for(i = 0; i < Event::LastType; ++i)
ourMessageTable[i] = ""; ourMessageTable[i] = "";
// Set unchanging messages // Set unchanging messages
@ -215,7 +217,6 @@ void EventHandler::setKeymap()
if(isValidList(list, StellaEvent::LastKCODE)) if(isValidList(list, StellaEvent::LastKCODE))
{ {
Event::Type event;
istringstream buf(list); istringstream buf(list);
string key; string key;
@ -240,7 +241,6 @@ void EventHandler::setJoymap()
if(isValidList(list, StellaEvent::LastJSTICK*StellaEvent::LastJCODE)) if(isValidList(list, StellaEvent::LastJSTICK*StellaEvent::LastJCODE))
{ {
Event::Type event;
istringstream buf(list); istringstream buf(list);
string key; string key;

View File

@ -13,9 +13,10 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Settings.cxx,v 1.5 2003-09-19 15:45:01 stephena Exp $ // $Id: Settings.cxx,v 1.6 2003-09-21 14:33:33 stephena Exp $
//============================================================================ //============================================================================
#include <assert.h>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
@ -138,7 +139,21 @@ void Settings::saveConfig()
return; return;
} }
out << "fps = " << theDesiredFrameRate << endl out << "; Stella configuration file" << endl
<< ";" << endl
<< "; Lines starting with ';' are comments and are ignored." << endl
<< "; Spaces and tabs are ignored." << endl
<< ";" << endl
<< "; Format MUST be as follows:" << endl
<< "; command = value" << endl
<< ";" << endl
<< "; Commmands are the same as those specified on the commandline," << endl
<< "; without the '-' character." << endl
<< ";" << endl
<< "; Values are the same as those allowed on the commandline." << endl
<< "; Boolean values are specified as 1 (for true) and 0 (for false)" << endl
<< ";" << endl
<< "fps = " << theDesiredFrameRate << endl
<< "zoom = " << theZoomLevel << endl << "zoom = " << theZoomLevel << endl
<< "keymap = " << myConsole->eventHandler().getKeymap() << endl << "keymap = " << myConsole->eventHandler().getKeymap() << endl
<< "joymap = " << myConsole->eventHandler().getJoymap() << endl << "joymap = " << myConsole->eventHandler().getJoymap() << endl

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TIA.cxx,v 1.19 2002-11-19 04:33:48 bwmott Exp $ // $Id: TIA.cxx,v 1.20 2003-09-21 14:33:33 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -656,9 +656,10 @@ void TIA::drawMessageText()
} }
// Then, draw the text // Then, draw the text
for(uInt8 x = 0; x < length; ++x) //FIXME - change back to x
for(uInt8 x1 = 0; x1 < length; ++x1)
{ {
char letter = myMessageText[x]; char letter = myMessageText[x1];
if((letter >= 'A') && (letter <= 'Z')) if((letter >= 'A') && (letter <= 'Z'))
data = ourFontData[(int)letter - 65]; data = ourFontData[(int)letter - 65];

View File

@ -1,35 +0,0 @@
; Stella configuration file
;
; Lines starting with ';' are comments and are ignored.
; Spaces and tabs are ignored.
;
; Format MUST be as follows:
; command = value
;
; Commmands are the same as those specified on the commandline,
; without the '-' character.
;
; Values are the same as those allowed on the commandline.
; Boolean values are specified as 1 (for true) and 0 (for false)
;
; LINUX VERSION
; This file can be put in "/etc/stellarc" for system-wide access
; or in "$HOME/.stella/stellarc" for individual users.
;display = <display>
;fps = <number>
;owncmap = <0|1>
;zoom = <size>
;grabmouse = <0|1>
;hidecursor = <0|1>
;center = <0|1>
;volume = <number>
;paddle = <0|1|2|3|real>
;showinfo = <0|1>
;fullscreen = <0|1>
;ssdir = <pathname>
;ssname = <romname|md5sum>
;sssingle = <0|1>
;accurate = <0|1>
;sound = <0|oss|sdl>
;Dmerge = <0|1>

View File

@ -51,17 +51,17 @@ BOOL AboutDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
m_hlMail_JSM.SubclassDlgItem(IDC_EMAIL_JEFFMILL, this); m_hlMail_JSM.SubclassDlgItem(IDC_EMAIL_JEFFMILL, this);
m_hlMail_JSM.SetURL( _T("mailto:miller@zipcon.net?Subject=StellaX") ); m_hlMail_JSM.SetURL( _T("mailto:stephena@users.sourceforge.net?Subject=Cyberstella") );
m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_JEFFMILL, this); m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_JEFFMILL, this);
m_hlWWW_JSM.SetURL( _T("http://www.emuunlim.com/stellax/") ); m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this); m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this);
m_hlMail_Stella.SetURL( _T("mailto:stella@csc.ncsu.edu") ); m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
m_hlWWW_Stella.SubclassDlgItem(IDC_WEB_STELLA, this); m_hlWWW_Stella.SubclassDlgItem(IDC_WEB_STELLA, this);
m_hlWWW_Stella.SetURL( _T("http://stella.atari.org/") ); m_hlWWW_Stella.SetURL( _T("http://stella.sourceforge.net") );
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE

View File

@ -40,9 +40,10 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release" # PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\games" /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /FR /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\games" /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /D DIRECTINPUT_VERSION=0x0800 /FR /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -53,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386 # ADD LINK32 dxguid.lib ddraw.lib dsound.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "Cyberstella - Win32 Debug" !ELSEIF "$(CFG)" == "Cyberstella - Win32 Debug"
@ -69,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\games" /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /FR /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\games" /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /D DIRECTINPUT_VERSION=0x0800 /FR /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -80,7 +81,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD LINK32 dxguid.lib ddraw.lib dsound.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF !ENDIF
@ -97,10 +98,6 @@ SOURCE=.\AboutDlg.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\AudioStream.cxx
# End Source File
# Begin Source File
SOURCE=.\CRegBinding.cpp SOURCE=.\CRegBinding.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -157,6 +154,10 @@ SOURCE=.\pch.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\SettingsWin32.cxx
# End Source File
# Begin Source File
SOURCE=.\SoundWin32.cxx SOURCE=.\SoundWin32.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -177,10 +178,6 @@ SOURCE=.\AboutDlg.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\AudioStream.hxx
# End Source File
# Begin Source File
SOURCE=.\CRegBinding.h SOURCE=.\CRegBinding.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -237,6 +234,10 @@ SOURCE=.\Resource.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\SettingsWin32.hxx
# End Source File
# Begin Source File
SOURCE=.\SoundWin32.hxx SOURCE=.\SoundWin32.hxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -257,10 +258,6 @@ SOURCE=.\res\Cyberstella.rc2
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Dir.ico
# End Source File
# Begin Source File
SOURCE=.\res\Dir.ico SOURCE=.\res\Dir.ico
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -269,10 +266,6 @@ SOURCE=.\res\Stella.ico
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\Stella.ico
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp SOURCE=.\res\Toolbar.bmp
# End Source File # End Source File
# End Group # End Group
@ -361,6 +354,14 @@ SOURCE=..\..\emucore\CartE7.hxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\emucore\CartF4.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF4.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF4SC.cxx SOURCE=..\..\emucore\CartF4SC.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -473,6 +474,14 @@ SOURCE=..\..\emucore\Event.hxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\emucore\EventHandler.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\EventHandler.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Joystick.cxx SOURCE=..\..\emucore\Joystick.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -553,6 +562,14 @@ SOURCE=..\..\emucore\Serializer.hxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\emucore\Settings.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Settings.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Sound.cxx SOURCE=..\..\emucore\Sound.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -561,6 +578,10 @@ SOURCE=..\..\emucore\Sound.hxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\emucore\StellaEvent.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Switches.cxx SOURCE=..\..\emucore\Switches.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -575,6 +596,14 @@ SOURCE=..\..\emucore\TIA.cxx
SOURCE=..\..\emucore\TIA.hxx SOURCE=..\..\emucore\TIA.hxx
# End Source File # End Source File
# Begin Source File
SOURCE=..\..\emucore\TIASound.c
# End Source File
# Begin Source File
SOURCE=..\..\emucore\TIASound.h
# End Source File
# End Group # End Group
# Begin Group "M6502" # Begin Group "M6502"
@ -636,38 +665,6 @@ SOURCE=..\..\emucore\m6502\src\System.cxx
SOURCE=..\..\emucore\m6502\src\System.hxx SOURCE=..\..\emucore\m6502\src\System.hxx
# End Source File # End Source File
# End Group # End Group
# Begin Group "Sound"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\sound\TIASound.c
# End Source File
# Begin Source File
SOURCE=..\sound\TIASound.h
# End Source File
# End Group
# Begin Group "Games"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\games\Gunfight.h
# End Source File
# Begin Source File
SOURCE=..\..\games\Jammed.h
# End Source File
# Begin Source File
SOURCE=..\..\games\Qb.h
# End Source File
# Begin Source File
SOURCE=..\..\games\Thrust.h
# End Source File
# End Group
# Begin Source File # Begin Source File
SOURCE=..\..\emucore\m6502\src\bspf\src\bspf.hxx SOURCE=..\..\emucore\m6502\src\bspf\src\bspf.hxx
@ -676,13 +673,5 @@ SOURCE=..\..\emucore\m6502\src\bspf\src\bspf.hxx
SOURCE=..\..\..\CyberstellaTodo.txt SOURCE=..\..\..\CyberstellaTodo.txt
# End Source File # End Source File
# Begin Source File
SOURCE=..\..\build\M6502Hi.ins
# End Source File
# Begin Source File
SOURCE=..\..\build\M6502Low.ins
# End Source File
# End Target # End Target
# End Project # End Project

View File

@ -27,7 +27,7 @@ public:
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCyberstellaApp) //{{AFX_VIRTUAL(CCyberstellaApp)
public: public:
virtual BOOL InitInstance(); virtual BOOL InitInstance();
//}}AFX_VIRTUAL //}}AFX_VIRTUAL

View File

@ -129,13 +129,6 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Cyberstella", IDC_CONFIG MENUITEM "&Cyberstella", IDC_CONFIG
END END
POPUP "&Games"
BEGIN
MENUITEM "&Gunfight", IDG_GUNFIGHT
MENUITEM "&Jammed", IDG_JAMMED
MENUITEM "&QB", IDG_QB
MENUITEM "&Thrust", IDG_THRUST
END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
MENUITEM "&About Cyberstella...", ID_APP_ABOUT MENUITEM "&About Cyberstella...", ID_APP_ABOUT
@ -173,7 +166,7 @@ END
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169 IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
STYLE WS_CHILD STYLE WS_CHILD
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP | CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,7,7,44,8 WS_GROUP,7,7,44,8
@ -185,29 +178,29 @@ BEGIN
SS_NOPREFIX | WS_GROUP,57,7,254,8 SS_NOPREFIX | WS_GROUP,57,7,254,8
END END
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 390, 133 IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 285, 128
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Information" CAPTION "Information"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
LTEXT "You must own legal copies of all ROM images you are using. Neither Manuel Polik nor the rest of the Stella team can tell you where to find ROM images so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities.", LTEXT "You must own legal copies of all ROM images you are using. The Stella team cannot tell you where to find ROM images, so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities.",
-1,7,27,376,18,SS_NOPREFIX -1,7,21,266,26,SS_NOPREFIX
LTEXT "If you have a question or a problem with Cyberstella, please try one of these contacts:", LTEXT "If you have a question or a problem with Cyberstella, please try one of these contacts:",
-1,7,58,376,8,SS_NOPREFIX -1,7,58,271,8,SS_NOPREFIX
LTEXT "Manuel Polik:",-1,7,76,62,8,SS_NOPREFIX LTEXT "Stephen Anthony",-1,7,76,62,8,SS_NOPREFIX
LTEXT "cybergoth@nexgo.de",IDC_EMAIL_JEFFMILL,73,76,103,8, LTEXT "stephena@users.sourceforge.net",IDC_EMAIL_MAINTAINER,73,
76,103,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "http://minbar.org",IDC_WEB_MAINTAINER,190,76,82,8,
SS_NOPREFIX | SS_NOTIFY SS_NOPREFIX | SS_NOTIFY
LTEXT "http://www.emuunlim.com/stellax/",IDC_WEB_JEFFMILL,178, LTEXT "Stella dev team:",-1,7,89,52,8,SS_NOPREFIX
76,110,8,SS_NOPREFIX | SS_NOTIFY LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
LTEXT "Stella dev team:",-1,7,88,52,8,SS_NOPREFIX 89,105,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "stella@csc.ncsu.edu",IDC_EMAIL_STELLA,73,88,67,8, LTEXT "http://stella.sourceforge.net",IDC_WEB_STELLA,190,89,88,
SS_NOPREFIX | SS_NOTIFY 8,SS_NOPREFIX | SS_NOTIFY
LTEXT "http://stella.atari.org",IDC_WEB_STELLA,178,88,65,8, LTEXT "Cyberstella v1.4 is GPL software.",-1,7,7,271,9,
SS_NOPREFIX | SS_NOTIFY SS_NOPREFIX
LTEXT "Cyberstella is free software. It may not be sold or offered as part of a collection for sale without permission from Manuel Polik. When distributing Cyberstella, the original distribution (the .zip file) must not be altered.", CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,268,1
-1,7,7,376,19,SS_NOPREFIX PUSHBUTTON "&Continue",IDC_CONTINUE,112,107,60,14
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,375,1
PUSHBUTTON "&Continue",IDC_CONTINUE,136,111,118,14
END END
IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 112 IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 112
@ -239,8 +232,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1 FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -253,17 +246,20 @@ VS_VERSION_INFO VERSIONINFO
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "040904B0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "\0" VALUE "CompanyName", "\0"
VALUE "FileDescription", "Cyberstella MFC Application\0" VALUE "FileDescription", "Cyberstella MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0" VALUE "FileVersion", "1.4\0"
VALUE "InternalName", "Cyberstella\0" VALUE "InternalName", "Cyberstella\0"
VALUE "LegalCopyright", "Copyright (C) 2002\0" VALUE "LegalCopyright", "Copyright (C) 2003\0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Cyberstella.EXE\0" VALUE "OriginalFilename", "Cyberstella.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Cyberstella Application\0" VALUE "ProductName", "Cyberstella Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0" VALUE "ProductVersion", "1.4\0"
VALUE "SpecialBuild", "\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -294,9 +290,9 @@ BEGIN
IDD_ABOUTBOX, DIALOG IDD_ABOUTBOX, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 383 RIGHTMARGIN, 278
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 126 BOTTOMMARGIN, 121
END END
IDD_CONFIG_PAGE, DIALOG IDD_CONFIG_PAGE, DIALOG

View File

@ -9,6 +9,7 @@
#include "StellaConfig.h" #include "StellaConfig.h"
#include "Console.hxx" #include "Console.hxx"
#include "SoundWin32.hxx" #include "SoundWin32.hxx"
#include "SettingsWin32.hxx"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -41,10 +42,6 @@ BEGIN_MESSAGE_MAP(CCyberstellaView, CFormView)
ON_BN_CLICKED(IDC_CONFIG, OnConfig) ON_BN_CLICKED(IDC_CONFIG, OnConfig)
ON_BN_CLICKED(IDC_PLAY, OnPlay) ON_BN_CLICKED(IDC_PLAY, OnPlay)
ON_WM_DESTROY() ON_WM_DESTROY()
ON_COMMAND(IDG_GUNFIGHT, OnGunfight)
ON_COMMAND(IDG_JAMMED, OnJammed)
ON_COMMAND(IDG_QB, OnQb)
ON_COMMAND(IDG_THRUST, OnThrust)
ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos) ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos)
ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote) ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote)
ON_MESSAGE(MSG_VIEW_INITIALIZE, initialize) ON_MESSAGE(MSG_VIEW_INITIALIZE, initialize)
@ -142,6 +139,10 @@ LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
// Create a properties set for us to use // Create a properties set for us to use
m_pPropertiesSet = new PropertiesSet(); m_pPropertiesSet = new PropertiesSet();
// Create SettingsWin32 object
pSettings = new SettingsWin32();
pSettings->loadConfig();
// Set up the image list. // Set up the image list.
HICON hFolder, hAtari; HICON hFolder, hAtari;
@ -212,34 +213,6 @@ LRESULT CCyberstellaView::displayNote(WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
void CCyberstellaView::OnGunfight()
{
MessageBox("To avoid probable GPL violations by including non-GPL games into this project, this function is currently disabled. We're working on a GPL conform solution though, so check back soon.", "Sorry, currently not available!", MB_OK);
//playRom(IDG_GUNFIGHT);
//MessageBox("If you'd like to play Gunfight on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
}
void CCyberstellaView::OnJammed()
{
MessageBox("To avoid probable GPL violations by including non-GPL games into this project, this function is currently disabled. We're working on a GPL conform solution though, so check back soon.", "Sorry, currently not available!", MB_OK);
//playRom(IDG_JAMMED);
//MessageBox("If you'd like to play Jammed on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
}
void CCyberstellaView::OnQb()
{
MessageBox("To avoid probable GPL violations by including non-GPL games into this project, this function is currently disabled. We're working on a GPL conform solution though, so check back soon.", "Sorry, currently not available!", MB_OK);
//playRom(IDG_QB);
//MessageBox("If you'd like to play Qb on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
}
void CCyberstellaView::OnThrust()
{
MessageBox("To avoid probable GPL violations by including non-GPL games into this project, this function is currently disabled. We're working on a GPL conform solution though, so check back soon.", "Sorry, currently not available!", MB_OK);
//playRom(IDG_THRUST);
//MessageBox("If you'd like to play Thrust on a real VCS, you can order a cartridge for only $25\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
}
void CCyberstellaView::playRom(LONG gameID) void CCyberstellaView::playRom(LONG gameID)
{ {
@ -254,179 +227,116 @@ void CCyberstellaView::playRom(LONG gameID)
CString fileName; CString fileName;
BYTE* pImage = NULL; BYTE* pImage = NULL;
LPCTSTR pszFileName = NULL; LPCTSTR pszFileName = NULL;
Console* pConsole = NULL;
Sound* pSound = NULL;
DWORD dwImageSize; DWORD dwImageSize;
DWORD dwActualSize; DWORD dwActualSize;
Event rEvent; Console* pConsole = NULL;
// Create Sound driver object // Create Sound driver object
// (Will be initialized once we have a window handle below) // (Will be initialized once we have a window handle below)
if (m_pGlobalData->bNoSound) if(m_pGlobalData->bNoSound)
{ {
TRACE("Creating Sound driver"); TRACE("Creating Sound driver");
pSound = new Sound; pSound = new Sound();
} }
else else
{ {
TRACE("Creating SoundWin32 driver"); TRACE("Creating SoundWin32 driver");
pSound = new SoundWin32; pSound = new SoundWin32();
} }
if ( pSound == NULL ) if ( pSound == NULL )
{ {
goto exit; goto exit;
} }
// Special handling for special games
switch(gameID) fileName = m_List.getCurrentFile();
// Safety Bail Out
if(fileName.GetLength() <= 0)
return;
// Load the rom file
HANDLE hFile;
hFile = ::CreateFile( fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if(hFile == INVALID_HANDLE_VALUE)
{ {
case IDG_GUNFIGHT: DWORD dwLastError = ::GetLastError();
{
/*pszFileName = "Gunfight";
dwActualSize = sizeof gunfight;
pImage = new BYTE[dwActualSize];
for(int i=0; i<dwActualSize; i++)
{
pImage[i] = gunfight[i]^(pszFileName[i%strlen(pszFileName)]);
}*/
break;
}
case IDG_JAMMED:
{
/*pszFileName = "Jammed";
dwActualSize = sizeof jammed;
pImage = new BYTE[dwActualSize];
for(int i=0; i<dwActualSize; i++)
{
pImage[i] = jammed[i]^(pszFileName[i%strlen(pszFileName)]);
}*/
break;
}
case IDG_QB:
{
/*pszFileName = "Qb";
dwActualSize = sizeof qb;
pImage = new BYTE[dwActualSize];
for(int i=0; i<dwActualSize; i++)
{
pImage[i] = qb[i]^(pszFileName[i%strlen(pszFileName)]);
}*/
break;
}
case IDG_THRUST:
{
/*pszFileName = "Thrust";
dwActualSize = sizeof thrust;
pImage = new BYTE[dwActualSize];
for(int i=0; i<dwActualSize; i++)
{
pImage[i] = thrust[i]^(pszFileName[i%strlen(pszFileName)]);
}*/
break;
}
default:
{
fileName = m_List.getCurrentFile();
// Safety Bail Out TCHAR pszCurrentDirectory[ MAX_PATH + 1 ];
if(fileName.GetLength() <= 0) return; ::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory );
// Load the rom file // ::MessageBoxFromGetLastError( pszPathName );
HANDLE hFile; TCHAR pszFormat[ 1024 ];
hFile = ::CreateFile( fileName, LoadString(GetModuleHandle(NULL),
GENERIC_READ, IDS_ROM_LOAD_FAILED,
FILE_SHARE_READ, pszFormat, 1023 );
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL );
if (hFile == INVALID_HANDLE_VALUE) LPTSTR pszLastError = NULL;
{
DWORD dwLastError = ::GetLastError();
TCHAR pszCurrentDirectory[ MAX_PATH + 1 ]; FormatMessage(
::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory ); FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszLastError,
0,
NULL);
// ::MessageBoxFromGetLastError( pszPathName ); TCHAR pszError[ 1024 ];
TCHAR pszFormat[ 1024 ]; wsprintf( pszError,
LoadString(GetModuleHandle(NULL), pszFormat,
IDS_ROM_LOAD_FAILED, pszCurrentDirectory,
pszFormat, 1023 ); fileName,
dwLastError,
pszLastError );
LPTSTR pszLastError = NULL; ::MessageBox( *this,
pszError,
_T("Error"),
MB_OK | MB_ICONEXCLAMATION );
FormatMessage( ::LocalFree( pszLastError );
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszLastError,
0,
NULL);
TCHAR pszError[ 1024 ]; goto exit;
wsprintf( pszError, }
pszFormat,
pszCurrentDirectory,
fileName,
dwLastError,
pszLastError );
::MessageBox( *this, dwImageSize = ::GetFileSize( hFile, NULL );
pszError,
_T("Error"),
MB_OK | MB_ICONEXCLAMATION );
::LocalFree( pszLastError ); pImage = new BYTE[dwImageSize + 1];
if ( pImage == NULL )
goto exit;
goto exit; if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) )
} {
VERIFY( ::CloseHandle( hFile ) );
dwImageSize = ::GetFileSize( hFile, NULL ); MessageBoxFromGetLastError(fileName);
pImage = new BYTE[dwImageSize + 1]; goto exit;
if ( pImage == NULL ) }
{
goto exit;
}
if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) ) VERIFY( ::CloseHandle(hFile) );
{
VERIFY( ::CloseHandle( hFile ) );
MessageBoxFromGetLastError(fileName); // get just the filename
pszFileName = _tcsrchr( fileName, _T('\\') );
goto exit; if ( pszFileName )
} {
++pszFileName;
VERIFY( ::CloseHandle(hFile) ); }
} else
// get just the filename {
pszFileName = _tcsrchr( fileName, _T('\\') ); pszFileName = fileName;
if ( pszFileName )
{
++pszFileName;
}
else
{
pszFileName = fileName;
}
} }
try try
{ {
// If this throws an exception, then it's probably a bad cartridge // If this throws an exception, then it's probably a bad cartridge
pConsole = new Console( pImage, pConsole = new Console( pImage, dwActualSize, pszFileName, *pSettings,
dwActualSize, *m_pPropertiesSet, 31400 );
pszFileName,
rEvent,
*m_pPropertiesSet,
*pSound );
if ( pConsole == NULL ) if ( pConsole == NULL )
{
goto exit; goto exit;
}
} }
catch (...) catch (...)
{ {
@ -438,18 +348,12 @@ void CCyberstellaView::playRom(LONG gameID)
} }
#ifdef USE_FS #ifdef USE_FS
pwnd = new CDirectXFullScreen( m_pGlobalData, pwnd = new CDirectXFullScreen( m_pGlobalData, pConsole, pSound );
pConsole,
rEvent );
#else #else
pwnd = new CDirectXWindow( m_pGlobalData, pwnd = new CDirectXWindow( m_pGlobalData, pConsole, pSound );
pConsole,
rEvent );
#endif #endif
if ( pwnd == NULL ) if( pwnd == NULL )
{
goto exit; goto exit;
}
HRESULT hr; HRESULT hr;
@ -475,21 +379,15 @@ void CCyberstellaView::playRom(LONG gameID)
goto exit; goto exit;
} }
if (!m_pGlobalData->bNoSound) if(!m_pGlobalData->bNoSound)
{ {
// SoundWin32* pSoundWin32 = static_cast<SoundWin32*>( pSound );
// 060499: Pass pwnd->GetHWND() in instead of hwnd as some systems
// will not play sound if this isn't set to the active window
//
SoundWin32* pSoundWin32 = static_cast<SoundWin32*>( pSound ); hr = pSoundWin32->Initialize(*pwnd);
if(FAILED(hr))
hr = pSoundWin32->Initialize( *pwnd ); {
if ( FAILED(hr) ) TRACE( "Sndwin32 Initialize failed, err = %X", hr );
{ }
TRACE( "Sndwin32 Initialize failed, err = %X", hr );
goto exit;
}
} }
::ShowWindow( *this, SW_HIDE ); ::ShowWindow( *this, SW_HIDE );
@ -502,7 +400,9 @@ exit:
delete pwnd; delete pwnd;
delete pConsole; delete pConsole;
delete pSound; delete pSound;
if (pImage) delete pImage;
if(pImage)
delete pImage;
EnableWindow(TRUE); EnableWindow(TRUE);

View File

@ -11,6 +11,8 @@
#include "GlobalData.hxx" #include "GlobalData.hxx"
#include "PropsSet.hxx" #include "PropsSet.hxx"
#include "Sound.hxx"
#include "SettingsWin32.hxx"
#include "GameList.h" #include "GameList.h"
class CCyberstellaView : public CFormView class CCyberstellaView : public CFormView
@ -60,10 +62,6 @@ protected:
afx_msg void OnConfig(); afx_msg void OnConfig();
afx_msg void OnPlay(); afx_msg void OnPlay();
afx_msg void OnDestroy(); afx_msg void OnDestroy();
afx_msg void OnGunfight();
afx_msg void OnJammed();
afx_msg void OnQb();
afx_msg void OnThrust();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
@ -78,6 +76,8 @@ private:
// members // members
PropertiesSet* m_pPropertiesSet; PropertiesSet* m_pPropertiesSet;
Sound* pSound;
SettingsWin32* pSettings;
bool m_bIsPause; bool m_bIsPause;
}; };

View File

@ -1,18 +1,32 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/01/2000 // 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
// //
#ifndef DIRECTIN_H // Copyright (c) 1995-1999 by Bradford W. Mott
#define DIRECTIN_H //
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DirectInput.hxx,v 1.2 2003-09-21 14:33:34 stephena Exp $
//============================================================================
#ifndef DIRECT_INPUT_HXX
#define DIRECT_INPUT_HXX
class CDirectInput class CDirectInput
{ {
public: public:
CDirectInput( HWND hwnd, DWORD dwDevType, int nButtonCount ); CDirectInput( HWND hwnd, DWORD dwDevType, int nButtonCount );
virtual ~CDirectInput( ); virtual ~CDirectInput( );
virtual HRESULT Initialize( void ); public:
virtual HRESULT Initialize( void );
virtual HRESULT Update( void ) = 0; virtual HRESULT Update( void ) = 0;

View File

@ -2,6 +2,8 @@
// StellaX // StellaX
// Jeff Miller 05/12/2000 // Jeff Miller 05/12/2000
// //
#define STRICT
#include "pch.hxx" #include "pch.hxx"
#include "DirectXFullScreen.hxx" #include "DirectXFullScreen.hxx"
#include "resource.h" #include "resource.h"
@ -10,7 +12,9 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "Event.hxx" #include "EventHandler.hxx"
#include "StellaEvent.hxx"
#include "Sound.hxx"
#include "MediaSrc.hxx" #include "MediaSrc.hxx"
/* /*
@ -30,14 +34,14 @@ LPCTSTR CDirectXFullScreen::pszClassName = _T("StellaXClass");
CDirectXFullScreen::CDirectXFullScreen( CDirectXFullScreen::CDirectXFullScreen(
const CGlobalData* rGlobalData, const CGlobalData* rGlobalData,
const Console* pConsole, const Console* pConsole,
Event& rEvent Sound* pSound
) : \ ) : \
m_rGlobalData( rGlobalData ), m_rGlobalData( rGlobalData ),
m_pConsole( pConsole ), m_pConsole( pConsole ),
m_rEvent( rEvent ), m_pSound( pSound ),
m_fInitialized( FALSE ), m_fInitialized( FALSE ),
m_hwnd( NULL ), m_hwnd( NULL ),
m_piDD( NULL ), m_piDD( NULL ),
m_piDDSPrimary( NULL ), m_piDDSPrimary( NULL ),
@ -635,6 +639,9 @@ DWORD CDirectXFullScreen::Run(
break; break;
} }
// FIXME - clean up this logic here, make it more like main in mainSDL
m_pSound->updateSound(rMediaSource);
// //
// Check for keyboard, mouse, joystick input // Check for keyboard, mouse, joystick input
// //
@ -695,108 +702,101 @@ DWORD CDirectXFullScreen::Run(
return msg.wParam; return msg.wParam;
} }
// FIXME - Event handling should be stripped out of this class
// This class should only be a Display class, similar to DisplaySDL
// or DisplayX11
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Event Handling // Event Handling
// VK_* is defined in winuser.h // VK_* is defined in winuser.h
struct KeyEventStruct struct KeyEventStruct
{ {
int nVirtKey; int nVirtKey;
int nAsyncVirtKey; int nAsyncVirtKey;
Event::Type eventCode; StellaEvent::KeyCode keyCode;
}; };
static KeyEventStruct KeyEventMap[] = static KeyEventStruct KeyEventMap[] =
{ {
/* -------------------------------------------------------------------- */ { DIK_F1, VK_F1, StellaEvent::KCODE_F1 },
/* left keypad */ { DIK_F2, VK_F2, StellaEvent::KCODE_F2 },
{ DIK_F3, VK_F3, StellaEvent::KCODE_F3 },
{ DIK_F4, VK_F4, StellaEvent::KCODE_F4 },
{ DIK_F5, VK_F5, StellaEvent::KCODE_F5 },
{ DIK_F6, VK_F6, StellaEvent::KCODE_F6 },
{ DIK_F7, VK_F7, StellaEvent::KCODE_F7 },
{ DIK_F8, VK_F8, StellaEvent::KCODE_F8 },
{ DIK_F9, VK_F9, StellaEvent::KCODE_F9 },
{ DIK_F10, VK_F10, StellaEvent::KCODE_F10 },
{ DIK_F11, VK_F11, StellaEvent::KCODE_F11 },
{ DIK_F12, VK_F12, StellaEvent::KCODE_F12 },
{ DIK_1, '1', Event::KeyboardZero1 }, { DIK_UP, VK_UP, StellaEvent::KCODE_UP },
{ DIK_2, '2', Event::KeyboardZero2 }, { DIK_DOWN, VK_DOWN, StellaEvent::KCODE_DOWN },
{ DIK_3, '3', Event::KeyboardZero3 }, { DIK_LEFT, VK_LEFT, StellaEvent::KCODE_LEFT },
{ DIK_Q, 'Q', Event::KeyboardZero4 }, { DIK_RIGHT, VK_RIGHT, StellaEvent::KCODE_RIGHT },
{ DIK_W, 'W', Event::KeyboardZero5 }, { DIK_SPACE, VK_SPACE, StellaEvent::KCODE_SPACE },
{ DIK_E, 'E', Event::KeyboardZero6 }, { DIK_LCONTROL, VK_CONTROL, StellaEvent::KCODE_CTRL },
{ DIK_A, 'A', Event::KeyboardZero7 }, { DIK_RCONTROL, VK_CONTROL, StellaEvent::KCODE_CTRL },
{ DIK_S, 'S', Event::KeyboardZero8 }, // FIXME
{ DIK_D, 'D', Event::KeyboardZero9 }, // { SDLK_LALT, StellaEvent::KCODE_ALT },
{ DIK_Z, 'Z', Event::KeyboardZeroStar }, // { SDLK_RALT, StellaEvent::KCODE_ALT },
{ DIK_X, 'X', Event::KeyboardZero0 },
{ DIK_C, 'C', Event::KeyboardZeroPound },
/* -------------------------------------------------------------------- */ { DIK_A, 'A', StellaEvent::KCODE_a },
/* right keypad */ { DIK_B, 'B', StellaEvent::KCODE_b },
{ DIK_C, 'C', StellaEvent::KCODE_c },
{ DIK_D, 'D', StellaEvent::KCODE_d },
{ DIK_E, 'E', StellaEvent::KCODE_e },
{ DIK_F, 'F', StellaEvent::KCODE_f },
{ DIK_G, 'G', StellaEvent::KCODE_g },
{ DIK_H, 'H', StellaEvent::KCODE_h },
{ DIK_I, 'I', StellaEvent::KCODE_i },
{ DIK_J, 'J', StellaEvent::KCODE_j },
{ DIK_K, 'K', StellaEvent::KCODE_k },
{ DIK_L, 'L', StellaEvent::KCODE_l },
{ DIK_M, 'M', StellaEvent::KCODE_m },
{ DIK_N, 'N', StellaEvent::KCODE_n },
{ DIK_O, 'O', StellaEvent::KCODE_o },
{ DIK_P, 'P', StellaEvent::KCODE_p },
{ DIK_Q, 'Q', StellaEvent::KCODE_q },
{ DIK_R, 'R', StellaEvent::KCODE_r },
{ DIK_S, 'S', StellaEvent::KCODE_s },
{ DIK_T, 'T', StellaEvent::KCODE_t },
{ DIK_U, 'U', StellaEvent::KCODE_u },
{ DIK_V, 'V', StellaEvent::KCODE_v },
{ DIK_W, 'W', StellaEvent::KCODE_w },
{ DIK_X, 'X', StellaEvent::KCODE_x },
{ DIK_Y, 'Y', StellaEvent::KCODE_y },
{ DIK_Z, 'Z', StellaEvent::KCODE_z },
{ DIK_8, '8', Event::KeyboardOne1 }, { DIK_0, '0', StellaEvent::KCODE_0 },
{ DIK_9, '9', Event::KeyboardOne2 }, { DIK_1, '1', StellaEvent::KCODE_1 },
{ DIK_0, '0', Event::KeyboardOne3 }, { DIK_2, '2', StellaEvent::KCODE_2 },
{ DIK_I, 'I', Event::KeyboardOne4 }, { DIK_3, '3', StellaEvent::KCODE_3 },
{ DIK_O, 'O', Event::KeyboardOne5 }, { DIK_4, '4', StellaEvent::KCODE_4 },
{ DIK_P, 'P', Event::KeyboardOne6 }, { DIK_5, '5', StellaEvent::KCODE_5 },
{ DIK_K, 'K', Event::KeyboardOne7 }, { DIK_6, '6', StellaEvent::KCODE_6 },
{ DIK_L, 'L', Event::KeyboardOne8 }, { DIK_7, '7', StellaEvent::KCODE_7 },
{ DIK_SEMICOLON,';', Event::KeyboardOne9 }, { DIK_8, '8', StellaEvent::KCODE_8 },
{ DIK_COMMA, ',', Event::KeyboardOneStar }, { DIK_9, '9', StellaEvent::KCODE_9 },
{ DIK_PERIOD, '.', Event::KeyboardOne0 },
{ DIK_SLASH, '/', Event::KeyboardOnePound },
/* -------------------------------------------------------------------- */ // FIXME - add keypad codes here ...
/* left joystick */
{ DIK_DOWN, VK_DOWN, Event::JoystickZeroDown }, // FIXME - get rest of codes ...
{ DIK_UP, VK_UP, Event::JoystickZeroUp }, // { SDLK_BACKSPACE, StellaEvent::KCODE_BACKSPACE },
{ DIK_LEFT, VK_LEFT, Event::JoystickZeroLeft }, { DIK_TAB, VK_TAB, StellaEvent::KCODE_TAB },
{ DIK_RIGHT, VK_RIGHT, Event::JoystickZeroRight }, // { SDLK_RETURN, StellaEvent::KCODE_RETURN },
{ DIK_SPACE, VK_SPACE, Event::JoystickZeroFire }, // { SDLK_PAUSE, StellaEvent::KCODE_PAUSE },
// { SDLK_ESCAPE, StellaEvent::KCODE_ESCAPE },
/* left joystick (alt.) */ { DIK_COMMA, ',', StellaEvent::KCODE_COMMA },
{ DIK_PERIOD, '.', StellaEvent::KCODE_PERIOD },
{ DIK_W, 'W', Event::JoystickZeroUp }, { DIK_SLASH, '/', StellaEvent::KCODE_SLASH },
{ DIK_S, 'S', Event::JoystickZeroDown }, // { SDLK_BACKSLASH, StellaEvent::KCODE_BACKSLASH },
{ DIK_A, 'A', Event::JoystickZeroLeft }, { DIK_SEMICOLON,';', StellaEvent::KCODE_SEMICOLON }
{ DIK_D, 'D', Event::JoystickZeroRight }, // { SDLK_QUOTE, StellaEvent::KCODE_QUOTE },
{ DIK_TAB, VK_TAB, Event::JoystickZeroFire }, // { SDLK_BACKQUOTE, StellaEvent::KCODE_BACKQUOTE },
// { SDLK_LEFTBRACKET, StellaEvent::KCODE_LEFTBRACKET},
/* I added this one (for my powerramp joystick) */ // { SDLK_RIGHTBRACKET,StellaEvent::KCODE_RIGHTBRACKET}
{ DIK_LCONTROL, VK_CONTROL, Event::JoystickZeroFire },
/* left joystick booster-grip */
{ DIK_Z, 'Z', Event::BoosterGripZeroTrigger },
{ DIK_X, 'X', Event::BoosterGripZeroBooster },
/* left joystick booster-grip (alt.) */
{ DIK_1, '1', Event::BoosterGripZeroTrigger },
{ DIK_2, '2', Event::BoosterGripZeroBooster },
/* -------------------------------------------------------------------- */
/* right joystick */
{ DIK_L, 'L', Event::JoystickOneDown },
{ DIK_O, 'O', Event::JoystickOneUp },
{ DIK_K, 'K', Event::JoystickOneLeft },
{ DIK_SEMICOLON,';', Event::JoystickOneRight },
{ DIK_J, 'J', Event::JoystickOneFire },
/* right joystick booster-grip */
{ DIK_N, 'N', Event::BoosterGripOneTrigger },
{ DIK_M, 'M', Event::BoosterGripOneBooster },
/* -------------------------------------------------------------------- */
/* console controls */
{ DIK_F1, VK_F1, Event::ConsoleSelect },
{ DIK_F2, VK_F2, Event::ConsoleReset },
{ DIK_F3, VK_F3, Event::ConsoleColor },
{ DIK_F4, VK_F4, Event::ConsoleBlackWhite },
{ DIK_F5, VK_F5, Event::ConsoleLeftDifficultyA },
{ DIK_F6, VK_F6, Event::ConsoleLeftDifficultyB },
{ DIK_F7, VK_F7, Event::ConsoleRightDifficultyA },
{ DIK_F8, VK_F8, Event::ConsoleRightDifficultyB }
}; };
void CDirectXFullScreen::UpdateEvents( void CDirectXFullScreen::UpdateEvents(
@ -808,9 +808,9 @@ void CDirectXFullScreen::UpdateEvents(
// and I don't want to undo a set i may have done earlier in the loop // and I don't want to undo a set i may have done earlier in the loop
// //
const int nEventCount = Event::LastType; const int nSize = _countof(KeyEventMap);
long rgEventState[ nEventCount ]; // long rgKeyEventState[ nSize ];
ZeroMemory( rgEventState, nEventCount * sizeof(long) ); // ZeroMemory( rgKeyEventState, nSize * sizeof(StellaEvent::KeyCode) );
int i; int i;
@ -820,25 +820,20 @@ void CDirectXFullScreen::UpdateEvents(
if (m_pDirectKeyboard->Update() == S_OK) if (m_pDirectKeyboard->Update() == S_OK)
{ {
int nSize = _countof(KeyEventMap);
for (i = 0; i < nSize; ++i) for (i = 0; i < nSize; ++i)
{ {
rgEventState[KeyEventMap[i].eventCode] |= int state = (m_pDirectKeyboard->IsButtonPressed(KeyEventMap[i].nVirtKey)) ? 1 : 0;
m_pDirectKeyboard->IsButtonPressed(KeyEventMap[i].nVirtKey); m_pConsole->eventHandler().sendKeyEvent(KeyEventMap[i].keyCode, state);
} }
} }
else else
{ {
// Fallback -- if Keyboard update failed (most likely due to // Fallback -- if Keyboard update failed (most likely due to
// DirectInput not being available), then use the old async // DirectInput not being available), then use the old async
int nSize = _countof(KeyEventMap);
for (i = 0; i < nSize; ++i) for (i = 0; i < nSize; ++i)
{ {
rgEventState[KeyEventMap[i].eventCode] |= int state = (::GetAsyncKeyState(KeyEventMap[i].nAsyncVirtKey)) ? 1 : 0;
(::GetAsyncKeyState(KeyEventMap[i].nAsyncVirtKey) ? 1: 0); m_pConsole->eventHandler().sendKeyEvent(KeyEventMap[i].keyCode, state);
} }
} }
@ -846,6 +841,7 @@ void CDirectXFullScreen::UpdateEvents(
// Update joystick // Update joystick
// //
/* FIXME - add multiple joysticks
if (m_pDirectJoystick->Update() == S_OK) if (m_pDirectJoystick->Update() == S_OK)
{ {
rgEventState[Event::JoystickZeroFire] |= rgEventState[Event::JoystickZeroFire] |=
@ -871,7 +867,7 @@ void CDirectXFullScreen::UpdateEvents(
{ {
rgEventState[Event::JoystickZeroDown] = 1; rgEventState[Event::JoystickZeroDown] = 1;
} }
} } */
// //
// Update mouse // Update mouse
@ -886,19 +882,19 @@ void CDirectXFullScreen::UpdateEvents(
// Mouse resistance is measured between 0...1000000 // Mouse resistance is measured between 0...1000000
rgEventState[ m_rGlobalData->PaddleResistanceEvent() ] = (999-x)*1000; // rgEventState[ m_rGlobalData->PaddleResistanceEvent() ] = (999-x)*1000;
rgEventState[ m_rGlobalData->PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0); // rgEventState[ m_rGlobalData->PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0);
} }
// //
// Write new event state // Write new event state
// //
for (i = 0; i < nEventCount; ++i) // for (i = 0; i < nEventCount; ++i)
{ // {
m_rEvent.set( (Event::Type)i, rgEventState[i] ); // m_rEvent.set( (Event::Type)i, rgEventState[i] );
} // }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -8,6 +8,7 @@
class Console; class Console;
class MediaSource; class MediaSource;
class Sound;
class CDirectInput; class CDirectInput;
@ -16,12 +17,10 @@ class CDirectInput;
class CDirectXFullScreen class CDirectXFullScreen
{ {
public: public:
CDirectXFullScreen(const CGlobalData* rGlobalData, const Console* pConsole,
CDirectXFullScreen( const CGlobalData* rGlobalData, Sound* pSound);
const Console* pConsole, ~CDirectXFullScreen();
Event& rEvent );
~CDirectXFullScreen();
HRESULT Initialize( int cx = 0, int cy = 0 ); HRESULT Initialize( int cx = 0, int cy = 0 );
@ -55,10 +54,9 @@ private:
// Stella objects // Stella objects
const Console* m_pConsole; const Console* m_pConsole;
Event& m_rEvent; const CGlobalData* m_rGlobalData;
Sound* m_pSound;
const CGlobalData* m_rGlobalData;
SIZE m_sizeGame; SIZE m_sizeGame;
BYTE m_rgbPixelDataTable[256]; BYTE m_rgbPixelDataTable[256];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
//============================================================================
//
// 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: SettingsWin32.cxx,v 1.1 2003-09-21 14:33:34 stephena Exp $
//============================================================================
#include "bspf.hxx"
#include "SettingsWin32.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsWin32::SettingsWin32()
{
mySettingsInputFilename = "stellarc";
mySettingsOutputFilename = "stellarc";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsWin32::~SettingsWin32()
{
cerr << "SettingsWin32::~SettingsWin32()\n";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SettingsWin32::setArgument(string& key, string& value)
{
cerr << "SettingsWin32::setArgument()\n";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsWin32::getArguments()
{
cerr << "SettingsWin32::getArguments()\n";
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsWin32::stateFilename(uInt32 state)
{
cerr << "SettingsWin32::stateFilename()\n";
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsWin32::snapshotFilename()
{
cerr << "SettingsWin32::snapshotFilename()\n";
return "";
}

View File

@ -0,0 +1,38 @@
//============================================================================
//
// 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: SettingsWin32.hxx,v 1.1 2003-09-21 14:33:34 stephena Exp $
//============================================================================
#ifndef SETTINGS_WIN32_HXX
#define SETTINGS_WIN32_HXX
#include "bspf.hxx"
#include "Settings.hxx"
class SettingsWin32 : public Settings
{
public:
SettingsWin32();
virtual ~SettingsWin32();
public:
virtual void setArgument(string& key, string& value);
virtual string getArguments();
virtual string stateFilename(uInt32 state);
virtual string snapshotFilename();
};
#endif

View File

@ -1,173 +1,162 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 04/26/2000 // 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
// //
#include "pch.hxx" // 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: SoundWin32.cxx,v 1.2 2003-09-21 14:33:34 stephena Exp $
//============================================================================
#include <assert.h>
#include <dsound.h>
#include "bspf.hxx"
#include "MediaSrc.hxx"
#include "SoundWin32.hxx" #include "SoundWin32.hxx"
#include "resource.h"
#include "AudioStream.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundWin32::SoundWin32()
SoundWin32::SoundWin32( : myIsInitializedFlag(false),
) : myBufferSize(512),
m_fInitialized( FALSE ), mySampleRate(31400),
m_pass( NULL ), myDSBuffer(NULL)
m_pasCurrent( NULL )
{ {
TRACE("SoundWin32::SoundWin32"); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundWin32::~SoundWin32()
{
closeDevice();
} }
HRESULT SoundWin32::Initialize( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd HRESULT SoundWin32::Initialize(HWND hWnd)
)
{ {
TRACE( "SoundWin32::Initialize hwnd=%08X", hwnd ); HRESULT hr;
if ( m_fInitialized )
{
TRACE( "SoundWin32::Initialize - already initialized" );
return S_OK;
}
HRESULT hr = S_OK;
m_pass = new AudioStreamServices;
if ( m_pass == NULL )
{
hr = E_OUTOFMEMORY;
goto cleanup;
}
if ( ! m_pass->Initialize( hwnd ) )
{
TRACE( "ASS Initialize failed" );
MessageBox( (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE ),
hwnd,
IDS_ASS_FAILED );
hr = E_FAIL;
goto cleanup;
}
m_pasCurrent = new AudioStream;
if ( m_pasCurrent == NULL )
{
hr = E_OUTOFMEMORY;
goto cleanup;
}
if ( ! m_pasCurrent->Create( m_pass ) )
{
TRACE( "PAS Create failed" );
MessageBox( (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE ),
hwnd,
IDS_PAS_FAILED );
hr = E_FAIL;
goto cleanup;
}
m_pasCurrent->Play();
m_fInitialized = TRUE;
cleanup:
if ( FAILED(hr) )
{
if ( m_pasCurrent )
{
m_pasCurrent->Destroy();
delete m_pasCurrent;
m_pasCurrent = NULL;
}
if ( m_pass )
{
delete m_pass;
m_pass = NULL;
}
}
// Create IDirectSound using the primary sound device
if( FAILED( hr = DirectSoundCreate8( NULL, &myDSDevice, NULL ) ) )
{
SoundError("DirectSoundCreate8");
return hr; return hr;
}
// Set DirectSound coop level
if( FAILED(hr = myDSDevice->SetCooperativeLevel(hWnd, DSSCL_PRIORITY)) )
{
SoundError("SetCooperativeLevel");
return hr;
}
// Set up the static sound buffer
WAVEFORMATEX wfx;
DSBUFFERDESC dsbdesc;
ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = 1;
wfx.nSamplesPerSec = mySampleRate;
wfx.wBitsPerSample = 8;
wfx.nBlockAlign = 1; //wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
ZeroMemory(&dsbdesc, sizeof(dsbdesc));
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME;
dsbdesc.dwBufferBytes = myBufferSize;
dsbdesc.lpwfxFormat = &wfx;
hr = myDSDevice->CreateSoundBuffer(&dsbdesc, &myDSBuffer, NULL);
if(SUCCEEDED(hr))
myIsInitializedFlag = true;
return hr;
} }
SoundWin32::~SoundWin32( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
) void SoundWin32::closeDevice()
{ {
TRACE("SoundWin32::~SoundWin32");
if ( m_pasCurrent )
{
m_pasCurrent->Destroy();
delete m_pasCurrent;
m_pasCurrent = NULL;
}
delete m_pass;
m_pass = NULL;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::set(Sound::Register reg, uInt8 value) uInt32 SoundWin32::getSampleRate() const
{ {
if ( ! m_fInitialized ) return myIsInitializedFlag ? mySampleRate : 0;
{
TRACE( "SoundWin32::set -- not initialized" );
return;
}
//
// Process TIA data
//
switch( reg )
{
case AUDC0:
Update_tia_sound( 0x15, value );
break;
case AUDC1:
Update_tia_sound( 0x16, value );
break;
case AUDF0:
Update_tia_sound( 0x17, value );
break;
case AUDF1:
Update_tia_sound( 0x18, value );
break;
case AUDV0:
Update_tia_sound( 0x19, value );
break;
case AUDV1:
Update_tia_sound( 0x1A, value );
break;
}
} }
void SoundWin32::mute( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool mute bool SoundWin32::isSuccessfullyInitialized() const
)
{ {
if ( ! m_fInitialized ) return myIsInitializedFlag;
{
TRACE( "SoundWin32::mute -- not initialized" );
return;
}
if ( m_pasCurrent )
{
if ( mute )
{
m_pasCurrent->Stop();
}
else
{
m_pasCurrent->Play();
}
}
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::setSoundVolume(Int32 percent)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::updateSound(MediaSource& mediaSource)
{
if(myIsInitializedFlag)
{
HRESULT hr;
uInt8 periodCount = 0;
uInt8* buffer = new uInt8[myBufferSize];
// Dequeue samples as long as full fragments are available
while(mediaSource.numberOfAudioSamples() >= myBufferSize)
{
mediaSource.dequeueAudioSamples(buffer, myBufferSize);
LPVOID lpvWrite;
DWORD dwLength;
hr = myDSBuffer->Lock(0, 0, &lpvWrite, &dwLength, NULL, NULL, DSBLOCK_ENTIREBUFFER);
if(hr == DS_OK)
{
memcpy(lpvWrite, buffer, dwLength);
myDSBuffer->Unlock(lpvWrite, dwLength, NULL, 0);
myDSBuffer->SetCurrentPosition(0);
myDSBuffer->Play(0, 0, 0);
periodCount++;
}
}
delete[] buffer;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::SoundError(const char* message)
{
cout << "ERROR in SOUND: " << message << endl;
myIsInitializedFlag = false;
}
/* // Fill any unused fragments with silence so that we have a lower
// risk of having playback underruns
for(int i = 0; i < 1-periodCount; ++i)
{
frames = snd_pcm_avail_update(myPcmHandle);
if (frames > 0)
{
uInt8 buffer[frames];
memset((void*)buffer, 0, frames);
snd_pcm_writei(myPcmHandle, buffer, frames);
}
else if(frames == -EPIPE) // this should never happen
{
cerr << "EPIPE after write\n";
break;
}
}*/

View File

@ -1,109 +1,117 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/01/2000 // 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
// //
#ifndef SNDWIN32_H // Copyright (c) 1995-2002 by Bradford W. Mott
#define SNDWIN32_H //
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SoundWin32.hxx,v 1.2 2003-09-21 14:33:34 stephena Exp $
//============================================================================
#ifndef SOUND_WIN32_HXX
#define SOUND_WIN32_HXX
#include <dsound.h>
#include "bspf.hxx" #include "bspf.hxx"
#include "MediaSrc.hxx"
#include "Sound.hxx" #include "Sound.hxx"
#include "TIASound.h"
/**
This class implements a sound class using the
Win32 DirectSound API.
class AudioStreamServices; @author Stephen Anthony
class AudioStream; @version $Id: SoundWin32.hxx,v 1.2 2003-09-21 14:33:34 stephena Exp $
*/
#define SAMPLES_PER_SEC 22050
#define NUM_CHANNELS 1
#define BITS_PER_SAMPLE 8
class WaveFile
{
public:
WaveFile( void )
{
ZeroMemory( &wfx, sizeof(wfx) );
wfx.cbSize = sizeof( wfx );
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = NUM_CHANNELS;
wfx.nSamplesPerSec = SAMPLES_PER_SEC;
wfx.wBitsPerSample = BITS_PER_SAMPLE;
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
}
~WaveFile( void )
{
}
BOOL Open( void )
{
Tia_sound_init( 31400, wfx.nSamplesPerSec );
return TRUE;
}
BOOL Cue( void )
{
return TRUE;
}
void Read( BYTE* pbDest, UINT cbSize )
{
Tia_process ( pbDest, cbSize );
}
UINT GetAvgDataRate (void)
{
return wfx.nAvgBytesPerSec;
}
BYTE GetSilenceData (void)
{
return 0;
}
WAVEFORMATEX* GetWaveFormatEx( void )
{
return &wfx;
}
private:
WAVEFORMATEX wfx;
WaveFile( const WaveFile& ); // no implementation
void operator=( const WaveFile& ); // no implementation
};
class SoundWin32 : public Sound class SoundWin32 : public Sound
{ {
public: public:
/**
Create a new sound object
*/
SoundWin32();
SoundWin32(); /**
virtual ~SoundWin32(); Destructor
*/
virtual ~SoundWin32();
HRESULT Initialize( HWND hwnd ); public:
/**
// Closes the sound device
// base class virtuals */
// void closeDevice();
virtual void set(Sound::Register reg, uInt8 value); /**
Return the playback sample rate for the sound device.
virtual void mute( bool state ); @return The playback sample rate
*/
private: uInt32 getSampleRate() const;
BOOL m_fInitialized; /**
Return true iff the sound device was successfully initlaized.
AudioStreamServices* m_pass; @return true iff the sound device was successfully initlaized.
AudioStream* m_pasCurrent; */
bool isSuccessfullyInitialized() const;
SoundWin32( const SoundWin32& ); // no implementation /**
void operator=( const SoundWin32& ); // no implementation Sets the volume of the sound device to the specified level. The
volume is given as a percentage from 0 to 100. A -1 indicates
that the volume shouldn't be changed at all.
@param percent The new volume percentage level for the sound device
*/
void setSoundVolume(Int32 percent);
/**
Update the sound device using the audio sample from the specified
media source.
@param mediaSource The media source to get audio samples from.
*/
void updateSound(MediaSource& mediaSource);
/**
Initialize the DirectSound subsystem/
@return The result of initialization.
*/
HRESULT Initialize(HWND hwnd);
private:
// Print error messages and clean up
void SoundError(const char* message);
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
// DirectSound device
LPDIRECTSOUND8 myDSDevice;
// DirectSound secondary buffer
LPDIRECTSOUNDBUFFER myDSBuffer;
// Mixer file descriptor
int myMixerFd;
// Original mixer volume when the sound device was opened
int myOriginalVolume;
// PCM buffer size
uInt32 myBufferSize;
// DSP sample rate
uInt32 mySampleRate;
}; };
#endif #endif

View File

@ -40,12 +40,12 @@
#define IDS_ROM_LOAD_FAILED 304 #define IDS_ROM_LOAD_FAILED 304
#define IDS_NO_ITEM_SELECTED 305 #define IDS_NO_ITEM_SELECTED 305
#define IDC_CONTINUE 1000 #define IDC_CONTINUE 1000
#define IDC_EMAIL_JEFFMILL 1002 #define IDC_EMAIL_MAINTAINER 1002
#define IDC_EMAIL_STELLA 1003 #define IDC_EMAIL_STELLA 1003
#define IDC_PLAY 1005 #define IDC_PLAY 1005
#define IDC_ROMCOUNT 1006 #define IDC_ROMCOUNT 1006
#define IDC_ROMLIST 1007 #define IDC_ROMLIST 1007
#define IDC_WEB_JEFFMILL 1010 #define IDC_WEB_MAINTAINER 1010
#define IDC_WEB_STELLA 1011 #define IDC_WEB_STELLA 1011
#define IDC_ROMPATH 1013 #define IDC_ROMPATH 1013
#define IDC_CONFIG 1015 #define IDC_CONFIG 1015