0 Members and 2 Guests are viewing this topic.
//----- (00403C50) --------------------------------------------------------int __stdcall sub_403C50(int a1){ FILE binFile; // eax@1 FILE *binFilePtr; // edi@1 FILE *logFile; // esi@2 __int32 fileValue; // esi@4 void *binStructure; // ebx@4 int v6; // ecx@4 __int32 v7; // eax@4 int v8; // edx@5 int v9; // esi@10 int result; // eax@11 int v11; // [sp+10h] [bp-78h]@4 char v12; // [sp+18h] [bp-70h]@2 sub_4DC770(off_61AD48); binFile = fopen("./image/image.bin", "r"); binFilePtr = binFile; if ( !binFile ) { logFile = fopen("dbg.txt", "a+"); sprintf(&v12, "[dbg] func_name:%s, line:%d\n", "Graphics::init_bmp", 919); fputs(&v12, logFile); fclose(logFile); sub_4C2E00((int)binFilePtr); exit_1((int)binFilePtr); } //starts reading image.bin at 0x02 //int fseek ( FILE * stream, long int offset, int origin ); fseek(binFile, 0, 2); fileValue = ftell(binFilePtr); fseek(binFilePtr, 0, 0); binStructure = malloc(fileValue); //size_t fread ( void * ptr, size_t size, size_t count, FILE * stream ); //Reads an array of count elements, each one with a size of size bytes, from the stream and stores them in the block of memory specified by ptr. fread(binStructure, 1u, fileValue, binFilePtr); v6 = 0; v7 = 0; v11 = 0; if ( fileValue > 0 ) { do { v8 = *((_BYTE *)binStructure + v7++); v6 += v8; } while ( v7 < fileValue ); v11 = v6; } fclose(binFilePtr); free(binStructure); if ( v11 != 250926440 ) { MessageBoxA(0, "invalid external files.", "Rockman8FC", 0); sub_4C2E00((int)binFilePtr); exit_1(0); } v9 = 0; do result = sub_401590(v9++, a1); while ( v9 < 273 ); return result;}