Added dbg:map, moved some stuff, removed OK msg
This commit is contained in:
parent
8787229004
commit
470fd27fbb
29
src/sfxd.c
29
src/sfxd.c
|
@ -153,7 +153,6 @@ void ipc_loop(void) {
|
||||||
params++;
|
params++;
|
||||||
}
|
}
|
||||||
execute_command((struct msg_target) { 0, ipc.sock_fd, sa_client, sl_client }, command, params);
|
execute_command((struct msg_target) { 0, ipc.sock_fd, sa_client, sl_client }, command, params);
|
||||||
SOFT_EXPECT(sendto(ipc.sock_fd, "OK\n", 4, 0, sa_client, sl_client), == 4,);
|
|
||||||
SOFT_EXPECT(sendto(ipc.sock_fd, "", 0, 0, sa_client, sl_client), == 0,);
|
SOFT_EXPECT(sendto(ipc.sock_fd, "", 0, 0, sa_client, sl_client), == 0,);
|
||||||
sl_client = sizeof(ipc.sa_client);
|
sl_client = sizeof(ipc.sa_client);
|
||||||
}
|
}
|
||||||
|
@ -287,6 +286,10 @@ void execute_command(struct msg_target tgt, const char *command, const char *par
|
||||||
sound->volume = vol;
|
sound->volume = vol;
|
||||||
} else if (0 == strcmp(command, "source")) {
|
} else if (0 == strcmp(command, "source")) {
|
||||||
execute_file(tgt, params, 0);
|
execute_file(tgt, params, 0);
|
||||||
|
} else if (0 == strcmp(command, "help")) {
|
||||||
|
send_help(tgt);
|
||||||
|
} else if (0 == strcmp(command, "meow")) {
|
||||||
|
send_txt(tgt, "mrr~\n");
|
||||||
} else if (0 == strcmp(command, "dbg:dump")) {
|
} else if (0 == strcmp(command, "dbg:dump")) {
|
||||||
for (int i = 0; i < sounds_pool.cap; i++) {
|
for (int i = 0; i < sounds_pool.cap; i++) {
|
||||||
struct sfx_pool_item item = sounds_pool.sounds[i];
|
struct sfx_pool_item item = sounds_pool.sounds[i];
|
||||||
|
@ -310,10 +313,26 @@ void execute_command(struct msg_target tgt, const char *command, const char *par
|
||||||
send_txt(tgt, ".pool.use = %d\n", sounds_pool.use);
|
send_txt(tgt, ".pool.use = %d\n", sounds_pool.use);
|
||||||
send_txt(tgt, ".pool.cap = %d\n", sounds_pool.cap);
|
send_txt(tgt, ".pool.cap = %d\n", sounds_pool.cap);
|
||||||
#endif
|
#endif
|
||||||
} else if (0 == strcmp(command, "help")) {
|
} else if (0 == strcmp(command, "dbg:map")) {
|
||||||
send_help(tgt);
|
int n_hits = 0, n_misses = 0;
|
||||||
} else if (0 == strcmp(command, "meow")) {
|
for (int i = 0; i < sounds_pool.cap; i++) {
|
||||||
send_txt(tgt, "mrr~\n");
|
struct sfx_pool_item *item = &sounds_pool.sounds[i];
|
||||||
|
if ((i % 16) == 0) {
|
||||||
|
send_txt(tgt, "# ");
|
||||||
|
}
|
||||||
|
if (item->key[0] == '\0') {
|
||||||
|
send_txt(tgt, "-- ");
|
||||||
|
} else {
|
||||||
|
uint32_t hash = adler32(item->key, strlen(item->key));
|
||||||
|
int index = hash % sounds_pool.cap;
|
||||||
|
send_txt(tgt, "%02d ", i - index);
|
||||||
|
}
|
||||||
|
if ((i % 16) == 15) {
|
||||||
|
send_txt(tgt, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send_txt(tgt, ".used = %ld\n.size = %ld\n", sounds_pool.use, sounds_pool.cap);
|
||||||
|
send_txt(tgt, ".hits = %d\n.misses = %d\n", n_hits, n_misses);
|
||||||
} else if (0 == strcmp(command, "")) {
|
} else if (0 == strcmp(command, "")) {
|
||||||
} else {
|
} else {
|
||||||
send_txt(tgt, "ERR: unknown command: %s\n", command);
|
send_txt(tgt, "ERR: unknown command: %s\n", command);
|
||||||
|
|
Loading…
Reference in New Issue