diff --git a/extensions/balance/manifest.toml b/extensions/balance/manifest.toml index 2e4aa37..635b3c2 100644 --- a/extensions/balance/manifest.toml +++ b/extensions/balance/manifest.toml @@ -1,10 +1,10 @@ id = "balance" name = "Balance" description = "Shift the sound towards the left or right ear in decibel steps, or play one ear only." -version = "0.1.0" +version = "0.1.1" author = "RevolaOS" license = "GPL-3.0-only" -api = "1.78" +api = "1.89" stability = "beta" category = "effects" diff --git a/extensions/crossfeed/manifest.toml b/extensions/crossfeed/manifest.toml index 1109dc6..1449cb3 100644 --- a/extensions/crossfeed/manifest.toml +++ b/extensions/crossfeed/manifest.toml @@ -1,14 +1,17 @@ id = "crossfeed" name = "Crossfeed" description = "Blends a little of each channel into the other so hard-panned stereo is easier on headphones. A simple mode or a custom filter." -version = "0.1.0" +version = "0.1.1" author = "RevolaOS" note = "Ported from Rockbox" license = "GPL-3.0-only" -api = "1.78" +api = "1.89" stability = "beta" category = "effects" -requires = ["dsp"] + +[libraries] +required = ["dsp"] +optional = ["reprise"] [[module]] name = "main" diff --git a/extensions/dsp/manifest.toml b/extensions/dsp/manifest.toml index c1657c3..14b074b 100644 --- a/extensions/dsp/manifest.toml +++ b/extensions/dsp/manifest.toml @@ -1,11 +1,11 @@ id = "dsp" name = "DSP" description = "Signal processing the audio effects share: the look-ahead limiter, filter designs, the biquad cascade and the maths behind them." -version = "0.1.0" +version = "0.1.1" author = "RevolaOS" note = "Partly adapted from RepriseOS" license = "GPL-3.0-only" -api = "1.74" +api = "1.89" stability = "beta" category = "library" exports = [ diff --git a/extensions/dsp/rv_dsp.h b/extensions/dsp/rv_dsp.h index 5ae8a22..d63b241 100644 --- a/extensions/dsp/rv_dsp.h +++ b/extensions/dsp/rv_dsp.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-3.0-only */ /* What the dsp library exports, and the state its limiter and fade run on. - * An effect lists `requires = ["dsp"]` in its manifest; rv.mk finds the + * An effect lists dsp under `[libraries] required`; rv.mk finds the * library and the core fills in the addresses when it loads. No * RV_MODULE_CALL here: a call into a library is a long call. */ diff --git a/extensions/night-shift/manifest.toml b/extensions/night-shift/manifest.toml index fd37372..f6f6e5b 100644 --- a/extensions/night-shift/manifest.toml +++ b/extensions/night-shift/manifest.toml @@ -1,12 +1,15 @@ id = "night-shift" name = "Night Shift" description = "Warm the display manually or follow sunset and sunrise in the iPod's time zone." -version = "0.1.2" +version = "0.1.3" author = "RepriseOS and RevolaOS contributors" license = "GPL-3.0-only" -api = "1.81" +api = "1.89" category = "system" +[libraries] +optional = ["reprise"] + [[module]] name = "main" trigger = "always" diff --git a/extensions/playback-log/main.c b/extensions/playback-log/main.c index 81db894..f369469 100644 --- a/extensions/playback-log/main.c +++ b/extensions/playback-log/main.c @@ -119,7 +119,7 @@ static void field_media_text(struct osos_media_item *item, enum osos_media_text osos_media_item_text(item, field, &string); } else { uint16_t text[255]; - uint32_t units = api->album_artist_read(item->record, text, 255); + uint32_t units = RV_OPTIONAL(reprise_album_artist_read, 0, item->record, text, 255); osos_native_string_assign_utf16(&string, text, units); } const char *text = osos_native_string_data(&string); @@ -657,8 +657,6 @@ static const struct rv_descriptor extension = { const struct rv_descriptor *rv_module_entry(const struct rv_api *core, rv_extension_handle handle) { - if (!rv_has_reprise_services(core)) - return NULL; api = core; self = handle; load_config(); diff --git a/extensions/playback-log/manifest.toml b/extensions/playback-log/manifest.toml index 73fed35..77324e3 100644 --- a/extensions/playback-log/manifest.toml +++ b/extensions/playback-log/manifest.toml @@ -1,12 +1,15 @@ id = "playback-log" name = "Playback Log" description = "Write a scrobbler log and optional detailed listening reports." -version = "0.1.1" +version = "0.1.2" author = "RepriseOS contributors" license = "GPL-3.0-only" -api = "1.82" +api = "1.89" category = "media" +[libraries] +optional = ["reprise"] + [[module]] name = "main" trigger = "always" diff --git a/extensions/playback-log/test.c b/extensions/playback-log/test.c index 44b56db..2a24e0f 100644 --- a/extensions/playback-log/test.c +++ b/extensions/playback-log/test.c @@ -138,6 +138,9 @@ static int mock_seek(void *h, uint64_t n, int w) #define osos_file_read mock_read #define osos_file_close(h) ((void)(h)) #define osos_file_seek mock_seek +/* Weak like the optional.h of the build, so the tests against NULL stay. */ +#pragma weak reprise_legacy_preference +#pragma weak reprise_album_artist_read #include "main.c" enum { FINISH, COMPLETE }; @@ -168,7 +171,15 @@ static int32_t mock_enabled(rv_extension_handle ext, uint16_t key) return 0; } -static uint32_t read_artist(void *r, uint16_t *s, uint32_t n) +uint32_t (reprise_legacy_preference)(uint32_t key, void *data, uint32_t capacity) +{ + (void)key; + (void)data; + (void)capacity; + return 0; +} + +uint32_t (reprise_album_artist_read)(void *r, uint16_t *s, uint32_t n) { (void)r; (void)s; @@ -194,7 +205,6 @@ int main(void) { static const struct rv_api mock = { .hook_next = mock_next, - .album_artist_read = read_artist, .setting_get_int = mock_enabled, }; api = &mock; diff --git a/extensions/reprise/manifest.toml b/extensions/reprise/manifest.toml new file mode 100644 index 0000000..dd8d996 --- /dev/null +++ b/extensions/reprise/manifest.toml @@ -0,0 +1,16 @@ +id = "reprise" +name = "RepriseOS" +description = "RepriseOS services its core provides to extensions. Nothing to install: list it under [libraries] optional." +version = "0.1.0" +author = "RepriseOS contributors" +license = "GPL-3.0-only" +api = "1.89" +category = "library" +exports = [ + "reprise_legacy_preference", + "reprise_album_artist_read", +] + +[[module]] +name = "main" +trigger = "always" diff --git a/extensions/reprise/reprise.h b/extensions/reprise/reprise.h new file mode 100644 index 0000000..20dd966 --- /dev/null +++ b/extensions/reprise/reprise.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-3.0-only */ + +/* What the RepriseOS core exports as the library `reprise`. There is no + * reprise.rvx: the core answers the id itself. List it under + * `[libraries] optional`, so the extension also runs on other cores, where + * these stay NULL; call them through RV_OPTIONAL or test them first. */ + +#ifndef REPRISE_H +#define REPRISE_H +#include + +/* Copies the stored value of an old firmware preference `key` into `data` + * and returns its size, 0 when absent; at most `capacity` bytes. */ +uint32_t (reprise_legacy_preference)(uint32_t key, void *data, uint32_t capacity); +/* Copies the album artist of a library record as UTF-16 units into `text` and + * returns how many, at most `capacity`. */ +uint32_t (reprise_album_artist_read)(void *record, uint16_t *text, uint32_t capacity); + +#endif diff --git a/extensions/shared/legacy.h b/extensions/shared/legacy.h index 974435c..474e871 100644 --- a/extensions/shared/legacy.h +++ b/extensions/shared/legacy.h @@ -1,20 +1,22 @@ /* SPDX-License-Identifier: GPL-3.0-only */ #pragma once #include "rv_api.h" +#include "../reprise/reprise.h" /* Only the initial load imports the old firmware switch. A later reset records - * the extension default so rebooting cannot resurrect the old preference. */ + * the extension default so rebooting cannot resurrect the old preference. On a + * core without the reprise library nothing is imported. */ static inline void migrate_switch(const struct rv_api *api, rv_extension_handle self, int first_load, uint16_t key, uint32_t old_key, uint32_t old_on, int on, int off, uint8_t type) { uint32_t value; - if (!rv_has_reprise_services(api) || + if (!reprise_legacy_preference || api->setting_read(self, key, &value, sizeof value) == sizeof value) return; int32_t mode = off; if (first_load && - api->legacy_preference(old_key, &value, sizeof value) == sizeof value && + (reprise_legacy_preference)(old_key, &value, sizeof value) == sizeof value && value == old_on) mode = on; api->setting_write(self, key, type, &mode, sizeof mode); diff --git a/tests/test_catalog.py b/tests/test_catalog.py index fd4de66..922385a 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -55,7 +55,7 @@ def test_remote_release_and_failed_update_retains_all_assets(self): folder = catalog.ROOT / source["path"] package = (self.packages / "balance.rvx").read_bytes() release = { - "tag_name": "balance/v0.1.0", + "tag_name": "balance/v0.1.1", "published_at": "2026-11-24T00:00:00Z", "assets": [ {"name": "balance.rvx", "size": len(package), "state": "uploaded"} @@ -77,7 +77,7 @@ def download(url, limit): ): self.assertEqual(catalog.generate(sources, self.out, catalog.remote), []) before = self.entries() - release["tag_name"] = "balance/v0.1.1" + release["tag_name"] = "balance/v0.1.2" self.assertTrue(catalog.generate(sources, self.out, catalog.remote)) self.assertEqual(before, self.entries()) self.assertTrue((self.out / before["balance"]["package"]["url"]).exists()) @@ -182,7 +182,7 @@ def test_corrupt_package_is_rejected(self): catalog.snapshot( "balance", source, - "0.1.0", + "0.1.1", lambda path: (folder / path).read_bytes(), package, None, diff --git a/tools/catalog.py b/tools/catalog.py index 4c698d2..a099275 100644 --- a/tools/catalog.py +++ b/tools/catalog.py @@ -162,7 +162,7 @@ def image(filename): entry.update( category=manifest.category(doc), api=doc["api"], - requires=manifest.requires(doc), + requires=manifest.libraries(doc)[0], firmware_id=f"{header['firmware']:08x}", repo=source["repo"], source_path=source.get("path", ""), @@ -359,7 +359,7 @@ def local_manifest(identifier, source): doc = tomllib.loads((folder / "manifest.toml").read_text()) if doc["id"] != identifier or not (folder / "listing.toml").is_file(): raise ValueError(f"{identifier}: expected matching local manifest and listing") - return {"category": manifest.category(doc), "requires": manifest.requires(doc)} + return {"category": manifest.category(doc), "requires": manifest.libraries(doc)[0]} def review(sources, previous, body=None, index=None):