From a6d9b330c321bb98197925aa86b653905804a69e Mon Sep 17 00:00:00 2001 From: gunfight Date: Tue, 14 May 2002 10:56:03 +0000 Subject: [PATCH] Made Cyberstella compile with new serialisation classes added. Changes I had to do where: Adding #include "bspf.hxx" to the headers of the new classes. Fixing a myriad of (in VC++ 6.0 illegal) uInt32 redefinitions git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@99 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/CartDPC.cxx | 32 +-- stella/src/emucore/CartE7.cxx | 24 +- stella/src/emucore/Deserializer.hxx | 5 +- stella/src/emucore/Serializer.hxx | 5 +- stella/src/ui/win32/ConfigPage.cxx | 24 +- stella/src/ui/win32/ConfigPage.hxx | 4 +- stella/src/ui/win32/DirectInput.cxx | 23 +- stella/src/ui/win32/DirectXFullScreen.cxx | 22 +- stella/src/ui/win32/DirectXFullScreen.hxx | 4 +- stella/src/ui/win32/DirectXWindow.cxx | 36 ++- stella/src/ui/win32/DirectXWindow.hxx | 4 +- stella/src/ui/win32/GlobalData.cxx | 29 +-- stella/src/ui/win32/GlobalData.hxx | 11 +- stella/src/ui/win32/MainDlg.cxx | 265 +++------------------- stella/src/ui/win32/MainDlg.hxx | 19 +- stella/src/ui/win32/Stella.dsp | 72 ++---- stella/src/ui/win32/Stella.dsw | 24 ++ stella/src/ui/win32/StellaXMain.cxx | 10 +- stella/src/ui/win32/StellaXMain.hxx | 2 +- stella/src/ui/win32/main.cxx | 157 +------------ stella/src/ui/win32/resource.h | 4 +- stella/src/ui/win32/stella.ini | 6 +- stella/src/ui/win32/stella.rc | 126 +++------- 23 files changed, 247 insertions(+), 661 deletions(-) diff --git a/stella/src/emucore/CartDPC.cxx b/stella/src/emucore/CartDPC.cxx index 0e988e448..d9c54b67f 100644 --- a/stella/src/emucore/CartDPC.cxx +++ b/stella/src/emucore/CartDPC.cxx @@ -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: CartDPC.cxx,v 1.4 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartDPC.cxx,v 1.5 2002-05-14 10:56:03 gunfight Exp $ //============================================================================ #include @@ -331,8 +331,11 @@ void CartridgeDPC::bank(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeDPC::save(Serializer& out) { - cerr << "save from CartDPC !!\n"; - string cart = name(); + uInt32 i; + + cerr << "save from CartDPC !!\n"; + + string cart = name(); try { @@ -343,17 +346,17 @@ bool CartridgeDPC::save(Serializer& out) // The bottom registers for the data fetchers out.putLong(8); - for(uInt32 i = 0; i < 8; ++i) + for(i = 0; i < 8; ++i) out.putLong(myBottoms[i]); // The counter registers for the data fetchers out.putLong(8); - for(uInt32 i = 0; i < 8; ++i) + for(i = 0; i < 8; ++i) out.putLong(myCounters[i]); // The flag registers for the data fetchers out.putLong(8); - for(uInt32 i = 0; i < 8; ++i) + for(i = 0; i < 8; ++i) out.putLong(myFlags[i]); // The random number generator register @@ -361,7 +364,7 @@ bool CartridgeDPC::save(Serializer& out) // The top registers for the data fetchers out.putLong(8); - for(uInt32 i = 0; i < 8; ++i) + for(i = 0; i < 8; ++i) out.putLong(myTops[i]); } catch(char *msg) @@ -381,8 +384,11 @@ bool CartridgeDPC::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeDPC::load(Deserializer& in) { - cerr << "load from CartDPC !!\n"; - string cart = name(); + uInt32 i; + + cerr << "load from CartDPC !!\n"; + + string cart = name(); try { @@ -396,17 +402,17 @@ bool CartridgeDPC::load(Deserializer& in) // The bottom registers for the data fetchers limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myBottoms[i] = (uInt8) in.getLong(); // The counter registers for the data fetchers limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myCounters[i] = (uInt16) in.getLong(); // The flag registers for the data fetchers limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myFlags[i] = (uInt8) in.getLong(); // The random number generator register @@ -414,7 +420,7 @@ bool CartridgeDPC::load(Deserializer& in) // The top registers for the data fetchers limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myTops[i] = (uInt8) in.getLong(); } catch(char *msg) diff --git a/stella/src/emucore/CartE7.cxx b/stella/src/emucore/CartE7.cxx index 1078866e4..6e5720836 100644 --- a/stella/src/emucore/CartE7.cxx +++ b/stella/src/emucore/CartE7.cxx @@ -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: CartE7.cxx,v 1.2 2002-05-13 19:17:32 stephena Exp $ +// $Id: CartE7.cxx,v 1.3 2002-05-14 10:56:03 gunfight Exp $ //============================================================================ #include @@ -218,22 +218,25 @@ void CartridgeE7::bankRAM(uInt16 bank) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeE7::save(Serializer& out) { - cerr << "save from CartE7 !!\n"; - string cart = name(); + uInt32 i; + + cerr << "save from CartE7 !!\n"; + + string cart = name(); try { out.putString(cart); out.putLong(2); - for(uInt32 i = 0; i < 2; ++i) + for(i = 0; i < 2; ++i) out.putLong(myCurrentSlice[i]); out.putLong(myCurrentRAM); // The 2048 bytes of RAM out.putLong(2048); - for(uInt32 i = 0; i < 2048; ++i) + for(i = 0; i < 2048; ++i) out.putLong(myRAM[i]); } catch(char *msg) @@ -253,8 +256,11 @@ bool CartridgeE7::save(Serializer& out) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartridgeE7::load(Deserializer& in) { - cerr << "load from CartE7 !!\n"; - string cart = name(); + uInt32 i; + + cerr << "load from CartE7 !!\n"; + + string cart = name(); try { @@ -264,14 +270,14 @@ bool CartridgeE7::load(Deserializer& in) uInt32 limit; limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myCurrentSlice[i] = (uInt16) in.getLong(); myCurrentRAM = (uInt16) in.getLong(); // The 2048 bytes of RAM limit = (uInt32) in.getLong(); - for(uInt32 i = 0; i < limit; ++i) + for(i = 0; i < limit; ++i) myRAM[i] = (uInt8) in.getLong(); } catch(char *msg) diff --git a/stella/src/emucore/Deserializer.hxx b/stella/src/emucore/Deserializer.hxx index 9e19f36bc..eecd98a8d 100644 --- a/stella/src/emucore/Deserializer.hxx +++ b/stella/src/emucore/Deserializer.hxx @@ -13,12 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Deserializer.hxx,v 1.1 2002-05-13 19:14:17 stephena Exp $ +// $Id: Deserializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ //============================================================================ #ifndef DESERIALIZER_HXX #define DESERIALIZER_HXX +#include "bspf.hxx" #include #include @@ -31,7 +32,7 @@ return. @author Stephen Anthony - @version $Id: Deserializer.hxx,v 1.1 2002-05-13 19:14:17 stephena Exp $ + @version $Id: Deserializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ */ class Deserializer { diff --git a/stella/src/emucore/Serializer.hxx b/stella/src/emucore/Serializer.hxx index 6d3f36e5c..cdecec0b2 100644 --- a/stella/src/emucore/Serializer.hxx +++ b/stella/src/emucore/Serializer.hxx @@ -13,12 +13,13 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Serializer.hxx,v 1.1 2002-05-13 19:14:17 stephena Exp $ +// $Id: Serializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ //============================================================================ #ifndef SERIALIZER_HXX #define SERIALIZER_HXX +#include "bspf.hxx" #include #include @@ -32,7 +33,7 @@ Boolean values are written using a special pattern. @author Stephen Anthony - @version $Id: Serializer.hxx,v 1.1 2002-05-13 19:14:17 stephena Exp $ + @version $Id: Serializer.hxx,v 1.2 2002-05-14 10:56:03 gunfight Exp $ */ class Serializer { diff --git a/stella/src/ui/win32/ConfigPage.cxx b/stella/src/ui/win32/ConfigPage.cxx index 5c976a4dc..83310bdff 100644 --- a/stella/src/ui/win32/ConfigPage.cxx +++ b/stella/src/ui/win32/ConfigPage.cxx @@ -10,7 +10,7 @@ #include "BrowseForFolder.hxx" CConfigPage::CConfigPage( - CGlobalData& rGlobalData + CGlobalData* rGlobalData ) : \ m_rGlobalData( rGlobalData ), CPropertyPage( IDD_CONFIG_PAGE ) @@ -33,7 +33,7 @@ BOOL CConfigPage::OnInitDialog( hwndCtrl = ::GetDlgItem( hwnd, IDC_ROMPATH ); ::SendMessage( hwndCtrl, EM_LIMITTEXT, MAX_PATH, 0 ); - ::SetWindowText( hwndCtrl, m_rGlobalData.RomDir() ); + ::SetWindowText( hwndCtrl, m_rGlobalData->RomDir() ); // // Set up PADDLE @@ -50,7 +50,7 @@ BOOL CConfigPage::OnInitDialog( } ::SendMessage( hwndCtrl, CB_SETCURSEL, - m_rGlobalData.PaddleMode(), 0 ); + m_rGlobalData->PaddleMode(), 0 ); // // Set up SOUND @@ -58,7 +58,7 @@ BOOL CConfigPage::OnInitDialog( hwndCtrl = ::GetDlgItem( hwnd, IDC_SOUND ); ::SendMessage( hwndCtrl, BM_SETCHECK, - m_rGlobalData.NoSound() ? BST_CHECKED : BST_UNCHECKED, + m_rGlobalData->NoSound() ? BST_CHECKED : BST_UNCHECKED, 0 ); // @@ -68,7 +68,7 @@ BOOL CConfigPage::OnInitDialog( hwndCtrl = ::GetDlgItem( hwnd, IDC_AUTO_SELECT_VIDEOMODE ); ::SendMessage( hwndCtrl, BM_SETCHECK, - m_rGlobalData.AutoSelectVideoMode() ? BST_CHECKED : BST_UNCHECKED, + m_rGlobalData->AutoSelectVideoMode() ? BST_CHECKED : BST_UNCHECKED, 0 ); // @@ -77,7 +77,7 @@ BOOL CConfigPage::OnInitDialog( hwndCtrl = ::GetDlgItem( hwnd, IDC_JOYSTICK ); ::SendMessage( hwndCtrl, BM_SETCHECK, - m_rGlobalData.DisableJoystick() ? BST_CHECKED : BST_UNCHECKED, + m_rGlobalData->DisableJoystick() ? BST_CHECKED : BST_UNCHECKED, 0 ); return TRUE; @@ -105,28 +105,28 @@ LONG CConfigPage::OnApply( hwndCtrl = ::GetDlgItem( m_hwnd, IDC_ROMPATH ); ASSERT( hwndCtrl ); - ::GetWindowText( hwndCtrl, m_rGlobalData.m_pszRomDir, MAX_PATH ); + ::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 ); + 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 ) + 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 ) + 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 ) + m_rGlobalData->m_fDisableJoystick= ( ::SendMessage( hwndCtrl, BM_GETCHECK, 0, 0 ) == BST_CHECKED ); - m_rGlobalData.SetModified(); + m_rGlobalData->SetModified(); return PSNRET_NOERROR; } diff --git a/stella/src/ui/win32/ConfigPage.hxx b/stella/src/ui/win32/ConfigPage.hxx index 5c9ab3af5..8e5d4dc8d 100644 --- a/stella/src/ui/win32/ConfigPage.hxx +++ b/stella/src/ui/win32/ConfigPage.hxx @@ -14,7 +14,7 @@ class CConfigPage : public CPropertyPage { public: - CConfigPage( CGlobalData& rGlobalData ); + CConfigPage(CGlobalData* rGlobalData); protected: @@ -26,7 +26,7 @@ protected: private: - CGlobalData& m_rGlobalData; + CGlobalData* m_rGlobalData; HWND m_hwnd; CConfigPage( const CConfigPage& ); // no implementation diff --git a/stella/src/ui/win32/DirectInput.cxx b/stella/src/ui/win32/DirectInput.cxx index fd8354e5a..c75d97219 100644 --- a/stella/src/ui/win32/DirectInput.cxx +++ b/stella/src/ui/win32/DirectInput.cxx @@ -13,19 +13,16 @@ // CDirectInput // -CDirectInput::CDirectInput( - HWND hwnd, - DWORD dwDevType, - int nButtonCount - ) : \ - m_hwnd( hwnd ), - m_piDID(NULL), - m_dwDevType(dwDevType), - m_nButtonCount(nButtonCount), - m_pButtons(NULL), - m_lX(0), - m_lY(0), - m_fInitialized( FALSE ) +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"); } diff --git a/stella/src/ui/win32/DirectXFullScreen.cxx b/stella/src/ui/win32/DirectXFullScreen.cxx index 03a53c4a2..e13f14468 100644 --- a/stella/src/ui/win32/DirectXFullScreen.cxx +++ b/stella/src/ui/win32/DirectXFullScreen.cxx @@ -12,6 +12,7 @@ #include "Console.hxx" #include "Event.hxx" #include "MediaSrc.hxx" +#include "debug.hxx" /* @@ -28,7 +29,7 @@ idle time LPCTSTR CDirectXFullScreen::pszClassName = _T("StellaXClass"); CDirectXFullScreen::CDirectXFullScreen( - const CGlobalData& rGlobalData, + const CGlobalData* rGlobalData, const Console* pConsole, Event& rEvent ) : \ @@ -99,7 +100,7 @@ HRESULT CDirectXFullScreen::Initialize( WNDCLASSEX wcex; ZeroMemory( &wcex, sizeof(wcex) ); wcex.cbSize = sizeof( wcex ); - wcex.hInstance = m_rGlobalData.ModuleInstance(); + wcex.hInstance = m_rGlobalData->ModuleInstance(); wcex.lpszClassName = pszClassName; wcex.lpfnWndProc = StaticWindowProc; wcex.style = CS_OWNDC; @@ -126,13 +127,13 @@ HRESULT CDirectXFullScreen::Initialize( 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, - m_rGlobalData.ModuleInstance(), + m_rGlobalData->ModuleInstance(), this ); if ( m_hwnd == NULL ) { TRACE( "CreateWindow failed" ); hr = HRESULT_FROM_WIN32( GetLastError() ); - MessageBox( m_rGlobalData.ModuleInstance(), NULL, IDS_CW_FAILED ); + MessageBox( m_rGlobalData->ModuleInstance(), NULL, IDS_CW_FAILED ); goto cleanup; } @@ -322,7 +323,7 @@ HRESULT CDirectXFullScreen::Initialize( goto cleanup; } - if ( m_rGlobalData.DisableJoystick() ) + if ( m_rGlobalData->DisableJoystick() ) { m_pDirectJoystick = new CDisabledJoystick( m_hwnd ); } @@ -425,7 +426,7 @@ void CDirectXFullScreen::Cleanup( m_hwnd = NULL; } - ::UnregisterClass( pszClassName, m_rGlobalData.ModuleInstance() ); + ::UnregisterClass( pszClassName, m_rGlobalData->ModuleInstance() ); m_fInitialized = FALSE; } @@ -572,7 +573,7 @@ DWORD CDirectXFullScreen::Run( ::QueryPerformanceFrequency( (LARGE_INTEGER*)&uiCountsPerSecond ); const unsigned __int64 uiCountsPerFrame = - ( uiCountsPerSecond / m_rGlobalData.DesiredFrameRate() ); + ( uiCountsPerSecond / m_rGlobalData->DesiredFrameRate() ); TRACE( "uiCountsPerSecond=%ld", uiCountsPerSecond ); TRACE( "uiCountsPerFrame = %ld", uiCountsPerFrame ); @@ -666,7 +667,7 @@ DWORD CDirectXFullScreen::Run( // Main message loop done - if ( m_rGlobalData.ShowFPS() ) + if ( m_rGlobalData->ShowFPS() ) { // get number of scanlines in last frame @@ -885,9 +886,9 @@ void CDirectXFullScreen::UpdateEvents( // Mouse resistance is measured between 0...1000000 - rgEventState[ m_rGlobalData.PaddleResistanceEvent() ] = (999-x)*1000; + rgEventState[ m_rGlobalData->PaddleResistanceEvent() ] = (999-x)*1000; - rgEventState[ m_rGlobalData.PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0); + rgEventState[ m_rGlobalData->PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0); } // @@ -969,7 +970,6 @@ BOOL CDirectXFullScreen::UpdateDisplay( (void)m_piDDSBack->Unlock( ddsd.lpSurface ); // Blit offscreen to onscreen - RECT rc = { 0, 0, m_sizeGame.cx*2, // WIDTH_FACTOR diff --git a/stella/src/ui/win32/DirectXFullScreen.hxx b/stella/src/ui/win32/DirectXFullScreen.hxx index 7ffe81172..f81da633c 100644 --- a/stella/src/ui/win32/DirectXFullScreen.hxx +++ b/stella/src/ui/win32/DirectXFullScreen.hxx @@ -18,7 +18,7 @@ class CDirectXFullScreen { public: - CDirectXFullScreen( const CGlobalData& rGlobalData, + CDirectXFullScreen( const CGlobalData* rGlobalData, const Console* pConsole, Event& rEvent ); ~CDirectXFullScreen(); @@ -58,7 +58,7 @@ private: const Console* m_pConsole; Event& m_rEvent; - const CGlobalData& m_rGlobalData; + const CGlobalData* m_rGlobalData; SIZE m_sizeGame; BYTE m_rgbPixelDataTable[256]; diff --git a/stella/src/ui/win32/DirectXWindow.cxx b/stella/src/ui/win32/DirectXWindow.cxx index d37633a33..7cea43268 100644 --- a/stella/src/ui/win32/DirectXWindow.cxx +++ b/stella/src/ui/win32/DirectXWindow.cxx @@ -49,7 +49,7 @@ static inline void ClientToScreen( } CDirectXWindow::CDirectXWindow( - const CGlobalData& rGlobalData, + const CGlobalData* rGlobalData, const Console* pConsole, Event& rEvent ) : \ @@ -118,7 +118,7 @@ CDirectXWindow::~CDirectXWindow m_piDD = NULL; } - ::UnregisterClass( pszClassName, m_rGlobalData.ModuleInstance() ); + ::UnregisterClass( pszClassName, m_rGlobalData->ModuleInstance() ); } HRESULT CDirectXWindow::Initialize( @@ -142,8 +142,8 @@ HRESULT CDirectXWindow::Initialize( wc.lpszClassName = pszClassName; wc.lpfnWndProc = StaticWindowProc; wc.style = CS_HREDRAW | CS_VREDRAW; // CS_OWNDC - wc.hInstance = m_rGlobalData.ModuleInstance(); - wc.hIcon = ::LoadIcon( m_rGlobalData.ModuleInstance(), + wc.hInstance = m_rGlobalData->ModuleInstance(); + wc.hIcon = ::LoadIcon( m_rGlobalData->ModuleInstance(), MAKEINTRESOURCE( IDI_APP ) ); wc.hCursor = ::LoadCursor( NULL, IDC_ARROW ); wc.hbrBackground = (HBRUSH)::GetStockObject( NULL_BRUSH ); @@ -175,13 +175,13 @@ HRESULT CDirectXWindow::Initialize( 0, 0, 0, 0, NULL, NULL, - m_rGlobalData.ModuleInstance(), + m_rGlobalData->ModuleInstance(), this ); if ( m_hwnd == NULL ) { TRACE( "CreateWindow failed" ); hr = HRESULT_FROM_WIN32( GetLastError() ); - MessageBox( m_rGlobalData.ModuleInstance(), NULL, IDS_CW_FAILED ); + MessageBox( m_rGlobalData->ModuleInstance(), NULL, IDS_CW_FAILED ); goto cleanup; } @@ -310,7 +310,7 @@ HRESULT CDirectXWindow::Initialize( goto cleanup; } - if ( m_rGlobalData.DisableJoystick() ) + if ( m_rGlobalData->DisableJoystick() ) { m_pDirectJoystick = new CDisabledJoystick( m_hwnd ); } @@ -711,6 +711,20 @@ BOOL CDirectXWindow::WndProc( ::PostMessage( m_hwnd, WM_CLOSE, 0, 0 ); return TRUE; + case VK_F3: + // + // F11 = toggle fullscreen/windowed + // + if (m_fActive && m_fReady) + { + if (m_fWindowed) + { + MessageBox(NULL, "Hallo!", "Hallo!", MB_OK); + } + } + break; + + case VK_F11: // // F11 = toggle fullscreen/windowed @@ -907,7 +921,7 @@ DWORD CDirectXWindow::Run( ::QueryPerformanceFrequency( (LARGE_INTEGER*)&uiCountsPerSecond ); const unsigned __int64 uiCountsPerFrame = - ( uiCountsPerSecond / m_rGlobalData.DesiredFrameRate() ); + ( uiCountsPerSecond / m_rGlobalData->DesiredFrameRate() ); TRACE( "uiCountsPerSecond=%ld", uiCountsPerSecond ); TRACE( "uiCountsPerFrame = %ld", uiCountsPerFrame ); @@ -1033,7 +1047,7 @@ DWORD CDirectXWindow::Run( // Main message loop done - if ( m_rGlobalData.ShowFPS() ) + if ( m_rGlobalData->ShowFPS() ) { // get number of scanlines in last frame @@ -1257,9 +1271,9 @@ void CDirectXWindow::UpdateEvents( // Mouse resistance is measured between 0...1000000 - rgEventState[ m_rGlobalData.PaddleResistanceEvent() ] = (999-x)*1000; + rgEventState[ m_rGlobalData->PaddleResistanceEvent() ] = (999-x)*1000; - rgEventState[ m_rGlobalData.PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0); + rgEventState[ m_rGlobalData->PaddleFireEvent() ] |= m_pDirectMouse->IsButtonPressed(0); } // diff --git a/stella/src/ui/win32/DirectXWindow.hxx b/stella/src/ui/win32/DirectXWindow.hxx index 3c54c8d73..5cd9728ab 100644 --- a/stella/src/ui/win32/DirectXWindow.hxx +++ b/stella/src/ui/win32/DirectXWindow.hxx @@ -18,7 +18,7 @@ class CDirectXWindow { public: - CDirectXWindow( const CGlobalData& rGlobalData, + CDirectXWindow( const CGlobalData* rGlobalData, const Console* pConsole, Event& rEvent ); ~CDirectXWindow(); @@ -67,7 +67,7 @@ private: const Console* m_pConsole; Event& m_rEvent; - const CGlobalData& m_rGlobalData; + const CGlobalData* m_rGlobalData; SIZE m_sizeGame; BYTE m_rgbPixelDataTable[256]; diff --git a/stella/src/ui/win32/GlobalData.cxx b/stella/src/ui/win32/GlobalData.cxx index b522c0707..05aba17cf 100644 --- a/stella/src/ui/win32/GlobalData.cxx +++ b/stella/src/ui/win32/GlobalData.cxx @@ -152,31 +152,4 @@ CGlobalData::~CGlobalData( m_fDisableJoystick, g_pszIniFile ); } -} - -BOOL CGlobalData::ParseCommandLine( - int argc, - TCHAR** argv - ) -{ - // parse arguments - - for (int i = 1; i < argc; ++i) - { - LPCTSTR ctszArg = argv[i]; - - if (ctszArg && (ctszArg[0] != _T('-'))) - { - // assume this is the start rom name - - lstrcpy( m_pszPathName, ctszArg ); - } - else - { - return FALSE; - } - } - - return TRUE; -} - +} \ No newline at end of file diff --git a/stella/src/ui/win32/GlobalData.hxx b/stella/src/ui/win32/GlobalData.hxx index fb191a27d..8d354e7ac 100644 --- a/stella/src/ui/win32/GlobalData.hxx +++ b/stella/src/ui/win32/GlobalData.hxx @@ -16,10 +16,8 @@ class CGlobalData public: - CGlobalData( HINSTANCE hInstance ); - ~CGlobalData( ); - - BOOL ParseCommandLine( int argc, TCHAR* argv[] ); + CGlobalData(HINSTANCE hInstance); + ~CGlobalData(); int DesiredFrameRate( void ) const { @@ -90,11 +88,8 @@ public: return m_fIsModified; } -private: - // Basic options - - TCHAR m_pszRomDir[ MAX_PATH ]; + TCHAR* m_pszRomDir; int m_nPaddleMode; BOOL m_fNoSound; BOOL m_fDisableJoystick; diff --git a/stella/src/ui/win32/MainDlg.cxx b/stella/src/ui/win32/MainDlg.cxx index fb9543e1e..57af58735 100644 --- a/stella/src/ui/win32/MainDlg.cxx +++ b/stella/src/ui/win32/MainDlg.cxx @@ -5,21 +5,15 @@ #include "pch.hxx" #include "MainDlg.hxx" -#include "GlobalData.hxx" - #include "PropertySheet.hxx" -#include "AboutPage.hxx" -#include "DocPage.hxx" #include "ConfigPage.hxx" +#include "AboutPage.hxx" #include "MD5.hxx" #include "PropsSet.hxx" #include "resource.h" -#define BKGND_BITMAP_TOP 64 -#define BKGND_BITMAP_BOTTOM 355 - // NOTE: LVS_OWNERDATA doesn't support LVM_SORTITEMS! inline LPARAM ListView_GetItemData( @@ -35,13 +29,15 @@ inline LPARAM ListView_GetItemData( return lvi.lParam; } -CMainDlg::CMainDlg( - CGlobalData& rGlobalData, - HINSTANCE hInstance - ) : \ - m_rGlobalData(rGlobalData), - m_hInstance(hInstance) +CMainDlg::CMainDlg(HINSTANCE hInstance) + : m_hInstance(hInstance) { + m_pGlobalData = new CGlobalData(hInstance); +} + +CMainDlg::~CMainDlg() +{ + delete m_pGlobalData; } void CMainDlg::ClearList( @@ -101,97 +97,32 @@ BOOL CALLBACK CMainDlg::StaticDialogFunc( return pDlg->DialogFunc( uMsg, wParam, lParam ); } -BOOL CALLBACK CMainDlg::DialogFunc( - UINT uMsg, - WPARAM wParam, - LPARAM lParam - ) +BOOL CALLBACK CMainDlg::DialogFunc(UINT uMsg, WPARAM wParam, LPARAM lParam) { - BOOL b; - switch (uMsg) { - case WM_COMMAND: - return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) ); + case WM_COMMAND: + return OnCommand( LOWORD(wParam), (HWND)lParam, HIWORD(wParam) ); - case WM_CTLCOLORSTATIC: - b = (BOOL)OnCtlColorStatic( (HDC)wParam, (HWND)lParam ); - if (b) - { - return b; - } - break; + case WM_INITDIALOG: + return OnInitDialog( ); - case WM_ERASEBKGND: - if ( OnEraseBkgnd( (HDC)wParam ) ) - { - return TRUE; - } - break; + case WM_NOTIFY: + return OnNotify( (int)wParam, (LPNMHDR)lParam ); - case WM_INITDIALOG: - return OnInitDialog( ); - - case WM_NOTIFY: - return OnNotify( (int)wParam, (LPNMHDR)lParam ); - - case WM_PALETTECHANGED: - TRACE( "WM_PALETTECHANGED from maindlg" ); - return FALSE; - - case WM_QUERYNEWPALETTE: - TRACE( "WM_QUERYNEWPALETTE from maindlg" ); - return FALSE; - - // - // Cool caption handlers - // - - case WM_DESTROY: - OnDestroy( ); - break; - - case WM_DRAWITEM: - // Forward this onto the control - ::SendMessage( ((LPDRAWITEMSTRUCT)lParam)->hwndItem, WM_DRAWITEM, - wParam, lParam ); - return TRUE; - - case WM_NCPAINT: - // DefWindowProc(hDlg, uMsg, wParam, lParam); - OnNcPaint( (HRGN)wParam ); - return TRUE; - - case WM_NCACTIVATE: - OnNcActivate( (BOOL)wParam ); - // When the fActive parameter is FALSE, an application should return - // TRUE to indicate that the system should proceed with the default - // processing - SetWindowLong( m_hwnd, DWL_MSGRESULT, TRUE ); - return TRUE; - - case WM_NCLBUTTONDOWN: - return OnNcLButtonDown( (INT)wParam, MAKEPOINTS(lParam) ); - - case WM_SYSCOMMAND: - // Allow Alt-F4 to close the window - if ( wParam == SC_CLOSE ) - { - ::EndDialog( m_hwnd, IDCANCEL ); - } - break; + case WM_SYSCOMMAND: + // Allow Alt-F4 to close the window + if ( wParam == SC_CLOSE ) + { + ::EndDialog( m_hwnd, IDCANCEL ); + } + break; } - // - // Message not handled - // - return FALSE; } -BOOL CMainDlg::OnInitDialog( - void - ) +BOOL CMainDlg::OnInitDialog(void) { DWORD dwRet; @@ -232,14 +163,7 @@ BOOL CMainDlg::OnInitDialog( } // Do subclassing - - m_CoolCaption.OnInitDialog( hwnd ); m_header.SubclassDlgItem( hwnd, IDC_ROMLIST ); - m_btn3d.SubclassDlgItem( hwnd, IDC_TITLE ); - m_btnPlay.SubclassDlgItem( hwnd, IDC_PLAY ); - m_btnHelp.SubclassDlgItem( hwnd, IDC_ABOUT ); - m_btnConfig.SubclassDlgItem( hwnd, IDC_CONFIG ); - m_btnExit.SubclassDlgItem( hwnd, IDC_EXIT ); const int nMaxString = 256; TCHAR psz[nMaxString + 1]; @@ -322,7 +246,7 @@ BOOL CMainDlg::OnInitDialog( // Show rom path // - SetDlgItemText( hwnd, IDC_ROMPATH, m_rGlobalData.RomDir() ); + SetDlgItemText( hwnd, IDC_ROMPATH, m_pGlobalData->RomDir() ); // // Set default button @@ -381,7 +305,7 @@ BOOL CMainDlg::OnCommand( pListData = (CListData*)ListView_GetItemData( m_hwndList, nItem ); TCHAR pszPathName[ MAX_PATH + 1 ]; - lstrcpy( pszPathName, m_rGlobalData.RomDir() ); + lstrcpy( pszPathName, m_pGlobalData->RomDir() ); lstrcat( pszPathName, _T("\\") ); lstrcat( pszPathName, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) ); @@ -393,7 +317,7 @@ BOOL CMainDlg::OnCommand( (void)m_stella.PlayROM( hwnd, pszPathName, pListData->GetTextForColumn( CListData::NAME_COLUMN ), - m_rGlobalData ); + m_pGlobalData); ::EnableWindow( hwnd, TRUE ); @@ -412,26 +336,22 @@ BOOL CMainDlg::OnCommand( { CPropertySheet ps( _T("Configure"), hwnd ); - CConfigPage pgConfig( m_rGlobalData ); + CConfigPage pgConfig(m_pGlobalData); ps.AddPage( &pgConfig ); (void)ps.DoModal(); } return TRUE; - case IDC_ABOUT: + case IDC_ABOUT: { - CPropertySheet ps(_T("Help"), hwnd); + CPropertySheet ps( _T("Help"), hwnd ); CHelpPage pgAbout; - ps.AddPage(&pgAbout); + ps.AddPage( &pgAbout ); - CDocPage pgDoc; - ps.AddPage(&pgDoc); - - ps.DoModal(); + (void)ps.DoModal(); } - return TRUE; } return FALSE; @@ -489,83 +409,6 @@ static void FillSolidRect( ::SetBkColor(hdc, crOld); } -BOOL CMainDlg::OnEraseBkgnd( - HDC hdc - ) -{ - // don't do this in 256 color - - if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) - { - return FALSE; - } - - RECT rcWindow; - ::GetWindowRect( *this, &rcWindow ); - ::ScreenToClient( *this, &rcWindow ); - - FillSolidRect( hdc, &rcWindow, ::GetSysColor( COLOR_3DFACE ) ); - - RECT rc; - ::SetRect( &rc, rcWindow.left, BKGND_BITMAP_TOP, - rcWindow.right, BKGND_BITMAP_BOTTOM ); - - long lWidth = rc.right - rc.left; - long lHeight = rc.bottom - rc.top; - - HDC hdcMem = CreateCompatibleDC(hdc); - - HBITMAP hbmpTile = LoadBitmap( m_hInstance, - MAKEINTRESOURCE(IDB_TILE) ); - - BITMAP bm; - GetObject(hbmpTile, sizeof(bm), &bm); - - HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpTile); - - for (long x = 0; x < lWidth; x += bm.bmWidth) - { - for (long y = 0; y < lHeight; y += bm.bmHeight) - { - ::BitBlt( hdc, - rc.left + x, rc.top + y, - ( (rc.left + x + bm.bmWidth) > rc.right ) ? rc.right-(rc.left+x) : bm.bmWidth, - ( (rc.top + y + bm.bmHeight) > rc.bottom ) ? rc.bottom-(rc.top+y) : bm.bmHeight, - hdcMem, - 0, 0, SRCCOPY ); - } - } - - SelectObject(hdcMem, hbmpOld); - - DeleteObject(hbmpTile); - - DeleteDC(hdcMem); - - return TRUE; -} - -HBRUSH CMainDlg::OnCtlColorStatic( - HDC hdcStatic, - HWND hwndStatic - ) -{ - // don't do this in 256 color - - if (GetDeviceCaps(hdcStatic, RASTERCAPS) & RC_PALETTE) - { - return FALSE; - } - - if ((GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON) == SS_ICON) - { - return NULL; - } - - SetBkMode(hdcStatic, TRANSPARENT); - return (HBRUSH)GetStockObject(NULL_BRUSH); -} - // --------------------------------------------------------------------------- DWORD CMainDlg::PopulateRomList( @@ -587,7 +430,7 @@ DWORD CMainDlg::PopulateRomList( TCHAR pszPath[ MAX_PATH ]; - lstrcpy( pszPath, m_rGlobalData.RomDir() ); + lstrcpy( pszPath, m_pGlobalData->RomDir() ); lstrcat( pszPath, _T("\\*.bin") ); WIN32_FIND_DATA ffd; @@ -672,7 +515,7 @@ DWORD CMainDlg::ReadRomData( TCHAR pszPath[MAX_PATH + 1]; - lstrcpy( pszPath, m_rGlobalData.RomDir() ); + lstrcpy( pszPath, m_pGlobalData->RomDir() ); lstrcat( pszPath, _T("\\") ); lstrcat( pszPath, pListData->GetTextForColumn( CListData::FILENAME_COLUMN ) ); @@ -878,42 +721,4 @@ int CALLBACK CMainDlg::ListViewCompareFunc( // return lstrcmpi( pszItem1, pszItem2 ); -} - -// --------------------------------------------------------------------------- -// Cool caption message handlers - -void CMainDlg::OnDestroy( - void - ) -{ - m_CoolCaption.OnDestroy(); - - if ( m_hfontRomNote ) - { - ::DeleteObject( m_hfontRomNote ); - m_hfontRomNote = NULL; - } -} - -void CMainDlg::OnNcPaint( - HRGN hrgn - ) -{ - m_CoolCaption.OnNcPaint( hrgn ); -} - -void CMainDlg::OnNcActivate( - BOOL fActive - ) -{ - m_CoolCaption.OnNcActivate( fActive ); -} - -BOOL CMainDlg::OnNcLButtonDown( - INT nHitTest, - POINTS pts - ) -{ - return m_CoolCaption.OnNCLButtonDown( nHitTest, pts ); -} +} \ No newline at end of file diff --git a/stella/src/ui/win32/MainDlg.hxx b/stella/src/ui/win32/MainDlg.hxx index 98e29ebaa..8412aaeeb 100644 --- a/stella/src/ui/win32/MainDlg.hxx +++ b/stella/src/ui/win32/MainDlg.hxx @@ -8,13 +8,9 @@ #include "resource.h" -class CGlobalData; - +#include "GlobalData.hxx" #include "StellaXMain.hxx" -#include "CoolCaption.hxx" -#include "TextButton3d.hxx" #include "HeaderCtrl.hxx" -#include "RoundButton.hxx" class CMainDlg; @@ -174,7 +170,8 @@ public: enum { IDD = IDD_MAIN }; - CMainDlg( CGlobalData& rGlobalData, HINSTANCE hInstance ); + CMainDlg(HINSTANCE hInstance); + ~CMainDlg(); virtual int DoModal( HWND hwndParent ); @@ -186,14 +183,7 @@ public: private: HWND m_hwnd; - - CCoolCaption m_CoolCaption; - CTextButton3d m_btn3d; CHeaderCtrl m_header; - CRoundButton m_btnPlay; - CRoundButton m_btnHelp; - CRoundButton m_btnConfig; - CRoundButton m_btnExit; // // Message handlers @@ -202,7 +192,6 @@ private: BOOL OnInitDialog( void ); BOOL OnCommand( int id, HWND hwndCtl, UINT codeNotify ); BOOL OnNotify( int idCtrl, LPNMHDR pnmh ); - BOOL OnEraseBkgnd( HDC hdc ); HBRUSH OnCtlColorStatic( HDC hdcStatic, HWND hwndStatic ); // @@ -248,7 +237,7 @@ private: // Stella stuff - CGlobalData& m_rGlobalData; + CGlobalData* m_pGlobalData; CStellaXMain m_stella; CMainDlg( const CMainDlg& ); // no implementation diff --git a/stella/src/ui/win32/Stella.dsp b/stella/src/ui/win32/Stella.dsp index 46f4c2cdb..8467ccdd8 100644 --- a/stella/src/ui/win32/Stella.dsp +++ b/stella/src/ui/win32/Stella.dsp @@ -200,6 +200,14 @@ 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 @@ -280,6 +288,14 @@ 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 @@ -452,22 +468,6 @@ SOURCE=.\ConfigPage.hxx # End Source File # Begin Source File -SOURCE=.\ControlHost.cxx -# End Source File -# Begin Source File - -SOURCE=.\ControlHost.hxx -# End Source File -# Begin Source File - -SOURCE=.\CoolCaption.cxx -# End Source File -# Begin Source File - -SOURCE=.\CoolCaption.hxx -# End Source File -# Begin Source File - SOURCE=.\debug.cxx # End Source File # Begin Source File @@ -508,14 +508,6 @@ SOURCE=.\DirectXWindow.hxx # End Source File # Begin Source File -SOURCE=.\DocPage.cxx -# End Source File -# Begin Source File - -SOURCE=.\DocPage.hxx -# End Source File -# Begin Source File - SOURCE=.\FileDialog.cxx # End Source File # Begin Source File @@ -568,26 +560,10 @@ SOURCE=.\pch.hxx # 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=.\resource.h # End Source File # Begin Source File -SOURCE=.\RoundButton.cxx -# End Source File -# Begin Source File - -SOURCE=.\RoundButton.hxx -# End Source File -# Begin Source File - SOURCE=.\SoundWin32.cxx # End Source File # Begin Source File @@ -608,14 +584,6 @@ SOURCE=.\StellaXMain.hxx # End Source File # Begin Source File -SOURCE=.\TextButton3d.cxx -# End Source File -# Begin Source File - -SOURCE=.\TextButton3d.hxx -# End Source File -# Begin Source File - SOURCE=.\Timer.cxx # End Source File # Begin Source File @@ -657,11 +625,15 @@ SOURCE=..\..\build\M6502Low.ins # End Source File # Begin Source File -SOURCE=.\STELLA.ICO +SOURCE=.\PropertySheet.cxx # End Source File # Begin Source File -SOURCE=.\tile.bmp +SOURCE=.\PropertySheet.hxx +# End Source File +# Begin Source File + +SOURCE=.\STELLA.ICO # End Source File # End Target # End Project diff --git a/stella/src/ui/win32/Stella.dsw b/stella/src/ui/win32/Stella.dsw index c095bd228..c4018f376 100644 --- a/stella/src/ui/win32/Stella.dsw +++ b/stella/src/ui/win32/Stella.dsw @@ -3,6 +3,18 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### +Project: "Cyberstella"=..\Cyberstella\Cyberstella.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "Stella"=.\Stella.dsp - Package Owner=<4> Package=<5> @@ -15,6 +27,18 @@ Package=<4> ############################################################################### +Project: "test"=.\test\test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Global: Package=<5> diff --git a/stella/src/ui/win32/StellaXMain.cxx b/stella/src/ui/win32/StellaXMain.cxx index 52108a6f8..7a2492ba9 100644 --- a/stella/src/ui/win32/StellaXMain.cxx +++ b/stella/src/ui/win32/StellaXMain.cxx @@ -126,7 +126,7 @@ HRESULT CStellaXMain::PlayROM( HWND hwnd, LPCTSTR pszPathName, LPCTSTR pszFriendlyName, - CGlobalData& rGlobalData + CGlobalData* rGlobalData ) { UNUSED_ALWAYS( hwnd ); @@ -243,7 +243,7 @@ HRESULT CStellaXMain::PlayROM( // (Will be initialized once we have a window handle below) // - if (rGlobalData.NoSound()) + if (rGlobalData->NoSound()) { TRACE("Creating Sound driver"); pSound = new Sound; @@ -291,7 +291,7 @@ HRESULT CStellaXMain::PlayROM( } catch (...) { - MessageBox(rGlobalData.ModuleInstance(), + MessageBox(rGlobalData->ModuleInstance(), NULL, IDS_CANTSTARTCONSOLE); goto exit; @@ -313,7 +313,7 @@ HRESULT CStellaXMain::PlayROM( } #ifdef USE_FS - if ( rGlobalData.AutoSelectVideoMode() ) + if ( rGlobalData->AutoSelectVideoMode() ) { hr = pwnd->Initialize( ); } @@ -334,7 +334,7 @@ HRESULT CStellaXMain::PlayROM( goto exit; } - if (!rGlobalData.NoSound()) + if (!rGlobalData->NoSound()) { // // 060499: Pass pwnd->GetHWND() in instead of hwnd as some systems diff --git a/stella/src/ui/win32/StellaXMain.hxx b/stella/src/ui/win32/StellaXMain.hxx index 403316a8a..b72875b4a 100644 --- a/stella/src/ui/win32/StellaXMain.hxx +++ b/stella/src/ui/win32/StellaXMain.hxx @@ -20,7 +20,7 @@ public: HRESULT PlayROM( HWND hwnd, LPCTSTR ctszPathName, LPCTSTR pszFriendlyName, - CGlobalData& rGlobalData ); + CGlobalData* rGlobalData ); PropertiesSet& GetPropertiesSet() const; private: diff --git a/stella/src/ui/win32/main.cxx b/stella/src/ui/win32/main.cxx index 2505719b1..fbe7820ab 100644 --- a/stella/src/ui/win32/main.cxx +++ b/stella/src/ui/win32/main.cxx @@ -1,124 +1,30 @@ /* - StellaX Win32 DirectX port of Stella - Written by Jeff Miller (contact Bradford for current email address) + Originally written by Jeff Miller + Continued by Manuel Polik Stella core developed by Bradford W. Mott - - This software is Copyright (c) 1995-2000, Jeff Miller - -REVISIONS: - - 14-Mar-99 1.1.0 new code base - - 19-Mar-99 1.1.1 took into account video width - fixed no sound card bug - -mute option - fixed mame32 www link - - 11-Jun-99 1.1.2 removed registerfiletypes call - fixed directsound - added directinput support for keyboard, mouse, joystick - fixed minimize button bug - created virtual list view to speed load time - add screen capture (f12 key) - added romdir read from STELLA.INI file - (defaults to ROMS directory) - I now use WM_SETICON so the stella icon shows on the task list - Works on NT4 (dont fail if DirectInput not available) - Added UI field for a cartridge.note - Changed stellax web site address - Added really cool help property sheet w/adobe doc - - 9-Sep-99 1.1.3 Improved video detection logic - Added DisableJoystick and ListSort options to .ini - Rewrote the sound driver code - Added multiple screen shot support - first writes to - stella00.bmp then stella01.bmp, etc. - Added cool round buttons on main screen - 18-Apr-00 Started removing all exceptions - Fixed sound code (now uses streaming properly) - Added configuration dialog - Fixed it so that Alt-F4 will close the dialog - Updated the master ROM list - - 02-May-00 1.1.3a Fixed joystick handling regression - Fixed repaint problem on doc page - Fixed problem where some machines would report path not found - Added force 640x480 video mode - Added browse button on config dialog - - 05-Jan-02 n/a Wow, it's been awhile...Released source code - */ #include "pch.hxx" #include "resource.h" - -#include "GlobalData.hxx" #include "MainDlg.hxx" -class CSingleInstance -{ -public: - - CSingleInstance( LPCTSTR pszName ) - { - ::SetLastError( ERROR_SUCCESS ); - - m_hMutex = ::CreateMutex( NULL, TRUE, pszName ); - - m_dwError = ::GetLastError(); - } - - ~CSingleInstance() - { - if ( m_hMutex != INVALID_HANDLE_VALUE && - m_dwError != ERROR_ALREADY_EXISTS ) - { - VERIFY( ::ReleaseMutex( m_hMutex ) ); - VERIFY( ::CloseHandle( m_hMutex ) ); - } - } - - BOOL AlreadyExists( void ) const - { - return ( m_dwError == ERROR_ALREADY_EXISTS ); - } - -private: - - HANDLE m_hMutex; - DWORD m_dwError; - - CSingleInstance( const CSingleInstance& ); // no implementation - void operator=( const CSingleInstance& ); // no implementation -}; - // see debug.cpp - LPCTSTR g_ctszDebugLog = _T("stella.log"); - -int WINAPI _tWinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPTSTR lpCmdLine, - int nCmdShow - ) +int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance + ,LPTSTR lpCmdLine,int nCmdShow) { - UNUSED_ALWAYS( hPrevInstance ); - UNUSED_ALWAYS( lpCmdLine ); - UNUSED_ALWAYS( nCmdShow ); - - DWORD dwRet; - + // Delete previous Debug Log (void)::DeleteFile(g_ctszDebugLog); - CSingleInstance mutex( _T("StellaXMutex") ); - if ( mutex.AlreadyExists() ) + // Avoid Second instance + CreateMutex(NULL,TRUE,_T("StellaXMutex")); + + if (GetLastError() == ERROR_ALREADY_EXISTS) { MessageBox( hInstance, NULL, IDS_ALREADYRUNNING ); return 1; @@ -132,49 +38,8 @@ int WINAPI _tWinMain( ::InitCommonControls(); - BOOL fOk = FALSE; - - CGlobalData globaldata( hInstance ); - - fOk = globaldata.ParseCommandLine( __argc, __argv ); - if (!fOk) - { - MessageBox( hInstance, NULL, IDS_BADARGUMENT ); - } - else - { - LPCTSTR ctszPathName = globaldata.PathName(); - if (ctszPathName != NULL) - { - // - // a filename was given on the commandline, skip the UI - // - - CStellaXMain stellax; - - dwRet = stellax.Initialize(); - if ( dwRet != ERROR_SUCCESS ) - { - MessageBoxFromWinError( dwRet, _T("CStellaX::Initialize") ); - } - else - { - dwRet = stellax.PlayROM( GetDesktopWindow(), - ctszPathName, - _T("StellaX"), // Dont knwo the friendly name - globaldata ); - } - } - else - { - // - // show the ui - // - - CMainDlg dlg( globaldata, hInstance ); - dlg.DoModal( NULL ); - } - } + CMainDlg dlg(hInstance); + dlg.DoModal(NULL); if ( hrCoInit == S_OK ) { diff --git a/stella/src/ui/win32/resource.h b/stella/src/ui/win32/resource.h index 18deef75a..773a1646b 100644 --- a/stella/src/ui/win32/resource.h +++ b/stella/src/ui/win32/resource.h @@ -2,7 +2,6 @@ // Microsoft Developer Studio generated include file. // Used by Stella.rc // -#define IDB_TILE 101 #define IDI_APP 102 #define IDD_ABOUT 103 #define IDD_MAIN 104 @@ -57,7 +56,6 @@ #define IDC_ROMCOUNT 1006 #define IDC_ROMLIST 1007 #define IDC_STATIC 1008 -#define IDC_TITLE 1009 #define IDC_WEB_JEFFMILL 1010 #define IDC_WEB_STELLA 1011 #define IDC_WWW_MAME 1012 @@ -77,7 +75,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 296 +#define _APS_NEXT_RESOURCE_VALUE 297 #define _APS_NEXT_COMMAND_VALUE 32772 #define _APS_NEXT_CONTROL_VALUE 1022 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/stella/src/ui/win32/stella.ini b/stella/src/ui/win32/stella.ini index 1ce79b463..5ff2c069d 100644 --- a/stella/src/ui/win32/stella.ini +++ b/stella/src/ui/win32/stella.ini @@ -4,7 +4,7 @@ ; Set this to the path where your .bin rom files are located ; If this isn't specified, ROMS will be used -RomPath=ROMS +RomPath=C:\temp\2600 ; ---------------------------------------------------------------------------- ; Set this to specify which paddle the mouse should emulate. This can be any @@ -25,9 +25,9 @@ Mute=0 DisableJoystick=0 -; ============================================================================ +;============================================================================ ; ADVANCED OPTIONS FOLLOW -; ============================================================================ +;============================================================================ ; ---------------------------------------------------------------------------- ; Set this to 1 if you want to see the FPS count after a game is played diff --git a/stella/src/ui/win32/stella.rc b/stella/src/ui/win32/stella.rc index 634de86dc..316c938e9 100644 --- a/stella/src/ui/win32/stella.rc +++ b/stella/src/ui/win32/stella.rc @@ -104,38 +104,6 @@ END // Dialog // -IDD_MAIN DIALOG DISCARDABLE 0, 0, 409, 249 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "StellaX" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP | - WS_GROUP,7,45,44,8 - CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | - WS_BORDER | WS_TABSTOP,7,57,395,143,WS_EX_STATICEDGE - CONTROL "&Play",IDC_PLAY,"Button",BS_OWNERDRAW | WS_TABSTOP,7, - 226,200,16 - CONTROL "&Options",IDC_CONFIG,"Button",BS_OWNERDRAW | WS_TABSTOP, - 230,226,54,16 - CONTROL "&Help",IDC_ABOUT,"Button",BS_OWNERDRAW | WS_TABSTOP,289, - 226,54,16 - CONTROL "E&xit",IDC_EXIT,"Button",BS_OWNERDRAW | WS_TABSTOP,348, - 226,54,16 - CTEXT "Written by Jeff Miller (miller@zipcon.net)\nStella core by Bradford W. Mott (bwmott@acm.org)", - IDC_STATIC,175,13,227,19,SS_NOPREFIX - RTEXT "",IDC_ROMCOUNT,322,45,80,8,SS_NOPREFIX - CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,39,411,1 - CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,218,411,1 - CONTROL "StellaX v1.1.3a",IDC_TITLE,"Button",BS_OWNERDRAW | - WS_DISABLED | WS_TABSTOP,0,0,167,34 - CONTROL "Static",IDC_ROMPATH,"Static",SS_LEFTNOWORDWRAP | - SS_NOPREFIX | WS_GROUP,57,45,254,8 - CONTROL "",IDC_ROMNOTE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | - WS_GROUP,93,205,309,8 - LTEXT "Game notes (if available):",-1,7,205,80,8 -END - IDD_DOC_PAGE DIALOG DISCARDABLE 0, 0, 390, 196 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Documentation" @@ -147,44 +115,8 @@ BEGIN IDC_ADOBE,7,35,376,10,SS_NOTIFY | NOT WS_VISIBLE END -IDD_ABOUT_PAGE DIALOG DISCARDABLE 0, 0, 390, 196 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Information" -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT "You must own legal copies of all ROM images you are using. Neither Jeff Miller nor the rest of the Stella team can tell you where to find ROM images so DON'T ASK. All requests will either be deleted or sent to the appropriate authorities.", - -1,7,7,376,18,SS_NOPREFIX - LTEXT "If you have a question or a problem, please try one of these contacts:", - -1,7,93,376,8,SS_NOPREFIX - LTEXT "Jeff Miller:",-1,7,109,32,8,SS_NOPREFIX - LTEXT "miller@zipcon.net",IDC_EMAIL_JEFFMILL,73,109,56,8, - SS_NOPREFIX | SS_NOTIFY - LTEXT "http://www.emuunlim.com/stellax/",IDC_WEB_JEFFMILL,178, - 109,110,8,SS_NOPREFIX | SS_NOTIFY - LTEXT "Stella dev team:",-1,7,121,52,8,SS_NOPREFIX - LTEXT "stella@csc.ncsu.edu",IDC_EMAIL_STELLA,73,121,67,8, - SS_NOPREFIX | SS_NOTIFY - LTEXT "http://stella.atari.org",IDC_WEB_STELLA,178,121,65,8, - SS_NOPREFIX | SS_NOTIFY - LTEXT "God, Suzi and Noah",-1,60,155,69,8,SS_NOPREFIX - LTEXT "Bradford Mott, Mike Balfour and Roger Onslow.",-1,60, - 168,287,8,SS_NOPREFIX - LTEXT "StellaX is free software. It may not be sold or offered as part of a collection for sale without permission from Jeff Miller. When distributing StellaX, the original distribution (the .zip file) must not be altered.", - -1,7,32,376,19,SS_NOPREFIX - CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,143,376,1 - LTEXT "Beta Tester:",-1,7,181,44,8,SS_NOPREFIX - LTEXT "John Hardy IV",IDC_WWW_MAME,60,181,46,8,SS_NOPREFIX | - SS_NOTIFY - CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,81,376,1 - LTEXT "TIPS: F12 will create a screen shot of the current game screen. Open up stella.ini in notepad to see configurable options.", - -1,7,56,376,18 - LTEXT "Thanks To:",-1,7,168,38,8 - LTEXT "Dedicated To:",-1,7,155,46,8 -END - IDD_CONFIG_PAGE DIALOG DISCARDABLE 0, 0, 390, 196 -STYLE WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Options" +STYLE DS_MODALFRAME | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN LTEXT "&ROM (.bin) file path:",-1,7,10,64,8 @@ -198,7 +130,7 @@ BEGIN WS_TABSTOP LTEXT "Set this to specify which paddle the mouse should emulate. This can be any number from 0 to 3 inclusive.", -1,7,65,333,8 - CONTROL "",-1,"Static",SS_ETCHEDHORZ,8,82,375,1 + CONTROL "",-1,"Static",SS_ETCHEDHORZ,7,82,375,1 CONTROL "&Auto select video mode",IDC_AUTO_SELECT_VIDEOMODE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,90,10 LTEXT "If this is not checked, then a standard video mode (640x480) will be used. Otherwise, StellaX will use the video mode which it believes will work best. You should only uncheck this if you are having video problems while running StellaX.", @@ -210,6 +142,29 @@ BEGIN BS_AUTOCHECKBOX | WS_TABSTOP,7,155,70,10 END +IDD_MAIN DIALOGEX 0, 0, 409, 211 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +CAPTION "StellaX" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "&Files found in:",-1,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,7,7,44,8 + CONTROL "List1",IDC_ROMLIST,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + WS_BORDER | WS_TABSTOP,7,19,395,143,WS_EX_STATICEDGE + PUSHBUTTON "&Play",IDC_PLAY,7,188,200,16 + PUSHBUTTON "&Options",IDC_CONFIG,230,188,54,16 + PUSHBUTTON "&Help",IDC_ABOUT,289,188,54,16 + PUSHBUTTON "E&xit",IDC_EXIT,348,188,54,16 + RTEXT "",IDC_ROMCOUNT,322,7,80,8,SS_NOPREFIX + CONTROL "Static",IDC_ROMPATH,"Static",SS_LEFTNOWORDWRAP | + SS_NOPREFIX | WS_GROUP,57,7,254,8 + CONTROL "",IDC_ROMNOTE,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | + WS_GROUP,93,167,309,8 + LTEXT "Game notes (if available):",-1,7,167,80,8 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -219,14 +174,6 @@ END #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 402 - TOPMARGIN, 7 - BOTTOMMARGIN, 242 - END - IDD_DOC_PAGE, DIALOG BEGIN LEFTMARGIN, 7 @@ -235,14 +182,6 @@ BEGIN BOTTOMMARGIN, 189 END - IDD_ABOUT_PAGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 383 - TOPMARGIN, 7 - BOTTOMMARGIN, 189 - END - IDD_CONFIG_PAGE, DIALOG BEGIN LEFTMARGIN, 7 @@ -250,6 +189,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 189 END + + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 402 + TOPMARGIN, 7 + BOTTOMMARGIN, 204 + END END #endif // APSTUDIO_INVOKED @@ -263,13 +210,6 @@ END // remains consistent on all systems. IDI_APP ICON DISCARDABLE "STELLA.ICO" -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_TILE BITMAP DISCARDABLE "tile.bmp" - ///////////////////////////////////////////////////////////////////////////// // // String Table