mirror of https://github.com/stella-emu/stella.git
Fixing various bugs I checked in 4 hours ago.
*GRMBLFX* Someday I should know how windows messages work... git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@90 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
47ce58f23d
commit
b4e885bc4b
|
@ -49,7 +49,7 @@ LPCTSTR g_ctszDebugLog = _T("stella.log");
|
|||
|
||||
BOOL CCyberstellaApp::InitInstance()
|
||||
{
|
||||
// Delete previous Debug Log
|
||||
// Delete previous Debug Log
|
||||
(void)::DeleteFile(g_ctszDebugLog);
|
||||
|
||||
// Avoid Second instance
|
||||
|
@ -82,7 +82,7 @@ BOOL CCyberstellaApp::InitInstance()
|
|||
// Register the application's document templates. Document templates
|
||||
// serve as the connection between documents, frame windows and views.
|
||||
|
||||
CSingleDocTemplate* pDocTemplate;
|
||||
CSingleDocTemplate* pDocTemplate;
|
||||
pDocTemplate = new CSingleDocTemplate(
|
||||
IDR_MAINFRAME,
|
||||
RUNTIME_CLASS(CCyberstellaDoc),
|
||||
|
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\build" /I "..\..\emucore" /I "..\..\emucore\m6502\src" /I "..\..\emucore\m6502\src\bspf\src" /I "..\sound" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "BSPF_WIN32" /FR /FD /c
|
||||
# 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" /FR /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
|
|
|
@ -51,6 +51,7 @@ BEGIN_MESSAGE_MAP(CCyberstellaView, CFormView)
|
|||
ON_COMMAND(IDG_THRUST, OnThrust)
|
||||
ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos)
|
||||
ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote)
|
||||
ON_MESSAGE(MSG_VIEW_INITIALIZE, initialize)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -76,7 +77,7 @@ CCyberstellaView::~CCyberstellaView()
|
|||
|
||||
void CCyberstellaView::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CFormView::DoDataExchange(pDX);
|
||||
CFormView::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CCyberstellaView)
|
||||
DDX_Control(pDX, IDC_ROMLIST, m_List);
|
||||
//}}AFX_DATA_MAP
|
||||
|
@ -92,12 +93,12 @@ BOOL CCyberstellaView::PreCreateWindow(CREATESTRUCT& cs)
|
|||
|
||||
void CCyberstellaView::OnInitialUpdate()
|
||||
{
|
||||
CFormView::OnInitialUpdate();
|
||||
CFormView::OnInitialUpdate();
|
||||
GetParentFrame()->RecalcLayout();
|
||||
ResizeParentToFit();
|
||||
|
||||
// Init ListControl, parse stella.pro
|
||||
Initialize();
|
||||
PostMessage(MSG_VIEW_INITIALIZE);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -127,8 +128,121 @@ void CCyberstellaView::OnConfig()
|
|||
dlg.DoModal();
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnPlay(LONG gameID)
|
||||
void CCyberstellaView::OnPlay()
|
||||
{
|
||||
playRom();
|
||||
}
|
||||
|
||||
// Toggles pausing of the emulator
|
||||
void CCyberstellaView::togglePause()
|
||||
{
|
||||
m_bIsPause = !m_bIsPause;
|
||||
|
||||
//TODO: theConsole->mediaSource().pause(m_bIsPause);
|
||||
}
|
||||
|
||||
LRESULT CCyberstellaView::initialize(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Create a properties set for us to use
|
||||
m_pPropertiesSet = new PropertiesSet();
|
||||
|
||||
// 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);
|
||||
|
||||
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||
|
||||
// Init ListCtrl
|
||||
m_List.init(m_pPropertiesSet,this);
|
||||
|
||||
// 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
|
||||
{
|
||||
m_pPropertiesSet->load("", &Console::defaultProperties());
|
||||
MessageBox("stella.pro not found in working directory!", "Warning!", MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
m_List.populateRomList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnDestroy()
|
||||
{
|
||||
CFormView::OnDestroy();
|
||||
m_List.deleteItemsAndProperties();
|
||||
}
|
||||
|
||||
LRESULT CCyberstellaView::updateListInfos(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Show status text
|
||||
CString status;
|
||||
status.Format(IDS_STATUSTEXT, m_List.getRomCount());
|
||||
SetDlgItemText(IDC_ROMCOUNT,status);
|
||||
|
||||
// Show rom path
|
||||
SetDlgItemText(IDC_ROMPATH, m_List.getPath());
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CCyberstellaView::displayNote(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
// Show rom path
|
||||
CString note;
|
||||
note.Format(IDS_NOTETEXT, m_List.getCurrentNote());
|
||||
((CMainFrame*)AfxGetMainWnd())->setStatusText(note);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnGunfight()
|
||||
{
|
||||
playRom(IDG_GUNFIGHT);
|
||||
MessageBox("If you'd like to play Gunfight on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnJammed()
|
||||
{
|
||||
playRom(IDG_JAMMED);
|
||||
MessageBox("If you'd like to play Jammed on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnQb()
|
||||
{
|
||||
playRom(IDG_QB);
|
||||
MessageBox("If you'd like to play Qb on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnThrust()
|
||||
{
|
||||
playRom(IDG_THRUST);
|
||||
MessageBox("If you'd like to play Thrust on a real VCS, you can order a cartridge for only $25\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::playRom(LONG gameID)
|
||||
{
|
||||
|
||||
EnableWindow(FALSE);
|
||||
|
||||
#ifdef USE_FS
|
||||
|
@ -388,113 +502,10 @@ exit:
|
|||
delete pwnd;
|
||||
delete pConsole;
|
||||
delete pSound;
|
||||
delete pImage;
|
||||
if (pImage) delete pImage;
|
||||
|
||||
EnableWindow(TRUE);
|
||||
|
||||
// Set focus back to the rom list
|
||||
m_List.SetFocus();
|
||||
}
|
||||
|
||||
// Toggles pausing of the emulator
|
||||
void CCyberstellaView::togglePause()
|
||||
{
|
||||
m_bIsPause = !m_bIsPause;
|
||||
|
||||
//TODO: theConsole->mediaSource().pause(m_bIsPause);
|
||||
}
|
||||
|
||||
void CCyberstellaView::Initialize()
|
||||
{
|
||||
// Create a properties set for us to use
|
||||
m_pPropertiesSet = new PropertiesSet();
|
||||
|
||||
// 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);
|
||||
|
||||
m_List.SetImageList (&m_imglist, LVSIL_SMALL);
|
||||
|
||||
// Init ListCtrl
|
||||
m_List.init(m_pPropertiesSet,this);
|
||||
|
||||
// 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
|
||||
{
|
||||
m_pPropertiesSet->load("", &Console::defaultProperties());
|
||||
MessageBox("stella.pro not found in working directory!", "Warning!", MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
// Fill our game list
|
||||
m_List.populateRomList();
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnDestroy()
|
||||
{
|
||||
CFormView::OnDestroy();
|
||||
m_List.deleteItemsAndProperties();
|
||||
}
|
||||
|
||||
void CCyberstellaView::updateListInfos()
|
||||
{
|
||||
// Show status text
|
||||
CString status;
|
||||
status.Format(IDS_STATUSTEXT, m_List.getRomCount());
|
||||
SetDlgItemText(IDC_ROMCOUNT,status);
|
||||
|
||||
// Show rom path
|
||||
SetDlgItemText(IDC_ROMPATH, m_List.getPath());
|
||||
}
|
||||
|
||||
void CCyberstellaView::displayNote()
|
||||
{
|
||||
// Show rom path
|
||||
CString note;
|
||||
note.Format(IDS_NOTETEXT, m_List.getCurrentNote());
|
||||
((CMainFrame*)AfxGetMainWnd())->setStatusText(note);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnGunfight()
|
||||
{
|
||||
OnPlay(IDG_GUNFIGHT);
|
||||
MessageBox("If you'd like to play Gunfight on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnJammed()
|
||||
{
|
||||
OnPlay(IDG_JAMMED);
|
||||
MessageBox("If you'd like to play Jammed on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnQb()
|
||||
{
|
||||
OnPlay(IDG_QB);
|
||||
MessageBox("If you'd like to play Qb on a real VCS, you can order a cartridge for only $16\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
||||
|
||||
void CCyberstellaView::OnThrust()
|
||||
{
|
||||
OnPlay(IDG_THRUST);
|
||||
MessageBox("If you'd like to play Thrust on a real VCS, you can order a cartridge for only $25\nfrom http://webpages.charter.net/hozervideo!", "Commercial Break", MB_OK);
|
||||
}
|
|
@ -58,7 +58,7 @@ protected:
|
|||
protected:
|
||||
//{{AFX_MSG(CCyberstellaView)
|
||||
afx_msg void OnConfig();
|
||||
afx_msg void OnPlay(LONG gameID);
|
||||
afx_msg void OnPlay();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnGunfight();
|
||||
afx_msg void OnJammed();
|
||||
|
@ -70,9 +70,11 @@ protected:
|
|||
private:
|
||||
// methods
|
||||
void togglePause();
|
||||
void Initialize();
|
||||
void updateListInfos();
|
||||
void displayNote();
|
||||
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* m_pPropertiesSet;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "GameList.h"
|
||||
#include "MD5.hxx"
|
||||
|
||||
class CyberstellaView;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
|
@ -127,7 +129,7 @@ void GameList::populateRomList()
|
|||
// Select first item
|
||||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
|
||||
m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_UPDATE);
|
||||
}
|
||||
|
||||
void GameList::displayPath()
|
||||
|
@ -421,7 +423,7 @@ void GameList::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
|
|||
{
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
||||
|
||||
m_pParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
||||
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ CMainFrame::~CMainFrame()
|
|||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
public:
|
||||
virtual ~CMainFrame();
|
||||
void setStatusText(CString text);
|
||||
void updateListInfos();
|
||||
void displayNote();
|
||||
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
|
|
|
@ -12,6 +12,7 @@ Later:
|
|||
- Add Pause - F3
|
||||
- Add Fullscreen / Windowed mode -F4
|
||||
- Check Direct Draw implementation / upgrade to DX8
|
||||
- Integrate manuals for the built in games
|
||||
|
||||
ToDos from Brad Mott:
|
||||
- Is the keyboard mapping correct (e.g., do both of the Joysticks
|
||||
|
|
|
@ -39,8 +39,9 @@
|
|||
#include <dinput.h>
|
||||
|
||||
// Stella Messages:
|
||||
#define MSG_GAMELIST_UPDATE WM_USER+0x100
|
||||
#define MSG_GAMELIST_DISPLAYNOTE WM_USER+0x101
|
||||
#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]))
|
||||
|
||||
|
|
Loading…
Reference in New Issue