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
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# 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 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
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD 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_COMMAND(IDG_THRUST, OnThrust)
|
||||||
ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos)
|
ON_MESSAGE(MSG_GAMELIST_UPDATE, updateListInfos)
|
||||||
ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote)
|
ON_MESSAGE(MSG_GAMELIST_DISPLAYNOTE, displayNote)
|
||||||
|
ON_MESSAGE(MSG_VIEW_INITIALIZE, initialize)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ void CCyberstellaView::OnInitialUpdate()
|
||||||
ResizeParentToFit();
|
ResizeParentToFit();
|
||||||
|
|
||||||
// Init ListControl, parse stella.pro
|
// Init ListControl, parse stella.pro
|
||||||
Initialize();
|
PostMessage(MSG_VIEW_INITIALIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -127,8 +128,121 @@ void CCyberstellaView::OnConfig()
|
||||||
dlg.DoModal();
|
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);
|
EnableWindow(FALSE);
|
||||||
|
|
||||||
#ifdef USE_FS
|
#ifdef USE_FS
|
||||||
|
@ -388,113 +502,10 @@ exit:
|
||||||
delete pwnd;
|
delete pwnd;
|
||||||
delete pConsole;
|
delete pConsole;
|
||||||
delete pSound;
|
delete pSound;
|
||||||
delete pImage;
|
if (pImage) delete pImage;
|
||||||
|
|
||||||
EnableWindow(TRUE);
|
EnableWindow(TRUE);
|
||||||
|
|
||||||
// Set focus back to the rom list
|
// Set focus back to the rom list
|
||||||
m_List.SetFocus();
|
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:
|
protected:
|
||||||
//{{AFX_MSG(CCyberstellaView)
|
//{{AFX_MSG(CCyberstellaView)
|
||||||
afx_msg void OnConfig();
|
afx_msg void OnConfig();
|
||||||
afx_msg void OnPlay(LONG gameID);
|
afx_msg void OnPlay();
|
||||||
afx_msg void OnDestroy();
|
afx_msg void OnDestroy();
|
||||||
afx_msg void OnGunfight();
|
afx_msg void OnGunfight();
|
||||||
afx_msg void OnJammed();
|
afx_msg void OnJammed();
|
||||||
|
@ -70,9 +70,11 @@ protected:
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
void togglePause();
|
void togglePause();
|
||||||
void Initialize();
|
void playRom(LONG gameID = NULL);
|
||||||
void updateListInfos();
|
|
||||||
void displayNote();
|
LRESULT initialize(WPARAM wParam, LPARAM lParam);
|
||||||
|
LRESULT displayNote(WPARAM wParam, LPARAM lParam);
|
||||||
|
LRESULT updateListInfos(WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
// members
|
// members
|
||||||
PropertiesSet* m_pPropertiesSet;
|
PropertiesSet* m_pPropertiesSet;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "GameList.h"
|
#include "GameList.h"
|
||||||
#include "MD5.hxx"
|
#include "MD5.hxx"
|
||||||
|
|
||||||
|
class CyberstellaView;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
#undef THIS_FILE
|
#undef THIS_FILE
|
||||||
|
@ -127,7 +129,7 @@ void GameList::populateRomList()
|
||||||
// Select first item
|
// Select first item
|
||||||
SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
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()
|
void GameList::displayPath()
|
||||||
|
@ -421,7 +423,7 @@ void GameList::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
{
|
{
|
||||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
||||||
|
|
||||||
m_pParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
if(m_pParent) m_pParent->SendMessage(MSG_GAMELIST_DISPLAYNOTE);
|
||||||
|
|
||||||
*pResult = 0;
|
*pResult = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
public:
|
public:
|
||||||
virtual ~CMainFrame();
|
virtual ~CMainFrame();
|
||||||
void setStatusText(CString text);
|
void setStatusText(CString text);
|
||||||
|
void updateListInfos();
|
||||||
|
void displayNote();
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
virtual void AssertValid() const;
|
virtual void AssertValid() const;
|
||||||
|
|
|
@ -12,6 +12,7 @@ Later:
|
||||||
- Add Pause - F3
|
- Add Pause - F3
|
||||||
- Add Fullscreen / Windowed mode -F4
|
- Add Fullscreen / Windowed mode -F4
|
||||||
- Check Direct Draw implementation / upgrade to DX8
|
- Check Direct Draw implementation / upgrade to DX8
|
||||||
|
- Integrate manuals for the built in games
|
||||||
|
|
||||||
ToDos from Brad Mott:
|
ToDos from Brad Mott:
|
||||||
- Is the keyboard mapping correct (e.g., do both of the Joysticks
|
- Is the keyboard mapping correct (e.g., do both of the Joysticks
|
||||||
|
|
|
@ -39,8 +39,9 @@
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
// Stella Messages:
|
// Stella Messages:
|
||||||
#define MSG_GAMELIST_UPDATE WM_USER+0x100
|
#define MSG_GAMELIST_UPDATE WM_USER+0x1000
|
||||||
#define MSG_GAMELIST_DISPLAYNOTE WM_USER+0x101
|
#define MSG_GAMELIST_DISPLAYNOTE WM_USER+0x1001
|
||||||
|
#define MSG_VIEW_INITIALIZE WM_USER+0x1002
|
||||||
|
|
||||||
#define _countof(array) (sizeof(array)/sizeof(array[0]))
|
#define _countof(array) (sizeof(array)/sizeof(array[0]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue