Skip to content

Commit

Permalink
Enable long paths and fill version data in .exe
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaSmith committed Dec 12, 2020
1 parent 9f36ff9 commit 30b146c
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 20 deletions.
52 changes: 44 additions & 8 deletions .vs/cdecrypt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
<ClInclude Include="..\utf8.h" />
<ClInclude Include="..\util.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\cdecrypt.rc" />
</ItemGroup>
<ItemGroup>
<Xml Include="..\manifest.xml" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{3BC46AE2-C27A-4B9F-B4C0-04F694F449BA}</ProjectGuid>
Expand Down Expand Up @@ -107,10 +113,18 @@
<AdditionalOptions>/DAPP_VERSION=$(AppVersion) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(AppMajor)' != ''">
<ResourceCompile>
<AdditionalOptions>/DAPP_MAJOR=$(AppMajor) %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(AppMinor)' != ''">
<ResourceCompile>
<AdditionalOptions>/DAPP_MINOR=$(AppMinor) %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
Expand All @@ -124,11 +138,16 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest />
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Manifest>
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
Expand All @@ -142,11 +161,16 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest />
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Manifest>
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
Expand All @@ -163,11 +187,16 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest />
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Manifest>
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
Expand All @@ -184,6 +213,13 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest />
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Manifest>
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
13 changes: 13 additions & 0 deletions .vs/cdecrypt.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resources">
<UniqueIdentifier>{0db7e32b-0c50-4029-aa93-74996f4b42b3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\cdecrypt.c">
Expand Down Expand Up @@ -38,4 +41,14 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\cdecrypt.rc">
<Filter>Resources</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Xml Include="..\manifest.xml">
<Filter>Resources</Filter>
</Xml>
</ItemGroup>
</Project>
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# cdecrypt
# CDecrypt

[![Build status](https://img.shields.io/appveyor/ci/VitaSmith/cdecrypt.svg?style=flat-square)](https://ci.appveyor.com/project/VitaSmith/cdecrypt)
[![Github stats](https://img.shields.io/github/downloads/VitaSmith/cdecrypt/total.svg?style=flat-square)](https://github.com/VitaSmith/cdecrypt/releases)
[![Latest release](https://img.shields.io/github/release-pre/VitaSmith/cdecrypt?style=flat-square)](https://github.com/VitaSmith/cdecrypt/releases)

A commandline utility that can be used to decrypt Wii U NUS content files.
### Description

This is a fork of https://code.google.com/p/cdecrypt intended for modders,
who want to explore or modify the content of the Wii U applications they own.
A utility that decrypts Wii U NUS content files.

### Details

This is a fork of https://code.google.com/p/cdecrypt intended for modders who
want to explore or modify the content of the Wii U applications they own.

Unlike other clones, this version of cdecrypt has **no** external dependencies
such as OpenSSL libraries and whatnot. A single executable file is all you need.
such as OpenSSL libraries and whatnot: A single executable file is all you need.
It also supports international characters, does not need to reside in the same
directory as the NUS content, and can be compiled for Linux.

### Usage

```
cdecrypt <NUS file or directory>
```

The content is extracted into the same directory where the NUS files reside.
On Windows, you can also drag and drop a directory/file directly onto `cdecrypt.exe`.
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ skip_non_tags: true

environment:
PROJECT_NAME: cdecrypt
FRIENDLY_NAME: cdecrypt
FRIENDLY_NAME: CDecrypt

build_script:
ps: |-
msbuild "$env:PROJECT_NAME.sln" /m /p:Configuration=Release /p:Platform=x86 /p:AppVersion=$env:APPVEYOR_REPO_TAG_NAME /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
$env:APPVEYOR_REPO_TAG_NAME -match 'v(\d+)\.(\d+)'
msbuild "$env:PROJECT_NAME.sln" /m /p:Configuration=Release /p:Platform=x86 /p:AppVersion=$env:APPVEYOR_REPO_TAG_NAME /p:AppMajor=$($matches[1]) /p:AppMinor=$($matches[2]) /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
after_build:
ps: |-
Expand Down
6 changes: 3 additions & 3 deletions cdecrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ static bool extract_file(FILE* src, uint64_t part_data_offset, uint64_t file_off
int main_utf8(int argc, char** argv)
{
int r = EXIT_FAILURE;
char str[MAX_PATH], *tmd_path = NULL, *tik_path = NULL;
char str[PATH_MAX], *tmd_path = NULL, *tik_path = NULL;
FILE* src = NULL;
TitleMetaData* tmd = NULL;
uint8_t *tik = NULL, *cnt = NULL;

if (argc < 2) {
printf("%s %s - Wii U NUS content file decrypter\n"
"Copyright (c) 2013-2015 crediar, Copyright (c) 2020 VitaSmith\n"
"Copyright (c) 2020 VitaSmith, Copyright (c) 2013-2015 crediar\n"
"Visit https://github.com/VitaSmith/cdecrypt for official source and downloads.\n\n"
"Usage: %s <file or directory>\n\n"
"This program is free software; you can redistribute it and/or modify it under\n"
Expand Down Expand Up @@ -495,7 +495,7 @@ int main_utf8(int argc, char** argv)

printf("FST entries: %u\n", entries);

char path[MAX_PATH] = { 0 };
char path[PATH_MAX] = { 0 };
uint32_t entry[16];
uint32_t l_entry[16];

Expand Down
58 changes: 58 additions & 0 deletions cdecrypt.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma code_page(65001)

#include <winver.h>
#include <ntdef.h>

#ifdef RC_INVOKED

#define _TO_STRING(x) #x
#define TO_STRING(x) _TO_STRING(x)

#ifndef APP_DESC
#define APP_DESC ""
#endif

#ifndef APP_MAJOR
#define APP_MAJOR 0
#endif

#ifndef APP_MINOR
#define APP_MINOR 0
#endif

#ifndef APP_NAME
#define APP_NAME ""
#endif

#ifndef EXE_NAME
#define EXE_NAME ""
#endif

VS_VERSION_INFO VERSIONINFO
FILEFLAGS 0x0L
FILEFLAGSMASK 0x3FL
FILEOS 0x40004L
FILESUBTYPE 0x0L
FILETYPE 0x1L
FILEVERSION APP_MAJOR,APP_MINOR,0,0
PRODUCTVERSION APP_MAJOR,APP_MINOR,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", APP_DESC
VALUE "FileVersion", TO_STRING(APP_MAJOR) "," TO_STRING(APP_MINOR) ",0,0"
VALUE "InternalName", APP_NAME
VALUE "LegalCopyright", "Copyright © 2020 VitaSmith, Copyright © 2013-2015 crediar"
VALUE "OriginalFilename", EXE_NAME
VALUE "ProductName", APP_NAME
VALUE "ProductVersion", TO_STRING(APP_MAJOR) "," TO_STRING(APP_MINOR) ",0,0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x9, 1200
END
END
#endif
8 changes: 8 additions & 0 deletions manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
4 changes: 2 additions & 2 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
#define PATH_SEP '/'
#endif

#ifndef MAX_PATH
#define MAX_PATH 256
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif

#ifndef min
Expand Down

0 comments on commit 30b146c

Please sign in to comment.