JurassicParkTrespasser/jp2_pc
Michael 5bd95ec56c dlgrender.cpp: preselect driver from configuration 2021-09-02 21:02:44 +02:00
..
BinData Initial commit 2018-01-01 23:07:24 +01:00
BuildTools BuildTools/CMake: update submodule to new head revision 2020-11-19 00:20:02 +01:00
Distribution Distribution/Binary/OpenTrespasser.ini: set window mode to borderless window, increase default window size 2021-07-04 21:27:07 +02:00
Documents MemoryDebugging.md: updates and clarifications to the memory debugging instructions 2021-04-24 22:41:45 +02:00
Inc box2.h: add local min macro definition 2020-06-29 22:36:39 +02:00
MWBuild Initial commit 2018-01-01 23:07:24 +01:00
Metrowerks Additions Initial commit 2018-01-01 23:07:24 +01:00
Source dlgrender.cpp: preselect driver from configuration 2021-09-02 21:02:44 +02:00
Tools Root/TweakTrespass.exe: move TweakTrespass.exe to Tools directory 2021-01-30 15:44:44 +01:00
cmake Merge pull request #172 from meekee7/applyclut16-cpp-path 2021-07-31 15:45:23 +02:00
gtest@6a7ed316a5 gtest: forward to head of v1.10.x branch 2020-04-16 00:29:40 +02:00
lib Initial commit 2018-01-01 23:07:24 +01:00
ADPCM.eel Initial commit 2018-01-01 23:07:24 +01:00
CMakeLists.txt Merge pull request #172 from meekee7/applyclut16-cpp-path 2021-07-31 15:45:23 +02:00
Error.scn Initial commit 2018-01-01 23:07:24 +01:00
GUIApp.BCE Initial commit 2018-01-01 23:07:24 +01:00
Generate-VS2019-x86.cmd CMake: add script to generate VS2019 solution with CMake 2020-03-28 21:45:03 +01:00
LastScene.scn Initial commit 2018-01-01 23:07:24 +01:00
Missing.cau Initial commit 2018-01-01 23:07:24 +01:00
Processor.dll Initial commit 2018-01-01 23:07:24 +01:00
README.md Merge pull request #154 from meekee7/32bit-colordepth-support 2021-06-08 18:10:58 +02:00
Settings.d3d Initial commit 2018-01-01 23:07:24 +01:00
SlideTest.scn Initial commit 2018-01-01 23:07:24 +01:00
Start-CMake-GUI.cmd Root/Start-CMake-GUI.cmd: detach launched CMake-GUI.exe from console process 2021-07-04 20:23:32 +02:00
Test.scn Initial commit 2018-01-01 23:07:24 +01:00
build.cmd Root/build.cmd: add launcher script for build.ps1 2021-07-04 22:42:50 +02:00
build.ps1 build.ps1: use ProductVersion from OpenTrespasser.exe in package name 2021-07-10 00:31:13 +02:00
test.eel Initial commit 2018-01-01 23:07:24 +01:00
vssver.scc Initial commit 2018-01-01 23:07:24 +01:00

README.md

Getting started with OpenTrespasser

General build requirements

Visual Studio 2019 with the C++ Desktop Development workload is required. That includes the C++ compiler and the Windows SDK. You will also need the packages for MFC and ATL libraries.

All other libraries and tools are provided in this repository, either directly or from Git submodules.

You should install the game Trespasser before starting development on OpenTrespasser, so that the game directory can be autodetected.

Generating the VS solution with CMake

The project configuration and build instructions are written in a CMake script.

It is recommended that you generate a VS solution and VS projects and work with these generated files. To do this, run the script Generate-VS2019-x86.cmd, the solution and project files will be generated under Build\cmake-x86.

If you want more control over CMake, then you can also run CMake-GUI with the launch script Start-CMake-GUI.cmd.

You can regenerate the solution with CMake while it is still open in VS. In that case, VS will ask if you want to reload the solution, which you should do.

VS2019 also has built-in support for CMake projects (if you install the package for that), but this has not been tested yet with OpenTrespasser.

Project configurations

OpenTrespasser knows three project configurations:

  • Debug: Compiler optimizations are disabled, runtime checks are enabled. All debugging code is enabled.
  • Release: Compiler optimizations are enabled, runtime checks are reduced to default. Some, but not all, debugging code is disabled.
  • Final: Same as Release, but all debugging code is disabled.

Note that debug symbols (PDBs) are generated in all three configurations, so using the debugger is always possible.

Execution and debugging

The game executable OpenTrespasser.exe needs to be run in the Trespasser game directory, usually found in the C:\Program Files (x86)\... path. If a Trespasser installation is detected by CMake, then the Trespasser directory is automatically set to be the working directory for debug execution in VS. This means that you can start the game directly from VS.

Also the built OpenTrespasser.exe is automatically copied to the Trespasser directory after each build.

Depending on your system configuration, a program running in the Trespasser directory might require elevated rights to write files in that directory. It is recommended that you start VS with admin rights (see below). You should also configure the program to start with admin rights directly, via the compatibility settings.

16bit color depth mode

The game works in both 16bit and 32bit color depth. An exception applies to D3D rendering together with exclusive fullscreen mode: this combination only works with 16bit color depth.

Additional tools like GUIApp have not yet been tested in 32bit color depth and might completely refuse to start in that configuration.

We do not know how to make VS start a program in 16bit color depth mode. Perhaps it can be done by starting VS with 16bit color depth, but that would be very inconvenient.

The recommended procedure for using 16bit color depth is this:

  • Open the executable's compatiblity settings. Open its file properties and go to the compatibility tab.
  • Set the color mode to 16bit.
  • Start the program.
  • If you need the debugger, attach it manually as described below.

Attaching the debugger manually

You can use the VS Debugger without starting a program from VS. In the Debug menu in the main menu bar, there is a command to attach to a running process. If you attached the debugger once, another command is added to the Debug menu to reattach it, so you don't have to reselect the process.

When starting Trespasser, a warning message might pop up, telling you that your graphics driver is not certified for DirectDraw. It is highly recommended that you do not disable that message. The moment that warning is on display is an excellent opportunity to manually attach the debugger.

Output of debug information

In any normal Win32 GUI program, including the Trespasser game, output to console via std::cout and std::cerr does not work because there is no console. However, Windows offers a special debug output channel, which can be viewed in the Output window in Visual Studio. Trespasser gives convenient access to that channel with the global output stream dout (declared in Lib/Sys/DebugConsole.hpp), which can be used just like std::cout. Note that all output to dout is discarded in Final builds.

Trespasser also supports other forms of debug output, including log files and writing text directly to the game screen, as demonstrated by the bones cheat.

General Tips and Troubleshooting

  • Launch Visual Studio with admin rights. Just open the context menu (right-click) for its entry in the start menu and select Run as Admin. Trespasser wants to write files to its own directory under C:\Program Files (x86)\..., and that requires elevated rights on modern Windows configurations. By launching VS with admin rights, it can launch Trespasser with elevated rights as well.

  • If you want to make a new tool with the Trespasser code and use MFC/AFX in your project (like the GUIApp), then add this line before you include the MFC headers (i.e. in stdafx.h or pch.h):

    • #define DIRECT3D_VERSION 0x0700

    • The old Direct3D code in the Windows SDK headers is only activated if your project is based on Direct3D 7.0 or lower. In modern Windows SDKs, the MFC headers include the stuff of newer Direct3D versions by default.

  • If you get the error The command "setlocal during the build, that means something went wrong in the postbuild step which is supposed to copy the newly built OpenTrespasser.exe to the Trespasser directory.

    • Ensure that VS is started with Admin rights (see above)
    • If the problem persists, disable the postbuild step.
      • To disable it in VS, open the project settings for trespass, go to Build Events and remove the postbuild command. Note that it will be added again when the solution is regenerated by CMake.
      • To disable the postbuild step in CMake, regenerate the solution, but set the CMake variable USE_TRESPASSER_DIRECTORY to FALSE. That can be easily done with the CMake GUI.
  • See Documents/MemoryDebugging.md for instructions on advanced debugging tools for memory corruption.