Removed the old Windows frontend code. Most of it has serious bit-rot

anyway, and some of it has been in an uncompilable state for almost
4 years!

All future Windows development will be on the StellaX GUI, and even
that may eventually disappear if the same functionality is integrated
into Stella itself.

So, for any Windows developers reading this, all Win32 development
occurs in the src/win32 directory.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@303 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2004-07-11 21:55:32 +00:00
parent 1859b80f16
commit eda901519b
118 changed files with 0 additions and 35129 deletions

View File

@ -1,69 +0,0 @@
// AboutDlg.cpp : implementation file
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "AboutDlg.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_MAINTAINER, this);
m_hlMail_JSM.SetURL( _T("mailto:stephena@users.sourceforge.net?Subject=Cyberstella") );
m_hlWWW_JSM.SubclassDlgItem(IDC_WEB_MAINTAINER, this);
m_hlWWW_JSM.SetURL( _T("http://www.cs.mun.ca/~stephena") );
m_hlMail_Stella.SubclassDlgItem(IDC_EMAIL_STELLA, this);
m_hlMail_Stella.SetURL( _T("mailto:stella-main@lists.sourceforge.net") );
m_hlWWW_Stella.SubclassDlgItem(IDC_WEB_STELLA, this);
m_hlWWW_Stella.SetURL( _T("http://stella.sourceforge.net") );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View File

@ -1,57 +0,0 @@
#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

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

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

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

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

@ -1,123 +0,0 @@
// 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)
//}}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
void CCyberstellaApp::OnViewToolbar()
{
// TODO: Add your command handler code here
}

View File

@ -1,677 +0,0 @@
# 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 Ignore_Export_Lib 0
# 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 "..\..\games" /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" /D DIRECTINPUT_VERSION=0x0800 /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 dxguid.lib ddraw.lib dsound.lib /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 Ignore_Export_Lib 0
# 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 "..\..\games" /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" /D DIRECTINPUT_VERSION=0x0800 /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 dxguid.lib ddraw.lib dsound.lib /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=.\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=.\GameList.cpp
# 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=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\pch.cxx
# End Source File
# Begin Source File
SOURCE=.\SettingsWin32.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=.\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=.\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=.\GameList.h
# 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=.\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=.\SettingsWin32.hxx
# 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=.\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.rc2
# End Source File
# Begin Source File
SOURCE=.\res\Dir.ico
# End Source File
# Begin Source File
SOURCE=.\res\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\CartF4.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\CartF4.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\Deserializer.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Deserializer.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\EventHandler.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\EventHandler.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\Serializer.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Serializer.hxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Settings.cxx
# End Source File
# Begin Source File
SOURCE=..\..\emucore\Settings.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\StellaEvent.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
# Begin Source File
SOURCE=..\..\emucore\TIASound.c
# End Source File
# Begin Source File
SOURCE=..\..\emucore\TIASound.h
# 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 Source File
SOURCE=..\..\emucore\m6502\src\bspf\src\bspf.hxx
# End Source File
# Begin Source File
SOURCE=..\..\..\CyberstellaTodo.txt
# End Source File
# End Target
# End Project

View File

@ -1,48 +0,0 @@
// 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();
afx_msg void OnViewToolbar();
//}}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

@ -1,505 +0,0 @@
// Microsoft Visual C++ 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
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
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
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_FOLDER ICON "res\\DIR.ICO"
#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 "res\\STELLA.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR 16, 15
BEGIN
BUTTON ID_APP_ABOUT
BUTTON IDC_PLAY
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Play", IDC_PLAY
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "&Configuration"
BEGIN
MENUITEM "&Cyberstella", IDC_CONFIG
END
POPUP "&Help"
BEGIN
MENUITEM "&About Cyberstella...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS
BEGIN
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CYBERSTELLA_FORM DIALOGEX 0, 0, 409, 169
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
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 | WS_BORDER |
WS_TABSTOP,7,19,395,143,WS_EX_CLIENTEDGE
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
END
IDD_ABOUTBOX DIALOGEX 0, 0, 322, 138
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Information"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "You must own legal copies of all ROM images you are using. The Stella team cannot 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,21,295,26,SS_NOPREFIX
LTEXT "If you have a question or a problem with Cyberstella, please try one of these contacts:",
-1,7,58,308,8,SS_NOPREFIX
LTEXT "Stephen Anthony",-1,7,76,62,8,SS_NOPREFIX
LTEXT "stephena@users.sourceforge.net",IDC_EMAIL_MAINTAINER,73,
76,103,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "http://www.cs.mun.ca/~stephena",IDC_WEB_MAINTAINER,188,
76,112,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "Stella dev team:",-1,7,89,52,8,SS_NOPREFIX
LTEXT "stella-main@lists.sourceforge.net",IDC_EMAIL_STELLA,73,
89,105,8,SS_NOPREFIX | SS_NOTIFY
LTEXT "http://stella.sourceforge.net",IDC_WEB_STELLA,188,89,93,
8,SS_NOPREFIX | SS_NOTIFY
LTEXT "Cyberstella v1.4 is GPL software.",-1,7,7,308,9,
SS_NOPREFIX
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,50,299,1
PUSHBUTTON "&Continue",IDC_CONTINUE,129,117,60,14,BS_CENTER
END
IDD_CONFIG_PAGE DIALOG 0, 0, 390, 112
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cyberstella Configuration"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Mouse should emulate &paddle:",-1,7,10,97,8
COMBOBOX IDC_PADDLE,109,7,48,82,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,27,374,1
CONTROL "&Auto select video mode",IDC_AUTO_SELECT_VIDEOMODE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,90,10
LTEXT "If this is not checked, then a standard video mode (640x480) will be used. Otherwise, Cyberstella will use the video mode which it believes will work best. You should only uncheck this if you are having video problems while running Cyberstella.",
-1,7,45,376,18
CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,69,373,1
CONTROL "Disable &Sound",IDC_SOUND,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,7,77,62,10
CONTROL "Disable &Joysticks",IDC_JOYSTICK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,96,70,10
PUSHBUTTON "&Continue",IDC_CONTINUE,265,92,118,14
END
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Cyberstella MFC Application"
VALUE "FileVersion", "1.4"
VALUE "InternalName", "Cyberstella"
VALUE "LegalCopyright", "Copyright (C) 2003"
VALUE "OriginalFilename", "Cyberstella.EXE"
VALUE "ProductName", "Cyberstella Application"
VALUE "ProductVersion", "1.4"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_CYBERSTELLA_FORM, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 402
TOPMARGIN, 7
BOTTOMMARGIN, 162
END
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 315
TOPMARGIN, 7
BOTTOMMARGIN, 131
END
IDD_CONFIG_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 383
TOPMARGIN, 7
BOTTOMMARGIN, 106
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDR_MAINFRAME "Cyberstella\n\nCybers\n\n\nCyberstella.Document\nCybers Document"
END
STRINGTABLE
BEGIN
AFX_IDS_APP_TITLE "Cyberstella"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE
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
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
BEGIN
IDC_PLAY "Play the currently selected Game\nPlay"
END
STRINGTABLE
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
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
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
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE
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
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
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
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE
BEGIN
IDS_ALREADYRUNNING "StellaX is already running!"
IDS_BADARGUMENT "Unknown argument given on command line"
END
STRINGTABLE
BEGIN
IDS_CW_FAILED "CreateWindow failed"
END
STRINGTABLE
BEGIN
IDS_DDCP_FAILED "IDirectDraw::CreatePalette failed"
END
STRINGTABLE
BEGIN
IDS_DDCS_FAILED "IDirectDraw::CreateSurface failed"
END
STRINGTABLE
BEGIN
IDS_DDSCL_FAILED "IDirectDraw::SetCooperativeLevel failed"
END
STRINGTABLE
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_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_FILE "File"
IDS_RARITY "Rarity"
END
STRINGTABLE
BEGIN
IDS_STATUSTEXT "%d files found"
IDS_STELLA "StellaX"
IDS_NOTETEXT "Note: %s"
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
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

File diff suppressed because it is too large Load Diff

View File

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

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

@ -1,310 +0,0 @@
// CyberstellaView.cpp : implementation of the CCyberstellaView class
//
#include "pch.hxx"
#include "Cyberstella.h"
#include "MainFrm.h"
#include "CyberstellaDoc.h"
#include "CyberstellaView.h"
#include "StellaConfig.h"
#include "Console.hxx"
#include "MainWin32.hxx"
#include "SoundWin32.hxx"
#include "SettingsWin32.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)
ON_WM_DESTROY()
ON_WM_SIZE()
ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos)
ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote)
ON_MESSAGE(MSG_VIEW_INITIALIZE, initialize)
// }}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCyberstellaView construction/destruction
CCyberstellaView::CCyberstellaView()
: CFormView(CCyberstellaView::IDD)
{
// Create SettingsWin32 object
// This should be done before any other xxxWin32 objects are created
theSettings = new SettingsWin32();
theSettings->loadConfig();
// Create a properties set for us to use
thePropertiesSet = new PropertiesSet();
// Try to load the file stella.pro file
string filename(theSettings->userPropertiesFilename());
// 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();
thePropertiesSet->load(filename, &Console::defaultProperties());
}
else
{
thePropertiesSet->load("", &Console::defaultProperties());
MessageBox("stella.pro not found in working directory!", "Warning!", MB_OK|MB_ICONEXCLAMATION);
}
}
CCyberstellaView::~CCyberstellaView()
{
if(thePropertiesSet)
delete thePropertiesSet;
if(theSettings)
{
theSettings->saveConfig();
delete theSettings;
}
}
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
// {{AFX_DATA_MAP(CCyberstellaView)
DDX_Control(pDX, IDC_ROMLIST, myGameList);
// }}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(FALSE);
ResizeParentToFit();
// Init ListControl, parse stella.pro
PostMessage(MSG_VIEW_INITIALIZE);
}
void CCyberstellaView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// FIXME - this is a horrible way to do it, since the fonts may change
// There should be a way to do percentage resize (or at least figure
// out how big the current font is)
if(IsWindow(myGameList.m_hWnd))
myGameList.SetWindowPos(NULL, 10, 35, cx-20, cy-45, SWP_NOZORDER);
}
/////////////////////////////////////////////////////////////////////////////
// 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
void CCyberstellaView::OnConfig()
{
StellaConfig dlg(theSettings);
dlg.DoModal();
}
void CCyberstellaView::OnPlay()
{
playRom();
}
LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
{
// Set up the image list.
HICON hFolder, hAtari;
m_imglist.Create( 16, 16, ILC_COLOR16 | ILC_MASK, 4, 1 );
hFolder = reinterpret_cast<HICON>(
::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_FOLDER),
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));
hAtari = reinterpret_cast<HICON>(
::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));
m_imglist.Add (hFolder);
m_imglist.Add (hAtari);
myGameList.SetImageList (&m_imglist, LVSIL_SMALL);
// Init ListCtrl
myGameList.init(thePropertiesSet, theSettings, this);
myGameList.populateRomList();
return 0;
}
void CCyberstellaView::OnDestroy()
{
CFormView::OnDestroy();
myGameList.deleteItemsAndProperties();
}
LRESULT CCyberstellaView::updateListInfos(WPARAM wParam, LPARAM lParam)
{
// Show status text
CString status;
status.Format(IDS_STATUSTEXT, myGameList.getRomCount());
SetDlgItemText(IDC_ROMCOUNT,status);
// Show rom path
SetDlgItemText(IDC_ROMPATH, myGameList.getPath());
return 0;
}
LRESULT CCyberstellaView::displayNote(WPARAM wParam, LPARAM lParam)
{
// Show rom path
CString note;
note.Format(IDS_NOTETEXT, myGameList.getCurrentNote());
((CMainFrame*)AfxGetMainWnd())->setStatusText(note);
return 0;
}
void CCyberstellaView::playRom(LONG gameID)
{
EnableWindow(FALSE);
CString fileName;
BYTE* pImage = NULL;
LPCTSTR pszFileName = NULL;
DWORD dwImageSize;
DWORD dwActualSize;
fileName = myGameList.getCurrentFile();
if(fileName.GetLength() <= 0)
return;
// Load the rom file
HANDLE hFile;
hFile = ::CreateFile( fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if(hFile == INVALID_HANDLE_VALUE)
{
DWORD dwLastError = ::GetLastError();
TCHAR pszCurrentDirectory[ MAX_PATH + 1 ];
::GetCurrentDirectory( MAX_PATH, pszCurrentDirectory );
// ::MessageBoxFromGetLastError( pszPathName );
TCHAR pszFormat[ 1024 ];
LoadString(GetModuleHandle(NULL), 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,
fileName,
dwLastError,
pszLastError );
::MessageBox( *this,
pszError,
_T("Error"),
MB_OK | MB_ICONEXCLAMATION );
::LocalFree( pszLastError );
return;
}
dwImageSize = ::GetFileSize( hFile, NULL );
pImage = new BYTE[dwImageSize + 1];
if(pImage == NULL)
return;
if ( ! ::ReadFile( hFile, pImage, dwImageSize, &dwActualSize, NULL ) )
{
VERIFY( ::CloseHandle( hFile ) );
MessageBoxFromGetLastError(fileName);
delete pImage;
return;
}
VERIFY( ::CloseHandle(hFile) );
// get just the filename
pszFileName = _tcsrchr( fileName, _T('\\') );
if ( pszFileName )
{
++pszFileName;
}
else
{
pszFileName = fileName;
}
::ShowWindow( *this, SW_HIDE );
// Create a new main instance for this cartridge
MainWin32* mainWin32 = new MainWin32(pImage, dwActualSize, pszFileName,
*theSettings, *thePropertiesSet);
// And start the main emulation loop
mainWin32->run();
::ShowWindow( *this, SW_SHOW );
ShowCursor(TRUE);
delete pImage;
delete mainWin32;
EnableWindow(TRUE);
// Set focus back to the rom list
myGameList.SetFocus();
}

View File

@ -1,89 +0,0 @@
// 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 "PropsSet.hxx"
#include "SettingsWin32.hxx"
#include "GameList.h"
class CCyberstellaView : public CFormView
{
protected: // create from serialization only
CCyberstellaView();
DECLARE_DYNCREATE(CCyberstellaView)
public:
// {{AFX_DATA(CCyberstellaView)
enum { IDD = IDD_CYBERSTELLA_FORM };
GameList myGameList;
// }}AFX_DATA
// Attributes
public:
CCyberstellaDoc* GetDocument();
CImageList m_imglist;
// 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
virtual void OnSize(UINT nType, int cx, int cy);
// }}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 void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void playRom(LONG gameID = NULL);
LRESULT initialize(WPARAM wParam, LPARAM lParam);
LRESULT displayNote(WPARAM wParam, LPARAM lParam);
LRESULT updateListInfos(WPARAM wParam, LPARAM lParam);
// members
PropertiesSet* thePropertiesSet;
SettingsWin32* theSettings;
};
#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

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

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

@ -1,306 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DirectInput.cxx,v 1.6 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "resource.h"
#include "DirectInput.hxx"
DirectInput::DirectInput(bool disablejoystick)
: myHWND(NULL),
mylpdi(NULL),
myKeyboard(NULL),
myMouse(NULL),
myJoystickCount(0),
myDisableJoystick(disablejoystick)
{
for(uInt32 i = 0; i < 8; i++)
myJoystick[i] = NULL;
}
DirectInput::~DirectInput()
{
cleanup();
}
bool DirectInput::initialize(HWND hwnd)
{
// FIXME - this should move to the constructor
if(FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION,
IID_IDirectInput8, (void**)&mylpdi, NULL)))
return false;
// We use buffered mode whenever possible, since it is more
// efficient than constantly getting a full state snapshot
// and analyzing it for state changes
// Initialize the keyboard
if(FAILED(mylpdi->CreateDevice(GUID_SysKeyboard, &myKeyboard, NULL)))
return false;
if(FAILED(myKeyboard->SetDataFormat(&c_dfDIKeyboard)))
return false;
if(FAILED(myKeyboard->SetCooperativeLevel(hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE)))
return false;
DIPROPDWORD k_dipdw;
k_dipdw.diph.dwSize = sizeof(DIPROPDWORD);
k_dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
k_dipdw.diph.dwObj = 0;
k_dipdw.diph.dwHow = DIPH_DEVICE;
k_dipdw.dwData = 64;
if(FAILED(myKeyboard->SetProperty(DIPROP_BUFFERSIZE, &k_dipdw.diph)))
return false;
if(FAILED(myKeyboard->Acquire()))
return false;
// Initialize the mouse
if(FAILED(mylpdi->CreateDevice(GUID_SysMouse, &myMouse, NULL)))
return false;
if(FAILED(myMouse->SetDataFormat(&c_dfDIMouse2)))
return false;
if(FAILED(myMouse->SetCooperativeLevel(hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE)))
return false; // DISCL_FOREGROUND | DISCL_EXCLUSIVE
DIPROPDWORD m_dipdw;
m_dipdw.diph.dwSize = sizeof(DIPROPDWORD);
m_dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
m_dipdw.diph.dwObj = 0;
m_dipdw.diph.dwHow = DIPH_DEVICE;
m_dipdw.dwData = 64;
if(FAILED(myMouse->SetProperty(DIPROP_BUFFERSIZE, &m_dipdw.diph)))
return false;
if(FAILED(myMouse->Acquire()))
return false;
// Don't go any further if using joysticks has been disabled
if(myDisableJoystick)
return true;
// Initialize all joysticks
// Since a joystick isn't absolutely required, we won't return
// false if there are none found
if(FAILED(mylpdi->EnumDevices(DI8DEVCLASS_GAMECTRL,
EnumJoysticksCallback,
this, DIEDFL_ATTACHEDONLY)))
return true;
for(uInt32 i = 0; i < myJoystickCount; i++)
{
LPDIRECTINPUTDEVICE8 joystick = myJoystick[i];
if(FAILED(joystick->SetDataFormat(&c_dfDIJoystick2 )))
return true;
if(FAILED(joystick->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND)))
return true;
// Set the size of the buffer for buffered data
DIPROPDWORD j_dipdw;
j_dipdw.diph.dwSize = sizeof(DIPROPDWORD);
j_dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
j_dipdw.diph.dwObj = 0;
j_dipdw.diph.dwHow = DIPH_DEVICE;
j_dipdw.dwData = 64;
joystick->SetProperty(DIPROP_BUFFERSIZE, &j_dipdw.diph);
// Set X-axis range to (-1000 ... +1000)
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;
joystick->SetProperty(DIPROP_RANGE, &dipr.diph);
// 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;
joystick->SetProperty(DIPROP_RANGE, &dipr.diph);
// 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;
joystick->SetProperty(DIPROP_DEADZONE, &dipdw.diph);
dipdw.diph.dwSize = sizeof(dipdw);
dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
dipdw.diph.dwHow = DIPH_BYOFFSET;
dipdw.dwData = 5000;
dipdw.diph.dwObj = DIJOFS_Y;
joystick->SetProperty(DIPROP_DEADZONE, &dipdw.diph);
joystick->Acquire();
}
return true;
}
bool DirectInput::getKeyEvents(DIDEVICEOBJECTDATA* keyEvents,
DWORD* numKeyEvents)
{
HRESULT hr;
// Make sure the keyboard has been initialized
if(myKeyboard == NULL)
return false;
// Check for keyboard events
hr = myKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
keyEvents, numKeyEvents, 0 );
if(hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
{
hr = myKeyboard->Acquire();
if(hr == DIERR_OTHERAPPHASPRIO)
return false;
hr = myKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
keyEvents, numKeyEvents, 0 );
}
return true;
}
bool DirectInput::getMouseEvents(DIDEVICEOBJECTDATA* mouseEvents,
DWORD* numMouseEvents)
{
HRESULT hr;
// Make sure the mouse has been initialized
if(myMouse == NULL)
return false;
// Check for mouse events
hr = myMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
mouseEvents, numMouseEvents, 0 );
if(hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
{
hr = myMouse->Acquire();
if(hr == DIERR_OTHERAPPHASPRIO)
return false;
hr = myMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
mouseEvents, numMouseEvents, 0 );
}
return true;
}
bool DirectInput::getJoystickEvents(uInt32 stick, DIDEVICEOBJECTDATA* joyEvents,
DWORD* numJoyEvents)
{
LPDIRECTINPUTDEVICE8 joystick;
// Make sure the joystick exists and has been initialized
if(stick >= 0 && stick <= 8)
{
joystick = myJoystick[stick];
if(joystick == NULL)
return false;
}
else
return false;
// Check for joystick events
joystick->Poll();
HRESULT hr = joystick->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
joyEvents, numJoyEvents, 0 );
if(hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
{
hr = joystick->Acquire();
if(hr == DIERR_OTHERAPPHASPRIO)
return false;
joystick->Poll();
hr = joystick->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),
joyEvents, numJoyEvents, 0 );
}
return true;
}
void DirectInput::cleanup()
{
for(uInt32 i = 0; i < myJoystickCount; i++)
{
if(myJoystick[i])
{
myJoystick[i]->Unacquire();
myJoystick[i]->Release();
myJoystick[i] = NULL;
}
}
if(myMouse)
{
myMouse->Unacquire();
myMouse->Release();
myMouse = NULL;
}
if(myKeyboard)
{
myKeyboard->Unacquire();
myKeyboard->Release();
myKeyboard = NULL;
}
if(mylpdi)
{
mylpdi->Release();
mylpdi = NULL;
}
}
BOOL CALLBACK DirectInput::EnumJoysticksCallback(
const DIDEVICEINSTANCE* inst,
LPVOID pvRef)
{
DirectInput* pThis = (DirectInput*) pvRef;
if(!pThis)
return DIENUM_STOP;
// If we can't store any more joysticks, then stop enumeration.
// The limit is set to 8, since the Stella eventhandler core
// can use up to 8 joysticks.
if(pThis->myJoystickCount > 8)
return DIENUM_STOP;
// Obtain an interface to the enumerated joystick.
HRESULT hr = pThis->mylpdi->CreateDevice(inst->guidInstance,
(LPDIRECTINPUTDEVICE8*) &pThis->myJoystick[pThis->myJoystickCount], NULL );
// Indicate that we've found one more joystick
if(!FAILED(hr))
pThis->myJoystickCount++;
// And continue enumeration for more joysticks
return DIENUM_CONTINUE;
}

View File

@ -1,60 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DirectInput.hxx,v 1.7 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#ifndef DIRECT_INPUT_HXX
#define DIRECT_INPUT_HXX
#define DIRECTINPUT_VERSION 0x0800
#include "bspf.hxx"
#include "dinput.h"
class DirectInput
{
public:
DirectInput(bool usejoystick);
~DirectInput();
bool getKeyEvents(DIDEVICEOBJECTDATA* keyEvents, DWORD* numKeyEvents);
bool getMouseEvents(DIDEVICEOBJECTDATA* mouseEvents, DWORD* numMouseEvents);
bool getJoystickEvents(uInt32 stick, DIDEVICEOBJECTDATA* joyEvents,
DWORD* numJoyEvents);
bool initialize(HWND hwnd);
void update();
uInt32 numJoysticks() { return myJoystickCount; }
private:
void cleanup();
static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* inst,
LPVOID pvRef);
HWND myHWND;
LPDIRECTINPUT8 mylpdi;
LPDIRECTINPUTDEVICE8 myKeyboard;
LPDIRECTINPUTDEVICE8 myMouse;
LPDIRECTINPUTDEVICE8 myJoystick[8];
uInt32 myJoystickCount;
bool myDisableJoystick;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,82 +0,0 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#ifndef DXFS_H
#define DXFS_H
#pragma once
class Console;
class MediaSource;
class Sound;
class CDirectInput;
#include "Event.hxx"
#include "GlobalData.hxx"
class CDirectXFullScreen
{
public:
CDirectXFullScreen(const CGlobalData* rGlobalData, const Console* pConsole,
Sound* pSound);
~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;
const CGlobalData* m_rGlobalData;
Sound* m_pSound;
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

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

@ -1,569 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferWin32.cxx,v 1.7 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#include <sstream>
#include "pch.hxx"
#include "resource.h"
#include "bspf.hxx"
#include "Console.hxx"
#include "EventHandler.hxx"
#include "StellaEvent.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferWin32.hxx"
#include "MediaSrc.hxx"
#include "Settings.hxx"
LPCTSTR FrameBufferWin32::pszClassName = _T("StellaXClass");
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferWin32::FrameBufferWin32()
: myDD(NULL),
myPrimarySurface(NULL),
myBackSurface(NULL),
myDDPalette(NULL),
theZoomLevel(1),
theMaxZoomLevel(1),
isFullscreen(false),
isWindowActive(true)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferWin32::~FrameBufferWin32()
{
cleanup();
if(myHWND)
{
DestroyWindow( myHWND );
// Remove the WM_QUIT which will be in the message queue
// so that the main window doesn't exit
MSG msg;
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
myHWND = NULL;
}
UnregisterClass(pszClassName, GetModuleHandle(NULL));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::cleanup()
{
if(myDDPalette)
{
myDDPalette->Release();
myDDPalette = NULL;
}
if(myBackSurface)
{
myBackSurface->Release();
myBackSurface = NULL;
}
if(myDD)
{
if(myPrimarySurface)
{
myPrimarySurface->Release();
myPrimarySurface = NULL;
}
myDD->Release();
myDD = NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferWin32::init()
{
HRESULT hrCoInit = ::CoInitialize( NULL );
// Get the game's width and height
myGameSize.cx = myWidth = myMediaSource->width() << 1;
myGameSize.cy = myHeight = myMediaSource->height();
// Initialize the pixel data table
for(uInt32 i = 0; i < 256; ++i)
myPalette[i] = i | (i << 8);
HRESULT hr = S_OK;
const unsigned int* pPalette = myMediaSource->palette();
WNDCLASSEX wcex;
ZeroMemory( &wcex, sizeof(wcex) );
wcex.cbSize = sizeof( wcex );
wcex.hInstance = GetModuleHandle(NULL);
wcex.lpszClassName = pszClassName;
wcex.lpfnWndProc = StaticWindowProc;
wcex.style = CS_OWNDC;
wcex.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wcex.hIconSm = LoadIcon( NULL, IDI_WINLOGO );
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
if(!RegisterClassEx(&wcex))
{
OutputDebugString("Error: RegisterClassEX FAILED");
hr = HRESULT_FROM_WIN32( ::GetLastError() );
cleanup();
return false;
}
myHWND = CreateWindowEx( WS_EX_TOPMOST,
pszClassName,
_T("StellaX"),
WS_VISIBLE | WS_POPUP,
0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
GetModuleHandle(NULL),
this );
if(myHWND == NULL )
{
OutputDebugString("Error: CreateWindowEx FAILED");
hr = HRESULT_FROM_WIN32( GetLastError() );
cleanup();
return false;
}
::SetFocus(myHWND);
::ShowWindow(myHWND, SW_SHOW);
::UpdateWindow(myHWND);
::ShowCursor( FALSE );
// Initialize DirectDraw
//
hr = ::CoCreateInstance( CLSID_DirectDraw,
NULL,
CLSCTX_SERVER,
IID_IDirectDraw,
(void**)&myDD );
if(FAILED(hr))
{
OutputDebugString("Error: CoCreateInstance FAILED");
cleanup();
return false;
}
// Initialize it
// This method takes the driver GUID parameter that the DirectDrawCreate
// function typically uses (NULL is active display driver)
hr = myDD->Initialize(NULL);
if(FAILED(hr))
{
OutputDebugString("Error: DirectDraw Initialize FAILED");
cleanup();
return false;
}
// Get the best video mode for game width
int cx = 640; int cy = 480;
if(myConsole->settings().getBool("autoselect_video"))
cx = cy = 0;
SetRect(&myScreenRect, 0, 0, cx, cy);
if(cx == 0 || cy == 0)
{
hr = myDD->EnumDisplayModes(0, NULL, this, EnumModesCallback);
if(FAILED(hr))
{
OutputDebugString("Error: Displaymode Enumeration FAILED");
cleanup();
return false;
}
}
if(myScreenRect.right == 0 || myScreenRect.bottom == 0)
{
OutputDebugString("Error: ScreenRect INVALID");
cleanup();
return false;
}
// compute blit offset to center image
myBlitOffset.x = ((myScreenRect.right - myGameSize.cx) / 2);
myBlitOffset.y = ((myScreenRect.bottom - myGameSize.cy) / 2);
// Set cooperative level
hr = myDD->SetCooperativeLevel(myHWND, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if(FAILED(hr))
{
OutputDebugString("Error: SetCooperativeLevel FAILED");
cleanup();
return false;
}
hr = myDD->SetDisplayMode(myScreenRect.right, myScreenRect.bottom, 8);
if(FAILED(hr))
{
OutputDebugString("Error: SetDisplayMode FAILED");
cleanup();
return false;
}
// Create the primary surface
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = myDD->CreateSurface(&ddsd, &myPrimarySurface, NULL);
if(FAILED(hr))
{
OutputDebugString("Error: Create primary surface FAILED");
cleanup();
return false;
}
// 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;
ddsd.dwWidth = myGameSize.cx;
ddsd.dwHeight = myGameSize.cy;
hr = myDD->CreateSurface(&ddsd, &myBackSurface, NULL);
if(FAILED(hr))
{
OutputDebugString("Error: Create back surface FAILED");
cleanup();
return false;
}
// Erase the surface
HDC hdc;
hr = myBackSurface->GetDC(&hdc);
if(hr == DD_OK)
{
SetBkColor(hdc, RGB(0, 0, 0));
RECT rc;
SetRect(&rc, 0, 0, myGameSize.cx, myGameSize.cy);
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
(void)myBackSurface->ReleaseDC(hdc);
}
// Create Palette
hr = setupPalette(1.0);
if(FAILED(hr))
{
OutputDebugString("Error: setupPalette FAILED");
cleanup();
return false;
}
// If we get this far, then assume that there were no problems
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HRESULT FrameBufferWin32::setupPalette(float shade)
{
HRESULT hr;
if(myDDPalette)
{
myDDPalette->Release();
myDDPalette = NULL;
}
const uInt32* pPalette = myMediaSource->palette();
PALETTEENTRY pe[256];
for(uInt32 i = 0; i < 256; ++i)
{
pe[i].peRed = (BYTE) (((pPalette[i] & 0x00ff0000) >> 16) * shade);
pe[i].peGreen = (BYTE) (((pPalette[i] & 0x0000ff00) >> 8) * shade);
pe[i].peBlue = (BYTE) ((pPalette[i] & 0x000000ff) * shade);
pe[i].peFlags = 0;
}
hr = myDD->CreatePalette(DDPCAPS_8BIT, pe, &myDDPalette, NULL );
if(FAILED(hr))
{
OutputDebugString("Error: CreatePalette FAILED");
cleanup();
return hr;
}
hr = myPrimarySurface->SetPalette(myDDPalette);
if(FAILED(hr))
{
OutputDebugString("Error: SetPalette FAILED");
cleanup();
return hr;
}
return hr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::drawMediaSource()
{
if(myPrimarySurface == NULL || !isWindowActive)
return;
const BYTE* current = myMediaSource->currentFrameBuffer();
const BYTE* previous = myMediaSource->previousFrameBuffer();
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
register int y;
for(y = 0; y < myGameSize.cy; ++y)
{
const WORD bufofsY = (WORD) ( y * myGameSize.cx >> 1 );
const DWORD screenofsY = ( y * myDDSurface.lPitch );
register int x;
for(x = 0; x < myGameSize.cx >> 1; ++x )
{
const WORD bufofs = bufofsY + x;
BYTE v = current[ bufofs ];
if(v == previous[ bufofs ] && !theRedrawEntireFrameIndicator)
continue;
// x << 1 is times 2 ( doubling width ) WIDTH_FACTOR
const DWORD pos = screenofsY + ( x << 1 );
pbBackBytes[ pos + 0 ] = pbBackBytes[ pos + 1 ] = myPalette[v];
}
}
// The frame doesn't need to be completely redrawn anymore
theRedrawEntireFrameIndicator = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::preFrameUpdate()
{
// Acquire pointer to linear video ram
ZeroMemory(&myDDSurface, sizeof(myDDSurface));
myDDSurface.dwSize = sizeof(myDDSurface);
HRESULT hr = myBackSurface->Lock(NULL, &myDDSurface, DDLOCK_WAIT, NULL);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::postFrameUpdate()
{
// We only send any changes to the screen once per frame
(void)myBackSurface->Unlock(myDDSurface.lpSurface);
// Blit offscreen to onscreen
RECT rc = { 0, 0, myGameSize.cx, myGameSize.cy };
HRESULT hr = myPrimarySurface->BltFast( myBlitOffset.x, myBlitOffset.y,
myBackSurface,
&rc,
DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT );
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::pauseEvent(bool status)
{
if(status)
setupPalette(0.75);
else
setupPalette(1.0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::toggleFullscreen()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
// First draw the background
for(uInt32 row = 0; row < h; row++)
{
for(uInt32 col = 0; col < w; col++)
{
BYTE* ptr = pbBackBytes + ((row + y) * myDDSurface.lPitch) + col + x;
*ptr = myPalette[myBGColor];
}
}
// Now draw the surrounding lines
for(uInt32 col = 0; col < w+1; col++) // Top line
{
BYTE* ptr = pbBackBytes + y * myDDSurface.lPitch + col + x;
*ptr = myPalette[myFGColor];
}
for(uInt32 col = 0; col < w+1; col++) // Bottom line
{
BYTE* ptr = pbBackBytes + (y+h) * myDDSurface.lPitch + col + x;
*ptr = myPalette[myFGColor];
}
for(uInt32 row = 0; row < h; row++) // Left line
{
BYTE* ptr = pbBackBytes + (row + y) * myDDSurface.lPitch + x;
*ptr = myPalette[myFGColor];
}
for(uInt32 row = 0; row < h; row++) // Right line
{
BYTE* ptr = pbBackBytes + (row + y) * myDDSurface.lPitch + x + w;
*ptr = myPalette[myFGColor];
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::drawText(uInt32 xorig, uInt32 yorig, const string& message)
{
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
uInt8 length = message.length();
for(uInt32 z = 0; z < length; z++)
{
for(uInt32 y = 0; y < 8; y++)
{
for(uInt32 x = 0; x < 8; x++)
{
char letter = message[z];
if((ourFontData[(letter << 3) + y] >> x) & 1)
pbBackBytes[((z<<3) + x + xorig) + (y + yorig) * myDDSurface.lPitch] =
myPalette[myFGColor];
}
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferWin32::drawChar(uInt32 xorig, uInt32 yorig, uInt32 c)
{
BYTE* pbBackBytes = (BYTE*)myDDSurface.lpSurface;
for(uInt32 y = 0; y < 8; y++)
{
for(uInt32 x = 0; x < 8; x++)
{
if((ourFontData[(c << 3) + y] >> x) & 1)
pbBackBytes[x + xorig + (y + yorig) * myDDSurface.lPitch] =
myPalette[myFGColor];
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LRESULT CALLBACK FrameBufferWin32::StaticWindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
FrameBufferWin32* pThis;
if(uMsg == WM_CREATE)
{
pThis = reinterpret_cast<FrameBufferWin32*>(
reinterpret_cast<CREATESTRUCT*>( lParam )->lpCreateParams );
SetWindowLong(hwnd, GWL_USERDATA, reinterpret_cast<LONG>(pThis));
}
else
{
pThis = reinterpret_cast<FrameBufferWin32*>(GetWindowLong(hwnd, GWL_USERDATA));
}
if(pThis)
{
if(pThis->WndProc(uMsg, wParam, lParam))
{
// Handled message
return 0L;
}
}
// Unhandled message
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL FrameBufferWin32::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_ACTIVATE:
isWindowActive = (wParam != WA_INACTIVE);
break;
case WM_DESTROY:
::PostQuitMessage(0);
break;
case WM_PAINT:
PAINTSTRUCT ps;
::BeginPaint( myHWND, &ps );
::EndPaint( myHWND, &ps );
break;
default:
return FALSE;
}
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HRESULT WINAPI FrameBufferWin32::EnumModesCallback(
LPDDSURFACEDESC lpDDSurfaceDesc,
LPVOID lpContext)
{
FrameBufferWin32* pThis = (FrameBufferWin32*)lpContext;
DWORD dwWidthReq = pThis->myGameSize.cx;
DWORD dwHeightReq = pThis->myGameSize.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;
// Must be larger then required screen size
if(dwWidth < dwWidthReq || dwHeight < dwHeightReq)
return DDENUMRET_OK;
if(pThis->myScreenRect.right != 0 && pThis->myScreenRect.bottom != 0)
{
// check to see if this is better than the previous choice
if((dwWidth - dwWidthReq) > (pThis->myScreenRect.right - dwWidthReq))
return DDENUMRET_OK;
if((dwHeight - dwHeightReq) > (pThis->myScreenRect.bottom - dwHeightReq))
return DDENUMRET_OK;
}
// use it!
pThis->myScreenRect.right = dwWidth;
pThis->myScreenRect.bottom = dwHeight;
return DDENUMRET_OK;
}

View File

@ -1,181 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferWin32.hxx,v 1.4 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_WIN32_HXX
#define FRAMEBUFFER_WIN32_HXX
#include "FrameBuffer.hxx"
#include "bspf.hxx"
class Console;
class MediaSource;
/**
This class implements a DirectX software framebuffer.
Only fullscreen mode is supported for now.
@author Stephen Anthony
@version $Id: FrameBufferWin32.hxx,v 1.4 2003-11-24 23:56:10 stephena Exp $
*/
class FrameBufferWin32 : public FrameBuffer
{
public:
/**
Creates a new DirectDraw framebuffer
*/
FrameBufferWin32();
/**
Destructor
*/
virtual ~FrameBufferWin32();
HWND hwnd() const { return myHWND; }
bool windowActive() { return isWindowActive; }
/**
This routine should be called once the console is created to setup
the video system for us to use. Return false if any operation fails,
otherwise return true.
*/
virtual bool init();
/**
Set up the palette for a screen of depth = 8.
@param shade Scales the palette by the given amount
@return The result of the CreatePalette method
*/
HRESULT setupPalette(float shade);
/**
This routine should be called anytime the MediaSource needs to be redrawn
to the screen.
*/
virtual void drawMediaSource();
/**
This routine should be called to draw a rectangular box with sides
at the specified coordinates.
@param x The x coordinate
@param y The y coordinate
@param w The width of the box
@param h The height of the box
*/
virtual void drawBoundedBox(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
/**
This routine should be called to draw text at the specified coordinates.
@param x The x coordinate
@param y The y coordinate
@param message The message text
*/
virtual void drawText(uInt32 x, uInt32 y, const string& message);
/**
This routine should be called to draw character 'c' at the specified coordinates.
@param x The x coordinate
@param y The y coordinate
@param c The character to draw
*/
virtual void drawChar(uInt32 x, uInt32 y, uInt32 c);
/**
This routine is called before any drawing is done (per-frame).
*/
virtual void preFrameUpdate();
/**
This routine is called after any drawing is done (per-frame).
*/
virtual void postFrameUpdate();
/**
This routine is called when the emulation has received
a pause event.
@param status The received pause status
*/
virtual void pauseEvent(bool status);
/**
Toggles between fullscreen and window mode. Grabmouse and hidecursor
activated when in fullscreen mode.
*/
void toggleFullscreen();
/**
This routine is called when the user wants to resize the window.
A '1' argument indicates that the window should increase in size, while '-1'
indicates that the windows should decrease in size. A '0' indicates that
the window should be sized according to the current properties.
Can't resize in fullscreen mode. Will only resize up to the maximum size
of the screen.
*/
void resize(int mode);
/**
Answers if the display is currently in fullscreen mode.
*/
bool fullScreen() { return isFullscreen; }
/**
Answers the current zoom level of the window
*/
uInt32 zoomLevel() { return theZoomLevel; }
private:
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();
HWND myHWND;
RECT myScreenRect;
POINT myBlitOffset;
// Stella objects
SIZE myGameSize;
BYTE myPalette[256];
// DirectX
IDirectDraw* myDD;
IDirectDrawSurface* myPrimarySurface;
IDirectDrawSurface* myBackSurface;
DDSURFACEDESC myDDSurface;
IDirectDrawPalette* myDDPalette;
static LPCTSTR pszClassName;
// Indicates the current zoom level of the window
uInt32 theZoomLevel;
// Indicates the maximum zoom of the window
uInt32 theMaxZoomLevel;
// Indicates whether the game is currently in fullscreen
bool isFullscreen;
// Indicates whether the window is currently active
bool isWindowActive;
};
#endif

View File

@ -1,461 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameList.cpp,v 1.6 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "Cyberstella.h"
#include "GameList.h"
#include "MD5.hxx"
#include "SettingsWin32.hxx"
class CyberstellaView;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GameList::GameList()
: myRomPath(""),
myRomCount(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GameList::~GameList()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(GameList, CListCtrl)
// {{AFX_MSG_MAP(GameList)
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, OnItemActivate)
ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemchanged)
// }}AFX_MSG_MAP
END_MESSAGE_MAP()
// Sort the item in reverse alphabetical order.
static int CALLBACK
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
Properties* props1 = (Properties*) lParam1;
Properties* props2 = (Properties*) lParam2;
// Dots on top
if(strcmpi(props1->get("Cartridge.Type").c_str(), "Dots") == 0)
return 0;
if(strcmpi(props2->get("Cartridge.Type").c_str(), "Dots") == 0)
return 1;
// Directories on top
if((strcmpi(props1->get("Cartridge.Type").c_str(), "Directory") == 0)
&&(strcmpi(props2->get("Cartridge.Type").c_str(), "Directory") != 0))
return 0;
if((strcmpi(props1->get("Cartridge.Type").c_str(), "Directory") != 0)
&&(strcmpi(props2->get("Cartridge.Type").c_str(), "Directory") == 0))
return 1;
// Else compare by name
return strcmpi(props1->get("Cartridge.Name").c_str(),
props2->get("Cartridge.Name").c_str());
}
void GameList::deleteItemsAndProperties()
{
// First delete all Properties
for(int i = 0; i < GetItemCount(); i++)
{
Properties* props = (Properties*)GetItemData(i);
if(props) delete props;
}
// Second delete all items
DeleteAllItems();
}
void GameList::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
void GameList::insertColumns()
{
CRect rect;
int width;
CString str;
GetClientRect(&rect);
width = (rect.Width()-20)/4;
// Insert Columns
str.LoadString(IDS_FILE);
InsertColumn (0, str, LVCFMT_LEFT, width);
str.LoadString(IDS_NAME);
InsertColumn (1, str, LVCFMT_LEFT, width);
str.LoadString(IDS_MANUFACTURER);
InsertColumn (2, str, LVCFMT_LEFT, width);
str.LoadString(IDS_RARITY);
InsertColumn (3, str, LVCFMT_LEFT, width);
}
void GameList::populateRomList()
{
CWaitCursor c;
// Remove previous content
deleteItemsAndProperties();
// Add new content
if(myRomPath.GetLength() > 0)
displayPath();
else
displayDrives();
// Sort content
SortItems(MyCompareProc, (LPARAM)(CListCtrl*)this);
// Select first item
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
if(myParent)
myParent->SendMessage(MSG_GAMELIST_UPDATE);
// Save the current path
mySettings->setString("rompath", (const char*) myRomPath);
}
void GameList::displayPath()
{
CFileFind find;
CString name, searchpath;
BOOL bFind;
LVITEM lvi;
int itemCounter = 0;
BOOL first = true;
// Do pathname
if (myRomPath.GetAt(myRomPath.GetLength()-1) == '\\')
searchpath = myRomPath + "*.*";
else
searchpath = myRomPath + "\\*.*";
bFind = find.FindFile(searchpath);
// Init Rom count
myRomCount = 0;
while (bFind)
{
bFind = find.FindNextFile();
if (find.IsDirectory())
{
if (!find.IsDots())
{
name = find.GetFileName();
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
lvi.iItem = itemCounter++;
lvi.iSubItem = 0;
lvi.pszText = name.GetBuffer(name.GetLength());
// set fake properties
Properties* props = new Properties();
props->set("Cartridge.Type", "Directory");
props->set("Cartridge.Name", name.GetBuffer(name.GetLength()));
lvi.lParam = (LPARAM)props;
//Set folder icon
lvi.iImage = 0;
InsertItem(&lvi);
}
}
else
{
name = find.GetFileName();
// Bail out if if this is not a *.BIN file
CString right = name.Right(4);
if (strcmpi(right, ".bin") != 0) continue;
// Bail out if we don't get properties
Properties* props = readRomData(find.GetFilePath());
if(props == NULL) continue;
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
lvi.iItem = itemCounter++;
lvi.iSubItem = 0;
lvi.pszText = name.GetBuffer(name.GetLength());
lvi.lParam = (LPARAM)props;
// Set atari icon
lvi.iImage = 1;
InsertItem(&lvi);
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 1;
name = props->get("Cartridge.Name").c_str();
// If entry is not found in stella.pro, set filename
if(strcmpi(name,"untitled") == 0)
{
props->set("Cartridge.Name", find.GetFileName().GetBuffer(name.GetLength()));
}
lvi.pszText = name.GetBuffer(name.GetLength());
SetItem(&lvi);
lvi.iSubItem = 2;
name = props->get("Cartridge.Manufacturer").c_str();
lvi.pszText = name.GetBuffer(name.GetLength());
SetItem(&lvi);
lvi.iSubItem = 3;
name = props->get("Cartridge.Rarity").c_str();
lvi.pszText = name.GetBuffer(name.GetLength());
SetItem(&lvi);
myRomCount++;
}
}
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
lvi.iItem = itemCounter++;
lvi.iSubItem = 0;
lvi.pszText = "..";
// set fake properties
Properties* props = new Properties();
props->set("Cartridge.Type", "Dots");
lvi.lParam = (LPARAM)props;
//Set folder icon
lvi.iImage = 0;
InsertItem(&lvi);
}
void GameList::displayDrives()
{
DWORD dwDrives, dwMask;
LVITEM lvi;
bool first;
int itemCounter;
// Clear path
myRomPath = "";
//Enumerate drive letters and add them to list
dwDrives = GetLogicalDrives();
dwMask = 1;
first = true;
itemCounter = 0;
for (int i=0; i<32; i++)
{
if (dwDrives & dwMask)
{
CString sDrive;
sDrive.Format(_T("%c:\\"), i + _T('A'));
lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
lvi.iItem = itemCounter++;
lvi.iSubItem = 0;
lvi.pszText = sDrive.GetBuffer(sDrive.GetLength());
// set fake properties
Properties* props = new Properties();
props->set("Cartridge.Type", "Directory");
props->set("Cartridge.Name", sDrive.GetBuffer(sDrive.GetLength()));
lvi.lParam = (LPARAM)props;
//Set folder icon
lvi.iImage = 0;
InsertItem(&lvi);
}
dwMask <<= 1;
}
}
void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
int iItem = pNMListView->iItem;
if(iItem >= 0)
{
Properties* props = (Properties*)GetItemData(iItem);
CString dir = GetItemText(iItem,0);
if(strcmpi(props->get("Cartridge.Type").c_str(), "Dots") == 0)
{
int cutPos = myRomPath.ReverseFind('\\');
myRomPath = myRomPath.Left(cutPos);
populateRomList();
}
else if(strcmpi(props->get("Cartridge.Type").c_str(), "Directory") == 0)
{
// Do pathname
if (myRomPath.GetLength() <= 0)
{
myRomPath = dir;
}
else if (myRomPath.GetAt(myRomPath.GetLength()-1) != '\\')
{
myRomPath += "\\";
myRomPath += dir;
}
else
{
myRomPath += dir;
}
populateRomList();
}
else
{
// Notify parent to play the current game by
// sending a faked 'Play Button Pressed' message.
if (myParent) myParent->PostMessage(WM_COMMAND, BN_CLICKED | IDC_PLAY);
}
}
*pResult = 0;
}
Properties* GameList::readRomData(CString binFile)
{
HANDLE hFile;
hFile = CreateFile(binFile, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
return NULL;
}
DWORD dwFileSize = ::GetFileSize(hFile, NULL);
BYTE* pImage = new BYTE[dwFileSize];
if (pImage == NULL)
{
return NULL;
}
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
Properties* props = new Properties();
myPropertiesSet->getMD5(md5, *props);
// Return properties
delete[] pImage;
VERIFY(::CloseHandle(hFile));
return props;
}
delete[] pImage;
VERIFY(::CloseHandle(hFile));
return NULL;
}
CString GameList::getCurrentFile()
{
CString filename = "";
int curSel = GetSelectionMark();
if(curSel >= 0)
{
if (myRomPath.GetAt(myRomPath.GetLength()-1) != '\\')
myRomPath += "\\";
filename = myRomPath + GetItemText(curSel,0);
}
return filename;
}
CString GameList::getCurrentName()
{
int curSel = GetSelectionMark();
if(curSel >= 0)
{
return GetItemText(curSel,1);
}
return "";
}
CString GameList::getCurrentNote()
{
int curSel = GetSelectionMark();
if(curSel >= 0)
{
Properties* props = (Properties*)GetItemData(curSel);
return props->get("Cartridge.Note").c_str();
}
return "";
}
void GameList::init(PropertiesSet* newPropertiesSet,
SettingsWin32* settings, CWnd* newParent)
{
myParent = newParent;
myPropertiesSet = newPropertiesSet;
mySettings = settings;
myRomPath = mySettings->getString("rompath").c_str();
SetExtendedStyle(LVS_EX_FULLROWSELECT);
insertColumns();
}
void GameList::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if(myParent) myParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
*pResult = 0;
}
BOOL GameList::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
if(pMsg->wParam == VK_RETURN)
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return TRUE; // DO NOT process further
}
}
return CListCtrl::PreTranslateMessage(pMsg);
}

View File

@ -1,73 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-1999 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameList.h,v 1.5 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#ifndef GAME_LIST_H
#define GAME_LIST_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PropsSet.hxx"
#include "SettingsWin32.hxx"
/////////////////////////////////////////////////////////////////////////////
// GameList window
class GameList : public CListCtrl
{
public:
GameList();
virtual ~GameList();
void init(PropertiesSet* newPropertiesSet,
SettingsWin32* settings, CWnd* newParent);
CString getCurrentNote();
CString getPath() { return myRomPath; }
uInt32 getRomCount() { return myRomCount; }
virtual BOOL PreTranslateMessage(MSG* pMsg);
void insertColumns();
void populateRomList();
void deleteItemsAndProperties();
CString getCurrentFile();
CString getCurrentName();
private:
CWnd* myParent;
PropertiesSet* myPropertiesSet;
SettingsWin32* mySettings;
CString myRomPath;
uInt32 myRomCount;
private:
void displayDrives();
void displayPath();
Properties* readRomData(CString binFile);
protected:
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
DECLARE_MESSAGE_MAP()
};
#endif

View File

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

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

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

@ -1,100 +0,0 @@
// 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_)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,106 +0,0 @@
// 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
void CMainFrame::setStatusText(CString text)
{
m_wndStatusBar.SetWindowText(text);
}

View File

@ -1,60 +0,0 @@
// 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();
void setStatusText(CString text);
void updateListInfos();
void displayNote();
#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

@ -1,458 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainWin32.cxx,v 1.6 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#define STRICT
#include "pch.hxx"
#include "resource.h"
#include "DirectInput.hxx"
#include "bspf.hxx"
#include "Console.hxx"
#include "EventHandler.hxx"
#include "FrameBuffer.hxx"
#include "FrameBufferWin32.hxx"
#include "Settings.hxx"
#include "SettingsWin32.hxx"
#include "Sound.hxx"
#include "SoundWin32.hxx"
#include "StellaEvent.hxx"
#include "MainWin32.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
Settings& settings, PropertiesSet& properties)
: theSettings(settings),
thePropertiesSet(properties),
theDisplay(NULL),
theSound(NULL),
theInput(NULL),
theMouseX(0),
thePaddleMode(0),
myIsInitialized(false)
{
// Setup the DirectX window
theDisplay = new FrameBufferWin32();
if(!theDisplay)
{
cleanup();
return;
}
// Create a sound object for playing audio
string sounddriver = theSettings.getString("sound");
if(sounddriver == "win32")
theSound = new SoundWin32();
else
theSound = new Sound();
if(!theSound)
{
cleanup();
return;
}
// Create the 2600 game console
theConsole = new Console(image, size, filename, theSettings, thePropertiesSet,
*theDisplay, *theSound);
// We can now initialize the sound and directinput classes with
// the handle to the current window.
// This must be done after the console is created, since at this
// point we know that the FrameBuffer has been fully initialized
// Initialize SoundWin32
if(sounddriver == "win32")
((SoundWin32*)theSound)->Initialize(theDisplay->hwnd());
theSound->setVolume(theSettings.getInt("volume"));
// Initialize DirectInput
theInput = new DirectInput(theSettings.getBool("disable_joystick"));
if(!theInput)
{
cleanup();
return;
}
theInput->initialize(theDisplay->hwnd());
myIsInitialized = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MainWin32::~MainWin32()
{
cleanup();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainWin32::cleanup()
{
if(theDisplay)
delete theDisplay;
if(theSound)
delete theSound;
if(theInput)
delete theInput;
if(theConsole)
delete theConsole;
myIsInitialized = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DWORD MainWin32::run()
{
if(!myIsInitialized)
return 0;
// Get the initial tick count
UINT uFrameCount = 0;
unsigned __int64 uiStartRun;
QueryPerformanceCounter( (LARGE_INTEGER*)&uiStartRun );
// Find out how many ticks occur per second
unsigned __int64 uiCountsPerSecond;
QueryPerformanceFrequency( (LARGE_INTEGER*)&uiCountsPerSecond );
const unsigned __int64 uiCountsPerFrame =
( uiCountsPerSecond / theSettings.getInt("framerate"));
unsigned __int64 uiFrameStart;
unsigned __int64 uiFrameCurrent;
// Main message loop
MSG msg;
for(;;)
{
if(::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ))
{
if(msg.message == WM_QUIT)
break;
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else if (theDisplay->windowActive())
{
// idle time -- do stella updates
++uFrameCount;
::QueryPerformanceCounter( (LARGE_INTEGER*)&uiFrameStart );
UpdateEvents();
theConsole->update();
// waste time to to meet desired frame rate
for(;;)
{
QueryPerformanceCounter( (LARGE_INTEGER*)&uiFrameCurrent );
if((uiFrameCurrent - uiFrameStart) >= uiCountsPerFrame)
break;
}
}
}
// Main message loop done
if(0)// m_rGlobalData->bShowFPS)
{
// Get the final tick count
unsigned __int64 uiEndRun;
QueryPerformanceCounter( (LARGE_INTEGER*)&uiEndRun );
// Get number of ticks
DWORD secs = (DWORD)((uiEndRun - uiStartRun) / uiCountsPerSecond);
DWORD fps = (secs == 0) ? 0 : (uFrameCount / secs);
TCHAR pszBuf[1024];
wsprintf(pszBuf, _T("Frames drawn: %ld\nFPS: %ld\n"), uFrameCount, fps);
MessageBox(NULL, pszBuf, _T("Statistics"), MB_OK);
}
return msg.wParam;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MainWin32::UpdateEvents()
{
DIDEVICEOBJECTDATA eventArray[64];
DWORD numEvents;
// Check for keyboard events
numEvents = 64;
if(theInput->getKeyEvents(eventArray, &numEvents))
{
for(unsigned int i = 0; i < numEvents; i++ )
{
uInt32 key = eventArray[i].dwOfs;
uInt8 state = eventArray[i].dwData & 0x80 ? 1 : 0;
for(uInt32 i = 0; i < sizeof(keyList) / sizeof(Switches); ++i)
{
if(keyList[i].nVirtKey == key)
theConsole->eventHandler().sendKeyEvent(keyList[i].keyCode, state);
}
}
}
// Check for mouse events
numEvents = 64;
if(theInput->getMouseEvents(eventArray, &numEvents))
{
for(unsigned int i = 0; i < numEvents; i++ )
{
Event::Type type = Event::LastType;
Int32 value;
switch(eventArray[i].dwOfs)
{
// Check for button press and release
case DIMOFS_BUTTON0:
case DIMOFS_BUTTON1:
case DIMOFS_BUTTON2:
case DIMOFS_BUTTON3:
case DIMOFS_BUTTON4:
case DIMOFS_BUTTON5:
case DIMOFS_BUTTON6:
case DIMOFS_BUTTON7:
value = (Int32) eventArray[i].dwData & 0x80 ? 1 : 0;
if(thePaddleMode == 0)
type = Event::PaddleZeroFire;
else if(thePaddleMode == 1)
type = Event::PaddleOneFire;
else if(thePaddleMode == 2)
type = Event::PaddleTwoFire;
else if(thePaddleMode == 3)
type = Event::PaddleThreeFire;
theConsole->eventHandler().sendEvent(type, value);
break;
// Check for horizontal movement
case DIMOFS_X:
theMouseX = theMouseX + eventArray[i].dwData;
// Force mouseX between 0 ... 999
if(theMouseX < 0)
theMouseX = 0;
else if(theMouseX > 999)
theMouseX = 999;
Int32 value = (999 - theMouseX) * 1000;
if(thePaddleMode == 0)
type = Event::PaddleZeroResistance;
else if(thePaddleMode == 1)
type = Event::PaddleOneResistance;
else if(thePaddleMode == 2)
type = Event::PaddleTwoResistance;
else if(thePaddleMode == 3)
type = Event::PaddleThreeResistance;
theConsole->eventHandler().sendEvent(type, value);
break;
}
}
}
// Check for joystick events
for(uInt32 joystick = 0; joystick < theInput->numJoysticks(); joystick++)
{
numEvents = 64;
if(theInput->getJoystickEvents(joystick, eventArray, &numEvents))
{
StellaEvent::JoyStick stick = joyList[joystick];
StellaEvent::JoyCode code;
for(uInt32 i = 0; i < numEvents; i++ )
{
Event::Type type = Event::LastType;
Int32 state, value;
if(eventArray[i].dwOfs == DIJOFS_X) // left-right motion
{
value = (Int32) eventArray[i].dwData;
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_LEFT,
(value < 0) ? 1 : 0);
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_RIGHT,
(value > 0) ? 1 : 0);
}
else if(eventArray[i].dwOfs == DIJOFS_Y) // up-down motion
{
value = (Int32) eventArray[i].dwData;
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_UP,
(value < 0) ? 1 : 0);
theConsole->eventHandler().sendJoyEvent(stick, StellaEvent::JAXIS_DOWN,
(value > 0) ? 1 : 0);
}
else // Check for button press and release
{
for(uInt32 j = 0; j < StellaEvent::LastJCODE-4; j++)
{
if(eventArray[i].dwOfs == DIJOFS_BUTTON(j))
{
code = joyButtonList[j];
state = (Int32) eventArray[i].dwData & 0x80 ? 1 : 0;
theConsole->eventHandler().sendJoyEvent(stick, code, state);
}
}
}
}
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MainWin32::Switches MainWin32::keyList[StellaEvent::LastKCODE] = {
{ DIK_F1, StellaEvent::KCODE_F1 },
{ DIK_F2, StellaEvent::KCODE_F2 },
{ DIK_F3, StellaEvent::KCODE_F3 },
{ DIK_F4, StellaEvent::KCODE_F4 },
{ DIK_F5, StellaEvent::KCODE_F5 },
{ DIK_F6, StellaEvent::KCODE_F6 },
{ DIK_F7, StellaEvent::KCODE_F7 },
{ DIK_F8, StellaEvent::KCODE_F8 },
{ DIK_F9, StellaEvent::KCODE_F9 },
{ DIK_F10, StellaEvent::KCODE_F10 },
{ DIK_F11, StellaEvent::KCODE_F11 },
{ DIK_F12, StellaEvent::KCODE_F12 },
{ DIK_F13, StellaEvent::KCODE_F13 },
{ DIK_F14, StellaEvent::KCODE_F14 },
{ DIK_F15, StellaEvent::KCODE_F15 },
{ DIK_UP, StellaEvent::KCODE_UP },
{ DIK_DOWN, StellaEvent::KCODE_DOWN },
{ DIK_LEFT, StellaEvent::KCODE_LEFT },
{ DIK_RIGHT, StellaEvent::KCODE_RIGHT },
{ DIK_SPACE, StellaEvent::KCODE_SPACE },
{ DIK_LCONTROL, StellaEvent::KCODE_LCTRL },
{ DIK_RCONTROL, StellaEvent::KCODE_RCTRL },
{ DIK_LMENU, StellaEvent::KCODE_LALT },
{ DIK_RMENU, StellaEvent::KCODE_RALT },
{ DIK_LWIN, StellaEvent::KCODE_LWIN },
{ DIK_RWIN, StellaEvent::KCODE_RWIN },
{ DIK_APPS, StellaEvent::KCODE_MENU },
{ DIK_A, StellaEvent::KCODE_a },
{ DIK_B, StellaEvent::KCODE_b },
{ DIK_C, StellaEvent::KCODE_c },
{ DIK_D, StellaEvent::KCODE_d },
{ DIK_E, StellaEvent::KCODE_e },
{ DIK_F, StellaEvent::KCODE_f },
{ DIK_G, StellaEvent::KCODE_g },
{ DIK_H, StellaEvent::KCODE_h },
{ DIK_I, StellaEvent::KCODE_i },
{ DIK_J, StellaEvent::KCODE_j },
{ DIK_K, StellaEvent::KCODE_k },
{ DIK_L, StellaEvent::KCODE_l },
{ DIK_M, StellaEvent::KCODE_m },
{ DIK_N, StellaEvent::KCODE_n },
{ DIK_O, StellaEvent::KCODE_o },
{ DIK_P, StellaEvent::KCODE_p },
{ DIK_Q, StellaEvent::KCODE_q },
{ DIK_R, StellaEvent::KCODE_r },
{ DIK_S, StellaEvent::KCODE_s },
{ DIK_T, StellaEvent::KCODE_t },
{ DIK_U, StellaEvent::KCODE_u },
{ DIK_V, StellaEvent::KCODE_v },
{ DIK_W, StellaEvent::KCODE_w },
{ DIK_X, StellaEvent::KCODE_x },
{ DIK_Y, StellaEvent::KCODE_y },
{ DIK_Z, StellaEvent::KCODE_z },
{ DIK_0, StellaEvent::KCODE_0 },
{ DIK_1, StellaEvent::KCODE_1 },
{ DIK_2, StellaEvent::KCODE_2 },
{ DIK_3, StellaEvent::KCODE_3 },
{ DIK_4, StellaEvent::KCODE_4 },
{ DIK_5, StellaEvent::KCODE_5 },
{ DIK_6, StellaEvent::KCODE_6 },
{ DIK_7, StellaEvent::KCODE_7 },
{ DIK_8, StellaEvent::KCODE_8 },
{ DIK_9, StellaEvent::KCODE_9 },
{ DIK_NUMPAD0, StellaEvent::KCODE_KP0 },
{ DIK_NUMPAD1, StellaEvent::KCODE_KP1 },
{ DIK_NUMPAD2, StellaEvent::KCODE_KP2 },
{ DIK_NUMPAD3, StellaEvent::KCODE_KP3 },
{ DIK_NUMPAD4, StellaEvent::KCODE_KP4 },
{ DIK_NUMPAD5, StellaEvent::KCODE_KP5 },
{ DIK_NUMPAD6, StellaEvent::KCODE_KP6 },
{ DIK_NUMPAD7, StellaEvent::KCODE_KP7 },
{ DIK_NUMPAD8, StellaEvent::KCODE_KP8 },
{ DIK_NUMPAD9, StellaEvent::KCODE_KP9 },
{ DIK_DECIMAL, StellaEvent::KCODE_KP_PERIOD },
{ DIK_DIVIDE, StellaEvent::KCODE_KP_DIVIDE },
{ DIK_MULTIPLY, StellaEvent::KCODE_KP_MULTIPLY },
{ DIK_SUBTRACT, StellaEvent::KCODE_KP_MINUS },
{ DIK_ADD, StellaEvent::KCODE_KP_PLUS },
{ DIK_NUMPADENTER, StellaEvent::KCODE_KP_ENTER },
// { SDLK_KP_EQUALS, StellaEvent::KCODE_KP_EQUALS },
{ DIK_BACK, StellaEvent::KCODE_BACKSPACE },
{ DIK_TAB, StellaEvent::KCODE_TAB },
// { SDLK_CLEAR, StellaEvent::KCODE_CLEAR },
{ DIK_RETURN, StellaEvent::KCODE_RETURN },
{ DIK_ESCAPE, StellaEvent::KCODE_ESCAPE },
{ DIK_COMMA, StellaEvent::KCODE_COMMA },
{ DIK_MINUS, StellaEvent::KCODE_MINUS },
{ DIK_PERIOD, StellaEvent::KCODE_PERIOD },
{ DIK_SLASH, StellaEvent::KCODE_SLASH },
{ DIK_BACKSLASH, StellaEvent::KCODE_BACKSLASH },
{ DIK_SEMICOLON, StellaEvent::KCODE_SEMICOLON },
{ DIK_EQUALS, StellaEvent::KCODE_EQUALS },
{ DIK_APOSTROPHE, StellaEvent::KCODE_QUOTE },
{ DIK_GRAVE, StellaEvent::KCODE_BACKQUOTE },
{ DIK_LBRACKET, StellaEvent::KCODE_LEFTBRACKET },
{ DIK_RBRACKET, StellaEvent::KCODE_RIGHTBRACKET },
{ DIK_SYSRQ, StellaEvent::KCODE_PRTSCREEN },
{ DIK_SCROLL, StellaEvent::KCODE_SCRLOCK },
{ DIK_PAUSE, StellaEvent::KCODE_PAUSE },
{ DIK_INSERT, StellaEvent::KCODE_INSERT },
{ DIK_HOME, StellaEvent::KCODE_HOME },
{ DIK_PRIOR, StellaEvent::KCODE_PAGEUP },
{ DIK_DELETE, StellaEvent::KCODE_DELETE },
{ DIK_END, StellaEvent::KCODE_END },
{ DIK_NEXT, StellaEvent::KCODE_PAGEDOWN }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaEvent::JoyStick MainWin32::joyList[StellaEvent::LastJSTICK] = {
StellaEvent::JSTICK_0, StellaEvent::JSTICK_1,
StellaEvent::JSTICK_2, StellaEvent::JSTICK_3,
StellaEvent::JSTICK_4, StellaEvent::JSTICK_5,
StellaEvent::JSTICK_6, StellaEvent::JSTICK_7
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaEvent::JoyCode MainWin32::joyButtonList[StellaEvent::LastJCODE-4] = {
StellaEvent::JBUTTON_0, StellaEvent::JBUTTON_1, StellaEvent::JBUTTON_2,
StellaEvent::JBUTTON_3, StellaEvent::JBUTTON_4, StellaEvent::JBUTTON_5,
StellaEvent::JBUTTON_6, StellaEvent::JBUTTON_7, StellaEvent::JBUTTON_8,
StellaEvent::JBUTTON_9, StellaEvent::JBUTTON_10, StellaEvent::JBUTTON_11,
StellaEvent::JBUTTON_12, StellaEvent::JBUTTON_13, StellaEvent::JBUTTON_14,
StellaEvent::JBUTTON_15, StellaEvent::JBUTTON_16, StellaEvent::JBUTTON_17,
StellaEvent::JBUTTON_18, StellaEvent::JBUTTON_19
};

View File

@ -1,113 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MainWin32.hxx,v 1.4 2003-11-19 21:06:27 stephena Exp $
//============================================================================
#ifndef MAIN_WIN32_HXX
#define MAIN_WIN32_HXX
class Console;
class FrameBufferWin32;
class MediaSource;
class PropertiesSet;
class Sound;
class Settings;
class DirectInput;
#include "GlobalData.hxx"
#include "FrameBuffer.hxx"
#include "Event.hxx"
#include "StellaEvent.hxx"
/**
This class implements a main-like method where all per-game
instantiation is done. Event gathering is also done here.
This class is meant to be quite similar to the mainDOS or mainSDL
classes so that all platforms have a main-like method as described
in the Porting.txt document
@author Stephen Anthony
@version $Id: MainWin32.hxx,v 1.4 2003-11-19 21:06:27 stephena Exp $
*/
class MainWin32
{
public:
/**
Create a new instance of the emulation core for the specified
rom image.
@param image The ROM image of the game to emulate
@param size The size of the ROM image
@param filename The name of the file that contained the ROM image
@param settings The settings object to use
@param properties The game profiles object to use
*/
MainWin32(const uInt8* image, uInt32 size, const char* filename,
Settings& settings, PropertiesSet& properties);
/**
Destructor
*/
virtual ~MainWin32();
// Start the main emulation loop
DWORD run();
private:
void UpdateEvents();
void cleanup();
private:
// Pointer to the console object
Console* theConsole;
// Reference to the settings object
Settings& theSettings;
// Reference to the properties set object
PropertiesSet& thePropertiesSet;
// Pointer to the display object
FrameBufferWin32* theDisplay;
// Pointer to the sound object
Sound* theSound;
// Pointer to the input object
DirectInput* theInput;
struct Switches
{
uInt32 nVirtKey;
StellaEvent::KeyCode keyCode;
};
static Switches keyList[StellaEvent::LastKCODE];
// Lookup tables for joystick numbers and events
static StellaEvent::JoyStick joyList[StellaEvent::LastJSTICK];
static StellaEvent::JoyCode joyButtonList[StellaEvent::LastJCODE-4];
// Indicates the current mouse position in the X direction
Int32 theMouseX;
// Indicates the current paddle mode
uInt32 thePaddleMode;
// Indicates that all subsystems were initialized
bool myIsInitialized;
};
#endif

View File

@ -1,85 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsWin32.cxx,v 1.4 2003-11-24 01:14:38 stephena Exp $
//============================================================================
#include <sstream>
#include <afxwin.h>
#include "bspf.hxx"
#include "Console.hxx"
#include "Settings.hxx"
#include "SettingsWin32.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsWin32::SettingsWin32()
{
// First set variables that the parent class needs
myBaseDir = ".\\"; // TODO - this should change to per-user location if using Windows XP
myStateDir = myBaseDir + "state\\";
CreateDirectory(myStateDir.c_str(), NULL);
// TODO - these should reflect user vs. system files
myUserPropertiesFile = myBaseDir + "stella.pro";
mySystemPropertiesFile = myBaseDir + "stella.pro";
myUserConfigFile = myBaseDir + "stellarc";
mySystemConfigFile = myBaseDir + "stellarc";
// Set up the names of the input and output config files
mySettingsOutputFilename = myUserConfigFile;
mySettingsInputFilename = mySystemConfigFile;
mySnapshotFile = "";
myStateFile = "";
// Now create Win32 specific settings
set("autoselect_video", "false");
set("disable_joystick", "true");
set("rompath", "");
set("sound", "win");
set("volume", "-1");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsWin32::~SettingsWin32()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsWin32::stateFilename(uInt32 state)
{
if(!myConsole)
return "";
ostringstream buf;
buf << myStateDir << myConsole->properties().get("Cartridge.MD5")
<< ".st" << state;
myStateFile = buf.str();
return myStateFile;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string SettingsWin32::snapshotFilename()
{
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SettingsWin32::usage(string& message)
{
}

View File

@ -1,37 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SettingsWin32.hxx,v 1.3 2003-11-19 21:06:27 stephena Exp $
//============================================================================
#ifndef SETTINGS_WIN32_HXX
#define SETTINGS_WIN32_HXX
#include "bspf.hxx"
#include "Settings.hxx"
class SettingsWin32 : public Settings
{
public:
SettingsWin32();
virtual ~SettingsWin32();
public:
virtual string stateFilename(uInt32 state);
virtual string snapshotFilename();
virtual void usage(string& message);
};
#endif

View File

@ -1,178 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SoundWin32.cxx,v 1.5 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#include <assert.h>
#include <dsound.h>
#include "bspf.hxx"
#include "MediaSrc.hxx"
#include "SoundWin32.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundWin32::SoundWin32()
: myIsInitializedFlag(false),
myBufferSize(4096),
mySampleRate(31400),
myDSBuffer(NULL)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundWin32::~SoundWin32()
{
closeDevice();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HRESULT SoundWin32::Initialize(HWND hWnd)
{
HRESULT hr;
// Create IDirectSound using the primary sound device
if( FAILED( hr = DirectSoundCreate8( NULL, &myDSDevice, NULL ) ) )
{
SoundError("DirectSoundCreate8");
return hr;
}
// Set DirectSound coop level
if( FAILED(hr = myDSDevice->SetCooperativeLevel(hWnd, DSSCL_EXCLUSIVE)) )
{
SoundError("SetCooperativeLevel");
return hr;
}
// Set up the static sound buffer
WAVEFORMATEX wfx;
DSBUFFERDESC dsbdesc;
ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = 1;
wfx.nSamplesPerSec = mySampleRate;
wfx.wBitsPerSample = 8;
wfx.nBlockAlign = 1; //wfx.wBitsPerSample / 8 * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
ZeroMemory(&dsbdesc, sizeof(dsbdesc));
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC;
dsbdesc.dwBufferBytes = myBufferSize;
dsbdesc.lpwfxFormat = &wfx;
hr = myDSDevice->CreateSoundBuffer(&dsbdesc, &myDSBuffer, NULL);
if(SUCCEEDED(hr))
myIsInitializedFlag = true;
return hr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::closeDevice()
{
if(myDSBuffer)
{
myDSBuffer->Stop();
myDSBuffer->Release();
myDSBuffer = NULL;
}
if(myDSDevice)
{
myDSDevice->Release();
myDSDevice = NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 SoundWin32::getSampleRate() const
{
return mySampleRate;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundWin32::isSuccessfullyInitialized() const
{
return myIsInitializedFlag;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::setVolume(Int32 percent)
{
// By default, use the system volume
if(percent < 0 || percent > 100)
return;
// FIXME - let the percentage accurately represent decibel level
// ie, so volume 50 is half as loud as volume 100
// Scale the volume over the given range
if(myDSBuffer)
{
long offset = (long)((DSBVOLUME_MAX - DSBVOLUME_MIN) * (percent/100.0));
myDSBuffer->SetVolume(DSBVOLUME_MIN + offset);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::update()
{
if(myIsInitializedFlag)
{
HRESULT hr;
uInt8 periodCount = 0;
uInt8* buffer = new uInt8[myBufferSize];
if(myPauseStatus) // FIXME - don't stop the buffer so many times
{
myDSBuffer->Stop();
return;
}
// Dequeue samples as long as full fragments are available
while(myMediaSource->numberOfAudioSamples() >= myBufferSize)
{
myMediaSource->dequeueAudioSamples(buffer, myBufferSize);
LPVOID lpvWrite;
DWORD dwLength;
hr = myDSBuffer->Lock(0, 0, &lpvWrite, &dwLength, NULL, NULL, DSBLOCK_ENTIREBUFFER);
if(hr == DS_OK)
{
memcpy(lpvWrite, buffer, dwLength);
myDSBuffer->Unlock(lpvWrite, dwLength, NULL, 0);
myDSBuffer->SetCurrentPosition(0);
myDSBuffer->Play(0, 0, DSBPLAY_LOOPING);
periodCount++;
}
}
delete[] buffer;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundWin32::SoundError(const char* message)
{
string error = "Error: ";
error += message;
OutputDebugString(error.c_str());
myIsInitializedFlag = false;
}

View File

@ -1,116 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SoundWin32.hxx,v 1.3 2003-11-19 21:06:27 stephena Exp $
//============================================================================
#ifndef SOUND_WIN32_HXX
#define SOUND_WIN32_HXX
#include <dsound.h>
#include "bspf.hxx"
#include "MediaSrc.hxx"
#include "Sound.hxx"
/**
This class implements a sound class using the
Win32 DirectSound API.
@author Stephen Anthony
@version $Id: SoundWin32.hxx,v 1.3 2003-11-19 21:06:27 stephena Exp $
*/
class SoundWin32 : public Sound
{
public:
/**
Create a new sound object
*/
SoundWin32();
/**
Destructor
*/
virtual ~SoundWin32();
public:
/**
Closes the sound device
*/
void closeDevice();
/**
Return the playback sample rate for the sound device.
@return The playback sample rate
*/
uInt32 getSampleRate() const;
/**
Return true iff the sound device was successfully initlaized.
@return true iff the sound device was successfully initlaized.
*/
bool isSuccessfullyInitialized() const;
/**
Sets the volume of the sound device to the specified level. The
volume is given as a percentage from 0 to 100. A -1 indicates
that the volume shouldn't be changed at all.
@param percent The new volume percentage level for the sound device
*/
void setVolume(Int32 percent);
/**
Update the sound device using the audio sample from the
media source.
*/
void update();
/**
Initialize the DirectSound subsystem/
@return The result of initialization.
*/
HRESULT Initialize(HWND hwnd);
private:
// Print error messages and clean up
void SoundError(const char* message);
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
// DirectSound device
LPDIRECTSOUND8 myDSDevice;
// DirectSound secondary buffer
LPDIRECTSOUNDBUFFER myDSBuffer;
// Mixer file descriptor
int myMixerFd;
// Original mixer volume when the sound device was opened
int myOriginalVolume;
// PCM buffer size
uInt32 myBufferSize;
// DSP sample rate
uInt32 mySampleRate;
};
#endif

View File

@ -1,127 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaConfig.cpp,v 1.4 2003-11-24 23:56:10 stephena Exp $
//============================================================================
#include "pch.hxx"
#include "bspf.hxx"
#include "SettingsWin32.hxx"
#include "Cyberstella.h"
#include "StellaConfig.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaConfig::StellaConfig(SettingsWin32* settings, CWnd* pParent)
: CDialog(StellaConfig::IDD, pParent),
mySettings(settings)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN_MESSAGE_MAP(StellaConfig, CDialog)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_CONTINUE, OnContinue)
END_MESSAGE_MAP()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL StellaConfig::OnInitDialog()
{
CDialog::OnInitDialog();
// Set up PADDLE
CString paddle = "Paddle%d";
for(uInt32 i = 0; i < 4; i++)
{
paddle.Format("Paddle %d",i);
((CComboBox*)GetDlgItem(IDC_PADDLE))->AddString(paddle);
}
uInt32 paddlemode = mySettings->getInt("paddle");
if(paddlemode < 0 || paddlemode > 4)
paddlemode = 0;
((CComboBox*)GetDlgItem(IDC_PADDLE))->SetCurSel(paddlemode);
// Set up SOUND
string sound = mySettings->getString("sound");
((CButton*) GetDlgItem(IDC_SOUND))->SetCheck(
sound == "0" ? BST_CHECKED : BST_UNCHECKED);
// Set up AutoSelectVideoMode
bool autoselect = mySettings->getBool("autoselect_video");
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->SetCheck
(autoselect ? BST_CHECKED : BST_UNCHECKED);
// Set up JOYSTICK
bool joystick = mySettings->getBool("disable_joystick");
((CButton*)GetDlgItem(IDC_JOYSTICK))->SetCheck
(joystick ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaConfig::OnClose()
{
retrieveData();
CDialog::OnClose();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL StellaConfig::DestroyWindow()
{
retrieveData();
return CDialog::DestroyWindow();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaConfig::retrieveData()
{
string tmp;
// Apply changes
mySettings->setInt("paddle", (uInt32) ((CComboBox*)GetDlgItem(IDC_PADDLE))->GetCurSel());
if(((CButton*)GetDlgItem(IDC_SOUND))->GetCheck())
mySettings->setString("sound", "0");
else
mySettings->setString("sound", "win32");
mySettings->setBool("autoselect_video",
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->GetCheck());
mySettings->setBool("disable_joystick",
((CButton*)GetDlgItem(IDC_JOYSTICK))->GetCheck());
// Save any settings that were changed
mySettings->saveConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaConfig::OnContinue()
{
EndDialog(1);
}

View File

@ -1,60 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2002 by Bradford W. Mott
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: StellaConfig.h,v 1.2 2003-11-24 01:14:38 stephena Exp $
//============================================================================
#ifndef STELLA_CONFIG_H
#define STELLA_CONFIG_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SettingsWin32.hxx"
class StellaConfig : public CDialog
{
public:
StellaConfig(SettingsWin32* settings, CWnd* pParent = NULL);
// Dialog Data
enum { IDD = IDD_CONFIG_PAGE };
// Overrides
public:
virtual BOOL DestroyWindow();
protected:
// DDX/DDV support
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
afx_msg void OnClose();
afx_msg void OnBrowse();
afx_msg void OnContinue();
DECLARE_MESSAGE_MAP()
private:
// The settings for this session
SettingsWin32* mySettings;
// method
void retrieveData();
};
#endif

View File

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

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

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

@ -1,21 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cyberstella", "Cyberstella.vcproj", "{6B7A0EFC-814C-48E5-AA07-39EDB383289E}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{6B7A0EFC-814C-48E5-AA07-39EDB383289E}.Debug.ActiveCfg = Debug|Win32
{6B7A0EFC-814C-48E5-AA07-39EDB383289E}.Debug.Build.0 = Debug|Win32
{6B7A0EFC-814C-48E5-AA07-39EDB383289E}.Release.ActiveCfg = Release|Win32
{6B7A0EFC-814C-48E5-AA07-39EDB383289E}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

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

@ -1,152 +0,0 @@
//
// 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>
// Stella Messages:
#define MSG_GAMELIST_UPDATE WM_USER+0x1000
#define MSG_GAMELIST_DISPLAYNOTE WM_USER+0x1001
#define MSG_VIEW_INITIALIZE WM_USER+0x1002
#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

View File

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

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

View File

@ -1,73 +0,0 @@
//{{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 IDI_FOLDER 133
#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_FILE 282
#define IDS_RARITY 284
#define IDS_STATUSTEXT 289
#define IDS_STELLA 290
#define IDS_NOTETEXT 291
#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_MAINTAINER 1002
#define IDC_EMAIL_STELLA 1003
#define IDC_PLAY 1005
#define IDC_ROMCOUNT 1006
#define IDC_ROMLIST 1007
#define IDC_WEB_MAINTAINER 1010
#define IDC_WEB_STELLA 1011
#define IDC_ROMPATH 1013
#define IDC_CONFIG 1015
#define IDC_PADDLE 1017
#define IDC_SOUND 1018
#define IDC_JOYSTICK 1019
#define IDC_AUTO_SELECT_VIDEOMODE 1020
#define IDC_BROWSE 1021
#define ID_BUTTON32774 32774
#define IDG_GUNFIGHT 32775
#define IDG_JAMMED 32776
#define IDG_QB 32777
#define IDG_THRUST 32778
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 32780
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,36 +0,0 @@
//
// StellaX
// Jeff Miller 04/27/2000
//
#include "pch.hxx"
#include "AboutPage.hxx"
#include "resource.h"
CHelpPage::CHelpPage(
) : \
CPropertyPage(IDD_ABOUT_PAGE)
{
}
BOOL CHelpPage::OnInitDialog(
HWND hwnd
)
{
m_hlMail_JSM.SubclassDlgItem( hwnd, IDC_EMAIL_JEFFMILL );
m_hlMail_JSM.SetURL( _T("mailto:miller@zipcon.net?Subject=StellaX") );
m_hlWWW_JSM.SubclassDlgItem( hwnd, IDC_WEB_JEFFMILL );
m_hlWWW_JSM.SetURL( _T("http://www.emuunlim.com/stellax/") );
m_hlMail_Stella.SubclassDlgItem( hwnd, IDC_EMAIL_STELLA );
m_hlMail_Stella.SetURL( _T("mailto:stella@csc.ncsu.edu") );
m_hlWWW_Stella.SubclassDlgItem( hwnd, IDC_WEB_STELLA );
m_hlWWW_Stella.SetURL( _T("http://stella.atari.org/") );
m_hlWWW_Mame.SubclassDlgItem( hwnd, IDC_WWW_MAME );
m_hlWWW_Mame.SetURL( _T("http://www.classicgaming.com/mame32qa/") );
// return FALSE if SetFocus is called
return TRUE;
}

View File

@ -1,34 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef ABOUTPG_H
#define ABOUTPG_H
#pragma once
#include "PropertySheet.hxx"
#include "HyperLink.hxx"
class CHelpPage : public CPropertyPage
{
public:
CHelpPage();
protected:
virtual BOOL OnInitDialog( HWND hwnd );
private:
CHyperLink m_hlMail_JSM;
CHyperLink m_hlWWW_JSM;
CHyperLink m_hlMail_Stella;
CHyperLink m_hlWWW_Stella;
CHyperLink m_hlWWW_Mame;
CHelpPage( const CHelpPage& ); // no implementation
void operator=( const CHelpPage& ); // no implementation
};
#endif

View File

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

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

@ -1,226 +0,0 @@
//////////////////////////////////////////////////////////////////////
//
// 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
//////////////////////////////////////////////////////////////////////
//
// Construction/Destruction
//
#ifdef MFC
CBrowseForFolder::CBrowseForFolder(
const HWND hParent /*= NULL*/,
const LPITEMIDLIST pidl /*= NULL*/,
const int nTitleID /*= 0*/
)
{
m_hwnd = NULL;
SetOwner(hParent);
SetRoot(pidl);
SetTitle(nTitleID);
m_bi.lpfn = BrowseCallbackProc;
m_bi.lParam = reinterpret_cast<LPARAM>( this );
m_bi.pszDisplayName = m_szSelected;
}
#endif
CBrowseForFolder::CBrowseForFolder(
const HWND hParent,
const LPITEMIDLIST pidl,
LPCTSTR strTitle)
{
m_hwnd = NULL;
SetOwner(hParent);
SetRoot(pidl);
SetTitle(strTitle);
m_bi.lpfn = BrowseCallbackProc;
m_bi.lParam = reinterpret_cast<LPARAM>( this );
m_bi.pszDisplayName = m_szSelected;
}
CBrowseForFolder::~CBrowseForFolder()
{
}
//////////////////////////////////////////////////////////////////////
//
// Implementation
//
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;
}
bool CBrowseForFolder::SetTitle(
LPCTSTR strTitle
)
{
if (m_hwnd != NULL)
return false;
if ( strTitle == NULL )
{
return false;
}
if ( ! m_pchTitle.Set( strTitle ) )
{
return false;
}
m_bi.lpszTitle = m_pchTitle.Get();
return true;
}
#ifdef MFC
bool CBrowseForFolder::SetTitle(const int nTitle)
{
if (nTitle <= 0)
return false;
CString strTitle;
if(!strTitle.LoadString(static_cast(nTitle)))
{
return false;
}
SetTitle(strTitle);
return true;
}
#endif
void CBrowseForFolder::SetFlags(const UINT ulFlags)
{
if (m_hwnd != NULL)
return;
m_bi.ulFlags = ulFlags;
}
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

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

@ -1,154 +0,0 @@
//
// StellaX
// Jeff Miller 05/07/2000
//
#include "pch.hxx"
#include "ConfigPage.hxx"
#include "resource.h"
#include "BrowseForFolder.hxx"
CConfigPage::CConfigPage(
CGlobalData* rGlobalData
) : \
m_rGlobalData( rGlobalData ),
CPropertyPage( IDD_CONFIG_PAGE )
{
}
BOOL CConfigPage::OnInitDialog(
HWND hwnd
)
{
// return FALSE if SetFocus is called
m_hwnd = hwnd;
HWND hwndCtrl;
//
// Set up ROMPATH
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH );
::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 );
::SetWindowText( hwndCtrl, m_rGlobalData->RomDir() );
//
// Set up PADDLE
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_PADDLE );
LPTSTR psz = _T("0");
TCHAR i;
for ( i = 0; i < 4; ++i )
{
psz[0] = _T('0') + i;
::SendMessage( hwndCtrl, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)psz );
}
::SendMessage( hwndCtrl, CB_SETCURSEL,
m_rGlobalData->PaddleMode(), 0 );
//
// Set up SOUND
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND );
::SendMessage( hwndCtrl, BM_SETCHECK,
m_rGlobalData->NoSound() ? BST_CHECKED : BST_UNCHECKED,
0 );
//
// Set up AutoSelectVideoMode
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_AUTO_SELECT_VIDEOMODE );
::SendMessage( hwndCtrl, BM_SETCHECK,
m_rGlobalData->AutoSelectVideoMode() ? BST_CHECKED : BST_UNCHECKED,
0 );
//
// Set up JOYSTICK
//
hwndCtrl = ::GetDlgItem( hwnd, IDC_JOYSTICK );
::SendMessage( hwndCtrl, BM_SETCHECK,
m_rGlobalData->DisableJoystick() ? BST_CHECKED : BST_UNCHECKED,
0 );
return TRUE;
}
void CConfigPage::OnDestroy(
void
)
{
}
LONG CConfigPage::OnApply(
LPPSHNOTIFY lppsn
)
{
UNUSED_ALWAYS( lppsn );
//
// Apply the changes
//
// HWND hwnd = lppsn->hdr.hwndFrom; <<-- points to the sheet!
HWND hwndCtrl;
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH );
ASSERT( hwndCtrl );
::GetWindowText( hwndCtrl, m_rGlobalData->m_pszRomDir, MAX_PATH );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_PADDLE );
ASSERT( hwndCtrl );
m_rGlobalData->m_nPaddleMode = ::SendMessage( hwndCtrl, CB_GETCURSEL, 0, 0 );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_SOUND );
ASSERT( hwndCtrl );
m_rGlobalData->m_fNoSound = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
== BST_CHECKED );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_AUTO_SELECT_VIDEOMODE );
ASSERT( hwndCtrl );
m_rGlobalData->m_fAutoSelectVideoMode = ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
== BST_CHECKED );
hwndCtrl = ::GetDlgItem( m_hwnd, IDC_JOYSTICK );
ASSERT( hwndCtrl );
m_rGlobalData->m_fDisableJoystick= ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 )
== BST_CHECKED );
m_rGlobalData->SetModified();
return PSNRET_NOERROR;
}
BOOL CConfigPage::OnCommand(
WORD wNotifyCode,
WORD wID,
HWND hwndCtl
)
{
UNUSED_ALWAYS( wNotifyCode );
UNUSED_ALWAYS( hwndCtl );
if ( wID == IDC_BROWSE )
{
CBrowseForFolder bff( m_hwnd );
bff.SetFlags( BIF_RETURNONLYFSDIRS );
if ( bff.SelectFolder() )
{
::SetDlgItemText( m_hwnd, IDC_ROMPATH, bff.GetSelectedFolder() );
}
}
return FALSE;
}

View File

@ -1,37 +0,0 @@
//
// StellaX
// Jeff Miller 05/07/2000
//
#ifndef CONFIGPG_H
#define CONFIGPG_H
#pragma once
#include "PropertySheet.hxx"
#include "GlobalData.hxx"
class CConfigPage : public CPropertyPage
{
public:
CConfigPage(CGlobalData* rGlobalData);
protected:
virtual BOOL OnInitDialog( HWND hwnd );
virtual void OnDestroy();
virtual LONG OnApply( LPPSHNOTIFY lppsn );
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ );
private:
CGlobalData* m_rGlobalData;
HWND m_hwnd;
CConfigPage( const CConfigPage& ); // no implementation
void operator=( const CConfigPage& ); // no implementation
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,246 +0,0 @@
//
// StellaX
// Jeff Miller 05/02/2000
//
#ifndef _CONTROLHOST_H_
#define _CONTROLHOST_H_
//
// This code was based from the MSDN DRAGGEOCNTRL sample
// NOTE: PDF control requires UI Deactivate/UI Activate to resize
//
#include <ocidl.h>
#define BASE_EXTENDED_PROPERTY 0x80010000
#define DISPID_NAME (BASE_EXTENDED_PROPERTY | 0x00)
#define DISPID_ALIGN (BASE_EXTENDED_PROPERTY | 0x01)
#define DISPID_BASEHREF (BASE_EXTENDED_PROPERTY | 0x02)
#define IMPLEMENT_IOLECONTROLSITE
#define IMPLEMENT_IOLEINPLACESITEWINDOWLESS
class CActiveXControl
{
public:
CActiveXControl();
virtual ~CActiveXControl();
HRESULT CreateInstance( void );
HRESULT GetDispInterface( IDispatch** piDispatch );
IDispatch* GetDispInterfaceNoAddRef( void );
virtual REFCLSID GetCLSID( void ) = 0;
virtual void OnInitialUpdate( void );
protected:
// Dispatch helpers
HRESULT PutPropertyByName( LPCOLESTR lpsz, VARIANT* pVar );
HRESULT GetIDOfName( LPCOLESTR lpsz, DISPID* pdispid );
static HRESULT GetProperty( IDispatch* pDisp, DISPID dwDispID,
VARIANT* pVar );
static HRESULT PutProperty( IDispatch* pDisp, DISPID dwDispID,
VARIANT* pVar );
// Invoke a method by DISPID with a single parameter
HRESULT Invoke1( DISPID dispid, VARIANT* pvarParam1,
VARIANT* pvarRet = NULL );
// Invoke a method by name with a single parameter
HRESULT Invoke1( LPCOLESTR lpszName, VARIANT* pvarParam1,
VARIANT* pvarRet = NULL );
private:
IDispatch* m_piDispatch;
CActiveXControl( const CActiveXControl& ); // no implementation
void operator=( const CActiveXControl& ); // no implementation
};
inline HRESULT CActiveXControl::GetDispInterface(
IDispatch** piDispatch
)
{
if (piDispatch == NULL)
{
return E_INVALIDARG;
}
m_piDispatch->AddRef();
*piDispatch = m_piDispatch;
return S_OK;
}
inline IDispatch* CActiveXControl::GetDispInterfaceNoAddRef(
void
)
{
return m_piDispatch;
}
// ---------------------------------------------------------------------------
class CControlHost : \
public IDispatch,
#ifdef IMPLEMENT_IOLEINPLACESITEWINDOWLESS
public IOleInPlaceSiteWindowless,
#endif
public IOleInPlaceFrame,
public IOleControlSite,
public IOleClientSite
{
public:
CControlHost( CActiveXControl* pControl );
~CControlHost( );
HRESULT SetHwnd( HWND hwnd );
HRESULT CreateControl( void );
HRESULT DeleteControl( void );
HRESULT QueryObject( REFIID riid, void **ppvObject );
HWND GetControlHWND( void ) const
{
return _hwndControl;
}
protected:
HWND _hwnd; // container window handle
HWND _hwndControl; // Control's window handle
UINT _cRef; // IUnknown ref count
BOOL _bCapture; // mouse capture flag
RECT _rcPos;
void* _punkOuter; // parent container
CActiveXControl* m_pControl;
public:
// *** IUnknown Methods ***
STDMETHODIMP QueryInterface( REFIID riid, LPVOID * ppvObj );
STDMETHODIMP_(ULONG) AddRef( void );
STDMETHODIMP_(ULONG) Release( void );
// *** IDispatch Methods ***
STDMETHOD (GetIDsOfNames)( REFIID riid, OLECHAR FAR* FAR* rgszNames,
unsigned int cNames, LCID lcid,
DISPID FAR* rgdispid );
STDMETHOD (GetTypeInfo)( unsigned int itinfo, LCID lcid,
ITypeInfo FAR* FAR* pptinfo );
STDMETHOD (GetTypeInfoCount)( unsigned int FAR * pctinfo );
STDMETHOD (Invoke)( DISPID dispid, REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult,
EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr );
// *** IOleClientSite methods ***
STDMETHOD (SaveObject)( void );
STDMETHOD (GetMoniker)( DWORD, DWORD, LPMONIKER * );
STDMETHOD (GetContainer)( LPOLECONTAINER * );
STDMETHOD (ShowObject)( void );
STDMETHOD (OnShowWindow)( BOOL );
STDMETHOD (RequestNewObjectLayout)( void );
// *** IOleWindow Methods ***
STDMETHOD (GetWindow)( HWND * phwnd );
STDMETHOD (ContextSensitiveHelp)( BOOL fEnterMode );
// *** IOleInPlaceSite Methods ***
STDMETHOD (CanInPlaceActivate)( void );
STDMETHOD (OnInPlaceActivate)( void );
STDMETHOD (OnUIActivate)( void );
STDMETHOD (GetWindowContext)( IOleInPlaceFrame ** ppFrame,
IOleInPlaceUIWindow ** ppDoc,
LPRECT lprcPosRect, LPRECT lprcClipRect,
LPOLEINPLACEFRAMEINFO lpFrameInfo );
STDMETHOD (Scroll)( SIZE scrollExtent );
STDMETHOD (OnUIDeactivate)( BOOL fUndoable );
STDMETHOD (OnInPlaceDeactivate)( void );
STDMETHOD (DiscardUndoState)( void );
STDMETHOD (DeactivateAndUndo)( void );
STDMETHOD (OnPosRectChange)( LPCRECT lprcPosRect );
#ifdef IMPLEMENT_IOLEINPLACESITEWINDOWLESS
// *** IOleInPlaceSiteEx Methods ***
STDMETHOD (OnInPlaceActivateEx)( BOOL *pfNoRedraw, DWORD dwFlags );
STDMETHOD (OnInPlaceDeactivateEx)( BOOL fNoRedraw );
STDMETHOD (RequestUIActivate)( void );
// *** IOleInPlaceSiteWindowless Methods ***
STDMETHOD (CanWindowlessActivate)( void );
STDMETHOD (GetCapture)( void );
STDMETHOD (SetCapture)( BOOL fCapture );
STDMETHOD (GetFocus)( void );
STDMETHOD (SetFocus)( BOOL fFocus );
STDMETHOD (GetDC)( LPCRECT pRect, DWORD grfFlags, HDC *phDC );
STDMETHOD (ReleaseDC)( HDC hDC );
STDMETHOD (InvalidateRect)( LPCRECT pRect, BOOL fErase );
STDMETHOD (InvalidateRgn)( HRGN hRGN, BOOL fErase );
STDMETHOD (ScrollRect)( INT dx, INT dy, LPCRECT pRectScroll,
LPCRECT pRectClip );
STDMETHOD (AdjustRect)( LPRECT prc );
STDMETHOD (OnDefWindowMessage)( UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT *plResult );
#endif
// *** IOleInPlaceUIWindow Methods ***
STDMETHOD (GetBorder)(LPRECT lprectBorder);
STDMETHOD (RequestBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
STDMETHOD (SetBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
STDMETHOD (SetActiveObject)(IOleInPlaceActiveObject * pActiveObject,
LPCOLESTR lpszObjName);
// *** IOleInPlaceFrame Methods ***
STDMETHOD (InsertMenus)(HMENU hmenuShared,
LPOLEMENUGROUPWIDTHS lpMenuWidths);
STDMETHOD (SetMenu)(HMENU hmenuShared, HOLEMENU holemenu,
HWND hwndActiveObject);
STDMETHOD (RemoveMenus)(HMENU hmenuShared);
STDMETHOD (SetStatusText)(LPCOLESTR pszStatusText);
STDMETHOD (EnableModeless)(BOOL fEnable);
STDMETHOD (TranslateAccelerator)(LPMSG lpmsg, WORD wID);
#ifdef IMPLEMENT_IOLECONTROLSITE
// *** IOleControlSite Methods ***
STDMETHOD (OnControlInfoChanged)(void);
STDMETHOD (LockInPlaceActive)(BOOL fLock);
STDMETHOD (GetExtendedControl)(IDispatch **ppDisp);
STDMETHOD (TransformCoords)(POINTL *pptlHimetric, POINTF *pptfContainer,
DWORD dwFlags);
STDMETHOD (TranslateAccelerator)(LPMSG pMsg, DWORD grfModifiers);
STDMETHOD (OnFocus)(BOOL fGotFocus);
STDMETHOD (ShowPropertyFrame)(void);
#endif
private:
CControlHost( const CControlHost& ); // no implementation
void operator=( const CControlHost& ); // no implementation
};
#endif

View File

@ -1,284 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "CoolCaption.hxx"
// MAKE SURE STYLE IS JUST "TITLE BAR" !
CCoolCaption::CCoolCaption(
) : \
m_hfont( NULL ),
m_tszCaption( NULL ),
m_fIsActive( FALSE ),
m_hDlg( NULL )
{
}
void CCoolCaption::OnInitDialog(
HWND hDlg
)
{
m_hDlg = hDlg;
CalculateNCArea();
}
void CCoolCaption::OnDestroy(
void
)
{
if ( m_hDlg == NULL )
{
return;
}
if ( m_hfont )
{
::DeleteObject( m_hfont );
}
delete[] m_tszCaption;
m_tszCaption = NULL;
}
void CCoolCaption::CalculateNCArea(
)
{
if ( m_hDlg == NULL )
{
return;
}
::GetWindowRect(m_hDlg, &m_rcWindow);
m_cxWindow = (m_rcWindow.right - m_rcWindow.left);
m_cyWindow = (m_rcWindow.bottom - m_rcWindow.top);
m_cxFrame = ::GetSystemMetrics(SM_CXFRAME);
m_cyFrame = ::GetSystemMetrics(SM_CYFRAME);
m_cxButtonSize = ::GetSystemMetrics(SM_CXSIZE);
const int cyCaption = ::GetSystemMetrics(SM_CYCAPTION);
// This is the size of the caption
::SetRect(&m_rcCaption, 0, 0, m_cxWindow, cyCaption + m_cyFrame);
// calculate position of buttons
SetRect(&m_rcClose,
m_cxWindow - m_cxFrame - m_cxButtonSize + 1,
m_rcCaption.top + m_cyFrame + 1,
m_cxWindow - m_cxFrame - 1,
m_rcCaption.bottom - m_cyFrame
);
CopyRect(&m_rcMin, &m_rcClose);
OffsetRect(&m_rcMin, -(m_cxButtonSize-2), 0);
// figure out union of all buttons
RECT rcButtons;
UnionRect(&rcButtons, &m_rcClose, &m_rcMin);
SetRect(&m_rcTextArea, m_cxFrame, m_rcCaption.top+m_cyFrame,
rcButtons.left-m_cxFrame, m_rcCaption.bottom-m_cyFrame);
// Make bold caption font
m_hfont = (HFONT)SendMessage(m_hDlg, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(m_hfont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
m_hfont = CreateFontIndirect(&lf);
// Get caption text
int nCaptionLength = GetWindowTextLength(m_hDlg);
m_tszCaption = new TCHAR[nCaptionLength + 2];
GetWindowText(m_hDlg, m_tszCaption, nCaptionLength+1);
}
void CCoolCaption::OnNcPaint(
HRGN hrgn
)
{
UNUSED_ALWAYS( hrgn );
if ( m_hDlg == NULL )
{
return;
}
HDC hdc = GetWindowDC(m_hDlg);
// Fill in the NC area with the proper color
HPEN hpen, hpenOld;
hpen = CreatePen(PS_SOLID, 1, m_fIsActive ?
GetSysColor(COLOR_ACTIVECAPTION) : \
GetSysColor(COLOR_INACTIVECAPTION));
hpenOld = (HPEN)SelectObject(hdc, hpen);
for (long x = 0; x < m_cxWindow; ++x)
{
if (x < m_cxFrame-1 || x > m_cxWindow-m_cxFrame)
{
// left, right must go from top to bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcWindow.bottom);
}
else
{
// otherwise just do top and bottom
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, m_rcCaption.bottom);
MoveToEx(hdc, x, m_cyWindow-m_cyFrame, NULL);
LineTo(hdc, x, m_cyWindow);
}
}
SelectObject(hdc, hpenOld);
DeleteObject(hpen);
// Draw the close button
DrawFrameControl(hdc, &m_rcClose, DFC_CAPTION, DFCS_CAPTIONCLOSE);
// draw the minimize button
DrawFrameControl(hdc, &m_rcMin, DFC_CAPTION, DFCS_CAPTIONMIN);
// Draw the caption text
SetTextColor(hdc, m_fIsActive ? GetSysColor(COLOR_CAPTIONTEXT) : \
GetSysColor(COLOR_INACTIVECAPTIONTEXT));
SetBkMode(hdc, TRANSPARENT);
HFONT hfontOld = (HFONT)SelectObject(hdc, m_hfont);
// calculate width / height of text
SIZE sizeText;
GetTextExtentPoint(hdc, m_tszCaption, lstrlen(m_tszCaption), &sizeText);
DrawText(hdc, m_tszCaption, -1, &m_rcTextArea,
DT_END_ELLIPSIS | DT_EXTERNALLEADING |
DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
SelectObject(hdc, hfontOld);
// Draw the docking grippers
const int nTextRight = m_rcTextArea.left + sizeText.cx + m_cxFrame;
// right top
COLORREF cr3dHilight = GetSysColor(COLOR_3DHILIGHT);
COLORREF cr3dShadow = GetSysColor(COLOR_3DSHADOW);
Draw3dRect(hdc, nTextRight+m_cxFrame, 8,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
// right bottom
Draw3dRect(hdc, nTextRight+m_cxFrame, 12,
m_rcTextArea.right-(nTextRight+m_cxFrame), 3,
cr3dHilight, cr3dShadow);
ReleaseDC(m_hDlg, hdc);
}
void CCoolCaption::OnNcActivate(
BOOL fActive
)
{
if (m_hDlg == NULL)
return;
m_fIsActive = fActive;
// This fixes a problem where alt-tab wont repaint the NC area
RedrawWindow(m_hDlg, NULL, NULL,
RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
}
BOOL CCoolCaption::OnNCLButtonDown(
INT nHitTest,
POINTS pts
)
{
UNUSED_ALWAYS( nHitTest );
if ( m_hDlg == NULL )
{
return FALSE;
}
// Get the point in client units
RECT rcWindow;
GetWindowRect(m_hDlg, &rcWindow);
POINT pt = { pts.x, pts.y };
pt.x -= rcWindow.left;
pt.y -= rcWindow.top;
if (PtInRect(&m_rcClose, pt))
{
// This isn't closing it!
// SendMessage(m_hDlg, WM_CLOSE, 0, 0);
EndDialog(m_hDlg, IDCANCEL);
return TRUE;
}
if (PtInRect(&m_rcMin, pt))
{
ShowWindow(m_hDlg, SW_MINIMIZE);
return TRUE;
}
return FALSE;
}
void CCoolCaption::FillSolidRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clr
)
{
COLORREF cr = SetBkColor(hdc, clr);
RECT rect = { x, y, x+cx, y+cy };
ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
SetBkColor(hdc, cr);
}
void CCoolCaption::Draw3dRect(
HDC hdc,
int x,
int y,
int cx,
int cy,
COLORREF clrTopLeft,
COLORREF clrBottomRight
)
{
FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
}

View File

@ -1,51 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef COOLCAP_H
#define COOLCAP_H
#pragma once
class CCoolCaption
{
public:
CCoolCaption();
void OnInitDialog(HWND hDlg);
void OnDestroy();
void OnNcPaint(HRGN);
void OnNcActivate(BOOL);
BOOL OnNCLButtonDown(INT, POINTS);
protected:
HWND m_hDlg;
private:
void CalculateNCArea(void);
void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr);
void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
COLORREF clrTopLeft, COLORREF clrBottomRight);
BOOL m_fIsActive;
RECT m_rcWindow;
int m_cxWindow;
int m_cyWindow;
int m_cxFrame;
int m_cyFrame;
int m_cxButtonSize;
RECT m_rcClose;
RECT m_rcMin;
RECT m_rcCaption;
RECT m_rcTextArea;
HFONT m_hfont;
LPTSTR m_tszCaption;
CCoolCaption( const CCoolCaption& ); // no implementation
void operator=( const CCoolCaption& ); // no implementation
};
#endif

View File

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

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

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

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

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

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

@ -1,153 +0,0 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#include "pch.hxx"
#include "DocPage.hxx"
#include "resource.h"
#include <oleauto.h>
static LPCTSTR g_ctszDocFile = _T("\\docs\\stella.pdf");
const CLSID CPDFControl::clsid = { 0xCA8A9780, 0x280D, 0x11CF,
{ 0xA2, 0x4D, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } };
void CPDFControl::OnInitialUpdate(
void
)
{
// This will do a control.src = "c:\temp\a.pdf"
IDispatch* piDispatch = NULL;
if (GetDispInterface(&piDispatch) != S_OK)
return;
TCHAR tszDir[MAX_PATH + 1];
::GetCurrentDirectory(MAX_PATH, tszDir);
lstrcat(tszDir, g_ctszDocFile);
VARIANT var;
VariantInit(&var);
var.vt = VT_BSTR;
#if defined(_UNICODE)
BSTR bstr = ::SysAllocString(tszDir);
if (bstr == NULL)
return;
#else
int nLen = ::MultiByteToWideChar(CP_ACP, 0, tszDir, -1, NULL, NULL);
BSTR bstr = ::SysAllocStringLen(NULL, nLen);
if (bstr == NULL)
return;
::MultiByteToWideChar(CP_ACP, 0, tszDir, -1, bstr, nLen);
#endif
var.bstrVal = bstr;
if (PutPropertyByName(L"src", &var) != S_OK)
{
VariantClear(&var);
piDispatch->Release();
return;
}
VariantClear(&var);
// The following features are only in PDF 4.0 +
VARIANT varRet;
VariantInit(&var);
// This will do a control.setZoom(90)
V_VT(&var) = VT_I1;
V_I1(&var) = 90;
if (Invoke1(L"setZoom", &var, &varRet) != S_OK)
{
VariantClear(&var);
piDispatch->Release();
return;
}
VariantClear(&var);
VariantClear(&varRet);
piDispatch->Release();
}
CDocPage::CDocPage(
) : \
CPropertyPage(IDD_DOC_PAGE),
m_pHost(NULL)
{
}
BOOL CDocPage::OnInitDialog(
HWND hwnd
)
{
TCHAR tszDir[MAX_PATH + 1];
::GetCurrentDirectory(MAX_PATH, tszDir);
lstrcat(tszDir, g_ctszDocFile);
// verify file exists
WIN32_FIND_DATA findFileData;
HANDLE hFind = ::FindFirstFile(tszDir, &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
TCHAR tszMsg[MAX_PATH * 2];
lstrcpy(tszMsg, _T("ERROR: Cannot find "));
lstrcat(tszMsg, tszDir);
HWND hwndInst = ::GetDlgItem(hwnd, IDC_INSTRUCTIONS);
::SetWindowText(hwndInst, tszMsg);
::ShowWindow(hwndInst, SW_SHOW);
return TRUE;
}
::FindClose(hFind);
m_pHost = new CControlHost(new CPDFControl);
m_pHost->SetHwnd(hwnd);
if (m_pHost->CreateControl() != S_OK)
{
::ShowWindow(::GetDlgItem(hwnd, IDC_INSTRUCTIONS), SW_SHOW);
::ShowWindow(::GetDlgItem(hwnd, IDC_ADOBE), SW_SHOW);
m_hlAdobe.SubclassDlgItem(hwnd, IDC_ADOBE);
m_hlAdobe.SetURL(_T("http://www.adobe.com/prodindex/acrobat/alternate.html"));
m_pHost = NULL;
}
// return FALSE if SetFocus is called
return TRUE;
}
void CDocPage::OnDestroy(
void
)
{
delete m_pHost;
}
void CDocPage::OnActivate(
UINT state,
HWND hwndActDeact,
BOOL fMinimized
)
{
if ( state == WA_ACTIVE && !fMinimized && m_pHost )
{
HWND hwnd = m_pHost->GetControlHWND();
if ( hwnd )
{
::InvalidateRect( hwnd, NULL, TRUE );
::UpdateWindow( hwnd );
}
}
}

View File

@ -1,57 +0,0 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#ifndef DOCPG_H
#define DOCPG_H
#pragma once
#include "PropertySheet.hxx"
#include "ControlHost.hxx"
#include "HyperLink.hxx"
class CPDFControl : public CActiveXControl
{
public:
CPDFControl() : CActiveXControl()
{
}
REFCLSID GetCLSID() { return clsid; }
void OnInitialUpdate();
protected:
static const CLSID clsid;
private:
CPDFControl( const CPDFControl& ); // no implementation
void operator=( const CPDFControl& ); // no implementation
};
class CDocPage : public CPropertyPage
{
public:
CDocPage();
protected:
virtual BOOL OnInitDialog(HWND hwnd);
virtual void OnDestroy();
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized );
private:
CHyperLink m_hlAdobe;
CControlHost* m_pHost;
CDocPage( const CDocPage& ); // no implementation
void operator=( const CDocPage& ); // no implementation
};
#endif

View File

@ -1,69 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "FileDialog.hxx"
CFileDialog::CFileDialog(
BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
LPCTSTR lpszDefExt /* = NULL */,
LPCTSTR lpszFileName /* = NULL */,
DWORD dwFlags /* = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT */,
LPCTSTR lpszFilter /* = NULL */,
HWND hwndParent /* = NULL */
)
{
UNUSED_ALWAYS( hwndParent );
memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL
m_szFileName[0] = '\0';
m_szFileTitle[0] = '\0';
m_bOpenFileDialog = bOpenFileDialog;
m_ofn.lStructSize = sizeof(m_ofn);
m_ofn.lpstrFile = m_szFileName;
m_ofn.nMaxFile = _countof(m_szFileName);
m_ofn.lpstrDefExt = lpszDefExt;
m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle;
m_ofn.nMaxFileTitle = _countof(m_szFileTitle);
m_ofn.Flags = (dwFlags | OFN_EXPLORER);
m_ofn.hInstance = NULL;
// setup initial file name
if (lpszFileName != NULL)
lstrcpyn(m_szFileName, lpszFileName, _countof(m_szFileName));
// Translate filter into commdlg format (lots of \0)
if (lpszFilter != NULL)
{
lstrcpy(m_szFilter, lpszFilter);
LPTSTR pch = m_szFilter; // modify the buffer in place
// MFC delimits with '|' not '\0'
while ((pch = _tcschr(pch, '|')) != NULL)
*pch++ = '\0';
m_ofn.lpstrFilter = m_szFilter;
// do not call ReleaseBuffer() since the string contains '\0' characters
}
}
int CFileDialog::DoModal(
void
)
{
int nResult;
if (m_bOpenFileDialog)
{
nResult = ::GetOpenFileName(&m_ofn);
}
else
{
nResult = ::GetSaveFileName(&m_ofn);
}
return nResult ? nResult : IDCANCEL;
}

View File

@ -1,51 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef FILEDLG_H
#define FILEDLG_H
#pragma once
class CFileDialog
{
public:
OPENFILENAME m_ofn;
CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
HWND hwndParent = NULL);
virtual int DoModal();
LPCTSTR GetPathName() const
{
return m_ofn.lpstrFile;
}
LPCTSTR GetFileName() const
{
return m_ofn.lpstrFileTitle;
}
protected:
BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save
TCHAR m_szFilter[1024]; // filter string
// separate fields with '|', terminate with '||\0'
TCHAR m_szFileTitle[64]; // contains file title after return
TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return
private:
CFileDialog( const CFileDialog& ); // no implementation
void operator=( const CFileDialog& ); // no implementation
};
#endif

View File

@ -1,155 +0,0 @@
//
// StellaX
// Jeff Miller 05/06/2000
//
#include "pch.hxx"
#include "GlobalData.hxx"
#include "resource.h"
static LPCTSTR g_pszIniFile = _T(".\\stella.ini");
static LPCTSTR g_pszIniSection = _T("Options");
static LPCTSTR g_pszKeyNameRomPath = _T("RomPath");
static LPCTSTR g_pszKeyNameFrameRate = _T("FrameRate");
static LPCTSTR g_pszKeyNameShowFPS = _T("ShowFPS");
static LPCTSTR g_pszKeyNameMute = _T("Mute");
static LPCTSTR g_pszKeyNamePaddle = _T("Paddle");
static LPCTSTR g_pszKeyNameDisableJoystick = _T("DisableJoystick");
static LPCTSTR g_pszKeyNameAutoSelectVideoMode = _T("AutoSelectVideoMode");
BOOL WritePrivateProfileInt(
LPCTSTR lpAppName, // section name
LPCTSTR lpKeyName, // key name
int nValue,
LPCTSTR lpFileName // initialization file
)
{
TCHAR psz[ 50 ];
_itoa( nValue, psz, 10 );
return ::WritePrivateProfileString( lpAppName,
lpKeyName,
psz,
lpFileName );
}
CGlobalData::CGlobalData(
HINSTANCE hInstance
) : \
m_hInstance(hInstance),
m_fIsModified( FALSE )
{
m_pszPathName[0] = _T('\0');
//
// Read the ROM directory from the stella.ini file
// default to "ROMS" directory for compatibility with older StellaX
//
::GetPrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath,
_T("ROMS"),
m_pszRomDir, _MAX_PATH,
g_pszIniFile);
// Read the desired frame rate
m_nDesiredFrameRate = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate,
60,
g_pszIniFile );
if (m_nDesiredFrameRate < 1 || m_nDesiredFrameRate > 300)
{
m_nDesiredFrameRate = 60;
}
// Read ShowFPS
m_fShowFPS = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameShowFPS,
FALSE,
g_pszIniFile);
//
// Read Mute
//
m_fNoSound = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute,
FALSE,
g_pszIniFile );
//
// Get AutoSelectVideoMode
//
m_fAutoSelectVideoMode =
(BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameAutoSelectVideoMode,
TRUE,
g_pszIniFile );
//
// Read the Paddle mode
//
m_nPaddleMode = (int)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle,
0,
g_pszIniFile);
if ( m_nPaddleMode < 0 || m_nPaddleMode > 3 )
{
m_nPaddleMode = 0;
}
// Read DisableJoystick
m_fDisableJoystick = (BOOL)::GetPrivateProfileInt( g_pszIniSection,
g_pszKeyNameDisableJoystick,
FALSE,
g_pszIniFile );
}
CGlobalData::~CGlobalData(
)
{
//
// Write out settings (if changed)
//
if ( m_fIsModified )
{
::WritePrivateProfileString( g_pszIniSection,
g_pszKeyNameRomPath,
m_pszRomDir,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameFrameRate,
m_nDesiredFrameRate,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameMute,
m_fNoSound,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameAutoSelectVideoMode,
m_fAutoSelectVideoMode,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNamePaddle,
m_nPaddleMode,
g_pszIniFile );
::WritePrivateProfileInt( g_pszIniSection,
g_pszKeyNameDisableJoystick,
m_fDisableJoystick,
g_pszIniFile );
}
}

View File

@ -1,158 +0,0 @@
//
// StellaX
// Jeff Miller 05/06/2000
//
#ifndef GLOBALS_H
#define GLOBALS_H
#pragma once
#include "Event.hxx"
class CConfigPage;
class CGlobalData
{
friend CConfigPage;
public:
CGlobalData(HINSTANCE hInstance);
~CGlobalData();
int DesiredFrameRate( void ) const
{
return m_nDesiredFrameRate;
}
//
// Booleans
//
BOOL ShowFPS( void ) const
{
return m_fShowFPS;
}
BOOL NoSound() const
{
return m_fNoSound;
}
BOOL DisableJoystick( void ) const
{
return m_fDisableJoystick;
}
BOOL AutoSelectVideoMode( void ) const
{
return m_fAutoSelectVideoMode;
}
int PaddleMode( void ) const;
Event::Type PaddleResistanceEvent( void ) const;
Event::Type PaddleFireEvent( void ) const;
LPCTSTR PathName( void ) const
{
if ( m_pszPathName[0] == _T('\0') )
{
return NULL;
}
return m_pszPathName;
}
LPCTSTR RomDir( void ) const
{
return m_pszRomDir;
}
HINSTANCE ModuleInstance( void ) const
{
return m_hInstance;
}
//
// Modified flags
//
void SetModified( void )
{
m_fIsModified = TRUE;
}
BOOL IsModified( void ) const
{
return m_fIsModified;
}
// Basic options
TCHAR* m_pszRomDir;
int m_nPaddleMode;
BOOL m_fNoSound;
BOOL m_fDisableJoystick;
// Advanced options
BOOL m_fShowFPS;
int m_nDesiredFrameRate;
BOOL m_fAutoSelectVideoMode;
HINSTANCE m_hInstance;
TCHAR m_pszPathName[ MAX_PATH ];
BOOL m_fIsModified;
CGlobalData( const CGlobalData& ); // no implementation
void operator=( const CGlobalData& ); // no implementation
};
inline int CGlobalData::PaddleMode(
void
) const
{
return m_nPaddleMode;
}
inline Event::Type CGlobalData::PaddleResistanceEvent(
void
) const
{
switch ( m_nPaddleMode )
{
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 ( m_nPaddleMode )
{
case 1:
return Event::PaddleOneFire;
case 2:
return Event::PaddleTwoFire;
case 3:
return Event::PaddleThreeFire;
}
return Event::PaddleZeroFire;
}
#endif

View File

@ -1,200 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "HeaderCtrl.hxx"
CHeaderCtrl::CHeaderCtrl(
) : \
m_nSortCol(0),
m_fSortAsc(TRUE)
{
}
LRESULT CHeaderCtrl::WndProc(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{
switch ( msg )
{
case WM_DRAWITEM:
rfHandled = TRUE;
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
}
return 0;
}
void CHeaderCtrl::SetSortCol(
int nCol,
BOOL bAsc
)
{
m_nSortCol = nCol;
m_fSortAsc = bAsc;
// change this item to owner draw
HWND hwndHeader = ::GetDlgItem( *this, 0 );
HDITEM hdi;
hdi.mask = HDI_FORMAT;
Header_GetItem(hwndHeader, nCol, &hdi);
hdi.fmt |= HDF_OWNERDRAW;
Header_SetItem(hwndHeader, nCol, &hdi);
// repaint the header
::InvalidateRect(hwndHeader, NULL, TRUE);
}
void CHeaderCtrl::OnDrawItem(
HWND hwnd,
UINT idCtl,
LPDRAWITEMSTRUCT lpdis
)
{
UNUSED_ALWAYS( idCtl );
HDC hdc = lpdis->hDC;
RECT rcLabel;
::CopyRect( &rcLabel, &(lpdis->rcItem) );
/* save the DC */
int nSavedDC = ::SaveDC( hdc );
/* set clip region to column */
HRGN hrgn = ::CreateRectRgnIndirect( &rcLabel );
SelectObject( hdc, hrgn );
DeleteObject( hrgn );
/* draw the background */
::FillRect( hdc, &rcLabel, ::GetSysColorBrush(COLOR_3DFACE) );
/* offset the label */
SIZE size;
::GetTextExtentPoint32( hdc, _T(" "), 1, &size );
int nOffset = size.cx * 2;
/* get the column text and format */
TCHAR tszText[255 + 1];
HDITEM hdi;
hdi.mask = HDI_TEXT | HDI_FORMAT;
hdi.pszText = tszText;
hdi.cchTextMax = 255;
Header_GetItem( GetDlgItem(hwnd, 0), lpdis->itemID, &hdi );
/* determine format for drawing label */
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP |
DT_VCENTER | DT_END_ELLIPSIS;
/* determine justification */
if (hdi.fmt & HDF_CENTER)
{
uFormat |= DT_CENTER;
}
else if (hdi.fmt & HDF_RIGHT)
{
uFormat |= DT_RIGHT;
}
else
{
uFormat |= DT_LEFT;
}
/* adjust the rect if selected */
if (lpdis->itemState & ODS_SELECTED)
{
rcLabel.left++;
rcLabel.top += 2;
rcLabel.right++;
}
/* adjust rect for sort arrow */
if ( lpdis->itemID == m_nSortCol )
{
rcLabel.right -= (3 * nOffset);
}
rcLabel.left += nOffset;
rcLabel.right -= nOffset;
/* draw label */
if ( rcLabel.left < rcLabel.right )
{
::DrawText(hdc, tszText, -1, &rcLabel, uFormat );
}
/* draw the arrow */
if ( lpdis->itemID == m_nSortCol )
{
RECT rcIcon;
HPEN hpenLight, hpenShadow, hpenOld;
::CopyRect( &rcIcon, &(lpdis->rcItem) );
hpenLight = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) );
hpenShadow = ::CreatePen( PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW) );
hpenOld = (HPEN)::SelectObject( hdc, hpenLight );
if (m_fSortAsc)
{
/* draw triangle pointing up */
::MoveToEx( hdc, rcIcon.right - 2 * nOffset, nOffset - 1, NULL );
::LineTo( hdc, rcIcon.right - 3 * nOffset / 2,
rcIcon.bottom - nOffset );
::LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 2,
rcIcon.bottom - nOffset );
::MoveToEx( hdc, rcIcon.right - 5 * nOffset / 2 - 1,
rcIcon.bottom - nOffset, NULL );
::SelectObject( hdc, hpenShadow );
::LineTo( hdc, rcIcon.right - 2 * nOffset, nOffset - 2 );
}
else
{
/* draw triangle pointing down */
::MoveToEx( hdc, rcIcon.right - 3 * nOffset / 2, nOffset - 1,
NULL );
::LineTo( hdc, rcIcon.right - 2 * nOffset - 1,
rcIcon.bottom - nOffset );
::LineTo( hdc, rcIcon.right - 2 * nOffset - 1,
rcIcon.bottom - nOffset );
::MoveToEx( hdc, rcIcon.right - 2 * nOffset - 1,
rcIcon.bottom - nOffset, NULL );
::SelectObject( hdc, hpenShadow );
::LineTo( hdc, rcIcon.right - 5 * nOffset / 2 - 1,
nOffset - 1 );
::LineTo( hdc, rcIcon.right - 3 * nOffset / 2,
nOffset - 1 );
}
::SelectObject( hdc, hpenOld );
::DeleteObject( hpenShadow );
::DeleteObject( hpenLight );
}
::RestoreDC( hdc, nSavedDC );
}

View File

@ -1,54 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef HDRCTL_H
#define HDRCTL_H
#pragma once
#include "Wnd.hxx"
class CHeaderCtrl : public CWnd
{
public:
CHeaderCtrl();
void SetSortCol(int nCol, BOOL fAscending);
int GetSortCol(void) const;
BOOL GetSortAsc(void) const;
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
UINT m_nSortCol;
BOOL m_fSortAsc;
CHeaderCtrl( const CHeaderCtrl& ); // no implementation
void operator=( const CHeaderCtrl& ); // no implementation
};
inline int CHeaderCtrl::GetSortCol
(
void
) const
{
return m_nSortCol;
}
inline BOOL CHeaderCtrl::GetSortAsc
(
void
) const
{
return m_fSortAsc;
}
#endif

View File

@ -1,352 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "HyperLink.hxx"
#include <shellapi.h>
CHyperLink::CHyperLink(
) : \
m_bOverControl(FALSE),
m_bVisited(FALSE),
m_hFont(NULL),
m_hLinkCursor(NULL)
{
m_crLinkColor = RGB( 0, 0, 238); // Blue
m_crVisitedColor = RGB( 85, 26, 139); // Purple
m_crHoverColor = ::GetSysColor(COLOR_HIGHLIGHT);
SetDefaultCursor();
}
CHyperLink::~CHyperLink(
)
{
if (m_hFont)
{
::DeleteObject( m_hFont );
m_hFont = NULL;
}
}
void CHyperLink::SetURL(
LPCTSTR ctszURL
)
{
if (ctszURL == NULL)
return;
lstrcpy(m_tszURL, ctszURL);
}
void CHyperLink::PreSubclassWindow(
HWND hwnd
)
{
::GetWindowText( hwnd, m_tszText, MAX_HYPERLINK_TEXT_LEN );
m_hFont = (HFONT)::SendMessage(hwnd, WM_GETFONT, 0, 0);
}
LRESULT CHyperLink::WndProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{
switch (msg)
{
case WM_PAINT:
rfHandled = TRUE;
return OnPaint(hwnd);
case WM_SETCURSOR:
rfHandled = TRUE;
return OnSetCursor(hwnd, LOWORD(lParam), HIWORD(lParam));
case WM_LBUTTONUP:
rfHandled = TRUE;
return OnLButtonUp(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
case WM_MOUSEMOVE:
rfHandled = TRUE;
return OnMouseMove(hwnd, wParam, LOWORD(lParam),
HIWORD(lParam));
}
return 0;
}
LRESULT CHyperLink::OnPaint(
HWND hwnd
)
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, m_hFont);
if (m_bOverControl)
{
SetTextColor(hdc, m_crHoverColor);
}
else if (m_bVisited)
{
SetTextColor(hdc, m_crVisitedColor);
}
else
{
SetTextColor(hdc, m_crLinkColor);
}
::SetBkMode( hdc, TRANSPARENT );
::TextOut( hdc, 0, 0, m_tszText, lstrlen(m_tszText) );
EndPaint(hwnd, &ps);
return 0;
}
BOOL CHyperLink::OnSetCursor(
HWND hwnd,
WORD nHittest,
WORD wMouseMsg
)
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( nHittest );
UNUSED_ALWAYS( wMouseMsg );
if (m_hLinkCursor)
{
::SetCursor(m_hLinkCursor);
return TRUE;
}
return FALSE;
}
LRESULT CHyperLink::OnLButtonUp(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
{
UNUSED_ALWAYS( fwKeys );
UNUSED_ALWAYS( xPos );
UNUSED_ALWAYS( yPos );
int result = (int)GotoURL(m_tszURL, SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited)
{
MessageBeep(MB_ICONEXCLAMATION);
ReportError(result);
}
else
{
m_bVisited = TRUE;
InvalidateRect(hwnd, NULL, FALSE);
}
return 0;
}
LRESULT CHyperLink::OnMouseMove(
HWND hwnd,
WPARAM fwKeys,
WORD xPos,
WORD yPos
)
{
UNUSED_ALWAYS( fwKeys );
// call defwindowproc?
if (m_bOverControl)
{
RECT rc;
GetClientRect(hwnd, &rc);
POINT pt = { xPos, yPos };
if (!PtInRect(&rc, pt))
{
m_bOverControl = FALSE;
ReleaseCapture();
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
}
}
else
{
m_bOverControl = TRUE;
RedrawWindow(hwnd, NULL, NULL,
RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
SetCapture(hwnd);
}
return 0;
}
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor(
void
)
{
if (m_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
TCHAR tszWndDir[MAX_PATH + 1];
GetWindowsDirectory(tszWndDir, MAX_PATH);
lstrcat(tszWndDir, _T("\\winhlp32.exe"));
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(tszWndDir);
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
)
{
TCHAR tsz[MAX_HYPERLINK_TEXT_LEN + 1];
switch (nError)
{
case 0:
lstrcpy(tsz, _T("The operating system is out\nof memory or resources."));
break;
case SE_ERR_PNF:
lstrcpy(tsz, _T("The specified path was not found."));
break;
case SE_ERR_FNF:
lstrcpy(tsz, _T("The specified file was not found."));
break;
case ERROR_BAD_FORMAT:
lstrcpy(tsz, _T("The .EXE file is invalid\n(non-Win32 .EXE or error in .EXE image)."));
break;
case SE_ERR_ACCESSDENIED:
lstrcpy(tsz, _T("The operating system denied\naccess to the specified file."));
break;
case SE_ERR_ASSOCINCOMPLETE:
lstrcpy(tsz,_T("The filename association is\nincomplete or invalid."));
break;
case SE_ERR_DDEBUSY:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because other DDE transactions\nwere being processed."));
break;
case SE_ERR_DDEFAIL:
lstrcpy(tsz, _T("The DDE transaction failed."));
break;
case SE_ERR_DDETIMEOUT:
lstrcpy(tsz, _T("The DDE transaction could not\nbe completed because the request timed out."));
break;
case SE_ERR_DLLNOTFOUND:
lstrcpy(tsz, _T("The specified dynamic-link library was not found."));
break;
case SE_ERR_NOASSOC:
lstrcpy(tsz, __T("There is no application associated\nwith the given filename extension."));
break;
case SE_ERR_OOM:
lstrcpy(tsz, _T("There was not enough memory to complete the operation."));
break;
case SE_ERR_SHARE:
lstrcpy(tsz, _T("A sharing violation occurred."));
break;
default:
wsprintf(tsz, _T("Unknown error %d occurred."), nError);
break;
}
TCHAR tszCaption[MAX_HYPERLINK_TEXT_LEN + 1];
lstrcpy(tszCaption, _T("Unable to open hyperlink"));
MessageBox(NULL, tsz, tszCaption, 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

@ -1,66 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef HYPERLINK_H
#define HYPERLINK_H
#pragma once
#define MAX_HYPERLINK_TEXT_LEN 256
#define MAX_HYPERLINK_URL 256
#include "Wnd.hxx"
class CHyperLink : public CWnd
{
public:
CHyperLink();
~CHyperLink();
void SetURL(LPCTSTR ctszURL);
protected:
virtual void PreSubclassWindow(HWND hwnd);
virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
void SetDefaultCursor();
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
void ReportError(int nError);
HINSTANCE GotoURL(LPCTSTR url, int showcmd);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam);
HBRUSH OnCtlColorStatic(HWND hwnd, HDC hdcStatic, HWND hwndStatic);
BOOL OnSetCursor(HWND hwnd, WORD nHittest, WORD wMouseMsg);
LRESULT OnPaint(HWND hwnd);
LRESULT OnLButtonUp(HWND, WPARAM, WORD, WORD);
LRESULT OnMouseMove(HWND, WPARAM, WORD, WORD);
// Stuff from the control
TCHAR m_tszText[MAX_HYPERLINK_TEXT_LEN + 1];
HFONT m_hFont;
// link specific
COLORREF m_crLinkColor;
COLORREF m_crVisitedColor;
COLORREF m_crHoverColor;
BOOL m_bOverControl;
BOOL m_bVisited;
HCURSOR m_hLinkCursor;
TCHAR m_tszURL[MAX_HYPERLINK_URL + 1];
CHyperLink( const CHyperLink& ); // no implementation
void operator=( const CHyperLink& ); // no implementation
};
#endif

View File

@ -1,724 +0,0 @@
//
// StellaX
// Jeff Miller 05/12/2000
//
#include "pch.hxx"
#include "MainDlg.hxx"
#include "PropertySheet.hxx"
#include "ConfigPage.hxx"
#include "AboutPage.hxx"
#include "MD5.hxx"
#include "PropsSet.hxx"
#include "resource.h"
// NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS!
inline LPARAM ListView_GetItemData(
HWND hwndList,
int iItem
)
{
LVITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iItem = iItem;
lvi.iSubItem = 0;
ListView_GetItem(hwndList, &lvi);
return lvi.lParam;
}
CMainDlg::CMainDlg(HINSTANCE hInstance)
: m_hInstance(hInstance)
{
m_pGlobalData = new CGlobalData(hInstance);
}
CMainDlg::~CMainDlg()
{
delete m_pGlobalData;
}
void CMainDlg::ClearList(
void
)
{
int nCount = ListView_GetItemCount( m_hwndList );
for (int i = 0; i < nCount; ++i)
{
delete (CListData*)ListView_GetItemData( m_hwndList, i );
}
ListView_DeleteAllItems( m_hwndList );
}
int CMainDlg::DoModal(
HWND hwndParent
)
{
return DialogBoxParam( m_hInstance,
MAKEINTRESOURCE(IDD),
hwndParent,
StaticDialogFunc,
(LPARAM)this );
}
BOOL CALLBACK CMainDlg::StaticDialogFunc(
HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
CMainDlg* pDlg;
switch ( uMsg )
{
case WM_INITDIALOG:
pDlg = reinterpret_cast<CMainDlg*>( lParam );
pDlg->m_hwnd = hDlg;
(void)::SetWindowLong( hDlg,
DWL_USER,
reinterpret_cast<LONG>( pDlg ) );
break;
default:
pDlg = reinterpret_cast<CMainDlg*>(
::GetWindowLong( hDlg, DWL_USER ) );
if ( pDlg == NULL )
{
return FALSE;
}
break;
}
return pDlg->DialogFunc( uMsg, wParam, lParam );
}
BOOL CALLBACK CMainDlg::DialogFunc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) );
case WM_INITDIALOG:
return OnInitDialog( );
case WM_NOTIFY:
return OnNotify( (int)wParam, (LPNMHDR)lParam );
case WM_SYSCOMMAND:
// Allow Alt-F4 to close the window
if ( wParam == SC_CLOSE )
{
::EndDialog( m_hwnd, IDCANCEL );
}
break;
}
return FALSE;
}
BOOL CMainDlg::OnInitDialog(void)
{
DWORD dwRet;
HWND hwnd = *this;
dwRet = m_stella.Initialize();
if ( dwRet != ERROR_SUCCESS )
{
MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") );
SendMessage( hwnd, WM_CLOSE, 0, 0 );
return FALSE;
}
// Set dialog icon
HICON hicon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_APP));
::SendMessage( hwnd, WM_SETICON, ICON_BIG, (LPARAM)hicon );
::SendMessage( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hicon );
//
// Make the Rom note have bold text
//
HWND hwndCtrl;
hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMNOTE );
HFONT hfont = (HFONT)::SendMessage( hwndCtrl, WM_GETFONT, 0, 0 );
LOGFONT lf;
::GetObject( hfont, sizeof(LOGFONT), &lf );
lf.lfWeight = FW_BOLD;
m_hfontRomNote = ::CreateFontIndirect( &lf );
if ( m_hfontRomNote )
{
::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 );
}
// Do subclassing
m_header.SubclassDlgItem( hwnd, IDC_ROMLIST );
const int nMaxString = 256;
TCHAR psz[nMaxString + 1];
// Initialize the list view
m_hwndList = ::GetDlgItem( hwnd, IDC_ROMLIST );
ASSERT( m_hwndList );
// LVS_EX_ONECLICKACTIVATE was causing a/vs in kernel32
::SendMessage( m_hwndList,
LVM_SETEXTENDEDLISTVIEWSTYLE,
0,
LVS_EX_FULLROWSELECT );
RECT rc;
::GetClientRect( m_hwndList, &rc );
LONG lTotalWidth = rc.right-rc.left - GetSystemMetrics(SM_CXVSCROLL);
int cx = lTotalWidth / CListData::GetColumnCount();
for (int i = 0; i < CListData::GetColumnCount(); ++i)
{
::LoadString( m_hInstance,
CListData::GetColumnNameIdForColumn( i ),
psz, nMaxString );
LV_COLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = cx;
lvc.pszText = psz;
ListView_InsertColumn( m_hwndList, i, &lvc );
}
DWORD dwError = PopulateRomList();
if ( dwError != ERROR_SUCCESS )
{
MessageBoxFromWinError( dwError, _T("PopulateRomList") );
return FALSE;
}
// if items added, select first item and enable play button
int nCount = ListView_GetItemCount( m_hwndList );
if (nCount != 0)
{
#ifdef _DEBUG
DWORD dwStartTick = ::GetTickCount();
#endif
m_header.SetSortCol( 0, TRUE );
ListView_SortItems( m_hwndList,
ListViewCompareFunc,
(LPARAM)this );
#ifdef _DEBUG
TRACE("\tElapsed ticks for ListView_SortItems = %ld", ::GetTickCount()-dwStartTick);
#endif
ListView_SetItemState( m_hwndList, 0, LVIS_SELECTED | LVIS_FOCUSED,
LVIS_SELECTED | LVIS_FOCUSED );
}
else
{
::EnableWindow(::GetDlgItem( hwnd, IDC_PLAY), FALSE );
}
//
// Show status text
//
TCHAR pszStatus[256 + 1];
LoadString(m_hInstance, IDS_STATUSTEXT, pszStatus, 256);
wsprintf( psz, pszStatus, nCount );
SetDlgItemText( hwnd, IDC_ROMCOUNT, psz );
//
// Show rom path
//
SetDlgItemText( hwnd, IDC_ROMPATH, m_pGlobalData->RomDir() );
//
// Set default button
//
::SendMessage( hwnd, DM_SETDEFID, IDC_PLAY, 0 );
// return FALSE if SetFocus is called
return TRUE;
}
BOOL CMainDlg::OnCommand(
int id,
HWND hwndCtl,
UINT codeNotify
)
{
UNUSED_ALWAYS( hwndCtl );
UNUSED_ALWAYS( codeNotify );
HWND hwnd = *this;
CListData* pListData;
int nItem;
switch (id)
{
case IDC_PLAY:
nItem = (int)::SendMessage( m_hwndList,
LVM_GETNEXTITEM,
(WPARAM)-1,
MAKELPARAM( LVNI_SELECTED, 0 ) );
ASSERT( nItem != -1 );
if ( nItem == -1 )
{
::MessageBox( m_hInstance,
hwnd,
IDS_NO_ITEM_SELECTED );
return TRUE;
}
#if 0
TCHAR pszFile[MAX_PATH + 1];
// BUGBUG: On Win95b pszFile is coming back empty!
LVITEM lvi;
lvi.mask = LVIF_TEXT;
lvi.iItem = nItem;
lvi.iSubItem = CListData::FILENAME_COLUMN;
lvi.pszText = pszFile;
lvi.cchTextMax = MAX_PATH;
::SendMessage( m_hwndList, LVM_GETITEM, 0, (LPARAM)&lvi );
#endif
pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem );
TCHAR pszPathName[ MAX_PATH + 1 ];
lstrcpy( pszPathName, m_pGlobalData->RomDir() );
lstrcat( pszPathName, _T("\\") );
lstrcat( pszPathName,
pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) );
// Play the game!
::EnableWindow( hwnd, FALSE );
(void)m_stella.PlayROM( hwnd,
pszPathName,
pListData->GetTextForColumn( CListData::NAME_COLUMN ),
m_pGlobalData);
::EnableWindow( hwnd, TRUE );
// Set focus back to the rom list
::SetFocus( m_hwndList );
return TRUE;
case IDC_EXIT:
ClearList();
::EndDialog( hwnd, IDCANCEL );
return TRUE;
case IDC_CONFIG:
{
CPropertySheet ps( _T("Configure"), hwnd );
CConfigPage pgConfig(m_pGlobalData);
ps.AddPage( &pgConfig );
(void)ps.DoModal();
}
return TRUE;
case IDC_ABOUT:
{
CPropertySheet ps( _T("Help"), hwnd );
CHelpPage pgAbout;
ps.AddPage( &pgAbout );
(void)ps.DoModal();
}
}
return FALSE;
}
BOOL CMainDlg::OnNotify(
int idCtrl,
LPNMHDR pnmh
)
{
UNUSED_ALWAYS( idCtrl );
switch ( pnmh->code )
{
case LVN_GETDISPINFO:
OnGetDispInfo( (NMLVDISPINFO*)pnmh );
return TRUE;
case LVN_COLUMNCLICK:
OnColumnClick( (LPNMLISTVIEW)pnmh );
return TRUE;
case LVN_ITEMCHANGED:
OnItemChanged( (LPNMLISTVIEW)pnmh );
return TRUE;
case NM_DBLCLK:
// send out an ok click to play
::SendDlgItemMessage( *this, IDC_PLAY, BM_CLICK, 0, 0 );
return TRUE;
}
// not handled
return FALSE;
}
static void ScreenToClient(
HWND hwnd,
LPRECT lpRect
)
{
::ScreenToClient(hwnd, (LPPOINT)lpRect);
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
}
static void FillSolidRect(
HDC hdc,
LPCRECT lpRect,
COLORREF clr
)
{
COLORREF crOld = ::SetBkColor(hdc, clr);
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
::SetBkColor(hdc, crOld);
}
// ---------------------------------------------------------------------------
DWORD CMainDlg::PopulateRomList(
void
)
{
TRACE("CMainDlg::PopulateRomList");
DWORD dwRet;
#ifdef _DEBUG
DWORD dwStartTick = ::GetTickCount();
#endif
ClearList();
// REVIEW: Support .zip files?
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_hwndList, 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 = LPSTR_TEXTCALLBACK;
lvi.lParam = (LPARAM)pListData;
int nItem = ListView_InsertItem( m_hwndList, &lvi );
ASSERT( nItem != -1 );
ListView_SetItemText( m_hwndList, nItem,
CListData::FILENAME_COLUMN, LPSTR_TEXTCALLBACK );
ListView_SetItemText(m_hwndList, nItem,
CListData::MANUFACTURER_COLUMN, LPSTR_TEXTCALLBACK);
ListView_SetItemText( m_hwndList, nItem,
CListData::RARITY_COLUMN, LPSTR_TEXTCALLBACK );
// go to the next rom file
fDone = !FindNextFile(hFind, &ffd);
}
if ( hFind != INVALID_HANDLE_VALUE )
{
VERIFY( ::FindClose( hFind ) );
}
#ifdef _DEBUG
TRACE("\tElapsed ticks for PopulateRomList = %ld", ::GetTickCount()-dwStartTick);
#endif
return ERROR_SUCCESS;
}
DWORD CMainDlg::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 CMainDlg::OnColumnClick(
LPNMLISTVIEW pnmv
)
{
HCURSOR hcur = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
m_header.SetSortCol(pnmv->iSubItem, TRUE);
ListView_SortItems(pnmv->hdr.hwndFrom, ListViewCompareFunc, (LPARAM)this);
// ensure the selected item is visible
int nItem = ListView_GetNextItem( m_hwndList, -1, LVNI_SELECTED );
if (nItem != -1)
{
ListView_EnsureVisible( m_hwndList, nItem, TRUE );
}
::SetCursor(hcur);
}
void CMainDlg::OnItemChanged(
LPNMLISTVIEW pnmv
)
{
HWND hwnd = *this;
HWND hwndNote = ::GetDlgItem( hwnd, IDC_ROMNOTE );
RECT rc;
::GetWindowRect(hwndNote, &rc);
::ScreenToClient( hwnd, (LPPOINT)&rc );
::ScreenToClient( hwnd, ((LPPOINT)&rc)+1 );
int iItem = ListView_GetNextItem(pnmv->hdr.hwndFrom, -1, LVNI_SELECTED);
if (iItem == -1)
{
::SetWindowText( hwndNote, _T("") );
::EnableWindow( ::GetDlgItem( hwnd, IDC_PLAY ), FALSE );
::InvalidateRect( hwnd, &rc, TRUE );
return;
}
CListData* pListData = (CListData*)ListView_GetItemData(
pnmv->hdr.hwndFrom,
pnmv->iItem );
::SetWindowText( hwndNote, pListData->GetNote() );
::InvalidateRect( hwnd, &rc, TRUE );
::EnableWindow( ::GetDlgItem( hwnd, IDC_PLAY ), TRUE );
}
// ---------------------------------------------------------------------------
// LPSTR_TEXTCALLBACK message handlers
void CMainDlg::OnGetDispInfo(
NMLVDISPINFO* pnmv
)
{
// Provide the item or subitem's text, if requested.
if ( ! (pnmv->item.mask & LVIF_TEXT ) )
{
return;
}
CListData* pListData = (CListData*)ListView_GetItemData(
pnmv->hdr.hwndFrom,
pnmv->item.iItem );
ASSERT( pListData );
if ( pListData == NULL )
{
return;
}
if ( ! pListData->IsPopulated() )
{
ReadRomData( pListData );
}
pnmv->item.pszText = const_cast<LPTSTR>( pListData->GetTextForColumn(pnmv->item.iSubItem) );
// ASSERT( pnmv->item.pszText );
}
int CALLBACK CMainDlg::ListViewCompareFunc(
LPARAM lParam1,
LPARAM lParam2,
LPARAM lParamSort
)
{
CMainDlg* pThis = reinterpret_cast<CMainDlg*>( lParamSort );
//
// I assume that the metadata for column 0 is always available,
// while other column metadata requires a call to ReadRomData
//
int nSortCol = pThis->m_header.GetSortCol();
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 );
}

View File

@ -1,248 +0,0 @@
//
// StellaX
// Jeff Miller 05/10/2000
//
#ifndef MAINDLG_H
#define MAINDLG_H
#pragma once
#include "resource.h"
#include "GlobalData.hxx"
#include "StellaXMain.hxx"
#include "HeaderCtrl.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;
}
//
// MetaData
//
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;
}
private:
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
};
// ---------------------------------------------------------------------------
class CMainDlg
{
public:
enum { IDD = IDD_MAIN };
CMainDlg(HINSTANCE hInstance);
~CMainDlg();
virtual int DoModal( HWND hwndParent );
operator HWND( void ) const
{
return m_hwnd;
}
private:
HWND m_hwnd;
CHeaderCtrl m_header;
//
// Message handlers
//
BOOL OnInitDialog( void );
BOOL OnCommand( int id, HWND hwndCtl, UINT codeNotify );
BOOL OnNotify( int idCtrl, LPNMHDR pnmh );
HBRUSH OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic );
//
// wm_notify handlers
//
void OnGetDispInfo( NMLVDISPINFO* pnmh );
void OnColumnClick( LPNMLISTVIEW pnmv );
void OnItemChanged( LPNMLISTVIEW pnmv );
//
// cool caption handlers
//
void OnDestroy( void );
void OnNcPaint( HRGN hrgn );
void OnNcActivate( BOOL fActive );
BOOL OnNcLButtonDown( INT nHitTest, POINTS pts );
//
// callback methods
//
BOOL CALLBACK DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam );
static BOOL CALLBACK StaticDialogFunc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
static int CALLBACK ListViewCompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
// internal data
DWORD PopulateRomList();
DWORD ReadRomData( CListData* ) const;
HINSTANCE m_hInstance;
// stuff in list
HWND m_hwndList;
void ClearList();
HFONT m_hfontRomNote;
// Stella stuff
CGlobalData* m_pGlobalData;
CStellaXMain m_stella;
CMainDlg( const CMainDlg& ); // no implementation
void operator=( const CMainDlg& ); // no implementation
};
#endif

View File

@ -1,260 +0,0 @@
//
// StellaX
// Jeff Miller 05/02/2000
//
#include "pch.hxx"
#include "PropertySheet.hxx"
#pragma comment(lib, "comctl32")
#include <pshpack1.h>
typedef struct DLGTEMPLATEEX
{
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h>
CPropertyPage::CPropertyPage(
UINT nIDTemplate,
UINT nIDCaption /* = 0 */
)
{
UNUSED_ALWAYS( nIDCaption );
ZeroMemory(&m_psp, sizeof(m_psp));
m_psp.dwSize = sizeof(m_psp);
m_psp.dwFlags = PSP_USECALLBACK;
// m_psp.hInstance = hInstance;
m_psp.pszTemplate = MAKEINTRESOURCE(nIDTemplate);
m_psp.pfnDlgProc = StaticDlgProc;
m_psp.lParam = (LPARAM)this;
m_psp.pfnCallback = StaticCallback;
}
UINT CALLBACK CPropertyPage::StaticCallback(
HWND hwnd,
UINT uMsg,
LPPROPSHEETPAGE ppsp
)
{
UNUSED_ALWAYS( hwnd );
UNUSED_ALWAYS( ppsp );
switch (uMsg)
{
case PSPCB_CREATE:
// ppsp->lParam holds create lParam
return TRUE;
case PSPCB_RELEASE:
break;
}
return 0;
}
BOOL CALLBACK CPropertyPage::StaticDlgProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
CPropertyPage* pPage = NULL;
switch ( uMsg )
{
case WM_INITDIALOG:
pPage = reinterpret_cast<CPropertyPage*>(
reinterpret_cast<PROPSHEETPAGE*>( lParam )->lParam );
(void)::SetWindowLong( hwnd,
DWL_USER,
reinterpret_cast<LONG>( pPage ) );
break;
default:
pPage = reinterpret_cast<CPropertyPage*>(
::GetWindowLong( hwnd, DWL_USER ) );
if ( pPage == NULL )
{
return FALSE;
}
break;
}
return pPage->DlgProc( hwnd, uMsg, wParam, lParam );
}
BOOL CALLBACK CPropertyPage::DlgProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
)
{
switch (msg)
{
case WM_ACTIVATE:
OnActivate( (UINT)LOWORD(wParam), (HWND)lParam, (BOOL)HIWORD(wParam) );
return TRUE;
case WM_INITDIALOG:
return OnInitDialog( hwnd );
case WM_DESTROY:
OnDestroy( );
return TRUE;
case WM_COMMAND:
return OnCommand( HIWORD(wParam), LOWORD(wParam), (HWND)lParam );
case WM_NOTIFY:
// Handle PSN_QUERYCANCEL?
// Handle PSN_KILLACTIVE?
switch (((LPNMHDR)lParam)->code)
{
case PSN_SETACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnSetActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_KILLACTIVE:
::SetWindowLong(hwnd, DWL_MSGRESULT, OnKillActive( (LPPSHNOTIFY)lParam ) );
return TRUE;
case PSN_APPLY:
::SetWindowLong( hwnd, DWL_MSGRESULT, OnApply( (LPPSHNOTIFY)lParam) );
return TRUE;
case PSN_RESET:
OnReset( (LPPSHNOTIFY)lParam );
return TRUE;
}
return OnNotify( (int)wParam, (LPNMHDR)lParam );
}
return FALSE;
}
//
// CPropertySheet
//
CPropertySheet::CPropertySheet
(
LPCTSTR pszCaption,
HWND hwndParent,
UINT nStartPage /* = 0 */
) :\
m_strCaption( pszCaption )
{
ZeroMemory(&m_psh, sizeof(m_psh));
m_psh.dwSize = sizeof(m_psh);
m_psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
m_psh.hwndParent = hwndParent;
m_psh.hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE);
m_psh.pszCaption = m_strCaption.c_str();
m_psh.nStartPage = nStartPage;
m_psh.pfnCallback = StaticCallback;
}
CPropertySheet::~CPropertySheet(
)
{
// BUGBUG: This is static!
/*
if ( m_hfontLogo )
{
::DeleteObject( m_hfontLogo );
m_hfontLogo = NULL;
}
*/
}
void CPropertySheet::AddPage(
CPropertyPage* pPage
)
{
if (pPage)
{
m_pages.push_back(pPage);
}
}
int CPropertySheet::DoModal(
void
)
{
int nSize = m_pages.size();
if (nSize == 0)
return IDCANCEL;
PROPSHEETPAGE* pspage = new PROPSHEETPAGE[nSize];
for (int i = 0; i < nSize; ++i)
{
CopyMemory(&(pspage[i]), m_pages[i]->GetPropSheetPage(),
sizeof(PROPSHEETPAGE));
pspage[i].hInstance = m_psh.hInstance;
}
m_psh.nPages = nSize;
m_psh.ppsp = pspage;
int nRet = ::PropertySheet( &m_psh );
delete[] pspage;
return nRet;
}
int CALLBACK CPropertySheet::StaticCallback(
HWND hwnd,
UINT uMsg,
LPARAM lParam
)
{
UNUSED_ALWAYS( hwnd );
switch (uMsg)
{
case PSCB_INITIALIZED:
// Property sheet is being initialized
return TRUE;
case PSCB_PRECREATE:
// Property sheet is about to be created
//
// Remove the DS_CONTEXTHELP style from the dialog template
// (This will remove the "?" in the top right corner)
//
if ( ( (LPDLGTEMPLATEEX)lParam )->signature == 0xFFFF)
{
( (LPDLGTEMPLATEEX)lParam )->style &= ~DS_CONTEXTHELP;
}
else
{
( (LPDLGTEMPLATE)lParam )->style &= ~DS_CONTEXTHELP;
}
return TRUE;
}
return 0;
}

View File

@ -1,111 +0,0 @@
//
// StellaX
// Jeff Miller 05/02/2000
//
#ifndef PROPSHT_H
#define PROPSHT_H
#pragma once
#include <prsht.h>
#include <vector>
#include <string>
class CPropertyPage
{
public:
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
const PROPSHEETPAGE* GetPropSheetPage();
protected:
//
// Overridable callbacks
//
virtual void OnActivate( UINT state, HWND hwndActDeact, BOOL fMinimized )
{
}
virtual BOOL OnInitDialog( HWND /* hwnd */ )
{
return FALSE;
}
virtual void OnDestroy( void )
{
}
virtual BOOL OnSetActive( LPPSHNOTIFY /* lppsn */ )
{
return 0;
}
virtual BOOL OnKillActive( LPPSHNOTIFY /* lppsn */ )
{
return FALSE;
}
virtual LONG OnApply( LPPSHNOTIFY /* lppsn */ )
{
return PSNRET_NOERROR;
}
virtual void OnReset( LPPSHNOTIFY /* lppsn */ )
{
}
virtual BOOL OnCommand( WORD /* wNotifyCode */, WORD /* wID */, HWND /* hwndCtl */ )
{
return FALSE;
}
virtual BOOL OnNotify( int /* idCtrl */, LPNMHDR /* pnmh */ )
{
return FALSE;
}
private:
static UINT CALLBACK StaticCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
static BOOL CALLBACK StaticDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
PROPSHEETPAGE m_psp;
CPropertyPage( const CPropertyPage& ); // no implementation
void operator=( const CPropertyPage& ); // no implementation
};
inline const PROPSHEETPAGE* CPropertyPage::GetPropSheetPage(
void
)
{
return &m_psp;
}
class CPropertySheet
{
public:
CPropertySheet( LPCTSTR pszCaption, HWND hwndParent, UINT nStartPage = 0 );
~CPropertySheet( );
void AddPage( CPropertyPage* pPage );
virtual int DoModal( void );
private:
static int CALLBACK StaticCallback( HWND hwndDlg, UINT uMsg, LPARAM lParam );
PROPSHEETHEADER m_psh;
std::vector<CPropertyPage*> m_pages;
std::string m_strCaption;
CPropertySheet( const CPropertySheet& ); // no implementation
void operator=( const CPropertySheet& ); // no implementation
};
#endif

View File

@ -1,625 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#include "pch.hxx"
#include "RoundButton.hxx"
#include <math.h>
#include <limits.h>
// prototypes
COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark);
void DrawCircle( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crColour, BOOL bDashed = FALSE);
void DrawCircleLeft( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crBright, COLORREF crDark);
void DrawCircleRight( HDC hdc, const POINT& p, LONG lRadius,
COLORREF crBright, COLORREF crDark);
// Calculate colour for a point at the given angle by performing a linear
// interpolation between the colours crBright and crDark based on the cosine
// of the angle between the light source and the point.
//
// Angles are measured from the +ve x-axis (i.e. (1,0) = 0 degrees, (0,1) = 90 degrees )
// But remember: +y points down!
COLORREF GetColour(
double dAngle,
COLORREF crBright,
COLORREF crDark
)
{
#define Rad2Deg 180.0/3.1415
// For better light-continuity along the edge of a stretched button:
// LIGHT_SOURCE_ANGLE == -1.88
//#define LIGHT_SOURCE_ANGLE -2.356 // -2.356 radians = -135 degrees, i.e. From top left
#define LIGHT_SOURCE_ANGLE -1.88
ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
double dAngleDifference = LIGHT_SOURCE_ANGLE - dAngle;
if (dAngleDifference < -3.1415) dAngleDifference = 6.293 + dAngleDifference;
else if (dAngleDifference > 3.1415) dAngleDifference = 6.293 - dAngleDifference;
double Weight = 0.5*(cos(dAngleDifference)+1.0);
BYTE Red = (BYTE) (Weight*GetRValue(crBright) + (1.0-Weight)*GetRValue(crDark));
BYTE Green = (BYTE) (Weight*GetGValue(crBright) + (1.0-Weight)*GetGValue(crDark));
BYTE Blue = (BYTE) (Weight*GetBValue(crBright) + (1.0-Weight)*GetBValue(crDark));
//TRACE("LightAngle = %0.0f, Angle = %3.0f, Diff = %3.0f, Weight = %0.2f, RGB %3d,%3d,%3d\n",
// LIGHT_SOURCE_ANGLE*Rad2Deg, dAngle*Rad2Deg, dAngleDifference*Rad2Deg, Weight,Red,Green,Blue);
return RGB(Red, Green, Blue);
}
void DrawCircle(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crColour,
BOOL bDashed
)
{
const int nDashLength = 1;
LONG lError, lXoffset, lYoffset;
int nDash = 0;
BOOL bDashOn = TRUE;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
if (bDashOn)
{
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
}
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
if (bDashed && (++nDash == nDashLength))
{
nDash = 0;
bDashOn = !bDashOn;
}
} while (lYoffset <= lXoffset); //Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
void DrawCircleRight(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crBright,
COLORREF crDark
)
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5;
COLORREF crColour;
double dAngle = atan2(lYoffset, lXoffset);
//Draw the current pixel, reflected across all four arcs
crColour = GetColour(dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lYoffset, p.y - lXoffset, crColour);
crColour = GetColour(-dAngle, crBright, crDark);
::SetPixelV(hdc, p.x + lXoffset, p.y - lYoffset, crColour);
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
}
// The original Drawcircle function is split up into DrawCircleRight and DrawCircleLeft
// to make stretched buttons
void DrawCircleLeft(
HDC hdc,
const POINT& p,
LONG lRadius,
COLORREF crBright,
COLORREF crDark
)
{
LONG lError, lXoffset, lYoffset;
//Check to see that the coordinates are valid
ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );
//Set starting values
lXoffset = lRadius;
lYoffset = 0;
lError = -lRadius;
do
{
const double Pi = 3.141592654,
Pi_on_2 = Pi * 0.5;
COLORREF crColour;
double dAngle = atan2(lYoffset, lXoffset);
//Draw the current pixel, reflected across all eight arcs
crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lYoffset, p.y + lXoffset, crColour);
crColour = GetColour(Pi - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lXoffset, p.y + lYoffset, crColour);
crColour = GetColour(-Pi + dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lXoffset, p.y - lYoffset, crColour);
crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
::SetPixelV(hdc, p.x - lYoffset, p.y - lXoffset, crColour);
//Advance the error term and the constant X axis step
lError += lYoffset++;
//Check to see if error term has overflowed
if ((lError += lYoffset) >= 0)
lError -= --lXoffset * 2;
} while (lYoffset <= lXoffset); //Continue until halfway point
}
/////////////////////////////////////////////////////////////////////////////
static void ClientToScreen(
HWND hwnd,
LPRECT lpRect
)
{
::ClientToScreen(hwnd, (LPPOINT)lpRect);
::ClientToScreen(hwnd, ((LPPOINT)lpRect)+1);
}
static void ScreenToClient(
HWND hwnd,
LPRECT lpRect
)
{
::ScreenToClient(hwnd, (LPPOINT)lpRect);
::ScreenToClient(hwnd, ((LPPOINT)lpRect)+1);
}
static void FillSolidRect(
HDC hdc,
LPCRECT lpRect,
COLORREF clr
)
{
COLORREF crOld = ::SetBkColor(hdc, clr);
::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
::SetBkColor(hdc, crOld);
}
//////////////////////////////////////////////////////////////////////////////
CRoundButton::CRoundButton(
) : \
m_hrgn( NULL ),
m_fDrawDashedFocusCircle( TRUE ),
m_fStretch( FALSE )
{
}
CRoundButton::~CRoundButton(
)
{
if ( m_hrgn )
{
::DeleteObject( m_hrgn );
}
}
void CRoundButton::PreSubclassWindow(
HWND hwnd
)
{
RECT rect;
::GetClientRect( hwnd, &rect );
m_fStretch = (rect.right-rect.left) > (rect.bottom-rect.top);
if ( ! m_fStretch )
{
rect.bottom = rect.right = min ( rect.bottom, rect.right );
}
m_ptCenter.x = m_ptLeft.x = m_ptRight.x = ((rect.right-rect.left)/2);
m_ptCenter.y = m_ptLeft.y = m_ptRight.y = ((rect.bottom-rect.top)/2);
m_nRadius = rect.bottom/2 - 1;
m_ptLeft.x = m_nRadius;
m_ptRight.x = rect.right - m_nRadius - 1;
::SetWindowRgn( hwnd, NULL, FALSE );
m_hrgn = ::CreateEllipticRgnIndirect( &rect );
::SetWindowRgn( hwnd, m_hrgn, TRUE );
::ClientToScreen( hwnd, &rect );
HWND hwndParent = ::GetParent( hwnd );
if ( hwndParent )
{
::ScreenToClient( hwndParent, &rect );
}
if ( ! m_fStretch )
{
::MoveWindow( hwnd, rect.left, rect.top,
rect.right-rect.left, rect.bottom-rect.top, TRUE );
}
}
LRESULT CRoundButton::WndProc(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{
switch (msg)
{
case WM_DRAWITEM:
rfHandled = TRUE;
OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
case WM_ERASEBKGND:
// don't do erasing
return TRUE;
}
return 0;
}
void CRoundButton::OnDrawItem(
HWND hwnd,
UINT idCtl,
LPDRAWITEMSTRUCT lpdis
)
{
UNUSED_ALWAYS( idCtl );
HDC hdc = lpdis->hDC;
RECT& rect = lpdis->rcItem;
UINT state = lpdis->itemState;
UINT nStyle = GetWindowLong(hwnd, GWL_STYLE);
int nRadius = m_nRadius;
int nSavedDC = ::SaveDC( hdc );
::SelectObject( hdc, ::GetStockObject( NULL_BRUSH ) );
::FillSolidRect( hdc, &rect, ::GetSysColor(COLOR_BTNFACE) );
// Draw the focus circle around the button for non-stretched buttons
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
{
DrawCircle( hdc, m_ptCenter, nRadius--, RGB( 0, 0, 0) );
}
// Draw the raised/sunken edges of the button (unless flat)
if ( nStyle & BS_FLAT )
{
if ( m_fStretch )
{
// for stretched buttons: draw left and right arcs and connect the with lines
HPEN hpenOld;
RECT rectLeftBound;
::SetRect( &rectLeftBound, 0, 0, nRadius*2, nRadius*2 );
RECT rectRightBound;
::SetRect( &rectRightBound, m_ptRight.x-nRadius, 0, m_ptRight.x+nRadius, nRadius*2 );
hpenOld = (HPEN)::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
::Arc( hdc,
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
m_ptLeft.x, 0,
m_ptLeft.x, nRadius*2 );
::Arc( hdc,
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
m_ptRight.x, nRadius*2,
m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, 0, NULL );
::LineTo( hdc, m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, nRadius*2-1, NULL );
::LineTo( hdc, m_ptRight.x, nRadius*2-1 );
nRadius--;
::InflateRect( &rectLeftBound, -1, -1 );
::InflateRect( &rectRightBound, -1, -1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
::Arc( hdc,
rectLeftBound.left, rectLeftBound.top, rectLeftBound.right, rectLeftBound.bottom,
m_ptLeft.x, 1,
m_ptLeft.x, nRadius*2 );
::Arc( hdc,
rectRightBound.left, rectRightBound.top, rectRightBound.right, rectRightBound.bottom,
m_ptRight.x, nRadius*2,
m_ptRight.x, 0 );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x, 1 );
::MoveToEx( hdc, m_ptLeft.x, nRadius*2, NULL );
::LineTo( hdc, m_ptRight.x, nRadius*2 );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
else
{
// for non-stretched buttons: draw two circles
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircle( hdc, m_ptCenter, nRadius--, ::GetSysColor(COLOR_3DHIGHLIGHT) );
}
}
else
{
if (state & ODS_SELECTED)
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius,
::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DHIGHLIGHT) );
DrawCircleLeft( hdc, m_ptLeft, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
DrawCircleRight( hdc, m_ptRight, nRadius-1,
::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DLIGHT) );
if ( m_fStretch )
{
// draw connecting lines for stretched buttons only
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
(HPEN)::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW) ) );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x, 1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW) ) ) );
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
::LineTo( hdc, m_ptRight.x, 2 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DLIGHT ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius-1, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius-1 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1, ::GetSysColor( COLOR_3DHIGHLIGHT ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
else
{
// draw the circular segments for stretched AND non-stretched buttons
DrawCircleLeft( hdc, m_ptLeft, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius,
::GetSysColor(COLOR_3DHIGHLIGHT), ::GetSysColor(COLOR_3DDKSHADOW) );
DrawCircleLeft( hdc, m_ptLeft, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
DrawCircleRight( hdc, m_ptRight, nRadius - 1,
::GetSysColor(COLOR_3DLIGHT), ::GetSysColor(COLOR_3DSHADOW) );
// draw connecting lines for stretch buttons
if ( m_fStretch )
{
HPEN hpenOld;
hpenOld = (HPEN)::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, 1 ) ) );
::MoveToEx( hdc, m_ptLeft.x, 1, NULL );
::LineTo( hdc, m_ptRight.x , 1);
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, 2 ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, 2, NULL );
::LineTo( hdc, m_ptRight.x, 2 );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius );
::DeleteObject( ::SelectObject( hdc,
::CreatePen( PS_SOLID, 1,
::GetPixel( hdc, m_ptLeft.x, m_ptLeft.y+nRadius-1 ) ) ) );
::MoveToEx( hdc, m_ptLeft.x, m_ptLeft.y + nRadius - 1, NULL );
::LineTo( hdc, m_ptRight.x, m_ptLeft.y + nRadius - 1 );
::DeleteObject( ::SelectObject( hdc, hpenOld ) );
}
}
}
// Draw the text if there is any
TCHAR pszText[ 256 ];
int cch = ::GetWindowText( hwnd, pszText, 255 );
if ( cch != 0 )
{
HRGN hrgn;
if ( m_fStretch )
{
hrgn = ::CreateRectRgn( m_ptLeft.x - nRadius / 2, m_ptCenter.y - nRadius,
m_ptRight.x + nRadius / 2, m_ptCenter.y + nRadius );
}
else
{
hrgn = CreateEllipticRgn( m_ptCenter.x - nRadius, m_ptCenter.y - nRadius,
m_ptCenter.x + nRadius, m_ptCenter.y + nRadius );
}
::SelectClipRgn( hdc, hrgn );
SIZE size;
::GetTextExtentPoint32( hdc, pszText, cch, &size );
POINT pt = { m_ptCenter.x - size.cx / 2, m_ptCenter.y - size.cy / 2 - 1 };
POINT pt2 = { m_ptCenter.x + size.cx/2, m_ptCenter.y + size.cy/2 + 1 };
if ( state & ODS_SELECTED )
{
++( pt.x );
++( pt.y );
}
::SetBkMode( hdc, TRANSPARENT );
#if 0
if ( state & ODS_DISABLED )
{
::DrawState( hdc, NULL, NULL, (LPARAM)pszText, (WPARAM)cch,
pt.x, pt.y, size.cx, size.cy, DSS_DISABLED );
}
else
#endif
{
// give text a 3d-look
RECT pos;
::SetRect( &pos, pt.x, pt.y, pt2.x, pt2.y );
COLORREF crOld = ::SetTextColor( hdc,
( state & ODS_DISABLED ) ?
::GetSysColor( COLOR_GRAYTEXT ) :
::GetSysColor( COLOR_WINDOWTEXT ) );
if ( state & ODS_FOCUS )
{
LOGFONT lf;
::GetObject( (HFONT)::SendMessage( hwnd, WM_GETFONT, 0, 0 ),
sizeof(LOGFONT), &lf );
lf.lfWeight = FW_BOLD;
HFONT hfontOld = (HFONT)::SelectObject( hdc, ::CreateFontIndirect( &lf ) );
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
::DeleteObject( ::SelectObject( hdc, hfontOld) );
}
else
{
::DrawText( hdc, pszText, -1, &pos, DT_SINGLELINE | DT_CENTER );
}
::SetTextColor( hdc, crOld );
}
::SelectClipRgn( hdc, NULL );
DeleteObject( hrgn );
}
#if 0
// draw the focus circle on the inside
if ( (state & ODS_FOCUS) && m_fDrawDashedFocusCircle && !m_fStretch )
{
DrawCircle( hdc, m_ptCenter, nRadius-2, RGB(0, 0, 0), TRUE );
}
#endif
::RestoreDC( hdc, nSavedDC );
}

View File

@ -1,39 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef RNDBUT_H
#define RNDBUT_H
#include "Wnd.hxx"
class CRoundButton : public CWnd
{
public:
CRoundButton();
~CRoundButton();
protected:
LRESULT WndProc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam, BOOL& fHandled );
virtual void PreSubclassWindow(HWND hwnd);
private:
void OnDrawItem(HWND hwnd, UINT idCtl, LPDRAWITEMSTRUCT lpdis);
HRGN m_hrgn;
POINT m_ptCenter;
POINT m_ptLeft;
POINT m_ptRight;
int m_nRadius;
BOOL m_fDrawDashedFocusCircle;
BOOL m_fStretch;
CRoundButton( const CRoundButton& ); // no implementation
void operator=( const CRoundButton& ); // no implementation
};
#endif

View File

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

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

@ -1,639 +0,0 @@
# Microsoft Developer Studio Project File - Name="Stella" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Stella - 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 "Stella.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 "Stella.mak" CFG="Stella - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Stella - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Stella - 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)" == "Stella - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "BSPF_WIN32" /Fr /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386
!ELSEIF "$(CFG)" == "Stella - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BSPF_WIN32" /FR /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib /nologo /subsystem:windows /profile /debug /machine:I386
!ENDIF
# Begin Target
# Name "Stella - Win32 Release"
# Name "Stella - Win32 Debug"
# 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 "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 "Win32"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\AboutPage.cxx
# End Source File
# Begin Source File
SOURCE=.\AboutPage.hxx
# End Source File
# Begin Source File
SOURCE=.\AudioStream.cxx
# End Source File
# Begin Source File
SOURCE=.\AudioStream.hxx
# End Source File
# Begin Source File
SOURCE=.\BrowseForFolder.cxx
# End Source File
# Begin Source File
SOURCE=.\BrowseForFolder.hxx
# End Source File
# Begin Source File
SOURCE=.\ConfigPage.cxx
# End Source File
# Begin Source File
SOURCE=.\ConfigPage.hxx
# End Source File
# Begin Source File
SOURCE=.\debug.cxx
# End Source File
# Begin Source File
SOURCE=.\debug.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectDraw.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectDraw.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectInput.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectInput.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectXFullScreen.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectXFullScreen.hxx
# End Source File
# Begin Source File
SOURCE=.\DirectXWindow.cxx
# End Source File
# Begin Source File
SOURCE=.\DirectXWindow.hxx
# End Source File
# Begin Source File
SOURCE=.\FileDialog.cxx
# End Source File
# Begin Source File
SOURCE=.\FileDialog.hxx
# End Source File
# Begin Source File
SOURCE=.\GlobalData.cxx
# End Source File
# Begin Source File
SOURCE=.\GlobalData.hxx
# End Source File
# Begin Source File
SOURCE=.\HeaderCtrl.cxx
# End Source File
# Begin Source File
SOURCE=.\HeaderCtrl.hxx
# End Source File
# Begin Source File
SOURCE=.\HyperLink.cxx
# End Source File
# Begin Source File
SOURCE=.\HyperLink.hxx
# End Source File
# Begin Source File
SOURCE=.\main.cxx
# End Source File
# Begin Source File
SOURCE=.\MainDlg.cxx
# End Source File
# Begin Source File
SOURCE=.\MainDlg.hxx
# End Source File
# Begin Source File
SOURCE=.\pch.cxx
# 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.cxx
# End Source File
# Begin Source File
SOURCE=.\SoundWin32.hxx
# End Source File
# Begin Source File
SOURCE=.\stella.rc
# End Source File
# Begin Source File
SOURCE=.\StellaXMain.cxx
# End Source File
# Begin Source File
SOURCE=.\StellaXMain.hxx
# End Source File
# Begin Source File
SOURCE=.\Timer.cxx
# End Source File
# Begin Source File
SOURCE=.\Timer.hxx
# End Source File
# Begin Source File
SOURCE=.\Wnd.cxx
# End Source File
# Begin Source File
SOURCE=.\Wnd.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=.\PropertySheet.cxx
# End Source File
# Begin Source File
SOURCE=.\PropertySheet.hxx
# End Source File
# Begin Source File
SOURCE=.\STELLA.ICO
# End Source File
# End Target
# End Project

View File

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

View File

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

View File

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

View File

@ -1,186 +0,0 @@
//
// StellaX
// Jeff Miller 10/12/1999
//
#include "pch.hxx"
#include "TextButton3d.hxx"
// button style should be VISIBLE / DISABLED / OWNERDRAW
CTextButton3d::CTextButton3d
(
)
{
}
LRESULT CTextButton3d::WndProc
(
HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam,
BOOL& rfHandled
)
{
switch (msg)
{
#if 0
// TODO: re do this now that I send this message here
case WM_DRAWITEM:
rfHandled = TRUE;
pThis->OnDrawItem(hWnd, (UINT)wParam, (LPDRAWITEMSTRUCT)lParam);
return TRUE;
#endif
case WM_PAINT:
rfHandled = TRUE;
OnPaint(hWnd, (HDC)wParam);
return TRUE;
case WM_ERASEBKGND:
rfHandled = TRUE;
return OnEraseBkgnd(hWnd, (HDC)wParam);
}
return 0;
}
void CTextButton3d::OnPaint
(
HWND hwnd,
HDC hdcPaint
)
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
int cxClient, cyClient;
RECT rc;
GetClientRect(hwnd, &rc);
RECT rcClient;
CopyRect(&rcClient, &rc);
// lpdis->rcItem, lpdis->itemState
int l = GetWindowTextLength(hwnd);
LPTSTR text = new TCHAR[l + 2];
if (text == NULL)
{
EndPaint(hwnd, &ps);
return;
}
GetWindowText(hwnd, text, l+1);
HFONT hfont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(hfont, sizeof(lf), &lf);
if (lf.lfHeight == 0)
lf.lfHeight = 20;
lf.lfWidth = 0;
lf.lfWeight = FW_BLACK;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
HFONT hfontTry = CreateFontIndirect(&lf);
HFONT hfontOld = (HFONT)SelectObject(hdc, hfontTry);
rcClient.left += 3;
rcClient.top += 3;
rcClient.right -= 3;
rcClient.bottom -= 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
SIZE sizeTextClient;
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
if (cxClient*sizeTextClient.cy > cyClient*sizeTextClient.cx)
{
lf.lfHeight = MulDiv(lf.lfHeight, cyClient, sizeTextClient.cy);
}
else
{
lf.lfHeight = MulDiv(lf.lfHeight, cxClient, sizeTextClient.cx);
}
lf.lfHeight--;
rcClient.left -= 3;
rcClient.top -= 3;
rcClient.right += 3;
rcClient.bottom += 3;
cxClient = rcClient.right - rcClient.left;
cyClient = rcClient.bottom - rcClient.top;
hfont = CreateFontIndirect(&lf);
SelectObject(hdc, hfont);
GetTextExtentPoint(hdc, text, lstrlen(text),
&sizeTextClient);
int minx = rcClient.left + (cxClient - sizeTextClient.cx) / 2;
int miny = rcClient.top + (cyClient - sizeTextClient.cy) / 2;
int iOldBkMode = SetBkMode(hdc, TRANSPARENT);
COLORREF crText = GetSysColor(COLOR_BTNTEXT);
COLORREF crOldText = SetTextColor(hdc, crText);
int cx = minx;
int cy = miny;
int s = 1;
cx += 3;
cy += 3;
// draw 3D highlights
SetTextColor(hdc, GetSysColor(COLOR_3DDKSHADOW));
TextOut(hdc, cx-s*2, cy+s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx+s*2, cy+s*2, text, lstrlen(text));
SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
TextOut(hdc, cx+s*1, cy-s*2, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx-s*2, cy-s*2, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DSHADOW));
TextOut(hdc, cx-s*1, cy+s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx+s*1, cy+s*1, text, lstrlen(text));
SetTextColor(hdc, GetSysColor(COLOR_3DLIGHT));
TextOut(hdc, cx, cy-s*1, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy, text, lstrlen(text));
TextOut(hdc, cx-s*1, cy-s*1, text, lstrlen(text));
SetTextColor(hdc, crText);
// draw the text
TextOut(hdc, cx, cy, text, lstrlen(text));
// restore dc
SetTextColor(hdc, crOldText);
SetBkMode(hdc, iOldBkMode);
SelectObject(hdc, hfontOld);
DeleteObject(hfont);
DeleteObject(hfontTry);
delete[] text;
EndPaint(hwnd, &ps);
}
BOOL CTextButton3d::OnEraseBkgnd
(
HWND hwnd,
HDC hdc
)
{
// dont do any erasing
return TRUE;
}

View File

@ -1,33 +0,0 @@
//
// StellaX
// Jeff Miller 05/01/2000
//
#ifndef TXTBTN_H
#define TXTBTN_H
#pragma once
// derived from Roger Onslow's code
#include "Wnd.hxx"
class CTextButton3d : public CWnd
{
public:
CTextButton3d();
protected:
LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
BOOL& rfHandled);
private:
void OnPaint(HWND, HDC);
BOOL OnEraseBkgnd(HWND, HDC);
CTextButton3d( const CTextButton3d& ); // no implementation
void operator=( const CTextButton3d& ); // no implementation
};
#endif

View File

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

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

Some files were not shown because too many files have changed in this diff Show More