psx_gpu->texture_page_ptr = psx_gpu->vram_ptr;
   psx_gpu->clut_ptr = psx_gpu->vram_ptr;
 
+  psx_gpu->viewport_start_x = psx_gpu->viewport_start_y = 0;
+  psx_gpu->viewport_end_x = psx_gpu->viewport_end_y = 0;
   psx_gpu->mask_msb = 0;
 
   psx_gpu->texture_window_x = 0;
 
   gpu.screen.hres = gpu.screen.w = 256;
   gpu.screen.vres = gpu.screen.h = 240;
   gpu.screen.x = gpu.screen.y = 0;
+  renderer_sync_ecmds(gpu.ex_regs);
   renderer_notify_res_change();
 }
 
   return gpu.frameskip.allow;
 }
 
+static void flush_cmd_buffer(void);
+
 static noinline void get_gpu_info(uint32_t data)
 {
+  if (unlikely(gpu.cmd_len > 0))
+    flush_cmd_buffer();
   switch (data & 0x0f) {
     case 0x02:
     case 0x03: