Advanced Search

Author Topic: Rockman 8 FC  (Read 92630 times)

0 Members and 1 Guest are viewing this topic.

October 08, 2017, 08:11:20 AM
Reply #180

Threenator

  • Guest
Re: Rockman 8 FC
« Reply #180 on: October 08, 2017, 08:11:20 AM »
Can someone please post the cheat table again?

October 09, 2017, 12:16:14 AM
Reply #181

Offline Grahf78

  • Standard Member
  • Date Registered: May 24, 2017, 09:31:58 PM

    • View Profile
Re: Rockman 8 FC
« Reply #181 on: October 09, 2017, 12:16:14 AM »
I've made some progress trying to make this game moddable.

The game is coded in C++, so I used IDA to decompile the source code and reconstruct whatever bits I could.

As we all know, all images are stored into the image.bin file, but its contents are obfuscated and can't be ripped or re-encoded easily.

All i've found for now is that this is the function that loads the images from image.bin into memory:
Code: [Select]
//----- (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;
}

If I read that correctly, the file is a simple data structure that needs to be serially decoded. Perhaps someone with debugging/hacking/programming skills can lend a hand?