- Fixed bug with missing stella.pro file

- Cleaned up Toolbar & Menubar
- Moved Play Button into Toolbar & Menubar
- Moved Options Button into Menubar
- Moved all contents of StellaXMain into CyberstellaView and subsequently
  removed the StellaXMain files from the project. This was done  in order
  to simplify the commando-chain for executing screenshots, pause/unpause
  as well as a future windowed/fullscreen switch.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@62 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
gunfight 2002-04-03 12:28:23 +00:00
parent dd36b9f23d
commit 5898941bf0
14 changed files with 361 additions and 495 deletions

View File

@ -21,8 +21,6 @@ static char THIS_FILE[] = __FILE__;
BEGIN_MESSAGE_MAP(CCyberstellaApp, CWinApp)
//{{AFX_MSG_MAP(CCyberstellaApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
@ -117,3 +115,9 @@ void CCyberstellaApp::OnAppAbout()
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp message handlers
void CCyberstellaApp::OnViewToolbar()
{
// TODO: Add your command handler code here
}

View File

@ -168,10 +168,6 @@ SOURCE=.\StellaConfig.cpp
# End Source File
# Begin Source File
SOURCE=.\StellaXMain.cxx
# End Source File
# Begin Source File
SOURCE=.\Timer.cxx
# End Source File
# End Group
@ -256,10 +252,6 @@ SOURCE=.\StellaConfig.h
# End Source File
# Begin Source File
SOURCE=.\StellaXMain.hxx
# End Source File
# Begin Source File
SOURCE=.\Timer.hxx
# End Source File
# End Group

View File

@ -34,8 +34,7 @@ public:
// Implementation
//{{AFX_MSG(CCyberstellaApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
afx_msg void OnViewToolbar();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -95,17 +95,8 @@ IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_NEW
BUTTON ID_FILE_OPEN
BUTTON ID_FILE_SAVE
SEPARATOR
BUTTON ID_EDIT_CUT
BUTTON ID_EDIT_COPY
BUTTON ID_EDIT_PASTE
SEPARATOR
BUTTON ID_FILE_PRINT
SEPARATOR
BUTTON ID_APP_ABOUT
BUTTON IDC_PLAY
END
@ -118,28 +109,18 @@ IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &As...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Play", IDC_PLAY
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
MENUITEM SEPARATOR
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "Configuration"
BEGIN
MENUITEM "&Cyberstella", IDC_CONFIG
END
POPUP "&Help"
BEGIN
MENUITEM "&About Cyberstella...", ID_APP_ABOUT
@ -175,7 +156,7 @@ END
// Dialog
//
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 211
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
@ -184,14 +165,9 @@ BEGIN
CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE |
WS_BORDER | WS_TABSTOP,7,19,395,143,WS_EX_STATICEDGE
PUSHBUTTON "&Play",IDC_PLAY,7,188,155,16
PUSHBUTTON "&Options",IDC_CONFIG,247,188,155,16
RTEXT "<status>",IDC_ROMCOUNT,322,7,80,8,SS_NOPREFIX
CONTROL "Static",IDC_ROMPATH,"Static",SS_LEFTNOWORDWRAP |
SS_NOPREFIX | WS_GROUP,57,7,254,8
CONTROL "",IDC_ROMNOTE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,93,167,309,8
LTEXT "Game notes (if available):",-1,7,167,80,8
END
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 390, 176
@ -223,7 +199,7 @@ END
IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 149
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
CAPTION "Cyberstella Configuration"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&ROM (.bin) file path:",-1,7,10,64,8
@ -305,7 +281,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 402
TOPMARGIN, 7
BOTTOMMARGIN, 204
BOTTOMMARGIN, 162
END
IDD_ABOUTBOX, DIALOG

View File

@ -3,11 +3,14 @@
#include "pch.hxx"
#include "Cyberstella.h"
#include "MainFrm.h"
#include "CyberstellaDoc.h"
#include "CyberstellaView.h"
#include "StellaConfig.h"
#include "MD5.hxx"
#include "PropsSet.hxx"
#include "Console.hxx"
#include "SoundWin32.hxx"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -15,6 +18,21 @@
static char THIS_FILE[] = __FILE__;
#endif
//
// Undefining USE_FS will use the (untested) windowed mode
//
//#define USE_FS
#ifdef USE_FS
#include "DirectXFullScreen.hxx"
#else
#include "DirectXWindow.hxx"
#endif
#define FORCED_VIDEO_CX 640
#define FORCED_VIDEO_CY 480
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaView
@ -38,11 +56,14 @@ CCyberstellaView::CCyberstellaView()
//}}AFX_DATA_INIT
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
m_bIsPause = false;
m_pPropertiesSet = NULL;
}
CCyberstellaView::~CCyberstellaView()
{
if(m_pGlobalData) delete m_pGlobalData;
if(m_pPropertiesSet) delete m_pPropertiesSet;
}
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
@ -71,33 +92,13 @@ void CCyberstellaView::OnInitialUpdate()
HWND hwnd = *this;
dwRet = m_stella.Initialize();
dwRet = Initialize();
if ( dwRet != ERROR_SUCCESS )
{
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
AfxGetMainWnd()->SendMessage(WM_CLOSE, 0, 0);
}
//
// 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 );
}
const int nMaxString = 256;
TCHAR psz[nMaxString + 1];
@ -378,7 +379,7 @@ DWORD CCyberstellaView::ReadRomData(CListData* pListData) const
// search through the properties set for this MD5
PropertiesSet& propertiesSet = m_stella.GetPropertiesSet();
PropertiesSet& propertiesSet = GetPropertiesSet();
Properties properties;
propertiesSet.getMD5(md5, properties);
@ -446,7 +447,7 @@ void CCyberstellaView::OnPlay()
::EnableWindow(*this, FALSE );
(void)m_stella.PlayROM( *this,
PlayROM( *this,
pszPathName,
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
m_pGlobalData);
@ -456,4 +457,303 @@ void CCyberstellaView::OnPlay()
// Set focus back to the rom list
::SetFocus(m_List);
}
// Toggles pausing of the emulator
void CCyberstellaView::togglePause()
{
m_bIsPause = !m_bIsPause;
//TODO: theConsole->mediaSource().pause(m_bIsPause);
}
DWORD CCyberstellaView::Initialize()
{
TRACE( "CStellaXMain::SetupProperties" );
// Create a properties set for us to use
if ( m_pPropertiesSet )
{
return ERROR_SUCCESS;
}
m_pPropertiesSet = new PropertiesSet();
if ( m_pPropertiesSet == NULL )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
// Try to load the file stella.pro file
string filename( "stella.pro" );
// See if we can open the file and load properties from it
ifstream stream(filename.c_str());
if(stream)
{
// File was opened so load properties from it
stream.close();
m_pPropertiesSet->load(filename, &Console::defaultProperties());
}
else
{
m_pPropertiesSet->load("", &Console::defaultProperties());
}
return ERROR_SUCCESS;
}
HRESULT CCyberstellaView::PlayROM(HWND hwnd,
LPCTSTR pszPathName,
LPCTSTR pszFriendlyName,
CGlobalData* rGlobalData)
{
UNUSED_ALWAYS( hwnd );
HRESULT hr = S_OK;
TRACE("CStellaXMain::PlayROM");
//
// show wait cursor while loading
//
HCURSOR hcur = ::SetCursor( ::LoadCursor( NULL, IDC_WAIT ) );
//
// setup objects used here
//
BYTE* pImage = NULL;
LPCTSTR pszFileName = NULL;
#ifdef USE_FS
CDirectXFullScreen* pwnd = NULL;
#else
CDirectXWindow* pwnd = NULL;
#endif
Console* pConsole = NULL;
Sound* pSound = NULL;
Event rEvent;
//
// Load the rom file
//
HANDLE hFile;
DWORD dwImageSize;
hFile = ::CreateFile( pszPathName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL );
if (hFile == INVALID_HANDLE_VALUE)
{
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE );
DWORD dwLastError = ::GetLastError();
TCHAR pszCurrentDirectory[ MAX_PATH + 1 ];
::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory );
// ::MessageBoxFromGetLastError( pszPathName );
TCHAR pszFormat[ 1024 ];
LoadString( hInstance,
IDS_ROM_LOAD_FAILED,
pszFormat, 1023 );
LPTSTR pszLastError = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszLastError,
0,
NULL);
TCHAR pszError[ 1024 ];
wsprintf( pszError,
pszFormat,
pszCurrentDirectory,
pszPathName,
dwLastError,
pszLastError );
::MessageBox( hwnd,
pszError,
_T("Error"),
MB_OK | MB_ICONEXCLAMATION );
::LocalFree( pszLastError );
hr = HRESULT_FROM_WIN32( ::GetLastError() );
goto exit;
}
dwImageSize = ::GetFileSize( hFile, NULL );
pImage = new BYTE[dwImageSize + 1];
if ( pImage == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
DWORD dwActualSize;
if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) )
{
VERIFY( ::CloseHandle( hFile ) );
MessageBoxFromGetLastError( pszPathName );
hr = HRESULT_FROM_WIN32( ::GetLastError() );
goto exit;
}
VERIFY( ::CloseHandle(hFile) );
//
// Create Sound driver object
// (Will be initialized once we have a window handle below)
//
if (rGlobalData->bNoSound)
{
TRACE("Creating Sound driver");
pSound = new Sound;
}
else
{
TRACE("Creating SoundWin32 driver");
pSound = new SoundWin32;
}
if ( pSound == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
//
// get just the filename
//
pszFileName = _tcsrchr( pszPathName, _T('\\') );
if ( pszFileName )
{
++pszFileName;
}
else
{
pszFileName = pszPathName;
}
try
{
// If this throws an exception, then it's probably a bad cartridge
pConsole = new Console( pImage,
dwActualSize,
pszFileName,
rEvent,
*m_pPropertiesSet,
*pSound );
if ( pConsole == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
}
catch (...)
{
::MessageBox(rGlobalData->instance,
NULL, IDS_CANTSTARTCONSOLE);
goto exit;
}
#ifdef USE_FS
pwnd = new CDirectXFullScreen( rGlobalData,
pConsole,
rEvent );
#else
pwnd = new CDirectXWindow( rGlobalData,
pConsole,
rEvent );
#endif
if ( pwnd == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
#ifdef USE_FS
if (rGlobalData->bAutoSelectVideoMode)
{
hr = pwnd->Initialize( );
}
else
{
//
// Initialize with 640 x 480
//
hr = pwnd->Initialize( FORCED_VIDEO_CX, FORCED_VIDEO_CY );
}
#else
hr = pwnd->Initialize( hwnd, pszFriendlyName );
#endif
if ( FAILED(hr) )
{
TRACE( "CWindow::Initialize failed, err = %X", hr );
goto exit;
}
if (!rGlobalData->bNoSound)
{
//
// 060499: Pass pwnd->GetHWND() in instead of hwnd as some systems
// will not play sound if this isn't set to the active window
//
SoundWin32* pSoundWin32 = static_cast<SoundWin32*>( pSound );
hr = pSoundWin32->Initialize( *pwnd );
if ( FAILED(hr) )
{
TRACE( "Sndwin32 Initialize failed, err = %X", hr );
goto exit;
}
}
// restore cursor
::SetCursor( hcur );
hcur = NULL;
::ShowWindow( hwnd, SW_HIDE );
(void)pwnd->Run();
::ShowWindow( hwnd, SW_SHOW );
exit:
if ( hcur )
{
::SetCursor( hcur );
}
delete pwnd;
delete pConsole;
delete pSound;
delete pImage;
return hr;
}

View File

@ -9,9 +9,9 @@
#pragma once
#endif // _MSC_VER > 1000
#include "StellaXMain.hxx"
#include "GlobalData.hxx"
#include "ListData.hxx"
#include "PropsSet.hxx"
class CCyberstellaView : public CFormView
{
@ -28,8 +28,6 @@ public:
// Attributes
public:
CCyberstellaDoc* GetDocument();
CStellaXMain m_stella;
HFONT m_hfontRomNote;
CGlobalData* m_pGlobalData;
// Operations
@ -64,10 +62,20 @@ protected:
DECLARE_MESSAGE_MAP()
private:
// methods
PropertiesSet& GetPropertiesSet() const {return *m_pPropertiesSet;}
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
DWORD PopulateRomList();
void ClearList();
void togglePause();
DWORD ReadRomData(CListData* pListData) const;
DWORD Initialize();
HRESULT PlayROM( HWND hwnd, LPCTSTR ctszPathName,
LPCTSTR pszFriendlyName,
CGlobalData* rGlobalData );
// members
PropertiesSet* m_pPropertiesSet;
bool m_bIsPause;
};
#ifndef _DEBUG // debug version in CyberstellaView.cpp

View File

@ -2,5 +2,5 @@
// StellaX
// Jeff Miller 05/12/2000
//
#include "pch.hxx"
#include "ListData.hxx"

View File

@ -8,7 +8,6 @@
#include "resource.h"
#include "pch.hxx"
#include "StellaXMain.hxx"
class CMainDlg;

View File

@ -98,4 +98,9 @@ void CMainFrame::Dump(CDumpContext& dc) const
CFrameWnd::Dump(dc);
}
void CMainFrame::setStatusText(CString text)
{
m_wndStatusBar.SetWindowText(text);
}
#endif //_DEBUG

View File

@ -31,6 +31,9 @@ public:
// Implementation
public:
virtual ~CMainFrame();
void setStatusText(CString text);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;

View File

@ -1,379 +0,0 @@
//
// StellaX
// Jeff Miller 05/13/2000
//
#include "pch.hxx"
#include "StellaXMain.hxx"
#include <iostream>
#include <strstream>
#include <fstream>
#include <string>
#include "bspf.hxx"
#include "Console.hxx"
#include "Event.hxx"
#include "MediaSrc.hxx"
#include "PropsSet.hxx"
#include "resource.h"
#include "GlobalData.hxx"
#include "SoundWin32.hxx"
//
// Undefining USE_FS will use the (untested) windowed mode
//
//#define USE_FS
#ifdef USE_FS
#include "DirectXFullScreen.hxx"
#else
#include "DirectXWindow.hxx"
#endif
#include "DirectInput.hxx"
#include "DirectDraw.hxx"
//
// CStellaXMain
//
// equivalent to main() in the DOS version of stella
//
#define FORCED_VIDEO_CX 640
#define FORCED_VIDEO_CY 480
#ifdef USE_MY_STELLAPRO
#include "misc\stellapro.h"
#endif
CStellaXMain::CStellaXMain(
) : \
m_pPropertiesSet( NULL )
{
TRACE( "CStellaXMain::CStellaXMain" );
}
CStellaXMain::~CStellaXMain(
)
{
TRACE( "CStellaXMain::~CStellaXMain" );
delete m_pPropertiesSet;
m_pPropertiesSet = NULL;
}
DWORD CStellaXMain::Initialize(
void
)
{
TRACE( "CStellaXMain::SetupProperties" );
// Create a properties set for us to use
if ( m_pPropertiesSet )
{
return ERROR_SUCCESS;
}
m_pPropertiesSet = new PropertiesSet();
if ( m_pPropertiesSet == NULL )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
// Try to load the file stella.pro file
string filename( "stella.pro" );
// See if we can open the file and load properties from it
ifstream stream(filename.c_str());
if(stream)
{
// File was opened so load properties from it
stream.close();
m_pPropertiesSet->load(filename, &Console::defaultProperties());
}
else
{
#ifdef USE_MY_STELLAPRO
int cPropSet = sizeof( g_propset ) / sizeof( g_propset[0] );
int iPropSet;
for ( iPropSet = 0; iPropSet < cPropSet; ++iPropSet )
{
Properties properties( &Console::defaultProperties() );
PROPSET::PROPS* pProps = g_propset[iPropSet].props;
while ( pProps->key != NULL )
{
properties.set( pProps->key, pProps->value );
++pProps;
}
m_pPropertiesSet->insert( properties );
}
#endif
}
return ERROR_SUCCESS;
}
HRESULT CStellaXMain::PlayROM(
HWND hwnd,
LPCTSTR pszPathName,
LPCTSTR pszFriendlyName,
CGlobalData* rGlobalData
)
{
UNUSED_ALWAYS( hwnd );
HRESULT hr = S_OK;
TRACE("CStellaXMain::PlayROM");
//
// show wait cursor while loading
//
HCURSOR hcur = ::SetCursor( ::LoadCursor( NULL, IDC_WAIT ) );
//
// setup objects used here
//
BYTE* pImage = NULL;
LPCTSTR pszFileName = NULL;
#ifdef USE_FS
CDirectXFullScreen* pwnd = NULL;
#else
CDirectXWindow* pwnd = NULL;
#endif
Console* pConsole = NULL;
Sound* pSound = NULL;
Event rEvent;
//
// Load the rom file
//
HANDLE hFile;
DWORD dwImageSize;
hFile = ::CreateFile( pszPathName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL );
if (hFile == INVALID_HANDLE_VALUE)
{
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE );
DWORD dwLastError = ::GetLastError();
TCHAR pszCurrentDirectory[ MAX_PATH + 1 ];
::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory );
// ::MessageBoxFromGetLastError( pszPathName );
TCHAR pszFormat[ 1024 ];
LoadString( hInstance,
IDS_ROM_LOAD_FAILED,
pszFormat, 1023 );
LPTSTR pszLastError = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszLastError,
0,
NULL);
TCHAR pszError[ 1024 ];
wsprintf( pszError,
pszFormat,
pszCurrentDirectory,
pszPathName,
dwLastError,
pszLastError );
::MessageBox( hwnd,
pszError,
_T("Error"),
MB_OK | MB_ICONEXCLAMATION );
::LocalFree( pszLastError );
hr = HRESULT_FROM_WIN32( ::GetLastError() );
goto exit;
}
dwImageSize = ::GetFileSize( hFile, NULL );
pImage = new BYTE[dwImageSize + 1];
if ( pImage == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
DWORD dwActualSize;
if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) )
{
VERIFY( ::CloseHandle( hFile ) );
MessageBoxFromGetLastError( pszPathName );
hr = HRESULT_FROM_WIN32( ::GetLastError() );
goto exit;
}
VERIFY( ::CloseHandle(hFile) );
//
// Create Sound driver object
// (Will be initialized once we have a window handle below)
//
if (rGlobalData->bNoSound)
{
TRACE("Creating Sound driver");
pSound = new Sound;
}
else
{
TRACE("Creating SoundWin32 driver");
pSound = new SoundWin32;
}
if ( pSound == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
//
// get just the filename
//
pszFileName = _tcsrchr( pszPathName, _T('\\') );
if ( pszFileName )
{
++pszFileName;
}
else
{
pszFileName = pszPathName;
}
try
{
// If this throws an exception, then it's probably a bad cartridge
pConsole = new Console( pImage,
dwActualSize,
pszFileName,
rEvent,
*m_pPropertiesSet,
*pSound );
if ( pConsole == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
}
catch (...)
{
MessageBox(rGlobalData->instance,
NULL, IDS_CANTSTARTCONSOLE);
goto exit;
}
#ifdef USE_FS
pwnd = new CDirectXFullScreen( rGlobalData,
pConsole,
rEvent );
#else
pwnd = new CDirectXWindow( rGlobalData,
pConsole,
rEvent );
#endif
if ( pwnd == NULL )
{
hr = E_OUTOFMEMORY;
goto exit;
}
#ifdef USE_FS
if (rGlobalData->bAutoSelectVideoMode)
{
hr = pwnd->Initialize( );
}
else
{
//
// Initialize with 640 x 480
//
hr = pwnd->Initialize( FORCED_VIDEO_CX, FORCED_VIDEO_CY );
}
#else
hr = pwnd->Initialize( hwnd, pszFriendlyName );
#endif
if ( FAILED(hr) )
{
TRACE( "CWindow::Initialize failed, err = %X", hr );
goto exit;
}
if (!rGlobalData->bNoSound)
{
//
// 060499: Pass pwnd->GetHWND() in instead of hwnd as some systems
// will not play sound if this isn't set to the active window
//
SoundWin32* pSoundWin32 = static_cast<SoundWin32*>( pSound );
hr = pSoundWin32->Initialize( *pwnd );
if ( FAILED(hr) )
{
TRACE( "Sndwin32 Initialize failed, err = %X", hr );
goto exit;
}
}
// restore cursor
::SetCursor( hcur );
hcur = NULL;
::ShowWindow( hwnd, SW_HIDE );
(void)pwnd->Run();
::ShowWindow( hwnd, SW_SHOW );
exit:
if ( hcur )
{
::SetCursor( hcur );
}
delete pwnd;
delete pConsole;
delete pSound;
delete pImage;
return hr;
}

View File

@ -1,41 +0,0 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#ifndef STELLAX_H
#define STELLAX_H
#pragma once
class PropertiesSet;
class CGlobalData;
class CStellaXMain
{
public:
CStellaXMain();
~CStellaXMain();
DWORD Initialize( void );
HRESULT PlayROM( HWND hwnd, LPCTSTR ctszPathName,
LPCTSTR pszFriendlyName,
CGlobalData* rGlobalData );
PropertiesSet& GetPropertiesSet() const;
private:
PropertiesSet* m_pPropertiesSet;
CStellaXMain( const CStellaXMain& ); // no implementation
void operator=( const CStellaXMain& ); // no implementation
};
inline PropertiesSet& CStellaXMain::GetPropertiesSet(
void
) const
{
return *m_pPropertiesSet;
}
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 358 B

View File

@ -45,13 +45,13 @@
#define IDC_WEB_JEFFMILL 1010
#define IDC_WEB_STELLA 1011
#define IDC_ROMPATH 1013
#define IDC_ROMNOTE 1014
#define IDC_CONFIG 1015
#define IDC_PADDLE 1017
#define IDC_SOUND 1018
#define IDC_JOYSTICK 1019
#define IDC_AUTO_SELECT_VIDEOMODE 1020
#define IDC_BROWSE 1021
#define ID_BUTTON32774 32774
// Next default values for new objects
//
@ -59,7 +59,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_COMMAND_VALUE 32775
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif