void InstrumentEditorFactory::LoadPlugins() {
        if (!bPluginsLoaded) {
            dmsg(1,("Loading instrument editor plugins..."));
            // getenv() is available on Posix and Windows
            char* pcPluginDir = getenv("LINUXSAMPLER_PLUGIN_DIR");
            #if defined(WIN32)
            String installDir = Sampler::GetInstallDir();
            String pluginDir;
            if (pcPluginDir)
                pluginDir = pcPluginDir;
            if (pluginDir.empty())
                pluginDir = installDir + "\\plugins";

            // Put the LS installation directory first in DLL search
            // path, so the plugin finds for example the bundled GTK
            // libraries before any other installed versions
            if (!installDir.empty()) {
                // The SetDllDirectory function is only available on
                // XP and higher, so we call it dynamically
                HMODULE k32 = GetModuleHandleA("kernel32.dll");
                if (k32) {
                    BOOL WINAPI (*setDllDirectory)(LPCSTR) =
                        (BOOL WINAPI (*)(LPCSTR))GetProcAddress(k32, "SetDllDirectoryA");
                    if (setDllDirectory) {
                        setDllDirectory(installDir.c_str());
                    }
                }
            }

            if (pluginDir.empty() || !LoadPlugins(pluginDir)) {
                if (!LoadPlugins(CONFIG_PLUGIN_DIR)) {
                    std::cerr << "Could not open instrument editor plugins "
                              << "directory ('" << pluginDir << "' or '"
                              << CONFIG_PLUGIN_DIR << "'), Error: "
                              << GetLastError() << std::endl;
                    return;
                }
            }
            #else
            String dir;
            if (pcPluginDir)
                dir = pcPluginDir;
            if (dir.empty())
                dir = CONFIG_PLUGIN_DIR;
            if (!LoadPlugins(dir)) {
                std::cerr << "Could not open instrument editor plugins "
                          << "directory ('" << dir << "'): "
                          << strerror(errno) << std::endl;
                return;
            }
            #endif
            bPluginsLoaded = true;
            dmsg(1,("OK\n"));
        }
    }
//---------------------------------------------------------------------------
TMainManager::TMainManager()
{
	LoadPlugins(std::string("plugins"));
	ActivatePlugin("DataProcessor", "BaseDataProcessor");
	ActivatePlugin("RegProcessor", "BaseRegProcessor");
	ActivatePlugin("ObjProcessor", "BaseObjProcessor");
}
Beispiel #3
0
int SysInit() {
#if defined (CPU_LOG) || defined(DMA_LOG) || defined(CDR_LOG) || defined(HW_LOG) || \
	defined(BIOS_LOG) || defined(GTE_LOG) || defined(PAD_LOG)
	emuLog = fopen("/PSXISOS/emu.log", "w");
#endif
	Config.Cpu = dynacore;  //cpu may have changed  
	psxInit();
	LoadPlugins();
	if(OpenPlugins() < 0)
		return -1;
  
	//Init biosFile pointers and stuff
	if(biosDevice != BIOSDEVICE_HLE) {
		biosFile_dir = (biosDevice == BIOSDEVICE_SD) ? &biosDir_libfat_Default : &biosDir_libfat_USB;
		biosFile_readFile  = fileBrowser_libfat_readFile;
		biosFile_open      = fileBrowser_libfat_open;
		biosFile_init      = fileBrowser_libfat_init;
		biosFile_deinit    = fileBrowser_libfat_deinit;
		if(biosFile) {
    		free(biosFile);
	 	}
		biosFile = (fileBrowser_file*)memalign(32,sizeof(fileBrowser_file));
		memcpy(biosFile,biosFile_dir,sizeof(fileBrowser_file));
		strcat(biosFile->name, "/SCPH1001.BIN");
		biosFile_init(biosFile);  //initialize the bios device (it might not be the same as ISO device)
		Config.HLE = BIOS_USER_DEFINED;
	} else {
		Config.HLE = BIOS_HLE;
	}

	return 0;
}
Beispiel #4
0
	CRoot::CRoot(char *pluginName, char* logFileName)
	{
		s_Instance = this;

		m_pLogManager = new CLogManager;
		m_pLogManager->CreateLog(logFileName, true);

		// Archive Manager
		m_pArchiveManager = new CArchiveManager;
		m_pFileArchiveFactory = new CFileArchiveFactory;
		m_pArchiveManager->AddArchiveFactory(m_pFileArchiveFactory);
		m_pMpqArchiveFactory = new CMpqArchiveFactory;
		m_pArchiveManager->AddArchiveFactory(m_pMpqArchiveFactory);
		m_pZipArchiveFactory = new CZipArchiveFactory;
		m_pArchiveManager->AddArchiveFactory(m_pZipArchiveFactory);

		m_pResourceGroupManager = new CResourceGroupManager;
		m_pDynLibManager = new CDynLibManager;
		m_pSceneManager = new CSceneManager;
		m_pMdxMeshManager = new CMdxMeshManager;
		m_pCamera = new CCamera;
		m_pActiveRenderer = NULL;

		LoadPlugins(pluginName);
	}
Beispiel #5
0
void Transcode(CStdString &file)
{
	OrkLogManager::Instance()->Initialize();

	ObjectFactory::GetSingleton()->Initialize();

	ConfigManager::Instance()->Initialize();

	std::list<ACE_DLL> pluginDlls;
	LoadPlugins(pluginDlls);

	// Register in-built filters
	FilterRef filter(new AlawToPcmFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new UlawToPcmFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new GsmToPcmFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new IlbcToPcmFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new AudioGainFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new G722ToPcmFilter());
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new SpeexDecoder() );
	FilterRegistry::instance()->RegisterFilter(filter);
	filter.reset(new G721CodecDecoder());
	FilterRegistry::instance()->RegisterFilter(filter);
	
	// Register in-built tape processors and build the processing chain
	BatchProcessing::Initialize();
	Reporting::Initialize();
	TapeFileNaming::Initialize();

	if (!ACE_Thread_Manager::instance()->spawn(ACE_THR_FUNC(BatchProcessing::ThreadHandler)))
	{
		LOG4CXX_INFO(LOG.rootLog, CStdString("Failed to create batch processing thread"));
	}


	
	// Transmit the tape to the BatchProcessing
	CStdString ProcessorName("BatchProcessing");
	TapeProcessorRef bp = TapeProcessorRegistry::instance()->GetNewTapeProcessor(ProcessorName);
	CStdString portName("SinglePort");
	AudioTapeRef tape(new AudioTape(portName, file));
	bp->AddAudioTape(tape);
	
	// Make sure it stops after processing
	tape.reset();
	bp->AddAudioTape(tape);

	// Wait for completion
	while(!Daemon::Singleton()->IsStopping())
	{
		ACE_OS::sleep(1);
	}
}
Beispiel #6
0
PTPSoCTestJigInterface2::PTPSoCTestJigInterface2(QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
        LoadPlugins();
        Initialization();
        SignalsAndSlots();
        enableRichGUI();
}
Beispiel #7
0
int OpenPlugins() {
	int ret;

	while ((ret = _OpenPlugins()) == -2) {
		ReleasePlugins();
		if (LoadPlugins() == -1) return -1;
	}
	return ret;	
}
 std::vector<String> InstrumentEditorFactory::AvailableEditors() {
     // make sure plugins were loaded already
     LoadPlugins();
     // render result
     std::vector<String> result;
     std::map<String, InnerFactory*>::iterator iter = InnerFactories.begin();
     for (; iter != InnerFactories.end(); iter++)
         result.push_back(iter->first);
     return result;
 }
Beispiel #9
0
int OpenPlugins() {
	int ret;

	while ((ret = _OpenPlugins()) == -2) {
		ReleasePlugins();
		LoadMcds(Config.Mcd1, Config.Mcd2);
		if (LoadPlugins() == -1) return -1;
	}
	return ret;
}
Beispiel #10
0
int OpenPlugins(HWND hWnd, int internaliso) {
	int ret;

	while ((ret = _OpenPlugins(hWnd)) == -2) {
		ReleasePlugins();
		LoadMcds(Config.Mcd1, Config.Mcd2);
		if (LoadPlugins() == -1) return -1;
	}
	return ret;
}
Beispiel #11
0
void WINAPI CustomGetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
{
	if (!bLoadedPluginsYet)
	{
		// At the time this is called, the EXE is fully decrypted - we don't need any tricks from the ASI side
		LoadPlugins();
		bLoadedPluginsYet = true;
	}
	GetStartupInfoW(lpStartupInfo);
}
Beispiel #12
0
long Cx_PluginLoader::LoadPlugins(HMODULE instance, const wchar_t* path,
                                  const wchar_t* ext, bool recursive,
                                  bool enableDelayLoading)
{
    wchar_t fullpath[MAX_PATH];

    m_instance = instance;
    MakeFullPath(fullpath, instance, path);

    return LoadPlugins(fullpath, ext, recursive, enableDelayLoading);
}
Beispiel #13
0
// Loads all plugins and verifies them.
void PluginManager::Startup()
{
	// Let the user know we are loading plugins.
	hConsole::EnqueueMessage("INFO", "", "", true);
	hConsole::EnqueueMessage("INFO", "Plugins:", "", true);

	LoadPlugins();
	VerifyExports();
	VerifyOfficial();
	VerifyDependencies();
	PrintAuthorInfo();
}
 std::vector<String> InstrumentEditorFactory::MatchingEditors(String sTypeName, String sTypeVersion) {
     // make sure plugins were loaded already
     LoadPlugins();
     // render result
     std::vector<String> result;
     std::map<String, InnerFactory*>::iterator iter = InnerFactories.begin();
     for (; iter != InnerFactories.end(); iter++) {
         InstrumentEditor* pEditor = iter->second->Create();
         if (pEditor->IsTypeSupported(sTypeName, sTypeVersion))
             result.push_back(iter->first);
         iter->second->Destroy(pEditor);
     }
     return result;
 }
Beispiel #15
0
void Player::Start()
{
#if URHO3D_SYSTEMUI
    ui::GetIO().IniFilename = nullptr;              // Disable of imgui.ini creation,
#endif
#if URHO3D_CSHARP
    if (Script* script = GetSubsystem<Script>())    // Graceful failure when managed runtime support is present but not in use.
        script->LoadRuntime();
#endif

    GetCache()->AddResourceRouter(new BakedResourceRouter(context_));

    context_->RegisterSubsystem(new SceneManager(context_));

    ea::shared_ptr<JSONFile> projectFile(GetCache()->GetResource<JSONFile>("Project.json", false));
    if (!projectFile)
    {
        projectFile = new JSONFile(context_);
        if (!projectFile->LoadFile(ToString("%s%s", APK, "Project.json")))
        {
            ErrorExit("Project.json missing.");
            return;
        }
    }

    const JSONValue& projectRoot = projectFile->GetRoot();
    if (!projectRoot.Contains("plugins"))
    {
        ErrorExit("Project.json does not have 'plugins' section.");
        return;
    }

    const JSONValue& plugins = projectRoot["plugins"];
    if (!LoadPlugins(plugins))
        ErrorExit("Loading of required plugins failed.");

    for (auto& plugin : plugins_)
        plugin->Start();

    // Load main scene.
    {
        SceneManager* manager = GetSubsystem<SceneManager>();
        Scene* scene = manager->CreateScene();

        if (scene->LoadFile(projectRoot["default-scene"].GetString()))
            manager->SetActiveScene(scene);
        else
            ErrorExit("Invalid scene file.");
    }
}
Beispiel #16
0
int emuLoadRom( QString * romFile ){
    if( romFile->isEmpty()) return 0;
    SetIsoFile(romFile->toLatin1().data());
    if (psxInit() == -1) {
        printf("PSX emulator couldn't be initialized.\n");
        emuClose();
        return 0;
    }
    if (LoadPlugins() == -1) {
        printf("Failed loading plugins.\n");
        emuClose();
        return 0;
    }
    psxReset();
    return 1;
}
void PluginManager::findandload()
{
    if (pluginsDir == NULL){
        return;
    }
    vector<string> files;
    vector<string> pLibNames;

  // find all dlls in a folder specified by the pluginDir
  fLength = findDLLs(pluginsDir, files);
    if (fLength < 0){
        return;
    }
    // array of dll handlers
    pLib = new HAND[fLength];
  fLength = LoadDLLs(pluginsDir, files, pLibNames);
  LoadPlugins(pLibNames);
}
Beispiel #18
0
void OnOK(HWND hW) {
	char * biosFILE=GetSelBIOS(hW,IDC_LISTBIOS);

    if  (biosFILE==NULL) {
		MessageBox(hW,"BIOS not selected!","Error",MB_OK|MB_ICONERROR);
	}
	else
	{
		strcpy(Config.Bios, biosFILE);
	}

	SaveConfig();

	CleanUpCombos(hW);

	if (!ConfPlug) {
		NeedReset = 1;
		ReleasePlugins();
		LoadPlugins();
	}
	EndDialog(hW,TRUE);
}
Beispiel #19
0
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
{
	if (reason == DLL_PROCESS_ATTACH)
	{
		dllModule = hInst;
		hExecutableInstance = GetModuleHandle(NULL); // passing NULL should be safe even with the loader lock being held (according to ReactOS ldr.c)
		GetModuleFileName(dllModule, DllPath, MAX_PATH);
		DllName = strrchr(DllPath, '\\');
		SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, 0, szSystemPath);
		strcat(szSystemPath, DllName);

		int nForceEPHook = GetPrivateProfileInt("globalsets", "forceentrypointhook", FALSE, "scripts\\global.ini");

		if (hExecutableInstance && (_stricmp(DllName + 1, "vorbisFile.dll") == NULL || nForceEPHook != FALSE))
		{
			VorbisFile();
		}
		else
		{
			LoadPlugins();
			bLoadedPluginsYet = true;
		}
	}

	if (reason == DLL_PROCESS_DETACH)
	{
		FreeLibrary(dsound.dll);
		FreeLibrary(dinput8.dll);
		FreeLibrary(ddraw.dll);
		FreeLibrary(d3d8.dll);
		FreeLibrary(d3d9.dll);
		FreeLibrary(d3d11.dll);
		FreeLibrary(winmmbase.dll);
		FreeLibrary(msacm32.dll);
		MemoryFreeLibrary(vorbisHooked);
		MemoryFreeLibrary(wndmode);
	}
	return TRUE;
}
Beispiel #20
0
void InitMainWindow(HWND hwnd) {
	BOOL isUnicode = IsWindowUnicode(hwnd);
	if (isUnicode) {
		if (IsWindowClassW(hwnd, L"VirtualDub")) {
			g_hWndVDub = hwnd;
			__VDProjectUI_MainWndProcOrig = (WNDPROC)GetWindowLongPtrW(hwnd, GWLP_WNDPROC);
		}
	} else {
		if (IsWindowClassA(hwnd, "VirtualDub")) {
			g_hWndVDub = hwnd;
			__VDProjectUI_MainWndProcOrig = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
		}
	}
	if (g_hWndVDub) {

		LoadPlugins();

		if (!g_bAPIOverride) {
			HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(g_hWndVDub, GWLP_HINSTANCE);
			if (hInst) {
				if (WinAPIOverride32Init(hInst)) {
					LoadFakeAPIDefinitionArray(FakeApiInfos);
					g_bAPIOverride = true;
				}
			}
		}

		if (__VDProjectUI_MainWndProcOrig) {
			if (isUnicode)
				SetWindowLongPtrW(g_hWndVDub, GWLP_WNDPROC, (LONG)__VDProjectUI_MainWndProc);
			else
				SetWindowLongPtrA(g_hWndVDub, GWLP_WNDPROC, (LONG)__VDProjectUI_MainWndProc);
		}

		PostMessage(g_hWndVDub, WM_NULL, 0, 0);
	}
}
void TestStringTable::setUp()
{
	VERIFY(LoadPlugins(L"StringTable.plugin.dll, ConfigXml.plugin.dll LogManager.plugin.dll", false) >= 2);
}
Beispiel #22
0
int main (int argc, char** argv) {

    const bool USE_OPENCV_DISPLAY = false; // Use OpenCV or CImg for display?

    pI::BaseApplication app;
    pI::Runtime runtime (app.GetRuntime());
    LoadPlugins (app);

    // Creates and initializes all the necessary plugins.
    const int DeviceIndex = 0;
    const bool ShowRGB = true;

    // Freenect/GetVideoAndDepth returns both the RGB image and the depth map captured by a Kinect.
    boost::shared_ptr<pI::pIn> getImageAndDepth
        = app.SpawnAndInitialize (runtime,
                                  "Freenect/GetVideoAndDepth",
                                  DeviceIndex,
                                  ShowRGB ? 0 : 2,   // Video format: FREENECT_VIDEO_RGB or FREENECT_VIDEO_IR_8BIT
                                  0                  // Depth format: FREENECT_DEPTH_11BIT
                                 );
    pI::Arguments getImageAndDepth_in = getImageAndDepth->GetInputSignature(),
                  getImageAndDepth_out = getImageAndDepth->GetOutputSignature();

    // Freenect/SetTiltAndLED sets the tilt angle and LED status of a Kinect.
    boost::shared_ptr<pI::pIn> setTiltAndLED = app.SpawnAndInitialize (runtime, "Freenect/SetTiltAndLED", DeviceIndex);
    pI::Arguments setTiltAndLED_in = setTiltAndLED->GetInputSignature(),
                  setTiltAndLED_out = setTiltAndLED->GetOutputSignature();

    // Color/ApplyRGBPalette applies an arbitrary RGB palette onto a matrix
    boost::shared_ptr<pI::pIn> applyRGB (runtime.SpawnPlugin ("pIn/Color/ApplyRGBPalette"));
    pI::Arguments applyRGB_params = applyRGB->GetParameterSignature();

    pI::RGBPalette rgb (applyRGB_params[0]);
    rgb.SetCount (2048);

    std::map<size_t, uint32_t> freenect_glview_colors; // Coloring as used in Freenect's glview example
    freenect_glview_colors[0]    = (0xFFFFFF); // white
    freenect_glview_colors[256]  = (0xFF0000); // red
    freenect_glview_colors[512]  = (0xFFFF00); // yellow
    freenect_glview_colors[768]  = (0x00FF00); // green
    freenect_glview_colors[1024] = (0x00FFFF); // cyan
    freenect_glview_colors[1280] = (0x0000FF); // blue
    freenect_glview_colors[1536] = (0x000000); // black

    std::map<size_t, uint32_t> terrain; // Alternative coloring; names taken from http://en.wikipedia.org/wiki/List_of_colors
    terrain[0]     = (0xFFFFFF); // White
    terrain[256]   = (0x964B00); // Brown (traditional)
    terrain[512]   = (0xFBEC5D); // Maize
    terrain[768]   = (0x66FF00); // Bright green
    terrain[1024]  = (0x014421); // Forest green (traditional)
    terrain[1025]  = (0x87CEFA); // Light sky blue
    terrain[1280]  = (0x00008B); // Dark blue
    terrain[2047]  = (0x000000); // Black
    terrain[2048]  = (0x696969); // Dim gray

    ColorRamp ramp (terrain);

    for (int i = 0; i < 2048; i++) {
        float v = powf ( (i / 2048.), 3);
        uint16_t gamma = 9216 * v;

        uint32_t c = ramp.GetColor (gamma);
        rgb.SetR (i, red (c));
        rgb.SetG (i, green (c));
        rgb.SetB (i, blue (c));
    }

    applyRGB->Initialize (applyRGB_params);

    pI::Arguments applyRGB_in = applyRGB->GetInputSignature(),
                  applyRGB_out = applyRGB->GetOutputSignature();

    // OpenCV/Draw/Rectangle draws the inner rectangle.
    boost::shared_ptr<pI::pIn> drawRectImage = app.SpawnAndInitialize (runtime, "OpenCV/Draw/Rectangle");
    pI::Arguments drawRectImage_in = drawRectImage->GetInputSignature(),
                  drawRectImage_out = drawRectImage->GetOutputSignature();

    boost::shared_ptr<pI::pIn> drawRectDepth = app.SpawnAndInitialize (runtime, "OpenCV/Draw/Rectangle");
    pI::Arguments drawRectDepth_in = drawRectDepth->GetInputSignature(),
                  drawRectDepth_out = drawRectDepth->GetOutputSignature();

    // OpenCV/Draw/PutText draws a text string into an image.
    boost::shared_ptr<pI::pIn> puttext
        = app.SpawnAndInitialize (runtime,
                                  "OpenCV/Draw/PutText",
                                  0,                // font type: CV_FONT_HERSHEY_SIMPLEX
                                  pI_FALSE,         // render font italic: no
                                  0.75, 0.75,       // horizontal and vertical scale
                                  0.0,              // shear: no shear
                                  1,                // thickness of the text strokes: 1
                                  2                 // type of the line: CV_AA
                                 );
    pI::Arguments puttext_in = puttext->GetInputSignature(),
                  puttext_out = puttext->GetOutputSignature();

    // OpenCV/IO/SaveImage saves images to disk.
    boost::shared_ptr<pI::pIn> saveImage (runtime.SpawnPlugin ("OpenCV/IO/SaveImage"));
    saveImage->Initialize (saveImage->GetParameterSignature());
    pI::Arguments saveImage_in = saveImage->GetInputSignature(),
                  saveImage_out = saveImage->GetOutputSignature();

    // OpenCV/IO/ShowImage or CImg/Display displays the image and the depth map.
    boost::shared_ptr<pI::pIn> displayImage, displayDepth;

    if (USE_OPENCV_DISPLAY) {
        displayImage = app.SpawnAndInitialize (runtime, "OpenCV/IO/ShowImage",
                                               "RGB image window", false, 640, 480, 0, 0);
        displayDepth = app.SpawnAndInitialize (runtime, "OpenCV/IO/ShowImage",
                                               "Depth map window", false, 640, 480, 650, 0);
    } else {
        displayImage   = app.SpawnAndInitialize (runtime, "CImg/Display", pI_TRUE);
        displayDepth = app.SpawnAndInitialize (runtime, "CImg/Display", pI_TRUE);
    }

    pI::Arguments displayImage_in = displayImage->GetInputSignature(),
                  displayImage_out = displayImage->GetOutputSignature();

    pI::Arguments displayDepth_in = displayDepth->GetInputSignature(),
                  displayDepth_out = displayDepth->GetOutputSignature();


    // Now that all plugins are initialized, connect them.

    drawRectImage_in[0] = getImageAndDepth_out[0];
    pI::IntValue (drawRectImage_in[1]).SetData (310);
    pI::IntValue (drawRectImage_in[2]).SetData (230);
    pI::IntValue (drawRectImage_in[3]).SetData (330);
    pI::IntValue (drawRectImage_in[4]).SetData (250);
    pI::IntValue (drawRectImage_in[5]).SetData (255);
    pI::IntValue (drawRectImage_in[6]).SetData (255);
    pI::IntValue (drawRectImage_in[7]).SetData (255);
    pI::IntValue (drawRectImage_in[8]).SetData (1);
    pI::StringSelection (drawRectImage_in[9]).SetIndex (0);
    pI::IntValue (drawRectImage_in[10]).SetData (0);

    displayImage_in[0] = drawRectImage_in[0];

    pI::StringValue fileName (saveImage_in[0]);
    saveImage_in[1] = getImageAndDepth_out[0];

    applyRGB_in[0] =  getImageAndDepth_out[1];
    drawRectDepth_in[0] = applyRGB_out[0];
    pI::IntValue (drawRectDepth_in[1]).SetData (310);
    pI::IntValue (drawRectDepth_in[2]).SetData (230);
    pI::IntValue (drawRectDepth_in[3]).SetData (330);
    pI::IntValue (drawRectDepth_in[4]).SetData (250);
    pI::IntValue (drawRectDepth_in[5]).SetData (255);
    pI::IntValue (drawRectDepth_in[6]).SetData (255);
    pI::IntValue (drawRectDepth_in[7]).SetData (255);
    pI::IntValue (drawRectDepth_in[8]).SetData (1);
    pI::StringSelection (drawRectDepth_in[9]).SetIndex (0);
    pI::IntValue (drawRectDepth_in[10]).SetData (0);
    displayDepth_in[0] = drawRectDepth_in[0];

    pI::StringValue puttext_text (puttext_in[1]);
    pI::IntValue puttext_x (puttext_in[2]);
    pI::IntValue puttext_y (puttext_in[3]);
    pI::IntValue puttext_R (puttext_in[4]);
    pI::IntValue puttext_G (puttext_in[5]);
    pI::IntValue puttext_B (puttext_in[6]);
    pI::BoolValue puttext_do_draw (puttext_in[7]);

    puttext_in[0] = drawRectDepth_in[0];
    puttext_R.SetData (255);
    puttext_G.SetData (255);
    puttext_B.SetData (255);
    puttext_do_draw.SetData (pI_TRUE);

    puttext_x.SetData (285);
    puttext_y.SetData (272);

    // Executes getImageAndDepth and setTiltAndLED a first time to initialize Kinect.

    getImageAndDepth->Execute (getImageAndDepth_in, getImageAndDepth_out);

    pI::IntValue newTilt (setTiltAndLED_in[0]);
    pI::IntValue newLED (setTiltAndLED_in[1]);

    newTilt.SetData (0); // Tilt angle 0 degree
    newLED.SetData (1); // LED status Green

    setTiltAndLED->Execute (setTiltAndLED_in, setTiltAndLED_out);

    Poco::Timestamp now;

    bool doLoop = true;
    bool showDistance = false;

    try {
        while (doLoop) {
            while (!kbhit()) {

                // Get Depth and RGB data, ...
                getImageAndDepth->Execute (getImageAndDepth_in, getImageAndDepth_out);

                // ... apply depth to color image conversion, ...
                applyRGB->Execute (applyRGB_in, applyRGB_out);

                // ... draw a white rectangle into the center of both image and map, ...
                if (showDistance) {
                    drawRectImage->Execute (drawRectImage_in, drawRectImage_out);
                    drawRectDepth->Execute (drawRectDepth_in, drawRectDepth_out);
                }

                // ... and perhaps the result of distance measurement, ...
                double avgDistance = 0.;

                if (showDistance) {
                    pI::ShortMatrix depth (getImageAndDepth_out[1]);
                    double sumDistance = 0.;
                    int sumCount = 0;

                    for (int j = 230; j <= 250; ++j) {
                        for (int i = 310; i <= 330; ++i) {
                            int dep = depth.GetData (j, i);

                            if (dep < 2047) {
                                sumDistance += RawDepthToMeters (dep);
                                ++sumCount;
                            }
                        }
                    }

                    if (sumCount > 0) {
                        avgDistance = sumDistance / (double) sumCount;
                    }

                    char str[32];
                    sprintf (str, "%.2f m", avgDistance);
                    puttext_text.SetData (str);

                    puttext->Execute (puttext_in, puttext_out);
                }

                // ... and display both the image and the depth map.
                displayImage->Execute (displayImage_in, displayImage_out);
                displayDepth->Execute (displayDepth_in, displayDepth_out);

                std::cout << "Tilt " << (int) newTilt.GetData();
                std::cout << "; " << (1000000. / now.elapsed()) << " frames/sec          \r";

                now.update();
            }

            int ch = getch();

            switch (ch) {
            case 'q':
            case 'Q':
            case 27 /* ESC */:
                // Terminates
                newTilt.SetData (0); // Tilt angle 0 degree
                newLED.SetData (0); // LED status off

                setTiltAndLED->Execute (setTiltAndLED_in, setTiltAndLED_out);

                doLoop = false;
                break;

            case 'm':
            case 'M': // Measurement mode
                showDistance = !showDistance;
                break;

            case 's':
            case 'S': { // Takes snapshot

                std::string dateTime = Poco::DateTimeFormatter::format (Poco::LocalDateTime(), "%Y-%m-%d_%H-%M-%S");

                std::string name = std::string ("KinectImage_") + dateTime + std::string (".png");
                fileName.SetData (const_cast<char*> (name.c_str()));

                saveImage->Execute (saveImage_in);

                std::cout << "Saved " << name << std::endl;

                // HACK Experimental: saves PCL point cloud

                pI::ShortMatrix depth (getImageAndDepth_out[1]);
                int width = depth.GetCols();
                int height = depth.GetRows();

                pcl::PointCloud<pcl::PointXYZ> cloud;

                for (int j = 0; j < height; ++j) {
                    for (int i = 0; i < width; ++i) {
                        int dep = depth.GetData (j, i);

                        if (dep < 2048) {
                            cloud.push_back (DepthToWorld (i, j, dep));
                        }
                    }
                }

                name = std::string ("PointCloud_") + dateTime + std::string (".pcd");
                pcl::io::savePCDFileASCII (name, cloud);

                std::cout << "Saved " << name << std::endl;
            }
            break;
            case '+':
            case 'u':
            case 'U':
                //std::cout << std::endl << "Tilt: " << newTilt.GetData();
                newTilt.SetData (newTilt.GetData() + 1);
                //std::cout << " -> " << newTilt.GetData() << std::endl;
                setTiltAndLED->Execute (setTiltAndLED_in, setTiltAndLED_out);
                break;
            case '-':
            case 'd':
            case 'D':
                //std::cout << std::endl << "Tilt: " << newTilt.GetData();
                newTilt.SetData (newTilt.GetData() - 1);
                //std::cout << " -> " << newTilt.GetData() << std::endl;
                setTiltAndLED->Execute (setTiltAndLED_in, setTiltAndLED_out);
                break;
            default:
                break;
            }
        }
    } catch (pI::exception::ExecutionException& e) {
        std::cerr << e.what() << std::endl;
    }
}
	void CDatabaseOdbcMsSqlTest::DoLoadPlugins()
	{
		LoadPlugins( InitialiseSingletons(), false, false, false, true, false );
	}
Beispiel #24
0
extern "C" int __declspec(dllexport) Load(void)
{
	mir_getLP(&pluginInfo);

	YAMN_STATUS = ID_STATUS_OFFLINE;

	//	we get the Miranda Root Path
	PathToAbsoluteT( _T("."), szMirandaDir);

	// retrieve the current profile name
	CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName);	//not to pass entire array to fcn
	TCHAR *fc = _tcsrchr(ProfileName, '.');
	if ( fc != NULL ) *fc = 0;

	//	we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file
	GetProfileDirectory(UserDirectory, _countof(UserDirectory));

	// Enumerate all the code pages available for the System Locale
	EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
	CodePageNamesSupp = new _tcptable[CPLENSUPP];
	for (int i = 0, k = 0; i < CPLENALL; i++) {
		if (CodePageNamesAll[i].isValid) {
			CodePageNamesSupp[k] = CodePageNamesAll[i];
			k++;
	}	}

	// Registering YAMN as protocol
	PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
	pd.szName = YAMN_DBMODULE;
	pd.type = PROTOTYPE_VIRTUAL;
	Proto_RegisterModule(&pd);

	InitializeCriticalSection(&AccountStatusCS);
	InitializeCriticalSection(&FileWritingCS);
	InitializeCriticalSection(&PluginRegCS);

	if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL)))
		return 1;
	if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
		return 1;
	if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL)))
		return 1;

	PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0);
	PosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0);
	SizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800);
	SizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200);

	HeadPosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0);
	HeadPosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0);
	HeadSizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690);
	HeadSizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300);
	HeadSplitPos = db_get_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250);

	optDateTime = db_get_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);

	// Create new window queues for broadcast messages
	YAMNVar.MessageWnds = WindowList_Create();
	YAMNVar.NewMailAccountWnd = WindowList_Create();
	YAMNVar.Shutdown = FALSE;

	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);

#ifdef _DEBUG
	InitDebug();
#endif

	CreateServiceFunctions();

	SkinAddNewSoundEx(YAMN_NEWMAILSOUND, YAMN_DBMODULE, YAMN_NEWMAILSNDDESC);
	SkinAddNewSoundEx(YAMN_CONNECTFAILSOUND, YAMN_DBMODULE, YAMN_CONNECTFAILSNDDESC);

	HookEvents();

	LoadIcons();
	LoadPlugins();

	HOTKEYDESC hkd = {0};
	hkd.cbSize = sizeof(hkd);
	hkd.pszName = "YAMN_hotkey";
	hkd.pszService = MS_YAMN_FORCECHECK;
	hkd.pszSection = YAMN_DBMODULE;
	hkd.pszDescription = LPGEN("Check mail");
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11);
	Hotkey_Register(&hkd);

	//Create thread that will be executed every second
	if (!(SecTimer = SetTimer(NULL, 0, 1000, TimerProc)))
		return 1;

	return 0;
}
Beispiel #25
0
int main(int argc, char **argv)
{
	if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "-h")))) {
		PrintHelp();
		return 0;
	}

	emu_core_preinit();
	ChangeWorkingDirectory("c");
	char file[MAXPATHLEN] = "";
	char path[MAXPATHLEN];
	const char *cdfile = NULL;
	int loadst = 0;
	int i;
	int getst = -1;
	int discNumber = 0;

	g_menuscreen_w = 800;
	g_menuscreen_h = 480;

	strcpy(Config.Gpu, "builtin_gpu");
	strcpy(Config.Spu, "builtin_spu");
	strcpy(Config.BiosDir, "/home/user/MyDocs");
	strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
	snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
	Config.PsxAuto = 1;
	pl_rearmed_cbs.frameskip = -1;
	strcpy(Config.Bios, "HLE");
    iUseReverb = 0;
    iUseInterpolation = 0;

	in_type1 = PSE_PAD_TYPE_STANDARD;
	in_type2 = PSE_PAD_TYPE_STANDARD;

	accelOptions.sens     = 150;
	accelOptions.y_def	  = 500;
	accelOptions.maxValue = 500.0;

	// read command line options
	for (i = 1; i < argc; i++) {
		     if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
		else if (!strcmp(argv[i], "-cdfile")) {
			char isofilename[MAXPATHLEN];
			if (i+1 >= argc) break;
			strncpy(isofilename, argv[++i], MAXPATHLEN);
			if (isofilename[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, isofilename);
					strcpy(isofilename, path);
				} else
					isofilename[0] = 0;
			}
			cdfile = isofilename;
		}
		else if (!strcmp(argv[i],"-frameskip")) {
			int tv_reg = atol(argv[++i]);
			if (tv_reg < -1)
				pl_rearmed_cbs.frameskip = -1;
			else
				pl_rearmed_cbs.frameskip = tv_reg;
		}
		else if (!strcmp(argv[i],"-region")) {
			int psx_reg = atol(argv[++i]);
			if (psx_reg == 0 || psx_reg == 1){
				Config.PsxAuto = 0;
				Config.PsxType = psx_reg;
			}
		}

		else if (!strcmp(argv[i],"-get_sstatename")) getst = atol(argv[++i]);

		else if (!strcmp(argv[i], "-fullscreen"))	        g_maemo_opts |= 2;
		else if (!strcmp(argv[i], "-accel"))				g_maemo_opts |= 4;
		else if (!strcmp(argv[i], "-nosound"))		        strcpy(Config.Spu, "spunull.so");
		else if (!strcmp(argv[i], "-bdir"))			sprintf(Config.BiosDir, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-pdir"))			        sprintf(Config.PluginsDir, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-bios"))			sprintf(Config.Bios, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-gles"))			        { strcpy(Config.Gpu, "gpu_gles.so"); g_maemo_opts |= 8 ;}
		else if (!strcmp(argv[i], "-oldgpu"))		        strcpy(Config.Gpu, "gpu_peops.so");
		else if (!strcmp(argv[i], "-unai"))		            strcpy(Config.Gpu, "gpu_unai.so");
		else if (!strcmp(argv[i], "-cdda"))		Config.Cdda = 1;
		else if (!strcmp(argv[i], "-xa"))		Config.Xa = 1;
		else if (!strcmp(argv[i], "-rcnt"))		Config.RCntFix = 1 ;
		else if (!strcmp(argv[i], "-sio"))		Config.Sio = 1;
		else if (!strcmp(argv[i], "-spuirq"))	Config.SpuIrq = 1;
		else if (!strcmp(argv[i], "-vsync"))	Config.VSyncWA = 1;
		else if (!strcmp(argv[i], "-fps")) 		            g_opts |=OPT_SHOWFPS;
		else if (!strcmp(argv[i], "-cpu")) 		            g_opts |=OPT_SHOWCPU;
		else if (!strcmp(argv[i], "-spu")) 		            g_opts |=OPT_SHOWSPU;
		else if (!strcmp(argv[i], "-nofl")) 		        g_opts |=OPT_NO_FRAMELIM;
		else if (!strcmp(argv[i], "-mcd1")) 	            sprintf(Config.Mcd1, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-mcd2")) 	            sprintf(Config.Mcd2, "%s", argv[++i]);

		else if (!strcmp(argv[i], "-cpuclock")) 	        cycle_multiplier = 10000 / atol(argv[++i]);
		else if (!strcmp(argv[i], "-guncon")) 	            in_type1 = PSE_PAD_TYPE_GUNCON;
		else if (!strcmp(argv[i], "-gunnotrigger")) 		g_opts |= OPT_TSGUN_NOTRIGGER;
		else if (!strcmp(argv[i], "-analog")) 	            in_type1 = PSE_PAD_TYPE_ANALOGPAD;
		else if (!strcmp(argv[i], "-vibration")) 	        { in_type1 = PSE_PAD_TYPE_ANALOGPAD; in_enable_vibration = 1; }
		else if (!strcmp(argv[i], "-sens")) 				accelOptions.sens = atol(argv[++i]);
		else if (!strcmp(argv[i], "-ydef")) 				accelOptions.y_def = atol(argv[++i]);
		else if (!strcmp(argv[i], "-max")) 				    accelOptions.maxValue = atol(argv[++i]);
		else if (!strcmp(argv[i], "-displayon")) 		    bKeepDisplayOn = TRUE;
		else if (!strcmp(argv[i], "-keys")) 				sprintf(keys_config_file, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-autosave")) 		    bAutosaveOnExit = TRUE;
		else if (!strcmp(argv[i], "-disc")) 		        discNumber = atol(argv[++i]);
		else if (!strcmp(argv[i], "-corners")){
			int j = 0;
			i++;
			char num[2];
			for (j=0; j<strlen(argv[i]); j++){
				strncpy(num, argv[i] + j, 1);
				cornerActions[j] = atoi(num);
			}
	}

		else if (!strcmp(argv[i], "-spu_reverb"))           { if (atol(argv[++i]) > 0) iUseReverb = 2; }
		else if (!strcmp(argv[i], "-spu_interpolation")) 	iUseInterpolation = atol(argv[++i]);

		else if (!strcmp(argv[i],"-interlace")) {
			int interlace = atol(argv[++i]);
			if (interlace >= 0 && interlace <= 2)
				pl_rearmed_cbs.gpu_neon.allow_interlace = interlace;
		}
		else if (!strcmp(argv[i], "-enhance")) 			pl_rearmed_cbs.gpu_neon.enhancement_enable = 1;
		else if (!strcmp(argv[i], "-enhancehack")) 		pl_rearmed_cbs.gpu_neon.enhancement_no_main = 1;

		else if (!strcmp(argv[i], "-gles_dithering")) 	pl_rearmed_cbs.gpu_peopsgl.bDrawDither = atol(argv[++i]);
		else if (!strcmp(argv[i], "-gles_mask")) 	    pl_rearmed_cbs.gpu_peopsgl.iUseMask = atol(argv[++i]);
		else if (!strcmp(argv[i], "-gles_filtering")) 	pl_rearmed_cbs.gpu_peopsgl.iFilterType = atol(argv[++i]);
		else if (!strcmp(argv[i], "-gles_fbtex")) 	    pl_rearmed_cbs.gpu_peopsgl.iFrameTexType = atol(argv[++i]);
		else if (!strcmp(argv[i], "-gles_vram")) 	    pl_rearmed_cbs.gpu_peopsgl.iVRamSize = atol(argv[++i]);
		else if (!strcmp(argv[i], "-gles_fastmdec")) 	pl_rearmed_cbs.gpu_peopsgl.bUseFastMdec = atol(argv[++i]);
        else if (!strcmp(argv[i], "-gles_advblend")) 	pl_rearmed_cbs.gpu_peopsgl.bAdvancedBlend = atol(argv[++i]);
        else if (!strcmp(argv[i], "-gles_opaque")) 	    pl_rearmed_cbs.gpu_peopsgl.bOpaquePass = atol(argv[++i]);

		else {
			fprintf(stderr, "Unknown option: %s\n", argv[i]);
			return 1;
		}
	}
	
	pl_init();
	if (emu_core_init() == -1)
		return 1;
	
	if (cdfile) {
		set_cd_image(cdfile);
		strcpy(file_name, strrchr(cdfile,'/'));
	}

	if (LoadPlugins() == -1) {
		SysMessage("Failed loading plugins!");
		return 1;
	}

	if (discNumber > 0)
		cdrIsoMultidiskSelect = discNumber - 1;

	if (OpenPlugins() == -1) {
		return 1;
	}
	plugin_call_rearmed_cbs();

	CheckCdrom();

	if (getst >= 0){
		char fname[MAXPATHLEN];

		get_state_filename(fname, sizeof(fname), getst);
		printf("SAVESTATE: %s\n", fname);
		if (cdrIsoMultidiskCount > 1){
			int i = 0;
			for (i=1; i<cdrIsoMultidiskCount; i++){
				cdrIsoMultidiskSelect = i;
				CdromId[0] = '\0';
				CdromLabel[0] = '\0';

				CDR_close();
				if (CDR_open() == 0){
					CheckCdrom();
					get_state_filename(fname, sizeof(fname), getst);
					printf("SAVESTATE: %s\n", fname);
				}
			}
		}
		return 0;
	}

	SysReset();

	if (file[0] != '\0') {
		if (Load(file) != -1)
			ready_to_go = 1;
	} else {
		if (cdfile) {
			if (LoadCdrom() == -1) {
				ClosePlugins();
				printf(_("Could not load CD-ROM!\n"));
				return -1;
			}
			emu_on_new_cd(0);
			ready_to_go = 1;
		}
	}

	if (!ready_to_go) {
		printf ("something goes wrong, maybe you forgot -cdfile ? \n");
		return 1;
	}

	if (cdrIsoMultidiskCount > 1)
		printf ("Loaded a multidisc image: %i discs.\n", cdrIsoMultidiskCount);

	// If a state has been specified, then load that
	if (loadst) {
		int ret = emu_load_state(loadst - 1);
		printf("%s state %d\n", ret ? "Failed to load" : "Loaded", loadst);
		state_slot = loadst - 1;
	}

	if (maemo_init(&argc, &argv))
		return 1;

	if (GPU_open != NULL) {
		int ret = GPU_open(&gpuDisp, "PCSX", NULL);
		if (ret){
			fprintf(stderr, "Warning: GPU_open returned %d\n", ret);
			gpuDisp=ret;
		}
	}

	if (Config.HLE)
		printf("Note: running without BIOS, expect compatibility problems\n");

	dfinput_activate();
	pl_timing_prepare(Config.PsxType);

	while (1)
	{
		stop = 0;
		emu_action = SACTION_NONE;

		psxCpu->Execute();
		if (emu_action != SACTION_NONE)
			do_emu_action();
	}

	maemo_finish();
	return 0;
}
Beispiel #26
0
int main(int argc, char *argv[]) {
	char file[MAXPATHLEN] = "";
	char path[MAXPATHLEN];
	int runcd = RUN;
	int loadst = 0;
	int i;

#ifdef ENABLE_NLS
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	memset(&Config, 0, sizeof(PcsxConfig));

	// what is the name of the config file?
	// it may be redefined by -cfg on the command line
	strcpy(cfgfile_basename, "pcsxr.cfg");

	// read command line options
	for (i = 1; i < argc; i++) {
		if (!strcmp(argv[i], "-runcd")) runcd = RUN_CD;
		else if (!strcmp(argv[i], "-nogui")) UseGui = FALSE;
		else if (!strcmp(argv[i], "-psxout")) Config.PsxOut = TRUE;
		else if (!strcmp(argv[i], "-slowboot")) Config.SlowBoot = TRUE;
		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
		else if (!strcmp(argv[i], "-cfg")) {
			if (i+1 >= argc) break;
			strncpy(cfgfile_basename, argv[++i], MAXPATHLEN-100);	/* TODO buffer overruns */
			printf("Using config file %s.\n", cfgfile_basename);
		}
		else if (!strcmp(argv[i], "-cdfile")) {
			char isofilename[MAXPATHLEN];

			if (i+1 >= argc) break;
			strncpy(isofilename, argv[++i], MAXPATHLEN);
			if (isofilename[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, isofilename);
					strcpy(isofilename, path);
				} else
					isofilename[0] = 0;
			}

			SetIsoFile(isofilename);
			runcd = RUN_CD;
		}
		else if (!strcmp(argv[i], "-h") ||
			 !strcmp(argv[i], "-help") ||
			 !strcmp(argv[i], "--help")) {
			 printf(PACKAGE_STRING "\n");
			 printf("%s\n", _(
							" pcsxr [options] [file]\n"
							"\toptions:\n"
							"\t-runcd\t\tRuns CD-ROM\n"
							"\t-cdfile FILE\tRuns a CD image file\n"
							"\t-nogui\t\tDon't open the GTK GUI\n"
							"\t-cfg FILE\tLoads desired configuration file (default: ~/.pcsxr/pcsxr.cfg)\n"
							"\t-psxout\t\tEnable PSX output\n"
							"\t-slowboot\tEnable BIOS Logo\n"
							"\t-load STATENUM\tLoads savestate STATENUM (1-9)\n"
							"\t-h -help\tDisplay this message\n"
							"\tfile\t\tLoads file\n"));
			 return 0;
		} else {
			strncpy(file, argv[i], MAXPATHLEN);
			if (file[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, file);
					strcpy(file, path);
				} else
					file[0] = 0;
			}
		}
	}

	strcpy(Config.Net, "Disabled");

	if (UseGui) gtk_init(NULL, NULL);

	CheckSubDir();
	ScanAllPlugins();

	// try to load config
	// if the config file doesn't exist
	if (LoadConfig() == -1) {
		if (!UseGui) {
			printf(_("PCSXR cannot be configured without using the GUI -- you should restart without -nogui.\n"));
			return 1;
		}

		// Uh oh, no config file found, use some defaults
		Config.PsxAuto = 1;

		gchar *str_bios_dir = g_strconcat(getenv("HOME"), BIOS_DIR, NULL);
		strcpy(Config.BiosDir, str_bios_dir);
		g_free(str_bios_dir);

		gchar *str_plugin_dir = g_strconcat(getenv("HOME"), PLUGINS_DIR, NULL);
		strcpy(Config.PluginsDir, str_plugin_dir);
		g_free(str_plugin_dir);

		gtk_init(NULL, NULL);

		// Update available plugins, but not GUI
		UpdatePluginsBIOS();

		// Pick some defaults, if they're available
		set_default_plugin(GpuConfS.plist[0], Config.Gpu);
		set_default_plugin(SpuConfS.plist[0], Config.Spu);
		set_default_plugin(CdrConfS.plist[0], Config.Cdr);
		set_default_plugin(Pad1ConfS.plist[0], Config.Pad1);
		set_default_plugin(Pad2ConfS.plist[0], Config.Pad2);
		set_default_plugin(BiosConfS.plist[0], Config.Bios);

		// create & load default memcards if they don't exist
		CreateMemcard("card1.mcd", Config.Mcd1);
		CreateMemcard("card2.mcd", Config.Mcd2);

		LoadMcds(Config.Mcd1, Config.Mcd2);

		SaveConfig();
	}

	gchar *str_patches_dir = g_strconcat(getenv("HOME"), PATCHES_DIR, NULL);
	strcpy(Config.PatchesDir,  str_patches_dir);
	g_free(str_patches_dir);

	// switch to plugin dotdir
	// this lets plugins work without modification!
	gchar *plugin_default_dir = g_build_filename(getenv("HOME"), PLUGINS_DIR, NULL);
	chdir(plugin_default_dir);
	g_free(plugin_default_dir);

	if (UseGui && runcd != RUN_CD) SetIsoFile(NULL);

	if (SysInit() == -1) return 1;

	if (UseGui && runcd != RUN_CD) {
		StartGui();
	} else {
		// the following only occurs if the gui isn't started
		if (LoadPlugins() == -1) {
			SysErrorMessage(_("Error"), _("Failed loading plugins!"));
			return 1;
		}

		if (OpenPlugins() == -1 || plugins_configured() == FALSE) {
			return 1;
		}

		CheckCdrom();

		// Auto-detect: get region first, then rcnt-bios reset
		SysReset();

		if (file[0] != '\0') {
			Load(file);
		} else {
			if (runcd == RUN_CD) {
				if (LoadCdrom() == -1) {
					ClosePlugins();
					printf(_("Could not load CD-ROM!\n"));
					return -1;
				}
			}
		}

		// If a state has been specified, then load that
		if (loadst) {
			StatesC = loadst - 1;
			gchar *state_filename = get_state_filename(StatesC);
			LoadState(state_filename);
			g_free(state_filename);
		}

		psxCpu->Execute();
	}

	return 0;
}
Beispiel #27
0
int main(int argc, char *argv[])
{
	char file[MAXPATHLEN] = "";
	char path[MAXPATHLEN];
	const char *cdfile = NULL;
	const char *loadst_f = NULL;
	int psxout = 0;
	int loadst = 0;
	int i;

	emu_core_preinit();

	// read command line options
	for (i = 1; i < argc; i++) {
		     if (!strcmp(argv[i], "-psxout")) psxout = 1;
		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
		else if (!strcmp(argv[i], "-cfg")) {
			if (i+1 >= argc) break;
			strncpy(cfgfile_basename, argv[++i], MAXPATHLEN-100);	/* TODO buffer overruns */
			SysPrintf("Using config file %s.\n", cfgfile_basename);
		}
		else if (!strcmp(argv[i], "-cdfile")) {
			char isofilename[MAXPATHLEN];

			if (i+1 >= argc) break;
			strncpy(isofilename, argv[++i], MAXPATHLEN);
			if (isofilename[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, isofilename);
					strcpy(isofilename, path);
				} else
					isofilename[0] = 0;
			}

			cdfile = isofilename;
		}
		else if (!strcmp(argv[i], "-loadf")) {
			if (i+1 >= argc) break;
			loadst_f = argv[++i];
		}
		else if (!strcmp(argv[i], "-h") ||
			 !strcmp(argv[i], "-help") ||
			 !strcmp(argv[i], "--help")) {
			 printf("PCSX-ReARMed " REV "\n");
			 printf("%s\n", _(
							" pcsx [options] [file]\n"
							"\toptions:\n"
							"\t-cdfile FILE\tRuns a CD image file\n"
							"\t-cfg FILE\tLoads desired configuration file (default: ~/.pcsx/pcsx.cfg)\n"
							"\t-psxout\t\tEnable PSX output\n"
							"\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
							"\t-h -help\tDisplay this message\n"
							"\tfile\t\tLoads a PSX EXE file\n"));
			 return 0;
		} else {
			strncpy(file, argv[i], MAXPATHLEN);
			if (file[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, file);
					strcpy(file, path);
				} else
					file[0] = 0;
			}
		}
	}

	if (cdfile)
		set_cd_image(cdfile);

	// frontend stuff
	// init input but leave probing to platform code,
	// they add input drivers and may need to modify them after probe
	in_init();
	pl_init();
	plat_init();
	menu_init(); // loads config

	if (emu_core_init() != 0)
		return 1;

	if (psxout)
		Config.PsxOut = 1;

	if (LoadPlugins() == -1) {
		// FIXME: this recovery doesn't work, just delete bad config and bail out
		// SysMessage("could not load plugins, retrying with defaults\n");
		set_default_paths();
		snprintf(path, sizeof(path), "." PCSX_DOT_DIR "%s", cfgfile_basename);
		remove(path);
		SysMessage("Failed loading plugins!");
		return 1;
	}
	pcnt_hook_plugins();

	if (OpenPlugins() == -1) {
		return 1;
	}
	plugin_call_rearmed_cbs();

	CheckCdrom();
	SysReset();

	if (file[0] != '\0') {
		if (Load(file) != -1)
			ready_to_go = 1;
	} else {
		if (cdfile) {
			if (LoadCdrom() == -1) {
				ClosePlugins();
				SysPrintf(_("Could not load CD-ROM!\n"));
				return -1;
			}
			emu_on_new_cd(!loadst);
			ready_to_go = 1;
		}
	}

	if (loadst_f) {
		int ret = LoadState(loadst_f);
		SysPrintf("%s state file: %s\n",
			ret ? "failed to load" : "loaded", loadst_f);
		ready_to_go |= ret == 0;
	}

	if (ready_to_go) {
		menu_prepare_emu();

		// If a state has been specified, then load that
		if (loadst) {
			int ret = emu_load_state(loadst - 1);
			SysPrintf("%s state %d\n",
				ret ? "failed to load" : "loaded", loadst);
		}
	}
	else
		menu_loop();

	pl_start_watchdog();

	while (!g_emu_want_quit)
	{
		stop = 0;
		emu_action = SACTION_NONE;

		psxCpu->Execute();
		if (emu_action != SACTION_NONE)
			do_emu_action();
	}

	printf("Exit..\n");
	ClosePlugins();
	SysClose();
	menu_finish();
	plat_finish();

	return 0;
}
Beispiel #28
0
int main(int argc, char **argv)
{
	char file[MAXPATHLEN] = "";
	char path[MAXPATHLEN];
	const char *cdfile = NULL;
	int loadst = 0;
	int i;

	emu_core_preinit();
	ChangeWorkingDirectory("c");

	strcpy(Config.BiosDir, "/home/user/MyDocs");
	strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
	snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
	Config.PsxAuto = 1;

	g_menuscreen_w = 800;
	g_menuscreen_h = 480;

	pl_init();

	emu_core_init();

	// read command line options
	for (i = 1; i < argc; i++) {
		     if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
		else if (!strcmp(argv[i], "-cdfile")) {
			char isofilename[MAXPATHLEN];
			if (i+1 >= argc) break;
			strncpy(isofilename, argv[++i], MAXPATHLEN);
			if (isofilename[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, isofilename);
					strcpy(isofilename, path);
				} else
					isofilename[0] = 0;
			}
			cdfile = isofilename;
		}
		else if (!strcmp(argv[i],"-frameskip")) {
			int tv_reg = atol(argv[++i]);
			if (tv_reg > 0)
				pl_rearmed_cbs.frameskip = -1;
		}
		else if (!strcmp(argv[i],"-fullscreen"))		g_maemo_opts |= 2;
		else if (!strcmp(argv[i],"-accel"))				g_maemo_opts |= 4;
		else if (!strcmp(argv[i],"-nosound"))		strcpy(Config.Spu, "spunull.so");
		else if (!strcmp(argv[i], "-bdir"))			sprintf(Config.BiosDir, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-bios"))			sprintf(Config.Bios, "%s", argv[++i]);
		else if (!strcmp(argv[i], "-gles"))			strcpy(Config.Gpu, "gpuGLES.so");
		else if (!strcmp(argv[i], "-cdda"))		Config.Cdda = 1;
		else if (!strcmp(argv[i], "-xa"))		Config.Xa = 1;
		else if (!strcmp(argv[i], "-rcnt"))		Config.RCntFix = 1 ;
		else if (!strcmp(argv[i], "-sio"))		Config.Sio = 1;
		else if (!strcmp(argv[i], "-spuirq"))	Config.SpuIrq = 1;
		else if (!strcmp(argv[i], "-vsync"))	Config.VSyncWA = 1;
	}

	hildon_init(&argc, &argv);
	
	if (cdfile) {
		set_cd_image(cdfile);
		strcpy(file_name, strrchr(cdfile,'/'));
	}

	if (LoadPlugins() == -1) {
		SysMessage("Failed loading plugins!");
		return 1;
	}

	if (OpenPlugins() == -1) {
		return 1;
	}
	plugin_call_rearmed_cbs();

	CheckCdrom();
	SysReset();

	if (file[0] != '\0') {
		if (Load(file) != -1)
			ready_to_go = 1;
	} else {
		if (cdfile) {
			if (LoadCdrom() == -1) {
				ClosePlugins();
				printf(_("Could not load CD-ROM!\n"));
				return -1;
			}
			emu_on_new_cd(0);
			ready_to_go = 1;
		}
	}

	if (!ready_to_go) {
		printf ("something goes wrong, maybe you forgot -cdfile ? \n");
		return 1;
	}

	// If a state has been specified, then load that
	if (loadst) {
		int ret = emu_load_state(loadst - 1);
		printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
	}

	maemo_init(&argc, &argv);

	if (GPU_open != NULL) {
		int ret = GPU_open(&gpuDisp, "PCSX", NULL);
		if (ret)
			fprintf(stderr, "Warning: GPU_open returned %d\n", ret);
	}

	dfinput_activate();
	pl_timing_prepare(Config.PsxType);

	while (1)
	{
		stop = 0;
		emu_action = SACTION_NONE;

		psxCpu->Execute();
		if (emu_action != SACTION_NONE)
			do_emu_action();
	}

	return 0;
}
Beispiel #29
0
NAMESPACE_BEGIN

Renderer::Renderer(const String& basePath, const String& prefPath,
                   Input* inputMgr, const String& windowTitle)
    : mInputMgr(inputMgr),
      mWindow(nullptr),
	  mLogManager(nullptr),
	  mLog(nullptr),
	  mRoot(nullptr),
      mSceneManager(nullptr),
	  mRootNode(nullptr),
      mRenderWindow(nullptr),
      mViewport(nullptr),
      mDefaultCamera(nullptr),
      mRaySceneQuery(nullptr),
	  mRenderSystemPlugin(nullptr),
	  mParticleUniversePlugin(nullptr),
      mRTRoot(nullptr),
      mRTRootPosition(Position::origin)
{
    // Read config file
    Vec2i displayMode = Config::Get<Vec2i>("displaymode", Vec2i(1280, 800));
    bool fullscreen = Config::Get<bool>("fullscreen", false);
    bool vsync = Config::Get<bool>("vsync", true);

    // Set up Ogre's log manager
    mLogManager = new Ogre::LogManager();
    mLog = mLogManager->createLog(prefPath + "ogre.log", true, false, false);

    // Create the Ogre root
    mRoot = new Ogre::Root("", "");
    LOG << "Created Ogre Root";
    LOG << "\tVersion: " << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "."
                << OGRE_VERSION_PATCH << " " << OGRE_VERSION_NAME;

    // PLUGIN STAGE
    LoadPlugins();

    // Set the render system to the first available renderer
    if (mRoot->getAvailableRenderers().empty())
    {
        // TODO: THIS SHOULD NEVER HAPPEN
        assert(0);
    }
    mRoot->setRenderSystem(mRoot->getAvailableRenderers().front());

    // WINDOW CREATION STAGE

    // Window options
    Ogre::NameValuePairList options;
    options["vsync"] = vsync ? "true" : "false";
    options["gamma"] = "true";
    options["title"] = windowTitle;
    CreateSDLWindow(windowTitle, displayMode, fullscreen, options);

    // Initialise Ogre and use the SDL window
    mRoot->initialise(false, "", "");
    mRenderWindow = mRoot->createRenderWindow(windowTitle, displayMode.x, displayMode.y, fullscreen, &options);
    mRenderWindow->setVisible(true);

    // OGRE IS NOW READY, SET UP THE SCENE
	InitResources(basePath);
    InitScene();

    // Set up the raycast query object
    mRaySceneQuery = mSceneManager->createRayQuery(Ogre::Ray(), Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
    mRaySceneQuery->setSortByDistance(true);
    mRaySceneQuery->setQueryMask(UNIVERSE_OBJECT);

    // Set up the deferred shading system
    mDeferredShadingMgr = new DeferredShadingManager(mViewport, mSceneManager);

    // Set up post processing
    mHDRComp = Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "HDR");
    mBlurComp = Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "GaussianBlur");
    mHDRComp->setEnabled(true);
    //mBlurComp->setEnabled(true);

    // Set up the sprite manager
    mSpriteManager = new SpriteManager(mViewport, mSceneManager);

    // Set up the root scene nodes
    mRootNode = mSceneManager->getRootSceneNode();
    mRTRoot = mRootNode->createChildSceneNode();

    // Add event delegates
    ADD_LISTENER(Renderer, EvtData_KeyDown);
}
Beispiel #30
0
BOOL CDuffDlg::OnInitDialog()
{
CResizableDialog::OnInitDialog();


	// Add "About..." menu item to system menu.
	/*
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);


	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}
*/
	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

 m_CurrentTaskText.SetWindowText( StringFromResource(IDS_STATUS_IDLE)  );



 m_hAccel = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR));
 if (!m_hAccel)
	{
		AfxMessageBox(IDS_MSGBOX_ACCELERATOR_LOAD_ERROR_TEXT, MB_OK | MB_ICONEXCLAMATION);
	}

//HWND phWnd;
//GetDlgItem(IDC_PROPERTYSHEET,&phWnd);

//m_PropertySheet.Attach(phWnd);
 m_PropertySheet.EnableStackedTabs(FALSE);
	m_PropertySheet.AddPage(&m_LayerPage);
 m_PropertySheet.AddPage(&m_DirectoryPage);
	m_PropertySheet.AddPage(&m_FileFilterPage);
 m_PropertySheet.AddPage(&m_DuplicatePage);
 m_PropertySheet.AddPage(&m_SelectionPage);
 m_PropertySheet.AddPage(&m_ProcessPage);
 m_PropertySheet.AddPage(&m_StatusLogPage);
 m_PropertySheet.AddPage(&m_OptionsPage);
#ifdef _DEBUG
 m_PropertySheet.AddPage(&m_DebugPage);
#endif


		m_PropertySheet.Create(this, WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE, 0);

	m_PropertySheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
	m_PropertySheet.ModifyStyle( 0, WS_TABSTOP );

 // property sheet fix
 m_PropertySheet.SetActivePage(0);
 m_PropertySheet.SetActivePage(1);
 m_PropertySheet.SetActivePage(2);
	m_PropertySheet.SetActivePage(3);
	m_PropertySheet.SetActivePage(4);
 m_PropertySheet.SetActivePage(5);
 m_PropertySheet.SetActivePage(6);
 m_PropertySheet.SetActivePage(7);
#ifdef _DEBUG
 m_PropertySheet.SetActivePage(8);
#endif
 m_PropertySheet.SetActivePage(0);
	//

m_TabImageList.Create( IDB_TABIMAGES, 13, 1, RGB(255,0,255) );
m_PropertySheet.GetTabControl()->SetImageList(&m_TabImageList);

TC_ITEM tcItem;
	tcItem.mask = TCIF_IMAGE;
	for( int i = 0; i < 8; i++ )
	{
		tcItem.iImage = i;
		m_PropertySheet.GetTabControl()->SetItem( i, &tcItem );
	}


 // preset resize layout
	AddAnchor(IDC_EXIT, BOTTOM_RIGHT);
	AddAnchor(IDC_START, BOTTOM_RIGHT);
	AddAnchor(IDC_STOP, BOTTOM_RIGHT);
	AddAnchor(IDC_PAUSE, BOTTOM_RIGHT);
	AddAnchor(IDC_ANIMATE_CONTROL, BOTTOM_RIGHT);
	AddAnchor(IDC_STATUS, BOTTOM_RIGHT);
	AddAnchor(IDC_STATIC_CURRENT_TASK, BOTTOM_LEFT);
	AddAnchor(IDC_STATIC_TASK_INFO, BOTTOM_LEFT);
	AddAnchor(IDC_STATIC_SUBPREGRESS1, BOTTOM_LEFT);
	AddAnchor(IDC_STATIC_SUBPROGRESS2, BOTTOM_LEFT);
	AddAnchor(IDC_STATIC_PROGRESS_ENTIRE, BOTTOM_LEFT);
	AddAnchor(IDC_PROPERTYSHEET, TOP_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_TASK_INFO,  BOTTOM_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_CURRENT_TASK,  BOTTOM_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_PROGRESS_ENTIRE, BOTTOM_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_PROGRESS_SUB_2, BOTTOM_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_PROGRESS_SUB_1, BOTTOM_LEFT,BOTTOM_RIGHT);
	AddAnchor(IDC_SUBRANGE2, BOTTOM_RIGHT);
	AddAnchor(IDC_SUBRANGE1, BOTTOM_RIGHT);
	AddAnchor(IDC_RANGE_ENTIRE, BOTTOM_RIGHT);
 //



//
//this->ShowSizeGrip(FALSE);

 m_PropertySheet.Resize();

//	CRect rcSheet;
	//GetDlgItem( IDC_PROPERTYSHEET )->GetWindowRect( &rcSheet );
	//ScreenToClient( &rcSheet );
//	m_PropertySheet.SetWindowPos( NULL, rcSheet.left-7, rcSheet.top-7, 0, 0, 	SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );

// g_DupeFileFind.SetDuffDlg(this);

 // load plugins
	Log( StringFromResource(IDS_LOADING_PLUGINS) );
	LoadPlugins();
	Log( StringFromResource(IDS_FINISHED_LOADING_PLUGINS) );
	//

	m_bAnimateControl = m_AnimateControl.Open(StringFromResource(IDS_ANIMATION_FILENAME)) != 0;
	Log( StringFromResource(m_bAnimateControl ? IDS_ANIMATE_CONTROL_LOADED : IDS_ANIMATE_CONTROL_NOT_LOADED) );


	// not in use
	/*
	for (i = 0; i < g_DuffObjects.GetSize(); i++)
	{
		g_DuffObjects.ElementAt(i)->LoadSettings();
	}
 */



	return TRUE;  // return TRUE  unless you set the focus to a control
}