Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gericom committed Nov 4, 2014
0 parents commit 948fda4
Show file tree
Hide file tree
Showing 253 changed files with 46,480 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Thumbs.db
*.vsp
*.psess
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.sln.docstates
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.vssscc
$tf*/
TestPlugin*/
1 change: 1 addition & 0 deletions .tfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\.git
205 changes: 205 additions & 0 deletions 3DS/3DS.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F28E77C4-BB68-4513-9468-8EABDE8DC9CB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_3DS</RootNamespace>
<AssemblyName>3DS</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Tao.DevIl, Version=1.6.8.3, Culture=neutral, PublicKeyToken=7ec4053013524957, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\MKDS Course Modifier\MKDS Course Modifier\bin\x86\Debug_new\Tao.DevIl.dll</HintPath>
</Reference>
<Reference Include="Tao.OpenGl, Version=2.1.0.12, Culture=neutral, PublicKeyToken=1ca010269a4501ef, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\MKDS Course Modifier\MKDS Course Modifier\bin\x86\Debug_new\Tao.OpenGl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Tao.Platform.Windows, Version=1.0.0.5, Culture=neutral, PublicKeyToken=701104b2da67a104, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\MKDS Course Modifier\MKDS Course Modifier\bin\x86\Debug_new\Tao.Platform.Windows.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="NintendoWare\GFX\BoundingVolume.cs" />
<Compile Include="NintendoWare\GFX\CANM.cs" />
<Compile Include="NintendoWare\GFX\CGFX.cs" />
<Compile Include="NintendoWare\GFX\CGFXShader.cs" />
<Compile Include="NintendoWare\GFX\CGFXWriterContext.cs" />
<Compile Include="NintendoWare\GFX\CMDL.cs" />
<Compile Include="NintendoWare\GFX\DICT.cs" />
<Compile Include="NintendoWare\GFX\PatriciaTreeGenerator.cs" />
<Compile Include="NintendoWare\GFX\TXOB.cs" />
<Compile Include="NintendoWare\LYT\BasicShader.cs" />
<Compile Include="NintendoWare\LYT\bnd1.cs" />
<Compile Include="NintendoWare\LYT\CLIM.cs" />
<Compile Include="NintendoWare\LYT\CLYT.cs" />
<Compile Include="NintendoWare\LYT\CLAN.cs" />
<Compile Include="NintendoWare\LYT\CLYTShader.cs" />
<Compile Include="NintendoWare\LYT\mat1.cs" />
<Compile Include="NintendoWare\LYT\pan1.cs" />
<Compile Include="NintendoWare\LYT\pic1.cs" />
<Compile Include="NintendoWare\LYT\txt1.cs" />
<Compile Include="NintendoWare\LYT\wnd1.cs" />
<Compile Include="NintendoWare\SND\CSTM.cs" />
<Compile Include="DARC.cs" />
<Compile Include="DSP\ADPCM.cs" />
<Compile Include="DVLB.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="GPU\Textures.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="SARC.cs" />
<Compile Include="SARCEFESFSFile.cs" />
<Compile Include="SMDH.cs" />
<Compile Include="UI\CGFXViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\CGFXViewer.designer.cs">
<DependentUpon>CGFXViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\CLIMViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\CLIMViewer.Designer.cs">
<DependentUpon>CLIMViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\CLYTViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\CLYTViewer.Designer.cs">
<DependentUpon>CLYTViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\DARCViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\DARCViewer.Designer.cs">
<DependentUpon>DARCViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\SARCViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\SARCViewer.Designer.cs">
<DependentUpon>SARCViewer.cs</DependentUpon>
</Compile>
<Compile Include="UI\SMDHViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\SMDHViewer.Designer.cs">
<DependentUpon>SMDHViewer.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonFiles\CommonFiles.csproj">
<Project>{4D0F5EC8-4730-4D62-AFA5-80AD4AD14625}</Project>
<Name>CommonFiles</Name>
</ProjectReference>
<ProjectReference Include="..\LibEveryFileExplorer\LibEveryFileExplorer.csproj">
<Project>{39DBD12F-F7E3-4E9A-97A2-0722A4BA2A26}</Project>
<Name>LibEveryFileExplorer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="UI\CGFXViewer.resx">
<DependentUpon>CGFXViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\CLIMViewer.resx">
<DependentUpon>CLIMViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\CLYTViewer.resx">
<DependentUpon>CLYTViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\DARCViewer.resx">
<DependentUpon>DARCViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\SARCViewer.resx">
<DependentUpon>SARCViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\SMDHViewer.resx">
<DependentUpon>SMDHViewer.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\leaf.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\image.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\zone.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\preview_background.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\zone16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\image16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\slide.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\edit.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\zones-stack.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(SolutionDir)\EveryFileExplorer\bin\Debug\Plugins\$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
152 changes: 152 additions & 0 deletions 3DS/DARC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibEveryFileExplorer.Files;
using System.Drawing;
using System.IO;
using LibEveryFileExplorer.Files.SimpleFileSystem;
using _3DS.UI;

namespace _3DS
{
public class DARC : FileFormat<DARC.darcIdentifier>, IViewable
{
public DARC(byte[] Data)
{
EndianBinaryReader er = new EndianBinaryReader(new MemoryStream(Data), Endianness.LittleEndian);
try
{
Header = new darcHeader(er);
er.BaseStream.Position = Header.FileTableOffset;
FileTableEntry root = new FileTableEntry(er);
Entries = new FileTableEntry[root.DataLength];
Entries[0] = root;
for (int i = 1; i < root.DataLength; i++) Entries[i] = new FileTableEntry(er);
FileNameTable = new Dictionary<uint,string>();
uint offs = 0;
for (int i = 0; i < root.DataLength; i++)
{
String s = er.ReadStringNT(Encoding.Unicode);
FileNameTable.Add(offs, s);
offs += (uint)s.Length * 2 + 2;
}
er.BaseStream.Position = Header.FileDataOffset;
this.Data = er.ReadBytes((int)(Header.FileSize - Header.FileDataOffset));
}
finally
{
er.Close();
}
}


public System.Windows.Forms.Form GetDialog()
{
return new DARCViewer(this);
}

public darcHeader Header;
public class darcHeader
{
public darcHeader(EndianBinaryReader er)
{
Signature = er.ReadString(Encoding.ASCII, 4);
if (Signature != "darc") throw new SignatureNotCorrectException(Signature, "darc", er.BaseStream.Position - 4);
Endianness = er.ReadUInt16();
HeaderSize = er.ReadUInt16();
Unknown = er.ReadUInt32();
FileSize = er.ReadUInt32();
FileTableOffset = er.ReadUInt32();
FileTableLength = er.ReadUInt32();
FileDataOffset = er.ReadUInt32();
}
public String Signature;
public UInt16 Endianness;
public UInt16 HeaderSize;
public UInt32 Unknown;
public UInt32 FileSize;
public UInt32 FileTableOffset;
public UInt32 FileTableLength;
public UInt32 FileDataOffset;
}

public FileTableEntry[] Entries;
public class FileTableEntry
{
public FileTableEntry(EndianBinaryReader er)
{
NameOffset = er.ReadUInt32();
IsFolder = (NameOffset >> 24) == 1;
NameOffset &= 0xFFFFFF;
DataOffset = er.ReadUInt32();
DataLength = er.ReadUInt32();
}
public UInt32 NameOffset;
public Boolean IsFolder;
public UInt32 DataOffset;//Parent Entry Index if folder
public UInt32 DataLength;//Nr Files if folder
}

public Dictionary<UInt32, String> FileNameTable;

public byte[] Data;

public SFSDirectory ToFileSystem()
{
SFSDirectory[] dirs = new SFSDirectory[Entries.Length];
dirs[1] = new SFSDirectory("/", true);
var curdir = dirs[1];
for (int i = 2; i < Entries.Length; i++)
{
if (Entries[i].IsFolder)
{
var folder = new SFSDirectory(FileNameTable[Entries[i].NameOffset], false);
dirs[i] = folder;
folder.Parent = dirs[Entries[i].DataOffset];
dirs[Entries[i].DataOffset].SubDirectories.Add(folder);
curdir = folder;
}
else
{
var file = new SFSFile(-1, FileNameTable[Entries[i].NameOffset], curdir);
byte[] data = new byte[Entries[i].DataLength];
Array.Copy(Data, Entries[i].DataOffset - Header.FileDataOffset, data, 0, Entries[i].DataLength);
file.Data = data;
curdir.Files.Add(file);
}
}
return dirs[1];
}

public class darcIdentifier : FileFormatIdentifier
{
public override string GetCategory()
{
return Category_Archives;
}

public override string GetFileDescription()
{
return "Data Archive (darc)";
}

public override string GetFileFilter()
{
return "Data Archive (*.darc, *.arc)|*.darc;*.arc";
}

public override Bitmap GetIcon()
{
return null;
}

public override FormatMatch IsFormat(EFEFile File)
{
if (File.Data.Length > 4 && File.Data[0] == 'd' && File.Data[1] == 'a' && File.Data[2] == 'r' && File.Data[3] == 'c') return FormatMatch.Content;
return FormatMatch.No;
}

}
}
}
Loading

0 comments on commit 948fda4

Please sign in to comment.