2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-03-01 07:15:10 +00:00
|
|
|
#include <wx/wx.h>
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/filepicker.h>
|
|
|
|
#include <wx/statbmp.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/listctrl.h>
|
|
|
|
#include <wx/imaglist.h>
|
2010-06-08 02:03:44 +00:00
|
|
|
#include <wx/fontmap.h>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/HW/GCMemcard.h"
|
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/IniFile.h"
|
2008-12-10 02:41:55 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#undef MEMCARD_MANAGER_STYLE
|
|
|
|
#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX
|
2011-01-30 22:02:47 +00:00
|
|
|
#define MEMCARDMAN_TITLE _trans("Memory Card Manager WARNING-Make backups before using, should be fixed but could mangle stuff!")
|
2009-07-18 07:59:31 +00:00
|
|
|
|
2008-12-12 07:14:37 +00:00
|
|
|
#define E_SAVEFAILED "File write failed"
|
|
|
|
#define E_UNK "Unknown error"
|
2008-12-10 02:41:55 +00:00
|
|
|
#define FIRSTPAGE 0
|
2009-03-01 07:15:10 +00:00
|
|
|
|
2010-02-25 06:12:35 +00:00
|
|
|
class CMemcardManager : public wxDialog
|
2008-12-08 04:46:09 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-01-30 22:02:47 +00:00
|
|
|
CMemcardManager(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& title = wxGetTranslation(wxT(MEMCARDMAN_TITLE)),
|
2008-12-10 02:41:55 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE);
|
2008-12-08 04:46:09 +00:00
|
|
|
virtual ~CMemcardManager();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
int page[2];
|
|
|
|
int itemsPerPage;
|
|
|
|
int maxPages;
|
|
|
|
std::string DefaultMemcard[2];
|
|
|
|
std::string DefaultIOPath;
|
2008-12-10 02:41:55 +00:00
|
|
|
IniFile MemcardManagerIni;
|
2010-12-10 07:11:05 +00:00
|
|
|
IniFile::Section* iniMemcardSection;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-17 04:51:41 +00:00
|
|
|
wxButton* m_CopyFrom[2];
|
|
|
|
wxButton* m_SaveImport[2];
|
|
|
|
wxButton* m_SaveExport[2];
|
|
|
|
wxButton* m_Delete[2];
|
|
|
|
wxButton* m_NextPage[2];
|
|
|
|
wxButton* m_PrevPage[2];
|
|
|
|
wxButton* m_ConvertToGci;
|
2008-12-20 08:07:04 +00:00
|
|
|
wxFilePickerCtrl *m_MemcardPath[2];
|
|
|
|
wxStaticText *t_Status[2];
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
enum
|
|
|
|
{
|
2014-02-17 04:51:41 +00:00
|
|
|
ID_COPYFROM_A = 1000, // Do not rearrange these items,
|
|
|
|
ID_COPYFROM_B, // ID_..._B must be 1 more than ID_..._A
|
2008-12-10 02:41:55 +00:00
|
|
|
ID_FIXCHECKSUM_A,
|
|
|
|
ID_FIXCHECKSUM_B,
|
|
|
|
ID_DELETE_A,
|
2008-12-12 07:14:37 +00:00
|
|
|
ID_DELETE_B,
|
2008-12-10 02:41:55 +00:00
|
|
|
ID_SAVEEXPORT_A,
|
|
|
|
ID_SAVEEXPORT_B,
|
|
|
|
ID_SAVEIMPORT_A,
|
|
|
|
ID_SAVEIMPORT_B,
|
2009-02-22 03:23:48 +00:00
|
|
|
ID_EXPORTALL_A,
|
|
|
|
ID_EXPORTALL_B,
|
2008-12-08 04:46:09 +00:00
|
|
|
ID_CONVERTTOGCI,
|
2008-12-12 07:14:37 +00:00
|
|
|
ID_NEXTPAGE_A,
|
|
|
|
ID_NEXTPAGE_B,
|
|
|
|
ID_PREVPAGE_A,
|
|
|
|
ID_PREVPAGE_B,
|
2008-12-10 02:41:55 +00:00
|
|
|
ID_MEMCARDLIST_A,
|
|
|
|
ID_MEMCARDLIST_B,
|
2008-12-12 07:14:37 +00:00
|
|
|
ID_MEMCARDPATH_A,
|
|
|
|
ID_MEMCARDPATH_B,
|
2008-12-10 02:41:55 +00:00
|
|
|
ID_USEPAGES,
|
2008-12-08 04:46:09 +00:00
|
|
|
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
COLUMN_BANNER = 0,
|
|
|
|
COLUMN_TITLE,
|
|
|
|
COLUMN_COMMENT,
|
|
|
|
COLUMN_ICON,
|
|
|
|
COLUMN_BLOCKS,
|
|
|
|
COLUMN_FIRSTBLOCK,
|
2009-01-15 06:06:30 +00:00
|
|
|
COLUMN_GAMECODE,
|
|
|
|
COLUMN_MAKERCODE,
|
|
|
|
COLUMN_FILENAME,
|
|
|
|
COLUMN_BIFLAGS,
|
|
|
|
COLUMN_MODTIME,
|
|
|
|
COLUMN_IMAGEADD,
|
|
|
|
COLUMN_ICONFMT,
|
|
|
|
COLUMN_ANIMSPEED,
|
|
|
|
COLUMN_PERMISSIONS,
|
|
|
|
COLUMN_COPYCOUNTER,
|
|
|
|
COLUMN_COMMENTSADDRESS,
|
2008-12-08 04:46:09 +00:00
|
|
|
NUMBER_OF_COLUMN
|
|
|
|
};
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
GCMemcard *memoryCard[2];
|
|
|
|
|
|
|
|
void CreateGUIControls();
|
|
|
|
void CopyDeleteClick(wxCommandEvent& event);
|
2008-12-20 08:07:04 +00:00
|
|
|
bool ReloadMemcard(const char *fileName, int card);
|
2008-12-10 02:41:55 +00:00
|
|
|
void OnMenuChange(wxCommandEvent& event);
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnPageChange(wxCommandEvent& event);
|
|
|
|
void OnPathChange(wxFileDirPickerEvent& event);
|
2008-12-20 08:47:38 +00:00
|
|
|
void ChangePath(int id);
|
2008-12-13 11:30:00 +00:00
|
|
|
bool CopyDeleteSwitch(u32 error, int slot);
|
2010-12-10 07:11:05 +00:00
|
|
|
bool LoadSettings();
|
|
|
|
bool SaveSettings();
|
2008-12-10 02:41:55 +00:00
|
|
|
|
2010-12-10 07:11:05 +00:00
|
|
|
struct _mcmSettings
|
2008-12-10 02:41:55 +00:00
|
|
|
{
|
2011-02-06 01:56:45 +00:00
|
|
|
bool twoCardsLoaded;
|
|
|
|
bool usePages;
|
|
|
|
bool column[NUMBER_OF_COLUMN + 1];
|
|
|
|
} mcmSettings;
|
2010-12-10 07:11:05 +00:00
|
|
|
|
|
|
|
class CMemcardListCtrl : public wxListCtrl
|
|
|
|
{
|
2011-02-06 01:56:45 +00:00
|
|
|
//BEGIN_EVENT_TABLE(CMemcardManager::CMemcardListCtrl, wxListCtrl)
|
|
|
|
// EVT_RIGHT_DOWN(CMemcardManager::CMemcardListCtrl::OnRightClick)
|
|
|
|
//END_EVENT_TABLE()
|
2010-12-10 07:11:05 +00:00
|
|
|
public:
|
2011-02-06 01:56:45 +00:00
|
|
|
CMemcardListCtrl(wxWindow* parent, const wxWindowID id,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style, _mcmSettings& _mcmSetngs)
|
|
|
|
: wxListCtrl(parent, id, pos, size, style)
|
|
|
|
, __mcmSettings(_mcmSetngs)
|
|
|
|
{
|
2013-01-13 18:07:45 +00:00
|
|
|
Bind(wxEVT_RIGHT_DOWN, &CMemcardListCtrl::OnRightClick, this);
|
2011-02-06 01:56:45 +00:00
|
|
|
}
|
|
|
|
~CMemcardListCtrl()
|
|
|
|
{
|
2013-01-13 18:07:45 +00:00
|
|
|
Unbind(wxEVT_RIGHT_DOWN, &CMemcardListCtrl::OnRightClick, this);
|
2011-02-06 01:56:45 +00:00
|
|
|
}
|
2010-12-10 07:11:05 +00:00
|
|
|
_mcmSettings & __mcmSettings;
|
2014-02-17 04:51:41 +00:00
|
|
|
bool prevPage;
|
|
|
|
bool nextPage;
|
2008-12-10 02:41:55 +00:00
|
|
|
private:
|
2013-10-29 05:23:17 +00:00
|
|
|
void OnRightClick(wxMouseEvent& event);
|
2008-12-10 02:41:55 +00:00
|
|
|
};
|
2013-10-29 05:23:17 +00:00
|
|
|
|
2008-12-10 02:41:55 +00:00
|
|
|
CMemcardListCtrl *m_MemcardList[2];
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|