diff options
Diffstat (limited to 'rbutil/bootloaders.cpp')
-rwxr-xr-x | rbutil/bootloaders.cpp | 140 |
1 files changed, 71 insertions, 69 deletions
diff --git a/rbutil/bootloaders.cpp b/rbutil/bootloaders.cpp index 039451f247..56f936e4ff 100755 --- a/rbutil/bootloaders.cpp +++ b/rbutil/bootloaders.cpp | |||
@@ -55,14 +55,14 @@ bool ipodpatcher(int mode,wxString bootloadername) | |||
55 | // downloading files | 55 | // downloading files |
56 | if(mode == BOOTLOADER_ADD) | 56 | if(mode == BOOTLOADER_ADD) |
57 | { | 57 | { |
58 | src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str()); | 58 | src = gv->bootloader_url + wxT("/ipod/") |
59 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 59 | + bootloadername + wxT(".ipod"); |
60 | gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); | 60 | dest = gv->stdpaths->GetUserDataDir() |
61 | + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername; | ||
61 | if ( DownloadURL(src, dest) ) | 62 | if ( DownloadURL(src, dest) ) |
62 | { | 63 | { |
63 | wxRemoveFile(dest); | 64 | wxRemoveFile(dest); |
64 | buf.Printf(wxT("Unable to download %s"), src.c_str() ); | 65 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install")); |
65 | ERR_DIALOG(buf, wxT("Install")); | ||
66 | return false; | 66 | return false; |
67 | } | 67 | } |
68 | } | 68 | } |
@@ -191,14 +191,14 @@ bool sansapatcher(int mode,wxString bootloadername) | |||
191 | // downloading files | 191 | // downloading files |
192 | if(mode == BOOTLOADER_ADD) | 192 | if(mode == BOOTLOADER_ADD) |
193 | { | 193 | { |
194 | src.Printf(wxT("%s/sandisk-sansa/e200/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); | 194 | src = gv->bootloader_url + wxT("/sandisk-sansa/e200/") |
195 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 195 | + bootloadername; |
196 | gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); | 196 | dest = gv->stdpaths->GetUserDataDir() |
197 | + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername; | ||
197 | if ( DownloadURL(src, dest) ) | 198 | if ( DownloadURL(src, dest) ) |
198 | { | 199 | { |
199 | wxRemoveFile(dest); | 200 | wxRemoveFile(dest); |
200 | buf.Printf(wxT("Unable to download %s"), src.c_str() ); | 201 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Download")); |
201 | ERR_DIALOG(buf, wxT("Download")); | ||
202 | return false; | 202 | return false; |
203 | } | 203 | } |
204 | } | 204 | } |
@@ -270,27 +270,26 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir) | |||
270 | wxString err; | 270 | wxString err; |
271 | wxString src,dest; | 271 | wxString src,dest; |
272 | 272 | ||
273 | path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),deviceDir.c_str()); | 273 | path1 = deviceDir |
274 | + wxT("" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"); | ||
274 | 275 | ||
275 | if(mode == BOOTLOADER_ADD) | 276 | if(mode == BOOTLOADER_ADD) |
276 | { | 277 | { |
277 | //Files downloaden | 278 | //Files downloaden |
278 | src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); | 279 | src = gv->bootloader_url + wxT("/gigabeat/") + bootloadername; |
279 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 280 | dest = gv->stdpaths->GetUserDataDir() |
280 | gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); | 281 | + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername; |
281 | if( DownloadURL(src, dest) ) | 282 | if( DownloadURL(src, dest) ) |
282 | { | 283 | { |
283 | wxRemoveFile(dest); | 284 | wxRemoveFile(dest); |
284 | err.Printf(wxT("Unable to download %s"), src.c_str() ); | 285 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install")); |
285 | ERR_DIALOG(err, wxT("Install")); | ||
286 | return false; | 286 | return false; |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | if(!wxFileExists(path1)) | 290 | if(!wxFileExists(path1)) |
291 | { | 291 | { |
292 | err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); | 292 | ERR_DIALOG(wxT("[ERR] Coud not find ")+path1, wxT("Bootloader add")); |
293 | ERR_DIALOG(err, wxT("Bootloader add")); | ||
294 | return false; | 293 | return false; |
295 | } | 294 | } |
296 | path2 = path1; | 295 | path2 = path1; |
@@ -299,8 +298,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir) | |||
299 | { | 298 | { |
300 | if(!wxRenameFile(path1,path2,false)) | 299 | if(!wxRenameFile(path1,path2,false)) |
301 | { | 300 | { |
302 | err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); | 301 | ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ") |
303 | ERR_DIALOG(err, wxT("Bootloader add")); | 302 | + path2, wxT("Bootloader add")); |
304 | return false; | 303 | return false; |
305 | } | 304 | } |
306 | } | 305 | } |
@@ -308,8 +307,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir) | |||
308 | 307 | ||
309 | if(!wxCopyFile(dest,path1)) | 308 | if(!wxCopyFile(dest,path1)) |
310 | { | 309 | { |
311 | err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); | 310 | ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ") |
312 | ERR_DIALOG(err, wxT("Bootloader add")); | 311 | + path2, wxT("Bootloader add")); |
313 | return false; | 312 | return false; |
314 | } | 313 | } |
315 | } | 314 | } |
@@ -319,14 +318,14 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir) | |||
319 | path2.Append(wxT(".ORIG")); | 318 | path2.Append(wxT(".ORIG")); |
320 | if(!wxFileExists(path2)) | 319 | if(!wxFileExists(path2)) |
321 | { | 320 | { |
322 | err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); | 321 | ERR_DIALOG(wxT("[ERR] Coud not find ") + path1, |
323 | ERR_DIALOG(err, wxT("Bootloader del")); | 322 | wxT("Bootloader del")); |
324 | return false; | 323 | return false; |
325 | } | 324 | } |
326 | if(!wxRenameFile(path2,path1,true)) | 325 | if(!wxRenameFile(path2,path1,true)) |
327 | { | 326 | { |
328 | err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); | 327 | ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ") |
329 | ERR_DIALOG(err, wxT("Bootloader del")); | 328 | + path2, wxT("Bootloader del")); |
330 | return false; | 329 | return false; |
331 | } | 330 | } |
332 | } | 331 | } |
@@ -340,27 +339,27 @@ bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir) | |||
340 | wxString err; | 339 | wxString err; |
341 | wxString src,dest; | 340 | wxString src,dest; |
342 | 341 | ||
343 | path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),deviceDir.c_str(),bootloadername.c_str()); | 342 | path1 = deviceDir + wxT("" PATH_SEP "FIRMWARE" PATH_SEP) |
343 | + bootloadername; | ||
344 | 344 | ||
345 | if(mode == BOOTLOADER_ADD) | 345 | if(mode == BOOTLOADER_ADD) |
346 | { | 346 | { |
347 | //Files downloaden | 347 | //Files downloaden |
348 | src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); | 348 | src = gv->bootloader_url + wxT("/iaudio/") + bootloadername; |
349 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 349 | dest = gv->stdpaths->GetUserDataDir() |
350 | gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); | 350 | + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername; |
351 | if( DownloadURL(src, dest) ) | 351 | if( DownloadURL(src, dest) ) |
352 | { | 352 | { |
353 | wxRemoveFile(dest); | 353 | wxRemoveFile(dest); |
354 | err.Printf(wxT("Unable to download %s"), src.c_str() ); | 354 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install")); |
355 | ERR_DIALOG(err, wxT("Install")); | ||
356 | return false; | 355 | return false; |
357 | } | 356 | } |
358 | 357 | ||
359 | // copy file | 358 | // copy file |
360 | if(!wxCopyFile(dest,path1)) | 359 | if(!wxCopyFile(dest,path1)) |
361 | { | 360 | { |
362 | err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); | 361 | ERR_DIALOG(wxT("[ERR] Coud not copy ")+dest+wxT(" to ")+path2, |
363 | ERR_DIALOG(err, wxT("Bootloader add")); | 362 | wxT("Bootloader add")); |
364 | return false; | 363 | return false; |
365 | } | 364 | } |
366 | 365 | ||
@@ -383,27 +382,26 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir) | |||
383 | if(mode == BOOTLOADER_ADD) | 382 | if(mode == BOOTLOADER_ADD) |
384 | { | 383 | { |
385 | //Files downloaden | 384 | //Files downloaden |
386 | src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); | 385 | src = gv->bootloader_url + wxT("/iriver/") + bootloadername; |
387 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 386 | dest = gv->stdpaths->GetUserDataDir() |
388 | gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str()); | 387 | + wxT("" PATH_SEP "download" PATH_SEP) + firmwarename; |
389 | if( DownloadURL(src, dest) ) | 388 | if( DownloadURL(src, dest) ) |
390 | { | 389 | { |
391 | wxRemoveFile(dest); | 390 | wxRemoveFile(dest); |
392 | err.Printf(wxT("Unable to download %s"), src.c_str() ); | 391 | ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install")); |
393 | ERR_DIALOG(err, wxT("Install")); | ||
394 | return false; | 392 | return false; |
395 | } | 393 | } |
396 | 394 | ||
397 | path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); | 395 | path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename; |
398 | path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str()); | 396 | path2 = deviceDir + wxT("SYSTEM" PATH_SEP "Original.mi4"); |
399 | 397 | ||
400 | if(!wxFileExists(path1)) //Firmware dosent exists on player | 398 | if(!wxFileExists(path1)) //Firmware dosent exists on player |
401 | { | 399 | { |
402 | path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename | 400 | path1 = deviceDir + wxT("SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename |
403 | if(!wxFileExists(path1)) //Firmware dosent exists on player | 401 | if(!wxFileExists(path1)) //Firmware dosent exists on player |
404 | { | 402 | { |
405 | err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); | 403 | ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"), |
406 | ERR_DIALOG(err, wxT("Bootloader add")); | 404 | wxT("Bootloader add")); |
407 | return false; | 405 | return false; |
408 | } | 406 | } |
409 | } | 407 | } |
@@ -411,16 +409,16 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir) | |||
411 | { | 409 | { |
412 | if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original | 410 | if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original |
413 | { | 411 | { |
414 | err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); | 412 | ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ") |
415 | ERR_DIALOG(err, wxT("Bootloader add")); | 413 | + path2, wxT("Bootloader add")); |
416 | return false; | 414 | return false; |
417 | } | 415 | } |
418 | } | 416 | } |
419 | 417 | ||
420 | if(!wxCopyFile(dest,path1)) // copy file | 418 | if(!wxCopyFile(dest,path1)) // copy file |
421 | { | 419 | { |
422 | err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path1.c_str()); | 420 | ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ") + path1, |
423 | ERR_DIALOG(err,wxT("Bootloader add")); | 421 | wxT("Bootloader add")); |
424 | return false; | 422 | return false; |
425 | } | 423 | } |
426 | 424 | ||
@@ -429,30 +427,30 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir) | |||
429 | } | 427 | } |
430 | else if(mode == BOOTLOADER_REM) | 428 | else if(mode == BOOTLOADER_REM) |
431 | { | 429 | { |
432 | path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); | 430 | path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename; |
433 | path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str()); | 431 | path2 = gv->curdestdir + wxT("SYSTEM" PATH_SEP "Original.mi4"); |
434 | if(!wxFileExists(path1)) //Firmware dosent exists on player | 432 | if(!wxFileExists(path1)) //Firmware dosent exists on player |
435 | { | 433 | { |
436 | path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename | 434 | path1 = deviceDir + wxT("" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename |
437 | if(!wxFileExists(path1)) //Firmware dosent exists on player | 435 | if(!wxFileExists(path1)) //Firmware dosent exists on player |
438 | { | 436 | { |
439 | err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); | 437 | ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"), |
440 | ERR_DIALOG(err, wxT("Bootloader rem")); | 438 | wxT("Bootloader rem")); |
441 | return false; | 439 | return false; |
442 | } | 440 | } |
443 | } | 441 | } |
444 | 442 | ||
445 | if(!wxFileExists(path2)) //Original Firmware dosent exists on player | 443 | if(!wxFileExists(path2)) //Original Firmware dosent exists on player |
446 | { | 444 | { |
447 | err.Printf(wxT("[ERR] File %s does not Exist"),path2.c_str()); | 445 | ERR_DIALOG(wxT("[ERR] File ") + path2 + wxT(" does not Exist"), |
448 | ERR_DIALOG(err, wxT("Bootloader rem")); | 446 | wxT("Bootloader rem")); |
449 | return false; | 447 | return false; |
450 | } | 448 | } |
451 | 449 | ||
452 | if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original | 450 | if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original |
453 | { | 451 | { |
454 | err.Printf(wxT("[ERR] Coud not rename %s to %s"),path2.c_str(),path1.c_str()); | 452 | ERR_DIALOG(wxT("[ERR] Coud not rename ") + path2 + wxT(" to ") |
455 | ERR_DIALOG(err, wxT("Bootloader add")); | 453 | + path1, wxT("Bootloader add")); |
456 | return false; | 454 | return false; |
457 | } | 455 | } |
458 | 456 | ||
@@ -503,38 +501,42 @@ bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firm | |||
503 | else | 501 | else |
504 | { | 502 | { |
505 | //Download bootloader | 503 | //Download bootloader |
506 | src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); | 504 | src = gv->bootloader_url + wxT("/iriver/") |
507 | dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), | 505 | + bootloadername; |
508 | gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); | 506 | dest = gv->stdpaths->GetUserDataDir() |
507 | + wxT("" PATH_SEP "download" PATH_SEP) | ||
508 | + bootloadername; | ||
509 | if( DownloadURL(src, dest) ) | 509 | if( DownloadURL(src, dest) ) |
510 | { | 510 | { |
511 | wxRemoveFile(dest); | 511 | wxRemoveFile(dest); |
512 | err.Printf(wxT("Unable to download %s"), src.c_str() ); | 512 | ERR_DIALOG(wxT("Unable to download ") + src, |
513 | ERR_DIALOG(err, wxT("Install")); | 513 | wxT("Install")); |
514 | return false; | 514 | return false; |
515 | } | 515 | } |
516 | 516 | ||
517 | if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware | 517 | if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware |
518 | { | 518 | { |
519 | ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware")); | 519 | ERR_DIALOG(wxT("Patching Firmware failed"), |
520 | wxT("Patching Firmware")); | ||
520 | return false; | 521 | return false; |
521 | } | 522 | } |
522 | } | 523 | } |
523 | 524 | ||
524 | // Load patched Firmware to player | 525 | // Load patched Firmware to player |
525 | src.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"), | 526 | src = gv->stdpaths->GetUserDataDir() |
526 | gv->stdpaths->GetUserDataDir().c_str()); | 527 | + wxT("" PATH_SEP "download" PATH_SEP "new.hex"); |
527 | 528 | ||
528 | if(gv->curplat == wxT("h100")) | 529 | if(gv->curplat == wxT("h100")) |
529 | dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),deviceDir.c_str()); | 530 | dest = deviceDir + wxT("" PATH_SEP "ihp_100.hex"); |
530 | else if(gv->curplat == wxT("h120")) | 531 | else if(gv->curplat == wxT("h120")) |
531 | dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),deviceDir.c_str()); | 532 | dest = deviceDir + wxT("" PATH_SEP "ihp_120.hex"); |
532 | else if(gv->curplat == wxT("h300")) | 533 | else if(gv->curplat == wxT("h300")) |
533 | dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str()); | 534 | dest = deviceDir + wxT("" PATH_SEP "H300.hex"); |
534 | 535 | ||
535 | if(!wxRenameFile(src,dest)) | 536 | if(!wxRenameFile(src,dest)) |
536 | { | 537 | { |
537 | ERR_DIALOG(wxT("Copying Firmware to Device failed"), wxT("Copying Firmware")); | 538 | ERR_DIALOG(wxT("Copying Firmware to Device failed"), |
539 | wxT("Copying Firmware")); | ||
538 | return false; | 540 | return false; |
539 | } | 541 | } |
540 | else | 542 | else |