示例#1
0
文件: graph.c 项目: jur/ps2sdk
int graph_initialize(int fbp, int width, int height, int psm, int x, int y)
{

	int mode = graph_get_region();

	// Set a default interlaced video mode with flicker filter.
	graph_set_mode(GRAPH_MODE_INTERLACED, mode, GRAPH_MODE_FIELD, GRAPH_ENABLE);

	// Set the screen up
	graph_set_screen(0,0,width,height);

	// Set black background
	graph_set_bgcolor(0,0,0);

	graph_set_framebuffer_filtered(fbp,width,psm,x,y);

	graph_enable_output();

	// End function.
	return 0;

}
示例#2
0
void settings_parse(config_t *config)
{

    int i = 0;

    const char ps2[4] = "PS2";

    char section_path[256];
    char setting[256];

    if (config == NULL)
    {
        return;
    }

    /// Home
    strcpy(section_path,ps2);
    strkat(section_path,".Home.");

    sprintf(setting,"%s%s",section_path,"Partition");
    strcpy(settings.home.partition,  cfg_get_string(setting,""));

    sprintf(setting,"%s%s",section_path,"Directory");
    strcpy(settings.home.directory,  cfg_get_string(setting,"mc0:/SYS-CONF"));


    /// Display
    strcpy(section_path,ps2);
    strkat(section_path,".Display.");

    sprintf(setting,"%s%s",section_path,"Mode");
    settings.display.mode = cfg_string_to_int(cfg_get_string(setting,"0"));
    printf("mode = %d\n",settings.display.mode);
    if (settings.display.mode == GRAPH_MODE_AUTO)
    {
        settings.display.mode = graph_get_region();
    }

    sprintf(setting,"%s%s",section_path,"Interlace");
    settings.display.interlace = cfg_get_bool(setting,0);

    sprintf(setting,"%s%s",section_path,"OffsetX");
    settings.display.x = cfg_string_to_int(cfg_get_string(setting,"0"));

    sprintf(setting,"%s%s",section_path,"OffsetY");
    settings.display.y = cfg_string_to_int(cfg_get_string(setting,"0"));

    /// Sound
    strcpy(section_path,ps2);
    strkat(section_path,".Sound.");

    sprintf(setting,"%s%s",section_path,"Stereo");
    settings.sound.stereo = cfg_get_bool(setting,1);

    sprintf(setting,"%s%s",section_path,"Volume");
    settings.sound.volume = cfg_string_to_int(cfg_get_string(setting,"100"));

    /// Font
    strcpy(section_path,ps2);
    strkat(section_path,".Font.");

    sprintf(setting,"%s%s",section_path,"Height");
    settings.font.height = cfg_string_to_int(cfg_get_string(setting,"16"));

    sprintf(setting,"%s%s",section_path,"Color");
    for (i = 0; i < 4; i++)
    {
        settings.font.color[i] = cfg_string_to_int(cfg_get_string_elem(setting,i,"128"));
    }

    sprintf(setting,"%s%s",section_path,"Highlight");
    for (i = 0; i < 4; i++)
    {
        settings.font.highlight[i] = cfg_string_to_int(cfg_get_string_elem(setting,i,"255"));
    }

    /// Input
    strcpy(section_path,ps2);
    strkat(section_path,".Input.");

    sprintf(setting,"%s%s",section_path,"Port");
    settings.input.port = cfg_string_to_int(cfg_get_string(setting,"0"));

    sprintf(setting,"%s%s",section_path,"Slot");
    settings.input.slot = cfg_string_to_int(cfg_get_string(setting,"0"));

    sprintf(setting,"%s%s",section_path,"Confirm");
    if (!strcmp("X",cfg_get_string(setting,"X")))
    {
        settings.input.confirm = PAD_CROSS;
    }
    else
    {
        settings.input.confirm = PAD_CIRCLE;
    }

    /// Devices
    strcpy(section_path,ps2);
    strkat(section_path,".Devices.");

    sprintf(setting,"%s%s",section_path,"Mass");
    settings.devices.mass = cfg_get_bool(setting,0);

    sprintf(setting,"%s%s",section_path,"HDD");
    settings.devices.hdd = cfg_get_bool(setting,0);

}