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.

Smile Game Builder archives (sgbpack)

Featured Replies

  • Author
  • Localization

wattostudios, posted Sat Aug 18, 2018 1:58 pm (37643)


Wondering if anyone knows enough about encryption to work out how they do it for Smile Game Builder engine archives.

Older versions were just a ZIP file with a funny header and no compression - they're pretty simple to figure out.

Newer archives look very different, to me it looks like the files are XOR'd with a 16-byte repeating key, but each file in the archive might have a different key? In the example archive, the first file looks like it might use this key (\x1E\x20\x45\x1B\x14\x84\xC9\x8C\x53\xA5\x7C\x42\x7B\xA9\x62\xE9) and a file a little further on with this key (\x34\x7C\x25\xD5\xEE\x10\x2C\x2A\x4B\xE7\xE0\xAE\x83\xBB\x2B\x49)

I admit I'm no expert in encryption, so I could be totally wrong.

It looks like there is probably no compression, as there are whole sections of repeating characters that really should be easy to compress.

Is anyone able to help with this?

Sample archive (from game Monarch of Greed - Act 1) - https://drive.google.com/open?id=12A3UhodYRvFjaM9-F_SQQ5JTlmhyO0NC

Thanks for any help!
  • Author
  • Localization

aluigi, posted Mon Aug 20, 2018 1:00 pm (37697)


It's weird indeed and it's not a xor key since the resulting data is still senseless.
It's not a block cipher too since most of the bytes in these "sequences" are often differents.
Apparently it's necessary to do some reverse engineering and it's not possible to guess it from the file.
  • Author
  • Localization

lisomn, posted Sat Feb 15, 2020 6:49 am (54028)


About sgbpack
First you need to replace the first 8 bytes with
"\x50\x4B\x03\x04\x14\x00\x00\x00"
Then use that algorithm to decrypt
Code:
byte* ptr = 0x02;
int num = 0;
if (0 < buffer.Length)
{
   do
   {
   int num2 = (int)((byte)(num % 16));
   buffer[num] -= (byte)((int)num2[ptr] * num2);
   num ;
   }
   while (num < buffer.Length);
}
  • Author
  • Localization

aluigi, posted Sun Mar 22, 2020 12:00 pm (54945)


The sample is no longer available, anyone can upload it or another encrypted sgbpack file for testing?
  • Author
  • Localization

lisomn, posted Thu Jul 23, 2020 5:48 am (57736)


aluigi wrote:
The sample is no longer available, anyone can upload it or another encrypted sgbpack file for testing?

hi aluigi Here is the decryption logic, can you create a bms version?
The bms script I made is a bit slow

program logic
Code:
      auto bs=File(file_name,"rb ");
      ulong size=getSize(file_name);
      char[] magic=bs.rawRead(new char[6]);
      ubyte[] key=[72,9,20,154,48,169,84,225,0,8,14,9,20,60,66,70];
      ubyte[] header=[80,75,3,4,20,0,0,0];
      if(magic.dup == "SGBDAT")
      {
         int versionno=(bs.rawRead(new ubyte[1])[0]<<8) bs.rawRead(new ubyte[1])[0];
         if(versionno!=0)
         {
            int versionno=(bs.rawRead(new ubyte[1])[0]<<8) bs.rawRead(new ubyte[1])[0];
            auto wbs=File(file_name~".zip","wb");
            wbs.rawWrite(header);
            int num=0;
            ubyte[] buffe=bs.rawRead(new ubyte[(size-8).to!uint]);
            for(int i=0;i<(size-8);i )
            {
               buffe[num]-=key[num];
               num ;
            }
            wbs.rawWrite(buffe);
         }
      }
  • Author
  • Localization

gaugsroff2, posted Mon Nov 23, 2020 1:54 pm (60539)


Thank you. Unfortunately both tools extract a zip with lots of files but the png/obj/ogg files inside can't be opened.

Example game: https://syukino.itch.io/euclyca-chronicles-lyla

More details: Seeking smile game builder extractors / Game exe states: SGB RPG Player 1.12.8.4 by SmileBoom Co. Ltd.
  • Author
  • Localization

aluigi, posted Wed Nov 25, 2020 8:26 pm (60603)


Ok I rewrote the script from scratch, it can now be used to dump all the files without creating the ZIP first.

The problem was simply that the extracted files had a second encryption (so after decompression) and needed to be decrypted.
  • Author
  • Localization

Renneta, posted Tue May 18, 2021 11:19 am (64121)


aluigi wrote:
Ok I rewrote the script from scratch, it can now be used to dump all the files without creating the ZIP first.

The problem was simply that the extracted files had a second encryption (so after decompression) and needed to be decrypted.


Can you help me? I want to translate one game on the SGB engine, but I'm not a programmer and can't open this type of archives. :cry:

---OK, no need more.
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.