diff options
author | Matthew Wozniak <me@woz.blue> | 2024-11-10 22:40:14 -0500 |
---|---|---|
committer | Matthew Wozniak <me@woz.blue> | 2024-11-10 22:40:14 -0500 |
commit | de0cd8796d835061898edb3ea89d9a3c84df859f (patch) | |
tree | 14c4fa26c9a2ca3ad470d43aaf0f7fe0b68a6e57 /main.c | |
parent | 09c6eab77771198f63860aa0c612b324d5ea09d5 (diff) | |
download | rt-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 'main.c')
-rw-r--r-- | main.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -35,6 +35,7 @@ struct { int qvs; const char *out; const char **demo; + int demo_count; bool combine; } args = {0}; @@ -42,13 +43,14 @@ void (*orig_cbuf_addtext)(char *); void hook_cbuf_addtext(char *str) { orig_cbuf_addtext(str); // this is the last thing that happens when the game is opened - if (!strcmp(str, "exec modsettings.cfg mod\n")) { - bool use_bitrate = !!args.bitrate; - if (!render_init(args.width, args.height, args.fps, use_bitrate, - use_bitrate ? args.bitrate : args.quality, args.out, args.qvs)) + if (!strcmp(str, "exec valve.rc\n")) { + // after sound has been init'd, we can finish this + if (!api_find_snd_recordbuffer()) + die("couldn't find SND_RecordBuffer"); + if (!render_init()) die("couldn't init render"); - // play the demo demoplayer->vt->start_playback(demoplayer, args.demo[0], false); + orig_cbuf_addtext("exec prerender"); } } @@ -69,7 +71,7 @@ void WINAPI *hook_LoadLibraryExA(const char *filename, void *hfile, int flags) { for (const char *p = filename; *p; p++) if (*p == '\\') basename = p + 1; - if (!strcmp(basename, "engine.dll")) { + if (!strcmp(basename, "gameui.dll")) { if (!api_init()) die("couldn't get apis"); orig_cbuf_addtext = (void (*)(char *)) hook_inline((void *)cbuf_addtext, (void *)hook_cbuf_addtext); @@ -146,6 +148,7 @@ int main(int argc, const char **argv) { } args.out = argv[0]; args.demo = argv + 1; + args.demo_count = argc - 2; sprintf(cmdline, "hl2.exe -game %s -w %d -h %d -window -console", args.game, args.width, args.height); |