diff options
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); |