Bootstrap Framework 3.3.5

Over a dozen reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more...

User avatar
By Oak
Jabroni Jabroni
#129139
Yeniaul wrote:That may be true, but I have minor Python 2 knowledge and that's it. I couldn't do something like this.


Well, it's not too difficult. You have to traverse the two textures / models byte-by-byte and change the desired bytes.
So, let's say our smallest file goes from 000000 to 2FFFFF.
If you want to swap bytes from 002000 to 00FFFF, you would have to convert those two numbers from hex to dec and make a for-loop so you could swap bytes.
Here's a very basic example (Java-style pseudocode):

(Assume file1 and file2 are two file pointers, start is your starting address, end is your ending address)
Code: Select allFile smallest = (file1.getSize() > file2.getSize() ? file1 : file2); // Get the smallest file, so we can test if the start and end addresses are valid
File biggest = (file1.getSize() > file2.getSize() ? file2 : file1); // Store the biggest file in another pointer as well
/* Error checking */
if (smallest.toByteArray().length < hex2dec(start)) {
    print("Can't swap bytes: start address is out of bounds");
} else if (smallest.toByteArray().length < hex2dec(end)) {
    print("Can't swap bytes: end address is out of bounds");
} else {
    /* No errors here, swap the bytes */
    Byte[] smallFile = smallest.toByteArray();
    Byte[] bigFile = biggest.toByteArray();
    for (long i = start; i < end; i++) { // From the start address until the end address:
        Byte swap = smallFile[i]; // Store the current byte on the smallest file
        smallFile[i] = bigFile[i]; // Swap the smallest file's current byte with the biggest file's current byte
        bigFile[i] = swap; // Swap the biggest file's current byte with the smallest file's old byte
    }
    smallest.writeBytes(smallFile); // Write the byte array to the smallest file
    smallest.close();
    biggest.writeBytes(bigFile); // Write the byte array to the biggest file
    biggest.close();
    /* Close the original file pointers */
    file1.close();
    file2.close();
}


This is just a pseudocode snippet so maybe you can understand what it would do. It swaps the bytes of both files instead of only one.

Huh, now that I made this maybe I will turn it into a real thing :lol:
User avatar
By Yeniaul
Vinebro Vinebro
#134940
Hey man, if you wanna make it, go for it. I just wanna see this become a thing. Although, you said "model/texture", but I was meaning "a part of the entire file". :P

Ourumov from 007 Goldeneye does the Dab https[…]

Swap-in out addons, use only what you really need!