mirror of https://github.com/stella-emu/stella.git
Completely (hopefully) removed all references to the registry stuff.
All Settings should now be saved in the stellarc file. Activated all former settings in StellaConfig. You can now select different options from the config dialog box and actually have them work in the emulation core. Cleaned up the main file lister user interface a little. Specifically, when you resize the window, the internal file lister should resize as well. This one was bugging me for a long time. There's still some work to do when making the outer window smaller than the inner one though. Made first pass at the SoundWin32 code. It now sounds *much* better than it did before, but there's still some work left to do. I've been looking at other Windows Atari 2600 emulators (PCAE and Z26), and I've noticed that while their sound generation is clear and doesn't have pops, the pitch and latency is still off a bit. The only time I've ever heard it work correctly is in the Linux version of Stella, and I'm trying hard to make Cyberstella work the same way. Note, this isn't a slam again PCAE or Z26, or saying that Linux is superior to Windows (I'll leave that to another discussion ;). It's just that Stella and the sound code were originally developed under Linux, and that's where it seems to work best (and I'm hoping this will change). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@220 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
120dd7b268
commit
4e8e332370
|
@ -66,11 +66,11 @@ BOOL CCyberstellaApp::InitInstance()
|
|||
// 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
|
||||
//#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
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\games,..\..\build,..\..\emucore,..\..\emucore\m6502\src,..\..\emucore\m6502\src\bspf\src,..\sound"
|
||||
AdditionalIncludeDirectories=".\;..\..\emucore;..\..\emucore\m6502\src;..\..\emucore\m6502\src\bspf\src;..\sound"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;BSPF_WIN32;DIRECTINPUT_VERSION=0x0800"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
|
@ -105,7 +105,7 @@
|
|||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="dxguid.lib ddraw.lib dsound.lib"
|
||||
AdditionalDependencies="dxguid.lib ddraw.lib dsound.lib dinput8.lib"
|
||||
OutputFile=".\Release/Cyberstella.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
|
|
|
@ -24,14 +24,15 @@ static char THIS_FILE[] = __FILE__;
|
|||
IMPLEMENT_DYNCREATE(CCyberstellaView, CFormView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCyberstellaView, CFormView)
|
||||
//{{AFX_MSG_MAP(CCyberstellaView)
|
||||
// {{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
|
||||
// }}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,10 +41,6 @@ END_MESSAGE_MAP()
|
|||
CCyberstellaView::CCyberstellaView()
|
||||
: CFormView(CCyberstellaView::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CCyberstellaView)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
// Create SettingsWin32 object
|
||||
// This should be done before any other xxxWin32 objects are created
|
||||
theSettings = new SettingsWin32();
|
||||
|
@ -85,9 +82,9 @@ CCyberstellaView::~CCyberstellaView()
|
|||
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CFormView::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CCyberstellaView)
|
||||
DDX_Control(pDX, IDC_ROMLIST, m_List);
|
||||
//}}AFX_DATA_MAP
|
||||
// {{AFX_DATA_MAP(CCyberstellaView)
|
||||
DDX_Control(pDX, IDC_ROMLIST, myGameList);
|
||||
// }}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BOOL CCyberstellaView::PreCreateWindow(CREATESTRUCT& cs)
|
||||
|
@ -102,10 +99,22 @@ void CCyberstellaView::OnInitialUpdate()
|
|||
{
|
||||
CFormView::OnInitialUpdate();
|
||||
GetParentFrame()->RecalcLayout();
|
||||
ResizeParentToFit(FALSE);
|
||||
ResizeParentToFit();
|
||||
|
||||
// Init ListControl, parse stella.pro
|
||||
PostMessage(MSG_VIEW_INITIALIZE);
|
||||
// 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);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -137,7 +146,7 @@ void CCyberstellaView::OnConfig()
|
|||
|
||||
void CCyberstellaView::OnPlay()
|
||||
{
|
||||
playRom();
|
||||
playRom();
|
||||
}
|
||||
|
||||
LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
||||
|
@ -157,11 +166,11 @@ LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
|||
m_imglist.Add (hFolder);
|
||||
m_imglist.Add (hAtari);
|
||||
|
||||
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||
myGameList.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||
|
||||
// Init ListCtrl
|
||||
m_List.init(thePropertiesSet, theSettings, this);
|
||||
m_List.populateRomList();
|
||||
myGameList.init(thePropertiesSet, theSettings, this);
|
||||
myGameList.populateRomList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -169,18 +178,18 @@ LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
|||
void CCyberstellaView::OnDestroy()
|
||||
{
|
||||
CFormView::OnDestroy();
|
||||
m_List.deleteItemsAndProperties();
|
||||
myGameList.deleteItemsAndProperties();
|
||||
}
|
||||
|
||||
LRESULT CCyberstellaView::updateListInfos(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Show status text
|
||||
CString status;
|
||||
status.Format(IDS_STATUSTEXT, m_List.getRomCount());
|
||||
status.Format(IDS_STATUSTEXT, myGameList.getRomCount());
|
||||
SetDlgItemText(IDC_ROMCOUNT,status);
|
||||
|
||||
// Show rom path
|
||||
SetDlgItemText(IDC_ROMPATH, m_List.getPath());
|
||||
SetDlgItemText(IDC_ROMPATH, myGameList.getPath());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -189,10 +198,10 @@ LRESULT CCyberstellaView::displayNote(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
// Show rom path
|
||||
CString note;
|
||||
note.Format(IDS_NOTETEXT, m_List.getCurrentNote());
|
||||
note.Format(IDS_NOTETEXT, myGameList.getCurrentNote());
|
||||
((CMainFrame*)AfxGetMainWnd())->setStatusText(note);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCyberstellaView::playRom(LONG gameID)
|
||||
|
@ -205,7 +214,7 @@ void CCyberstellaView::playRom(LONG gameID)
|
|||
DWORD dwImageSize;
|
||||
DWORD dwActualSize;
|
||||
|
||||
fileName = m_List.getCurrentFile();
|
||||
fileName = myGameList.getCurrentFile();
|
||||
if(fileName.GetLength() <= 0)
|
||||
return;
|
||||
|
||||
|
@ -284,7 +293,7 @@ void CCyberstellaView::playRom(LONG gameID)
|
|||
|
||||
// Create a new main instance for this cartridge
|
||||
MainWin32* mainWin32 = new MainWin32(pImage, dwActualSize, pszFileName,
|
||||
*theSettings, *thePropertiesSet);
|
||||
*theSettings, *thePropertiesSet);
|
||||
// And start the main emulation loop
|
||||
mainWin32->run();
|
||||
|
||||
|
@ -297,5 +306,5 @@ void CCyberstellaView::playRom(LONG gameID)
|
|||
EnableWindow(TRUE);
|
||||
|
||||
// Set focus back to the rom list
|
||||
m_List.SetFocus();
|
||||
myGameList.SetFocus();
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ protected: // create from serialization only
|
|||
DECLARE_DYNCREATE(CCyberstellaView)
|
||||
|
||||
public:
|
||||
//{{AFX_DATA(CCyberstellaView)
|
||||
// {{AFX_DATA(CCyberstellaView)
|
||||
enum { IDD = IDD_CYBERSTELLA_FORM };
|
||||
GameList m_List;
|
||||
//}}AFX_DATA
|
||||
GameList myGameList;
|
||||
// }}AFX_DATA
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
@ -35,13 +35,15 @@ public:
|
|||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCyberstellaView)
|
||||
// {{AFX_VIRTUAL(CCyberstellaView)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void OnInitialUpdate(); // called first time after construct
|
||||
//}}AFX_VIRTUAL
|
||||
virtual void OnSize(UINT nType, int cx, int cy);
|
||||
|
||||
// }}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
|
@ -81,7 +83,7 @@ inline CCyberstellaDoc* CCyberstellaView::GetDocument()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// {{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_)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.5 2003-11-16 19:32:50 stephena Exp $
|
||||
// $Id: DirectInput.cxx,v 1.6 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -21,12 +21,13 @@
|
|||
|
||||
#include "DirectInput.hxx"
|
||||
|
||||
DirectInput::DirectInput()
|
||||
DirectInput::DirectInput(bool disablejoystick)
|
||||
: myHWND(NULL),
|
||||
mylpdi(NULL),
|
||||
myKeyboard(NULL),
|
||||
myMouse(NULL),
|
||||
myJoystickCount(0)
|
||||
myJoystickCount(0),
|
||||
myDisableJoystick(disablejoystick)
|
||||
{
|
||||
for(uInt32 i = 0; i < 8; i++)
|
||||
myJoystick[i] = NULL;
|
||||
|
@ -88,6 +89,10 @@ bool DirectInput::initialize(HWND hwnd)
|
|||
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
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.6 2003-11-16 19:32:51 stephena Exp $
|
||||
// $Id: DirectInput.hxx,v 1.7 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DIRECT_INPUT_HXX
|
||||
|
@ -27,7 +27,7 @@
|
|||
class DirectInput
|
||||
{
|
||||
public:
|
||||
DirectInput();
|
||||
DirectInput(bool usejoystick);
|
||||
~DirectInput();
|
||||
|
||||
bool getKeyEvents(DIDEVICEOBJECTDATA* keyEvents, DWORD* numKeyEvents);
|
||||
|
@ -54,6 +54,7 @@ class DirectInput
|
|||
LPDIRECTINPUTDEVICE8 myMouse;
|
||||
LPDIRECTINPUTDEVICE8 myJoystick[8];
|
||||
uInt32 myJoystickCount;
|
||||
bool myDisableJoystick;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.6 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: FrameBufferWin32.cxx,v 1.7 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -179,10 +179,11 @@ bool FrameBufferWin32::init()
|
|||
}
|
||||
|
||||
// Get the best video mode for game width
|
||||
//int cx = 640; int cy = 480;
|
||||
int cx = 320; int cy = 240;
|
||||
SetRect(&myScreenRect, 0, 0, cx, cy);
|
||||
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);
|
||||
|
@ -267,12 +268,36 @@ bool FrameBufferWin32::init()
|
|||
}
|
||||
|
||||
// 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 );
|
||||
pe[i].peGreen = (BYTE)( (pPalette[i] & 0x0000FF00) >> 8 );
|
||||
pe[i].peBlue = (BYTE)( (pPalette[i] & 0x000000FF) );
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -281,7 +306,7 @@ bool FrameBufferWin32::init()
|
|||
{
|
||||
OutputDebugString("Error: CreatePalette FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = myPrimarySurface->SetPalette(myDDPalette);
|
||||
|
@ -289,11 +314,10 @@ bool FrameBufferWin32::init()
|
|||
{
|
||||
OutputDebugString("Error: SetPalette FAILED");
|
||||
cleanup();
|
||||
return false;
|
||||
return hr;
|
||||
}
|
||||
|
||||
// If we get this far, then assume that there were no problems
|
||||
return true;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -358,7 +382,11 @@ void FrameBufferWin32::postFrameUpdate()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::pauseEvent(bool status)
|
||||
{
|
||||
}
|
||||
if(status)
|
||||
setupPalette(0.75);
|
||||
else
|
||||
setupPalette(1.0);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferWin32::toggleFullscreen()
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.3 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: FrameBufferWin32.hxx,v 1.4 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_WIN32_HXX
|
||||
|
@ -30,7 +30,7 @@ class MediaSource;
|
|||
Only fullscreen mode is supported for now.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBufferWin32.hxx,v 1.3 2003-11-24 01:14:38 stephena Exp $
|
||||
@version $Id: FrameBufferWin32.hxx,v 1.4 2003-11-24 23:56:10 stephena Exp $
|
||||
*/
|
||||
class FrameBufferWin32 : public FrameBuffer
|
||||
{
|
||||
|
@ -55,6 +55,14 @@ class FrameBufferWin32 : public FrameBuffer
|
|||
*/
|
||||
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.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.5 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: GameList.cpp,v 1.6 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -121,28 +121,25 @@ void GameList::insertColumns()
|
|||
|
||||
void GameList::populateRomList()
|
||||
{
|
||||
CWaitCursor c;
|
||||
CWaitCursor c;
|
||||
|
||||
// Remove previous content
|
||||
deleteItemsAndProperties();
|
||||
// Remove previous content
|
||||
deleteItemsAndProperties();
|
||||
|
||||
// Add new content
|
||||
if(myRomPath.GetLength() > 0)
|
||||
{
|
||||
displayPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
displayDrives();
|
||||
}
|
||||
// Add new content
|
||||
if(myRomPath.GetLength() > 0)
|
||||
displayPath();
|
||||
else
|
||||
displayDrives();
|
||||
|
||||
// Sort content
|
||||
SortItems(MyCompareProc, (LPARAM)(CListCtrl*)this);
|
||||
// Sort content
|
||||
SortItems(MyCompareProc, (LPARAM)(CListCtrl*)this);
|
||||
|
||||
// Select first item
|
||||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
// Select first item
|
||||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
|
||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||
if(myParent)
|
||||
myParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||
|
||||
// Save the current path
|
||||
mySettings->setString("rompath", (const char*) myRomPath);
|
||||
|
@ -343,7 +340,7 @@ void GameList::OnItemActivate(NMHDR* pNMHDR, LRESULT* pResult)
|
|||
{
|
||||
// Notify parent to play the current game by
|
||||
// sending a faked 'Play Button Pressed' message.
|
||||
if (m_pParent) m_pParent->PostMessage(WM_COMMAND, BN_CLICKED | IDC_PLAY);
|
||||
if (myParent) myParent->PostMessage(WM_COMMAND, BN_CLICKED | IDC_PLAY);
|
||||
}
|
||||
}
|
||||
*pResult = 0;
|
||||
|
@ -429,7 +426,7 @@ CString GameList::getCurrentNote()
|
|||
void GameList::init(PropertiesSet* newPropertiesSet,
|
||||
SettingsWin32* settings, CWnd* newParent)
|
||||
{
|
||||
m_pParent = newParent;
|
||||
myParent = newParent;
|
||||
myPropertiesSet = newPropertiesSet;
|
||||
mySettings = settings;
|
||||
|
||||
|
@ -443,7 +440,7 @@ void GameList::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
|
|||
{
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
||||
|
||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
||||
if(myParent) myParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.4 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: GameList.h,v 1.5 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef GAME_LIST_H
|
||||
|
@ -51,12 +51,11 @@ class GameList : public CListCtrl
|
|||
CString getCurrentName();
|
||||
|
||||
private:
|
||||
// members saved in registry
|
||||
CString myRomPath;
|
||||
uInt32 myRomCount;
|
||||
CWnd* m_pParent;
|
||||
CWnd* myParent;
|
||||
PropertiesSet* myPropertiesSet;
|
||||
SettingsWin32* mySettings;
|
||||
CString myRomPath;
|
||||
uInt32 myRomCount;
|
||||
|
||||
private:
|
||||
void displayDrives();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.5 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: MainWin32.cxx,v 1.6 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#define STRICT
|
||||
|
@ -66,8 +66,6 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
|||
return;
|
||||
}
|
||||
|
||||
theSound->setVolume(theSettings.getInt("volume"));
|
||||
|
||||
// Create the 2600 game console
|
||||
theConsole = new Console(image, size, filename, theSettings, thePropertiesSet,
|
||||
*theDisplay, *theSound);
|
||||
|
@ -80,9 +78,10 @@ MainWin32::MainWin32(const uInt8* image, uInt32 size, const char* filename,
|
|||
// Initialize SoundWin32
|
||||
if(sounddriver == "win32")
|
||||
((SoundWin32*)theSound)->Initialize(theDisplay->hwnd());
|
||||
theSound->setVolume(theSettings.getInt("volume"));
|
||||
|
||||
// Initialize DirectInput
|
||||
theInput = new DirectInput();
|
||||
theInput = new DirectInput(theSettings.getBool("disable_joystick"));
|
||||
if(!theInput)
|
||||
{
|
||||
cleanup();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.4 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: SoundWin32.cxx,v 1.5 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -27,7 +27,7 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWin32::SoundWin32()
|
||||
: myIsInitializedFlag(false),
|
||||
myBufferSize(512),
|
||||
myBufferSize(4096),
|
||||
mySampleRate(31400),
|
||||
myDSBuffer(NULL)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ HRESULT SoundWin32::Initialize(HWND hWnd)
|
|||
}
|
||||
|
||||
// Set DirectSound coop level
|
||||
if( FAILED(hr = myDSDevice->SetCooperativeLevel(hWnd, DSSCL_PRIORITY)) )
|
||||
if( FAILED(hr = myDSDevice->SetCooperativeLevel(hWnd, DSSCL_EXCLUSIVE)) )
|
||||
{
|
||||
SoundError("SetCooperativeLevel");
|
||||
return hr;
|
||||
|
@ -73,7 +73,7 @@ HRESULT SoundWin32::Initialize(HWND hWnd)
|
|||
|
||||
ZeroMemory(&dsbdesc, sizeof(dsbdesc));
|
||||
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME;
|
||||
dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_STATIC;
|
||||
dsbdesc.dwBufferBytes = myBufferSize;
|
||||
dsbdesc.lpwfxFormat = &wfx;
|
||||
|
||||
|
@ -87,6 +87,18 @@ HRESULT SoundWin32::Initialize(HWND hWnd)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWin32::closeDevice()
|
||||
{
|
||||
if(myDSBuffer)
|
||||
{
|
||||
myDSBuffer->Stop();
|
||||
myDSBuffer->Release();
|
||||
myDSBuffer = NULL;
|
||||
}
|
||||
|
||||
if(myDSDevice)
|
||||
{
|
||||
myDSDevice->Release();
|
||||
myDSDevice = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -104,6 +116,19 @@ bool SoundWin32::isSuccessfullyInitialized() const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -115,6 +140,12 @@ void SoundWin32::update()
|
|||
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)
|
||||
{
|
||||
|
@ -128,7 +159,7 @@ void SoundWin32::update()
|
|||
memcpy(lpvWrite, buffer, dwLength);
|
||||
myDSBuffer->Unlock(lpvWrite, dwLength, NULL, 0);
|
||||
myDSBuffer->SetCurrentPosition(0);
|
||||
myDSBuffer->Play(0, 0, 0);
|
||||
myDSBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
periodCount++;
|
||||
}
|
||||
}
|
||||
|
@ -145,21 +176,3 @@ void SoundWin32::SoundError(const char* message)
|
|||
|
||||
myIsInitializedFlag = false;
|
||||
}
|
||||
|
||||
/* // Fill any unused fragments with silence so that we have a lower
|
||||
// risk of having playback underruns
|
||||
for(int i = 0; i < 1-periodCount; ++i)
|
||||
{
|
||||
frames = snd_pcm_avail_update(myPcmHandle);
|
||||
if (frames > 0)
|
||||
{
|
||||
uInt8 buffer[frames];
|
||||
memset((void*)buffer, 0, frames);
|
||||
snd_pcm_writei(myPcmHandle, buffer, frames);
|
||||
}
|
||||
else if(frames == -EPIPE) // this should never happen
|
||||
{
|
||||
cerr << "EPIPE after write\n";
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// 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.3 2003-11-24 01:14:38 stephena Exp $
|
||||
// $Id: StellaConfig.cpp,v 1.4 2003-11-24 23:56:10 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "pch.hxx"
|
||||
|
@ -113,7 +113,7 @@ void StellaConfig::retrieveData()
|
|||
mySettings->setBool("autoselect_video",
|
||||
((CButton*)GetDlgItem(IDC_AUTO_SELECT_VIDEOMODE))->GetCheck());
|
||||
|
||||
mySettings->setBool("joystick_disabled",
|
||||
mySettings->setBool("disable_joystick",
|
||||
((CButton*)GetDlgItem(IDC_JOYSTICK))->GetCheck());
|
||||
|
||||
// Save any settings that were changed
|
||||
|
|
Loading…
Reference in New Issue