//Fast ini
#include <libBAG.h>

INIObj MyIni;

void ds2_main(void)
{
	if(!BAG_Init(1))
		ds2_plug_exit();
	
	ds2_setCPUclocklevel(0);
	
	printf("fastini demo\n");
	
	initFastIni(&MyIni);
	//use ini sort for faster parsing!
	s8 test = MyIni.load(&MyIni, "/test.ini", INI_SORT);
	if(test == -1)
		printf("failed to open ini file\n");
		
	printf("================================\n");
	printf("ini file loaded\n\n");

	//read an integer from [user info] section, entry "patch"
	printf("integer = %d\n", MyIni.getInt(&MyIni, "Main", "integer", -1));
	printf("string = %s\n", MyIni.getStr(&MyIni, "Main", "text", "hello world!"));


	printf("writing file now\n");
	MyIni.write(&MyIni, "/fast.ini");
	printf("done writing, turn off!");
	while(1){
		BAG_Update();
	}
}

