Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// The application object
//-----------------------------------------------------------------------------
bool CDmxConvertApp::Create()
{
	SpewOutputFunc( DMXConvertOutputFunc );
	AddSystem( g_pDataModel, VDATAMODEL_INTERFACE_VERSION );
	AddSystem( g_pDmSerializers, DMSERIALIZERS_INTERFACE_VERSION );
	return true;
}
Exemplo n.º 2
0
void Scene::CreateSystems()
{
	renderSystem = new RenderSystem();
	eventSystem = new EventSystem();

    transformSystem = new TransformSystem(this);
    AddSystem(transformSystem, (1 << Component::TRANSFORM_COMPONENT));

    renderUpdateSystem = new RenderUpdateSystem(this);
    AddSystem(renderUpdateSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::RENDER_COMPONENT));

	lodSystem = new LodSystem(this);
	AddSystem(lodSystem, (1 << Component::LOD_COMPONENT));

    debugRenderSystem = new DebugRenderSystem(this);
    AddSystem(debugRenderSystem, (1 << Component::DEBUG_RENDER_COMPONENT));

	particleEffectSystem = new ParticleEffectSystem(this);
	AddSystem(particleEffectSystem, (1 << Component::PARTICLE_EFFECT_COMPONENT));

	updatableSystem = new UpdateSystem(this);
	AddSystem(updatableSystem, (1 << Component::UPDATABLE_COMPONENT));
    
    lightUpdateSystem = new LightUpdateSystem(this);
    AddSystem(lightUpdateSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::LIGHT_COMPONENT));

	switchSystem = new SwitchSystem(this);
	AddSystem(switchSystem, (1 << Component::SWITCH_COMPONENT));

	soundSystem = new SoundUpdateSystem(this);
	AddSystem(soundSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::SOUND_COMPONENT));
	
	actionSystem = new ActionUpdateSystem(this);
	AddSystem(actionSystem, (1 << Component::ACTION_COMPONENT));
}
Exemplo n.º 3
0
void CEngine::CreateSystems()
{
    AddSystem( Input() );
    AddSystem( Sound() );
	AddSystem( Physics() );
	AddSystem( Script() );	
}
Exemplo n.º 4
0
void H_system::Create_h_Vent(char *line) {

	char name[100];
	h_Vent *new_one;
	vector3 pos=_vector3(0.0, 0.0, 0.0);
	vector3 dir;
	double volume,isol = 0;
	int one, two, three, four;
	sscanf (line+6, " %s %i %i %i %i",
		name,
		&one, &two, &three, &four);
	new_one = (h_Vent*)AddSystem(new h_Vent(name, pos));
	new_one->IN_valve.open = one;
	new_one->OUT_valve.open = two;
	new_one->OUT2_valve.open = three;
	new_one->LEAK_valve.open = four;
	new_one->space.Void(); //empty the space

	line = ReadConfigLine();
	while (strnicmp(line,"</VENT>",7)) {
		sscanf (line, "<%lf %lf %lf> <%lf %lf %lf> %lf",
			&pos.x, &pos.y, &pos.z,
			&dir.x, &dir.y, &dir.z,
			&volume);
		new_one->AddVent(pos,dir,volume);

		line=ReadConfigLine();
	}
}
Exemplo n.º 5
0
void H_system::Create_h_Radiator(char *line) {

	char name[100];
	h_Radiator *new_one;
	vector3 pos;
	vector3 dir;
	double volume, isol, mass, temp;

	sscanf(line+10, " %s  <%lf %lf %lf> %lf ",
		   name,
		   &pos.x,&pos.y,&pos.z,&temp);

	line = ReadConfigLine();
	sscanf(line," %lf %lf %lf", &volume, &isol, &mass);
	new_one = (h_Radiator*)AddSystem(new h_Radiator(name, pos, volume, isol));

	// Debugging thermal management
	//if (!strcmp(name, "ECSRADIATOR1"))
	//	P_thermal->AddThermalObject(new_one, true);
	//else 

	P_thermal->AddThermalObject(new_one);

	new_one->isolation = 1.0;
	new_one->Area = (1.0 / 4.0 * volume);
	new_one->mass = mass;
	new_one->SetTemp(temp);
	new_one->parent = this;
}
// brown smoke ps
void CParticleSystemManager::CreateBrownPS(vec3_t vPosition, vec3_t vDirection)
{
	if(CheckDrawSystem() == false)
		return;

	AddSystem(new CBrownSmokeParticleSystem(vPosition, vDirection));
}
// wrappers to create particle system's
// flintlock smoke ps
void CParticleSystemManager::CreateFlintPS(vec3_t vPosition)
{
	if(CheckDrawSystem() == false)
		return;

	AddSystem(new CFlintlockSmokeParticleSystem(vPosition));
}
// mapped ps
void CParticleSystemManager::CreateMappedPS( char* sFile, particle_system_management* pSystem )
{
	if(pSystem == NULL) {
		return;
	}

	AddSystem(new CMappedParticleSystem(sFile, pSystem));
}
Exemplo n.º 9
0
 void r_framework_drawing::Init(RGameEngine* game)
 {  
     AddSystem(&_sys_sprite);
     systems.push_back(&_sys_ui_text);
     systems.push_back(&_sys_fg_color);
     systems.push_back(&_sys_bg_color);
     systems.push_back(&_sys_position);
     systems.push_back(&_sys_dimensions);
     systems.push_back(&_sys_unicode);
 }
Exemplo n.º 10
0
Game* Engine::CreateGame()
{
	// Create a new game
	if (!AddSystem(new Game(GameData()))) { return nullptr; }
	Game* game = GetSystem<Game>(SystemType::Sys_Game);
	if (!game) { return nullptr; }
	if (!game->Initialize()) { return nullptr; }

	return game;
}
Exemplo n.º 11
0
void H_system::Create_h_crew(char *line)
{
char name[100];
int nmb;
char source[100];
h_Tank *SRC;
sscanf(line+6,"%s %i %s",name,&nmb,source);
SRC=(h_Tank*)GetPointerByString(source);
AddSystem(new h_crew(name,nmb,SRC));
}
Exemplo n.º 12
0
Game* Engine::CreateGame(){
	if (!AddSystem(new Game(GameData())))
		return nullptr;
	Game* game = GetSystem<Game>(SystemType::Sys_Game);
	if (!game)
		return nullptr;
	/*if (!game->Initialize());
	return nullptr;*/

	return game;
}
Exemplo n.º 13
0
void H_system::Create_h_Pipe(char *line) {

	h_Valve *in;
	h_Valve *out;
	char name[100];
	char in_valve[100];
	char out_valve[100];
	char type[100];
	double max=0;
	double min=0;
	char is_two[100];

	if (sscanf(line + 6, " %s", name) <= 0)
		name[0] = '\0';

	line = ReadConfigLine();
	while (!Compare(line,"</PIPE>")) {type[0]=0;is_two[0]=0;
		sscanf (line, "%s %s %s %lf %lf %s",in_valve,out_valve,type,&max,&min,is_two);

		int two_way=1;
		if (Compare(type,"ONEWAY")) two_way=0;
		if (Compare(is_two,"ONEWAY")) two_way=0;

		in=(h_Valve*)GetPointerByString(in_valve);
		out=(h_Valve*)GetPointerByString(out_valve);

		if (Compare(type,"PREG"))
			AddSystem(new h_Pipe(name,in,out,1,max,min,two_way));
		else if (Compare(type,"BURST"))
			AddSystem(new h_Pipe(name,in,out,2,max,min,two_way));
		else if (Compare(type,"PVALVE"))
			AddSystem(new h_Pipe(name,in,out,3,max,min,two_way));
		else
			AddSystem(new h_Pipe(name,in,out,0,0,0,two_way));
		
		line=ReadConfigLine();
	}
}
Exemplo n.º 14
0
//-----------------------------------------------------------------------------
// The application object
//-----------------------------------------------------------------------------
bool CUnitTestApp::Create()
{
	// Install a special Spew handler that ignores all assertions and lets us
	// run for as long as possible
	SpewOutputFunc( UnitTestSpew );

	// FIXME: This list of dlls should come from the unittests themselves
	AppSystemInfo_t appSystems[] = 
	{
		{ "vstdlib.dll",			PROCESS_UTILS_INTERFACE_VERSION },
		{ "", "" }	// Required to terminate the list
	};

	if ( !AddSystems( appSystems ) ) 
		return false;

	// Very simple... just iterate over all .DLLs in the current directory 
	// see if they export UNITTEST_INTERFACE_VERSION. If not, then unload them
	// just as quick.

	// We may want to make this more sophisticated, giving it a search path,
	// or giving test DLLs special extensions, or statically linking the test DLLs
	// to this program.

	WIN32_FIND_DATA findFileData;
	HANDLE hFind= FindFirstFile("*.dll", &findFileData);

	while (hFind != INVALID_HANDLE_VALUE)
	{
		CSysModule* hLib = Sys_LoadModule(findFileData.cFileName);
		if ( hLib )
		{
			CreateInterfaceFn factory = Sys_GetFactory( hLib );
			if ( factory && factory( UNITTEST_INTERFACE_VERSION, NULL ) )
			{
				AppModule_t module = LoadModule( factory );
				AddSystem( module, UNITTEST_INTERFACE_VERSION );
			}
			else
			{
				Sys_UnloadModule( hLib );
			}
		}

		if (!FindNextFile( hFind, &findFileData ))
			break;
	}

	return true;
}
Exemplo n.º 15
0
void H_system::Create_h_MixingPipe(char *line) {

	char name[100], in1Name[100], in2Name[100], outName[100];
	int pump;
	double targetTemp;

	sscanf(line + 12, " %s %i %s %s %s %lf",
		   name, &pump, in1Name, in2Name, outName, &targetTemp);

	h_Valve *in1 = (h_Valve*)GetPointerByString(in1Name);
	h_Valve *in2 = (h_Valve*)GetPointerByString(in2Name);
	h_Valve *out = (h_Valve*)GetPointerByString(outName);

	AddSystem(new h_MixingPipe(name, pump, in1, in2, out, targetTemp));
}
Exemplo n.º 16
0
//-----------------------------------------------------------------------------
// Create necessary interfaces
//-----------------------------------------------------------------------------
bool CSteamApplication::Create()
{
	FileSystem_SetErrorMode( FS_ERRORMODE_AUTO );

	char pFileSystemDLL[MAX_PATH];
	if ( FileSystem_GetFileSystemDLLName( pFileSystemDLL, MAX_PATH, m_bSteam ) != FS_OK )
		return false;
	
	FileSystem_SetupSteamInstallPath();

	// Add in the cvar factory
	AppModule_t cvarModule = LoadModule( VStdLib_GetICVarFactory() );
	AddSystem( cvarModule, CVAR_INTERFACE_VERSION );

	AppModule_t fileSystemModule = LoadModule( pFileSystemDLL );
	m_pFileSystem = (IFileSystem*)AddSystem( fileSystemModule, FILESYSTEM_INTERFACE_VERSION );
	if ( !m_pFileSystem )
	{
		Error( "Unable to load %s", pFileSystemDLL );
		return false;
	}

	return true;
}
Exemplo n.º 17
0
void H_system::Create_h_HeatExchanger(char *line) {

	char name[100], sourceName[100], targetName[100];
	double length, tempMin, tempMax;
	int pump;

	sscanf(line + 15, " %s %i %lf %s %s %lf %lf",
		   name, &pump, &length, sourceName, targetName, &tempMin, &tempMax);

	ship_object* so = (ship_object*) GetPointerByString(targetName) ;
	therm_obj *target = so->GetThermalInterface();

	so = (ship_object*) GetPointerByString(sourceName) ;
	therm_obj *source = so->GetThermalInterface();

	AddSystem(new h_HeatExchanger(name, pump, length, source, target, tempMin, tempMax));
}
Exemplo n.º 18
0
void H_system::Create_h_Evaporator(char *line) {

	char name[100], liquidSourceName[100], targetName[100], tempControlName[100];
	int pump;
	double targetTemp, turnOnTemp;
	h_Evaporator *new_one;

	sscanf(line + 12, " %s %i %s %lf %s %lf %s",
		   name, &pump, targetName, &targetTemp, liquidSourceName, &turnOnTemp, tempControlName);

	ship_object* so = (ship_object*) GetPointerByString(targetName) ;
	therm_obj *target = so->GetThermalInterface();

	h_Valve *liquidSource = (h_Valve*)GetPointerByString(liquidSourceName);

	so = (ship_object*) GetPointerByString(tempControlName) ;
	therm_obj *tempControl = so->GetThermalInterface();
	
	new_one = (h_Evaporator*) AddSystem(new h_Evaporator(name, pump, target, targetTemp, liquidSource, turnOnTemp, tempControl));
	new_one->parent = this;
}
Exemplo n.º 19
0
	Core::Core(const string& cLog, const string& cConfig)
		: CoreObject("CORE", new ofstream(cLog), WorkPriority::WP_MAIN)
	{
		mLogger = mOutFileStream;
		m_pRenderSystem = nullptr;
		m_pInputSystem = nullptr;
		m_pFileSystem = nullptr;

		AddSystem(new FileSystem(mLogger), true);

		ConfigFile* config = new ConfigFile(cConfig, mLogger);
		for (auto it : config->Get())
		{
			if (it.first == "load_module")
			{
				LoadModule(it.second);
			}
			else if (it.first == "set_render_system")
			{
				if (it.second == "11.2")
				{
					ChangeSystem(SystemsType::SYSTEM_RENDER_DIRECTX_11_2);
				}
				else
				{
					DrawLine("Core: Íåâåðíûé ïàðàìåòîð! set_render_system");
				}
			}
			else if (it.first == "set_input_system")
			{
				ChangeSystem(SystemsType::SYSTEM_INPUT_DX);
			}
			else if (it.first == "load_resource_folder")
			{
				m_pFileSystem->AddResourceFolder(it.second);
			}
		}

		DrawLine("Core: Çàãðóçêà çàâåðøåíà!");
	}
Exemplo n.º 20
0
void H_system::Create_h_Tank(char *line) {

	char name[100], valvename[100];
	h_Tank *new_one;
	vector3 pos;
	double volume,isol=0;
	float size = 0;
	int open;
	h_Valve *valve;

	sscanf (line+6, " %s <%lf %lf %lf> %lf %lf",
								name,
								&pos.x,
								&pos.y,
								&pos.z,
								&volume, &isol);

	new_one=(h_Tank*)AddSystem(new h_Tank(name,pos, volume));

	h_substance loaded_sub;
	new_one->space.Void(); //empty the space

	while (strnicmp(line,"</TANK>",7)) {

		if (!strnicmp (line, "CHM",3 )) {
            sscanf (line+3, "   %i %lf %lf %lf",
						&loaded_sub.subst_type,
						&loaded_sub.mass,
						&loaded_sub.vapor_mass,
						&loaded_sub.Q);
			new_one->space+=loaded_sub;

		} else if (!strnicmp (line, "VALVE", 5)) {
            sscanf (line + 5, " %s %i %f",
						valvename, &open, &size);

			valve = 0;
			if (!strnicmp (valvename, "IN", 2)) {
				valve = &(new_one->IN_valve);
			} else if (!strnicmp (valvename, "OUT2", 4)) {
				valve = &(new_one->OUT2_valve);
			} else if (!strnicmp (valvename, "OUT", 3)) {
				valve = &(new_one->OUT_valve);
			} else if (!strnicmp (valvename, "LEAK", 4)) {
				valve = &(new_one->LEAK_valve);
			} else {
				BuildError(2); //no such component
			}

			if (valve) {
				valve->open = open;
				valve->size = size;
			}
		}
		do {
			line = ReadConfigLine();
		} while (line == NULL);
	}
	new_one->mass=new_one->space.GetMass();//get all the mass,etc..
	new_one->space.GetMaxSub();//recompute sub_number;
	new_one->energy=new_one->space.GetQ();//sum up Qs
	new_one->Original_volume=volume;
	P_thermal->AddThermalObject(new_one);
	if (isol)
		new_one->isolation=isol;
	else
		new_one->isolation=1.0;

	new_one->Area=pow(3.0/4.0*PI*volume/1000,0.3333); //radius of tank
	new_one->Area=2*PI*new_one->Area*new_one->Area;//projection circle ois 2*PI*R
	new_one->parent=this;
}
Exemplo n.º 21
0
TEST_F(SystemTests,AddSystem){
	AddSystem();
}
Exemplo n.º 22
0
bool MDFNI_InitializeModules(const std::vector<MDFNGI *> &ExternalSystems)
{
    static MDFNGI *InternalSystems[] =
    {
#ifdef WANT_NES_EMU
        &EmulatedNES,
#endif

#ifdef WANT_SNES_EMU
        &EmulatedSNES,
#endif

#ifdef WANT_GB_EMU
        &EmulatedGB,
#endif

#ifdef WANT_GBA_EMU
        &EmulatedGBA,
#endif

#ifdef WANT_PCE_EMU
        &EmulatedPCE,
#endif

#ifdef WANT_PCE_FAST_EMU
        &EmulatedPCE_Fast,
#endif

#ifdef WANT_LYNX_EMU
        &EmulatedLynx,
#endif

#ifdef WANT_MD_EMU
        &EmulatedMD,
#endif

#ifdef WANT_PCFX_EMU
        &EmulatedPCFX,
#endif

#ifdef WANT_NGP_EMU
        &EmulatedNGP,
#endif

#ifdef WANT_PSX_EMU
        &EmulatedPSX,
#endif

#ifdef WANT_VB_EMU
        &EmulatedVB,
#endif

#ifdef WANT_WSWAN_EMU
        &EmulatedWSwan,
#endif

#ifdef WANT_SMS_EMU
        &EmulatedSMS,
        &EmulatedGG,
#endif

        &EmulatedCDPlay
    };
    std::string i_modules_string, e_modules_string;

    for(unsigned int i = 0; i < sizeof(InternalSystems) / sizeof(MDFNGI *); i++)
    {
        AddSystem(InternalSystems[i]);
        if(i)
            i_modules_string += " ";
        i_modules_string += std::string(InternalSystems[i]->shortname);
    }

    for(unsigned int i = 0; i < ExternalSystems.size(); i++)
    {
        AddSystem(ExternalSystems[i]);
        if(i)
            i_modules_string += " ";
        e_modules_string += std::string(ExternalSystems[i]->shortname);
    }

    MDFNI_printf(_("Internal emulation modules: %s\n"), i_modules_string.c_str());
    MDFNI_printf(_("External emulation modules: %s\n"), e_modules_string.c_str());


    for(unsigned int i = 0; i < MDFNSystems.size(); i++)
        MDFNSystemsPrio.push_back(MDFNSystems[i]);

    MDFNSystemsPrio.sort(MDFNSystemsPrio_CompareFunc);

#if 0
    std::string a_modules;

std::list<MDFNGI *>:
    iterator it;

    for(it = MDFNSystemsPrio.
             f
#endif

             CDUtility::CDUtility_Init();

            return(1);
}

int MDFNI_Initialize(const char *basedir, const std::vector<MDFNSetting> &DriverSettings)
{
    // FIXME static
    static std::vector<MDFNSetting> dynamic_settings;

    if(!MDFN_RunMathTests())
    {
        return(0);
    }


    memset(PortDataCache, 0, sizeof(PortDataCache));
    memset(PortDataLenCache, 0, sizeof(PortDataLenCache));
    memset(PortDeviceCache, 0, sizeof(PortDeviceCache));

    lzo_init();

    MDFNI_SetBaseDirectory(basedir);

    MDFN_InitFontData();

    // Generate dynamic settings
    for(unsigned int i = 0; i < MDFNSystems.size(); i++)
    {
        MDFNSetting setting;
        const char *sysname;

        sysname = (const char *)MDFNSystems[i]->shortname;

        if(!MDFNSystems[i]->soundchan)
            printf("0 sound channels for %s????\n", sysname);

        if(MDFNSystems[i]->soundchan == 2)
        {
            BuildDynamicSetting(&setting, sysname, "forcemono", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_SOUND, CSD_forcemono, MDFNST_BOOL, "0");
            dynamic_settings.push_back(setting);
        }

        BuildDynamicSetting(&setting, sysname, "enable", MDFNSF_COMMON_TEMPLATE, CSD_enable, MDFNST_BOOL, "1");
        dynamic_settings.push_back(setting);

        BuildDynamicSetting(&setting, sysname, "tblur", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_VIDEO, CSD_tblur, MDFNST_BOOL, "0");
        dynamic_settings.push_back(setting);

        BuildDynamicSetting(&setting, sysname, "tblur.accum", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_VIDEO, CSD_tblur_accum, MDFNST_BOOL, "0");
        dynamic_settings.push_back(setting);

        BuildDynamicSetting(&setting, sysname, "tblur.accum.amount", MDFNSF_COMMON_TEMPLATE | MDFNSF_CAT_VIDEO, CSD_tblur_accum_amount, MDFNST_FLOAT, "50", "0", "100");
        dynamic_settings.push_back(setting);
    }

    if(DriverSettings.size())
        MDFN_MergeSettings(DriverSettings);

    // First merge all settable settings, then load the settings from the SETTINGS FILE OF DOOOOM
    MDFN_MergeSettings(MednafenSettings);
    MDFN_MergeSettings(dynamic_settings);
    MDFN_MergeSettings(MDFNMP_Settings);


    for(unsigned int x = 0; x < MDFNSystems.size(); x++)
    {
        if(MDFNSystems[x]->Settings)
            MDFN_MergeSettings(MDFNSystems[x]->Settings);
    }

    MDFN_MergeSettings(RenamedSettings);

    if(!MFDN_LoadSettings(basedir))
        return(0);

#ifdef WANT_DEBUGGER
    MDFNDBG_Init();
#endif

    return(1);
}

void MDFNI_Kill(void)
{
    MDFN_SaveSettings();
}

static double multiplier_save, volume_save;
static std::vector<int16> SoundBufPristine;

static void ProcessAudio(EmulateSpecStruct *espec)
{
    if(espec->SoundVolume != 1)
        volume_save = espec->SoundVolume;

    if(espec->soundmultiplier != 1)
        multiplier_save = espec->soundmultiplier;

    if(espec->SoundBuf && espec->SoundBufSize)
    {
        int16 *const SoundBuf = espec->SoundBuf + espec->SoundBufSizeALMS * MDFNGameInfo->soundchan;
        int32 SoundBufSize = espec->SoundBufSize - espec->SoundBufSizeALMS;
        const int32 SoundBufMaxSize = espec->SoundBufMaxSize - espec->SoundBufSizeALMS;


        if(qtrecorder && (volume_save != 1 || multiplier_save != 1))
        {
            int32 orig_size = SoundBufPristine.size();

            SoundBufPristine.resize(orig_size + SoundBufSize * MDFNGameInfo->soundchan);
            for(int i = 0; i < SoundBufSize * MDFNGameInfo->soundchan; i++)
                SoundBufPristine[orig_size + i] = SoundBuf[i];
        }

        if(espec->NeedSoundReverse)
        {
            int16 *yaybuf = SoundBuf;
            int32 slen = SoundBufSize;

            if(MDFNGameInfo->soundchan == 1)
            {
                for(int x = 0; x < (slen / 2); x++)
                {
                    int16 cha = yaybuf[slen - x - 1];
                    yaybuf[slen - x - 1] = yaybuf[x];
                    yaybuf[x] = cha;
                }
            }
            else if(MDFNGameInfo->soundchan == 2)
            {
                for(int x = 0; x < (slen * 2) / 2; x++)
                {
                    int16 cha = yaybuf[slen * 2 - (x&~1) - ((x&1) ^ 1) - 1];
                    yaybuf[slen * 2 - (x&~1) - ((x&1) ^ 1) - 1] = yaybuf[x];
                    yaybuf[x] = cha;
                }
            }
        }

        try
        {
            if(wavrecorder)
                wavrecorder->WriteSound(SoundBuf, SoundBufSize);
        }
        catch(std::exception &e)
        {
            MDFND_PrintError(e.what());
            delete wavrecorder;
            wavrecorder = NULL;
        }

        if(multiplier_save != LastSoundMultiplier)
        {
            ff_resampler.time_ratio(multiplier_save, 0.9965);
            LastSoundMultiplier = multiplier_save;
        }

        if(multiplier_save != 1)
        {
            if(FFDiscard)
            {
                if(SoundBufSize >= multiplier_save)
                    SoundBufSize /= multiplier_save;
            }
            else
            {
                if(MDFNGameInfo->soundchan == 2)
                {
                    assert(ff_resampler.max_write() >= SoundBufSize * 2);

                    for(int i = 0; i < SoundBufSize * 2; i++)
                        ff_resampler.buffer()[i] = SoundBuf[i];
                }
                else
                {
                    assert(ff_resampler.max_write() >= SoundBufSize * 2);

                    for(int i = 0; i < SoundBufSize; i++)
                    {
                        ff_resampler.buffer()[i * 2] = SoundBuf[i];
                        ff_resampler.buffer()[i * 2 + 1] = 0;
                    }
                }
                ff_resampler.write(SoundBufSize * 2);

                int avail = ff_resampler.avail();
                int real_read = std::min((int)(SoundBufMaxSize * MDFNGameInfo->soundchan), avail);

                if(MDFNGameInfo->soundchan == 2)
                    SoundBufSize = ff_resampler.read(SoundBuf, real_read ) >> 1;
                else
                    SoundBufSize = ff_resampler.read_mono_hack(SoundBuf, real_read );

                avail -= real_read;

                if(avail > 0)
                {
                    printf("ff_resampler.avail() > espec->SoundBufMaxSize * MDFNGameInfo->soundchan - %d\n", avail);
                    ff_resampler.clear();
                }
            }
        }

        if(volume_save != 1)
        {
            if(volume_save < 1)
            {
                int volume = (int)(16384 * volume_save);

                for(int i = 0; i < SoundBufSize * MDFNGameInfo->soundchan; i++)
                    SoundBuf[i] = (SoundBuf[i] * volume) >> 14;
            }
            else
            {
Exemplo n.º 23
0
void Scene::Update(float timeElapsed)
{
    TIME_PROFILE("Scene::Update");
    
    uint64 time = SystemTimer::Instance()->AbsoluteMS();

    bool needShowStaticOcclusion = RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::DEBUG_DRAW_STATIC_OCCLUSION);
    if (needShowStaticOcclusion&&!staticOcclusionDebugDrawSystem)
    {
        staticOcclusionDebugDrawSystem = new StaticOcclusionDebugDrawSystem(this);
        AddSystem(staticOcclusionDebugDrawSystem, (1 << Component::STATIC_OCCLUSION_COMPONENT), false, renderUpdateSystem);
    }else if (!needShowStaticOcclusion&&staticOcclusionDebugDrawSystem)
    {
        RemoveSystem(staticOcclusionDebugDrawSystem);
        SafeDelete(staticOcclusionDebugDrawSystem);
    }

    uint32 size = (uint32)systemsToProcess.size();
    for (uint32 k = 0; k < size; ++k)
    {
        SceneSystem * system = systemsToProcess[k];
        if((systemsMask & SCENE_SYSTEM_UPDATEBLE_FLAG) && system == transformSystem)
        {
            updatableSystem->UpdatePreTransform(timeElapsed);
            transformSystem->Process(timeElapsed);
            updatableSystem->UpdatePostTransform(timeElapsed);
        }
        else if(system == lodSystem)
        {
            if(RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::UPDATE_LODS))
            {
                lodSystem->Process(timeElapsed);
            }
        }
        else
        {
            system->Process(timeElapsed);
        }
    }

// 	int32 size;
// 	
// 	size = (int32)animations.size();
// 	for (int32 animationIndex = 0; animationIndex < size; ++animationIndex)
// 	{
// 		SceneNodeAnimationList * anim = animations[animationIndex];
// 		anim->Update(timeElapsed);
// 	}
// 
// 	if(RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::UPDATE_ANIMATED_MESHES))
// 	{
// 		size = (int32)animatedMeshes.size();
// 		for (int32 animatedMeshIndex = 0; animatedMeshIndex < size; ++animatedMeshIndex)
// 		{
// 			AnimatedMesh * mesh = animatedMeshes[animatedMeshIndex];
// 			mesh->Update(timeElapsed);
// 		}
// 	}

	//if(imposterManager)
	//{
	//	imposterManager->Update(timeElapsed);
	//}

    updateTime = SystemTimer::Instance()->AbsoluteMS() - time;
}
Exemplo n.º 24
0
bool MDFNI_InitializeModules(const std::vector<MDFNGI *> &ExternalSystems)
{
 static MDFNGI *InternalSystems[] =
 {
  #ifdef WANT_NES_EMU
  &EmulatedNES,
  #endif

  #ifdef WANT_SNES_EMU
  &EmulatedSNES,
  #endif

  #ifdef WANT_SNES_PERF_EMU
  &EmulatedSNES_Perf,
  #endif

  #ifdef WANT_GB_EMU
  &EmulatedGB,
  #endif

  #ifdef WANT_GBA_EMU
  &EmulatedGBA,
  #endif

  #ifdef WANT_PC_EMU
  &EmulatedPC,
  #endif

  #ifdef WANT_PCE_EMU
  &EmulatedPCE,
  #endif

  #ifdef WANT_PCE_FAST_EMU
  &EmulatedPCE_Fast,
  #endif

  #ifdef WANT_LYNX_EMU
  &EmulatedLynx,
  #endif

  #ifdef WANT_MD_EMU
  &EmulatedMD,
  #endif

  #ifdef WANT_PCFX_EMU
  &EmulatedPCFX,
  #endif

  #ifdef WANT_NGP_EMU
  &EmulatedNGP,
  #endif

  #ifdef WANT_PSX_EMU
  &EmulatedPSX,
  #endif

  #ifdef WANT_VB_EMU
  &EmulatedVB,
  #endif

  #ifdef WANT_WSWAN_EMU
  &EmulatedWSwan,
  #endif

  #ifdef WANT_SMS_EMU
  &EmulatedSMS,
  &EmulatedGG,
  #endif

  &EmulatedCDPlay
 };
 std::string i_modules_string, e_modules_string;

 assert(MEDNAFEN_VERSION_NUMERIC >= 0x0927);

 for(unsigned int i = 0; i < sizeof(InternalSystems) / sizeof(MDFNGI *); i++)
 {
  AddSystem(InternalSystems[i]);
  if(i)
   i_modules_string += " ";
  i_modules_string += std::string(InternalSystems[i]->shortname);
 }

 for(unsigned int i = 0; i < ExternalSystems.size(); i++)
 {
  AddSystem(ExternalSystems[i]);
  if(i)
   i_modules_string += " ";
  e_modules_string += std::string(ExternalSystems[i]->shortname);
 }

 MDFNI_printf(_("Internal emulation modules: %s\n"), i_modules_string.c_str());
 MDFNI_printf(_("External emulation modules: %s\n"), e_modules_string.c_str());


 for(unsigned int i = 0; i < MDFNSystems.size(); i++)
  MDFNSystemsPrio.push_back(MDFNSystems[i]);

 MDFNSystemsPrio.sort(MDFNSystemsPrio_CompareFunc);

 CDUtility::CDUtility_Init();

 return(1);
}
Exemplo n.º 25
0
//Private Methods
int Engine::Initialize()
{
	// Set the engine to Initializing
	m_EngineState = EngineState::Initializing;

	// Create the WorldSettings singleton
	Singleton<WorldSettings>::CreateInstance();

	// Create a new point to a new game
	Game* game = CreateGame();

	// Break if the new game failed
	if (!game) { return false; }

	// Add systems

	// Adding the Window system
#if defined(DEBUG) | defined(_DEBUG)
	if (!AddSystem(new Window(WindowData(Singleton<WorldSettings>::GetInstance()->getWindowWidth(),
										 Singleton<WorldSettings>::GetInstance()->getWindowHeight(),
										 Singleton<WorldSettings>::GetInstance()->getWindowTitle()))))
		return false;
#else
	AddSystem(new Window(WindowData(Singleton<WorldSettings>::GetInstance()->getWindowWidth(),
									Singleton<WorldSettings>::GetInstance()->getWindowHeight(),
									Singleton<WorldSettings>::GetInstance()->getWindowTitle())));
#endif
	// Adding the Graphics system
#if defined(DEBUG) | defined(_DEBUG)
	if (!AddSystem(new Graphics(GraphicsData(GetSystem<Window>(SystemType::Sys_Window)))))
		return false;
#else
	AddSystem(new Graphics(GraphicsData(GetSystem<Window>(SystemType::Sys_Window))));
#endif
	// Adding the Engine Timer system
#if defined(DEBUG) | defined(_DEBUG)
	if (!AddSystem(new EngineTimer(EngineTimerData())))
		return false;
#else
	AddSystem(new EngineTimer(EngineTimerData()));
#endif
	// Adding the Game Logic Data system
#if defined(DEBUG) | defined(_DEBUG)
	if (!AddSystem(new GameLogic(GameLogicData())))
		return false;
#else
	AddSystem(new GameLogic(GameLogicData()));
#endif

	// Initialize the system

	// Window Init Block
#if defined(DEBUG) | defined(_DEBUG)
	if (!m_mapSystems[SystemType::Sys_Window]->Initialize())
		return false;
#else
	m_mapSystems[SystemType::Sys_Window]->Initialize();
#endif

		// Graphics Init Block
#if defined(DEBUG) | defined(_DEBUG)
		if (!m_mapSystems[SystemType::Sys_Graphics]->Initialize())
			return false;
#else
	m_mapSystems[SystemType::Sys_Graphics]->Initialize();
#endif

		// Engine Timer Init Block
#if defined(DEBUG) | defined(_DEBUG)
		if (!m_mapSystems[SystemType::Sys_EngineTimer]->Initialize())
			return false;
#else
	m_mapSystems[SystemType::Sys_EngineTimer]->Initialize();
#endif

		// Game Logic Init Block
#if defined(DEBUG) | defined(_DEBUG)
		if (!m_mapSystems[SystemType::Sys_Logic]->Initialize())
			return false;
#else
	m_mapSystems[SystemType::Sys_Logic]->Initialize();
#endif

	// Create the singleton of the graphics device manager
	Singleton<GraphicsDeviceManager>::CreateInstance();
	// Set that to the system we created
	Singleton<GraphicsDeviceManager>::GetInstance()->SetGraphics(GetSystem<Graphics>(SystemType::Sys_Graphics));

	return true;
}
Exemplo n.º 26
0
void Scene::CreateSystems()
{
	renderSystem = new RenderSystem();
    eventSystem = new EventSystem();

    if(SCENE_SYSTEM_STATIC_OCCLUSION_FLAG & systemsMask)
    {
        staticOcclusionSystem = new StaticOcclusionSystem(this);
        AddSystem(staticOcclusionSystem, (1 << Component::STATIC_OCCLUSION_DATA_COMPONENT), true);
    }

    if(SCENE_SYSTEM_TRANSFORM_FLAG & systemsMask)
    {
        transformSystem = new TransformSystem(this);
        AddSystem(transformSystem, (1 << Component::TRANSFORM_COMPONENT), true);
    }

    if(SCENE_SYSTEM_LOD_FLAG & systemsMask)
    {
        lodSystem = new LodSystem(this);
        AddSystem(lodSystem, (1 << Component::LOD_COMPONENT), true);
    }

    if(SCENE_SYSTEM_SWITCH_FLAG & systemsMask)
    {
        switchSystem = new SwitchSystem(this);
        AddSystem(switchSystem, (1 << Component::SWITCH_COMPONENT), true);
    }

    if(SCENE_SYSTEM_PARTICLE_EFFECT_FLAG & systemsMask)
    {
        particleEffectSystem = new ParticleEffectSystem(this);
        AddSystem(particleEffectSystem, (1 << Component::PARTICLE_EFFECT_COMPONENT), true);
    }

    if(SCENE_SYSTEM_SOUND_UPDATE_FLAG & systemsMask)
    {
        soundSystem = new SoundUpdateSystem(this);
        AddSystem(soundSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::SOUND_COMPONENT), true);
    }

    if(SCENE_SYSTEM_RENDER_UPDATE_FLAG & systemsMask)
    {
        renderUpdateSystem = new RenderUpdateSystem(this);
        AddSystem(renderUpdateSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::RENDER_COMPONENT), true);
    }

    if(SCENE_SYSTEM_UPDATEBLE_FLAG & systemsMask)
    {
        updatableSystem = new UpdateSystem(this);
        AddSystem(updatableSystem, (1 << Component::UPDATABLE_COMPONENT));
    }

    if(SCENE_SYSTEM_LIGHT_UPDATE_FLAG & systemsMask)
    {
        lightUpdateSystem = new LightUpdateSystem(this);
        AddSystem(lightUpdateSystem, (1 << Component::TRANSFORM_COMPONENT) | (1 << Component::LIGHT_COMPONENT));
    }

    if(SCENE_SYSTEM_ACTION_UPDATE_FLAG & systemsMask)
    {
        actionSystem = new ActionUpdateSystem(this);
        AddSystem(actionSystem, (1 << Component::ACTION_COMPONENT), true);
    }

    if(SCENE_SYSTEM_SKYBOX_FLAG & systemsMask)
    {
        skyboxSystem = new SkyboxSystem(this);
        AddSystem(skyboxSystem, (1 << Component::RENDER_COMPONENT), true);
    }

    if(SCENE_SYSTEM_MATERIAL_FLAG & systemsMask)
    {
        materialSystem = new MaterialSystem(this);
        AddSystem(materialSystem, (1 << Component::RENDER_COMPONENT));
    }

    if(SCENE_SYSTEM_DEBUG_RENDER_FLAG & systemsMask)
    {
        debugRenderSystem = new DebugRenderSystem(this);
        AddSystem(debugRenderSystem, (1 << Component::DEBUG_RENDER_COMPONENT), true);
    }
    
    if(SCENE_SYSTEM_FOLIAGE_FLAG & systemsMask)
    {
        foliageSystem = new FoliageSystem(this);
        AddSystem(foliageSystem, (1 << Component::RENDER_COMPONENT), true);
    }

    if(SCENE_SYSTEM_SPEEDTREE_UPDATE_FLAG & systemsMask)
    {
        speedTreeUpdateSystem = new SpeedTreeUpdateSystem(this);
        AddSystem(speedTreeUpdateSystem, (1 << Component::SPEEDTREE_COMPONENT), true);
    }

    if(SCENE_SYSTEM_WIND_UPDATE_FLAG & systemsMask)
    {
        windSystem = new WindSystem(this);
        AddSystem(windSystem, (1 << Component::WIND_COMPONENT), true);
    }

    if(SCENE_SYSTEM_WAVE_UPDATE_FLAG & systemsMask)
    {
        waveSystem = new WaveSystem(this);
        AddSystem(waveSystem, (1 << Component::WAVE_COMPONENT), true);
    }
}
Exemplo n.º 27
0
//-----------------------------------------------------------------------------
// Create all singleton systems
//-----------------------------------------------------------------------------
bool CSceneViewerApp::Create()
{
	if ( CommandLine()->FindParm( "-help" ) )
	{
		const bool newConsole( SetupWin32ConsoleIO() );

		Msg( "\n\n Sceneviewer - Loads and views Valve DMX Assets\n\n" );
		Msg( " Synopsis: sceneviewer [ vgui opts ] [ -help ] [ filename.[dmx|obj] ]\n" );
		Msg(
			"\n"
			" Where:\n"
			"\n"
			" Sceneviewer Options:\n"
			"\n"
			" -help . . . . . . Prints this information\n"
			" -nozoom . . . . . Stop sceneviewer zooming model viewer to occupy all client\n"
			"                   space when a dmx is specified on the command line\n"
			" -showasset  . . . Stop sceneviewer from hiding the asset builder when a dmx\n"
			"                   file is specified on the command line.\n"
			"  filename.dmx . . The name of a dmx file to load on start\n"
			"\n"
			" VGUI Options:\n"
			"\n"
			" -vproject <$> . . Override VPROJECT environment variable\n"
			" -game <$> . . . . Override VPROJECT environment variable\n"
			" -remote <$> . . . Add the remote share name\n"
			" -host <$> . . . . Set the host name\n"
			" -norfs  . . . . . Do not use remote filesystem\n"
			" -fullscreen . . . Run application fullscreen rather than in a window\n"
			" -width <#>  . . . Set the window width when running windowed\n"
			" -height <#> . . . Set the window height when running windowed\n"
			" -adapter <$>  . . Set the adapter??\n"
			" -ref  . . . . . . Set MATERIAL_INIT_REFERENCE_RASTERIZER on adapter??\n"
			" -resizing . . . . Allow the window to be resized\n"
			" -mat_vsync  . . . Wait for VSYNC\n"
			" -mat_antialias  . Turn on Anti-Aliasing\n"
			" -mat_aaquality  . Antialiasing quality (set to zero unless you know what you're doing)\n"
			"\n"
			);

		if ( newConsole )
		{
			Msg( "\n\nPress Any Key Continue..." );

			char tmpBuf[ 2 ];
			DWORD cRead;
			ReadConsole( GetStdHandle( STD_INPUT_HANDLE ), tmpBuf, 1, &cRead, NULL );
		}

		return false;
	}

	// FIXME: Enable vs30 shaders while NVidia driver bug exists
	CommandLine()->AppendParm( "-box", NULL );

	SpewOutputFunc( ModelBrowserSpewFunc );
	SpewActivate( "console", 1 );

	if ( !BaseClass::Create() )
		return false;

	AppSystemInfo_t appSystems[] = 
	{
		{ "vstdlib.dll",			PROCESS_UTILS_INTERFACE_VERSION },
		{ "studiorender.dll",		STUDIO_RENDER_INTERFACE_VERSION },
		{ "vphysics.dll",			VPHYSICS_INTERFACE_VERSION },
		{ "datacache.dll",			DATACACHE_INTERFACE_VERSION },
		{ "datacache.dll",			MDLCACHE_INTERFACE_VERSION },
		{ "p4lib.dll",				P4_INTERFACE_VERSION },
		{ "", "" }	// Required to terminate the list
	};

	AddSystem( g_pDataModel, VDATAMODEL_INTERFACE_VERSION );
	AddSystem( g_pDmElementFramework, VDMELEMENTFRAMEWORK_VERSION );
	AddSystem( g_pDmSerializers, DMSERIALIZERS_INTERFACE_VERSION );
	AddSystem( GetDefaultDmeMakefileUtils(), DMEMAKEFILE_UTILS_INTERFACE_VERSION );

	return AddSystems( appSystems );
}