mirror of
https://github.com/libretro/Play-.git
synced 2025-01-24 10:06:38 +00:00
PsfPlayer: SpuRegView updates.
git-svn-id: http://svn.purei.org/purei/trunk@636 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
6973660a6f
commit
8e6a9f78e6
@ -8,7 +8,7 @@
|
||||
#pragma comment (lib, "d3d9.lib")
|
||||
#pragma comment (lib, "d3dx9.lib")
|
||||
|
||||
CDirectXControl::CDirectXControl(HWND parentWnd)
|
||||
CDirectXControl::CDirectXControl(HWND parentWnd, uint32 wndStyle)
|
||||
: m_d3d(NULL)
|
||||
, m_device(NULL)
|
||||
, m_deviceLost(false)
|
||||
@ -26,7 +26,7 @@ CDirectXControl::CDirectXControl(HWND parentWnd)
|
||||
RegisterClassEx(&w);
|
||||
}
|
||||
|
||||
Create(WNDSTYLEEX, CLSNAME, _T(""), WNDSTYLE, Framework::Win32::CRect(0, 0, 1, 1), parentWnd, NULL);
|
||||
Create(WNDSTYLEEX, CLSNAME, _T(""), WNDSTYLE | wndStyle, Framework::Win32::CRect(0, 0, 1, 1), parentWnd, NULL);
|
||||
SetClassPtr();
|
||||
|
||||
m_backgroundColor = ConvertSysColor(GetSysColor(COLOR_BTNFACE));
|
||||
|
@ -8,7 +8,7 @@
|
||||
class CDirectXControl : public Framework::Win32::CWindow
|
||||
{
|
||||
public:
|
||||
CDirectXControl(HWND);
|
||||
CDirectXControl(HWND, uint32 = 0);
|
||||
virtual ~CDirectXControl();
|
||||
|
||||
protected:
|
||||
|
@ -143,8 +143,8 @@ m_accel(CreateAccelerators())
|
||||
m_fileInformationPanel = new CFileInformationPanel(m_placeHolder->m_hWnd);
|
||||
|
||||
//Create RegView panels
|
||||
m_spu0RegViewPanel = new CSpuRegViewPanel(m_placeHolder->m_hWnd);
|
||||
m_spu1RegViewPanel = new CSpuRegViewPanel(m_placeHolder->m_hWnd);
|
||||
m_spu0RegViewPanel = new CSpuRegViewPanel(m_placeHolder->m_hWnd, _T("SPU0"));
|
||||
m_spu1RegViewPanel = new CSpuRegViewPanel(m_placeHolder->m_hWnd, _T("SPU1"));
|
||||
|
||||
//Initialize panels
|
||||
m_panels[0] = m_playlistPanel;
|
||||
|
@ -1,12 +1,24 @@
|
||||
#include "SpuRegView.h"
|
||||
#include "win32/Rect.h"
|
||||
|
||||
CSpuRegView::CSpuRegView(HWND parentWnd) :
|
||||
CDirectXControl(parentWnd),
|
||||
#define CANVAS_WIDTH (188)
|
||||
#define CANVAS_HEIGHT (45)
|
||||
|
||||
#define PAGE_SIZE (1)
|
||||
|
||||
CSpuRegView::CSpuRegView(HWND parentWnd, const TCHAR* title) :
|
||||
CDirectXControl(parentWnd, WS_VSCROLL | WS_HSCROLL),
|
||||
m_spu(NULL),
|
||||
m_font(NULL)
|
||||
m_font(NULL),
|
||||
m_title(title),
|
||||
m_offsetX(0),
|
||||
m_offsetY(0),
|
||||
m_maxScrollX(0),
|
||||
m_maxScrollY(0)
|
||||
{
|
||||
CreateResources();
|
||||
UpdateHorizontalScroll();
|
||||
UpdateVerticalScroll();
|
||||
SetTimer(m_hWnd, NULL, 16, NULL);
|
||||
}
|
||||
|
||||
@ -28,6 +40,82 @@ long CSpuRegView::OnTimer(WPARAM param)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
long CSpuRegView::OnHScroll(unsigned int type, unsigned int position)
|
||||
{
|
||||
bool update = true;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SB_LINEDOWN:
|
||||
m_offsetX += 1;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
m_offsetX -= 1;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
m_offsetX += PAGE_SIZE;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
m_offsetX -= PAGE_SIZE;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
m_offsetX = position;
|
||||
update = false;
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
m_offsetX = position;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_offsetX < 0) m_offsetX = 0;
|
||||
if(m_offsetX > CANVAS_WIDTH) m_offsetX = CANVAS_WIDTH;
|
||||
|
||||
if(update)
|
||||
{
|
||||
UpdateHorizontalScroll();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
long CSpuRegView::OnVScroll(unsigned int type, unsigned int position)
|
||||
{
|
||||
bool update = true;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SB_LINEDOWN:
|
||||
m_offsetY += 1;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
m_offsetY -= 1;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
m_offsetY += PAGE_SIZE;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
m_offsetY -= PAGE_SIZE;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
m_offsetY = position;
|
||||
update = false;
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
m_offsetY = position;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_offsetY < 0) m_offsetY = 0;
|
||||
if(m_offsetY > CANVAS_HEIGHT) m_offsetY = CANVAS_HEIGHT;
|
||||
|
||||
if(update)
|
||||
{
|
||||
UpdateVerticalScroll();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CSpuRegView::CreateResources()
|
||||
{
|
||||
D3DXCreateFont(m_device, -11, 0, FW_NORMAL, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Courier New"), &m_font);
|
||||
@ -48,6 +136,32 @@ void CSpuRegView::SetSpu(Iop::CSpuBase* spu)
|
||||
m_spu = spu;
|
||||
}
|
||||
|
||||
void CSpuRegView::UpdateHorizontalScroll()
|
||||
{
|
||||
SCROLLINFO scrollInfo;
|
||||
memset(&scrollInfo, 0, sizeof(SCROLLINFO));
|
||||
scrollInfo.cbSize = sizeof(SCROLLINFO);
|
||||
scrollInfo.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
|
||||
scrollInfo.nMin = 0;
|
||||
scrollInfo.nMax = CANVAS_WIDTH;
|
||||
scrollInfo.nPos = m_offsetX;
|
||||
scrollInfo.nPage = PAGE_SIZE;
|
||||
SetScrollInfo(m_hWnd, SB_HORZ, &scrollInfo, TRUE);
|
||||
}
|
||||
|
||||
void CSpuRegView::UpdateVerticalScroll()
|
||||
{
|
||||
SCROLLINFO scrollInfo;
|
||||
memset(&scrollInfo, 0, sizeof(SCROLLINFO));
|
||||
scrollInfo.cbSize = sizeof(SCROLLINFO);
|
||||
scrollInfo.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
|
||||
scrollInfo.nMin = 0;
|
||||
scrollInfo.nMax = CANVAS_HEIGHT;
|
||||
scrollInfo.nPos = m_offsetY;
|
||||
scrollInfo.nPage = PAGE_SIZE;
|
||||
SetScrollInfo(m_hWnd, SB_VERT, &scrollInfo, TRUE);
|
||||
}
|
||||
|
||||
void CSpuRegView::Refresh()
|
||||
{
|
||||
if(m_device == NULL) return;
|
||||
@ -55,21 +169,24 @@ void CSpuRegView::Refresh()
|
||||
|
||||
m_device->Clear(0, NULL, D3DCLEAR_TARGET, m_backgroundColor, 1.0f, 0);
|
||||
m_device->BeginScene();
|
||||
|
||||
CLineDrawer drawer(m_font, m_textColor, -m_offsetX, -m_offsetY);
|
||||
|
||||
{
|
||||
std::tstring text = m_title + _T(" VLEFT VRIGH PITCH ADDRE ADSRL ADSRR ADSRVOLU REPEA ");
|
||||
drawer.Draw(text.c_str(), text.length());
|
||||
drawer.Feed();
|
||||
}
|
||||
|
||||
if(m_spu != NULL)
|
||||
{
|
||||
CLineDrawer drawer(m_font, m_textColor);
|
||||
|
||||
{
|
||||
std::tstring text = _T(" VLEFT VRIGH PITCH ADDRE ADSRL ADSRR ADSRV REPEA ");
|
||||
drawer.Draw(text.c_str(), text.length());
|
||||
drawer.Feed();
|
||||
}
|
||||
TCHAR channelStatus[Iop::CSpuBase::MAX_CHANNEL + 1];
|
||||
|
||||
for(unsigned int i = 0; i < Iop::CSpuBase::MAX_CHANNEL; i++)
|
||||
{
|
||||
Iop::CSpuBase::CHANNEL& channel(m_spu->GetChannel(i));
|
||||
TCHAR temp[256];
|
||||
_stprintf(temp, _T("CH%0.2i %0.4X %0.4X %0.4X %0.6X %0.4X %0.4X %0.4X %0.6X\r\n"),
|
||||
_stprintf(temp, _T("CH%0.2i %0.4X %0.4X %0.4X %0.6X %0.4X %0.4X %0.8X %0.6X\r\n"),
|
||||
i,
|
||||
channel.volumeLeft,
|
||||
channel.volumeRight,
|
||||
@ -77,17 +194,64 @@ void CSpuRegView::Refresh()
|
||||
channel.address,
|
||||
channel.adsrLevel,
|
||||
channel.adsrRate,
|
||||
channel.adsrVolume >> 16,
|
||||
channel.adsrVolume,
|
||||
channel.repeat);
|
||||
drawer.Draw(temp);
|
||||
|
||||
TCHAR status = _T('0');
|
||||
switch(channel.status)
|
||||
{
|
||||
case Iop::CSpuBase::ATTACK:
|
||||
case Iop::CSpuBase::KEY_ON:
|
||||
status = _T('A');
|
||||
break;
|
||||
case Iop::CSpuBase::DECAY:
|
||||
status = _T('D');
|
||||
break;
|
||||
case Iop::CSpuBase::SUSTAIN:
|
||||
status = _T('S');
|
||||
break;
|
||||
case Iop::CSpuBase::RELEASE:
|
||||
status = _T('R');
|
||||
break;
|
||||
}
|
||||
|
||||
channelStatus[i] = status;
|
||||
}
|
||||
|
||||
drawer.Feed();
|
||||
|
||||
channelStatus[Iop::CSpuBase::MAX_CHANNEL] = 0;
|
||||
|
||||
{
|
||||
TCHAR temp[256];
|
||||
_stprintf(temp, _T("CH_STAT: %s"), channelStatus);
|
||||
drawer.Draw(temp);
|
||||
}
|
||||
|
||||
{
|
||||
TCHAR revbStat[Iop::CSpuBase::MAX_CHANNEL + 1];
|
||||
|
||||
uint32 stat = m_spu->GetChannelReverb().f;
|
||||
for(unsigned int i = 0; i < Iop::CSpuBase::MAX_CHANNEL; i++)
|
||||
{
|
||||
revbStat[i] = (stat & (1 << i)) ? _T('1') : _T('0');
|
||||
}
|
||||
revbStat[Iop::CSpuBase::MAX_CHANNEL] = 0;
|
||||
|
||||
TCHAR temp[256];
|
||||
_stprintf(temp, _T("CH_REVB: %s"), revbStat);
|
||||
drawer.Draw(temp);
|
||||
}
|
||||
|
||||
}
|
||||
m_device->EndScene();
|
||||
m_device->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
CSpuRegView::CLineDrawer::CLineDrawer(LPD3DXFONT font, D3DCOLOR color)
|
||||
: m_posY(0)
|
||||
CSpuRegView::CLineDrawer::CLineDrawer(LPD3DXFONT font, D3DCOLOR color, int posX, int posY)
|
||||
: m_posX(posX)
|
||||
, m_posY(posY)
|
||||
, m_font(font)
|
||||
, m_color(color)
|
||||
{
|
||||
@ -96,7 +260,7 @@ CSpuRegView::CLineDrawer::CLineDrawer(LPD3DXFONT font, D3DCOLOR color)
|
||||
|
||||
void CSpuRegView::CLineDrawer::Draw(const TCHAR* text, int length)
|
||||
{
|
||||
m_font->DrawText(NULL, text, length, Framework::Win32::CRect(0, m_posY, 1, 1), DT_NOCLIP, m_color);
|
||||
m_font->DrawText(NULL, text, length, Framework::Win32::CRect(m_posX, m_posY, 1, 1), DT_NOCLIP, m_color);
|
||||
Feed();
|
||||
}
|
||||
|
||||
@ -104,76 +268,3 @@ void CSpuRegView::CLineDrawer::Feed()
|
||||
{
|
||||
m_posY += 12;
|
||||
}
|
||||
|
||||
//void CSpuRegView::Render()
|
||||
//{
|
||||
// string text;
|
||||
// char channelStatus[CSpuBase::MAX_CHANNEL + 1];
|
||||
//
|
||||
// //Header
|
||||
// text += " VLEFT VRIGH PITCH ADDRE ADSRL ADSRR ADSRV REPEA \r\n";
|
||||
// text += "\r\n";
|
||||
//
|
||||
// //Channel detail
|
||||
// for(unsigned int i = 0; i < CSpuBase::MAX_CHANNEL; i++)
|
||||
// {
|
||||
// CSpuBase::CHANNEL& channel(m_spu.GetChannel(i));
|
||||
// char temp[256];
|
||||
// sprintf(temp, "CH%0.2i %0.4X %0.4X %0.4X %0.6X %0.4X %0.4X %0.4X %0.6X\r\n",
|
||||
// i,
|
||||
// channel.volumeLeft,
|
||||
// channel.volumeRight,
|
||||
// channel.pitch,
|
||||
// channel.address,
|
||||
// channel.adsrLevel,
|
||||
// channel.adsrRate,
|
||||
// channel.adsrVolume >> 16,
|
||||
// channel.repeat);
|
||||
// text += temp;
|
||||
//
|
||||
// char status = '0';
|
||||
// switch(channel.status)
|
||||
// {
|
||||
// case CSpuBase::ATTACK:
|
||||
// case CSpuBase::KEY_ON:
|
||||
// status = 'A';
|
||||
// break;
|
||||
// case CSpuBase::DECAY:
|
||||
// status = 'D';
|
||||
// break;
|
||||
// case CSpuBase::SUSTAIN:
|
||||
// status = 'S';
|
||||
// break;
|
||||
// case CSpuBase::RELEASE:
|
||||
// status = 'R';
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// channelStatus[i] = status;
|
||||
// }
|
||||
//
|
||||
// channelStatus[CSpuBase::MAX_CHANNEL] = 0;
|
||||
//
|
||||
// text += "\r\n";
|
||||
// {
|
||||
// char temp[256];
|
||||
// sprintf(temp, "CH_STAT: %s\r\n", channelStatus);
|
||||
// text += temp;
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// char revbStat[CSpuBase::MAX_CHANNEL + 1];
|
||||
// char temp[256];
|
||||
// uint32 stat = m_spu.GetChannelReverb().f;
|
||||
// for(unsigned int i = 0; i < CSpuBase::MAX_CHANNEL; i++)
|
||||
// {
|
||||
// revbStat[i] = (stat & (1 << i)) ? '1' : '0';
|
||||
// }
|
||||
// revbStat[CSpuBase::MAX_CHANNEL] = 0;
|
||||
//
|
||||
// sprintf(temp, "CH_REVB: %s\r\n", revbStat);
|
||||
// text += temp;
|
||||
// }
|
||||
//
|
||||
// SetDisplayText(text.c_str());
|
||||
//}
|
||||
|
@ -7,7 +7,7 @@
|
||||
class CSpuRegView : public CDirectXControl
|
||||
{
|
||||
public:
|
||||
CSpuRegView(HWND);
|
||||
CSpuRegView(HWND, const TCHAR*);
|
||||
virtual ~CSpuRegView();
|
||||
|
||||
void SetSpu(Iop::CSpuBase*);
|
||||
@ -15,6 +15,9 @@ public:
|
||||
protected:
|
||||
virtual long OnTimer(WPARAM);
|
||||
|
||||
virtual long OnHScroll(unsigned int, unsigned int);
|
||||
virtual long OnVScroll(unsigned int, unsigned int);
|
||||
|
||||
virtual void Refresh();
|
||||
virtual void OnDeviceLost();
|
||||
virtual void OnDeviceReset();
|
||||
@ -23,20 +26,30 @@ private:
|
||||
class CLineDrawer
|
||||
{
|
||||
public:
|
||||
CLineDrawer(LPD3DXFONT, D3DCOLOR);
|
||||
CLineDrawer(LPD3DXFONT, D3DCOLOR, int, int);
|
||||
void Draw(const TCHAR*, int = -1);
|
||||
void Feed();
|
||||
|
||||
private:
|
||||
int m_posX;
|
||||
int m_posY;
|
||||
LPD3DXFONT m_font;
|
||||
D3DCOLOR m_color;
|
||||
};
|
||||
|
||||
virtual void CreateResources();
|
||||
void CreateResources();
|
||||
void UpdateHorizontalScroll();
|
||||
void UpdateVerticalScroll();
|
||||
|
||||
Iop::CSpuBase* m_spu;
|
||||
LPD3DXFONT m_font;
|
||||
|
||||
std::tstring m_title;
|
||||
|
||||
int m_offsetX;
|
||||
int m_offsetY;
|
||||
int m_maxScrollX;
|
||||
int m_maxScrollY;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define WNDSTYLE (WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD)
|
||||
#define WNDSTYLEEX (0)
|
||||
|
||||
CSpuRegViewPanel::CSpuRegViewPanel(HWND parentWnd)
|
||||
CSpuRegViewPanel::CSpuRegViewPanel(HWND parentWnd, const TCHAR* title)
|
||||
{
|
||||
if(!DoesWindowClassExist(CLSNAME))
|
||||
{
|
||||
@ -16,7 +16,7 @@ CSpuRegViewPanel::CSpuRegViewPanel(HWND parentWnd)
|
||||
Create(WNDSTYLEEX, CLSNAME, _T(""), WNDSTYLE, Framework::Win32::CRect(0, 0, 1, 1), parentWnd, NULL);
|
||||
SetClassPtr();
|
||||
|
||||
m_regView = new CSpuRegView(m_hWnd);
|
||||
m_regView = new CSpuRegView(m_hWnd, title);
|
||||
}
|
||||
|
||||
CSpuRegViewPanel::~CSpuRegViewPanel()
|
||||
|
@ -5,13 +5,10 @@
|
||||
#include "iop/Iop_SpuBase.h"
|
||||
#include "SpuRegView.h"
|
||||
|
||||
//#include "win32/Static.h"
|
||||
//#include "win32/GdiObj.h"
|
||||
|
||||
class CSpuRegViewPanel : public CPanel
|
||||
{
|
||||
public:
|
||||
CSpuRegViewPanel(HWND);
|
||||
CSpuRegViewPanel(HWND, const TCHAR*);
|
||||
virtual ~CSpuRegViewPanel();
|
||||
|
||||
void RefreshLayout();
|
||||
|
Loading…
x
Reference in New Issue
Block a user