Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Sonic Mega Collection (GC) dat files

Featured Replies

  • Author
  • Localization

GreyRogue, posted Sat Mar 07, 2015 5:18 pm (3646)


Here's a cpp file for converting the dat files to .bin I wrote.
Anybody who knows MexScript want to convert it?
Code:
#include "stdafx.h"
#include

int processdata(unsigned char *InData, unsigned char *OutData, int filedatasize) // OutData=0 to get size
{
   int CurrIn = 0x4; //Skip size
   int CurrOut = 0;
   while (CurrIn < filedatasize)
   {
      int Code = InData[CurrIn ];
      for (int i = 0; (i < 8) && (CurrIn < filedatasize); i )
      {
         if (Code & 1)
         {
            if (OutData)
               OutData[CurrOut] = InData[CurrIn];
            CurrOut ;
            CurrIn ;
         }
         else
         {
            int OutDict = InData[CurrIn ];
            int OutCnt = InData[CurrIn ];
            OutDict |= ((OutCnt << 4) & 0xF00);
            OutCnt = (OutCnt & 0xF) 2;
            OutDict |= (CurrOut & ~0xFFF);
            OutDict = 0x12;
            if (OutDict >= CurrOut)
               OutDict -= 0x1000;
            for (int j = 0; j <= OutCnt; j )
            {
               if (OutData)
                  OutData[CurrOut] = OutDict >= 0 ? OutData[OutDict] : 0;
               CurrOut ;
               OutDict ;
            }
         }
         Code >>= 1;
      }
   }
   return CurrOut;
}

int _tmain(int argc, _TCHAR* argv[])
{
   if (argc < 3)
   {
      printf("Wrong number of arguments");
      return -1;
   }
   std::ifstream InFile(argv[1], std::ios::binary);
   InFile.seekg(0, std::ios::end);
   int filesize = InFile.tellg();
   InFile.seekg(0, std::ios::beg);
   unsigned char *InData = new unsigned char[filesize];
   InFile.read((char*)InData, filesize);
   int swapend = 0x702;
   if (filesize <= swapend)
      swapend = filesize-1;
   for (int i = 0; (3 * i) < swapend; i )
   {
      char Tmp = InData[i];
      InData[i] = InData[swapend - i];
      InData[swapend - i] = Tmp;
   }
   int filedatasize = 0;
   for (int Curr = 0; Curr < 4; Curr )
   {
      filedatasize <<= 8;
      filedatasize |= InData[3 - Curr];
   }

   for (int i = 0; i < filedatasize; i )
      InData[i] ^= 0x54;

   // Only calling to get the output size.  Will be same as OutSize below.
   // Can skip this if using e.g. push_back() instead of unsigned char[]
   // or just set MaxBinSize large enough (max output file size).
   const int MaxBinSize = processdata(InData, 0, filedatasize);

   unsigned char* OutData = new unsigned char[MaxBinSize];
   const int OutSize = processdata(InData, OutData, filedatasize);
   swapend = 156;
   for (int i = 0; i < OutSize; i = (swapend 1))
   {
      if (i swapend >= OutSize)
         swapend = OutSize - i - 1;
      for (int j = 0; (j * 3) < swapend; j )
      {
         char Tmp = OutData[i j];
         OutData[i j] = OutData[i swapend-j];
         OutData[i swapend-j] = Tmp;
      }
   }

   std::ofstream OutFile(argv[2], std::ios::binary);
   OutFile.write((char*)OutData, OutSize);

   delete[] InData;
   delete[] OutData;
   return 0;
}
  • Author
  • Localization

Mygoshi, posted Sat Mar 07, 2015 6:03 pm (3647)


I'm also looking for help regarding this.
  • Author
  • Localization

aluigi, posted Sun Mar 08, 2015 10:37 am (3656)


Can you upload a sample?
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.