updated the filesystemviewer. maybe someone can help and explain why the treectrl doesn't work for me in non-debug builds?

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@807 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2008-10-09 05:33:24 +00:00
parent 4001e11116
commit eb65601f90
9 changed files with 247 additions and 82 deletions

View File

@ -38,8 +38,11 @@ class IVolume
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual std::string GetName() const = 0;
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;
virtual u32 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0;
enum ECountry

View File

@ -129,26 +129,6 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
return true;
}
std::string CVolumeDirectory::GetName() const
{
_dbg_assert_(DVDINTERFACE, m_diskHeader);
std::string name = (char*)(m_diskHeader + 0x20);
return name;
}
void CVolumeDirectory::SetName(std::string _Name)
{
_dbg_assert_(DVDINTERFACE, m_diskHeader);
u32 length = _Name.length();
if(length > MAX_NAME_LENGTH)
length = MAX_NAME_LENGTH;
memcpy(m_diskHeader + 0x20, _Name.c_str(), length);
m_diskHeader[length + 0x20] = 0;
}
std::string CVolumeDirectory::GetUniqueID() const
{
_dbg_assert_(DVDINTERFACE, m_diskHeader);
@ -222,6 +202,40 @@ IVolume::ECountry CVolumeDirectory::GetCountry() const
return(country);
}
std::string CVolumeDirectory::GetMakerID() const
{
return "VOID";
}
std::string CVolumeDirectory::GetName() const
{
_dbg_assert_(DVDINTERFACE, m_diskHeader);
std::string name = (char*)(m_diskHeader + 0x20);
return name;
}
void CVolumeDirectory::SetName(std::string _Name)
{
_dbg_assert_(DVDINTERFACE, m_diskHeader);
u32 length = _Name.length();
if(length > MAX_NAME_LENGTH)
length = MAX_NAME_LENGTH;
memcpy(m_diskHeader + 0x20, _Name.c_str(), length);
m_diskHeader[length + 0x20] = 0;
}
u32 CVolumeDirectory::GetFSTSize() const
{
return 0;
}
std::string CVolumeDirectory::GetApploaderDate() const
{
return "VOID";
}
u64 CVolumeDirectory::GetSize() const
{
return 0;

View File

@ -43,11 +43,17 @@ class CVolumeDirectory
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
std::string GetMakerID() const;
std::string GetName() const;
void SetName(std::string);
std::string GetUniqueID() const;
void SetUniqueID(std::string _ID);
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;

View File

@ -38,18 +38,6 @@ bool CVolumeGC::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
return m_pReader->Read(_Offset, _Length, _pBuffer);
}
std::string CVolumeGC::GetName() const
{
if (m_pReader == NULL)
return false;
char Name[128];
if (!Read(0x20, 0x60, (u8*)&Name))
return false;
return Name;
}
std::string CVolumeGC::GetUniqueID() const
{
static const std::string NO_UID("NO_UID");
@ -96,7 +84,7 @@ IVolume::ECountry CVolumeGC::GetCountry() const
case 'X':
country = COUNTRY_EUROPE;
break; // XIII <- uses X but is PAL rip
break; // XIII <- uses X but is PAL
case 'E':
country = COUNTRY_USA;
@ -119,6 +107,57 @@ IVolume::ECountry CVolumeGC::GetCountry() const
return(country);
}
std::string CVolumeGC::GetMakerID() const
{
if (m_pReader == NULL)
return false;
char makerID[3];
if (!Read(0x4, 0x2, (u8*)&makerID))
return false;
makerID[2] = 0;
return makerID;
}
std::string CVolumeGC::GetName() const
{
if (m_pReader == NULL)
return false;
char name[128];
if (!Read(0x20, 0x60, (u8*)&name))
return false;
return name;
}
u32 CVolumeGC::GetFSTSize() const
{
if (m_pReader == NULL)
return false;
u32 size;
if (!Read(0x428, 0x4, (u8*)&size))
return false;
return Common::swap32(size);
}
std::string CVolumeGC::GetApploaderDate() const
{
if (m_pReader == NULL)
return false;
char date[16];
if (!Read(0x2440, 0x10, (u8*)&date))
return false;
// Should be 0 already, but just in case
date[10] = 0;
return date;
}
u64 CVolumeGC::GetSize() const
{
if (m_pReader)

View File

@ -30,8 +30,11 @@ public:
CVolumeGC(IBlobReader* _pReader);
~CVolumeGC();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetName() const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;

View File

@ -86,26 +86,6 @@ CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
return(true);
}
std::string
CVolumeWiiCrypted::GetName() const
{
if (m_pReader == NULL)
{
return(false);
}
char Name[0xFF];
if (!Read(0x20, 0x60, (u8*)&Name))
{
return(false);
}
return(Name);
}
std::string
CVolumeWiiCrypted::GetUniqueID() const
{
@ -182,6 +162,82 @@ CVolumeWiiCrypted::GetCountry() const
return(country);
}
std::string
CVolumeWiiCrypted::GetMakerID() const
{
if (m_pReader == NULL)
{
return(false);
}
char makerID[3];
if (!Read(0x4, 0x2, (u8*)&makerID))
{
return(false);
}
makerID[2] = 0;
return(makerID);
}
std::string
CVolumeWiiCrypted::GetName() const
{
if (m_pReader == NULL)
{
return(false);
}
char name[0xFF];
if (!Read(0x20, 0x60, (u8*)&name))
{
return(false);
}
return(name);
}
u32
CVolumeWiiCrypted::GetFSTSize() const
{
if (m_pReader == NULL)
{
return(false);
}
u32 size;
if (!Read(0x428, 0x4, (u8*)&size))
{
return(false);
}
return(size);
}
std::string
CVolumeWiiCrypted::GetApploaderDate() const
{
if (m_pReader == NULL)
{
return(false);
}
char date[16];
if (!Read(0x2440, 0x10, (u8*)&date))
{
return(false);
}
date[10] = 0;
return(date);
}
u64
CVolumeWiiCrypted::GetSize() const

View File

@ -32,8 +32,11 @@ public:
CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey);
~CVolumeWiiCrypted();
bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const;
std::string GetName() const;
std::string GetUniqueID() const;
std::string GetMakerID() const;
std::string GetName() const;
u32 GetFSTSize() const;
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;

View File

@ -17,9 +17,9 @@
#include "Globals.h"
#include "ISOFile.h"
#include "VolumeCreator.h"
#include "Filesystem.h"
//#include "BannerLoader.h"
#include "FilesystemViewer.h"
BEGIN_EVENT_TABLE(CFilesystemViewer, wxDialog)
@ -33,27 +33,70 @@ BEGIN_EVENT_TABLE(CFilesystemViewer, wxDialog)
EVT_MENU(IDM_REPLACEFILE, CFilesystemViewer::OnReplaceFile)
EVT_MENU(IDM_RENAMEFILE, CFilesystemViewer::OnRenameFile)
END_EVENT_TABLE()
DiscIO::IVolume* OpenIso = NULL;
DiscIO::IFileSystem* pFileSystem = NULL;
DiscIO::IVolume *OpenISO = NULL;
DiscIO::IFileSystem *pFileSystem = NULL;
CFilesystemViewer::CFilesystemViewer(const std::string fileName, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
std::vector<const DiscIO::SFileInfo *> Our_Files;
OpenIso = DiscIO::CreateVolumeFromFilename(fileName);
pFileSystem = DiscIO::CreateFileSystem(OpenIso);
OpenISO = DiscIO::CreateVolumeFromFilename(fileName);
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
pFileSystem->GetFileList(Our_Files);
GameListItem OpenISO_(fileName);
CreateGUIControls();
// shuffle2: things only appear in the tree for me when using debug build; why? :<
// TODO: make proper looking dirs
wxTreeItemId dirId = NULL;
for(u32 a = 1; a < Our_Files.size(); ++a)
m_Treectrl->AppendItem(RootId, wxString::FromAscii(Our_Files[a]->m_FullPath));//printf("%d dir? %s '%s'\n", a, Our_Files[a].IsDirectory() ? "True" : "False", Our_Files[a].m_FullPath);
{
m_Treectrl->AppendItem(RootId, wxString::Format("%s", Our_Files[a]->m_FullPath));
//if(Our_Files[a]->IsDirectory())
}
m_Treectrl->Expand(RootId);
// Disk header and apploader
m_Name->SetValue(wxString(OpenISO->GetName().c_str(), wxConvUTF8));
m_Serial->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
switch (OpenISO->GetCountry())
{
case OpenISO->COUNTRY_EUROPE:
case OpenISO->COUNTRY_FRANCE:
m_Country->SetValue(wxString::FromAscii("EUR"));
break;
case OpenISO->COUNTRY_USA:
m_Country->SetValue(wxString::FromAscii("USA"));
break;
case OpenISO->COUNTRY_JAP:
m_Country->SetValue(wxString::FromAscii("JAP"));
break;
default:
m_Country->SetValue(wxString::FromAscii("UNKNOWN"));
break;
}
m_MakerID->SetValue(wxString::Format("0x%s", OpenISO->GetMakerID().c_str()));
m_Date->SetValue(wxString(OpenISO->GetApploaderDate().c_str(), wxConvUTF8));
m_TOC->SetValue(wxString::Format("%u", OpenISO->GetFSTSize()));
// Banner
// ...all the BannerLoader functions are bool...gross
//m_Version;
m_ShortName->SetValue(wxString(OpenISO_.GetName().c_str(), wxConvUTF8));
//m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8));
m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too
m_Comment->SetValue(wxString(OpenISO_.GetDescription().c_str(), wxConvUTF8));
}
CFilesystemViewer::~CFilesystemViewer()
{
delete pFileSystem;
delete OpenIso;
delete OpenISO;
}
void CFilesystemViewer::CreateGUIControls()
@ -76,17 +119,17 @@ void CFilesystemViewer::CreateGUIControls()
m_TOCText = new wxStaticText(this, ID_TOC_TEXT, wxT("TOC Size:"), wxDefaultPosition, wxDefaultSize);
m_TOC = new wxTextCtrl(this, ID_TOC, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
sISODetails->Add(m_NameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_NameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_Name, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_SerialText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_SerialText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_Serial, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_CountryText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_CountryText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_Country, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_MakerIDText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_MakerIDText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_MakerID, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_DateText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_DateText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_Date, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sISODetails->Add(m_TOCText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
sISODetails->Add(m_TOCText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sISODetails->Add(m_TOC, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5);
@ -108,20 +151,20 @@ void CFilesystemViewer::CreateGUIControls()
m_CommentText = new wxStaticText(this, ID_COMMENT_TEXT, wxT("Comment:"), wxDefaultPosition, wxDefaultSize);
m_Comment = new wxTextCtrl(this, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
m_BannerText = new wxStaticText(this, ID_BANNER_TEXT, wxT("Banner:"), wxDefaultPosition, wxDefaultSize);
//needs to be image:
// Needs to be image:
m_Banner = new wxTextCtrl(this, ID_BANNER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
m_SaveBNR = new wxButton(this, ID_SAVEBNR, wxT("Save Changes to BNR"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_SaveBNR->Disable();
sBannerDetails->Add(m_VersionText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_VersionText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Version, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_LangText, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Lang, wxGBPosition(0, 3), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_ShortName, wxGBPosition(1, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_LongText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_LongText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_LongName, wxGBPosition(2, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_MakerText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_MakerText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sBannerDetails->Add(m_Maker, wxGBPosition(3, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
sBannerDetails->Add(m_CommentText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
sBannerDetails->Add(m_Comment, wxGBPosition(4, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
@ -137,15 +180,14 @@ void CFilesystemViewer::CreateGUIControls()
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
/////////////
wxGridBagSizer* sMain;
sMain = new wxGridBagSizer(0, 0);
sMain->Add(sbISODetails, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbBannerDetails, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sMain->Add(sbTreectrl, wxGBPosition(0, 1), wxGBSpan(2, 1), wxALL, 5);
sMain->Add(m_Close, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
this->SetSizer(sMain);
this->Layout();
Fit();

View File

@ -46,7 +46,6 @@ class CFilesystemViewer : public wxDialog
wxGridBagSizer *sBannerDetails;
wxStaticBoxSizer *sbTreectrl;
wxTreeCtrl *m_Treectrl;
wxButton *m_Close;