Integrated the Settings/SettingsWin32 classes into the StellaX frontend.

That means I was able to ditch the ugly INI file code, and use the Settings
classes directly.  It also means I don't have to pass many options to Stella
commandline program through commandline arguments, since they'll already
be in the config file.

This is the beginning of fully integrating the Stella commandline program
with the StellaX GUI.  It won't happen for this release, but in later
releases these may become one program again.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@254 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-05-28 23:16:26 +00:00
parent 6f9618a4da
commit c9f9448e77
14 changed files with 206 additions and 292 deletions

View File

@ -14,7 +14,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: ConfigPage.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: ConfigPage.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#include "pch.hxx" #include "pch.hxx"
@ -22,8 +22,12 @@
#include "resource.h" #include "resource.h"
#include "BrowseForFolder.hxx" #include "BrowseForFolder.hxx"
#include "bspf.hxx"
#include "Settings.hxx"
CConfigPage::CConfigPage( CGlobalData& rGlobalData ) CConfigPage::CConfigPage( CGlobalData& rGlobalData )
: m_rGlobalData( rGlobalData ), : myGlobalData( rGlobalData ),
CPropertyPage( IDD_CONFIG_PAGE ) CPropertyPage( IDD_CONFIG_PAGE )
{ {
} }
@ -34,14 +38,17 @@ BOOL CConfigPage::OnInitDialog( HWND hwnd )
m_hwnd = hwnd; m_hwnd = hwnd;
HWND hwndCtrl; HWND hwndCtrl;
// Reload settings just in case the emulation changed them
myGlobalData.settings().loadConfig();
// Set up ROMPATH // Set up ROMPATH
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH ); hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH );
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 ); ::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
::SetWindowText( hwndCtrl, m_rGlobalData.RomDir() ); ::SetWindowText( hwndCtrl,
myGlobalData.settings().getString("romdir").c_str() );
// Set up PADDLE // Set up PADDLE
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE ); hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
TCHAR psz[4] = _T("0"); TCHAR psz[4] = _T("0");
TCHAR i; TCHAR i;
for ( i = 0; i < 4; ++i ) for ( i = 0; i < 4; ++i )
@ -49,12 +56,31 @@ BOOL CConfigPage::OnInitDialog( HWND hwnd )
psz[0] = _T('0') + i; psz[0] = _T('0') + i;
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz ); ::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
} }
::SendMessage( hwndCtrl, CB_SETCURSEL,
myGlobalData.settings().getInt("paddle"), 0 );
::SendMessage( hwndCtrl, CB_SETCURSEL, m_rGlobalData.PaddleMode(), 0 ); // Set up Video mode
int videomode = 0;
hwndCtrl = ::GetDlgItem( hwnd, IDC_VIDEO );
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"Software" );
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)"OpenGL" );
if(myGlobalData.settings().getString("video") == "soft")
videomode = 0;
else if(myGlobalData.settings().getString("video") == "gl")
videomode = 1;
::SendMessage( hwndCtrl, CB_SETCURSEL, videomode, 0 );
// Set up Aspect Ratio
hwndCtrl = ::GetDlgItem( hwnd, IDC_ASPECT );
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
::SetWindowText( hwndCtrl,
myGlobalData.settings().getString("gl_aspect").c_str() );
// Set up SOUND // Set up SOUND
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND ); hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
::SendMessage( hwndCtrl, BM_SETCHECK, m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED, 0 ); ::SendMessage( hwndCtrl, BM_SETCHECK,
myGlobalData.settings().getBool("sound")
? BST_UNCHECKED : BST_CHECKED, 0 );
return TRUE; return TRUE;
} }
@ -71,20 +97,52 @@ LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
// HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet! // HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet!
HWND hwndCtrl; HWND hwndCtrl;
TCHAR buffer[ MAX_PATH ];
string str;
int i;
bool b;
// RomPath
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH ); hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH );
ASSERT( hwndCtrl ); ASSERT( hwndCtrl );
::GetWindowText( hwndCtrl, m_rGlobalData.m_pszRomDir, MAX_PATH ); ::GetWindowText( hwndCtrl, buffer, MAX_PATH );
myGlobalData.settings().setString( "romdir", buffer );
// Paddle
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE ); hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE );
ASSERT( hwndCtrl ); ASSERT( hwndCtrl );
m_rGlobalData.m_nPaddleMode = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ); myGlobalData.settings().setInt( "paddle",
::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 ) );
// VideoMode
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_VIDEO );
ASSERT( hwndCtrl );
i = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
if( i == 0 )
str = "soft";
else if( i == 1 )
str = "gl";
else
str = "soft";
myGlobalData.settings().setString( "video", str );
// AspectRatio
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ASPECT );
ASSERT( hwndCtrl );
::GetWindowText( hwndCtrl, buffer, MAX_PATH );
myGlobalData.settings().setString( "gl_aspect", buffer );
// Sound
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_SOUND ); hwndCtrl = ::GetDlgItem( m_hwnd, IDC_SOUND );
ASSERT( hwndCtrl ); ASSERT( hwndCtrl );
m_rGlobalData.m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED ); if( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED )
b = false;
else
b = true;
myGlobalData.settings().setBool( "sound", b );
m_rGlobalData.SetModified(); // Finally, save the config file
myGlobalData.settings().saveConfig();
return PSNRET_NOERROR; return PSNRET_NOERROR;
} }

View File

@ -14,12 +14,11 @@
// 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: ConfigPage.hxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: ConfigPage.hxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#ifndef CONFIGPG_H #ifndef CONFIGPG_H
#define CONFIGPG_H #define CONFIGPG_H
//FIXME #pragma once
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"
@ -37,10 +36,10 @@ class CConfigPage : public CPropertyPage
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ ); virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
private: private:
CGlobalData& m_rGlobalData; CGlobalData& myGlobalData;
HWND m_hwnd; HWND m_hwnd;
CConfigPage( const CConfigPage& ); // no implementation CConfigPage( const CConfigPage& ); // no implementation
void operator=( const CConfigPage& ); // no implementation void operator=( const CConfigPage& ); // no implementation
}; };

View File

@ -14,126 +14,26 @@
// 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: GlobalData.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: GlobalData.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#include "pch.hxx" #include "pch.hxx"
#include "GlobalData.hxx"
#include "resource.h" #include "resource.h"
static LPCTSTR g_pszIniFile = _T(".\\stellax.ini"); #include "Settings.hxx"
static LPCTSTR g_pszIniSection = _T("Options"); #include "SettingsWin32.hxx"
#include "GlobalData.hxx"
static LPCTSTR g_pszKeyNameRomPath = _T("RomPath");
static LPCTSTR g_pszKeyNameFrameRate = _T("FrameRate");
static LPCTSTR g_pszKeyNameMute = _T("Mute");
static LPCTSTR g_pszKeyNamePaddle = _T("Paddle");
BOOL WritePrivateProfileInt(
LPCTSTR lpAppName, // section name
LPCTSTR lpKeyName, // key name
int nValue,
LPCTSTR lpFileName // initialization file
)
{
TCHAR psz[ 50 ];
_itoa( nValue, psz, 10 );
return ::WritePrivateProfileString( lpAppName, lpKeyName, psz, lpFileName );
}
CGlobalData::CGlobalData( HINSTANCE hInstance ) CGlobalData::CGlobalData( HINSTANCE hInstance )
: m_hInstance(hInstance), : myInstance(hInstance)
m_fIsModified( FALSE )
{ {
m_pszPathName[0] = _T('\0'); myPathName[0] = _T('\0');
mySettings = new SettingsWin32();
// Read the ROM directory from the stella.ini file
// default to "ROMS" directory for compatibility with older StellaX
::GetPrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath,
_T("ROMS"),
m_pszRomDir, _MAX_PATH,
g_pszIniFile);
// Read the desired frame rate
m_nDesiredFrameRate = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate,
60,
g_pszIniFile );
if (m_nDesiredFrameRate < 1 || m_nDesiredFrameRate > 300)
m_nDesiredFrameRate = 60;
// Read Mute
m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute,
FALSE,
g_pszIniFile );
// Read the Paddle mode
m_nPaddleMode = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle,
0,
g_pszIniFile);
if ( m_nPaddleMode < 0 || m_nPaddleMode > 3 )
m_nPaddleMode = 0;
} }
CGlobalData::~CGlobalData() CGlobalData::~CGlobalData()
{ {
// Write out settings (if changed) if(mySettings)
if ( m_fIsModified ) delete mySettings;
{
// RomPath
::WritePrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath,
m_pszRomDir,
g_pszIniFile );
// FrameRate
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate,
m_nDesiredFrameRate,
g_pszIniFile );
// Mute
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute,
m_fNoSound,
g_pszIniFile );
// Paddle
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle,
m_nPaddleMode,
g_pszIniFile );
}
} }
BOOL CGlobalData::ParseCommandLine(
int argc,
TCHAR** argv
)
{
// parse arguments
for (int i = 1; i < argc; ++i)
{
LPCTSTR ctszArg = argv[i];
if (ctszArg && (ctszArg[0] != _T('-')))
{
// assume this is the start rom name
lstrcpy( m_pszPathName, ctszArg );
}
else
{
return FALSE;
}
}
return TRUE;
}

View File

@ -1,28 +1,30 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll
// SS SS tt ll ll // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// 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: GlobalData.hxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: GlobalData.hxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#ifndef GLOBALS_H #ifndef GLOBAL_DATA_HXX
#define GLOBALS_H #define GLOBAL_DATA_HXX
#include "pch.hxx" #include "pch.hxx"
#include "bspf.hxx"
class CConfigPage; class CConfigPage;
class Settings;
class CGlobalData class CGlobalData
{ {
@ -30,70 +32,35 @@ class CGlobalData
public: public:
CGlobalData( HINSTANCE hInstance ); CGlobalData( HINSTANCE hInstance );
~CGlobalData( ); ~CGlobalData( void );
BOOL ParseCommandLine( int argc, TCHAR* argv[] );
int DesiredFrameRate( void ) const
{
return m_nDesiredFrameRate;
}
// Booleans
BOOL NoSound() const
{
return m_fNoSound;
}
int PaddleMode( void ) const
{
return m_nPaddleMode;
}
LPCTSTR PathName( void ) const LPCTSTR PathName( void ) const
{ {
if ( m_pszPathName[0] == _T('\0') ) if ( myPathName[0] == _T('\0') )
return NULL; return NULL;
return m_pszPathName; return myPathName;
} }
LPCTSTR RomDir( void ) const
{
return m_pszRomDir;
}
HINSTANCE ModuleInstance( void ) const HINSTANCE ModuleInstance( void ) const
{ {
return m_hInstance; return myInstance;
} }
// Modified flags Settings& settings( void )
void SetModified( void )
{ {
m_fIsModified = TRUE; return *mySettings;
}
BOOL IsModified( void ) const
{
return m_fIsModified;
} }
private: private:
// Basic options Settings* mySettings;
TCHAR m_pszRomDir[ MAX_PATH ];
int m_nPaddleMode;
BOOL m_fNoSound;
// Advanced options string myArgumentList;
int m_nDesiredFrameRate;
HINSTANCE m_hInstance; HINSTANCE myInstance;
TCHAR m_pszPathName[ MAX_PATH ]; TCHAR myPathName[ MAX_PATH ];
BOOL m_fIsModified; CGlobalData( const CGlobalData& ); // no implementation
CGlobalData( const CGlobalData& ); // no implementation
void operator=( const CGlobalData& ); // no implementation void operator=( const CGlobalData& ); // no implementation
}; };

View File

@ -1,20 +1,20 @@
//============================================================================ //============================================================================
// //
// SSSS tt lll lll // SSSS tt lll lll
// SS SS tt ll ll // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa // SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa // SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller // Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony // Copyright (c) 2004 by Stephen Anthony
// //
// 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: MainDlg.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: MainDlg.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#include "pch.hxx" #include "pch.hxx"
@ -25,6 +25,7 @@
#include "DocPage.hxx" #include "DocPage.hxx"
#include "ConfigPage.hxx" #include "ConfigPage.hxx"
#include "resource.h" #include "resource.h"
#include "Settings.hxx"
#define BKGND_BITMAP_TOP 64 #define BKGND_BITMAP_TOP 64
#define BKGND_BITMAP_BOTTOM 355 #define BKGND_BITMAP_BOTTOM 355
@ -46,7 +47,7 @@ inline LPARAM ListView_GetItemData( HWND hwndList, int iItem )
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CMainDlg::CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance ) CMainDlg::CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance )
: m_rGlobalData(rGlobalData), : myGlobalData(rGlobalData),
m_hInstance(hInstance) m_hInstance(hInstance)
{ {
} }
@ -271,7 +272,8 @@ BOOL CMainDlg::OnInitDialog( void )
SetDlgItemText( hwnd, IDC_ROMCOUNT, psz ); SetDlgItemText( hwnd, IDC_ROMCOUNT, psz );
// Show rom path // Show rom path
SetDlgItemText( hwnd, IDC_ROMPATH, m_rGlobalData.RomDir() ); SetDlgItemText( hwnd, IDC_ROMPATH,
myGlobalData.settings().getString("romdir").c_str() );
// Set default button // Set default button
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 ); ::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
@ -306,7 +308,7 @@ BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem ); pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem );
TCHAR pszPathName[ MAX_PATH + 1 ]; TCHAR pszPathName[ MAX_PATH + 1 ];
lstrcpy( pszPathName, m_rGlobalData.RomDir() ); lstrcpy( pszPathName, myGlobalData.settings().getString("romdir").c_str() );
lstrcat( pszPathName, _T("\\") ); lstrcat( pszPathName, _T("\\") );
lstrcat( pszPathName, lstrcat( pszPathName,
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) ); pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
@ -316,7 +318,7 @@ BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
(void)m_stella.PlayROM( hwnd, pszPathName, (void)m_stella.PlayROM( hwnd, pszPathName,
pListData->GetTextForColumn( CListData::NAME_COLUMN ), pListData->GetTextForColumn( CListData::NAME_COLUMN ),
m_rGlobalData ); myGlobalData );
::EnableWindow( hwnd, TRUE ); ::EnableWindow( hwnd, TRUE );
@ -336,7 +338,7 @@ BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
{ {
CPropertySheet ps( _T("Configure"), hwnd ); CPropertySheet ps( _T("Configure"), hwnd );
CConfigPage pgConfig( m_rGlobalData ); CConfigPage pgConfig( myGlobalData );
ps.AddPage( &pgConfig ); ps.AddPage( &pgConfig );
(void)ps.DoModal(); (void)ps.DoModal();
@ -490,7 +492,7 @@ DWORD CMainDlg::PopulateRomList( void )
TCHAR pszPath[ MAX_PATH ]; TCHAR pszPath[ MAX_PATH ];
lstrcpy( pszPath, m_rGlobalData.RomDir() ); lstrcpy( pszPath, myGlobalData.settings().getString("romdir").c_str() );
lstrcat( pszPath, _T("\\*.bin") ); lstrcat( pszPath, _T("\\*.bin") );
WIN32_FIND_DATA ffd; WIN32_FIND_DATA ffd;
@ -580,7 +582,7 @@ DWORD CMainDlg::ReadRomData(
TCHAR pszPath[MAX_PATH + 1]; TCHAR pszPath[MAX_PATH + 1];
lstrcpy( pszPath, m_rGlobalData.RomDir() ); lstrcpy( pszPath, myGlobalData.RomDir() );
lstrcat( pszPath, _T("\\") ); lstrcat( pszPath, _T("\\") );
lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) ); lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );

View File

@ -248,7 +248,7 @@ private:
// Stella stuff // Stella stuff
CGlobalData& m_rGlobalData; CGlobalData& myGlobalData;
CStellaXMain m_stella; CStellaXMain m_stella;
CMainDlg( const CMainDlg& ); // no implementation CMainDlg( const CMainDlg& ); // no implementation

View File

@ -13,16 +13,16 @@
// 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.2 2004-05-28 22:07:57 stephena Exp $ // $Id: SettingsWin32.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#include <cstdlib> //#include <cstdlib>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <unistd.h> //#include <unistd.h>
#include <sys/stat.h> //#include <sys/stat.h>
#include <sys/types.h> //#include <sys/types.h>
#include "bspf.hxx" #include "bspf.hxx"
#include "Settings.hxx" #include "Settings.hxx"
@ -44,8 +44,8 @@ SettingsWin32::SettingsWin32()
myUserPropertiesFile = stelladir + "stella.pro"; myUserPropertiesFile = stelladir + "stella.pro";
mySystemPropertiesFile = stelladir + "stella.pro"; mySystemPropertiesFile = stelladir + "stella.pro";
myUserConfigFile = stelladir + "stellarc"; myUserConfigFile = stelladir + "stella.ini";
mySystemConfigFile = stelladir + "stellarc"; mySystemConfigFile = stelladir + "stella.ini";
// Set up the names of the input and output config files // Set up the names of the input and output config files
mySettingsOutputFilename = myUserConfigFile; mySettingsOutputFilename = myUserConfigFile;
@ -58,6 +58,7 @@ SettingsWin32::SettingsWin32()
myStateFile = ""; myStateFile = "";
// Now create Win32 specific settings // Now create Win32 specific settings
set("romdir", "roms");
set("accurate", "false"); // Don't change this, or the sound will skip set("accurate", "false"); // Don't change this, or the sound will skip
#ifdef SNAPSHOT_SUPPORT #ifdef SNAPSHOT_SUPPORT
set("ssdir", ".\\"); set("ssdir", ".\\");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: SettingsWin32.hxx,v 1.2 2004-05-28 22:07:57 stephena Exp $ // $Id: SettingsWin32.hxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#ifndef SETTINGS_WIN32_HXX #ifndef SETTINGS_WIN32_HXX
@ -26,7 +26,7 @@
This class defines Windows system specific settings. This class defines Windows system specific settings.
@author Stephen Anthony @author Stephen Anthony
@version $Id: SettingsWin32.hxx,v 1.2 2004-05-28 22:07:57 stephena Exp $ @version $Id: SettingsWin32.hxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
*/ */
class SettingsWin32 : public Settings class SettingsWin32 : public Settings
{ {
@ -51,7 +51,7 @@ class SettingsWin32 : public Settings
@return String representing the full path of the state filename. @return String representing the full path of the state filename.
*/ */
virtual string stateFilename(const string& md5, uInt32 state) = 0; virtual string stateFilename(const string& md5, uInt32 state);
/** /**
This method should be called to test whether the given file exists. This method should be called to test whether the given file exists.
@ -60,7 +60,7 @@ class SettingsWin32 : public Settings
@return boolean representing whether or not the file exists @return boolean representing whether or not the file exists
*/ */
virtual bool fileExists(const string& filename) = 0; virtual bool fileExists(const string& filename);
/** /**
Display the commandline settings for this UNIX version of Stella. Display the commandline settings for this UNIX version of Stella.

View File

@ -20,8 +20,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="" AdditionalIncludeDirectories="..\emucore\m6502\src\bspf\src;..\emucore"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BSPF_WIN32" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;BSPF_WIN32;DISPLAY_OPENGL;SNAPSHOT_SUPPORT"
RuntimeLibrary="5" RuntimeLibrary="5"
PrecompiledHeaderFile=".\Debug/Stella.pch" PrecompiledHeaderFile=".\Debug/Stella.pch"
AssemblerListingLocation=".\Debug/" AssemblerListingLocation=".\Debug/"
@ -528,6 +528,12 @@
<File <File
RelativePath="RoundButton.hxx"> RelativePath="RoundButton.hxx">
</File> </File>
<File
RelativePath=".\SettingsWin32.cxx">
</File>
<File
RelativePath=".\SettingsWin32.hxx">
</File>
<File <File
RelativePath="stella.rc"> RelativePath="stella.rc">
</File> </File>
@ -604,6 +610,18 @@
RelativePath="Wnd.hxx"> RelativePath="Wnd.hxx">
</File> </File>
</Filter> </Filter>
<File
RelativePath="..\emucore\Settings.cxx">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\emucore\m6502\src\bspf\src;..\emucore"/>
</FileConfiguration>
</File>
<File
RelativePath="..\emucore\Settings.hxx">
</File>
<File <File
RelativePath="STELLA.ICO"> RelativePath="STELLA.ICO">
</File> </File>

View File

@ -14,7 +14,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: main.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $ // $Id: main.cxx,v 1.3 2004-05-28 23:16:26 stephena Exp $
//============================================================================ //============================================================================
#include "pch.hxx" #include "pch.hxx"
@ -66,8 +66,6 @@ int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
UNUSED_ALWAYS( lpCmdLine ); UNUSED_ALWAYS( lpCmdLine );
UNUSED_ALWAYS( nCmdShow ); UNUSED_ALWAYS( nCmdShow );
DWORD dwRet;
(void)::DeleteFile(g_ctszDebugLog); (void)::DeleteFile(g_ctszDebugLog);
CSingleInstance mutex( _T("StellaXMutex") ); CSingleInstance mutex( _T("StellaXMutex") );
@ -83,36 +81,11 @@ int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
::InitCommonControls(); ::InitCommonControls();
BOOL fOk = FALSE;
CGlobalData globaldata( hInstance ); CGlobalData globaldata( hInstance );
fOk = globaldata.ParseCommandLine( __argc, __argv ); // show the ui
if (!fOk) CMainDlg dlg( globaldata, hInstance );
{ dlg.DoModal( NULL );
MessageBox( hInstance, NULL, IDS_BADARGUMENT );
}
else
{
LPCTSTR ctszPathName = globaldata.PathName();
if (ctszPathName != NULL)
{
// a filename was given on the commandline, skip the UI
CStellaXMain stellax;
dwRet = stellax.Initialize();
if ( dwRet != ERROR_SUCCESS )
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
else
dwRet = stellax.PlayROM( GetDesktopWindow(), ctszPathName,
_T("StellaX"), globaldata );
}
else
{
// show the ui
CMainDlg dlg( globaldata, hInstance );
dlg.DoModal( NULL );
}
}
if ( hrCoInit == S_OK ) if ( hrCoInit == S_OK )
::CoUninitialize(); ::CoUninitialize();

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Visual C++ generated include file.
// Used by Stella.rc // Used by stella.rc
// //
#define IDB_TILE 101 #define IDB_TILE 101
#define IDI_APP 102 #define IDI_APP 102
@ -66,9 +66,11 @@
#define IDC_CONFIG 1015 #define IDC_CONFIG 1015
#define IDC_PADDLE 1017 #define IDC_PADDLE 1017
#define IDC_SOUND 1018 #define IDC_SOUND 1018
#define IDC_JOYSTICK 1019 #define IDC_VOLUME 1019
#define IDC_AUTO_SELECT_VIDEOMODE 1020 #define IDC_VIDEO 1020
#define IDC_BROWSE 1021 #define IDC_ASPECT 1021
#define IDC_BROWSE 1022
#define IDC_EDIT2 1027
#define IDC_INSTRUCTIONS 2000 #define IDC_INSTRUCTIONS 2000
#define IDC_ADOBE 2001 #define IDC_ADOBE 2001
#define ID_FILE_EXIT 32771 #define ID_FILE_EXIT 32771
@ -79,7 +81,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 296 #define _APS_NEXT_RESOURCE_VALUE 296
#define _APS_NEXT_COMMAND_VALUE 32772 #define _APS_NEXT_COMMAND_VALUE 32772
#define _APS_NEXT_CONTROL_VALUE 1022 #define _APS_NEXT_CONTROL_VALUE 1028
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

Binary file not shown.

View File

@ -75,12 +75,12 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "Comments", "This version of StellaX is not to be sold without written permission of the author" VALUE "Comments", "This version of StellaX is released under the GPL."
VALUE "CompanyName", "Jeff Miller (miller@zipcon.net)" VALUE "CompanyName", "Stephen Anthony (stephena@users.sourceforge.net)"
VALUE "FileDescription", "StellaX" VALUE "FileDescription", "StellaX"
VALUE "FileVersion", "1, 4, 0, 0" VALUE "FileVersion", "1, 4, 0, 0"
VALUE "InternalName", "StellaX" VALUE "InternalName", "StellaX"
VALUE "LegalCopyright", "Copyright (C) 2004 Stephen Anthony" VALUE "LegalCopyright", "Copyright (C) 2004 Jeff Miller, Copyright (C) 2004 Stephen Anthony"
VALUE "LegalTrademarks", "n/a" VALUE "LegalTrademarks", "n/a"
VALUE "OriginalFilename", "StellaX.exe" VALUE "OriginalFilename", "StellaX.exe"
VALUE "PrivateBuild", "n/a" VALUE "PrivateBuild", "n/a"
@ -176,32 +176,31 @@ BEGIN
LTEXT "Dedicated To:",-1,7,94,46,8 LTEXT "Dedicated To:",-1,7,94,46,8
END END
IDD_CONFIG_PAGE DIALOG 0, 0, 390, 196 IDD_CONFIG_PAGE DIALOGEX 0, 0, 306, 199
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Options" CAPTION "Options"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN
LTEXT "&ROM (.bin) file path:",-1,7,10,64,8 LTEXT "&ROM (.bin) file path:",-1,7,10,64,8
EDITTEXT IDC_ROMPATH,82,7,246,14,ES_AUTOHSCROLL EDITTEXT IDC_ROMPATH,82,7,152,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BROWSE,333,7,50,14 PUSHBUTTON "&Browse...",IDC_BROWSE,241,7,50,14
LTEXT "Set this to the path where your .bin rom files are located.", LTEXT "Set this to the path where your .bin rom files are located.",
-1,7,25,376,8 -1,7,25,292,8
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,39,376,1 CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,39,292,1
LTEXT "Mouse should emulate &paddle:",-1,7,49,97,8 LTEXT "Mouse should emulate &paddle:",-1,7,49,111,8
COMBOBOX IDC_PADDLE,109,46,48,82,CBS_DROPDOWNLIST | WS_VSCROLL | COMBOBOX IDC_PADDLE,122,47,48,82,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP WS_TABSTOP
LTEXT "Set this to specify which paddle the mouse should emulate. This can be any number from 0 to 3 inclusive.", LTEXT "Set this to specify which paddle the mouse should emulate. This can be any number from 0 to 3 inclusive.",
-1,7,65,333,8 -1,7,66,198,18
CONTROL "",-1,"Static",SS_ETCHEDHORZ,8,82,375,1
CONTROL "&Auto select video mode",IDC_AUTO_SELECT_VIDEOMODE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,90,10
LTEXT "If this is not checked, then a standard video mode (640x480) will be used. Otherwise, StellaX will use the video mode which it believes will work best. You should only uncheck this if you are having video problems while running StellaX.",
-1,7,105,376,18
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,129,374,1
CONTROL "Disable &Sound",IDC_SOUND,"Button",BS_AUTOCHECKBOX | CONTROL "Disable &Sound",IDC_SOUND,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,141,62,10 WS_TABSTOP,7,164,62,10
CONTROL "Disable &Joysticks",IDC_JOYSTICK,"Button", CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,91,291,1
BS_AUTOCHECKBOX | WS_TABSTOP,7,155,70,10 LTEXT "Video Driver:",-1,7,101,67,10
COMBOBOX IDC_VIDEO,67,99,51,35,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
LTEXT "Aspect Ratio:",-1,7,120,55,10
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,136,290,1
EDITTEXT IDC_ASPECT,66,118,50,12,ES_AUTOHSCROLL
END END
@ -240,9 +239,9 @@ BEGIN
IDD_CONFIG_PAGE, DIALOG IDD_CONFIG_PAGE, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 383 RIGHTMARGIN, 299
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 189 BOTTOMMARGIN, 192
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View File

@ -1,5 +0,0 @@
[Options]
RomPath=C:\Dell
FrameRate=60
Mute=1
Paddle=3