Skip to content

Commit

Permalink
add command line option to disable rendering
Browse files Browse the repository at this point in the history
removes the need for xvfb for tamarin test suite runs
  • Loading branch information
dbluelle committed Jan 7, 2018
1 parent da0e651 commit 0ce8b1b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
6 changes: 5 additions & 1 deletion docs/man/lightspark.1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
lightspark \- a free Flash player
.SH SYNOPSIS
.B lightspark
[\-\-url|\-u http://loader.url/file.swf] [\-\-air] [\-\-avmplus] [\-\-disable-interpreter|\-ni] [\-\-enable-fast-interpreter|\-fi] [\-\-enable\-jit|\-j] [\-\-log\-level|\-l 0-4] [\-\-parameters\-file|\-p params-file] [\-\-profiling-output|\-o] [\-\-security-sandbox|\-s <sandbox type>] [\-\-exit-on-error] [\-\-HTTP-cookies <cookie>] [\-\-version|\-v] file.swf
[\-\-url|\-u http://loader.url/file.swf] [\-\-air] [\-\-avmplus] [\-\-disable-rendering] [\-\-disable-interpreter|\-ni] [\-\-enable-fast-interpreter|\-fi] [\-\-enable\-jit|\-j] [\-\-log\-level|\-l 0-4] [\-\-parameters\-file|\-p params-file] [\-\-profiling-output|\-o] [\-\-security-sandbox|\-s <sandbox type>] [\-\-exit-on-error] [\-\-HTTP-cookies <cookie>] [\-\-version|\-v] file.swf
.SH DESCRIPTION
.B Lightspark
is a free, modern Flash Player implementation, this documents the options accepted by the standalone version of the program.
Expand Down Expand Up @@ -81,6 +81,10 @@ Run as an AIR application: grant permission to access both local files and netwo
.IP
Run as an application with avmplus package: grant permission to access both local files and network, and enable avmplus APIs.
.HP
\fB\-\-disable-rendering\fP
.IP
Run the application without the need for a graphical environment.
.HP
\fB\-\-version\fP, \fB\-v\fP
.IP
Shows lightspark version and exits.
Expand Down
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ int main(int argc, char* argv[])
{
exitOnError = SystemState::ERROR_ANY;
}
else if(strcmp(argv[i],"--disable-rendering")==0)
{
EngineData::enablerendering = false;
}

else if(strcmp(argv[i],"--HTTP-cookies")==0)
{
i++;
Expand Down Expand Up @@ -339,7 +344,7 @@ int main(int argc, char* argv[])
LOG(LOG_ERROR, "Usage: " << argv[0] << " [--url|-u http://loader.url/file.swf]" <<
" [--disable-interpreter|-ni] [--enable-fast-interpreter|-fi] [--enable-jit|-j]" <<
" [--log-level|-l 0-4] [--parameters-file|-p params-file] [--security-sandbox|-s sandbox]" <<
" [--exit-on-error] [--HTTP-cookies cookie] [--air] [--avmplus]" <<
" [--exit-on-error] [--HTTP-cookies cookie] [--air] [--avmplus] [--disable-rendering]" <<
#ifdef PROFILING_SUPPORT
" [--profiling-output|-o profiling-file]" <<
#endif
Expand Down
17 changes: 14 additions & 3 deletions src/platforms/engineutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ uint32_t EngineData::userevent = (uint32_t)-1;
Thread* EngineData::mainLoopThread = NULL;
bool EngineData::mainthread_running = false;
bool EngineData::sdl_needinit = true;
bool EngineData::enablerendering = true;
Semaphore EngineData::mainthread_initialized(0);
EngineData::EngineData() : currentPixelBuffer(0),currentPixelBufferOffset(0),currentPixelBufPtr(NULL),pixelBufferWidth(0),pixelBufferHeight(0),widget(0), width(0), height(0),needrenderthread(true),supportPackedDepthStencil(false)
{
Expand Down Expand Up @@ -115,10 +116,20 @@ static void mainloop_runner()

if (EngineData::sdl_needinit)
{
if (SDL_WasInit(0)) // some part of SDL already was initialized
sdl_available = !SDL_InitSubSystem ( SDL_INIT_VIDEO );
if (!EngineData::enablerendering)
{
if (SDL_WasInit(0)) // some part of SDL already was initialized
sdl_available = true;
else
sdl_available = !SDL_Init ( SDL_INIT_EVENTS );
}
else
sdl_available = !SDL_Init ( SDL_INIT_VIDEO );
{
if (SDL_WasInit(0)) // some part of SDL already was initialized
sdl_available = !SDL_InitSubSystem ( SDL_INIT_VIDEO );
else
sdl_available = !SDL_Init ( SDL_INIT_VIDEO );
}
}
if (!sdl_available)
{
Expand Down
1 change: 1 addition & 0 deletions src/platforms/engineutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class DLL_PUBLIC EngineData
virtual void openPageInBrowser(const tiny_string& url, const tiny_string& window)=0;

static bool sdl_needinit;
static bool enablerendering;
static bool mainthread_running;
static Semaphore mainthread_initialized;
static bool startSDLMain();
Expand Down
5 changes: 3 additions & 2 deletions src/swf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,12 @@ void SystemState::delayedCreation(SystemState* sys)
int32_t reqWidth=sys->mainClip->getFrameSize().Xmax/20;
int32_t reqHeight=sys->mainClip->getFrameSize().Ymax/20;

sys->engineData->showWindow(reqWidth, reqHeight);
if (EngineData::enablerendering)
sys->engineData->showWindow(reqWidth, reqHeight);

sys->inputThread->start(sys->engineData);

if(Config::getConfig()->isRenderingEnabled())
if(EngineData::enablerendering && Config::getConfig()->isRenderingEnabled())
{
if (sys->engineData->needrenderthread)
sys->renderThread->start(sys->engineData);
Expand Down
4 changes: 2 additions & 2 deletions tests/tests
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ for test in $TESTS; do
echo > $LOGFILE
if [ $PROPRIETARY -eq 0 ]; then
if [ $DEBUG -eq 1 ]; then
$TIMEOUTCMD $LIGHTSPARK -u $ROOTURL -l $LOGLEVEL --avmplus --exit-on-error $test >$LOGFILE 2>&1
$TIMEOUTCMD $LIGHTSPARK -u $ROOTURL -l $LOGLEVEL --avmplus --disable-rendering --exit-on-error $test >$LOGFILE 2>&1
else
$TIMEOUTCMD $LIGHTSPARK -u $ROOTURL -l $LOGLEVEL --avmplus --exit-on-error $test 1>$LOGFILE 2>/dev/null
$TIMEOUTCMD $LIGHTSPARK -u $ROOTURL -l $LOGLEVEL --avmplus --disable-rendering --exit-on-error $test 1>$LOGFILE 2>/dev/null
fi
else
if [ $DEBUG -eq 1 ]; then
Expand Down

0 comments on commit 0ce8b1b

Please sign in to comment.