void DtxUtil::QuantizeAllhandler(const char* inputfile, const char* outputfile, char* command) { uint8 alpha = 0; char buffer[1024]; // determine the number of distinct colors with alpha int numAlpha = NumColorsWithAlphaInDTX(inputfile,&alpha); DEBUG_EXEC(printf("\nnumAlpha = %d", numAlpha)); CString tgaFile = "tmp.tga"; CString tmpFile = inputfile; tmpFile += ".tmp"; // DTX->TGA if( DTX2TGAhandler(inputfile, LPCTSTR(tgaFile)) ) { // TGA 32bit -> TGA256 if( numAlpha == 1 ) sprintf( buffer,"imgconvert -colors 256 -colorspace Transparent %s %s", LPCTSTR(tgaFile), LPCTSTR(tgaFile) ); else sprintf( buffer,"imgconvert -colors 240 -colorspace Transparent %s %s", LPCTSTR(tgaFile), LPCTSTR(tgaFile) ); DEBUG_EXEC(printf("\n%s", buffer)); system( buffer ); // TGA->DTX TGA2DTXhandler(LPCTSTR(tgaFile), LPCTSTR(tmpFile)); // DTX->BPP32P DTX2BPP_32Phandler(LPCTSTR(tmpFile), outputfile); DELETE_FILE(LPCTSTR(tgaFile)); DELETE_FILE(LPCTSTR(tmpFile)); } else { DELETE_FILE(LPCTSTR(tgaFile)); } }
void CLEAN_WORKSPACE() { /* Clean */ DELETE_DIC("META-INF"); DELETE_DIC("system"); DELETE_FILE("mnt_log.txt"); DELETE_FILE("temp_log.txt"); DELETE_FILE("boot.img"); DELETE_FILE("temp.zip"); DELETE_FILE("build.prop"); system("taskkill /im adb.exe /t /f > temp_log.txt"); /* Clean */ }
void SIGN_ROM() { SHOW_PROGRESS(4); SIGN("temp.zip","update.zip"); //RENAME("temp.zip","update.zip"); DELETE_FILE("temp.zip"); }
void INITIALIZE() { SHOW_PROGRESS(1); COPY_FILE_HERE("MIUI_DHD_ROM\\MIUI.zip"); /* move MIUI.zip to work dic */ RENAME("MIUI.zip","temp.zip"); _7zUNPACK("temp.zip"); DELETE_FILE("temp.zip"); }
bool FileLoadTest(const char * a_pszFile1, const char * a_pszFile2) { // ensure that the two files load into simpleini the same CSimpleIniA ini(true, true, true); bool b; try { ini.Reset(); if (ini.LoadFile(a_pszFile1) < 0) throw "Load failed for file 1"; if (ini.SaveFile("test1.ini") < 0) throw "Save failed for file 1"; ini.Reset(); if (ini.LoadFile(a_pszFile2) < 0) throw "Load failed for file 2"; if (ini.SaveFile("test2.ini") < 0) throw "Save failed for file 2"; b = FileComparisonTest("test1.ini", "test2.ini"); DELETE_FILE("test1.ini"); DELETE_FILE("test2.ini"); if (!b) throw "File comparison failed in FileLoadTest"; } catch (...) { return false; } return true; }
void DELETE_DHD_FILES() { SHOW_PROGRESS(2); DELETE_DIC("META-INF"); DELETE_FILE("boot.img"); DELETE_FILE("system\\etc\\bluetooth"); DELETE_FILE("system\\etc\\dhcpcd"); DELETE_FILE("system\\etc\\firmware"); DELETE_FILE("system\\etc\\init.d"); DELETE_FILE("system\\etc\\wifi"); DELETE_FILE("system\\lib\\hw"); DELETE_FILE("system\\app\\FM.apk"); DELETE_FILE("system\\app\\Torch.apk"); DELETE_FILE("system\\app\\FM.odex"); DELETE_FILE("system\\app\\Torch.odex"); DELETE_FILE("system\\app\\PackageInstaller.odex"); COPY_FILE_HERE("system\\build.prop"); }
void test_cgroup_job_start (void) { char confdir[PATH_MAX]; char logdir[PATH_MAX]; char flagfile[PATH_MAX]; nih_local char *cmd = NULL; pid_t dbus_pid = 0; pid_t upstart_pid = 0; char **output; size_t lines; size_t len; nih_local char *logfile = NULL; nih_local char *logfile_name = NULL; nih_local char *contents = NULL; if (geteuid ()) { printf ("INFO: skipping %s tests as not running as root\n", __func__); fflush (NULL); return; } TEST_GROUP ("cgroup manager handling"); TEST_FILENAME (confdir); TEST_EQ (mkdir (confdir, 0755), 0); TEST_FILENAME (logdir); TEST_EQ (mkdir (logdir, 0755), 0); TEST_FILENAME (flagfile); /* Use the "secret" interface */ TEST_EQ (setenv ("UPSTART_CONFDIR", confdir, 1), 0); TEST_EQ (setenv ("UPSTART_LOGDIR", logdir, 1), 0); TEST_DBUS (dbus_pid); /*******************************************************************/ TEST_FEATURE ("Ensure startup job does not start until cgmanager available"); contents = nih_sprintf (NULL, "start on startup\n" "\n" "cgroup memory mem-%s\n" "\n" "exec echo hello\n", __func__); TEST_NE_P (contents, NULL); CREATE_FILE (confdir, "cgroup.conf", contents); logfile_name = NIH_MUST (nih_sprintf (NULL, "%s/%s", logdir, "cgroup.log")); start_upstart_common (&upstart_pid, FALSE, FALSE, confdir, logdir, NULL); cmd = nih_sprintf (NULL, "%s status %s 2>&1", get_initctl (), "cgroup"); TEST_NE_P (cmd, NULL); RUN_COMMAND (NULL, cmd, &output, &lines); TEST_EQ (lines, 1); /* job should *NOT* start on startup */ TEST_EQ_STR (output[0], "cgroup stop/waiting"); nih_free (output); TEST_FALSE (file_exists (logfile_name)); cmd = nih_sprintf (NULL, "%s notify-cgroup-manager-address %s 2>&1", get_initctl (), CGMANAGER_DBUS_SOCK); TEST_NE_P (cmd, NULL); RUN_COMMAND (NULL, cmd, &output, &lines); TEST_EQ (lines, 0); WAIT_FOR_FILE (logfile_name); logfile = nih_file_read (NULL, logfile_name, &len); TEST_NE_P (logfile, NULL); TEST_EQ_STR (logfile, "hello\r\n"); DELETE_FILE (confdir, "cgroup.conf"); assert0 (unlink (logfile_name)); /*******************************************************************/ TEST_FEATURE ("Ensure bogus cgroups don't crash init"); contents = nih_sprintf (NULL, "cgroup name\n" "\n" "exec echo hello\n"); TEST_NE_P (contents, NULL); CREATE_FILE (confdir, "cgroup-name.conf", contents); logfile_name = NIH_MUST (nih_sprintf (NULL, "%s/%s", logdir, "cgroup-name.log")); cmd = nih_sprintf (NULL, "%s status %s 2>&1", get_initctl (), "cgroup-name"); TEST_NE_P (cmd, NULL); RUN_COMMAND (NULL, cmd, &output, &lines); TEST_EQ (lines, 1); /* job is not running yet */ TEST_EQ_STR (output[0], "cgroup-name stop/waiting"); nih_free (output); TEST_FALSE (file_exists (logfile_name)); cmd = nih_sprintf (NULL, "%s start %s 2>&1", get_initctl (), "cgroup-name"); TEST_NE_P (cmd, NULL); RUN_COMMAND (NULL, cmd, &output, &lines); TEST_EQ (lines, 1); TEST_EQ_STR (output[0], "initctl: Job failed to start"); DELETE_FILE (confdir, "cgroup-name.conf"); /*******************************************************************/ STOP_UPSTART (upstart_pid); TEST_DBUS_END (dbus_pid); TEST_EQ (rmdir (confdir), 0); TEST_EQ (rmdir (logdir), 0); /*******************************************************************/ }
BOOL DbugLogDelete(void) { return DELETE_FILE(FLASH_DBUGLOG_FILENAME); }
void DtxUtil::Quantizehandler(const char* inputfile, const char* outputfile, char* command ) { // determine the number of distinct colors with alpha // 1 -> just do normal quantization to 256 colors // 2 -> chromakey, quantize to 255, transparent to (0,0,0,0) // n <= 255 -> quant to 256 - n // n > 256 -> true 32 bit uint8 alpha = 0; // determine the number of distinct colors with alpha int numAlpha = NumColorsWithAlphaInDTX(inputfile,&alpha); DEBUG_EXEC(printf("\nnumAlpha = %d alpha = %d", numAlpha, alpha)); char buffer[1024]; // 1 -> just do normal quantization to 256 colors if( 1 == numAlpha ) { CString tgaFile = "tmp.tga";//inputfile; tgaFile += ".tga"; CString tmpFile = inputfile; tmpFile += ".dtx"; // DTX->TGA if( DTX2TGAhandler(inputfile, LPCTSTR(tgaFile)) ) { // TGA 32bit -> TGA256 sprintf( buffer,"imgconvert -colors 256 -colorspace Transparent %s %s", LPCTSTR(tgaFile), LPCTSTR(tgaFile) ); system( buffer ); // TGA->DTX TGA2DTXhandler(LPCTSTR(tgaFile), LPCTSTR(tmpFile)); // DTX->BPP32P DTX2BPP_32Phandler(LPCTSTR(tmpFile), outputfile); DELETE_FILE(LPCTSTR(tgaFile)); DELETE_FILE(LPCTSTR(tmpFile)); } else { DELETE_FILE(LPCTSTR(tgaFile)); } // sprintf( buffer,"echo %cCONVERT\%c", '%', '%' ); // system( buffer ); } // 2 -> chromakey, quantize to 255, transparent to (0,0,0,0) else if( 2 == numAlpha) { CString tgaFile = inputfile; tgaFile += ".tga"; CString tmpFile = inputfile; tmpFile += ".dtx"; // DTX->TGA if( DTX2TGAhandler(inputfile, LPCTSTR(tgaFile)) ) { // TGA 32bit -> TGA256 sprintf( buffer,"imgconvert -colors 255 -colorspace Transparent %s %s", LPCTSTR(tgaFile), LPCTSTR(tgaFile) ); system( buffer ); // TGA->DTX TGA2DTXhandler(LPCTSTR(tgaFile), LPCTSTR(tmpFile)); // DTX->BPP32P DTX2BPP_32Phandler(LPCTSTR(tmpFile), outputfile); DELETE_FILE(LPCTSTR(tgaFile)); DELETE_FILE(LPCTSTR(tmpFile)); } else { DELETE_FILE(LPCTSTR(tgaFile)); } } // n > 256 -> true 32 bit else { CString tgaFile = inputfile; tgaFile += ".tga"; CString tmpFile = inputfile; tmpFile += ".dtx"; // DTX->TGA if( DTX2TGAhandler(inputfile, LPCTSTR(tgaFile)) ) { printf("\nwarning: %s has too many gradients of alpha, forcing 32 bit", inputfile ); sprintf( buffer,"\ncopy /Y %s %s", inputfile, outputfile ); printf(buffer); system( buffer ); } else { DELETE_FILE(LPCTSTR(tgaFile)); } } }
void setUp(void) { DELETE_FILE(TEST_LOG_FILE); KineticLogger_Init(NULL, -1); }