Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
DCxDemo committed Aug 7, 2017
1 parent f97695c commit 223f697
Show file tree
Hide file tree
Showing 19 changed files with 6,654 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

#Visual Studio Files
[Oo]bj
[Bb]in
[Dd]ebug
[Bb]uild/
*.user
*.suo
*.exe
*.pdb
*.aps
*_i.c
*_p.c
*.ncb
*.tlb
*.tlh
*.[Cc]ache
*.bak
*.ncb
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
*.dbmdl
*.csproj.user
*.cache
*.swp
*.vspscc
*.vssscc
*.bak.*
*.bak

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
340 changes: 340 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#WAD Tool

###Description
Packer/unpacker for Neversoft's "Big Guns" engine games.

*Apocalypse
*Spider-Man
*Spider-Man 2
*Tony Hawk's Pro Skater
*Tony Hawk's Pro Skater 2
*Tony Hawk's Pro Skater 3
*Tony Hawk's Pro Skater 4

##Working example
* https://www.youtube.com/watch?v=N1-Av0GBIeY

2016-2017, DCxDemo*.
20 changes: 20 additions & 0 deletions hedwadtool/hedwadtool.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hedwadtool", "hedwadtool\hedwadtool.csproj", "{10502ECA-E0BE-4E6B-BBDC-D13BFCE53D62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10502ECA-E0BE-4E6B-BBDC-D13BFCE53D62}.Debug|x86.ActiveCfg = Debug|x86
{10502ECA-E0BE-4E6B-BBDC-D13BFCE53D62}.Debug|x86.Build.0 = Debug|x86
{10502ECA-E0BE-4E6B-BBDC-D13BFCE53D62}.Release|x86.ActiveCfg = Release|x86
{10502ECA-E0BE-4E6B-BBDC-D13BFCE53D62}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
115 changes: 115 additions & 0 deletions hedwadtool/hedwadtool/BruteHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace hedwadtool
{
class BruteHelper
{

string prefix;
string suffix;
string checksum;

string test;

uint checksumuint = 0;

public BruteHelper(string p, string s, string c)
{
prefix = p;
suffix = s;
checksum = c;

target.Clear();
target.Add(0);

len1 = lets.Length;

if (!Checksum.TryParseHex(checksum, out checksumuint))
{
checksumuint = 0;
}
}


string lets = "_0123456789abcdefghijklmnopqrstuvwxyz";
int len1;

List<byte> target = new List<byte>();
bool stop = false;

StringBuilder sb = new StringBuilder();


private void TargetToTest()
{
foreach (byte c in target)
test += lets[c];
}

public bool ChecksumMatches()
{
if (checksumuint == Checksum.Calc(sb.ToString(), false))
return true;

return false;
}

public uint GetChecksum()
{
return checksumuint;
}

public string GetText()
{
return sb.ToString();
}


public void Next()
{
test = "";

TargetToTest();

sb.Clear();
sb.Append(prefix);
sb.Append(test);
sb.Append(suffix);

Increase();
}

private void Increase()
{
for (int i = 0; i < target.Count; i++)
{
try
{
if (target[i] < len1 - 1)
{
target[i] += 1;
return;
}
else
{
target[i] = 0;
if (i == target.Count - 1)
{
target.Add(0);
return;
}
}
}
catch
{
target.Add(0);
}
}
}


}
}
50 changes: 50 additions & 0 deletions hedwadtool/hedwadtool/Checksum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace hedwadtool
{
class Checksum
{

public static uint Calc(string k, bool allowCaps)
{
string str = allowCaps ? k : k.ToLower();

uint result = 0xFFFFFFFF;

foreach (char c in str)
{
uint temp = result ^ c;

for (int i = 0; i < 8; i++)
{
result = (result >> 31) | 2 * result;
if ((temp & 1) != 0) result ^= 0xEDB88320;
temp >>= 1;
}
}

return result;
}


public static bool TryParseHex(string hex, out UInt32 result)
{
result = 0;

if (hex == null) return false;

try
{
result = Convert.ToUInt32(hex, 16);
return true;
}
catch (Exception exception)
{
return false;
}
}
}
}
Loading

0 comments on commit 223f697

Please sign in to comment.