diff options
| author | daco65 <daco65@gmail.com> | 2008-11-26 15:17:25 +0000 |
|---|---|---|
| committer | daco65 <daco65@gmail.com> | 2008-11-26 15:17:25 +0000 |
| commit | 1580d6ecf11e00585e2167f97687de181e95f80c (patch) | |
| tree | b7595f831e245d7e5ab29cb1003932f9f854b607 /Source/Core/DiscIO/Src/VolumeCreator.cpp | |
| parent | 3f52c6951375fe93095ccdc72814933d7d15f4e2 (diff) | |
Let the user decide to convert the txt to the masterkey.bin
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1302 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO/Src/VolumeCreator.cpp')
| -rw-r--r-- | Source/Core/DiscIO/Src/VolumeCreator.cpp | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/Source/Core/DiscIO/Src/VolumeCreator.cpp b/Source/Core/DiscIO/Src/VolumeCreator.cpp index 69b846b86b..3591c545d6 100644 --- a/Source/Core/DiscIO/Src/VolumeCreator.cpp +++ b/Source/Core/DiscIO/Src/VolumeCreator.cpp @@ -18,6 +18,7 @@ #include <vector>
#include "AES/aes.h"
+#include <wx/wx.h>
#include "VolumeCreator.h"
@@ -127,37 +128,49 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _VolumeType) FILE* pT = fopen(WII_MASTERKEY_FILE, "rb");
if (pT == NULL)
{
- PanicAlert("Can't open '" WII_MASTERKEY_FILE "'.\n If you know the key, now it's the time to paste it into '" WII_MASTERKEY_FILE_HEX "' before pressing [OK].");
-
- pT = fopen(WII_MASTERKEY_FILE_HEX, "r");
- if(pT==NULL)
- return NULL;
-
- static char hexkey[32];
- if(fread(hexkey,1,32,pT)<32)
+ if (wxMessageBox(_("Can't open '" WII_MASTERKEY_FILE "'.\n If you know the key, now it's the time to paste it into '"
+ WII_MASTERKEY_FILE_HEX "' before pressing [YES]."),
+ wxMessageBoxCaptionStr, wxYES_NO|wxICON_EXCLAMATION) == wxYES)
{
+ pT = fopen(WII_MASTERKEY_FILE_HEX, "r");
+ if(pT==NULL){
+ PanicAlert("could not open " WII_MASTERKEY_FILE_HEX );
+ return NULL;
+ }
+
+ static char hexkey[32];
+ if(fread(hexkey,1,32,pT)<32)
+ {
+ PanicAlert(WII_MASTERKEY_FILE_HEX " is not the right size" );
+ fclose(pT);
+ return NULL;
+ }
fclose(pT);
- return NULL;
- }
- fclose(pT);
- static char binkey[16];
- char *t=hexkey;
- for(int i=0;i<16;i++)
- {
- char h[3]={*(t++),*(t++),0};
- binkey[i] = strtol(h,NULL,16);
- }
-
- pT = fopen(WII_MASTERKEY_FILE, "wb");
- if(pT==NULL)
- return NULL;
-
- fwrite(binkey,16,1,pT);
- fclose(pT);
+ static char binkey[16];
+ char *t=hexkey;
+ for(int i=0;i<16;i++)
+ {
+ char h[3]={*(t++),*(t++),0};
+ binkey[i] = strtol(h,NULL,16);
+ }
+
+ pT = fopen(WII_MASTERKEY_FILE, "wb");
+ if(pT==NULL){
+ PanicAlert("could not open/make '" WII_MASTERKEY_FILE "' for writing!");
+ return NULL;
+ }
+
+ fwrite(binkey,16,1,pT);
+ fclose(pT);
- pT = fopen(WII_MASTERKEY_FILE, "rb");
- if(pT==NULL)
+ pT = fopen(WII_MASTERKEY_FILE, "rb");
+ if(pT==NULL){
+ PanicAlert("could not open '" WII_MASTERKEY_FILE "' for reading!\n did the file get deleted or locked after converting?");
+ return NULL;
+ }
+ }
+ else
return NULL;
}
|
