mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Started Work on File System Viewer. It isn't very pretty yet
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@570 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
07421b08eb
commit
28cd7e220c
@ -159,8 +159,17 @@ void CFileSystemGCWii::GetStringFromOffset(u64 _Offset, char* Filename) const
|
||||
m_rVolume.Read(_Offset, 255, (u8*)Filename);
|
||||
}
|
||||
|
||||
size_t CFileSystemGCWii::GetFileList(std::vector<SFileInfo> *_rFilenames)
|
||||
{
|
||||
(*_rFilenames).resize(m_FileInfoVector.size());
|
||||
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
||||
{
|
||||
(*_rFilenames)[i] = m_FileInfoVector[i];
|
||||
}
|
||||
return m_FileInfoVector.size();
|
||||
}
|
||||
|
||||
const CFileSystemGCWii::SFileInfo*
|
||||
const SFileInfo*
|
||||
CFileSystemGCWii::FindFileInfo(const char* _rFullPath) const
|
||||
{
|
||||
for (size_t i = 0; i < m_FileInfoVector.size(); i++)
|
||||
|
@ -48,17 +48,6 @@ class CFileSystemGCWii
|
||||
|
||||
private:
|
||||
|
||||
// file info of an FST entry
|
||||
struct SFileInfo
|
||||
{
|
||||
u32 m_NameOffset;
|
||||
u64 m_Offset;
|
||||
u32 m_FileSize;
|
||||
char m_FullPath[512];
|
||||
|
||||
bool IsDirectory() {return((m_NameOffset& 0xFF000000) != 0 ? true : false);}
|
||||
};
|
||||
|
||||
typedef std::vector<SFileInfo>CFileInfoVector;
|
||||
CFileInfoVector m_FileInfoVector;
|
||||
|
||||
@ -68,6 +57,8 @@ class CFileSystemGCWii
|
||||
|
||||
u32 Read32(u64 _Offset) const;
|
||||
|
||||
virtual size_t GetFileList(std::vector<SFileInfo> *_rFilenames);
|
||||
|
||||
void GetStringFromOffset(u64 _Offset, char* Filename) const;
|
||||
|
||||
const SFileInfo* FindFileInfo(const char* _rFullPath) const;
|
||||
|
@ -33,7 +33,7 @@ class IFileSystem
|
||||
virtual bool IsInitialized() = 0;
|
||||
|
||||
|
||||
// virtual size_t GetFileList(std::vector<std::string&> _rFilenames) = 0;
|
||||
virtual size_t GetFileList(std::vector<SFileInfo> *_rFilenames) = 0;
|
||||
|
||||
virtual size_t GetFileSize(const char* _rFullPath) = 0;
|
||||
|
||||
|
@ -19,9 +19,20 @@
|
||||
#define _VOLUME_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// file info of an FST entry
|
||||
struct SFileInfo
|
||||
{
|
||||
u32 m_NameOffset;
|
||||
u64 m_Offset;
|
||||
u32 m_FileSize;
|
||||
char m_FullPath[512];
|
||||
|
||||
bool IsDirectory() {return((m_NameOffset& 0xFF000000) != 0 ? true : false);}
|
||||
};
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
//#include "VolumeCreator.h"
|
||||
//#include "Filesystem.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "Filesystem.h"
|
||||
//#include "BannerLoader.h"
|
||||
#include "FilesystemViewer.h"
|
||||
|
||||
@ -33,18 +33,26 @@ 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;
|
||||
|
||||
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)
|
||||
{
|
||||
/*DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(fileName);
|
||||
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(*pVolume);
|
||||
pFileSystem->*/
|
||||
OpenIso = DiscIO::CreateVolumeFromFilename(fileName);
|
||||
pFileSystem = DiscIO::CreateFileSystem(*OpenIso);
|
||||
std::vector<SFileInfo> Our_Files;
|
||||
pFileSystem->GetFileList(&Our_Files);
|
||||
CreateGUIControls();
|
||||
|
||||
for(int a = 0;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);
|
||||
}
|
||||
|
||||
CFilesystemViewer::~CFilesystemViewer()
|
||||
{
|
||||
delete pFileSystem;
|
||||
delete OpenIso;
|
||||
}
|
||||
|
||||
void CFilesystemViewer::CreateGUIControls()
|
||||
@ -127,7 +135,7 @@ void CFilesystemViewer::CreateGUIControls()
|
||||
m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, 450)/*wxDefaultSize*/, wxTR_DEFAULT_STYLE, wxDefaultValidator);
|
||||
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
|
||||
|
||||
m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
|
||||
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
|
||||
|
||||
/////////////
|
||||
wxGridBagSizer* sMain;
|
||||
@ -188,7 +196,23 @@ void CFilesystemViewer::OnBannerImageSave(wxCommandEvent& WXUNUSED (event))
|
||||
|
||||
void CFilesystemViewer::OnExtractFile(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
|
||||
wxString Path;
|
||||
wxString File;
|
||||
Path = wxFileSelector(
|
||||
_T("Export File"),
|
||||
wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
wxString::Format
|
||||
(
|
||||
_T("All files (%s)|%s"),
|
||||
wxFileSelectorDefaultWildcardStr
|
||||
),
|
||||
wxFD_SAVE,
|
||||
this);
|
||||
|
||||
File = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
|
||||
if (!Path || !File)
|
||||
return;
|
||||
pFileSystem->ExportFile(File.mb_str(), Path.mb_str());
|
||||
}
|
||||
|
||||
void CFilesystemViewer::OnReplaceFile(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -76,6 +76,7 @@ class CFilesystemViewer : public wxDialog
|
||||
wxTextCtrl *m_Maker;
|
||||
wxTextCtrl *m_Comment;
|
||||
wxTextCtrl *m_Banner;
|
||||
wxTreeItemId RootId;
|
||||
|
||||
wxChoice *m_Lang;
|
||||
wxButton *m_SaveBNR;
|
||||
|
@ -472,7 +472,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
||||
popupMenu.Append(IDM_EDITPATCHFILE, wxString::FromAscii(menu_text.c_str())); //Pretty much everything in wxwidgets is a wxString, try to convert to those first!
|
||||
popupMenu.Append(IDM_OPENCONTAININGFOLDER, wxString::FromAscii("Open &containing folder"));
|
||||
popupMenu.Append(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
|
||||
//popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
|
||||
popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
|
||||
|
||||
// F|RES: compression doesn't work and will be rewritten ... if it is fixed the gui is ready :D
|
||||
if (selected_iso->IsCompressed())
|
||||
|
Loading…
Reference in New Issue
Block a user