X-Git-Url: http://git.squeep.com/?p=dcpu16;a=blobdiff_plain;f=vm-dcpu16.c;h=5f652739e6c477aa428cae2bb55a82e8d2693af3;hp=1e3a49656757f8e68cd90ebae13a12bd75018ed1;hb=a4e2c238ea47badea198132fc5d9311d1f40ca13;hpb=34245ba6868f5d0580c3f16dbd68a4f973ef27f8 diff --git a/vm-dcpu16.c b/vm-dcpu16.c index 1e3a496..5f65273 100644 --- a/vm-dcpu16.c +++ b/vm-dcpu16.c @@ -368,31 +368,31 @@ COMMAND_HELP(run) { COMMAND_IMPL(display) { (void)arg_count, (void)arg_vector; - static DPIX *pixbuf = NULL; + static DCPU16_DISPLAY *display = NULL; - if (pixbuf) { + if (display) { printf("display already enabled..\n"); return 0; } - pixbuf = display_init_pixbuf(); - if (pixbuf == NULL) { + display = display_new("dcpu16-display.pnm"); + if (display == NULL) { fprintf(stderr, "failed to initialize display buffer\n"); return 0; } - if (dcpu16_acct_add(vm, DCPU16_ACCT_EV_WRITE, display_fn, pixbuf)) { + if (dcpu16_acct_add(vm, DCPU16_ACCT_EV_WRITE, display_fn, display)) { fprintf(stderr, "failed to register display update callback\n"); return 0; } - if (dcpu16_acct_add(vm, DCPU16_ACCT_EV_RESET, display_reset_fn, pixbuf)) { + if (dcpu16_acct_add(vm, DCPU16_ACCT_EV_RESET, display_reset_fn, display)) { fprintf(stderr, "failed to register display reset callback\n"); return 0; } /* init display as if reset occurred */ - display_reset_fn(vm, DCPU16_ACCT_EV_RESET, 0, pixbuf); + display_reset_fn(vm, DCPU16_ACCT_EV_RESET, 0, display); return 0; }