More GFX plugin cleanup, still no visible changes.

New right-click popup menu in game list - allow editing patch files easily.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@31 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-20 12:26:32 +00:00
parent c7795c41b7
commit 461077b1a1
52 changed files with 509 additions and 805 deletions
+17
View File
@@ -78,6 +78,23 @@ bool PanicYesNo(const char* format, ...)
}
bool AskYesNo(const char* format, ...)
{
va_list args;
va_start(args, format);
bool retval;
#ifdef _WIN32
std::string msg;
StringFromFormatV(&msg, format, args);
retval = IDYES == MessageBox(0, msg.c_str(), "Dolphin", MB_ICONQUESTION | MB_YESNO);
#elif __GNUC__
//vprintf(format, args);
return(true); //#error Do a messagebox!
#endif
va_end(args);
return(retval);
}
// Standard implementation of logging - simply print to standard output.
// Programs are welcome to override this.
/*
+2
View File
@@ -223,6 +223,8 @@ inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 3
void PanicAlert(const char* text, ...);
bool PanicYesNo(const char* text, ...);
bool AskYesNo(const char* text, ...);
extern void __Log(int logNumber, const char* text, ...);
+36 -1
View File
@@ -1,5 +1,6 @@
#include "Common.h"
#include "FileUtil.h"
#include <shellapi.h>
bool File::Exists(const std::string &filename)
{
@@ -8,4 +9,38 @@ bool File::Exists(const std::string &filename)
#else
return true; //TODO
#endif
}
}
std::string SanitizePath(const std::string &filename) {
std::string copy = filename;
for (int i = 0; i < copy.size(); i++)
if (copy[i] == '/') copy[i] = '\\';
return copy;
}
void File::Launch(const std::string &filename)
{
#ifdef _WIN32
std::string win_filename = SanitizePath(filename);
SHELLEXECUTEINFO shex = { sizeof(shex) };
shex.fMask = SEE_MASK_NO_CONSOLE; // | SEE_MASK_ASYNC_OK;
shex.lpVerb = "open";
shex.lpFile = win_filename.c_str();
shex.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&shex);
#endif
}
void File::Explore(const std::string &path)
{
#ifdef _WIN32
std::string win_path = SanitizePath(path);
SHELLEXECUTEINFO shex = { sizeof(shex) };
shex.fMask = SEE_MASK_NO_CONSOLE; // | SEE_MASK_ASYNC_OK;
shex.lpVerb = "explore";
shex.lpFile = win_path.c_str();
shex.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&shex);
#endif
}
+2
View File
@@ -7,6 +7,8 @@ class File
{
public:
static bool Exists(const std::string &filename);
static void Launch(const std::string &filename);
static void Explore(const std::string &path);
};
#endif
+1 -1
View File
@@ -113,7 +113,7 @@ void Execute(u32 _CurrentPC, u32 _Instruction)
}
else
{
_dbg_assert_(HLE, 0);
PanicAlert("HLE system tried to call an undefined HLE function %i.", FunctionIndex);
}
// _dbg_assert_msg_(HLE,NPC == LR, "Broken HLE function (doesn't set NPC)", OSPatches[pos].m_szPatchName);
+3 -3
View File
@@ -281,12 +281,12 @@ void Write16(const u16 _Value, const u32 _Address)
PluginDSP::DSP_WriteMailboxLow(true, _Value);
break;
case DSP_MAIL_FROM_DSP_HI:
_dbg_assert_(DSPINTERFACE,0);
case DSP_MAIL_FROM_DSP_HI:
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI");
break;
case DSP_MAIL_FROM_DSP_LO:
_dbg_assert_(DSPINTERFACE,0);
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO");
break;
// ==================================================================================
+1 -1
View File
@@ -38,7 +38,7 @@ class IBannerLoader
virtual bool GetBanner(u32* _pBannerImage) = 0;
virtual bool GetName(std::string& _rName) = 0;
virtual bool GetName(std::string& _rName, int language) = 0;
virtual bool GetCompany(std::string& _rCompany) = 0;
+4 -2
View File
@@ -82,7 +82,7 @@ CBannerLoaderGC::GetBanner(u32* _pBannerImage)
bool
CBannerLoaderGC::GetName(std::string& _rName)
CBannerLoaderGC::GetName(std::string& _rName, int language)
{
_rName = "invalid image";
@@ -93,7 +93,9 @@ CBannerLoaderGC::GetName(std::string& _rName)
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
if (!CopyToStringAndCheck(_rName, pBanner->comment[0].longTitle))
int lang = 0;
if (!CopyToStringAndCheck(_rName, language != 0 ? pBanner->comment[0].shortTitle : pBanner->comment[0].longTitle))
{
return(false);
}
+1 -1
View File
@@ -35,7 +35,7 @@ class CBannerLoaderGC
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
+1 -1
View File
@@ -89,7 +89,7 @@ CBannerLoaderWii::GetBanner(u32* _pBannerImage)
bool
CBannerLoaderWii::GetName(std::string& _rName)
CBannerLoaderWii::GetName(std::string& _rName, int language)
{
_rName = m_Name;
return(true);
+1 -1
View File
@@ -35,7 +35,7 @@ class CBannerLoaderWii
virtual bool GetBanner(u32* _pBannerImage);
virtual bool GetName(std::string& _rName);
virtual bool GetName(std::string& _rName, int language);
virtual bool GetCompany(std::string& _rCompany);
+9
View File
@@ -187,6 +187,15 @@ CFrame::CreateMenu()
m_pMenuBar->Append(fileMenu, _T("&File"));
}
// Game menu
{
wxMenu* pGameMenu = new wxMenu;
{
wxMenuItem *pItem = new wxMenuItem(pGameMenu, IDM_EDITPATCHFILE, "Edit patch file");
pGameMenu->Append(pItem);
}
}
// emulation menu
{
wxMenu* pEmulationMenu = new wxMenu;
+67 -3
View File
@@ -18,8 +18,10 @@
#include "Globals.h"
#include <wx/imaglist.h>
#include <algorithm>
#include "FileSearch.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "BootManager.h"
#include "Config.h"
@@ -42,6 +44,8 @@ EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag)
EVT_LIST_ITEM_SELECTED(LIST_CTRL, CGameListCtrl::OnSelected)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CGameListCtrl::OnActivated)
EVT_LIST_COL_END_DRAG(LIST_CTRL, CGameListCtrl::OnColEndDrag)
EVT_MENU(IDM_EDITPATCHFILE, CGameListCtrl::OnEditPatchFile)
EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
END_EVENT_TABLE()
@@ -116,6 +120,7 @@ CGameListCtrl::Update()
{
InsertItemInReportView(i);
}
SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
else
{
@@ -126,6 +131,7 @@ CGameListCtrl::Update()
long item = InsertItem(0, buf, -1);
SetItemFont(item, *wxITALIC_FONT);
SetColumnWidth(item, wxLIST_AUTOSIZE);
SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
AutomaticColumnWidth();
@@ -299,6 +305,7 @@ CGameListCtrl::ScanForISOs()
}
}
}
std::sort(m_ISOFiles.begin(), m_ISOFiles.end());
}
@@ -317,8 +324,25 @@ CGameListCtrl::OnColEndDrag(wxListEvent& WXUNUSED (event))
void
CGameListCtrl::OnRightClick(wxMouseEvent& WXUNUSED (event))
{}
CGameListCtrl::OnRightClick(wxMouseEvent& event)
{
// Focus the clicked item.
int flags;
long item = HitTest(event.GetPosition(), flags);
if (item != wxNOT_FOUND) {
SetItemState(item, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
}
const CISOFile *selected_iso = GetSelectedISO();
if (selected_iso) {
std::string unique_id = selected_iso->GetUniqueID();
wxMenu popupMenu;
std::string menu_text = StringFromFormat("Edit &patch file: %s.ini", unique_id.c_str());
popupMenu.Append(IDM_EDITPATCHFILE, menu_text);
popupMenu.Append(IDM_OPENCONTAININGFOLDER, "Open &containing folder");
PopupMenu(&popupMenu);
}
}
void
@@ -331,7 +355,6 @@ CGameListCtrl::OnActivated(wxListEvent& event)
else
{
size_t Index = event.GetData();
if (Index < m_ISOFiles.size())
{
const CISOFile& rISOFile = m_ISOFiles[Index];
@@ -340,6 +363,47 @@ CGameListCtrl::OnActivated(wxListEvent& event)
}
}
const CISOFile *
CGameListCtrl::GetSelectedISO() const
{
int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
return 0;
else
return &m_ISOFiles[GetItemData(item)];
}
void
CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) {
const CISOFile *iso = GetSelectedISO();
if (!iso)
return;
std::string path;
SplitPath(iso->GetFileName(), &path, 0, 0);
File::Explore(path);
}
void
CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
{
const CISOFile *iso = GetSelectedISO();
if (!iso)
return;
std::string filename = "Patches/" + iso->GetUniqueID() + ".ini";
if (!File::Exists(filename)) {
if (AskYesNo("%s.ini does not exist. Do you want to create it?", iso->GetUniqueID().c_str())) {
FILE *f = fopen(filename.c_str(), "w");
fprintf(f, "# %s - %s\r\n\r\n", iso->GetUniqueID().c_str(), iso->GetName().c_str());
fprintf(f, "[OnFrame]\r\n#Add memory patches here.\r\n\r\n");
fprintf(f, "[ActionReplay]\r\n#Add decrypted action replay cheats here.\r\n");
fclose(f);
} else {
return;
}
}
File::Launch(filename);
}
void
CGameListCtrl::OnSelected(wxListEvent& WXUNUSED (event))
+7 -8
View File
@@ -20,20 +20,18 @@
#include <vector>
#include "wx/listctrl.h"
#include "ISOFile.h"
// Define a new application
class CGameListCtrl
: public wxListCtrl
class CGameListCtrl : public wxListCtrl
{
public:
CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
void Update();
void BrowseForDirectory();
const CISOFile *GetSelectedISO() const;
private:
@@ -51,13 +49,12 @@ class CGameListCtrl
std::vector<int>m_FlagImageIndex;
bool m_test;
std::vector<CISOFile>m_ISOFiles;
std::vector<CISOFile> m_ISOFiles;
void InitBitmaps();
void InsertItemInReportView(size_t _Index);
void ScanForISOs();
DECLARE_EVENT_TABLE()
// events
@@ -68,6 +65,8 @@ class CGameListCtrl
void OnSelected(wxListEvent& event);
void OnActivated(wxListEvent& event);
void OnSize(wxSizeEvent& event);
void OnEditPatchFile(wxCommandEvent& event);
void OnOpenContainingFolder(wxCommandEvent& event);
virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
+2
View File
@@ -25,6 +25,8 @@ enum
IDM_PLAY,
IDM_STOP,
IDM_BROWSE,
IDM_EDITPATCHFILE,
IDM_OPENCONTAININGFOLDER,
IDM_PLUGIN_OPTIONS,
IDM_CONFIG_GFX_PLUGIN,
IDM_CONFIG_DSP_PLUGIN,
+2 -1
View File
@@ -44,6 +44,7 @@ CISOFile::CISOFile(const std::string& _rFileName)
m_Country = pVolume->GetCountry();
m_FileSize = pVolume->GetSize();
m_Name = pVolume->GetName();
m_UniqueID = pVolume->GetUniqueID();
// check if we can get some infos from the banner file too
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(*pVolume);
@@ -56,7 +57,7 @@ CISOFile::CISOFile(const std::string& _rFileName)
{
if (pBannerLoader->IsValid())
{
pBannerLoader->GetName(m_Name);
pBannerLoader->GetName(m_Name, 0); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
pBannerLoader->GetCompany(m_Company);
if (pBannerLoader->GetBanner(g_ImageTemp))
+6 -5
View File
@@ -29,30 +29,31 @@ class CISOFile
bool IsValid() const {return(m_Valid);}
const std::string& GetFileName() const {return(m_FileName);}
const std::string& GetName() const {return(m_Name);}
const std::string& GetCompany() const {return(m_Company);}
const std::string& GetUniqueID() const {return(m_UniqueID);}
DiscIO::IVolume::ECountry GetCountry() const {return(m_Country);}
u64 GetFileSize() const {return(m_FileSize);}
const wxImage& GetImage() const {return(m_Image);}
bool operator < (const CISOFile &other) const {
// HACK - they end up in reverse order in the list view
return strcmp(m_Name.c_str(), other.m_Name.c_str()) > 0;
}
private:
std::string m_FileName;
std::string m_Name;
std::string m_Company;
std::string m_UniqueID;
u64 m_FileSize;
+18 -2
View File
@@ -1,7 +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/
#include "Common.h"
#include "BPMemory.h"
//BP state
BPMemory bpmem;
BPMemory bpmem;
+46
View File
@@ -1,3 +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/
#ifndef _BPMEMORY_H
#define _BPMEMORY_H
@@ -5,6 +22,35 @@
#pragma pack(4)
#define BPMEM_GENMODE 0x00
#define BPMEM_IND_MTX 0x06
#define BPMEM_RAS1_SS0 0x25 // ind tex coord scale 0
#define BPMEM_RAS1_SS1 0x26 // ind tex coord scale 1
#define BPMEM_ZMODE 0x40
#define BPMEM_BLENDMODE 0x41
#define BPMEM_CONSTANTALPHA 0x42
#define BPMEM_ALPHACOMPARE 0xF3
#define BPMEM_LINEPTWIDTH 0x22
#define BPMEM_TEXINVALIDATE 0x66
#define BPMEM_SCISSORTL 0x20
#define BPMEM_SCISSORBR 0x21
#define BPMEM_SCISSOROFFSET 0x59
#define BPMEM_CLEARBBOX1 0x55 // let's hope not many games use bboxes..
#define BPMEM_CLEARBBOX2 0x56 // TODO(ector): add something that watches bboxes
#define BPMEM_TEXMODE0_1 0x80
#define BPMEM_TEXMODE0_2 0xA0
#define BPMEM_FOGPARAM0 0xEE
#define BPMEM_FOGBMAGNITUDE 0xEF
#define BPMEM_FOGBEXPONENT 0xF0
#define BPMEM_FOGPARAM3 0xF1
#define BPMEM_FOGCOLOR 0xF2
#define BPMEM_ZTEX1 0xF4
#define BPMEM_ZTEX2 0xF5
#define BPMEM_DRAWDONE 0x45
#define BPMEM_PE_TOKEN_ID 0x47
#define BPMEM_PE_TOKEN_INT_ID 0x48
//////////////////////////////////////////////////////////////////////////
// Tev/combiner things
//////////////////////////////////////////////////////////////////////////
+19 -1
View File
@@ -1,7 +1,25 @@
// 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 "Common.h"
#include "CPMemory.h"
// CP state
u32 arraybases[16];
u32 arraystrides[16];
TMatrixIndexA MatrixIndexA;
TMatrixIndexB MatrixIndexB;

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