Skip to content

Instantly share code, notes, and snippets.

@flayman
Last active March 6, 2023 06:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flayman/24b4326fd451f1200d2c199a1bf62fa1 to your computer and use it in GitHub Desktop.
Save flayman/24b4326fd451f1200d2c199a1bf62fa1 to your computer and use it in GitHub Desktop.
Step-by-step instructions for building xEdit in RAD Studio 10.4 Community Edition

Step-by-step instructions for building xEdit in RAD Studio 10.4 Community Edition

There is a message pinned to the #dev_support channel where ElminsterAU described the steps for building xEdit in the Community Edition of the Delphi RAD Studio IDE. With the release of version 10.4 of that IDE, these instructions have been superseded. I'm giving below my steps to get this project group to build. I would like to thank ElminsterAU for working with me to fix a couple problems in the codebase that were preventing it from building or running correctly. I will describe those too.

Step One: Install RAD Studio

This is not hard. Either log in on this page or click the link that reads "Register Here" to fill out a form. Then satisfy the captcha and click the button that reads "DOWNLOAD NOW" to begin the download of the latest version. You will also be sent by email a license key which needs to be provided during install. The install should be self-explanatory.

Step Two: Download and install Project Magician

Link is here: https://www.uweraabe.de/Blog/downloads/download-info/project-magician/. Dowload the zip, extract it into a folder, and run the installer application contained therein.

Step Three: Download and install IDE Fix Pack

At the time of writing, there is not currently a fix pack for version 10.4 so this step can be skipped. In case there ever is one, you will find it here: https://www.idefixpack.de/blog/ide-tools/ide-fix-pack/

Step Four: Download and install DDevExtensions

Grab the latest version from this page, then extract the 7z file to a folder and run the executable inside. You may need the free 7-Zip program for this, which also handles zip and many other types of archive.

Step Four(a): Activate "Disable Package Cache" in DDevExtensions settings

Open RAD Studio and find DDevExension options under the Tools menu. Tick the box next to "Disable Package Cache (requires IDE restart)" and click OK. Restart the IDE now or later.

Step Five: Download the xEdit sources from GitHub

It is not enough to download the zip archive from the green Code button, as this will not give you the externals. You'll need to clone the git repository using whichever tools and methods with which you are most comfortable. For read-only access, you will probably need to use the https URL to get it. The project page is here: https://github.com/TES5Edit/TES5Edit, and the repo URL is https://github.com/TES5Edit/TES5Edit.git

You should have the default branch of dev-4.1.5, which is currently recommended as of 8th December 2021. If you see a later dev branch as default, then you should use that. ElminsterAU includes a note about making sure to update the submodules. This needs a bit more of an explanation. Assuming you are using command line git (such as from the excellent Git Bash console), you will need to issue the following commands:

> git submodule init   
> git submodule update

This will pull down the tagged heads of the external project repos.

Step 6: Install JCL

The recommended way to install the JEDI packages JCL and JVCL is through a combined installer; however, for xEdit we need to use the specific versions that are supplied with special patches. ElminsterAU's instructions, and indeed the package's own instructions for installing individually, say to install with a command line batch script. Unfortunately, due to a new limitation instroduced in version 10.4, this no longer works. Instructions here give a clue as to how to proceed with a manual install, but I found these a bit lacking. Here's what you need to do:

  1. From the TES5Edit root folder, find .\External\jcl\jcl\source\include\jcl.template.inc and create two copies of that as jcld27win32.inc and jcld27win64.inc in the same location.
  2. In the IDE, open the group project file located at .\External\jcl\jcl\packages\JclPackagesD270.groupproj
  3. Compile the projects Jcl270.bpl and JcslVcl270.bpl for both 32-bit and 64-bit targets, though 32-bit is all you'll need for this.

Step 7: Install JVCL

This suffers from the same problem as JCL. This package's instructions for manual install are obscure as well as outdated. Here's what you need to do:

  1. Open the group project file found at ".\External\jvcl\jvcl\packages\D27 Packages.groupproj"
  2. Choose from main menu Tools -> Options then Language -> Delphi -> Library
  3. Edit the library path to add the full path to the include folder where you created the two include files in step 6. Also add the full path to .\External\jcl\jcl\lib\d27\win32.
  4. "Build All Projects" from the Project menu. They will not all build successfully, but it's okay. I had "[dcc32 Fatal Error] JvBands.dpk(43): E2202 Required package 'JclDeveloperTools' not found". This package is not needed.
  5. Install the design time package JvCoreDesign270.bpl

There is no need to bother with the D27_x64 Packages group project, as it does not contain a design time package for JvCore. I'm told that this is because that package is only used by RAD Studio and that there is no 64-bit version of the IDE.

Step 8: Install the VirtualTrees design package

  1. Open the group project file at ".\External\VirtualTrees\Packages\RAD Studio 10.4\VirtualTreeView.groupproj" and choose the Windows 32-bit target platform.
  2. Ensure that the library path for the 32-bit Release build configuration contains the same paths as in step 7, then also add the full path to .\External\jvcl\jvcl\lib\d27\win32.
  3. "Build All Projects" from the Project menu, then install the design time package VirtualTreesD27.bpl.

I tried to follow similar steps to install the 64-bit version of VirtualTrees, but I couldn't get that to work. I'm not sure whether it has anything to the lack of JvCore design time package. I may investigate this further when I have more time. If you want to try, apply similar changes to the Windows 64-bit library path but substiting win32 with win64 in any path names. At this point, JEDI paths can optionally be removed from any library path for the target platforms, as they are no longer needed.

Step 9: Install FileContainer

Open the group project file at .\External\FileContainer\FileContainer26.groupproj then Build All and install the design time package FileContainerD26.bpl.

Note: It certainly would seem like there should be a D27 version of this package included, but the D26 seems to work.

Step 10: Build the xEdit projects!

  1. Open BethWorkBench.groupproj from the TES5Edit root. If you see an error related to frmMain, hit Cancel.
  2. Choose the target platform. There is a 32-bit and a 64-bit target, which both build and run fine. The 64-bit version displays a warning saying there is usually no good reason to run that version unless you are seeing out of memory errors.
  3. When building xEdit.exe, select the build configuration LiteDebug under Debug. For the others, select Debug.
  4. Build and then run the project. It should run without any errors. Then you are done!

Note: If you see an error about cxEdit when building xEdit.exe, it means you have not selected the correct build configuration.

Code that prevented compilation

See this commit, which fixes a bug that the new compiler picks up which turns out to be an inconsequential memory leak: https://github.com/TES5Edit/TES5Edit/commit/218cfe1584160b2001ba9cb42e976b21f8821fc4

Code that was causing runtime errors

Any other commits on the same date as above address these issues, which boiled down to missing changes for the RAD Studio 10.4 package of VirtualTrees. VirtualTrees is heavily patched for xEdit, and the 10.4 package had not been used before.

How to run the xEdit program from the IDE for your desired game

When xEdit is distributed for a particular game, it is given a unique file name, for example, FNVEdit.exe. This is how the application normally detects which game mode it should be working in. From the IDE, it is necessary to suppy a command line parameter. The choices are 'tes5vr', 'fo4vr', 'tes3', 'tes4', 'tes5', 'enderalse', 'enderal', 'sse', 'fo3', 'fnv', 'fo4', and 'fo76', defaulting to fo4. The parameter is supplied as a switch that follows a hyphen, so -fnv for example. Choose "Parameters..." from the Run menu and plug the switch into the Parameters box. Then run the program. As Todd Howard famously said, "It just works."

License

This help file is provided without license in the hope that it will be useful. It may be reused in any form. I only ask that credit is given.

@Infernio
Copy link

Infernio commented Sep 7, 2022

For anyone who gets an error like this:

[dcc32 Fatal Error] jcl.inc(44): F1026 File not found: 'jedi\jedi.inc'

JCL includes a submodule of its own, so the submodules need recursive initialization. The instructions in the "Download the xEdit sources from GitHub" section should be:

git submodule update --init --recursive

Edit: there is also now a D27 version of FileContainer.

@sibir-ine
Copy link

sibir-ine commented Sep 10, 2022

In addition to these instructions & Infernio's correction, I had to install the JvCustomDesign270.bpl package from the JVCL group project. Otherwise, I got errors about a missing TJvBalloonHint class that prevented xEdit from building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment