Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security policy

Report a suspected vulnerability through [GitHub private vulnerability reporting](https://github.com/EternalSelf-2328/undershell/security/advisories/new).
Include the affected undershell version or commit, your Linux distribution,
the feature involved, and the conditions needed to observe the issue. Remove
credentials and personal paths from logs and attachments before sharing them.

Use [GitHub Issues](https://github.com/EternalSelf-2328/undershell/issues) for
ordinary bugs and feature requests.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
meson:
name: Build and test (Ubuntu 24.04)
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
LIBGL_ALWAYS_SOFTWARE: '1'
LP_NUM_THREADS: '2'
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- name: Install build and EGL test dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
meson ninja-build pkg-config libwayland-dev wayland-protocols \
libegl-dev libgles-dev libegl-mesa0 libgl1-mesa-dri libpipewire-0.3-dev \
libtomlplusplus-dev libglib2.0-dev libcairo2-dev libpango1.0-dev \
libsqlite3-dev libfontconfig-dev libxkbcommon-dev libsystemd-dev \
libgdk-pixbuf-2.0-dev libcurl4-openssl-dev nlohmann-json3-dev \
libavformat-dev libavcodec-dev libswscale-dev libavutil-dev liblz4-dev
- name: Compile
run: |
meson setup build -Dvideo=enabled -Devolution=enabled -Dscenes=enabled
meson compile -C build -j 2
- name: Run tests with headless EGL
run: |
meson test -C build --no-rebuild --print-errorlogs --num-processes 2 --timeout-multiplier 3
jq -e -s 'length > 0 and all(.[]; .result == "OK")' build/meson-logs/testlog.json
3 changes: 2 additions & 1 deletion src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ void Audio::processFrame() {
for (size_t i = 0; i < n; ++i) {
float v = m_bands[i];
if (v < m_prev[i] && nr > 0.1F) {
v = static_cast<float>(m_peak[i] * (1.0 - m_fall[i] * m_fall[i] * gravityMod));
const double fall = m_fall[i];
v = static_cast<float>(m_peak[i] * (1.0 - fall * fall * gravityMod));
v = std::max(v, 0.0F);
m_fall[i] += 0.04F;
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/particles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ ParticleSystem::ParticleSystem(const ParticleDef& def, const ParticleSettings& s
}

size_t ParticleSystem::wantedCap() const {
const double n = m_def.max * m_set.amount * perfKnobs().particles;
return std::clamp<size_t>(static_cast<size_t>(std::ceil(n)), 1, kMaxCap);
const double n = static_cast<double>(m_def.max) * m_set.amount * perfKnobs().particles;
if (std::isnan(n)) return 1;
return static_cast<size_t>(std::ceil(std::clamp(n, 1.0, static_cast<double>(kMaxCap))));
}

void ParticleSystem::resize(size_t cap) {
Expand Down Expand Up @@ -700,7 +701,7 @@ void ParticleField::configure(const toml::table& opts, const NoctaliaState& noct
auto num = [&](const char* opt, double def, double lo, double hi) {
double v = def;
if (auto x = opts[particleKey(d.id, opt)].value<double>()) v = *x;
return static_cast<float>(std::clamp(v, lo, hi));
return static_cast<float>(std::clamp(std::isnan(v) ? def : v, lo, hi));
};
ParticleSettings s;
s.amount = num("amount", 1, 0.1, 3);
Expand Down
4 changes: 2 additions & 2 deletions src/perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ double PerfGovernor::upCost(PerfLevel level) {
if (level == PerfLevel::Ultra) return 1;
const PerfKnobs &a = knobsFor(level), &b = knobsFor(step(level, +1));
const double fa = a.fpsCap > 0 ? a.fpsCap : 60, fb = b.fpsCap > 0 ? b.fpsCap : 60;
const double px = (b.renderScale / a.renderScale) * (b.renderScale / a.renderScale);
return std::max(1.0, fb / fa * px);
const double scale = static_cast<double>(b.renderScale) / a.renderScale;
return std::max(1.0, fb / fa * (scale * scale));
}

void PerfGovernor::reset(PerfLevel start, PerfLevel floor, PerfLevel ceiling) {
Expand Down
3 changes: 2 additions & 1 deletion src/visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ void Visualizer::configureHalo(const WidgetConfig& cfg, const NoctaliaState& noc
BoltRandom r(7);
for (size_t i = 0; i < kFilaments; ++i) {
m_filAngle[i] = static_cast<double>(i) * 2.39996 + r.range(-0.3F, 0.3F);
m_filSpeed[i] = (r.next() < 0.5F ? -1 : 1) * r.range(0.25F, 0.8F);
const double direction = r.next() < 0.5F ? -1.0 : 1.0;
m_filSpeed[i] = direction * r.range(0.25F, 0.8F);
m_filSeed[i] = 101 + static_cast<uint32_t>(i) * 7919;
}
for (size_t k = 0; k < m_arcSeed.size(); ++k) m_arcSeed[k] = 3 + static_cast<uint32_t>(k) * 104729;
Expand Down
6 changes: 6 additions & 0 deletions tests/test_particles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ int main() {
}
CHECK(lib.find("sparks") && lib.find("sparks")->additive && lib.find("sparks")->react > 0);

// A TOML nan uses the option's default and still lets the system emit.
ParticleField normal, nonFinite;
normal.configure(toml::parse("pt_snow = true\n"), testPalette());
nonFinite.configure(toml::parse("pt_snow = true\npt_snow_amount = nan\n"), testPalette());
CHECK(normal.count() > 0 && nonFinite.count() == normal.count());

// what the format refuses
CHECK(!parseParticles("x", "{ nope").error.empty());
CHECK(!parseParticles("x", R"({"sprite": "cube"})").error.empty());
Expand Down
Loading