mirror of https://github.com/stella-emu/stella.git
Removed most of the Registry stuff and replaced it with
references to SettingsWin32. Made many changes to FrameBufferWin32, cleaned up the code and renamed variables. I may only release fullscreen mode for version 1.4, so I decided to clean it up a bit. Enabled SettingsWin32 code. Now you can save/load state files. Reorganized the base Settings class a bit. It had a dependency on a Console being created when it shouldn't have. As a result, any changes made to event remappings won't be saved. I'll fix it tomorrow; time for sleep ... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@218 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
0058d868a4
commit
6aef328c60
|
@ -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: Settings.cxx,v 1.12 2003-11-17 17:43:39 stephena Exp $
|
// $Id: Settings.cxx,v 1.13 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -141,8 +141,9 @@ bool Settings::loadCommandLine(Int32 argc, char** argv)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Settings::saveConfig()
|
void Settings::saveConfig()
|
||||||
{
|
{
|
||||||
if(!myConsole)
|
// if(!myConsole)
|
||||||
return;
|
// return;
|
||||||
|
// FIXME - there should not be a dependency on Console
|
||||||
|
|
||||||
ofstream out(mySettingsOutputFilename.c_str());
|
ofstream out(mySettingsOutputFilename.c_str());
|
||||||
if(!out || !out.is_open())
|
if(!out || !out.is_open())
|
||||||
|
@ -152,8 +153,8 @@ void Settings::saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that any modifications to key remapping is saved
|
// Make sure that any modifications to key remapping is saved
|
||||||
set("keymap", myConsole->eventHandler().getKeymap());
|
// set("keymap", myConsole->eventHandler().getKeymap());
|
||||||
set("joymap", myConsole->eventHandler().getJoymap());
|
// set("joymap", myConsole->eventHandler().getJoymap());
|
||||||
|
|
||||||
out << "; Stella configuration file" << endl
|
out << "; Stella configuration file" << endl
|
||||||
<< ";" << endl
|
<< ";" << endl
|
||||||
|
@ -220,6 +221,42 @@ void Settings::set(const string& key, const string& value, bool save)
|
||||||
++mySize;
|
++mySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Settings::setInt(const string& key, const uInt32 value)
|
||||||
|
{
|
||||||
|
ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
|
||||||
|
set(key, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Settings::setFloat(const string& key, const float value)
|
||||||
|
{
|
||||||
|
ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
|
||||||
|
set(key, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Settings::setBool(const string& key, const bool value)
|
||||||
|
{
|
||||||
|
ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
|
||||||
|
set(key, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Settings::setString(const string& key, const string& value)
|
||||||
|
{
|
||||||
|
ostringstream stream;
|
||||||
|
stream << value;
|
||||||
|
|
||||||
|
set(key, stream.str());
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Int32 Settings::getInt(const string& key) const
|
Int32 Settings::getInt(const string& key) const
|
||||||
{
|
{
|
||||||
|
@ -237,7 +274,7 @@ float Settings::getFloat(const string& key) const
|
||||||
// Try to find the named setting and answer its value
|
// Try to find the named setting and answer its value
|
||||||
for(uInt32 i = 0; i < mySize; ++i)
|
for(uInt32 i = 0; i < mySize; ++i)
|
||||||
if(key == mySettings[i].key)
|
if(key == mySettings[i].key)
|
||||||
return atof(mySettings[i].value.c_str());
|
return (float) atof(mySettings[i].value.c_str());
|
||||||
|
|
||||||
return -1.0;
|
return -1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: Settings.hxx,v 1.10 2003-11-17 17:43:39 stephena Exp $
|
// $Id: Settings.hxx,v 1.11 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef SETTINGS_HXX
|
#ifndef SETTINGS_HXX
|
||||||
|
@ -32,7 +32,7 @@ class Console;
|
||||||
This class provides an interface for accessing frontend specific settings.
|
This class provides an interface for accessing frontend specific settings.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Settings.hxx,v 1.10 2003-11-17 17:43:39 stephena Exp $
|
@version $Id: Settings.hxx,v 1.11 2003-11-24 01:14:38 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,34 @@ class Settings
|
||||||
@param value The value to assign to the setting
|
@param value The value to assign to the setting
|
||||||
@param save Whether this setting should be saved to the rc-file.
|
@param save Whether this setting should be saved to the rc-file.
|
||||||
*/
|
*/
|
||||||
void set(const string& key, const string& value, bool save = true);
|
void setInt(const string& key, const uInt32 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the value associated with key to the given value.
|
||||||
|
|
||||||
|
@param key The key of the setting
|
||||||
|
@param value The value to assign to the setting
|
||||||
|
@param save Whether this setting should be saved to the rc-file.
|
||||||
|
*/
|
||||||
|
void setFloat(const string& key, const float value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the value associated with key to the given value.
|
||||||
|
|
||||||
|
@param key The key of the setting
|
||||||
|
@param value The value to assign to the setting
|
||||||
|
@param save Whether this setting should be saved to the rc-file.
|
||||||
|
*/
|
||||||
|
void setBool(const string& key, const bool value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set the value associated with key to the given value.
|
||||||
|
|
||||||
|
@param key The key of the setting
|
||||||
|
@param value The value to assign to the setting
|
||||||
|
@param save Whether this setting should be saved to the rc-file.
|
||||||
|
*/
|
||||||
|
void setString(const string& key, const string& value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -187,6 +214,8 @@ class Settings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void set(const string& key, const string& value, bool save = true);
|
||||||
|
|
||||||
string myBaseDir;
|
string myBaseDir;
|
||||||
string myStateDir;
|
string myStateDir;
|
||||||
string myStateFile;
|
string myStateFile;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "Cyberstella.h"
|
#include "Cyberstella.h"
|
||||||
#include "AboutDlg.h"
|
#include "AboutDlg.h"
|
||||||
|
#include ".\aboutdlg.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
@ -55,7 +56,7 @@ BOOL AboutDlg::OnInitDialog()
|
||||||
m_hlMail_JSM.SetURL( _T("mailto:stephena@users.sourceforge.net?Subject=Cyberstella") );
|
m_hlMail_JSM.SetURL( _T("mailto:stephena@users.sourceforge.net?Subject=Cyberstella") );
|
||||||
|
|
||||||
m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_MAINTAINER, this);
|
m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_MAINTAINER, this);
|
||||||
m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
|
m_hlWWW_JSM.SetURL( _T("http://www.cs.mun.ca/~stephena") );
|
||||||
|
|
||||||
m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this);
|
m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this);
|
||||||
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
CHyperLink m_hlMail_Stella;
|
CHyperLink m_hlMail_Stella;
|
||||||
CHyperLink m_hlWWW_Stella;
|
CHyperLink m_hlWWW_Stella;
|
||||||
CHyperLink m_hlWWW_Mame;
|
CHyperLink m_hlWWW_Mame;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//Microsoft Developer Studio generated resource script.
|
// Microsoft Visual C++ generated resource script.
|
||||||
//
|
//
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
@ -27,18 +27,18 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||||
// TEXTINCLUDE
|
// TEXTINCLUDE
|
||||||
//
|
//
|
||||||
|
|
||||||
1 TEXTINCLUDE DISCARDABLE
|
1 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"resource.h\0"
|
"resource.h\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
2 TEXTINCLUDE DISCARDABLE
|
2 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#include ""afxres.h""\r\n"
|
"#include ""afxres.h""\r\n"
|
||||||
"\0"
|
"\0"
|
||||||
END
|
END
|
||||||
|
|
||||||
3 TEXTINCLUDE DISCARDABLE
|
3 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||||
|
@ -66,7 +66,7 @@ END
|
||||||
|
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_FOLDER ICON DISCARDABLE "res\\DIR.ICO"
|
IDI_FOLDER ICON "res\\DIR.ICO"
|
||||||
#endif // German (Germany) resources
|
#endif // German (Germany) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -87,21 +87,21 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDR_MAINFRAME ICON DISCARDABLE "res\\STELLA.ICO"
|
IDR_MAINFRAME ICON "res\\STELLA.ICO"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Bitmap
|
// Bitmap
|
||||||
//
|
//
|
||||||
|
|
||||||
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
|
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Toolbar
|
// Toolbar
|
||||||
//
|
//
|
||||||
|
|
||||||
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
|
IDR_MAINFRAME TOOLBAR 16, 15
|
||||||
BEGIN
|
BEGIN
|
||||||
BUTTON ID_APP_ABOUT
|
BUTTON ID_APP_ABOUT
|
||||||
BUTTON IDC_PLAY
|
BUTTON IDC_PLAY
|
||||||
|
@ -113,7 +113,7 @@ END
|
||||||
// Menu
|
// Menu
|
||||||
//
|
//
|
||||||
|
|
||||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
IDR_MAINFRAME MENU
|
||||||
BEGIN
|
BEGIN
|
||||||
POPUP "&File"
|
POPUP "&File"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -141,7 +141,7 @@ END
|
||||||
// Accelerator
|
// Accelerator
|
||||||
//
|
//
|
||||||
|
|
||||||
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
IDR_MAINFRAME ACCELERATORS
|
||||||
BEGIN
|
BEGIN
|
||||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
@ -165,7 +165,7 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
|
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
|
||||||
STYLE WS_CHILD
|
STYLE DS_SETFONT | WS_CHILD
|
||||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
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 |
|
||||||
|
@ -178,33 +178,34 @@ 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, 285, 128
|
IDD_ABOUTBOX DIALOGEX 0, 0, 322, 138
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||||
|
WS_SYSMENU
|
||||||
CAPTION "Information"
|
CAPTION "Information"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
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.",
|
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,21,266,26,SS_NOPREFIX
|
-1,7,21,295,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,271,8,SS_NOPREFIX
|
-1,7,58,308,8,SS_NOPREFIX
|
||||||
LTEXT "Stephen Anthony",-1,7,76,62,8,SS_NOPREFIX
|
LTEXT "Stephen Anthony",-1,7,76,62,8,SS_NOPREFIX
|
||||||
LTEXT "stephena@users.sourceforge.net",IDC_EMAIL_MAINTAINER,73,
|
LTEXT "stephena@users.sourceforge.net",IDC_EMAIL_MAINTAINER,73,
|
||||||
76,103,8,SS_NOPREFIX | SS_NOTIFY
|
76,103,8,SS_NOPREFIX | SS_NOTIFY
|
||||||
LTEXT "http://minbar.org",IDC_WEB_MAINTAINER,190,76,82,8,
|
LTEXT "http://www.cs.mun.ca/~stephena",IDC_WEB_MAINTAINER,188,
|
||||||
SS_NOPREFIX | SS_NOTIFY
|
76,112,8,SS_NOPREFIX | SS_NOTIFY
|
||||||
LTEXT "Stella dev team:",-1,7,89,52,8,SS_NOPREFIX
|
LTEXT "Stella dev team:",-1,7,89,52,8,SS_NOPREFIX
|
||||||
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
|
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
|
||||||
89,105,8,SS_NOPREFIX | SS_NOTIFY
|
89,105,8,SS_NOPREFIX | SS_NOTIFY
|
||||||
LTEXT "http://stella.sourceforge.net",IDC_WEB_STELLA,190,89,88,
|
LTEXT "http://stella.sourceforge.net",IDC_WEB_STELLA,188,89,93,
|
||||||
8,SS_NOPREFIX | SS_NOTIFY
|
8,SS_NOPREFIX | SS_NOTIFY
|
||||||
LTEXT "Cyberstella v1.4 is GPL software.",-1,7,7,271,9,
|
LTEXT "Cyberstella v1.4 is GPL software.",-1,7,7,308,9,
|
||||||
SS_NOPREFIX
|
SS_NOPREFIX
|
||||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,268,1
|
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,299,1
|
||||||
PUSHBUTTON "&Continue",IDC_CONTINUE,112,107,60,14
|
PUSHBUTTON "&Continue",IDC_CONTINUE,129,117,60,14,BS_CENTER
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 112
|
IDD_CONFIG_PAGE DIALOG 0, 0, 390, 112
|
||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Cyberstella Configuration"
|
CAPTION "Cyberstella Configuration"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -225,7 +226,6 @@ BEGIN
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
#ifndef _MAC
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Version
|
// Version
|
||||||
|
@ -248,18 +248,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904b0"
|
BLOCK "040904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "\0"
|
VALUE "FileDescription", "Cyberstella MFC Application"
|
||||||
VALUE "CompanyName", "\0"
|
VALUE "FileVersion", "1.4"
|
||||||
VALUE "FileDescription", "Cyberstella MFC Application\0"
|
VALUE "InternalName", "Cyberstella"
|
||||||
VALUE "FileVersion", "1.4\0"
|
VALUE "LegalCopyright", "Copyright (C) 2003"
|
||||||
VALUE "InternalName", "Cyberstella\0"
|
VALUE "OriginalFilename", "Cyberstella.EXE"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2003\0"
|
VALUE "ProductName", "Cyberstella Application"
|
||||||
VALUE "LegalTrademarks", "\0"
|
VALUE "ProductVersion", "1.4"
|
||||||
VALUE "OriginalFilename", "Cyberstella.EXE\0"
|
|
||||||
VALUE "PrivateBuild", "\0"
|
|
||||||
VALUE "ProductName", "Cyberstella Application\0"
|
|
||||||
VALUE "ProductVersion", "1.4\0"
|
|
||||||
VALUE "SpecialBuild", "\0"
|
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@ -268,8 +263,6 @@ BEGIN
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // !_MAC
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -277,7 +270,7 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
GUIDELINES DESIGNINFO DISCARDABLE
|
GUIDELINES DESIGNINFO
|
||||||
BEGIN
|
BEGIN
|
||||||
IDD_CYBERSTELLA_FORM, DIALOG
|
IDD_CYBERSTELLA_FORM, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -290,9 +283,9 @@ BEGIN
|
||||||
IDD_ABOUTBOX, DIALOG
|
IDD_ABOUTBOX, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 7
|
LEFTMARGIN, 7
|
||||||
RIGHTMARGIN, 278
|
RIGHTMARGIN, 315
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 121
|
BOTTOMMARGIN, 131
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_CONFIG_PAGE, DIALOG
|
IDD_CONFIG_PAGE, DIALOG
|
||||||
|
@ -311,18 +304,18 @@ END
|
||||||
// String Table
|
// String Table
|
||||||
//
|
//
|
||||||
|
|
||||||
STRINGTABLE PRELOAD DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDR_MAINFRAME "Cyberstella\n\nCybers\n\n\nCyberstella.Document\nCybers Document"
|
IDR_MAINFRAME "Cyberstella\n\nCybers\n\n\nCyberstella.Document\nCybers Document"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE PRELOAD DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
AFX_IDS_APP_TITLE "Cyberstella"
|
AFX_IDS_APP_TITLE "Cyberstella"
|
||||||
AFX_IDS_IDLEMESSAGE "Ready"
|
AFX_IDS_IDLEMESSAGE "Ready"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_INDICATOR_EXT "EXT"
|
ID_INDICATOR_EXT "EXT"
|
||||||
ID_INDICATOR_CAPS "CAP"
|
ID_INDICATOR_CAPS "CAP"
|
||||||
|
@ -332,7 +325,7 @@ BEGIN
|
||||||
ID_INDICATOR_REC "REC"
|
ID_INDICATOR_REC "REC"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_FILE_NEW "Create a new document\nNew"
|
ID_FILE_NEW "Create a new document\nNew"
|
||||||
ID_FILE_OPEN "Open an existing document\nOpen"
|
ID_FILE_OPEN "Open an existing document\nOpen"
|
||||||
|
@ -341,18 +334,18 @@ BEGIN
|
||||||
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
|
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDC_PLAY "Play the currently selected Game\nPlay"
|
IDC_PLAY "Play the currently selected Game\nPlay"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||||
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_FILE_MRU_FILE1 "Open this document"
|
ID_FILE_MRU_FILE1 "Open this document"
|
||||||
ID_FILE_MRU_FILE2 "Open this document"
|
ID_FILE_MRU_FILE2 "Open this document"
|
||||||
|
@ -372,18 +365,18 @@ BEGIN
|
||||||
ID_FILE_MRU_FILE16 "Open this document"
|
ID_FILE_MRU_FILE16 "Open this document"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||||
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_EDIT_CLEAR "Erase the selection\nErase"
|
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||||
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||||
|
@ -398,13 +391,13 @@ BEGIN
|
||||||
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||||
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
AFX_IDS_SCSIZE "Change the window size"
|
AFX_IDS_SCSIZE "Change the window size"
|
||||||
AFX_IDS_SCMOVE "Change the window position"
|
AFX_IDS_SCMOVE "Change the window position"
|
||||||
|
@ -415,39 +408,39 @@ BEGIN
|
||||||
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||||
AFX_IDS_SCTASKLIST "Activate Task List"
|
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_ALREADYRUNNING "StellaX is already running!"
|
IDS_ALREADYRUNNING "StellaX is already running!"
|
||||||
IDS_BADARGUMENT "Unknown argument given on command line"
|
IDS_BADARGUMENT "Unknown argument given on command line"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_CW_FAILED "CreateWindow failed"
|
IDS_CW_FAILED "CreateWindow failed"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
|
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
|
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
|
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_DDSDM_FAILED "Unable to set video mode. Your video adapter might be incompatible with stella."
|
IDS_DDSDM_FAILED "Unable to set video mode. Your video adapter might be incompatible with stella."
|
||||||
IDS_DSCSBFAILED "IDirectSound::CreateSoundBuffer failed"
|
IDS_DSCSBFAILED "IDirectSound::CreateSoundBuffer failed"
|
||||||
|
@ -461,7 +454,7 @@ BEGIN
|
||||||
IDS_RARITY "Rarity"
|
IDS_RARITY "Rarity"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_STATUSTEXT "%d files found"
|
IDS_STATUSTEXT "%d files found"
|
||||||
IDS_STELLA "StellaX"
|
IDS_STELLA "StellaX"
|
||||||
|
@ -477,7 +470,7 @@ BEGIN
|
||||||
IDS_DI_INIT_FAILED "Unable to initialize DirectInput object"
|
IDS_DI_INIT_FAILED "Unable to initialize DirectInput object"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_ROM_LOAD_FAILED "Unable to load ROM image\n\nCurrent Directory: %s\nPath: %s\nError code: %d - %s"
|
IDS_ROM_LOAD_FAILED "Unable to load ROM image\n\nCurrent Directory: %s\nPath: %s\nError code: %d - %s"
|
||||||
IDS_NO_ITEM_SELECTED "Before pressing play you must first select a game from the list!"
|
IDS_NO_ITEM_SELECTED "Before pressing play you must first select a game from the list!"
|
||||||
|
|
|
@ -170,28 +170,6 @@
|
||||||
BrowseInformation="1"/>
|
BrowseInformation="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="CRegBinding.cpp">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="Cyberstella.cpp">
|
RelativePath="Cyberstella.cpp">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
|
@ -308,28 +286,6 @@
|
||||||
BrowseInformation="1"/>
|
BrowseInformation="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="GlobalData.cxx">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="HyperLink.cpp">
|
RelativePath="HyperLink.cpp">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
|
@ -465,28 +421,6 @@
|
||||||
BrowseInformation="1"/>
|
BrowseInformation="1"/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="Timer.cxx">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
BrowseInformation="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
|
@ -494,9 +428,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="AboutDlg.h">
|
RelativePath="AboutDlg.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="CRegBinding.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="Cyberstella.h">
|
RelativePath="Cyberstella.h">
|
||||||
</File>
|
</File>
|
||||||
|
@ -515,9 +446,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="GameList.h">
|
RelativePath="GameList.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="GlobalData.hxx">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="HyperLink.h">
|
RelativePath="HyperLink.h">
|
||||||
</File>
|
</File>
|
||||||
|
@ -548,9 +476,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="StellaConfig.h">
|
RelativePath="StellaConfig.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="Timer.hxx">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
|
@ -1793,5 +1718,8 @@
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
<Global
|
||||||
|
Name="RESOURCE_FILE"
|
||||||
|
Value="Cyberstella.rc"/>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
|
|
@ -18,21 +18,6 @@
|
||||||
static char THIS_FILE[] = __FILE__;
|
static char THIS_FILE[] = __FILE__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// Undefining USE_FS will use the (untested) windowed mode
|
|
||||||
//
|
|
||||||
/*
|
|
||||||
#define USE_FS
|
|
||||||
|
|
||||||
#ifdef USE_FS
|
|
||||||
#include "DirectXFullScreen.hxx"
|
|
||||||
#else
|
|
||||||
#include "DirectXWindow.hxx"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FORCED_VIDEO_CX 640
|
|
||||||
#define FORCED_VIDEO_CY 480
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CCyberstellaView
|
// CCyberstellaView
|
||||||
|
|
||||||
|
@ -59,9 +44,6 @@ CCyberstellaView::CCyberstellaView()
|
||||||
// NOTE: the ClassWizard will add member initialization here
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
//}}AFX_DATA_INIT
|
//}}AFX_DATA_INIT
|
||||||
|
|
||||||
// FIXME - get rid of this
|
|
||||||
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
|
|
||||||
|
|
||||||
// Create SettingsWin32 object
|
// Create SettingsWin32 object
|
||||||
// This should be done before any other xxxWin32 objects are created
|
// This should be done before any other xxxWin32 objects are created
|
||||||
theSettings = new SettingsWin32();
|
theSettings = new SettingsWin32();
|
||||||
|
@ -71,7 +53,7 @@ CCyberstellaView::CCyberstellaView()
|
||||||
thePropertiesSet = new PropertiesSet();
|
thePropertiesSet = new PropertiesSet();
|
||||||
|
|
||||||
// Try to load the file stella.pro file
|
// Try to load the file stella.pro file
|
||||||
string filename("stella.pro"); // FIXME look into settings to get path
|
string filename(theSettings->userPropertiesFilename());
|
||||||
|
|
||||||
// See if we can open the file and load properties from it
|
// See if we can open the file and load properties from it
|
||||||
ifstream stream(filename.c_str());
|
ifstream stream(filename.c_str());
|
||||||
|
@ -90,15 +72,15 @@ CCyberstellaView::CCyberstellaView()
|
||||||
|
|
||||||
CCyberstellaView::~CCyberstellaView()
|
CCyberstellaView::~CCyberstellaView()
|
||||||
{
|
{
|
||||||
if(m_pGlobalData)
|
|
||||||
delete m_pGlobalData;
|
|
||||||
|
|
||||||
if(thePropertiesSet)
|
if(thePropertiesSet)
|
||||||
delete thePropertiesSet;
|
delete thePropertiesSet;
|
||||||
|
|
||||||
if(theSettings)
|
if(theSettings)
|
||||||
|
{
|
||||||
|
theSettings->saveConfig();
|
||||||
delete theSettings;
|
delete theSettings;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
|
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
|
@ -149,7 +131,7 @@ CCyberstellaDoc* CCyberstellaView::GetDocument() // non-debug version is inline
|
||||||
|
|
||||||
void CCyberstellaView::OnConfig()
|
void CCyberstellaView::OnConfig()
|
||||||
{
|
{
|
||||||
StellaConfig dlg(m_pGlobalData);
|
StellaConfig dlg(theSettings);
|
||||||
dlg.DoModal();
|
dlg.DoModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +160,7 @@ LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
||||||
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||||
|
|
||||||
// Init ListCtrl
|
// Init ListCtrl
|
||||||
m_List.init(thePropertiesSet,this);
|
m_List.init(thePropertiesSet, theSettings, this);
|
||||||
m_List.populateRomList();
|
m_List.populateRomList();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
#include "GlobalData.hxx"
|
|
||||||
#include "PropsSet.hxx"
|
#include "PropsSet.hxx"
|
||||||
#include "SettingsWin32.hxx"
|
#include "SettingsWin32.hxx"
|
||||||
#include "GameList.h"
|
#include "GameList.h"
|
||||||
|
@ -29,7 +28,6 @@ public:
|
||||||
// Attributes
|
// Attributes
|
||||||
public:
|
public:
|
||||||
CCyberstellaDoc* GetDocument();
|
CCyberstellaDoc* GetDocument();
|
||||||
CGlobalData* m_pGlobalData;
|
|
||||||
CImageList m_imglist;
|
CImageList m_imglist;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
|
|
|
@ -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: FrameBufferWin32.cxx,v 1.5 2003-11-19 21:06:27 stephena Exp $
|
// $Id: FrameBufferWin32.cxx,v 1.6 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -34,14 +34,14 @@ LPCTSTR FrameBufferWin32::pszClassName = _T("StellaXClass");
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FrameBufferWin32::FrameBufferWin32()
|
FrameBufferWin32::FrameBufferWin32()
|
||||||
: m_piDD( NULL ),
|
: myDD(NULL),
|
||||||
m_piDDSPrimary( NULL ),
|
myPrimarySurface(NULL),
|
||||||
m_piDDSBack( NULL ),
|
myBackSurface(NULL),
|
||||||
m_piDDPalette( NULL ),
|
myDDPalette(NULL),
|
||||||
m_fActiveWindow( TRUE ),
|
|
||||||
theZoomLevel(1),
|
theZoomLevel(1),
|
||||||
theMaxZoomLevel(1),
|
theMaxZoomLevel(1),
|
||||||
isFullscreen(false)
|
isFullscreen(false),
|
||||||
|
isWindowActive(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,51 +49,48 @@ FrameBufferWin32::FrameBufferWin32()
|
||||||
FrameBufferWin32::~FrameBufferWin32()
|
FrameBufferWin32::~FrameBufferWin32()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
|
if(myHWND)
|
||||||
|
{
|
||||||
|
DestroyWindow( myHWND );
|
||||||
|
|
||||||
|
// Remove the WM_QUIT which will be in the message queue
|
||||||
|
// so that the main window doesn't exit
|
||||||
|
MSG msg;
|
||||||
|
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||||
|
|
||||||
|
myHWND = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnregisterClass(pszClassName, GetModuleHandle(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::cleanup()
|
void FrameBufferWin32::cleanup()
|
||||||
{
|
{
|
||||||
if(m_piDDPalette)
|
if(myDDPalette)
|
||||||
{
|
{
|
||||||
m_piDDPalette->Release();
|
myDDPalette->Release();
|
||||||
m_piDDPalette = NULL;
|
myDDPalette = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_piDDSBack )
|
if(myBackSurface)
|
||||||
{
|
{
|
||||||
m_piDDSBack->Release();
|
myBackSurface->Release();
|
||||||
m_piDDSBack = NULL;
|
myBackSurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_piDD )
|
if(myDD)
|
||||||
{
|
{
|
||||||
if ( m_piDDSPrimary )
|
if(myPrimarySurface)
|
||||||
{
|
{
|
||||||
m_piDDSPrimary->Release();
|
myPrimarySurface->Release();
|
||||||
m_piDDSPrimary = NULL;
|
myPrimarySurface = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_piDD->Release();
|
myDD->Release();
|
||||||
m_piDD = NULL;
|
myDD = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myHWND)
|
|
||||||
{
|
|
||||||
::DestroyWindow( myHWND );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Remove the WM_QUIT which will be in the message queue
|
|
||||||
// so that the main window doesn't exit
|
|
||||||
//
|
|
||||||
|
|
||||||
MSG msg;
|
|
||||||
::PeekMessage( &msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE );
|
|
||||||
|
|
||||||
myHWND = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
::UnregisterClass( pszClassName, GetModuleHandle(NULL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,8 +100,8 @@ bool FrameBufferWin32::init()
|
||||||
HRESULT hrCoInit = ::CoInitialize( NULL );
|
HRESULT hrCoInit = ::CoInitialize( NULL );
|
||||||
|
|
||||||
// Get the game's width and height
|
// Get the game's width and height
|
||||||
mySizeGame.cx = myWidth = myMediaSource->width() << 1;
|
myGameSize.cx = myWidth = myMediaSource->width() << 1;
|
||||||
mySizeGame.cy = myHeight = myMediaSource->height();
|
myGameSize.cy = myHeight = myMediaSource->height();
|
||||||
|
|
||||||
// Initialize the pixel data table
|
// Initialize the pixel data table
|
||||||
for(uInt32 i = 0; i < 256; ++i)
|
for(uInt32 i = 0; i < 256; ++i)
|
||||||
|
@ -125,9 +122,9 @@ bool FrameBufferWin32::init()
|
||||||
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
|
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||||
wcex.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
|
wcex.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
|
||||||
|
|
||||||
if( ! ::RegisterClassEx( &wcex ) )
|
if(!RegisterClassEx(&wcex))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 1");
|
OutputDebugString("Error: RegisterClassEX FAILED");
|
||||||
hr = HRESULT_FROM_WIN32( ::GetLastError() );
|
hr = HRESULT_FROM_WIN32( ::GetLastError() );
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,7 +141,7 @@ OutputDebugString("got here failed 1");
|
||||||
this );
|
this );
|
||||||
if(myHWND == NULL )
|
if(myHWND == NULL )
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 2");
|
OutputDebugString("Error: CreateWindowEx FAILED");
|
||||||
hr = HRESULT_FROM_WIN32( GetLastError() );
|
hr = HRESULT_FROM_WIN32( GetLastError() );
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
|
@ -156,145 +153,122 @@ OutputDebugString("got here failed 2");
|
||||||
|
|
||||||
::ShowCursor( FALSE );
|
::ShowCursor( FALSE );
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize DirectDraw
|
// Initialize DirectDraw
|
||||||
//
|
//
|
||||||
hr = ::CoCreateInstance( CLSID_DirectDraw,
|
hr = ::CoCreateInstance( CLSID_DirectDraw,
|
||||||
NULL,
|
NULL,
|
||||||
CLSCTX_SERVER,
|
CLSCTX_SERVER,
|
||||||
IID_IDirectDraw,
|
IID_IDirectDraw,
|
||||||
(void**)&m_piDD );
|
(void**)&myDD );
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 3");
|
OutputDebugString("Error: CoCreateInstance FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize it
|
// Initialize it
|
||||||
// This method takes the driver GUID parameter that the DirectDrawCreate
|
// This method takes the driver GUID parameter that the DirectDrawCreate
|
||||||
// function typically uses (NULL is active display driver)
|
// function typically uses (NULL is active display driver)
|
||||||
//
|
hr = myDD->Initialize(NULL);
|
||||||
hr = m_piDD->Initialize( NULL );
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 4");
|
OutputDebugString("Error: DirectDraw Initialize FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Get the best video mode for game width
|
// Get the best video mode for game width
|
||||||
//
|
|
||||||
//int cx = 640; int cy = 480;
|
//int cx = 640; int cy = 480;
|
||||||
int cx = 320; int cy = 240;
|
int cx = 320; int cy = 240;
|
||||||
::SetRect( &m_rectScreen, 0, 0, cx, cy );
|
SetRect(&myScreenRect, 0, 0, cx, cy);
|
||||||
|
|
||||||
if(cx == 0 || cy == 0)
|
if(cx == 0 || cy == 0)
|
||||||
{
|
{
|
||||||
hr = m_piDD->EnumDisplayModes( 0, NULL, this, EnumModesCallback );
|
hr = myDD->EnumDisplayModes(0, NULL, this, EnumModesCallback);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 5");
|
OutputDebugString("Error: Displaymode Enumeration FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_rectScreen.right == 0 || m_rectScreen.bottom == 0 )
|
if(myScreenRect.right == 0 || myScreenRect.bottom == 0)
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 6");
|
OutputDebugString("Error: ScreenRect INVALID");
|
||||||
hr = E_INVALIDARG;
|
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE( "Video Mode Selected: %d x %d", m_rectScreen.right, m_rectScreen.bottom );
|
|
||||||
|
|
||||||
// compute blit offset to center image
|
// compute blit offset to center image
|
||||||
|
myBlitOffset.x = ((myScreenRect.right - myGameSize.cx) / 2);
|
||||||
m_ptBlitOffset.x = ( ( m_rectScreen.right - mySizeGame.cx ) / 2 );
|
myBlitOffset.y = ((myScreenRect.bottom - myGameSize.cy) / 2);
|
||||||
m_ptBlitOffset.y = ( ( m_rectScreen.bottom - mySizeGame.cy ) / 2 );
|
|
||||||
|
|
||||||
// Set cooperative level
|
// Set cooperative level
|
||||||
|
hr = myDD->SetCooperativeLevel(myHWND, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
hr = m_piDD->SetCooperativeLevel( myHWND, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 7");
|
OutputDebugString("Error: SetCooperativeLevel FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_piDD->SetDisplayMode( m_rectScreen.right, m_rectScreen.bottom, 8 );
|
hr = myDD->SetDisplayMode(myScreenRect.right, myScreenRect.bottom, 8);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 8");
|
OutputDebugString("Error: SetDisplayMode FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Create the primary surface
|
// Create the primary surface
|
||||||
//
|
|
||||||
|
|
||||||
DDSURFACEDESC ddsd;
|
DDSURFACEDESC ddsd;
|
||||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
ddsd.dwFlags = DDSD_CAPS;
|
ddsd.dwFlags = DDSD_CAPS;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
|
||||||
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSPrimary, NULL);
|
hr = myDD->CreateSurface(&ddsd, &myPrimarySurface, NULL);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 9");
|
OutputDebugString("Error: Create primary surface FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Create the offscreen surface
|
// Create the offscreen surface
|
||||||
//
|
|
||||||
|
|
||||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||||
ddsd.dwWidth = mySizeGame.cx;
|
ddsd.dwWidth = myGameSize.cx;
|
||||||
ddsd.dwHeight = mySizeGame.cy;
|
ddsd.dwHeight = myGameSize.cy;
|
||||||
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSBack, NULL);
|
|
||||||
|
hr = myDD->CreateSurface(&ddsd, &myBackSurface, NULL);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 10");
|
OutputDebugString("Error: Create back surface FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Erase the surface
|
// Erase the surface
|
||||||
//
|
|
||||||
|
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
hr = m_piDDSBack->GetDC( &hdc );
|
hr = myBackSurface->GetDC(&hdc);
|
||||||
if(hr == DD_OK)
|
if(hr == DD_OK)
|
||||||
{
|
{
|
||||||
::SetBkColor( hdc, RGB(0, 0, 0) );
|
SetBkColor(hdc, RGB(0, 0, 0));
|
||||||
RECT rc;
|
RECT rc;
|
||||||
::SetRect( &rc, 0, 0,
|
SetRect(&rc, 0, 0, myGameSize.cx, myGameSize.cy);
|
||||||
mySizeGame.cx,
|
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
|
||||||
mySizeGame.cy );
|
|
||||||
::ExtTextOut( hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
|
|
||||||
|
|
||||||
(void)m_piDDSBack->ReleaseDC( hdc );
|
(void)myBackSurface->ReleaseDC(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Create Palette
|
// Create Palette
|
||||||
//
|
|
||||||
|
|
||||||
PALETTEENTRY pe[256];
|
PALETTEENTRY pe[256];
|
||||||
|
for(uInt32 i = 0; i < 256; ++i)
|
||||||
for ( int i = 0; i < 256; ++i )
|
|
||||||
{
|
{
|
||||||
pe[i].peRed = (BYTE)( (pPalette[i] & 0x00FF0000) >> 16 );
|
pe[i].peRed = (BYTE)( (pPalette[i] & 0x00FF0000) >> 16 );
|
||||||
pe[i].peGreen = (BYTE)( (pPalette[i] & 0x0000FF00) >> 8 );
|
pe[i].peGreen = (BYTE)( (pPalette[i] & 0x0000FF00) >> 8 );
|
||||||
|
@ -302,21 +276,18 @@ return false;
|
||||||
pe[i].peFlags = 0;
|
pe[i].peFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_piDD->CreatePalette( DDPCAPS_8BIT,
|
hr = myDD->CreatePalette(DDPCAPS_8BIT, pe, &myDDPalette, NULL );
|
||||||
pe,
|
|
||||||
&m_piDDPalette,
|
|
||||||
NULL );
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 11");
|
OutputDebugString("Error: CreatePalette FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_piDDSPrimary->SetPalette( m_piDDPalette );
|
hr = myPrimarySurface->SetPalette(myDDPalette);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
OutputDebugString("got here failed 12");
|
OutputDebugString("Error: SetPalette FAILED");
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -328,33 +299,21 @@ OutputDebugString("got here failed 12");
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::drawMediaSource()
|
void FrameBufferWin32::drawMediaSource()
|
||||||
{
|
{
|
||||||
if(m_piDDSPrimary == NULL || !m_fActiveWindow)
|
if(myPrimarySurface == NULL || !isWindowActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HRESULT hr;
|
|
||||||
const BYTE* current = myMediaSource->currentFrameBuffer();
|
const BYTE* current = myMediaSource->currentFrameBuffer();
|
||||||
const BYTE* previous = myMediaSource->previousFrameBuffer();
|
const BYTE* previous = myMediaSource->previousFrameBuffer();
|
||||||
|
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||||
|
|
||||||
// acquire pointer to linear video ram
|
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
ZeroMemory( &ddsd, sizeof(ddsd) );
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
hr = m_piDDSBack->Lock( NULL,
|
|
||||||
&ddsd,
|
|
||||||
/* DDLOCK_SURFACEMEMORYPTR | */ DDLOCK_WAIT,
|
|
||||||
NULL );
|
|
||||||
// BUGBUG: Check for error
|
|
||||||
|
|
||||||
BYTE* pbBackBytes = (BYTE*)ddsd.lpSurface;
|
|
||||||
register int y;
|
register int y;
|
||||||
for(y = 0; y < mySizeGame.cy; ++y)
|
for(y = 0; y < myGameSize.cy; ++y)
|
||||||
{
|
{
|
||||||
const WORD bufofsY = (WORD) ( y * mySizeGame.cx >> 1 );
|
const WORD bufofsY = (WORD) ( y * myGameSize.cx >> 1 );
|
||||||
const DWORD screenofsY = ( y * ddsd.lPitch );
|
const DWORD screenofsY = ( y * myDDSurface.lPitch );
|
||||||
|
|
||||||
register int x;
|
register int x;
|
||||||
for(x = 0; x < mySizeGame.cx >> 1; ++x )
|
for(x = 0; x < myGameSize.cx >> 1; ++x )
|
||||||
{
|
{
|
||||||
const WORD bufofs = bufofsY + x;
|
const WORD bufofs = bufofsY + x;
|
||||||
BYTE v = current[ bufofs ];
|
BYTE v = current[ bufofs ];
|
||||||
|
@ -366,7 +325,6 @@ void FrameBufferWin32::drawMediaSource()
|
||||||
pbBackBytes[ pos + 0 ] = pbBackBytes[ pos + 1 ] = myPalette[v];
|
pbBackBytes[ pos + 0 ] = pbBackBytes[ pos + 1 ] = myPalette[v];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
|
||||||
|
|
||||||
// The frame doesn't need to be completely redrawn anymore
|
// The frame doesn't need to be completely redrawn anymore
|
||||||
theRedrawEntireFrameIndicator = false;
|
theRedrawEntireFrameIndicator = false;
|
||||||
|
@ -375,22 +333,25 @@ void FrameBufferWin32::drawMediaSource()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::preFrameUpdate()
|
void FrameBufferWin32::preFrameUpdate()
|
||||||
{
|
{
|
||||||
// FIXME - move locking here so its only done once per frame
|
// Acquire pointer to linear video ram
|
||||||
|
ZeroMemory(&myDDSurface, sizeof(myDDSurface));
|
||||||
|
myDDSurface.dwSize = sizeof(myDDSurface);
|
||||||
|
|
||||||
|
HRESULT hr = myBackSurface->Lock(NULL, &myDDSurface, DDLOCK_WAIT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::postFrameUpdate()
|
void FrameBufferWin32::postFrameUpdate()
|
||||||
{
|
{
|
||||||
// We only send any changes to the screen once per frame
|
// We only send any changes to the screen once per frame
|
||||||
// FIXME - move unlocking here so its only done once per frame
|
(void)myBackSurface->Unlock(myDDSurface.lpSurface);
|
||||||
|
|
||||||
// Blit offscreen to onscreen
|
// Blit offscreen to onscreen
|
||||||
RECT rc = { 0, 0, mySizeGame.cx, mySizeGame.cy };
|
RECT rc = { 0, 0, myGameSize.cx, myGameSize.cy };
|
||||||
|
|
||||||
HRESULT hr = m_piDDSPrimary->BltFast( m_ptBlitOffset.x, m_ptBlitOffset.y,
|
HRESULT hr = myPrimarySurface->BltFast( myBlitOffset.x, myBlitOffset.y,
|
||||||
m_piDDSBack,
|
myBackSurface,
|
||||||
&rc,
|
&rc,
|
||||||
// DDBLTFAST_WAIT |DDBLTFAST_DESTCOLORKEY );
|
|
||||||
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );
|
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,25 +368,14 @@ void FrameBufferWin32::toggleFullscreen()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||||
{
|
{
|
||||||
// acquire pointer to linear video ram
|
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
ZeroMemory( &ddsd, sizeof(ddsd) );
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
HRESULT hr = m_piDDSBack->Lock( NULL,
|
|
||||||
&ddsd,
|
|
||||||
/* DDLOCK_SURFACEMEMORYPTR | */ DDLOCK_WAIT,
|
|
||||||
NULL );
|
|
||||||
// BUGBUG: Check for error
|
|
||||||
|
|
||||||
BYTE* pbBackBytes = (BYTE*)ddsd.lpSurface;
|
|
||||||
|
|
||||||
// First draw the background
|
// First draw the background
|
||||||
for(uInt32 row = 0; row < h; row++)
|
for(uInt32 row = 0; row < h; row++)
|
||||||
{
|
{
|
||||||
for(uInt32 col = 0; col < w; col++)
|
for(uInt32 col = 0; col < w; col++)
|
||||||
{
|
{
|
||||||
BYTE* ptr = pbBackBytes + ((row + y) * ddsd.lPitch) + col + x;
|
BYTE* ptr = pbBackBytes + ((row + y) * myDDSurface.lPitch) + col + x;
|
||||||
*ptr = myPalette[myBGColor];
|
*ptr = myPalette[myBGColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,96 +383,70 @@ void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||||
// Now draw the surrounding lines
|
// Now draw the surrounding lines
|
||||||
for(uInt32 col = 0; col < w+1; col++) // Top line
|
for(uInt32 col = 0; col < w+1; col++) // Top line
|
||||||
{
|
{
|
||||||
BYTE* ptr = pbBackBytes + y * ddsd.lPitch + col + x;
|
BYTE* ptr = pbBackBytes + y * myDDSurface.lPitch + col + x;
|
||||||
*ptr = myPalette[myFGColor];
|
*ptr = myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uInt32 col = 0; col < w+1; col++) // Bottom line
|
for(uInt32 col = 0; col < w+1; col++) // Bottom line
|
||||||
{
|
{
|
||||||
BYTE* ptr = pbBackBytes + (y+h) * ddsd.lPitch + col + x;
|
BYTE* ptr = pbBackBytes + (y+h) * myDDSurface.lPitch + col + x;
|
||||||
*ptr = myPalette[myFGColor];
|
*ptr = myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uInt32 row = 0; row < h; row++) // Left line
|
for(uInt32 row = 0; row < h; row++) // Left line
|
||||||
{
|
{
|
||||||
BYTE* ptr = pbBackBytes + (row + y) * ddsd.lPitch + x;
|
BYTE* ptr = pbBackBytes + (row + y) * myDDSurface.lPitch + x;
|
||||||
*ptr = myPalette[myFGColor];
|
*ptr = myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uInt32 row = 0; row < h; row++) // Right line
|
for(uInt32 row = 0; row < h; row++) // Right line
|
||||||
{
|
{
|
||||||
BYTE* ptr = pbBackBytes + (row + y) * ddsd.lPitch + x + w;
|
BYTE* ptr = pbBackBytes + (row + y) * myDDSurface.lPitch + x + w;
|
||||||
*ptr = myPalette[myFGColor];
|
*ptr = myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::drawText(uInt32 xorig, uInt32 yorig, const string& message)
|
void FrameBufferWin32::drawText(uInt32 xorig, uInt32 yorig, const string& message)
|
||||||
{
|
{
|
||||||
// acquire pointer to linear video ram
|
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
ZeroMemory( &ddsd, sizeof(ddsd) );
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
HRESULT hr = m_piDDSBack->Lock( NULL,
|
|
||||||
&ddsd,
|
|
||||||
/* DDLOCK_SURFACEMEMORYPTR | */ DDLOCK_WAIT,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
BYTE* pbBackBytes = (BYTE*)ddsd.lpSurface;
|
|
||||||
uInt8 length = message.length();
|
uInt8 length = message.length();
|
||||||
for(uInt32 x = 0; x < length; x++)
|
for(uInt32 z = 0; z < length; z++)
|
||||||
{
|
{
|
||||||
for(uInt32 y = 0; y < 8; y++)
|
for(uInt32 y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
for(uInt32 z = 0; z < 8; z++)
|
for(uInt32 x = 0; x < 8; x++)
|
||||||
{
|
{
|
||||||
char letter = message[x];
|
char letter = message[z];
|
||||||
if((ourFontData[(letter << 3) + y] >> z) & 1)
|
if((ourFontData[(letter << 3) + y] >> x) & 1)
|
||||||
pbBackBytes[((x<<3) + z + xorig) + (y + yorig) * ddsd.lPitch] =
|
pbBackBytes[((z<<3) + x + xorig) + (y + yorig) * myDDSurface.lPitch] =
|
||||||
myPalette[myFGColor];
|
myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FrameBufferWin32::drawChar(uInt32 xorig, uInt32 yorig, uInt32 c)
|
void FrameBufferWin32::drawChar(uInt32 xorig, uInt32 yorig, uInt32 c)
|
||||||
{
|
{
|
||||||
// acquire pointer to linear video ram
|
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
ZeroMemory( &ddsd, sizeof(ddsd) );
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
|
|
||||||
HRESULT hr = m_piDDSBack->Lock( NULL,
|
|
||||||
&ddsd,
|
|
||||||
/* DDLOCK_SURFACEMEMORYPTR | */ DDLOCK_WAIT,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
BYTE* pbBackBytes = (BYTE*)ddsd.lpSurface;
|
|
||||||
for(uInt32 y = 0; y < 8; y++)
|
for(uInt32 y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
for(uInt32 x = 0; x < 8; x++)
|
for(uInt32 x = 0; x < 8; x++)
|
||||||
{
|
{
|
||||||
if((ourFontData[(c << 3) + y] >> x) & 1)
|
if((ourFontData[(c << 3) + y] >> x) & 1)
|
||||||
pbBackBytes[x + xorig + (y + yorig) * ddsd.lPitch] =
|
pbBackBytes[x + xorig + (y + yorig) * myDDSurface.lPitch] =
|
||||||
myPalette[myFGColor];
|
myPalette[myFGColor];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
LRESULT CALLBACK FrameBufferWin32::StaticWindowProc(
|
LRESULT CALLBACK FrameBufferWin32::StaticWindowProc(
|
||||||
HWND hwnd,
|
HWND hwnd,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam
|
LPARAM lParam)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FrameBufferWin32* pThis;
|
FrameBufferWin32* pThis;
|
||||||
|
|
||||||
|
@ -531,42 +455,33 @@ LRESULT CALLBACK FrameBufferWin32::StaticWindowProc(
|
||||||
pThis = reinterpret_cast<FrameBufferWin32*>(
|
pThis = reinterpret_cast<FrameBufferWin32*>(
|
||||||
reinterpret_cast<CREATESTRUCT*>( lParam )->lpCreateParams );
|
reinterpret_cast<CREATESTRUCT*>( lParam )->lpCreateParams );
|
||||||
|
|
||||||
::SetWindowLong( hwnd,
|
SetWindowLong(hwnd, GWL_USERDATA, reinterpret_cast<LONG>(pThis));
|
||||||
GWL_USERDATA,
|
|
||||||
reinterpret_cast<LONG>( pThis ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pThis = reinterpret_cast<FrameBufferWin32*>(
|
pThis = reinterpret_cast<FrameBufferWin32*>(GetWindowLong(hwnd, GWL_USERDATA));
|
||||||
::GetWindowLong( hwnd, GWL_USERDATA ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pThis)
|
if(pThis)
|
||||||
{
|
{
|
||||||
if(pThis->WndProc(uMsg, wParam, lParam))
|
if(pThis->WndProc(uMsg, wParam, lParam))
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Handled message
|
// Handled message
|
||||||
//
|
|
||||||
|
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Unhandled message
|
// Unhandled message
|
||||||
//
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
return ::DefWindowProc( hwnd, uMsg, wParam, lParam );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
m_fActiveWindow = (wParam != WA_INACTIVE);
|
isWindowActive = (wParam != WA_INACTIVE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
@ -586,60 +501,41 @@ BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
HRESULT WINAPI FrameBufferWin32::EnumModesCallback(
|
HRESULT WINAPI FrameBufferWin32::EnumModesCallback(
|
||||||
LPDDSURFACEDESC lpDDSurfaceDesc,
|
LPDDSURFACEDESC lpDDSurfaceDesc,
|
||||||
LPVOID lpContext)
|
LPVOID lpContext)
|
||||||
{
|
{
|
||||||
FrameBufferWin32* pThis = (FrameBufferWin32*)lpContext;
|
FrameBufferWin32* pThis = (FrameBufferWin32*)lpContext;
|
||||||
|
|
||||||
DWORD dwWidthReq = pThis->mySizeGame.cx;
|
DWORD dwWidthReq = pThis->myGameSize.cx;
|
||||||
DWORD dwHeightReq = pThis->mySizeGame.cy;
|
DWORD dwHeightReq = pThis->myGameSize.cy;
|
||||||
|
|
||||||
DWORD dwWidth = lpDDSurfaceDesc->dwWidth;
|
DWORD dwWidth = lpDDSurfaceDesc->dwWidth;
|
||||||
DWORD dwHeight = lpDDSurfaceDesc->dwHeight;
|
DWORD dwHeight = lpDDSurfaceDesc->dwHeight;
|
||||||
DWORD dwRGBBitCount = lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;
|
DWORD dwRGBBitCount = lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;
|
||||||
|
|
||||||
//
|
// Must be 8 bit mode
|
||||||
// must be 8 bit mode
|
|
||||||
//
|
|
||||||
|
|
||||||
if(dwRGBBitCount != 8)
|
if(dwRGBBitCount != 8)
|
||||||
{
|
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// must be larger then required screen size
|
|
||||||
//
|
|
||||||
|
|
||||||
|
// Must be larger then required screen size
|
||||||
if(dwWidth < dwWidthReq || dwHeight < dwHeightReq)
|
if(dwWidth < dwWidthReq || dwHeight < dwHeightReq)
|
||||||
{
|
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
|
||||||
|
|
||||||
if ( pThis->m_rectScreen.right != 0 && pThis->m_rectScreen.bottom != 0 )
|
if(pThis->myScreenRect.right != 0 && pThis->myScreenRect.bottom != 0)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// check to see if this is better than the previous choice
|
// check to see if this is better than the previous choice
|
||||||
//
|
if((dwWidth - dwWidthReq) > (pThis->myScreenRect.right - dwWidthReq))
|
||||||
|
return DDENUMRET_OK;
|
||||||
|
|
||||||
if ( (dwWidth - dwWidthReq) > (pThis->m_rectScreen.right - dwWidthReq) )
|
if((dwHeight - dwHeightReq) > (pThis->myScreenRect.bottom - dwHeightReq))
|
||||||
{
|
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (dwHeight - dwHeightReq) > (pThis->m_rectScreen.bottom - dwHeightReq) )
|
|
||||||
{
|
|
||||||
return DDENUMRET_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// use it!
|
// use it!
|
||||||
//
|
pThis->myScreenRect.right = dwWidth;
|
||||||
|
pThis->myScreenRect.bottom = dwHeight;
|
||||||
pThis->m_rectScreen.right = dwWidth;
|
|
||||||
pThis->m_rectScreen.bottom = dwHeight;
|
|
||||||
|
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: FrameBufferWin32.hxx,v 1.2 2003-11-13 00:25:07 stephena Exp $
|
// $Id: FrameBufferWin32.hxx,v 1.3 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef FRAMEBUFFER_WIN32_HXX
|
#ifndef FRAMEBUFFER_WIN32_HXX
|
||||||
|
@ -27,9 +27,10 @@ class MediaSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class implements a DirectX software framebuffer.
|
This class implements a DirectX software framebuffer.
|
||||||
|
Only fullscreen mode is supported for now.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: FrameBufferWin32.hxx,v 1.2 2003-11-13 00:25:07 stephena Exp $
|
@version $Id: FrameBufferWin32.hxx,v 1.3 2003-11-24 01:14:38 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class FrameBufferWin32 : public FrameBuffer
|
class FrameBufferWin32 : public FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -45,7 +46,7 @@ class FrameBufferWin32 : public FrameBuffer
|
||||||
virtual ~FrameBufferWin32();
|
virtual ~FrameBufferWin32();
|
||||||
|
|
||||||
HWND hwnd() const { return myHWND; }
|
HWND hwnd() const { return myHWND; }
|
||||||
bool windowActive() { return m_fActiveWindow; }
|
bool windowActive() { return isWindowActive; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This routine should be called once the console is created to setup
|
This routine should be called once the console is created to setup
|
||||||
|
@ -140,22 +141,19 @@ class FrameBufferWin32 : public FrameBuffer
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
HWND myHWND;
|
HWND myHWND;
|
||||||
bool m_fActiveWindow;
|
RECT myScreenRect;
|
||||||
|
POINT myBlitOffset;
|
||||||
RECT m_rectScreen;
|
|
||||||
POINT m_ptBlitOffset;
|
|
||||||
|
|
||||||
// Stella objects
|
// Stella objects
|
||||||
SIZE mySizeGame;
|
SIZE myGameSize;
|
||||||
BYTE myPalette[256];
|
BYTE myPalette[256];
|
||||||
|
|
||||||
//
|
|
||||||
// DirectX
|
// DirectX
|
||||||
//
|
IDirectDraw* myDD;
|
||||||
IDirectDraw* m_piDD;
|
IDirectDrawSurface* myPrimarySurface;
|
||||||
IDirectDrawSurface* m_piDDSPrimary;
|
IDirectDrawSurface* myBackSurface;
|
||||||
IDirectDrawSurface* m_piDDSBack;
|
DDSURFACEDESC myDDSurface;
|
||||||
IDirectDrawPalette* m_piDDPalette;
|
IDirectDrawPalette* myDDPalette;
|
||||||
|
|
||||||
static LPCTSTR pszClassName;
|
static LPCTSTR pszClassName;
|
||||||
|
|
||||||
|
@ -167,6 +165,9 @@ class FrameBufferWin32 : public FrameBuffer
|
||||||
|
|
||||||
// Indicates whether the game is currently in fullscreen
|
// Indicates whether the game is currently in fullscreen
|
||||||
bool isFullscreen;
|
bool isFullscreen;
|
||||||
|
|
||||||
|
// Indicates whether the window is currently active
|
||||||
|
bool isWindowActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,10 +1,26 @@
|
||||||
// GameList.cpp : implementation file
|
//============================================================================
|
||||||
//
|
//
|
||||||
|
// 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: GameList.cpp,v 1.5 2003-11-24 01:14:38 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
#include "Cyberstella.h"
|
#include "Cyberstella.h"
|
||||||
#include "GameList.h"
|
#include "GameList.h"
|
||||||
#include "MD5.hxx"
|
#include "MD5.hxx"
|
||||||
|
#include "SettingsWin32.hxx"
|
||||||
|
|
||||||
class CyberstellaView;
|
class CyberstellaView;
|
||||||
|
|
||||||
|
@ -14,19 +30,19 @@ class CyberstellaView;
|
||||||
static char THIS_FILE[] = __FILE__;
|
static char THIS_FILE[] = __FILE__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// GameList
|
|
||||||
|
|
||||||
GameList::GameList()
|
GameList::GameList()
|
||||||
: rs("GameList")
|
: myRomPath(""),
|
||||||
|
myRomCount(0)
|
||||||
{
|
{
|
||||||
rs.Bind(m_Path, "ROM Path", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
GameList::~GameList()
|
GameList::~GameList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BEGIN_MESSAGE_MAP(GameList, CListCtrl)
|
BEGIN_MESSAGE_MAP(GameList, CListCtrl)
|
||||||
// {{AFX_MSG_MAP(GameList)
|
// {{AFX_MSG_MAP(GameList)
|
||||||
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
||||||
|
@ -35,9 +51,6 @@ BEGIN_MESSAGE_MAP(GameList, CListCtrl)
|
||||||
// }}AFX_MSG_MAP
|
// }}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// GameList message handlers
|
|
||||||
|
|
||||||
// Sort the item in reverse alphabetical order.
|
// Sort the item in reverse alphabetical order.
|
||||||
static int CALLBACK
|
static int CALLBACK
|
||||||
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
|
@ -114,7 +127,7 @@ void GameList::populateRomList()
|
||||||
deleteItemsAndProperties();
|
deleteItemsAndProperties();
|
||||||
|
|
||||||
// Add new content
|
// Add new content
|
||||||
if(m_Path.GetLength() > 0)
|
if(myRomPath.GetLength() > 0)
|
||||||
{
|
{
|
||||||
displayPath();
|
displayPath();
|
||||||
}
|
}
|
||||||
|
@ -130,6 +143,9 @@ void GameList::populateRomList()
|
||||||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||||
|
|
||||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||||
|
|
||||||
|
// Save the current path
|
||||||
|
mySettings->setString("rompath", (const char*) myRomPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::displayPath()
|
void GameList::displayPath()
|
||||||
|
@ -142,15 +158,15 @@ void GameList::displayPath()
|
||||||
BOOL first = true;
|
BOOL first = true;
|
||||||
|
|
||||||
// Do pathname
|
// Do pathname
|
||||||
if (m_Path.GetAt(m_Path.GetLength()-1) == '\\')
|
if (myRomPath.GetAt(myRomPath.GetLength()-1) == '\\')
|
||||||
searchpath = m_Path + "*.*";
|
searchpath = myRomPath + "*.*";
|
||||||
else
|
else
|
||||||
searchpath = m_Path + "\\*.*";
|
searchpath = myRomPath + "\\*.*";
|
||||||
|
|
||||||
bFind = find.FindFile(searchpath);
|
bFind = find.FindFile(searchpath);
|
||||||
|
|
||||||
// Init Rom count
|
// Init Rom count
|
||||||
m_RomCount = 0;
|
myRomCount = 0;
|
||||||
|
|
||||||
while (bFind)
|
while (bFind)
|
||||||
{
|
{
|
||||||
|
@ -224,7 +240,7 @@ void GameList::displayPath()
|
||||||
lvi.pszText = name.GetBuffer(name.GetLength());
|
lvi.pszText = name.GetBuffer(name.GetLength());
|
||||||
SetItem(&lvi);
|
SetItem(&lvi);
|
||||||
|
|
||||||
m_RomCount++;
|
myRomCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +268,7 @@ void GameList::displayDrives()
|
||||||
int itemCounter;
|
int itemCounter;
|
||||||
|
|
||||||
// Clear path
|
// Clear path
|
||||||
m_Path = "";
|
myRomPath = "";
|
||||||
|
|
||||||
//Enumerate drive letters and add them to list
|
//Enumerate drive letters and add them to list
|
||||||
dwDrives = GetLogicalDrives();
|
dwDrives = GetLogicalDrives();
|
||||||
|
@ -301,25 +317,25 @@ void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
|
||||||
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
|
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
|
||||||
{
|
{
|
||||||
int cutPos = m_Path.ReverseFind('\\');
|
int cutPos = myRomPath.ReverseFind('\\');
|
||||||
m_Path = m_Path.Left(cutPos);
|
myRomPath = myRomPath.Left(cutPos);
|
||||||
populateRomList();
|
populateRomList();
|
||||||
}
|
}
|
||||||
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
|
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
|
||||||
{
|
{
|
||||||
// Do pathname
|
// Do pathname
|
||||||
if (m_Path.GetLength() <= 0)
|
if (myRomPath.GetLength() <= 0)
|
||||||
{
|
{
|
||||||
m_Path = dir;
|
myRomPath = dir;
|
||||||
}
|
}
|
||||||
else if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
|
else if (myRomPath.GetAt(myRomPath.GetLength()-1) != '\\')
|
||||||
{
|
{
|
||||||
m_Path += "\\";
|
myRomPath += "\\";
|
||||||
m_Path += dir;
|
myRomPath += dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Path += dir;
|
myRomPath += dir;
|
||||||
}
|
}
|
||||||
populateRomList();
|
populateRomList();
|
||||||
}
|
}
|
||||||
|
@ -361,7 +377,7 @@ Properties* GameList::readRomData(CString binFile)
|
||||||
std::string md5 = MD5(pImage, dwFileSize);
|
std::string md5 = MD5(pImage, dwFileSize);
|
||||||
// search through the properties set for this MD5
|
// search through the properties set for this MD5
|
||||||
Properties* props = new Properties();
|
Properties* props = new Properties();
|
||||||
m_pPropertiesSet->getMD5(md5, *props);
|
myPropertiesSet->getMD5(md5, *props);
|
||||||
// Return properties
|
// Return properties
|
||||||
delete[] pImage;
|
delete[] pImage;
|
||||||
VERIFY(::CloseHandle(hFile));
|
VERIFY(::CloseHandle(hFile));
|
||||||
|
@ -380,10 +396,10 @@ CString GameList::getCurrentFile()
|
||||||
int curSel = GetSelectionMark();
|
int curSel = GetSelectionMark();
|
||||||
if(curSel >= 0)
|
if(curSel >= 0)
|
||||||
{
|
{
|
||||||
if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
|
if (myRomPath.GetAt(myRomPath.GetLength()-1) != '\\')
|
||||||
m_Path += "\\";
|
myRomPath += "\\";
|
||||||
|
|
||||||
filename = m_Path + GetItemText(curSel,0);
|
filename = myRomPath + GetItemText(curSel,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
|
@ -410,10 +426,14 @@ CString GameList::getCurrentNote()
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameList::init(PropertiesSet* newPropertiesSet, CWnd* newParent)
|
void GameList::init(PropertiesSet* newPropertiesSet,
|
||||||
|
SettingsWin32* settings, CWnd* newParent)
|
||||||
{
|
{
|
||||||
m_pParent = newParent;
|
m_pParent = newParent;
|
||||||
m_pPropertiesSet = newPropertiesSet;
|
myPropertiesSet = newPropertiesSet;
|
||||||
|
mySettings = settings;
|
||||||
|
|
||||||
|
myRomPath = mySettings->getString("rompath").c_str();
|
||||||
SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
||||||
insertColumns();
|
insertColumns();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,78 +1,74 @@
|
||||||
#if !defined(AFX_GAMELIST_H__1EF8C3E1_4D6A_11D6_ACFC_0048546D2F04__INCLUDED_)
|
//============================================================================
|
||||||
#define AFX_GAMELIST_H__1EF8C3E1_4D6A_11D6_ACFC_0048546D2F04__INCLUDED_
|
//
|
||||||
|
// 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: GameList.h,v 1.4 2003-11-24 01:14:38 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef GAME_LIST_H
|
||||||
|
#define GAME_LIST_H
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
// GameList.h : header file
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "CRegBinding.h"
|
|
||||||
#include "PropsSet.hxx"
|
#include "PropsSet.hxx"
|
||||||
|
#include "SettingsWin32.hxx"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// GameList window
|
// GameList window
|
||||||
|
|
||||||
class GameList : public CListCtrl
|
class GameList : public CListCtrl
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
// memebers saved in registry
|
|
||||||
CString m_Path;
|
|
||||||
int m_RomCount;
|
|
||||||
CWnd* m_pParent;
|
|
||||||
PropertiesSet* m_pPropertiesSet;
|
|
||||||
|
|
||||||
// Regbinding
|
|
||||||
CRegBinding rs;
|
|
||||||
|
|
||||||
// methods
|
|
||||||
void displayDrives();
|
|
||||||
void displayPath();
|
|
||||||
Properties* readRomData(CString binFile);
|
|
||||||
|
|
||||||
// Construction
|
|
||||||
public:
|
public:
|
||||||
GameList();
|
GameList();
|
||||||
virtual ~GameList();
|
virtual ~GameList();
|
||||||
// Methods
|
|
||||||
|
|
||||||
|
void init(PropertiesSet* newPropertiesSet,
|
||||||
|
SettingsWin32* settings, CWnd* newParent);
|
||||||
|
|
||||||
CString getCurrentNote();
|
CString getCurrentNote();
|
||||||
CString getPath() {return m_Path;}
|
CString getPath() { return myRomPath; }
|
||||||
int getRomCount() {return m_RomCount;}
|
uInt32 getRomCount() { return myRomCount; }
|
||||||
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Overrides
|
|
||||||
// ClassWizard generated virtual function overrides
|
|
||||||
//{{AFX_VIRTUAL(GameList)
|
|
||||||
public:
|
|
||||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
//}}AFX_VIRTUAL
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
public:
|
|
||||||
void insertColumns();
|
void insertColumns();
|
||||||
void populateRomList();
|
void populateRomList();
|
||||||
void init(PropertiesSet* newPropertiesSet, CWnd* newParent);
|
|
||||||
void deleteItemsAndProperties();
|
void deleteItemsAndProperties();
|
||||||
CString getCurrentFile();
|
CString getCurrentFile();
|
||||||
CString getCurrentName();
|
CString getCurrentName();
|
||||||
|
|
||||||
// Generated message map functions
|
private:
|
||||||
|
// members saved in registry
|
||||||
|
CString myRomPath;
|
||||||
|
uInt32 myRomCount;
|
||||||
|
CWnd* m_pParent;
|
||||||
|
PropertiesSet* myPropertiesSet;
|
||||||
|
SettingsWin32* mySettings;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void displayDrives();
|
||||||
|
void displayPath();
|
||||||
|
Properties* readRomData(CString binFile);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//{{AFX_MSG(GameList)
|
|
||||||
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
afx_msg void OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult);
|
afx_msg void OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
|
afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
//}}AFX_MSG
|
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
#endif
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
||||||
|
|
||||||
#endif // !defined(AFX_GAMELIST_H__1EF8C3E1_4D6A_11D6_ACFC_0048546D2F04__INCLUDED_)
|
|
||||||
|
|
|
@ -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: MainWin32.cxx,v 1.4 2003-11-19 21:06:27 stephena Exp $
|
// $Id: MainWin32.cxx,v 1.5 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#define STRICT
|
#define STRICT
|
||||||
|
@ -55,10 +55,10 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a sound object for playing audio
|
// Create a sound object for playing audio
|
||||||
// string driver = theSettings.getString("sound");
|
string sounddriver = theSettings.getString("sound");
|
||||||
// if(driver != "0")
|
if(sounddriver == "win32")
|
||||||
// theSound = new SoundWin32();
|
theSound = new SoundWin32();
|
||||||
// else
|
else
|
||||||
theSound = new Sound();
|
theSound = new Sound();
|
||||||
if(!theSound)
|
if(!theSound)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// theSound->setSoundVolume(theSettings.getInt("volume"));
|
theSound->setVolume(theSettings.getInt("volume"));
|
||||||
|
|
||||||
// Create the 2600 game console
|
// Create the 2600 game console
|
||||||
theConsole = new Console(image, size, filename, theSettings, thePropertiesSet,
|
theConsole = new Console(image, size, filename, theSettings, thePropertiesSet,
|
||||||
|
@ -77,6 +77,10 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
||||||
// This must be done after the console is created, since at this
|
// This must be done after the console is created, since at this
|
||||||
// point we know that the FrameBuffer has been fully initialized
|
// point we know that the FrameBuffer has been fully initialized
|
||||||
|
|
||||||
|
// Initialize SoundWin32
|
||||||
|
if(sounddriver == "win32")
|
||||||
|
((SoundWin32*)theSound)->Initialize(theDisplay->hwnd());
|
||||||
|
|
||||||
// Initialize DirectInput
|
// Initialize DirectInput
|
||||||
theInput = new DirectInput();
|
theInput = new DirectInput();
|
||||||
if(!theInput)
|
if(!theInput)
|
||||||
|
@ -92,9 +96,6 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
MainWin32::~MainWin32()
|
MainWin32::~MainWin32()
|
||||||
{
|
{
|
||||||
// Save the settings for this instance of the console
|
|
||||||
theConsole->settings().saveConfig();
|
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,17 +13,45 @@
|
||||||
// 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: SettingsWin32.cxx,v 1.3 2003-11-19 21:06:27 stephena Exp $
|
// $Id: SettingsWin32.cxx,v 1.4 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <afxwin.h>
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
#include "Console.hxx"
|
||||||
|
#include "Settings.hxx"
|
||||||
#include "SettingsWin32.hxx"
|
#include "SettingsWin32.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
SettingsWin32::SettingsWin32()
|
SettingsWin32::SettingsWin32()
|
||||||
{
|
{
|
||||||
mySettingsInputFilename = "stellarc";
|
// First set variables that the parent class needs
|
||||||
mySettingsOutputFilename = "stellarc";
|
myBaseDir = ".\\"; // TODO - this should change to per-user location if using Windows XP
|
||||||
|
|
||||||
|
myStateDir = myBaseDir + "state\\";
|
||||||
|
CreateDirectory(myStateDir.c_str(), NULL);
|
||||||
|
|
||||||
|
// TODO - these should reflect user vs. system files
|
||||||
|
myUserPropertiesFile = myBaseDir + "stella.pro";
|
||||||
|
mySystemPropertiesFile = myBaseDir + "stella.pro";
|
||||||
|
myUserConfigFile = myBaseDir + "stellarc";
|
||||||
|
mySystemConfigFile = myBaseDir + "stellarc";
|
||||||
|
|
||||||
|
// Set up the names of the input and output config files
|
||||||
|
mySettingsOutputFilename = myUserConfigFile;
|
||||||
|
mySettingsInputFilename = mySystemConfigFile;
|
||||||
|
|
||||||
|
mySnapshotFile = "";
|
||||||
|
myStateFile = "";
|
||||||
|
|
||||||
|
// Now create Win32 specific settings
|
||||||
|
set("autoselect_video", "false");
|
||||||
|
set("disable_joystick", "true");
|
||||||
|
set("rompath", "");
|
||||||
|
set("sound", "win");
|
||||||
|
set("volume", "-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -34,7 +62,15 @@ SettingsWin32::~SettingsWin32()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string SettingsWin32::stateFilename(uInt32 state)
|
string SettingsWin32::stateFilename(uInt32 state)
|
||||||
{
|
{
|
||||||
|
if(!myConsole)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
ostringstream buf;
|
||||||
|
buf << myStateDir << myConsole->properties().get("Cartridge.MD5")
|
||||||
|
<< ".st" << state;
|
||||||
|
|
||||||
|
myStateFile = buf.str();
|
||||||
|
return myStateFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: SoundWin32.cxx,v 1.3 2003-11-19 21:06:27 stephena Exp $
|
// $Id: SoundWin32.cxx,v 1.4 2003-11-24 01:14:38 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -92,7 +92,7 @@ void SoundWin32::closeDevice()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 SoundWin32::getSampleRate() const
|
uInt32 SoundWin32::getSampleRate() const
|
||||||
{
|
{
|
||||||
return myIsInitializedFlag ? mySampleRate : 0;
|
return mySampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -139,7 +139,10 @@ void SoundWin32::update()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SoundWin32::SoundError(const char* message)
|
void SoundWin32::SoundError(const char* message)
|
||||||
{
|
{
|
||||||
cout << "ERROR in SOUND: " << message << endl;
|
string error = "Error: ";
|
||||||
|
error += message;
|
||||||
|
OutputDebugString(error.c_str());
|
||||||
|
|
||||||
myIsInitializedFlag = false;
|
myIsInitializedFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
// StellaConfig.cpp : implementation file
|
//============================================================================
|
||||||
//
|
//
|
||||||
|
// 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: StellaConfig.cpp,v 1.3 2003-11-24 01:14:38 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "pch.hxx"
|
#include "pch.hxx"
|
||||||
|
#include "bspf.hxx"
|
||||||
|
#include "SettingsWin32.hxx"
|
||||||
#include "Cyberstella.h"
|
#include "Cyberstella.h"
|
||||||
#include "StellaConfig.h"
|
#include "StellaConfig.h"
|
||||||
|
|
||||||
|
@ -11,91 +28,99 @@
|
||||||
static char THIS_FILE[] = __FILE__;
|
static char THIS_FILE[] = __FILE__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// StellaConfig dialog
|
StellaConfig::StellaConfig(SettingsWin32* settings, CWnd* pParent)
|
||||||
|
: CDialog(StellaConfig::IDD, pParent),
|
||||||
|
mySettings(settings)
|
||||||
StellaConfig::StellaConfig(CGlobalData* rGlobalData, CWnd* pParent /*=NULL*/)
|
|
||||||
: CDialog(StellaConfig::IDD, pParent)
|
|
||||||
,m_pGlobalData(rGlobalData)
|
|
||||||
{
|
{
|
||||||
//{{AFX_DATA_INIT(StellaConfig)
|
|
||||||
// NOTE: the ClassWizard will add member initialization here
|
|
||||||
//}}AFX_DATA_INIT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaConfig::DoDataExchange(CDataExchange* pDX)
|
void StellaConfig::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
//{{AFX_DATA_MAP(StellaConfig)
|
|
||||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
||||||
//}}AFX_DATA_MAP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BEGIN_MESSAGE_MAP(StellaConfig, CDialog)
|
BEGIN_MESSAGE_MAP(StellaConfig, CDialog)
|
||||||
//{{AFX_MSG_MAP(StellaConfig)
|
|
||||||
ON_WM_CLOSE()
|
ON_WM_CLOSE()
|
||||||
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
|
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
|
||||||
//}}AFX_MSG_MAP
|
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// StellaConfig message handlers
|
|
||||||
|
|
||||||
BOOL StellaConfig::OnInitDialog()
|
BOOL StellaConfig::OnInitDialog()
|
||||||
{
|
{
|
||||||
CDialog::OnInitDialog();
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Set up PADDLE
|
// Set up PADDLE
|
||||||
CString paddle = "Paddle%d";
|
CString paddle = "Paddle%d";
|
||||||
for (i=0; i<4; i++)
|
for(uInt32 i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
paddle.Format("Paddle %d",i);
|
paddle.Format("Paddle %d",i);
|
||||||
((CComboBox*)GetDlgItem(IDC_PADDLE))->AddString(paddle);
|
((CComboBox*)GetDlgItem(IDC_PADDLE))->AddString(paddle);
|
||||||
}
|
}
|
||||||
((CComboBox*)GetDlgItem(IDC_PADDLE))->SetCurSel(m_pGlobalData->iPaddleMode);
|
|
||||||
|
uInt32 paddlemode = mySettings->getInt("paddle");
|
||||||
|
if(paddlemode < 0 || paddlemode > 4)
|
||||||
|
paddlemode = 0;
|
||||||
|
((CComboBox*)GetDlgItem(IDC_PADDLE))->SetCurSel(paddlemode);
|
||||||
|
|
||||||
// Set up SOUND
|
// Set up SOUND
|
||||||
((CButton*)GetDlgItem(IDC_SOUND))->SetCheck(m_pGlobalData->bNoSound ? BST_CHECKED : BST_UNCHECKED);
|
string sound = mySettings->getString("sound");
|
||||||
|
((CButton*) GetDlgItem(IDC_SOUND))->SetCheck(
|
||||||
|
sound == "0" ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
// Set up AutoSelectVideoMode
|
// Set up AutoSelectVideoMode
|
||||||
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck(m_pGlobalData->bAutoSelectVideoMode ? BST_CHECKED : BST_UNCHECKED);
|
bool autoselect = mySettings->getBool("autoselect_video");
|
||||||
|
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck
|
||||||
|
(autoselect ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
// Set up JOYSTICK
|
// Set up JOYSTICK
|
||||||
((CButton*)GetDlgItem(IDC_JOYSTICK))->SetCheck(m_pGlobalData->bJoystickIsDisabled ? BST_CHECKED : BST_UNCHECKED);
|
bool joystick = mySettings->getBool("disable_joystick");
|
||||||
|
((CButton*)GetDlgItem(IDC_JOYSTICK))->SetCheck
|
||||||
|
(joystick ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
return TRUE; // return TRUE unless you set the focus to a control
|
return TRUE;
|
||||||
// EXCEPTION: OCX Property Pages should return FALSE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaConfig::OnClose()
|
void StellaConfig::OnClose()
|
||||||
{
|
{
|
||||||
retrieveData();
|
retrieveData();
|
||||||
CDialog::OnClose();
|
CDialog::OnClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BOOL StellaConfig::DestroyWindow()
|
BOOL StellaConfig::DestroyWindow()
|
||||||
{
|
{
|
||||||
retrieveData();
|
retrieveData();
|
||||||
return CDialog::DestroyWindow();
|
return CDialog::DestroyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaConfig::retrieveData()
|
void StellaConfig::retrieveData()
|
||||||
{
|
{
|
||||||
// Apply changes
|
string tmp;
|
||||||
m_pGlobalData->iPaddleMode = ((CComboBox*)GetDlgItem(IDC_PADDLE))->GetCurSel();
|
|
||||||
m_pGlobalData->bNoSound = ((CButton*)GetDlgItem(IDC_SOUND))->GetCheck();
|
|
||||||
m_pGlobalData->bAutoSelectVideoMode = ((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->GetCheck();
|
|
||||||
m_pGlobalData->bJoystickIsDisabled = ((CButton*)GetDlgItem(IDC_JOYSTICK))->GetCheck();
|
|
||||||
|
|
||||||
// Set modify flag
|
// Apply changes
|
||||||
m_pGlobalData->bIsModified = true;
|
mySettings->setInt("paddle", (uInt32) ((CComboBox*)GetDlgItem(IDC_PADDLE))->GetCurSel());
|
||||||
|
|
||||||
|
if(((CButton*)GetDlgItem(IDC_SOUND))->GetCheck())
|
||||||
|
mySettings->setString("sound", "0");
|
||||||
|
else
|
||||||
|
mySettings->setString("sound", "win32");
|
||||||
|
|
||||||
|
mySettings->setBool("autoselect_video",
|
||||||
|
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->GetCheck());
|
||||||
|
|
||||||
|
mySettings->setBool("joystick_disabled",
|
||||||
|
((CButton*)GetDlgItem(IDC_JOYSTICK))->GetCheck());
|
||||||
|
|
||||||
|
// Save any settings that were changed
|
||||||
|
mySettings->saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaConfig::OnContinue()
|
void StellaConfig::OnContinue()
|
||||||
{
|
{
|
||||||
EndDialog(1);
|
EndDialog(1);
|
||||||
|
|
|
@ -1,56 +1,60 @@
|
||||||
#if !defined(AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_)
|
//============================================================================
|
||||||
#define AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_
|
//
|
||||||
|
// 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: StellaConfig.h,v 1.2 2003-11-24 01:14:38 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef STELLA_CONFIG_H
|
||||||
|
#define STELLA_CONFIG_H
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
#include "GlobalData.hxx"
|
#include "SettingsWin32.hxx"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// StellaConfig dialog
|
|
||||||
|
|
||||||
class StellaConfig : public CDialog
|
class StellaConfig : public CDialog
|
||||||
{
|
{
|
||||||
// Construction
|
|
||||||
public:
|
public:
|
||||||
StellaConfig(CGlobalData* rGlobalData, CWnd* pParent = NULL); // standard constructor
|
StellaConfig(SettingsWin32* settings, CWnd* pParent = NULL);
|
||||||
|
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
//{{AFX_DATA(StellaConfig)
|
|
||||||
enum { IDD = IDD_CONFIG_PAGE };
|
enum { IDD = IDD_CONFIG_PAGE };
|
||||||
// NOTE: the ClassWizard will add data members here
|
|
||||||
//}}AFX_DATA
|
|
||||||
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
// ClassWizard generated virtual function overrides
|
|
||||||
//{{AFX_VIRTUAL(StellaConfig)
|
|
||||||
public:
|
public:
|
||||||
virtual BOOL DestroyWindow();
|
virtual BOOL DestroyWindow();
|
||||||
protected:
|
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
||||||
//}}AFX_VIRTUAL
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
protected:
|
protected:
|
||||||
|
// DDX/DDV support
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX);
|
||||||
|
|
||||||
// Generated message map functions
|
|
||||||
//{{AFX_MSG(StellaConfig)
|
|
||||||
virtual BOOL OnInitDialog();
|
virtual BOOL OnInitDialog();
|
||||||
afx_msg void OnClose();
|
afx_msg void OnClose();
|
||||||
afx_msg void OnBrowse();
|
afx_msg void OnBrowse();
|
||||||
afx_msg void OnContinue();
|
afx_msg void OnContinue();
|
||||||
//}}AFX_MSG
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// member
|
// The settings for this session
|
||||||
CGlobalData* m_pGlobalData;
|
SettingsWin32* mySettings;
|
||||||
|
|
||||||
// method
|
// method
|
||||||
void retrieveData();
|
void retrieveData();
|
||||||
};
|
};
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
#endif
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
||||||
|
|
||||||
#endif // !defined(AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_)
|
|
||||||
|
|
Loading…
Reference in New Issue