Skip to content

Commit 30b146c

Browse files
committed
Enable long paths and fill version data in .exe
1 parent 9f36ff9 commit 30b146c

8 files changed

+151
-20
lines changed

.vs/cdecrypt.vcxproj

+44-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
<ClInclude Include="..\utf8.h" />
3131
<ClInclude Include="..\util.h" />
3232
</ItemGroup>
33+
<ItemGroup>
34+
<ResourceCompile Include="..\cdecrypt.rc" />
35+
</ItemGroup>
36+
<ItemGroup>
37+
<Xml Include="..\manifest.xml" />
38+
</ItemGroup>
3339
<PropertyGroup Label="Globals">
3440
<VCProjectVersion>16.0</VCProjectVersion>
3541
<ProjectGuid>{3BC46AE2-C27A-4B9F-B4C0-04F694F449BA}</ProjectGuid>
@@ -107,10 +113,18 @@
107113
<AdditionalOptions>/DAPP_VERSION=$(AppVersion) %(AdditionalOptions)</AdditionalOptions>
108114
</ClCompile>
109115
</ItemDefinitionGroup>
116+
<ItemDefinitionGroup Condition="'$(AppMajor)' != ''">
117+
<ResourceCompile>
118+
<AdditionalOptions>/DAPP_MAJOR=$(AppMajor) %(AdditionalOptions)</AdditionalOptions>
119+
</ResourceCompile>
120+
</ItemDefinitionGroup>
121+
<ItemDefinitionGroup Condition="'$(AppMinor)' != ''">
122+
<ResourceCompile>
123+
<AdditionalOptions>/DAPP_MINOR=$(AppMinor) %(AdditionalOptions)</AdditionalOptions>
124+
</ResourceCompile>
125+
</ItemDefinitionGroup>
110126
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
111127
<ClCompile>
112-
<PrecompiledHeader>
113-
</PrecompiledHeader>
114128
<WarningLevel>Level4</WarningLevel>
115129
<Optimization>Disabled</Optimization>
116130
<SDLCheck>true</SDLCheck>
@@ -124,11 +138,16 @@
124138
<SubSystem>Console</SubSystem>
125139
<GenerateDebugInformation>true</GenerateDebugInformation>
126140
</Link>
141+
<Manifest />
142+
<ResourceCompile>
143+
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
144+
</ResourceCompile>
145+
<Manifest>
146+
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
147+
</Manifest>
127148
</ItemDefinitionGroup>
128149
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
129150
<ClCompile>
130-
<PrecompiledHeader>
131-
</PrecompiledHeader>
132151
<WarningLevel>Level4</WarningLevel>
133152
<Optimization>Disabled</Optimization>
134153
<SDLCheck>true</SDLCheck>
@@ -142,11 +161,16 @@
142161
<SubSystem>Console</SubSystem>
143162
<GenerateDebugInformation>true</GenerateDebugInformation>
144163
</Link>
164+
<Manifest />
165+
<ResourceCompile>
166+
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
167+
</ResourceCompile>
168+
<Manifest>
169+
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
170+
</Manifest>
145171
</ItemDefinitionGroup>
146172
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
147173
<ClCompile>
148-
<PrecompiledHeader>
149-
</PrecompiledHeader>
150174
<WarningLevel>Level4</WarningLevel>
151175
<Optimization>MaxSpeed</Optimization>
152176
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -163,11 +187,16 @@
163187
<OptimizeReferences>true</OptimizeReferences>
164188
<GenerateDebugInformation>true</GenerateDebugInformation>
165189
</Link>
190+
<Manifest />
191+
<ResourceCompile>
192+
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
193+
</ResourceCompile>
194+
<Manifest>
195+
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
196+
</Manifest>
166197
</ItemDefinitionGroup>
167198
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
168199
<ClCompile>
169-
<PrecompiledHeader>
170-
</PrecompiledHeader>
171200
<WarningLevel>Level4</WarningLevel>
172201
<Optimization>MaxSpeed</Optimization>
173202
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -184,6 +213,13 @@
184213
<OptimizeReferences>true</OptimizeReferences>
185214
<GenerateDebugInformation>true</GenerateDebugInformation>
186215
</Link>
216+
<Manifest />
217+
<ResourceCompile>
218+
<PreprocessorDefinitions>_UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
219+
</ResourceCompile>
220+
<Manifest>
221+
<AdditionalManifestFiles>..\manifest.xml</AdditionalManifestFiles>
222+
</Manifest>
187223
</ItemDefinitionGroup>
188224
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
189225
<ImportGroup Label="ExtensionTargets">

.vs/cdecrypt.vcxproj.filters

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
1010
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
1111
</Filter>
12+
<Filter Include="Resources">
13+
<UniqueIdentifier>{0db7e32b-0c50-4029-aa93-74996f4b42b3}</UniqueIdentifier>
14+
</Filter>
1215
</ItemGroup>
1316
<ItemGroup>
1417
<ClCompile Include="..\cdecrypt.c">
@@ -38,4 +41,14 @@
3841
<Filter>Header Files</Filter>
3942
</ClInclude>
4043
</ItemGroup>
44+
<ItemGroup>
45+
<ResourceCompile Include="..\cdecrypt.rc">
46+
<Filter>Resources</Filter>
47+
</ResourceCompile>
48+
</ItemGroup>
49+
<ItemGroup>
50+
<Xml Include="..\manifest.xml">
51+
<Filter>Resources</Filter>
52+
</Xml>
53+
</ItemGroup>
4154
</Project>

README.md

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
# cdecrypt
1+
# CDecrypt
22

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

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

9-
This is a fork of https://code.google.com/p/cdecrypt intended for modders,
10-
who want to explore or modify the content of the Wii U applications they own.
9+
A utility that decrypts Wii U NUS content files.
10+
11+
### Details
12+
13+
This is a fork of https://code.google.com/p/cdecrypt intended for modders who
14+
want to explore or modify the content of the Wii U applications they own.
1115

1216
Unlike other clones, this version of cdecrypt has **no** external dependencies
13-
such as OpenSSL libraries and whatnot. A single executable file is all you need.
17+
such as OpenSSL libraries and whatnot: A single executable file is all you need.
18+
It also supports international characters, does not need to reside in the same
19+
directory as the NUS content, and can be compiled for Linux.
20+
21+
### Usage
22+
23+
```
24+
cdecrypt <NUS file or directory>
25+
```
26+
27+
The content is extracted into the same directory where the NUS files reside.
28+
On Windows, you can also drag and drop a directory/file directly onto `cdecrypt.exe`.

appveyor.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ skip_non_tags: true
44

55
environment:
66
PROJECT_NAME: cdecrypt
7-
FRIENDLY_NAME: cdecrypt
7+
FRIENDLY_NAME: CDecrypt
88

99
build_script:
1010
ps: |-
11-
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"
11+
$env:APPVEYOR_REPO_TAG_NAME -match 'v(\d+)\.(\d+)'
12+
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"
1213
1314
after_build:
1415
ps: |-

cdecrypt.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,14 @@ static bool extract_file(FILE* src, uint64_t part_data_offset, uint64_t file_off
352352
int main_utf8(int argc, char** argv)
353353
{
354354
int r = EXIT_FAILURE;
355-
char str[MAX_PATH], *tmd_path = NULL, *tik_path = NULL;
355+
char str[PATH_MAX], *tmd_path = NULL, *tik_path = NULL;
356356
FILE* src = NULL;
357357
TitleMetaData* tmd = NULL;
358358
uint8_t *tik = NULL, *cnt = NULL;
359359

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

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

498-
char path[MAX_PATH] = { 0 };
498+
char path[PATH_MAX] = { 0 };
499499
uint32_t entry[16];
500500
uint32_t l_entry[16];
501501

cdecrypt.rc

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#pragma code_page(65001)
2+
3+
#include <winver.h>
4+
#include <ntdef.h>
5+
6+
#ifdef RC_INVOKED
7+
8+
#define _TO_STRING(x) #x
9+
#define TO_STRING(x) _TO_STRING(x)
10+
11+
#ifndef APP_DESC
12+
#define APP_DESC ""
13+
#endif
14+
15+
#ifndef APP_MAJOR
16+
#define APP_MAJOR 0
17+
#endif
18+
19+
#ifndef APP_MINOR
20+
#define APP_MINOR 0
21+
#endif
22+
23+
#ifndef APP_NAME
24+
#define APP_NAME ""
25+
#endif
26+
27+
#ifndef EXE_NAME
28+
#define EXE_NAME ""
29+
#endif
30+
31+
VS_VERSION_INFO VERSIONINFO
32+
FILEFLAGS 0x0L
33+
FILEFLAGSMASK 0x3FL
34+
FILEOS 0x40004L
35+
FILESUBTYPE 0x0L
36+
FILETYPE 0x1L
37+
FILEVERSION APP_MAJOR,APP_MINOR,0,0
38+
PRODUCTVERSION APP_MAJOR,APP_MINOR,0,0
39+
BEGIN
40+
BLOCK "StringFileInfo"
41+
BEGIN
42+
BLOCK "040904b0"
43+
BEGIN
44+
VALUE "FileDescription", APP_DESC
45+
VALUE "FileVersion", TO_STRING(APP_MAJOR) "," TO_STRING(APP_MINOR) ",0,0"
46+
VALUE "InternalName", APP_NAME
47+
VALUE "LegalCopyright", "Copyright © 2020 VitaSmith, Copyright © 2013-2015 crediar"
48+
VALUE "OriginalFilename", EXE_NAME
49+
VALUE "ProductName", APP_NAME
50+
VALUE "ProductVersion", TO_STRING(APP_MAJOR) "," TO_STRING(APP_MINOR) ",0,0"
51+
END
52+
END
53+
BLOCK "VarFileInfo"
54+
BEGIN
55+
VALUE "Translation", 0x9, 1200
56+
END
57+
END
58+
#endif

manifest.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
3+
<asmv3:application>
4+
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
5+
<ws2:longPathAware>true</ws2:longPathAware>
6+
</asmv3:windowsSettings>
7+
</asmv3:application>
8+
</assembly>

util.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
#define PATH_SEP '/'
5757
#endif
5858

59-
#ifndef MAX_PATH
60-
#define MAX_PATH 256
59+
#ifndef PATH_MAX
60+
#define PATH_MAX 1024
6161
#endif
6262

6363
#ifndef min

0 commit comments

Comments
 (0)