aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'render.c')
-rw-r--r--render.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/render.c b/render.c
index 7b03e79..ecea85a 100644
--- a/render.c
+++ b/render.c
@@ -75,7 +75,13 @@ bool do_frame(struct videomode *this, struct movieinfo *info) {
struct { u8 bgr[3]; } *data = 0;
HR(imf_buffer->lpVtbl->Lock(imf_buffer, (u8 **)&data, NULL, NULL));
// THIS IS SLOW!!
- this->vt->read_screen_pixels(this, 0, 0, args.width, args.height, raw, IMAGE_FORMAT_BGR888);
+ if (steampipe)
+ this->vt->steampipe_read_screen_pixels(this, 0, 0, args.width,
+ args.height, raw, IMAGE_FORMAT_BGR888);
+ else
+ this->vt->read_screen_pixels(this, 0, 0, args.width, args.height, raw,
+ IMAGE_FORMAT_BGR888);
+
for (int y = args.height - 1; y > 0; y--) {
memcpy(data + ((args.height - y) * args.width), raw + y * args.width,
szpx * args.width);
@@ -140,6 +146,8 @@ void VIRTUAL hook_stop_playback(struct demoplayer *this) {
return;
}
+ info("finished!");
+
if (!do_stop())
die("oopsie!");
@@ -150,8 +158,12 @@ bool render_init(void) {
bool r =
os_mprot((*videomode)->vt, 28 * sizeof(void *), PAGE_EXECUTE_READWRITE);
if (!r) bail("couldn't mprotect videomode vtable");
- orig_write_movie_frame = (*videomode)->vt->write_movie_frame;
- (*videomode)->vt->write_movie_frame = hook_write_movie_frame;
+
+ typeof(orig_write_movie_frame) *wmf = steampipe ?
+ &(*videomode)->vt->steampipe_write_movie_frame :
+ &(*videomode)->vt->write_movie_frame;
+ orig_write_movie_frame = *wmf;
+ *wmf = hook_write_movie_frame;
r = os_mprot(demoplayer->vt, 18 * sizeof(void *), PAGE_EXECUTE_READWRITE);
if (!r) bail("couldn't mprotect demoplayer vtable");
@@ -170,6 +182,9 @@ bool render_init(void) {
sprintf(framerate_cmd, "host_framerate %d;", args.fps);
cbuf_addtext(framerate_cmd);
+ if (CoInitializeEx(NULL, COINIT_MULTITHREADED) == RPC_E_CHANGED_MODE)
+ warn("changed COM concurrency mode!");
+
HR(MFStartup(MF_VERSION, 0));
// init sinkwriter