Skip to content

Instantly share code, notes, and snippets.

@barncastle
barncastle / Encryption.java
Last active August 1, 2023 14:37
Encryption logic from Joey For Reddit with all credentials
import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import com.qiniu.util.Base64; // https://github.com/qiniu/java-sdk/blob/master/src/main/java/com/qiniu/util/Base64.java
class Scratch {
@barncastle
barncastle / MultiSimConverter.cs
Last active February 6, 2023 07:54
A tool to convert MultiSim project files between their uncompressed XML format and their compressed MS14/EWPRJ format
///
/// This code is licensed under the terms of the MIT license
///
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
namespace MultiSimConverter
@barncastle
barncastle / NeopetsPak.cs
Created August 28, 2022 20:05
Code for reading Neopets Java Mobile game's PAK files
using System;
using System.Collections.Generic;
using System.IO;
public class NeopetsPak
{
private static readonly HashSet<int> MidiFiles = new HashSet<int>
{
58, 57, 56, 49, 55
};
@barncastle
barncastle / ShakedownHawaiiBFP2.cs
Last active August 31, 2022 15:03
Code for reading Vblank Entertainment' Shakedown: Hawaii's BFP archives
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Linq;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using System.IO.Compression;
@barncastle
barncastle / DragonManiaLegendsPAK.cs
Created August 12, 2022 16:19
Sample code for decompressing the header of Dragon Mania Legends PAK files
// iterate each sample file
foreach (var sample in Directory.GetFiles(@"C:\Users\temp\Downloads\sample"))
{
// open the file stream and create a reader
using var stream = File.OpenRead(sample);
using var reader = new BinaryReader(stream);
// read the header
var magic = reader.ReadString(4);
var fileTableCompressedSize = reader.ReadInt32();
@barncastle
barncastle / WarForKingship.js
Created August 10, 2022 16:00
Core functions for reading War For Kingship's BIN files
var PackageItemType;
(function (PackageItemType) {
PackageItemType[PackageItemType["Image"] = 0] = "Image";
PackageItemType[PackageItemType["MovieClip"] = 1] = "MovieClip";
PackageItemType[PackageItemType["Sound"] = 2] = "Sound";
PackageItemType[PackageItemType["Component"] = 3] = "Component";
PackageItemType[PackageItemType["Atlas"] = 4] = "Atlas";
PackageItemType[PackageItemType["Font"] = 5] = "Font";
PackageItemType[PackageItemType["Swf"] = 6] = "Swf";
PackageItemType[PackageItemType["Misc"] = 7] = "Misc";
@barncastle
barncastle / muk.cpp
Created August 8, 2022 12:06
Bio F.R.E.A.K.S Muk archive format
struct MukArchive {
uint16 version
uint16 fileCount
uint32 fileNameLength; // unused, game always uses 8
FileInfo fileInfos[fileCount];
byte fileData[x];
}
struct FileInfo {
char Name[8];
@barncastle
barncastle / tex2dds.cpp
Last active September 21, 2023 09:18
Ghostbusters TEX converter by Jonathan Wilson - Fixed
/* Ghostbusters texture converter
Copyright 2010 Jonathan Wilson
The Ghostbusters texture converter is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version. See the file COPYING for more details.
*/
#include <stdio.h>
#include <string.h>
@barncastle
barncastle / WoWMatrixCard.cs
Created July 27, 2022 15:00
C# re-implementation of the WoW Matrix Card 2FA system available from TBC (2.0.0.5991)
class WoWMatrixCard
{
public uint Width = 8; // SECURITYMATRIX_NUM_COLUMNS in SecurityMatrix.lua, default of 8
public uint Height = 10; // SECURITYMATRIX_NUM_ROWS in SecurityMatrix.lua, default of 10
public uint DigitCount = 2; // SECURITYMATRIX_NUM_MIN_DIGITS in SecurityMatrix.lua, default of 2
public uint ChallengeCount; // number of cells/rounds to be completed
public ulong Seed;
public uint[] Coordinates;
private readonly byte[] _IPad = new byte[0x40];
@barncastle
barncastle / BrawlhallaDumper.zip
Last active November 19, 2023 04:11
Code for decrypting Blue Mammoth Games' Brawlhalla's SWZ files