示例#1
0
SOL_API int
sol_flow_node_named_options_parse_member(
    struct sol_flow_node_named_options_member *m,
    const char *value,
    const struct sol_flow_node_options_member_description *mdesc)
{
    int r;

    if (!m) {
        SOL_DBG("Options member must be a valid pointer.");
        return -EINVAL;
    }

    if (!mdesc) {
        SOL_DBG("Options member description must be a valid pointer.");
        return -EINVAL;
    }

    if (m->type == 0) {
        r = -EINVAL;
        SOL_DBG("Unitialized member type for name=\"%s\": \"%s\"", m->name, value);
    } else if (m->type < sol_util_array_size(options_parse_functions)) {
        if (mdesc->required)
            init_member_suboptions(m);
        else
            set_default_option(m, mdesc);

        r = options_parse_functions[m->type](value, m);
        if (r < 0) {
            SOL_DBG("Invalid value '%s' for option name='%s' of type='%s'",
                    value, m->name, sol_flow_node_options_member_type_to_string(m->type));
        }
    } else {
        r = -ENOTSUP;
        SOL_DBG("Invalid option member type for name=\"%s\": \"%s\"", m->name, value);
    }

    return r;
}
示例#2
0
global void ini_file_load(void)
{
	#if 1
	/* sceIoMkdir();でパスを作成する場合、最後が '/' だと作成されないので注意。 */
	// 要望があったので全力で対応
//	sceIoMkdir(const char *aaa_dir, SceMode mode);
	sceIoMkdir("ms0:/PICTURE", 0777);	/* "ms0:/PICTURE"がない場合、
	"ms0:/PICTURE/東方模倣風"が作れないので、必ず必要。
	ない場合、無視されるのではなくて、最悪「ハングアップしたりする」。
 */
//	sceIoMkdir("ms0:/PICTURE/東方模倣風/", 0777);/* 出来ない */
	sceIoMkdir("ms0:/PICTURE/東方模倣風", 0777);/* 出来る */
	#endif
//	char my_file_common_name[128/*64 50*/];
//	strcpy(my_file_common_name, "./" FILE_NAME_SETTING_TXT);
	strcpy(my_file_common_name, FILE_NAME_SETTING_TXT);
	int int_result;
	int_result = 0;/* 異常 */
	int ng1;
	ng1 = 0;/*fopen()成功*/
//
//	FILE *fp;
	if (NULL == /* fp =*/ my_file_fopen())	/* 開けなかったとき */		/*my_file_common_name, "r"*/
	{	/* 読み込み失敗 */
		ng1 = 1;/*fopen()失敗*/ goto error00;
	}
	/* キーコンフィグ設定の読み込み */
	{
		char key_config_tag[4];
		key_config_tag[0] = 'K';
		key_config_tag[1] = '0';
//		key_config_tag[2] = ('a'+i);
		key_config_tag[3] = 0;
		{	unsigned int i;
			for (i=0; i<KINOU_08_WARIATE_MAX; i++)
			{
				key_config_tag[2] = ('a'+i);
			//
				{	int value;
					value = ini_load_value(key_config_tag, NULL);/*fp,*/
					if (0 > value)	{goto error00;	}
					else			{pad_config[i] = value;	}
				}
			}
		}
	}
	/* オプション設定の読み込み */
	{	unsigned int i;
		for (i=0; i<OPTION_CONFIG_08_MAX; i++)
		{
			int value;
			value = ini_load_value((char *)my_config_title[i], NULL);/*fp,*/
			if (0 > value)	{goto error00;	}
			else			{option_config[i] = value; }
		}
	}
	int_result = 1;/* 正常 */
//
error00:
	/* high_score load */
	{	int ng2;
		int tmpscore;
		ng2 = ng1;
		tmpscore = 0;
		char search_str_name32[8];/*(検索する名前)*/
		//-----------------01234567
		strcpy(search_str_name32, "SCORE00");
		search_str_name32[7] = 0;/* 念の為 */
//
		int j;
		for (j=0; j<MAX_8_SAVE_PLAYERS; j++)
		{
			search_str_name32[5] = '0'+j;/* PLAYER */
			unsigned int i;
			for (i=0; i<MAX_5_RANKING; i++)
			{
				search_str_name32[6] = '0'+i;/* score rank number. 順位 */
				if (0==ng2)
				{
				//#define readed_str_name32 my_file_line_buffer256
					char readed_str_name32[64/*50*/];
				//	if (1 == fscanf(fp, "%23s\n", readed_str_name32 ))
				//	if (0 != my_fgets(/*fp, "%23s\n", readed_str_name32*/ ))
					int value;
					value = ini_load_value(search_str_name32, readed_str_name32);
					if (0 > value)	{ng2 = 1;/* エラー */}
					else
					{
						/* 埋め込む */
						high_score_table[j][i].final_stage = readed_str_name32[1/*10*/]-('0');

					//	strncpy(high_score_table[j][i].name, &readed_str_name32[10], 3);
						high_score_table[j][i].name[0] = readed_str_name32[2];/*10*/
						high_score_table[j][i].name[1] = readed_str_name32[3];/*11*/
						high_score_table[j][i].name[2] = readed_str_name32[4];/*12*/
						high_score_table[j][i].name[3] = readed_str_name32[5];/*13*/
//
						high_score_table[j][i].name[4] = readed_str_name32[6];/*14*/
						high_score_table[j][i].name[5] = readed_str_name32[7];/*15*/
						high_score_table[j][i].name[6] = readed_str_name32[8];/*16*/
						high_score_table[j][i].name[7] = readed_str_name32[9];/*16*/
						{	char tmp_str32bytes[32];/*(atoiの場合、バッファ長32[bytes]==最大31文字に統一)*/
							strcpy(tmp_str32bytes, &readed_str_name32[10]);/*5 13*/
							tmpscore = atoi(tmp_str32bytes);
						}
					}
				}
				#if (1)
			/*	else // 直前の ini_load_value() でエラーが起きた場合に初期化するので このelse無効。 */
			//	if (1==ng2) /* pspは0レジスタがあるので0と比較したほうが速い */
				if (0!=ng2)/*(エラー発生している場合、強制的にスコアテーブルを初期化する。)*/
				{
					high_score_table[j][i].final_stage = (6-i);/* 到達ステージ */
					static const int init_score_tbl[5] =
					{
						score(100000000),//score(70000000),//score(50000000),
						score( 50000000),//score(60000000),//score(4000000),
						score( 10000000),//score(50000000),//score(300000),
						score(	5000000),//score(10000000),//score(20000),
						score(	1000000),//score( 5000000),//score(1000),
					};
				//	strcpy(high_score_table[j][i].name, "12345678");
				//	strcpy(high_score_table[j][i].name, "ZUN     ");
					strcpy(high_score_table[j][i].name, "Nanashi ");
					tmpscore = init_score_tbl[i];
				}
				#endif
				high_score_table[j][i].score = tmpscore;
			}
		}
	//	top_score = high_score_table[0][0].score;	// 常に表示するハイコアの取得=>score.cで利用
	}
//
	if (0==ng1)
	{
		my_file_fclose();/*fp*/ //fclose(fp);
	}
	//return (int_result)/*1*/;
	if (0==(int_result)) // 20090110
	{
//		chooseModDir();
		set_default_key(pad_config, 0/*0==type 01 模倣風 標準*/);
		set_default_option(option_config);/* OPTION_CONFIG_00_PLAYER から OPTION_CONFIG_03_SOUND まで設定 */
	//	option_config[OPTION_CONFIG_04_CURRENT_DIFFICULTY]	= 0;
	//	option_config[OPTION_CONFIG_05_CURRENT_PLAYER]		= 0;
	//	option_config[OPTION_CONFIG_06_ANALOG]				= 0;
		option_config[OPTION_CONFIG_07_OPEN]				= 0x0500;
	}
	/* 範囲外チェック(範囲外の場合は修正) */
	check_limit_value_option(option_config);/* */
	/* 読み込んだデーターで初期設定 */
	cg.game_difficulty		= option_config[OPTION_CONFIG_04_CURRENT_DIFFICULTY];
	cg_game_select_player	= option_config[OPTION_CONFIG_05_CURRENT_PLAYER];
	#if 1/*(範囲外の場合は強制的に修正する。)*/
	cg.game_difficulty		&= 0x03;/* (easy)0 1 2 3(Lunatic) */
	cg_game_select_player	&= 0x07;
	#endif
}