mirror of https://github.com/stella-emu/stella.git
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:
parent
a0f6eaa4ff
commit
2f1d07c207
|
@ -1,20 +1,32 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 04/27/2000
|
||||
// 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-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 "AboutPage.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
CHelpPage::CHelpPage(
|
||||
) : \
|
||||
CPropertyPage(IDD_ABOUT_PAGE)
|
||||
CHelpPage::CHelpPage()
|
||||
: CPropertyPage(IDD_ABOUT_PAGE)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CHelpPage::OnInitDialog(
|
||||
HWND hwnd
|
||||
)
|
||||
BOOL CHelpPage::OnInitDialog( HWND hwnd )
|
||||
{
|
||||
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
|
||||
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.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 TRUE;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,25 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/01/2000
|
||||
// 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-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
|
||||
#define ABOUTPG_H
|
||||
#pragma once
|
||||
//FIXME#pragma once
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "HyperLink.hxx"
|
||||
|
@ -12,20 +27,16 @@
|
|||
class CHelpPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpPage();
|
||||
|
||||
protected:
|
||||
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
|
||||
private:
|
||||
|
||||
CHyperLink m_hlMail_JSM;
|
||||
CHyperLink m_hlWWW_JSM;
|
||||
CHyperLink m_hlMail_Stella;
|
||||
CHyperLink m_hlWWW_Stella;
|
||||
CHyperLink m_hlWWW_Mame;
|
||||
|
||||
CHelpPage( const CHelpPage& ); // no implementation
|
||||
void operator=( const CHelpPage& ); // no implementation
|
||||
|
|
|
@ -1,47 +1,48 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/07/2000
|
||||
// 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-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 "ConfigPage.hxx"
|
||||
#include "resource.h"
|
||||
|
||||
#include "BrowseForFolder.hxx"
|
||||
|
||||
CConfigPage::CConfigPage(
|
||||
CGlobalData& rGlobalData
|
||||
) : \
|
||||
m_rGlobalData( rGlobalData ),
|
||||
CConfigPage::CConfigPage( CGlobalData& rGlobalData )
|
||||
: m_rGlobalData( rGlobalData ),
|
||||
CPropertyPage( IDD_CONFIG_PAGE )
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CConfigPage::OnInitDialog(
|
||||
HWND hwnd
|
||||
)
|
||||
BOOL CConfigPage::OnInitDialog( HWND hwnd )
|
||||
{
|
||||
// return FALSE if SetFocus is called
|
||||
|
||||
m_hwnd = hwnd;
|
||||
|
||||
HWND hwndCtrl;
|
||||
|
||||
//
|
||||
// Set up ROMPATH
|
||||
//
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH );
|
||||
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
|
||||
::SetWindowText( hwndCtrl, m_rGlobalData.RomDir() );
|
||||
|
||||
//
|
||||
// Set up PADDLE
|
||||
//
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
|
||||
|
||||
LPTSTR psz = _T("0");
|
||||
TCHAR psz[4] = _T("0");
|
||||
TCHAR i;
|
||||
for ( i = 0; i < 4; ++i )
|
||||
{
|
||||
|
@ -49,56 +50,24 @@ HWND hwnd
|
|||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
|
||||
}
|
||||
|
||||
::SendMessage( hwndCtrl, CB_SETCURSEL,
|
||||
m_rGlobalData.PaddleMode(), 0 );
|
||||
::SendMessage( hwndCtrl, CB_SETCURSEL, m_rGlobalData.PaddleMode(), 0 );
|
||||
|
||||
//
|
||||
// Set up SOUND
|
||||
//
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
|
||||
::SendMessage( hwndCtrl, BM_SETCHECK,
|
||||
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 );
|
||||
::SendMessage( hwndCtrl, BM_SETCHECK, m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED, 0 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CConfigPage::OnDestroy(
|
||||
void
|
||||
)
|
||||
void CConfigPage::OnDestroy( void )
|
||||
{
|
||||
}
|
||||
|
||||
LONG CConfigPage::OnApply(
|
||||
LPPSHNOTIFY lppsn
|
||||
)
|
||||
LONG CConfigPage::OnApply( LPPSHNOTIFY lppsn )
|
||||
{
|
||||
UNUSED_ALWAYS( lppsn );
|
||||
|
||||
//
|
||||
// Apply the changes
|
||||
//
|
||||
|
||||
// HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet!
|
||||
|
||||
HWND hwndCtrl;
|
||||
|
@ -113,29 +82,14 @@ LONG CConfigPage::OnApply(
|
|||
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_SOUND );
|
||||
ASSERT( hwndCtrl );
|
||||
m_rGlobalData.m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
|
||||
== 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.m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED );
|
||||
|
||||
m_rGlobalData.SetModified();
|
||||
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
|
||||
BOOL CConfigPage::OnCommand(
|
||||
WORD wNotifyCode,
|
||||
WORD wID,
|
||||
HWND hwndCtl
|
||||
)
|
||||
BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
|
||||
{
|
||||
UNUSED_ALWAYS( wNotifyCode );
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
|
@ -145,10 +99,8 @@ BOOL CConfigPage::OnCommand(
|
|||
CBrowseForFolder bff( m_hwnd );
|
||||
bff.SetFlags( BIF_RETURNONLYFSDIRS );
|
||||
if ( bff.SelectFolder() )
|
||||
{
|
||||
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -1,11 +1,25 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/07/2000
|
||||
// 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-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
|
||||
#define CONFIGPG_H
|
||||
#pragma once
|
||||
//FIXME #pragma once
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "GlobalData.hxx"
|
||||
|
@ -13,11 +27,9 @@
|
|||
class CConfigPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
|
||||
CConfigPage( CGlobalData& rGlobalData );
|
||||
|
||||
protected:
|
||||
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
virtual void OnDestroy();
|
||||
virtual LONG OnApply( LPPSHNOTIFY lppsn );
|
||||
|
@ -25,13 +37,11 @@ virtual LONG OnApply( LPPSHNOTIFY lppsn );
|
|||
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
|
||||
|
||||
private:
|
||||
|
||||
CGlobalData& m_rGlobalData;
|
||||
HWND m_hwnd;
|
||||
|
||||
CConfigPage( const CConfigPage& ); // no implementation
|
||||
void operator=( const CConfigPage& ); // no implementation
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,22 +1,33 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/06/2000
|
||||
// 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-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 "GlobalData.hxx"
|
||||
|
||||
#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_pszKeyNameRomPath = _T("RomPath");
|
||||
static LPCTSTR g_pszKeyNameFrameRate = _T("FrameRate");
|
||||
static LPCTSTR g_pszKeyNameShowFPS = _T("ShowFPS");
|
||||
static LPCTSTR g_pszKeyNameMute = _T("Mute");
|
||||
static LPCTSTR g_pszKeyNamePaddle = _T("Paddle");
|
||||
static LPCTSTR g_pszKeyNameDisableJoystick = _T("DisableJoystick");
|
||||
static LPCTSTR g_pszKeyNameAutoSelectVideoMode = _T("AutoSelectVideoMode");
|
||||
|
||||
BOOL WritePrivateProfileInt(
|
||||
LPCTSTR lpAppName, // section name
|
||||
|
@ -29,25 +40,17 @@ BOOL WritePrivateProfileInt(
|
|||
|
||||
_itoa( nValue, psz, 10 );
|
||||
|
||||
return ::WritePrivateProfileString( lpAppName,
|
||||
lpKeyName,
|
||||
psz,
|
||||
lpFileName );
|
||||
return ::WritePrivateProfileString( lpAppName, lpKeyName, psz, lpFileName );
|
||||
}
|
||||
|
||||
CGlobalData::CGlobalData(
|
||||
HINSTANCE hInstance
|
||||
) : \
|
||||
m_hInstance(hInstance),
|
||||
CGlobalData::CGlobalData( HINSTANCE hInstance )
|
||||
: m_hInstance(hInstance),
|
||||
m_fIsModified( FALSE )
|
||||
{
|
||||
m_pszPathName[0] = _T('\0');
|
||||
|
||||
//
|
||||
// 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"),
|
||||
|
@ -55,102 +58,57 @@ CGlobalData::CGlobalData(
|
|||
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 ShowFPS
|
||||
|
||||
m_fShowFPS = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameShowFPS,
|
||||
FALSE,
|
||||
g_pszIniFile);
|
||||
|
||||
//
|
||||
// Read Mute
|
||||
//
|
||||
|
||||
m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameMute,
|
||||
FALSE,
|
||||
g_pszIniFile );
|
||||
|
||||
//
|
||||
// Get AutoSelectVideoMode
|
||||
//
|
||||
|
||||
m_fAutoSelectVideoMode =
|
||||
(BOOL)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameAutoSelectVideoMode,
|
||||
TRUE,
|
||||
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;
|
||||
}
|
||||
|
||||
// Read DisableJoystick
|
||||
|
||||
m_fDisableJoystick = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameDisableJoystick,
|
||||
FALSE,
|
||||
g_pszIniFile );
|
||||
|
||||
}
|
||||
|
||||
CGlobalData::~CGlobalData(
|
||||
)
|
||||
CGlobalData::~CGlobalData()
|
||||
{
|
||||
//
|
||||
// Write out settings (if changed)
|
||||
//
|
||||
|
||||
if ( m_fIsModified )
|
||||
{
|
||||
// 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 );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameAutoSelectVideoMode,
|
||||
m_fAutoSelectVideoMode,
|
||||
g_pszIniFile );
|
||||
|
||||
// Paddle
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNamePaddle,
|
||||
m_nPaddleMode,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameDisableJoystick,
|
||||
m_fDisableJoystick,
|
||||
g_pszIniFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/06/2000
|
||||
// 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-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
|
||||
#define GLOBALS_H
|
||||
#pragma once
|
||||
|
||||
#include "pch.hxx"
|
||||
|
||||
|
@ -15,7 +29,6 @@ class CGlobalData
|
|||
friend CConfigPage;
|
||||
|
||||
public:
|
||||
|
||||
CGlobalData( HINSTANCE hInstance );
|
||||
~CGlobalData( );
|
||||
|
||||
|
@ -26,38 +39,21 @@ public:
|
|||
return m_nDesiredFrameRate;
|
||||
}
|
||||
|
||||
//
|
||||
// Booleans
|
||||
//
|
||||
|
||||
BOOL ShowFPS( void ) const
|
||||
{
|
||||
return m_fShowFPS;
|
||||
}
|
||||
|
||||
BOOL NoSound() const
|
||||
{
|
||||
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
|
||||
{
|
||||
if ( m_pszPathName[0] == _T('\0') )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_pszPathName;
|
||||
}
|
||||
|
@ -72,10 +68,7 @@ public:
|
|||
return m_hInstance;
|
||||
}
|
||||
|
||||
//
|
||||
// Modified flags
|
||||
//
|
||||
|
||||
void SetModified( void )
|
||||
{
|
||||
m_fIsModified = TRUE;
|
||||
|
@ -87,20 +80,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
// Basic options
|
||||
|
||||
TCHAR m_pszRomDir[ MAX_PATH ];
|
||||
int m_nPaddleMode;
|
||||
BOOL m_fNoSound;
|
||||
BOOL m_fDisableJoystick;
|
||||
|
||||
// Advanced options
|
||||
|
||||
BOOL m_fShowFPS;
|
||||
int m_nDesiredFrameRate;
|
||||
BOOL m_fAutoSelectVideoMode;
|
||||
|
||||
|
||||
HINSTANCE m_hInstance;
|
||||
TCHAR m_pszPathName[ MAX_PATH ];
|
||||
|
@ -111,12 +97,4 @@ CGlobalData( const CGlobalData& ); // no implementation
|
|||
void operator=( const CGlobalData& ); // no implementation
|
||||
};
|
||||
|
||||
inline int CGlobalData::PaddleMode(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_nPaddleMode;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,17 +1,29 @@
|
|||
//============================================================================
|
||||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/12/2000
|
||||
// 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-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 "MainDlg.hxx"
|
||||
|
||||
#include "GlobalData.hxx"
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "AboutPage.hxx"
|
||||
#include "DocPage.hxx"
|
||||
#include "ConfigPage.hxx"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define BKGND_BITMAP_TOP 64
|
||||
|
@ -19,45 +31,39 @@
|
|||
|
||||
// NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS!
|
||||
|
||||
inline LPARAM ListView_GetItemData(
|
||||
HWND hwndList,
|
||||
int iItem
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
inline LPARAM ListView_GetItemData( HWND hwndList, int iItem )
|
||||
{
|
||||
LVITEM lvi;
|
||||
lvi.mask = LVIF_PARAM;
|
||||
lvi.iItem = iItem;
|
||||
lvi.iSubItem = 0;
|
||||
|
||||
ListView_GetItem(hwndList, &lvi);
|
||||
|
||||
return lvi.lParam;
|
||||
}
|
||||
|
||||
CMainDlg::CMainDlg(
|
||||
CGlobalData& rGlobalData,
|
||||
HINSTANCE hInstance
|
||||
) : \
|
||||
m_rGlobalData(rGlobalData),
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CMainDlg::CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance )
|
||||
: m_rGlobalData(rGlobalData),
|
||||
m_hInstance(hInstance)
|
||||
{
|
||||
}
|
||||
|
||||
void CMainDlg::ClearList(
|
||||
void
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CMainDlg::ClearList( void )
|
||||
{
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
delete (CListData*)ListView_GetItemData( m_hwndList, i );
|
||||
}
|
||||
|
||||
ListView_DeleteAllItems( m_hwndList );
|
||||
}
|
||||
|
||||
int CMainDlg::DoModal(
|
||||
HWND hwndParent
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int CMainDlg::DoModal( HWND hwndParent )
|
||||
{
|
||||
return DialogBoxParam( m_hInstance,
|
||||
MAKEINTRESOURCE(IDD),
|
||||
|
@ -66,12 +72,9 @@ int CMainDlg::DoModal(
|
|||
(LPARAM)this );
|
||||
}
|
||||
|
||||
BOOL CALLBACK CMainDlg::StaticDialogFunc(
|
||||
HWND hDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CALLBACK
|
||||
CMainDlg::StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
CMainDlg* pDlg;
|
||||
|
||||
|
@ -80,29 +83,22 @@ BOOL CALLBACK CMainDlg::StaticDialogFunc(
|
|||
case WM_INITDIALOG:
|
||||
pDlg = reinterpret_cast<CMainDlg*>( lParam );
|
||||
pDlg->m_hwnd = hDlg;
|
||||
(void)::SetWindowLong( hDlg,
|
||||
DWL_USER,
|
||||
reinterpret_cast<LONG>( pDlg ) );
|
||||
(void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast<LONG>( pDlg ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
pDlg = reinterpret_cast<CMainDlg*>(
|
||||
::GetWindowLong( hDlg, DWL_USER ) );
|
||||
pDlg = reinterpret_cast<CMainDlg*>( ::GetWindowLong( hDlg, DWL_USER ) );
|
||||
if ( pDlg == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return pDlg->DialogFunc( uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
BOOL CALLBACK CMainDlg::DialogFunc(
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CALLBACK
|
||||
CMainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
BOOL b;
|
||||
|
||||
|
@ -114,16 +110,12 @@ BOOL CALLBACK CMainDlg::DialogFunc(
|
|||
case WM_CTLCOLORSTATIC:
|
||||
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
|
||||
if (b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if ( OnEraseBkgnd( (HDC)wParam ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
|
@ -140,18 +132,14 @@ BOOL CALLBACK CMainDlg::DialogFunc(
|
|||
TRACE( "WM_QUERYNEWPALETTE from maindlg" );
|
||||
return FALSE;
|
||||
|
||||
//
|
||||
// Cool caption handlers
|
||||
//
|
||||
|
||||
case WM_DESTROY:
|
||||
OnDestroy( );
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
// Forward this onto the control
|
||||
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM,
|
||||
wParam, lParam );
|
||||
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, wParam, lParam );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCPAINT:
|
||||
|
@ -173,23 +161,16 @@ BOOL CALLBACK CMainDlg::DialogFunc(
|
|||
case WM_SYSCOMMAND:
|
||||
// Allow Alt-F4 to close the window
|
||||
if ( wParam == SC_CLOSE )
|
||||
{
|
||||
::EndDialog( m_hwnd, IDCANCEL );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Message not handled
|
||||
//
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnInitDialog(
|
||||
void
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnInitDialog( void )
|
||||
{
|
||||
DWORD dwRet;
|
||||
|
||||
|
@ -204,15 +185,11 @@ BOOL CMainDlg::OnInitDialog(
|
|||
}
|
||||
|
||||
// Set dialog icon
|
||||
|
||||
HICON hicon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_APP));
|
||||
::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon );
|
||||
::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon );
|
||||
|
||||
//
|
||||
// Make the Rom note have bold text
|
||||
//
|
||||
|
||||
HWND hwndCtrl;
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE );
|
||||
|
@ -225,12 +202,9 @@ BOOL CMainDlg::OnInitDialog(
|
|||
|
||||
m_hfontRomNote = ::CreateFontIndirect( &lf );
|
||||
if ( m_hfontRomNote )
|
||||
{
|
||||
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
|
||||
}
|
||||
|
||||
// Do subclassing
|
||||
|
||||
m_CoolCaption.OnInitDialog( hwnd );
|
||||
m_header.SubclassDlgItem( hwnd, IDC_ROMLIST );
|
||||
m_btn3d.SubclassDlgItem( hwnd, IDC_TITLE );
|
||||
|
@ -243,16 +217,12 @@ BOOL CMainDlg::OnInitDialog(
|
|||
TCHAR psz[nMaxString + 1];
|
||||
|
||||
// Initialize the list view
|
||||
|
||||
m_hwndList = ::GetDlgItem( hwnd, IDC_ROMLIST );
|
||||
ASSERT( m_hwndList );
|
||||
|
||||
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
|
||||
|
||||
::SendMessage( m_hwndList,
|
||||
LVM_SETEXTENDEDLISTVIEWSTYLE,
|
||||
0,
|
||||
LVS_EX_FULLROWSELECT );
|
||||
::SendMessage( m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE,
|
||||
0, LVS_EX_FULLROWSELECT );
|
||||
|
||||
RECT rc;
|
||||
::GetClientRect( m_hwndList, &rc );
|
||||
|
@ -262,8 +232,7 @@ BOOL CMainDlg::OnInitDialog(
|
|||
|
||||
for (int i = 0; i < CListData::GetColumnCount(); ++i)
|
||||
{
|
||||
::LoadString( m_hInstance,
|
||||
CListData::GetColumnNameIdForColumn( i ),
|
||||
::LoadString( m_hInstance, CListData::GetColumnNameIdForColumn( i ),
|
||||
psz, nMaxString );
|
||||
|
||||
LV_COLUMN lvc;
|
||||
|
@ -282,23 +251,11 @@ BOOL CMainDlg::OnInitDialog(
|
|||
}
|
||||
|
||||
// if items added, select first item and enable play button
|
||||
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
if (nCount != 0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
DWORD dwStartTick = ::GetTickCount();
|
||||
#endif
|
||||
|
||||
m_header.SetSortCol( 0, TRUE );
|
||||
ListView_SortItems( m_hwndList,
|
||||
ListViewCompareFunc,
|
||||
(LPARAM)this );
|
||||
|
||||
#ifdef _DEBUG
|
||||
TRACE("\tElapsed ticks for ListView_SortItems = %ld", ::GetTickCount()-dwStartTick);
|
||||
#endif
|
||||
|
||||
ListView_SortItems( m_hwndList, ListViewCompareFunc, (LPARAM)this );
|
||||
ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
|
@ -307,36 +264,24 @@ BOOL CMainDlg::OnInitDialog(
|
|||
::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE );
|
||||
}
|
||||
|
||||
//
|
||||
// Show status text
|
||||
//
|
||||
|
||||
TCHAR pszStatus[256 + 1];
|
||||
LoadString(m_hInstance, IDS_STATUSTEXT, pszStatus, 256);
|
||||
wsprintf( psz, pszStatus, nCount );
|
||||
SetDlgItemText( hwnd, IDC_ROMCOUNT, psz );
|
||||
|
||||
//
|
||||
// Show rom path
|
||||
//
|
||||
|
||||
SetDlgItemText( hwnd, IDC_ROMPATH, m_rGlobalData.RomDir() );
|
||||
|
||||
//
|
||||
// Set default button
|
||||
//
|
||||
|
||||
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
|
||||
|
||||
// return FALSE if SetFocus is called
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnCommand(
|
||||
int id,
|
||||
HWND hwndCtl,
|
||||
UINT codeNotify
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
||||
{
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
UNUSED_ALWAYS( codeNotify );
|
||||
|
@ -349,33 +294,15 @@ BOOL CMainDlg::OnCommand(
|
|||
switch (id)
|
||||
{
|
||||
case IDC_PLAY:
|
||||
|
||||
nItem = (int)::SendMessage( m_hwndList,
|
||||
LVM_GETNEXTITEM,
|
||||
(WPARAM)-1,
|
||||
MAKELPARAM( LVNI_SELECTED, 0 ) );
|
||||
nItem = (int)::SendMessage( m_hwndList, LVM_GETNEXTITEM,
|
||||
(WPARAM)-1, MAKELPARAM( LVNI_SELECTED, 0 ) );
|
||||
ASSERT( nItem != -1 );
|
||||
if ( nItem == -1 )
|
||||
{
|
||||
::MessageBox( m_hInstance,
|
||||
hwnd,
|
||||
IDS_NO_ITEM_SELECTED );
|
||||
::MessageBox( m_hInstance, hwnd, IDS_NO_ITEM_SELECTED );
|
||||
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 );
|
||||
|
||||
TCHAR pszPathName[ MAX_PATH + 1 ];
|
||||
|
@ -385,26 +312,25 @@ BOOL CMainDlg::OnCommand(
|
|||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// Play the game!
|
||||
|
||||
::EnableWindow( hwnd, FALSE );
|
||||
|
||||
(void)m_stella.PlayROM( hwnd,
|
||||
pszPathName,
|
||||
(void)m_stella.PlayROM( hwnd, pszPathName,
|
||||
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
|
||||
m_rGlobalData );
|
||||
|
||||
::EnableWindow( hwnd, TRUE );
|
||||
|
||||
// Set focus back to the rom list
|
||||
|
||||
::SetFocus( m_hwndList );
|
||||
|
||||
return TRUE;
|
||||
break; // case IDC_PLAY
|
||||
|
||||
case IDC_EXIT:
|
||||
ClearList();
|
||||
::EndDialog( hwnd, IDCANCEL );
|
||||
return TRUE;
|
||||
break; // case IDC_EXIT
|
||||
|
||||
case IDC_CONFIG:
|
||||
{
|
||||
|
@ -414,8 +340,10 @@ BOOL CMainDlg::OnCommand(
|
|||
ps.AddPage( &pgConfig );
|
||||
|
||||
(void)ps.DoModal();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
break; // case IDC_CONFIG
|
||||
}
|
||||
|
||||
case IDC_ABOUT:
|
||||
{
|
||||
|
@ -428,17 +356,16 @@ BOOL CMainDlg::OnCommand(
|
|||
ps.AddPage(&pgDoc);
|
||||
|
||||
ps.DoModal();
|
||||
}
|
||||
return TRUE;
|
||||
break; // case IDC_ABOUT
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnNotify(
|
||||
int idCtrl,
|
||||
LPNMHDR pnmh
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnNotify( int idCtrl, LPNMHDR pnmh )
|
||||
{
|
||||
UNUSED_ALWAYS( idCtrl );
|
||||
|
||||
|
@ -463,40 +390,31 @@ BOOL CMainDlg::OnNotify(
|
|||
}
|
||||
|
||||
// not handled
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void ScreenToClient(
|
||||
HWND hwnd,
|
||||
LPRECT lpRect
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static void ScreenToClient( HWND hwnd, LPRECT lpRect )
|
||||
{
|
||||
::ScreenToClient(hwnd, (LPPOINT)lpRect);
|
||||
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
||||
}
|
||||
|
||||
static void FillSolidRect(
|
||||
HDC hdc,
|
||||
LPCRECT lpRect,
|
||||
COLORREF clr
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static void FillSolidRect( HDC hdc, LPCRECT lpRect, COLORREF clr )
|
||||
{
|
||||
COLORREF crOld = ::SetBkColor(hdc, clr);
|
||||
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
||||
::SetBkColor(hdc, crOld);
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnEraseBkgnd(
|
||||
HDC hdc
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnEraseBkgnd( HDC hdc )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RECT rcWindow;
|
||||
::GetWindowRect( *this, &rcWindow );
|
||||
|
@ -505,16 +423,14 @@ BOOL CMainDlg::OnEraseBkgnd(
|
|||
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
|
||||
|
||||
RECT rc;
|
||||
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP,
|
||||
rcWindow.right, BKGND_BITMAP_BOTTOM );
|
||||
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, rcWindow.right, BKGND_BITMAP_BOTTOM );
|
||||
|
||||
long lWidth = rc.right - rc.left;
|
||||
long lHeight = rc.bottom - rc.top;
|
||||
|
||||
HDC hdcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
HBITMAP hbmpTile = LoadBitmap( m_hInstance,
|
||||
MAKEINTRESOURCE(IDB_TILE) );
|
||||
HBITMAP hbmpTile = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_TILE) );
|
||||
|
||||
BITMAP bm;
|
||||
GetObject(hbmpTile, sizeof(bm), &bm);
|
||||
|
@ -535,42 +451,31 @@ BOOL CMainDlg::OnEraseBkgnd(
|
|||
}
|
||||
|
||||
SelectObject(hdcMem, hbmpOld);
|
||||
|
||||
DeleteObject(hbmpTile);
|
||||
|
||||
DeleteDC(hdcMem);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HBRUSH CMainDlg::OnCtlColorStatic(
|
||||
HDC hdcStatic,
|
||||
HWND hwndStatic
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
HBRUSH CMainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
|
||||
return (HBRUSH)GetStockObject(NULL_BRUSH);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
DWORD CMainDlg::PopulateRomList(
|
||||
void
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DWORD CMainDlg::PopulateRomList( void )
|
||||
{
|
||||
|
||||
TRACE("CMainDlg::PopulateRomList");
|
||||
|
||||
DWORD dwRet;
|
||||
|
|
|
@ -1,58 +1,21 @@
|
|||
/*
|
||||
|
||||
StellaX
|
||||
Win32 DirectX port of Stella
|
||||
|
||||
Written by Jeff Miller (contact Bradford for current email address)
|
||||
|
||||
Stella core developed by Bradford W. Mott
|
||||
|
||||
This software is Copyright (c) 1995-2000, Jeff Miller
|
||||
|
||||
REVISIONS:
|
||||
|
||||
14-Mar-99 1.1.0 new code base
|
||||
|
||||
19-Mar-99 1.1.1 took into account video width
|
||||
fixed no sound card bug
|
||||
-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
|
||||
|
||||
*/
|
||||
//============================================================================
|
||||
//
|
||||
// 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-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: main.cxx,v 1.2 2004-05-27 22:02:35 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
#include "resource.h"
|
||||
|
@ -63,20 +26,16 @@ REVISIONS:
|
|||
class CSingleInstance
|
||||
{
|
||||
public:
|
||||
|
||||
CSingleInstance( LPCTSTR pszName )
|
||||
{
|
||||
::SetLastError( ERROR_SUCCESS );
|
||||
|
||||
m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
|
||||
|
||||
m_dwError = ::GetLastError();
|
||||
}
|
||||
|
||||
~CSingleInstance()
|
||||
{
|
||||
if ( m_hMutex != INVALID_HANDLE_VALUE &&
|
||||
m_dwError != ERROR_ALREADY_EXISTS )
|
||||
if ( m_hMutex != INVALID_HANDLE_VALUE && m_dwError != ERROR_ALREADY_EXISTS )
|
||||
{
|
||||
VERIFY( ::ReleaseMutex( m_hMutex ) );
|
||||
VERIFY( ::CloseHandle( m_hMutex ) );
|
||||
|
@ -89,7 +48,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
HANDLE m_hMutex;
|
||||
DWORD m_dwError;
|
||||
|
||||
|
@ -101,13 +59,8 @@ void operator=( const CSingleInstance& ); // no implementation
|
|||
|
||||
LPCTSTR g_ctszDebugLog = _T("stella.log");
|
||||
|
||||
|
||||
int WINAPI _tWinMain(
|
||||
HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow
|
||||
)
|
||||
int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
UNUSED_ALWAYS( hPrevInstance );
|
||||
UNUSED_ALWAYS( lpCmdLine );
|
||||
|
@ -126,14 +79,11 @@ int WINAPI _tWinMain(
|
|||
|
||||
HRESULT hrCoInit = ::CoInitialize( NULL );
|
||||
if ( FAILED(hrCoInit) )
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_COINIT_FAILED );
|
||||
}
|
||||
|
||||
::InitCommonControls();
|
||||
|
||||
BOOL fOk = FALSE;
|
||||
|
||||
CGlobalData globaldata( hInstance );
|
||||
|
||||
fOk = globaldata.ParseCommandLine( __argc, __argv );
|
||||
|
@ -146,40 +96,26 @@ int WINAPI _tWinMain(
|
|||
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
|
||||
{
|
||||
dwRet = stellax.PlayROM( GetDesktopWindow(),
|
||||
ctszPathName,
|
||||
_T("StellaX"), // Dont knwo the friendly name
|
||||
globaldata );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// show the ui
|
||||
//
|
||||
|
||||
CMainDlg dlg( globaldata, hInstance );
|
||||
dlg.DoModal( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
if ( hrCoInit == S_OK )
|
||||
{
|
||||
::CoUninitialize();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,49 +1,5 @@
|
|||
[Options]
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; 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
|
||||
|
||||
RomPath=C:\Dell
|
||||
FrameRate=60
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; 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
|
||||
Mute=1
|
||||
Paddle=3
|
||||
|
|
Loading…
Reference in New Issue