Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 24-04-2025, 08:29
L33THAK0R's Avatar
L33THAK0R L33THAK0R is offline
Registered User
 
Join Date: Feb 2021
Location: Saudi Arabia
Posts: 406
Thanks: 138
Thanked 117 Times in 70 Posts
L33THAK0R is on a distinguished road
Quote:
Originally Posted by teusma View Post
It took me a while but I understood haha, thanks. the only downside is that the quickbms executable is 19.3 MB and compressed 3.79 MB, this will overshadow almost all the gain I will have by decrypting the data.pak. But do what you know...that's life. If someone could create a C++ program from this BMS script, the executable would not exceed 100kb....
I had a read through the article you linked and the concept is a lot simpler than you think. Based off of the authors "java-like pseudocode" I whipped up a couple python scripts that "decrypt" and "encrypt" the data.pak file. What is actually happening is basic obfuscation, for even bytes, the value is divided by 2, for odd bytes, 255 is added, and then the value is divided by 2. Very simple stuff.

Even though I've only ever dabbled in python scripting, writing a C++ application proved to be quite simple, here's the source code:

Code:
#include <fstream>
#include <vector>
#include <cstdint>
#include <iostream>

uint8_t reencrypt_byte(uint8_t d) {
    return (d < 128) ? (d * 2)
                     : static_cast<uint8_t>(2 * d - 255);
}

int main(int argc, char* argv[]) {
    if (argc != 3) {
        std::cerr << "Usage: reenc <infile> <outfile>\n";
        return 1;
    }

    // Read input file
    std::ifstream fin(argv[1], std::ios::binary);
    if (!fin) { perror("Error opening input"); return 1; }
    std::vector<uint8_t> buf((std::istreambuf_iterator<char>(fin)),
                              std::istreambuf_iterator<char>());

    // Transform in place
    for (auto &b : buf) {
        b = reencrypt_byte(b);
    }

    // Write output file
    std::ofstream fout(argv[2], std::ios::binary);
    if (!fout) { perror("Error opening output"); return 1; }
    fout.write(reinterpret_cast<char*>(buf.data()), buf.size());

    return 0;
}
I've saved you the trouble of compiling this, attached in the zip file are both the python scripts as well as the C++ source code and application, as well as a copy of sfk + a batch script for patching all the extracted streams (well 1116/1139 files, but all WAV, OGG were found. 651/663 DDS found.), if you choose to go down that route. Good news is this solution meets your requirements, with just srep+lolz the compiled C++ executable goes from 131KiB to 34.9KiB. Hope this helps, this was a good excuse to keep some technical skills fresh.
Attached Files
File Type: zip Solution_Resources.zip (1.13 MB, 6 views)

Last edited by L33THAK0R; 24-04-2025 at 08:34.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Borderlands 2 GOTY omdj PC Games - CD/DVD Conversions 12 07-06-2026 22:52
Tom Clancy's Splinter Cell Conviction Faks PC Games - Protection List 3 03-06-2010 02:10
Having a nightmare with Iomega USB ZipCD - Help! Tranced CD/DVD-Writers 2 03-04-2005 06:00
PMA Update failure....????????? dannyk DVD Backup Forum 1 05-01-2005 14:19
HELP ME PLZ!!!! Dalvin DC Games 0 02-01-2001 22:15



All times are GMT -7. The time now is 11:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com