コード例 #1
0
ファイル: GSDevice11.cpp プロジェクト: Alchemistxxd/pcsx2
//Included an init function for this also. Just to be safe.
void GSDevice11::InitExternalFX()
{
	if (!ExShader_Compiled)
	{
		try {
			std::string config_name(theApp.GetConfigS("shaderfx_conf"));
			std::ifstream fconfig(config_name);
			std::stringstream shader;
			if (fconfig.good())
				shader << fconfig.rdbuf() << "\n";
			else
				fprintf(stderr, "GSdx: External shader config '%s' not loaded.\n", config_name.c_str());

			std::string shader_name(theApp.GetConfigS("shaderfx_glsl"));
			std::ifstream fshader(shader_name);
			if (fshader.good())
			{
				shader << fshader.rdbuf();
				CompileShader(shader.str().c_str(), shader.str().length(), shader_name.c_str(), D3D_COMPILE_STANDARD_FILE_INCLUDE, "ps_main", nullptr, &m_shaderfx.ps);
			}
			else
			{
				fprintf(stderr, "GSdx: External shader '%s' not loaded and will be disabled!\n", shader_name.c_str());
			}
		}
		catch (GSDXRecoverableError) {
			printf("GSdx: failed to compile external post-processing shader. \n");
		}
		ExShader_Compiled = true;
	}
}
コード例 #2
0
ファイル: disk.c プロジェクト: balr0g/cw
/****************************************************************************
 * config_disk_format
 ****************************************************************************/
static cw_bool_t
config_disk_format(
	struct config			*cfg,
	struct disk_track		*dsk_trk)

	{
	cw_char_t			token[GLOBAL_MAX_NAME_SIZE];
	struct format_desc		*fmt_dsc;

	fmt_dsc = format_search_desc(config_name(cfg, "format name expected", token, sizeof (token)));
	if (fmt_dsc == NULL) config_error(cfg, "unknown format '%s'", token);
	if (! disk_set_format(dsk_trk, fmt_dsc)) debug_error();
	return (CW_BOOL_OK);
	}
コード例 #3
0
ファイル: disk.c プロジェクト: balr0g/cw
/****************************************************************************
 * config_disk_trackmap
 ****************************************************************************/
static cw_bool_t
config_disk_trackmap(
	struct config			*cfg,
	struct disk			*dsk)

	{
	cw_char_t			token[GLOBAL_MAX_NAME_SIZE];
	struct trackmap			*trm;

	trm = trackmap_search(config_name(cfg, "trackmap name expected", token, sizeof (token)));
	if (trm == NULL) config_error(cfg, "unknown trackmap name '%s'", token);
	if (! disk_set_trackmap(dsk, trm)) debug_error();
	return (CW_BOOL_OK);
	}
コード例 #4
0
ファイル: disk.c プロジェクト: balr0g/cw
/****************************************************************************
 * config_disk_image
 ****************************************************************************/
static cw_bool_t
config_disk_image(
	struct config			*cfg,
	struct disk			*dsk)

	{
	cw_char_t			token[GLOBAL_MAX_NAME_SIZE];
	struct image_desc		*img_dsc;

	img_dsc = image_search_desc(config_name(cfg, "image name expected", token, sizeof (token)));
	if (img_dsc == NULL) config_error(cfg, "unknown image name '%s'", token);
	if (! disk_set_image(dsk, img_dsc)) debug_error();
	return (CW_BOOL_OK);
	}
コード例 #5
0
ファイル: disk.c プロジェクト: balr0g/cw
/****************************************************************************
 * config_disk_copy
 ****************************************************************************/
static cw_bool_t
config_disk_copy(
	struct config			*cfg,
	struct disk			*dsk)

	{
	cw_char_t			token[GLOBAL_MAX_NAME_SIZE];
	struct disk			*dsk2;

	dsk2 = disk_search(config_name(cfg, "disk name expected", token, sizeof (token)));
	if (dsk2 == NULL) config_error(cfg, "unknown disk name '%s'", token);
	if (! disk_copy(dsk, dsk2)) debug_error();
	return (CW_BOOL_OK);
	}
コード例 #6
0
ファイル: disk.c プロジェクト: balr0g/cw
/****************************************************************************
 * config_disk
 ****************************************************************************/
cw_bool_t
config_disk(
	struct config			*cfg,
	cw_count_t			revision)

	{
	cw_char_t			token[GLOBAL_MAX_NAME_SIZE];
	struct disk			dsk;

	disk_init(&dsk, revision);
	config_name(cfg, "disk name expected", token, sizeof (token));
	if (! disk_set_name(&dsk, token)) config_error(cfg, "already defined disk '%s' within this scope", token);
	config_disk_directive(cfg, &dsk, disk_init_track_default(&dsk), NULL, SCOPE_ENTER | SCOPE_TRACK | SCOPE_RW);
	if (! disk_tracks_used(&dsk)) config_error(cfg, "no tracks used in disk '%s'", token);
	if (! disk_image_ok(&dsk)) config_error(cfg, "specified format and image do not have the same level in disk '%s'", token);
	if (! disk_trackmap_ok(&dsk)) config_error(cfg, "trackmap incomplete or illegal use of side_offset or flip_side in disk '%s'", token);
	if (! disk_trackmap_numbering_ok(&dsk)) config_error(cfg, "image_track numbering in trackmap not compatible with selected image format in disk '%s'", token);
	disk_insert(&dsk);
	return (CW_BOOL_OK);
	}
コード例 #7
0
bool PSDualShock4Controller::open(
    const DeviceEnumerator *enumerator)
{
    const ControllerDeviceEnumerator *pEnum = static_cast<const ControllerDeviceEnumerator *>(enumerator);

    const char *cur_dev_path = pEnum->get_path();
    bool success = false;

    if (getIsOpen())
    {
        SERVER_LOG_WARNING("PSDualShock4Controller::open") << "PSDualShock4Controller(" << cur_dev_path << ") already open. Ignoring request.";
        success = true;
    }
    else
    {
        char cur_dev_serial_number[256];

        SERVER_LOG_INFO("PSDualShock4Controller::open") << "Opening PSDualShock4Controller(" << cur_dev_path << ")";

        if (pEnum->get_serial_number(cur_dev_serial_number, sizeof(cur_dev_serial_number)))
        {
            SERVER_LOG_INFO("PSDualShock4Controller::open") << "  with serial_number: " << cur_dev_serial_number;
        }
        else
        {
            cur_dev_serial_number[0] = '\0';
            SERVER_LOG_INFO("PSDualShock4Controller::open") << "  with EMPTY serial_number";
        }

        // Attempt to open the controller 
		HIDDetails.vendor_id = pEnum->get_vendor_id();
		HIDDetails.product_id = pEnum->get_product_id();
        HIDDetails.Device_path = cur_dev_path;
        HIDDetails.Handle = hid_open_path(HIDDetails.Device_path.c_str());

        if (HIDDetails.Handle != nullptr)  // Controller was opened and has an index
        {             
            // Don't block on hid report requests
            hid_set_nonblocking(HIDDetails.Handle, 1);

            /* -USB or Bluetooth Device-

                On my Mac, using bluetooth,
                cur_dev->path = Bluetooth_054c_03d5_779732e8
                cur_dev->serial_number = 00-06-f7-97-32-e8
                On my Mac, using USB,
                cur_dev->path = USB_054c_03d5_14100000
                cur_dev->serial_number = "" (not null, just empty)

                On my Windows 10 box (different controller), using bluetooth
                cur_dev->path = \\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002054c_pid&05c4#8&217a4584&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                cur_dev->serial_number = 1c666d2c8deb
                Using USB
                cur_dev->path = \\?\hid#vid_054c&pid_03d5&col01#6&7773e57&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
                cur_dev->serial_number = (null)
            */

            // Bluetooth connected
            if (strlen(cur_dev_serial_number) > 0)
            {
                IsBluetooth = true;

                // Convert the serial number into a normalized bluetooth address of the form: "xx:xx:xx:xx:xx:xx"
                char szNormalizedControllerAddress[18];
                ServerUtility::bluetooth_cstr_address_normalize(
                    cur_dev_serial_number, true, ':',
                    szNormalizedControllerAddress, sizeof(szNormalizedControllerAddress));

                // Save the controller address as a std::string
                HIDDetails.Bt_addr = std::string(szNormalizedControllerAddress);

				// Get the (possibly cached) bluetooth address of the first bluetooth adapter
				if (!bluetooth_get_host_address(HIDDetails.Host_bt_addr))
				{
					HIDDetails.Host_bt_addr= "00:00:00:00:00:00";
				}

                success = true;
            }
            // USB Connected
            else
            {
                IsBluetooth = false;
                
                // Fetch the bluetooth host and controller addresses via USB HID report request
                success = getBTAddressesViaUSB(HIDDetails.Host_bt_addr, HIDDetails.Bt_addr);

                if (!success)
                {
                    // If serial is still bad, maybe we have a disconnected
                    // controller still showing up in hidapi
                    SERVER_LOG_ERROR("PSDualShock4Controller::open") << "Failed to get bluetooth address of PSDualShock4Controller(" << cur_dev_path << ")";
                }
            }

            if (success)
            {
                // Build a unique name for the config file using bluetooth address of the controller
                char szConfigSuffix[18];
                ServerUtility::bluetooth_cstr_address_normalize(
                    HIDDetails.Bt_addr.c_str(), true, '_',
                    szConfigSuffix, sizeof(szConfigSuffix));

                std::string config_name("dualshock4_");
                config_name += szConfigSuffix;

                // Load the config file
                cfg = PSDualShock4ControllerConfig(config_name);
                cfg.load();

				// Save it back out again in case any defaults changed
				cfg.save();
            }

            // Reset the polling sequence counter
            NextPollSequenceNumber = 0;

            // Write out the initial controller state
            if (success && IsBluetooth)
            {
                bWriteStateDirty= true;
                writeDataOut();
            }
        }
        else
        {
            SERVER_LOG_ERROR("PSDualShock4Controller::open") << "Failed to open PSDualShock4Controller(" << cur_dev_path << ")";
            success = false;
        }
    }

    return success;
}