Some more code cleanups for the StellaX frontend. The configuration

dialog actually works now without crashing the program.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@250 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-05-27 22:02:35 +00:00
parent a0f6eaa4ff
commit 2f1d07c207
9 changed files with 735 additions and 1020 deletions

View File

@ -1,20 +1,32 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 04/27/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#include "pch.hxx" #include "pch.hxx"
#include "AboutPage.hxx" #include "AboutPage.hxx"
#include "resource.h" #include "resource.h"
CHelpPage::CHelpPage( CHelpPage::CHelpPage()
) : \ : CPropertyPage(IDD_ABOUT_PAGE)
CPropertyPage(IDD_ABOUT_PAGE)
{ {
} }
BOOL CHelpPage::OnInitDialog( BOOL CHelpPage::OnInitDialog( HWND hwnd )
HWND hwnd
)
{ {
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER ); m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
m_hlMail_JSM.SetURL( _T("mailto:sa666_666@hotmail.com?Subject=StellaX") ); m_hlMail_JSM.SetURL( _T("mailto:sa666_666@hotmail.com?Subject=StellaX") );
@ -28,9 +40,6 @@ BOOL CHelpPage::OnInitDialog(
m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA ); m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA );
m_hlWWW_Stella.SetURL( _T("http://stella.sf.net") ); m_hlWWW_Stella.SetURL( _T("http://stella.sf.net") );
m_hlWWW_Mame.SubclassDlgItem( hwnd, IDC_WWW_MAME );
m_hlWWW_Mame.SetURL( _T("http://www.classicgaming.com/mame32qa/") );
// return FALSE if SetFocus is called // return FALSE if SetFocus is called
return TRUE; return TRUE;
} }

View File

@ -1,10 +1,25 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/01/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AboutPage.hxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#ifndef ABOUTPG_H #ifndef ABOUTPG_H
#define ABOUTPG_H #define ABOUTPG_H
#pragma once //FIXME#pragma once
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "HyperLink.hxx" #include "HyperLink.hxx"
@ -12,20 +27,16 @@
class CHelpPage : public CPropertyPage class CHelpPage : public CPropertyPage
{ {
public: public:
CHelpPage(); CHelpPage();
protected: protected:
virtual BOOL OnInitDialog( HWND hwnd ); virtual BOOL OnInitDialog( HWND hwnd );
private: private:
CHyperLink m_hlMail_JSM; CHyperLink m_hlMail_JSM;
CHyperLink m_hlWWW_JSM; CHyperLink m_hlWWW_JSM;
CHyperLink m_hlMail_Stella; CHyperLink m_hlMail_Stella;
CHyperLink m_hlWWW_Stella; CHyperLink m_hlWWW_Stella;
CHyperLink m_hlWWW_Mame;
CHelpPage( const CHelpPage& ); // no implementation CHelpPage( const CHelpPage& ); // no implementation
void operator=( const CHelpPage& ); // no implementation void operator=( const CHelpPage& ); // no implementation

View File

@ -1,47 +1,48 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/07/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#include "pch.hxx" #include "pch.hxx"
#include "ConfigPage.hxx" #include "ConfigPage.hxx"
#include "resource.h" #include "resource.h"
#include "BrowseForFolder.hxx" #include "BrowseForFolder.hxx"
CConfigPage::CConfigPage( CConfigPage::CConfigPage( CGlobalData& rGlobalData )
CGlobalData& rGlobalData : m_rGlobalData( rGlobalData ),
) : \
m_rGlobalData( rGlobalData ),
CPropertyPage( IDD_CONFIG_PAGE ) CPropertyPage( IDD_CONFIG_PAGE )
{ {
} }
BOOL CConfigPage::OnInitDialog( BOOL CConfigPage::OnInitDialog( HWND hwnd )
HWND hwnd
)
{ {
// return FALSE if SetFocus is called // return FALSE if SetFocus is called
m_hwnd = hwnd; m_hwnd = hwnd;
HWND hwndCtrl; HWND hwndCtrl;
//
// 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, m_rGlobalData.RomDir() );
//
// Set up PADDLE // Set up PADDLE
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE ); hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
LPTSTR psz = _T("0"); TCHAR psz[4] = _T("0");
TCHAR i; TCHAR i;
for ( i = 0; i < 4; ++i ) for ( i = 0; i < 4; ++i )
{ {
@ -49,56 +50,24 @@ HWND hwnd
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz ); ::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
} }
::SendMessage( hwndCtrl, CB_SETCURSEL, ::SendMessage( hwndCtrl, CB_SETCURSEL, m_rGlobalData.PaddleMode(), 0 );
m_rGlobalData.PaddleMode(), 0 );
//
// Set up SOUND // Set up SOUND
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND ); hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
::SendMessage( hwndCtrl, BM_SETCHECK, ::SendMessage( hwndCtrl, BM_SETCHECK, m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED, 0 );
m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED,
0 );
//
// Set up AutoSelectVideoMode
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_AUTO_SELECT_VIDEOMODE );
::SendMessage( hwndCtrl, BM_SETCHECK,
m_rGlobalData.AutoSelectVideoMode() ? BST_CHECKED : BST_UNCHECKED,
0 );
//
// Set up JOYSTICK
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_JOYSTICK );
::SendMessage( hwndCtrl, BM_SETCHECK,
m_rGlobalData.DisableJoystick() ? BST_CHECKED : BST_UNCHECKED,
0 );
return TRUE; return TRUE;
} }
void CConfigPage::OnDestroy( void CConfigPage::OnDestroy( void )
void
)
{ {
} }
LONG CConfigPage::OnApply( LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
LPPSHNOTIFY lppsn
)
{ {
UNUSED_ALWAYS( lppsn ); UNUSED_ALWAYS( lppsn );
//
// Apply the changes // Apply the changes
//
// HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet! // HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet!
HWND hwndCtrl; HWND hwndCtrl;
@ -113,29 +82,14 @@ LONG CConfigPage::OnApply(
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 ) m_rGlobalData.m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED );
== BST_CHECKED );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_AUTO_SELECT_VIDEOMODE );
ASSERT( hwndCtrl );
m_rGlobalData.m_fAutoSelectVideoMode = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
== BST_CHECKED );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_JOYSTICK );
ASSERT( hwndCtrl );
m_rGlobalData.m_fDisableJoystick= ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
== BST_CHECKED );
m_rGlobalData.SetModified(); m_rGlobalData.SetModified();
return PSNRET_NOERROR; return PSNRET_NOERROR;
} }
BOOL CConfigPage::OnCommand( BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
WORD wNotifyCode,
WORD wID,
HWND hwndCtl
)
{ {
UNUSED_ALWAYS( wNotifyCode ); UNUSED_ALWAYS( wNotifyCode );
UNUSED_ALWAYS( hwndCtl ); UNUSED_ALWAYS( hwndCtl );
@ -145,10 +99,8 @@ BOOL CConfigPage::OnCommand(
CBrowseForFolder bff( m_hwnd ); CBrowseForFolder bff( m_hwnd );
bff.SetFlags( BIF_RETURNONLYFSDIRS ); bff.SetFlags( BIF_RETURNONLYFSDIRS );
if ( bff.SelectFolder() ) if ( bff.SelectFolder() )
{
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() ); ::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
} }
}
return FALSE; return FALSE;
} }

View File

@ -1,11 +1,25 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/07/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ConfigPage.hxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#ifndef CONFIGPG_H #ifndef CONFIGPG_H
#define CONFIGPG_H #define CONFIGPG_H
#pragma once //FIXME #pragma once
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"
@ -13,11 +27,9 @@
class CConfigPage : public CPropertyPage class CConfigPage : public CPropertyPage
{ {
public: public:
CConfigPage( CGlobalData& rGlobalData ); CConfigPage( CGlobalData& rGlobalData );
protected: protected:
virtual BOOL OnInitDialog( HWND hwnd ); virtual BOOL OnInitDialog( HWND hwnd );
virtual void OnDestroy(); virtual void OnDestroy();
virtual LONG OnApply( LPPSHNOTIFY lppsn ); virtual LONG OnApply( LPPSHNOTIFY lppsn );
@ -25,13 +37,11 @@ virtual LONG OnApply( LPPSHNOTIFY lppsn );
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ ); virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
private: private:
CGlobalData& m_rGlobalData; CGlobalData& m_rGlobalData;
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
}; };
#endif #endif

View File

@ -1,22 +1,33 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/06/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#include "pch.hxx" #include "pch.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"
#include "resource.h" #include "resource.h"
static LPCTSTR g_pszIniFile = _T(".\\stella.ini"); static LPCTSTR g_pszIniFile = _T(".\\stellax.ini");
static LPCTSTR g_pszIniSection = _T("Options"); static LPCTSTR g_pszIniSection = _T("Options");
static LPCTSTR g_pszKeyNameRomPath = _T("RomPath"); static LPCTSTR g_pszKeyNameRomPath = _T("RomPath");
static LPCTSTR g_pszKeyNameFrameRate = _T("FrameRate"); static LPCTSTR g_pszKeyNameFrameRate = _T("FrameRate");
static LPCTSTR g_pszKeyNameShowFPS = _T("ShowFPS");
static LPCTSTR g_pszKeyNameMute = _T("Mute"); static LPCTSTR g_pszKeyNameMute = _T("Mute");
static LPCTSTR g_pszKeyNamePaddle = _T("Paddle"); static LPCTSTR g_pszKeyNamePaddle = _T("Paddle");
static LPCTSTR g_pszKeyNameDisableJoystick = _T("DisableJoystick");
static LPCTSTR g_pszKeyNameAutoSelectVideoMode = _T("AutoSelectVideoMode");
BOOL WritePrivateProfileInt( BOOL WritePrivateProfileInt(
LPCTSTR lpAppName, // section name LPCTSTR lpAppName, // section name
@ -29,25 +40,17 @@ BOOL WritePrivateProfileInt(
_itoa( nValue, psz, 10 ); _itoa( nValue, psz, 10 );
return ::WritePrivateProfileString( lpAppName, return ::WritePrivateProfileString( lpAppName, lpKeyName, psz, lpFileName );
lpKeyName,
psz,
lpFileName );
} }
CGlobalData::CGlobalData( CGlobalData::CGlobalData( HINSTANCE hInstance )
HINSTANCE hInstance : m_hInstance(hInstance),
) : \
m_hInstance(hInstance),
m_fIsModified( FALSE ) m_fIsModified( FALSE )
{ {
m_pszPathName[0] = _T('\0'); m_pszPathName[0] = _T('\0');
//
// Read the ROM directory from the stella.ini file // Read the ROM directory from the stella.ini file
// default to "ROMS" directory for compatibility with older StellaX // default to "ROMS" directory for compatibility with older StellaX
//
::GetPrivateProfileString( g_pszIniSection, ::GetPrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath, g_pszKeyNameRomPath,
_T("ROMS"), _T("ROMS"),
@ -55,102 +58,57 @@ CGlobalData::CGlobalData(
g_pszIniFile); g_pszIniFile);
// Read the desired frame rate // Read the desired frame rate
m_nDesiredFrameRate = (int)::GetPrivateProfileInt( g_pszIniSection, m_nDesiredFrameRate = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate, g_pszKeyNameFrameRate,
60, 60,
g_pszIniFile ); g_pszIniFile );
if (m_nDesiredFrameRate < 1 || m_nDesiredFrameRate > 300) if (m_nDesiredFrameRate < 1 || m_nDesiredFrameRate > 300)
{
m_nDesiredFrameRate = 60; m_nDesiredFrameRate = 60;
}
// Read ShowFPS
m_fShowFPS = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameShowFPS,
FALSE,
g_pszIniFile);
//
// Read Mute // Read Mute
//
m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection, m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute, g_pszKeyNameMute,
FALSE, FALSE,
g_pszIniFile ); g_pszIniFile );
//
// Get AutoSelectVideoMode
//
m_fAutoSelectVideoMode =
(BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameAutoSelectVideoMode,
TRUE,
g_pszIniFile );
//
// Read the Paddle mode // Read the Paddle mode
//
m_nPaddleMode = (int)::GetPrivateProfileInt( g_pszIniSection, m_nPaddleMode = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle, g_pszKeyNamePaddle,
0, 0,
g_pszIniFile); g_pszIniFile);
if ( m_nPaddleMode < 0 || m_nPaddleMode > 3 ) if ( m_nPaddleMode < 0 || m_nPaddleMode > 3 )
{
m_nPaddleMode = 0; m_nPaddleMode = 0;
}
// Read DisableJoystick
m_fDisableJoystick = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameDisableJoystick,
FALSE,
g_pszIniFile );
} }
CGlobalData::~CGlobalData( CGlobalData::~CGlobalData()
)
{ {
//
// Write out settings (if changed) // Write out settings (if changed)
//
if ( m_fIsModified ) if ( m_fIsModified )
{ {
// RomPath
::WritePrivateProfileString( g_pszIniSection, ::WritePrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath, g_pszKeyNameRomPath,
m_pszRomDir, m_pszRomDir,
g_pszIniFile ); g_pszIniFile );
// FrameRate
::WritePrivateProfileInt( g_pszIniSection, ::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate, g_pszKeyNameFrameRate,
m_nDesiredFrameRate, m_nDesiredFrameRate,
g_pszIniFile ); g_pszIniFile );
// Mute
::WritePrivateProfileInt( g_pszIniSection, ::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute, g_pszKeyNameMute,
m_fNoSound, m_fNoSound,
g_pszIniFile ); g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection, // Paddle
g_pszKeyNameAutoSelectVideoMode,
m_fAutoSelectVideoMode,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection, ::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle, g_pszKeyNamePaddle,
m_nPaddleMode, m_nPaddleMode,
g_pszIniFile ); g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameDisableJoystick,
m_fDisableJoystick,
g_pszIniFile );
} }
} }

View File

@ -1,10 +1,24 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/06/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalData.hxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#ifndef GLOBALS_H #ifndef GLOBALS_H
#define GLOBALS_H #define GLOBALS_H
#pragma once
#include "pch.hxx" #include "pch.hxx"
@ -15,7 +29,6 @@ class CGlobalData
friend CConfigPage; friend CConfigPage;
public: public:
CGlobalData( HINSTANCE hInstance ); CGlobalData( HINSTANCE hInstance );
~CGlobalData( ); ~CGlobalData( );
@ -26,38 +39,21 @@ public:
return m_nDesiredFrameRate; return m_nDesiredFrameRate;
} }
//
// Booleans // Booleans
//
BOOL ShowFPS( void ) const
{
return m_fShowFPS;
}
BOOL NoSound() const BOOL NoSound() const
{ {
return m_fNoSound; return m_fNoSound;
} }
BOOL DisableJoystick( void ) const int PaddleMode( void ) const
{ {
return m_fDisableJoystick; return m_nPaddleMode;
} }
BOOL AutoSelectVideoMode( void ) const
{
return m_fAutoSelectVideoMode;
}
int PaddleMode( void ) const;
LPCTSTR PathName( void ) const LPCTSTR PathName( void ) const
{ {
if ( m_pszPathName[0] == _T('\0') ) if ( m_pszPathName[0] == _T('\0') )
{
return NULL; return NULL;
}
return m_pszPathName; return m_pszPathName;
} }
@ -72,10 +68,7 @@ public:
return m_hInstance; return m_hInstance;
} }
//
// Modified flags // Modified flags
//
void SetModified( void ) void SetModified( void )
{ {
m_fIsModified = TRUE; m_fIsModified = TRUE;
@ -87,20 +80,13 @@ public:
} }
private: private:
// Basic options // Basic options
TCHAR m_pszRomDir[ MAX_PATH ]; TCHAR m_pszRomDir[ MAX_PATH ];
int m_nPaddleMode; int m_nPaddleMode;
BOOL m_fNoSound; BOOL m_fNoSound;
BOOL m_fDisableJoystick;
// Advanced options // Advanced options
BOOL m_fShowFPS;
int m_nDesiredFrameRate; int m_nDesiredFrameRate;
BOOL m_fAutoSelectVideoMode;
HINSTANCE m_hInstance; HINSTANCE m_hInstance;
TCHAR m_pszPathName[ MAX_PATH ]; TCHAR m_pszPathName[ MAX_PATH ];
@ -111,12 +97,4 @@ CGlobalData( const CGlobalData& ); // no implementation
void operator=( const CGlobalData& ); // no implementation void operator=( const CGlobalData& ); // no implementation
}; };
inline int CGlobalData::PaddleMode(
void
) const
{
return m_nPaddleMode;
}
#endif #endif

View File

@ -1,17 +1,29 @@
//============================================================================
// //
// StellaX // SSSS tt lll lll
// Jeff Miller 05/12/2000 // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2000 by Jeff Miller
// Copyright (c) 2004 by Stephen Anthony
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainDlg.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
//============================================================================
#include "pch.hxx" #include "pch.hxx"
#include "MainDlg.hxx" #include "MainDlg.hxx"
#include "GlobalData.hxx" #include "GlobalData.hxx"
#include "PropertySheet.hxx" #include "PropertySheet.hxx"
#include "AboutPage.hxx" #include "AboutPage.hxx"
#include "DocPage.hxx" #include "DocPage.hxx"
#include "ConfigPage.hxx" #include "ConfigPage.hxx"
#include "resource.h" #include "resource.h"
#define BKGND_BITMAP_TOP 64 #define BKGND_BITMAP_TOP 64
@ -19,45 +31,39 @@
// NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS! // NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS!
inline LPARAM ListView_GetItemData( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwndList, inline LPARAM ListView_GetItemData( HWND hwndList, int iItem )
int iItem
)
{ {
LVITEM lvi; LVITEM lvi;
lvi.mask = LVIF_PARAM; lvi.mask = LVIF_PARAM;
lvi.iItem = iItem; lvi.iItem = iItem;
lvi.iSubItem = 0; lvi.iSubItem = 0;
ListView_GetItem(hwndList, &lvi); ListView_GetItem(hwndList, &lvi);
return lvi.lParam; return lvi.lParam;
} }
CMainDlg::CMainDlg( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CGlobalData& rGlobalData, CMainDlg::CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance )
HINSTANCE hInstance : m_rGlobalData(rGlobalData),
) : \
m_rGlobalData(rGlobalData),
m_hInstance(hInstance) m_hInstance(hInstance)
{ {
} }
void CMainDlg::ClearList( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void void CMainDlg::ClearList( void )
)
{ {
int nCount = ListView_GetItemCount( m_hwndList ); int nCount = ListView_GetItemCount( m_hwndList );
for (int i = 0; i < nCount; ++i) for (int i = 0; i < nCount; ++i)
{
delete (CListData*)ListView_GetItemData( m_hwndList, i ); delete (CListData*)ListView_GetItemData( m_hwndList, i );
}
ListView_DeleteAllItems( m_hwndList ); ListView_DeleteAllItems( m_hwndList );
} }
int CMainDlg::DoModal( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwndParent int CMainDlg::DoModal( HWND hwndParent )
)
{ {
return DialogBoxParam( m_hInstance, return DialogBoxParam( m_hInstance,
MAKEINTRESOURCE(IDD), MAKEINTRESOURCE(IDD),
@ -66,12 +72,9 @@ int CMainDlg::DoModal(
(LPARAM)this ); (LPARAM)this );
} }
BOOL CALLBACK CMainDlg::StaticDialogFunc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hDlg, BOOL CALLBACK
UINT uMsg, CMainDlg::StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
WPARAM wParam,
LPARAM lParam
)
{ {
CMainDlg* pDlg; CMainDlg* pDlg;
@ -80,29 +83,22 @@ BOOL CALLBACK CMainDlg::StaticDialogFunc(
case WM_INITDIALOG: case WM_INITDIALOG:
pDlg = reinterpret_cast<CMainDlg*>( lParam ); pDlg = reinterpret_cast<CMainDlg*>( lParam );
pDlg->m_hwnd = hDlg; pDlg->m_hwnd = hDlg;
(void)::SetWindowLong( hDlg, (void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast<LONG>( pDlg ) );
DWL_USER,
reinterpret_cast<LONG>( pDlg ) );
break; break;
default: default:
pDlg = reinterpret_cast<CMainDlg*>( pDlg = reinterpret_cast<CMainDlg*>( ::GetWindowLong( hDlg, DWL_USER ) );
::GetWindowLong( hDlg, DWL_USER ) );
if ( pDlg == NULL ) if ( pDlg == NULL )
{
return FALSE; return FALSE;
}
break; break;
} }
return pDlg->DialogFunc( uMsg, wParam, lParam ); return pDlg->DialogFunc( uMsg, wParam, lParam );
} }
BOOL CALLBACK CMainDlg::DialogFunc( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UINT uMsg, BOOL CALLBACK
WPARAM wParam, CMainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
LPARAM lParam
)
{ {
BOOL b; BOOL b;
@ -114,16 +110,12 @@ BOOL CALLBACK CMainDlg::DialogFunc(
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam ); b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
if (b) if (b)
{
return b; return b;
}
break; break;
case WM_ERASEBKGND: case WM_ERASEBKGND:
if ( OnEraseBkgnd( (HDC)wParam ) ) if ( OnEraseBkgnd( (HDC)wParam ) )
{
return TRUE; return TRUE;
}
break; break;
case WM_INITDIALOG: case WM_INITDIALOG:
@ -140,18 +132,14 @@ BOOL CALLBACK CMainDlg::DialogFunc(
TRACE( "WM_QUERYNEWPALETTE from maindlg" ); TRACE( "WM_QUERYNEWPALETTE from maindlg" );
return FALSE; return FALSE;
//
// Cool caption handlers // Cool caption handlers
//
case WM_DESTROY: case WM_DESTROY:
OnDestroy( ); OnDestroy( );
break; break;
case WM_DRAWITEM: case WM_DRAWITEM:
// Forward this onto the control // Forward this onto the control
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, ::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, wParam, lParam );
wParam, lParam );
return TRUE; return TRUE;
case WM_NCPAINT: case WM_NCPAINT:
@ -173,23 +161,16 @@ BOOL CALLBACK CMainDlg::DialogFunc(
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
// Allow Alt-F4 to close the window // Allow Alt-F4 to close the window
if ( wParam == SC_CLOSE ) if ( wParam == SC_CLOSE )
{
::EndDialog( m_hwnd, IDCANCEL ); ::EndDialog( m_hwnd, IDCANCEL );
}
break; break;
} }
//
// Message not handled // Message not handled
//
return FALSE; return FALSE;
} }
BOOL CMainDlg::OnInitDialog( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void BOOL CMainDlg::OnInitDialog( void )
)
{ {
DWORD dwRet; DWORD dwRet;
@ -204,15 +185,11 @@ BOOL CMainDlg::OnInitDialog(
} }
// Set dialog icon // Set dialog icon
HICON hicon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_APP)); HICON hicon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_APP));
::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon ); ::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon );
::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon ); ::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon );
//
// Make the Rom note have bold text // Make the Rom note have bold text
//
HWND hwndCtrl; HWND hwndCtrl;
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE ); hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE );
@ -225,12 +202,9 @@ BOOL CMainDlg::OnInitDialog(
m_hfontRomNote = ::CreateFontIndirect( &lf ); m_hfontRomNote = ::CreateFontIndirect( &lf );
if ( m_hfontRomNote ) if ( m_hfontRomNote )
{
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 ); ::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
}
// Do subclassing // Do subclassing
m_CoolCaption.OnInitDialog( hwnd ); m_CoolCaption.OnInitDialog( hwnd );
m_header.SubclassDlgItem( hwnd, IDC_ROMLIST ); m_header.SubclassDlgItem( hwnd, IDC_ROMLIST );
m_btn3d.SubclassDlgItem( hwnd, IDC_TITLE ); m_btn3d.SubclassDlgItem( hwnd, IDC_TITLE );
@ -243,16 +217,12 @@ BOOL CMainDlg::OnInitDialog(
TCHAR psz[nMaxString + 1]; TCHAR psz[nMaxString + 1];
// Initialize the list view // Initialize the list view
m_hwndList = ::GetDlgItem( hwnd, IDC_ROMLIST ); m_hwndList = ::GetDlgItem( hwnd, IDC_ROMLIST );
ASSERT( m_hwndList ); ASSERT( m_hwndList );
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32 // LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
::SendMessage( m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE,
::SendMessage( m_hwndList, 0, LVS_EX_FULLROWSELECT );
LVM_SETEXTENDEDLISTVIEWSTYLE,
0,
LVS_EX_FULLROWSELECT );
RECT rc; RECT rc;
::GetClientRect( m_hwndList, &rc ); ::GetClientRect( m_hwndList, &rc );
@ -262,8 +232,7 @@ BOOL CMainDlg::OnInitDialog(
for (int i = 0; i < CListData::GetColumnCount(); ++i) for (int i = 0; i < CListData::GetColumnCount(); ++i)
{ {
::LoadString( m_hInstance, ::LoadString( m_hInstance, CListData::GetColumnNameIdForColumn( i ),
CListData::GetColumnNameIdForColumn( i ),
psz, nMaxString ); psz, nMaxString );
LV_COLUMN lvc; LV_COLUMN lvc;
@ -282,23 +251,11 @@ BOOL CMainDlg::OnInitDialog(
} }
// if items added, select first item and enable play button // if items added, select first item and enable play button
int nCount = ListView_GetItemCount( m_hwndList ); int nCount = ListView_GetItemCount( m_hwndList );
if (nCount != 0) if (nCount != 0)
{ {
#ifdef _DEBUG
DWORD dwStartTick = ::GetTickCount();
#endif
m_header.SetSortCol( 0, TRUE ); m_header.SetSortCol( 0, TRUE );
ListView_SortItems( m_hwndList, ListView_SortItems( m_hwndList, ListViewCompareFunc, (LPARAM)this );
ListViewCompareFunc,
(LPARAM)this );
#ifdef _DEBUG
TRACE("\tElapsed ticks for ListView_SortItems = %ld", ::GetTickCount()-dwStartTick);
#endif
ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED, ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED ); LVIS_SELECTED | LVIS_FOCUSED );
} }
@ -307,36 +264,24 @@ BOOL CMainDlg::OnInitDialog(
::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE ); ::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE );
} }
//
// Show status text // Show status text
//
TCHAR pszStatus[256 + 1]; TCHAR pszStatus[256 + 1];
LoadString(m_hInstance, IDS_STATUSTEXT, pszStatus, 256); LoadString(m_hInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, nCount ); wsprintf( psz, pszStatus, nCount );
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, m_rGlobalData.RomDir() );
//
// Set default button // Set default button
//
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 ); ::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
// return FALSE if SetFocus is called // return FALSE if SetFocus is called
return TRUE; return TRUE;
} }
BOOL CMainDlg::OnCommand( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int id, BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
HWND hwndCtl,
UINT codeNotify
)
{ {
UNUSED_ALWAYS( hwndCtl ); UNUSED_ALWAYS( hwndCtl );
UNUSED_ALWAYS( codeNotify ); UNUSED_ALWAYS( codeNotify );
@ -349,33 +294,15 @@ BOOL CMainDlg::OnCommand(
switch (id) switch (id)
{ {
case IDC_PLAY: case IDC_PLAY:
nItem = (int)::SendMessage( m_hwndList, LVM_GETNEXTITEM,
nItem = (int)::SendMessage( m_hwndList, (WPARAM)-1, MAKELPARAM( LVNI_SELECTED, 0 ) );
LVM_GETNEXTITEM,
(WPARAM)-1,
MAKELPARAM( LVNI_SELECTED, 0 ) );
ASSERT( nItem != -1 ); ASSERT( nItem != -1 );
if ( nItem == -1 ) if ( nItem == -1 )
{ {
::MessageBox( m_hInstance, ::MessageBox( m_hInstance, hwnd, IDS_NO_ITEM_SELECTED );
hwnd,
IDS_NO_ITEM_SELECTED );
return TRUE; return TRUE;
} }
#if 0
TCHAR pszFile[MAX_PATH + 1];
// BUGBUG: On Win95b pszFile is coming back empty!
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = CListData::FILENAME_COLUMN;
lvi.pszText = pszFile;
lvi.cchTextMax = MAX_PATH;
::SendMessage( m_hwndList, LVM_GETITEM, 0, (LPARAM)&lvi );
#endif
pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem ); pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem );
TCHAR pszPathName[ MAX_PATH + 1 ]; TCHAR pszPathName[ MAX_PATH + 1 ];
@ -385,26 +312,25 @@ BOOL CMainDlg::OnCommand(
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) ); pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
// Play the game! // Play the game!
::EnableWindow( hwnd, FALSE ); ::EnableWindow( hwnd, FALSE );
(void)m_stella.PlayROM( hwnd, (void)m_stella.PlayROM( hwnd, pszPathName,
pszPathName,
pListData->GetTextForColumn( CListData::NAME_COLUMN ), pListData->GetTextForColumn( CListData::NAME_COLUMN ),
m_rGlobalData ); m_rGlobalData );
::EnableWindow( hwnd, TRUE ); ::EnableWindow( hwnd, TRUE );
// Set focus back to the rom list // Set focus back to the rom list
::SetFocus( m_hwndList ); ::SetFocus( m_hwndList );
return TRUE; return TRUE;
break; // case IDC_PLAY
case IDC_EXIT: case IDC_EXIT:
ClearList(); ClearList();
::EndDialog( hwnd, IDCANCEL ); ::EndDialog( hwnd, IDCANCEL );
return TRUE; return TRUE;
break; // case IDC_EXIT
case IDC_CONFIG: case IDC_CONFIG:
{ {
@ -414,8 +340,10 @@ BOOL CMainDlg::OnCommand(
ps.AddPage( &pgConfig ); ps.AddPage( &pgConfig );
(void)ps.DoModal(); (void)ps.DoModal();
}
return TRUE; return TRUE;
break; // case IDC_CONFIG
}
case IDC_ABOUT: case IDC_ABOUT:
{ {
@ -428,17 +356,16 @@ BOOL CMainDlg::OnCommand(
ps.AddPage(&pgDoc); ps.AddPage(&pgDoc);
ps.DoModal(); ps.DoModal();
}
return TRUE; return TRUE;
break; // case IDC_ABOUT
}
} }
return FALSE; return FALSE;
} }
BOOL CMainDlg::OnNotify( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int idCtrl, BOOL CMainDlg::OnNotify( int idCtrl, LPNMHDR pnmh )
LPNMHDR pnmh
)
{ {
UNUSED_ALWAYS( idCtrl ); UNUSED_ALWAYS( idCtrl );
@ -463,40 +390,31 @@ BOOL CMainDlg::OnNotify(
} }
// not handled // not handled
return FALSE; return FALSE;
} }
static void ScreenToClient( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HWND hwnd, static void ScreenToClient( HWND hwnd, LPRECT lpRect )
LPRECT lpRect
)
{ {
::ScreenToClient(hwnd, (LPPOINT)lpRect); ::ScreenToClient(hwnd, (LPPOINT)lpRect);
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1); ::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
} }
static void FillSolidRect( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HDC hdc, static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
LPCRECT lpRect,
COLORREF clr
)
{ {
COLORREF crOld = ::SetBkColor(hdc, clr); COLORREF crOld = ::SetBkColor(hdc, clr);
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL); ::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
::SetBkColor(hdc, crOld); ::SetBkColor(hdc, crOld);
} }
BOOL CMainDlg::OnEraseBkgnd( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HDC hdc BOOL CMainDlg::OnEraseBkgnd( HDC hdc )
)
{ {
// don't do this in 256 color // don't do this in 256 color
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
{
return FALSE; return FALSE;
}
RECT rcWindow; RECT rcWindow;
::GetWindowRect( *this, &rcWindow ); ::GetWindowRect( *this, &rcWindow );
@ -505,16 +423,14 @@ BOOL CMainDlg::OnEraseBkgnd(
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) ); FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
RECT rc; RECT rc;
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, ::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, rcWindow.right, BKGND_BITMAP_BOTTOM );
rcWindow.right, BKGND_BITMAP_BOTTOM );
long lWidth = rc.right - rc.left; long lWidth = rc.right - rc.left;
long lHeight = rc.bottom - rc.top; long lHeight = rc.bottom - rc.top;
HDC hdcMem = CreateCompatibleDC(hdc); HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmpTile = LoadBitmap( m_hInstance, HBITMAP hbmpTile = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_TILE) );
MAKEINTRESOURCE(IDB_TILE) );
BITMAP bm; BITMAP bm;
GetObject(hbmpTile, sizeof(bm), &bm); GetObject(hbmpTile, sizeof(bm), &bm);
@ -535,42 +451,31 @@ BOOL CMainDlg::OnEraseBkgnd(
} }
SelectObject(hdcMem, hbmpOld); SelectObject(hdcMem, hbmpOld);
DeleteObject(hbmpTile); DeleteObject(hbmpTile);
DeleteDC(hdcMem); DeleteDC(hdcMem);
return TRUE; return TRUE;
} }
HBRUSH CMainDlg::OnCtlColorStatic( // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HDC hdcStatic, HBRUSH CMainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
HWND hwndStatic
)
{ {
// don't do this in 256 color // don't do this in 256 color
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE) if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
{
return FALSE; return FALSE;
}
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON) if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
{
return NULL; return NULL;
}
SetBkMode(hdcStatic, TRANSPARENT); SetBkMode(hdcStatic, TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH); return (HBRUSH)GetStockObject(NULL_BRUSH);
} }
// --------------------------------------------------------------------------- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DWORD CMainDlg::PopulateRomList( void )
DWORD CMainDlg::PopulateRomList(
void
)
{ {
TRACE("CMainDlg::PopulateRomList"); TRACE("CMainDlg::PopulateRomList");
DWORD dwRet; DWORD dwRet;

View File

@ -1,58 +1,21 @@
/* //============================================================================
//
StellaX // SSSS tt lll lll
Win32 DirectX port of Stella // SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
Written by Jeff Miller (contact Bradford for current email address) // SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
Stella core developed by Bradford W. Mott // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
This software is Copyright (c) 1995-2000, Jeff Miller //
// Copyright (c) 1995-2000 by Jeff Miller
REVISIONS: // Copyright (c) 2004 by Stephen Anthony
//
14-Mar-99 1.1.0 new code base // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
19-Mar-99 1.1.1 took into account video width //
fixed no sound card bug // $Id: main.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
-mute option //============================================================================
fixed mame32 www link
11-Jun-99 1.1.2 removed registerfiletypes call
fixed directsound
added directinput support for keyboard, mouse, joystick
fixed minimize button bug
created virtual list view to speed load time
add screen capture (f12 key)
added romdir read from STELLA.INI file
(defaults to ROMS directory)
I now use WM_SETICON so the stella icon shows on the task list
Works on NT4 (dont fail if DirectInput not available)
Added UI field for a cartridge.note
Changed stellax web site address
Added really cool help property sheet w/adobe doc
9-Sep-99 1.1.3 Improved video detection logic
Added DisableJoystick and ListSort options to .ini
Rewrote the sound driver code
Added multiple screen shot support - first writes to
stella00.bmp then stella01.bmp, etc.
Added cool round buttons on main screen
18-Apr-00 Started removing all exceptions
Fixed sound code (now uses streaming properly)
Added configuration dialog
Fixed it so that Alt-F4 will close the dialog
Updated the master ROM list
02-May-00 1.1.3a Fixed joystick handling regression
Fixed repaint problem on doc page
Fixed problem where some machines would report path not found
Added force 640x480 video mode
Added browse button on config dialog
05-Jan-02 n/a Wow, it's been awhile...Released source code
*/
#include "pch.hxx" #include "pch.hxx"
#include "resource.h" #include "resource.h"
@ -63,20 +26,16 @@ REVISIONS:
class CSingleInstance class CSingleInstance
{ {
public: public:
CSingleInstance( LPCTSTR pszName ) CSingleInstance( LPCTSTR pszName )
{ {
::SetLastError( ERROR_SUCCESS ); ::SetLastError( ERROR_SUCCESS );
m_hMutex = ::CreateMutex( NULL, TRUE, pszName ); m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
m_dwError = ::GetLastError(); m_dwError = ::GetLastError();
} }
~CSingleInstance() ~CSingleInstance()
{ {
if ( m_hMutex != INVALID_HANDLE_VALUE && if ( m_hMutex != INVALID_HANDLE_VALUE && m_dwError != ERROR_ALREADY_EXISTS )
m_dwError != ERROR_ALREADY_EXISTS )
{ {
VERIFY( ::ReleaseMutex( m_hMutex ) ); VERIFY( ::ReleaseMutex( m_hMutex ) );
VERIFY( ::CloseHandle( m_hMutex ) ); VERIFY( ::CloseHandle( m_hMutex ) );
@ -89,7 +48,6 @@ public:
} }
private: private:
HANDLE m_hMutex; HANDLE m_hMutex;
DWORD m_dwError; DWORD m_dwError;
@ -101,13 +59,8 @@ void operator=( const CSingleInstance& ); // no implementation
LPCTSTR g_ctszDebugLog = _T("stella.log"); LPCTSTR g_ctszDebugLog = _T("stella.log");
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
int WINAPI _tWinMain( LPTSTR lpCmdLine, int nCmdShow )
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow
)
{ {
UNUSED_ALWAYS( hPrevInstance ); UNUSED_ALWAYS( hPrevInstance );
UNUSED_ALWAYS( lpCmdLine ); UNUSED_ALWAYS( lpCmdLine );
@ -126,14 +79,11 @@ int WINAPI _tWinMain(
HRESULT hrCoInit = ::CoInitialize( NULL ); HRESULT hrCoInit = ::CoInitialize( NULL );
if ( FAILED(hrCoInit) ) if ( FAILED(hrCoInit) )
{
MessageBox( hInstance, NULL, IDS_COINIT_FAILED ); MessageBox( hInstance, NULL, IDS_COINIT_FAILED );
}
::InitCommonControls(); ::InitCommonControls();
BOOL fOk = FALSE; BOOL fOk = FALSE;
CGlobalData globaldata( hInstance ); CGlobalData globaldata( hInstance );
fOk = globaldata.ParseCommandLine( __argc, __argv ); fOk = globaldata.ParseCommandLine( __argc, __argv );
@ -146,40 +96,26 @@ int WINAPI _tWinMain(
LPCTSTR ctszPathName = globaldata.PathName(); LPCTSTR ctszPathName = globaldata.PathName();
if (ctszPathName != NULL) if (ctszPathName != NULL)
{ {
//
// a filename was given on the commandline, skip the UI // a filename was given on the commandline, skip the UI
//
CStellaXMain stellax; CStellaXMain stellax;
dwRet = stellax.Initialize(); dwRet = stellax.Initialize();
if ( dwRet != ERROR_SUCCESS ) if ( dwRet != ERROR_SUCCESS )
{
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") ); MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
else
dwRet = stellax.PlayROM( GetDesktopWindow(), ctszPathName,
_T("StellaX"), globaldata );
} }
else else
{ {
dwRet = stellax.PlayROM( GetDesktopWindow(),
ctszPathName,
_T("StellaX"), // Dont knwo the friendly name
globaldata );
}
}
else
{
//
// show the ui // show the ui
//
CMainDlg dlg( globaldata, hInstance ); CMainDlg dlg( globaldata, hInstance );
dlg.DoModal( NULL ); dlg.DoModal( NULL );
} }
} }
if ( hrCoInit == S_OK ) if ( hrCoInit == S_OK )
{
::CoUninitialize(); ::CoUninitialize();
}
return 0; return 0;
} }

View File

@ -1,49 +1,5 @@
[Options] [Options]
RomPath=C:\Dell
; ----------------------------------------------------------------------------
; Set this to the path where your .bin rom files are located
; If this isn't specified, ROMS will be used
RomPath=ROMS
; ----------------------------------------------------------------------------
; Set this to specify which paddle the mouse should emulate. This can be any
; number from 0 to 3 inclusive.
; If this isn't specified, 0 will be used (the mouse will emulate paddle 0)
Paddle=0
; ----------------------------------------------------------------------------
; Set this to 1 if you don't want any sound effects.
; If this isn't specified, 0 will be used
Mute=0
; ----------------------------------------------------------------------------
; Set this to 1 to have StellaX not use any joysticks. This may speed up
; StellaX, but you won't be able to play using joystick!
DisableJoystick=0
; ============================================================================
; ADVANCED OPTIONS FOLLOW
; ============================================================================
; ----------------------------------------------------------------------------
; Set this to 1 if you want to see the FPS count after a game is played
; If this isn't specified, 0 will be used
ShowFps=0
; ----------------------------------------------------------------------------
; Set this to the desired frame rate. This normally should not be changed.
; Any value from 1 to 300 is allowed.
; If this isn't specified, 60 will be used
FrameRate=60 FrameRate=60
Mute=1
; ---------------------------------------------------------------------------- Paddle=3
; Set this to 0 if you want stella to always use 640x480 as the video mode.
; If this isn't specified, 1 will be used
AutoSelectVideoMode=1