Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,22 @@ int Menu_Main(void){

//full hashes

if(!useNTFS){
crc32Val = 0;
md5_starts(&md5ctx);
sha1_starts(&sha1ctx);

if(!useNTFS){
//part hashes
crc32PartVal = 0;
md5_starts(&md5PartCtx);
sha1_starts(&sha1PartCtx);
}

//create hashing thread

stack = MEMBucket_alloc(0x4000, 0x20);
thread = (OSThread*)memalign(8, 0x1000); //thread cant be in MEMBucket
OSCreateThread(thread, hashThread, 0, NULL, (u32)stack+0x4000, 0x4000, 20, (1<<OSGetCoreId()));
}

//0xBA7400 = full disc
while(readSectors < 0xBA7400) {
Expand All @@ -431,11 +431,11 @@ int Menu_Main(void){
char tmpChar[64];
sprintf(tmpChar, "game_part%i", part);
write_hash_file(tmpChar, wudumpPath, crc32PartVal, &md5PartCtx, &sha1PartCtx);
}
//open new hashes
crc32PartVal = 0;
md5_starts(&md5PartCtx);
sha1_starts(&sha1PartCtx);
}
}

//set part int for next file
Expand All @@ -457,7 +457,7 @@ int Menu_Main(void){
ret = fsa_odd_read(fsaFd, oddFd, sectorBuf, readSectors);
} while(ret < 0);
//update hashes in thread
if(!useNTFS){ OSResumeThread(thread); }
OSResumeThread(thread);
//write in new offsets
fwrite(sectorBuf, 1, bufSize, f);
readSectors += NUM_SECTORS;
Expand Down Expand Up @@ -492,15 +492,13 @@ int Menu_Main(void){
}

//write global hashes into file
if(!useNTFS){
write_hash_file("game", wudumpPath, crc32Val, &md5ctx, &sha1ctx);
//close down hash thread
threadRunning = false;
OSResumeThread(thread);
OSJoinThread(thread, &ret);
free(thread); //thread cant be in MEMBucket
MEMBucket_free(stack);
}

//all finished!
OSScreenClearBufferEx(0, 0);
Expand Down