Commit graph

5393 commits

Author SHA1 Message Date
db4a4fe858 Merge pull request 'Fix missing drivers from driver selection menu' (#47) from fix-missing-drivers into main
Reviewed-on: speed-dreams/speed-dreams-code#47
2025-01-31 01:05:00 +01:00
2f72b8b9e8
src/drivers: Ensure existing dir and params file
Otherwise, if no drivers are generated by GfDrivers::ensure_min(), the
driver type (e.g.: dandroid) would not be available from the driver
selection menu because its parameter file (e.g.: dandroid.xml) would not
be available.
2025-01-30 23:34:06 +01:00
c650fa8faa
Bump speed-dreams-data
The following commit provides a fix:

commit 06aadb301f081ce837a11a6bdcc89d77fa258c5d
Author: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
Date:   Thu Jan 30 23:00:35 2025 +0100

    simplix: Remove obsolete simplix.xml

    This was a leftover from the dynamic driver generation feature. Now that
    drivers are generated from GfLocalDir(), simplix.xml is not consumed
    from GfDataDir() any more.
2025-01-30 23:33:15 +01:00
7d372c7cad Merge pull request 'CMakeLists.txt: Copy solid dlls to bin directory' (#43) from fix-solid-win into main
Reviewed-on: speed-dreams/speed-dreams-code#43
2025-01-30 01:10:18 +01:00
5652175db7
CMakeLists.txt: Copy solid dlls to bin directory
As opposed to POSIX, Windows lacks a rpath mechanism, which means that
shared libraries (aka dlls) must reside next to the executable. [1]
Since freesolid is no longer built by the 3rdParty build system (i.e.,
it is now a submodule), CMake must copy its libraries to the bin/
directory so simuv5 and friends can find them.

Note that no modifications were required for the install step, since
libraries would be already installed by the submodule.

Fixes speed-dreams/speed-dreams-code#42

[1]: https://stackoverflow.com/questions/3272383/linking-with-r-and-rpath-switches-on-windows
2025-01-30 00:19:16 +01:00
5cf9c09950 Merge pull request 'ssggraph: Remove car deformations' (#40) from rm-deformations into main
Reviewed-on: speed-dreams/speed-dreams-code#40
2025-01-28 17:25:40 +01:00
1612c46094 Merge pull request 'Fix championship and single event modes' (#41) from fix-no-display into main
Reviewed-on: speed-dreams/speed-dreams-code#41
2025-01-28 17:25:17 +01:00
a51b2bc5f3
Fix championship and single event modes
The qualification mode relies on running the race loop as fast as
possible, in order to reproduce the race results in a much shorter time.

However, the maximum frame rate limitations introduced by the commit
below caused a regression to the qualification mode, because now the
game would GfSleep most of the time and only run the race loop once
every frame (e.g.: every 1/60 seconds):

commit 9914e9d24c
Author: xavi92 <xavi92@30fe4595-0a0c-4342-8851-515496e4dcbd>
Date:   Mon Jul 15 02:52:31 2024 +0000

    Implement maximum frame rate limit

Therefore, since it is required to run the physics loop as many times as
possible, the recompute callback variant with `unsigned ms` is used so
that it is run in a loop until the time available to the callback
expires.

Fixes #37 [1].

[1]: speed-dreams/speed-dreams-code#37
2025-01-28 07:16:27 +01:00
32ada09c18
ssggraph: Remove car deformations
The deformations looked too unrealistic to be acceptable, so it is
better to remove them.
2025-01-28 07:13:04 +01:00
0a8ece452f Merge pull request 'Bump speed-dreams-data submodule' (#39) from bump-data into main
Reviewed-on: speed-dreams/speed-dreams-code#39
2025-01-27 22:27:02 +01:00
b1da069d61 Merge pull request 'Remove dangling references to simuv2 and simuv2.1' (#38) from simu-leftovers into main
Reviewed-on: speed-dreams/speed-dreams-code#38
2025-01-27 22:26:09 +01:00
8f027615ca
Bump speed-dreams-data submodule
Because of this commit:

commit aa2d7c17c135a6abb00dff9bde7bc896bd573e12
Author: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
Date:   Mon Jan 27 22:09:22 2025 +0100

    menu: Remove OnlineButton and NetworkButton

    Networked multiplayer is considered too immature for production, so this
    commit suggests to remove it from the menus in order to avoid confusion
    and frustration from players, at least until a proper implementation is
    in place.
2025-01-27 22:22:49 +01:00
68f0a38e57
Remove dangling references to simuv2 and simuv2.1
These physics engines were removed by previous commits:

commit 999eeed320
Author: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
Date:   Sat Jan 25 01:37:16 2025 +0100

    Remove simuv2

commit 022b19a141
Author: Xavier Del Campo Romero <xavi.dcr@tutanota.com>
Date:   Sun Jan 26 23:33:49 2025 +0100

    Remove simuv2.1, add FreeSOLID as a submodule

Also, make simuv5 the default value.
2025-01-27 21:56:23 +01:00
1f36ad4423 Merge pull request 'Remove obsolete simu versions' (#34) from remove-simu into main
Reviewed-on: speed-dreams/speed-dreams-code#34
2025-01-27 18:09:41 +01:00
022b19a141
Remove simuv2.1, add FreeSOLID as a submodule
As opposed to simu >= 3.0, simu 2.1 did not consider air or wheel
temperatures. This would have several consequences:

- Some drivers such as shadow rely on these parameters to calculate tire
grip. If temperature air is zero (i.e., 0K), no grip is assumed
and therefore speeds are also assigned to zero, making the driver not to
move at all.

- Invalid temperature values (i.e., 0K) would be shown on the UI, both
in ssg and OSG.

Unfortunately, simuv2.1 bundled the SOLID-2.0 library (aka FreeSOLID)
because the library is not available from most GNU/Linux distributions
yet.

In order to solve this situation, the FreeSOLID library was migrated
from CVS to Git [1] so it could be used as a submodule, and therefore
let the build system decide whether to optionally use the in-tree copy.
That said, packaging/3rdParty-devel has dropped FreeSOLID in favour of
the submodule, since it must always be built from source anyway.

[1]: https://forge.a-lec.org/speed-dreams/freesolid
2025-01-27 00:46:06 +01:00
999eeed320
Remove simuv2
It is considered obsolete by the build system and is not even built any
more.
2025-01-26 21:11:19 +01:00
73cb26ae7d Merge pull request 'Fixes to shadow and usr' (#33) from driver-fixes into main
Reviewed-on: speed-dreams/speed-dreams-code#33
2025-01-26 18:03:35 +01:00
1253fff0d3 Merge pull request 'Fix 3rdparty workflow' (#36) from test-3rdparty into main
Reviewed-on: speed-dreams/speed-dreams-code#36
2025-01-26 17:47:37 +01:00
d4a9605286
build-3rdparty.yml: Fix repo branch name
${{ env.GITHUB_HEAD_REF }} is not available to workflow_dispatch [1],
so the branch name must be manually extracted from
${{ env.GITHUB_EVENT_PATH }}.

[1]: https://forgejo.org/docs/latest/user/actions/#env-1
2025-01-26 17:45:58 +01:00
b2456f6a0d
3rdParty-devel: Fix dangling reference to readme.txt 2025-01-26 17:43:53 +01:00
720b727cd0 Merge pull request 'Bump speed-dreams-data submodule' (#35) from bump-sddata into main
Reviewed-on: speed-dreams/speed-dreams-code#35
2025-01-26 01:28:28 +01:00
620c511b39
Bump speed-dreams-data submodule
This commit should reduce the minimum system requirements:

    graph.xml: Reduce graphics quality by default

    - ssggraph provides better performance when the sky dome is disabled and
    visibility is below 100%. 50% seems to provide a good visibility/fps
    ratio.

    - Particles such as skids, and specially smoke, are resource-intensive,
    so they are now disabled by default.
2025-01-25 01:42:50 +01:00
0aec7b38cb
usr/MyCar.cpp: Express mRearWingAngle in rad
Commit 41ed56d1 allowed default values for usr drivers. However,
mRearWingAngle was incorrectly expressed as deg, when in fact
MyCar::initCa() expects it as rad. This would cause the implementation
to calculate invalid maximum speeds.

Fixes speed-dreams/speed-dreams-code#6
2025-01-25 01:33:20 +01:00
3ca9c331bf
shadow: Do not rely on static variables
The use of statically allocated variables in Driver is incorrect since
they would be shared among all Driver instances, when in fact these
variables must be defined per instance.
2025-01-25 01:28:37 +01:00
19b41127dd Merge pull request 'download-manager/README.md: Fix typo' (#32) from readme-typo into main
Reviewed-on: speed-dreams/speed-dreams-code#32
2025-01-24 22:41:39 +01:00
6a4e99f893
download-manager/README.md: Fix typo 2025-01-24 22:39:58 +01:00
2dcf10d14a Merge pull request 'download-manager: Make validation file more strict' (#31) from iceflower/speed-dreams-code:main into main
Reviewed-on: speed-dreams/speed-dreams-code#31
Reviewed-by: Xavier Del Campo Romero <xavi@noreply.forge.a-lec.org>
2025-01-24 22:38:52 +01:00
7ba51d9076
download-manager: Make validation file more strict 2025-01-24 01:11:40 +01:00
e7a87f3a51 Merge pull request 'build-deb.yml: Set up matrix for Debian and Ubuntu' (#30) from matrix into main
Reviewed-on: speed-dreams/speed-dreams-code#30
2025-01-24 00:51:07 +01:00
db9e17eadc
build-deb.yml: Set up matrix for debian and ubuntu 2025-01-24 00:50:01 +01:00
9067b0e02b Merge pull request 'Download manager: clarify documentation and fix vulnerability' (#28) from clarify-docs into main
Reviewed-on: speed-dreams/speed-dreams-code#28
2025-01-22 17:19:55 +01:00
afa21d25d5
asset.cpp: Also call check_dir for drivers
The driver category is used to determine which directory the driver
should be extracted to, so it must be sanitised.
2025-01-22 16:49:41 +01:00
139b2ac913
download-manager/README.md: Add missing enumerator 2025-01-22 16:47:17 +01:00
45107d5f17
download-manager/README.md: Clarify category for cars 2025-01-22 16:46:52 +01:00
258302220a Merge pull request 'OSG fixes' (#27) from osg-fixes into main
Reviewed-on: speed-dreams/speed-dreams-code#27
2025-01-22 16:45:41 +01:00
ea0410bf00
OsgHUD.cpp: Simplify with GfParmReadFileBoth 2025-01-20 23:24:21 +01:00
829f334268
OsgScenery.cpp: Remove invalid paths from list
"data/objects/" and "data/textures" only exist on GfDataDir().
2025-01-20 23:23:23 +01:00
42be91682c
osggraph: Fix wrong path searches
- Some search paths had GfDataDir() twice.
- As part of the dynamic driver generation feature, "drivers/" was
moved from GfDataDir() to GfLocalDir().
- Steering wheel 3D models were looked up from the wrong path. This
included high-resolution models.
- Driver entities were looked up from the wrong path:
	GfLocalDir() + filename
instead of:
	GfLocalDir() + "cars/models/<car-name>/" + filename
- Wheel 3D models were missing a search path with GfLocalDir().
2025-01-20 23:11:54 +01:00
e337decdab Merge pull request 'Read/write car and track data also from/into GfLocalDir' (#25) from fix-cars-local into main
Reviewed-on: speed-dreams/speed-dreams-code#25
2025-01-20 00:39:33 +01:00
61bb030315
params.cpp: Skip ../ when accessing XML entities
So far, tracks were always assumed to reside on GfDataDir, and often
included references to other XML files via relative paths, such as
"../../../data/tracks/surfaces.xml".
Because now tracks can also be stored into GfLocalDir, the relative
paths were now broken.

Therefore, as a workaround any "../" is skipped from the relative path,
so that entities can still be accessed from GfDataDir, even if the track
resides on GfLocalDir, thus avoiding the breaking change.
2025-01-19 23:44:17 +01:00
d4971a95bc
Allow removing assets from downloads menu
Otherwise, users would be required to remove assets manually from
GfLocalDir.
2025-01-19 23:43:14 +01:00
1169cf2b18
downloadsmenu.cpp: Ensure parent directories
Cars are downloaded to cars/models/<carname>, and tracks to
tracks/<category>/<trackname>. Therefore, downloadsmenu.cpp must ensure
cars/models/ and tracks/<category>/ exist before extracting the package.
2025-01-19 09:55:06 +01:00
c71728ea4b
asset.cpp: Always point to GfLocalDir
Now that tracks and cars can also be loaded from GfLocalDir(), the
in-game download manager must only use this directory since write
permissions are not guaranteed on GfDataDir().
2025-01-19 09:55:06 +01:00
8b5b506a7c
Support reading trackdata from GfLocalDir()
This would allow users to extract track data into GfLocalDir(), which
is guaranteed to have write permissions, as opposed to GfDataDir().
2025-01-19 09:55:06 +01:00
acf68f5847
Add missing const qualifiers 2025-01-19 09:55:06 +01:00
559b2974d6
OsgRender.cpp: Do not set pointers to NULL on destructor
It provides no benefit to do so, since the object would be destroyed
anyway and therefore it would be impossible to reuse these pointers.
Doing so can only mask potential memory errors.
2025-01-19 09:55:05 +01:00
6d7088adf5
OsgScenery.cpp: Fix undefined behaviour on delete
SDTrack was taking the ownership for track, a pointer to tTrack
allocated many layers above SDScenery::LoadScene. More specifically, it
is allocated by either TrackBuildEx or TrackBuildv1, and both would
allocate the tTrack instance via calloc(3) instead of C++'s new.

Attempting to `delete` a pointer *not* allocated by a previous call to
`new` is undefined behaviour according to the C++ standard. [1]

In fact, SDScenery::LoadScene did not even attempt to modify the
tTrack instance, so there was no need to take its ownership in the first
place.

[1]: https://en.cppreference.com/w/cpp/language/delete
2025-01-19 09:55:05 +01:00
afa38f2b0d
Support reading car data from GfLocalDir()
This would allow users to extract car data into GfLocalDir(), which is
guaranteed to have write permissions, as opposed to GfDataDir().
2025-01-19 09:55:05 +01:00
eb415c78d4
tgf: Introduce GfParmReadFileBoth
This new function attempts to read a parameter file from GfLocalDir()
first, and from GfDataDir() if not successful.

This function will be useful to extract car and track data from both
directories. Having car and track data available from GfLocalDir() is
required to allow users downloading new cars and tracks without
administrator/root privileges.
2025-01-19 08:41:21 +01:00
83bc8500ee
grsound.cpp: Use GfFileExists instead of fopen(3)
Opening a file only to check whether it exists is resource-consuming for
no reason, since GfFileExists can achieve the same effect without
requiring to open a file.
2025-01-19 08:41:06 +01:00