From 30b146c4e49878e81f55138504db0240bb17a2a5 Mon Sep 17 00:00:00 2001 From: VitaSmith Date: Sat, 12 Dec 2020 16:50:15 +0000 Subject: [PATCH] Enable long paths and fill version data in .exe --- .vs/cdecrypt.vcxproj | 52 +++++++++++++++++++++++++++----- .vs/cdecrypt.vcxproj.filters | 13 ++++++++ README.md | 25 ++++++++++++---- appveyor.yml | 5 ++-- cdecrypt.c | 6 ++-- cdecrypt.rc | 58 ++++++++++++++++++++++++++++++++++++ manifest.xml | 8 +++++ util.h | 4 +-- 8 files changed, 151 insertions(+), 20 deletions(-) create mode 100644 cdecrypt.rc create mode 100644 manifest.xml diff --git a/.vs/cdecrypt.vcxproj b/.vs/cdecrypt.vcxproj index f37a03f..e1e64db 100644 --- a/.vs/cdecrypt.vcxproj +++ b/.vs/cdecrypt.vcxproj @@ -30,6 +30,12 @@ + + + + + + 16.0 {3BC46AE2-C27A-4B9F-B4C0-04F694F449BA} @@ -107,10 +113,18 @@ /DAPP_VERSION=$(AppVersion) %(AdditionalOptions) + + + /DAPP_MAJOR=$(AppMajor) %(AdditionalOptions) + + + + + /DAPP_MINOR=$(AppMinor) %(AdditionalOptions) + + - - Level4 Disabled true @@ -124,11 +138,16 @@ Console true + + + _UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions) + + + ..\manifest.xml + - - Level4 Disabled true @@ -142,11 +161,16 @@ Console true + + + _UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions) + + + ..\manifest.xml + - - Level4 MaxSpeed true @@ -163,11 +187,16 @@ true true + + + _UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions) + + + ..\manifest.xml + - - Level4 MaxSpeed true @@ -184,6 +213,13 @@ true true + + + _UNICODE;UNICODE;APP_NAME=\"CDecrypt\";EXE_NAME=\"$(TargetFileName)\";%(PreprocessorDefinitions) + + + ..\manifest.xml + diff --git a/.vs/cdecrypt.vcxproj.filters b/.vs/cdecrypt.vcxproj.filters index 8e4dfc4..47e8c88 100644 --- a/.vs/cdecrypt.vcxproj.filters +++ b/.vs/cdecrypt.vcxproj.filters @@ -9,6 +9,9 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + {0db7e32b-0c50-4029-aa93-74996f4b42b3} + @@ -38,4 +41,14 @@ Header Files + + + Resources + + + + + Resources + + \ No newline at end of file diff --git a/README.md b/README.md index 8474765..d383c99 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +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`. diff --git a/appveyor.yml b/appveyor.yml index 66bde0b..f232456 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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: |- diff --git a/cdecrypt.c b/cdecrypt.c index 023ef93..58a9d74 100644 --- a/cdecrypt.c +++ b/cdecrypt.c @@ -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 \n\n" "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) 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]; diff --git a/cdecrypt.rc b/cdecrypt.rc new file mode 100644 index 0000000..2cadb41 --- /dev/null +++ b/cdecrypt.rc @@ -0,0 +1,58 @@ +#pragma code_page(65001) + +#include +#include + +#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 diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..2eb8d5f --- /dev/null +++ b/manifest.xml @@ -0,0 +1,8 @@ + + + + + true + + + diff --git a/util.h b/util.h index acb53b6..63b6e09 100644 --- a/util.h +++ b/util.h @@ -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