Remove all tab/space mismatches from the DolphinWX project (at least 99%. I promise!)

Also fix up the dangling else's. Shit just looks incredibly ugly in terms of actual structure in the code.

I took the liberty of adding comments in FifoPlayerDlg.cpp, LogConfigWindow.cpp, LogWindow.cpp, and FrameAui.cpp to better explain some things.

If any comments are wrong, don't hesitate to complain.
This commit is contained in:
Lioncash
2013-04-08 01:16:50 -04:00
parent 5b2d9a7d9f
commit 1db10b139c
36 changed files with 584 additions and 295 deletions

View File

@ -43,7 +43,7 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
if (!TitleID) // Import
{
AES_set_decrypt_key(SDKey, 128, &m_AES_KEY);
AES_set_decrypt_key(SDKey, 128, &m_AES_KEY);
do
{
b_valid = true;
@ -56,12 +56,15 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
SuccessAlertT("Successfully imported save files");
b_tryAgain = false;
}
else b_tryAgain = AskYesNoT("Import failed, try again?");
}while(b_tryAgain);
else
{
b_tryAgain = AskYesNoT("Import failed, try again?");
}
} while(b_tryAgain);
}
else
{
AES_set_encrypt_key(SDKey, 128, &m_AES_KEY);
AES_set_encrypt_key(SDKey, 128, &m_AES_KEY);
if (getPaths(true))
{
@ -77,8 +80,11 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID)
SuccessAlertT("Successfully exported file to %s", pathData_bin);
b_tryAgain = false;
}
else b_tryAgain = AskYesNoT("Export failed, try again?");
}while(b_tryAgain);
else
{
b_tryAgain = AskYesNoT("Export failed, try again?");
}
} while(b_tryAgain);
}
}
}
@ -253,7 +259,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
memset(IV, 0, 0x10);
_fileSize = 0;
if (!fpData_bin.ReadBytes(&_tmpFileHDR, FILE_HDR_SZ))
if (!fpData_bin.ReadBytes(&_tmpFileHDR, FILE_HDR_SZ))
{
PanicAlertT("Failed to write header for file %d", i);
b_valid = false;
@ -299,7 +305,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles()
File::IOFile fpRawSaveFile(fullFilePath, "wb");
fpRawSaveFile.WriteBytes(_data, _fileSize);
}
}
delete []_data;
}
}
@ -333,7 +339,6 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter)
{
for (size_t j = 0; (j = __name.find(iter->second, j)) != __name.npos; ++j)
{
__name.replace(j, iter->second.length(), 1, iter->first);
@ -472,7 +477,7 @@ void CWiiSaveCrypted::make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name,
{
memset(cert, 0, 0x180);
*(u32*)cert = Common::swap32(0x10002);
memcpy(cert + 4, sig, 60);
strcpy((char*)cert + 0x80, signer);
*(u32*)(cert + 0xc0) = Common::swap32(2);
@ -484,17 +489,18 @@ void CWiiSaveCrypted::make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name,
bool CWiiSaveCrypted::getPaths(bool forExport)
{
if (m_TitleID)
{
{
WiiTitlePath = Common::GetTitleDataPath(m_TitleID);
BannerFilePath = WiiTitlePath + "banner.bin";
}
if (forExport)
{
char GameID[5];
sprintf(GameID, "%c%c%c%c",
(u8)(m_TitleID >> 24) & 0xFF, (u8)(m_TitleID >> 16) & 0xFF,
(u8)(m_TitleID >> 8) & 0xFF, (u8)m_TitleID & 0xFF);
if(!File::IsDirectory(WiiTitlePath))
{
b_valid = false;
@ -530,7 +536,10 @@ void CWiiSaveCrypted::ScanForFiles(std::string savDir, std::vector<std::string>&
Directories.push_back(savDir);
for (u32 i = 0; i < Directories.size(); i++)
{
if (i) FileList.push_back(Directories[i]);//add dir to fst
if (i != 0)
{
FileList.push_back(Directories[i]);//add dir to fst
}
File::FSTEntry FST_Temp;
File::ScanDirectoryTree(Directories[i], FST_Temp);

View File

@ -26,7 +26,6 @@
// --- this is used for encrypted Wii save files
class CWiiSaveCrypted
{
public:
@ -40,8 +39,7 @@ public:
void ImportWiiSaveFiles();
void ExportWiiSaveFiles(); // To data.bin
void do_sig();
void make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name, u8 *priv,
u32 key_id);
void make_ec_cert(u8 *cert, u8 *sig, char *signer, char *name, u8 *priv, u32 key_id);
bool getPaths(bool forExport = false);
void ScanForFiles(std::string savDir, std::vector<std::string>&FilesList, u32 *_numFiles, u32 *_sizeFiles);
@ -49,7 +47,7 @@ private:
AES_KEY m_AES_KEY;
u8 SD_IV[0x10];
std::vector<std::string> FilesList;
char pathData_bin[2048];
std::string BannerFilePath,
@ -85,13 +83,12 @@ private:
BK_LISTED_SZ = 0x70, // Size before rounding to nearest block
BK_SZ = 0x80,
FILE_HDR_SZ = 0x80,
SIG_SZ = 0x40,
NG_CERT_SZ = 0x180,
AP_CERT_SZ = 0x180,
FULL_CERT_SZ = 0x3C0, // SIG_SZ + NG_CERT_SZ + AP_CERT_SZ + 0x80?
BK_HDR_MAGIC = 0x426B0001,
FILE_HDR_MAGIC = 0x03adf17e
};
@ -107,7 +104,7 @@ private:
u8 Md5[0x10]; // md5 of plaintext header with md5 blanker applied
u16 unk2;
};
struct HEADER
{
Data_Bin_HDR hdr;