예제 #1
0
MOboolean moCalibrationGrid::Init() {

    if (!PreInit()) return false;

	moDefineParamIndex( CALIBRATIONGRID_ALPHA, moText("alpha") );
	moDefineParamIndex( CALIBRATIONGRID_COLOR, moText("color") );

    Tx = Ty = Tz = Rx = Ry = Rz = 0.0;
	Sx = Sy = Sz = 1.0;

	return true;
}
예제 #2
0
MOboolean moSceneEffect::Init()
{
	MOuint i;

    PreInit();

	idp_alpha = m_Config.GetParamIndex("alpha");

	idp_effects = m_Config.GetParamIndex("effects");
	idp_scenes = m_Config.GetParamIndex("scenes");

	plugins.Init(0,NULL);

	//generamos el array para los efectos
	effects.Init(m_Config.GetValuesCount(idp_effects),NULL);

	//generamos los efectos
	m_Config.SetCurrentParamIndex(idp_effects);
	m_Config.FirstValue();
	for(i=0; i<effects.Count(); i++) {
		effects[i] = moNewEffect(m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT).Text(), plugins);
		if(effects[i]!=NULL) {
			effects[i]->SetResourceManager( m_pResourceManager );
			effects[i]->SetConfigName(  m_Config.GetParam().GetValue().GetSubValue(MO_CFG_EFFECT_CONFIG).Text() );
                        char* str = effects[i]->GetName(); //(by Andres)
			printf("escena nombre efecto %i: %s\n",i,str);
		}
		m_Config.NextValue();
	}

	//INICIALIZACION DE CADA EFFECT(LA ASIGNACION DE CODIGOS DE DISPOSITIVO SE HACE APARTE)
	for(i=0; i<effects.Count(); i++) {
		if(effects[i]!=NULL) {

			moEffectState fxstate = effects[i]->GetEffectState();
			fxstate.fulldebug = m_EffectState.fulldebug;

            effects[i]->SetEffectState( fxstate );
			effects[i]->Init();
			effects[i]->Activate();

		}
	}

    if(m_Config.GetPreConfCount() > 0)
        m_Config.PreConfFirst();

	return true;
}
MOboolean
moPostEffectColorFilter::Init()
{
    if (!PreInit()) return false;

	moDefineParamIndex( COLORFILTER_COLOR, moText("color") );
	moDefineParamIndex( COLORFILTER_BLENDING, moText("blending") );
	moDefineParamIndex( COLORFILTER_SENSIBILITY, moText("sensibility") );
	moDefineParamIndex( COLORFILTER_SYNCRO, moText("syncro") );
	UpdateParameters();

	moTextArray filter_str;
	filter_str.Init(1, moText(""));
	filter_str.Set(0, moText("effects_texture shaders/ColorMatrix.cfg colorfilter_texture"));
	bool res = filters.Init(&filter_str, m_pResourceManager->GetGLMan(), m_pResourceManager->GetFBMan(), m_pResourceManager->GetShaderMan(), m_pResourceManager->GetTextureMan(), m_pResourceManager->GetRenderMan());

	int tex_moid = m_pResourceManager->GetTextureMan()->GetTextureMOId("colorfilter_texture", false);
	tex_glid = m_pResourceManager->GetTextureMan()->GetGLId(tex_moid);

	if (!res)
	{
		MODebug->Push("Error: cannot load shader in colorfilter");
		return false;
	}

	FilterParams = MOEmptyTexFilterParam;
	ColorMatrix.Init();
	HSIMatrix.Init(true, 0.0, 4.0, 0.0, 4.0);
	BCMatrix.Init(-1.0, 1.0, 0.0, 4.0);
	intensity0 = saturation0 = intensity = saturation = 0.25;
	hue0 = hue = 0.0;
	brightness0 = brightness = 0.5;
	contrast0 = contrast = 0.25;
	HSIMatrix.Update(intensity, saturation, hue);
	BCMatrix.Update(brightness, contrast);
	ColorMatrix.Copy(HSIMatrix);
	ColorMatrix.Multiply(BCMatrix);
	FilterParams.par_mat4 = ColorMatrix.GetMatrixPointer();

    sWidth = m_pResourceManager->GetRenderMan()->RenderWidth();
    sHeight = m_pResourceManager->GetRenderMan()->RenderHeight();

    if(m_Config.GetPreConfCount() > 0)
        m_Config.PreConfFirst();
		
	return true;
}
예제 #4
0
MOboolean moDeformationGrid::Init() {

    if (!PreInit()) return false;

	moDefineParamIndex( DEFORMATIONGRID_ALPHA, moText("alpha") );
	moDefineParamIndex( DEFORMATIONGRID_COLOR, moText("color") );
	moDefineParamIndex( DEFORMATIONGRID_SYNC, moText("syncro") );
	moDefineParamIndex( DEFORMATIONGRID_PHASE, moText("phase") );
	moDefineParamIndex( DEFORMATIONGRID_TEXTURE, moText("texture") );

	moDefineParamIndex( DEFORMATIONGRID_WIDTH, moText("width") );
	moDefineParamIndex( DEFORMATIONGRID_HEIGHT, moText("height") );
	moDefineParamIndex( DEFORMATIONGRID_POINTS, moText("points") );
	moDefineParamIndex( DEFORMATIONGRID_TEXCOORD_X1, moText("texcoord_x1") );
	moDefineParamIndex( DEFORMATIONGRID_TEXCOORD_Y1, moText("texcoord_y1") );
	moDefineParamIndex( DEFORMATIONGRID_TEXCOORD_X2, moText("texcoord_x2") );
	moDefineParamIndex( DEFORMATIONGRID_TEXCOORD_Y2, moText("texcoord_y2") );

	moDefineParamIndex( DEFORMATIONGRID_TRANSLATEX, moText("translatex") );
	moDefineParamIndex( DEFORMATIONGRID_TRANSLATEY, moText("translatey") );
	moDefineParamIndex( DEFORMATIONGRID_TRANSLATEZ, moText("translatez") );
	moDefineParamIndex( DEFORMATIONGRID_ROTATEX, moText("rotatex") );
	moDefineParamIndex( DEFORMATIONGRID_ROTATEY, moText("rotatey") );
	moDefineParamIndex( DEFORMATIONGRID_ROTATEZ, moText("rotatez") );
	moDefineParamIndex( DEFORMATIONGRID_SCALEX, moText("scalex") );
	moDefineParamIndex( DEFORMATIONGRID_SCALEY, moText("scaley") );
	moDefineParamIndex( DEFORMATIONGRID_SCALEZ, moText("scalez") );

	moDefineParamIndex( DEFORMATIONGRID_SHOWGRID, moText("showgrid") );
	moDefineParamIndex( DEFORMATIONGRID_CLEAR, moText("clear") );
	moDefineParamIndex( DEFORMATIONGRID_PRECISION, moText("precision") );
	moDefineParamIndex( DEFORMATIONGRID_MODE, moText("mode") );

    m_Width = 0;
    m_Height = 0;
    pImage = NULL;
    m_Points = NULL;
    m_TPoints = NULL;

    UpdateParameters();

    m_Selector_I = 0;
    m_Selector_J = 0;
    m_Modo = (moDeformationGridMode)m_Config.Int( moR(DEFORMATIONGRID_MODE) );

	return true;
}
MOboolean
moPostEffectVideoWall::Init()
{
    if (!PreInit()) return false;

    moDefineParamIndex( VIDEOWALL_INLET, moText("inlets") );
    moDefineParamIndex( VIDEOWALL_OUTLET, moText("outlets") );
    moDefineParamIndex( VIDEOWALL_SCRIPT, moText("script") );
    moDefineParamIndex( VIDEOWALL_ALPHA, moText("alpha") );
    moDefineParamIndex( VIDEOWALL_SYNCRO, moText("syncro") );
    moDefineParamIndex( VIDEOWALL_PHASE, moText("phase") );
	moDefineParamIndex( VIDEOWALL_COLOR, moText("color") );
	moDefineParamIndex( VIDEOWALL_CONFIGURATION, moText("configuration") );
	moDefineParamIndex( VIDEOWALL_TRANSLATEZ, moText("translatez") );

	return true;
}
FOculusInput::FOculusInput( const TSharedRef< FGenericApplicationMessageHandler >& InMessageHandler )
	: MessageHandler( InMessageHandler )
	, ControllerPairs()
{
	PreInit(); // @TODO: call it sooner to avoid 'Warning InputKey Event specifies invalid' when loading a map using the custom keys

	// take care of backward compatibility of Remote with Gamepad 
	if (bRemoteKeysMappedToGamepad)
	{
		Remote.ReinitButtonsForGamepadCompat();
	}

	// Only initialize plug-in when not running a dedicated server, and Oculus service is running
	if(!IsRunningDedicatedServer() && ovr_Detect(0).IsOculusServiceRunning)
	{
		// Initializes LibOVR. 
		ovrInitParams initParams;
		FMemory::Memset(initParams, 0);
		initParams.Flags = ovrInit_RequestVersion;
		initParams.RequestedMinorVersion = OVR_MINOR_VERSION;
#if !UE_BUILD_SHIPPING
//		initParams.LogCallback = OvrLogCallback;
#endif

		ovrResult initStatus = ovr_Initialize(&initParams);
		if (!OVR_SUCCESS(initStatus) && initStatus == ovrError_LibLoad)
		{
			// fatal errors: can't load library
 			UE_LOG(LogOcInput, Log, TEXT("Can't find Oculus library %s: is proper Runtime installed? Version: %s"),
 				TEXT(OVR_FILE_DESCRIPTION_STRING), TEXT(OVR_VERSION_STRING));
			return;
		}

		FOculusTouchControllerPair& ControllerPair = *new(ControllerPairs) FOculusTouchControllerPair();

		// @todo: Unreal controller index should be assigned to us by the engine to ensure we don't contest with other devices
		ControllerPair.UnrealControllerIndex = 0; //???? NextUnrealControllerIndex++;

		IModularFeatures::Get().RegisterModularFeature( GetModularFeatureName(), this );
		GEngine->MotionControllerDevices.AddUnique(this);

		UE_LOG(LogOcInput, Log, TEXT("OculusInput is initialized. Init status %d. Runtime version: %s"), int(initStatus), *FString(ANSI_TO_TCHAR(ovr_GetVersionString())));
	}
}
예제 #7
0
MOboolean moEffectScene3D::Init() {

    if (!PreInit()) return false;

    // Hacer la inicializacion de este efecto en particular.
	object = m_Config.GetParamIndex("object");
	transx = m_Config.GetParamIndex("translatex");
    transy = m_Config.GetParamIndex("translatey");
    transz = m_Config.GetParamIndex("translatez");
    rotatx = m_Config.GetParamIndex("rotatex");
    rotaty = m_Config.GetParamIndex("rotatey");
    rotatz = m_Config.GetParamIndex("rotatez");
    scalex = m_Config.GetParamIndex("scalex");
    scaley = m_Config.GetParamIndex("scaley");
    scalez = m_Config.GetParamIndex("scalez");

    eyex = m_Config.GetParamIndex("eyex");
    eyey = m_Config.GetParamIndex("eyey");
    eyez = m_Config.GetParamIndex("eyez");
    viewx = m_Config.GetParamIndex("viewx");
    viewy = m_Config.GetParamIndex("viewy");
    viewz = m_Config.GetParamIndex("viewz");


	g_ViewMode = GL_TRIANGLES;

  
	//inicializacion de los objetos y materiales
	Models3d.MODebug = MODebug;
	Models3d.Init(GetConfig(),object,MOModels);

    // Seteos de OpenGL.

    // moText(by Andres)
    moText cargando_str("Cargando preconfigs"); 
    moText finalizado_str("Inicializacion finalizada");

	MODebug->Push(cargando_str);
    if(preconfig.GetPreConfNum() > 0)
        preconfig.PreConfFirst( GetConfig());
	MODebug->Push(finalizado_str);
	return true;
}
MOboolean moMasterEffectMasterChannel::Init()
{
    if (!PreInit()) return false;

/*
    color = m_Config.GetParamIndex("color");
    transx = m_Config.GetParamIndex("TranslateX");
    transy = m_Config.GetParamIndex("TranslateY");
    transz = m_Config.GetParamIndex("TranslateZ");
    rotatx = m_Config.GetParamIndex("RotateX");
    rotaty = m_Config.GetParamIndex("RotateY");
    rotatz = m_Config.GetParamIndex("RotateZ");
    scalex = m_Config.GetParamIndex("ScaleX");
    scaley = m_Config.GetParamIndex("ScaleY");
    scalez = m_Config.GetParamIndex("ScaleZ");
*/
    // Hacer la inicializacion de este efecto en particular.
    // Seteos de OpenGL.
    // Seteos de Texturas.
	return true;
}
예제 #9
0
MOboolean
moPostEffectDebug::Init()
{
    if (!PreInit()) return false;

	moDefineParamIndex( DEBUG_ALPHA, moText("alpha") );
	moDefineParamIndex( DEBUG_COLOR, moText("color") );
	moDefineParamIndex( DEBUG_SYNC, moText("syncro") );
	moDefineParamIndex( DEBUG_PHASE, moText("phase") );
	moDefineParamIndex( DEBUG_FONT, moText("font") );


	ticks = 0;
	fps_current = 0;
	fps_mean = 0;
	fps_count = 0;

	MODebug2->Message(moText("Debug initialized"));

	return true;
}
예제 #10
0
 int Game::Run(void) {
     running = true;
     Logger::Log() << "Running...";
     
     stateManager.RegisterGame(this);
     
     PreInit();
     
     // Initialize our application which might set our Running flag to false
     Init();
     
     // Loop if Running flag is still true
     Loop();
     
     // Cleanup our application
     Cleanup();
     
     // Make sure our Running flag is set to false before exiting
     running = false;
     
     return EXIT_SUCCESS;
 }
예제 #11
0
CWinRenderer::CWinRenderer() : CBaseRenderer()
  , m_bConfigured(false)
  , m_bUseHQScaler(false)
  , m_bFilterInitialized(false)
  , m_cmsOn(false)
  , m_clutLoaded(true)
  , m_toneMapping(false)
  , m_destWidth(0)
  , m_destHeight(0)
  , m_frameIdx(0)
  , m_iYV12RenderBuffer(0)
  , m_NumYV12Buffers(0)
  , m_neededBuffers(0)
  , m_iRequestedMethod(RENDER_METHOD_AUTO)
  , m_dxva_format(DXGI_FORMAT_UNKNOWN)
  , m_renderMethod(RENDER_PS)
  , m_bufferFormat(BUFFER_FMT_NONE)
  , m_scalingMethod(VS_SCALINGMETHOD_LINEAR)
  , m_scalingMethodGui(static_cast<ESCALINGMETHOD>(-1))
  , m_processor(nullptr)
  , m_sw_scale_ctx(nullptr)
  , m_colorShader(nullptr)
  , m_scalerShader(nullptr)
  , m_capture(nullptr)
  , m_pCLUTView(nullptr)
{
  m_format = AV_PIX_FMT_NONE;
  for (unsigned i = 0; i < NUM_BUFFERS; i++)
    m_renderBuffers[i].Release();

  m_colorManager = std::make_unique<CColorManager>();
  m_outputShader.reset();
  const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings();
  m_useDithering = settings->GetBool("videoscreen.dither");
  m_ditherDepth = settings->GetInt("videoscreen.ditherdepth");

  PreInit();
}
예제 #12
0
MOboolean
moPostEffectVideoPanel::Init()
{
    if (!PreInit()) return false;

    color = m_Config.GetParamIndex("color");

	radius = m_Config.GetParamIndex("radio"); 
	aberration = m_Config.GetParamIndex("aberracion");
	configuration = m_Config.GetParamIndex("configuracion");
	blending = m_Config.GetParamIndex("blending");

    transx = m_Config.GetParamIndex("TranslateX");
    transy = m_Config.GetParamIndex("TranslateY");
    transz = m_Config.GetParamIndex("TranslateZ");
    rotatx = m_Config.GetParamIndex("RotateX");
    rotaty = m_Config.GetParamIndex("RotateY");
    rotatz = m_Config.GetParamIndex("RotateZ");
    scalex = m_Config.GetParamIndex("ScaleX");
    scaley = m_Config.GetParamIndex("ScaleY");
    scalez = m_Config.GetParamIndex("ScaleZ");

	return true;
}
예제 #13
0
// Call the preinit function for .text segment modification.
void PluginManager::PreInit()
{
	// Let the user know we are calling.
	hConsole::EnqueueMessage("INFO", "", "", true);
	hConsole::EnqueueMessage("INFO", "Plugins::PreInit:", "", true);

	// Iterate through the vector and call the functionpointers.
	for (auto i = Plugins.begin(); i != Plugins.end(); ++i)
	{
		auto Start = std::chrono::high_resolution_clock::now();
		
		if (i->PreInit() != FALSE)
		{
			hConsole::EnqueueMessage("INFO", (char *)hString::va("Plugin <%s> preinit succeeded in %ld msec", i->Name.c_str(), std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - Start).count()), "", true);
		}
		else
		{
			// We do not remove the plugin for this.
			// It can still do memory edits if it wants.
			// And it may provide exports for other functions.
			hConsole::EnqueueMessage("INFO", (char *)hString::va("Plugin <%s> preinit failed", i->Name.c_str()), "", true);
		}
	}
}
예제 #14
0
void C4Application::Execute() {
  CStdApp::Execute();
  // Recursive execution check
  static int32_t iRecursionCount = 0;
  ++iRecursionCount;
  // Exec depending on game state
  assert(AppState != C4AS_None);
  switch (AppState) {
    case C4AS_Quit:
      // Do nothing, HandleMessage will return HR_Failure soon
      break;
    case C4AS_PreInit:
      if (!PreInit()) Quit();
      break;
    case C4AS_Startup:
#ifdef USE_CONSOLE
// Console engines just stay in this state until aborted or new commands arrive
// on stdin
#else
      AppState = C4AS_Game;
      // if no scenario or direct join has been specified, get game startup
      // parameters by startup dialog
      Game.ScenarioTitle.Copy(LoadResStr("IDS_PRC_INITIALIZE"));
      if (!C4Startup::Execute()) {
        Quit();
        --iRecursionCount;
        return;
      }
      AppState = C4AS_StartGame;
#endif
      break;
    case C4AS_StartGame:
      // immediate progress to next state; OpenGame will enter
      // HandleMessage-loops
      // in startup and lobby!
      AppState = C4AS_Game;
      // first-time game initialization
      if (!OpenGame()) {
        // set error flag (unless this was a lobby user abort)
        if (!C4GameLobby::UserAbort) Game.fQuitWithError = true;
        // no start: Regular QuitGame; this may reset the engine to startup mode
        // if desired
        QuitGame();
      }
      break;
    case C4AS_Game: {
      uint32_t iThisGameTick = timeGetTime();
      // Game (do additional timing check)
      if (Game.IsRunning && iRecursionCount <= 1)
        if (Game.GameGo || !iExtraGameTickDelay ||
            (iThisGameTick > iLastGameTick + iExtraGameTickDelay)) {
          // Execute
          Game.Execute();
          // Save back time
          iLastGameTick = iThisGameTick;
        }
      // Graphics
      if (!Game.DoSkipFrame) {
        uint32_t iPreGfxTime = timeGetTime();
        // Fullscreen mode
        if (isFullScreen) FullScreen.Execute(iRecursionCount > 1);
        // Console mode
        else
          Console.Execute();
        // Automatic frame skip if graphics are slowing down the game (skip max.
        // every 2nd frame)
        Game.DoSkipFrame = Game.Parameters.AutoFrameSkip &&
                           ((iPreGfxTime + iGameTickDelay) < timeGetTime());
      } else
        Game.DoSkipFrame = false;
      // Sound
      SoundSystem.Execute();
      // Gamepad
      if (pGamePadControl) pGamePadControl->Execute();
      break;
    }
  }

  --iRecursionCount;
}
예제 #15
0
void C4Application::GameTick()
{
	// Exec depending on game state
	switch (AppState)
	{
	case C4AS_None:
		assert(AppState != C4AS_None);
		break;
	case C4AS_Quit:
		// Do nothing, the main loop will exit soon
		break;
	case C4AS_PreInit:
		if (!PreInit()) Quit();
		break;
	case C4AS_Startup:
		SoundSystem.Execute();
		MusicSystem.Execute();
		// wait for the user to start a game
		break;
	case C4AS_StartGame:
		// immediate progress to next state; OpenGame will enter HandleMessage-loops in startup and lobby!
		C4Startup::CloseStartup();
		AppState = C4AS_Game;
		// first-time game initialization
		if (!Game.Init())
		{
			// set error flag (unless this was a lobby user abort)
			if (!C4GameLobby::UserAbort)
				Game.fQuitWithError = true;
			// no start: Regular QuitGame; this may reset the engine to startup mode if desired
			QuitGame();
			break;
		}
		if(Config.Graphics.Windowed == 2 && FullScreenMode())
			Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, true);
		break;
	case C4AS_AfterGame:
		// stop game
		Game.Clear();
		if(Config.Graphics.Windowed == 2 && !NextMission && !isEditor)
			Application.SetVideoMode(GetConfigWidth(), GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, false);
		AppState = C4AS_PreInit;
		// if a next mission is desired, set to start it
		if (NextMission)
		{
			Game.SetScenarioFilename(NextMission.getData());
			Game.fLobby = Game.NetworkActive;
			Game.fObserve = false;
			NextMission.Clear();
		}
		break;
	case C4AS_Game:
		// Game
		if (Game.IsRunning)
			Game.Execute();
		// Sound
		SoundSystem.Execute();
		MusicSystem.Execute();
		// Gamepad
		if (pGamePadControl) pGamePadControl->Execute();
		break;
	}
}
예제 #16
0
			virtual void preInit() const { PreInit(); }
 int ApplicationStateMachine::Start (int argc, char* argv[]) {
     PreInit(argc, argv);
     Init();
     Run();
     return Close();
 }
예제 #18
0
MOboolean moSceneEffect::Init()
{
  if (!PreInit()) return false;

  moDefineParamIndex( SCENE_INLET, "inlet" );
  moDefineParamIndex( SCENE_OUTLET, "outlet" );
  moDefineParamIndex( SCENE_SCRIPT, "script" );
  moDefineParamIndex( SCENE_ALPHA, "alpha" );
  moDefineParamIndex( SCENE_COLOR, "color" );
  moDefineParamIndex( SCENE_SYNC, "syncro" );
  moDefineParamIndex( SCENE_PHASE, "phase" );
  moDefineParamIndex( SCENE_PREEFFECTS, "preeffect" );
  moDefineParamIndex( SCENE_EFFECTS, "effect" );
  moDefineParamIndex( SCENE_POSTEFFECTS, "posteffect" );
  moDefineParamIndex( SCENE_STATES, "scene_states" );
  moDefineParamIndex( SCENE_SEQUENCE_MODE, "sequence_mode" );
  moDefineParamIndex( SCENE_SEQUENCE_DURATION, "sequence_duration" );
  moDefineParamIndex( SCENE_SEQUENCE_LOOP, "sequence_loop" );
  moDefineParamIndex( SCENE_CREATE_LAYER, "create_layer" );

  m_i_scene_states = -1;
	m_EffectManager.Init();
	m_EffectManager.m_pEffectManager = &m_EffectManager;
	m_EffectManager.m_pResourceManager = GetResourceManager();

	moEffect* newEffect = NULL;
  bool res = false;
  int pre=-1,on=-1;
	/** CREATING NEW LAYER!! */
	//RenderMan->CreateNewLayer( this );

  m_Config.SetCurrentParam( "preeffect" );
	if (m_Config.FirstValue()) {
    do {
      moValue& mVal(m_Config.GetCurrentValue());
      moMobDefinition MoldeoObjectDef( mVal.GetSubValue( MO_CFG_EFFECT).Text(), mVal.GetSubValue( MO_CFG_EFFECT_CONFIG).Text(),
                                        MO_OBJECT_PREEFFECT, mVal.GetSubValue( MO_CFG_EFFECT_LABEL).Text() );

      newEffect = m_EffectManager.New( MoldeoObjectDef );
      if (newEffect) {
          res = newEffect->Init();
          pre = mVal.GetSubValue(MO_CFG_EFFECT_PRE).Int();
          on = mVal.GetSubValue(MO_CFG_EFFECT_ON).Int();
          if (pre>=0) newEffect->GetConfig()->SetCurrentPreConf(pre);
          if (on>0) newEffect->Activate();
          else newEffect->Deactivate();
      }
    } while (m_Config.NextValue());
	}


  m_Config.SetCurrentParam( "effect" );
	if (m_Config.FirstValue()) {
    do {
      moValue& mVal(m_Config.GetCurrentValue());
      moMobDefinition MoldeoObjectDef( mVal.GetSubValue( MO_CFG_EFFECT).Text(), mVal.GetSubValue( MO_CFG_EFFECT_CONFIG).Text(),
                                        MO_OBJECT_EFFECT, mVal.GetSubValue( MO_CFG_EFFECT_LABEL).Text() );
      newEffect = m_EffectManager.New( MoldeoObjectDef );
      if (newEffect) {
          res = newEffect->Init();
          pre = mVal.GetSubValue(MO_CFG_EFFECT_PRE).Int();
          on = mVal.GetSubValue(MO_CFG_EFFECT_ON).Int();
          if (pre>=0) newEffect->GetConfig()->SetCurrentPreConf(pre);
          if (on>0) newEffect->Activate();
          else newEffect->Deactivate();
      }

    } while (m_Config.NextValue());
	}

  m_Config.SetCurrentParam( "posteffect" );
	if (m_Config.FirstValue()) {
    do {
      moValue& mVal(m_Config.GetCurrentValue());
      moMobDefinition MoldeoObjectDef( mVal.GetSubValue( MO_CFG_EFFECT).Text(), mVal.GetSubValue( MO_CFG_EFFECT_CONFIG).Text(),
                                        MO_OBJECT_POSTEFFECT, mVal.GetSubValue( MO_CFG_EFFECT_LABEL).Text() );
      newEffect = m_EffectManager.New( MoldeoObjectDef );
      if (newEffect) {
          res = newEffect->Init();
          pre = mVal.GetSubValue(MO_CFG_EFFECT_PRE).Int();
          on = mVal.GetSubValue(MO_CFG_EFFECT_ON).Int();
          if (pre>=0) newEffect->GetConfig()->SetCurrentPreConf(pre);
          if (on>0) newEffect->Activate();
          else newEffect->Deactivate();
      }

    } while (m_Config.NextValue());
	}


	m_Config.SetCurrentParam( "scene_states" );
	m_n_scene_states = m_Config.GetCurrentParam().GetValuesCount();

	int i_scene_states = 0;
	if (m_Config.FirstValue()) {
    do {
        moValue& mVal(m_Config.GetCurrentValue());
        moSceneState SceneState;

        if (mVal.GetSubValueCount()>1) {
          SceneState.m_state_name = mVal.GetSubValue( 0 ).Text();
          SceneState.Set( mVal.GetSubValue( 1 ).Text());
        }

        m_SceneStates[i_scene_states] = SceneState;

        MODebug2->Message("scene_states: " + mVal.GetSubValue( 0 ).Text() );
        i_scene_states+= 1;
    } while (m_Config.NextValue());
	}
	m_Config[ moR(SCENE_STATES)].SetIndexValue(0);

  m_Config.SetCurrentPreConf( 0 );

	return true;
}
bool
ShouldA11yBeEnabled()
{
  static bool sChecked = false, sShouldEnable = false;
  if (sChecked)
    return sShouldEnable;

  sChecked = true;

  EPlatformDisabledState disabledState = PlatformDisabledState();
  if (disabledState == ePlatformIsDisabled)
    return sShouldEnable = false;

  // check if accessibility enabled/disabled by environment variable
  const char* envValue = PR_GetEnv(sAccEnv);
  if (envValue)
    return sShouldEnable = !!atoi(envValue);

#ifdef MOZ_ENABLE_DBUS
  PreInit();
  bool dbusSuccess = false;
  DBusMessage *reply = nullptr;
  if (!sPendingCall)
    goto dbus_done;

  dbus_pending_call_block(sPendingCall);
  reply = dbus_pending_call_steal_reply(sPendingCall);
  dbus_pending_call_unref(sPendingCall);
  sPendingCall = nullptr;
  if (!reply ||
      dbus_message_get_type(reply) != DBUS_MESSAGE_TYPE_METHOD_RETURN ||
      strcmp(dbus_message_get_signature (reply), DBUS_TYPE_VARIANT_AS_STRING))
    goto dbus_done;

  DBusMessageIter iter, iter_variant, iter_struct;
  dbus_bool_t dResult;
  dbus_message_iter_init(reply, &iter);
  dbus_message_iter_recurse (&iter, &iter_variant);
  switch (dbus_message_iter_get_arg_type(&iter_variant)) {
    case DBUS_TYPE_STRUCT:
      // at-spi2-core 2.2.0-2.2.1 had a bug where it returned a struct
      dbus_message_iter_recurse(&iter_variant, &iter_struct);
      if (dbus_message_iter_get_arg_type(&iter_struct) == DBUS_TYPE_BOOLEAN) {
        dbus_message_iter_get_basic(&iter_struct, &dResult);
        sShouldEnable = dResult;
        dbusSuccess = true;
      }

      break;
    case DBUS_TYPE_BOOLEAN:
      dbus_message_iter_get_basic(&iter_variant, &dResult);
      sShouldEnable = dResult;
      dbusSuccess = true;
      break;
    default:
      break;
  }

dbus_done:
  if (reply)
    dbus_message_unref(reply);

  if (dbusSuccess)
    return sShouldEnable;
#endif

  //check gconf-2 setting
static const char sGconfAccessibilityKey[] =
    "/desktop/gnome/interface/accessibility";
  nsresult rv = NS_OK;
  nsCOMPtr<nsIGConfService> gconf =
    do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv) && gconf)
    gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey), &sShouldEnable);

  return sShouldEnable;
}