aboutsummaryrefslogtreecommitdiff
path: root/api.h
diff options
context:
space:
mode:
authorGravatar Matthew Wozniak <me@woz.blue> 2024-11-10 22:40:14 -0500
committerGravatar Matthew Wozniak <me@woz.blue> 2024-11-10 22:40:14 -0500
commitde0cd8796d835061898edb3ea89d9a3c84df859f (patch)
tree14c4fa26c9a2ca3ad470d43aaf0f7fe0b68a6e57 /api.h
parent09c6eab77771198f63860aa0c612b324d5ea09d5 (diff)
downloadrt-de0cd8796d835061898edb3ea89d9a3c84df859f.tar.gz
rt-de0cd8796d835061898edb3ea89d9a3c84df859f.zip
Small code changes; add ability to find audio functions and data.
Audio is weird. I've been working for a few days to figure out how to correctly render the audio but in that time I've done some other minor refactors so I figured I migth as well just push those. Audio should be coming soon, but no promises.
Diffstat (limited to 'api.h')
-rw-r--r--api.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/api.h b/api.h
index 8f42eaf..df8c191 100644
--- a/api.h
+++ b/api.h
@@ -21,6 +21,7 @@
#define VENGINE_CLIENT_INTERFACE_VERSION "VEngineClient013"
#define VENGINE_LAUNCHER_INTERFACE_VERSION "VENGINE_LAUNCHER_API_VERSION004"
#define VENGINE_TOOL_INTERFACE_VERSION "VENGINETOOL003"
+#define VENGINE_CVAR_INTERFACE_VERSION "VEngineCvar004"
#include "intdef.h"
#include "os.h"
@@ -55,6 +56,34 @@ struct enginetools {
} *vt;
};
+struct cvar {
+ struct {
+ usize _pad[10];
+ struct concommand * (*VIRTUAL find_command)(struct cvar *this, const char *name);
+ } *vt;
+};
+
+struct cmdbase {
+ void **vt;
+ struct cmdbase *next;
+ bool registered;
+ const char *name;
+ const char *helpstring;
+ int flags;
+};
+
+struct concommand {
+ struct cmdbase base;
+ void *callback;
+};
+
+struct audio_device {
+ struct {
+ usize _pad[22];
+ void *transfer_samples;
+ } *vt;
+};
+
struct movieinfo {
char name[256];
int curframe;
@@ -132,6 +161,29 @@ struct demoplayer {
} *vt;
};
+/* EPIC HACK:
+ * Snd_WriteLinearBlastStereo16 is an inline asm function that starts with
+ *
+ * mov ebx,snd_p
+ * mov edi,snd_out
+ * mov ecx,snd_linear_count
+ * mov esi,snd_vol
+ *
+ * Luckily for us, these are all the things that we need!!!!
+ * So, we just use the instructions as a struct so we don't have to copy
+ * anything. It just works.
+ */
+struct soundstate {
+ u16 _mov_ebx;
+ int **snd_p;
+ u16 _mov_edi;
+ short **snd_out;
+ u16 _mov_ecx;
+ int *snd_linear_count;
+ u16 _mov_esi;
+ int *snd_vol;
+} __attribute__((packed));
+
#ifndef NO_EXTERNS
extern struct engserver *engserver;
extern struct engclient *engclient;
@@ -141,10 +193,13 @@ extern struct demoplayer *demoplayer;
extern struct videomode **videomode;
extern struct movieinfo *movieinfo;
extern void (*cbuf_addtext)(char *);
+extern void (*snd_recordbuffer)(void);
+extern struct soundstate *snd;
#endif
// initializes required engine apis. returns false on error.
bool api_init(void);
+bool api_find_snd_recordbuffer(void);
#endif