//================================================================
//  gimconv configuration
//================================================================

usage {
	puts "usage:"
	puts "        gimconv <input files> [options]"
	puts ""
	puts "options:"
	puts "        -interact       input additional options"
	puts "        -pictures       merge files as pictures"
	puts "        -frames         merge files as frames"
	puts "        -levels         merge files as levels"
	puts "        -prompt         prompt always"
	puts "        -warning        prompt on warning"
	puts "        -error          prompt on error"
	puts "        -viewer         start gimview.exe when process ends"
	puts "        -o <filename>   specify output file name"
	puts "        -s <w,h>        resize image data"
	puts "        -S              output text format"
	puts "        -P              resize image data to a power of two"
	puts "        -N              output in normal pixel storage format"
	puts "        -F              output in faster pixel storage format"
	puts "        -R              re-convert ( don't swap RGBA <-> ABGR )"
}

//----------------------------------------------------------------
//  default settings
//----------------------------------------------------------------

default {
	load "lib/*"

	//  main control

	interact_mode = off		// off on ctrl
	merge_mode = off		// off picture frame level plane
					// image palette sequence
	prompt_mode = off		// off on warning error
	output_object = on		// off on
	output_script = off		// off on
	output_directory = auto		// current input auto
	output_filename = ""
	object_extension = .gim
	script_extension = .gis
	userdata_extension = .dat
	glob_extension = .dds .tm2 .tga .bmp .avi
	object_viewer = ""

	//  process control

	filter_script = "Filter"
	image_size = default		// default pow2 $w,$h
	pixel_order = default		// default normal faster
	pixel_alpha = default		// default $alpha
	pixel_channel = default		// default rgba rgab ragb ... etc
	image_format = default		// default rgba8888 rgba4444 rgba5551 rgba5650
					// index4 index8 index16 index32
					// dxt1 dxt3 dxt5 dxt1ext dxt3ext dxt5ext
	palette_format = default	// default rgba8888 rgba4444 rgba5551 rgba5650
	update_userdata = default	// default off on
	update_fileinfo = off		// default off on

	check_limit = on		// off on
	limit_image_width = 4096	// off $count
	limit_image_height = 4096	// off $count
	limit_level_count = 8		// off $count
	limit_frame_count = off		// off $count

	//  output control

	format_style = psp		// std psp ps3
	format_endian = little		// little big

	output_image = on		// off on
	output_palette = on		// off on
	output_sequence = on		// off on

	//  PS3 OSD default settings

	format_endian = big		// -B
	pixel_order = normal		// -N
	pixel_channel = default		// -R
	image_format = rgba8888		// --image_format rgba8888

	extend_edge = off
}

//--------------------------------------------------------
//  format specific
//--------------------------------------------------------

input *.avi {
	pixel_alpha = 255
}

input *.bmp {
	pixel_alpha = 255
}

input *.dds {
}

input *.tga {
}

input *.tm2 {
}

input *.gim {
}

input *.gis {
}

//--------------------------------------------------------
//  mode option
//--------------------------------------------------------

option -interact {
	interact_mode = on
}

option -pictures {
	merge_mode = picture
}

option -frames {
	merge_mode = frame
}

option -levels {
	merge_mode = level
}

option -planes {
	merge_mode = plane
}

option -images {
	merge_mode = image
}

option -palettes {
	merge_mode = palette
}

option -sequences {
	merge_mode = sequence
}

option -prompt {
	prompt_mode = on
}

option -warning {
	prompt_mode = warning
}

option -error {
	prompt_mode = error
}

option -viewer {
	object_viewer = "GimView.exe"
}

//--------------------------------------------------------
//  process option
//--------------------------------------------------------

option -o %filename {
	output_filename = %filename
}

option -s %size {
	image_size = %size
}

option -g %ext {
	glob_extension = %ext
}

option -P {
	image_size = pow2
}

option -N {
	pixel_order = normal
}

option -F {
	pixel_order = faster
}

//--------------------------------------------------------
//  PS3 OSD specific options
//--------------------------------------------------------

option -B {
	format_endian = big
}

option -X {
	pixel_channel = abgr
}

option -R {
	pixel_channel = default
}

option -DXT {
	pixel_order = default
	pixel_channel = default
	image_format = default
}

option -E {
	extend_edge = on
}

//--------------------------------------------------------
//  output option
//--------------------------------------------------------

option -S {
	output_object = off
	output_script = on
}

//--------------------------------------------------------
//  filter script
//--------------------------------------------------------

script Filter %target {
	RescaleImage   %target $image_size
	SetPixelFormat %target $image_format $palette_format
	SetPixelAlpha  %target $pixel_alpha
	SwapPixelChannel %target $pixel_channel
	ConfigureImage %target order $pixel_order
	UpdateUserData %target $update_userdata
	UpdateFileInfo %target $update_fileinfo
	ExtendEdge     %target $extend_edge
	CheckPSP       %target $check_limit
}
