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,36 +1,45 @@
|
|||
//
|
||||
// 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") );
|
||||
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_MAINTAINER );
|
||||
m_hlMail_JSM.SetURL( _T("mailto:sa666_666@hotmail.com?Subject=StellaX") );
|
||||
|
||||
m_hlWWW_JSM.SubclassDlgItem( hwnd, IDC_WEB_MAINTAINER );
|
||||
m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
|
||||
m_hlWWW_JSM.SubclassDlgItem( hwnd, IDC_WEB_MAINTAINER );
|
||||
m_hlWWW_JSM.SetURL( _T("http://minbar.org") );
|
||||
|
||||
m_hlMail_Stella.SubclassDlgItem( hwnd, IDC_EMAIL_STELLA );
|
||||
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
||||
m_hlMail_Stella.SubclassDlgItem( hwnd, IDC_EMAIL_STELLA );
|
||||
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
|
||||
|
||||
m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA );
|
||||
m_hlWWW_Stella.SetURL( _T("http://stella.sf.net") );
|
||||
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;
|
||||
// return FALSE if SetFocus is called
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,45 @@
|
|||
//
|
||||
// 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"
|
||||
|
||||
class CHelpPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
public:
|
||||
CHelpPage();
|
||||
|
||||
CHelpPage();
|
||||
protected:
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
|
||||
protected:
|
||||
private:
|
||||
CHyperLink m_hlMail_JSM;
|
||||
CHyperLink m_hlWWW_JSM;
|
||||
CHyperLink m_hlMail_Stella;
|
||||
CHyperLink m_hlWWW_Stella;
|
||||
|
||||
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
|
||||
CHelpPage( const CHelpPage& ); // no implementation
|
||||
void operator=( const CHelpPage& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,154 +1,106 @@
|
|||
//
|
||||
// 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 ),
|
||||
CPropertyPage( IDD_CONFIG_PAGE )
|
||||
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;
|
||||
// return FALSE if SetFocus is called
|
||||
m_hwnd = hwnd;
|
||||
HWND hwndCtrl;
|
||||
|
||||
//
|
||||
// Set up ROMPATH
|
||||
//
|
||||
// Set up ROMPATH
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH );
|
||||
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
|
||||
::SetWindowText( hwndCtrl, m_rGlobalData.RomDir() );
|
||||
|
||||
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 );
|
||||
|
||||
//
|
||||
// Set up PADDLE
|
||||
//
|
||||
TCHAR psz[4] = _T("0");
|
||||
TCHAR i;
|
||||
for ( i = 0; i < 4; ++i )
|
||||
{
|
||||
psz[0] = _T('0') + i;
|
||||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
|
||||
}
|
||||
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
|
||||
::SendMessage( hwndCtrl, CB_SETCURSEL, m_rGlobalData.PaddleMode(), 0 );
|
||||
|
||||
LPTSTR psz = _T("0");
|
||||
TCHAR i;
|
||||
for ( i = 0; i < 4; ++i )
|
||||
{
|
||||
psz[0] = _T('0') + i;
|
||||
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
|
||||
}
|
||||
// Set up SOUND
|
||||
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
|
||||
::SendMessage( hwndCtrl, BM_SETCHECK, m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED, 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 );
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CConfigPage::OnDestroy(
|
||||
void
|
||||
)
|
||||
void CConfigPage::OnDestroy( void )
|
||||
{
|
||||
}
|
||||
|
||||
LONG CConfigPage::OnApply(
|
||||
LPPSHNOTIFY lppsn
|
||||
)
|
||||
LONG CConfigPage::OnApply( 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;
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH );
|
||||
ASSERT( hwndCtrl );
|
||||
::GetWindowText( hwndCtrl, m_rGlobalData.m_pszRomDir, MAX_PATH );
|
||||
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH );
|
||||
ASSERT( hwndCtrl );
|
||||
::GetWindowText( hwndCtrl, m_rGlobalData.m_pszRomDir, MAX_PATH );
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE );
|
||||
ASSERT( hwndCtrl );
|
||||
m_rGlobalData.m_nPaddleMode = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
|
||||
|
||||
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE );
|
||||
ASSERT( hwndCtrl );
|
||||
m_rGlobalData.m_nPaddleMode = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
|
||||
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_SOUND );
|
||||
ASSERT( hwndCtrl );
|
||||
m_rGlobalData.m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
|
||||
== BST_CHECKED );
|
||||
m_rGlobalData.SetModified();
|
||||
|
||||
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();
|
||||
|
||||
return PSNRET_NOERROR;
|
||||
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 );
|
||||
UNUSED_ALWAYS( wNotifyCode );
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
|
||||
if ( wID == IDC_BROWSE )
|
||||
{
|
||||
CBrowseForFolder bff( m_hwnd );
|
||||
bff.SetFlags( BIF_RETURNONLYFSDIRS );
|
||||
if ( bff.SelectFolder() )
|
||||
{
|
||||
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
}
|
||||
}
|
||||
if ( wID == IDC_BROWSE )
|
||||
{
|
||||
CBrowseForFolder bff( m_hwnd );
|
||||
bff.SetFlags( BIF_RETURNONLYFSDIRS );
|
||||
if ( bff.SelectFolder() )
|
||||
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1,37 +1,47 @@
|
|||
//
|
||||
// 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"
|
||||
|
||||
class CConfigPage : public CPropertyPage
|
||||
{
|
||||
public:
|
||||
public:
|
||||
CConfigPage( CGlobalData& rGlobalData );
|
||||
|
||||
CConfigPage( CGlobalData& rGlobalData );
|
||||
protected:
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
virtual void OnDestroy();
|
||||
virtual LONG OnApply( LPPSHNOTIFY lppsn );
|
||||
|
||||
protected:
|
||||
|
||||
virtual BOOL OnInitDialog( HWND hwnd );
|
||||
virtual void OnDestroy();
|
||||
virtual LONG OnApply( LPPSHNOTIFY lppsn );
|
||||
|
||||
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
CConfigPage( const CConfigPage& ); // no implementation
|
||||
void operator=( const CConfigPage& ); // no implementation
|
||||
};
|
||||
|
||||
#endif
|
||||
#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
|
||||
|
@ -25,133 +36,80 @@ BOOL WritePrivateProfileInt(
|
|||
LPCTSTR lpFileName // initialization file
|
||||
)
|
||||
{
|
||||
TCHAR psz[ 50 ];
|
||||
TCHAR psz[ 50 ];
|
||||
|
||||
_itoa( nValue, psz, 10 );
|
||||
_itoa( nValue, psz, 10 );
|
||||
|
||||
return ::WritePrivateProfileString( lpAppName,
|
||||
lpKeyName,
|
||||
psz,
|
||||
lpFileName );
|
||||
return ::WritePrivateProfileString( lpAppName, lpKeyName, psz, lpFileName );
|
||||
}
|
||||
|
||||
CGlobalData::CGlobalData(
|
||||
HINSTANCE hInstance
|
||||
) : \
|
||||
m_hInstance(hInstance),
|
||||
m_fIsModified( FALSE )
|
||||
CGlobalData::CGlobalData( HINSTANCE hInstance )
|
||||
: m_hInstance(hInstance),
|
||||
m_fIsModified( FALSE )
|
||||
{
|
||||
m_pszPathName[0] = _T('\0');
|
||||
m_pszPathName[0] = _T('\0');
|
||||
|
||||
//
|
||||
// Read the ROM directory from the stella.ini file
|
||||
// default to "ROMS" directory for compatibility with older StellaX
|
||||
//
|
||||
// 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);
|
||||
|
||||
::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 the desired frame rate
|
||||
// Read Mute
|
||||
m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameMute,
|
||||
FALSE,
|
||||
g_pszIniFile );
|
||||
|
||||
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,
|
||||
// Read the Paddle mode
|
||||
m_nPaddleMode = (int)::GetPrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNamePaddle,
|
||||
0,
|
||||
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 );
|
||||
if ( m_nPaddleMode < 0 || m_nPaddleMode > 3 )
|
||||
m_nPaddleMode = 0;
|
||||
|
||||
}
|
||||
|
||||
CGlobalData::~CGlobalData(
|
||||
)
|
||||
CGlobalData::~CGlobalData()
|
||||
{
|
||||
//
|
||||
// Write out settings (if changed)
|
||||
//
|
||||
// Write out settings (if changed)
|
||||
if ( m_fIsModified )
|
||||
{
|
||||
// RomPath
|
||||
::WritePrivateProfileString( g_pszIniSection,
|
||||
g_pszKeyNameRomPath,
|
||||
m_pszRomDir,
|
||||
g_pszIniFile );
|
||||
|
||||
if ( m_fIsModified )
|
||||
{
|
||||
::WritePrivateProfileString( g_pszIniSection,
|
||||
g_pszKeyNameRomPath,
|
||||
m_pszRomDir,
|
||||
g_pszIniFile );
|
||||
// FrameRate
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameFrameRate,
|
||||
m_nDesiredFrameRate,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameFrameRate,
|
||||
m_nDesiredFrameRate,
|
||||
g_pszIniFile );
|
||||
// Mute
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameMute,
|
||||
m_fNoSound,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameMute,
|
||||
m_fNoSound,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameAutoSelectVideoMode,
|
||||
m_fAutoSelectVideoMode,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNamePaddle,
|
||||
m_nPaddleMode,
|
||||
g_pszIniFile );
|
||||
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNameDisableJoystick,
|
||||
m_fDisableJoystick,
|
||||
g_pszIniFile );
|
||||
}
|
||||
// Paddle
|
||||
::WritePrivateProfileInt( g_pszIniSection,
|
||||
g_pszKeyNamePaddle,
|
||||
m_nPaddleMode,
|
||||
g_pszIniFile );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CGlobalData::ParseCommandLine(
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -12,111 +26,75 @@ class CConfigPage;
|
|||
|
||||
class CGlobalData
|
||||
{
|
||||
friend CConfigPage;
|
||||
|
||||
public:
|
||||
friend CConfigPage;
|
||||
|
||||
public:
|
||||
CGlobalData( HINSTANCE hInstance );
|
||||
~CGlobalData( );
|
||||
|
||||
BOOL ParseCommandLine( int argc, TCHAR* argv[] );
|
||||
|
||||
int DesiredFrameRate( void ) const
|
||||
{
|
||||
return m_nDesiredFrameRate;
|
||||
}
|
||||
{
|
||||
return m_nDesiredFrameRate;
|
||||
}
|
||||
|
||||
//
|
||||
// Booleans
|
||||
//
|
||||
|
||||
BOOL ShowFPS( void ) const
|
||||
{
|
||||
return m_fShowFPS;
|
||||
}
|
||||
|
||||
BOOL NoSound() const
|
||||
{
|
||||
return m_fNoSound;
|
||||
}
|
||||
{
|
||||
return m_fNoSound;
|
||||
}
|
||||
|
||||
BOOL DisableJoystick( void ) const
|
||||
{
|
||||
return m_fDisableJoystick;
|
||||
}
|
||||
|
||||
BOOL AutoSelectVideoMode( void ) const
|
||||
{
|
||||
return m_fAutoSelectVideoMode;
|
||||
}
|
||||
|
||||
int PaddleMode( void ) const;
|
||||
int PaddleMode( void ) const
|
||||
{
|
||||
return m_nPaddleMode;
|
||||
}
|
||||
|
||||
LPCTSTR PathName( void ) const
|
||||
{
|
||||
if ( m_pszPathName[0] == _T('\0') )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_pszPathName;
|
||||
if ( m_pszPathName[0] == _T('\0') )
|
||||
return NULL;
|
||||
|
||||
return m_pszPathName;
|
||||
}
|
||||
|
||||
LPCTSTR RomDir( void ) const
|
||||
{
|
||||
return m_pszRomDir;
|
||||
}
|
||||
{
|
||||
return m_pszRomDir;
|
||||
}
|
||||
|
||||
HINSTANCE ModuleInstance( void ) const
|
||||
{
|
||||
return m_hInstance;
|
||||
}
|
||||
{
|
||||
return m_hInstance;
|
||||
}
|
||||
|
||||
//
|
||||
// Modified flags
|
||||
//
|
||||
|
||||
void SetModified( void )
|
||||
{
|
||||
m_fIsModified = TRUE;
|
||||
}
|
||||
{
|
||||
m_fIsModified = TRUE;
|
||||
}
|
||||
|
||||
BOOL IsModified( void ) const
|
||||
{
|
||||
return m_fIsModified;
|
||||
}
|
||||
|
||||
private:
|
||||
{
|
||||
return m_fIsModified;
|
||||
}
|
||||
|
||||
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 ];
|
||||
|
||||
BOOL m_fIsModified;
|
||||
|
||||
CGlobalData( const CGlobalData& ); // no implementation
|
||||
void operator=( const CGlobalData& ); // no implementation
|
||||
CGlobalData( const CGlobalData& ); // no implementation
|
||||
void operator=( const CGlobalData& ); // no implementation
|
||||
};
|
||||
|
||||
inline int CGlobalData::PaddleMode(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_nPaddleMode;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,579 +1,484 @@
|
|||
//
|
||||
// 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
|
||||
#define BKGND_BITMAP_TOP 64
|
||||
#define BKGND_BITMAP_BOTTOM 355
|
||||
|
||||
// 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;
|
||||
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),
|
||||
m_hInstance(hInstance)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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 );
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
delete (CListData*)ListView_GetItemData( m_hwndList, i );
|
||||
}
|
||||
for (int i = 0; i < nCount; ++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,
|
||||
MAKEINTRESOURCE(IDD),
|
||||
hwndParent,
|
||||
StaticDialogFunc,
|
||||
(LPARAM)this );
|
||||
return DialogBoxParam( m_hInstance,
|
||||
MAKEINTRESOURCE(IDD),
|
||||
hwndParent,
|
||||
StaticDialogFunc,
|
||||
(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;
|
||||
CMainDlg* pDlg;
|
||||
|
||||
switch ( uMsg )
|
||||
{
|
||||
switch ( uMsg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
pDlg = reinterpret_cast<CMainDlg*>( lParam );
|
||||
pDlg->m_hwnd = hDlg;
|
||||
(void)::SetWindowLong( hDlg,
|
||||
DWL_USER,
|
||||
reinterpret_cast<LONG>( pDlg ) );
|
||||
break;
|
||||
pDlg = reinterpret_cast<CMainDlg*>( lParam );
|
||||
pDlg->m_hwnd = hDlg;
|
||||
(void)::SetWindowLong( hDlg, DWL_USER, reinterpret_cast<LONG>( pDlg ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
pDlg = reinterpret_cast<CMainDlg*>(
|
||||
::GetWindowLong( hDlg, DWL_USER ) );
|
||||
if ( pDlg == NULL )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
pDlg = reinterpret_cast<CMainDlg*>( ::GetWindowLong( hDlg, DWL_USER ) );
|
||||
if ( pDlg == NULL )
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return pDlg->DialogFunc( uMsg, wParam, lParam );
|
||||
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;
|
||||
BOOL b;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) );
|
||||
return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) );
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
|
||||
if (b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
break;
|
||||
b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam );
|
||||
if (b)
|
||||
return b;
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if ( OnEraseBkgnd( (HDC)wParam ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
if ( OnEraseBkgnd( (HDC)wParam ) )
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
return OnInitDialog( );
|
||||
return OnInitDialog( );
|
||||
|
||||
case WM_NOTIFY:
|
||||
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
||||
return OnNotify( (int)wParam, (LPNMHDR)lParam );
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
TRACE( "WM_PALETTECHANGED from maindlg" );
|
||||
return FALSE;
|
||||
TRACE( "WM_PALETTECHANGED from maindlg" );
|
||||
return FALSE;
|
||||
|
||||
case WM_QUERYNEWPALETTE:
|
||||
TRACE( "WM_QUERYNEWPALETTE from maindlg" );
|
||||
return FALSE;
|
||||
TRACE( "WM_QUERYNEWPALETTE from maindlg" );
|
||||
return FALSE;
|
||||
|
||||
//
|
||||
// Cool caption handlers
|
||||
//
|
||||
|
||||
case WM_DESTROY:
|
||||
OnDestroy( );
|
||||
break;
|
||||
OnDestroy( );
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
// Forward this onto the control
|
||||
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM,
|
||||
wParam, lParam );
|
||||
return TRUE;
|
||||
// Forward this onto the control
|
||||
::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, wParam, lParam );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCPAINT:
|
||||
// DefWindowProc(hDlg, uMsg, wParam, lParam);
|
||||
OnNcPaint( (HRGN)wParam );
|
||||
return TRUE;
|
||||
// DefWindowProc(hDlg, uMsg, wParam, lParam);
|
||||
OnNcPaint( (HRGN)wParam );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCACTIVATE:
|
||||
OnNcActivate( (BOOL)wParam );
|
||||
// When the fActive parameter is FALSE, an application should return
|
||||
// TRUE to indicate that the system should proceed with the default
|
||||
// processing
|
||||
SetWindowLong( m_hwnd, DWL_MSGRESULT, TRUE );
|
||||
return TRUE;
|
||||
OnNcActivate( (BOOL)wParam );
|
||||
// When the fActive parameter is FALSE, an application should return
|
||||
// TRUE to indicate that the system should proceed with the default
|
||||
// processing
|
||||
SetWindowLong( m_hwnd, DWL_MSGRESULT, TRUE );
|
||||
return TRUE;
|
||||
|
||||
case WM_NCLBUTTONDOWN:
|
||||
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
|
||||
return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) );
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
// Allow Alt-F4 to close the window
|
||||
if ( wParam == SC_CLOSE )
|
||||
{
|
||||
::EndDialog( m_hwnd, IDCANCEL );
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Allow Alt-F4 to close the window
|
||||
if ( wParam == SC_CLOSE )
|
||||
::EndDialog( m_hwnd, IDCANCEL );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Message not handled
|
||||
//
|
||||
// Message not handled
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnInitDialog( void )
|
||||
{
|
||||
DWORD dwRet;
|
||||
|
||||
HWND hwnd = *this;
|
||||
|
||||
dwRet = m_stella.Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
|
||||
SendMessage( hwnd, WM_CLOSE, 0, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// 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 );
|
||||
|
||||
HFONT hfont = (HFONT)::SendMessage( hwndCtrl, WM_GETFONT, 0, 0 );
|
||||
|
||||
LOGFONT lf;
|
||||
::GetObject( hfont, sizeof(LOGFONT), &lf );
|
||||
lf.lfWeight = FW_BOLD;
|
||||
|
||||
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 );
|
||||
m_btnPlay.SubclassDlgItem( hwnd, IDC_PLAY );
|
||||
m_btnHelp.SubclassDlgItem( hwnd, IDC_ABOUT );
|
||||
m_btnConfig.SubclassDlgItem( hwnd, IDC_CONFIG );
|
||||
m_btnExit.SubclassDlgItem( hwnd, IDC_EXIT );
|
||||
|
||||
const int nMaxString = 256;
|
||||
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 );
|
||||
|
||||
RECT rc;
|
||||
::GetClientRect( m_hwndList, &rc );
|
||||
|
||||
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
|
||||
int cx = lTotalWidth / CListData::GetColumnCount();
|
||||
|
||||
for (int i = 0; i < CListData::GetColumnCount(); ++i)
|
||||
{
|
||||
::LoadString( m_hInstance, CListData::GetColumnNameIdForColumn( i ),
|
||||
psz, nMaxString );
|
||||
|
||||
LV_COLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
lvc.cx = cx;
|
||||
lvc.pszText = psz;
|
||||
ListView_InsertColumn( m_hwndList, i, &lvc );
|
||||
}
|
||||
|
||||
DWORD dwError = PopulateRomList();
|
||||
if ( dwError != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwError, _T("PopulateRomList") );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// if items added, select first item and enable play button
|
||||
int nCount = ListView_GetItemCount( m_hwndList );
|
||||
if (nCount != 0)
|
||||
{
|
||||
m_header.SetSortCol( 0, TRUE );
|
||||
ListView_SortItems( m_hwndList, ListViewCompareFunc, (LPARAM)this );
|
||||
ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
else
|
||||
{
|
||||
::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::OnInitDialog(
|
||||
void
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
||||
{
|
||||
DWORD dwRet;
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
UNUSED_ALWAYS( codeNotify );
|
||||
|
||||
HWND hwnd = *this;
|
||||
HWND hwnd = *this;
|
||||
CListData* pListData;
|
||||
|
||||
dwRet = m_stella.Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
|
||||
SendMessage( hwnd, WM_CLOSE, 0, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
int nItem;
|
||||
|
||||
// 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 );
|
||||
|
||||
HFONT hfont = (HFONT)::SendMessage( hwndCtrl, WM_GETFONT, 0, 0 );
|
||||
|
||||
LOGFONT lf;
|
||||
::GetObject( hfont, sizeof(LOGFONT), &lf );
|
||||
lf.lfWeight = FW_BOLD;
|
||||
|
||||
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 );
|
||||
m_btnPlay.SubclassDlgItem( hwnd, IDC_PLAY );
|
||||
m_btnHelp.SubclassDlgItem( hwnd, IDC_ABOUT );
|
||||
m_btnConfig.SubclassDlgItem( hwnd, IDC_CONFIG );
|
||||
m_btnExit.SubclassDlgItem( hwnd, IDC_EXIT );
|
||||
|
||||
const int nMaxString = 256;
|
||||
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 );
|
||||
|
||||
RECT rc;
|
||||
::GetClientRect( m_hwndList, &rc );
|
||||
|
||||
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
|
||||
int cx = lTotalWidth / CListData::GetColumnCount();
|
||||
|
||||
for (int i = 0; i < CListData::GetColumnCount(); ++i)
|
||||
{
|
||||
::LoadString( m_hInstance,
|
||||
CListData::GetColumnNameIdForColumn( i ),
|
||||
psz, nMaxString );
|
||||
|
||||
LV_COLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
lvc.cx = cx;
|
||||
lvc.pszText = psz;
|
||||
ListView_InsertColumn( m_hwndList, i, &lvc );
|
||||
}
|
||||
|
||||
DWORD dwError = PopulateRomList();
|
||||
if ( dwError != ERROR_SUCCESS )
|
||||
{
|
||||
MessageBoxFromWinError( dwError, _T("PopulateRomList") );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// 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_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
else
|
||||
{
|
||||
::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
|
||||
)
|
||||
{
|
||||
UNUSED_ALWAYS( hwndCtl );
|
||||
UNUSED_ALWAYS( codeNotify );
|
||||
|
||||
HWND hwnd = *this;
|
||||
CListData* pListData;
|
||||
|
||||
int nItem;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case IDC_PLAY:
|
||||
|
||||
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 );
|
||||
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 ];
|
||||
lstrcpy( pszPathName, m_rGlobalData.RomDir() );
|
||||
lstrcat( pszPathName, _T("\\") );
|
||||
lstrcat( pszPathName,
|
||||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// Play the game!
|
||||
|
||||
::EnableWindow( hwnd, FALSE );
|
||||
|
||||
(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 );
|
||||
|
||||
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 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem );
|
||||
|
||||
TCHAR pszPathName[ MAX_PATH + 1 ];
|
||||
lstrcpy( pszPathName, m_rGlobalData.RomDir() );
|
||||
lstrcat( pszPathName, _T("\\") );
|
||||
lstrcat( pszPathName,
|
||||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// Play the game!
|
||||
::EnableWindow( hwnd, FALSE );
|
||||
|
||||
(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;
|
||||
ClearList();
|
||||
::EndDialog( hwnd, IDCANCEL );
|
||||
return TRUE;
|
||||
break; // case IDC_EXIT
|
||||
|
||||
case IDC_CONFIG:
|
||||
{
|
||||
CPropertySheet ps( _T("Configure"), hwnd );
|
||||
{
|
||||
CPropertySheet ps( _T("Configure"), hwnd );
|
||||
|
||||
CConfigPage pgConfig( m_rGlobalData );
|
||||
ps.AddPage( &pgConfig );
|
||||
CConfigPage pgConfig( m_rGlobalData );
|
||||
ps.AddPage( &pgConfig );
|
||||
|
||||
(void)ps.DoModal();
|
||||
}
|
||||
return TRUE;
|
||||
(void)ps.DoModal();
|
||||
|
||||
return TRUE;
|
||||
break; // case IDC_CONFIG
|
||||
}
|
||||
|
||||
case IDC_ABOUT:
|
||||
{
|
||||
CPropertySheet ps(_T("Help"), hwnd);
|
||||
{
|
||||
CPropertySheet ps(_T("Help"), hwnd);
|
||||
|
||||
CHelpPage pgAbout;
|
||||
ps.AddPage(&pgAbout);
|
||||
CHelpPage pgAbout;
|
||||
ps.AddPage(&pgAbout);
|
||||
|
||||
CDocPage pgDoc;
|
||||
ps.AddPage(&pgDoc);
|
||||
CDocPage pgDoc;
|
||||
ps.AddPage(&pgDoc);
|
||||
|
||||
ps.DoModal();
|
||||
}
|
||||
return TRUE;
|
||||
ps.DoModal();
|
||||
return TRUE;
|
||||
break; // case IDC_ABOUT
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CMainDlg::OnNotify(
|
||||
int idCtrl,
|
||||
LPNMHDR pnmh
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnNotify( int idCtrl, LPNMHDR pnmh )
|
||||
{
|
||||
UNUSED_ALWAYS( idCtrl );
|
||||
UNUSED_ALWAYS( idCtrl );
|
||||
|
||||
switch ( pnmh->code )
|
||||
{
|
||||
switch ( pnmh->code )
|
||||
{
|
||||
case LVN_GETDISPINFO:
|
||||
OnGetDispInfo( (NMLVDISPINFO*)pnmh );
|
||||
return TRUE;
|
||||
OnGetDispInfo( (NMLVDISPINFO*)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case LVN_COLUMNCLICK:
|
||||
OnColumnClick( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
OnColumnClick( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case LVN_ITEMCHANGED:
|
||||
OnItemChanged( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
OnItemChanged( (LPNMLISTVIEW)pnmh );
|
||||
return TRUE;
|
||||
|
||||
case NM_DBLCLK:
|
||||
// send out an ok click to play
|
||||
::SendDlgItemMessage( *this, IDC_PLAY, BM_CLICK, 0, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
// send out an ok click to play
|
||||
::SendDlgItemMessage( *this, IDC_PLAY, BM_CLICK, 0, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// not handled
|
||||
// not handled
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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 )
|
||||
{
|
||||
COLORREF crOld = ::SetBkColor(hdc, clr);
|
||||
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
|
||||
::SetBkColor(hdc, crOld);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BOOL CMainDlg::OnEraseBkgnd( HDC hdc )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void ScreenToClient(
|
||||
HWND hwnd,
|
||||
LPRECT lpRect
|
||||
)
|
||||
{
|
||||
::ScreenToClient(hwnd, (LPPOINT)lpRect);
|
||||
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
|
||||
}
|
||||
RECT rcWindow;
|
||||
::GetWindowRect( *this, &rcWindow );
|
||||
::ScreenToClient( *this, &rcWindow );
|
||||
|
||||
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);
|
||||
}
|
||||
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
|
||||
|
||||
BOOL CMainDlg::OnEraseBkgnd(
|
||||
HDC hdc
|
||||
)
|
||||
{
|
||||
// don't do this in 256 color
|
||||
RECT rc;
|
||||
::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, rcWindow.right, BKGND_BITMAP_BOTTOM );
|
||||
|
||||
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
|
||||
long lWidth = rc.right - rc.left;
|
||||
long lHeight = rc.bottom - rc.top;
|
||||
|
||||
HDC hdcMem = CreateCompatibleDC(hdc);
|
||||
|
||||
HBITMAP hbmpTile = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_TILE) );
|
||||
|
||||
BITMAP bm;
|
||||
GetObject(hbmpTile, sizeof(bm), &bm);
|
||||
|
||||
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpTile);
|
||||
|
||||
for (long x = 0; x < lWidth; x += bm.bmWidth)
|
||||
{
|
||||
for (long y = 0; y < lHeight; y += bm.bmHeight)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RECT rcWindow;
|
||||
::GetWindowRect( *this, &rcWindow );
|
||||
::ScreenToClient( *this, &rcWindow );
|
||||
|
||||
FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) );
|
||||
|
||||
RECT rc;
|
||||
::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) );
|
||||
|
||||
BITMAP bm;
|
||||
GetObject(hbmpTile, sizeof(bm), &bm);
|
||||
|
||||
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpTile);
|
||||
|
||||
for (long x = 0; x < lWidth; x += bm.bmWidth)
|
||||
{
|
||||
for (long y = 0; y < lHeight; y += bm.bmHeight)
|
||||
{
|
||||
::BitBlt( hdc,
|
||||
::BitBlt( hdc,
|
||||
rc.left + x, rc.top + y,
|
||||
( (rc.left + x + bm.bmWidth) > rc.right ) ? rc.right-(rc.left+x) : bm.bmWidth,
|
||||
( (rc.top + y + bm.bmHeight) > rc.bottom ) ? rc.bottom-(rc.top+y) : bm.bmHeight,
|
||||
hdcMem,
|
||||
0, 0, SRCCOPY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject(hdcMem, hbmpOld);
|
||||
SelectObject(hdcMem, hbmpOld);
|
||||
DeleteObject(hbmpTile);
|
||||
DeleteDC(hdcMem);
|
||||
|
||||
DeleteObject(hbmpTile);
|
||||
|
||||
DeleteDC(hdcMem);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HBRUSH CMainDlg::OnCtlColorStatic(
|
||||
HDC hdcStatic,
|
||||
HWND hwndStatic
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
HBRUSH CMainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
|
||||
{
|
||||
// don't do this in 256 color
|
||||
// don't do this in 256 color
|
||||
|
||||
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE)
|
||||
return FALSE;
|
||||
|
||||
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON)
|
||||
return NULL;
|
||||
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
return (HBRUSH)GetStockObject(NULL_BRUSH);
|
||||
SetBkMode(hdcStatic, TRANSPARENT);
|
||||
|
||||
return (HBRUSH)GetStockObject(NULL_BRUSH);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
DWORD CMainDlg::PopulateRomList(
|
||||
void
|
||||
)
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DWORD CMainDlg::PopulateRomList( void )
|
||||
{
|
||||
TRACE("CMainDlg::PopulateRomList");
|
||||
|
||||
TRACE("CMainDlg::PopulateRomList");
|
||||
|
||||
DWORD dwRet;
|
||||
DWORD dwRet;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DWORD dwStartTick = ::GetTickCount();
|
||||
|
|
|
@ -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"
|
||||
|
@ -62,124 +25,97 @@ REVISIONS:
|
|||
|
||||
class CSingleInstance
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
CSingleInstance( LPCTSTR pszName )
|
||||
{
|
||||
::SetLastError( ERROR_SUCCESS );
|
||||
|
||||
m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
|
||||
|
||||
m_dwError = ::GetLastError();
|
||||
}
|
||||
{
|
||||
::SetLastError( ERROR_SUCCESS );
|
||||
m_hMutex = ::CreateMutex( NULL, TRUE, pszName );
|
||||
m_dwError = ::GetLastError();
|
||||
}
|
||||
|
||||
~CSingleInstance()
|
||||
{
|
||||
if ( m_hMutex != INVALID_HANDLE_VALUE &&
|
||||
m_dwError != ERROR_ALREADY_EXISTS )
|
||||
{
|
||||
VERIFY( ::ReleaseMutex( m_hMutex ) );
|
||||
VERIFY( ::CloseHandle( m_hMutex ) );
|
||||
}
|
||||
}
|
||||
{
|
||||
if ( m_hMutex != INVALID_HANDLE_VALUE && m_dwError != ERROR_ALREADY_EXISTS )
|
||||
{
|
||||
VERIFY( ::ReleaseMutex( m_hMutex ) );
|
||||
VERIFY( ::CloseHandle( m_hMutex ) );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL AlreadyExists( void ) const
|
||||
{
|
||||
return ( m_dwError == ERROR_ALREADY_EXISTS );
|
||||
}
|
||||
|
||||
private:
|
||||
{
|
||||
return ( m_dwError == ERROR_ALREADY_EXISTS );
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE m_hMutex;
|
||||
DWORD m_dwError;
|
||||
|
||||
CSingleInstance( const CSingleInstance& ); // no implementation
|
||||
void operator=( const CSingleInstance& ); // no implementation
|
||||
CSingleInstance( const CSingleInstance& ); // no implementation
|
||||
void operator=( const CSingleInstance& ); // no implementation
|
||||
};
|
||||
|
||||
// see debug.cpp
|
||||
|
||||
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 );
|
||||
UNUSED_ALWAYS( nCmdShow );
|
||||
UNUSED_ALWAYS( hPrevInstance );
|
||||
UNUSED_ALWAYS( lpCmdLine );
|
||||
UNUSED_ALWAYS( nCmdShow );
|
||||
|
||||
DWORD dwRet;
|
||||
DWORD dwRet;
|
||||
|
||||
(void)::DeleteFile(g_ctszDebugLog);
|
||||
(void)::DeleteFile(g_ctszDebugLog);
|
||||
|
||||
CSingleInstance mutex( _T("StellaXMutex") );
|
||||
if ( mutex.AlreadyExists() )
|
||||
CSingleInstance mutex( _T("StellaXMutex") );
|
||||
if ( mutex.AlreadyExists() )
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_ALREADYRUNNING );
|
||||
return 1;
|
||||
}
|
||||
|
||||
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 );
|
||||
if (!fOk)
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_BADARGUMENT );
|
||||
}
|
||||
else
|
||||
{
|
||||
LPCTSTR ctszPathName = globaldata.PathName();
|
||||
if (ctszPathName != NULL)
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_ALREADYRUNNING );
|
||||
return 1;
|
||||
}
|
||||
// a filename was given on the commandline, skip the UI
|
||||
CStellaXMain stellax;
|
||||
|
||||
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 );
|
||||
if (!fOk)
|
||||
{
|
||||
MessageBox( hInstance, NULL, IDS_BADARGUMENT );
|
||||
dwRet = stellax.Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
|
||||
else
|
||||
dwRet = stellax.PlayROM( GetDesktopWindow(), ctszPathName,
|
||||
_T("StellaX"), globaldata );
|
||||
}
|
||||
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"), // Dont knwo the friendly name
|
||||
globaldata );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// show the ui
|
||||
//
|
||||
|
||||
CMainDlg dlg( globaldata, hInstance );
|
||||
dlg.DoModal( NULL );
|
||||
}
|
||||
// show the ui
|
||||
CMainDlg dlg( globaldata, hInstance );
|
||||
dlg.DoModal( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
if ( hrCoInit == S_OK )
|
||||
{
|
||||
::CoUninitialize();
|
||||
}
|
||||
if ( hrCoInit == S_OK )
|
||||
::CoUninitialize();
|
||||
|
||||
return 0;
|
||||
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