summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/ISOProperties.h
blob: 5db5af88105e2227ca7f07f21d3e484b6569def7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#pragma once

#include <cstddef>
#include <set>
#include <string>
#include <vector>
#include <wx/arrstr.h>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/toplevel.h>
#include <wx/translation.h>
#include <wx/treebase.h>
#include <wx/windowid.h>

#include "Common/IniFile.h"

class GameListItem;
class wxButton;
class wxCheckBox;
class wxCheckListBox;
class wxChoice;
class wxStaticBitmap;
class wxTextCtrl;
class wxTreeCtrl;
class wxWindow;
namespace DiscIO { struct SFileInfo; }
namespace Gecko { class CodeConfigPanel; }

struct PHackData
{
	bool PHackSZNear;
	bool PHackSZFar;
	std::string PHZNear;
	std::string PHZFar;
};

class CISOProperties : public wxDialog
{
public:
	CISOProperties(const std::string fileName,
			wxWindow* parent,
			wxWindowID id = 1,
			const wxString& title = _("Properties"),
			const wxPoint& pos = wxDefaultPosition,
			const wxSize& size = wxDefaultSize,
			long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
	virtual ~CISOProperties();

	bool bRefreshList;

	void ActionReplayList_Load();
	bool SaveGameConfig();

	PHackData PHack_Data;

private:
	DECLARE_EVENT_TABLE();

	// Core
	wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *TLBHack;
	wxCheckBox *VBeam, *SyncGPU, *FastDiscSpeed, *BlockMerging, *DSPHLE;
	// Wii
	wxCheckBox *EnableWideScreen;
	// Video
	wxCheckBox *PHackEnable, *UseBBox;
	wxButton *PHSettings;

	wxArrayString arrayStringFor_EmuState;
	wxChoice *EmuState;
	wxTextCtrl *EmuIssues;
	wxArrayString arrayStringFor_Patches;
	wxCheckListBox *Patches;
	wxButton *EditPatch;
	wxButton *RemovePatch;
	wxArrayString arrayStringFor_Cheats;
	wxCheckListBox *Cheats;
	wxButton *EditCheat;
	wxButton *RemoveCheat;
	wxArrayString arrayStringFor_Speedhacks;
	wxCheckListBox *Speedhacks;
	wxButton *EditSpeedhack;
	wxButton *AddSpeedhack;
	wxButton *RemoveSpeedhack;

	wxTextCtrl *m_Name;
	wxTextCtrl *m_GameID;
	wxTextCtrl *m_Country;
	wxTextCtrl *m_MakerID;
	wxTextCtrl *m_Revision;
	wxTextCtrl *m_Date;
	wxTextCtrl *m_FST;
	wxTextCtrl *m_MD5Sum;
	wxButton   *m_MD5SumCompute;
	wxArrayString arrayStringFor_Lang;
	wxChoice *m_Lang;
	wxTextCtrl *m_ShortName;
	wxTextCtrl *m_Maker;
	wxTextCtrl *m_Comment;
	wxStaticBitmap *m_Banner;

	wxTreeCtrl *m_Treectrl;
	wxTreeItemId RootId;

	Gecko::CodeConfigPanel *m_geckocode_panel;

	enum
	{
		ID_TREECTRL = 1000,

		ID_NOTEBOOK,
		ID_GAMECONFIG,
		ID_PATCH_PAGE,
		ID_ARCODE_PAGE,
		ID_SPEEDHACK_PAGE,
		ID_INFORMATION,
		ID_FILESYSTEM,

		ID_USEDUALCORE,
		ID_IDLESKIP,
		ID_MMU,
		ID_DCBZOFF,
		ID_TLBHACK,
		ID_VBEAM,
		ID_SYNCGPU,
		ID_DISCSPEED,
		ID_MERGEBLOCKS,
		ID_AUDIO_DSP_HLE,
		ID_USE_BBOX,
		ID_PHACKENABLE,
		ID_PHSETTINGS,
		ID_ENABLEPROGRESSIVESCAN,
		ID_ENABLEWIDESCREEN,
		ID_EDITCONFIG,
		ID_SHOWDEFAULTCONFIG,
		ID_EMUSTATE,
		ID_EMU_ISSUES,
		ID_PATCHES_LIST,
		ID_EDITPATCH,
		ID_ADDPATCH,
		ID_REMOVEPATCH,
		ID_CHEATS_LIST,
		ID_EDITCHEAT,
		ID_ADDCHEAT,
		ID_REMOVECHEAT,

		ID_NAME,
		ID_GAMEID,
		ID_COUNTRY,
		ID_MAKERID,
		ID_REVISION,
		ID_DATE,
		ID_FST,
		ID_MD5SUM,
		ID_MD5SUMCOMPUTE,
		ID_VERSION,
		ID_LANG,
		ID_SHORTNAME,
		ID_LONGNAME,
		ID_MAKER,
		ID_COMMENT,
		ID_BANNER,
		IDM_EXTRACTDIR,
		IDM_EXTRACTALL,
		IDM_EXTRACTFILE,
		IDM_EXTRACTAPPLOADER,
		IDM_EXTRACTDOL,
		IDM_CHECKINTEGRITY,
		IDM_BNRSAVEAS
	};

	void LaunchExternalEditor(const std::string& filename);

	void CreateGUIControls(bool);
	void OnClose(wxCloseEvent& event);
	void OnCloseClick(wxCommandEvent& event);
	void OnEditConfig(wxCommandEvent& event);
	void OnComputeMD5Sum(wxCommandEvent& event);
	void OnShowDefaultConfig(wxCommandEvent& event);
	void ListSelectionChanged(wxCommandEvent& event);
	void PatchButtonClicked(wxCommandEvent& event);
	void ActionReplayButtonClicked(wxCommandEvent& event);
	void RightClickOnBanner(wxMouseEvent& event);
	void OnBannerImageSave(wxCommandEvent& event);
	void OnRightClickOnTree(wxTreeEvent& event);
	void OnExtractFile(wxCommandEvent& event);
	void OnExtractDir(wxCommandEvent& event);
	void OnExtractDataFromHeader(wxCommandEvent& event);
	void CheckPartitionIntegrity(wxCommandEvent& event);
	void SetRefresh(wxCommandEvent& event);
	void OnChangeBannerLang(wxCommandEvent& event);
	void PHackButtonClicked(wxCommandEvent& event);

	GameListItem *OpenGameListItem;

	std::vector<const DiscIO::SFileInfo *> GCFiles;
	typedef std::vector<const DiscIO::SFileInfo *>::iterator fileIter;

	size_t CreateDirectoryTree(wxTreeItemId& parent,
			std::vector<const DiscIO::SFileInfo*> fileInfos,
			const size_t _FirstIndex,
			const size_t _LastIndex);
	void ExportDir(const std::string& _rFullPath, const std::string& _rExportFilename,
			const int partitionNum = 0);

	IniFile GameIniDefault;
	IniFile GameIniLocal;
	std::string GameIniFileDefault;
	std::string GameIniFileLocal;

	std::set<std::string> DefaultPatches;
	std::set<std::string> DefaultCheats;

	void LoadGameConfig();
	void PatchList_Load();
	void PatchList_Save();
	void ActionReplayList_Save();
	void ChangeBannerDetails(int lang);

	long GetElementStyle(const char* section, const char* key);
	void SetCheckboxValueFromGameini(const char* section, const char* key, wxCheckBox* checkbox);
	void SaveGameIniValueFrom3StateCheckbox(const char* section, const char* key, wxCheckBox* checkbox);
};