Beispiel #1
0
void Map::initializeOverlays()
{
    ResourceManager *resman = ResourceManager::getInstance();

    for (int i = 0;
         hasProperty("overlay" + toString(i) + "image");
         i++)
    {
        const std::string name = "overlay" + toString(i);

        Image *img = resman->getImage(getProperty(name + "image"));
        const float speedX = getFloatProperty(name + "scrollX");
        const float speedY = getFloatProperty(name + "scrollY");
        const float parallax = getFloatProperty(name + "parallax");
        const bool keepRatio = getBoolProperty(name + "keepratio");

        if (img)
        {
            mOverlays.push_back(
                    new AmbientOverlay(img, parallax, speedX, speedY, keepRatio));

            // The AmbientOverlay takes control over the image.
            img->decRef();
        }
    }
}
void PCIDeviceStub_XHCIMux::configWrite32(IOPCIAddressSpace space, UInt8 offset, UInt32 data)
{
    UInt32 deviceInfo = super::configRead32(space, kIOPCIConfigVendorID);
    DebugLog("[%04x:%04x] XHCIMux::configWrite32 address space(0x%08x, 0x%02x) data: 0x%08x\n",
             deviceInfo & 0xFFFF, deviceInfo >> 16, space.bits, offset, data);

    UInt32 newData = data;
    switch (offset)
    {
        case kXHCI_PCIConfig_PR2:
        {
            if (getBoolProperty(kPR2Block, false))
            {
                AlwaysLog("[%04x:%04x] XHCIMux::configWrite32 address space(0x%08x, 0x%02x) data: 0x%08x blocked\n",
                          deviceInfo & 0xFFFF, deviceInfo >> 16, space.bits, offset, data);
                return;
            }
            UInt32 mask;
            if (getBoolProperty(kPR2HonorPR2M, true))
                mask = super::configRead32(super::space, kXHCI_PCIConfig_PR2M);
            else
                mask = getUInt32Property(kPR2ChipsetMask);
            newData = super::configRead32(space, kXHCI_PCIConfig_PR2);
            newData &= ~mask;
            newData |= getUInt32Property(kPR2Force) & mask;
        }
            break;

        case kXHCI_PCIConfig_PR2M:
        {
            if (getBoolProperty(kPR2MBlock, false))
            {
                AlwaysLog("[%04x:%04x] XHCIMux::configWrite32 address space(0x%08x, 0x%02x) data: 0x%08x blocked\n",
                          deviceInfo & 0xFFFF, deviceInfo >> 16, space.bits, offset, data);
                return;
            }
        }
Beispiel #3
0
void Map::initializeAmbientLayers()
{
    ResourceManager *resman = ResourceManager::getInstance();

    // search for "foreground*" or "overlay*" (old term) in map properties
    for (int i = 0; /* terminated by a break */; i++)
    {
        std::string name;
        if (hasProperty("foreground" + toString(i) + "image"))
        {
            name = "foreground" + toString(i);
        }
        else if (hasProperty("overlay" + toString(i) + "image"))
        {
            name = "overlay" + toString(i);
        }
        else
        {
            break; // the FOR loop
        }

        Image *img = resman->getImage(getProperty(name + "image"));
        const float speedX = getFloatProperty(name + "scrollX");
        const float speedY = getFloatProperty(name + "scrollY");
        const float parallax = getFloatProperty(name + "parallax");
        const bool keepRatio = getBoolProperty(name + "keepratio");

        if (img)
        {
            mForegrounds.push_back(
                    new AmbientLayer(img, parallax, speedX, speedY, keepRatio));

            // The AmbientLayer takes control over the image.
            img->decRef();
        }
    }


    // search for "background*" in map properties
    for (int i = 0;
         hasProperty("background" + toString(i) + "image");
         i++)
    {
        const std::string name = "background" + toString(i);

        Image *img = resman->getImage(getProperty(name + "image"));
        const float speedX = getFloatProperty(name + "scrollX");
        const float speedY = getFloatProperty(name + "scrollY");
        const float parallax = getFloatProperty(name + "parallax");
        const bool keepRatio = getBoolProperty(name + "keepratio");

        if (img)
        {
            mBackgrounds.push_back(
                    new AmbientLayer(img, parallax, speedX, speedY, keepRatio));

            // The AmbientLayer takes control over the image.
            img->decRef();
        }
    }
}
Beispiel #4
0
void Map::initializeAmbientLayers()
{
    ResourceManager *const resman = ResourceManager::getInstance();

    // search for "foreground*" or "overlay*" (old term) in map properties
    for (int i = 0; /* terminated by a break */; i++)
    {
        std::string name;
        if (hasProperty(std::string("foreground").append(
            toString(i)).append("image")))
        {
            name = "foreground" + toString(i);
        }
        else if (hasProperty(std::string("overlay").append(
                 toString(i)).append("image")))
        {
            name = "overlay" + toString(i);
        }
        else
        {
            break;  // the FOR loop
        }

        Image *const img = resman->getImage(getProperty(name + "image"));
        if (img)
        {
            int mask = atoi(getProperty(name + "mask").c_str());
            if (!mask)
                mask = 1;
            const float parallax = getFloatProperty(name + "parallax");
            mForegrounds.push_back(new AmbientLayer(img,
                getFloatProperty(name + "parallaxX", parallax),
                getFloatProperty(name + "parallaxY", parallax),
                getFloatProperty(name + "posX"),
                getFloatProperty(name + "posY"),
                getFloatProperty(name + "scrollX"),
                getFloatProperty(name + "scrollY"),
                getBoolProperty(name + "keepratio"),
                mask));

            // The AmbientLayer takes control over the image.
            img->decRef();
        }
    }

    // search for "background*" in map properties
    for (int i = 0; hasProperty(std::string("background").append(
         toString(i)).append("image")); i ++)
    {
        const std::string name("background" + toString(i));
        Image *const img = resman->getImage(getProperty(name + "image"));

        if (img)
        {
            int mask = atoi(getProperty(name + "mask").c_str());
            if (!mask)
                mask = 1;

            const float parallax = getFloatProperty(name + "parallax");
            mForegrounds.push_back(new AmbientLayer(img,
                getFloatProperty(name + "parallaxX", parallax),
                getFloatProperty(name + "parallaxY", parallax),
                getFloatProperty(name + "posX"),
                getFloatProperty(name + "posY"),
                getFloatProperty(name + "scrollX"),
                getFloatProperty(name + "scrollY"),
                getBoolProperty(name + "keepratio"),
                mask));

            // The AmbientLayer takes control over the image.
            img->decRef();
        }
    }
}