Initial import of Cyberstella project.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@61 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
gunfight 2002-04-02 09:51:03 +00:00
parent 46f5aaafd9
commit dd36b9f23d
50 changed files with 9769 additions and 0 deletions

View File

@ -0,0 +1,68 @@
// AboutDlg.cpp : implementation file
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// AboutDlg dialog
AboutDlg::AboutDlg(CWnd* pParent /*=NULL*/)
: CDialog(AboutDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(AboutDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void AboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(AboutDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(AboutDlg, CDialog)
//{{AFX_MSG_MAP(AboutDlg)
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// AboutDlg message handlers
void AboutDlg::OnContinue()
{
EndDialog(1);
}
BOOL AboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_hlMail_JSM.SubclassDlgItem(IDC_EMAIL_JEFFMILL, this);
m_hlMail_JSM.SetURL( _T("mailto:miller@zipcon.net?Subject=StellaX") );
m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_JEFFMILL, this);
m_hlWWW_JSM.SetURL( _T("http://www.emuunlim.com/stellax/") );
m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this);
m_hlMail_Stella.SetURL( _T("mailto:stella@csc.ncsu.edu") );
m_hlWWW_Stella.SubclassDlgItem(IDC_WEB_STELLA, this);
m_hlWWW_Stella.SetURL( _T("http://stella.atari.org/") );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View File

@ -0,0 +1,56 @@
#if !defined(AFX_ABOUTDLG_H__1E4CE741_3D76_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_ABOUTDLG_H__1E4CE741_3D76_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AboutDlg.h : header file
//
#include "HyperLink.h"
/////////////////////////////////////////////////////////////////////////////
// AboutDlg dialog
class AboutDlg : public CDialog
{
// Construction
public:
AboutDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(AboutDlg)
enum { IDD = IDD_ABOUTBOX };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(AboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(AboutDlg)
afx_msg void OnContinue();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CHyperLink m_hlMail_JSM;
CHyperLink m_hlWWW_JSM;
CHyperLink m_hlMail_Stella;
CHyperLink m_hlWWW_Stella;
CHyperLink m_hlWWW_Mame;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ABOUTDLG_H__1E4CE741_3D76_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1,570 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#define DIRECTSOUND_VERSION 0x700
#include "pch.hxx"
#include "AudioStream.hxx"
#include "Timer.hxx"
#include "SoundWin32.hxx"
//
// see "Streaming Wave Files with DirectSound" (Mark McCulley)
// http://msdn.microsoft.com/library/techart/msdn_streams3.htm
//
// Modified for infinite streaming by Jeff Miller 25-Apr-2000
//
// The following constants are the defaults for our streaming buffer operation.
// default buffer length in msec
const UINT AudioStream::DefBufferLength = 250;
// default buffer service interval in msec
const UINT AudioStream::DefBufferServiceInterval = 50;
AudioStreamServices::AudioStreamServices(
void
) :
m_pds( NULL ),
m_hwnd( NULL )
{
TRACE ("AudioStreamServices::AudioStreamServices");
}
AudioStreamServices::~AudioStreamServices(
void
)
{
TRACE ( "AudioStreamServices::~AudioStreamServices" );
if ( m_pds )
{
m_pds->Release();
m_pds = NULL;
}
}
BOOL AudioStreamServices::Initialize(
HWND hwnd
)
{
TRACE( "AudioStreamServices::Initialize" );
ASSERT( hwnd != NULL );
HRESULT hr;
BOOL fRtn = TRUE;
if ( m_pds != NULL )
{
return TRUE;
}
if ( hwnd == NULL )
{
// Error, invalid hwnd
TRACE ( "ERROR: Invalid hwnd, unable to initialize services" );
return FALSE;
}
m_hwnd = hwnd;
// Create DirectSound object
hr = ::CoCreateInstance( CLSID_DirectSound,
NULL,
CLSCTX_SERVER,
IID_IDirectSound,
(void**)&m_pds );
if ( FAILED(hr) )
{
TRACE( "CCI IDirectSound failed" );
return FALSE;
}
hr = m_pds->Initialize( NULL );
if ( FAILED(hr) )
{
TRACE( "IDS::Initialize failed" );
m_pds->Release();
m_pds = NULL;
return FALSE;
}
// Set cooperative level for DirectSound. Normal means our
// sounds will be silenced when our window loses input focus.
if ( m_pds->SetCooperativeLevel( m_hwnd, DSSCL_NORMAL ) == DS_OK )
{
// Any additional initialization goes here
}
else
{
// Error
TRACE ("ERROR: Unable to set cooperative level\n\r");
m_pds->Release();
m_pds = NULL;
fRtn = FALSE;
}
return fRtn;
}
//
// AudioStream class implementation
//
////////////////////////////////////////////////////////////
AudioStream::AudioStream(
void
)
{
TRACE( "AudioStream::AudioStream" );
// Initialize data members
m_pass = NULL;
m_pwavefile = NULL;
m_pdsb = NULL;
m_ptimer = NULL;
m_fPlaying = m_fCued = FALSE;
m_lInService = FALSE;
m_dwWriteCursor = 0;
m_nBufLength = DefBufferLength;
m_cbBufSize = 0;
m_nBufService = DefBufferServiceInterval;
m_nTimeStarted = 0;
m_nTimeElapsed = 0;
m_pbTempData = NULL;
}
AudioStream::~AudioStream(
void
)
{
TRACE( "AudioStream::~AudioStream" );
Destroy();
}
BOOL AudioStream::Create(
AudioStreamServices* pass
)
{
BOOL fRtn = TRUE; // assume TRUE
ASSERT( pass );
TRACE( "AudioStream::Create" );
// pass points to AudioStreamServices object
m_pass = pass;
if ( m_pass )
{
// Create a new WaveFile object
if ( m_pwavefile = new WaveFile )
{
// Open given file
if ( m_pwavefile->Open( ) )
{
// Calculate sound buffer size in bytes
// Buffer size is average data rate times length of buffer
// No need for buffer to be larger than wave data though
m_cbBufSize = (m_pwavefile->GetAvgDataRate () * m_nBufLength) / 1000;
m_pbTempData = new BYTE[ m_cbBufSize ];
if ( m_pbTempData == NULL )
{
delete m_pwavefile;
return FALSE;
}
TRACE1( "average data rate = %d", m_pwavefile->GetAvgDataRate () );
TRACE1( "m_cbBufSize = %d", m_cbBufSize );
// Create sound buffer
HRESULT hr;
memset (&m_dsbd, 0, sizeof (DSBUFFERDESC));
m_dsbd.dwSize = sizeof (DSBUFFERDESC);
m_dsbd.dwBufferBytes = m_cbBufSize;
m_dsbd.lpwfxFormat = m_pwavefile->GetWaveFormatEx();
hr = m_pass->GetPDS()->CreateSoundBuffer( &m_dsbd, &m_pdsb, NULL );
if (hr == DS_OK)
{
// Cue for playback
Cue();
}
else
{
// Error, unable to create DirectSound buffer
TRACE ("Error, unable to create DirectSound buffer\n\r");
if (hr == DSERR_BADFORMAT)
{
TRACE (" Bad format (probably ADPCM)\n\r");
}
fRtn = FALSE;
}
}
else
{
// Error opening file
delete m_pwavefile;
m_pwavefile = NULL;
fRtn = FALSE;
}
}
else
{
// Error, unable to create WaveFile object
fRtn = FALSE;
}
}
else
{
// Error, passed invalid parms
fRtn = FALSE;
}
return fRtn;
}
// Destroy
BOOL AudioStream::Destroy(
void
)
{
BOOL fRtn = TRUE;
TRACE ("AudioStream::Destroy");
// Stop playback
Stop();
// Release DirectSound buffer
if (m_pdsb)
{
m_pdsb->Release();
m_pdsb = NULL;
}
// Delete WaveFile object
delete m_pwavefile;
m_pwavefile = NULL;
delete[] m_pbTempData;
m_pbTempData = NULL;
return fRtn;
}
// WriteWaveData
//
// Writes wave data to sound buffer. This is a helper method used by Create and
// ServiceBuffer; it's not exposed to users of the AudioStream class.
BOOL AudioStream::WriteWaveData(
DWORD cbWriteBytes
)
{
HRESULT hr;
LPVOID pvAudioPtr1 = NULL;
DWORD cbAudioBytes1 = 0;
LPVOID pvAudioPtr2 = NULL;
DWORD cbAudioBytes2 = 0;
BOOL fRtn = TRUE;
// Lock the sound buffer
hr = m_pdsb->Lock( m_dwWriteCursor,
cbWriteBytes,
&pvAudioPtr1, &cbAudioBytes1,
&pvAudioPtr2, &cbAudioBytes2,
0 );
if ( hr == DS_OK )
{
// Write data to sound buffer. Because the sound buffer is circular, we may have to
// do two write operations if locked portion of buffer wraps around to start of buffer.
ASSERT ( pvAudioPtr1 != NULL );
m_pwavefile->Read( m_pbTempData, cbWriteBytes );
memcpy( pvAudioPtr1, m_pbTempData, cbAudioBytes1 );
memcpy( pvAudioPtr2, m_pbTempData + cbAudioBytes1, cbAudioBytes2 );
// Update our buffer offset and unlock sound buffer
m_dwWriteCursor = ( m_dwWriteCursor + cbAudioBytes1 + cbAudioBytes2 ) % m_cbBufSize;
m_pdsb->Unlock( pvAudioPtr1, cbAudioBytes1,
pvAudioPtr2, cbAudioBytes2 );
}
else
{
// Error locking sound buffer
TRACE("Error, unable to lock sound buffer" );
fRtn = FALSE;
}
return fRtn;
}
// GetMaxWriteSize
//
// Helper function to calculate max size of sound buffer write operation, i.e. how much
// free space there is in buffer.
DWORD AudioStream::GetMaxWriteSize(
void
)
{
DWORD dwCurrentPlayCursor;
DWORD dwCurrentWriteCursor;
DWORD dwMaxSize;
// Get current play position
if ( m_pdsb->GetCurrentPosition( &dwCurrentPlayCursor,
&dwCurrentWriteCursor) == DS_OK)
{
if ( m_dwWriteCursor <= dwCurrentPlayCursor )
{
// Our write position trails play cursor
dwMaxSize = dwCurrentPlayCursor - m_dwWriteCursor;
}
else // (m_dwWriteCursor > dwCurrentPlayCursor)
{
// Play cursor has wrapped
dwMaxSize = m_cbBufSize - m_dwWriteCursor + dwCurrentPlayCursor;
}
}
else
{
// GetCurrentPosition call failed
ASSERT (0);
dwMaxSize = 0;
}
return dwMaxSize;
}
// ServiceBuffer
//
// Routine to service buffer requests initiated by periodic timer.
//
// Returns TRUE if buffer serviced normally; otherwise returns FALSE.
BOOL AudioStream::ServiceBuffer(
void
)
{
BOOL fRtn = TRUE;
// Check for reentrance
if ( ::InterlockedExchange( &m_lInService, TRUE ) == FALSE )
{
// Not reentered, proceed normally
// Maintain elapsed time count
m_nTimeElapsed = timeGetTime () - m_nTimeStarted;
// All of sound not played yet, send more data to buffer
DWORD dwFreeSpace = GetMaxWriteSize ();
// Determine free space in sound buffer
if (dwFreeSpace)
{
// Enough wave data remains to fill free space in buffer
// Fill free space in buffer with wave data
if ( WriteWaveData( dwFreeSpace ) == FALSE )
{
// Error writing wave data
fRtn = FALSE;
ASSERT (0);
TRACE ("WriteWaveData failed\n\r");
}
}
else
{
// No free space in buffer for some reason
fRtn = FALSE;
}
// Reset reentrancy semaphore
::InterlockedExchange( &m_lInService, FALSE );
}
else
{
// Service routine reentered. Do nothing, just return
fRtn = FALSE;
}
return fRtn;
}
void AudioStream::Cue(
void
)
{
TRACE ( "AudioStream::Cue" );
if ( !m_fCued )
{
// Reset buffer ptr
m_dwWriteCursor = 0;
// Reset file ptr, etc
m_pwavefile->Cue();
// Reset DirectSound buffer
m_pdsb->SetCurrentPosition( 0 );
// Fill buffer with wave data
WriteWaveData( m_cbBufSize );
m_fCued = TRUE;
}
}
void AudioStream::Play(
void
)
{
if ( m_pdsb )
{
// If playing, stop
if (m_fPlaying)
{
Stop();
}
// Cue for playback if necessary
if (!m_fCued)
{
Cue();
}
// Begin DirectSound playback
HRESULT hr = m_pdsb->Play( 0, 0, DSBPLAY_LOOPING );
if (hr == DS_OK)
{
m_nTimeStarted = timeGetTime();
// Kick off timer to service buffer
m_ptimer = new CMmTimer;
if ( m_ptimer )
{
m_ptimer->Create( m_nBufService, m_nBufService, (DWORD)this, TimerCallback );
}
else
{
Stop();
return;
}
// Playback begun, no longer cued
m_fPlaying = TRUE;
m_fCued = FALSE;
}
else
{
TRACE ("Error, play failed\n\r");
}
}
}
BOOL AudioStream::TimerCallback(
DWORD dwUser
)
{
// dwUser contains ptr to AudioStream object
AudioStream* pas = (AudioStream *)dwUser;
return pas->ServiceBuffer();
}
void AudioStream::Stop(
void
)
{
TRACE ("AudioStream::Stop");
if (m_fPlaying)
{
// Stop DirectSound playback
m_pdsb->Stop ();
// Delete Timer object
delete m_ptimer;
m_ptimer = NULL;
m_fPlaying = FALSE;
}
}

View File

@ -0,0 +1,117 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef AUDIOSTREAM_H
#define AUDIOSTREAM_H
#include <dsound.h>
class CMmTimer;
class WaveFile;
// Classes
// AudioStreamServices
//
// DirectSound apportions services on a per-window basis to allow
// sound from background windows to be muted. The AudioStreamServices
// class encapsulates the initialization of DirectSound services.
//
// Each window that wants to create AudioStream objects must
// first create and initialize an AudioStreamServices object.
// All AudioStream objects must be destroyed before the associated
// AudioStreamServices object is destroyed.
class AudioStreamServices
{
public:
AudioStreamServices( void );
~AudioStreamServices( void );
BOOL Initialize ( HWND hwnd );
LPDIRECTSOUND GetPDS(void)
{
return m_pds;
}
protected:
HWND m_hwnd;
LPDIRECTSOUND m_pds;
private:
AudioStreamServices( const AudioStreamServices& ); // no implementation
void operator=( const AudioStreamServices& ); // no implementation
};
// AudioStream
//
// Audio stream interface class for playing WAV files using DirectSound.
// Users of this class must create AudioStreamServices object before
// creating an AudioStream object.
//
// Public Methods:
//
// Public Data:
//
class AudioStream
{
public:
AudioStream(void);
~AudioStream(void);
BOOL Create( AudioStreamServices * pass );
BOOL Destroy( void );
void Play( void );
void Stop( void );
protected:
void Cue (void);
BOOL WriteWaveData( DWORD cbWriteBytes );
DWORD GetMaxWriteSize (void);
BOOL ServiceBuffer (void);
static BOOL TimerCallback (DWORD dwUser);
AudioStreamServices * m_pass; // ptr to AudioStreamServices object
LPDIRECTSOUNDBUFFER m_pdsb; // sound buffer
WaveFile * m_pwavefile; // ptr to WaveFile object
CMmTimer * m_ptimer; // ptr to Timer object
BOOL m_fCued; // semaphore (stream cued)
BOOL m_fPlaying; // semaphore (stream playing)
DSBUFFERDESC m_dsbd; // sound buffer description
LONG m_lInService; // reentrancy semaphore
UINT m_dwWriteCursor; // last write position
UINT m_nBufLength; // length of sound buffer in msec
UINT m_cbBufSize; // size of sound buffer in bytes
UINT m_nBufService; // service interval in msec
UINT m_nDuration; // duration of wave file
UINT m_nTimeStarted; // time (in system time) playback started
UINT m_nTimeElapsed; // elapsed time in msec since playback started
BYTE* m_pbTempData; // Cache so we dont call Read twice for overlap
static const UINT DefBufferLength;
static const UINT DefBufferServiceInterval;
private:
AudioStream( const AudioStream& ); // no implementation
void operator=( const AudioStream& ); // no implementation
};
#endif // _INC_AUDIOSTREAM

View File

@ -0,0 +1,153 @@
//////////////////////////////////////////////////////////////////////
//
// ShellBrowser.cpp: implementation of the CShellBrowser class.
//
#include "pch.hxx"
#include "BrowseForFolder.hxx"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CBrowseForFolder::CBrowseForFolder(const HWND hParent, const LPITEMIDLIST pidl,
LPCTSTR strTitle)
{
m_hwnd = NULL;
SetOwner(hParent);
SetRoot(pidl);
m_bi.lpfn = BrowseCallbackProc;
m_bi.lParam = reinterpret_cast<LPARAM>( this );
m_bi.pszDisplayName = m_szSelected;
m_bi.lpszTitle = strTitle;
}
CBrowseForFolder::~CBrowseForFolder()
{
}
void CBrowseForFolder::SetOwner(const HWND hwndOwner)
{
if (m_hwnd != NULL)
return;
m_bi.hwndOwner = hwndOwner;
}
void CBrowseForFolder::SetRoot(const LPITEMIDLIST pidl)
{
if (m_hwnd != NULL)
return;
m_bi.pidlRoot = pidl;
}
LPCTSTR CBrowseForFolder::GetTitle() const
{
return m_bi.lpszTitle;
}
void CBrowseForFolder::SetFlags(const UINT ulFlags)
{
if (m_hwnd != NULL)
return;
m_bi.ulFlags = ulFlags;
}
LPCTSTR CBrowseForFolder::GetSelectedFolder(
void
) const
{
return m_szSelected;
}
bool CBrowseForFolder::SelectFolder()
{
bool bRet = false;
LPITEMIDLIST pidl;
if ((pidl = ::SHBrowseForFolder(&m_bi)) != NULL)
{
m_strPath.Set( _T("") );
if (SUCCEEDED(::SHGetPathFromIDList(pidl, m_szSelected)))
{
bRet = true;
m_strPath.Set( m_szSelected );
}
LPMALLOC pMalloc;
//Retrieve a pointer to the shell's IMalloc interface
if (SUCCEEDED(SHGetMalloc(&pMalloc)))
{
// free the PIDL that SHBrowseForFolder returned to us.
pMalloc->Free(pidl);
// release the shell's IMalloc interface
(void)pMalloc->Release();
}
}
m_hwnd = NULL;
return bRet;
}
void CBrowseForFolder::OnInit() const
{
}
void CBrowseForFolder::OnSelChanged(const LPITEMIDLIST pidl) const
{
(void)pidl;
}
void CBrowseForFolder::EnableOK(const bool bEnable) const
{
if (m_hwnd == NULL)
return;
// (void)SendMessage(m_hwnd, BFFM_ENABLEOK, static_cast(bEnable), NULL);
(void)SendMessage( m_hwnd, BFFM_ENABLEOK, NULL, static_cast<LPARAM>(bEnable) );
}
void CBrowseForFolder::SetSelection(const LPITEMIDLIST pidl) const
{
if (m_hwnd == NULL)
return;
(void)SendMessage(m_hwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(pidl));
}
void CBrowseForFolder::SetSelection(
LPCTSTR strPath
) const
{
if (m_hwnd == NULL)
return;
(void)SendMessage(m_hwnd, BFFM_SETSELECTION, TRUE, reinterpret_cast<LPARAM>(strPath));
}
void CBrowseForFolder::SetStatusText(
LPCTSTR strText
) const
{
if (m_hwnd == NULL)
return;
(void)SendMessage(m_hwnd, BFFM_SETSTATUSTEXT, NULL, reinterpret_cast<LPARAM>(strText));
}
int __stdcall CBrowseForFolder::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
CBrowseForFolder* pbff = reinterpret_cast<CBrowseForFolder*>( lpData );
pbff->m_hwnd = hwnd;
if (uMsg == BFFM_INITIALIZED)
pbff->OnInit();
else if (uMsg == BFFM_SELCHANGED)
pbff->OnSelChanged( reinterpret_cast<LPITEMIDLIST>( lParam ));
return 0;
}

View File

@ -0,0 +1,175 @@
//////////////////////////////////////////////////////////////////////
//
// ShellBrowser.h: interface for the CShellBrowser class.
//
// Copyright 1998 Scott D. Killen
//
//////////////////////////////////////////////////////////////////////
#ifndef __SHELLBROWSER_H__
#define __SHELLBROWSER_H__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <shlobj.h>
/////////////////////////////////////////////////////////////////////
//
// CShellBrowser
//
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 );
virtual ~CBrowseForFolder();
//
// Set the handle of the owner window for the dialog box.
//
void SetOwner(const HWND hwndOwner);
//
// Set the root of the heirarchy that will be browsed. Get pidl from
// SHGetSpecialFolderLocation. This can be set to NULL to use the Virtual Folder
// that represents the Windows Desktop.
//
void SetRoot(const LPITEMIDLIST pidl);
//
// Access a string that is displayed above the tree view control in the dialog box.
// This string can be used to specify instructions to the user. strTitle is a
// CString containing the text to be displayed. nTitle is the index of a string
// resource to be loaded. The return value is false if the resource could not be
// loaded.
//
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
// as well as other options. This member can include zero or more of the following
// values:
//
// BIF_BROWSEFORCOMPUTER Only returns computers. If the user selects
// anything other than a computer, the OK button
// is grayed.
//
// BIF_BROWSEFORPRINTER Only returns printers. If the user selects
// anything other than a printer, the OK button
// is grayed.
//
// BIF_DONTGOBELOWDOMAIN Does not include network folders below the
// domain level in the tree view control.
//
// BIF_RETURNFSANCESTORS Only returns file system ancestors. If the user
// selects anything other than a file system
// ancestor, the OK button is grayed.
//
// BIF_RETURNONLYFSDIRS Only returns file system directories. If the
// user selects folders that are not part of the
// file system, the OK button is grayed.
//
// BIF_STATUSTEXT Includes a status area in the dialog box. The
// callback function can set the status text by
// sending messages to the dialog box.
//
UINT GetFlags() const;
void SetFlags(const UINT ulFlags);
//
// Call GetSelectedFolder to retrieve the folder selected by the user.
//
LPCTSTR GetSelectedFolder() const;
//
// Function to retreive the image associated with the selected folder. The image is
// specified as an index to the system image list.
//
int GetImage() const;
//
// Call SelectFolder to display the dialog and get a selection from the user. Use
// GetSelectedFolder and GetImage to get the results of the dialog.
//
bool SelectFolder();
protected:
//
// OnInit is called before the dialog is displayed on the screen.
//
virtual void OnInit() const;
//
// OnSelChanged is called whenever the user selects a different directory. pidl is
// the LPITEMIDLIST of the new selection. Use SHGetPathFromIDList to retrieve the
// path of the selection.
//
virtual void OnSelChanged(const LPITEMIDLIST pidl) const;
//
// Call EnableOK to enable the OK button on the active dialog. If bEnable is true
// then the button is enabled, otherwise it is disabled.
// NOTE -- This function should only be called within overrides of OnInit and
// OnSelChanged.
//
void EnableOK(const bool bEnable) const;
//
// Call SetSelection to set the selection in the active dialog. pidl is the
// LPITEMIDLIST
// of the path to be selected. strPath is a CString containing the path to be
// selected.
// NOTE -- This function should only be called within overrides of OnInit and
// OnSelChanged.
//
void SetSelection(const LPITEMIDLIST pidl) const;
void SetSelection(LPCTSTR strPath) const;
//
// Call SetStatusText to set the text in the Status area in the active dialog.
// strText is the text to be displayed.
// NOTE -- This function should only be called within overrides of OnInit and
// OnSelChanged.
//
void SetStatusText(LPCTSTR strText) const;
private:
static int __stdcall BrowseCallbackProc(HWND hwnd,
UINT uMsg,
LPARAM lParam,
LPARAM lpData);
CSimpleString m_pchTitle;
BROWSEINFO m_bi;
char m_szSelected[MAX_PATH];
CSimpleString m_strPath;
HWND m_hwnd;
};
inline UINT CBrowseForFolder::GetFlags() const
{
return m_bi.ulFlags;
}
inline int CBrowseForFolder::GetImage() const
{
return m_bi.iImage;
}
#endif // __SHELLBROWSER_H__

View File

@ -0,0 +1,345 @@
/*
* CREGBINDING.CPP
*
* Registry Class
*
* Copyright (C) 1998 by Joerg Dentler (dentler@tpnet.de)
* All rights reserved
*
*/
//
// Version 1.0.0 98-11-20 created
/////////////////////////////////////////////////////////////////////////////
// Permission is granted to anyone to use this software for any
// purpose and to redistribute it in any way, subject to the following
// restrictions:
//
// 1. The author is not responsible for the consequences of use of
// this software, no matter how awful, even if they arise
// from defects in it.
//
// 2. The origin of this software must not be misrepresented, either
// by explicit claim or by omission.
//
// 3. Altered versions must be plainly marked as such, and must not
// be misrepresented (by explicit claim or omission) as being
// the original software.
//
// 4. This notice must not be removed or altered.
/////////////////////////////////////////////////////////////////////////////
#include <afxwin.h>
#include "cregbinding.h"
// CEntry class
class CEntry : public CObject
{
public:
enum Type
{
CR_INVALID,
CR_INT,
CR_DWORD,
CR_STRING,
CR_BYTE_ARR,
CR_CWND
};
Type m_eType;
CString m_strName;
LPVOID m_pData;
CEntry() :
m_eType(CR_INVALID), m_pData(NULL) { }
CEntry(const CEntry &e) :
m_eType(e.m_eType), m_pData(e.m_pData), m_strName(e.m_strName) { }
};
// CRegBinding class members
BOOL CRegBinding::Hook(const HWND hwnd)
{
CEntry *e;
if (FindAndRemove(e, hwnd)) {
SaveWindowState(*e);
delete e;
return TRUE;
}
return FALSE;
}
BOOL CRegBinding::FindAndRemove(CEntry *&e, const HWND hwnd)
{
POSITION pos = m_list.GetHeadPosition(), spos;
while (pos != NULL) {
spos = pos;
CObject *o = m_list.GetNext(pos);
ASSERT_VALID(o);
e = (CEntry *)o;
if (e->m_eType == CEntry::CR_CWND) {
CWnd *wnd = (CWnd *)e->m_pData;
if (wnd->GetSafeHwnd() == hwnd) {
m_list.RemoveAt(spos);
return TRUE;
}
}
}
return FALSE;
}
void CRegBinding::Bind(int &value, const char *name, const int def)
{
value = m_pApp->GetProfileInt(m_strSection, name, def);
CEntry e;
e.m_eType = CEntry::CR_INT;
e.m_pData = &value;
e.m_strName = name;
Insert(e);
}
void CRegBinding::Bind(DWORD &value, const char *name, const DWORD def)
{
value = m_pApp->GetProfileInt(m_strSection, name, def);
CEntry e;
e.m_eType = CEntry::CR_DWORD;
e.m_pData = &value;
e.m_strName = name;
Insert(e);
}
void CRegBinding::Bind(CString &value, const char *name, const char *def)
{
const char *ds = def ? def : "";
value = m_pApp->GetProfileString(m_strSection, name, ds);
CEntry e;
e.m_eType = CEntry::CR_STRING;
e.m_pData = &value;
e.m_strName = name;
Insert(e);
}
void CRegBinding::Bind(CByteArray &value, const char *name,
const CByteArray *def)
{
LPBYTE data = NULL;
UINT bytes;
m_pApp->GetProfileBinary(m_strSection, name, &data, &bytes);
if (bytes > 0) {
// registry contains some data
value.SetAtGrow(bytes - 1, 0);
BYTE *p = value.GetData();
CopyMemory(p, data, bytes);
delete data;
} else {
// assume default value
if (def) {
ASSERT_VALID(def);
value.Copy(*def);
}
}
CEntry e;
e.m_eType = CEntry::CR_BYTE_ARR;
e.m_pData = &value;
e.m_strName = name;
Insert(e);
}
void CRegBinding::Bind(CWnd *wnd, const char *name)
{
ASSERT_VALID(wnd);
ASSERT(wnd->GetSafeHwnd() != NULL);
CString n;
if (name)
n = name;
else {
wnd->GetWindowText(n);
if (n.IsEmpty())
n = "Window";
}
n += '_';
WINDOWPLACEMENT wp;
wp.length = sizeof (WINDOWPLACEMENT);
wnd->GetWindowPlacement(&wp);
if (((wp.flags =
m_pApp->GetProfileInt (m_strSection, n + "flags", -1)) != -1) &&
((wp.showCmd =
m_pApp->GetProfileInt (m_strSection, n + "showCmd", -1)) != -1) &&
((wp.rcNormalPosition.left =
m_pApp->GetProfileInt (m_strSection, n + "x1", -1)) != -1) &&
((wp.rcNormalPosition.top =
m_pApp->GetProfileInt (m_strSection, n + "y1", -1)) != -1) &&
((wp.rcNormalPosition.right =
m_pApp->GetProfileInt (m_strSection, n + "x2", -1)) != -1) &&
((wp.rcNormalPosition.bottom =
m_pApp->GetProfileInt (m_strSection, n + "y2", -1)) != -1)) {
wp.rcNormalPosition.left = min (wp.rcNormalPosition.left,
::GetSystemMetrics (SM_CXSCREEN) -
::GetSystemMetrics (SM_CXICON));
wp.rcNormalPosition.top = min (wp.rcNormalPosition.top,
::GetSystemMetrics (SM_CYSCREEN) -
::GetSystemMetrics (SM_CYICON));
wnd->SetWindowPlacement (&wp);
}
CEntry e;
e.m_eType = CEntry::CR_CWND;
e.m_pData = wnd;
e.m_strName = n;
Insert(e);
}
CWinApp *CRegBinding::m_pApp;
HHOOK CRegBinding::m_hHook;
CRegBinding::CRegBinding(const char *section) : m_strSection(section)
{
m_pApp = AfxGetApp();
ASSERT_VALID(m_pApp);
if (m_lInstances.IsEmpty()) {
m_hHook = ::SetWindowsHookEx(WH_CBT, FilterHook, NULL, ::GetCurrentThreadId());
if (m_hHook == NULL)
AfxThrowMemoryException();
}
Bind(this);
}
void CRegBinding::Insert(const CEntry &e)
{
// in autosave Mode the destructor of the CRegBinding Member Object
// must be called before any other member destructor is executed
#ifdef _DEBUG
LPVOID tp = (const LPVOID)this;
LPVOID mp = (const LPVOID)(e.m_pData);
if (!(mp < tp)) {
TRACE("Please put the CRegBinding Object behind"
"the last member to bind\n"
"Only class members can registerd by CRegBinding\n");
ASSERT(0);
}
POSITION pos = m_list.GetHeadPosition();
while (pos != NULL) {
CObject *o = m_list.GetNext(pos);
ASSERT_VALID(o);
CEntry *le = (CEntry *)o;
if (le->m_strName == e.m_strName) {
TRACE("The same key already exists in this section\n");
ASSERT(0);
}
}
#endif
CEntry *ne = new CEntry(e);
ASSERT_VALID(ne);
m_list.AddTail(ne);
}
void CRegBinding::SaveWindowState(const CEntry &e)
{
ASSERT(e.m_eType == CEntry::CR_CWND);
CWnd *wnd = (CWnd *)e.m_pData;
ASSERT_VALID(wnd);
CString n = e.m_strName;
WINDOWPLACEMENT wp;
wp.length = sizeof (WINDOWPLACEMENT);
wnd->GetWindowPlacement(&wp);
m_pApp->WriteProfileInt(m_strSection, n + "flags", wp.flags);
m_pApp->WriteProfileInt(m_strSection, n + "showCmd", wp.showCmd);
m_pApp->WriteProfileInt(m_strSection, n + "x1", wp.rcNormalPosition.left);
m_pApp->WriteProfileInt(m_strSection, n + "y1", wp.rcNormalPosition.top);
m_pApp->WriteProfileInt(m_strSection, n + "x2", wp.rcNormalPosition.right);
m_pApp->WriteProfileInt(m_strSection, n + "y2", wp.rcNormalPosition.bottom);
}
CRegBinding::~CRegBinding()
{
Write(TRUE);
UnBind(this);
if (m_lInstances.IsEmpty()) {
UnhookWindowsHookEx(m_hHook);
}
}
void CRegBinding::Write(BOOL del)
{
POSITION pos1 = m_list.GetHeadPosition(), pos2;
while (pos1 != NULL) {
pos2 = pos1;
CEntry *o = (CEntry *)m_list.GetNext(pos1);
ASSERT_VALID(o);
Write(o);
if (del) {
m_list.RemoveAt(pos2);
delete o;
}
}
}
void CRegBinding::Write(const CEntry *e)
{
ASSERT_VALID(e);
switch (e->m_eType) {
case CEntry::CR_INT:
{
int *i = (int *)(e->m_pData);
m_pApp->WriteProfileInt(m_strSection, e->m_strName, *i);
return;
}
case CEntry::CR_DWORD:
{
DWORD *dw = (DWORD *)(e->m_pData);
m_pApp->WriteProfileInt(m_strSection, e->m_strName, *dw);
return;
}
case CEntry::CR_STRING:
{
CString *str = (CString *)(e->m_pData);
m_pApp->WriteProfileString(m_strSection, e->m_strName, *str);
return;
}
case CEntry::CR_BYTE_ARR:
{
CByteArray *p = (CByteArray *)(e->m_pData);
ASSERT_VALID(p);
m_pApp->WriteProfileBinary(m_strSection, e->m_strName, p->GetData(),
p->GetSize());
return;
}
case CEntry::CR_CWND:
SaveWindowState(*e);
return;
}
ASSERT(0);
}
CObList CRegBinding::m_lInstances;
LRESULT CALLBACK
CRegBinding::FilterHook(int code, WPARAM wParam, LPARAM lParam)
{
if (code == HCBT_DESTROYWND) {
ASSERT(wParam != NULL); // should be non-NULL HWND
POSITION pos = m_lInstances.GetHeadPosition();
while (pos != NULL) {
CObject *o = m_lInstances.GetNext(pos);
ASSERT_VALID(o);
CRegBinding *rs = (CRegBinding *)o;
if (rs->Hook((HWND)wParam))
break;
}
}
return CallNextHookEx(m_hHook, code, wParam, lParam);
}
void CRegBinding::Bind(CRegBinding *rs)
{
m_lInstances.AddTail(rs);
}
void CRegBinding::UnBind(CRegBinding *rs)
{
ASSERT_VALID(rs);
POSITION f = m_lInstances.Find(rs);
ASSERT(f != NULL);
m_lInstances.RemoveAt(f);
}

View File

@ -0,0 +1,78 @@
/*
* CREGBINDING.H
*
* Registry Class
*
* Copyright (C) 1998 by Joerg Dentler (dentler@tpnet.de)
* All rights reserved
*
*/
//
// Version 1.0.0 98-11-20 created
#ifndef __CREGBINDING_H__
#define __CREGBINDING_H__
/////////////////////////////////////////////////////////////////////////////
// Permission is granted to anyone to use this software for any
// purpose and to redistribute it in any way, subject to the following
// restrictions:
//
// 1. The author is not responsible for the consequences of use of
// this software, no matter how awful, even if they arise
// from defects in it.
//
// 2. The origin of this software must not be misrepresented, either
// by explicit claim or by omission.
//
// 3. Altered versions must be plainly marked as such, and must not
// be misrepresented (by explicit claim or omission) as being
// the original software.
//
// 4. This notice must not be removed or altered.
/////////////////////////////////////////////////////////////////////////////
#include <afx.h>
class CEntry;
// An alternative Registry Class
class CRegBinding : public CObject
{
public:
CRegBinding(const char *section);
// Bind frequently used data types
void Bind(int &value, const char *name, const int def = 0);
void Bind(DWORD &value, const char *name, const DWORD def = 0);
void Bind(CString &value, const char *name, const char *def = NULL);
void Bind(CByteArray &value, const char *name, const CByteArray *def = NULL);
// Save the window's screen state
void Bind(CWnd *value, const char *name = NULL);
// Write Data - optional clear variable bindings
void Write(const BOOL clear = FALSE);
~CRegBinding();
protected:
// Data
CObList m_list;
CString m_strSection;
protected:
void SaveWindowState(const CEntry &e);
void Write(const CEntry *e);
void Insert(const CEntry &e);
BOOL Hook(const HWND hwnd);
BOOL FindAndRemove(CEntry *&e, const HWND hwnd);
static CWinApp *m_pApp;
static HHOOK m_hHook;
// reference counting
static CObList m_lInstances;
static LRESULT CALLBACK FilterHook(int code, WPARAM wParam, LPARAM lParam);
static void Bind(CRegBinding *rs);
static void UnBind(CRegBinding *rs);
};
#endif

View File

@ -0,0 +1,119 @@
// Cyberstella.cpp : Defines the class behaviors for the application.
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "MainFrm.h"
#include "CyberstellaDoc.h"
#include "CyberstellaView.h"
#include "AboutDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp
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)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp construction
CCyberstellaApp::CCyberstellaApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CCyberstellaApp object
CCyberstellaApp theApp;
// see debug.cpp
LPCTSTR g_ctszDebugLog = _T("stella.log");
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp initialization
BOOL CCyberstellaApp::InitInstance()
{
// Delete previous Debug Log
(void)::DeleteFile(g_ctszDebugLog);
// Avoid Second instance
CreateMutex(NULL,TRUE,_T("StellaXMutex"));
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
MessageBox(NULL, NULL, IDS_ALREADYRUNNING);
return false;
}
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(10); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCyberstellaDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CCyberstellaView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
// App command to run the about dialog
void CCyberstellaApp::OnAppAbout()
{
AboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp message handlers

View File

@ -0,0 +1,663 @@
# Microsoft Developer Studio Project File - Name="Cyberstella" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Cyberstella - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Cyberstella.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Cyberstella.mak" CFG="Cyberstella - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Cyberstella - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Cyberstella - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Cyberstella - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /FR /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x407 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "Cyberstella - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /FR /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x407 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Cyberstella - Win32 Release"
# Name "Cyberstella - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\AboutDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\AudioStream.cxx
# End Source File
# Begin Source File
SOURCE=.\BrowseForFolder.cxx
# End Source File
# Begin Source File
SOURCE=.\CRegBinding.cpp
# End Source File
# Begin Source File
SOURCE=.\Cyberstella.cpp
# End Source File
# Begin Source File
SOURCE=.\Cyberstella.rc
# End Source File
# Begin Source File
SOURCE=.\CyberstellaDoc.cpp
# End Source File
# Begin Source File
SOURCE=.\CyberstellaView.cpp
# End Source File
# Begin Source File
SOURCE=.\DirectDraw.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectInput.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectXFullScreen.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectXWindow.cxx
# End Source File
# Begin Source File
SOURCE=.\GlobalData.cxx
# End Source File
# Begin Source File
SOURCE=.\HyperLink.cpp
# End Source File
# Begin Source File
SOURCE=.\ListData.cxx
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\pch.cxx
# End Source File
# Begin Source File
SOURCE=.\SoundWin32.cxx
# End Source File
# Begin Source File
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
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\AboutDlg.h
# End Source File
# Begin Source File
SOURCE=.\AudioStream.hxx
# End Source File
# Begin Source File
SOURCE=.\BrowseForFolder.hxx
# End Source File
# Begin Source File
SOURCE=.\CRegBinding.h
# End Source File
# Begin Source File
SOURCE=.\Cyberstella.h
# End Source File
# Begin Source File
SOURCE=.\CyberstellaDoc.h
# End Source File
# Begin Source File
SOURCE=.\CyberstellaView.h
# End Source File
# Begin Source File
SOURCE=.\DirectDraw.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectInput.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectXFullScreen.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectXWindow.hxx
# End Source File
# Begin Source File
SOURCE=.\GlobalData.hxx
# End Source File
# Begin Source File
SOURCE=.\HyperLink.h
# End Source File
# Begin Source File
SOURCE=.\ListData.hxx
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\pch.hxx
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\SoundWin32.hxx
# End Source File
# Begin Source File
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
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\Cyberstella.ico
# End Source File
# Begin Source File
SOURCE=.\res\Cyberstella.rc2
# End Source File
# Begin Source File
SOURCE=.\res\CyberstellaDoc.ico
# End Source File
# Begin Source File
SOURCE=.\Stella.ico
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp
# End Source File
# End Group
# Begin Group "Core"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\emucore\Booster.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Booster.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart2K.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart2K.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart3F.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart3F.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart4K.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Cart4K.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartAR.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartAR.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartCV.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartCV.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartDPC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartDPC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartE0.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartE0.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartE7.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartE7.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF4SC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF4SC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF6.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF6.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF6SC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF6SC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF8.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF8.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF8SC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF8SC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartFASC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartFASC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartFE.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartFE.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartMB.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartMB.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartMC.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartMC.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Console.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Console.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Control.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Control.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Driving.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Driving.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Event.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Event.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Joystick.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Joystick.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Keyboard.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Keyboard.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\M6532.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\M6532.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\MD5.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\MD5.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\MediaSrc.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\MediaSrc.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Paddles.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Paddles.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Props.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Props.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\PropsSet.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\PropsSet.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Random.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Random.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Sound.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Sound.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Switches.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Switches.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\TIA.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\TIA.hxx
# End Source File
# End Group
# Begin Group "M6502"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\emucore\m6502\src\D6502.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\D6502.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\Device.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\Device.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502Hi.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502Hi.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502Low.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\M6502Low.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\NullDev.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\NullDev.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\System.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\m6502\src\System.hxx
# End Source File
# End Group
# Begin Group "Sound"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\sound\TIASound.c
# End Source File
# Begin Source File
SOURCE=..\sound\TIASound.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\emucore\m6502\src\bspf\src\bspf.hxx
# End Source File
# Begin Source File
SOURCE=..\..\build\M6502Hi.ins
# End Source File
# Begin Source File
SOURCE=..\..\build\M6502Low.ins
# End Source File
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View File

@ -0,0 +1,49 @@
// Cyberstella.h : main header file for the CYBERSTELLA application
//
#if !defined(AFX_CYBERSTELLA_H__7FB621F6_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_CYBERSTELLA_H__7FB621F6_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaApp:
// See Cyberstella.cpp for the implementation of this class
//
class CCyberstellaApp : public CWinApp
{
public:
CCyberstellaApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCyberstellaApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// 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
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CYBERSTELLA_H__7FB621F6_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1,527 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Cyberstella.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "STELLA.ICO"
IDR_CYBERSTYPE ICON DISCARDABLE "res\\CyberstellaDoc.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
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
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
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 "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 "&Help"
BEGIN
MENUITEM "&About Cyberstella...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 211
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,7,7,44,8
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
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Information"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "You must own legal copies of all ROM images you are using. Neither Jeff Miller nor the rest of the Stella team can tell you where to find ROM images so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities.",
-1,7,7,376,18,SS_NOPREFIX
LTEXT "If you have a question or a problem, please try one of these contacts:",
-1,7,93,376,8,SS_NOPREFIX
LTEXT "Jeff Miller:",-1,7,109,32,8,SS_NOPREFIX
LTEXT "miller@zipcon.net",IDC_EMAIL_JEFFMILL,73,109,56,8,
SS_NOPREFIX | SS_NOTIFY
LTEXT "http://www.emuunlim.com/stellax/",IDC_WEB_JEFFMILL,178,
109,110,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "Stella dev team:",-1,7,121,52,8,SS_NOPREFIX
LTEXT "stella@csc.ncsu.edu",IDC_EMAIL_STELLA,73,121,67,8,
SS_NOPREFIX | SS_NOTIFY
LTEXT "http://stella.atari.org",IDC_WEB_STELLA,178,121,65,8,
SS_NOPREFIX | SS_NOTIFY
LTEXT "StellaX is free software. It may not be sold or offered as part of a collection for sale without permission from Jeff Miller. When distributing StellaX, the original distribution (the .zip file) must not be altered.",
-1,7,32,376,19,SS_NOPREFIX
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,81,376,1
LTEXT "TIPS: F12 will create a screen shot of the current game screen. Open up stella.ini in notepad to see configurable options.",
-1,7,56,376,18
PUSHBUTTON "&Continue",IDC_CONTINUE,136,144,118,14
END
IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 149
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&ROM (.bin) file path:",-1,7,10,64,8
EDITTEXT IDC_ROMPATH,82,7,246,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BROWSE,333,7,50,14
LTEXT "Set this to the path where your .bin rom files are located.",
-1,7,25,376,8
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,39,376,1
LTEXT "Mouse should emulate &paddle:",-1,7,49,97,8
COMBOBOX IDC_PADDLE,109,46,48,82,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,66,374,1
CONTROL "&Auto select video mode",IDC_AUTO_SELECT_VIDEOMODE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,73,90,10
LTEXT "If this is not checked, then a standard video mode (640x480) will be used. Otherwise, StellaX will use the video mode which it believes will work best. You should only uncheck this if you are having video problems while running StellaX.",
-1,7,84,376,18
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,108,373,1
CONTROL "Disable &Sound",IDC_SOUND,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,116,62,10
CONTROL "Disable &Joysticks",IDC_JOYSTICK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,130,70,10
PUSHBUTTON "&Continue",IDC_CONTINUE,265,128,118,14
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Cyberstella MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Cyberstella\0"
VALUE "LegalCopyright", "Copyright (C) 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Cyberstella.EXE\0"
VALUE "ProductName", "Cyberstella Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CYBERSTELLA_FORM, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 402
TOPMARGIN, 7
BOTTOMMARGIN, 204
END
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 383
TOPMARGIN, 7
BOTTOMMARGIN, 169
END
IDD_CONFIG_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 383
TOPMARGIN, 7
BOTTOMMARGIN, 142
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "Cyberstella\n\nCybers\n\n\nCyberstella.Document\nCybers Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "Cyberstella"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "SCRL"
ID_INDICATOR_OVR "OVR"
ID_INDICATOR_REC "REC"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Create a new document\nNew"
ID_FILE_OPEN "Open an existing document\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the active document\nSave"
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
ID_FILE_MRU_FILE5 "Open this document"
ID_FILE_MRU_FILE6 "Open this document"
ID_FILE_MRU_FILE7 "Open this document"
ID_FILE_MRU_FILE8 "Open this document"
ID_FILE_MRU_FILE9 "Open this document"
ID_FILE_MRU_FILE10 "Open this document"
ID_FILE_MRU_FILE11 "Open this document"
ID_FILE_MRU_FILE12 "Open this document"
ID_FILE_MRU_FILE13 "Open this document"
ID_FILE_MRU_FILE14 "Open this document"
ID_FILE_MRU_FILE15 "Open this document"
ID_FILE_MRU_FILE16 "Open this document"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
ID_EDIT_FIND "Find the specified text\nFind"
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
ID_EDIT_UNDO "Undo the last action\nUndo"
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ALREADYRUNNING "StellaX is already running!"
IDS_BADARGUMENT "Unknown argument given on command line"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_CW_FAILED "CreateWindow failed"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DDSDM_FAILED "Unable to set video mode. Your video adapter might be incompatible with stella."
IDS_DSCSBFAILED "IDirectSound::CreateSoundBuffer failed"
IDS_DSSCLFAILED "IDirectSound::SetCooperativeLevel failed"
IDS_FILEFILTER "Stella Files (*.bin)|*.bin|All Files (*.*)|*.*||"
IDS_FILENAME "Filename"
IDS_MANUFACTURER "Manufacturer"
IDS_MIKE """I've heard some folks discussing the possibility of writing an 2600 emulator in a high level language - forget it, not possible."" -- Mike Livesay on rec.games.video.classic"
IDS_NAME "Name"
IDS_NODIRECTDRAW "DirectDraw does not appear to be installed on this system!"
IDS_RARITY "Rarity"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_STATUSTEXT "%d files found"
IDS_STELLA "StellaX"
IDS_NODIRECTINPUT "DirectInput could not be initialized. Be sure you have DirectX 5.0 or later installed."
IDS_CANTSTARTCONSOLE "Error starting console. You may have chosen an invalid ROM file."
IDS_COINIT_FAILED "Unable to initialize COM subsystem"
IDS_ASS_FAILED "Unable to initialize audio subsystem"
IDS_PAS_FAILED "Unable to create audio stream"
IDS_DD_INIT_FAILED "Unable to initialize DirectDraw object"
IDS_DD_ENUMMODES_FAILED "Unable to enumerate display modes"
IDS_NO_VID_MODE "No compatible video modes were found"
IDS_DI_INIT_FAILED "Unable to initialize DirectInput object"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ROM_LOAD_FAILED "Unable to load ROM image\n\nCurrent Directory: %s\nPath: %s\nError code: %d - %s"
IDS_NO_ITEM_SELECTED "Before pressing play you must first select a game from the list!"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Cyberstella.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,84 @@
// CyberstellaDoc.cpp : implementation of the CCyberstellaDoc class
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "CyberstellaDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaDoc
IMPLEMENT_DYNCREATE(CCyberstellaDoc, CDocument)
BEGIN_MESSAGE_MAP(CCyberstellaDoc, CDocument)
//{{AFX_MSG_MAP(CCyberstellaDoc)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaDoc construction/destruction
CCyberstellaDoc::CCyberstellaDoc()
{
// TODO: add one-time construction code here
}
CCyberstellaDoc::~CCyberstellaDoc()
{
}
BOOL CCyberstellaDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaDoc serialization
void CCyberstellaDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaDoc diagnostics
#ifdef _DEBUG
void CCyberstellaDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CCyberstellaDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaDoc commands

View File

@ -0,0 +1,57 @@
// CyberstellaDoc.h : interface of the CCyberstellaDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CYBERSTELLADOC_H__7FB621FC_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_CYBERSTELLADOC_H__7FB621FC_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CCyberstellaDoc : public CDocument
{
protected: // create from serialization only
CCyberstellaDoc();
DECLARE_DYNCREATE(CCyberstellaDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCyberstellaDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CCyberstellaDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CCyberstellaDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CYBERSTELLADOC_H__7FB621FC_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1,459 @@
// CyberstellaView.cpp : implementation of the CCyberstellaView class
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "CyberstellaDoc.h"
#include "CyberstellaView.h"
#include "StellaConfig.h"
#include "MD5.hxx"
#include "PropsSet.hxx"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaView
IMPLEMENT_DYNCREATE(CCyberstellaView, CFormView)
BEGIN_MESSAGE_MAP(CCyberstellaView, CFormView)
//{{AFX_MSG_MAP(CCyberstellaView)
ON_BN_CLICKED(IDC_CONFIG, OnConfig)
ON_BN_CLICKED(IDC_PLAY, OnPlay)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaView construction/destruction
CCyberstellaView::CCyberstellaView()
: CFormView(CCyberstellaView::IDD)
{
//{{AFX_DATA_INIT(CCyberstellaView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pGlobalData = new CGlobalData(GetModuleHandle(NULL));
}
CCyberstellaView::~CCyberstellaView()
{
if(m_pGlobalData) delete m_pGlobalData;
}
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCyberstellaView)
DDX_Control(pDX, IDC_ROMLIST, m_List);
//}}AFX_DATA_MAP
}
BOOL CCyberstellaView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CCyberstellaView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
DWORD dwRet;
HWND hwnd = *this;
dwRet = m_stella.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];
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
::SendMessage( m_List,
LVM_SETEXTENDEDLISTVIEWSTYLE,
0,
LVS_EX_FULLROWSELECT );
RECT rc;
::GetClientRect( m_List, &rc );
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
int cx = lTotalWidth / CListData::GetColumnCount();
for (int i = 0; i < CListData::GetColumnCount(); ++i)
{
LoadString(GetModuleHandle(NULL),
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_List, i, &lvc );
}
DWORD dwError = PopulateRomList();
if ( dwError != ERROR_SUCCESS )
{
MessageBoxFromWinError( dwError, _T("PopulateRomList") );
AfxGetMainWnd()->SendMessage(WM_CLOSE, 0, 0);
}
// if items added, select first item and enable play button
int nCount = ListView_GetItemCount( m_List );
if (nCount != 0)
{
m_List.SortItems(ListViewCompareFunc, 0);
ListView_SetItemState( m_List, 0, LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED );
}
else
{
::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE );
}
//
// Show status text
//
TCHAR pszStatus[256 + 1];
LoadString(GetModuleHandle(NULL), IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, nCount );
SetDlgItemText(IDC_ROMCOUNT, psz );
//
// Show rom path
//
SetDlgItemText(IDC_ROMPATH, m_pGlobalData->romDir);
//
// Set default button
//
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
}
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaView diagnostics
#ifdef _DEBUG
void CCyberstellaView::AssertValid() const
{
CFormView::AssertValid();
}
void CCyberstellaView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CCyberstellaDoc* CCyberstellaView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCyberstellaDoc)));
return (CCyberstellaDoc*)m_pDocument;
}
#endif //_DEBUG
////////////////////////////
// Listview compare function
int CALLBACK CCyberstellaView::ListViewCompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort)
{
CCyberstellaView* pThis = reinterpret_cast<CCyberstellaView*>( lParamSort );
//
// I assume that the metadata for column 0 is always available,
// while other column metadata requires a call to ReadRomData
//
int nSortCol = lParamSort;
CListData* pItem1 = reinterpret_cast<CListData*>( lParam1 );
if ( ! pItem1->IsPopulated() && nSortCol != 0 )
{
pThis->ReadRomData( pItem1 );
}
CListData* pItem2 = reinterpret_cast<CListData*>( lParam2 );
if ( ! pItem2->IsPopulated() && nSortCol != 0 )
{
pThis->ReadRomData( pItem2 );
}
LPCTSTR pszItem1 = pItem1->GetTextForColumn( nSortCol );
LPCTSTR pszItem2 = pItem2->GetTextForColumn( nSortCol );
//
// put blank items last
//
if ( pszItem1 == NULL || pszItem1[0] == _T('\0') )
{
return 1;
}
if ( pszItem2 == NULL || pszItem2[0] == _T('\0') )
{
return -1;
}
//
// Compare the specified column.
//
return lstrcmpi( pszItem1, pszItem2 );
}
void CCyberstellaView::OnConfig()
{
StellaConfig dlg(m_pGlobalData);
dlg.DoModal();
}
DWORD CCyberstellaView::PopulateRomList()
{
DWORD dwRet;
ClearList();
TCHAR pszPath[ MAX_PATH ];
lstrcpy( pszPath, m_pGlobalData->romDir);
lstrcat( pszPath, _T("\\*.bin") );
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile( pszPath, &ffd );
ListView_SetItemCount(m_List, 100);
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;
}
dwRet = pListData->Initialize();
if ( dwRet != ERROR_SUCCESS )
{
return dwRet;
}
if ( ! pListData->m_strFileName.Set( ffd.cFileName ) )
{
return FALSE;
}
LV_ITEM lvi;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = iItem++;
lvi.iSubItem = 0;
lvi.pszText = ffd.cFileName;
lvi.lParam = (LPARAM)pListData;
m_List.InsertItem (&lvi);
//TODO: Display the Rest
/*int nItem = ListView_InsertItem(m_List, &lvi);
ASSERT( nItem != -1 );
ListView_SetItemText(m_List, nItem,
CListData::FILENAME_COLUMN, LPSTR_TEXTCALLBACK );
ListView_SetItemText(m_List, nItem,
CListData::MANUFACTURER_COLUMN, LPSTR_TEXTCALLBACK);
ListView_SetItemText(m_List, nItem,
CListData::RARITY_COLUMN, LPSTR_TEXTCALLBACK );*/
// go to the next rom file
fDone = !FindNextFile(hFind, &ffd);
}
if ( hFind != INVALID_HANDLE_VALUE )
{
VERIFY( ::FindClose( hFind ) );
}
return ERROR_SUCCESS;
}
void CCyberstellaView::ClearList()
{
int nCount = ListView_GetItemCount(m_List);
for (int i = 0; i < nCount; ++i)
{
ListView_DeleteItem(m_List,0);
}
ListView_DeleteAllItems(m_List);
}
DWORD CCyberstellaView::ReadRomData(CListData* pListData) const
{
// TODO: Move this method to ListData class (?)
if ( pListData == NULL )
{
ASSERT( FALSE );
return ERROR_BAD_ARGUMENTS;
}
// attempt to read the rom file
TCHAR pszPath[MAX_PATH + 1];
lstrcpy( pszPath, m_pGlobalData->romDir);
lstrcat( pszPath, _T("\\") );
lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
HANDLE hFile;
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
std::string md5 = MD5( pImage, dwFileSize );
// search through the properties set for this MD5
PropertiesSet& propertiesSet = m_stella.GetPropertiesSet();
Properties properties;
propertiesSet.getMD5(md5, properties);
if ( ! pListData->m_strManufacturer.Set(
properties.get("Cartridge.Manufacturer").c_str() ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! pListData->m_strName.Set(
properties.get("Cartridge.Name").c_str() ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if (! pListData->m_strRarity.Set(
properties.get("Cartridge.Rarity").c_str() ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! pListData->m_strNote.Set(
properties.get("Cartridge.Note").c_str() ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
}
delete[] pImage;
VERIFY( ::CloseHandle( hFile ) );
pListData->m_fPopulated = TRUE;
return ERROR_SUCCESS;
}
void CCyberstellaView::OnPlay()
{
CListData* pListData;
int nItem;
nItem = (int)::SendMessage( m_List,
LVM_GETNEXTITEM,
(WPARAM)-1,
MAKELPARAM( LVNI_SELECTED, 0 ) );
ASSERT( nItem != -1 );
if ( nItem == -1 )
{
::MessageBox( GetModuleHandle(NULL),
*this,
IDS_NO_ITEM_SELECTED );
return;
}
pListData = (CListData*)m_List.GetItemData(nItem);
TCHAR pszPathName[ MAX_PATH + 1 ];
lstrcpy( pszPathName, m_pGlobalData->romDir);
lstrcat( pszPathName, _T("\\") );
lstrcat( pszPathName,
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
// Play the game!
::EnableWindow(*this, FALSE );
(void)m_stella.PlayROM( *this,
pszPathName,
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
m_pGlobalData);
::EnableWindow( *this, TRUE );
// Set focus back to the rom list
::SetFocus(m_List);
}

View File

@ -0,0 +1,83 @@
// CyberstellaView.h : interface of the CCyberstellaView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CYBERSTELLAVIEW_H__7FB621FE_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_CYBERSTELLAVIEW_H__7FB621FE_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "StellaXMain.hxx"
#include "GlobalData.hxx"
#include "ListData.hxx"
class CCyberstellaView : public CFormView
{
protected: // create from serialization only
CCyberstellaView();
DECLARE_DYNCREATE(CCyberstellaView)
public:
//{{AFX_DATA(CCyberstellaView)
enum { IDD = IDD_CYBERSTELLA_FORM };
CListCtrl m_List;
//}}AFX_DATA
// Attributes
public:
CCyberstellaDoc* GetDocument();
CStellaXMain m_stella;
HFONT m_hfontRomNote;
CGlobalData* m_pGlobalData;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCyberstellaView)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CCyberstellaView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CCyberstellaView)
afx_msg void OnConfig();
afx_msg void OnPlay();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
DWORD PopulateRomList();
void ClearList();
DWORD ReadRomData(CListData* pListData) const;
};
#ifndef _DEBUG // debug version in CyberstellaView.cpp
inline CCyberstellaDoc* CCyberstellaView::GetDocument()
{ return (CCyberstellaDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CYBERSTELLAVIEW_H__7FB621FE_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1,470 @@
//
// StellaX
// Jeff Miller 05/10/2000
//
#include "pch.hxx"
#include "DirectDraw.hxx"
#include "resource.h"
CDirectDraw::CDirectDraw(
const SIZE& sizeSurface
) :\
m_fInitialized( FALSE ),
m_piDD(NULL),
m_piDDSurface(NULL),
m_piDDSurfaceBack(NULL),
m_piDDPalette(NULL)
{
m_sizeScreen.cx = 0;
m_sizeScreen.cy = 0;
m_sizeSurface.cx = sizeSurface.cx;
m_sizeSurface.cy = sizeSurface.cy;
// TRACE( "m_sizeSurface = %d x %d", m_sizeSurface.cx, m_sizeSurface.cy );
}
CDirectDraw::~CDirectDraw(
)
{
TRACE("CDirectDraw::~CDirectDraw");
Cleanup();
}
HRESULT CDirectDraw::Initialize(
HWND hwnd,
const ULONG* pulPalette,
int cx /* = 0 */,
int cy /* = 0 */
)
{
HRESULT hr = S_OK;
UINT uMsg = 0; // Message to show if FAILED(hr)
m_hwnd = hwnd;
hr = ::CoCreateInstance( CLSID_DirectDraw,
NULL,
CLSCTX_SERVER,
IID_IDirectDraw,
(void**)&m_piDD );
if ( FAILED(hr) )
{
TRACE( "CCI on DirectDraw failed, hr=%x", hr );
uMsg = IDS_NODIRECTDRAW;
goto cleanup;
}
//
// Initialize it
// This method takes the driver GUID parameter that the DirectDrawCreate
// function typically uses (NULL is active display driver)
//
hr = m_piDD->Initialize( NULL );
if ( FAILED(hr) )
{
TRACE( "DDraw::Initialize failed, hr=%x", hr );
uMsg = IDS_DD_INIT_FAILED;
goto cleanup;
}
//
// Get the best video mode for game width
//
m_sizeScreen.cx = cx;
m_sizeScreen.cy = cy;
if ( cx == 0 || cy == 0 )
{
hr = m_piDD->EnumDisplayModes( 0, NULL, this, EnumModesCallback );
if ( FAILED(hr) )
{
TRACE( "EnumDisplayModes failed" );
uMsg = IDS_DD_ENUMMODES_FAILED;
goto cleanup;
}
}
if (m_sizeScreen.cx == 0 || m_sizeScreen.cy == 0)
{
TRACE("No good video mode found");
uMsg = IDS_NO_VID_MODE;
hr = E_INVALIDARG;
goto cleanup;
}
TRACE("Video Mode Selected: %d x %d", m_sizeScreen.cx, m_sizeScreen.cy);
// compute blit offset to center image
#ifdef DOUBLE_WIDTH
m_ptBlitOffset.x = ((m_sizeScreen.cx - m_sizeSurface.cx*2) / 2);
#else
m_ptBlitOffset.x = ((m_sizeScreen.cx - m_sizeSurface.cx) / 2);
#endif
m_ptBlitOffset.y = ((m_sizeScreen.cy - m_sizeSurface.cy) / 2);
TRACE("Game dimensions: %dx%d (blit offset = %d, %d)",
m_sizeSurface.cx, m_sizeSurface.cy, m_ptBlitOffset.x, m_ptBlitOffset.y);
// Set cooperative level
hr = m_piDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
if ( FAILED(hr) )
{
TRACE( "IDD:SetCooperativeLevel failed, hr=%x", hr );
uMsg = IDS_DDSCL_FAILED;
goto cleanup;
}
hr = m_piDD->SetDisplayMode( m_sizeScreen.cx, m_sizeScreen.cy, 8 );
if ( FAILED(hr) )
{
TRACE( "IDD:SetDisplayMode failed, hr=%x", hr );
uMsg = IDS_DDSDM_FAILED;
goto cleanup;
}
hr = CreateSurfacesAndPalette();
if ( FAILED(hr) )
{
TRACE( "CreateSurfacesAndPalette failed, hr=%X", hr );
uMsg = IDS_DDCS_FAILED;
goto cleanup;
}
hr = InitPalette( pulPalette );
if ( FAILED(hr) )
{
TRACE( "InitPalette failed, hr=%X", hr );
uMsg = IDS_DDCP_FAILED;
goto cleanup;
}
m_fInitialized = TRUE;
cleanup:
if ( FAILED(hr) )
{
Cleanup();
if ( uMsg != 0 )
{
MessageBox( (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE ),
hwnd, uMsg );
}
}
return hr;
}
void CDirectDraw::Cleanup(
void
)
{
// release all of the objects
if (m_piDDSurfaceBack)
{
m_piDDSurfaceBack->Release();
m_piDDSurfaceBack = NULL;
}
if (m_piDDSurface)
{
m_piDDSurface->Release();
m_piDDSurface = NULL;
}
if (m_piDDPalette)
{
m_piDDPalette->Release();
m_piDDPalette = NULL;
}
if (m_piDD)
{
m_piDD->Release();
m_piDD = NULL;
}
m_fInitialized = FALSE;
}
HRESULT WINAPI CDirectDraw::EnumModesCallback(
LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext
)
{
CDirectDraw* pThis = (CDirectDraw*)lpContext;
DWORD dwWidthReq = pThis->m_sizeSurface.cx;
#ifdef DOUBLE_WIDTH
dwWidthReq *= 2;
#endif
DWORD dwHeightReq = pThis->m_sizeSurface.cy;
DWORD dwWidth = lpDDSurfaceDesc->dwWidth;
DWORD dwHeight = lpDDSurfaceDesc->dwHeight;
DWORD dwRGBBitCount = lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;
// must be 8 bit mode
if (dwRGBBitCount != 8)
{
return DDENUMRET_OK;
}
// TRACE( "EnumModesCallback found: %ld x %ld x %ld", dwWidth, dwHeight, dwRGBBitCount );
// must be larger then required screen size
if ( dwWidth < dwWidthReq || dwHeight < dwHeightReq )
{
return DDENUMRET_OK;
}
if ( pThis->m_sizeScreen.cx != 0 && pThis->m_sizeScreen.cy != 0 )
{
// check to see if this is better than the previous choice
if ( (dwWidth - dwWidthReq) > (pThis->m_sizeScreen.cx - dwWidthReq) )
{
return DDENUMRET_OK;
}
if ( (dwHeight - dwHeightReq) > (pThis->m_sizeScreen.cy - dwHeightReq) )
{
return DDENUMRET_OK;
}
}
// use it!
pThis->m_sizeScreen.cx = dwWidth;
pThis->m_sizeScreen.cy = dwHeight;
// TRACE( "\tEnumModesCallback likes this mode!" );
return DDENUMRET_OK;
}
HRESULT CDirectDraw::CreateSurfacesAndPalette(
void
)
{
TRACE("CDirectDraw::CreateSurfacesAndPalette");
HRESULT hr;
DDSURFACEDESC ddsd;
HDC hdc;
// Create the primary surface
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSurface, NULL);
if (FAILED(hr))
{
TRACE( "CreateSurface failed, hr=%X", hr );
return hr;
}
hr = m_piDDSurface->GetDC(&hdc);
if (hr == DD_OK)
{
::SetBkColor(hdc, RGB(0, 0, 0));
RECT rc = { 0, 0, m_sizeScreen.cx, m_sizeScreen.cy };
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
m_piDDSurface->ReleaseDC(hdc);
}
// Create the offscreen surface
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
#ifdef DOUBLE_WIDTH
ddsd.dwWidth = m_sizeSurface.cx * 2;
#else
ddsd.dwWidth = m_sizeSurface.cx;
#endif
ddsd.dwHeight = m_sizeSurface.cy;
hr = m_piDD->CreateSurface(&ddsd, &m_piDDSurfaceBack, NULL);
if (FAILED(hr))
{
TRACE( "CreateSurface failed, hr=%x", hr );
return hr;
}
// Erase the surface
hr = m_piDDSurfaceBack->GetDC(&hdc);
if (hr == DD_OK)
{
::SetBkColor(hdc, RGB(0, 0, 0));
#ifdef DOUBLE_WIDTH
m_sizeScreen.cx = m_sizeSurface.cx * 2;
m_sizeScreen.cy = m_sizeSurface.cy;
#else
m_sizeScreen.cx = m_sizeSurface.cx;
m_sizeScreen.cy = m_sizeSurface.cy;
#endif
RECT rc = { 0, 0, m_sizeScreen.cx, m_sizeScreen.cy };
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
m_piDDSurfaceBack->ReleaseDC(hdc);
}
return S_OK;
}
HRESULT CDirectDraw::InitPalette(
const ULONG* pulPalette
)
{
TRACE("CDirectDraw::InitPalette");
// Create the palette and attach it to the primary surface
PALETTEENTRY pe[256];
int i;
for ( i = 0; i < 256; ++i )
{
pe[i].peRed = (BYTE)( (pulPalette[i] & 0x00FF0000) >> 16 );
pe[i].peGreen = (BYTE)( (pulPalette[i] & 0x0000FF00) >> 8 );
pe[i].peBlue = (BYTE)( (pulPalette[i] & 0x000000FF) );
pe[i].peFlags = 0;
}
HRESULT hr = S_OK;
hr = m_piDD->CreatePalette( DDPCAPS_8BIT,
pe,
&m_piDDPalette,
NULL );
if ( FAILED(hr) )
{
TRACE( "IDD::CreatePalette failed, hr=%X", hr);
goto cleanup;
}
hr = m_piDDSurface->SetPalette( m_piDDPalette );
if ( FAILED(hr) )
{
TRACE( "SetPalette failed, hr=%x", hr );
goto cleanup;
}
cleanup:
if ( FAILED(hr) )
{
if (m_piDDPalette)
{
m_piDDPalette->Release();
m_piDDPalette = NULL;
}
}
return hr;
}
HRESULT CDirectDraw::Lock(
BYTE** ppSurface,
LONG* plPitch
)
{
if (ppSurface == NULL || plPitch == NULL)
{
return E_INVALIDARG;
}
HRESULT hr;
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
hr = m_piDDSurfaceBack->Lock(
NULL,
&ddsd,
DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,
NULL );
if (hr != S_OK)
{
TRACE("Lock failed on back surface");
return hr;
}
*ppSurface = (BYTE*)ddsd.lpSurface;
*plPitch = ddsd.lPitch;
return S_OK;
}
HRESULT CDirectDraw::Unlock(
BYTE* pSurface
)
{
if (pSurface == NULL)
{
return E_INVALIDARG;
}
return m_piDDSurfaceBack->Unlock( pSurface );
}
HRESULT CDirectDraw::BltFast(
const RECT* prc
)
{
HRESULT hr;
for ( ; ; )
{
hr = m_piDDSurface->BltFast(
m_ptBlitOffset.x,
m_ptBlitOffset.y,
m_piDDSurfaceBack,
const_cast<RECT*>( prc ),
DDBLTFAST_NOCOLORKEY );
if (hr == DD_OK)
{
break;
}
if (hr == DDERR_SURFACELOST)
{
m_piDDSurface->Restore();
m_piDDSurfaceBack->Restore();
}
else if (hr != DDERR_WASSTILLDRAWING)
{
// FATAL ERROR
TRACE("IDDS:BltFast failed, hr = %08X", hr);
return E_FAIL;
}
}
return S_OK;
}

View File

@ -0,0 +1,53 @@
//
// StellaX
// Jeff Miller 05/06/2000
//
#ifndef DIRECTDR_H
#define DIRECTDR_H
#pragma once
class CDirectDraw
{
public:
CDirectDraw( const SIZE& sizeSurface );
~CDirectDraw();
HRESULT Initialize( HWND hwnd, const ULONG* pulPalette,
int cx = 0, int cy = 0 );
HRESULT Lock( BYTE** ppSurface, LONG* lPitch );
HRESULT Unlock( BYTE* pSurface );
HRESULT BltFast( const RECT* prc );
private:
HRESULT CreateSurfacesAndPalette( void );
// param should really be a const BYTE*
HRESULT InitPalette( const ULONG* pulPalette );
void Cleanup( void );
static HRESULT WINAPI EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext);
BOOL m_fInitialized;
IDirectDraw* m_piDD;
IDirectDrawSurface* m_piDDSurface;
IDirectDrawSurface* m_piDDSurfaceBack;
IDirectDrawPalette* m_piDDPalette;
SIZE m_sizeScreen;
SIZE m_sizeSurface; // blit surface size
POINT m_ptBlitOffset;
HWND m_hwnd;
CDirectDraw( const CDirectDraw& ); // no implementation
void operator=( const CDirectDraw& ); // no implementation
};
#endif

View File

@ -0,0 +1,533 @@
//
// StellaX
// Jeff Miller 05/13/2000
//
#define DIRECTINPUT_VERSION 0x700
#include "pch.hxx"
#include "DirectInput.hxx"
#include "resource.h"
//
// CDirectInput
//
CDirectInput::CDirectInput(HWND hwnd, DWORD dwDevType, int nButtonCount)
: m_hwnd( hwnd )
, m_piDID(NULL)
, m_piDI(NULL)
, m_dwDevType(dwDevType)
, m_nButtonCount(nButtonCount)
, m_pButtons(NULL)
, m_lX(0)
, m_lY(0)
, m_fInitialized( FALSE )
{
TRACE("CDirectInput::CDirectInput");
}
CDirectInput::~CDirectInput(
)
{
TRACE("CDirectInput::~CDirectInput");
Cleanup();
}
HRESULT CDirectInput::Initialize(
void
)
{
TRACE("CDirectInput::Initialize");
HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( m_hwnd, GWL_HINSTANCE );
if ( m_fInitialized )
{
return S_OK;
}
if ( m_hwnd == NULL )
{
// This is for CDisabledJoystick
return S_OK;
}
HRESULT hr = S_OK;
UINT uMsg = 0; // if ( FAILED(hr) )
hr = ::CoCreateInstance( CLSID_DirectInput,
NULL,
CLSCTX_SERVER,
IID_IDirectInput,
(void**)&m_piDI );
if ( FAILED(hr) )
{
TRACE( "WARNING: CCI on DirectInput failed, error=%X", hr );
//
// Note -- I don't fail here so that machines with NT4 (which doesn't
// have DirectX 5.0) don't fail
//
// For this to work, Update() must begin with
// if (GetDevice() == NULL) { return E_FAIL; }
//
// uMsg = IDS_NODIRECTINPUT;
hr = S_FALSE;
goto cleanup;
}
//
// Initialize it
//
hr = m_piDI->Initialize( hInstance, DIRECTINPUT_VERSION );
if ( FAILED(hr) )
{
TRACE("IDI::Initialize failed");
uMsg = IDS_DI_INIT_FAILED;
goto cleanup;
}
//
// enumerate to find proper device
// The callback will set m_piDID
//
TRACE("\tCalling EnumDevices");
hr = m_piDI->EnumDevices( m_dwDevType,
EnumDevicesProc,
this,
DIEDFL_ATTACHEDONLY );
if ( m_piDID )
{
TRACE("\tGot a device!");
(void)m_piDID->SetCooperativeLevel( m_hwnd,
DISCL_NONEXCLUSIVE
| DISCL_FOREGROUND);
hr = GetDevice()->Acquire();
if ( hr == DIERR_OTHERAPPHASPRIO )
{
return S_FALSE;
}
}
m_pButtons = new BYTE[GetButtonCount()];
if ( m_pButtons == NULL )
{
hr = E_OUTOFMEMORY;
goto cleanup;
}
m_fInitialized = TRUE;
cleanup:
if ( FAILED(hr) )
{
Cleanup();
if ( uMsg != 0 )
{
MessageBox( hInstance, m_hwnd, uMsg );
}
}
return hr;
}
void CDirectInput::Cleanup(
void
)
{
TRACE("CDirectInput::Cleanup");
delete[] m_pButtons;
if (m_piDID)
{
m_piDID->Unacquire();
m_piDID->Release();
m_piDID = NULL;
}
if (m_piDI)
{
m_piDI->Release();
m_piDI = NULL;
}
m_fInitialized = FALSE;
}
BOOL CALLBACK CDirectInput::EnumDevicesProc
(
const DIDEVICEINSTANCE* lpddi,
LPVOID pvRef
)
{
CDirectInput* pThis = (CDirectInput*)pvRef;
ASSERT(pThis);
const DIDATAFORMAT* pdidf = NULL;
switch(pThis->m_dwDevType)
{
case DIDEVTYPE_MOUSE:
TRACE("EnumDevicesProc (mouse)");
pdidf = &c_dfDIMouse;
break;
case DIDEVTYPE_KEYBOARD:
TRACE("EnumDevicesProc (keyboard)");
pdidf = &c_dfDIKeyboard;
break;
case DIDEVTYPE_JOYSTICK:
TRACE("EnumDevicesProc (joystick)");
pdidf = &c_dfDIJoystick;
break;
default:
ASSERT(FALSE);
return DIENUM_STOP;
};
HRESULT hr;
IDirectInputDevice* piDID;
hr = pThis->m_piDI->CreateDevice(lpddi->guidInstance, &piDID,
NULL);
ASSERT(hr == DI_OK && "IDI::CreateDevice failed");
if (hr != DI_OK)
{
return DIENUM_CONTINUE;
}
hr = piDID->SetDataFormat(pdidf);
ASSERT(hr == DI_OK && "IDID::SetDataFormat failed");
if (hr != DI_OK)
{
piDID->Release();
return DIENUM_CONTINUE;
}
hr = piDID->QueryInterface(IID_IDirectInputDevice2,
(void**)&(pThis->m_piDID));
if (hr != S_OK)
{
piDID->Release();
return DIENUM_CONTINUE;
}
// undo the addref that QI did (CreateDevice did an addref)
pThis->m_piDID->Release();
#ifdef _DEBUG
DIDEVICEINSTANCE didi;
didi.dwSize = sizeof(didi);
piDID->GetDeviceInfo(&didi);
TRACE("Using device: %s", didi.tszProductName);
#endif
return DIENUM_STOP;
}
BOOL CDirectInput::IsButtonPressed
(
int nButton
) const
{
if ( nButton > GetButtonCount() )
{
return FALSE;
}
return ( m_pButtons[nButton] ) ? 1 : 0;
}
// ---------------------------------------------------------------------------
CDirectKeyboard::CDirectKeyboard(
HWND hwnd
) : \
CDirectInput( hwnd, DIDEVTYPE_KEYBOARD, 256 )
{
TRACE( "CDirectKeyboard::CDirectKeyboard" );
}
HRESULT CDirectKeyboard::Update(
void
)
{
if ( GetDevice() == NULL )
{
return E_FAIL;
}
HRESULT hr;
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( GetButtonCount(), m_pButtons );
if ( hr == DIERR_INPUTLOST ||
hr == DIERR_NOTACQUIRED )
{
hr = GetDevice()->Acquire();
if ( hr == DIERR_OTHERAPPHASPRIO )
{
return S_FALSE;
}
TRACE( "Acquire = %X", hr );
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( GetButtonCount(), m_pButtons );
}
ASSERT(hr == S_OK && "Keyboard GetDeviceState failed");
return hr;
}
// ---------------------------------------------------------------------------
CDirectJoystick::CDirectJoystick(
HWND hwnd
) : \
CDirectInput( hwnd, DIDEVTYPE_JOYSTICK, 32 )
{
TRACE( "CDirectJoystick::CDirectJoystick" );
}
HRESULT CDirectJoystick::Initialize(
void
)
{
TRACE( "CDirectJoystick::Initialize" );
HRESULT hr;
hr = CDirectInput::Initialize();
if ( FAILED(hr) )
{
return hr;
}
if ( GetDevice() == NULL )
{
TRACE("No joystick was found");
return S_FALSE;
}
// set X-axis range to (-1000 ... +1000)
// This lets us test against 0 to see which way the stick is pointed.
DIPROPRANGE dipr;
dipr.diph.dwSize = sizeof(dipr);
dipr.diph.dwHeaderSize = sizeof(dipr.diph);
dipr.diph.dwHow = DIPH_BYOFFSET;
dipr.lMin = -1000;
dipr.lMax = +1000;
dipr.diph.dwObj = DIJOFS_X;
hr = GetDevice()->SetProperty( DIPROP_RANGE, &dipr.diph );
if ( FAILED(hr) )
{
TRACE( "SetProperty(DIPROP_RANGE,x) failed, hr=%X", hr );
return hr;
}
// And again for Y-axis range
dipr.diph.dwSize = sizeof(dipr);
dipr.diph.dwHeaderSize = sizeof(dipr.diph);
dipr.diph.dwHow = DIPH_BYOFFSET;
dipr.lMin = -1000;
dipr.lMax = +1000;
dipr.diph.dwObj = DIJOFS_Y;
hr = GetDevice()->SetProperty( DIPROP_RANGE, &dipr.diph );
if ( FAILED(hr) )
{
TRACE( "SetProperty(DIPROP_RANGE,y) failed, hr=%X", hr );
return hr;
}
// set dead zone to 50%
DIPROPDWORD dipdw;
dipdw.diph.dwSize = sizeof(dipdw);
dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
dipdw.diph.dwHow = DIPH_BYOFFSET;
dipdw.dwData = 5000;
dipdw.diph.dwObj = DIJOFS_X;
hr = GetDevice()->SetProperty( DIPROP_DEADZONE, &dipdw.diph );
if ( FAILED(hr) )
{
TRACE( "SetProperty(DIPROP_DEADZONE,x) failed, hr=%X", hr );
return hr;
}
dipdw.diph.dwSize = sizeof(dipdw);
dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
dipdw.diph.dwHow = DIPH_BYOFFSET;
dipdw.dwData = 5000;
dipdw.diph.dwObj = DIJOFS_Y;
hr = GetDevice()->SetProperty( DIPROP_DEADZONE, &dipdw.diph );
if ( FAILED(hr) )
{
TRACE( "SetProperty(DIPROP_DEADZONE,y) failed, hr=%X", hr );
return hr;
}
return S_OK;
}
HRESULT CDirectJoystick::Update(
void
)
{
if ( GetDevice() == NULL )
{
return E_FAIL;
}
HRESULT hr;
DIJOYSTATE dijs;
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( sizeof(dijs), &dijs );
if ( hr == DIERR_INPUTLOST ||
hr == DIERR_NOTACQUIRED )
{
hr = GetDevice()->Acquire();
if ( hr == DIERR_OTHERAPPHASPRIO )
{
return S_FALSE;
}
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( sizeof(dijs), &dijs );
}
ASSERT(hr == DI_OK && "Joystick GetDeviceState failed");
if ( hr == DI_OK )
{
m_lX = dijs.lX;
m_lY = dijs.lY;
memcpy( m_pButtons,
dijs.rgbButtons,
sizeof(dijs.rgbButtons) );
}
return hr;
}
// ---------------------------------------------------------------------------
CDisabledJoystick::CDisabledJoystick(
HWND hwnd
) : \
CDirectInput( NULL, 0, 0 )
{
UNUSED_ALWAYS( hwnd );
TRACE( "CDisabledJoystick::CDisabledJoystick" );
}
HRESULT CDisabledJoystick::Update(
void
)
{
return S_FALSE;
}
// ---------------------------------------------------------------------------
CDirectMouse::CDirectMouse(
HWND hwnd
) : \
CDirectInput( hwnd, DIDEVTYPE_MOUSE, 4 )
{
TRACE( "CDirectMouse::CDirectMouse" );
}
HRESULT CDirectMouse::Update(
void
)
{
if (GetDevice() == NULL)
{
return E_FAIL;
}
HRESULT hr;
DIMOUSESTATE dims;
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( sizeof(dims), &dims );
if ( hr == DIERR_INPUTLOST ||
hr == DIERR_NOTACQUIRED )
{
hr = GetDevice()->Acquire();
if ( hr == DIERR_OTHERAPPHASPRIO )
{
return S_FALSE;
}
GetDevice()->Poll();
hr = GetDevice()->GetDeviceState( sizeof(dims), &dims );
}
ASSERT( hr == DI_OK && "Mouse GetDeviceState failed" );
if ( hr == DI_OK )
{
// Because the mouse is returning relative positions,
// force X and Y to go between 0 ... 999
m_lX += dims.lX;
if (m_lX < 0)
{
m_lX = 0;
}
else if (m_lX > 999)
{
m_lX = 999;
}
m_lY += dims.lY;
if (m_lY < 0)
{
m_lY = 0;
}
else if (m_lY > 999)
{
m_lY = 999;
}
memcpy( m_pButtons,
dims.rgbButtons,
sizeof(dims.rgbButtons) );
}
return hr;
}

View File

@ -0,0 +1,158 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef DIRECTIN_H
#define DIRECTIN_H
class CDirectInput
{
public:
CDirectInput( HWND hwnd, DWORD dwDevType, int nButtonCount );
virtual ~CDirectInput( );
virtual HRESULT Initialize( void );
virtual HRESULT Update( void ) = 0;
void GetPos( LONG* pX, LONG* pY ) const;
virtual BOOL IsButtonPressed( int nButton ) const;
virtual int GetButtonCount( void ) const;
// I need IDID2 for the Poll method
IDirectInputDevice2* GetDevice( void ) const;
protected:
LONG m_lX;
LONG m_lY;
BYTE* m_pButtons;
private:
void Cleanup();
static BOOL CALLBACK EnumDevicesProc( const DIDEVICEINSTANCE* lpddi,
LPVOID pvRef );
IDirectInput* m_piDI;
HWND m_hwnd;
IDirectInputDevice2* m_piDID;
DWORD m_dwDevType;
const int m_nButtonCount;
BOOL m_fInitialized;
CDirectInput( const CDirectInput& ); // no implementation
void operator=( const CDirectInput& ); // no implementation
};
inline int CDirectInput::GetButtonCount(
void
) const
{
return m_nButtonCount;
}
inline IDirectInputDevice2* CDirectInput::GetDevice(
void
) const
{
// 060499: Dont assert here, as it's okay if a device isn't available
// (client must check for NULL return)
return m_piDID;
}
inline void CDirectInput::GetPos(
LONG* pX,
LONG* pY
) const
{
if (pX != NULL)
{
*pX = m_lX;
}
if (pY != NULL)
{
*pY = m_lY;
}
}
// ---------------------------------------------------------------------------
class CDirectMouse : public CDirectInput
{
public:
CDirectMouse( HWND hwnd );
HRESULT Update( void );
private:
CDirectMouse( const CDirectMouse& ); // no implementation
void operator=( const CDirectMouse& ); // no implementation
};
// ---------------------------------------------------------------------------
class CDirectJoystick : public CDirectInput
{
public:
CDirectJoystick( HWND hwnd );
HRESULT Initialize( void );
HRESULT Update( void );
private:
CDirectJoystick( const CDirectJoystick& ); // no implementation
void operator=( const CDirectJoystick& ); // no implementation
};
class CDisabledJoystick : public CDirectInput
{
public:
CDisabledJoystick( HWND hwnd );
HRESULT Update( void );
private:
CDisabledJoystick( const CDisabledJoystick& ); // no implementation
void operator=( const CDisabledJoystick& ); // no implementation
};
// ---------------------------------------------------------------------------
class CDirectKeyboard : public CDirectInput
{
public:
CDirectKeyboard( HWND hwnd );
HRESULT Update( void );
private:
CDirectKeyboard( const CDirectKeyboard& ); // no implementation
void operator=( const CDirectKeyboard& ); // no implementation
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#ifndef DXFS_H
#define DXFS_H
#pragma once
class Console;
class MediaSource;
class CDirectInput;
#include "Event.hxx"
#include "GlobalData.hxx"
class CDirectXFullScreen
{
public:
CDirectXFullScreen( const CGlobalData* rGlobalData,
const Console* pConsole,
Event& rEvent );
~CDirectXFullScreen();
HRESULT Initialize( int cx = 0, int cy = 0 );
DWORD Run();
operator HWND( void ) const
{
return m_hwnd;
}
private:
BOOL m_fInitialized;
static LRESULT CALLBACK StaticWindowProc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam );
BOOL WndProc( UINT uMsg, WPARAM wParam, LPARAM lParam );
static HRESULT WINAPI EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext);
void Cleanup();
void UpdateEvents();
BOOL UpdateDisplay( MediaSource& rMediaSource );
HWND m_hwnd;
BOOL m_fActiveWindow;
RECT m_rectScreen;
POINT m_ptBlitOffset;
// Stella objects
const Console* m_pConsole;
Event& m_rEvent;
const CGlobalData* m_rGlobalData;
SIZE m_sizeGame;
BYTE m_rgbPixelDataTable[256];
//
// DirectX
//
IDirectDraw* m_piDD;
IDirectDrawSurface* m_piDDSPrimary;
IDirectDrawSurface* m_piDDSBack;
IDirectDrawPalette* m_piDDPalette;
CDirectInput* m_pDirectMouse;
CDirectInput* m_pDirectJoystick;
CDirectInput* m_pDirectKeyboard;
static LPCTSTR pszClassName;
CDirectXFullScreen( const CDirectXFullScreen& ); // no implementation
void operator=( const CDirectXFullScreen& ); // no implementation
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
//
// StellaX
// Jeff Miller 05/15/2000
//
#ifndef DXWIN_H
#define DXWIN_H
#pragma once
class Console;
class MediaSource;
class CDirectInput;
#include "Event.hxx"
#include "GlobalData.hxx"
class CDirectXWindow
{
public:
CDirectXWindow( const CGlobalData* rGlobalData,
const Console* pConsole,
Event& rEvent );
~CDirectXWindow();
HRESULT Initialize( HWND hwndParent, LPCSTR pszTitle );
DWORD Run();
operator HWND( void ) const { return m_hwnd; }
private:
void ReleaseAllObjects( void );
HRESULT InitSurfaces( void );
HRESULT ChangeCoopLevel( void );
HWND m_hwnd;
BOOL m_fReady;
BOOL m_fWindowed;
BOOL m_fActive;
RECT m_rcWindow;
RECT m_rcScreen;
IDirectDraw* m_piDD;
IDirectDrawSurface* m_piDDSPrimary;
IDirectDrawSurface* m_piDDSBack;
SIZE m_sizeFS;
static HRESULT WINAPI EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext);
static LRESULT CALLBACK StaticWindowProc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam );
BOOL WndProc( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult );
void UpdateEvents();
BOOL UpdateDisplay( MediaSource& rMediaSource );
PALETTEENTRY m_rgpe[256];
// Stella objects
const Console* m_pConsole;
Event& m_rEvent;
const CGlobalData* m_rGlobalData;
SIZE m_sizeGame;
BYTE m_rgbPixelDataTable[256];
//
// DirectX
//
IDirectDrawPalette* m_piDDPalette;
CDirectInput* m_pDirectMouse;
CDirectInput* m_pDirectJoystick;
CDirectInput* m_pDirectKeyboard;
static LPCTSTR pszClassName;
CDirectXWindow( const CDirectXWindow& ); // no implementation
void operator=( const CDirectXWindow& ); // no implementation
};
#endif

View File

@ -0,0 +1,31 @@
//
// StellaX
// Jeff Miller 05/06/2000
//
#include "pch.hxx"
#include "GlobalData.hxx"
#include "resource.h"
CGlobalData::CGlobalData(HINSTANCE hInstance)
: instance(hInstance)
,bIsModified(FALSE)
,rs("GlobalData")
{
rs.Bind(romDir, "rom dir", "ROMS");
rs.Bind(desiredFrameRate, "desired frame rate", 60);
rs.Bind(bShowFPS, "Show FPS", false);
rs.Bind(bNoSound, "No Sound", false);
rs.Bind(bAutoSelectVideoMode, "Autoselect Video Mode", true);
rs.Bind(iPaddleMode, "Paddle Mode", 0);
rs.Bind(bJoystickIsDisabled, "Joystick Is Disabled", false);
if (desiredFrameRate < 1 || desiredFrameRate > 300)
{
desiredFrameRate = 60;
}
if (iPaddleMode<0 || iPaddleMode>3)
{
iPaddleMode = 0;
}
}

View File

@ -0,0 +1,78 @@
//
// StellaX
// Jeff Miller 05/06/2000
//
#ifndef GLOBALS_H
#define GLOBALS_H
#pragma once
#include "Event.hxx"
#include "CRegBinding.h"
class CGlobalData
{
public:
CGlobalData(HINSTANCE hInstance);
~CGlobalData() {}
Event::Type PaddleResistanceEvent( void ) const;
Event::Type PaddleFireEvent( void ) const;
// Data Members in Registry
CString romDir;
int iPaddleMode;
BOOL bNoSound;
BOOL bJoystickIsDisabled;
BOOL bAutoSelectVideoMode;
BOOL bShowFPS;
int desiredFrameRate;
// Data Members not in Registry
HINSTANCE instance;
BOOL bIsModified;
// Regbinding
CRegBinding rs;
};
inline Event::Type CGlobalData::PaddleResistanceEvent(
void
) const
{
switch (iPaddleMode)
{
case 1:
return Event::PaddleOneResistance;
case 2:
return Event::PaddleTwoResistance;
case 3:
return Event::PaddleThreeResistance;
}
return Event::PaddleZeroResistance;
}
inline Event::Type CGlobalData::PaddleFireEvent(
void
) const
{
switch (iPaddleMode)
{
case 1:
return Event::PaddleOneFire;
case 2:
return Event::PaddleTwoFire;
case 3:
return Event::PaddleThreeFire;
}
return Event::PaddleZeroFire;
}
#endif

View File

@ -0,0 +1,428 @@
// HyperLink.cpp : implementation file
//
// HyperLink static control. Will open the default browser with the given URL
// when the user clicks on the link.
//
// Copyright (C) 1997, 1998 Chris Maunder (chrismaunder@codeguru.com)
// All rights reserved. May not be sold for profit.
//
// Thanks to Pål K. Tønder for auto-size and window caption changes.
//
// "GotoURL" function by Stuart Patterson
// As seen in the August, 1997 Windows Developer's Journal.
// Copyright 1997 by Miller Freeman, Inc. All rights reserved.
// Modified by Chris Maunder to use TCHARs instead of chars.
//
// "Default hand cursor" from Paul DiLascia's Jan 1998 MSJ article.
//
#include "pch.hxx"
#include "HyperLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TOOLTIP_ID 1
/////////////////////////////////////////////////////////////////////////////
// CHyperLink
CHyperLink::CHyperLink()
{
m_hLinkCursor = NULL; // No cursor as yet
m_crLinkColour = RGB( 0, 0, 238); // Blue
m_crVisitedColour = RGB( 85, 26, 139); // Purple
m_crHoverColour = ::GetSysColor(COLOR_HIGHLIGHT);
m_bOverControl = FALSE; // Cursor not yet over control
m_bVisited = FALSE; // Hasn't been visited yet.
m_bUnderline = TRUE; // Underline the link?
m_bAdjustToFit = TRUE; // Resize the window to fit the text?
m_strURL.Empty();
}
CHyperLink::~CHyperLink()
{
m_Font.DeleteObject();
}
BEGIN_MESSAGE_MAP(CHyperLink, CStatic)
//{{AFX_MSG_MAP(CHyperLink)
ON_CONTROL_REFLECT(STN_CLICKED, OnClicked)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SETCURSOR()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHyperLink message handlers
BOOL CHyperLink::PreTranslateMessage(MSG* pMsg)
{
m_ToolTip.RelayEvent(pMsg);
return CStatic::PreTranslateMessage(pMsg);
}
void CHyperLink::OnClicked()
{
int result = (int)GotoURL(m_strURL, SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited) {
MessageBeep(MB_ICONEXCLAMATION); // Unable to follow link
ReportError(result);
} else
SetVisited(); // Repaint to show visited colour
}
HBRUSH CHyperLink::CtlColor(CDC* pDC, UINT nCtlColor)
{
ASSERT(nCtlColor == CTLCOLOR_STATIC);
if (m_bOverControl)
pDC->SetTextColor(m_crHoverColour);
else if (m_bVisited)
pDC->SetTextColor(m_crVisitedColour);
else
pDC->SetTextColor(m_crLinkColour);
// transparent text.
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
void CHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
CStatic::OnMouseMove(nFlags, point);
if (m_bOverControl) // Cursor is currently over control
{
CRect rect;
GetClientRect(rect);
if (!rect.PtInRect(point))
{
m_bOverControl = FALSE;
ReleaseCapture();
RedrawWindow();
return;
}
}
else // Cursor has just moved over control
{
m_bOverControl = TRUE;
RedrawWindow();
SetCapture();
}
}
BOOL CHyperLink::OnSetCursor(CWnd* /*pWnd*/, UINT /*nHitTest*/, UINT /*message*/)
{
if (m_hLinkCursor)
{
::SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
void CHyperLink::PreSubclassWindow()
{
// We want to get mouse clicks via STN_CLICKED
DWORD dwStyle = GetStyle();
::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
// Set the URL as the window text
if (m_strURL.IsEmpty())
GetWindowText(m_strURL);
// Check that the window text isn't empty. If it is, set it as the URL.
CString strWndText;
GetWindowText(strWndText);
if (strWndText.IsEmpty()) {
ASSERT(!m_strURL.IsEmpty()); // Window and URL both NULL. DUH!
SetWindowText(m_strURL);
}
// Create the font
LOGFONT lf;
GetFont()->GetLogFont(&lf);
lf.lfUnderline = m_bUnderline;
m_Font.CreateFontIndirect(&lf);
SetFont(&m_Font);
PositionWindow(); // Adjust size of window to fit URL if necessary
SetDefaultCursor(); // Try and load up a "hand" cursor
// Create the tooltip
CRect rect;
GetClientRect(rect);
m_ToolTip.Create(this);
m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
CStatic::PreSubclassWindow();
}
/////////////////////////////////////////////////////////////////////////////
// CHyperLink operations
void CHyperLink::SetURL(CString strURL)
{
m_strURL = strURL;
if (::IsWindow(GetSafeHwnd())) {
PositionWindow();
m_ToolTip.UpdateTipText(strURL, this, TOOLTIP_ID);
}
}
CString CHyperLink::GetURL() const
{
return m_strURL;
}
void CHyperLink::SetColours(COLORREF crLinkColour, COLORREF crVisitedColour,
COLORREF crHoverColour /* = -1 */)
{
m_crLinkColour = crLinkColour;
m_crVisitedColour = crVisitedColour;
if (crHoverColour == -1)
m_crHoverColour = ::GetSysColor(COLOR_HIGHLIGHT);
else
m_crHoverColour = crHoverColour;
if (::IsWindow(m_hWnd))
Invalidate();
}
COLORREF CHyperLink::GetLinkColour() const
{
return m_crLinkColour;
}
COLORREF CHyperLink::GetVisitedColour() const
{
return m_crVisitedColour;
}
COLORREF CHyperLink::GetHoverColour() const
{
return m_crHoverColour;
}
void CHyperLink::SetVisited(BOOL bVisited /* = TRUE */)
{
m_bVisited = bVisited;
if (::IsWindow(GetSafeHwnd()))
Invalidate();
}
BOOL CHyperLink::GetVisited() const
{
return m_bVisited;
}
void CHyperLink::SetLinkCursor(HCURSOR hCursor)
{
m_hLinkCursor = hCursor;
if (m_hLinkCursor == NULL)
SetDefaultCursor();
}
HCURSOR CHyperLink::GetLinkCursor() const
{
return m_hLinkCursor;
}
void CHyperLink::SetUnderline(BOOL bUnderline /* = TRUE */)
{
m_bUnderline = bUnderline;
if (::IsWindow(GetSafeHwnd()))
{
LOGFONT lf;
GetFont()->GetLogFont(&lf);
lf.lfUnderline = m_bUnderline;
m_Font.DeleteObject();
m_Font.CreateFontIndirect(&lf);
SetFont(&m_Font);
Invalidate();
}
}
BOOL CHyperLink::GetUnderline() const
{
return m_bUnderline;
}
void CHyperLink::SetAutoSize(BOOL bAutoSize /* = TRUE */)
{
m_bAdjustToFit = bAutoSize;
if (::IsWindow(GetSafeHwnd()))
PositionWindow();
}
BOOL CHyperLink::GetAutoSize() const
{
return m_bAdjustToFit;
}
// Move and resize the window so that the window is the same size
// as the hyperlink text. This stops the hyperlink cursor being active
// when it is not directly over the text. If the text is left justified
// then the window is merely shrunk, but if it is centred or right
// justified then the window will have to be moved as well.
//
// Suggested by Pål K. Tønder
void CHyperLink::PositionWindow()
{
if (!::IsWindow(GetSafeHwnd()) || !m_bAdjustToFit)
return;
// Get the current window position
CRect rect;
GetWindowRect(rect);
CWnd* pParent = GetParent();
if (pParent)
pParent->ScreenToClient(rect);
// Get the size of the window text
CString strWndText;
GetWindowText(strWndText);
CDC* pDC = GetDC();
CFont* pOldFont = pDC->SelectObject(&m_Font);
CSize Extent = pDC->GetTextExtent(strWndText);
pDC->SelectObject(pOldFont);
ReleaseDC(pDC);
// Get the text justification via the window style
DWORD dwStyle = GetStyle();
// Recalc the window size and position based on the text justification
if (dwStyle & SS_CENTERIMAGE)
rect.DeflateRect(0, (rect.Height() - Extent.cy)/2);
else
rect.bottom = rect.top + Extent.cy;
if (dwStyle & SS_CENTER)
rect.DeflateRect((rect.Width() - Extent.cx)/2, 0);
else if (dwStyle & SS_RIGHT)
rect.left = rect.right - Extent.cx;
else // SS_LEFT = 0, so we can't test for it explicitly
rect.right = rect.left + Extent.cx;
// Move the window
SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
}
/////////////////////////////////////////////////////////////////////////////
// CHyperLink implementation
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor()
{
if (m_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
CString strWndDir;
GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
strWndDir.ReleaseBuffer();
strWndDir += _T("\\winhlp32.exe");
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(strWndDir);
if (hModule) {
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if (hHandCursor)
m_hLinkCursor = CopyCursor(hHandCursor);
}
FreeLibrary(hModule);
}
}
LONG CHyperLink::GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
{
HKEY hkey;
LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if (retval == ERROR_SUCCESS) {
long datasize = MAX_PATH;
TCHAR data[MAX_PATH];
RegQueryValue(hkey, NULL, data, &datasize);
lstrcpy(retdata,data);
RegCloseKey(hkey);
}
return retval;
}
void CHyperLink::ReportError(int nError)
{
CString str;
switch (nError) {
case 0: str = "The operating system is out\nof memory or resources."; break;
case SE_ERR_PNF: str = "The specified path was not found."; break;
case SE_ERR_FNF: str = "The specified file was not found."; break;
case ERROR_BAD_FORMAT: str = "The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."; break;
case SE_ERR_ACCESSDENIED: str = "The operating system denied\naccess to the specified file."; break;
case SE_ERR_ASSOCINCOMPLETE: str = "The filename association is\nincomplete or invalid."; break;
case SE_ERR_DDEBUSY: str = "The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."; break;
case SE_ERR_DDEFAIL: str = "The DDE transaction failed."; break;
case SE_ERR_DDETIMEOUT: str = "The DDE transaction could not\nbe completed because the request timed out."; break;
case SE_ERR_DLLNOTFOUND: str = "The specified dynamic-link library was not found."; break;
case SE_ERR_NOASSOC: str = "There is no application associated\nwith the given filename extension."; break;
case SE_ERR_OOM: str = "There was not enough memory to complete the operation."; break;
case SE_ERR_SHARE: str = "A sharing violation occurred. ";
default: str.Format("Unknown Error (%d) occurred.", nError); break;
}
str = "Unable to open hyperlink:\n\n" + str;
AfxMessageBox(str, MB_ICONEXCLAMATION | MB_OK);
}
HINSTANCE CHyperLink::GotoURL(LPCTSTR url, int showcmd)
{
TCHAR key[MAX_PATH + MAX_PATH];
// First try ShellExecute()
HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL,NULL, showcmd);
// If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR) {
if (GetRegKey(HKEY_CLASSES_ROOT, _T(".htm"), key) == ERROR_SUCCESS) {
lstrcat(key, _T("\\shell\\open\\command"));
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {
TCHAR *pos;
pos = _tcsstr(key, _T("\"%1\""));
if (pos == NULL) { // No quotes found
pos = strstr(key, _T("%1")); // Check for %1, without quotes
if (pos == NULL) // No parameter at all...
pos = key+lstrlen(key)-1;
else
*pos = '\0'; // Remove the parameter
}
else
*pos = '\0'; // Remove the parameter
lstrcat(pos, _T(" "));
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key,showcmd);
}
}
}
return result;
}

View File

@ -0,0 +1,100 @@
// HyperLink.h : header file
//
//
// HyperLink static control. Will open the default browser with the given URL
// when the user clicks on the link.
//
// Copyright Chris Maunder, 1997, 1998
// Feel free to use and distribute. May not be sold for profit.
#if !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)
#define AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// CHyperLink window
class CHyperLink : public CStatic
{
// Construction/destruction
public:
CHyperLink();
virtual ~CHyperLink();
// Attributes
public:
// Operations
public:
void SetURL(CString strURL);
CString GetURL() const;
void SetColours(COLORREF crLinkColour, COLORREF crVisitedColour,
COLORREF crHoverColour = -1);
COLORREF GetLinkColour() const;
COLORREF GetVisitedColour() const;
COLORREF GetHoverColour() const;
void SetVisited(BOOL bVisited = TRUE);
BOOL GetVisited() const;
void SetLinkCursor(HCURSOR hCursor);
HCURSOR GetLinkCursor() const;
void SetUnderline(BOOL bUnderline = TRUE);
BOOL GetUnderline() const;
void SetAutoSize(BOOL bAutoSize = TRUE);
BOOL GetAutoSize() const;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHyperLink)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
protected:
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
void ReportError(int nError);
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void PositionWindow();
void SetDefaultCursor();
// Protected attributes
protected:
COLORREF m_crLinkColour, m_crVisitedColour; // Hyperlink colours
COLORREF m_crHoverColour; // Hover colour
BOOL m_bOverControl; // cursor over control?
BOOL m_bVisited; // Has it been visited?
BOOL m_bUnderline; // underline hyperlink?
BOOL m_bAdjustToFit; // Adjust window size to fit text?
CString m_strURL; // hyperlink URL
CFont m_Font; // Underline font if necessary
HCURSOR m_hLinkCursor; // Cursor for hyperlink
CToolTipCtrl m_ToolTip; // The tooltip
// Generated message map functions
protected:
//{{AFX_MSG(CHyperLink)
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
afx_msg void OnClicked();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)

View File

@ -0,0 +1,6 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#include "pch.hxx"
#include "ListData.hxx"

View File

@ -0,0 +1,157 @@
//
// StellaX
// Jeff Miller 05/10/2000
//
#ifndef MAINDLG_H
#define MAINDLG_H
#pragma once
#include "resource.h"
#include "pch.hxx"
#include "StellaXMain.hxx"
class CMainDlg;
class CListData
{
friend CMainDlg;
public:
CListData() :
m_fPopulated( FALSE )
{
}
DWORD Initialize()
{
//
// ListView control doesn't like NULLs returned, so initialize all
//
if ( ! m_strName.Set( _T("") ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! m_strManufacturer.Set( _T("") ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! m_strRarity.Set( _T("") ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! m_strFileName.Set( _T("") ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
if ( ! m_strNote.Set( _T("") ) )
{
return ERROR_NOT_ENOUGH_MEMORY;
}
return ERROR_SUCCESS;
}
static int GetColumnCount( void )
{
return 4;
}
enum ColumnIndex
{
FILENAME_COLUMN,
NAME_COLUMN,
MANUFACTURER_COLUMN,
RARITY_COLUMN,
};
static UINT GetColumnNameIdForColumn( int nCol )
{
UINT uID = 0;
switch ( nCol )
{
case NAME_COLUMN:
uID = IDS_NAME;
break;
case MANUFACTURER_COLUMN:
uID = IDS_MANUFACTURER;
break;
case RARITY_COLUMN:
uID = IDS_RARITY;
break;
case FILENAME_COLUMN:
uID = IDS_FILENAME;
break;
default:
ASSERT(FALSE);
break;
}
return uID;
}
LPCTSTR GetTextForColumn( int nCol ) const
{
LPCTSTR pszText = NULL;
switch (nCol)
{
case NAME_COLUMN:
pszText = m_strName.Get();
break;
case MANUFACTURER_COLUMN:
pszText = m_strManufacturer.Get();
break;
case RARITY_COLUMN:
pszText = m_strRarity.Get();
break;
case FILENAME_COLUMN:
pszText = m_strFileName.Get();
break;
default:
ASSERT( FALSE );
break;
}
return pszText;
}
LPCTSTR GetNote( void ) const
{
return m_strNote.Get();
}
BOOL IsPopulated( void ) const
{
return m_fPopulated;
}
CSimpleString m_strName;
CSimpleString m_strManufacturer;
CSimpleString m_strRarity;
CSimpleString m_strFileName;
CSimpleString m_strNote;
BOOL m_fPopulated;
private:
CListData( const CListData& ); // no implementation
void operator=( const CListData& ); // no implementation
};
#endif

View File

@ -0,0 +1,101 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG

View File

@ -0,0 +1,56 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__7FB621FA_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_MAINFRM_H__7FB621FA_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__7FB621FA_3CB8_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1 @@
Cyberstella V1.0 by Manuel Polik

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,173 @@
//
// StellaX
// Jeff Miller 04/26/2000
//
#include "pch.hxx"
#include "SoundWin32.hxx"
#include "resource.h"
#include "AudioStream.hxx"
SoundWin32::SoundWin32(
) :
m_fInitialized( FALSE ),
m_pass( NULL ),
m_pasCurrent( NULL )
{
TRACE("SoundWin32::SoundWin32");
}
HRESULT SoundWin32::Initialize(
HWND hwnd
)
{
TRACE( "SoundWin32::Initialize hwnd=%08X", hwnd );
if ( m_fInitialized )
{
TRACE( "SoundWin32::Initialize - already initialized" );
return S_OK;
}
HRESULT hr = S_OK;
m_pass = new AudioStreamServices;
if ( m_pass == NULL )
{
hr = E_OUTOFMEMORY;
goto cleanup;
}
if ( ! m_pass->Initialize( hwnd ) )
{
TRACE( "ASS Initialize failed" );
MessageBox( (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE ),
hwnd,
IDS_ASS_FAILED );
hr = E_FAIL;
goto cleanup;
}
m_pasCurrent = new AudioStream;
if ( m_pasCurrent == NULL )
{
hr = E_OUTOFMEMORY;
goto cleanup;
}
if ( ! m_pasCurrent->Create( m_pass ) )
{
TRACE( "PAS Create failed" );
MessageBox( (HINSTANCE)::GetWindowLong( hwnd, GWL_HINSTANCE ),
hwnd,
IDS_PAS_FAILED );
hr = E_FAIL;
goto cleanup;
}
m_pasCurrent->Play();
m_fInitialized = TRUE;
cleanup:
if ( FAILED(hr) )
{
if ( m_pasCurrent )
{
m_pasCurrent->Destroy();
delete m_pasCurrent;
m_pasCurrent = NULL;
}
if ( m_pass )
{
delete m_pass;
m_pass = NULL;
}
}
return hr;
}
SoundWin32::~SoundWin32(
)
{
TRACE("SoundWin32::~SoundWin32");
if ( m_pasCurrent )
{
m_pasCurrent->Destroy();
delete m_pasCurrent;
m_pasCurrent = NULL;
}
delete m_pass;
m_pass = NULL;
}
void SoundWin32::set(Sound::Register reg, uInt8 value)
{
if ( ! m_fInitialized )
{
TRACE( "SoundWin32::set -- not initialized" );
return;
}
//
// Process TIA data
//
switch( reg )
{
case AUDC0:
Update_tia_sound( 0x15, value );
break;
case AUDC1:
Update_tia_sound( 0x16, value );
break;
case AUDF0:
Update_tia_sound( 0x17, value );
break;
case AUDF1:
Update_tia_sound( 0x18, value );
break;
case AUDV0:
Update_tia_sound( 0x19, value );
break;
case AUDV1:
Update_tia_sound( 0x1A, value );
break;
}
}
void SoundWin32::mute(
bool mute
)
{
if ( ! m_fInitialized )
{
TRACE( "SoundWin32::mute -- not initialized" );
return;
}
if ( m_pasCurrent )
{
if ( mute )
{
m_pasCurrent->Stop();
}
else
{
m_pasCurrent->Play();
}
}
}

View File

@ -0,0 +1,109 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef SNDWIN32_H
#define SNDWIN32_H
#include "bspf.hxx"
#include "Sound.hxx"
#include "TIASound.h"
class AudioStreamServices;
class AudioStream;
#define SAMPLES_PER_SEC 22050
#define NUM_CHANNELS 1
#define BITS_PER_SAMPLE 8
class WaveFile
{
public:
WaveFile( void )
{
ZeroMemory( &wfx, sizeof(wfx) );
wfx.cbSize = sizeof( wfx );
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = NUM_CHANNELS;
wfx.nSamplesPerSec = SAMPLES_PER_SEC;
wfx.wBitsPerSample = BITS_PER_SAMPLE;
wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
}
~WaveFile( void )
{
}
BOOL Open( void )
{
Tia_sound_init( 31400, wfx.nSamplesPerSec );
return TRUE;
}
BOOL Cue( void )
{
return TRUE;
}
void Read( BYTE* pbDest, UINT cbSize )
{
Tia_process ( pbDest, cbSize );
}
UINT GetAvgDataRate (void)
{
return wfx.nAvgBytesPerSec;
}
BYTE GetSilenceData (void)
{
return 0;
}
WAVEFORMATEX* GetWaveFormatEx( void )
{
return &wfx;
}
private:
WAVEFORMATEX wfx;
WaveFile( const WaveFile& ); // no implementation
void operator=( const WaveFile& ); // no implementation
};
class SoundWin32 : public Sound
{
public:
SoundWin32();
virtual ~SoundWin32();
HRESULT Initialize( HWND hwnd );
//
// base class virtuals
//
virtual void set(Sound::Register reg, uInt8 value);
virtual void mute( bool state );
private:
BOOL m_fInitialized;
AudioStreamServices* m_pass;
AudioStream* m_pasCurrent;
SoundWin32( const SoundWin32& ); // no implementation
void operator=( const SoundWin32& ); // no implementation
};
#endif

View File

@ -0,0 +1,121 @@
// StellaConfig.cpp : implementation file
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "StellaConfig.h"
#include "BrowseForFolder.hxx"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// StellaConfig dialog
StellaConfig::StellaConfig(CGlobalData* rGlobalData, CWnd* pParent /*=NULL*/)
: CDialog(StellaConfig::IDD, pParent)
,m_pGlobalData(rGlobalData)
{
//{{AFX_DATA_INIT(StellaConfig)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void StellaConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(StellaConfig)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(StellaConfig, CDialog)
//{{AFX_MSG_MAP(StellaConfig)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// StellaConfig message handlers
BOOL StellaConfig::OnInitDialog()
{
CDialog::OnInitDialog();
int i;
// Set up ROMPATH
((CEdit*)GetDlgItem(IDC_ROMPATH))->SetLimitText(MAX_PATH);
((CEdit*)GetDlgItem(IDC_ROMPATH))->SetWindowText(m_pGlobalData->romDir);
// Set up PADDLE
CString paddle = "Paddle%d";
for (i=0; i<4; i++)
{
paddle.Format("Paddle %d",i);
((CComboBox*)GetDlgItem(IDC_PADDLE))->AddString(paddle);
}
((CComboBox*)GetDlgItem(IDC_PADDLE))->SetCurSel(m_pGlobalData->iPaddleMode);
// Set up SOUND
((CButton*)GetDlgItem(IDC_SOUND))->SetCheck(m_pGlobalData->bNoSound ? BST_CHECKED : BST_UNCHECKED);
// Set up AutoSelectVideoMode
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck(m_pGlobalData->bAutoSelectVideoMode ? BST_CHECKED : BST_UNCHECKED);
// Set up JOYSTICK
((CButton*)GetDlgItem(IDC_JOYSTICK))->SetCheck(m_pGlobalData->bJoystickIsDisabled ? BST_CHECKED : BST_UNCHECKED);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void StellaConfig::OnClose()
{
retrieveData();
CDialog::OnClose();
}
BOOL StellaConfig::DestroyWindow()
{
retrieveData();
return CDialog::DestroyWindow();
}
void StellaConfig::retrieveData()
{
// Apply changes
((CEdit*)GetDlgItem(IDC_ROMPATH))->GetWindowText(m_pGlobalData->romDir);
m_pGlobalData->iPaddleMode = ((CComboBox*)GetDlgItem(IDC_PADDLE))->GetCurSel();
m_pGlobalData->bNoSound = ((CButton*)GetDlgItem(IDC_SOUND))->GetCheck();
m_pGlobalData->bAutoSelectVideoMode = ((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->GetCheck();
m_pGlobalData->bJoystickIsDisabled = ((CButton*)GetDlgItem(IDC_JOYSTICK))->GetCheck();
// Set modify flag
m_pGlobalData->bIsModified = true;
}
void StellaConfig::OnBrowse()
{
CBrowseForFolder bff;
bff.SetFlags(BIF_RETURNONLYFSDIRS);
if (bff.SelectFolder())
{
((CEdit*)GetDlgItem(IDC_ROMPATH))->SetWindowText(bff.GetSelectedFolder());
}
// Set Focus to Continue Button
((CWnd*)GetDlgItem(IDC_CONTINUE))->SetFocus();
}
void StellaConfig::OnContinue()
{
EndDialog(1);
}

View File

@ -0,0 +1,56 @@
#if !defined(AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_)
#define AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GlobalData.hxx"
/////////////////////////////////////////////////////////////////////////////
// StellaConfig dialog
class StellaConfig : public CDialog
{
// Construction
public:
StellaConfig(CGlobalData* rGlobalData, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(StellaConfig)
enum { IDD = IDD_CONFIG_PAGE };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(StellaConfig)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(StellaConfig)
virtual BOOL OnInitDialog();
afx_msg void OnClose();
afx_msg void OnBrowse();
afx_msg void OnContinue();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
// member
CGlobalData* m_pGlobalData;
//method
void retrieveData();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STELLACONFIG_H__EECE0DA1_3FFF_11D6_ACFC_0048546D2F04__INCLUDED_)

View File

@ -0,0 +1,379 @@
//
// 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

@ -0,0 +1,41 @@
//
// 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

View File

@ -0,0 +1,89 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "Timer.hxx"
CMmTimer::CMmTimer(
void
) :
m_mmrIDTimer( NULL )
{
TRACE( "CMmTimer::CMmTimer" );
}
CMmTimer::~CMmTimer(
void
)
{
TRACE( "CMmTimer::~CMmTimer" );
if ( m_mmrIDTimer != NULL )
{
::timeKillEvent( m_mmrIDTimer );
m_mmrIDTimer = NULL;
}
}
BOOL CMmTimer::Create(
UINT nPeriod,
UINT nRes,
DWORD dwUser,
TIMERCALLBACK pfnCallback
)
{
BOOL fRet = TRUE;
TRACE( "CMmTimer::Create" );
ASSERT( pfnCallback != NULL );
ASSERT( nPeriod > 10 );
ASSERT( nPeriod >= nRes );
m_nPeriod = nPeriod;
m_nRes = nRes;
m_dwUser = dwUser;
m_pfnCallback = pfnCallback;
m_mmrIDTimer = ::timeSetEvent( m_nPeriod,
m_nRes,
TimeProc,
(DWORD)this,
TIME_PERIODIC );
if ( m_mmrIDTimer == NULL )
{
fRet = FALSE;
}
return fRet;
}
// Timer proc for multimedia timer callback set with timeSetTime().
//
// Calls procedure specified when Timer object was created. The
// dwUser parameter contains "this" pointer for associated Timer object.
//
void CALLBACK CMmTimer::TimeProc(
UINT uID,
UINT uMsg,
DWORD dwUser,
DWORD dw1,
DWORD dw2
)
{
// dwUser contains ptr to Timer object
CMmTimer* pThis = (CMmTimer*)dwUser;
ASSERT( pThis != NULL );
// Call user-specified callback and pass back user specified data
ASSERT( pThis->m_pfnCallback != NULL );
pThis->m_pfnCallback( pThis->m_dwUser );
}

View File

@ -0,0 +1,46 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef TIMER_H
#define TIMER_H
// Constants
typedef BOOL ( * TIMERCALLBACK )( DWORD );
// Classes
// Timer
//
// Wrapper class for Windows multimedia timer services. Provides
// both periodic and one-shot events. User must supply callback
// for periodic events.
//
class CMmTimer
{
public:
CMmTimer( void );
~CMmTimer( void );
BOOL Create( UINT nPeriod, UINT nRes, DWORD dwUser, TIMERCALLBACK pfnCallback );
protected:
static void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 );
TIMERCALLBACK m_pfnCallback;
DWORD m_dwUser;
UINT m_nPeriod;
UINT m_nRes;
MMRESULT m_mmrIDTimer;
private:
CMmTimer( const CMmTimer& ); // no implementation
void operator=( const CMmTimer& ); // no implementation
};
#endif

View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Cyberstella"=.\Cyberstella.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1,88 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include <stdio.h>
#include <stdarg.h>
#include "resource.h"
// This will force in the DirectX library
#pragma comment( lib, "dxguid" )
// Bring in DirectInput library (for c_dfDIMouse, etc)
#pragma comment( lib, "dinput" )
// Bring in the common control library
#pragma comment( lib, "comctl32" )
// Bring in multimedia timers
#pragma comment( lib, "winmm" )
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
)
{
const int nMaxStrLen = 1024;
TCHAR tszCaption[nMaxStrLen + 1] = { 0 };
TCHAR tszText[nMaxStrLen + 1] = { 0 };
// Caption is always "StellaX"
LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
LoadString(hInstance, uIDText, tszText, nMaxStrLen);
if (hwndParent == NULL)
{
hwndParent = ::GetForegroundWindow();
}
::MessageBox(hwndParent, tszText, tszCaption, MB_ICONWARNING | MB_OK);
}
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
)
{
const int nMaxStrLen = 1024;
TCHAR pszCaptionStellaX[nMaxStrLen + 1];
if ( pszCaption == NULL )
{
// LoadString(hInstance, IDS_STELLA, tszCaption, nMaxStrLen);
lstrcpy( pszCaptionStellaX, _T("StellaX") );
}
LPTSTR pszText = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&pszText,
0,
NULL);
::MessageBox(::GetForegroundWindow(), pszText,
pszCaption ? pszCaption : pszCaptionStellaX, MB_ICONWARNING | MB_OK);
::LocalFree( pszText );
}
void MessageBoxFromGetLastError(
LPCTSTR pszCaption /* = NULL */
)
{
MessageBoxFromWinError( GetLastError(), pszCaption );
}

View File

@ -0,0 +1,147 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef __PCH_H__
#define __PCH_H__
#pragma once
#ifndef _WIN32
#error This file can only be compiled for a Win32 platform
#endif
#define WIN32_LEAN_AND_MEAN
//#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
// warning C4201: nonstandard extension used : nameless struct/union
#pragma warning ( once: 4201 )
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <ddraw.h>
#include <dsound.h>
#include <dinput.h>
#define _countof(array) (sizeof(array)/sizeof(array[0]))
// ---------------------------------------------------------------------------
// Conditional defines
#define DOUBLE_WIDTH
//
// Macros
//
#ifdef _DEBUG
#define UNUSED(x)
#else
#define UNUSED(x) x
#endif
#define UNUSED_ALWAYS(x) x
//
// Simple string class
//
class CSimpleString
{
public:
CSimpleString() :
m_psz( NULL ),
m_cch( -1 )
{
}
~CSimpleString()
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
}
BOOL Set( LPCTSTR psz )
{
int cch = lstrlen( psz );
if ( cch > m_cch )
{
delete[] m_psz;
m_psz = NULL;
m_cch = -1;
m_psz = new TCHAR[ cch + 1 ];
if ( m_psz == NULL )
{
return FALSE;
}
m_cch = cch;
}
memcpy( m_psz, psz, ( cch + 1 ) * sizeof( TCHAR ) );
return TRUE;
}
LPCTSTR Get( void ) const
{
ASSERT( m_psz != NULL );
return m_psz;
}
int Length( void ) const
{
return m_cch;
}
private:
//
// The string and its size (-1 means not initialized)
//
LPTSTR m_psz;
int m_cch;
CSimpleString( const CSimpleString& ); // no implementation
void operator=( const CSimpleString& ); // no implementation
};
//
// Utility methods
//
void MessageBox(
HINSTANCE hInstance,
HWND hwndParent,
UINT uIDText
);
void MessageBoxFromWinError(
DWORD dwError,
LPCTSTR pszCaption /* = NULL */
);
void MessageBoxFromGetLastError(
LPCTSTR pszCaption /* = NULL */
);
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,13 @@
//
// CYBERSTELLA.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,66 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Cyberstella.rc
//
#define IDD_ABOUTBOX 100
#define IDD_CYBERSTELLA_FORM 101
#define IDD_CONFIG_PAGE 108
#define IDR_MAINFRAME 128
#define IDR_CYBERSTYPE 129
#define IDS_ALREADYRUNNING 200
#define IDS_BADARGUMENT 201
#define IDS_CW_FAILED 208
#define IDS_DDCP_FAILED 224
#define IDS_DDCS_FAILED 240
#define IDS_DDSCL_FAILED 256
#define IDS_DDSDM_FAILED 272
#define IDS_DSCSBFAILED 273
#define IDS_DSSCLFAILED 274
#define IDS_FILEFILTER 276
#define IDS_FILENAME 277
#define IDS_MANUFACTURER 278
#define IDS_MIKE 279
#define IDS_NAME 280
#define IDS_NODIRECTDRAW 281
#define IDS_RARITY 284
#define IDS_STATUSTEXT 289
#define IDS_STELLA 290
#define IDS_NODIRECTINPUT 293
#define IDS_CANTSTARTCONSOLE 295
#define IDS_COINIT_FAILED 296
#define IDS_ASS_FAILED 297
#define IDS_PAS_FAILED 298
#define IDS_DD_INIT_FAILED 300
#define IDS_DD_ENUMMODES_FAILED 301
#define IDS_NO_VID_MODE 302
#define IDS_DI_INIT_FAILED 303
#define IDS_ROM_LOAD_FAILED 304
#define IDS_NO_ITEM_SELECTED 305
#define IDC_CONTINUE 1000
#define IDC_EMAIL_JEFFMILL 1002
#define IDC_EMAIL_STELLA 1003
#define IDC_PLAY 1005
#define IDC_ROMCOUNT 1006
#define IDC_ROMLIST 1007
#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
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif