Releases: GothicKit/ZenKit
[release] v1.3.0
Version 1.3 re-brands "phoenix" as "ZenKit" to avoid confusion with PhoenixTales' Game
of the same name. Basically all APIs have gotten a new look with more appropriate names and a replacement for
phoenix::buffer
has been introduced. The build system has also been changed and requires manual intervention when
updating to the new version. A migration guide is available at https://zk.gothickit.dev/library/misc/v1.2-to-v1.3/.
Here are the changes not related to the renamed API.
Breaking Changes
The phoenix
CMake target has been renamed to zenkit
and the following changes have been made in relation to that
change:
- The following CMake variables have been renamed:
PHOENIX_BUILD_EXAMPLES
toZK_BUILD_EXAMPLES
PHOENIX_BUILD_TESTS
toZK_BUILD_TESTS
PHOENIX_BUILD_SHARED
toZK_BUILD_SHARED
PHOENIX_INSTALL
toZK_ENABLE_INSTALL
PHOENIX_DISABLE_SANIZIZERS
toZK_ENABLE_ASAN
(Danger: The meaning of this variable has been reversed)
phoenix::vdf_file
has been fully removed. Migrate tozenkit::Vfs
!phoenix::way_net::waypoint
has been removedphoenix::archive_reader::read_raw_bytes
has been removed in favour ofphoenix::archive_reader::read_raw_bytes(size_t)
phoenix::model_script::parse_binary
has been removed in favour ofphoenix::model_script::parse
phoenix::vobs::camera_lock_mode
has been removed in favour ofphoenix::vobs::sprite_alignment
phoenix::vob::camera_alignment
has been removed in favour ofphoenix::vob::sprite_camera_facing_mode
phoenix::symbol::{get,set}_{string,int,float}
now take a raw pointer as context.phoenix::cs_camera::frames
has been split intotrajectory_frames
andtarget_frames
Other breaking changes:
- [59d7930] The value setters in
DaedalusSymbol
now take regular pointers for the context (instead ofshared_ptr
) - [cd8092c]
DaedalusScript::enumerate_instances_by_name
now only enumeratesconst
instances
Features
- [cfec005] XZEN-encoded worlds are now supported. Thanks, @ThielHater!
- [13dbb6a] The member array lengths of
vobs::npc
now have names thanks to a patch by @JucanAndreiDaniel - [bbf0505,ad4a3540] @Try added support for the Nintendo Switch port of Gothic 1 by adding
c_menu_item_frame::frame_pos{x,y}
andc_menu_item_flags::hor_selectable
in the Daedalus support library - There are two new interfaces for interacting with data which replace
phoenix::buffer
:zenkit::Read
andzenkit::Write
- [535ef54] The
phoenix::mesh
now comes with a new API for retrieving raw, un-triangulated polygons from the mesh data - [9caff1b] Added a getter for
DaedalusInstance
bound types - [2122d85,7e8b4800,fed97b02,fd58eef2] Added spec-compliant ZenGin Archive parser. This new implementation properly handles
object references and is capable of parsing objects automatically using the newReadArchive::read_object
API. - [34b26bc] Added a new
WriteArchive
API for creating ZenGin Archives using ZenKit - [c3dbd5e...46e9ea4,6aa96dbc,aba71724,cd2e3d7f,60d49f14,05cbd047,9b694f06] Implement
save
for various object types, including the VOb-tree. These objects can now be
loaded, modified and then saved again using ZenKit only. The objects are:VirtualObject
and its descendants,
CutsceneLibrary
,Font
,Mesh
,ModelHierarchy
,Texture
,Vfs
,MultiResolutionMesh
,ModelMesh
,Model
,World
- [fc75d4b] Added
Write
implemented to write to a given file system path - [338cce7] Added getters and setters for the global
DaedalusVm
instance - [369ea8b]
DaedalusVm::print_stack_trace
now reports global state information as well - [f723065,253e29b6] Improved
SaveGame
support drastically. Save games can now be fully parsed and also created usingZenKit
alone. - [202e9b8] Added a
TextureBuilder
for creating new textures from scratch - [a3a408f] Deadalus external functions can now also take a
DaedalusSymbol&
as a parameter (instead of just a name) - [d0b8dcf] Add support for loading uncompressed VdfsTool VDFs
- [037db91] Added supported for the ARGB4 texture format
Bugfixes
- [a5cdce4] Fixed possible
nullptr
-dereference inVfs::mount_disk
- [9d7c3f7] Fixed an integer underflow in
register_default_external
- [42efd41] Fixed loading of rigid-body information from save-games.
- [5eb44c8,2b5aa9e8] Fixed some issues with memory leakage in the
Vfs
- [713480b] Fixed a dangeling reference issue in
DaedalusVm::register_default_external
- [c9acf8e,3d67ed5a] Fixed some broken bounds checks in
DaedalusVm
andDaedalusScript
- [748962d] Fixed an issue where exported VDF files could not be read in by some tools because the journal was at the incorrect location
- [51540d8] Fixed an issue where the file and directory count was written out-of-order in the VDF export
- [616182a,7dc594e3,36c2e909,f942cf20] Fixed a set of issues preventing files from being read correctly on Windows when MMAP support was disabled.
- [f6ded81] Fixed a segfault which could happen when reading in a world with an empty BSP-tree.
Misc
- Added documentation for all known VObs and their fields. This new documentation can be viewed at
zk.gothickit.dev, and it has been mirrored to the
Gothic Modding Community (GMC)'s page. - [6e71a70]
mio
has been dropped and replaced by a custom, simpler memory mapping implementation (zenkit::Mmap
) - [1f88732] Sped up
Mesh
parsing for some Windows systems by up to 15x - [5e60a3a] The VDF export now always outputs the current date as the file's timestamp
- [f53a955] The Daedalus VM's stack is now managed correctly when functions exit with unconsumed data on the stack.
Deprecations
- All APIs in the
phoenix
namespace. Migrate to their analogs in thezenkit
namespace instead! Also see the migration guide
[release] v1.2.0
Update 1.2 introduces a host of new features, mostly for the VM, to support modding frameworks like Ikarus and LeGo.
There are also many bugfixes, which mostly address issues with games files provided by mods. Notably, there is one
small breaking change which only affects users who have been manually passing include_polygons
to mesh::parse()
,
as described below.
Breaking Changes
- [33f6f6d] For performance reasons,
mesh::parse()
now takes a vector of ints instead of anunordered_set
. Thanks, @Try!
Features
- [69f1df0] You can now call script functions manually, pushing values onto the stack as required, by using
vm::unsafe_call()
. This addition was made for compatibility with the C interface. - [637b888] You can now register a custom default external function for manually handling the stack. This addition was
made for compatibility with the C interface. - [78a1c82] Added a new implementation of the VFS in the form of
Vfs
. This will fully replace the oldvdf_file
implementation in phoenix 2.0. - [5230465] Meshes can now be parsed without passing
include_polygons
. - [bbec4cc,f46144fa] Added named constants for Gothic 1/2 specific enum values in
npc_type
. - [e481bca] The VM now supports overriding functions in a way which will not push a call stack frame ("naked functions"). Thanks, @Try!
- [e481bca] The VM can now report accesses of specific symbols by calling a registered callback. This is required for
supporting the Ikarus modding framework as well as debugging support. Thanks, @Try! - [13c929b] Daedalus function parameters for externals can now be explicitly passed using a new
func
type,
instead of a plainint
. - [a348a38] The VM now supports two new instance types,
opaque_instance
andtransient_instance
, which can be used
to support modding frameworks like Ikarus. Thanks, @Try!
Bugfixes
- [2c2a099]
vm::call_function()
now properly compiles when building a shared library. - [b4af7ed] The
camera_trajectory
enum now contains the correct enum value forcamera_trajectory::object
. - [fee2dd1] Added support for semicolons in model script source files.
- [ed37464] The buffer now no longer segfaults when loading empty files.
- [68714df] When reading a line at EOF, the buffer no longer throws an exception, but rather returns the empty string.
- [356647d]
light_preset
andlight
VObs now correctly support greyscale color transitions. - [3fe0f7b] Parsing of model scripts now features improved compatibility for modded installations.
- [0e7e507] For compatibility with mods, values of Daedalus string symbols are now parsed using a special algorithm
to avoid data corruption. - [9e8458e,7e447c3e,bcb47c1b] The Vfs now correctly handles trailing whitespace in node names.
Misc
- [4ac598e]
texture
s can now be copied and moved. - [1d6a3b7]
script
s can now be copied and moved. - [19ab9ac] Buffer exception constructors are now public.
- [d6566d5,bee00d13] VM stack traces are now printed using the logger.
- [3b6825b] The element count of
c_item::{text, count}
has been extracted as a constant. Thanks, @JucanAndreiDaniel!
Deprecations
- [78a1c82] Deprecated the old VFS implementation in
vdfs.hh
.
[backport-release] v1.1.2
This release backports bugfixes from v1.2.0.
Bugfixes
- [a0574b7]
vm::call_function()
now properly compiles when building a shared library. - [6adfc90] The
camera_trajectory
enum now contains the correct enum value forcamera_trajectory::object
. - [efe212a] Added support for semicolons in model script source files.
- [b55206c] The buffer now no longer segfaults when loading empty files.
- [89bb243] When reading a line at EOF, the buffer no longer throws an exception, but rather returns the empty string.
- [5d8b511]
light_preset
andlight
VObs now correctly support greyscale color transitions. - [4b512fa] Parsing of model scripts now features improved compatibility for modded installations.
- [090dc1b] For compatibility with mods, values of Daedalus string symbols are now parsed using a special algorithm
to avoid data corruption.
[release] v1.1.1
This update again brings many bugfixes and smaller improvements in addition to updates to the documentation. phoenix can now also be built as a shared library which should be considered an experimental feature. This update also finally replaces the old lexy parser for model scripts with a self-rolled implementation.
Bugfixes
- [03cb97b] Fixed a stack corruption issue in the VM which could be triggered if the
movvf
ormovf
was called
with a member but no current instance was present - [c6cb69d] Fixed broken VM execution flag
allow_null_instance_access
for instructionsaddmovi
,submovi
,
mulmovi
anddivmovi
. - [cae1c118, f0d6751] Fixed a VM/script bug which could occur when using higher-order functions.
- [2cd3da6] Added checks for division by zero errors in the VM.
- [3693450] Prevent null-pointer de-reference in
vm::initialize_instance
if the instance's parent symbol can
not be found. - [1bf2510] VDF entries with a size larger than the VDF file itself are now no longer loaded.
- [5d78aa4, 4e7b863] Fix an issues with ignoring whitespace in binary archives.
- [c7d4115] Catch numeric conversion errors in archives and re-throw them as
parser_error
s.
Misc
[release] v1.1.0
Oh boy, this is a big one! There are a lot of additions, some changes and also some deprecations here. Also, the performance of phoenix has improved quite a bit, especially interacting with VDFs and parsing worlds. We've also made the first steps to making phoenix a shared library by adding support for cmake --install
(thanks @DaDummy!) which will be expanded on in the future. Another cool thing is the new, centralized documentation page for phoenix and ZenGin internals available at https://phoenix.lmichaelis.de. It's quite bare-bones still but some interesting stuff has already been moved over.
Anyway, here's the list of changes:
Bugfixes
- [0c29d03, 6a64eee] Fix issues related to stack guards and externals.
- [529137d] Fix incorrect parsing of animation sample rotations.
- [1403f5e] Fix undefined behavior in
trigger_mover
- [2456b7f] Report the end of archive objects at EOF as well.
Features
- [397bacf, 702c838, b7a650a, 6dd7fe4, 5703773, 9568b8a, db6616f, 15396f0, 63692ad, d855c16, 8932721] Add
support for parsing save-games. This feature allows phoenix to fully parse original save-games from their directory
structure. Seesave_game.hh
for additional information. - [08bcab3] Add
archive_reader::print_structure
to print the contents of an archived object as XML. This is mainly
useful for debugging, and it only works properly with ASCII and BIN_SAFE archives since BINARY archives don't contain
field names. - [f789a92] Add a safer version of
archive_reader::read_raw_bytes
which takes the number of bytes to read as a
parameter. This works since we normally know how many bytes to parse anyway, otherwise BINARY archives would not work. - [0d0f07d]
archive_reader
now has an API to easily check whether it's a save-game or not (archive_reader::is_save_game
). - [3079375, b8db409] Add unstable APIs for retrieving and visiting archive entries and objects without a schema. See
archive_reader::next
andarchive_reader::visit_objects
for more details. - [a8526c3] VM external functions may now take raw instance pointers. This allows for bypassing potentially expensive
std::shared_ptr
copies. - [d0ad2da] The default external implementation now handles instances by pushing a
null
-instance instead
Changes
- [ae77600]
script::find_symbol_by_name
and everywhere the script and VM require a symbol name parameter now take
astd::string_view
instead ofstd::string
. - [0bfd3cf]
symbol::get_string
now returns astd::string_view
instead of astd::string
- [0d1b976] Indexes into script symbol values are now represented by a
size_t
instead of auint8_t
- [fd0023b] Internal Change: phoenix' tests are now much easier to identify and feature additional checks for
VObs and different game versions - [c0ace3c]
bsp_tree
leaf polygons are now stored in astd::unordered_set
instead of astd::vector
for
performance reasons. This change improves world parse times by about 6%. - [39319e9] If the signature of a VDF files being parsed is not recognized, phoenix now throws a
vdfs_signature_error
Deprecations
- [32770f8]
way_net::waypoint(std::string const&)
: This is a broken and slow API which should not be used. - [f789a92]
archive_reader::read_raw_bytes()
: This API is unsafe and should no longer be used. - [1df2b5e]
model_script::parse_binary(...)
: Usemodel_script::parse(...)
instead, it now supports both binary
and text-based scripts. - [30de6a4]
camera_lock_mode
andvob::camera_alignment
: Old and incorrect names forsprite_alignment
and
vob::sprite_camera_facing_mode
respectively. - [604b61b]
vdf_entry* vdf_entry::find_child(std::string_view) &
andvdf_entry* vdf_file::find_child(std::string_view) &
:
Mutating VDF entries is broken, thus these APIs should not be used. Use theconst
versions instead.
Performance
- [ebb48be]
messages::block_by_name
now makes use of a sorted vector instead of a map lookup - [604b61b, 1957cbb] VDF entry lookups are now up to 90 times faster due to usage of
std::set
to contain the entries. - [ee00a03] The VM now uses a flat array as a stack instead of an actual
std::stack
. This eliminates unnecessary
heap allocations during runtime and thus improves speed. - [f8c6935] Improve performance of
buffer
in general by about 20% - [5bf91b4] Improve
archive_reader::read_object_begin
performance by about 7%
Misc
- [d2b8649, 21dbecd, bdc8bb3, b962249] phoenix is now also compiled with
-Wpedantic
and-Wshadow
- [2556143] Add support for using CMake install (thanks, @DaDummy!)
- [de512da] Clang 14 is now tested in CI and fully supported
- [cc00c0e]
fmtlib
is no longer a dependency of phoenix - [16328f8, 44a59c1, a61ab85, 1846455, 8196b89, 3d79c51 - 55de3c6] Add centralized documentation site for both
the phoenix library and ZenGin internals. It can be found at https://phoenix.lmichaelis.de.
[release] v1.0.2
In this version, some quite severe bugs regarding model script parsing have been fixed. Additionally, this release contains a lot of smaller fixes detailed below:
Bugfixes
- [cbe6fea] Fix issue in archive_reader::read_bool which would return false for any value other than 1. This is not the correct behaviour since it should return true for any non-zero value instead. This is now the case.
- [5c1c34c] Fix typo in #define for log levels (thanks, @DaDummy!)
- [15f0e4f] Fix a bug in archive_reader_binary::skip_opject which caused the parser to jump 4 bytes too far
- [a3a23ce] Fix a compilation error specific to Apple Clang in c_info::remove_choice
- [b3b7eb2, ff6735b] Fix incorrect parsing of enums in BINARY archives.
- [17dfa5a, 3abd771, 26f53ec, 5c628a4] Fix many issues regarding MDS parsing. MDS files seem to have a defined structure at first but there are typos in original files which break that structure. These fixes address various typos in these files to make them parse correctly again.
[release] v1.0.1
After the merge into OpenGothic a couple other issues were uncovered. This patch addresses these issues and contain a set of compatibility improvements and some performance upgrades. These are the changes made since v1.0.0:
Bugfixes
- [d9357f6] Previously, only the non-
const
version ofscript::find_symbol_by_name
was case-insensitive. Now
theconst
version is too. - [7d87485] Non-free waypoints are now correctly included in the
way_net::waypoint
lookup - [c8c2294] Return
null
-instances from the default VM external set byvm::register_default_external
if needed - [ce320ad] If a default external is set the stack guard in the
opcode::be
branch ofvm::exec
is now inhibited
preventing stack corruption - [272c2a3] The stack guard for the
opcode::bl
instruction invm::exec
usedsym
as uninitialized which caused VM
crashes if any script function was overridden - [612b078] Fix incorrect usage of
std::isspace
in multiple locations which could cause crashes using compilers which
treatchar
as signed
Performance
- [88c43eb] Improve
archive_reader::read_object_begin
performance by up to 30% by usingsscanf
instead
ofstd::stringstream
internally
Misc
[release] v1.0.0
After some tweaks and bugfixes, phoenix was merged into OpenGothic! This means, phoenix is now officially released. Here's a list of changes made since v1.0.0-rc1:
Bugfixes
- [f251a9b] VM exceptions are now re-thrown if no exception handler is set
- [7806270] The order of colors parsed from archives was incorrect. Colors are now parsed in the correct order
Features
- [dd95ae6] The VM now supports allocation of instances without initialization using
vm::allocate_instance
. This is useful for avoiding side effects of the script's initialization function - [81986f3] The Daedalus Classes extension now uses more named array size constants
- [c6a47e9, 1c5473b] The
buffer
now supports automatic un-escaping of escaped lines usingbuffer::get_line_escaped
- [85d520f] String constants in scripts are now automatically un-escaped and thus they will now contain newlines and tab characters
- [56775ce] The VM now prevents stack corruption when throwing external C++ functions are called
Deprecations
- [301f881]
camera_lock_mode
should now be referred to assprite_alignment
- [301f881]
vob::camera_alignment
should now be referred to asvob::sprite_camera_facing_mode
Misc
[pre-release] v1.0.0-rc1
After about a year of development, I'm happy to announce the first pre-release for phoenix v1.0.0! From now on, detailed information about changes made to the API as well as internal changes can be found in changelog.md. More information about the versioning scheme can be found in readme.md.
🐲 This is a pre-release version. It is possible that additional breaking changes will be made before the full release of v1.0.0!