Commit graph

5322 commits

Author SHA1 Message Date
f593629982
racemanagers.cpp: Do not list championship on no cars
Some checks failed
/ build (pull_request) Failing after 42s
Some championships depend on a given car category (e.g.: "36GP") that
might have not been installed yet by the user.

Making the championship not available fixes a out-of-bounds access when
reading VecCarCategoryIds in driverselect.cpp.
2025-01-19 07:22:34 +01:00
ac052b58d0 Merge pull request 'README.md: Fix invalid links' (#20) from fix-readme-2 into main
Reviewed-on: #20
2025-01-15 07:44:40 +01:00
6c3eea2dee
README.md: Fix invalid links
Some checks failed
/ build (pull_request) Has been cancelled
2025-01-15 07:43:45 +01:00
5e7335fe99 Merge pull request 'README.md: Minor changes' (#19) from fix-readme into main
Reviewed-on: #19
2025-01-15 07:35:45 +01:00
a990abe1c0
README.md: Add project logo
Some checks failed
/ build (pull_request) Has been cancelled
2025-01-15 07:34:29 +01:00
17af4eab29
README.md: Fix wrong links to submodule 2025-01-15 07:33:19 +01:00
bd5f11b80b Merge pull request 'Add speed-dreams-data as submodule' (#18) from data-submodule into main
Reviewed-on: #18
2025-01-15 07:17:04 +01:00
8cb2219134
build-w64-mingw32.yml: Clone repository recursively
Some checks failed
/ build (pull_request) Failing after 34s
Now that speed-dreams-data is provided as a submodule, this workflow can
package a NSIS installer that contains both code and data.
2025-01-15 07:16:39 +01:00
c5d07414fe
README.md: Update according to new build system features 2025-01-15 07:14:41 +01:00
c34ed2f809
Replace packaging/3rdParty-devel/readme.txt with README.md 2025-01-15 06:36:59 +01:00
880d53d88a
Find speed-dreams-data submodule by default
Now that speed-dreams-data is available as a submodule, this allows the
build system to choose it for in-tree builds. Therefore, CMake will
perform in the following order:

1. Do not search the speed-dreams-data package if SD_ASSUME_DATADIR is
   set.
2. Otherwise, do an in-tree build if the submodule has been updated.
3. Otherwise, search for the speed-dreams-data package on standard
   locations and CMAKE_PREFIX_PATH and/or CMAKE_FIND_ROOT_PATH.
4. Otherwise, return an error message.

SD_HAS_DATADIR was rendered redundant, so it has been removed. However,
SD_DATADIR_INSTALL_PREFIX was introduced because it would not equal
SD_DATADIR_ABS for in-tree builds, where an installed version of the
speed-dreams-data package is not required.

In-tree builds now allow to generate NSIS installers with both code and
data.
2025-01-15 06:36:59 +01:00
2c45379403
Add speed-dreams-data as a submodule
There were several reasons behind splitting the old SVN monorepo in two
Git repositories:

- It made packaging for GNU/Linux distributions easier, since
speed-dreams-data would be often considered as a separate,
portable package, as typically done in other video games. For example,
0ad and 0ad-data, cube2 and cube2-data, and so on.

- It reduced the repository size for the engine repository as much as
possible, which is often desirable for CI/CD runs and developers with
poor connectivity and/or who only want to perform quick changes to the
source code. After all, speed-dreams-data is around 294 MiB as of the
time of this writing, whereas speed-dreams-code is around 36 MiB.

However, there are situations where having both repositories together is
desirable or even mandatory:

- In the case of Windows builds, both repositories must be configured by
the same top-level CMakeLists.txt so that files and targets from both
repositories are installed simultaneously, and therefore packaged into
the NSIS-based installers. Otherwise, it would require users to run two
separate installers, one for speed-dreams-code and another for
speed-dreams-data.

- Having a submodule makes which version from speed-dreams-data is
compatible with speed-dreams-code clearer.

- Not having a submodule required developers to both fetch the
speed-dreams-data repository and install it, which means double disk
space usage.

- Some users might still prefer to work on a monorepo and not have to
worry about installing speed-dreams-data beforehand.
2025-01-15 06:36:50 +01:00
Xavier Del Campo Romero
13b6fc1457 Merge pull request 'Continuous delivery for Debian stable and i686-w64-mingw32' (#11) from cd into main
Reviewed-on: #11
2025-01-13 16:22:41 +01:00
b4662b65b9
Introduce w64-mingw32 workflows
All checks were successful
/ build (pull_request) Successful in 18m20s
- build-3rdparty.yml cross-builds all third-party dependencies for
Windows. This workflow is meant to be run only sparingly, since
it fetches source code from many repositories and takes a long time to
build.

- build-w64-mingw32.yml cross-builds the game engine and tools for
Windows. It requires a pre-existing build of the third-party libraries.
2025-01-13 00:07:07 +01:00
44429fab1f
build-deb.yml: Upload Debian package 2025-01-13 00:07:07 +01:00
3bb02a188c
build-deb.yml: Build Debian package 2025-01-13 00:07:07 +01:00
fa12517208
build-deb.yml: Fetch whole history
Otherwise, git-describe(1) would fail and it would not be possible to
tag the artifacts accordingly.
2025-01-13 00:07:06 +01:00
bb6f43d124
build-deb.yml: Do not report git clone progress
Progress information is noisy and therefore does not provide any
benefits to the CI/CD logs.
2025-01-13 00:07:06 +01:00
f822312fdb
build-deb.yml: Add step names
These get reflected by the web browser interface, enhancing readability.
However, splitting into different steps requires to specify the working
directory.
2025-01-13 00:07:06 +01:00
3567f775d2
build-deb.yml: Change indentation from 4 to 2 spaces
Even if most of the project follows the 4-space convention, 2 spaces
seems more comfortable for YAML files, specially for workflows where
deeper levels of indentations are common.
2025-01-13 00:07:06 +01:00
e9bd5b2ff8
Rename build.yml to build-deb.yml
This workflow will be dedicated to Debian packaging only.
2025-01-13 00:07:06 +01:00
8af4015db8
Revamp Debian and NSIS packaging
The existing scripts for Debian and NSIS packaging were too complex and
dealt unnecessarily with lower level details that should be already
handled by CMake and CPack.

- Packaging-related scripts have been moved to the new cpack/ directory.
There, CPack variables common to all generators are defined in
cpack/common.cmake, and then generator-specific variables are defined
independently (e.g.: cpack/debian.cmake and cpack/nsis.cmake).

- Packaging is now optionally done at a second stage, by running
`cpack -G <generator>` on the build directory. This removes the
requirement to branch based on the system name, and instead all CPack
variables are assigned unconditionally.

- Since now only one version of the game is packaged, there is no need
to maintain the complex scripts in packaging/ and packaging/windows that
used to deal with all variants (e.g.: "wip-cars-and-tracks",
"hq-cars-and-tracks", etc.).

- The use of CPACK_NSIS_EXTRA_INSTALL_COMMANDS,
CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS and CPACK_NSIS_CREATE_ICONS_EXTRA
should not be required, let alone modifying the HKLM registry manually,
since CPack already provides everything required to set up the
installer, the uninstaller and shortcuts.

- $INSTDIR is not required, since NSIS would already prepend the
target installation directory.

- PROJECT_VERSION_METADATA is not a standard CMake variable.
CMAKE_PROJECT_VERSION_TWEAK is instead meant for this purpose. [1]

- OPTION_PACKAGING and OPTION_ALL_IN_ONE_PACKAGING were removed since
packaging will always be available, yet optional. Packagers must then
run CPack on a second stage, as described above.

- Outdated comments were removed to avoid confusion.

TODO:

- Add shortcut to track editor on NSIS.

- dmg packaging was not revamped because of lacking compatible
hardware, but still it has been moved to cpack/dmg.cmake.

- Windows portable packaging (OPTION_PORTABLE_PACKAGING) has been left
out since it required 7z and relied on several hacks to work.
Furthermore, portable versions of the game were already not released on
the latest release, either. [2]

[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_VERSION_TWEAK.html
[2]: https://sourceforge.net/projects/speed-dreams/files/2.3.0/
2025-01-13 00:07:01 +01:00
8ae4321be6
Introduce i686-w64-mingw32.cmake
This is the i686 counterpart to x86_64-w64-mingw32.cmake, which will be
used to generate 32-bit builds for Windows.
2025-01-12 22:46:40 +01:00
5e9613238c
CMakeLists.txt: Add HOMEPAGE_URL to project
This is later used by CPack for its CPACK_PACKAGE_HOMEPAGE_URL. [1]
This requires CMake >= 3.12, which was released circa 2018. [2]

[1]: https://cmake.org/cmake/help/latest/module/CPack.html#variable:CPACK_PACKAGE_HOMEPAGE_URL
[2]: https://cmake.org/files/v3.12/
2025-01-12 22:46:40 +01:00
76b83654e0
Set executable icon
On Windows, the executable icon is important since it is also inherited
by CPACK_NSIS_INSTALLED_ICON_NAME [1] and CPACK_PACKAGE_EXECUTABLES. [2]

[1]: https://cmake.org/cmake/help/latest/cpack_gen/nsis.html#variable:CPACK_NSIS_INSTALLED_ICON_NAME
[2]: https://cmake.org/cmake/help/latest/module/CPack.html#variable:CPACK_PACKAGE_EXECUTABLES
2025-01-12 22:46:34 +01:00
Xavier Del Campo Romero
1ead0ca79f Merge pull request 'Fix download manager on windows' (#14) from fix-win32-dm into main
Reviewed-on: #14
2025-01-10 08:33:19 +01:00
eab16bcdd9
win32/rmdir_r.cpp: Try with RemoveDirectory
All checks were successful
/ build (pull_request) Successful in 12m53s
SHFileOperation has been shown to fail when removing empty directories,
even if the documentation does not document such behaviour. [1]
Therefore, RemoveDirectoryA is used since it is meant for empty
directories. [2]

[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationa
[2]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectorya
2025-01-09 22:02:09 +01:00
fd2327eec9
win32/rmdir_r.cpp: Check directory exists beforehand
rmdir_r's POSIX counterpart returns 0 on non-existing directories.
However, when SHFileOperation is called on a non-existing directory,
usually with DE_INVALIDFILES (0x7C) as its return code, although it is
considered unreliable. [1] Therefore, its existence must be checked
first.

[1]: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationa
2025-01-09 22:02:09 +01:00
9ddee14af1
unzip.cpp: Apply minor stylistic fix 2025-01-09 21:55:20 +01:00
1a4dc5f50f
unzip.cpp: Fix wrong open mode
By default, std::ofstream objects are opened under the std::ios::out
mode, equivalent to "r" mode in fopen(3), which has non-portable
behaviour. [1]

In order to avoid non-portable behaviour, std::ios::binary must be used
instead, equivalent to "rb" mode in fopen(3).

[1]: https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream
2025-01-09 21:54:19 +01:00
Xavier Del Campo Romero
53a758688e Merge pull request 'Reduce minimum required OpenGL version from 3.3.0 to 2.1.0, and other fixes' (#3) from gl-renderer into main
Reviewed-on: #3
2025-01-08 00:48:20 +01:00
8f230211bb
OsgCar.cpp: Do not create SDCarShader on "none" shaders
All checks were successful
/ build (pull_request) Successful in 13m24s
Even if "none" shaders were selected, the game would still parse
car.frag and execute the shaders, which is not the expected behaviour.
2025-01-07 00:28:47 +01:00
c677c8d9e2
guiscreen.cpp: Reduce minimum required OpenGL version
3.3.0 was required only because one shader, namely car.frag, was
arbitrarily requiring GLSL 3.3.0. However, it was already compatible
with GLSL 1.1.0, [1] so the minimum required OpenGL version can be
safely lowered to 2.1. [2]

[1]: https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.1.10.pdf
[2]: https://en.wikipedia.org/wiki/OpenGL#Version_history
2025-01-07 00:28:46 +01:00
21211a7aa5
guiscreen.cpp: Ensure successful SDL_GL_CreateContext
SDL_GL_CreateContext can fail due to several reasons, such as
GLXBadFBConfig on unsupported OpenGL versions.
2025-01-07 00:28:46 +01:00
Xavier Del Campo Romero
96d0dafac7 Merge pull request 'CMakeLists.txt: Reduce version to 2.3.0' (#13) from xavi/speed-dreams-code:reduce-version into main
Reviewed-on: #13
2025-01-07 00:20:31 +01:00
7700b68d87
CMakeLists.txt: Reduce version to 2.3.0
Some checks failed
/ build (pull_request) Has been cancelled
Until version 2.4.0 is not released, it is better to keep it as 2.3.0
since `git describe --tags --dirty` would return `v2.3.0-...` until the
`v2.4.0` tag is created.

Accordingly, speed-dreams-data also reduced its version to 2.3.0. [1]

[1]: 5c58ce805d
2025-01-07 00:18:47 +01:00
Xavier Del Campo Romero
c1cdee61e7 Merge pull request 'Add build.yml Forgejo workflow' (#9) from build-workflow into main
Reviewed-on: #9
2025-01-04 13:27:17 +01:00
17f37e85ad
Add build.yml Forgejo workflow
All checks were successful
/ build (pull_request) Successful in 12m52s
2025-01-04 13:00:28 +01:00
Xavier Del Campo Romero
7d2727c579 Merge pull request 'Introduce SD_ASSUME_DATADIR' (#10) from assume-datadir into main
Reviewed-on: #10
2025-01-04 13:00:03 +01:00
198f96295a
CMakeLists.txt: Introduce SD_ASSUME_DATADIR
This repository depends on the speed-dreams-data package in order to
generate a working package. However, in the context of CI/CD, it is
desirable to build this package without depending on the
speed-dreams-data, and instead assume it would be found on a standard
location.

Therefore, this would allow the generation of artifacts that install to
standard locations, such as Debian packages.
2025-01-04 11:55:19 +01:00
95f0bb57e6
CMakeLists.txt: Move call to project() to the top
Otherwise, references to standard CMake variables such as
CMAKE_INSTALL_PREFIX [1] would return an empty string.

Note: for some reason, CMake only documents this behaviour for other
variables such as PROJECT_SOURCE_DIR or PROJECT_BINARY_DIR, but not
CMAKE_INSTALL_PREFIX. [2] However, it was reproducible.

[1]: https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
[2]: https://cmake.org/cmake/help/latest/command/project.html
2025-01-04 11:51:37 +01:00
Xavier Del Campo Romero
6791a9358f Merge pull request 'advancedgraphicconfig.cpp: Fix wrong direction' (#8) from fix-wrong-dir into main
Reviewed-on: #8
2025-01-03 12:37:40 +01:00
d56b0c54dc
advancedgraphicconfig.cpp: Fix wrong direction
This was causing the right arrow to act like the left arrow, so shaders
would jump from "none" to "ultra" instead of from "none" to "little".
2025-01-03 12:32:57 +01:00
Xavier Del Campo Romero
316a1bc18b Merge pull request 'Fix several issues with file setup' (#2) from issue-1 into main
Reviewed-on: #2
2025-01-03 00:18:30 +01:00
Xavier Del Campo Romero
f6bce9f4fb Merge pull request 'mainmenu.cpp: Move downloads button to correct order' (#5) from issue-4 into main
Reviewed-on: #5
2025-01-02 23:09:30 +01:00
98806b1e6e
mainmenu.cpp: Move downloads button to correct order
Otherwise, pressing the "arrow down" key would jump with the following
order:

Options -> Downloads -> Credits -> Quit

Instead of the expected order:

Options -> Credits -> Downloads -> Quit
2025-01-02 23:00:34 +01:00
7e72f12a48
filesetup.cpp: Ensure destination dir before copy
When GfFileSetup is called on a fresh installation, none of the
destination directories might exist.

On the other hand, robustness has been slightly improved by adding calls
to good() and is_open().
2025-01-01 21:54:29 +01:00
1f81d42305
unitmain.cpp: Remove confusing error message
Now that the game ships without any driver by default, it is very likely
that simplix.xml does not exist on fresh installations. In fact, the
game already did not consider this as an error, so this was a leftover.
2025-01-01 21:05:12 +01:00
a0c31c8a1c
download-manager/README.md: Update driver info 2024-12-31 10:42:07 +01:00
bd2880e37b
Look up SD_DATADIR_ABS if SD_DATADIR not found
Commit 744677c3a6f3e6c1c463fe55b7b5408355ffe89b from speed-dreams-data
replaced the definition for SD_DATADIR from an absolute path to a
relative path. This was done in order to allow a relative path to be
looked up first by GfApplication::parseOptions() (as required by Windows
and macOS builds), and then look SD_DATADIR_ABS if not found (as
required by in-tree builds).
2024-12-31 08:34:49 +01:00