Skip to content

Commit c7207dc

Browse files
committed
Updated README with just information relevant to the DLL and how to build and debug it.
- Build instructions are based on a PR which removes the dependencies from Git and adds DEPENDENCIES.md instructions for obtaining them.
1 parent bc06d5a commit c7207dc

1 file changed

Lines changed: 21 additions & 67 deletions

File tree

README.md

Lines changed: 21 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,31 @@
1-
## Path of Building Design Overview from @Openarl
1+
# Path of Building Community SimpleGraphic.dll
22

3-
It is split into 2 main components: the program, and the runtime.
3+
## Introduction
44

5-
The program consists of the Lua scripts that comprise the application logic, as well as
6-
the data files that the application uses. These are the files that are in the GitHub
7-
repository. When performing a normal install of the application (non-standalone) these
8-
files end up in %ProgramData%\Path of Building. In theory, this part of the application
9-
should be fully portable. The application's entry module is Launch.lua, which contains error
10-
handling and update management code. The API is defined in SimpleGraphic\ui_api.cpp. It's
11-
not very well documented at the moment, but there's a summary of the functions at the top of
12-
that file.
5+
SimpleGraphic.dll is the host environment for Lua. It contains the API used by the application's Lua logic, as well as a 2D OpenGL renderer, window management, input handling, and a debug console. It exports one symbol, RunLuaFileAsWin, which is passed a C-style argc/argv argument list, with the script path as argv[0].
136

14-
The runtime consists of the platform-specific binaries, including the Lua interpreter and
15-
the host environment, as well as a few libraries, and the data files for the host environment.
16-
In a normal install, these files go in Program Files\Path of Building. In the GitHub
17-
repository, the runtime files are packed into a zip file (runtime-win32.zip).
18-
19-
The runtime contains the following binaries:
20-
21-
### Path of Building.exe
22-
I haven't included the source for this, because franky it's very boring,
23-
and is almost entirely Windows-centric code. It takes a Lua script as an argument (or looks
24-
for 'Launch.lua' if one isn't provided) and checks the first line for a host environment
25-
specification. This design enables the .exe to function as a generic Lua host, but for
26-
Path of Building the only host actually used is SimpleGraphic.dll, so all it really does is
27-
load SimpleGraphic.dll and pass the path of the script to the "RunLuaFileAsWin" export.
28-
29-
### SimpleGraphic.dll
30-
This is the Lua host environment. It contains the API used by the
31-
application's Lua logic, as well as a 2D OpenGL renderer, window management, input handling,
32-
and a debug console. It exports one symbol, RunLuaFileAsWin, which is passed a C-style argc/argv
33-
argument list, with the script path as argv[0]. The Windows-specific code is contained in 5 files:
34-
- win\entry.cpp: Contains the DLL export. It just creates the system main module, and runs it!
35-
- engine\system\win\sys_main.cpp: The system main module; it initialises the application, and
36-
contains generic OS interface functions, such as input and clipboard handling.
37-
- engine\system\win\sys_console.cpp: Manages the debug console window that appears during the
38-
program's initialisation.
39-
- engine\system\win\sys_video.cpp: Creates and manages the main program window. There's a lot of
40-
cruft relating to fullscreen mode which could be stripped out as Path of Building only operates
41-
in windowed mode.
7+
The Windows-specific code is contained in 5 files:
8+
- win\entry.cpp: Contains the DLL export. It just creates the system main module, and runs it.
9+
- engine\system\win\sys_main.cpp: The system main module; it initialises the application, and contains generic OS interface functions, such as input and clipboard handling.
10+
- engine\system\win\sys_console.cpp: Manages the debug console window that appears during the program's initialisation.
11+
- engine\system\win\sys_video.cpp: Creates and manages the main program window.
4212
- engine\system\win\sys_opengl.cpp: Initialises OpenGL.
4313

44-
The engine depends on a number of libraries, which are all fully portable:
45-
- LuaJIT 2.0.4: I use the third-party JIT for Lua: http://luajit.org/
46-
- ZLib 1.2.8
47-
- libjpeg 9a: http://ijg.org/
48-
- libpng 1.6.12: http://libpng.org/pub/png/libpng.html
49-
- GIFLIB 5.1.1: http://giflib.sourceforge.net/
50-
- LibTiFF: http://www.libtiff.org/ (Path of Building doesn't use TIFF images so you could
51-
cut this out if you wanted to)
14+
## Building
15+
16+
SimpleGraphic.dll is currently built using Visual Studio 2019.
5217

53-
### lua51.dll
54-
This is the aforementioned LuaJIT interpreter.
18+
The dll depends on a number of 3rd party libraries. Details and instructions for how to obtain them are in DEPENDENCIES.md.
5519

56-
### libcurl.dll
57-
This is of course cURL, which the application uses for network interaction.
58-
The specific version used is 7.54.0, if that matters.
20+
Once the libraries are obtained, follow these instructions to build the DLL:
21+
1) Open SimpleGraphic.sln in Visual Studio 2019
22+
2) Choose the `Release|x86` configuration.
23+
3) Build the solution
24+
4) The resulting `SimpleGraphic.dll` can be found in the `Release` directory.
25+
5) Copy `SimpleGraphic.dll` to the Path of Building install directory, replacing the existing file.
5926

60-
### lcurl.dll
61-
A Lua binding for libcurl: https://github.com/Lua-cURL/Lua-cURLv3
27+
## Debugging
6228

63-
### lzip.dll
64-
A simple library I created to allow Lua code to extract from .zip files. This is used
65-
by the updates system. The code is a bit odd as it's a stripped-down version of a ZIP-based
66-
virtual file system, but it should be portable as it is. It depends on LuaJIT and ZLib.
29+
Since SimpleGraphic.dll is dynamically loaded by `PathOfBuilding.exe`, to debug it, run `PathOfBuilding.exe` and then attach to that process using the `Debug->Attach to Process...` menu option in Visual Studio.
6730

68-
### Update.exe
69-
This is used by the updates system to update the runtime binaries. It runs with
70-
administrator priviliges to comply with Windows' UAC; that shouldn't be required on other OSs.
71-
It contains a Lua interpreter which runs the script passed as the first argument. In practice, the
72-
only script it will run is UpdateApply.lua. To allow the LuaJIT binary to be updated, it uses a
73-
standard Lua interpreter (not the JIT) which is embedded in the executable. The script's
74-
environment consists of the standard Lua libaries, plus an extra API function 'SpawnProcess' that
75-
starts the given process and returns without waiting for the process to finish. It also lowers the
76-
execution level so that the new process doesn't run with administrator priviliges. UpdateApply.lua
77-
uses this to restart the main application after the runtime files have been updated.
31+
If debugging of the initialization is desired, then adding a MessageBox or some other pause at the start will give you time to attach and continue.

0 commit comments

Comments
 (0)