From e94fe284a8d1bbbf3b09de2961b086073c0e0319 Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 15 May 2014 15:55:52 +0800 Subject: [PATCH] add dummy mode of framebuffer in emulator for testing --- ffi/framebuffer_SDL1_2.lua | 6 ++++-- ffi/framebuffer_SDL2_0.lua | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ffi/framebuffer_SDL1_2.lua b/ffi/framebuffer_SDL1_2.lua index 932e5e004..469bf4a06 100644 --- a/ffi/framebuffer_SDL1_2.lua +++ b/ffi/framebuffer_SDL1_2.lua @@ -8,7 +8,9 @@ local BB = require("ffi/blitbuffer") local fb = {} function fb.open() - SDL.open() + if not fb.dummy then + SDL.open() + end -- we present this buffer to the outside fb.bb = BB.new(SDL.screen.w, SDL.screen.h) @@ -52,7 +54,7 @@ function fb:refresh(refreshtype, waveform_mode, x1, y1, w, h) -- adapt to possible rotation changes self.real_bb:setRotation(self.bb:getRotation()) - + if SDL.SDL.SDL_LockSurface(SDL.screen) < 0 then error("Locking screen surface") end diff --git a/ffi/framebuffer_SDL2_0.lua b/ffi/framebuffer_SDL2_0.lua index 4279b62b9..550427bd5 100644 --- a/ffi/framebuffer_SDL2_0.lua +++ b/ffi/framebuffer_SDL2_0.lua @@ -8,7 +8,9 @@ local BB = require("ffi/blitbuffer") local fb = {} function fb.open() - SDL.open() + if not fb.dummy then + SDL.open() + end -- we present this buffer to the outside fb.bb = BB.new(SDL.w, SDL.h, BB.TYPE_BBRGB32)