set svn:eol-style=native for **.h

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing
2008-12-08 04:46:09 +00:00
parent e6fe5ec42f
commit 30c883bcfc
334 changed files with 30407 additions and 30407 deletions

View File

@ -1,43 +1,43 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CONFIG_H
#define _CONFIG_H
#include <string>
struct CConfig
{
bool m_EnableHLEAudio;
bool m_EnableDTKMusic;
bool m_EnableThrottle;
bool m_Interpolation;
int m_SampleRate;
CConfig();
void LoadDefaults();
void Load();
void Save();
};
extern CConfig g_Config;
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CONFIG_H
#define _CONFIG_H
#include <string>
struct CConfig
{
bool m_EnableHLEAudio;
bool m_EnableDTKMusic;
bool m_EnableThrottle;
bool m_Interpolation;
int m_SampleRate;
CConfig();
void LoadDefaults();
void Load();
void Save();
};
extern CConfig g_Config;
#endif

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
class CConfigDlg
: public CDialogImpl<CConfigDlg>
{
public:
enum { IDD = IDD_SETTINGS };
BEGIN_MSG_MAP(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
END_MSG_MAP()
private:
CButton m_buttonEnableHLEAudio;
CButton m_buttonEnableDTKMusic;
CButton m_buttonEnableThrottle;
CButton m_buttonDumpSamples;
CButton m_buttonAntiGap;
CEdit m_editDumpSamplePath;
CComboBox m_comboSampleRate;
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
};
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
class CConfigDlg
: public CDialogImpl<CConfigDlg>
{
public:
enum { IDD = IDD_SETTINGS };
BEGIN_MSG_MAP(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
END_MSG_MAP()
private:
CButton m_buttonEnableHLEAudio;
CButton m_buttonEnableDTKMusic;
CButton m_buttonEnableThrottle;
CButton m_buttonDumpSamples;
CButton m_buttonAntiGap;
CEdit m_editDumpSamplePath;
CComboBox m_comboSampleRate;
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
};

View File

@ -1,99 +1,99 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DSPHANDLER_H
#define _DSPHANDLER_H
#include "Common.h"
#include "MailHandler.h"
#include "UCodes/UCodes.h"
class CDSPHandler
{
public:
void Update();
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);
IUCode* GetUCode();
void SetUCode(u32 _crc);
CMailHandler& AccessMailHandler() { return m_MailHandler; }
static CDSPHandler& GetInstance()
{
return *m_pInstance;
}
static void Destroy()
{
delete m_pInstance;
m_pInstance = NULL;
}
static CDSPHandler& CreateInstance()
{
if (!m_pInstance)
m_pInstance = new CDSPHandler();
return *m_pInstance;
}
private:
CDSPHandler();
~CDSPHandler();
// UDSPControl
union UDSPControl
{
u16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned DSPInitCode : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(u16 _Hex = 0)
: Hex(_Hex)
{}
};
// singleton instance
static CDSPHandler* m_pInstance;
IUCode* m_pUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;
bool m_bHalt;
bool m_bAssertInt;
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DSPHANDLER_H
#define _DSPHANDLER_H
#include "Common.h"
#include "MailHandler.h"
#include "UCodes/UCodes.h"
class CDSPHandler
{
public:
void Update();
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);
IUCode* GetUCode();
void SetUCode(u32 _crc);
CMailHandler& AccessMailHandler() { return m_MailHandler; }
static CDSPHandler& GetInstance()
{
return *m_pInstance;
}
static void Destroy()
{
delete m_pInstance;
m_pInstance = NULL;
}
static CDSPHandler& CreateInstance()
{
if (!m_pInstance)
m_pInstance = new CDSPHandler();
return *m_pInstance;
}
private:
CDSPHandler();
~CDSPHandler();
// UDSPControl
union UDSPControl
{
u16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned DSPInitCode : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(u16 _Hex = 0)
: Hex(_Hex)
{}
};
// singleton instance
static CDSPHandler* m_pInstance;
IUCode* m_pUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;
bool m_bHalt;
bool m_bAssertInt;
};
#endif

View File

@ -1,172 +1,172 @@
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#ifndef __CDebugger_h__
#define __CDebugger_h__
// general things
#include <iostream>
#include <vector>
// wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/datetime.h> // for the timestamps
#include <wx/sizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
#include "../Globals.h"
class CPBView;
class IniFile;
// Window settings
#undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = CDebugger_STYLE);
virtual ~CDebugger();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void DoHide(); void DoShow();
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
void ShowHideConsole(wxCommandEvent& event); // options
void ShowBase(wxCommandEvent& event);
void DoShowHideConsole();
//void OnlyLooping(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event);
void OnShowAll(wxCommandEvent& event);
void ChangeFrequency(wxCommandEvent& event); // update frequency
void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event);
void DoChangePreset();
void OnSettingsCheck(wxCommandEvent& event); // settings
// ============== Mail
void DoUpdateMail();
void UpdateMail(wxNotebookEvent& event);
void ChangeMail(wxCommandEvent& event);
void ReadDir();
bool NoDuplicate(std::string FileName);
void OnGameChange(wxCommandEvent& event);
void MailSettings(wxCommandEvent& event);
void Readfile(std::string FileName, bool GC);
std::string Readfile_(std::string FileName);
u32 CountFiles(std::string FileName);
// ============== Blocks
void DoScrollBlocks();
void ScrollBlocksMouse(wxMouseEvent& event);
void ScrollBlocksCursor(wxScrollWinEvent& event);
CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll;
bool gSaveFile; // main options
bool gOnlyLooping;
bool gShowAll;
int giShowAll;
int gUpdFreq;// main update freq.
int gPreset; // main presets
bool bShowBase; // main presets
u32 gLastBlock;
bool ScanMails; // mail settings
bool StoreMails;
bool upd95; bool upd94; bool upd93; bool upd92; // block view settings
std::string str0; std::string str95; std::string str94; std::string str93; std::string str92;
std::vector<std::string> PBn; std::vector<std::string> PBp;
// members
wxTextCtrl * m_log, * m_log1, // mail
* m_bl0, * m_bl95, * m_bl94; // blocks
private:
// declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain, *m_PageMail, *m_PageBlock;
wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5];
wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum
{
IDC_CHECK0 = 2000,
IDC_CHECK1,
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6,
IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4,
IDG_LABEL1, IDG_LABEL2,
ID_UPD,
ID_SELC,
ID_PRESETS,
ID_GPR,
ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook
ID_LOG, ID_LOG1, // mails
ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif
//////////////////////////////////////////////////////////////////////////////////////////
//
// Licensetype: GNU General Public License (GPL)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
//
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
//
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//
//////////////////////////////////////////////////////////////////////////////////////////
#ifndef __CDebugger_h__
#define __CDebugger_h__
// general things
#include <iostream>
#include <vector>
// wx stuff, I'm not sure if we use all these
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/datetime.h> // for the timestamps
#include <wx/sizer.h>
#include <wx/notebook.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
#include "../Globals.h"
class CPBView;
class IniFile;
// Window settings
#undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = CDebugger_STYLE);
virtual ~CDebugger();
void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile);
void DoHide(); void DoShow();
void NotifyUpdate();
void OnUpdate(wxCommandEvent& event);
void ShowHideConsole(wxCommandEvent& event); // options
void ShowBase(wxCommandEvent& event);
void DoShowHideConsole();
//void OnlyLooping(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event);
void OnShowAll(wxCommandEvent& event);
void ChangeFrequency(wxCommandEvent& event); // update frequency
void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event);
void DoChangePreset();
void OnSettingsCheck(wxCommandEvent& event); // settings
// ============== Mail
void DoUpdateMail();
void UpdateMail(wxNotebookEvent& event);
void ChangeMail(wxCommandEvent& event);
void ReadDir();
bool NoDuplicate(std::string FileName);
void OnGameChange(wxCommandEvent& event);
void MailSettings(wxCommandEvent& event);
void Readfile(std::string FileName, bool GC);
std::string Readfile_(std::string FileName);
u32 CountFiles(std::string FileName);
// ============== Blocks
void DoScrollBlocks();
void ScrollBlocksMouse(wxMouseEvent& event);
void ScrollBlocksCursor(wxScrollWinEvent& event);
CPBView* m_GPRListView;
std::vector<std::string> sMail, sMailEnd, sFullMail;
wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll;
bool gSaveFile; // main options
bool gOnlyLooping;
bool gShowAll;
int giShowAll;
int gUpdFreq;// main update freq.
int gPreset; // main presets
bool bShowBase; // main presets
u32 gLastBlock;
bool ScanMails; // mail settings
bool StoreMails;
bool upd95; bool upd94; bool upd93; bool upd92; // block view settings
std::string str0; std::string str95; std::string str94; std::string str93; std::string str92;
std::vector<std::string> PBn; std::vector<std::string> PBp;
// members
wxTextCtrl * m_log, * m_log1, // mail
* m_bl0, * m_bl95, * m_bl94; // blocks
private:
// declarations
wxNotebook *m_Notebook; // notebook
wxPanel *m_PageMain, *m_PageMail, *m_PageBlock;
wxCheckBox *m_Check[9];
wxRadioButton *m_Radio[5];
wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset;
wxPanel *m_Controller;
std::vector<std::string> all_all_files, all_files, gc_files, wii_files;
// WARNING: Make sure these are not also elsewhere, for example in resource.h.
enum
{
IDC_CHECK0 = 2000,
IDC_CHECK1,
IDC_CHECK2,
IDC_CHECK3,
IDC_CHECK4,
IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6,
IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4,
IDG_LABEL1, IDG_LABEL2,
ID_UPD,
ID_SELC,
ID_PRESETS,
ID_GPR,
ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook
ID_LOG, ID_LOG1, // mails
ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif

View File

@ -1,47 +1,47 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __PBView_h__
#define __PBView_h__
#include <wx/listctrl.h>
#include <wx/dcclient.h>
#include "Common.h"
class CPBView
: public wxListCtrl
{
public:
CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
void Update();
u32 m_CachedRegs[64][92];
private:
DECLARE_EVENT_TABLE()
bool m_CachedRegHasChanged[64];
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __PBView_h__
#define __PBView_h__
#include <wx/listctrl.h>
#include <wx/dcclient.h>
#include "Common.h"
class CPBView
: public wxListCtrl
{
public:
CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
void Update();
u32 m_CachedRegs[64][92];
private:
DECLARE_EVENT_TABLE()
bool m_CachedRegHasChanged[64];
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
};
#endif

View File

@ -1,39 +1,39 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "Common.h"
#include "pluginspecs_dsp.h"
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void __Log_(int v, const char *fmt, ...);
#if defined(_DEBUG) || defined(DEBUGFAST)
#define LOG_(v, ...) __Log_(v, __VA_ARGS__);
#else
#define LOG_(_v_, ...)
#endif
u8 Memory_Read_U8(u32 _uAddress);
u16 Memory_Read_U16(u32 _uAddress);
u32 Memory_Read_U32(u32 _uAddress);
float Memory_Read_Float(u32 _uAddress);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "Common.h"
#include "pluginspecs_dsp.h"
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void __Log_(int v, const char *fmt, ...);
#if defined(_DEBUG) || defined(DEBUGFAST)
#define LOG_(v, ...) __Log_(v, __VA_ARGS__);
#else
#define LOG_(_v_, ...)
#endif
u8 Memory_Read_U8(u32 _uAddress);
u16 Memory_Read_U16(u32 _uAddress);
u32 Memory_Read_U32(u32 _uAddress);
float Memory_Read_Float(u32 _uAddress);
#endif

View File

@ -1,28 +1,28 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
void startConsoleWin(int width, int height, char* fname);
int wprintf(const char *fmt, ...);
int aprintf(int a, char *fmt, ...);
void ClearScreen();
void OpenConsole();
void CloseConsole();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
void startConsoleWin(int width, int height, char* fname);
int wprintf(const char *fmt, ...);
int aprintf(int a, char *fmt, ...);
void ClearScreen();
void OpenConsole();
void CloseConsole();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif

View File

@ -1,46 +1,46 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MAILHANDLER_H
#define _MAILHANDLER_H
#include <queue>
#include "Common.h"
class CMailHandler
{
public:
CMailHandler();
~CMailHandler();
void PushMail(u32 _Mail);
void Clear();
void Halt(bool _Halt);
bool IsEmpty();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
void Update();
private:
// mail handler
std::queue<u32> m_Mails;
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MAILHANDLER_H
#define _MAILHANDLER_H
#include <queue>
#include "Common.h"
class CMailHandler
{
public:
CMailHandler();
~CMailHandler();
void PushMail(u32 _Mail);
void Clear();
void Halt(bool _Halt);
bool IsEmpty();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
void Update();
private:
// mail handler
std::queue<u32> m_Mails;
};
#endif

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MIXER_H
#define _MIXER_H
extern volatile bool mixer_HLEready;
// Called from audio threads
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
// Called from main thread
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MIXER_H
#define _MIXER_H
extern volatile bool mixer_HLEready;
// Called from audio threads
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
// Called from main thread
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate);
#endif

View File

@ -1,77 +1,77 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX
#define _UCODE_AX
#include <iostream>
#include "UCode_AXStructs.h"
enum
{
NUMBER_OF_PBS = 128
};
class CUCode_AX : public IUCode
{
public:
CUCode_AX(CMailHandler& _rMailHandler);
virtual ~CUCode_AX();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
void Update();
// Logging
//template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, va_list ap);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;
int saveNext;
// PBs
u32 m_addressPBs;
u32 _CRC;
private:
enum
{
MAIL_AX_ALIST = 0xBABE0000,
AXLIST_STUDIOADDR = 0x0000,
AXLIST_PBADDR = 0x0002,
AXLIST_SBUFFER = 0x0007,
AXLIST_COMPRESSORTABLE = 0x000A,
AXLIST_END = 0x000F
};
int *templbuffer;
int *temprbuffer;
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num);
void WriteBackPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num);
#endif // _UCODE_AX
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX
#define _UCODE_AX
#include <iostream>
#include "UCode_AXStructs.h"
enum
{
NUMBER_OF_PBS = 128
};
class CUCode_AX : public IUCode
{
public:
CUCode_AX(CMailHandler& _rMailHandler);
virtual ~CUCode_AX();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
void Update();
// Logging
//template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void Logging(short* _pBuffer, int _iSize, int a, bool Wii);
void SaveLog_(bool Wii, const char* _fmt, va_list ap);
void SaveMail(bool Wii, u32 _uMail);
void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii);
std::string TmpMailLog;
int saveNext;
// PBs
u32 m_addressPBs;
u32 _CRC;
private:
enum
{
MAIL_AX_ALIST = 0xBABE0000,
AXLIST_STUDIOADDR = 0x0000,
AXLIST_PBADDR = 0x0002,
AXLIST_SBUFFER = 0x0007,
AXLIST_COMPRESSORTABLE = 0x000A,
AXLIST_END = 0x000F
};
int *templbuffer;
int *temprbuffer;
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num);
void WriteBackPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num);
#endif // _UCODE_AX

View File

@ -1,248 +1,248 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_STRUCTS_H
#define _UCODE_AX_STRUCTS_H
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBMixerWii
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[12];
u16 unknown4[8];
};
struct PBInitialTimeDelay
{
u16 on;
u16 addrMemHigh;
u16 addrMemLow;
u16 offsetLeft;
u16 offsetRight;
u16 targetLeft;
u16 targetRight;
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUpdatesWii
{
u16 num_updates[3];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBDpop
{
s16 unknown[9];
};
struct PBDpopWii
{
s16 unknown[12];
};
struct PBDpopWii_ // new CRC version
{
s16 unknown[7];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 gain;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 9 */ PBMixer mixer;
/* 27 */ PBInitialTimeDelay initial_time_delay;
/* 34 */ PBUpdates updates;
/* 41 */ PBDpop dpop;
/* 50 */ PBVolumeEnvelope vol_env;
/* 52 */ PBUnknown2 unknown3;
/* 55 */ PBAudioAddr audio_addr;
/* 63 */ PBADPCMInfo adpcm;
/* 83 */ PBSampleRateConverter src;
/* 90 */ PBADPCMLoopInfo adpcm_loop_info;
/* 93 */ u16 unknown_maybe_padding[3];
};
struct PBLpf
{
u16 enabled;
u16 yn1;
u16 a0;
u16 b0;
};
struct PBHpf
{
u16 enabled;
u16 yn1;
u16 a0;
u16 b0;
};
struct AXParamBlockWii
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii dpop;
/* 58 */ PBVolumeEnvelope vol_env;
/* 60 */ PBAudioAddr audio_addr;
/* 68 */ PBADPCMInfo adpcm;
/* 88 */ PBSampleRateConverter src;
/* 95 */ PBADPCMLoopInfo adpcm_loop_info;
/* 98 */ PBLpf lpf;
/* 102 */ PBHpf hpf;
/* 106 */ u16 pad[22];
};
struct AXParamBlockWii_ // new CRC version
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii_ dpop;
/* 53 */ PBVolumeEnvelope vol_env;
/* 55 */ PBAudioAddr audio_addr;
/* 63 */ PBADPCMInfo adpcm;
/* 83 */ PBSampleRateConverter src;
/* 90 */ PBADPCMLoopInfo adpcm_loop_info;
/* 93 */ PBLpf lpf;
/* 97 */ PBHpf hpf;
/* 101 */ u16 pad[27];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif // _UCODE_AX_STRUCTS_H
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_STRUCTS_H
#define _UCODE_AX_STRUCTS_H
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBMixerWii
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[12];
u16 unknown4[8];
};
struct PBInitialTimeDelay
{
u16 on;
u16 addrMemHigh;
u16 addrMemLow;
u16 offsetLeft;
u16 offsetRight;
u16 targetLeft;
u16 targetRight;
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUpdatesWii
{
u16 num_updates[3];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBDpop
{
s16 unknown[9];
};
struct PBDpopWii
{
s16 unknown[12];
};
struct PBDpopWii_ // new CRC version
{
s16 unknown[7];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 gain;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 9 */ PBMixer mixer;
/* 27 */ PBInitialTimeDelay initial_time_delay;
/* 34 */ PBUpdates updates;
/* 41 */ PBDpop dpop;
/* 50 */ PBVolumeEnvelope vol_env;
/* 52 */ PBUnknown2 unknown3;
/* 55 */ PBAudioAddr audio_addr;
/* 63 */ PBADPCMInfo adpcm;
/* 83 */ PBSampleRateConverter src;
/* 90 */ PBADPCMLoopInfo adpcm_loop_info;
/* 93 */ u16 unknown_maybe_padding[3];
};
struct PBLpf
{
u16 enabled;
u16 yn1;
u16 a0;
u16 b0;
};
struct PBHpf
{
u16 enabled;
u16 yn1;
u16 a0;
u16 b0;
};
struct AXParamBlockWii
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii dpop;
/* 58 */ PBVolumeEnvelope vol_env;
/* 60 */ PBAudioAddr audio_addr;
/* 68 */ PBADPCMInfo adpcm;
/* 88 */ PBSampleRateConverter src;
/* 95 */ PBADPCMLoopInfo adpcm_loop_info;
/* 98 */ PBLpf lpf;
/* 102 */ PBHpf hpf;
/* 106 */ u16 pad[22];
};
struct AXParamBlockWii_ // new CRC version
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 coef_select;
u32 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
/* 10 */ PBMixerWii mixer;
/* 34 */ PBInitialTimeDelay initial_time_delay;
/* 41 */ PBUpdatesWii updates;
/* 46 */ PBDpopWii_ dpop;
/* 53 */ PBVolumeEnvelope vol_env;
/* 55 */ PBAudioAddr audio_addr;
/* 63 */ PBADPCMInfo adpcm;
/* 83 */ PBSampleRateConverter src;
/* 90 */ PBADPCMLoopInfo adpcm_loop_info;
/* 93 */ PBLpf lpf;
/* 97 */ PBHpf hpf;
/* 101 */ u16 pad[27];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif // _UCODE_AX_STRUCTS_H

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AXWII
#define _UCODE_AXWII
#include "UCode_AXStructs.h"
#define NUMBER_OF_PBS 128
class CUCode_AXWii : public IUCode
{
public:
CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC);
virtual ~CUCode_AXWii();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs);
void Update();
// The logging function for the debugger
void Logging(short* _pBuffer, int _iSize, int a);
CUCode_AX * lCUCode_AX; // we need the logging functions in there
private:
enum
{
MAIL_AX_ALIST = 0xBABE0000,
};
// PBs
u32 m_addressPBs;
u32 _CRC;
int *templbuffer;
int *temprbuffer;
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
#endif // _UCODE_AXWII
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AXWII
#define _UCODE_AXWII
#include "UCode_AXStructs.h"
#define NUMBER_OF_PBS 128
class CUCode_AXWii : public IUCode
{
public:
CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC);
virtual ~CUCode_AXWii();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
template<class ParamBlockType>
//void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs);
void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs);
void Update();
// The logging function for the debugger
void Logging(short* _pBuffer, int _iSize, int a);
CUCode_AX * lCUCode_AX; // we need the logging functions in there
private:
enum
{
MAIL_AX_ALIST = 0xBABE0000,
};
// PBs
u32 m_addressPBs;
u32 _CRC;
int *templbuffer;
int *temprbuffer;
// ax task message handler
bool AXTask(u32& _uMail);
void SaveLog(const char* _fmt, ...);
void SendMail(u32 _uMail);
};
//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num);
#endif // _UCODE_AXWII

View File

@ -1,91 +1,91 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_ADPCM_H
#define _UCODE_AX_ADPCM_H
inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
{
while (samplePos < newSamplePos)
{
if ((samplePos & 15) == 0)
{
adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1);
samplePos += 2;
newSamplePos += 2;
}
int scale = 1 << (adpcm.pred_scale & 0xF);
int coef_idx = adpcm.pred_scale >> 4;
s32 coef1 = adpcm.coefs[coef_idx * 2 + 0];
s32 coef2 = adpcm.coefs[coef_idx * 2 + 1];
int temp = (samplePos & 1) ?
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) :
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4);
if (temp >= 8)
temp -= 16;
// 0x400 = 0.5 in 11-bit fixed point
int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11);
if (val > 0x7FFF)
val = 0x7FFF;
else if (val < -0x7FFF)
val = -0x7FFF;
adpcm.yn2 = adpcm.yn1;
adpcm.yn1 = val;
samplePos++;
}
return adpcm.yn1;
}
// =======================================================================================
// Volume control (ramping)
// --------------
inline u16 ADPCM_Vol(u16 vol, u16 delta)
{
int x = vol;
if (delta && delta < 0x5000)
x += delta * 20 * 8; // unsure what the right step is
//x += 1 * 20 * 8;
else if (delta && delta > 0x5000)
//x -= (0x10000 - delta); // this is to small, it's often 1
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
// did not have time to go to zero before the were closed
//x -= 1 * 20 * 16;
// make lower limits
if (x < 0) x = 0;
//if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make
// any sense?
// make upper limits
//if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also
// has a volume target?
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
return x; // update volume
}
// ==============
#endif // _UCODE_AX_ADPCM_H
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_ADPCM_H
#define _UCODE_AX_ADPCM_H
inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac)
{
while (samplePos < newSamplePos)
{
if ((samplePos & 15) == 0)
{
adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1);
samplePos += 2;
newSamplePos += 2;
}
int scale = 1 << (adpcm.pred_scale & 0xF);
int coef_idx = adpcm.pred_scale >> 4;
s32 coef1 = adpcm.coefs[coef_idx * 2 + 0];
s32 coef2 = adpcm.coefs[coef_idx * 2 + 1];
int temp = (samplePos & 1) ?
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) :
(g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4);
if (temp >= 8)
temp -= 16;
// 0x400 = 0.5 in 11-bit fixed point
int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11);
if (val > 0x7FFF)
val = 0x7FFF;
else if (val < -0x7FFF)
val = -0x7FFF;
adpcm.yn2 = adpcm.yn1;
adpcm.yn1 = val;
samplePos++;
}
return adpcm.yn1;
}
// =======================================================================================
// Volume control (ramping)
// --------------
inline u16 ADPCM_Vol(u16 vol, u16 delta)
{
int x = vol;
if (delta && delta < 0x5000)
x += delta * 20 * 8; // unsure what the right step is
//x += 1 * 20 * 8;
else if (delta && delta > 0x5000)
//x -= (0x10000 - delta); // this is to small, it's often 1
x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario
// did not have time to go to zero before the were closed
//x -= 1 * 20 * 16;
// make lower limits
if (x < 0) x = 0;
//if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make
// any sense?
// make upper limits
//if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also
// has a volume target?
//if (x >= 0x7fff) x = 0x7fff; // this seems a little high
if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000
return x; // update volume
}
// ==============
#endif // _UCODE_AX_ADPCM_H

View File

@ -1,402 +1,402 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_VOICE_H
#define _UCODE_AX_VOICE_H
#include "UCode_AX_ADPCM.h"
#include "UCode_AX.h"
#include "../main.h"
// ----------------------------------------------------
// Externals
// -----------
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
extern bool gSequenced;
extern float ratioFactor;
template<class ParamBlockType>
inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
{
int count = 0;
u32 blockAddr = pbs_address;
u32 pAddr = 0;
// reading and 'halfword' swap
for (int i = 0; i < _num; i++)
{
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
pAddr = blockAddr;
if (pSrc != NULL)
{
short *pDest = (short *)&_pPBs[i];
for (u32 p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
// Detect the last mail by checking when next_pb = 0
u32 next_pb = (Common::swap16(pSrc[0]) << 16) | Common::swap16(pSrc[1]);
if(next_pb == 0) break;
}
else
break;
}
// return the number of read PBs
return count;
}
template<class ParamBlockType>
inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{
u32 blockAddr = pbs_address;
// write back and 'halfword'swap
for (int i = 0; i < _num; i++)
{
short* pSrc = (short*)&_pPBs[i];
short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr);
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
}
// next block
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
}
}
template<class ParamBlockType>
inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii)
{
#ifdef _WIN32
ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
#else
ratioFactor = 32000.0f / 44100.0f;
#endif
DoVoiceHacks(pb, Wii);
// =============
if (pb.running)
{
// =======================================================================================
// Read initial parameters
// ------------
//constants
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor);
u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
//variables
u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo;
u32 frac = pb.src.cur_addr_frac;
// =============
// =======================================================================================
// Handle No-SRC streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0
// and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This
// makes samplePos update in the correct way. I'm unsure how we are actually supposed to
// detect that this setting. Updates did not fix this automatically.
// ---------------------------------------------------------------------------------------
// Stream settings
// src_type = 2 (most other games have src_type = 0)
// ------------
// Affected games:
// Baten Kaitos - Eternal Wings (2003)
// Baten Kaitos - Origins (2006)?
// Soul Calibur 2: The movie music use src_type 2 but it needs no adjustment, perhaps
// the sound format plays in to, Baten use ADPCM, SC2 use PCM16
// ------------
//if (pb.src_type == 2 && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0))
if (pb.running && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0))
{
pb.src.ratio_hi = 1;
}
// =============
// =======================================================================================
// Games that use looping to play non-looping music streams - SSBM has info in all
// pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams
// like any other looping streams the music works. I'm unsure how we are actually supposed to
// detect that these kinds of blocks should be looping. It seems like pb.mixer_control == 0 may
// identify these types of blocks. Updates did not write any looping values.
// --------------
if (
(pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2)
&& pb.mixer_control == 0
)
{
pb.audio_addr.looping = 1;
}
// ==============
// Top Spin 3 Wii
if(pb.audio_addr.sample_format > 25) pb.audio_addr.sample_format = 0;
// =======================================================================================
// Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to
// compensate for that. _iSize can be as low as 100 or as high as 2000 some cases.
for (int s = 0; s < _iSize; s++)
{
int sample = 0;
frac += ratio;
u32 newSamplePos = samplePos + (frac >> 16); //whole number of frac
// =======================================================================================
// Process sample format
// --------------
switch (pb.audio_addr.sample_format)
{
case AUDIOFORMAT_PCM8:
// TODO - the linear interpolation code below is somewhat suspicious
pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample
pb.adpcm.yn1 = ((s8)g_dspInitialize.pARAM_Read_U8(samplePos)) << 8;
if (pb.src_type == SRCTYPE_NEAREST)
{
sample = pb.adpcm.yn1;
}
else //linear interpolation
{
sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16;
}
samplePos = newSamplePos;
break;
case AUDIOFORMAT_PCM16:
// TODO - the linear interpolation code below is somewhat suspicious
pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample
pb.adpcm.yn1 = (s16)(u16)((g_dspInitialize.pARAM_Read_U8(samplePos * 2) << 8) | (g_dspInitialize.pARAM_Read_U8((samplePos * 2 + 1))));
if (pb.src_type == SRCTYPE_NEAREST)
sample = pb.adpcm.yn1;
else //linear interpolation
sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16;
samplePos = newSamplePos;
break;
case AUDIOFORMAT_ADPCM:
sample = ADPCM_Step(pb.adpcm, samplePos, newSamplePos, frac);
break;
default:
break;
}
// ================
// ===================================================================
// Overall volume control. In addition to this there is also separate volume settings to
// different channels (left, right etc).
frac &= 0xffff;
int vol = pb.vol_env.cur_volume >> 9;
sample = sample * vol >> 8;
if (pb.mixer_control & MIXCONTROL_RAMPING)
{
int x = pb.vol_env.cur_volume;
x += pb.vol_env.cur_volume_delta; // I'm not sure about this, can anybody find a game
// that use this? Or how does it work?
if (x < 0) x = 0;
if (x >= 0x7fff) x = 0x7fff;
pb.vol_env.cur_volume = x; // maybe not per sample?? :P
}
int leftmix = pb.mixer.volume_left >> 5;
int rightmix = pb.mixer.volume_right >> 5;
int left = sample * leftmix >> 8;
int right = sample * rightmix >> 8;
//adpcm has to walk from oldSamplePos to samplePos here
templbuffer[s] += left;
temprbuffer[s] += right;
// ===============
// ===================================================================
// Control the behavior when we reach the end of the sample
if (samplePos >= sampleEnd)
{
if (pb.audio_addr.looping == 1)
{
samplePos = loopPos;
if (pb.audio_addr.sample_format == AUDIOFORMAT_ADPCM)
{
if (!pb.is_stream)
{
pb.adpcm.yn1 = pb.adpcm_loop_info.yn1;
pb.adpcm.yn2 = pb.adpcm_loop_info.yn2;
pb.adpcm.pred_scale = pb.adpcm_loop_info.pred_scale;
}
}
}
else
{
pb.running = 0;
break;
}
}
// ===============
} // end of the _iSize loop
// Update volume
//if (sizeof(ParamBlockType) == sizeof(AXParamBlock)) // this is not needed anymore I think
if (gVolume) // allow us to turn this off in the debugger
{
pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown);
pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2);
}
pb.src.cur_addr_frac = (u16)frac;
pb.audio_addr.cur_addr_hi = samplePos >> 16;
pb.audio_addr.cur_addr_lo = (u16)samplePos;
} // if (pb.running)
}
// ================================================
// Voice hacks
// --------------
template<class ParamBlockType>
inline void DoVoiceHacks(ParamBlockType &pb, bool Wii)
{
// get necessary values
const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
const u32 updaddr = (u32)(pb.updates.data_hi << 16) | pb.updates.data_lo;
const u16 updpar = Memory_Read_U16(updaddr);
const u16 upddata = Memory_Read_U16(updaddr + 2);
// =======================================================================================
/* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd
would end up outside of bounds while the block was still playing resulting in noise
a strange noise. This should take care of that.
*/
// ------------
if (
(sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles
&& gSSBMremedy1
&& !Wii
)
{
pb.running = 0;
// also reset all values if it makes any difference
pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0;
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
}
/*
// the fact that no settings are reset (except running) after a SSBM type music stream or another
looping block (for example in Battle Stadium DON) has ended could cause loud garbled sound to be
played from one or more blocks. Perhaps it was in conjunction with the old sequenced music fix below,
I'm not sure. This was an attempt to prevent that anyway by resetting all. But I'm not sure if this
is needed anymore. Please try to play SSBM without it and see if it works anyway.
*/
if (
// detect blocks that have recently been running that we should reset
pb.running == 0 && pb.audio_addr.looping == 1
//pb.running == 0 && pb.adpcm_loop_info.pred_scale
// this prevents us from ruining sequenced music blocks, may not be needed
/*
&& !(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2]
|| pb.updates.num_updates[3] || pb.updates.num_updates[4])
*/
&& !(updpar || upddata)
&& pb.mixer_control == 0 // only use this in SSBM
&& gSSBMremedy2 // let us turn this fix on and off
&& !Wii
)
{
// reset the detection values
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
//pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
//pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
//pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
//pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0;
//pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
}
// =============
// =======================================================================================
// Reset all values
// ------------
if (gReset
&& (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale)
)
{
pb.running = 0;
pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0;
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
}
}
#endif // _UCODE_AX_VOICE_H
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX_VOICE_H
#define _UCODE_AX_VOICE_H
#include "UCode_AX_ADPCM.h"
#include "UCode_AX.h"
#include "../main.h"
// ----------------------------------------------------
// Externals
// -----------
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;
extern bool gSequenced;
extern bool gVolume;
extern bool gReset;
extern bool gSequenced;
extern float ratioFactor;
template<class ParamBlockType>
inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
{
int count = 0;
u32 blockAddr = pbs_address;
u32 pAddr = 0;
// reading and 'halfword' swap
for (int i = 0; i < _num; i++)
{
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
pAddr = blockAddr;
if (pSrc != NULL)
{
short *pDest = (short *)&_pPBs[i];
for (u32 p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
#if defined(_DEBUG) || defined(DEBUGFAST)
if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif
}
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
count++;
// Detect the last mail by checking when next_pb = 0
u32 next_pb = (Common::swap16(pSrc[0]) << 16) | Common::swap16(pSrc[1]);
if(next_pb == 0) break;
}
else
break;
}
// return the number of read PBs
return count;
}
template<class ParamBlockType>
inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num)
{
u32 blockAddr = pbs_address;
// write back and 'halfword'swap
for (int i = 0; i < _num; i++)
{
short* pSrc = (short*)&_pPBs[i];
short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr);
_pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control);
for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++)
{
if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32
else pDest[p] = Common::swap16(pSrc[p]);
}
// next block
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;
}
}
template<class ParamBlockType>
inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii)
{
#ifdef _WIN32
ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
#else
ratioFactor = 32000.0f / 44100.0f;
#endif
DoVoiceHacks(pb, Wii);
// =============
if (pb.running)
{
// =======================================================================================
// Read initial parameters
// ------------
//constants
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor);
u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
//variables
u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo;
u32 frac = pb.src.cur_addr_frac;
// =============
// =======================================================================================
// Handle No-SRC streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0
// and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This
// makes samplePos update in the correct way. I'm unsure how we are actually supposed to
// detect that this setting. Updates did not fix this automatically.
// ---------------------------------------------------------------------------------------
// Stream settings
// src_type = 2 (most other games have src_type = 0)
// ------------
// Affected games:
// Baten Kaitos - Eternal Wings (2003)
// Baten Kaitos - Origins (2006)?
// Soul Calibur 2: The movie music use src_type 2 but it needs no adjustment, perhaps
// the sound format plays in to, Baten use ADPCM, SC2 use PCM16
// ------------
//if (pb.src_type == 2 && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0))
if (pb.running && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0))
{
pb.src.ratio_hi = 1;
}
// =============
// =======================================================================================
// Games that use looping to play non-looping music streams - SSBM has info in all
// pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams
// like any other looping streams the music works. I'm unsure how we are actually supposed to
// detect that these kinds of blocks should be looping. It seems like pb.mixer_control == 0 may
// identify these types of blocks. Updates did not write any looping values.
// --------------
if (
(pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2)
&& pb.mixer_control == 0
)
{
pb.audio_addr.looping = 1;
}
// ==============
// Top Spin 3 Wii
if(pb.audio_addr.sample_format > 25) pb.audio_addr.sample_format = 0;
// =======================================================================================
// Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to
// compensate for that. _iSize can be as low as 100 or as high as 2000 some cases.
for (int s = 0; s < _iSize; s++)
{
int sample = 0;
frac += ratio;
u32 newSamplePos = samplePos + (frac >> 16); //whole number of frac
// =======================================================================================
// Process sample format
// --------------
switch (pb.audio_addr.sample_format)
{
case AUDIOFORMAT_PCM8:
// TODO - the linear interpolation code below is somewhat suspicious
pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample
pb.adpcm.yn1 = ((s8)g_dspInitialize.pARAM_Read_U8(samplePos)) << 8;
if (pb.src_type == SRCTYPE_NEAREST)
{
sample = pb.adpcm.yn1;
}
else //linear interpolation
{
sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16;
}
samplePos = newSamplePos;
break;
case AUDIOFORMAT_PCM16:
// TODO - the linear interpolation code below is somewhat suspicious
pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample
pb.adpcm.yn1 = (s16)(u16)((g_dspInitialize.pARAM_Read_U8(samplePos * 2) << 8) | (g_dspInitialize.pARAM_Read_U8((samplePos * 2 + 1))));
if (pb.src_type == SRCTYPE_NEAREST)
sample = pb.adpcm.yn1;
else //linear interpolation
sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16;
samplePos = newSamplePos;
break;
case AUDIOFORMAT_ADPCM:
sample = ADPCM_Step(pb.adpcm, samplePos, newSamplePos, frac);
break;
default:
break;
}
// ================
// ===================================================================
// Overall volume control. In addition to this there is also separate volume settings to
// different channels (left, right etc).
frac &= 0xffff;
int vol = pb.vol_env.cur_volume >> 9;
sample = sample * vol >> 8;
if (pb.mixer_control & MIXCONTROL_RAMPING)
{
int x = pb.vol_env.cur_volume;
x += pb.vol_env.cur_volume_delta; // I'm not sure about this, can anybody find a game
// that use this? Or how does it work?
if (x < 0) x = 0;
if (x >= 0x7fff) x = 0x7fff;
pb.vol_env.cur_volume = x; // maybe not per sample?? :P
}
int leftmix = pb.mixer.volume_left >> 5;
int rightmix = pb.mixer.volume_right >> 5;
int left = sample * leftmix >> 8;
int right = sample * rightmix >> 8;
//adpcm has to walk from oldSamplePos to samplePos here
templbuffer[s] += left;
temprbuffer[s] += right;
// ===============
// ===================================================================
// Control the behavior when we reach the end of the sample
if (samplePos >= sampleEnd)
{
if (pb.audio_addr.looping == 1)
{
samplePos = loopPos;
if (pb.audio_addr.sample_format == AUDIOFORMAT_ADPCM)
{
if (!pb.is_stream)
{
pb.adpcm.yn1 = pb.adpcm_loop_info.yn1;
pb.adpcm.yn2 = pb.adpcm_loop_info.yn2;
pb.adpcm.pred_scale = pb.adpcm_loop_info.pred_scale;
}
}
}
else
{
pb.running = 0;
break;
}
}
// ===============
} // end of the _iSize loop
// Update volume
//if (sizeof(ParamBlockType) == sizeof(AXParamBlock)) // this is not needed anymore I think
if (gVolume) // allow us to turn this off in the debugger
{
pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown);
pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2);
}
pb.src.cur_addr_frac = (u16)frac;
pb.audio_addr.cur_addr_hi = samplePos >> 16;
pb.audio_addr.cur_addr_lo = (u16)samplePos;
} // if (pb.running)
}
// ================================================
// Voice hacks
// --------------
template<class ParamBlockType>
inline void DoVoiceHacks(ParamBlockType &pb, bool Wii)
{
// get necessary values
const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
const u32 updaddr = (u32)(pb.updates.data_hi << 16) | pb.updates.data_lo;
const u16 updpar = Memory_Read_U16(updaddr);
const u16 upddata = Memory_Read_U16(updaddr + 2);
// =======================================================================================
/* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd
would end up outside of bounds while the block was still playing resulting in noise
a strange noise. This should take care of that.
*/
// ------------
if (
(sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles
&& gSSBMremedy1
&& !Wii
)
{
pb.running = 0;
// also reset all values if it makes any difference
pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0;
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
}
/*
// the fact that no settings are reset (except running) after a SSBM type music stream or another
looping block (for example in Battle Stadium DON) has ended could cause loud garbled sound to be
played from one or more blocks. Perhaps it was in conjunction with the old sequenced music fix below,
I'm not sure. This was an attempt to prevent that anyway by resetting all. But I'm not sure if this
is needed anymore. Please try to play SSBM without it and see if it works anyway.
*/
if (
// detect blocks that have recently been running that we should reset
pb.running == 0 && pb.audio_addr.looping == 1
//pb.running == 0 && pb.adpcm_loop_info.pred_scale
// this prevents us from ruining sequenced music blocks, may not be needed
/*
&& !(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2]
|| pb.updates.num_updates[3] || pb.updates.num_updates[4])
*/
&& !(updpar || upddata)
&& pb.mixer_control == 0 // only use this in SSBM
&& gSSBMremedy2 // let us turn this fix on and off
&& !Wii
)
{
// reset the detection values
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
//pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
//pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
//pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
//pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0;
//pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
}
// =============
// =======================================================================================
// Reset all values
// ------------
if (gReset
&& (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale)
)
{
pb.running = 0;
pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0;
pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0;
pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0;
pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0;
pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0;
pb.audio_addr.looping = 0;
pb.adpcm_loop_info.pred_scale = 0;
pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0;
}
}
#endif // _UCODE_AX_VOICE_H

View File

@ -1,45 +1,45 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_CARD_H
#define _UCODE_CARD_H
#include "UCodes.h"
class CUCode_CARD : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
public:
CUCode_CARD(CMailHandler& _rMailHandler);
virtual ~CUCode_CARD();
void HandleMail(u32 _uMail);
void Update();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_CARD_H
#define _UCODE_CARD_H
#include "UCodes.h"
class CUCode_CARD : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
public:
CUCode_CARD(CMailHandler& _rMailHandler);
virtual ~CUCode_CARD();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -1,54 +1,54 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_INITAUDIOSYSTEM
#define _UCODE_INITAUDIOSYSTEM
#include "UCodes.h"
class CUCode_InitAudioSystem : public IUCode
{
public:
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Init();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
bool IsInitialized;
void BootUCode();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_INITAUDIOSYSTEM
#define _UCODE_INITAUDIOSYSTEM
#include "UCodes.h"
class CUCode_InitAudioSystem : public IUCode
{
public:
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Init();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
bool IsInitialized;
void BootUCode();
};
#endif

View File

@ -1,74 +1,74 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_JAC
#define _UCODE_JAC
#include "UCodes.h"
class CUCode_Jac : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
bool m_bListInProgress;
int m_numSteps;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
// Hmm, don't these need bswaps?
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
CUCode_Jac(CMailHandler& _rMailHandler);
virtual ~CUCode_Jac();
void HandleMail(u32 _uMail);
void Update();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_JAC
#define _UCODE_JAC
#include "UCodes.h"
class CUCode_Jac : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
bool m_bListInProgress;
int m_numSteps;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
// Hmm, don't these need bswaps?
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
CUCode_Jac(CMailHandler& _rMailHandler);
virtual ~CUCode_Jac();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -1,51 +1,51 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ROM
#define _UCODE_ROM
#include "UCodes.h"
class CUCode_Rom : public IUCode
{
public:
CUCode_Rom(CMailHandler& _rMailHandler);
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
void BootUCode();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ROM
#define _UCODE_ROM
#include "UCodes.h"
class CUCode_Rom : public IUCode
{
public:
CUCode_Rom(CMailHandler& _rMailHandler);
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
void BootUCode();
};
#endif

View File

@ -1,75 +1,75 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ZELDA_H
#define _UCODE_ZELDA_H
#include "Common.h"
#include "UCodes.h"
class CUCode_Zelda : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progress
u32 m_numSteps;
bool m_bListInProgress;
u32 m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return m_Buffer[m_readOffset++];
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return res;
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return res;
}
public:
CUCode_Zelda(CMailHandler& _rMailHandler);
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
void MixAdd(short* buffer, int size);
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ZELDA_H
#define _UCODE_ZELDA_H
#include "Common.h"
#include "UCodes.h"
class CUCode_Zelda : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progress
u32 m_numSteps;
bool m_bListInProgress;
u32 m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return m_Buffer[m_readOffset++];
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return res;
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return res;
}
public:
CUCode_Zelda(CMailHandler& _rMailHandler);
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
void MixAdd(short* buffer, int size);
};
#endif

View File

@ -1,48 +1,48 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODES_H
#define _UCODES_H
#include "Common.h"
#define UCODE_ROM 0x0000000
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
class CMailHandler;
class IUCode
{
public:
IUCode(CMailHandler& _rMailHandler)
: m_rMailHandler(_rMailHandler)
{}
virtual ~IUCode()
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:
CMailHandler& m_rMailHandler;
};
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODES_H
#define _UCODES_H
#include "Common.h"
#define UCODE_ROM 0x0000000
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
class CMailHandler;
class IUCode
{
public:
IUCode(CMailHandler& _rMailHandler)
: m_rMailHandler(_rMailHandler)
{}
virtual ~IUCode()
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:
CMailHandler& m_rMailHandler;
};
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler);
#endif

View File

@ -1,30 +1,30 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
#define IDD_SETTINGS 101
#define IDD_DIALOG2 102
#define IDC_COMBO1 1001
#define IDC_SAMPLERATE 1001
#define IDC_EDIT1 1002
#define IDC_SAMPLEDUMPPATH 1002
#define IDC_ENABLE_AUDIO 1003
#define IDC_ENABLE_HLE_AUDIO 1003
#define IDC_ENABLE_DTK_MUSIC 1004
#define IDC_DUMPSAMPLES 1005
#define IDC_SAMPLEMINLENGTH 1006
#define IDC_BROWSE 1007
#define IDC_ENABLE_THROTTLE 1008
#define IDC_ANTIGAP 1009
#define IDC_CHECK3 1010
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
#define IDD_SETTINGS 101
#define IDD_DIALOG2 102
#define IDC_COMBO1 1001
#define IDC_SAMPLERATE 1001
#define IDC_EDIT1 1002
#define IDC_SAMPLEDUMPPATH 1002
#define IDC_ENABLE_AUDIO 1003
#define IDC_ENABLE_HLE_AUDIO 1003
#define IDC_ENABLE_DTK_MUSIC 1004
#define IDC_DUMPSAMPLES 1005
#define IDC_SAMPLEMINLENGTH 1006
#define IDC_BROWSE 1007
#define IDC_ENABLE_THROTTLE 1008
#define IDC_ANTIGAP 1009
#define IDC_CHECK3 1010
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
// Windows Header Files:
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atldlgs.h>
#include <atlctrls.h>
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
// Windows Header Files:
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atldlgs.h>
#include <atlctrls.h>
#endif

View File

@ -1,262 +1,262 @@
// Windows Template Library - WTL version 8.0
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLRES_H__
#define __ATLRES_H__
#pragma once
#if defined (_WIN32_WCE) && !defined (__ATLRESCE_H__)
#error Use atlresCE.h instead of atlres.h for Windows CE
#endif
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#ifndef _WIN32_WCE
#define VS_VERSION_INFO 1
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
#endif // APSTUDIO_INVOKED
#ifndef WINVER
#define WINVER 0x0400 // default to Windows Version 4.0
#endif // !WINVER
#include <winresrc.h>
// operation messages sent to DLGINIT
#define LB_ADDSTRING (WM_USER + 1)
#define CB_ADDSTRING (WM_USER + 3)
#endif // !_WIN32_WCE
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1)
#endif // !_INC_WINDOWS
#endif // RC_INVOKED
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// ATL resource types
#ifndef RC_INVOKED
#define RT_DLGINIT MAKEINTRESOURCE(240)
#define RT_TOOLBAR MAKEINTRESOURCE(241)
#endif // RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard window components
#define ID_SEPARATOR 0 // special separator value
#define ID_DEFAULT_PANE 0 // default status bar pane
#ifndef RC_INVOKED // code only
// standard control bars (IDW = window ID)
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
// parts of a frame window
#define ATL_IDW_CLIENT 0xE900
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
#define ATL_IDW_PANE_LAST 0xE9FF
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
// bands for a rebar
#define ATL_IDW_BAND_FIRST 0xEB00
#define ATL_IDW_BAND_LAST 0xEBFF
#endif // !RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard Commands
// File commands
#define ID_FILE_NEW 0xE100
#define ID_FILE_OPEN 0xE101
#define ID_FILE_CLOSE 0xE102
#define ID_FILE_SAVE 0xE103
#define ID_FILE_SAVE_AS 0xE104
#define ID_FILE_PAGE_SETUP 0xE105
#define ID_FILE_PRINT_SETUP 0xE106
#define ID_FILE_PRINT 0xE107
#define ID_FILE_PRINT_DIRECT 0xE108
#define ID_FILE_PRINT_PREVIEW 0xE109
#define ID_FILE_UPDATE 0xE10A
#define ID_FILE_SAVE_COPY_AS 0xE10B
#define ID_FILE_SEND_MAIL 0xE10C
#define ID_FILE_MRU_FIRST 0xE110
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
#define ID_FILE_MRU_FILE2 0xE111
#define ID_FILE_MRU_FILE3 0xE112
#define ID_FILE_MRU_FILE4 0xE113
#define ID_FILE_MRU_FILE5 0xE114
#define ID_FILE_MRU_FILE6 0xE115
#define ID_FILE_MRU_FILE7 0xE116
#define ID_FILE_MRU_FILE8 0xE117
#define ID_FILE_MRU_FILE9 0xE118
#define ID_FILE_MRU_FILE10 0xE119
#define ID_FILE_MRU_FILE11 0xE11A
#define ID_FILE_MRU_FILE12 0xE11B
#define ID_FILE_MRU_FILE13 0xE11C
#define ID_FILE_MRU_FILE14 0xE11D
#define ID_FILE_MRU_FILE15 0xE11E
#define ID_FILE_MRU_FILE16 0xE11F
#define ID_FILE_MRU_LAST 0xE11F
// Edit commands
#define ID_EDIT_CLEAR 0xE120
#define ID_EDIT_CLEAR_ALL 0xE121
#define ID_EDIT_COPY 0xE122
#define ID_EDIT_CUT 0xE123
#define ID_EDIT_FIND 0xE124
#define ID_EDIT_PASTE 0xE125
#define ID_EDIT_PASTE_LINK 0xE126
#define ID_EDIT_PASTE_SPECIAL 0xE127
#define ID_EDIT_REPEAT 0xE128
#define ID_EDIT_REPLACE 0xE129
#define ID_EDIT_SELECT_ALL 0xE12A
#define ID_EDIT_UNDO 0xE12B
#define ID_EDIT_REDO 0xE12C
// Window commands
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#ifndef RC_INVOKED // code only
#define ATL_IDM_WINDOW_FIRST 0xE130
#define ATL_IDM_WINDOW_LAST 0xE13F
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
#define ATL_IDM_LAST_MDICHILD 0xFFFD
#endif // !RC_INVOKED
// TabView
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
#define ID_WINDOW_TABLAST 0xFFFD
#define ID_WINDOW_SHOWTABLIST 0xFFFE
// Help and App commands
#define ID_APP_ABOUT 0xE140
#define ID_APP_EXIT 0xE141
#define ID_HELP_INDEX 0xE142
#define ID_HELP_FINDER 0xE143
#define ID_HELP_USING 0xE144
#define ID_CONTEXT_HELP 0xE145 // shift-F1
// special commands for processing help
#define ID_HELP 0xE146 // first attempt for F1
#define ID_DEFAULT_HELP 0xE147 // last attempt
// Misc
#define ID_NEXT_PANE 0xE150
#define ID_PREV_PANE 0xE151
#define ID_PANE_CLOSE 0xE152
// Format
#define ID_FORMAT_FONT 0xE160
// Scroll
#define ID_SCROLL_UP 0xE170
#define ID_SCROLL_DOWN 0xE171
#define ID_SCROLL_PAGE_UP 0xE172
#define ID_SCROLL_PAGE_DOWN 0xE173
#define ID_SCROLL_TOP 0xE174
#define ID_SCROLL_BOTTOM 0xE175
#define ID_SCROLL_LEFT 0xE176
#define ID_SCROLL_RIGHT 0xE177
#define ID_SCROLL_PAGE_LEFT 0xE178
#define ID_SCROLL_PAGE_RIGHT 0xE179
#define ID_SCROLL_ALL_LEFT 0xE17A
#define ID_SCROLL_ALL_RIGHT 0xE17B
// OLE commands
#define ID_OLE_INSERT_NEW 0xE200
#define ID_OLE_EDIT_LINKS 0xE201
#define ID_OLE_EDIT_CONVERT 0xE202
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
#define ID_OLE_EDIT_PROPERTIES 0xE204
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
#ifndef RC_INVOKED // code only
#define ID_OLE_VERB_LAST 0xE21F
#endif // !RC_INVOKED
// View commands (same number used as IDW used for toolbar and status bar)
#define ID_VIEW_TOOLBAR 0xE800
#define ID_VIEW_STATUS_BAR 0xE801
#define ID_VIEW_REFRESH 0xE803
///////////////////////////////////////////////////////////////////////////////
// Standard control IDs
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1) // all static controls
///////////////////////////////////////////////////////////////////////////////
// Standard string error/warnings
// idle status bar message
#define ATL_IDS_IDLEMESSAGE 0xE001
#ifndef RC_INVOKED // code only
#define ATL_IDS_SCFIRST 0xEF00
#endif // !RC_INVOKED
#define ATL_IDS_SCSIZE 0xEF00
#define ATL_IDS_SCMOVE 0xEF01
#define ATL_IDS_SCMINIMIZE 0xEF02
#define ATL_IDS_SCMAXIMIZE 0xEF03
#define ATL_IDS_SCNEXTWINDOW 0xEF04
#define ATL_IDS_SCPREVWINDOW 0xEF05
#define ATL_IDS_SCCLOSE 0xEF06
#define ATL_IDS_SCRESTORE 0xEF12
#define ATL_IDS_SCTASKLIST 0xEF13
#define ATL_IDS_MDICHILD 0xEF1F
#define ATL_IDS_MRU_FILE 0xEFDA
///////////////////////////////////////////////////////////////////////////////
// Misc. control IDs
// Property Sheet control id's (determined with Spy++)
#define ID_APPLY_NOW 0x3021
#define ID_WIZBACK 0x3023
#define ID_WIZNEXT 0x3024
#define ID_WIZFINISH 0x3025
#define ATL_IDC_TAB_CONTROL 0x3020
#endif // __ATLRES_H__
// Windows Template Library - WTL version 8.0
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLRES_H__
#define __ATLRES_H__
#pragma once
#if defined (_WIN32_WCE) && !defined (__ATLRESCE_H__)
#error Use atlresCE.h instead of atlres.h for Windows CE
#endif
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#ifndef _WIN32_WCE
#define VS_VERSION_INFO 1
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
#endif // APSTUDIO_INVOKED
#ifndef WINVER
#define WINVER 0x0400 // default to Windows Version 4.0
#endif // !WINVER
#include <winresrc.h>
// operation messages sent to DLGINIT
#define LB_ADDSTRING (WM_USER + 1)
#define CB_ADDSTRING (WM_USER + 3)
#endif // !_WIN32_WCE
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1)
#endif // !_INC_WINDOWS
#endif // RC_INVOKED
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// ATL resource types
#ifndef RC_INVOKED
#define RT_DLGINIT MAKEINTRESOURCE(240)
#define RT_TOOLBAR MAKEINTRESOURCE(241)
#endif // RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard window components
#define ID_SEPARATOR 0 // special separator value
#define ID_DEFAULT_PANE 0 // default status bar pane
#ifndef RC_INVOKED // code only
// standard control bars (IDW = window ID)
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
// parts of a frame window
#define ATL_IDW_CLIENT 0xE900
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
#define ATL_IDW_PANE_LAST 0xE9FF
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
// bands for a rebar
#define ATL_IDW_BAND_FIRST 0xEB00
#define ATL_IDW_BAND_LAST 0xEBFF
#endif // !RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard Commands
// File commands
#define ID_FILE_NEW 0xE100
#define ID_FILE_OPEN 0xE101
#define ID_FILE_CLOSE 0xE102
#define ID_FILE_SAVE 0xE103
#define ID_FILE_SAVE_AS 0xE104
#define ID_FILE_PAGE_SETUP 0xE105
#define ID_FILE_PRINT_SETUP 0xE106
#define ID_FILE_PRINT 0xE107
#define ID_FILE_PRINT_DIRECT 0xE108
#define ID_FILE_PRINT_PREVIEW 0xE109
#define ID_FILE_UPDATE 0xE10A
#define ID_FILE_SAVE_COPY_AS 0xE10B
#define ID_FILE_SEND_MAIL 0xE10C
#define ID_FILE_MRU_FIRST 0xE110
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
#define ID_FILE_MRU_FILE2 0xE111
#define ID_FILE_MRU_FILE3 0xE112
#define ID_FILE_MRU_FILE4 0xE113
#define ID_FILE_MRU_FILE5 0xE114
#define ID_FILE_MRU_FILE6 0xE115
#define ID_FILE_MRU_FILE7 0xE116
#define ID_FILE_MRU_FILE8 0xE117
#define ID_FILE_MRU_FILE9 0xE118
#define ID_FILE_MRU_FILE10 0xE119
#define ID_FILE_MRU_FILE11 0xE11A
#define ID_FILE_MRU_FILE12 0xE11B
#define ID_FILE_MRU_FILE13 0xE11C
#define ID_FILE_MRU_FILE14 0xE11D
#define ID_FILE_MRU_FILE15 0xE11E
#define ID_FILE_MRU_FILE16 0xE11F
#define ID_FILE_MRU_LAST 0xE11F
// Edit commands
#define ID_EDIT_CLEAR 0xE120
#define ID_EDIT_CLEAR_ALL 0xE121
#define ID_EDIT_COPY 0xE122
#define ID_EDIT_CUT 0xE123
#define ID_EDIT_FIND 0xE124
#define ID_EDIT_PASTE 0xE125
#define ID_EDIT_PASTE_LINK 0xE126
#define ID_EDIT_PASTE_SPECIAL 0xE127
#define ID_EDIT_REPEAT 0xE128
#define ID_EDIT_REPLACE 0xE129
#define ID_EDIT_SELECT_ALL 0xE12A
#define ID_EDIT_UNDO 0xE12B
#define ID_EDIT_REDO 0xE12C
// Window commands
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#ifndef RC_INVOKED // code only
#define ATL_IDM_WINDOW_FIRST 0xE130
#define ATL_IDM_WINDOW_LAST 0xE13F
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
#define ATL_IDM_LAST_MDICHILD 0xFFFD
#endif // !RC_INVOKED
// TabView
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
#define ID_WINDOW_TABLAST 0xFFFD
#define ID_WINDOW_SHOWTABLIST 0xFFFE
// Help and App commands
#define ID_APP_ABOUT 0xE140
#define ID_APP_EXIT 0xE141
#define ID_HELP_INDEX 0xE142
#define ID_HELP_FINDER 0xE143
#define ID_HELP_USING 0xE144
#define ID_CONTEXT_HELP 0xE145 // shift-F1
// special commands for processing help
#define ID_HELP 0xE146 // first attempt for F1
#define ID_DEFAULT_HELP 0xE147 // last attempt
// Misc
#define ID_NEXT_PANE 0xE150
#define ID_PREV_PANE 0xE151
#define ID_PANE_CLOSE 0xE152
// Format
#define ID_FORMAT_FONT 0xE160
// Scroll
#define ID_SCROLL_UP 0xE170
#define ID_SCROLL_DOWN 0xE171
#define ID_SCROLL_PAGE_UP 0xE172
#define ID_SCROLL_PAGE_DOWN 0xE173
#define ID_SCROLL_TOP 0xE174
#define ID_SCROLL_BOTTOM 0xE175
#define ID_SCROLL_LEFT 0xE176
#define ID_SCROLL_RIGHT 0xE177
#define ID_SCROLL_PAGE_LEFT 0xE178
#define ID_SCROLL_PAGE_RIGHT 0xE179
#define ID_SCROLL_ALL_LEFT 0xE17A
#define ID_SCROLL_ALL_RIGHT 0xE17B
// OLE commands
#define ID_OLE_INSERT_NEW 0xE200
#define ID_OLE_EDIT_LINKS 0xE201
#define ID_OLE_EDIT_CONVERT 0xE202
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
#define ID_OLE_EDIT_PROPERTIES 0xE204
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
#ifndef RC_INVOKED // code only
#define ID_OLE_VERB_LAST 0xE21F
#endif // !RC_INVOKED
// View commands (same number used as IDW used for toolbar and status bar)
#define ID_VIEW_TOOLBAR 0xE800
#define ID_VIEW_STATUS_BAR 0xE801
#define ID_VIEW_REFRESH 0xE803
///////////////////////////////////////////////////////////////////////////////
// Standard control IDs
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1) // all static controls
///////////////////////////////////////////////////////////////////////////////
// Standard string error/warnings
// idle status bar message
#define ATL_IDS_IDLEMESSAGE 0xE001
#ifndef RC_INVOKED // code only
#define ATL_IDS_SCFIRST 0xEF00
#endif // !RC_INVOKED
#define ATL_IDS_SCSIZE 0xEF00
#define ATL_IDS_SCMOVE 0xEF01
#define ATL_IDS_SCMINIMIZE 0xEF02
#define ATL_IDS_SCMAXIMIZE 0xEF03
#define ATL_IDS_SCNEXTWINDOW 0xEF04
#define ATL_IDS_SCPREVWINDOW 0xEF05
#define ATL_IDS_SCCLOSE 0xEF06
#define ATL_IDS_SCRESTORE 0xEF12
#define ATL_IDS_SCTASKLIST 0xEF13
#define ATL_IDS_MDICHILD 0xEF1F
#define ATL_IDS_MRU_FILE 0xEFDA
///////////////////////////////////////////////////////////////////////////////
// Misc. control IDs
// Property Sheet control id's (determined with Spy++)
#define ID_APPLY_NOW 0x3021
#define ID_WIZBACK 0x3023
#define ID_WIZNEXT 0x3024
#define ID_WIZFINISH 0x3025
#define ATL_IDC_TAB_CONTROL 0x3020
#endif // __ATLRES_H__

View File

@ -1,30 +1,30 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resources.rc
//
#define IDR_MAINFRAME 128
#define IDD_MAINDLG 129
#define IDD_DISASMDLG 129
#define IDD_DISASMDLG1 130
#define IDD_REGISTERDLG 130
#define IDC_LIST1 1000
#define IDC_DISASM_LIST 1000
#define ID_STEP 1001
#define ID_SHOW_REGISTER 1002
#define IDC_ASSERT_INT 1003
#define ID_GO 1004
#define IDC_HALT 1005
#define IDC_HALT2 1006
#define IDC_INIT 1006
#define IDC_GROUP 1007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 32772
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resources.rc
//
#define IDR_MAINFRAME 128
#define IDD_MAINDLG 129
#define IDD_DISASMDLG 129
#define IDD_DISASMDLG1 130
#define IDD_REGISTERDLG 130
#define IDC_LIST1 1000
#define IDC_DISASM_LIST 1000
#define ID_STEP 1001
#define ID_SHOW_REGISTER 1002
#define IDC_ASSERT_INT 1003
#define ID_GO 1004
#define IDC_HALT 1005
#define IDC_HALT2 1006
#define IDC_INIT 1006
#define IDC_GROUP 1007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 32772
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__

View File

@ -1,163 +1,163 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include <list>
#include <algorithm>
#include "../res/resource.h"
#include "DisAsmListView.h"
#include "RegisterDlg.h"
class CDisAsmDlg
: public CDialogImpl<CDisAsmDlg>, public CUpdateUI<CDisAsmDlg>, public CDialogResize<CDisAsmDlg>
{
public:
CDisAsmDlg();
enum { IDD = IDD_DISASMDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CDisAsmDlg)
END_UPDATE_UI_MAP()
BEGIN_DLGRESIZE_MAP(CDisAsmDlg)
DLGRESIZE_CONTROL(IDR_MAINFRAME, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
BEGIN_MSG_MAP(CDisAsmDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(ID_STEP, OnStep)
COMMAND_ID_HANDLER(ID_GO, OnGo)
COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
NOTIFY_CODE_HANDLER(NM_CLICK, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RETURN, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RCLICK, OnRClick)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
NOTIFY_HANDLER(IDC_DISASM_LIST, LVN_ITEMCHANGED, OnLvnItemchangedDisasmList)
MESSAGE_HANDLER(WM_SIZE, OnSize)
CHAIN_MSG_MAP(CDialogResize<CDisAsmDlg>)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
LRESULT OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
LRESULT OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
bool CanDoStep();
void DebugBreak();
private:
enum EColumns
{
ColumnBP = 0,
ColumnFunction = 1,
ColumnAddress = 2,
ColumnMenmomic = 3,
ColumnOpcode = 4,
ColumnExt = 5,
ColumnParameter = 6
};
enum EState
{
PAUSE,
STEP,
RUN,
RUN_START // ignores breakpoints and switches after one step to RUN
};
EState m_State;
CListViewCtrl m_DisAsmListViewCtrl;
CRegisterDlg m_RegisterDlg;
//CWindow GroupLeft
CStatic GroupLeft;
uint64 m_CachedStepCounter;
uint16 m_CachedCR;
uint32 m_CachedUCodeCRC;
typedef std::list<uint16>CBreakPointList;
CBreakPointList m_BreakPoints;
// break point handling
bool IsBreakPoint(uint16 _Address);
void ToggleBreakPoint(uint16 _Address);
void RemoveBreakPoint(uint16 _Address);
void AddBreakPoint(uint16 _Address);
void ClearBreakPoints();
// update dialog
void UpdateDisAsmListView();
void UpdateRegisterFlags();
void UpdateSymbolMap();
void UpdateButtonTexts();
void RedrawDisAsmListView();
void RebuildDisAsmListView();
struct SSymbol
{
uint32 AddressStart;
uint32 AddressEnd;
std::string Name;
SSymbol(uint32 _AddressStart = 0, uint32 _AddressEnd = 0, char* _Name = NULL)
: AddressStart(_AddressStart)
, AddressEnd(_AddressEnd)
, Name(_Name)
{}
};
typedef std::map<uint16, SSymbol>CSymbolMap;
CSymbolMap m_SymbolMap;
void AddSymbol(uint16 _AddressStart, uint16 _AddressEnd, char* _Name);
bool LoadSymbolMap(const char* _pFileName);
DWORD FindColor(uint16 _Address);
void UpdateDialog();
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
public:
LRESULT OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
};
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include <list>
#include <algorithm>
#include "../res/resource.h"
#include "DisAsmListView.h"
#include "RegisterDlg.h"
class CDisAsmDlg
: public CDialogImpl<CDisAsmDlg>, public CUpdateUI<CDisAsmDlg>, public CDialogResize<CDisAsmDlg>
{
public:
CDisAsmDlg();
enum { IDD = IDD_DISASMDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CDisAsmDlg)
END_UPDATE_UI_MAP()
BEGIN_DLGRESIZE_MAP(CDisAsmDlg)
DLGRESIZE_CONTROL(IDR_MAINFRAME, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
BEGIN_MSG_MAP(CDisAsmDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(ID_STEP, OnStep)
COMMAND_ID_HANDLER(ID_GO, OnGo)
COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
NOTIFY_CODE_HANDLER(NM_CLICK, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RETURN, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RCLICK, OnRClick)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
NOTIFY_HANDLER(IDC_DISASM_LIST, LVN_ITEMCHANGED, OnLvnItemchangedDisasmList)
MESSAGE_HANDLER(WM_SIZE, OnSize)
CHAIN_MSG_MAP(CDialogResize<CDisAsmDlg>)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
LRESULT OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
LRESULT OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
bool CanDoStep();
void DebugBreak();
private:
enum EColumns
{
ColumnBP = 0,
ColumnFunction = 1,
ColumnAddress = 2,
ColumnMenmomic = 3,
ColumnOpcode = 4,
ColumnExt = 5,
ColumnParameter = 6
};
enum EState
{
PAUSE,
STEP,
RUN,
RUN_START // ignores breakpoints and switches after one step to RUN
};
EState m_State;
CListViewCtrl m_DisAsmListViewCtrl;
CRegisterDlg m_RegisterDlg;
//CWindow GroupLeft
CStatic GroupLeft;
uint64 m_CachedStepCounter;
uint16 m_CachedCR;
uint32 m_CachedUCodeCRC;
typedef std::list<uint16>CBreakPointList;
CBreakPointList m_BreakPoints;
// break point handling
bool IsBreakPoint(uint16 _Address);
void ToggleBreakPoint(uint16 _Address);
void RemoveBreakPoint(uint16 _Address);
void AddBreakPoint(uint16 _Address);
void ClearBreakPoints();
// update dialog
void UpdateDisAsmListView();
void UpdateRegisterFlags();
void UpdateSymbolMap();
void UpdateButtonTexts();
void RedrawDisAsmListView();
void RebuildDisAsmListView();
struct SSymbol
{
uint32 AddressStart;
uint32 AddressEnd;
std::string Name;
SSymbol(uint32 _AddressStart = 0, uint32 _AddressEnd = 0, char* _Name = NULL)
: AddressStart(_AddressStart)
, AddressEnd(_AddressEnd)
, Name(_Name)
{}
};
typedef std::map<uint16, SSymbol>CSymbolMap;
CSymbolMap m_SymbolMap;
void AddSymbol(uint16 _AddressStart, uint16 _AddressEnd, char* _Name);
bool LoadSymbolMap(const char* _pFileName);
DWORD FindColor(uint16 _Address);
void UpdateDialog();
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
public:
LRESULT OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
};

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MYLISTVIEW_H
#define _MYLISTVIEW_H
class CDisAsmListView
: public CWindowImpl<CDisAsmListView, CListViewCtrl>,
public CCustomDraw<CDisAsmListView>
{
public:
BEGIN_MSG_MAP(CDisAsmListView)
CHAIN_MSG_MAP(CCustomDraw<CDisAsmListView>)
END_MSG_MAP()
DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/)
{
return(CDRF_NOTIFYITEMDRAW);
}
DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(lpNMCustomDraw);
// This is the prepaint stage for an item. Here's where we set the
// item's text color. Our return value will tell Windows to draw the
// item itself, but it will use the new color we set here for the background
COLORREF crText;
if ((pLVCD->nmcd.dwItemSpec % 2) == 0)
{
crText = RGB(200, 200, 255);
}
else
{
crText = RGB(255, 255, 255);
}
// Store the color back in the NMLVCUSTOMDRAW struct.
pLVCD->clrTextBk = crText;
// Tell Windows to paint the control itself.
return(CDRF_DODEFAULT);
}
};
#endif _MYLISTVIEW_H
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MYLISTVIEW_H
#define _MYLISTVIEW_H
class CDisAsmListView
: public CWindowImpl<CDisAsmListView, CListViewCtrl>,
public CCustomDraw<CDisAsmListView>
{
public:
BEGIN_MSG_MAP(CDisAsmListView)
CHAIN_MSG_MAP(CCustomDraw<CDisAsmListView>)
END_MSG_MAP()
DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/)
{
return(CDRF_NOTIFYITEMDRAW);
}
DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(lpNMCustomDraw);
// This is the prepaint stage for an item. Here's where we set the
// item's text color. Our return value will tell Windows to draw the
// item itself, but it will use the new color we set here for the background
COLORREF crText;
if ((pLVCD->nmcd.dwItemSpec % 2) == 0)
{
crText = RGB(200, 200, 255);
}
else
{
crText = RGB(255, 255, 255);
}
// Store the color back in the NMLVCUSTOMDRAW struct.
pLVCD->clrTextBk = crText;
// Tell Windows to paint the control itself.
return(CDRF_DODEFAULT);
}
};
#endif _MYLISTVIEW_H

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "pluginspecs_dsp.h"
#include "Common.h"
#include <stdio.h>
#define WITH_DSP_ON_THREAD 1
#define DUMP_DSP_IMEM 0
#define PROFILE 1
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void ErrorLog(const char* _fmt, ...);
void DSP_DebugBreak();
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef unsigned int uint;
typedef signed char sint8;
typedef signed short sint16;
typedef signed int sint32;
typedef signed long long sint64;
typedef const uint32 cuint32;
u16 Memory_Read_U16(u32 _uAddress); // For PB address detection
u32 Memory_Read_U32(u32 _uAddress);
#if PROFILE
void ProfilerDump(uint64 _count);
void ProfilerInit();
void ProfilerAddDelta(int _addr, int _delta);
void ProfilerStart();
#endif
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "pluginspecs_dsp.h"
#include "Common.h"
#include <stdio.h>
#define WITH_DSP_ON_THREAD 1
#define DUMP_DSP_IMEM 0
#define PROFILE 1
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void ErrorLog(const char* _fmt, ...);
void DSP_DebugBreak();
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef unsigned int uint;
typedef signed char sint8;
typedef signed short sint16;
typedef signed int sint32;
typedef signed long long sint64;
typedef const uint32 cuint32;
u16 Memory_Read_U16(u32 _uAddress); // For PB address detection
u32 Memory_Read_U32(u32 _uAddress);
#if PROFILE
void ProfilerDump(uint64 _count);
void ProfilerInit();
void ProfilerAddDelta(int _addr, int _delta);
void ProfilerStart();
#endif
#endif

View File

@ -1,129 +1,129 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef HLE_HELPER_H
#define HLE_HELPER_H
#include "gdsp_interpreter.h"
bool WriteDMEM(uint16 addr, uint16 val);
uint16 ReadDMEM(uint16 addr);
void Update_SR_Register(sint64 _Value);
sint8 GetMultiplyModifier();
template<unsigned N>
class TAccumulator
{
public:
TAccumulator()
{
_assert_(N < 2);
}
void operator=(sint64 val)
{
setValue(val);
}
void operator<<=(sint64 value)
{
sint64 acc = getValue();
acc <<= value;
setValue(acc);
}
void operator>>=(sint64 value)
{
sint64 acc = getValue();
acc >>= value;
setValue(acc);
}
void operator+=(sint64 value)
{
sint64 acc = getValue();
acc += value;
setValue(acc);
}
operator sint64()
{
return getValue();
}
operator uint64()
{
return getValue();
}
inline void setValue(sint64 val)
{
g_dsp.r[0x1c + N] = (uint16)val;
val >>= 16;
g_dsp.r[0x1e + N] = (uint16)val;
val >>= 16;
g_dsp.r[0x10 + N] = (uint16)val;
}
inline sint64 getValue()
{
sint64 val;
sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + N];
val <<= 32;
low_acc = g_dsp.r[0x1e + N];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + N];
val |= low_acc;
return(val);
}
};
class CProd
{
public:
CProd()
{
}
void operator=(sint64 val)
{
g_dsp.r[0x14] = (uint16)val;
val >>= 16;
g_dsp.r[0x15] = (uint16)val;
val >>= 16;
g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0;
}
operator sint64()
{
sint64 val;
sint64 low_prod;
val = (sint8)g_dsp.r[0x16];
val <<= 32;
low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17];
low_prod <<= 16;
low_prod |= g_dsp.r[0x14];
val += low_prod;
return(val);
}
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef HLE_HELPER_H
#define HLE_HELPER_H
#include "gdsp_interpreter.h"
bool WriteDMEM(uint16 addr, uint16 val);
uint16 ReadDMEM(uint16 addr);
void Update_SR_Register(sint64 _Value);
sint8 GetMultiplyModifier();
template<unsigned N>
class TAccumulator
{
public:
TAccumulator()
{
_assert_(N < 2);
}
void operator=(sint64 val)
{
setValue(val);
}
void operator<<=(sint64 value)
{
sint64 acc = getValue();
acc <<= value;
setValue(acc);
}
void operator>>=(sint64 value)
{
sint64 acc = getValue();
acc >>= value;
setValue(acc);
}
void operator+=(sint64 value)
{
sint64 acc = getValue();
acc += value;
setValue(acc);
}
operator sint64()
{
return getValue();
}
operator uint64()
{
return getValue();
}
inline void setValue(sint64 val)
{
g_dsp.r[0x1c + N] = (uint16)val;
val >>= 16;
g_dsp.r[0x1e + N] = (uint16)val;
val >>= 16;
g_dsp.r[0x10 + N] = (uint16)val;
}
inline sint64 getValue()
{
sint64 val;
sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + N];
val <<= 32;
low_acc = g_dsp.r[0x1e + N];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + N];
val |= low_acc;
return(val);
}
};
class CProd
{
public:
CProd()
{
}
void operator=(sint64 val)
{
g_dsp.r[0x14] = (uint16)val;
val >>= 16;
g_dsp.r[0x15] = (uint16)val;
val >>= 16;
g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0;
}
operator sint64()
{
sint64 val;
sint64 low_prod;
val = (sint8)g_dsp.r[0x16];
val <<= 32;
low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17];
low_prod <<= 16;
low_prod |= g_dsp.r[0x14];
val += low_prod;
return(val);
}
};
#endif

View File

@ -1,26 +1,26 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
void startConsoleWin(int width, int height, char* fname);
int wprintf(char *fmt, ...);
void ClearScreen();
HWND GetConsoleHwnd(void);
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
void startConsoleWin(int width, int height, char* fname);
int wprintf(char *fmt, ...);
void ClearScreen();
HWND GetConsoleHwnd(void);
#endif

View File

@ -1,23 +1,23 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
void Logging();
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
void Logging();
#endif

View File

@ -1,145 +1,145 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
#ifndef UCODE_AX_STRUCTS
#define UCODE_AX_STRUCTS
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBInitialTimeDelay
{
u16 unknown[7];
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUnknown
{
s16 unknown[9];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 unknown;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (2 = none, ?, linear)
u16 unknown1;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBUnknown unknown2;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifdef _WIN32
#ifndef UCODE_AX_STRUCTS
#define UCODE_AX_STRUCTS
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBInitialTimeDelay
{
u16 unknown[7];
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUnknown
{
s16 unknown[9];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 unknown;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (2 = none, ?, linear)
u16 unknown1;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBUnknown unknown2;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif
#endif // win32

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MIXER_H
#define _MIXER_H
extern volatile bool mixer_HLEready;
// Called from audio threads
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
// Called from main thread
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MIXER_H
#define _MIXER_H
extern volatile bool mixer_HLEready;
// Called from audio threads
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
// Called from main thread
void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate);
#endif

View File

@ -1,81 +1,81 @@
// RegSettings.h
//
// Copyright (c) 2001 Magomed Abdurakhmanov
// maq@hotbox.ru, http://mickels.iwt.ru/en
//
//
//
// No warranties are given. Use at your own risk.
//
//////////////////////////////////////////////////////////////////////
#if !defined (AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)
#define AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <AtlMisc.h>
#include <AtlCtrls.h>
class CWindowSettings
{
public:
WINDOWPLACEMENT m_WindowPlacement;
CWindowSettings();
void GetFrom(CWindow& Wnd);
void ApplyTo(CWindow& Wnd, int nCmdShow = SW_SHOWNORMAL) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CReBarSettings
{
public:
struct BandInfo
{
DWORD ID;
DWORD cx;
bool BreakLine;
}* m_pBands;
DWORD m_cbBandCount;
CReBarSettings();
~CReBarSettings();
void GetFrom(CReBarCtrl& ReBar);
void ApplyTo(CReBarCtrl& ReBar) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CSplitterSettings
{
public:
DWORD m_dwPos;
template<class T>void GetFrom(const T& Splitter)
{
m_dwPos = Splitter.GetSplitterPos();
}
template<class T>void ApplyTo(T& Splitter) const
{
Splitter.SetSplitterPos(m_dwPos);
}
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
#endif // !defined(AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)
// RegSettings.h
//
// Copyright (c) 2001 Magomed Abdurakhmanov
// maq@hotbox.ru, http://mickels.iwt.ru/en
//
//
//
// No warranties are given. Use at your own risk.
//
//////////////////////////////////////////////////////////////////////
#if !defined (AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)
#define AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <AtlMisc.h>
#include <AtlCtrls.h>
class CWindowSettings
{
public:
WINDOWPLACEMENT m_WindowPlacement;
CWindowSettings();
void GetFrom(CWindow& Wnd);
void ApplyTo(CWindow& Wnd, int nCmdShow = SW_SHOWNORMAL) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CReBarSettings
{
public:
struct BandInfo
{
DWORD ID;
DWORD cx;
bool BreakLine;
}* m_pBands;
DWORD m_cbBandCount;
CReBarSettings();
~CReBarSettings();
void GetFrom(CReBarCtrl& ReBar);
void ApplyTo(CReBarCtrl& ReBar) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CSplitterSettings
{
public:
DWORD m_dwPos;
template<class T>void GetFrom(const T& Splitter)
{
m_dwPos = Splitter.GetSplitterPos();
}
template<class T>void ApplyTo(T& Splitter) const
{
Splitter.SetSplitterPos(m_dwPos);
}
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
#endif // !defined(AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)

View File

@ -1,80 +1,80 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Globals.h"
#include <map>
#include "DisAsmListView.h"
class CRegisterDlg
: public CDialogImpl<CRegisterDlg>, public CUpdateUI<CRegisterDlg>
{
public:
CRegisterDlg();
enum { IDD = IDD_REGISTERDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CRegisterDlg)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CRegisterDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
// COMMAND_ID_HANDLER(ID_STEP, OnStep)
// COMMAND_ID_HANDLER(ID_GO, OnGo)
// COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
// LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
void UpdateRegisterListView();
private:
CListViewCtrl m_RegisterListViewCtrl;
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
uint64 m_CachedCounter;
uint16 m_CachedRegs[32];
bool m_CachedRegHasChanged[32];
};
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Globals.h"
#include <map>
#include "DisAsmListView.h"
class CRegisterDlg
: public CDialogImpl<CRegisterDlg>, public CUpdateUI<CRegisterDlg>
{
public:
CRegisterDlg();
enum { IDD = IDD_REGISTERDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CRegisterDlg)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CRegisterDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
// COMMAND_ID_HANDLER(ID_STEP, OnStep)
// COMMAND_ID_HANDLER(ID_GO, OnGo)
// COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
// LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
void UpdateRegisterListView();
private:
CListViewCtrl m_RegisterListViewCtrl;
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
uint64 m_CachedCounter;
uint16 m_CachedRegs[32];
bool m_CachedRegHasChanged[32];
};

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
// UDSPControl
union UDSPControl
{
uint16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned unk3 : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(uint16 _Hex = 0)
: Hex(_Hex) {}
};
bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc);
uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength);
bool DumpCWCode(uint32 _Address, uint32 _Length);
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
// UDSPControl
union UDSPControl
{
uint16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned unk3 : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(uint16 _Hex = 0)
: Hex(_Hex) {}
};
bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc);
uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength);
bool DumpCWCode(uint32 _Address, uint32 _Length);

View File

@ -1,46 +1,46 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#pragma once
typedef struct gd_globals_t
{
bool print_tabs;
bool show_hex;
bool show_pc;
bool decode_names;
bool decode_registers;
uint16* binbuf;
uint16 pc;
char* buffer;
uint16 buffer_size;
char ext_separator;
} gd_globals_t;
char* gd_dis_opcode(gd_globals_t* gdg);
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output);
const char* gd_dis_get_reg_name(uint16 reg);
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#pragma once
typedef struct gd_globals_t
{
bool print_tabs;
bool show_hex;
bool show_pc;
bool decode_names;
bool decode_registers;
uint16* binbuf;
uint16 pc;
char* buffer;
uint16 buffer_size;
char ext_separator;
} gd_globals_t;
char* gd_dis_opcode(gd_globals_t* gdg);
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output);
const char* gd_dis_get_reg_name(uint16 reg);

View File

@ -1,23 +1,23 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GDSP_ARAM_H
#define _GDSP_ARAM_H
uint16 dsp_read_aram();
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GDSP_ARAM_H
#define _GDSP_ARAM_H
uint16 dsp_read_aram();
#endif

View File

@ -1,33 +1,33 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_EXT_OP_H
#define _GDSP_EXT_OP_H
void dsp_op_ext_ops_pro(uint16 _Opcode);
void dsp_op_ext_ops_epi(uint16 _Opcode);
#endif
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_EXT_OP_H
#define _GDSP_EXT_OP_H
void dsp_op_ext_ops_pro(uint16 _Opcode);
void dsp_op_ext_ops_epi(uint16 _Opcode);
#endif

View File

@ -1,35 +1,35 @@
/*====================================================================
filename: gdsp_ifx.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
// ADPCM hw
#ifndef _GDSP_IFX_H
#define _GDSP_IFX_H
void gdsp_ifx_write(uint16 addr, uint16 val);
uint16 gdsp_ifx_read(uint16 addr);
#endif
/*====================================================================
filename: gdsp_ifx.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
// ADPCM hw
#ifndef _GDSP_IFX_H
#define _GDSP_IFX_H
void gdsp_ifx_write(uint16 addr, uint16 val);
uint16 gdsp_ifx_read(uint16 addr);
#endif

View File

@ -1,67 +1,67 @@
/*====================================================================
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERFACE_H
#define _GDSP_INTERFACE_H
#include "Globals.h"
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
#define DSP_DSMAH 0xce
#define DSP_DSMAL 0xcf
#define DSP_DSCR 0xc9
#define DSP_DSPA 0xcd
#define DSP_DSBL 0xcb
#define DSP_ACSAH 0xd4
#define DSP_ACSAL 0xd5
#define DSP_ACEAH 0xd6
#define DSP_ACEAL 0xd7
#define DSP_ACCAH 0xd8
#define DSP_ACCAL 0xd9
#define DSP_COEF_A1_0 0xa0
#define DSP_FORMAT 0xd1
#define DSP_PRED_SCALE 0xda
#define DSP_YN1 0xdb
#define DSP_YN2 0xdc
#define DSP_ARAM 0xdd
#define DSP_GAIN 0xde
extern uint16 gdsp_ifx_regs[256];
uint32 gdsp_mbox_peek(uint8 mbx);
void gdsp_mbox_write_h(uint8 mbx, uint16 val);
void gdsp_mbox_write_l(uint8 mbx, uint16 val);
uint16 gdsp_mbox_read_h(uint8 mbx);
uint16 gdsp_mbox_read_l(uint8 mbx);
void gdsp_ifx_init();
void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size);
#endif
/*====================================================================
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERFACE_H
#define _GDSP_INTERFACE_H
#include "Globals.h"
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
#define DSP_DSMAH 0xce
#define DSP_DSMAL 0xcf
#define DSP_DSCR 0xc9
#define DSP_DSPA 0xcd
#define DSP_DSBL 0xcb
#define DSP_ACSAH 0xd4
#define DSP_ACSAL 0xd5
#define DSP_ACEAH 0xd6
#define DSP_ACEAL 0xd7
#define DSP_ACCAH 0xd8
#define DSP_ACCAL 0xd9
#define DSP_COEF_A1_0 0xa0
#define DSP_FORMAT 0xd1
#define DSP_PRED_SCALE 0xda
#define DSP_YN1 0xdb
#define DSP_YN2 0xdc
#define DSP_ARAM 0xdd
#define DSP_GAIN 0xde
extern uint16 gdsp_ifx_regs[256];
uint32 gdsp_mbox_peek(uint8 mbx);
void gdsp_mbox_write_h(uint8 mbx, uint16 val);
void gdsp_mbox_write_l(uint8 mbx, uint16 val);
uint16 gdsp_mbox_read_h(uint8 mbx);
uint16 gdsp_mbox_read_l(uint8 mbx);
void gdsp_ifx_init();
void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size);
#endif

View File

@ -1,94 +1,94 @@
/*====================================================================
filename: gdsp_interpreter.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERPRETER_H
#define _GDSP_INTERPRETER_H
#include "Globals.h"
#define DSP_IRAM_SIZE (0x1000)
#define DSP_IRAM_MASK (0x0fff)
#define DSP_IROM_SIZE (0x1000)
#define DSP_IROM_MASK (0x0fff)
#define DSP_DRAM_SIZE (0x1000)
#define DSP_DRAM_MASK (0x0fff)
#define DSP_DROM_SIZE (0x1000)
#define DSP_DROM_MASK (0x0fff)
#define DSP_COEF_SIZE (0x1000)
#define DSP_COEF_MASK (0x0fff)
#define DSP_RESET_VECTOR (0x8000)
#define DSP_STACK_DEPTH 0x20
#define DSP_STACK_MASK 0x1f
struct SDSP
{
static uint16 r[32];
static uint16 pc;
static uint16 err_pc;
static uint16* iram;
static uint16* dram;
static uint16* irom;
static uint16* drom;
static uint16* coef;
static uint8* cpu_ram;
static uint16 cr;
static uint8 reg_stack_ptr[4];
// lets make stack depth to 32 for now
static uint16 reg_stack[4][DSP_STACK_DEPTH];
static void (* irq_request)(void);
// for debugger only
static uint32 iram_crc;
static uint64 step_counter;
static bool exception_in_progress_hack;
};
extern SDSP g_dsp;
void gdsp_init(void);
void gdsp_reset(void);
bool gdsp_load_rom(char* fname);
bool gdsp_load_coef(char* fname);
// steps through DSP code, returns false if error occured
void gdsp_step(void);
void gdsp_loop_step();
bool gdsp_run(void);
bool gdsp_runx(uint16 cnt);
void gdsp_stop(void);
void gdsp_write_cr(uint16 val);
uint16 gdsp_read_cr(void);
uint16* gdsp_get_iram(void);
uint16* gdsp_get_irom(void);
uint16* gdsp_get_dram(void);
uint16* gdsp_get_drom(void);
#endif
/*====================================================================
filename: gdsp_interpreter.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERPRETER_H
#define _GDSP_INTERPRETER_H
#include "Globals.h"
#define DSP_IRAM_SIZE (0x1000)
#define DSP_IRAM_MASK (0x0fff)
#define DSP_IROM_SIZE (0x1000)
#define DSP_IROM_MASK (0x0fff)
#define DSP_DRAM_SIZE (0x1000)
#define DSP_DRAM_MASK (0x0fff)
#define DSP_DROM_SIZE (0x1000)
#define DSP_DROM_MASK (0x0fff)
#define DSP_COEF_SIZE (0x1000)
#define DSP_COEF_MASK (0x0fff)
#define DSP_RESET_VECTOR (0x8000)
#define DSP_STACK_DEPTH 0x20
#define DSP_STACK_MASK 0x1f
struct SDSP
{
static uint16 r[32];
static uint16 pc;
static uint16 err_pc;
static uint16* iram;
static uint16* dram;
static uint16* irom;
static uint16* drom;
static uint16* coef;
static uint8* cpu_ram;
static uint16 cr;
static uint8 reg_stack_ptr[4];
// lets make stack depth to 32 for now
static uint16 reg_stack[4][DSP_STACK_DEPTH];
static void (* irq_request)(void);
// for debugger only
static uint32 iram_crc;
static uint64 step_counter;
static bool exception_in_progress_hack;
};
extern SDSP g_dsp;
void gdsp_init(void);
void gdsp_reset(void);
bool gdsp_load_rom(char* fname);
bool gdsp_load_coef(char* fname);
// steps through DSP code, returns false if error occured
void gdsp_step(void);
void gdsp_loop_step();
bool gdsp_run(void);
bool gdsp_runx(uint16 cnt);
void gdsp_stop(void);
void gdsp_write_cr(uint16 val);
uint16 gdsp_read_cr(void);
uint16* gdsp_get_iram(void);
uint16* gdsp_get_irom(void);
uint16* gdsp_get_dram(void);
uint16* gdsp_get_drom(void);
#endif

View File

@ -1,37 +1,37 @@
/*====================================================================
filename: gdsp_memory.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_MEMORY_H
#define _GDSP_MEMORY_H
#include "Globals.h"
uint16 dsp_fetch_code(void);
uint16 dsp_peek_code(void);
uint16 dsp_imem_read(uint16 addr);
bool dsp_dmem_write(uint16 addr, uint16 val);
uint16 dsp_dmem_read(uint16 addr);
#endif
/*====================================================================
filename: gdsp_memory.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_MEMORY_H
#define _GDSP_MEMORY_H
#include "Globals.h"
uint16 dsp_fetch_code(void);
uint16 dsp_peek_code(void);
uint16 dsp_imem_read(uint16 addr);
bool dsp_dmem_write(uint16 addr, uint16 val);
uint16 dsp_dmem_read(uint16 addr);
#endif

View File

@ -1,50 +1,50 @@
/*====================================================================
filename: gdsp_opcodes.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_H
#define _GDSP_OPCODES_H
#include "Globals.h"
void dsp_op0(uint16 opc);
void dsp_op1(uint16 opc);
void dsp_op2(uint16 opc);
void dsp_op3(uint16 opc);
void dsp_op4(uint16 opc);
void dsp_op5(uint16 opc);
void dsp_op6(uint16 opc);
void dsp_op7(uint16 opc);
void dsp_op8(uint16 opc);
void dsp_op9(uint16 opc);
void dsp_opab(uint16 opc);
void dsp_opcd(uint16 opc);
void dsp_ope(uint16 opc);
void dsp_opf(uint16 opc);
#define R_SR 0x13
#define FLAG_ENABLE_INTERUPT 11
#endif
/*====================================================================
filename: gdsp_opcodes.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_H
#define _GDSP_OPCODES_H
#include "Globals.h"
void dsp_op0(uint16 opc);
void dsp_op1(uint16 opc);
void dsp_op2(uint16 opc);
void dsp_op3(uint16 opc);
void dsp_op4(uint16 opc);
void dsp_op5(uint16 opc);
void dsp_op6(uint16 opc);
void dsp_op7(uint16 opc);
void dsp_op8(uint16 opc);
void dsp_op9(uint16 opc);
void dsp_opab(uint16 opc);
void dsp_opcd(uint16 opc);
void dsp_ope(uint16 opc);
void dsp_opf(uint16 opc);
#define R_SR 0x13
#define FLAG_ENABLE_INTERUPT 11
#endif

View File

@ -1,258 +1,258 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_HELPER_H
#define _GDSP_OPCODES_HELPER_H
#include "Globals.h"
#include "gdsp_opcodes.h"
#include "gdsp_memory.h"
#include "gdsp_interpreter.h"
#include "gdsp_registers.h"
#include "gdsp_ext_op.h"
// ---------------------------------------------------------------------------------------
//
// --- SR
//
// ---------------------------------------------------------------------------------------
inline void dsp_SR_set_flag(uint8 flag)
{
g_dsp.r[R_SR] |= (1 << flag);
}
inline bool dsp_SR_is_flag_set(uint8 flag)
{
return((g_dsp.r[R_SR] & (1 << flag)) > 0);
}
// ---------------------------------------------------------------------------------------
//
// --- reg
//
// ---------------------------------------------------------------------------------------
inline uint16 dsp_op_read_reg(uint8 reg)
{
uint16 val;
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
val = dsp_reg_load_stack(reg - 0x0c);
break;
default:
val = g_dsp.r[reg];
break;
}
return(val);
}
inline void dsp_op_write_reg(uint8 reg, uint16 val)
{
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
dsp_reg_store_stack(reg - 0x0c, val);
break;
default:
g_dsp.r[reg] = val;
break;
}
}
// ---------------------------------------------------------------------------------------
//
// --- prod
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_prod()
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
sint64 val;
sint64 low_prod;
val = (sint8)g_dsp.r[0x16];
val <<= 32;
low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17];
low_prod <<= 16;
low_prod |= g_dsp.r[0x14];
val += low_prod;
return(val);
}
inline void dsp_set_long_prod(sint64 val)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
g_dsp.r[0x14] = (uint16)val;
val >>= 16;
g_dsp.r[0x15] = (uint16)val;
val >>= 16;
g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0;
}
// ---------------------------------------------------------------------------------------
//
// --- acc
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acc(uint8 reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(reg < 2);
sint64 val;
sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline uint64 dsp_get_ulong_acc(uint8 reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(reg < 2);
uint64 val;
uint64 low_acc;
val = (uint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline void dsp_set_long_acc(uint8 _reg, sint64 val)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(_reg < 2);
g_dsp.r[0x1c + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x1e + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x10 + _reg] = (uint16)val;
}
inline sint16 dsp_get_acc_l(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1c + _reg]);
}
inline sint16 dsp_get_acc_m(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1e + _reg]);
}
inline sint16 dsp_get_acc_h(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x10 + _reg]);
}
// ---------------------------------------------------------------------------------------
//
// --- acx
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acx(uint8 _reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(_reg < 2);
sint64 val = (sint16)g_dsp.r[0x1a + _reg];
val <<= 16;
sint64 low_acc = g_dsp.r[0x18 + _reg];
val |= low_acc;
return(val);
}
inline sint16 dsp_get_ax_l(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x18 + _reg]);
}
inline sint16 dsp_get_ax_h(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1a + _reg]);
}
#endif
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_HELPER_H
#define _GDSP_OPCODES_HELPER_H
#include "Globals.h"
#include "gdsp_opcodes.h"
#include "gdsp_memory.h"
#include "gdsp_interpreter.h"
#include "gdsp_registers.h"
#include "gdsp_ext_op.h"
// ---------------------------------------------------------------------------------------
//
// --- SR
//
// ---------------------------------------------------------------------------------------
inline void dsp_SR_set_flag(uint8 flag)
{
g_dsp.r[R_SR] |= (1 << flag);
}
inline bool dsp_SR_is_flag_set(uint8 flag)
{
return((g_dsp.r[R_SR] & (1 << flag)) > 0);
}
// ---------------------------------------------------------------------------------------
//
// --- reg
//
// ---------------------------------------------------------------------------------------
inline uint16 dsp_op_read_reg(uint8 reg)
{
uint16 val;
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
val = dsp_reg_load_stack(reg - 0x0c);
break;
default:
val = g_dsp.r[reg];
break;
}
return(val);
}
inline void dsp_op_write_reg(uint8 reg, uint16 val)
{
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
dsp_reg_store_stack(reg - 0x0c, val);
break;
default:
g_dsp.r[reg] = val;
break;
}
}
// ---------------------------------------------------------------------------------------
//
// --- prod
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_prod()
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
sint64 val;
sint64 low_prod;
val = (sint8)g_dsp.r[0x16];
val <<= 32;
low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17];
low_prod <<= 16;
low_prod |= g_dsp.r[0x14];
val += low_prod;
return(val);
}
inline void dsp_set_long_prod(sint64 val)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
g_dsp.r[0x14] = (uint16)val;
val >>= 16;
g_dsp.r[0x15] = (uint16)val;
val >>= 16;
g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0;
}
// ---------------------------------------------------------------------------------------
//
// --- acc
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acc(uint8 reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(reg < 2);
sint64 val;
sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline uint64 dsp_get_ulong_acc(uint8 reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(reg < 2);
uint64 val;
uint64 low_acc;
val = (uint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline void dsp_set_long_acc(uint8 _reg, sint64 val)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(_reg < 2);
g_dsp.r[0x1c + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x1e + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x10 + _reg] = (uint16)val;
}
inline sint16 dsp_get_acc_l(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1c + _reg]);
}
inline sint16 dsp_get_acc_m(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1e + _reg]);
}
inline sint16 dsp_get_acc_h(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x10 + _reg]);
}
// ---------------------------------------------------------------------------------------
//
// --- acx
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acx(uint8 _reg)
{
#if PROFILE
ProfilerAddDelta(g_dsp.err_pc, 1);
#endif
_assert_(_reg < 2);
sint64 val = (sint16)g_dsp.r[0x1a + _reg];
val <<= 16;
sint64 low_acc = g_dsp.r[0x18 + _reg];
val |= low_acc;
return(val);
}
inline sint16 dsp_get_ax_l(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x18 + _reg]);
}
inline sint16 dsp_get_ax_h(uint8 _reg)
{
_assert_(_reg < 2);
return(g_dsp.r[0x1a + _reg]);
}
#endif

View File

@ -1,42 +1,42 @@
/*====================================================================
filename: gdsp_registers.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_REGISTERS_H
#define _GDSP_REGISTERS_H
#include "Globals.h"
#define DSP_REG_ST0 0x0c
#define DSP_REG_ST1 0x0c
#define DSP_REG_ST2 0x0c
#define DSP_REG_ST3 0x0c
#define DSP_STACK_C 0
#define DSP_STACK_D 1
void dsp_reg_store_stack(uint8 stack_reg, uint16 val);
uint16 dsp_reg_load_stack(uint8 stack_reg);
#endif
/*====================================================================
filename: gdsp_registers.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_REGISTERS_H
#define _GDSP_REGISTERS_H
#include "Globals.h"
#define DSP_REG_ST0 0x0c
#define DSP_REG_ST1 0x0c
#define DSP_REG_ST2 0x0c
#define DSP_REG_ST3 0x0c
#define DSP_STACK_C 0
#define DSP_STACK_D 1
void dsp_reg_store_stack(uint8 stack_reg, uint16 val);
uint16 dsp_reg_load_stack(uint8 stack_reg);
#endif

View File

@ -1,86 +1,86 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _OPCODES_H
#define _OPCODES_H
enum partype_t
{
P_NONE = 0x0000,
P_VAL = 0x0001,
P_IMM = 0x0002,
P_MEM = 0x0003,
P_STR = 0x0004,
P_REG = 0x8000,
P_REG08 = P_REG | 0x0800,
P_REG10 = P_REG | 0x1000,
P_REG18 = P_REG | 0x1800,
P_REG19 = P_REG | 0x1900,
P_REG1A = P_REG | 0x1a00,
P_REG1C = P_REG | 0x1c00,
P_ACCM = P_REG | 0x1e00,
P_ACCM_D = P_REG | 0x1e80,
P_ACC = P_REG | 0x2000,
P_ACC_D = P_REG | 0x2080,
P_AX = P_REG | 0x2200,
P_AX_D = P_REG | 0x2280,
P_REGS_MASK = 0x03f80,
P_REF = P_REG | 0x4000,
P_PRG = P_REF | P_REG,
};
#define P_EXT 0x80
typedef struct opcpar_t
{
partype_t type;
uint8 size;
uint8 loc;
sint8 lshift;
uint16 mask;
} opcpar_t;
typedef struct opc_t
{
const char* name;
uint16 opcode;
uint16 opcode_mask;
uint8 size;
uint8 param_count;
opcpar_t params[8];
} opc_t;
extern opc_t opcodes[];
extern const uint32 opcodes_size;
extern opc_t opcodes_ext[];
extern const uint32 opcodes_ext_size;
inline uint16 swap16(uint16 x)
{
return((x >> 8) | (x << 8));
}
#endif
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _OPCODES_H
#define _OPCODES_H
enum partype_t
{
P_NONE = 0x0000,
P_VAL = 0x0001,
P_IMM = 0x0002,
P_MEM = 0x0003,
P_STR = 0x0004,
P_REG = 0x8000,
P_REG08 = P_REG | 0x0800,
P_REG10 = P_REG | 0x1000,
P_REG18 = P_REG | 0x1800,
P_REG19 = P_REG | 0x1900,
P_REG1A = P_REG | 0x1a00,
P_REG1C = P_REG | 0x1c00,
P_ACCM = P_REG | 0x1e00,
P_ACCM_D = P_REG | 0x1e80,
P_ACC = P_REG | 0x2000,
P_ACC_D = P_REG | 0x2080,
P_AX = P_REG | 0x2200,
P_AX_D = P_REG | 0x2280,
P_REGS_MASK = 0x03f80,
P_REF = P_REG | 0x4000,
P_PRG = P_REF | P_REG,
};
#define P_EXT 0x80
typedef struct opcpar_t
{
partype_t type;
uint8 size;
uint8 loc;
sint8 lshift;
uint16 mask;
} opcpar_t;
typedef struct opc_t
{
const char* name;
uint16 opcode;
uint16 opcode_mask;
uint8 size;
uint8 param_count;
opcpar_t params[8];
} opc_t;
extern opc_t opcodes[];
extern const uint32 opcodes_size;
extern opc_t opcodes_ext[];
extern const uint32 opcodes_ext_size;
inline uint16 swap16(uint16 x)
{
return((x >> 8) | (x << 8));
}
#endif

View File

@ -1,36 +1,36 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include "PluginSpecs_DSP.h"
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include "PluginSpecs_DSP.h"

View File

@ -1,99 +1,99 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DSPHANDLER_H
#define _DSPHANDLER_H
#include "Common.h"
#include "MailHandler.h"
#include "UCodes/UCodes.h"
class CDSPHandler
{
public:
void Update();
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);
IUCode* GetUCode();
void SetUCode(u32 _crc);
CMailHandler& AccessMailHandler() { return m_MailHandler; }
static CDSPHandler& GetInstance()
{
return *m_pInstance;
}
static void Destroy()
{
delete m_pInstance;
m_pInstance = NULL;
}
static CDSPHandler& CreateInstance()
{
if (!m_pInstance)
m_pInstance = new CDSPHandler();
return *m_pInstance;
}
private:
CDSPHandler();
~CDSPHandler();
// UDSPControl
union UDSPControl
{
u16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned DSPInitCode : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(u16 _Hex = 0)
: Hex(_Hex)
{}
};
// singleton instance
static CDSPHandler* m_pInstance;
IUCode* m_pUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;
bool m_bHalt;
bool m_bAssertInt;
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DSPHANDLER_H
#define _DSPHANDLER_H
#include "Common.h"
#include "MailHandler.h"
#include "UCodes/UCodes.h"
class CDSPHandler
{
public:
void Update();
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);
IUCode* GetUCode();
void SetUCode(u32 _crc);
CMailHandler& AccessMailHandler() { return m_MailHandler; }
static CDSPHandler& GetInstance()
{
return *m_pInstance;
}
static void Destroy()
{
delete m_pInstance;
m_pInstance = NULL;
}
static CDSPHandler& CreateInstance()
{
if (!m_pInstance)
m_pInstance = new CDSPHandler();
return *m_pInstance;
}
private:
CDSPHandler();
~CDSPHandler();
// UDSPControl
union UDSPControl
{
u16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned DSPInitCode : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(u16 _Hex = 0)
: Hex(_Hex)
{}
};
// singleton instance
static CDSPHandler* m_pInstance;
IUCode* m_pUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;
bool m_bHalt;
bool m_bAssertInt;
};
#endif

View File

@ -1,46 +1,46 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MAILHANDLER_H
#define _MAILHANDLER_H
#include <queue>
#include "Common.h"
class CMailHandler
{
public:
CMailHandler();
~CMailHandler();
void PushMail(u32 _Mail);
void Clear();
void Halt(bool _Halt);
bool IsEmpty();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
void Update();
private:
// mail handler
std::queue<u32> m_Mails;
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _MAILHANDLER_H
#define _MAILHANDLER_H
#include <queue>
#include "Common.h"
class CMailHandler
{
public:
CMailHandler();
~CMailHandler();
void PushMail(u32 _Mail);
void Clear();
void Halt(bool _Halt);
bool IsEmpty();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
void Update();
private:
// mail handler
std::queue<u32> m_Mails;
};
#endif

View File

@ -1,67 +1,67 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX
#define _UCODE_AX
#include "UCode_AXStructs.h"
class CUCode_AX : public IUCode
{
public:
CUCode_AX(CMailHandler& _rMailHandler, bool wii = false);
virtual ~CUCode_AX();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
void Update();
private:
enum
{
NUMBER_OF_PBS = 64
};
enum
{
MAIL_AX_ALIST = 0xBABE0000,
AXLIST_STUDIOADDR = 0x0000,
AXLIST_PBADDR = 0x0002,
AXLIST_SBUFFER = 0x0007,
AXLIST_COMPRESSORTABLE = 0x000A,
AXLIST_END = 0x000F
};
// PBs
u32 m_addressPBs;
int *templbuffer;
int *temprbuffer;
bool wii_mode;
// ax task message handler
bool AXTask(u32& _uMail);
void SendMail(u32 _uMail);
int ReadOutPBs(AXParamBlock *_pPBs, int _num);
void WriteBackPBs(AXParamBlock *_pPBs, int _num);
s16 ADPCM_Step(AXParamBlock& pb, u32& samplePos, u32 newSamplePos, u16 frac);
};
#endif // _UCODE_AX
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_AX
#define _UCODE_AX
#include "UCode_AXStructs.h"
class CUCode_AX : public IUCode
{
public:
CUCode_AX(CMailHandler& _rMailHandler, bool wii = false);
virtual ~CUCode_AX();
void HandleMail(u32 _uMail);
void MixAdd(short* _pBuffer, int _iSize);
void Update();
private:
enum
{
NUMBER_OF_PBS = 64
};
enum
{
MAIL_AX_ALIST = 0xBABE0000,
AXLIST_STUDIOADDR = 0x0000,
AXLIST_PBADDR = 0x0002,
AXLIST_SBUFFER = 0x0007,
AXLIST_COMPRESSORTABLE = 0x000A,
AXLIST_END = 0x000F
};
// PBs
u32 m_addressPBs;
int *templbuffer;
int *temprbuffer;
bool wii_mode;
// ax task message handler
bool AXTask(u32& _uMail);
void SendMail(u32 _uMail);
int ReadOutPBs(AXParamBlock *_pPBs, int _num);
void WriteBackPBs(AXParamBlock *_pPBs, int _num);
s16 ADPCM_Step(AXParamBlock& pb, u32& samplePos, u32 newSamplePos, u16 frac);
};
#endif // _UCODE_AX

View File

@ -1,141 +1,141 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef UCODE_AX_STRUCTS
#define UCODE_AX_STRUCTS
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBInitialTimeDelay
{
u16 unknown[7];
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUnknown
{
s16 unknown[9];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 unknown;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 unknown1;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBUnknown unknown2;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef UCODE_AX_STRUCTS
#define UCODE_AX_STRUCTS
struct PBMixer
{
u16 volume_left;
u16 unknown;
u16 volume_right;
u16 unknown2;
u16 unknown3[8];
u16 unknown4[6];
};
struct PBInitialTimeDelay
{
u16 unknown[7];
};
// Update data - read these each 1ms subframe and use them!
// It seems that to provide higher time precisions for MIDI events, some games
// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms).
// Using this data should fix games that are missing MIDI notes.
struct PBUpdates
{
u16 num_updates[5];
u16 data_hi; // These point to main RAM. Not sure about the structure of the data.
u16 data_lo;
};
struct PBUnknown
{
s16 unknown[9];
};
struct PBVolumeEnvelope
{
u16 cur_volume;
s16 cur_volume_delta;
};
struct PBUnknown2
{
u16 unknown_reserved[3];
};
struct PBAudioAddr
{
u16 looping;
u16 sample_format;
u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active)
u16 loop_addr_lo;
u16 end_addr_hi; // End of sample (and loop), inclusive
u16 end_addr_lo;
u16 cur_addr_hi;
u16 cur_addr_lo;
};
struct PBADPCMInfo
{
s16 coefs[16];
u16 unknown;
u16 pred_scale;
s16 yn1;
s16 yn2;
};
struct PBSampleRateConverter
{
u16 ratio_hi;
u16 ratio_lo;
u16 cur_addr_frac;
u16 last_samples[4];
};
struct PBADPCMLoopInfo
{
u16 pred_scale;
u16 yn1;
u16 yn2;
};
struct AXParamBlock
{
u16 next_pb_hi;
u16 next_pb_lo;
u16 this_pb_hi;
u16 this_pb_lo;
u16 src_type; // Type of sample rate converter (none, ?, linear)
u16 unknown1;
u16 mixer_control;
u16 running; // 1=RUN 0=STOP
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBUnknown unknown2;
PBVolumeEnvelope vol_env;
PBUnknown2 unknown3;
PBAudioAddr audio_addr;
PBADPCMInfo adpcm;
PBSampleRateConverter src;
PBADPCMLoopInfo adpcm_loop_info;
u16 unknown_maybe_padding[3];
};
enum {
AUDIOFORMAT_ADPCM = 0,
AUDIOFORMAT_PCM8 = 0x19,
AUDIOFORMAT_PCM16 = 0xA,
};
enum {
SRCTYPE_LINEAR = 1,
SRCTYPE_NEAREST = 2,
MIXCONTROL_RAMPING = 8,
};
#endif

View File

@ -1,45 +1,45 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_CARD_H
#define _UCODE_CARD_H
#include "UCodes.h"
class CUCode_CARD : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
public:
CUCode_CARD(CMailHandler& _rMailHandler);
virtual ~CUCode_CARD();
void HandleMail(u32 _uMail);
void Update();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_CARD_H
#define _UCODE_CARD_H
#include "UCodes.h"
class CUCode_CARD : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
public:
CUCode_CARD(CMailHandler& _rMailHandler);
virtual ~CUCode_CARD();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -1,54 +1,54 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_INITAUDIOSYSTEM
#define _UCODE_INITAUDIOSYSTEM
#include "UCodes.h"
class CUCode_InitAudioSystem : public IUCode
{
public:
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Init();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
bool IsInitialized;
void BootUCode();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_INITAUDIOSYSTEM
#define _UCODE_INITAUDIOSYSTEM
#include "UCodes.h"
class CUCode_InitAudioSystem : public IUCode
{
public:
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Init();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
bool IsInitialized;
void BootUCode();
};
#endif

View File

@ -1,74 +1,74 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_JAC
#define _UCODE_JAC
#include "UCodes.h"
class CUCode_Jac : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
bool m_bListInProgress;
int m_numSteps;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
// Hmm, don't these need bswaps?
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
CUCode_Jac(CMailHandler& _rMailHandler);
virtual ~CUCode_Jac();
void HandleMail(u32 _uMail);
void Update();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_JAC
#define _UCODE_JAC
#include "UCodes.h"
class CUCode_Jac : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
bool m_bListInProgress;
int m_numSteps;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
// Hmm, don't these need bswaps?
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
CUCode_Jac(CMailHandler& _rMailHandler);
virtual ~CUCode_Jac();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -1,51 +1,51 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ROM
#define _UCODE_ROM
#include "UCodes.h"
class CUCode_Rom : public IUCode
{
public:
CUCode_Rom(CMailHandler& _rMailHandler);
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
void BootUCode();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ROM
#define _UCODE_ROM
#include "UCodes.h"
class CUCode_Rom : public IUCode
{
public:
CUCode_Rom(CMailHandler& _rMailHandler);
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
void BootUCode();
};
#endif

View File

@ -1,74 +1,74 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ZELDA_H
#define _UCODE_ZELDA_H
#include "Common.h"
#include "UCodes.h"
class CUCode_Zelda : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progress
u32 m_numSteps;
bool m_bListInProgress;
u32 m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return m_Buffer[m_readOffset++];
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return res;
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return res;
}
public:
CUCode_Zelda(CMailHandler& _rMailHandler);
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODE_ZELDA_H
#define _UCODE_ZELDA_H
#include "Common.h"
#include "UCodes.h"
class CUCode_Zelda : public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progress
u32 m_numSteps;
bool m_bListInProgress;
u32 m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return m_Buffer[m_readOffset++];
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return res;
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return res;
}
public:
CUCode_Zelda(CMailHandler& _rMailHandler);
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -1,48 +1,48 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODES_H
#define _UCODES_H
#include "Common.h"
#define UCODE_ROM 0x0000000
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
class CMailHandler;
class IUCode
{
public:
IUCode(CMailHandler& _rMailHandler)
: m_rMailHandler(_rMailHandler)
{}
virtual ~IUCode()
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:
CMailHandler& m_rMailHandler;
};
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UCODES_H
#define _UCODES_H
#include "Common.h"
#define UCODE_ROM 0x0000000
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
class CMailHandler;
class IUCode
{
public:
IUCode(CMailHandler& _rMailHandler)
: m_rMailHandler(_rMailHandler)
{}
virtual ~IUCode()
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:
CMailHandler& m_rMailHandler;
};
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler);
#endif

View File

@ -1,44 +1,44 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DIRECTINPUTBASE_H
#define _DIRECTINPUTBASE_H
class DInput
{
public:
DInput();
~DInput();
static void DInput::DIKToString(unsigned int keycode, char *keyStr);
HRESULT Init(HWND hWnd);
void Free();
HRESULT Read();
BYTE diks[256]; // DirectInput keyboard state buffer
private:
LPDIRECTINPUT8 g_pDI; // The DirectInput object
LPDIRECTINPUTDEVICE8 g_pKeyboard; // The keyboard device
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DIRECTINPUTBASE_H
#define _DIRECTINPUTBASE_H
class DInput
{
public:
DInput();
~DInput();
static void DInput::DIKToString(unsigned int keycode, char *keyStr);
HRESULT Init(HWND hWnd);
void Free();
HRESULT Read();
BYTE diks[256]; // DirectInput keyboard state buffer
private:
LPDIRECTINPUT8 g_pDI; // The DirectInput object
LPDIRECTINPUTDEVICE8 g_pKeyboard; // The keyboard device
};
#endif

View File

@ -1,34 +1,34 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <vector>
#include <xstring>
// DInput
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <vector>
#include <xstring>
// DInput
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>

View File

@ -1,29 +1,29 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BPSTRUCTS_H
#define _BPSTRUCTS_H
#pragma pack(4)
#include "BPMemory.h"
void BPInit();
void LoadBPReg(u32 value0);
void ActivateTextures();
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BPSTRUCTS_H
#define _BPSTRUCTS_H
#pragma pack(4)
#include "BPMemory.h"
void BPInit();
void LoadBPReg(u32 value0);
void ActivateTextures();
#endif

View File

@ -1,29 +1,29 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CPSTRUCTS_H
#define _CPSTRUCTS_H
#include "Common.h"
#include "CPMemory.h"
#include "XFMemory.h"
void CPUpdateMatricesA();
void CPUpdateMatricesB();
void LoadCPReg(u32 SubCmd, u32 Value);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CPSTRUCTS_H
#define _CPSTRUCTS_H
#include "Common.h"
#include "CPMemory.h"
#include "XFMemory.h"
void CPUpdateMatricesA();
void CPUpdateMatricesB();
void LoadCPReg(u32 SubCmd, u32 Value);
#endif

View File

@ -1,67 +1,67 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <string>
struct Config
{
Config();
void Load();
void Save();
int iAdapter;
int iFSResolution;
int iMultisampleMode;
int iPostprocessEffect;
int iCompileDLsLevel;
bool renderToMainframe;
bool bFullscreen;
bool bVsync;
bool bWireFrame;
bool bOverlayStats;
bool bDumpTextures;
bool bOldCard;
bool bShowShaderErrors;
//enhancements
bool bForceFiltering;
bool bForceMaxAniso;
bool bPreUpscale;
int iPreUpscaleFilter;
bool bTruform;
int iTruformLevel;
int iWindowedRes;
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
std::string texDumpPath;
};
extern Config g_Config;
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include <string>
struct Config
{
Config();
void Load();
void Save();
int iAdapter;
int iFSResolution;
int iMultisampleMode;
int iPostprocessEffect;
int iCompileDLsLevel;
bool renderToMainframe;
bool bFullscreen;
bool bVsync;
bool bWireFrame;
bool bOverlayStats;
bool bDumpTextures;
bool bOldCard;
bool bShowShaderErrors;
//enhancements
bool bForceFiltering;
bool bForceMaxAniso;
bool bPreUpscale;
int iPreUpscaleFilter;
bool bTruform;
int iTruformLevel;
int iWindowedRes;
char psProfile[16];
char vsProfile[16];
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
std::string texDumpPath;
};
extern Config g_Config;
#endif

View File

@ -1,97 +1,97 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _D3DBASE_H
#define _D3DBASE_H
#include <d3d9.h>
#include <vector>
#include <set>
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#endif
#include "Common.h"
namespace D3D
{
enum ShaderVersion
{
PSNONE = 0,
PS20 = 2,
PS30 = 3,
PS40 = 4,
};
HRESULT Init();
HRESULT Create(int adapter, HWND wnd, bool fullscreen, int resolution, int aa_mode);
void Close();
void Shutdown();
void Reset();
bool BeginFrame(bool clear=true, u32 color=0, float z=1.0f);
void EndFrame();
void SwitchFullscreen(bool fullscreen);
bool IsFullscreen();
int GetDisplayWidth();
int GetDisplayHeight();
ShaderVersion GetShaderVersion();
LPDIRECT3DSURFACE9 GetBackBufferSurface();
const D3DCAPS9 &GetCaps();
extern IDirect3DDevice9 *dev;
void ShowD3DError(HRESULT err);
void EnableAlphaToCoverage();
struct Resolution
{
char name[32];
int xres;
int yres;
std::set<D3DFORMAT> bitdepths;
std::set<int> refreshes;
};
struct AALevel
{
AALevel(const char *n, D3DMULTISAMPLE_TYPE m, int q) {strcpy(name, n); ms_setting=m; qual_setting=q;}
char name[32];
D3DMULTISAMPLE_TYPE ms_setting;
int qual_setting;
};
struct Adapter
{
D3DADAPTER_IDENTIFIER9 ident;
std::vector<Resolution> resolutions;
std::vector<AALevel> aa_levels;
bool supports_alpha_to_coverage;
};
struct Shader
{
int Minor;
int Major;
};
const Adapter &GetAdapter(int i);
const Adapter &GetCurAdapter();
int GetNumAdapters();
}
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _D3DBASE_H
#define _D3DBASE_H
#include <d3d9.h>
#include <vector>
#include <set>
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#endif
#include "Common.h"
namespace D3D
{
enum ShaderVersion
{
PSNONE = 0,
PS20 = 2,
PS30 = 3,
PS40 = 4,
};
HRESULT Init();
HRESULT Create(int adapter, HWND wnd, bool fullscreen, int resolution, int aa_mode);
void Close();
void Shutdown();
void Reset();
bool BeginFrame(bool clear=true, u32 color=0, float z=1.0f);
void EndFrame();
void SwitchFullscreen(bool fullscreen);
bool IsFullscreen();
int GetDisplayWidth();
int GetDisplayHeight();
ShaderVersion GetShaderVersion();
LPDIRECT3DSURFACE9 GetBackBufferSurface();
const D3DCAPS9 &GetCaps();
extern IDirect3DDevice9 *dev;
void ShowD3DError(HRESULT err);
void EnableAlphaToCoverage();
struct Resolution
{
char name[32];
int xres;
int yres;
std::set<D3DFORMAT> bitdepths;
std::set<int> refreshes;
};
struct AALevel
{
AALevel(const char *n, D3DMULTISAMPLE_TYPE m, int q) {strcpy(name, n); ms_setting=m; qual_setting=q;}
char name[32];
D3DMULTISAMPLE_TYPE ms_setting;
int qual_setting;
};
struct Adapter
{
D3DADAPTER_IDENTIFIER9 ident;
std::vector<Resolution> resolutions;
std::vector<AALevel> aa_levels;
bool supports_alpha_to_coverage;
};
struct Shader
{
int Minor;
int Major;
};
const Adapter &GetAdapter(int i);
const Adapter &GetCurAdapter();
int GetNumAdapters();
}
#endif

View File

@ -1,33 +1,33 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
namespace Postprocess
{
void Initialize();
void Cleanup();
void BeginFrame();
void FinalizeFrame();
int GetWidth();
int GetHeight();
const char **GetPostprocessingNames();
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
namespace Postprocess
{
void Initialize();
void Cleanup();
void BeginFrame();
void FinalizeFrame();
int GetWidth();
int GetHeight();
const char **GetPostprocessingNames();
}

View File

@ -1,26 +1,26 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len);
LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len);
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len);
LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len);
}

View File

@ -1,28 +1,28 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int height, const int pitch, D3DFORMAT fmt = D3DFMT_A8R8G8B8);
void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int width, const int height,const int pitch, D3DFORMAT fmt);
LPDIRECT3DTEXTURE9 CreateRenderTarget(const int width, const int height);
LPDIRECT3DSURFACE9 CreateDepthStencilSurface(const int width, const int height);
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int height, const int pitch, D3DFORMAT fmt = D3DFMT_A8R8G8B8);
void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int width, const int height,const int pitch, D3DFORMAT fmt);
LPDIRECT3DTEXTURE9 CreateRenderTarget(const int width, const int height);
LPDIRECT3DSURFACE9 CreateDepthStencilSurface(const int width, const int height);
}

View File

@ -1,61 +1,61 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
// Font creation flags
#define D3DFONT_BOLD 0x0001
#define D3DFONT_ITALIC 0x0002
// Font rendering flags
#define D3DFONT_CENTERED 0x0001
//a cut-down variant of the DXSDK CD3DFont class
class CD3DFont
{
LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font
LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text
//int m_dwTexWidth; // Texture dimensions
//int m_dwTexHeight;
float m_fTextScale;
float m_fTexCoords[128-32][4];
public:
CD3DFont();
// 2D (no longer 3D) text drawing function
// Initializing and destroying device-dependent objects
void SetRenderStates();
int Init();
int Shutdown();
int DrawTextScaled( float x, float y,
float fXScale, float fYScale,
float spacing, u32 dwColor,
const char* strText, bool center=true );
// Constructor / destructor
//~CD3DFont();
};
extern CD3DFont font;
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1);
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
namespace D3D
{
// Font creation flags
#define D3DFONT_BOLD 0x0001
#define D3DFONT_ITALIC 0x0002
// Font rendering flags
#define D3DFONT_CENTERED 0x0001
//a cut-down variant of the DXSDK CD3DFont class
class CD3DFont
{
LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font
LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text
//int m_dwTexWidth; // Texture dimensions
//int m_dwTexHeight;
float m_fTextScale;
float m_fTexCoords[128-32][4];
public:
CD3DFont();
// 2D (no longer 3D) text drawing function
// Initializing and destroying device-dependent objects
void SetRenderStates();
int Init();
int Shutdown();
int DrawTextScaled( float x, float y,
float fXScale, float fYScale,
float spacing, u32 dwColor,
const char* strText, bool center=true );
// Constructor / destructor
//~CD3DFont();
};
extern CD3DFont font;
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1);
}

View File

@ -1,72 +1,72 @@
#pragma once
#if 0
#include "D3DBase.h"
#include "DecodedVArray.h"
#include <map>
class CompiledDList
{
u32 *data;
int dataSize;
int pass;
int codeSize;
u8 *code;
struct Batch
{
DecodedVArray varray;
LPDIRECT3DINDEXBUFFER9 ibuffer;
int numDraws;
};
Batch *batches;
int numBatches;
u32 addr, size;
bool Compile();
bool Pass1();
void Pass2();
void Run();
public:
CompiledDList(u32 _addr, u32 _size);
~CompiledDList();
bool Call();
static void DrawHelperHelper(CompiledDList *dl, int vno, int prim);
};
class DListCache
{
struct DLCacheEntry
{
CompiledDList *dlist;
int frameCount;
int pass;
u32 size;
DLCacheEntry()
{
pass=0;
dlist=0;
frameCount=0;
}
void Destroy()
{
if (dlist)
delete dlist;
}
};
typedef std::map<DWORD,DLCacheEntry> DLCache;
static DLCache dlists;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Call(u32 _addr, u32 _size);
};
#pragma once
#if 0
#include "D3DBase.h"
#include "DecodedVArray.h"
#include <map>
class CompiledDList
{
u32 *data;
int dataSize;
int pass;
int codeSize;
u8 *code;
struct Batch
{
DecodedVArray varray;
LPDIRECT3DINDEXBUFFER9 ibuffer;
int numDraws;
};
Batch *batches;
int numBatches;
u32 addr, size;
bool Compile();
bool Pass1();
void Pass2();
void Run();
public:
CompiledDList(u32 _addr, u32 _size);
~CompiledDList();
bool Call();
static void DrawHelperHelper(CompiledDList *dl, int vno, int prim);
};
class DListCache
{
struct DLCacheEntry
{
CompiledDList *dlist;
int frameCount;
int pass;
u32 size;
DLCacheEntry()
{
pass=0;
dlist=0;
frameCount=0;
}
void Destroy()
{
if (dlist)
delete dlist;
}
};
typedef std::map<DWORD,DLCacheEntry> DLCache;
static DLCache dlists;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Call(u32 _addr, u32 _size);
};
#endif

View File

@ -1,114 +1,114 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DECODED_VARRAY_H
#define _DECODED_VARRAY_H
#include "Vec3.h"
#include "Common.h"
typedef Vec3 DecPos;
typedef Vec3 DecNormal;
struct DecUV
{
float u,v;
};
typedef u32 DecColor;
typedef u8 DecMtxInd;
int ComputeVertexSize(u32 components);
//TODO(ector): Change the internal implementation to pack it tight according to components
// The tight packing will be fed directly to the gfx card in the mystic future.
class DecodedVArray
{
int size;
u32 components;
int vertexSize;
public:
int count;
DecodedVArray();
~DecodedVArray();
void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components);
ComputeComponents(); }
u32 GetComponents() const {return components;}
void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount);
void Zero();
void Destroy();
void Reset() {count=0;}
int GetSize() {return size;}
int GetCount() {return count;}
void Next() {count++;}
void SetPosNrmIdx(int i) {posMtxInds[count] = i;}
void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;}
void SetPosX(float x) {positions[count].x=x;}
void SetPosY(float y) {positions[count].y=y;}
void SetPosZ(float z) {positions[count].z=z;}
void SetNormalX(int n,float x) {normals[n][count].x=x;}
void SetNormalY(int n,float y) {normals[n][count].y=y;}
void SetNormalZ(int n,float z) {normals[n][count].z=z;}
void SetU(int n, float u) {uvs[n][count].u = u;}
void SetV(int n, float v) {uvs[n][count].v = v;}
void SetPosition(float x, float y, float z) {
positions[count].x=x;
positions[count].y=y;
positions[count].z=z;
}
void SetNormal(int n, float x, float y, float z) {
normals[n][count].x=x;
normals[n][count].y=y;
normals[n][count].z=z;
}
void SetColor(int n, u32 c)
{
colors[n][count] = c;
}
void SetUV(int n, float u, float v) {
uvs[n][count].u=u;
uvs[n][count].v=v;
}
void ComputeComponents() {
hasPosMatIdx = (components & (1 << 1)) != 0;
for(int i = 0; i < 8; i++)
hasTexMatIdx[i] = (components & (1 << (i + 2))) != 0;
hasNrm = (components & (1 << 10)) != 0;
}
const DecPos &GetPos(int n) const { return positions[n]; }
const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; }
const DecColor &GetColor(int i, int n) const { return colors[i][n]; }
const DecUV &GetUV(int i, int n) const { return uvs[i][n]; }
const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; }
const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; }
//private:
DecPos *positions;
DecNormal *normals[3];
DecColor *colors[2];
DecUV *uvs[8];
DecMtxInd *posMtxInds;
DecMtxInd *texMtxInds[8];
// Component data
bool hasPosMatIdx, hasTexMatIdx[8], hasNrm;
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DECODED_VARRAY_H
#define _DECODED_VARRAY_H
#include "Vec3.h"
#include "Common.h"
typedef Vec3 DecPos;
typedef Vec3 DecNormal;
struct DecUV
{
float u,v;
};
typedef u32 DecColor;
typedef u8 DecMtxInd;
int ComputeVertexSize(u32 components);
//TODO(ector): Change the internal implementation to pack it tight according to components
// The tight packing will be fed directly to the gfx card in the mystic future.
class DecodedVArray
{
int size;
u32 components;
int vertexSize;
public:
int count;
DecodedVArray();
~DecodedVArray();
void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components);
ComputeComponents(); }
u32 GetComponents() const {return components;}
void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount);
void Zero();
void Destroy();
void Reset() {count=0;}
int GetSize() {return size;}
int GetCount() {return count;}
void Next() {count++;}
void SetPosNrmIdx(int i) {posMtxInds[count] = i;}
void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;}
void SetPosX(float x) {positions[count].x=x;}
void SetPosY(float y) {positions[count].y=y;}
void SetPosZ(float z) {positions[count].z=z;}
void SetNormalX(int n,float x) {normals[n][count].x=x;}
void SetNormalY(int n,float y) {normals[n][count].y=y;}
void SetNormalZ(int n,float z) {normals[n][count].z=z;}
void SetU(int n, float u) {uvs[n][count].u = u;}
void SetV(int n, float v) {uvs[n][count].v = v;}
void SetPosition(float x, float y, float z) {
positions[count].x=x;
positions[count].y=y;
positions[count].z=z;
}
void SetNormal(int n, float x, float y, float z) {
normals[n][count].x=x;
normals[n][count].y=y;
normals[n][count].z=z;
}
void SetColor(int n, u32 c)
{
colors[n][count] = c;
}
void SetUV(int n, float u, float v) {
uvs[n][count].u=u;
uvs[n][count].v=v;
}
void ComputeComponents() {
hasPosMatIdx = (components & (1 << 1)) != 0;
for(int i = 0; i < 8; i++)
hasTexMatIdx[i] = (components & (1 << (i + 2))) != 0;
hasNrm = (components & (1 << 10)) != 0;
}
const DecPos &GetPos(int n) const { return positions[n]; }
const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; }
const DecColor &GetColor(int i, int n) const { return colors[i][n]; }
const DecUV &GetUV(int i, int n) const { return uvs[i][n]; }
const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; }
const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; }
//private:
DecPos *positions;
DecNormal *normals[3];
DecColor *colors[2];
DecUV *uvs[8];
DecMtxInd *posMtxInds;
DecMtxInd *texMtxInds[8];
// Component data
bool hasPosMatIdx, hasTexMatIdx[8], hasNrm;
};
#endif

View File

@ -1,20 +1,20 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
void DlgSettings_Show(HINSTANCE hInstance, HWND parent);

View File

@ -1,16 +1,16 @@
#ifndef _EMUWINDOW_H
#define _EMUWINDOW_H
#include <windows.h>
namespace EmuWindow
{
HWND GetWnd();
HWND GetParentWnd();
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
void Show();
void Close();
void SetSize(int displayWidth, int displayHeight);
}
#endif
#ifndef _EMUWINDOW_H
#define _EMUWINDOW_H
#include <windows.h>
namespace EmuWindow
{
HWND GetWnd();
HWND GetParentWnd();
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
void Show();
void Close();
void SetSize(int displayWidth, int displayHeight);
}
#endif

View File

@ -1,36 +1,36 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
class IndexGenerator
{
unsigned short *ptr;
int numPrims;
int index;
public:
void Start(unsigned short *startptr);
void AddList(int numVerts);
void AddStrip(int numVerts);
void AddLineList(int numVerts);
void AddPointList(int numVerts); //dummy for counting vertices
void AddLineStrip(int numVerts);
void AddFan(int numVerts);
void AddQuads(int numVerts);
int GetNumPrims() {return numPrims;} //returns numprimitives
int GetNumVerts() {return index;} //returns numprimitives
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
class IndexGenerator
{
unsigned short *ptr;
int numPrims;
int index;
public:
void Start(unsigned short *startptr);
void AddList(int numVerts);
void AddStrip(int numVerts);
void AddLineList(int numVerts);
void AddPointList(int numVerts); //dummy for counting vertices
void AddLineStrip(int numVerts);
void AddFan(int numVerts);
void AddQuads(int numVerts);
int GetNumPrims() {return numPrims;} //returns numprimitives
int GetNumVerts() {return index;} //returns numprimitives
};

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Common.h"
#include "D3DShader.h"
const char *GeneratePixelShader();
#define PS_CONST_COLORS 0
#define PS_CONST_KCOLORS 4
#define PS_CONST_CONSTALPHA 8
#define PS_CONST_ALPHAREF 9 // x,y
#define PS_CONST_INDMTXSTART 10
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Common.h"
#include "D3DShader.h"
const char *GeneratePixelShader();
#define PS_CONST_COLORS 0
#define PS_CONST_KCOLORS 4
#define PS_CONST_CONSTALPHA 8
#define PS_CONST_ALPHAREF 9 // x,y
#define PS_CONST_INDMTXSTART 10
#define PS_CONST_INDSIZE 2

View File

@ -1,84 +1,84 @@
#ifndef _RGBAFLOAT_H
#define _RGBAFLOAT_H
struct RGBAFloat
{
float r,g,b,a;
RGBAFloat(){a=r=g=b=1.0f;}
RGBAFloat(float _r, float _g, float _b, float _a)
{
r=_r;g=_g;b=_b;a=_a;
}
void clamp()
{
if (r>1) r=1;
if (g>1) g=1;
if (b>1) b=1;
if (a>1) a=1;
if (r<0) r=0;
if (g<0) g=0;
if (b<0) b=0;
if (a<0) a=0;
}
void convertToD3DColor(u32 &color)
{
clamp();
color = (int(a*255)<<24) | (int(r*255)<<16) | (int(g*255)<<8) | (int(b*255));
}
void convertRGB_GC(u32 color)
{
r=((color>>24)&0xFF)/255.0f;
g=((color>>16)&0xFF)/255.0f;
b=((color>>8)&0xFF)/255.0f;
}
void convertRGB(u32 color)
{
r=((color>>16)&0xFF)/255.0f;
g=((color>>8)&0xFF)/255.0f;
b=((color)&0xFF)/255.0f;
}
void convertA(u32 color)
{
a=((color>>24)&0xFF)/255.0f;
}
void convertA_GC(u32 color)
{
a=((color)&0xFF)/255.0f;
}
void convert(u32 color)
{
convertRGB(color);
convertA(color);
}
void convert_GC(u32 color)
{
convertRGB_GC(color);
convertA_GC(color);
}
void operator *=(float f)
{
r*=f;g*=f;b*=f; a*=f;
}
RGBAFloat operator *(float f)
{
return RGBAFloat(r*f,g*f,b*f,a*f);
}
RGBAFloat operator *(RGBAFloat &o)
{
return RGBAFloat(r*o.r,g*o.g,b*o.b,a*o.a);
}
void operator *=(RGBAFloat &o)
{
r*=o.r;g*=o.g;b*=o.b;a*=o.a;
}
RGBAFloat operator +(RGBAFloat &o)
{
return RGBAFloat(r+o.r,g+o.g,b+o.b,a+o.a);
}
void operator +=(RGBAFloat &o)
{
r+=o.r;g+=o.g;b+=o.b;a+=o.a;
}
};
#ifndef _RGBAFLOAT_H
#define _RGBAFLOAT_H
struct RGBAFloat
{
float r,g,b,a;
RGBAFloat(){a=r=g=b=1.0f;}
RGBAFloat(float _r, float _g, float _b, float _a)
{
r=_r;g=_g;b=_b;a=_a;
}
void clamp()
{
if (r>1) r=1;
if (g>1) g=1;
if (b>1) b=1;
if (a>1) a=1;
if (r<0) r=0;
if (g<0) g=0;
if (b<0) b=0;
if (a<0) a=0;
}
void convertToD3DColor(u32 &color)
{
clamp();
color = (int(a*255)<<24) | (int(r*255)<<16) | (int(g*255)<<8) | (int(b*255));
}
void convertRGB_GC(u32 color)
{
r=((color>>24)&0xFF)/255.0f;
g=((color>>16)&0xFF)/255.0f;
b=((color>>8)&0xFF)/255.0f;
}
void convertRGB(u32 color)
{
r=((color>>16)&0xFF)/255.0f;
g=((color>>8)&0xFF)/255.0f;
b=((color)&0xFF)/255.0f;
}
void convertA(u32 color)
{
a=((color>>24)&0xFF)/255.0f;
}
void convertA_GC(u32 color)
{
a=((color)&0xFF)/255.0f;
}
void convert(u32 color)
{
convertRGB(color);
convertA(color);
}
void convert_GC(u32 color)
{
convertRGB_GC(color);
convertA_GC(color);
}
void operator *=(float f)
{
r*=f;g*=f;b*=f; a*=f;
}
RGBAFloat operator *(float f)
{
return RGBAFloat(r*f,g*f,b*f,a*f);
}
RGBAFloat operator *(RGBAFloat &o)
{
return RGBAFloat(r*o.r,g*o.g,b*o.b,a*o.a);
}
void operator *=(RGBAFloat &o)
{
r*=o.r;g*=o.g;b*=o.b;a*=o.a;
}
RGBAFloat operator +(RGBAFloat &o)
{
return RGBAFloat(r+o.r,g+o.g,b+o.b,a+o.a);
}
void operator +=(RGBAFloat &o)
{
r+=o.r;g+=o.g;b+=o.b;a+=o.a;
}
};
#endif

View File

@ -1,123 +1,123 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __H_RENDER__
#define __H_RENDER__
#include "PluginSpecs_Video.h"
#include <vector>
#include <string>
#include "D3DBase.h"
class Renderer
{
// screen offset
static float m_x,m_y,m_width, m_height,xScale,yScale;
const static int MaxTextureStages = 9;
const static int MaxRenderStates = 210;
const static DWORD MaxTextureTypes = 33;
const static DWORD MaxSamplerSize = 13;
const static DWORD MaxSamplerTypes = 15;
static std::vector<LPDIRECT3DBASETEXTURE9> m_Textures;
static DWORD m_RenderStates[MaxRenderStates];
static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes];
static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes];
static DWORD m_FVF;
public:
static void Init(SVideoInitialize &_VideoInitialize);
static void Shutdown();
// initialize opengl standard values (like view port)
static void Initialize(void);
// must be called if the window size has changed
static void ReinitView(void);
//
// --- Render Functions ---
//
static void SwapBuffers(void);
static void Flush(void);
static float GetXScale(){return xScale;}
static float GetYScale(){return yScale;}
static void SetScissorBox(RECT &rc);
static void SetViewport(float* _Viewport);
static void SetProjection(float* _pProjection, int constantIndex = -1);
static void AddMessage(const std::string &message, unsigned int ms);
static void ProcessMessages();
static void RenderText(const std::string &text, int left, int top, unsigned int color);
/**
* Assigns a texture to a device stage.
* @param Stage Stage to assign to.
* @param pTexture Texture to be assigned.
*/
static void SetTexture( DWORD Stage, IDirect3DBaseTexture9 *pTexture );
/**
* Sets the current vertex stream declaration.
* @param FVF Fixed function vertex type
*/
static void SetFVF( DWORD FVF );
/**
* Sets a single device render-state parameter.
* @param State Device state variable that is being modified.
* @param Value New value for the device render state to be set.
*/
static void SetRenderState( D3DRENDERSTATETYPE State, DWORD Value );
/**
* Sets the state value for the currently assigned texture.
* @param Stage Stage identifier of the texture for which the state value is set.
* @param Type Texture state to set.
* @param Value State value to set.
*/
static void SetTextureStageState( DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,DWORD Value );
/**
* Sets the sampler state value.
* @param Sampler The sampler stage index.
* @param Type Type of the sampler.
* @param Value State value to set.
*/
static void SetSamplerState( DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value );
/**
* Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type.
* @param PrimitiveType Type of primitive to render.
* @param PrimitiveCount Number of primitives to render.
* @param pVertexStreamZeroData User memory pointer to the vertex data.
* @param VertexStreamZeroStride The number of bytes of data for each vertex.
*/
static void DrawPrimitiveUP( D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
const void* pVertexStreamZeroData, UINT VertexStreamZeroStride );
/**
* Renders a sequence of non indexed, geometric primitives of the specified type from the current set of data input streams.
* @param PrimitiveType Type of primitive to render.
* @param StartVertex Index of the first vertex to load.
* @param PrimitiveCount Number of primitives to render.
*/
static void DrawPrimitive( D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount );
};
#endif // __H_RENDER__
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __H_RENDER__
#define __H_RENDER__
#include "PluginSpecs_Video.h"
#include <vector>
#include <string>
#include "D3DBase.h"
class Renderer
{
// screen offset
static float m_x,m_y,m_width, m_height,xScale,yScale;
const static int MaxTextureStages = 9;
const static int MaxRenderStates = 210;
const static DWORD MaxTextureTypes = 33;
const static DWORD MaxSamplerSize = 13;
const static DWORD MaxSamplerTypes = 15;
static std::vector<LPDIRECT3DBASETEXTURE9> m_Textures;
static DWORD m_RenderStates[MaxRenderStates];
static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes];
static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes];
static DWORD m_FVF;
public:
static void Init(SVideoInitialize &_VideoInitialize);
static void Shutdown();
// initialize opengl standard values (like view port)
static void Initialize(void);
// must be called if the window size has changed
static void ReinitView(void);
//
// --- Render Functions ---
//
static void SwapBuffers(void);
static void Flush(void);
static float GetXScale(){return xScale;}
static float GetYScale(){return yScale;}
static void SetScissorBox(RECT &rc);
static void SetViewport(float* _Viewport);
static void SetProjection(float* _pProjection, int constantIndex = -1);
static void AddMessage(const std::string &message, unsigned int ms);
static void ProcessMessages();
static void RenderText(const std::string &text, int left, int top, unsigned int color);
/**
* Assigns a texture to a device stage.
* @param Stage Stage to assign to.
* @param pTexture Texture to be assigned.
*/
static void SetTexture( DWORD Stage, IDirect3DBaseTexture9 *pTexture );
/**
* Sets the current vertex stream declaration.
* @param FVF Fixed function vertex type
*/
static void SetFVF( DWORD FVF );
/**
* Sets a single device render-state parameter.
* @param State Device state variable that is being modified.
* @param Value New value for the device render state to be set.
*/
static void SetRenderState( D3DRENDERSTATETYPE State, DWORD Value );
/**
* Sets the state value for the currently assigned texture.
* @param Stage Stage identifier of the texture for which the state value is set.
* @param Type Texture state to set.
* @param Value State value to set.
*/
static void SetTextureStageState( DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,DWORD Value );
/**
* Sets the sampler state value.
* @param Sampler The sampler stage index.
* @param Type Type of the sampler.
* @param Value State value to set.
*/
static void SetSamplerState( DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value );
/**
* Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type.
* @param PrimitiveType Type of primitive to render.
* @param PrimitiveCount Number of primitives to render.
* @param pVertexStreamZeroData User memory pointer to the vertex data.
* @param VertexStreamZeroStride The number of bytes of data for each vertex.
*/
static void DrawPrimitiveUP( D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
const void* pVertexStreamZeroData, UINT VertexStreamZeroStride );
/**
* Renders a sequence of non indexed, geometric primitives of the specified type from the current set of data input streams.
* @param PrimitiveType Type of primitive to render.
* @param StartVertex Index of the first vertex to load.
* @param PrimitiveCount Number of primitives to render.
*/
static void DrawPrimitive( D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount );
};
#endif // __H_RENDER__

View File

@ -1,97 +1,97 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
#include <map>
#include "PixelShader.h"
#include "VertexShader.h"
typedef u32 tevhash;
tevhash GetCurrentTEV();
class PShaderCache
{
struct PSCacheEntry
{
LPDIRECT3DPIXELSHADER9 shader;
//CGPShader shader;
int frameCount;
PSCacheEntry()
{
shader=0;
frameCount=0;
}
void Destroy()
{
if (shader)
shader->Release();
}
};
typedef std::map<tevhash,PSCacheEntry> PSCache;
static PSCache pshaders;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void SetShader();
};
class VShaderCache
{
struct VSCacheEntry
{
LPDIRECT3DVERTEXSHADER9 shader;
//CGVShader shader;
int frameCount;
VSCacheEntry()
{
shader=0;
frameCount=0;
}
void Destroy()
{
if (shader)
shader->Release();
}
};
typedef std::map<tevhash,VSCacheEntry> VSCache;
static VSCache vshaders;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void SetShader();
};
void InitCG();
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "D3DBase.h"
#include <map>
#include "PixelShader.h"
#include "VertexShader.h"
typedef u32 tevhash;
tevhash GetCurrentTEV();
class PShaderCache
{
struct PSCacheEntry
{
LPDIRECT3DPIXELSHADER9 shader;
//CGPShader shader;
int frameCount;
PSCacheEntry()
{
shader=0;
frameCount=0;
}
void Destroy()
{
if (shader)
shader->Release();
}
};
typedef std::map<tevhash,PSCacheEntry> PSCache;
static PSCache pshaders;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void SetShader();
};
class VShaderCache
{
struct VSCacheEntry
{
LPDIRECT3DVERTEXSHADER9 shader;
//CGVShader shader;
int frameCount;
VSCacheEntry()
{
shader=0;
frameCount=0;
}
void Destroy()
{
if (shader)
shader->Release();
}
};
typedef std::map<tevhash,VSCacheEntry> VSCache;
static VSCache vshaders;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void SetShader();
};
void InitCG();
void ShutdownCG();

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _TEXTURECACHE_H
#define _TEXTURECACHE_H
#include <map>
#include "D3DBase.h"
class TextureCache
{
struct TCacheEntry
{
LPDIRECT3DTEXTURE9 texture;
u32 addr;
u32 hash;
u32 paletteHash;
u32 hashoffset;
u32 oldpixel;
bool isRenderTarget;
bool isNonPow2;
int frameCount;
int w,h,fmt;
TCacheEntry()
{
texture=0;
isRenderTarget=0;
hash=0;
}
void Destroy();
};
typedef std::map<u32,TCacheEntry> TexCache;
static u8 *temp;
static TexCache textures;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Invalidate();
static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyEFBToRenderTarget(u32 address, RECT *source);
};
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _TEXTURECACHE_H
#define _TEXTURECACHE_H
#include <map>
#include "D3DBase.h"
class TextureCache
{
struct TCacheEntry
{
LPDIRECT3DTEXTURE9 texture;
u32 addr;
u32 hash;
u32 paletteHash;
u32 hashoffset;
u32 oldpixel;
bool isRenderTarget;
bool isNonPow2;
int frameCount;
int w,h,fmt;
TCacheEntry()
{
texture=0;
isRenderTarget=0;
hash=0;
}
void Destroy();
};
typedef std::map<u32,TCacheEntry> TexCache;
static u8 *temp;
static TexCache textures;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Invalidate();
static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyEFBToRenderTarget(u32 address, RECT *source);
};
#endif

View File

@ -1,55 +1,55 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _TRANSFORMENGINE_H
#define _TRANSFORMENGINE_H
//T&L Engine
//as much work as possible will be delegated to vertex shaders later
//to take full advantage of current PC HW
#include "VertexManager.h"
#include "DecodedVArray.h"
class CTransformEngine
{
static float* m_pPosMatrix;
static float* m_pNormalMatrix;
static float* m_pTexMatrix[8];
static float* m_pTexPostMatrix[8];
public:
static void TransformVertices(int _numVertices,
const DecodedVArray *varray,
D3DVertex *vbuffer);
static void SetPosNormalMatrix(float *p, float *n)
{
m_pPosMatrix = p;
m_pNormalMatrix = n;
}
static void SetTexMatrix(int i, float *f)
{
m_pTexMatrix[i] = f;
}
static void SetTexPostMatrix(int i, float *f)
{
m_pTexPostMatrix[i] = f;
}
};
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _TRANSFORMENGINE_H
#define _TRANSFORMENGINE_H
//T&L Engine
//as much work as possible will be delegated to vertex shaders later
//to take full advantage of current PC HW
#include "VertexManager.h"
#include "DecodedVArray.h"
class CTransformEngine
{
static float* m_pPosMatrix;
static float* m_pNormalMatrix;
static float* m_pTexMatrix[8];
static float* m_pTexPostMatrix[8];
public:
static void TransformVertices(int _numVertices,
const DecodedVArray *varray,
D3DVertex *vbuffer);
static void SetPosNormalMatrix(float *p, float *n)
{
m_pPosMatrix = p;
m_pNormalMatrix = n;
}
static void SetTexMatrix(int i, float *f)
{
m_pTexMatrix[i] = f;
}
static void SetTexPostMatrix(int i, float *f)
{
m_pTexPostMatrix[i] = f;
}
};
#endif

View File

@ -1,63 +1,63 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UTILS_H
#define _UTILS_H
#include "Common.h"
#include "main.h"
#include "LookUpTables.h"
extern int frameCount;
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
//#define RAM_MASK 0x1FFFFFF
inline u8 *Memory_GetPtr(u32 _uAddress)
{
return g_VideoInitialize.pGetMemoryPointer(_uAddress);
}
inline u8 Memory_Read_U8(u32 _uAddress)
{
return *g_VideoInitialize.pGetMemoryPointer(_uAddress);
}
inline u16 Memory_Read_U16(u32 _uAddress)
{
return _byteswap_ushort(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
// return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]);
}
inline u32 Memory_Read_U32(u32 _uAddress)
{
if (_uAddress == 0x020143a8)
{
int i =0;
}
return _byteswap_ulong(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
// return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]);
}
inline float Memory_Read_Float(u32 _uAddress)
{
u32 uTemp = Memory_Read_U32(_uAddress);
return *(float*)&uTemp;
}
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _UTILS_H
#define _UTILS_H
#include "Common.h"
#include "main.h"
#include "LookUpTables.h"
extern int frameCount;
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
//#define RAM_MASK 0x1FFFFFF
inline u8 *Memory_GetPtr(u32 _uAddress)
{
return g_VideoInitialize.pGetMemoryPointer(_uAddress);
}
inline u8 Memory_Read_U8(u32 _uAddress)
{
return *g_VideoInitialize.pGetMemoryPointer(_uAddress);
}
inline u16 Memory_Read_U16(u32 _uAddress)
{
return _byteswap_ushort(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
// return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]);
}
inline u32 Memory_Read_U32(u32 _uAddress)
{
if (_uAddress == 0x020143a8)
{
int i =0;
}
return _byteswap_ulong(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
// return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]);
}
inline float Memory_Read_Float(u32 _uAddress)
{
u32 uTemp = Memory_Read_U32(_uAddress);
return *(float*)&uTemp;
}
#endif

View File

@ -1,116 +1,116 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VEC3_H
#define _VEC3_H
#include <stdlib.h>
#include <math.h>
class Vec3
{
public:
float x,y,z;
Vec3() { }
explicit Vec3(float f) {x=y=z=f;}
explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];}
Vec3(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z;
}
void set(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z;
}
Vec3 operator + (const Vec3 &other) const {
return Vec3(x+other.x, y+other.y, z+other.z);
}
void operator += (const Vec3 &other) {
x+=other.x; y+=other.y; z+=other.z;
}
Vec3 operator -(const Vec3 &v) const {
return Vec3(x-v.x,y-v.y,z-v.z);
}
void operator -= (const Vec3 &other)
{
x-=other.x; y-=other.y; z-=other.z;
}
Vec3 operator -() const {
return Vec3(-x,-y,-z);
}
Vec3 operator * (const float f) const {
return Vec3(x*f,y*f,z*f);
}
Vec3 operator / (const float f) const {
float invf = (1.0f/f);
return Vec3(x*invf,y*invf,z*invf);
}
void operator /= (const float f)
{
*this = *this / f;
}
float operator * (const Vec3 &other) const {
return x*other.x + y*other.y + z*other.z;
}
void operator *= (const float f) {
*this = *this * f;
}
Vec3 scaled_by(const Vec3 &other) const {
return Vec3(x*other.x, y*other.y, z*other.z);
}
Vec3 operator %(const Vec3 &v) const {
return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
}
float length2() const {
return x*x+y*y+z*z;
}
float length() const {
return sqrtf(length2());
}
float distance2_to(Vec3 &other)
{
return (other-(*this)).length2();
}
Vec3 normalized() const {
return (*this) / length();
}
void normalize() {
(*this) /= length();
}
float &operator [] (int i)
{
return *((&x) + i);
}
const float operator [] (const int i) const
{
return *((&x) + i);
}
bool operator == (const Vec3 &other) const
{
if (x==other.x && y==other.y && z==other.z)
return true;
else
return false;
}
void setZero()
{
memset((void *)this,0,sizeof(float)*3);
}
};
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VEC3_H
#define _VEC3_H
#include <stdlib.h>
#include <math.h>
class Vec3
{
public:
float x,y,z;
Vec3() { }
explicit Vec3(float f) {x=y=z=f;}
explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];}
Vec3(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z;
}
void set(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z;
}
Vec3 operator + (const Vec3 &other) const {
return Vec3(x+other.x, y+other.y, z+other.z);
}
void operator += (const Vec3 &other) {
x+=other.x; y+=other.y; z+=other.z;
}
Vec3 operator -(const Vec3 &v) const {
return Vec3(x-v.x,y-v.y,z-v.z);
}
void operator -= (const Vec3 &other)
{
x-=other.x; y-=other.y; z-=other.z;
}
Vec3 operator -() const {
return Vec3(-x,-y,-z);
}
Vec3 operator * (const float f) const {
return Vec3(x*f,y*f,z*f);
}
Vec3 operator / (const float f) const {
float invf = (1.0f/f);
return Vec3(x*invf,y*invf,z*invf);
}
void operator /= (const float f)
{
*this = *this / f;
}
float operator * (const Vec3 &other) const {
return x*other.x + y*other.y + z*other.z;
}
void operator *= (const float f) {
*this = *this * f;
}
Vec3 scaled_by(const Vec3 &other) const {
return Vec3(x*other.x, y*other.y, z*other.z);
}
Vec3 operator %(const Vec3 &v) const {
return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
}
float length2() const {
return x*x+y*y+z*z;
}
float length() const {
return sqrtf(length2());
}
float distance2_to(Vec3 &other)
{
return (other-(*this)).length2();
}
Vec3 normalized() const {
return (*this) / length();
}
void normalize() {
(*this) /= length();
}
float &operator [] (int i)
{
return *((&x) + i);
}
const float operator [] (const int i) const
{
return *((&x) + i);
}
bool operator == (const Vec3 &other) const
{
if (x==other.x && y==other.y && z==other.z)
return true;
else
return false;
}
void setZero()
{
memset((void *)this,0,sizeof(float)*3);
}
};
#endif

View File

@ -1,195 +1,195 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXLOADER_H
#define _VERTEXLOADER_H
int ComputeVertexSize(u32 components);
#include "CPStructs.h"
#include "DecodedVArray.h"
#include "DataReader.h"
#define LOADERDECL __cdecl
typedef void (LOADERDECL *TPipelineFunction)(const void*);
class VertexLoader
{
public:
enum
{
NRM_ZERO = 0,
NRM_ONE = 1,
NRM_THREE = 3
};
enum {
VB_HAS_POSMTXIDX =(1<<1),
VB_HAS_TEXMTXIDX0=(1<<2),
VB_HAS_TEXMTXIDX1=(1<<3),
VB_HAS_TEXMTXIDX2=(1<<4),
VB_HAS_TEXMTXIDX3=(1<<5),
VB_HAS_TEXMTXIDX4=(1<<6),
VB_HAS_TEXMTXIDX5=(1<<7),
VB_HAS_TEXMTXIDX6=(1<<8),
VB_HAS_TEXMTXIDX7=(1<<9),
VB_HAS_TEXMTXIDXALL=(0xff<<2),
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
VB_HAS_NRM0=(1<<10),
VB_HAS_NRM1=(1<<11),
VB_HAS_NRM2=(1<<12),
VB_HAS_NRMALL=(7<<10),
VB_HAS_COL0=(1<<13),
VB_HAS_COL1=(1<<14),
VB_HAS_UV0=(1<<15),
VB_HAS_UV1=(1<<16),
VB_HAS_UV2=(1<<17),
VB_HAS_UV3=(1<<18),
VB_HAS_UV4=(1<<19),
VB_HAS_UV5=(1<<20),
VB_HAS_UV6=(1<<21),
VB_HAS_UV7=(1<<22),
VB_HAS_UVALL=(0xff<<15),
VB_HAS_UVTEXMTXSHIFT=13,
};
private:
TPipelineFunction m_PipelineStates[32];
int m_numPipelineStates;
int m_VertexSize;
int m_counter;
u32 m_components;
UVAT_group0 m_group0;
UVAT_group1 m_group1;
UVAT_group2 m_group2;
bool m_AttrDirty;
TVtxAttr m_VtxAttr; //Decoded into easy format
//common for all loaders
static TVtxDesc m_VtxDesc;
static bool m_DescDirty;
// seup the pipeline with this vertex fmt
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
public:
// constructor
VertexLoader();
~VertexLoader();
// run the pipeline
static void SetVArray(DecodedVArray *_varray);
void Setup();
void PrepareRun();
void RunVertices(int count);
void WriteCall(TPipelineFunction func);
int GetVertexSize(){return m_VertexSize;}
//VtxDesc - global
static void SetVtxDesc_Lo(u32 _iValue)
{
u64 old = m_VtxDesc.Hex;
m_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
m_VtxDesc.Hex |= _iValue;
if (m_VtxDesc.Hex != old)
m_DescDirty = true;
};
static void SetVtxDesc_Hi(u32 _iValue)
{
u64 old = m_VtxDesc.Hex;
m_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
m_VtxDesc.Hex |= (u64)_iValue << 17;
if (m_VtxDesc.Hex != old)
m_DescDirty = true;
};
static TVtxDesc &GetVtxDesc() {return m_VtxDesc;}
void SetVAT_group0(u32 _group0)
{
if (m_group0.Hex == _group0)
return;
m_AttrDirty = true;
m_group0.Hex = _group0;
m_VtxAttr.PosElements = m_group0.PosElements;
m_VtxAttr.PosFormat = m_group0.PosFormat;
m_VtxAttr.PosFrac = m_group0.PosFrac;
m_VtxAttr.NormalElements = m_group0.NormalElements;
m_VtxAttr.NormalFormat = m_group0.NormalFormat;
m_VtxAttr.color[0].Elements = m_group0.Color0Elements;
m_VtxAttr.color[0].Comp = m_group0.Color0Comp;
m_VtxAttr.color[1].Elements = m_group0.Color1Elements;
m_VtxAttr.color[1].Comp = m_group0.Color1Comp;
m_VtxAttr.texCoord[0].Elements = m_group0.Tex0CoordElements;
m_VtxAttr.texCoord[0].Format = m_group0.Tex0CoordFormat;
m_VtxAttr.texCoord[0].Frac = m_group0.Tex0Frac;
m_VtxAttr.ByteDequant = m_group0.ByteDequant;
m_VtxAttr.NormalIndex3 = m_group0.NormalIndex3;
};
void SetVAT_group1(u32 _group1)
{
if (m_group1.Hex == _group1)
return;
m_AttrDirty = true;
m_group1.Hex = _group1;
m_VtxAttr.texCoord[1].Elements = m_group1.Tex1CoordElements;
m_VtxAttr.texCoord[1].Format = m_group1.Tex1CoordFormat;
m_VtxAttr.texCoord[1].Frac = m_group1.Tex1Frac;
m_VtxAttr.texCoord[2].Elements = m_group1.Tex2CoordElements;
m_VtxAttr.texCoord[2].Format = m_group1.Tex2CoordFormat;
m_VtxAttr.texCoord[2].Frac = m_group1.Tex2Frac;
m_VtxAttr.texCoord[3].Elements = m_group1.Tex3CoordElements;
m_VtxAttr.texCoord[3].Format = m_group1.Tex3CoordFormat;
m_VtxAttr.texCoord[3].Frac = m_group1.Tex3Frac;
m_VtxAttr.texCoord[4].Elements = m_group1.Tex4CoordElements;
m_VtxAttr.texCoord[4].Format = m_group1.Tex4CoordFormat;
};
void SetVAT_group2(u32 _group2)
{
if (m_group2.Hex == _group2)
return;
m_AttrDirty = true;
m_group2.Hex = _group2;
m_VtxAttr.texCoord[4].Frac = m_group2.Tex4Frac;
m_VtxAttr.texCoord[5].Elements = m_group2.Tex5CoordElements;
m_VtxAttr.texCoord[5].Format = m_group2.Tex5CoordFormat;
m_VtxAttr.texCoord[5].Frac = m_group2.Tex5Frac;
m_VtxAttr.texCoord[6].Elements = m_group2.Tex6CoordElements;
m_VtxAttr.texCoord[6].Format = m_group2.Tex6CoordFormat;
m_VtxAttr.texCoord[6].Frac = m_group2.Tex6Frac;
m_VtxAttr.texCoord[7].Elements = m_group2.Tex7CoordElements;
m_VtxAttr.texCoord[7].Format = m_group2.Tex7CoordFormat;
m_VtxAttr.texCoord[7].Frac = m_group2.Tex7Frac;
};
};
extern VertexLoader g_VertexLoaders[8];
extern DecodedVArray* varray;
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXLOADER_H
#define _VERTEXLOADER_H
int ComputeVertexSize(u32 components);
#include "CPStructs.h"
#include "DecodedVArray.h"
#include "DataReader.h"
#define LOADERDECL __cdecl
typedef void (LOADERDECL *TPipelineFunction)(const void*);
class VertexLoader
{
public:
enum
{
NRM_ZERO = 0,
NRM_ONE = 1,
NRM_THREE = 3
};
enum {
VB_HAS_POSMTXIDX =(1<<1),
VB_HAS_TEXMTXIDX0=(1<<2),
VB_HAS_TEXMTXIDX1=(1<<3),
VB_HAS_TEXMTXIDX2=(1<<4),
VB_HAS_TEXMTXIDX3=(1<<5),
VB_HAS_TEXMTXIDX4=(1<<6),
VB_HAS_TEXMTXIDX5=(1<<7),
VB_HAS_TEXMTXIDX6=(1<<8),
VB_HAS_TEXMTXIDX7=(1<<9),
VB_HAS_TEXMTXIDXALL=(0xff<<2),
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
VB_HAS_NRM0=(1<<10),
VB_HAS_NRM1=(1<<11),
VB_HAS_NRM2=(1<<12),
VB_HAS_NRMALL=(7<<10),
VB_HAS_COL0=(1<<13),
VB_HAS_COL1=(1<<14),
VB_HAS_UV0=(1<<15),
VB_HAS_UV1=(1<<16),
VB_HAS_UV2=(1<<17),
VB_HAS_UV3=(1<<18),
VB_HAS_UV4=(1<<19),
VB_HAS_UV5=(1<<20),
VB_HAS_UV6=(1<<21),
VB_HAS_UV7=(1<<22),
VB_HAS_UVALL=(0xff<<15),
VB_HAS_UVTEXMTXSHIFT=13,
};
private:
TPipelineFunction m_PipelineStates[32];
int m_numPipelineStates;
int m_VertexSize;
int m_counter;
u32 m_components;
UVAT_group0 m_group0;
UVAT_group1 m_group1;
UVAT_group2 m_group2;
bool m_AttrDirty;
TVtxAttr m_VtxAttr; //Decoded into easy format
//common for all loaders
static TVtxDesc m_VtxDesc;
static bool m_DescDirty;
// seup the pipeline with this vertex fmt
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
public:
// constructor
VertexLoader();
~VertexLoader();
// run the pipeline
static void SetVArray(DecodedVArray *_varray);
void Setup();
void PrepareRun();
void RunVertices(int count);
void WriteCall(TPipelineFunction func);
int GetVertexSize(){return m_VertexSize;}
//VtxDesc - global
static void SetVtxDesc_Lo(u32 _iValue)
{
u64 old = m_VtxDesc.Hex;
m_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits
m_VtxDesc.Hex |= _iValue;
if (m_VtxDesc.Hex != old)
m_DescDirty = true;
};
static void SetVtxDesc_Hi(u32 _iValue)
{
u64 old = m_VtxDesc.Hex;
m_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits
m_VtxDesc.Hex |= (u64)_iValue << 17;
if (m_VtxDesc.Hex != old)
m_DescDirty = true;
};
static TVtxDesc &GetVtxDesc() {return m_VtxDesc;}
void SetVAT_group0(u32 _group0)
{
if (m_group0.Hex == _group0)
return;
m_AttrDirty = true;
m_group0.Hex = _group0;
m_VtxAttr.PosElements = m_group0.PosElements;
m_VtxAttr.PosFormat = m_group0.PosFormat;
m_VtxAttr.PosFrac = m_group0.PosFrac;
m_VtxAttr.NormalElements = m_group0.NormalElements;
m_VtxAttr.NormalFormat = m_group0.NormalFormat;
m_VtxAttr.color[0].Elements = m_group0.Color0Elements;
m_VtxAttr.color[0].Comp = m_group0.Color0Comp;
m_VtxAttr.color[1].Elements = m_group0.Color1Elements;
m_VtxAttr.color[1].Comp = m_group0.Color1Comp;
m_VtxAttr.texCoord[0].Elements = m_group0.Tex0CoordElements;
m_VtxAttr.texCoord[0].Format = m_group0.Tex0CoordFormat;
m_VtxAttr.texCoord[0].Frac = m_group0.Tex0Frac;
m_VtxAttr.ByteDequant = m_group0.ByteDequant;
m_VtxAttr.NormalIndex3 = m_group0.NormalIndex3;
};
void SetVAT_group1(u32 _group1)
{
if (m_group1.Hex == _group1)
return;
m_AttrDirty = true;
m_group1.Hex = _group1;
m_VtxAttr.texCoord[1].Elements = m_group1.Tex1CoordElements;
m_VtxAttr.texCoord[1].Format = m_group1.Tex1CoordFormat;
m_VtxAttr.texCoord[1].Frac = m_group1.Tex1Frac;
m_VtxAttr.texCoord[2].Elements = m_group1.Tex2CoordElements;
m_VtxAttr.texCoord[2].Format = m_group1.Tex2CoordFormat;
m_VtxAttr.texCoord[2].Frac = m_group1.Tex2Frac;
m_VtxAttr.texCoord[3].Elements = m_group1.Tex3CoordElements;
m_VtxAttr.texCoord[3].Format = m_group1.Tex3CoordFormat;
m_VtxAttr.texCoord[3].Frac = m_group1.Tex3Frac;
m_VtxAttr.texCoord[4].Elements = m_group1.Tex4CoordElements;
m_VtxAttr.texCoord[4].Format = m_group1.Tex4CoordFormat;
};
void SetVAT_group2(u32 _group2)
{
if (m_group2.Hex == _group2)
return;
m_AttrDirty = true;
m_group2.Hex = _group2;
m_VtxAttr.texCoord[4].Frac = m_group2.Tex4Frac;
m_VtxAttr.texCoord[5].Elements = m_group2.Tex5CoordElements;
m_VtxAttr.texCoord[5].Format = m_group2.Tex5CoordFormat;
m_VtxAttr.texCoord[5].Frac = m_group2.Tex5Frac;
m_VtxAttr.texCoord[6].Elements = m_group2.Tex6CoordElements;
m_VtxAttr.texCoord[6].Format = m_group2.Tex6CoordFormat;
m_VtxAttr.texCoord[6].Frac = m_group2.Tex6Frac;
m_VtxAttr.texCoord[7].Elements = m_group2.Tex7CoordElements;
m_VtxAttr.texCoord[7].Format = m_group2.Tex7CoordFormat;
m_VtxAttr.texCoord[7].Frac = m_group2.Tex7Frac;
};
};
extern VertexLoader g_VertexLoaders[8];
extern DecodedVArray* varray;
#endif

View File

@ -1,226 +1,226 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXLOADERCOLOR_H
#define _VERTEXLOADERCOLOR_H
#include "LookUpTables.h"
#define RSHIFT 16
#define GSHIFT 8
#define BSHIFT 0
#define ASHIFT 24
extern DecodedVArray *varray;
extern int colIndex;
inline void _SetCol(u32 val)
{
varray->SetColor(colIndex, val);
colIndex++;
}
void _SetCol4444(u16 val)
{
u32 col = lut4to8[(val>>0)&0xF]<<ASHIFT;
col |= lut4to8[(val>>12)&0xF] <<RSHIFT;
col |= lut4to8[(val>>8)&0xF] <<GSHIFT;
col |= lut4to8[(val>>4)&0xF] <<BSHIFT;
_SetCol(col);
}
void _SetCol6666(u32 val)
{
u32 col = lut6to8[(val>>18)&0x3F] << RSHIFT;
col |= lut6to8[(val>>12)&0x3F] << GSHIFT;
col |= lut6to8[(val>>6)&0x3F] << BSHIFT;
col |= lut6to8[(val>>0)&0x3F] << ASHIFT;
_SetCol(col);
}
void _SetCol565(u16 val)
{
u32 col = lut5to8[(val>>11)&0x1f] << RSHIFT;
col |= lut6to8[(val>>5 )&0x3f] << GSHIFT;
col |= lut5to8[(val )&0x1f] << BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
inline u32 _Read24(u32 iAddress)
{
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
return col | (0xFF<<ASHIFT);
}
inline u32 _Read32(u32 iAddress)
{
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
col |= Memory_Read_U8(iAddress+3) << ASHIFT;
return col;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadDirect_24b_888(const void *_p)
{
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
}
void LOADERDECL Color_ReadDirect_32b_888x(const void *_p){
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
DataReadU8();
}
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
{
_SetCol565(DataReadU16());
}
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
{
_SetCol4444(DataReadU16());
}
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
{
u32 val = DataReadU8()<<16;
val|=DataReadU8()<<8;
val|=DataReadU8();
_SetCol6666(val);
}
// F|RES: i am not 100 percent sure, but the colElements seems to be important for rendering only
// at least it fixes mario party 4
//
// if (colElements[colIndex])
// else
// col |= 0xFF<<ASHIFT;
//
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
{
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
col |= DataReadU8()<<ASHIFT;
// "kill" the alpha
if (!colElements[colIndex])
col |= 0xFF << ASHIFT;
_SetCol(col);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex8_16b_565(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol565(val);
}
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val);
}
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) |
(Memory_Read_U8(iAddress)<<16);
_SetCol6666(val);
}
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress));
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex16_16b_565(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol565(val);
}
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val);
}
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) |
(Memory_Read_U8(iAddress)<<16);
_SetCol6666(val);
}
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress));
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXLOADERCOLOR_H
#define _VERTEXLOADERCOLOR_H
#include "LookUpTables.h"
#define RSHIFT 16
#define GSHIFT 8
#define BSHIFT 0
#define ASHIFT 24
extern DecodedVArray *varray;
extern int colIndex;
inline void _SetCol(u32 val)
{
varray->SetColor(colIndex, val);
colIndex++;
}
void _SetCol4444(u16 val)
{
u32 col = lut4to8[(val>>0)&0xF]<<ASHIFT;
col |= lut4to8[(val>>12)&0xF] <<RSHIFT;
col |= lut4to8[(val>>8)&0xF] <<GSHIFT;
col |= lut4to8[(val>>4)&0xF] <<BSHIFT;
_SetCol(col);
}
void _SetCol6666(u32 val)
{
u32 col = lut6to8[(val>>18)&0x3F] << RSHIFT;
col |= lut6to8[(val>>12)&0x3F] << GSHIFT;
col |= lut6to8[(val>>6)&0x3F] << BSHIFT;
col |= lut6to8[(val>>0)&0x3F] << ASHIFT;
_SetCol(col);
}
void _SetCol565(u16 val)
{
u32 col = lut5to8[(val>>11)&0x1f] << RSHIFT;
col |= lut6to8[(val>>5 )&0x3f] << GSHIFT;
col |= lut5to8[(val )&0x1f] << BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
inline u32 _Read24(u32 iAddress)
{
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
return col | (0xFF<<ASHIFT);
}
inline u32 _Read32(u32 iAddress)
{
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
col |= Memory_Read_U8(iAddress+3) << ASHIFT;
return col;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadDirect_24b_888(const void *_p)
{
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
}
void LOADERDECL Color_ReadDirect_32b_888x(const void *_p){
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
_SetCol(col | (0xFF<<ASHIFT));
DataReadU8();
}
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
{
_SetCol565(DataReadU16());
}
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
{
_SetCol4444(DataReadU16());
}
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
{
u32 val = DataReadU8()<<16;
val|=DataReadU8()<<8;
val|=DataReadU8();
_SetCol6666(val);
}
// F|RES: i am not 100 percent sure, but the colElements seems to be important for rendering only
// at least it fixes mario party 4
//
// if (colElements[colIndex])
// else
// col |= 0xFF<<ASHIFT;
//
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
{
u32 col = DataReadU8()<<RSHIFT;
col |= DataReadU8()<<GSHIFT;
col |= DataReadU8()<<BSHIFT;
col |= DataReadU8()<<ASHIFT;
// "kill" the alpha
if (!colElements[colIndex])
col |= 0xFF << ASHIFT;
_SetCol(col);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex8_16b_565(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol565(val);
}
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val);
}
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) |
(Memory_Read_U8(iAddress)<<16);
_SetCol6666(val);
}
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress));
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
void LOADERDECL Color_ReadIndex16_16b_565(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol565(val);
}
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read24(iAddress));
}
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u16 val = Memory_Read_U16(iAddress);
_SetCol4444(val);
}
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
u32 val = Memory_Read_U8(iAddress+2) |
(Memory_Read_U8(iAddress+1)<<8) |
(Memory_Read_U8(iAddress)<<16);
_SetCol6666(val);
}
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
_SetCol(_Read32(iAddress));
}
#endif

View File

@ -1,41 +1,41 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Common.h"
#include "TransformEngine.h"
// ==============================================================================
// Direct
// ==============================================================================
void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
int index = DataReadU8() & 0x3f;
float *flipmem = (float *)xfmem;
varray->SetPosNrmIdx(index);
}
int s_texmtxread = 0, s_texmtxwrite = 0;
void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
int index = DataReadU8() & 0x3f;
varray->SetTcIdx(s_texmtxread++, index);
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "Common.h"
#include "TransformEngine.h"
// ==============================================================================
// Direct
// ==============================================================================
void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
int index = DataReadU8() & 0x3f;
float *flipmem = (float *)xfmem;
varray->SetPosNrmIdx(index);
}
int s_texmtxread = 0, s_texmtxwrite = 0;
void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
int index = DataReadU8() & 0x3f;
varray->SetTcIdx(s_texmtxread++, index);
}

View File

@ -1,90 +1,90 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "CommonTypes.h"
class VertexLoader_Normal
{
public:
static bool index3;
// Init
static void Init(void);
// GetSize
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
// GetFunction
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
private:
enum ENormalType
{
NRM_NOT_PRESENT = 0,
NRM_DIRECT = 1,
NRM_INDEX8 = 2,
NRM_INDEX16 = 3,
NUM_NRM_TYPE
};
enum ENormalFormat
{
FORMAT_UBYTE = 0,
FORMAT_BYTE = 1,
FORMAT_USHORT = 2,
FORMAT_SHORT = 3,
FORMAT_FLOAT = 4,
NUM_NRM_FORMAT
};
enum ENormalElements
{
NRM_NBT = 0,
NRM_NBT3 = 1,
NUM_NRM_ELEMENTS
};
// tables
static u8 m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
// direct
static void LOADERDECL Normal_DirectByte(const void* _p);
static void LOADERDECL Normal_DirectShort(const void* _p);
static void LOADERDECL Normal_DirectFloat(const void* _p);
static void LOADERDECL Normal_DirectByte3(const void* _p);
static void LOADERDECL Normal_DirectShort3(const void* _p);
static void LOADERDECL Normal_DirectFloat3(const void* _p);
// index8
static void LOADERDECL Normal_Index8_Byte(const void* _p);
static void LOADERDECL Normal_Index8_Short(const void* _p);
static void LOADERDECL Normal_Index8_Float(const void* _p);
static void LOADERDECL Normal_Index8_Byte3(const void* _p);
static void LOADERDECL Normal_Index8_Short3(const void* _p);
static void LOADERDECL Normal_Index8_Float3(const void* _p);
// index16
static void LOADERDECL Normal_Index16_Byte(const void* _p);
static void LOADERDECL Normal_Index16_Short(const void* _p);
static void LOADERDECL Normal_Index16_Float(const void* _p);
static void LOADERDECL Normal_Index16_Byte3(const void* _p);
static void LOADERDECL Normal_Index16_Short3(const void* _p);
static void LOADERDECL Normal_Index16_Float3(const void* _p);
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "CommonTypes.h"
class VertexLoader_Normal
{
public:
static bool index3;
// Init
static void Init(void);
// GetSize
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
// GetFunction
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
private:
enum ENormalType
{
NRM_NOT_PRESENT = 0,
NRM_DIRECT = 1,
NRM_INDEX8 = 2,
NRM_INDEX16 = 3,
NUM_NRM_TYPE
};
enum ENormalFormat
{
FORMAT_UBYTE = 0,
FORMAT_BYTE = 1,
FORMAT_USHORT = 2,
FORMAT_SHORT = 3,
FORMAT_FLOAT = 4,
NUM_NRM_FORMAT
};
enum ENormalElements
{
NRM_NBT = 0,
NRM_NBT3 = 1,
NUM_NRM_ELEMENTS
};
// tables
static u8 m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
// direct
static void LOADERDECL Normal_DirectByte(const void* _p);
static void LOADERDECL Normal_DirectShort(const void* _p);
static void LOADERDECL Normal_DirectFloat(const void* _p);
static void LOADERDECL Normal_DirectByte3(const void* _p);
static void LOADERDECL Normal_DirectShort3(const void* _p);
static void LOADERDECL Normal_DirectFloat3(const void* _p);
// index8
static void LOADERDECL Normal_Index8_Byte(const void* _p);
static void LOADERDECL Normal_Index8_Short(const void* _p);
static void LOADERDECL Normal_Index8_Float(const void* _p);
static void LOADERDECL Normal_Index8_Byte3(const void* _p);
static void LOADERDECL Normal_Index8_Short3(const void* _p);
static void LOADERDECL Normal_Index8_Float3(const void* _p);
// index16
static void LOADERDECL Normal_Index16_Byte(const void* _p);
static void LOADERDECL Normal_Index16_Short(const void* _p);
static void LOADERDECL Normal_Index16_Float(const void* _p);
static void LOADERDECL Normal_Index16_Byte3(const void* _p);
static void LOADERDECL Normal_Index16_Short3(const void* _p);
static void LOADERDECL Normal_Index16_Float3(const void* _p);
};

View File

@ -1,213 +1,213 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef VERTEXHANDLER_POSITION_H
#define VERTEXHANDLER_POSITION_H
#include "Common.h"
#include "Utils.h"
// ==============================================================================
// Direct
// ==============================================================================
template<class T>
inline void LOADERDECL _ReadPos8Mem(int iAddress, TVtxAttr* pVtxAttr)
{
varray->SetPosX(((float)(T)Memory_Read_U8(iAddress)) * posScale);
varray->SetPosY(((float)(T)Memory_Read_U8(iAddress+1)) * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ(((float)(T)Memory_Read_U8(iAddress+2)) * posScale);
else
varray->SetPosZ(1.0);
}
template<class T>
inline void LOADERDECL _ReadPos16Mem(int iAddress, TVtxAttr* pVtxAttr)
{
varray->SetPosX(((float)(T)Memory_Read_U16(iAddress)) * posScale);
varray->SetPosY(((float)(T)Memory_Read_U16(iAddress+2)) * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ(((float)(T)Memory_Read_U16(iAddress+4)) * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr)
{
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetPosX(*(float*)&uTemp);
uTemp = Memory_Read_U32(iAddress+4);
varray->SetPosY(*(float*)&uTemp);
if (pVtxAttr->PosElements)
{
uTemp = Memory_Read_U32(iAddress+8);
varray->SetPosZ(*(float*)&uTemp);
}
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)DataReadU8() * posScale);
varray->SetPosY((float)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Byte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)(s8)DataReadU8() * posScale);
varray->SetPosY((float)(s8)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)(s8)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)DataReadU16() * posScale);
varray->SetPosY((float)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)(s16)DataReadU16() * posScale);
varray->SetPosY((float)(s16)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)(s16)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX(DataReadF32());
varray->SetPosY(DataReadF32());
if (pVtxAttr->PosElements)
varray->SetPosZ(DataReadF32());
else
varray->SetPosZ(1.0);
}
// ==============================================================================
// Index 8
// ==============================================================================
void LOADERDECL Pos_ReadIndex8_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Byte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
// ==============================================================================
// Index 16
// ==============================================================================
void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef VERTEXHANDLER_POSITION_H
#define VERTEXHANDLER_POSITION_H
#include "Common.h"
#include "Utils.h"
// ==============================================================================
// Direct
// ==============================================================================
template<class T>
inline void LOADERDECL _ReadPos8Mem(int iAddress, TVtxAttr* pVtxAttr)
{
varray->SetPosX(((float)(T)Memory_Read_U8(iAddress)) * posScale);
varray->SetPosY(((float)(T)Memory_Read_U8(iAddress+1)) * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ(((float)(T)Memory_Read_U8(iAddress+2)) * posScale);
else
varray->SetPosZ(1.0);
}
template<class T>
inline void LOADERDECL _ReadPos16Mem(int iAddress, TVtxAttr* pVtxAttr)
{
varray->SetPosX(((float)(T)Memory_Read_U16(iAddress)) * posScale);
varray->SetPosY(((float)(T)Memory_Read_U16(iAddress+2)) * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ(((float)(T)Memory_Read_U16(iAddress+4)) * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr)
{
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetPosX(*(float*)&uTemp);
uTemp = Memory_Read_U32(iAddress+4);
varray->SetPosY(*(float*)&uTemp);
if (pVtxAttr->PosElements)
{
uTemp = Memory_Read_U32(iAddress+8);
varray->SetPosZ(*(float*)&uTemp);
}
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)DataReadU8() * posScale);
varray->SetPosY((float)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Byte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)(s8)DataReadU8() * posScale);
varray->SetPosY((float)(s8)DataReadU8() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)(s8)DataReadU8() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)DataReadU16() * posScale);
varray->SetPosY((float)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX((float)(s16)DataReadU16() * posScale);
varray->SetPosY((float)(s16)DataReadU16() * posScale);
if (pVtxAttr->PosElements)
varray->SetPosZ((float)(s16)DataReadU16() * posScale);
else
varray->SetPosZ(1.0);
}
void LOADERDECL Pos_ReadDirect_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
varray->SetPosX(DataReadF32());
varray->SetPosY(DataReadF32());
if (pVtxAttr->PosElements)
varray->SetPosZ(DataReadF32());
else
varray->SetPosZ(1.0);
}
// ==============================================================================
// Index 8
// ==============================================================================
void LOADERDECL Pos_ReadIndex8_UByte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Byte(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex8_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
// ==============================================================================
// Index 16
// ==============================================================================
void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Short(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
}
void LOADERDECL Pos_ReadIndex16_Float(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
_ReadPosFloatMem(iAddress, pVtxAttr);
}
#endif

View File

@ -1,202 +1,202 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef VERTEXHANDLER_TEXCOORD_H
#define VERTEXHANDLER_TEXCOORD_H
extern int tcIndex;
void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p)
{
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p)
{
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (s8)DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p)
{
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Short(const void* _p)
{
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Float(const void* _p)
{
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadF32() * tcScaleV[tcIndex]);
tcIndex++;
}
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p)
{
u16 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = Memory_Read_U32(iAddress+4);
varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = (u8)Memory_Read_U8(iAddress );
varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (u8)Memory_Read_U8(iAddress+1);
varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = (s8)Memory_Read_U8(iAddress );
varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (s8)Memory_Read_U8(iAddress+1);
varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
uTemp = (float)(u16)Memory_Read_U16(iAddress );
varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (float)(u16)Memory_Read_U16(iAddress+2);
varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
uTemp = (float)(s16)Memory_Read_U16(iAddress );
varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (float)(s16)Memory_Read_U16(iAddress+2);
varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = Memory_Read_U32(iAddress+4);
varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef VERTEXHANDLER_TEXCOORD_H
#define VERTEXHANDLER_TEXCOORD_H
extern int tcIndex;
void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p)
{
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p)
{
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (s8)DataReadU8() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p)
{
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Short(const void* _p)
{
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadDirect_Float(const void* _p)
{
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, DataReadF32() * tcScaleV[tcIndex]);
tcIndex++;
}
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p)
{
u8 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
varray->SetU(tcIndex, (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p)
{
u16 Index = DataReadU8();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = Memory_Read_U32(iAddress+4);
varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
// ==================================================================================
void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = (u8)Memory_Read_U8(iAddress );
varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (u8)Memory_Read_U8(iAddress+1);
varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = (s8)Memory_Read_U8(iAddress );
varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (s8)Memory_Read_U8(iAddress+1);
varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p)
{
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
uTemp = (float)(u16)Memory_Read_U16(iAddress );
varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (float)(u16)Memory_Read_U16(iAddress+2);
varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
float uTemp;
uTemp = (float)(s16)Memory_Read_U16(iAddress );
varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = (float)(s16)Memory_Read_U16(iAddress+2);
varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p)
{
u16 Index = DataReadU16();
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
u32 uTemp;
uTemp = Memory_Read_U32(iAddress );
varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]);
if (tcElements[tcIndex])
{
uTemp = Memory_Read_U32(iAddress+4);
varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]);
}
tcIndex++;
}
#endif

View File

@ -1,61 +1,61 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "CPStructs.h"
#include "VertexLoader.h"
#include "DecodedVArray.h"
struct UV
{
float u,v,w;
};
struct D3DVertex {
Vec3 pos;
Vec3 normal;
u32 colors[2];
UV uv[8];
};
enum Collection
{
C_NOTHING=0,
C_TRIANGLES=1,
C_LINES=2,
C_POINTS=3
};
namespace VertexManager
{
extern const Collection collectionTypeLUT[8];
bool Init();
void Shutdown();
void BeginFrame();
void CreateDeviceObjects();
void DestroyDeviceObjects();
void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray);
void Flush();
} // namespace
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "CPStructs.h"
#include "VertexLoader.h"
#include "DecodedVArray.h"
struct UV
{
float u,v,w;
};
struct D3DVertex {
Vec3 pos;
Vec3 normal;
u32 colors[2];
UV uv[8];
};
enum Collection
{
C_NOTHING=0,
C_TRIANGLES=1,
C_LINES=2,
C_POINTS=3
};
namespace VertexManager
{
extern const Collection collectionTypeLUT[8];
bool Init();
void Shutdown();
void BeginFrame();
void CreateDeviceObjects();
void DestroyDeviceObjects();
void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray);
void Flush();
} // namespace

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXSHADER_H
#define _VERTEXSHADER_H
#include "Common.h"
const char *GenerateVertexShader();
// shader variables
#define I_POSNORMALMATRIX "cpnmtx"
#define I_PROJECTION "cproj"
#define I_MATERIALS "cmtrl"
#define I_LIGHTS "clights"
#define I_TEXMATRICES "ctexmtx"
#define I_TRANSFORMMATRICES "ctrmtx"
#define I_NORMALMATRICES "cnmtx"
#define I_POSTTRANSFORMMATRICES "cpostmtx"
#define I_FOGPARAMS "cfog"
#define C_POSNORMALMATRIX 0
#define C_PROJECTION (C_POSNORMALMATRIX+6)
#define C_MATERIALS (C_PROJECTION+4)
#define C_LIGHTS (C_MATERIALS+4)
#define C_TEXMATRICES (C_LIGHTS+40)
#define C_TRANSFORMMATRICES (C_TEXMATRICES+24)
#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64)
#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32)
#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64)
#define PS_CONST_COLORS 0
#define PS_CONST_KCOLORS 4
#define PS_CONST_CONSTALPHA 8
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _VERTEXSHADER_H
#define _VERTEXSHADER_H
#include "Common.h"
const char *GenerateVertexShader();
// shader variables
#define I_POSNORMALMATRIX "cpnmtx"
#define I_PROJECTION "cproj"
#define I_MATERIALS "cmtrl"
#define I_LIGHTS "clights"
#define I_TEXMATRICES "ctexmtx"
#define I_TRANSFORMMATRICES "ctrmtx"
#define I_NORMALMATRICES "cnmtx"
#define I_POSTTRANSFORMMATRICES "cpostmtx"
#define I_FOGPARAMS "cfog"
#define C_POSNORMALMATRIX 0
#define C_PROJECTION (C_POSNORMALMATRIX+6)
#define C_MATERIALS (C_PROJECTION+4)
#define C_LIGHTS (C_MATERIALS+4)
#define C_TEXMATRICES (C_LIGHTS+40)
#define C_TRANSFORMMATRICES (C_TEXMATRICES+24)
#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64)
#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32)
#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64)
#define PS_CONST_COLORS 0
#define PS_CONST_KCOLORS 4
#define PS_CONST_CONSTALPHA 8
#endif

View File

@ -1,12 +1,12 @@
#pragma once
#include <windows.h>
class DialogManager
{
public:
static void AddDlg(HWND hDialog);
static bool IsDialogMessage(LPMSG message);
static void EnableAll(BOOL enable);
};
#pragma once
#include <windows.h>
class DialogManager
{
public:
static void AddDlg(HWND hDialog);
static bool IsDialogMessage(LPMSG message);
static void EnableAll(BOOL enable);
};

View File

@ -1,61 +1,61 @@
#ifndef __LAMEFILE_H__
#define __LAMEFILE_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
namespace W32Util
{
enum eFileMode
{
FILE_READ=5,
FILE_WRITE=6,
FILE_ERROR=0xff
};
class File
{
HANDLE fileHandle;
eFileMode mode;
bool isOpen;
public:
File();
virtual ~File();
bool Open(const TCHAR *filename, eFileMode mode);
void Adopt(HANDLE h) { fileHandle = h;}
void Close();
void WriteInt(int i);
void WriteChar(char i);
int Write(void *data, int size);
int ReadInt();
char ReadChar();
int Read(void *data, int size);
int WR(void *data, int size); //write or read depending on open mode
bool MagicCookie(int cookie);
int GetSize();
eFileMode GetMode() {return mode;}
void SeekBeg(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
}
void SeekEnd(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
}
void SeekCurrent(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
}
};
}
#ifndef __LAMEFILE_H__
#define __LAMEFILE_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
namespace W32Util
{
enum eFileMode
{
FILE_READ=5,
FILE_WRITE=6,
FILE_ERROR=0xff
};
class File
{
HANDLE fileHandle;
eFileMode mode;
bool isOpen;
public:
File();
virtual ~File();
bool Open(const TCHAR *filename, eFileMode mode);
void Adopt(HANDLE h) { fileHandle = h;}
void Close();
void WriteInt(int i);
void WriteChar(char i);
int Write(void *data, int size);
int ReadInt();
char ReadChar();
int Read(void *data, int size);
int WR(void *data, int size); //write or read depending on open mode
bool MagicCookie(int cookie);
int GetSize();
eFileMode GetMode() {return mode;}
void SeekBeg(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
}
void SeekEnd(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
}
void SeekCurrent(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
}
};
}
#endif //__LAMEFILE_H__

View File

@ -1,9 +1,9 @@
#pragma once
namespace W32Util
{
void CenterWindow(HWND hwnd);
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h);
void NiceSizeFormat(size_t size, char *out);
BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text);
#pragma once
namespace W32Util
{
void CenterWindow(HWND hwnd);
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h);
void NiceSizeFormat(size_t size, char *out);
BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text);
}

View File

@ -1,86 +1,86 @@
#pragma once
#include <vector>
namespace W32Util
{
class PropSheet;
class Tab
{
public:
PropSheet *sheet; //back pointer ..
virtual void Init(HWND hDlg) {}
virtual void Command(HWND hDlg, WPARAM wParam) {}
virtual void Apply(HWND hDlg) {}
virtual bool HasPrev() {return true;}
virtual bool HasFinish() {return false;}
virtual bool HasNext() {return true;}
static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
};
class WizExteriorPage : public Tab
{
int captionID;
public:
WizExteriorPage(int caption) {captionID = caption;}
void Init(HWND hDlg);
};
class WizFirstPage : public WizExteriorPage
{
public:
WizFirstPage(int caption) : WizExteriorPage(caption) {}
bool HasPrev() {return false;}
};
class WizLastPage : public WizExteriorPage
{
public:
WizLastPage(int caption) : WizExteriorPage(caption) {}
bool HasNext() {return false;}
bool HasFinish() {return true;}
};
class WizInteriorPage : public Tab
{
public:
};
class PropSheet
{
LPCTSTR watermark;
LPCTSTR header;
HFONT hTitleFont;
HFONT hDialogFont;
HICON icon;
struct Page
{
Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0)
: tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {}
Tab *tab;
LPCTSTR resource;
LPCTSTR title;
LPCTSTR hdrSubTitle;
};
public:
PropSheet();
typedef std::vector<Page> DlgList;
DlgList list;
void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;}
void SetHeader(LPCTSTR _header) {header=_header;}
void SetIcon(HICON _icon) {icon = _icon;}
void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0);
void Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage=0, bool floating = false, bool wizard = false);
HFONT GetTitleFont() {return hTitleFont;}
HFONT GetFont() {return hDialogFont;}
static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam);
};
#pragma once
#include <vector>
namespace W32Util
{
class PropSheet;
class Tab
{
public:
PropSheet *sheet; //back pointer ..
virtual void Init(HWND hDlg) {}
virtual void Command(HWND hDlg, WPARAM wParam) {}
virtual void Apply(HWND hDlg) {}
virtual bool HasPrev() {return true;}
virtual bool HasFinish() {return false;}
virtual bool HasNext() {return true;}
static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
};
class WizExteriorPage : public Tab
{
int captionID;
public:
WizExteriorPage(int caption) {captionID = caption;}
void Init(HWND hDlg);
};
class WizFirstPage : public WizExteriorPage
{
public:
WizFirstPage(int caption) : WizExteriorPage(caption) {}
bool HasPrev() {return false;}
};
class WizLastPage : public WizExteriorPage
{
public:
WizLastPage(int caption) : WizExteriorPage(caption) {}
bool HasNext() {return false;}
bool HasFinish() {return true;}
};
class WizInteriorPage : public Tab
{
public:
};
class PropSheet
{
LPCTSTR watermark;
LPCTSTR header;
HFONT hTitleFont;
HFONT hDialogFont;
HICON icon;
struct Page
{
Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0)
: tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {}
Tab *tab;
LPCTSTR resource;
LPCTSTR title;
LPCTSTR hdrSubTitle;
};
public:
PropSheet();
typedef std::vector<Page> DlgList;
DlgList list;
void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;}
void SetHeader(LPCTSTR _header) {header=_header;}
void SetIcon(HICON _icon) {icon = _icon;}
void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0);
void Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage=0, bool floating = false, bool wizard = false);
HFONT GetTitleFont() {return hTitleFont;}
HFONT GetFont() {return hDialogFont;}
static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam);
};
}

View File

@ -1,15 +1,15 @@
#pragma once
#include <xstring>
#include <vector>
namespace W32Util
{
std::string BrowseForFolder(HWND parent, char *title);
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
std::string& _strFileName);
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
#pragma once
#include <xstring>
#include <vector>
namespace W32Util
{
std::string BrowseForFolder(HWND parent, char *title);
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
std::string& _strFileName);
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
}

View File

@ -1,36 +1,36 @@
#pragma once
namespace W32Util
{
#define MAX_WIN_DIALOGS 32
class TabControl
{
private:
HINSTANCE m_hInstance;
HWND m_hWndParent;
HWND m_hTabCtrl;
HWND m_WinDialogs[MAX_WIN_DIALOGS];
int m_numDialogs;
public:
TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc);
~TabControl(void);
//
// --- tools ---
//
HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc);
void SelectDialog (int _nDialogId);
void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam);
};
}
#pragma once
namespace W32Util
{
#define MAX_WIN_DIALOGS 32
class TabControl
{
private:
HINSTANCE m_hInstance;
HWND m_hWndParent;
HWND m_hTabCtrl;
HWND m_WinDialogs[MAX_WIN_DIALOGS];
int m_numDialogs;
public:
TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc);
~TabControl(void);
//
// --- tools ---
//
HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc);
void SelectDialog (int _nDialogId);
void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam);
};
}

View File

@ -1,36 +1,36 @@
#pragma once
namespace W32Util
{
class Thread
{
private:
HANDLE _handle;
DWORD _tid; // thread id
public:
Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg);
~Thread () ;
//
// --- tools ---
//
void Resume(void);
void Suspend(void);
void WaitForDeath(void);
void Terminate(void);
void SetPriority(int _nPriority);
bool IsActive (void);
HANDLE GetHandle(void) {return _handle;}
};
}
#pragma once
namespace W32Util
{
class Thread
{
private:
HANDLE _handle;
DWORD _tid; // thread id
public:
Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg);
~Thread () ;
//
// --- tools ---
//
void Resume(void);
void Suspend(void);
void WaitForDeath(void);
void Terminate(void);
void SetPriority(int _nPriority);
bool IsActive (void);
HANDLE GetHandle(void) {return _handle;}
};
}

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _XFSTRUCTS_H
#define _XFSTRUCTS_H
#include "Common.h"
#include "Vec3.h"
#include "XFMemory.h"
void XFUpdateVP();
void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
void LoadIndexedXF(u32 val, int array);
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _XFSTRUCTS_H
#define _XFSTRUCTS_H
#include "Common.h"
#include "Vec3.h"
#include "XFMemory.h"
void XFUpdateVP();
void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
void LoadIndexedXF(u32 val, int array);
#endif

View File

@ -1,27 +1,27 @@
/* bmp_io.h 16 May 1999 */
#ifndef _BMP_IO_H
#define _BMP_IO_H
int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray,
int **garray, int **barray );
int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray,
int *garray, int *barray );
int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize );
int bmp_read_palette ( FILE *filein, int psize );
int bmp_read_test ( char *filein_name );
int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba );
int bmp_write_data ( FILE *fileout, int xsize, int ysize, char *rarray, char *garray, char *barray );
int bmp_write_header ( FILE *fileout, int xsize, int ysize );
int bmp_write_test ( char *fileout_name );
int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein );
int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein );
int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout );
int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout );
/* bmp_io.h 16 May 1999 */
#ifndef _BMP_IO_H
#define _BMP_IO_H
int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray,
int **garray, int **barray );
int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray,
int *garray, int *barray );
int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize );
int bmp_read_palette ( FILE *filein, int psize );
int bmp_read_test ( char *filein_name );
int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba );
int bmp_write_data ( FILE *fileout, int xsize, int ysize, char *rarray, char *garray, char *barray );
int bmp_write_header ( FILE *fileout, int xsize, int ysize );
int bmp_write_test ( char *fileout_name );
int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein );
int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein );
int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout );
int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout );
#endif

View File

@ -1,28 +1,28 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef MAIN_H
#define MAIN_H
#include "PluginSpecs_Video.h"
#include "Render.h"
extern SVideoInitialize g_VideoInitialize;
void DebugLog(const char* _fmt, ...);
#endif
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef MAIN_H
#define MAIN_H
#include "PluginSpecs_Video.h"
#include "Render.h"
extern SVideoInitialize g_VideoInitialize;
void DebugLog(const char* _fmt, ...);
#endif

Some files were not shown because too many files have changed in this diff Show More