Here's the code for the all.bin extractor:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
namespace Homeland_all.bin_extractor
{
class Program
{
static void Main(string[] args)
{
string[] droppedFiles = Environment.GetCommandLineArgs();
//string[] droppedFiles = new string[3];
//droppedFiles[0] = "hash";
//droppedFiles[1] = "C:\\Documents and Settings\\Jay\\Data Log\\Games\\Hacking\\NGC\\Tools\\Homeland\\all\\all.bin";
//droppedFiles[2] = "C:\\Documents and Settings\\Jay\\Data Log\\Games\\Hacking\\NGC\\Tools\\Homeland\\all\\Start.dol";
if ((droppedFiles.Length == 1) | (droppedFiles.Length == 0))
{
Console.WriteLine("2011 Jay Harland / JaytheHam");
Console.WriteLine("Homeland for Gamecube\n");
Console.WriteLine("Extracts all the \"CNDY\" files from \"all.bin\" data archive");
Console.WriteLine("Usage: allbinext.exe all.bin Start.dol");
Console.Read();
return;
}
Console.WriteLine(droppedFiles[1]);
FileStream allBin = new FileStream(droppedFiles[1], FileMode.Open);
FileStream startDol = new FileStream(droppedFiles[2], FileMode.Open);
int curFileOffset = 0;
int nextFileOffset = 1;
int fileSize = 0;
int filesDone = 0;
startDol.Position = 0xE22D4;
byte[] tempWord = new byte[4];
while (nextFileOffset != 0)
{
startDol.Read(tempWord, 0, 4);
curFileOffset = (int)((tempWord[0] << 24) +
(tempWord[1] << 16) +
(tempWord[2] << 8) +
tempWord[3]);
startDol.Read(tempWord, 0, 4);
nextFileOffset = (int)((tempWord[0] << 24) +
(tempWord[1] << 16) +
(tempWord[2] << 8) +
tempWord[3]);
startDol.Position -= 4;
fileSize = nextFileOffset - curFileOffset;
byte[] output = new byte[fileSize];
allBin.Read(output, 0, fileSize);
//Only extract "CNDY" Files, they seem to be the text ones
if (output[0] == 0x43 & output[1] == 0x4E & output[2] == 0x44 & output[3] == 0x59)
{
FileStream writeFile = new FileStream(droppedFiles[1] + "_" + curFileOffset.ToString(), FileMode.Create);
writeFile.Write(output, 0, fileSize);
writeFile.Close();
filesDone++;
if (filesDone % 500 == 0)
{
Console.WriteLine(filesDone.ToString() + " files done, at: " + nextFileOffset.ToString());
}
}
}
}
}
}