Skip to content

Commit

Permalink
Miscelaneous cosmetic source code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k3 committed Oct 28, 2015
1 parent 488c949 commit 5c35e8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

// customizations - careful with EXPERIMENTAL
// #define EXPERIMENTAL
// #define WORKDIR "/Decrypt9"
// #define WORKDIR "/Decrypt9" // DOES NOT WORK FOR EVERYTHING ATM!

inline char* strupper(const char* str) {
char* buffer = (char*)malloc(strlen(str) + 1);
Expand Down
7 changes: 2 additions & 5 deletions source/decryptor/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ u32 DecryptNcch(const char* filename, u32 offset, u32 size, u64 seedId)
Debug("Can only be decrypted on N3DS!");
return 1;
}
if (FileOpen("slot0x25KeyX.bin")) {
if (FileOpen("/slot0x25KeyX.bin")) {
u8 slot0x25KeyX[16] = {0};
if (FileRead(&slot0x25KeyX, 16, 0) != 16) {
Debug("slot0x25keyX.bin is corrupt!");
Expand All @@ -504,7 +504,7 @@ u32 DecryptNcch(const char* filename, u32 offset, u32 size, u64 seedId)

// check / setup seed crypto
if (usesSeedCrypto) {
if (FileOpen("seeddb.bin")) {
if (FileOpen("/seeddb.bin")) {
SeedInfoEntry* entry = (SeedInfoEntry*) buffer;
u32 found = 0;
for (u32 i = 0x10;; i += 0x20) {
Expand Down Expand Up @@ -553,7 +553,6 @@ u32 DecryptNcch(const char* filename, u32 offset, u32 size, u64 seedId)

// process ExHeader
if (ncch->size_exthdr > 0) {
// Debug("Decrypting ExtHeader (%ub)...", 0x800);
memset(info0.CTR + 12, 0x00, 4);
if (ncch->version == 1)
add_ctr(info0.CTR, 0x200); // exHeader offset
Expand All @@ -566,7 +565,6 @@ u32 DecryptNcch(const char* filename, u32 offset, u32 size, u64 seedId)
if (ncch->size_exefs > 0) {
u32 offset_byte = ncch->offset_exefs * 0x200;
u32 size_byte = ncch->size_exefs * 0x200;
// Debug("Decrypting ExeFS (%ukB)...", size_byte / 1024);
memset(info0.CTR + 12, 0x00, 4);
if (ncch->version == 1)
add_ctr(info0.CTR, offset_byte);
Expand Down Expand Up @@ -613,7 +611,6 @@ u32 DecryptNcch(const char* filename, u32 offset, u32 size, u64 seedId)
if (ncch->size_romfs > 0) {
u32 offset_byte = ncch->offset_romfs * 0x200;
u32 size_byte = ncch->size_romfs * 0x200;
// Debug("Decrypting RomFS (%uMB)...", size_byte / (1024 * 1024));
memset(info1.CTR + 12, 0x00, 4);
if (ncch->version == 1)
add_ctr(info1.CTR, offset_byte);
Expand Down
8 changes: 4 additions & 4 deletions source/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void DeinitFS()
bool FileOpen(const char* path)
{
#ifdef WORKDIR
while (*path == '/' || *path == '\\') path++;
if (*path == '/' || *path == '\\') path++;
#endif
unsigned flags = FA_READ | FA_WRITE | FA_OPEN_EXISTING;
bool ret = (f_open(&file, path, flags) == FR_OK);
Expand All @@ -53,7 +53,7 @@ bool DebugFileOpen(const char* path)
bool FileCreate(const char* path, bool truncate)
{
#ifdef WORKDIR
while (*path == '/' || *path == '\\') path++;
if (*path == '/' || *path == '\\') path++;
#endif
unsigned flags = FA_READ | FA_WRITE;
flags |= truncate ? FA_CREATE_ALWAYS : FA_OPEN_ALWAYS;
Expand Down Expand Up @@ -124,7 +124,7 @@ void FileClose()
bool DirMake(const char* path)
{
#ifdef WORKDIR
while (*path == '/' || *path == '\\') path++;
if (*path == '/' || *path == '\\') path++;
#endif
FRESULT res = f_mkdir(path);
bool ret = (res == FR_OK) || (res == FR_EXIST);
Expand All @@ -134,7 +134,7 @@ bool DirMake(const char* path)
bool DirOpen(const char* path)
{
#ifdef WORKDIR
while (*path == '/' || *path == '\\') path++;
if (*path == '/' || *path == '\\') path++;
#endif
bool ret = (f_opendir(&dir, path) == FR_OK);
return ret;
Expand Down

0 comments on commit 5c35e8c

Please sign in to comment.