mirror of
https://github.com/libretro/Play-.git
synced 2025-02-13 13:06:43 +00:00
git-svn-id: http://svn.purei.org/purei/trunk@364 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
5e429c8199
commit
3df45fecc7
47
tools/PsfPlayer2/Source/AboutWindow.cpp
Normal file
47
tools/PsfPlayer2/Source/AboutWindow.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "AboutWindow.h"
|
||||
#include "AppDef.h"
|
||||
#include "layout/LayoutEngine.h"
|
||||
#include "win32/Rect.h"
|
||||
#include "win32/Static.h"
|
||||
|
||||
#define CLSNAME _T("AboutWindow")
|
||||
#define WNDSTYLE (WS_CAPTION | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU)
|
||||
#define WNDSTYLEEX (WS_EX_DLGMODALFRAME)
|
||||
|
||||
using namespace std;
|
||||
using namespace Framework;
|
||||
|
||||
CAboutWindow::CAboutWindow(HWND parent) :
|
||||
CModalWindow(parent)
|
||||
{
|
||||
if(!DoesWindowClassExist(CLSNAME))
|
||||
{
|
||||
RegisterClassEx(&MakeWndClass(CLSNAME));
|
||||
}
|
||||
|
||||
Create(WNDSTYLEEX, CLSNAME, _T("About"), WNDSTYLE, Win32::CRect(0, 0, 400, 140), parent, NULL);
|
||||
SetClassPtr();
|
||||
|
||||
tstring aboutText;
|
||||
aboutText = tstring(APP_NAME) + _T(" v") + tstring(APP_VERSIONSTR) + _T("\r\n");
|
||||
aboutText += _T("\r\n");
|
||||
aboutText += tstring(_T("By Jean-Philip Desjardins")) + _T("\r\n");
|
||||
aboutText += _T("\r\n");
|
||||
aboutText += tstring(_T("Thanks to Neill Corlett for creating the PSF format and also for his ADSR analysis.")) + _T("\r\n");
|
||||
|
||||
m_layout = Win32::CLayoutWindow::CreateTextBoxBehavior(100, 60, new Win32::CStatic(m_hWnd, aboutText.c_str()));
|
||||
|
||||
RefreshLayout();
|
||||
}
|
||||
|
||||
CAboutWindow::~CAboutWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CAboutWindow::RefreshLayout()
|
||||
{
|
||||
RECT rc = GetClientRect();
|
||||
m_layout->SetRect(rc.left + 10, rc.top + 10, rc.right - 10, rc.bottom - 10);
|
||||
m_layout->RefreshGeometry();
|
||||
}
|
19
tools/PsfPlayer2/Source/AboutWindow.h
Normal file
19
tools/PsfPlayer2/Source/AboutWindow.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _ABOUTWINDOW_H_
|
||||
#define _ABOUTWINDOW_H_
|
||||
|
||||
#include "win32/ModalWindow.h"
|
||||
#include "win32/Layouts.h"
|
||||
|
||||
class CAboutWindow : public Framework::Win32::CModalWindow
|
||||
{
|
||||
public:
|
||||
CAboutWindow(HWND);
|
||||
virtual ~CAboutWindow();
|
||||
|
||||
private:
|
||||
void RefreshLayout();
|
||||
|
||||
Framework::LayoutObjectPtr m_layout;
|
||||
};
|
||||
|
||||
#endif
|
8
tools/PsfPlayer2/Source/AppDef.h
Normal file
8
tools/PsfPlayer2/Source/AppDef.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _APPDEF_H_
|
||||
#define _APPDEF_H_
|
||||
|
||||
#define APP_NAME _T("PsfPlayer")
|
||||
#define APP_VERSION (12)
|
||||
#define APP_VERSIONSTR _T("0.12")
|
||||
|
||||
#endif
|
@ -33,14 +33,14 @@ m_tags(tags)
|
||||
Create(WNDSTYLEEX, CLSNAME, _T("File Information"), WNDSTYLE, Win32::CRect(0, 0, 400, 250), parent, NULL);
|
||||
SetClassPtr();
|
||||
|
||||
m_title = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_artist = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_game = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_year = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_genre = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_comment = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_copyright = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_psfBy = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0));
|
||||
m_title = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_artist = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_game = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_year = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_genre = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_comment = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_copyright = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
m_psfBy = new Win32::CEdit(m_hWnd, Win32::CRect(0, 0, 0, 0), _T(""), ES_READONLY);
|
||||
|
||||
m_layout =
|
||||
VerticalLayoutContainer
|
||||
|
@ -1,17 +1,20 @@
|
||||
#include "AppDef.h"
|
||||
#include "PlayerWnd.h"
|
||||
#include "PsfLoader.h"
|
||||
#include "win32/Rect.h"
|
||||
#include "win32/FileDialog.h"
|
||||
#include "win32/AcceleratorTableGenerator.h"
|
||||
#include "FileInformationWindow.h"
|
||||
#include "AboutWindow.h"
|
||||
#include "string_cast.h"
|
||||
#include "resource.h"
|
||||
#include <afxres.h>
|
||||
#include <functional>
|
||||
|
||||
#define CLSNAME _T("PlayerWnd")
|
||||
#define WNDSTYLE (WS_CAPTION | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU)
|
||||
#define WNDSTYLEEX (0)
|
||||
#define CLSNAME _T("PlayerWnd")
|
||||
#define WNDSTYLE (WS_CAPTION | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_MINIMIZEBOX)
|
||||
#define WNDSTYLEEX (0)
|
||||
#define WM_UPDATEVIS (WM_USER + 1)
|
||||
|
||||
using namespace Psx;
|
||||
using namespace Framework;
|
||||
@ -30,7 +33,7 @@ m_accel(CreateAccelerators())
|
||||
RegisterClassEx(&Win32::CWindow::MakeWndClass(CLSNAME));
|
||||
}
|
||||
|
||||
Create(WNDSTYLEEX, CLSNAME, _T("PsfPlayer"), WNDSTYLE, Win32::CRect(0, 0, 470, 570), NULL, NULL);
|
||||
Create(WNDSTYLEEX, CLSNAME, APP_NAME, WNDSTYLE, Win32::CRect(0, 0, 470, 570), NULL, NULL);
|
||||
SetClassPtr();
|
||||
|
||||
SetMenu(LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MAINMENU)));
|
||||
@ -41,6 +44,7 @@ m_accel(CreateAccelerators())
|
||||
m_regView->Show(SW_SHOW);
|
||||
|
||||
UpdateUi();
|
||||
SetIcon(ICON_SMALL, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN)));
|
||||
|
||||
m_virtualMachine.OnNewFrame.connect(bind(&CPlayerWnd::OnNewFrame, this));
|
||||
}
|
||||
@ -51,6 +55,18 @@ CPlayerWnd::~CPlayerWnd()
|
||||
delete m_regView;
|
||||
}
|
||||
|
||||
long CPlayerWnd::OnWndProc(unsigned int msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_UPDATEVIS:
|
||||
m_regView->Render();
|
||||
m_regView->Redraw();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CPlayerWnd::Run()
|
||||
{
|
||||
while(IsWindow())
|
||||
@ -99,6 +115,9 @@ long CPlayerWnd::OnCommand(unsigned short id, unsigned short command, HWND hWndF
|
||||
case ID_FILE_EXIT:
|
||||
Destroy();
|
||||
break;
|
||||
case ID_HELP_ABOUT:
|
||||
ShowAbout();
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -139,15 +158,31 @@ void CPlayerWnd::ShowFileInformation()
|
||||
fileInfo.DoModal();
|
||||
}
|
||||
|
||||
void CPlayerWnd::ShowAbout()
|
||||
{
|
||||
CAboutWindow about(m_hWnd);
|
||||
about.DoModal();
|
||||
}
|
||||
|
||||
void CPlayerWnd::Load(const char* path)
|
||||
{
|
||||
m_virtualMachine.Pause();
|
||||
m_virtualMachine.Reset();
|
||||
m_tags.clear();
|
||||
CPsfLoader::LoadPsf(m_virtualMachine, path, &m_tags);
|
||||
m_virtualMachine.Resume();
|
||||
try
|
||||
{
|
||||
CPsfLoader::LoadPsf(m_virtualMachine, path, &m_tags);
|
||||
m_virtualMachine.Resume();
|
||||
m_ready = true;
|
||||
}
|
||||
catch(const exception& except)
|
||||
{
|
||||
tstring errorString = _T("Couldn't load PSF file: \r\n\r\n");
|
||||
errorString += string_cast<tstring>(except.what());
|
||||
MessageBox(m_hWnd, errorString.c_str(), NULL, 16);
|
||||
m_ready = false;
|
||||
}
|
||||
UpdateUi();
|
||||
m_ready = true;
|
||||
}
|
||||
|
||||
void CPlayerWnd::UpdateUi()
|
||||
@ -155,7 +190,7 @@ void CPlayerWnd::UpdateUi()
|
||||
CPsfBase::ConstTagIterator titleTag = m_tags.find("title");
|
||||
bool hasTitle = titleTag != m_tags.end();
|
||||
|
||||
tstring title = _T("PsfPlayer");
|
||||
tstring title = APP_NAME;
|
||||
if(hasTitle)
|
||||
{
|
||||
title += _T(" - [ ");
|
||||
@ -168,7 +203,6 @@ void CPlayerWnd::UpdateUi()
|
||||
|
||||
void CPlayerWnd::OnNewFrame()
|
||||
{
|
||||
m_regView->Render();
|
||||
m_regView->Redraw();
|
||||
PostMessage(m_hWnd, WM_UPDATEVIS, 0, 0);
|
||||
// m_frames++;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
void Run();
|
||||
|
||||
protected:
|
||||
long OnWndProc(unsigned int, WPARAM, LPARAM);
|
||||
long OnSize(unsigned int, unsigned int, unsigned int);
|
||||
long OnCommand(unsigned short, unsigned short, HWND);
|
||||
long OnTimer();
|
||||
@ -26,10 +27,10 @@ private:
|
||||
void Load(const char*);
|
||||
void PauseResume();
|
||||
void ShowFileInformation();
|
||||
void ShowAbout();
|
||||
void OnNewFrame();
|
||||
void UpdateUi();
|
||||
|
||||
|
||||
CPsxVm& m_virtualMachine;
|
||||
CSpuRegView* m_regView;
|
||||
CPsfBase::TagMap m_tags;
|
||||
|
@ -44,6 +44,11 @@ CPsfBase::~CPsfBase()
|
||||
delete [] m_program;
|
||||
}
|
||||
|
||||
uint8 CPsfBase::GetVersion() const
|
||||
{
|
||||
return m_version;
|
||||
}
|
||||
|
||||
uint8* CPsfBase::GetProgram() const
|
||||
{
|
||||
return m_program;
|
||||
|
@ -28,6 +28,7 @@ public:
|
||||
VERSION_CAPCOMQSOUND = 0x41
|
||||
};
|
||||
|
||||
uint8 GetVersion() const;
|
||||
uint8* GetProgram() const;
|
||||
const char* GetTagValue(const char*) const;
|
||||
ConstTagIterator GetTagsBegin() const;
|
||||
|
@ -5,11 +5,16 @@
|
||||
using namespace Framework;
|
||||
using namespace Psx;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
void CPsfLoader::LoadPsf(CPsxVm& virtualMachine, const char* pathString, CPsfBase::TagMap* tags)
|
||||
{
|
||||
CStdStream input(pathString, "rb");
|
||||
CPsfBase psfFile(input);
|
||||
if(psfFile.GetVersion() != CPsfBase::VERSION_PLAYSTATION)
|
||||
{
|
||||
throw runtime_error("Not a PlayStation psf.");
|
||||
}
|
||||
const char* libPath = psfFile.GetTagValue("_lib");
|
||||
if(tags)
|
||||
{
|
||||
|
@ -40,16 +40,20 @@ m_thread(bind(&CPsxVm::ThreadProc, this))
|
||||
m_cpu.m_pArch = &g_MAMIPSIV;
|
||||
m_cpu.m_pAddrTranslator = &CMIPS::TranslateAddress64;
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_cpu.m_Functions.Unserialize("rawr.functions");
|
||||
m_cpu.m_Comments.Unserialize("rawr.comments");
|
||||
#endif
|
||||
|
||||
m_dmac.SetReceiveFunction(4, bind(&CSpu::ReceiveDma, &m_spu, _1, _2, _3));
|
||||
}
|
||||
|
||||
CPsxVm::~CPsxVm()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_cpu.m_Functions.Serialize("rawr.functions");
|
||||
m_cpu.m_Comments.Serialize("rawr.comments");
|
||||
#endif
|
||||
delete [] m_ram;
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,24 @@ BEGIN
|
||||
BEGIN
|
||||
MENUITEM "&Open...", ID_FILE_OPEN
|
||||
MENUITEM "&File Information...", ID_FILE_FILEINFORMATION
|
||||
MENUITEM "Pause/Resume", ID_FILE_PAUSE
|
||||
MENUITEM "Pause/Resume\tF5", ID_FILE_PAUSE
|
||||
MENUITEM "Exit\tAlt+F4", ID_FILE_EXIT
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
MENUITEM "&About", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAIN ICON "images\\PsfPlayer.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -7,17 +7,20 @@
|
||||
#define IDB_BREAKPOINT 103
|
||||
#define IDR_MENU1 104
|
||||
#define IDR_MAINMENU 104
|
||||
#define IDI_ICON1 105
|
||||
#define IDI_MAIN 105
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_FILEINFORMATION 40003
|
||||
#define ID_VIRTUALMACHINE_PAUSE 40004
|
||||
#define ID_FILE_PAUSE 40005
|
||||
#define ID_HELP_ABOUT 40006
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40007
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""C:\Program Files\OpenAL 1.1 SDK\include";C:\Projects\Rawr\Source;C:\Projects\zlib;C:\Components\boost_1_35_0\boost\tr1\tr1;C:\Components\boost_1_35_0;C:\Projects\Framework\include;C:\Projects\Rawr\tools\PsfPlayer\Source"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC;_PSX"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -119,7 +119,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""C:\Program Files\OpenAL 1.1 SDK\include";C:\Projects\Rawr\Source;C:\Projects\zlib;C:\Components\boost_1_35_0\boost\tr1\tr1;C:\Components\boost_1_35_0;C:\Projects\Framework\include;C:\Projects\Rawr\tools\PsfPlayer\Source"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_MSVC;_PSX"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -138,6 +138,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib OpenAL32.lib"
|
||||
OutputFile="$(OutDir)\PsfPlayer.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""C:\Program Files\OpenAL 1.1 SDK\libs\Win32";C:\Components\boost_1_35_0\stage\lib"
|
||||
GenerateDebugInformation="true"
|
||||
@ -180,6 +181,14 @@
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Source\AboutWindow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\AboutWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\AcceleratorTable.cpp"
|
||||
>
|
||||
@ -188,6 +197,10 @@
|
||||
RelativePath=".\Source\AcceleratorTable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\AppDef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Source\CounterRegView.cpp"
|
||||
>
|
||||
|
15
tools/PsfPlayer2/Todolist.txt
Normal file
15
tools/PsfPlayer2/Todolist.txt
Normal file
@ -0,0 +1,15 @@
|
||||
TODO:
|
||||
- Exception for invalid PSFs
|
||||
- About box
|
||||
- 32-bits MA_MIPSIV support
|
||||
- Wild Arms
|
||||
- Castlevania SOTN
|
||||
|
||||
|
||||
Done:
|
||||
- Update to new Purei Core
|
||||
- Xenogears
|
||||
- Add ADSR support
|
||||
- Fix counter timing problem
|
||||
- Final Fantasy Tactics
|
||||
- Chrono Cross
|
Loading…
x
Reference in New Issue
Block a user