﻿### LICENSE:
#
# Copyright (C) 2011 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### FILE INFO:
#
# AROMA Installer 2.00 - AROMA Installer Test Script Configuration
#       (c) 2011-2012 by Ahmad Amarullah
#           amarullz - xda-developers
#           http://www.amarullz.com/
#
#       Binary Version  : 2.50
#       Binary Codename : Edelweis
#
### INFO:
#
# * AROMA Resource Dir  = META-INF/com/google/android/aroma
#
# * AROMA Temporary Dir = /tmp/aroma/
#
# * About Icon          = @alert - show <AROMA Resource Dir>/icons/alert.png
#                         or if theme used it will find <themedir>/icon.alert.png
#                         you can still access it via "icons/alert"
#
# * dp                  = Device Pixelate. WVGA/QHD = 3, HVGA = 2.
#                         dp calculated with = round(min(width,height) / 160)
#
###

##
# Fix Colorspace Issue
#
# For device which have a problem with color ( not display the correct color )
# try to set "force_colorspace" with ini_set. It may caused by wrong framebuffer
# information that passed by kernel into framebuffer device.
#
# You can use one of following values:
#   "rgba", "abgr", "argb", "bgra"
#
# NOTE: It must be in top most script, or you will got the color flicker
#
# ini_set("force_colorspace","rgba");
#

##[ REQUIRED ]
# Calibrate Touchscreen - MATRIX METHOD
#
# HTC Amaze 4G
#
calibrate_matrix(
  "126525.00", "-682.50",     "-2163345.00", "-2940.00",
  "116970.00", "-918780.00",  "223698.00",   "20"
); 

##
# Initializing Kernel Information
#
ini_set("rom_name",             "faux123 kernel");
ini_set("rom_version",          "023b4");
ini_set("rom_author",           "faux123");
ini_set("rom_device",           "Ruby / Amaze");
ini_set("rom_date",             "10/10/2012");

##
# Show AROMA Animated Splash
#
anisplash(
  #-- Number of Loop
    4,
  
  #-- Frame 1 [ Image, duration in millisecond ]. <AROMA Resource Dir>/splash/a[1..6].png
    "splash/a1", 500,
    "splash/a2", 30,
    "splash/a3", 30,
    "splash/a4", 30,
    "splash/a5", 30,
    "splash/a6", 30
);

#
# Set Small Font to Support all fonts
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)

###################################################################################################################
#
# LANGUAGE SELECTION
#
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font ( Look at Fonts & UNICODE Demo Below )
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font

###################################################################################################################
#
# DISPLAY CHANGELOG
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" <~changelog.title>",
  
  #-- Subtitle
    "Info",
  
  #-- Icon
    "@update",
  
  #-- Arg 4
    resread("changelog.txt")
);

###################################################################################################################
#
# CPU Frequencies
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "CPU frequency settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "cpu.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "CPU minimum frequency", 									"",																		2, #-- selected.1
    "192MHz", 				"",																													1, #-- 1
    "384MHz", 				"",																													0, #-- 2
    "432MHz", 				"",																													0, #-- 3
    "486MHz", 				"",																													0, #-- 4
  "CPU maximum frequency (= Intellidemand active max)", 	"",											2, #-- selected.2
    "810MHz",					"",																													0, #-- 1
    "864MHz",					"",																													0, #-- 2
    "918MHz",					"",																													0, #-- 3
    "972MHz",					"",																													0, #-- 4
    "1.02GHz",				"",																													0, #-- 5
    "1.08GHz",				"",																													0, #-- 6
    "1.13GHz",				"",																													0, #-- 7
    "1.18GHz",				"",																													0, #-- 8
    "1.24GHz",				"",																													0, #-- 9
    "1.29GHz",				"",																													0, #-- 10
    "1.35GHz",				"",																													0, #-- 11
    "1.40GHz",				"",																													0, #-- 12
    "1.45GHz",				"",																													0, #-- 13
    "1.51GHz",				"",																													0, #-- 14
    "1.56GHz",				"",																													0, #-- 15
    "1.62GHz",				"",																													0, #-- 16
    "1.67GHz",				"",																													0, #-- 17
    "1.72GHz",				"Stock Yank555.lu",																					1, #-- 18
  "Screen-off max frequency",														"",												2, #-- selected.3
    "192MHz", 				"(not recommended)",																				0, #-- 1
    "384MHz", 				"(not recommended)",																				0, #-- 2
    "432MHz", 				"Stock Yank555.lu",																					0, #-- 3
    "486MHz", 				"",																													0, #-- 4
    "540MHz", 				"",																													0, #-- 5
    "594MHz", 				"",																													1, #-- 6
    "648MHz", 				"",																													0, #-- 7
    "702MHz", 				"",																													0  #-- 8
);

###################################################################################################################
#
# Intellidemand governor Frequencies
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Intellidemand governor settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "intellidemand.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "Inactive max frequency (must be less than CPU max)",			"",										2, #-- selected.1
    "540MHz", 				"",																													0, #-- 1
    "594MHz", 				"",																													0, #-- 2
    "648MHz", 				"",																													0, #-- 3
    "702MHz", 				"",																													0, #-- 4
    "756MHz", 				"",																													0, #-- 5
    "810MHz",					"",																													0, #-- 6
    "864MHz",					"",																													0, #-- 7
    "918MHz",					"",																													1, #-- 8
    "972MHz",					"",																													0, #-- 9
    "1.02GHz",				"",																													0, #-- 10
    "1.08GHz",				"",																													0, #-- 11
    "1.13GHz",				"",																													0, #-- 12
    "1.18GHz",				"",																													0, #-- 13
    "1.24GHz",				"",																													0, #-- 14
  "Two phase frequency (must be less than inactive max)",		"",										2, #-- selected.2
    "540MHz", 				"",																													0, #-- 1
    "594MHz", 				"",																													0, #-- 2
    "648MHz", 				"",																													0, #-- 3
    "702MHz", 				"",																													0, #-- 4
    "756MHz", 				"",																													0, #-- 5
    "810MHz",					"",																													1, #-- 6
    "864MHz",					"",																													0, #-- 7
    "918MHz",					"",																													0, #-- 8
    "972MHz",					"",																													0, #-- 9
    "1.02GHz",				"",																													0, #-- 10
    "1.08GHz",				"",																													0, #-- 11
    "1.13GHz",				"",																													0, #-- 12
    "1.18GHz",				"",																													0, #-- 13
    "1.24GHz",				"",																													0  #-- 14
);

###################################################################################################################
#
# CPU Undervolting
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "CPU undervolting",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "undervolting.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "All frequencies", 													"",																	2, #-- selected.1
    "0mV",						"Start here !!",																						1, #-- 1
    "- 12.5mV",				"",																													0, #-- 2
    "- 25.0mV",				"",																													0, #-- 3
    "- 37.5mV",				"",																													0, #-- 4
    "- 50.0mV",				"",																													0, #-- 5
    "- 62.5mV",				"",																													0, #-- 6
    "- 75.0mV",				"",																													0, #-- 7
    "- 87.5mV",				"",																													0, #-- 8
    "-100.0mV",				"",																													0, #-- 9
    "-112.5mV",				"",																													0, #-- 10
    "-125.0mV",				"",																													0, #-- 11
    "-137.5mV",				"",																													0, #-- 12
    "-150.0mV",				"",																													0  #-- 13
);

###################################################################################################################
#
# GPU 3D OC
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "GPU 3D frequency settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "gpu.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "GPU 3D maximum frequency", 								"",																	2, #-- selected.1
    "266MHz", 				"",																													0, #-- 1
    "300MHz", 				"",																													1  #-- 2
);

###################################################################################################################
#
# I/O settings
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "MMC I/O Settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "io.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "MMC ReadAhead buffer size\n(more is not always better !)", 	"",								2, #-- selected.1
    "128kB", 					"",																													0, #-- 1
    "256kB", 					"",																													0, #-- 2
    "512kB", 					"",																													0, #-- 3
    "1024kB", 				"",																													0, #-- 4
    "2048kB", 				"",																													1, #-- 5
    "3072kB", 				"",																													0, #-- 6
    "4096kB", 				"",																													0, #-- 7
  "MMC I/O scheduler", 													"",																2, #-- selected.2
    "noop", 					"",																													0, #-- 1
    "dealine", 				"",																													0, #-- 2
    "cfq", 						"",																													1, #-- 3
    "bfq", 						"",																													0  #-- 4

);

###################################################################################################################
#
# Android Low Memory Killer settings
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Android Low Memory Killer settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "lmk.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "Low Memory Killer Presets", 								"",																	2, #-- selected.1
    "Stock htc", 				"16/21/26/31/53/66 Mb",																		1, #-- 1
    "Very light", 			"2/4/5/8/12/16 Mb (least free RAM)",											0, #-- 2
    "Light", 						"4/8/10/16/24/32 Mb (less free RAM)",											0, #-- 3
    "Medium", 					"4/8/16/32/48/64 Mb (medium free RAM)",										0, #-- 4
    "Aggressive", 			"8/16/32/64/96/128 Mb (more free RAM)",										0, #-- 5
    "Very aggressive", 	"16/32/64/128/192/256 Mb (most free RAM)",								0, #-- 6
    "Don't set here", 	"Leave LMK settings untouched",														0  #-- 7
);

###################################################################################################################
#
# Mods
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Kernel Mods",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "mods.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "USB forced fast charge", 										"",																2, #-- selected.1
    "disabled", 			"Don't use USB fast charge",																0, #-- 1
    "softforce", 			"Only force USB fastcharge if no USB device is detected",		1, #-- 2
    "always", 				"Always force USB fastcharge",															0, #-- 3
  "Hardswap by Yank555.lu\n(swap partition on SD card needed !)", "",							2, #-- selected.2
    "no", 						"",																													1, #-- 1
    "yes",					 	"",																													0, #-- 2
  "zRam support", 															"",																2, #-- selected.3
    "no", 						"",																													1, #-- 1
    "yes",					 	"",																													0, #-- 2
  "Vsync", 																			"",																2, #-- selected.4
    "enabled", 				"",																													1, #-- 1
    "disabled", 			"better GPU perf. / may produce glitches in 3D games",			0  #-- 2
);

###################################################################################################################
#
# DISPLAY WARNING
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version"),
  
  #-- Subtitle
    "Warning !!",
  
  #-- Icon
    "@alert",
  
  #-- Arg 4
    resread("warning.txt")
);

###################################################################################################################
#
# What to do now ?
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "What do you want to do now ?",
  
  #-- Icon
    "@confirm",
    
  #-- Will be saved in /tmp/aroma/
    "flash.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  																																									 #-- selected.0
    "All",			 			"Flash the kernel & config scripts",												1, #-- 1
    "Config only", 		"Regenerate the script with selected config",								0  #-- 2
);

###################################################################################################################
#
# Kernel flashing
#
setvar("retstatus",
  install(
	#-- Title
      ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
	
	#-- Installation Process message
	  "Please wait while flashing <b>"+ini_get("rom_name")+
	  "</b>. This should be done quickly.",
	
	#-- Installation Icon
      "@install",
	
	#-- Installation Finish Message
    "The installation wizard has successfully installed <b>"+ini_get("rom_name")+
	  "</b>. Press Next to continue."
  )
);

##
#
# Next Button is "Finish"
#
ini_set("text_next", "Finish");

###################################################################################################################
#
# FINISH MESSAGE, Add Checkbox to Reboot or No. Save in "reboot_it" variable
#
# You can use return value or "reboot_it" variable to retrive checkbox value
# Example:
# if (checkviewbox(....)=="1" then
#    ... checked ...
# endif;
#
checkviewbox(
  #-- Title
    "Installation Completed",
  
  #-- Text
    "<#selectbg_g><b>Congratulation...</b></#>\n\n"+
    "<b>"+ini_get("rom_name")+"</b> has been flashed onto your device.\n\n"+
    "Installer Status: "+getvar("retstatus")+"\n\n",
	
  #-- Icon
    "@welcome",

  #-- Checkbox Text
    "Reboot your device now.",

  #-- Initial Checkbox value ( 0=unchecked, 1=checked ) -  (Optional, default:0)
    "0",

  #-- Save checked value in variable "reboot_it" (Optional)
    "reboot_it"
);

###
#
# Check if reboot checkbox was checked
if
  getvar("reboot_it")=="1"
then
  #
  # reboot("onfinish");   - Reboot if anything finished
  # reboot("now");        - Reboot Directly
  # reboot("disable");    - If you set reboot("onfinish") before, use this command to revert it.
  #
  reboot("onfinish");
endif;

#---- FINISH
