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
|
||||
// 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>
|
||||
|
@ -141,8 +141,9 @@ bool Settings::loadCommandLine(Int32 argc, char** argv)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Settings::saveConfig()
|
||||
{
|
||||
if(!myConsole)
|
||||
return;
|
||||
// if(!myConsole)
|
||||
// return;
|
||||
// FIXME - there should not be a dependency on Console
|
||||
|
||||
ofstream out(mySettingsOutputFilename.c_str());
|
||||
if(!out || !out.is_open())
|
||||
|
@ -152,8 +153,8 @@ void Settings::saveConfig()
|
|||
}
|
||||
|
||||
// Make sure that any modifications to key remapping is saved
|
||||
set("keymap", myConsole->eventHandler().getKeymap());
|
||||
set("joymap", myConsole->eventHandler().getJoymap());
|
||||
// set("keymap", myConsole->eventHandler().getKeymap());
|
||||
// set("joymap", myConsole->eventHandler().getJoymap());
|
||||
|
||||
out << "; Stella configuration file" << endl
|
||||
<< ";" << endl
|
||||
|
@ -220,6 +221,42 @@ void Settings::set(const string& key, const string& value, bool save)
|
|||
++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
|
||||
{
|
||||
|
@ -237,7 +274,7 @@ float Settings::getFloat(const string& key) const
|
|||
// Try to find the named setting and answer its value
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
if(key == mySettings[i].key)
|
||||
return atof(mySettings[i].value.c_str());
|
||||
return (float) atof(mySettings[i].value.c_str());
|
||||
|
||||
return -1.0;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// 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
|
||||
|
@ -32,7 +32,7 @@ class Console;
|
|||
This class provides an interface for accessing frontend specific settings.
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -106,7 +106,34 @@ class Settings
|
|||
@param value The value to assign to the setting
|
||||
@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:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -187,6 +214,8 @@ class Settings
|
|||
#endif
|
||||
|
||||
protected:
|
||||
void set(const string& key, const string& value, bool save = true);
|
||||
|
||||
string myBaseDir;
|
||||
string myStateDir;
|
||||
string myStateFile;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "pch.hxx"
|
||||
#include "Cyberstella.h"
|
||||
#include "AboutDlg.h"
|
||||
#include ".\aboutdlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -34,9 +35,9 @@ void AboutDlg::DoDataExchange(CDataExchange* pDX)
|
|||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(AboutDlg)
|
||||
// {{AFX_MSG_MAP(AboutDlg)
|
||||
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
|
||||
//}}AFX_MSG_MAP
|
||||
// }} AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,7 +56,7 @@ BOOL AboutDlg::OnInitDialog()
|
|||
m_hlMail_JSM.SetURL( _T("mailto:stephena@users.sourceforge.net?Subject=Cyberstella") );
|
||||
|
||||
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.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
CHyperLink m_hlMail_Stella;
|
||||
CHyperLink m_hlWWW_Stella;
|
||||
CHyperLink m_hlWWW_Mame;
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
|
@ -27,18 +27,18 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
|||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_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
|
||||
// remains consistent on all systems.
|
||||
IDI_FOLDER ICON DISCARDABLE "res\\DIR.ICO"
|
||||
IDI_FOLDER ICON "res\\DIR.ICO"
|
||||
#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
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "res\\STELLA.ICO"
|
||||
IDR_MAINFRAME ICON "res\\STELLA.ICO"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
|
||||
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
|
||||
IDR_MAINFRAME TOOLBAR 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_APP_ABOUT
|
||||
BUTTON IDC_PLAY
|
||||
|
@ -113,7 +113,7 @@ END
|
|||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||
IDR_MAINFRAME MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
|
@ -141,7 +141,7 @@ END
|
|||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
||||
IDR_MAINFRAME ACCELERATORS
|
||||
BEGIN
|
||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||
|
@ -165,7 +165,7 @@ END
|
|||
//
|
||||
|
||||
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
|
||||
STYLE WS_CHILD
|
||||
STYLE DS_SETFONT | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP |
|
||||
|
@ -178,33 +178,34 @@ BEGIN
|
|||
SS_NOPREFIX | WS_GROUP,57,7,254,8
|
||||
END
|
||||
|
||||
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 285, 128
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 322, 138
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Information"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "You must own legal copies of all ROM images you are using. The Stella team 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:",
|
||||
-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 "stephena@users.sourceforge.net",IDC_EMAIL_MAINTAINER,73,
|
||||
76,103,8,SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "http://minbar.org",IDC_WEB_MAINTAINER,190,76,82,8,
|
||||
SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "http://www.cs.mun.ca/~stephena",IDC_WEB_MAINTAINER,188,
|
||||
76,112,8,SS_NOPREFIX | SS_NOTIFY
|
||||
LTEXT "Stella dev team:",-1,7,89,52,8,SS_NOPREFIX
|
||||
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
|
||||
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
|
||||
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
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,268,1
|
||||
PUSHBUTTON "&Continue",IDC_CONTINUE,112,107,60,14
|
||||
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,299,1
|
||||
PUSHBUTTON "&Continue",IDC_CONTINUE,129,117,60,14,BS_CENTER
|
||||
END
|
||||
|
||||
IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 112
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
IDD_CONFIG_PAGE DIALOG 0, 0, 390, 112
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cyberstella Configuration"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
|
@ -225,7 +226,6 @@ BEGIN
|
|||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
|
@ -248,18 +248,13 @@ BEGIN
|
|||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "Cyberstella MFC Application\0"
|
||||
VALUE "FileVersion", "1.4\0"
|
||||
VALUE "InternalName", "Cyberstella\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2003\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "Cyberstella.EXE\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "Cyberstella Application\0"
|
||||
VALUE "ProductVersion", "1.4\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
VALUE "FileDescription", "Cyberstella MFC Application"
|
||||
VALUE "FileVersion", "1.4"
|
||||
VALUE "InternalName", "Cyberstella"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2003"
|
||||
VALUE "OriginalFilename", "Cyberstella.EXE"
|
||||
VALUE "ProductName", "Cyberstella Application"
|
||||
VALUE "ProductVersion", "1.4"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -268,8 +263,6 @@ BEGIN
|
|||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -277,7 +270,7 @@ END
|
|||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CYBERSTELLA_FORM, DIALOG
|
||||
BEGIN
|
||||
|
@ -290,9 +283,9 @@ BEGIN
|
|||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 278
|
||||
RIGHTMARGIN, 315
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 121
|
||||
BOTTOMMARGIN, 131
|
||||
END
|
||||
|
||||
IDD_CONFIG_PAGE, DIALOG
|
||||
|
@ -311,18 +304,18 @@ END
|
|||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "Cyberstella\n\nCybers\n\n\nCyberstella.Document\nCybers Document"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "Cyberstella"
|
||||
AFX_IDS_IDLEMESSAGE "Ready"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_INDICATOR_EXT "EXT"
|
||||
ID_INDICATOR_CAPS "CAP"
|
||||
|
@ -332,7 +325,7 @@ BEGIN
|
|||
ID_INDICATOR_REC "REC"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_NEW "Create a new document\nNew"
|
||||
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"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDC_PLAY "Play the currently selected Game\nPlay"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_MRU_FILE1 "Open this document"
|
||||
ID_FILE_MRU_FILE2 "Open this document"
|
||||
|
@ -372,18 +365,18 @@ BEGIN
|
|||
ID_FILE_MRU_FILE16 "Open this document"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||
|
@ -398,13 +391,13 @@ BEGIN
|
|||
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCSIZE "Change the window size"
|
||||
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"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ALREADYRUNNING "StellaX is already running!"
|
||||
IDS_BADARGUMENT "Unknown argument given on command line"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_CW_FAILED "CreateWindow failed"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DDSDM_FAILED "Unable to set video mode. Your video adapter might be incompatible with stella."
|
||||
IDS_DSCSBFAILED "IDirectSound::CreateSoundBuffer failed"
|
||||
|
@ -461,7 +454,7 @@ BEGIN
|
|||
IDS_RARITY "Rarity"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_STATUSTEXT "%d files found"
|
||||
IDS_STELLA "StellaX"
|
||||
|
@ -477,7 +470,7 @@ BEGIN
|
|||
IDS_DI_INIT_FAILED "Unable to initialize DirectInput object"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
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!"
|
||||
|
|
|
@ -170,28 +170,6 @@
|
|||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</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
|
||||
RelativePath="Cyberstella.cpp">
|
||||
<FileConfiguration
|
||||
|
@ -308,28 +286,6 @@
|
|||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</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
|
||||
RelativePath="HyperLink.cpp">
|
||||
<FileConfiguration
|
||||
|
@ -465,28 +421,6 @@
|
|||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</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
|
||||
Name="Header Files"
|
||||
|
@ -494,9 +428,6 @@
|
|||
<File
|
||||
RelativePath="AboutDlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CRegBinding.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Cyberstella.h">
|
||||
</File>
|
||||
|
@ -515,9 +446,6 @@
|
|||
<File
|
||||
RelativePath="GameList.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="GlobalData.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="HyperLink.h">
|
||||
</File>
|
||||
|
@ -548,9 +476,6 @@
|
|||
<File
|
||||
RelativePath="StellaConfig.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Timer.hxx">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
@ -1793,5 +1718,8 @@
|
|||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="Cyberstella.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
|
|
@ -18,21 +18,6 @@
|
|||
static char THIS_FILE[] = __FILE__;
|
||||
#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
|
||||
|
||||
|
@ -59,9 +44,6 @@ CCyberstellaView::CCyberstellaView()
|
|||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
// FIXME - get rid of this
|
||||
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
|
||||
|
||||
// Create SettingsWin32 object
|
||||
// This should be done before any other xxxWin32 objects are created
|
||||
theSettings = new SettingsWin32();
|
||||
|
@ -71,7 +53,7 @@ CCyberstellaView::CCyberstellaView()
|
|||
thePropertiesSet = new PropertiesSet();
|
||||
|
||||
// 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
|
||||
ifstream stream(filename.c_str());
|
||||
|
@ -90,14 +72,14 @@ CCyberstellaView::CCyberstellaView()
|
|||
|
||||
CCyberstellaView::~CCyberstellaView()
|
||||
{
|
||||
if(m_pGlobalData)
|
||||
delete m_pGlobalData;
|
||||
|
||||
if(thePropertiesSet)
|
||||
delete thePropertiesSet;
|
||||
|
||||
if(theSettings)
|
||||
{
|
||||
theSettings->saveConfig();
|
||||
delete theSettings;
|
||||
}
|
||||
}
|
||||
|
||||
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
|
||||
|
@ -149,8 +131,8 @@ CCyberstellaDoc* CCyberstellaView::GetDocument() // non-debug version is inline
|
|||
|
||||
void CCyberstellaView::OnConfig()
|
||||
{
|
||||
StellaConfig dlg(m_pGlobalData);
|
||||
dlg.DoModal();
|
||||
StellaConfig dlg(theSettings);
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnPlay()
|
||||
|
@ -178,7 +160,7 @@ LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
|||
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||
|
||||
// Init ListCtrl
|
||||
m_List.init(thePropertiesSet,this);
|
||||
m_List.init(thePropertiesSet, theSettings, this);
|
||||
m_List.populateRomList();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "GlobalData.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
#include "GameList.h"
|
||||
|
@ -29,7 +28,6 @@ public:
|
|||
// Attributes
|
||||
public:
|
||||
CCyberstellaDoc* GetDocument();
|
||||
CGlobalData* m_pGlobalData;
|
||||
CImageList m_imglist;
|
||||
|
||||
// Operations
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// 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>
|
||||
|
@ -34,14 +34,14 @@ LPCTSTR FrameBufferWin32::pszClassName = _T("StellaXClass");
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FrameBufferWin32::FrameBufferWin32()
|
||||
: m_piDD( NULL ),
|
||||
m_piDDSPrimary( NULL ),
|
||||
m_piDDSBack( NULL ),
|
||||
m_piDDPalette( NULL ),
|
||||
m_fActiveWindow( TRUE ),
|
||||
: myDD(NULL),
|
||||
myPrimarySurface(NULL),
|
||||
myBackSurface(NULL),
|
||||
myDDPalette(NULL),
|
||||
theZoomLevel(1),
|
||||
theMaxZoomLevel(1),
|
||||
isFullscreen(false)
|
||||
isFullscreen(false),
|
||||
isWindowActive(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -49,51 +49,48 @@ FrameBufferWin32::FrameBufferWin32()
|
|||
FrameBufferWin32::~FrameBufferWin32()
|
||||
{
|
||||
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()
|
||||
{
|
||||
if(m_piDDPalette)
|
||||
if(myDDPalette)
|
||||
{
|
||||
m_piDDPalette->Release();
|
||||
m_piDDPalette = NULL;
|
||||
myDDPalette->Release();
|
||||
myDDPalette = NULL;
|
||||
}
|
||||
|
||||
if ( m_piDDSBack )
|
||||
if(myBackSurface)
|
||||
{
|
||||
m_piDDSBack->Release();
|
||||
m_piDDSBack = NULL;
|
||||
myBackSurface->Release();
|
||||
myBackSurface = NULL;
|
||||
}
|
||||
|
||||
if ( m_piDD )
|
||||
if(myDD)
|
||||
{
|
||||
if ( m_piDDSPrimary )
|
||||
if(myPrimarySurface)
|
||||
{
|
||||
m_piDDSPrimary->Release();
|
||||
m_piDDSPrimary = NULL;
|
||||
myPrimarySurface->Release();
|
||||
myPrimarySurface = NULL;
|
||||
}
|
||||
|
||||
m_piDD->Release();
|
||||
m_piDD = NULL;
|
||||
myDD->Release();
|
||||
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 );
|
||||
|
||||
// Get the game's width and height
|
||||
mySizeGame.cx = myWidth = myMediaSource->width() << 1;
|
||||
mySizeGame.cy = myHeight = myMediaSource->height();
|
||||
myGameSize.cx = myWidth = myMediaSource->width() << 1;
|
||||
myGameSize.cy = myHeight = myMediaSource->height();
|
||||
|
||||
// Initialize the pixel data table
|
||||
for(uInt32 i = 0; i < 256; ++i)
|
||||
|
@ -125,9 +122,9 @@ bool FrameBufferWin32::init()
|
|||
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
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() );
|
||||
cleanup();
|
||||
return false;
|
||||
|
@ -142,181 +139,155 @@ OutputDebugString("got here failed 1");
|
|||
NULL,
|
||||
GetModuleHandle(NULL),
|
||||
this );
|
||||
if( myHWND == NULL )
|
||||
{
|
||||
OutputDebugString("got here failed 2");
|
||||
if(myHWND == NULL )
|
||||
{
|
||||
OutputDebugString("Error: CreateWindowEx FAILED");
|
||||
hr = HRESULT_FROM_WIN32( GetLastError() );
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
::SetFocus( myHWND );
|
||||
::ShowWindow( myHWND, SW_SHOW );
|
||||
::UpdateWindow( myHWND );
|
||||
::SetFocus(myHWND);
|
||||
::ShowWindow(myHWND, SW_SHOW);
|
||||
::UpdateWindow(myHWND);
|
||||
|
||||
::ShowCursor( FALSE );
|
||||
|
||||
//
|
||||
// Initialize DirectDraw
|
||||
//
|
||||
hr = ::CoCreateInstance( CLSID_DirectDraw,
|
||||
NULL,
|
||||
CLSCTX_SERVER,
|
||||
IID_IDirectDraw,
|
||||
(void**)&m_piDD );
|
||||
if( FAILED(hr) )
|
||||
(void**)&myDD );
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("got here failed 3");
|
||||
cleanup();
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize it
|
||||
// This method takes the driver GUID parameter that the DirectDrawCreate
|
||||
// function typically uses (NULL is active display driver)
|
||||
//
|
||||
hr = m_piDD->Initialize( NULL );
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
OutputDebugString("got here failed 4");
|
||||
OutputDebugString("Error: CoCreateInstance FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize it
|
||||
// This method takes the driver GUID parameter that the DirectDrawCreate
|
||||
// function typically uses (NULL is active display driver)
|
||||
hr = myDD->Initialize(NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("Error: DirectDraw Initialize FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the best video mode for game width
|
||||
//
|
||||
//int cx = 640; int cy = 480;
|
||||
int cx = 320; int cy = 240;
|
||||
::SetRect( &m_rectScreen, 0, 0, cx, cy );
|
||||
//int cx = 640; int cy = 480;
|
||||
int cx = 320; int cy = 240;
|
||||
SetRect(&myScreenRect, 0, 0, cx, cy);
|
||||
|
||||
if ( cx == 0 || cy == 0 )
|
||||
if(cx == 0 || cy == 0)
|
||||
{
|
||||
hr = myDD->EnumDisplayModes(0, NULL, this, EnumModesCallback);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
hr = m_piDD->EnumDisplayModes( 0, NULL, this, EnumModesCallback );
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
OutputDebugString("got here failed 5");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
OutputDebugString("Error: Displaymode Enumeration FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_rectScreen.right == 0 || m_rectScreen.bottom == 0 )
|
||||
{
|
||||
OutputDebugString("got here failed 6");
|
||||
hr = E_INVALIDARG;
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
if(myScreenRect.right == 0 || myScreenRect.bottom == 0)
|
||||
{
|
||||
OutputDebugString("Error: ScreenRect INVALID");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
TRACE( "Video Mode Selected: %d x %d", m_rectScreen.right, m_rectScreen.bottom );
|
||||
// compute blit offset to center image
|
||||
myBlitOffset.x = ((myScreenRect.right - myGameSize.cx) / 2);
|
||||
myBlitOffset.y = ((myScreenRect.bottom - myGameSize.cy) / 2);
|
||||
|
||||
// compute blit offset to center image
|
||||
// Set cooperative level
|
||||
hr = myDD->SetCooperativeLevel(myHWND, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("Error: SetCooperativeLevel FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_ptBlitOffset.x = ( ( m_rectScreen.right - mySizeGame.cx ) / 2 );
|
||||
m_ptBlitOffset.y = ( ( m_rectScreen.bottom - mySizeGame.cy ) / 2 );
|
||||
|
||||
// Set cooperative level
|
||||
|
||||
hr = m_piDD->SetCooperativeLevel( myHWND, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
OutputDebugString("got here failed 7");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = m_piDD->SetDisplayMode( m_rectScreen.right, m_rectScreen.bottom, 8 );
|
||||
if ( FAILED(hr) )
|
||||
{
|
||||
OutputDebugString("got here failed 8");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Create the primary surface
|
||||
//
|
||||
hr = myDD->SetDisplayMode(myScreenRect.right, myScreenRect.bottom, 8);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("Error: SetDisplayMode FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the primary surface
|
||||
DDSURFACEDESC ddsd;
|
||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSPrimary, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
OutputDebugString("got here failed 9");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Create the offscreen surface
|
||||
//
|
||||
|
||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
ddsd.dwWidth = mySizeGame.cx;
|
||||
ddsd.dwHeight = mySizeGame.cy;
|
||||
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSBack, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
OutputDebugString("got here failed 10");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Erase the surface
|
||||
//
|
||||
|
||||
HDC hdc;
|
||||
hr = m_piDDSBack->GetDC( &hdc );
|
||||
if ( hr == DD_OK )
|
||||
{
|
||||
::SetBkColor( hdc, RGB(0, 0, 0) );
|
||||
RECT rc;
|
||||
::SetRect( &rc, 0, 0,
|
||||
mySizeGame.cx,
|
||||
mySizeGame.cy );
|
||||
::ExtTextOut( hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
|
||||
|
||||
(void)m_piDDSBack->ReleaseDC( hdc );
|
||||
}
|
||||
|
||||
//
|
||||
// Create Palette
|
||||
//
|
||||
|
||||
PALETTEENTRY pe[256];
|
||||
|
||||
for ( int i = 0; i < 256; ++i )
|
||||
{
|
||||
pe[i].peRed = (BYTE)( (pPalette[i] & 0x00FF0000) >> 16 );
|
||||
pe[i].peGreen = (BYTE)( (pPalette[i] & 0x0000FF00) >> 8 );
|
||||
pe[i].peBlue = (BYTE)( (pPalette[i] & 0x000000FF) );
|
||||
pe[i].peFlags = 0;
|
||||
}
|
||||
|
||||
hr = m_piDD->CreatePalette( DDPCAPS_8BIT,
|
||||
pe,
|
||||
&m_piDDPalette,
|
||||
NULL );
|
||||
if( FAILED(hr) )
|
||||
hr = myDD->CreateSurface(&ddsd, &myPrimarySurface, NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("got here failed 11");
|
||||
OutputDebugString("Error: Create primary surface FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = m_piDDSPrimary->SetPalette( m_piDDPalette );
|
||||
if( FAILED(hr) )
|
||||
// Create the offscreen surface
|
||||
ZeroMemory(&ddsd, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
ddsd.dwWidth = myGameSize.cx;
|
||||
ddsd.dwHeight = myGameSize.cy;
|
||||
|
||||
hr = myDD->CreateSurface(&ddsd, &myBackSurface, NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("got here failed 12");
|
||||
OutputDebugString("Error: Create back surface FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Erase the surface
|
||||
HDC hdc;
|
||||
hr = myBackSurface->GetDC(&hdc);
|
||||
if(hr == DD_OK)
|
||||
{
|
||||
SetBkColor(hdc, RGB(0, 0, 0));
|
||||
RECT rc;
|
||||
SetRect(&rc, 0, 0, myGameSize.cx, myGameSize.cy);
|
||||
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
|
||||
|
||||
(void)myBackSurface->ReleaseDC(hdc);
|
||||
}
|
||||
|
||||
// Create Palette
|
||||
PALETTEENTRY pe[256];
|
||||
for(uInt32 i = 0; i < 256; ++i)
|
||||
{
|
||||
pe[i].peRed = (BYTE)( (pPalette[i] & 0x00FF0000) >> 16 );
|
||||
pe[i].peGreen = (BYTE)( (pPalette[i] & 0x0000FF00) >> 8 );
|
||||
pe[i].peBlue = (BYTE)( (pPalette[i] & 0x000000FF) );
|
||||
pe[i].peFlags = 0;
|
||||
}
|
||||
|
||||
hr = myDD->CreatePalette(DDPCAPS_8BIT, pe, &myDDPalette, NULL );
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("Error: CreatePalette FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = myPrimarySurface->SetPalette(myDDPalette);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
OutputDebugString("Error: SetPalette FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
}
|
||||
|
@ -328,33 +299,21 @@ OutputDebugString("got here failed 12");
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::drawMediaSource()
|
||||
{
|
||||
if(m_piDDSPrimary == NULL || !m_fActiveWindow)
|
||||
if(myPrimarySurface == NULL || !isWindowActive)
|
||||
return;
|
||||
|
||||
HRESULT hr;
|
||||
const BYTE* current = myMediaSource->currentFrameBuffer();
|
||||
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;
|
||||
for(y = 0; y < mySizeGame.cy; ++y)
|
||||
for(y = 0; y < myGameSize.cy; ++y)
|
||||
{
|
||||
const WORD bufofsY = (WORD) ( y * mySizeGame.cx >> 1 );
|
||||
const DWORD screenofsY = ( y * ddsd.lPitch );
|
||||
const WORD bufofsY = (WORD) ( y * myGameSize.cx >> 1 );
|
||||
const DWORD screenofsY = ( y * myDDSurface.lPitch );
|
||||
|
||||
register int x;
|
||||
for(x = 0; x < mySizeGame.cx >> 1; ++x )
|
||||
for(x = 0; x < myGameSize.cx >> 1; ++x )
|
||||
{
|
||||
const WORD bufofs = bufofsY + x;
|
||||
BYTE v = current[ bufofs ];
|
||||
|
@ -366,8 +325,7 @@ void FrameBufferWin32::drawMediaSource()
|
|||
pbBackBytes[ pos + 0 ] = pbBackBytes[ pos + 1 ] = myPalette[v];
|
||||
}
|
||||
}
|
||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
||||
|
||||
|
||||
// The frame doesn't need to be completely redrawn anymore
|
||||
theRedrawEntireFrameIndicator = false;
|
||||
}
|
||||
|
@ -375,22 +333,25 @@ void FrameBufferWin32::drawMediaSource()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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()
|
||||
{
|
||||
// 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
|
||||
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,
|
||||
m_piDDSBack,
|
||||
HRESULT hr = myPrimarySurface->BltFast( myBlitOffset.x, myBlitOffset.y,
|
||||
myBackSurface,
|
||||
&rc,
|
||||
// DDBLTFAST_WAIT |DDBLTFAST_DESTCOLORKEY );
|
||||
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );
|
||||
}
|
||||
|
||||
|
@ -407,25 +368,14 @@ void FrameBufferWin32::toggleFullscreen()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
// acquire pointer to linear video ram
|
||||
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;
|
||||
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||
|
||||
// First draw the background
|
||||
for(uInt32 row = 0; row < h; row++)
|
||||
{
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
@ -433,140 +383,105 @@ void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
|||
// Now draw the surrounding lines
|
||||
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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::drawText(uInt32 xorig, uInt32 yorig, const string& message)
|
||||
{
|
||||
// acquire pointer to linear video ram
|
||||
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;
|
||||
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||
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 z = 0; z < 8; z++)
|
||||
for(uInt32 x = 0; x < 8; x++)
|
||||
{
|
||||
char letter = message[x];
|
||||
if((ourFontData[(letter << 3) + y] >> z) & 1)
|
||||
pbBackBytes[((x<<3) + z + xorig) + (y + yorig) * ddsd.lPitch] =
|
||||
char letter = message[z];
|
||||
if((ourFontData[(letter << 3) + y] >> x) & 1)
|
||||
pbBackBytes[((z<<3) + x + xorig) + (y + yorig) * myDDSurface.lPitch] =
|
||||
myPalette[myFGColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::drawChar(uInt32 xorig, uInt32 yorig, uInt32 c)
|
||||
{
|
||||
// acquire pointer to linear video ram
|
||||
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;
|
||||
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
|
||||
for(uInt32 y = 0; y < 8; y++)
|
||||
{
|
||||
for(uInt32 x = 0; x < 8; x++)
|
||||
{
|
||||
if((ourFontData[(c << 3) + y] >> x) & 1)
|
||||
pbBackBytes[x + xorig + (y + yorig) * ddsd.lPitch] =
|
||||
pbBackBytes[x + xorig + (y + yorig) * myDDSurface.lPitch] =
|
||||
myPalette[myFGColor];
|
||||
}
|
||||
}
|
||||
|
||||
(void)m_piDDSBack->Unlock( ddsd.lpSurface );
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LRESULT CALLBACK FrameBufferWin32::StaticWindowProc(
|
||||
HWND hwnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
LPARAM lParam)
|
||||
{
|
||||
FrameBufferWin32* pThis;
|
||||
FrameBufferWin32* pThis;
|
||||
|
||||
if ( uMsg == WM_CREATE )
|
||||
{
|
||||
pThis = reinterpret_cast<FrameBufferWin32*>(
|
||||
if(uMsg == WM_CREATE)
|
||||
{
|
||||
pThis = reinterpret_cast<FrameBufferWin32*>(
|
||||
reinterpret_cast<CREATESTRUCT*>( lParam )->lpCreateParams );
|
||||
|
||||
::SetWindowLong( hwnd,
|
||||
GWL_USERDATA,
|
||||
reinterpret_cast<LONG>( pThis ) );
|
||||
}
|
||||
else
|
||||
SetWindowLong(hwnd, GWL_USERDATA, reinterpret_cast<LONG>(pThis));
|
||||
}
|
||||
else
|
||||
{
|
||||
pThis = reinterpret_cast<FrameBufferWin32*>(GetWindowLong(hwnd, GWL_USERDATA));
|
||||
}
|
||||
|
||||
if(pThis)
|
||||
{
|
||||
if(pThis->WndProc(uMsg, wParam, lParam))
|
||||
{
|
||||
pThis = reinterpret_cast<FrameBufferWin32*>(
|
||||
::GetWindowLong( hwnd, GWL_USERDATA ) );
|
||||
// Handled message
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pThis )
|
||||
{
|
||||
if ( pThis->WndProc( uMsg, wParam, lParam ) )
|
||||
{
|
||||
//
|
||||
// Handled message
|
||||
//
|
||||
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Unhandled message
|
||||
//
|
||||
|
||||
return ::DefWindowProc( hwnd, uMsg, wParam, lParam );
|
||||
// Unhandled message
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_ACTIVATE:
|
||||
m_fActiveWindow = (wParam != WA_INACTIVE);
|
||||
isWindowActive = (wParam != WA_INACTIVE);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
@ -586,60 +501,41 @@ BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
HRESULT WINAPI FrameBufferWin32::EnumModesCallback(
|
||||
LPDDSURFACEDESC lpDDSurfaceDesc,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
FrameBufferWin32* pThis = (FrameBufferWin32*)lpContext;
|
||||
|
||||
DWORD dwWidthReq = pThis->mySizeGame.cx;
|
||||
DWORD dwHeightReq = pThis->mySizeGame.cy;
|
||||
DWORD dwWidthReq = pThis->myGameSize.cx;
|
||||
DWORD dwHeightReq = pThis->myGameSize.cy;
|
||||
|
||||
DWORD dwWidth = lpDDSurfaceDesc->dwWidth;
|
||||
DWORD dwHeight = lpDDSurfaceDesc->dwHeight;
|
||||
DWORD dwRGBBitCount = lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;
|
||||
|
||||
//
|
||||
// must be 8 bit mode
|
||||
//
|
||||
// Must be 8 bit mode
|
||||
if(dwRGBBitCount != 8)
|
||||
return DDENUMRET_OK;
|
||||
|
||||
if (dwRGBBitCount != 8)
|
||||
{
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
// Must be larger then required screen size
|
||||
if(dwWidth < dwWidthReq || dwHeight < dwHeightReq)
|
||||
return DDENUMRET_OK;
|
||||
|
||||
//
|
||||
// must be larger then required screen size
|
||||
//
|
||||
if(pThis->myScreenRect.right != 0 && pThis->myScreenRect.bottom != 0)
|
||||
{
|
||||
// check to see if this is better than the previous choice
|
||||
if((dwWidth - dwWidthReq) > (pThis->myScreenRect.right - dwWidthReq))
|
||||
return DDENUMRET_OK;
|
||||
|
||||
if ( dwWidth < dwWidthReq || dwHeight < dwHeightReq )
|
||||
{
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
if((dwHeight - dwHeightReq) > (pThis->myScreenRect.bottom - dwHeightReq))
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
if ( pThis->m_rectScreen.right != 0 && pThis->m_rectScreen.bottom != 0 )
|
||||
{
|
||||
//
|
||||
// check to see if this is better than the previous choice
|
||||
//
|
||||
// use it!
|
||||
pThis->myScreenRect.right = dwWidth;
|
||||
pThis->myScreenRect.bottom = dwHeight;
|
||||
|
||||
if ( (dwWidth - dwWidthReq) > (pThis->m_rectScreen.right - dwWidthReq) )
|
||||
{
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
if ( (dwHeight - dwHeightReq) > (pThis->m_rectScreen.bottom - dwHeightReq) )
|
||||
{
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// use it!
|
||||
//
|
||||
|
||||
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
|
||||
// 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
|
||||
|
@ -27,9 +27,10 @@ class MediaSource;
|
|||
|
||||
/**
|
||||
This class implements a DirectX software framebuffer.
|
||||
Only fullscreen mode is supported for now.
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -45,7 +46,7 @@ class FrameBufferWin32 : public FrameBuffer
|
|||
virtual ~FrameBufferWin32();
|
||||
|
||||
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
|
||||
|
@ -140,22 +141,19 @@ class FrameBufferWin32 : public FrameBuffer
|
|||
void cleanup();
|
||||
|
||||
HWND myHWND;
|
||||
bool m_fActiveWindow;
|
||||
|
||||
RECT m_rectScreen;
|
||||
POINT m_ptBlitOffset;
|
||||
RECT myScreenRect;
|
||||
POINT myBlitOffset;
|
||||
|
||||
// Stella objects
|
||||
SIZE mySizeGame;
|
||||
SIZE myGameSize;
|
||||
BYTE myPalette[256];
|
||||
|
||||
//
|
||||
// DirectX
|
||||
//
|
||||
IDirectDraw* m_piDD;
|
||||
IDirectDrawSurface* m_piDDSPrimary;
|
||||
IDirectDrawSurface* m_piDDSBack;
|
||||
IDirectDrawPalette* m_piDDPalette;
|
||||
IDirectDraw* myDD;
|
||||
IDirectDrawSurface* myPrimarySurface;
|
||||
IDirectDrawSurface* myBackSurface;
|
||||
DDSURFACEDESC myDDSurface;
|
||||
IDirectDrawPalette* myDDPalette;
|
||||
|
||||
static LPCTSTR pszClassName;
|
||||
|
||||
|
@ -167,6 +165,9 @@ class FrameBufferWin32 : public FrameBuffer
|
|||
|
||||
// Indicates whether the game is currently in fullscreen
|
||||
bool isFullscreen;
|
||||
|
||||
// Indicates whether the window is currently active
|
||||
bool isWindowActive;
|
||||
};
|
||||
|
||||
#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 "Cyberstella.h"
|
||||
#include "GameList.h"
|
||||
#include "MD5.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
|
||||
class CyberstellaView;
|
||||
|
||||
|
@ -14,30 +30,27 @@ class CyberstellaView;
|
|||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// GameList
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GameList::GameList()
|
||||
: rs("GameList")
|
||||
: myRomPath(""),
|
||||
myRomCount(0)
|
||||
{
|
||||
rs.Bind(m_Path, "ROM Path", "");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GameList::~GameList()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BEGIN_MESSAGE_MAP(GameList, CListCtrl)
|
||||
//{{AFX_MSG_MAP(GameList)
|
||||
// {{AFX_MSG_MAP(GameList)
|
||||
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
|
||||
ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, OnItemActivate)
|
||||
ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemchanged)
|
||||
//}}AFX_MSG_MAP
|
||||
// }}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// GameList message handlers
|
||||
|
||||
// Sort the item in reverse alphabetical order.
|
||||
static int CALLBACK
|
||||
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||
|
@ -114,7 +127,7 @@ void GameList::populateRomList()
|
|||
deleteItemsAndProperties();
|
||||
|
||||
// Add new content
|
||||
if(m_Path.GetLength() > 0)
|
||||
if(myRomPath.GetLength() > 0)
|
||||
{
|
||||
displayPath();
|
||||
}
|
||||
|
@ -130,6 +143,9 @@ void GameList::populateRomList()
|
|||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
|
||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||
|
||||
// Save the current path
|
||||
mySettings->setString("rompath", (const char*) myRomPath);
|
||||
}
|
||||
|
||||
void GameList::displayPath()
|
||||
|
@ -142,15 +158,15 @@ void GameList::displayPath()
|
|||
BOOL first = true;
|
||||
|
||||
// Do pathname
|
||||
if (m_Path.GetAt(m_Path.GetLength()-1) == '\\')
|
||||
searchpath = m_Path + "*.*";
|
||||
if (myRomPath.GetAt(myRomPath.GetLength()-1) == '\\')
|
||||
searchpath = myRomPath + "*.*";
|
||||
else
|
||||
searchpath = m_Path + "\\*.*";
|
||||
searchpath = myRomPath + "\\*.*";
|
||||
|
||||
bFind = find.FindFile(searchpath);
|
||||
|
||||
// Init Rom count
|
||||
m_RomCount = 0;
|
||||
myRomCount = 0;
|
||||
|
||||
while (bFind)
|
||||
{
|
||||
|
@ -224,7 +240,7 @@ void GameList::displayPath()
|
|||
lvi.pszText = name.GetBuffer(name.GetLength());
|
||||
SetItem(&lvi);
|
||||
|
||||
m_RomCount++;
|
||||
myRomCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +268,7 @@ void GameList::displayDrives()
|
|||
int itemCounter;
|
||||
|
||||
// Clear path
|
||||
m_Path = "";
|
||||
myRomPath = "";
|
||||
|
||||
//Enumerate drive letters and add them to list
|
||||
dwDrives = GetLogicalDrives();
|
||||
|
@ -301,25 +317,25 @@ void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
|
|||
|
||||
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
|
||||
{
|
||||
int cutPos = m_Path.ReverseFind('\\');
|
||||
m_Path = m_Path.Left(cutPos);
|
||||
int cutPos = myRomPath.ReverseFind('\\');
|
||||
myRomPath = myRomPath.Left(cutPos);
|
||||
populateRomList();
|
||||
}
|
||||
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
|
||||
{
|
||||
// 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 += "\\";
|
||||
m_Path += dir;
|
||||
myRomPath += "\\";
|
||||
myRomPath += dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Path += dir;
|
||||
myRomPath += dir;
|
||||
}
|
||||
populateRomList();
|
||||
}
|
||||
|
@ -361,7 +377,7 @@ Properties* GameList::readRomData(CString binFile)
|
|||
std::string md5 = MD5(pImage, dwFileSize);
|
||||
// search through the properties set for this MD5
|
||||
Properties* props = new Properties();
|
||||
m_pPropertiesSet->getMD5(md5, *props);
|
||||
myPropertiesSet->getMD5(md5, *props);
|
||||
// Return properties
|
||||
delete[] pImage;
|
||||
VERIFY(::CloseHandle(hFile));
|
||||
|
@ -380,10 +396,10 @@ CString GameList::getCurrentFile()
|
|||
int curSel = GetSelectionMark();
|
||||
if(curSel >= 0)
|
||||
{
|
||||
if (m_Path.GetAt(m_Path.GetLength()-1) != '\\')
|
||||
m_Path += "\\";
|
||||
if (myRomPath.GetAt(myRomPath.GetLength()-1) != '\\')
|
||||
myRomPath += "\\";
|
||||
|
||||
filename = m_Path + GetItemText(curSel,0);
|
||||
filename = myRomPath + GetItemText(curSel,0);
|
||||
}
|
||||
|
||||
return filename;
|
||||
|
@ -410,12 +426,16 @@ CString GameList::getCurrentNote()
|
|||
return "";
|
||||
}
|
||||
|
||||
void GameList::init(PropertiesSet* newPropertiesSet, CWnd* newParent)
|
||||
void GameList::init(PropertiesSet* newPropertiesSet,
|
||||
SettingsWin32* settings, CWnd* newParent)
|
||||
{
|
||||
m_pParent = newParent;
|
||||
m_pPropertiesSet = newPropertiesSet;
|
||||
SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
||||
insertColumns();
|
||||
m_pParent = newParent;
|
||||
myPropertiesSet = newPropertiesSet;
|
||||
mySettings = settings;
|
||||
|
||||
myRomPath = mySettings->getString("rompath").c_str();
|
||||
SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
||||
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
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// GameList.h : header file
|
||||
//
|
||||
|
||||
#include "CRegBinding.h"
|
||||
#include "PropsSet.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// GameList window
|
||||
|
||||
class GameList : public CListCtrl
|
||||
{
|
||||
private:
|
||||
// memebers saved in registry
|
||||
CString m_Path;
|
||||
int m_RomCount;
|
||||
CWnd* m_pParent;
|
||||
PropertiesSet* m_pPropertiesSet;
|
||||
public:
|
||||
GameList();
|
||||
virtual ~GameList();
|
||||
|
||||
// Regbinding
|
||||
CRegBinding rs;
|
||||
|
||||
// methods
|
||||
void displayDrives();
|
||||
void displayPath();
|
||||
Properties* readRomData(CString binFile);
|
||||
void init(PropertiesSet* newPropertiesSet,
|
||||
SettingsWin32* settings, CWnd* newParent);
|
||||
|
||||
// Construction
|
||||
public:
|
||||
GameList();
|
||||
virtual ~GameList();
|
||||
// Methods
|
||||
CString getCurrentNote();
|
||||
CString getPath() {return m_Path;}
|
||||
int getRomCount() {return m_RomCount;}
|
||||
CString getPath() { return myRomPath; }
|
||||
uInt32 getRomCount() { return myRomCount; }
|
||||
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(GameList)
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void insertColumns();
|
||||
void populateRomList();
|
||||
void init(PropertiesSet* newPropertiesSet, CWnd* newParent);
|
||||
void deleteItemsAndProperties();
|
||||
CString getCurrentFile();
|
||||
CString getCurrentName();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(GameList)
|
||||
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
private:
|
||||
// members saved in registry
|
||||
CString myRomPath;
|
||||
uInt32 myRomCount;
|
||||
CWnd* m_pParent;
|
||||
PropertiesSet* myPropertiesSet;
|
||||
SettingsWin32* mySettings;
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
void displayDrives();
|
||||
void displayPath();
|
||||
Properties* readRomData(CString binFile);
|
||||
|
||||
protected:
|
||||
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{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_)
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// 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
|
||||
|
@ -55,10 +55,10 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
|||
}
|
||||
|
||||
// Create a sound object for playing audio
|
||||
// string driver = theSettings.getString("sound");
|
||||
// if(driver != "0")
|
||||
// theSound = new SoundWin32();
|
||||
// else
|
||||
string sounddriver = theSettings.getString("sound");
|
||||
if(sounddriver == "win32")
|
||||
theSound = new SoundWin32();
|
||||
else
|
||||
theSound = new Sound();
|
||||
if(!theSound)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
|||
return;
|
||||
}
|
||||
|
||||
// theSound->setSoundVolume(theSettings.getInt("volume"));
|
||||
theSound->setVolume(theSettings.getInt("volume"));
|
||||
|
||||
// Create the 2600 game console
|
||||
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
|
||||
// point we know that the FrameBuffer has been fully initialized
|
||||
|
||||
// Initialize SoundWin32
|
||||
if(sounddriver == "win32")
|
||||
((SoundWin32*)theSound)->Initialize(theDisplay->hwnd());
|
||||
|
||||
// Initialize DirectInput
|
||||
theInput = new DirectInput();
|
||||
if(!theInput)
|
||||
|
@ -92,9 +96,6 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
MainWin32::~MainWin32()
|
||||
{
|
||||
// Save the settings for this instance of the console
|
||||
theConsole->settings().saveConfig();
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,17 +13,45 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsWin32.cxx,v 1.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 "Console.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsWin32::SettingsWin32()
|
||||
{
|
||||
mySettingsInputFilename = "stellarc";
|
||||
mySettingsOutputFilename = "stellarc";
|
||||
// First set variables that the parent class needs
|
||||
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)
|
||||
{
|
||||
return "";
|
||||
if(!myConsole)
|
||||
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
|
||||
// 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>
|
||||
|
@ -92,7 +92,7 @@ void SoundWin32::closeDevice()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundWin32::getSampleRate() const
|
||||
{
|
||||
return myIsInitializedFlag ? mySampleRate : 0;
|
||||
return mySampleRate;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -139,7 +139,10 @@ void SoundWin32::update()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWin32::SoundError(const char* message)
|
||||
{
|
||||
cout << "ERROR in SOUND: " << message << endl;
|
||||
string error = "Error: ";
|
||||
error += message;
|
||||
OutputDebugString(error.c_str());
|
||||
|
||||
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 "bspf.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
#include "Cyberstella.h"
|
||||
#include "StellaConfig.h"
|
||||
|
||||
|
@ -11,92 +28,100 @@
|
|||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// StellaConfig dialog
|
||||
|
||||
|
||||
StellaConfig::StellaConfig(CGlobalData* rGlobalData, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(StellaConfig::IDD, pParent)
|
||||
,m_pGlobalData(rGlobalData)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StellaConfig::StellaConfig(SettingsWin32* settings, CWnd* pParent)
|
||||
: CDialog(StellaConfig::IDD, pParent),
|
||||
mySettings(settings)
|
||||
{
|
||||
//{{AFX_DATA_INIT(StellaConfig)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaConfig::DoDataExchange(CDataExchange* 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)
|
||||
//{{AFX_MSG_MAP(StellaConfig)
|
||||
ON_WM_CLOSE()
|
||||
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// StellaConfig message handlers
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL StellaConfig::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
int i;
|
||||
// Set up PADDLE
|
||||
CString paddle = "Paddle%d";
|
||||
for(uInt32 i = 0; i < 4; i++)
|
||||
{
|
||||
paddle.Format("Paddle %d",i);
|
||||
((CComboBox*)GetDlgItem(IDC_PADDLE))->AddString(paddle);
|
||||
}
|
||||
|
||||
// Set up PADDLE
|
||||
CString paddle = "Paddle%d";
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
paddle.Format("Paddle %d",i);
|
||||
((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
|
||||
((CButton*)GetDlgItem(IDC_SOUND))->SetCheck(m_pGlobalData->bNoSound ? BST_CHECKED : BST_UNCHECKED);
|
||||
// Set up SOUND
|
||||
string sound = mySettings->getString("sound");
|
||||
((CButton*) GetDlgItem(IDC_SOUND))->SetCheck(
|
||||
sound == "0" ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
// Set up AutoSelectVideoMode
|
||||
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck(m_pGlobalData->bAutoSelectVideoMode ? BST_CHECKED : BST_UNCHECKED);
|
||||
// Set up AutoSelectVideoMode
|
||||
bool autoselect = mySettings->getBool("autoselect_video");
|
||||
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck
|
||||
(autoselect ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
// Set up JOYSTICK
|
||||
((CButton*)GetDlgItem(IDC_JOYSTICK))->SetCheck(m_pGlobalData->bJoystickIsDisabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
// Set up JOYSTICK
|
||||
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
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaConfig::OnClose()
|
||||
{
|
||||
retrieveData();
|
||||
CDialog::OnClose();
|
||||
retrieveData();
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL StellaConfig::DestroyWindow()
|
||||
{
|
||||
retrieveData();
|
||||
return CDialog::DestroyWindow();
|
||||
retrieveData();
|
||||
return CDialog::DestroyWindow();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaConfig::retrieveData()
|
||||
{
|
||||
// Apply changes
|
||||
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();
|
||||
string tmp;
|
||||
|
||||
// Set modify flag
|
||||
m_pGlobalData->bIsModified = true;
|
||||
// Apply changes
|
||||
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()
|
||||
{
|
||||
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
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "GlobalData.hxx"
|
||||
#include "SettingsWin32.hxx"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// StellaConfig dialog
|
||||
|
||||
class StellaConfig : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
StellaConfig(CGlobalData* rGlobalData, CWnd* pParent = NULL); // standard constructor
|
||||
public:
|
||||
StellaConfig(SettingsWin32* settings, CWnd* pParent = NULL);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(StellaConfig)
|
||||
enum { IDD = IDD_CONFIG_PAGE };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_CONFIG_PAGE };
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(StellaConfig)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
protected:
|
||||
// DDX/DDV support
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(StellaConfig)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnBrowse();
|
||||
afx_msg void OnContinue();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
// member
|
||||
CGlobalData* m_pGlobalData;
|
||||
//method
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnBrowse();
|
||||
afx_msg void OnContinue();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
// The settings for this session
|
||||
SettingsWin32* mySettings;
|
||||
|
||||
// method
|
||||
void retrieveData();
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue