Skip to content

Commit 2b9aeab

Browse files
module aliases for groups and subsystems e.g. MODLOAD net
1 parent 7dec891 commit 2b9aeab

File tree

15 files changed

+184
-66
lines changed

15 files changed

+184
-66
lines changed

include/module.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ typedef struct elf_rela {
142142
typedef bool (*module_init_fn)(void); /**< Prototype for module initialiser */
143143
typedef bool (*module_exit_fn)(void); /**< Prototype for module finaliser */
144144

145+
/**
146+
* @brief State for FSM for loadorder.conf
147+
*/
148+
enum loadorder_parse_state_t {
149+
SEARCH_ALIAS, /**< Searching for alias name in square brackets */
150+
READ_ALIAS, /**< Reading alias name in square brackets */
151+
READ_VENDOR, /**< Reading vendor ID */
152+
READ_DEVICE, /**< Reading device ID */
153+
READ_TYPE, /**< Reading class type */
154+
READ_MODLIST, /**< Reading module list */
155+
};
156+
145157
/**
146158
* @brief Set this prefix on all module_init/module_exit functions in modules
147159
*/

include/string.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,18 @@ size_t strlen_ansi(const char *s);
367367
* or NULL if no match is found.
368368
*/
369369
const char *strstr(const char *haystack, const char *needle);
370+
371+
/**
372+
* Tokenise a string
373+
*
374+
* @param s String to tokenize, or NULL to continue previous tokenisation
375+
* @param delim String of delimiter characters
376+
* @param save Pointer to a char* variable used internally to maintain context
377+
*
378+
* Returns the next token, or NULL if there are no more tokens.
379+
*
380+
* This function splits the input string into tokens separated by any
381+
* of the delimiter characters. Unlike strtok(), it is re-entrant and
382+
* safe for concurrent use on multiple strings.
383+
*/
384+
char *strtok_r(char *s, const char *delim, char **save);

modules/ogg/vorbis.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#define STB_VORBIS_NO_CRT
22
#define STB_VORBIS_NO_STDIO
33

4+
#include <kernel.h>
5+
#define free(x) kfree(x)
6+
47
#include "stb_vorbis.h"
58

69
/* Stupid stb_vorbis defines these and leaves them defined! */
@@ -18,8 +21,7 @@ typedef struct {
1821
int has_last;
1922
} resample_lin16_t;
2023

21-
static void resample_lin16_init(resample_lin16_t *st,
22-
uint32_t in_rate, uint32_t out_rate, uint32_t channels) {
24+
static void resample_lin16_init(resample_lin16_t *st, uint32_t in_rate, uint32_t out_rate, uint32_t channels) {
2325
st->in_rate = in_rate;
2426
st->out_rate = out_rate;
2527
st->channels = channels;
@@ -101,10 +103,6 @@ static size_t resample_lin16_process(resample_lin16_t *st, const int16_t *in_pcm
101103
return out_frames;
102104
}
103105

104-
/* -------------------------
105-
Ogg Vorbis loader: memory → PCM (44.1 kHz, stereo, s16le)
106-
------------------------- */
107-
108106
static bool vorbis_from_memory(const char *filename, const void *data, size_t bytes, void **out_ptr, size_t *out_bytes) {
109107
if (!filename || !out_ptr || !out_bytes || !data || bytes == 0) return false;
110108
if (!(has_suffix_icase(filename, ".ogg") || has_suffix_icase(filename, ".oga"))) return false;

os/programs/bach.rrbasic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ REM The introduction to Bach's Tocatta and Fuges
22
REM Demonstration of ENVELOPE and SOUND TONE
33

44
ON ERROR PROCcontinue
5-
MODLOAD "ac97"
5+
MODLOAD "sound"
66
ON ERROR OFF
77

88
REM Streams

os/programs/demo.rrbasic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SCALE# = 250
88
DIST# = 3
99

1010
ON ERROR PROCcontinue
11-
MODLOAD "hda"
11+
MODLOAD "sound"
1212
ON ERROR OFF
1313
PRINT "Harvesting apples..."
1414
SPRITELOAD bad_apple, "/images/bad-apple.gif"

os/programs/envelope_test.rrbasic

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ON ERROR PROCcapture
22

3-
MODLOAD "ac97"
3+
MODLOAD "sound"
44

55
STREAM CREATE s
66

os/programs/init.rrbasic

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ MODLOAD "net"
66
PROCmessage("Mounting", "filesystems")
77
MOUNT "/devices", "", "devfs"
88
MOUNT "/boot", "hd0", "fat32"
9+
MOUNT "/ramdisk", EMPTYRAMDISK$(1024), "rfs"
910

1011
PROCmessage("Setting", "keymap")
1112
KEYMAP "qemu"
1213

13-
RD$ = EMPTYRAMDISK$(1024)
14-
MOUNT "/ramdisk", RD$, "rfs"
15-
1614
SPRITELOAD rocky,"/images/boot.png"
1715
PLOT rocky, GRAPHICS_WIDTH - 128 - 16, 8
1816
SCROLLREGION 0, 16

os/programs/modplay.rrbasic

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
ON ERROR PROCcontinue
2-
MODLOAD "hda"
2+
MODLOAD "sound"
33
ON ERROR OFF
44
ON ERROR PROCcontinue
5-
MODLOAD "mod"
6-
ON ERROR OFF
7-
ON ERROR PROCcontinue
8-
MODLOAD "xm"
9-
ON ERROR OFF
10-
ON ERROR PROCcontinue
11-
MODLOAD "mp3"
5+
MODLOAD "codecs"
126
ON ERROR OFF
137

148
REM Streams

os/programs/musicdemo.rrbasic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ON ERROR PROCcontinue
2-
MODLOAD "ac97"
2+
MODLOAD "sound"
33
ON ERROR OFF
44
ON ERROR PROCcontinue
5-
MODLOAD "mod"
5+
MODLOAD "codecs"
66
ON ERROR OFF
77

88
STREAM CREATE music

os/programs/rick.rrbasic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ON ERROR PROCcontinue
2-
MODLOAD "ac97"
2+
MODLOAD "sound"
33
ON ERROR OFF
44
ON ERROR PROCcontinue
5-
MODLOAD "mod"
5+
MODLOAD "codecs"
66
ON ERROR OFF
77

88
STREAM CREATE music

0 commit comments

Comments
 (0)