mirror of https://github.com/stella-emu/stella.git
Some more code cleanups on StellaX. StellaX now launches the Stella
executable when you select 'Play' in the GUI. Still todo are add more options to the config page, figure out why the 'Browse ROM Dir' button doesn't work, and have StellaX parse the stella.pro file (so you can see romname, manufacturer, notes, etc). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@294 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f3fd04d5c4
commit
3496d66495
|
@ -14,12 +14,11 @@
|
|||
// 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.1 2004-06-28 23:13:54 stephena Exp $
|
||||
// $Id: AboutPage.hxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef ABOUTPG_H
|
||||
#define ABOUTPG_H
|
||||
//FIXME#pragma once
|
||||
|
||||
#include "PropertySheet.hxx"
|
||||
#include "HyperLink.hxx"
|
||||
|
|
|
@ -6,34 +6,11 @@
|
|||
#include "pch.hxx"
|
||||
#include "BrowseForFolder.hxx"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Construction/Destruction
|
||||
//
|
||||
|
||||
#ifdef MFC
|
||||
CBrowseForFolder::CBrowseForFolder(
|
||||
const HWND hParent /*= NULL*/,
|
||||
const LPITEMIDLIST pidl /*= NULL*/,
|
||||
const int nTitleID /*= 0*/
|
||||
)
|
||||
{
|
||||
m_hwnd = NULL;
|
||||
SetOwner(hParent);
|
||||
SetRoot(pidl);
|
||||
SetTitle(nTitleID);
|
||||
m_bi.lpfn = BrowseCallbackProc;
|
||||
m_bi.lParam = reinterpret_cast<LPARAM>( this );
|
||||
m_bi.pszDisplayName = m_szSelected;
|
||||
}
|
||||
#endif
|
||||
|
||||
CBrowseForFolder::CBrowseForFolder(
|
||||
const HWND hParent,
|
||||
const LPITEMIDLIST pidl,
|
||||
|
@ -41,20 +18,18 @@ CBrowseForFolder::CBrowseForFolder(
|
|||
{
|
||||
m_hwnd = NULL;
|
||||
|
||||
SetOwner(hParent);
|
||||
myBrowseInfo.pidlRoot = pidl;
|
||||
myBrowseInfo.hwndOwner = NULL;
|
||||
myBrowseInfo.pszDisplayName = mySelected;
|
||||
myBrowseInfo.lpszTitle = "Open ROM Folder ";
|
||||
myBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS|BIF_RETURNFSANCESTORS;
|
||||
myBrowseInfo.lParam = reinterpret_cast<LPARAM>( this );
|
||||
|
||||
SetRoot(pidl);
|
||||
|
||||
SetTitle(strTitle);
|
||||
|
||||
m_bi.lpfn = BrowseCallbackProc;
|
||||
m_bi.lParam = reinterpret_cast<LPARAM>( this );
|
||||
m_bi.pszDisplayName = m_szSelected;
|
||||
// myBrowseInfo.lpfn = BrowseCallbackProc;
|
||||
}
|
||||
|
||||
CBrowseForFolder::~CBrowseForFolder()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -67,7 +42,7 @@ void CBrowseForFolder::SetOwner(const HWND hwndOwner)
|
|||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.hwndOwner = hwndOwner;
|
||||
myBrowseInfo.hwndOwner = hwndOwner;
|
||||
}
|
||||
|
||||
void CBrowseForFolder::SetRoot(const LPITEMIDLIST pidl)
|
||||
|
@ -75,12 +50,12 @@ void CBrowseForFolder::SetRoot(const LPITEMIDLIST pidl)
|
|||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.pidlRoot = pidl;
|
||||
myBrowseInfo.pidlRoot = pidl;
|
||||
}
|
||||
|
||||
LPCTSTR CBrowseForFolder::GetTitle() const
|
||||
{
|
||||
return m_bi.lpszTitle;
|
||||
return myBrowseInfo.lpszTitle;
|
||||
}
|
||||
|
||||
bool CBrowseForFolder::SetTitle(
|
||||
|
@ -100,40 +75,24 @@ bool CBrowseForFolder::SetTitle(
|
|||
return false;
|
||||
}
|
||||
|
||||
m_bi.lpszTitle = m_pchTitle.Get();
|
||||
myBrowseInfo.lpszTitle = m_pchTitle.Get();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MFC
|
||||
bool CBrowseForFolder::SetTitle(const int nTitle)
|
||||
{
|
||||
if (nTitle <= 0)
|
||||
return false;
|
||||
|
||||
CString strTitle;
|
||||
if(!strTitle.LoadString(static_cast(nTitle)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SetTitle(strTitle);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CBrowseForFolder::SetFlags(const UINT ulFlags)
|
||||
{
|
||||
if (m_hwnd != NULL)
|
||||
return;
|
||||
|
||||
m_bi.ulFlags = ulFlags;
|
||||
myBrowseInfo.ulFlags = ulFlags;
|
||||
}
|
||||
|
||||
LPCTSTR CBrowseForFolder::GetSelectedFolder(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return m_szSelected;
|
||||
return mySelected;
|
||||
}
|
||||
|
||||
bool CBrowseForFolder::SelectFolder()
|
||||
|
@ -141,13 +100,13 @@ bool CBrowseForFolder::SelectFolder()
|
|||
bool bRet = false;
|
||||
|
||||
LPITEMIDLIST pidl;
|
||||
if ((pidl = ::SHBrowseForFolder(&m_bi)) != NULL)
|
||||
if ((pidl = ::SHBrowseForFolder(&myBrowseInfo)) != NULL)
|
||||
{
|
||||
m_strPath.Set( _T("") );
|
||||
if (SUCCEEDED(::SHGetPathFromIDList(pidl, m_szSelected)))
|
||||
myPath.Set( _T("") );
|
||||
if (SUCCEEDED(::SHGetPathFromIDList(pidl, mySelected)))
|
||||
{
|
||||
bRet = true;
|
||||
m_strPath.Set( m_szSelected );
|
||||
myPath.Set( mySelected );
|
||||
}
|
||||
|
||||
LPMALLOC pMalloc;
|
||||
|
|
|
@ -6,12 +6,8 @@
|
|||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __SHELLBROWSER_H__
|
||||
#define __SHELLBROWSER_H__
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
#ifndef __BROWSE_FOR_FOLDER_
|
||||
#define __BROWSE_FOR_FOLDER_
|
||||
|
||||
#include <shlobj.h>
|
||||
|
||||
|
@ -23,12 +19,6 @@
|
|||
class CBrowseForFolder
|
||||
{
|
||||
public:
|
||||
#ifdef MFC
|
||||
CBrowseForFolder(const HWND hParent = NULL,
|
||||
const LPITEMIDLIST pidl = NULL,
|
||||
const int nTitleID = 0);
|
||||
#endif
|
||||
|
||||
CBrowseForFolder(const HWND hParent = NULL,
|
||||
const LPITEMIDLIST pidl = NULL,
|
||||
LPCTSTR strTitle = NULL );
|
||||
|
@ -56,9 +46,6 @@ public:
|
|||
//
|
||||
LPCTSTR GetTitle() const;
|
||||
bool SetTitle(LPCTSTR strTitle);
|
||||
#ifdef MFC
|
||||
bool SetTitle(const int nTitle);
|
||||
#endif
|
||||
|
||||
//
|
||||
// ulFlags = Value specifying the types of folders to be listed in the dialog box
|
||||
|
@ -156,20 +143,20 @@ private:
|
|||
|
||||
CSimpleString m_pchTitle;
|
||||
|
||||
BROWSEINFO m_bi;
|
||||
char m_szSelected[MAX_PATH];
|
||||
CSimpleString m_strPath;
|
||||
BROWSEINFO myBrowseInfo;
|
||||
char mySelected[MAX_PATH];
|
||||
CSimpleString myPath;
|
||||
HWND m_hwnd;
|
||||
};
|
||||
|
||||
inline UINT CBrowseForFolder::GetFlags() const
|
||||
{
|
||||
return m_bi.ulFlags;
|
||||
return myBrowseInfo.ulFlags;
|
||||
}
|
||||
|
||||
inline int CBrowseForFolder::GetImage() const
|
||||
{
|
||||
return m_bi.iImage;
|
||||
return myBrowseInfo.iImage;
|
||||
}
|
||||
|
||||
#endif // __SHELLBROWSER_H__
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// 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.1 2004-06-28 23:13:54 stephena Exp $
|
||||
// $Id: ConfigPage.cxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -155,9 +155,9 @@ BOOL CConfigPage::OnCommand( WORD wNotifyCode, WORD wID, HWND hwndCtl )
|
|||
if ( wID == IDC_BROWSE )
|
||||
{
|
||||
CBrowseForFolder bff( m_hwnd );
|
||||
bff.SetFlags( BIF_RETURNONLYFSDIRS );
|
||||
if ( bff.SelectFolder() )
|
||||
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
;
|
||||
// ::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// 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.1 2004-06-28 23:13:54 stephena Exp $
|
||||
// $Id: GlobalData.cxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -30,6 +30,7 @@ CGlobalData::CGlobalData( HINSTANCE hInstance )
|
|||
{
|
||||
myPathName[0] = _T('\0');
|
||||
mySettings = new SettingsWin32();
|
||||
mySettings->loadConfig();
|
||||
}
|
||||
|
||||
CGlobalData::~CGlobalData()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// 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.1 2004-06-28 23:13:54 stephena Exp $
|
||||
// $Id: MainDlg.cxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -176,14 +176,6 @@ BOOL CMainDlg::OnInitDialog( void )
|
|||
|
||||
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 );
|
||||
|
@ -309,17 +301,9 @@ BOOL CMainDlg::OnCommand( int id, HWND hwndCtl, UINT codeNotify )
|
|||
TCHAR pszPathName[ MAX_PATH + 1 ];
|
||||
lstrcpy( pszPathName, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPathName, _T("\\") );
|
||||
lstrcat( pszPathName,
|
||||
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
lstrcat( pszPathName, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// Play the game!
|
||||
::EnableWindow( hwnd, FALSE );
|
||||
|
||||
(void)m_stella.PlayROM( hwnd, pszPathName,
|
||||
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
|
||||
myGlobalData );
|
||||
|
||||
::EnableWindow( hwnd, TRUE );
|
||||
(void)m_stella.PlayROM( pszPathName, myGlobalData );
|
||||
|
||||
// Set focus back to the rom list
|
||||
::SetFocus( m_hwndList );
|
||||
|
@ -474,147 +458,103 @@ HBRUSH CMainDlg::OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic )
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DWORD CMainDlg::PopulateRomList( void )
|
||||
{
|
||||
TRACE("CMainDlg::PopulateRomList");
|
||||
|
||||
DWORD dwRet;
|
||||
ClearList();
|
||||
|
||||
#ifdef _DEBUG
|
||||
DWORD dwStartTick = ::GetTickCount();
|
||||
#endif
|
||||
// REVIEW: Support .zip files?
|
||||
TCHAR pszPath[ MAX_PATH ];
|
||||
|
||||
ClearList();
|
||||
lstrcpy( pszPath, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPath, _T("\\*.bin") );
|
||||
|
||||
// REVIEW: Support .zip files?
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile( pszPath, &ffd );
|
||||
|
||||
TCHAR pszPath[ MAX_PATH ];
|
||||
ListView_SetItemCount( m_hwndList, 100 );
|
||||
|
||||
lstrcpy( pszPath, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPath, _T("\\*.bin") );
|
||||
int iItem = 0;
|
||||
BOOL fDone = (hFind == INVALID_HANDLE_VALUE);
|
||||
while(!fDone)
|
||||
{
|
||||
// File metadata will be read in ReadRomData()
|
||||
CListData* pListData = new CListData;
|
||||
if( pListData == NULL )
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile( pszPath, &ffd );
|
||||
dwRet = pListData->Initialize();
|
||||
if( dwRet != ERROR_SUCCESS )
|
||||
return dwRet;
|
||||
|
||||
ListView_SetItemCount( m_hwndList, 100 );
|
||||
if ( !pListData->m_strFileName.Set( ffd.cFileName ) )
|
||||
return FALSE;
|
||||
|
||||
int iItem = 0;
|
||||
LV_ITEM lvi;
|
||||
lvi.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
lvi.iItem = iItem++;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = LPSTR_TEXTCALLBACK;
|
||||
lvi.lParam = (LPARAM)pListData;
|
||||
int nItem = ListView_InsertItem( m_hwndList, &lvi );
|
||||
|
||||
BOOL fDone = (hFind == INVALID_HANDLE_VALUE);
|
||||
while (!fDone)
|
||||
{
|
||||
//
|
||||
// File metadata will be read in ReadRomData()
|
||||
//
|
||||
ASSERT( nItem != -1 );
|
||||
|
||||
CListData* pListData = new CListData;
|
||||
if( pListData == NULL )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::FILENAME_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
ListView_SetItemText(m_hwndList, nItem,
|
||||
CListData::MANUFACTURER_COLUMN, LPSTR_TEXTCALLBACK);
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::RARITY_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
|
||||
dwRet = pListData->Initialize();
|
||||
if ( dwRet != ERROR_SUCCESS )
|
||||
{
|
||||
return dwRet;
|
||||
}
|
||||
// go to the next rom file
|
||||
fDone = !FindNextFile(hFind, &ffd);
|
||||
}
|
||||
|
||||
if ( ! pListData->m_strFileName.Set( ffd.cFileName ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if( hFind != INVALID_HANDLE_VALUE )
|
||||
VERIFY( ::FindClose( hFind ) );
|
||||
|
||||
LV_ITEM lvi;
|
||||
|
||||
lvi.mask = LVIF_TEXT | LVIF_PARAM;
|
||||
lvi.iItem = iItem++;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = LPSTR_TEXTCALLBACK;
|
||||
lvi.lParam = (LPARAM)pListData;
|
||||
int nItem = ListView_InsertItem( m_hwndList, &lvi );
|
||||
|
||||
ASSERT( nItem != -1 );
|
||||
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::FILENAME_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
ListView_SetItemText(m_hwndList, nItem,
|
||||
CListData::MANUFACTURER_COLUMN, LPSTR_TEXTCALLBACK);
|
||||
ListView_SetItemText( m_hwndList, nItem,
|
||||
CListData::RARITY_COLUMN, LPSTR_TEXTCALLBACK );
|
||||
|
||||
// go to the next rom file
|
||||
|
||||
fDone = !FindNextFile(hFind, &ffd);
|
||||
}
|
||||
|
||||
if ( hFind != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
VERIFY( ::FindClose( hFind ) );
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
TRACE("\tElapsed ticks for PopulateRomList = %ld", ::GetTickCount()-dwStartTick);
|
||||
#endif
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD CMainDlg::ReadRomData(
|
||||
CListData* pListData
|
||||
) const
|
||||
DWORD CMainDlg::ReadRomData(CListData* pListData) const
|
||||
{
|
||||
// Add stella binary output for stella.pro info
|
||||
// There should be no parsing of stella.pro in this application
|
||||
// FIXME
|
||||
/*
|
||||
|
||||
// TODO: Move this method to ListData class (?)
|
||||
// TODO: Move this method to ListData class (?)
|
||||
if( pListData == NULL )
|
||||
{
|
||||
ASSERT( FALSE );
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
if ( pListData == NULL )
|
||||
{
|
||||
ASSERT( FALSE );
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
// attempt to read the rom file
|
||||
TCHAR pszPath[MAX_PATH + 1];
|
||||
lstrcpy( pszPath, myGlobalData.settings().getString("romdir").c_str() );
|
||||
lstrcat( pszPath, _T("\\") );
|
||||
lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
// attempt to read the rom file
|
||||
HANDLE hFile;
|
||||
hFile = CreateFile( pszPath,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL );
|
||||
if(hFile == INVALID_HANDLE_VALUE)
|
||||
return GetLastError();
|
||||
|
||||
TCHAR pszPath[MAX_PATH + 1];
|
||||
|
||||
lstrcpy( pszPath, myGlobalData.RomDir() );
|
||||
lstrcat( pszPath, _T("\\") );
|
||||
lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
|
||||
|
||||
HANDLE hFile;
|
||||
DWORD dwFileSize = ::GetFileSize( hFile, NULL );
|
||||
BYTE* pImage = new BYTE[dwFileSize];
|
||||
if( pImage == NULL )
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
hFile = CreateFile( pszPath,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL );
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
DWORD dwFileSize = ::GetFileSize( hFile, NULL );
|
||||
|
||||
BYTE* pImage = new BYTE[dwFileSize];
|
||||
if ( pImage == NULL )
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
DWORD dwRead;
|
||||
|
||||
if ( ::ReadFile( hFile, pImage, dwFileSize, &dwRead, NULL ) )
|
||||
{
|
||||
// Read the file, now check the md5
|
||||
DWORD dwRead;
|
||||
if( ::ReadFile( hFile, pImage, dwFileSize, &dwRead, NULL ) )
|
||||
{
|
||||
// Read the file, now check the md5
|
||||
std::string md5 = MD5( pImage, dwFileSize );
|
||||
|
||||
std::string md5 = MD5( pImage, dwFileSize );
|
||||
|
||||
// search through the properties set for this MD5
|
||||
|
||||
PropertiesSet& propertiesSet = m_stella.GetPropertiesSet();
|
||||
// search through the properties set for this MD5
|
||||
PropertiesSet& propertiesSet = m_stella.GetPropertiesSet();
|
||||
|
||||
uInt32 setSize = propertiesSet.size();
|
||||
|
||||
|
@ -729,34 +669,22 @@ void CMainDlg::OnItemChanged(
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
// LPSTR_TEXTCALLBACK message handlers
|
||||
|
||||
void CMainDlg::OnGetDispInfo(
|
||||
NMLVDISPINFO* pnmv
|
||||
)
|
||||
void CMainDlg::OnGetDispInfo(NMLVDISPINFO* pnmv)
|
||||
{
|
||||
// Provide the item or subitem's text, if requested.
|
||||
// Provide the item or subitem's text, if requested.
|
||||
if( !(pnmv->item.mask & LVIF_TEXT ) )
|
||||
return;
|
||||
|
||||
if ( ! (pnmv->item.mask & LVIF_TEXT ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
CListData* pListData = (CListData*)
|
||||
ListView_GetItemData( pnmv->hdr.hwndFrom, pnmv->item.iItem );
|
||||
ASSERT( pListData );
|
||||
if( pListData == NULL )
|
||||
return;
|
||||
|
||||
CListData* pListData = (CListData*)ListView_GetItemData(
|
||||
pnmv->hdr.hwndFrom,
|
||||
pnmv->item.iItem );
|
||||
ASSERT( pListData );
|
||||
if ( pListData == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( !pListData->IsPopulated() )
|
||||
ReadRomData( pListData );
|
||||
|
||||
if ( ! pListData->IsPopulated() )
|
||||
{
|
||||
ReadRomData( pListData );
|
||||
}
|
||||
|
||||
pnmv->item.pszText = const_cast<LPTSTR>( pListData->GetTextForColumn(pnmv->item.iSubItem) );
|
||||
// ASSERT( pnmv->item.pszText );
|
||||
pnmv->item.pszText = const_cast<LPTSTR>( pListData->GetTextForColumn(pnmv->item.iSubItem) );
|
||||
}
|
||||
|
||||
int CALLBACK CMainDlg::ListViewCompareFunc(
|
||||
|
|
Binary file not shown.
|
@ -80,7 +80,7 @@ BEGIN
|
|||
VALUE "FileDescription", "StellaX"
|
||||
VALUE "FileVersion", "1, 4, 0, 0"
|
||||
VALUE "InternalName", "StellaX"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2004 Jeff Miller, Copyright (C) 2004 Stephen Anthony"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2000 Jeff Miller, Copyright (C) 2004 Stephen Anthony"
|
||||
VALUE "LegalTrademarks", "n/a"
|
||||
VALUE "OriginalFilename", "StellaX.exe"
|
||||
VALUE "PrivateBuild", "n/a"
|
||||
|
@ -134,17 +134,6 @@ BEGIN
|
|||
LTEXT "Game notes (if available):",-1,7,205,98,8
|
||||
END
|
||||
|
||||
IDD_DOC_PAGE DIALOG 0, 0, 390, 196
|
||||
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Documentation"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "To view the online documentation, you need to first install Adobe Acrobat Reader 4.0 software. Once you have done this, return to this page and you will be able to read the documentation.",
|
||||
IDC_INSTRUCTIONS,7,7,376,21,NOT WS_VISIBLE
|
||||
LTEXT "Click here to download the Adobe Acrobat Reader software",
|
||||
IDC_ADOBE,7,35,376,10,SS_NOTIFY | NOT WS_VISIBLE
|
||||
END
|
||||
|
||||
IDD_ABOUT_PAGE DIALOGEX 0, 0, 298, 136
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Information"
|
||||
|
@ -220,14 +209,6 @@ BEGIN
|
|||
BOTTOMMARGIN, 242
|
||||
END
|
||||
|
||||
IDD_DOC_PAGE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 383
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 189
|
||||
END
|
||||
|
||||
IDD_ABOUT_PAGE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
|
|
|
@ -129,9 +129,6 @@
|
|||
<File
|
||||
RelativePath=".\debug.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileDialog.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GlobalData.cxx">
|
||||
</File>
|
||||
|
@ -191,9 +188,6 @@
|
|||
<File
|
||||
RelativePath=".\debug.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileDialog.hxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GlobalData.hxx">
|
||||
</File>
|
||||
|
|
|
@ -1,183 +1,62 @@
|
|||
//
|
||||
// StellaX
|
||||
// Jeff Miller 05/13/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: StellaXMain.cxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <iostream>
|
||||
#include <strstream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "resource.h"
|
||||
#include "GlobalData.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "pch.hxx"
|
||||
#include "StellaXMain.hxx"
|
||||
|
||||
//
|
||||
// CStellaXMain
|
||||
//
|
||||
// equivalent to main() in the DOS version of stella
|
||||
//
|
||||
|
||||
|
||||
CStellaXMain::CStellaXMain(
|
||||
) : \
|
||||
m_pPropertiesSet( NULL )
|
||||
CStellaXMain::CStellaXMain()
|
||||
{
|
||||
TRACE( "CStellaXMain::CStellaXMain" );
|
||||
}
|
||||
|
||||
CStellaXMain::~CStellaXMain(
|
||||
)
|
||||
CStellaXMain::~CStellaXMain()
|
||||
{
|
||||
TRACE( "CStellaXMain::~CStellaXMain" );
|
||||
}
|
||||
|
||||
DWORD CStellaXMain::Initialize(
|
||||
void
|
||||
)
|
||||
void CStellaXMain::PlayROM( LPCTSTR filename, CGlobalData& globaldata )
|
||||
{
|
||||
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;
|
||||
|
||||
//
|
||||
// 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) );
|
||||
|
||||
//
|
||||
// get just the filename
|
||||
//
|
||||
|
||||
pszFileName = _tcsrchr( pszPathName, _T('\\') );
|
||||
if ( pszFileName )
|
||||
{
|
||||
++pszFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
pszFileName = pszPathName;
|
||||
}
|
||||
|
||||
// restore cursor
|
||||
|
||||
::SetCursor( hcur );
|
||||
hcur = NULL;
|
||||
|
||||
::ShowWindow( hwnd, SW_HIDE );
|
||||
|
||||
// launch game here
|
||||
|
||||
::ShowWindow( hwnd, SW_SHOW );
|
||||
|
||||
exit:
|
||||
|
||||
if ( hcur )
|
||||
{
|
||||
::SetCursor( hcur );
|
||||
}
|
||||
|
||||
return hr;
|
||||
string rom = filename;
|
||||
|
||||
// Make sure the specfied ROM exists
|
||||
if(!globaldata.settings().fileExists(filename))
|
||||
{
|
||||
ostringstream out;
|
||||
out << "\"" << rom << "\" doesn't exist";
|
||||
|
||||
MessageBox( NULL, out.str().c_str(), "Unknown ROM", MB_ICONEXCLAMATION|MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
// Assume that the ROM file does exist, attempt to run external Stella
|
||||
// Since all settings are saved to the stella.ini file, we don't need
|
||||
// to pass any arguments here ...
|
||||
ShellExecute(NULL, "open", "stella.exe", rom.c_str(), NULL, 0);
|
||||
}
|
||||
|
|
|
@ -1,41 +1,38 @@
|
|||
//
|
||||
// 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: StellaXMain.hxx,v 1.2 2004-07-04 20:16:03 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef STELLAX_H
|
||||
#define STELLAX_H
|
||||
#pragma once
|
||||
|
||||
class PropertiesSet;
|
||||
class CGlobalData;
|
||||
|
||||
class CStellaXMain
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
CStellaXMain();
|
||||
~CStellaXMain();
|
||||
|
||||
DWORD Initialize( void );
|
||||
void PlayROM( LPCTSTR filename, CGlobalData& globaldata );
|
||||
|
||||
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
|
||||
private:
|
||||
CStellaXMain( const CStellaXMain& ); // no implementation
|
||||
void operator=( const CStellaXMain& ); // no implementation
|
||||
};
|
||||
|
||||
inline PropertiesSet& CStellaXMain::GetPropertiesSet(
|
||||
void
|
||||
) const
|
||||
{
|
||||
return *m_pPropertiesSet;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define IDD_ABOUT 103
|
||||
#define IDD_MAIN 104
|
||||
#define IDD_ABOUT_PAGE 106
|
||||
#define IDD_DOC_PAGE 107
|
||||
#define IDD_CONFIG_PAGE 108
|
||||
#define IDS_ALREADYRUNNING 200
|
||||
#define IDS_BADARGUMENT 201
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue