Exemplo n.º 1
0
Arquivo: ppu.cpp Projeto: zoibot/knes
PPU::PPU(Machine *mach, wxWindow* wind) {
    this->mach = mach;
    this->wind = wind;
    screen.Create(256, 240);
    screen_data = screen.GetData();
    vaddr = 0;
    taddr = next_taddr = false;
    obj_addr = 0;
    mem = new byte[0x4000];
    obj_mem = new byte[0x100];
    cycle_count = 0;
    odd_frame = false;
    last_nmi = 0;
    vbl_off = 0;
    nmi_occurred = false;
    a12high = false;
    horiz_scroll = vert_scroll = false;
    sl = -2;
    cyc = 0;
    pmask = 0;
    pctrl = 0;
    pstat = 0;
    last_vblank_end = last_vblank_start = 0;
    memset(mem, 0xff, 0x4000);
    memset(obj_mem, 0xff, 0x100);
    mirror_table = new word[0x4000];
    for(int i = 0; i < 0x4000; i++)
        mirror_table[i] = i;
    set_mirror(0x3000, 0x2000, 0xf00);
    if(mach->rom->flags6 & 8) {
        cout << "4 screen!!!!" << endl;
    }
    current_mirroring = FOUR_SCREEN;
    set_mirroring(mach->rom->mirror);
}
Exemplo n.º 2
0
/* Set status of additional camera capabilities */
static int gc0329_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
	struct gc0329_priv *priv = to_gc0329(sd);
	struct i2c_client *client =
			(struct i2c_client *) v4l2_get_subdevdata(sd);

	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
		priv->flag_vflip = ctrl->value;
		return set_flip(client, priv->flag_vflip);
		break;
	case V4L2_CID_HFLIP:
		priv->flag_hflip = ctrl->value;
		PDBG("set H-FLIP:%d\n", priv->flag_hflip);
		return set_mirror(client, priv->flag_hflip);
		break;
	case V4L2_CID_BRIGHTNESS:
		if (ctrl->value < -4 || ctrl->value > 4) {
			return -EINVAL;
		}
                priv->brightness = ctrl->value;
		return set_brightness(client, priv->brightness);
                break;
	case V4L2_CID_CONTRAST:
		if (ctrl->value < -3 || ctrl->value > 3) {
			return -EINVAL;
		}
                priv->contrast = ctrl->value;
		return set_contrast(client, priv->contrast);
                break;
	case V4L2_CID_SATURATION:
		if (ctrl->value < -3 || ctrl->value > 3) {
			return -EINVAL;
		}
                priv->sat = ctrl->value;
		return set_sat(client, priv->sat);
                break;
	case V4L2_CID_CAMERA_SPECIAL_EFFECT:
		if (ctrl->value < 0 || ctrl->value > 8) {
			return -EINVAL;
		}
                priv->effect = ctrl->value;
		return set_effect(client, priv->effect);
                break;
	case V4L2_CID_DO_WHITE_BALANCE:
		if (ctrl->value < 0 || ctrl->value > 4) {
			return -EINVAL;
		}
                priv->wh_bal = ctrl->value;
		return set_wh_bal(client, priv->wh_bal);
                break;
	default:
		return -EINVAL;
	}

	return 0;
}
Exemplo n.º 3
0
ppu::ppu(rom& romi, int res) : cart(romi), screen(1), scroll_shifts(0), frame(0) {
    if(screen.dummy) {
        dummy = true;
    }
    else {
        dummy = false;
    }
    //cout<<"Start ppu constructor"<<endl;
    //cout<<"\tRes: "<<res<<endl;
    //cout<<"End ppu constructor"<<endl<<endl;
    s.cycles = 0;
    s.reads = 0;
    s.twok2_reads = 0;
    s.writes = 0;
    s.dmas = 0;
    s.reads_during_render = 0;
    s.writes_during_render = 0;
    frame = 0;
    cleared_vsync = false;
    late_vsync_clear = false;
    spr_overflow_cycle = -1;
    spr_hit0_cycle = -1;
    recalc_overflow = true;
    recalc_s0 = true;
    table_view = false;
    init_scroll_x = init_scroll_y = 0;
    cycles_per_frame = CLK_PER_LINE * LINE_PER_FRAME;

    set_mirror(cart.get_mode());

    for(int i=0; i < 0x20; ++i)
        pal[i] = &(palette[i]);
    pal[0x10] = &(palette[0]);
    pal[0x14] = &(palette[4]);
    pal[0x18] = &(palette[8]);
    pal[0x1C] = &(palette[0x0c]);

    //tile_cache[table#][tile#][pal#][hflip][vflip]
    //        SDL_Surface * tile_cache[2][256][8][2][2];
    for(int table = 0; table < 2; ++table) {
        for(int tile = 0; tile < 256; ++tile) {
            for(int palette = 0; palette < 8; ++palette) {
                for(int hflip = 0; hflip < 2; ++hflip) {
                    for(int vflip = 0; vflip < 2; ++vflip) {
                        tile_cache[table][tile][palette][hflip][vflip] = NULL;
                    }
                }
            }
        }
    }
}
Exemplo n.º 4
0
/* Start/Stop streaming from the device */
static int gc0309_s_stream(struct v4l2_subdev *sd, int enable)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    struct gc0309_priv *priv = to_gc0309(sd);
    int ret = 0;

    /* Program orientation register. */
    ret = set_flip(client, priv->flag_vflip);
    if (ret < 0)
        return ret;

    ret = set_brightness(client, priv->brightness);
    if (ret < 0)
        return ret;

    ret = set_contrast(client, priv->contrast);
    if (ret < 0)
        return ret;

    ret = set_sat(client, priv->sat);
    if (ret < 0)
        return ret;

    ret = set_effect(client, priv->effect);
    if (ret < 0)
        return ret;

    ret = set_wh_bal(client, priv->wh_bal);
    if (ret < 0)
        return ret;

    ret = set_mirror(client, priv->flag_hflip);
    if (ret < 0)
        return ret;

    if (enable) {
        PDBG("Enabling Streaming\n");
        /* Start Streaming */
        ret = gc0309_write(client, 0x25, 0x0f);
        if (ret)
            goto out;
        
    } else {
        PDBG( "Disabling Streaming\n");
        
        ret = gc0309_write(client, 0x25, 0x00);
    }

out:
    return ret;
}
Exemplo n.º 5
0
/* Start/Stop streaming from the device */
static int gc0329_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct gc0329_priv *priv = to_gc0329(sd);
	int ret = 0;
	u8 val;

	/* Program orientation register. */
	ret = set_flip(client, priv->flag_vflip);
	if (ret < 0)
		return ret;

	ret = set_brightness(client, priv->brightness);
	if (ret < 0)
		return ret;

	ret = set_contrast(client, priv->contrast);
	if (ret < 0)
		return ret;

	ret = set_sat(client, priv->sat);
	if (ret < 0)
		return ret;

	ret = set_effect(client, priv->effect);
	if (ret < 0)
		return ret;

	ret = set_wh_bal(client, priv->wh_bal);
	if (ret < 0)
		return ret;

	ret = set_mirror(client, priv->flag_hflip);
	if (ret < 0)
		return ret;

	if (enable) {
		dev_dbg(&client->dev, "Enabling Streaming\n");
		/* Start Streaming */
	} else {
		dev_dbg(&client->dev, "Disabling Streaming\n");
	}



out:
	return ret;
}
Exemplo n.º 6
0
static int gc0311_s_stream(struct v4l2_subdev *sd, int enable)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    struct gc0311_priv *priv = to_gc0311(sd);
    int ret = 0;

    ret = set_flip(client, priv->flag_vflip);
    if (ret < 0)
        return ret;

    ret = set_brightness(client, priv->brightness);
    if (ret < 0)
        return ret;

    ret = set_contrast(client, priv->contrast);
    if (ret < 0)
        return ret;

    ret = set_sat(client, priv->sat);
    if (ret < 0)
        return ret;

    ret = set_effect(client, priv->effect);
    if (ret < 0)
        return ret;

    ret = set_wh_bal(client, priv->wh_bal);
    if (ret < 0)
        return ret;

    ret = set_mirror(client, priv->flag_hflip);
    if (ret < 0)
        return ret;

    if (enable) {
        ret = gc0311_write(client, 0x25, 0x0f);
        if (ret)
            goto out;
    } else {
        ret = gc0311_write(client, 0x25, 0x00);
    }

out:
    return ret;
}