summaryrefslogtreecommitdiff
path: root/rbutil/rbutilApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilApp.cpp')
-rw-r--r--rbutil/rbutilApp.cpp58
1 files changed, 42 insertions, 16 deletions
diff --git a/rbutil/rbutilApp.cpp b/rbutil/rbutilApp.cpp
index 215e9ebc8e..c30e5b4aaa 100644
--- a/rbutil/rbutilApp.cpp
+++ b/rbutil/rbutilApp.cpp
@@ -19,6 +19,7 @@
19 ****************************************************************************/ 19 ****************************************************************************/
20 20
21#include "rbutilApp.h" 21#include "rbutilApp.h"
22#include "bootloaders.h"
22 23
23GlobalVars* gv = new GlobalVars(); 24GlobalVars* gv = new GlobalVars();
24 25
@@ -30,15 +31,16 @@ bool rbutilFrmApp::OnInit()
30 31
31 wxLogVerbose(wxT("=== begin rbutilFrmApp::Oninit()")); 32 wxLogVerbose(wxT("=== begin rbutilFrmApp::Oninit()"));
32 33
34
33 gv->stdpaths = new wxStandardPaths(); 35 gv->stdpaths = new wxStandardPaths();
34 36
35 // Get application directory 37 // Get application directory
36 // DANGER! GetDataDir() doesn't portably return the application directory 38 // DANGER! GetDataDir() doesn't portably return the application directory
37 // We want to use the form below instead, but not until wxWidgets 2.8 is 39 // We want to use the form below instead, but not until wxWidgets 2.8 is
38 // released. 40 // released. *Datadir gives the wrong dir for this on Linux/Mac even on Wx2.8 *
39 gv->AppDir = gv->stdpaths->GetExecutablePath().BeforeLast(PATH_SEP_CHR); 41 gv->AppDir = gv->stdpaths->GetExecutablePath().BeforeLast(PATH_SEP_CHR);
40// buf = gv->stdpaths->GetDataDir(); buf.Append(PATH_SEP); 42 // buf = gv->stdpaths->GetDataDir(); buf.Append(PATH_SEP);
41// gv->AppDir = buf.BeforeLast(PATH_SEP_CHR).c_str(); 43 // gv->AppDir = buf.BeforeLast(PATH_SEP_CHR).c_str();
42 44
43 buf = gv->stdpaths->GetUserDataDir(); 45 buf = gv->stdpaths->GetUserDataDir();
44 if (! wxDirExists(buf) ) 46 if (! wxDirExists(buf) )
@@ -80,6 +82,7 @@ bool rbutilFrmApp::OnInit()
80 SetTopWindow(myFrame); 82 SetTopWindow(myFrame);
81 myFrame->Show(TRUE); 83 myFrame->Show(TRUE);
82 84
85 initIpodpatcher(); // reserve mem for ipodpatcher
83 wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()")); 86 wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()"));
84 return TRUE; 87 return TRUE;
85} 88}
@@ -92,7 +95,7 @@ int rbutilFrmApp::OnExit()
92 95
93 gv->logfile->Close(); 96 gv->logfile->Close();
94 /* Enabling this code causes the program to crash. I 97 /* Enabling this code causes the program to crash. I
95 * have no idea why. 98 * have no idea why. (possibly because deleting non existing objects ? :-) )
96 wxLog::DontCreateOnDemand(); 99 wxLog::DontCreateOnDemand();
97 // Free a bunch of structures. 100 // Free a bunch of structures.
98 delete gv->GlobalConfig; 101 delete gv->GlobalConfig;
@@ -120,15 +123,15 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
120 // are of course the same directory. 123 // are of course the same directory.
121 buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->AppDir.c_str() ); 124 buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->AppDir.c_str() );
122 125
123 if (! wxFileExists(buf) ) 126// if (! wxFileExists(buf) )
124 { 127// {
125 gv->ResourceDir = gv->stdpaths->GetResourcesDir(); 128// gv->ResourceDir = gv->stdpaths->GetResourcesDir();
126 buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), 129// buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"),
127 gv->ResourceDir.c_str() ); 130// gv->ResourceDir.c_str() );
128 } else 131// } else
129 { 132// {
130 gv->ResourceDir = gv->AppDir; 133// gv->ResourceDir = gv->AppDir;
131 } 134// }
132 135
133 wxFileInputStream* cfgis = new wxFileInputStream(buf); 136 wxFileInputStream* cfgis = new wxFileInputStream(buf);
134 137
@@ -146,13 +149,33 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
146 gv->GlobalConfig->SetPath(wxT("/platforms")); 149 gv->GlobalConfig->SetPath(wxT("/platforms"));
147 while(gv->GlobalConfig->Read(buf.Format(wxT("platform%d"), i + 1), 150 while(gv->GlobalConfig->Read(buf.Format(wxT("platform%d"), i + 1),
148 &tmpstr)) { 151 &tmpstr)) {
149 gv->plat_id.Add(tmpstr); 152 wxString cur = tmpstr;
153 //gv->plat_id.Add(tmpstr);
150 gv->GlobalConfig->Read(buf.Format(wxT("/%s/name"), 154 gv->GlobalConfig->Read(buf.Format(wxT("/%s/name"),
151 gv->plat_id[i].c_str()), &tmpstr); 155 cur.c_str()), &tmpstr);
152 gv->plat_name.Add(tmpstr); 156 gv->plat_name.Add(tmpstr);
157 gv->GlobalConfig->Read(buf.Format(wxT("/%s/platform"),
158 cur.c_str()), &tmpstr);
159 gv->plat_id.Add(tmpstr);
153 gv->GlobalConfig->Read(buf.Format(wxT("/%s/released"), 160 gv->GlobalConfig->Read(buf.Format(wxT("/%s/released"),
154 gv->plat_id[i].c_str()), &tmpstr); 161 cur.c_str()), &tmpstr);
155 gv->plat_released.Add( (tmpstr == wxT("yes")) ? true : false ) ; 162 gv->plat_released.Add( (tmpstr == wxT("yes")) ? true : false ) ;
163 gv->GlobalConfig->Read(buf.Format(wxT("/%s/needsbootloader"),
164 cur.c_str()), &tmpstr);
165 gv->plat_needsbootloader.Add( (tmpstr == wxT("yes")) ? true : false ) ;
166 gv->GlobalConfig->Read(buf.Format(wxT("/%s/bootloadermethod"),
167 cur.c_str()), &tmpstr);
168 gv->plat_bootloadermethod.Add(tmpstr);
169 gv->GlobalConfig->Read(buf.Format(wxT("/%s/bootloadername"),
170 cur.c_str()), &tmpstr);
171 gv->plat_bootloadername.Add(tmpstr);
172 gv->GlobalConfig->Read(buf.Format(wxT("/%s/autodetect"),
173 cur.c_str()), &tmpstr);
174 gv->plat_autodetect.Add( (tmpstr == wxT("yes")) ? true : false ) ;
175 gv->GlobalConfig->Read(buf.Format(wxT("/%s/combinedname"),
176 cur.c_str()), &tmpstr);
177 gv->plat_combinedname.Add(tmpstr);
178
156 i++; 179 i++;
157 } 180 }
158 181
@@ -184,6 +207,9 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
184 gv->GlobalConfig->Read(wxT("prog_name"), &tmpstr); 207 gv->GlobalConfig->Read(wxT("prog_name"), &tmpstr);
185 gv->prog_name = tmpstr; 208 gv->prog_name = tmpstr;
186 209
210 gv->GlobalConfig->Read(wxT("bootloader_url"), &tmpstr);
211 gv->bootloader_url = tmpstr;
212
187#ifdef __WXMSW__ 213#ifdef __WXMSW__
188 gv->curdestdir = wxT("D:\\"); 214 gv->curdestdir = wxT("D:\\");
189#else 215#else