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
This commit is contained in:
daco65 2008-11-26 15:17:25 +00:00
parent 3f52c69513
commit 1580d6ecf1
2 changed files with 42 additions and 29 deletions

View File

@ -175,7 +175,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\Common\Src" AdditionalIncludeDirectories="..\Common\Src;..\..\..\Externals\wxWidgets\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableEnhancedInstructionSet="2" EnableEnhancedInstructionSet="2"

View File

@ -18,6 +18,7 @@
#include <vector> #include <vector>
#include "AES/aes.h" #include "AES/aes.h"
#include <wx/wx.h>
#include "VolumeCreator.h" #include "VolumeCreator.h"
@ -127,15 +128,20 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _VolumeType)
FILE* pT = fopen(WII_MASTERKEY_FILE, "rb"); FILE* pT = fopen(WII_MASTERKEY_FILE, "rb");
if (pT == NULL) 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]."); 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"); pT = fopen(WII_MASTERKEY_FILE_HEX, "r");
if(pT==NULL) if(pT==NULL){
PanicAlert("could not open " WII_MASTERKEY_FILE_HEX );
return NULL; return NULL;
}
static char hexkey[32]; static char hexkey[32];
if(fread(hexkey,1,32,pT)<32) if(fread(hexkey,1,32,pT)<32)
{ {
PanicAlert(WII_MASTERKEY_FILE_HEX " is not the right size" );
fclose(pT); fclose(pT);
return NULL; return NULL;
} }
@ -150,14 +156,21 @@ IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _VolumeType)
} }
pT = fopen(WII_MASTERKEY_FILE, "wb"); pT = fopen(WII_MASTERKEY_FILE, "wb");
if(pT==NULL) if(pT==NULL){
PanicAlert("could not open/make '" WII_MASTERKEY_FILE "' for writing!");
return NULL; return NULL;
}
fwrite(binkey,16,1,pT); fwrite(binkey,16,1,pT);
fclose(pT); fclose(pT);
pT = fopen(WII_MASTERKEY_FILE, "rb"); pT = fopen(WII_MASTERKEY_FILE, "rb");
if(pT==NULL) 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; return NULL;
} }