Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

ike9000

Uploaded by

ike9000

Virus scan

Safe to use

Tags for this mod

About this mod

Adds new functionality to TESArchive (aka Archive.exe) found in official Skyrim SE Creation Kit. Makes process of building BSA files to be fully automated by making TESArchive to accept parameters passed to it from the Windows shell.

Permissions and credits
Changelogs
Donations
Possibility to use TESArchive in Batch files and with command-line like parameters.
It is a Windows DLL module that needs to be attached to the original TESArchive executable.
Open source, with source code of the project available.


Alternatives

If you're looking for command line tool to manage BSA files, BSArch is likeky a better option.


Patching TESArchive with the DLL

Note: you don't need to do this yourself. Someone else may do this for you and patch executable on his/hers end with all the tools and steps listed below.

Tools and utilities needed:

  • CFF Explorer VII - or other program that can patch Archive.exe to add new DLL to its imports.CFF Explorer VII is part of Explorer Suite by Daniel Pistelli and can be downloaded for free from here.
  • Archive.exe - located in your following subdirectory of the game after Creation Kit has been installed: "\Tools\Archive\Archive.exe". At this moment, using Creation Kit v1.5.3.0 updated at 2019-01-29.
  • cpta_dll.dll - the DLL file from this utility.


Steps:
* Copy "cpta_dll.dll" to the same folder/directory "Archive.exe" is in.
* Start CFF Explorer VII.
* In the main menu select "File", then "Open" and browse for "Archive.exe".
* From the list on the left, select "Import Adder".
* Int the middle of the main window. find and press the "Add" button.
* Browse and select "cpta_dll.dll".
* In the list below all the buttons, in the "Exported Functions" list,
  select its single item - if it's not selected already.
* Press "Import By Name" button.
* Press "Rebuild Import Table" button.
* Select main menu "File" then "Save As" and save in the same
  directory you started from as "Archive_cpta.exe".

See this single image article for an idea of what to do: GUIDE

From now on when you start patched "Archive_cpta.exe" the old way, by clicking on its icon, you will get at least one type of the following error messages:
1. that the DLL file named "cpta_dll.dll" is missing.
2. that environment variable ASCP_INPUT_DIR has not been found.


CPTA DLL Configuration


Once you patched TESArchive, or someone patched it for you, you can use it in your shell scripts or with other external utilities. Following environment variables are used by "cpta_dll.dll".

  • ASCP_INPUT  - This is an input path as either (1) "Data" directory or (2) text file containg all input file names.This is the input the contents of BSA will be created from. In case of #1, path should point to the directory named 'Data'. Originally, in the unpatched version, this is the "Edit" - "Add Directory" option.
  • ASCP_OUTPUT_BSA - Output BSA file name. Must end with the '.bsa' extension.
  • ASCP_CONF - Optional configuration. Semicolon separated (";") key-value pairs to pre-configure main TESArchive GUI window. See batch file example for option names.

Typically, when working with Batch scripts (.BAT), assign above environment variables using the "SET" command.


Batch Script Example

@echo off
SET ASCP_INPUT=C:\bsa_data\Data
SET ASCP_OUTPUT_BSA=C:\bsa_data\output.bsa
SET ASCP_CONF=bRemoveBSL=0;bCLIOnly=0;bHidden=0;bNoQuit=0;types2=eCompress,eMeshes,eTextures,eMisc
.\Archive_cpta.exe
echo status: %ERRORLEVEL%
SET ASCP_INPUT=
SET ASCP_OUTPUT_BSA=
SET ASCP_CONF=
pause



Compiling CPTA DLL Project from Sources


Note: you don't need to do this. You will find already compiled builds in the download section.

Software used

* MS Visual C++ Compiler - tested with Visual Studio 2017 (aka. MSVC2017), should work with older versions
* Windows SDK - tested with v7.1 (typically, install Windows SDK with MSVC)
* Detours software package - tested with v4.0.1. Link

Source code must be compiled for 64-bit Windows architecture.

Compiler options:

  • /EHsc (aka. /GX)
  • /D "DETOURS_TARGET_PROCESSOR=x64"
  • /D "IN32_LEAN_AND_MEAN"
  • /D "_WIN32_WINNT=0x501"

Linker options:

  • /dll


Detours Build Configuration
Some instructions regarding Detours software package. Build detours using provided configuration makefile. Alternatively, use following compiler flags:

        /MT /Gy /Od /DDETOURS_TARGET_PROCESSOR=x64
        /DWIN32_LEAN_AND_MEAN /D_WIN32_WINNT=0x501


Links and References

My Github page:
https://github.com/ikk00

Detours software package:
https://github.com/Microsoft/Detours

CFF Explorer VII and Explorer Suite:
https://ntcore.com/?page_id=388

Installing the Creation Kit:
https://www.creationkit.com/index.php?title=Category:Getting_Started

The Bethesda.net dashboard:
https://bethesda.net/en/dashboard