//-----------------------------------------------------------------------
//
void ReturnFromMoveRenameYesNo( bool result)
{
    // Routine if invoked upon return from the "Automatic Rename on Move" confirmation prompt.
     
    char str1[200], str2[200];
    int  renameResult;

    appendToLogfile("ReturnFromMoveRenameYesNo: Started.", INFO);

    // Check the result of the confirmation panel to decide what to do.
	switch (result)
    {
           case TRUE:  // YES
                       appendStringToLogfile("ReturnFromMoveRenameYesNo: Rename from %s", GlbSourceFile, WARNING);
                       appendStringToLogfile("ReturnFromMoveRenameYesNo: to %s", GlbRenamedFile, WARNING);
                       #ifdef WIN32  // If testing on WIN32 platform don't do rename as not yet implemented in the TAP SDK.
                       renameResult=0;
                       #else
                  	   renameResult=TAP_Hdd_Rename(GlbSourceFile,GlbRenamedFile);
                       #endif          
                  	   if (renameResult!=0)
                       {
                          TAP_SPrint(str1,"Error renaming: '%s'", GlbSourceFile);
                          TAP_SPrint(str2,"to: '%s'", GlbRenamedFile);
                          fileMoved      = FALSE;
                          returnFromMove = FALSE;   // Don't close the Move window to give user a chance to choose a different folder.
                          ShowMessageWin( rgn, "Rename On Move Failed.", str1, str2, 500 ); 
                          break;
                       }   
                       strncpy( GlbSourceFile, GlbRenamedFile, 256 );   // Copy the renamed filename into the Global variable so that we move the renamed file.
                       PerformMove();
                       switch (RenameOnMoveOption)
                       {
                              case 0:   // "Rename and confirm"
                                        // Close the Move Window after this, otherwise it is closed as part of the other routines.
                                        CloseArchiveMoveWindow();			    // Close the move window
                                        break;
                                        
                              case 2:   // "Rename automatically (with message) "
                                        TAP_SPrint(str1, "%s/%s", GlbTargetDir, GlbRenamedFile);  
                                        ShowMessageWin( rgn, "File Move Successful.", "Moved and renamed file to:", str1, 400 ); 
                                        break;
                                        
                              default:  // "Rename automatically (no message) "
                                        break;
                       }
                       break;
                      
	       case FALSE: // NO
                       fileMoved      = FALSE;
                       returnFromMove = FALSE;   // Don't close the Move window to give user a chance to choose a different folder.
                       break;	
    }   
    appendToLogfile("ReturnFromMoveRenameYesNo: Finished.", INFO);
}
Exemple #2
0
dword TAP_EventHandler(word wEvent, dword dwParam1, dword dwParam2)
{
	char message[10];
	dword returnKey, state, subState;

	returnKey = dwParam1;

	switch(wEvent)
	/* ------------------------------------------------------------------------------------ */
	{
	case EVT_IDLE:

		tmMain();

		returnKey = 0;

		break;
	/* ------------------------------------------------------------------------------------ */
	case EVT_KEY:

	 	TAP_GetState( &state, &subState );

		if
		(
			(dwParam1 == RKEY_Exit)
			&&
			(state == STATE_Normal)
			&&
			(subState == SUBSTATE_Normal)
		)
		{
			TAP_SPrint( message, "%5u", tmNumberOfEvents);

			ShowMessageWin("Number Of Events Stored:",message);
		}

		if(dwParam1 == RKEY_F4)
		{
			ShowMessageWin("Exiting","TimeMon Tap");

			TAP_Exit();
		}

		break;
	/* ------------------------------------------------------------------------------------ */
	default :
		 	break;
	/* ------------------------------------------------------------------------------------ */
	}

	return (returnKey);
}
//-----------------------------------------------------------------------
//
void ActivateDeleteWindow(char* filename, dword attr)
{
    char title[50], str1[200], str2[200], str3[200];

	if (myfiles[CurrentDirNumber][chosenLine]->isRecording)  // We cannot delete a recording file.
	{
         ShowMessageWin( rgn, "File Delete Not Allowed.", "You cannot delete a file that is", "currently recording.", 400 );
         return;
    }     
                                          
    deleteWindowShowing = TRUE;
    fileDeleted = FALSE;

    switch (attr)
    {
           case ATTR_FOLDER: TAP_SPrint(title, "Folder Delete Confirmation");
                             TAP_SPrint(str1,  "Folder: %s",filename);
                             TAP_SPrint(str2, "Do you want to delete this folder?");
                             break;
                
           default:          TAP_SPrint(title, "File Delete Confirmation");
                             TAP_SPrint(str1, "File: %s",filename);
                             TAP_SPrint(str2, "Do you want to delete this file?");
                             break;
    }
    

    DisplayYesNoWindow(title, str1, str2, "Yes", "No", 1, &ReturnFromDeleteYesNo );

}
void InitTAPexFailedMsg(char *ProgramName)
{
  TRACEENTER();

  char                  s[28];

  TAP_SPrint(s, "%d %4.4x", GetSysID(), ApplID);
  ShowMessageWin(ProgramName ? ProgramName : "", "FBLib failed to init", s, 500);

  TRACEEXIT();
}
Exemple #5
0
void tmLogEvent(void)
{
	char	tmBuffer[TM_EVENT_BUFFER_SIZE];

	TYPE_File* fp;

	memset (tmBuffer, 0, TM_EVENT_BUFFER_SIZE);

	TAP_SPrint( tmBuffer, "%02u:%02u:%02u %02u/%02u/%04u, %3u,  %3u, %3u       %02u:%02u:%02u %02u/%02u/%04u, %3u,  %3u, %3u\r\n", hourLast, minLast, secLast, dayLast, monthLast, yearLast, signalLevelLast, signalQualityLast, timersLast, hour, min, sec, day, month, year, signalLevel, signalQuality, timers);

	if (fp = TAP_Hdd_Fopen (TM_FILENAME))
	{
		TAP_Hdd_Fseek (fp, tmBufferOffset, 0);

		TAP_Hdd_Fwrite (tmBuffer, 1, strlen(tmBuffer), fp);

		TAP_Hdd_Fclose (fp);

		tmBufferOffset += strlen(tmBuffer);

		tmNumberOfEvents++;

		if (tmBufferOffset >= (TM_FILE_MAX_LENGTH - TM_EVENT_BUFFER_SIZE))
		{
			ShowMessageWin("Log File Full","Exiting!");

			TAP_Exit();

			return;
		}
	}
	else
	{
		ShowMessageWin("Error! - Unable to open file","Exiting!");

		TAP_Exit();

		return;
	}
}
//-----------------------------------------------------------------------
//
void PerformMove(void)
{
     bool moveres;
          
     appendToLogfile("PerformMove: Started.", INFO);
     
     // Call the move routine and track the result code.
     #ifdef WIN32
            moveres = TRUE;
     #else
            appendToLogfile("PerformMove: Calling TAP_Hdd_Move", WARNING);
            appendStringToLogfile("PerformMove: Calling TAP_Hdd_Move GlbSourceDir: %s",GlbSourceDir, WARNING);
            appendStringToLogfile("PerformMove: Calling TAP_Hdd_Move GlbTargetDir: %s",GlbTargetDir, WARNING);
            appendStringToLogfile("PerformMove: Calling TAP_Hdd_Move GlbSourceFile: %s",GlbSourceFile, WARNING);
            moveres = TAP_Hdd_Move( GlbSourceDir, GlbTargetDir, GlbSourceFile);
            appendToLogfile("PerformMove: TAP_Hdd_Move finished.", WARNING);
     #endif


     // Check and handle the result of the move routine.
     // Check the file actually moved via file exists.
     #ifdef WIN32  // If testing on Windows platform, assume success rather than physically deleting file.
     if (FALSE)
     #else  
     appendToLogfile("PerformMove: Calling TAP_Hdd_Exist", WARNING);
     if (TAP_Hdd_Exist(GlbSourceFile))  // If the file/folder still exists in the current directory, then the move didn't work.
     #endif
     {
         ShowMessageWin( rgn, "File/Folder Move Failed.", "Failed to move file/folder:", GlbSourceFile, 400 );
         fileMoved = FALSE;
     }
     else
     {
         fileMoved = TRUE;
         myfiles[CurrentDirNumber][chosenLine]->isNew = FALSE;   // Clear the 'new' flag for this file.
     }    
     returnFromMove = TRUE;   // Force a closer of the Move window, and refresh the list.
     
/*     
     ShowMessageWin( rgn, "Move Test #1.", "Moving Test.rec", "to MINE folder", 400 );
     moveres = TAP_Hdd_Move( "DataFiles", "DataFiles/Mine", "Test.rec");
   
     ShowMessageWin( rgn, "Move Test #2.", "Moving MINE folder", "to MINE2 folder", 400 );
     moveres = TAP_Hdd_Move( "DataFiles", "DataFiles/Mine2", "Mine");
     
     ShowMessageWin( rgn, "Move Test #3.", "Moving Test2.rec", "to .. folder", 400 );
     moveres = TAP_Hdd_Move( "DataFiles/Mine2", "DataFiles/Mine2/..", "Test2.rec");
*/   
     appendToLogfile("PerformMove: Finished.", WARNING);
     
}     
void ResetScreenConfigWindow()
{
     char str[100], gstr[100];
     if (TvRatioOption == 0) 
     {
         Set43ScreenSizes();
         strcpy(str,"Standard Screen");
     }
     else 
     {
         SetWideScreenSizes();
         strcpy(str,"Wide Screen");
     }
     InitialiseOverScanSizes();             // Set default Overscan sizes.
     SaveScreenConfig();
     sprintf(gstr,"set for %s.",str);
     ShowMessageWin(rgn, "Resetting Window Size & Positions.", "Window sizes & positions have been", gstr, 200);
     redrawWindow = TRUE;					// will cause a redraw of windows
}     
//------------
//
void DeleteFileFolder(void)
{
     char str[TS_FILE_NAME_SIZE];
     
     if (myfiles[CurrentDirNumber][chosenLine]->isPlaying)
        TAP_Hdd_StopTs();  // Stop the current playback to allow us to delete the file.
     TAP_Hdd_Delete(myfiles[CurrentDirNumber][chosenLine]->name);
     
     // Check if the delete was successful.
#ifdef WIN32
     if (FALSE)
#else  
     if (TAP_Hdd_Exist(myfiles[CurrentDirNumber][chosenLine]->name))  // Delete didn't work
#endif
     {
         TAP_SPrint(str,myfiles[CurrentDirNumber][chosenLine]->name);
         ShowMessageWin( rgn, "File Deletion Failed.", "Failed to delete file:", str, 400 );
         fileDeleted = FALSE;
     }
     else
         fileDeleted = TRUE;
     
}
void DeletePlayData( void )
{   // Will delete the playback progress file, and then recreate a new one.
    char* currentDir;
    int i;
     
    appendToLogfile("DeletePlayData: Started.", INFO);

    appendToLogfile("DeletePlayData: GetCurrentDir called.", WARNING);
    currentDir = GetCurrentDir();  // Store the current  directory.
    appendStringToLogfile("DeletePlayData: GetCurrentDir returned=%s.",currentDir, WARNING);
    appendStringToLogfile("DeletePlayData: Moving to=%s.",TAPIniDir, WARNING);
    GotoPath(TAPIniDir);           // Go to the Project Directory.

    appendToLogfile("DeletePlayData: Deleting DATA file.", ERR);
	if ( TAP_Hdd_Exist( PLAYDATA_FILENAME ) ) TAP_Hdd_Delete( PLAYDATA_FILENAME );	// Just delete any old copies

    appendToLogfile("DeletePlayData: Calling LoadPlayData.", ERR);
    LoadPlayData();  // Recreate and reload the new information.

    appendStringToLogfile("DeletePlayData: Returning to=%s.",currentDir, WARNING);
	GotoPath(currentDir);            // Return to the original directory.

    // Got through all of our current files and remove any progress information.
    for (i=1; i <= numberOfFiles; i += 1)
    {
        myfiles[CurrentDirNumber][i]->hasPlayed = FALSE;  // Reset indicator to show that file has not been played.
        myfiles[CurrentDirNumber][i]->currentBlock = 0;
        myfiles[CurrentDirNumber][i]->totalBlock   = 1;   // Set to 1 to ensure no division by 0 errors.
    }   

    ShowMessageWin( rgn, "All Progress Info Cleared.", "Removed playback information", "for all recorded files.", 400 );

    TAP_MemFree( currentDir );   // Free allocated memory.

    appendToLogfile("DeletePlayData: Finished.", INFO);
}
//------------
//
void ReturnFromRenameKeyboard( char *str, bool success)
{
    char str1[200], str2[200];
    int  result;
    
    returnFromRename = TRUE;
    

    if ( success == TRUE)
	{
	    if (currentFile.attr != ATTR_FOLDER) strcat( str, tagStr );	//ensure the file name is of the correct format by appending ".rec" or ".rec.del"
        if (strcmp(currentFile.name,str)!=0) fileRenamed=TRUE; // File name was changed.
        
        if (fileRenamed) // Check that another file doesn't already exist with the new name.
        {
              if (TAP_Hdd_Exist(str))
              {
                  // Message already exists
                  ShowMessageWin( rgn, "Rename Failed.", "A File or Folder with that name", "already exists.", 400 );
              }
              else
              {
              	   // Rename the file.
#ifdef WIN32  // If testing on WIN32 platform don't do rename as not yet implemented in the TAP SDK.
                   result=0;
#else
              	   result=TAP_Hdd_Rename(currentFile.name,str);
#endif          
              	   if (result==0)
                   {
                      // Need to update the playedFiles to update new filename.
                      
                      strcpy( currentFile.name, str );           // Update the display if we were successful.
                      strcpy( myfiles[CurrentDirNumber][chosenLine]->name, str );   // Update the array of files if we were successful.
                      if (IsFileRec(myfiles[CurrentDirNumber][chosenLine]->name, myfiles[CurrentDirNumber][chosenLine]->attr)) FormatSortName(myfiles[CurrentDirNumber][chosenLine]->sortName,str);
                      else 
                      {
                          strcpy( currentFolder.name, str );                     // Update the display if we were successful.
                          strcpy( myfolders[myfiles[CurrentDirNumber][chosenLine]->directoryNumber]->name, str );      // Update the array of folders if we were successful.
                          strcpy( myfiles[CurrentDirNumber][chosenLine]->sortName,str);
                      }
    	              infoCommandOption = INFO_OK_OPTION;                        // Highlight the "OK" Info Window option
    	              fileRenamed = TRUE;
                   }
                   else
                   {
                      TAP_SPrint(str1,"Error renaming: '%s'", currentFile.name);
                      TAP_SPrint(str2,"to: '%s'", str);
                      ShowMessageWin( rgn, "Rename Failed.", str1, str2, 500 ); 
    	              infoCommandOption = INFO_RENAME_OPTION; // Highlight the "RENAME" Info Window option
                   }   
    	           DisplayArchiveInfoWindow();  // Refresh the info window.
              }   
        }
	}
	else
	{
       	infoCommandOption = INFO_RENAME_OPTION; // Highlight the "RENAME" Info Window option
    }

}
Exemple #11
0
void tmInitialise(void)
{
	char tmBuffer[TM_FILE_BLOCK_SIZE];
	char hddBuffer[1];

	byte i;

	TYPE_File* fp;

	memset (tmBuffer, 0, TM_FILE_BLOCK_SIZE);

	if (!TAP_Hdd_Exist (TM_FILENAME))
	{
		TAP_Hdd_Create (TM_FILENAME, ATTR_NORMAL);

		if (fp = TAP_Hdd_Fopen (TM_FILENAME))
		{
			for (i = 0; i < TM_FILE_MAX_LENGTH / TM_FILE_BLOCK_SIZE; i++)
			{
				TAP_Hdd_Fwrite (tmBuffer, 1, TM_FILE_BLOCK_SIZE, fp);
			}

			TAP_Hdd_Fseek (fp, 0, 0);

			TAP_Hdd_Fwrite (TM_INFO, 1, sizeof(TM_INFO), fp);

			tmBufferOffset = sizeof(TM_INFO) - 1;

			tmNumberOfEvents = 0;

			TAP_Hdd_Fclose (fp);
		}
	}
	else
	{
		if (fp = TAP_Hdd_Fopen (TM_FILENAME))
		{
			tmBufferOffset = 0;
			tmExitFL = FALSE;

			while
			(
				(tmExitFL == FALSE)
				&&
				(tmBufferOffset < TM_FILE_MAX_LENGTH)
			)
			{
				TAP_Hdd_Fseek (fp, tmBufferOffset, 0);

				TAP_Hdd_Fread (hddBuffer, 1, 1, fp);

				if(hddBuffer[0] != 0)
				{
					tmBufferOffset++;

					if(hddBuffer[0] == 0x0A)
					{
						tmNumberOfEvents++;
					}
				}
				else
				{
					tmExitFL = TRUE;
				}
			}

			tmNumberOfEvents -= 2;

			TAP_Hdd_Fclose (fp);

			if (tmBufferOffset >= (TM_FILE_MAX_LENGTH - TM_EVENT_BUFFER_SIZE))
			{
				ShowMessageWin("Log File Full","Exiting!");

				TAP_Exit();

				return;
			}
		}
	}

	ShowMessageWin("Time Monitor Tap v1.0","Started");
}
//------------
//
void MoveAFile(char* sourceDir, char* destDir, char* sourceFile, dword attr)
{
     bool fileAlreadyExists;
     char targetDir[500];
	 char currentFileName[256], baseFileName[256], title1[50], title2[50], str1[256], str2[256], fileName[256], counter[6];
	 int  fileIncrement;       // A counter used in case we need to append a number to an already existing file name. 

     

     appendToLogfile("MoveAFile: Started.", WARNING);
 	 
      // If we try to move a file and there is already an existing file in the target directory
	 // with the same name, we will append an incrementing counter to the file name. (eg. news-1.rec  news-23.rec)
	 fileAlreadyExists = FALSE;          // Flag to indicate that the renamed file already exists.
	 fileIncrement     = 0;              // Counter in case we need to append a number to an already existing file name.

     if (attr != ATTR_FOLDER)
     {
         strncpy( currentFileName, sourceFile, 256 );   // Copy the current filename
         strncpy( fileName,        sourceFile, 256 );   // Copy the current filename
         strncpy( baseFileName,    sourceFile, 256 );   // Copy the current filename
    	 StripFileName( baseFileName );                       // Strip off the ".rec"
         strncpy( fileName, baseFileName, 256 );              // Copy the stripped off filename in case we need to rename on a move.
    	 strcat( fileName, REC_STRING );	                  // Append ".rec" to the base filename
     }

     // Perform check that the Move routine is available for this firmware.
     #ifdef WIN32
     #else
     if (!TAP_Hdd_Move_Available())
     {
         ShowMessageWin( rgn, "Move NOT available.", "This firmware does not support", "the move function via Archive.", 400 );
         returnFromMove = TRUE;   // Force a closer of the Move window, and refresh the list.
         return;
     }
     #endif
    
     appendToLogfile("MoveAFile: Creating target filename.", WARNING);
     
     // Create the fully qualified target directory name.  
     //
     // Start with the Source Directory 
     strcpy(targetDir, sourceDir);
     // Add the intermediate "/"
     strcat(targetDir, "/" );
     // Add the target directory.
     strcat(targetDir, destDir);

     // Check in the target directory to make sure a file with the same name doesn't already exists.
     //
     // Change to the target directory.
     appendStringToLogfile("MoveAFile: Changing to targetdir: %s.",targetDir, WARNING);
     GotoPath( targetDir );
     // Check for the same file.
     appendStringToLogfile("MoveAFile: Calling TAP_Hdd_Exist for:%s",sourceFile, WARNING);
     fileAlreadyExists = TAP_Hdd_Exist(sourceFile);

     // If we're moving a file and the target already exists, try to rename it - if the config option #28 has been set to allow rename..
     while ((fileAlreadyExists) && (fileIncrement < 99999) && (attr != ATTR_FOLDER) && (RenameOnMoveOption!=3))
     {
         fileIncrement++;         // Increase the counter for the number to append to the filename.
         appendIntToLogfile("MoveAFile: fileAlreadyExists loop:%d",fileIncrement, WARNING);
         sprintf(counter, "-%d", fileIncrement);        // Create the counter text
         strncpy( fileName, baseFileName, 256);         // Copy back the original filename
         strcat(  fileName, counter);                   // Append the counter text to the filename
 	     strcat(  fileName, REC_STRING );	            // Append the ".rec" to the end.
         appendStringToLogfile("MoveAFile: fileAlreadyExists loop calling TAP_Hdd_Exist for: %s", fileName, WARNING);
         fileAlreadyExists = TAP_Hdd_Exist(fileName);   // Check if the file exists.
         appendToLogfile("MoveAFile: fileAlreadyExists loop TAP_Hdd_Exist finished", WARNING);
     }

     // Return to the original directory.
     appendStringToLogfile("MoveAFile: Changing to sourceDir: %s.",sourceDir, WARNING);
     GotoPath( sourceDir );
     
    // Set up appropriate text strings for message windows, depending on whether it's a file or folder. 
     switch (attr)
     {
           case ATTR_FOLDER: TAP_SPrint(title1, "Folder Move Failed.");
                             TAP_SPrint(title2, "");
                             TAP_SPrint(str1,   "Same folder already exists:");
                             TAP_SPrint(str2,   "");
                             break;
                
           default:          TAP_SPrint(title1, "File Move Failed.");
                             TAP_SPrint(title2, "File Move Conflict.");
                             TAP_SPrint(str1,   "Same file already exists.");
                             TAP_SPrint(str2,   "Same file already exists.  Rename to:");
                             break;
     }
     
     // Copy source and destination information to Global variables so that they are available for the actual move routine.
     strncpy( GlbSourceFile, sourceFile, 256 );   // Copy the source filename
     strncpy( GlbSourceDir,  sourceDir,  256 );   // Copy the source directory
     strncpy( GlbTargetDir,  targetDir,  256 );   // Copy the target directory
     
     // If the target file already exists in the target directory we can't move.
     if (fileAlreadyExists)
     {
         ShowMessageWin( rgn, title1, str1, sourceFile, 400 );
         fileMoved      = FALSE;
         returnFromMove = FALSE;   // Don't close the Move window to give user a chance to choose a different folder.
         return;                   // Jump out of this routine as we can't do the move.
     }

     // Check if we needed to rename the file in the target directory.
     if (fileIncrement > 0) 
     {
         strncpy( GlbRenamedFile, fileName, 256 );   // Copy the renamed filename into the Global variable
         // Check the config option #28 to see if the Rename On Move requires a confirmation or not.
         if (RenameOnMoveOption == 0)   // Need to display a confirmation panel.
         {
                  DisplayYesNoWindow(title2, str2, fileName, "Yes", "No", 1, &ReturnFromMoveRenameYesNo );
                  fileMoved      = FALSE;
                  returnFromMove = FALSE;   // Don't close the Move window until after the Yes/No window.
                  return;                   // Jump out of this routine as Move will be done after Yes/No window.
         }
         else   // Otherwise call routine as if we said "Yes" on the confirmation window.
         {
                  ReturnFromMoveRenameYesNo( TRUE );
                  return;                    // Jump out of this routine as we've already done the move in the ReturnFromMoveRenameYesNo routine.
         }
         
     }
     
     // Call the routine to perform the actual move.
     PerformMove();

     appendToLogfile("MoveAFile: Finished.", WARNING);
   
}
Exemple #13
0
int TAP_Main (void)
{
  AddTime(0, 0);
  BMP_WriteHeader(NULL, 0, 0);
  BootReason();
  BuildWindowBorder();
  BuildWindowInfo();
  BuildWindowLine();
  BuildWindowLineSelected();
  BuildWindowScrollBar();
  BuildWindowTitle();
  busyWait();
  CalcAbsSectorFromFAT(NULL, 0);
  CalcPrepare();
  CalcTopIndex(0, 0);
  Callback(0, NULL, 0, 0, 0, 0);
  CallbackHelper(NULL, NULL, 0, 0, 0, 0);
  CallBIOS(0, 0, 0, 0, 0);
  CallFirmware(0, 0, 0, 0, 0);
  CallTraceEnable(FALSE);
  CallTraceEnter(NULL);
  CallTraceExit(NULL);
  CallTraceInit();
  CaptureScreen(0, 0, 0, NULL, 0, 0);
  ChangeDirRoot();
  CheckSelectable(0, 0);
  combineVfdData(NULL, NULL);
  compact(NULL, 0);
  CompressBlock(NULL, 0, NULL);
  CompressedTFDSize(NULL, 0, NULL);
  CompressTFD(NULL, 0, NULL, 0, 0, NULL);
  CRC16(0, NULL, 0);
  CRC32 (0, NULL, 0);
  Delay(0);
  DialogEvent(NULL, NULL, NULL);
  DialogMsgBoxButtonAdd(NULL, FALSE);
  DialogMsgBoxExit();
  DialogMsgBoxInit(NULL, NULL, NULL, NULL);
  DialogMsgBoxShow();
  DialogMsgBoxShowInfo(0);
  DialogMsgBoxShowOK();
  DialogMsgBoxShowOKCancel(0);
  DialogMsgBoxShowYesNo(0);
  DialogMsgBoxShowYesNoCancel(0);
  DialogMsgBoxTitleSet(NULL, NULL);
  DialogProfileChange(NULL);
  DialogProfileCheck(NULL, NULL, FALSE);
  DialogProfileLoad(NULL);
  DialogProfileLoadDefault();
  DialogProfileLoadMy(NULL, FALSE);
  DialogProfileSave(NULL);
  DialogProfileSaveDefault();
  DialogProfileScrollBehaviourChange(FALSE, FALSE);
  DialogProgressBarExit();
  DialogProgressBarInit(NULL, NULL, 0, 0, NULL, 0, 0);
  DialogProgressBarSet(0, 0);
  DialogProgressBarShow();
  DialogProgressBarTitleSet(NULL);
  DialogWindowChange(NULL, FALSE);
  DialogWindowCursorChange(FALSE);
  DialogWindowCursorSet(0);
  DialogWindowExit();
  DialogWindowHide();
  DialogWindowInfoAddIcon(0, 0, NULL);
  DialogWindowInfoAddS(0, 0, 0, NULL, 0, 0, 0, 0, 0);
  DialogWindowInfoDeleteAll();
  DialogWindowInit(NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, 0, 0, 0);
  DialogWindowItemAdd(NULL, 0, NULL, 0, FALSE, FALSE, 0, NULL);
  DialogWindowItemAddSeparator();
  DialogWindowItemChangeFlags(0, FALSE, FALSE);
  DialogWindowItemChangeIcon(0, 0, NULL);
  DialogWindowItemChangeParameter(0, NULL, 0);
  DialogWindowItemChangeValue(0, NULL, 0);
  DialogWindowItemDelete(0);
  DialogWindowItemDeleteAll();
  DialogWindowRefresh();
  DialogWindowReInit(0, 0, 0, 0, 0, 0);
  DialogWindowScrollDown();
  DialogWindowScrollDownPage();
  DialogWindowScrollUp();
  DialogWindowScrollUpPage();
  DialogWindowShow();
  DialogWindowTabulatorSet(0, 0);
  DialogWindowTitleChange(NULL, NULL, NULL);
  DialogWindowTypeChange(0);
  DrawMsgBoxButtons();
  DrawMsgBoxTitle();
  DrawOSDLine(0, 0, 0, 0, 0, 0);
  DrawProgressBarBar(0, 0);
  DrawProgressBarTitle();
  DrawWindowBorder();
  DrawWindowInfo();
  DrawWindowLine(0);
  DrawWindowLines();
  DrawWindowScrollBar();
  DrawWindowTitle();
  EndMessageWin();
  exitHook();
  ExtractLine(NULL, NULL);
  FileSelector(NULL, NULL, NULL, 0);
  FileSelectorKey(0, 0);
  FindDBTrack();
  FindInstructionSequence(NULL, NULL, 0, 0, 0, 0);
  findSendToVfdDisplay(0, 0);
  FlashAddFavourite(NULL, 0, FALSE);
  FlashDeleteFavourites();
  FlashFindEndOfServiceNameTableAddress();
  FlashFindEndOfServiceTableAddress(0);
  FlashFindServiceAddress(0, 0, 0, 0);
  FlashFindTransponderIndex(0, 0, 0);
  FlashGetBlockStartAddress(0);
  FlashGetChannelNumber(0, 0, 0, 0);
  FlashGetSatelliteByIndex(0);
  FlashGetServiceByIndex(0, FALSE);
  FlashGetServiceByName (NULL, FALSE);
  FlashGetTransponderCByIndex(0);
  FlashGetTransponderSByIndex(0, 0);
  FlashGetTransponderTByIndex(0);
  FlashGetTrueLocalTime(0, 0);
  FlashGetType();
  FlashInitialize(0);
  FlashProgram();
  FlashReindexFavourites(0, 0, 0);
  FlashReindexTimers(0, 0, 0);
  FlashRemoveCASServices(FALSE);
  FlashRemoveServiceByIndex(0, FALSE);
  FlashRemoveServiceByIndexString(NULL, FALSE);
  FlashRemoveServiceByLCN(NULL, FALSE);
  FlashRemoveServiceByName(NULL, FALSE);
  FlashRemoveServiceByPartOfName(NULL, FALSE);
  FlashRemoveServiceByUHF(NULL, FALSE, FALSE);
  FlashServiceAddressToServiceIndex(NULL);
  FlashWrite(NULL, NULL, 0, NULL);
  FlushCache(NULL, 0);
  FreeOSDRegion(0);
  fwHook(0);
  GetAudioTrackPID(0, NULL);
  GetClusterPointer(0);
  GetCurrentEvent(NULL);
  GetEEPROMAddress();
  GetEEPROMPin();
  GetFrameBufferPixel(0, 0);
  GetFrameSize(0, 0);
  GetFWInfo(0, 0, 0, 0, 0, 0, 0, 0);
  GetHeapParameter(NULL, 0);
  GetLine(NULL, 0);
  GetOSDMapAddress();
  GetOSDRegionHeight(0);
  GetOSDRegionWidth(0);
  GetPinStatus();
  GetPIPPosition(NULL, NULL, NULL, NULL);
  getRECSlotAddress();
  GetSysOsdControl(0);
  GetToppyString(0);
  HasEnoughItemMemory();
  HDD_AAM_Disable();
  HDD_AAM_Enable(0);
  HDD_APM_Disable();
  HDD_APM_Enable(0);
  HDD_BigFile_Read(NULL, 0, 0, NULL);
  HDD_BigFile_Size(NULL);
  HDD_BigFile_Write(NULL, 0, 0, NULL);
  HDD_ChangeDir(NULL);
  HDD_DecodeRECHeader(NULL, NULL);
  HDD_EncodeRECHeader(NULL, NULL, 0);
  HDD_FappendOpen(NULL);
  HDD_FappendWrite(NULL, NULL);
  HDD_FindPCR(NULL, 0);
  HDD_FindPMT(NULL, 0, NULL);
  HDD_FreeSize();
  HDD_GetClusterSize();
  HDD_GetFileDir(NULL, 0, NULL);
  HDD_GetFirmwareDirCluster();
  HDD_GetHddID(NULL, NULL, NULL);
  HDD_IdentifyDevice(NULL);
  HDD_isAnyRecording();
  HDD_isCryptedStream(NULL, 0);
  HDD_isRecording(0);
  HDD_LiveFS_GetChainLength(0);
  HDD_LiveFS_GetFAT1Address();
  HDD_LiveFS_GetFAT2Address();
  HDD_LiveFS_GetFirstCluster(0);
  HDD_LiveFS_GetLastCluster(0);
  HDD_LiveFS_GetNextCluster(0);
  HDD_LiveFS_GetPreviousCluster(0);
  HDD_LiveFS_GetRootDirAddress();
  HDD_LiveFS_GetSuperBlockAddress();
  HDD_MakeNewRecName(NULL, 0);
  HDD_Move(NULL, NULL, NULL);
  HDD_ReadClusterDMA(0, NULL);
  HDD_ReadSector(0, 0);
  HDD_ReadSectorDMA(0, 0, NULL);
  HDD_RECSlotGetAddress(0);
  HDD_RECSlotIsPaused(0);
  HDD_RECSlotPause(0, FALSE);
  HDD_RECSlotSetDuration(0, 0);
  HDD_SetCryptFlag(NULL, 0);
  HDD_SetFileDateTime(NULL, 0, 0, 0);
  HDD_SetSkipFlag (NULL, FALSE);
  HDD_SetStandbyTimer(0);
  HDD_Smart_DisableAttributeAutoSave();
  HDD_Smart_DisableOperations();
  HDD_Smart_EnableAttributeAutoSave();
  HDD_Smart_EnableOperations();
  HDD_Smart_ExecuteOfflineImmediate(0);
  HDD_Smart_ReadData(0);
  HDD_Smart_ReadThresholdData(0);
  HDD_Smart_ReturnStatus();
  HDD_Stop();
  HDD_TAP_Callback(0, NULL, 0, 0, 0, 0);
  HDD_TAP_Disable(0, 0);
  HDD_TAP_DisableAll(0);
  HDD_TAP_DisabledEventHandler(0, 0, 0);
  HDD_TAP_GetCurrentDir(NULL);
  HDD_TAP_GetCurrentDirCluster();
  HDD_TAP_GetIDByFileName(NULL);
  HDD_TAP_GetIDByIndex(0);
  HDD_TAP_GetIndexByID(0);
  HDD_TAP_GetInfo(0, NULL);
  HDD_TAP_GetStartParameter();
  HDD_TAP_isAnyRunning();
  HDD_TAP_isBatchMode();
  HDD_TAP_isDisabled(0);
  HDD_TAP_isDisabledAll();
  HDD_TAP_isRunning(0);
  HDD_TAP_SendEvent(0, FALSE, 0, 0, 0);
  HDD_TAP_SetCurrentDirCluster(0);
  HDD_TAP_Start(NULL, FALSE, NULL, NULL);
  HDD_TAP_StartedByTAP();
  HDD_TAP_Terminate(0);
  HDD_TouchFile(NULL);
  HDD_TranslateDirCluster(0, NULL);
  HDD_TruncateFile(NULL, 0);
  HDD_Write(NULL, 0, NULL);
  HDD_WriteClusterDMA(0, NULL);
  HDD_WriteSectorDMA(0, 0, NULL);
  HookEnable(0, 0);
  HookExit();
  HookIsEnabled(0);
  HookMIPS_Clear(0, 0, 0);
  HookMIPS_Set(0, 0, 0);
  HookSet(0, 0);
  IMEM_Alloc(0);
  IMEM_Init(0);
  IMEM_isInitialized();
  IMEM_Compact();
  IMEM_Free(NULL);
  IMEM_GetInfo(NULL, NULL);
  IMEM_Kill();
  InfoTestGrid();
  INICloseFile();
  INIFindStartEnd(NULL, NULL, NULL, 0);
  INIGetARGB(NULL, NULL, NULL, NULL, NULL, 0);
  INIGetHexByte(NULL, 0, 0, 0);
  INIGetHexDWord(NULL, 0, 0, 0);
  INIGetHexWord(NULL, 0, 0, 0);
  INIGetInt(NULL, 0, 0, 0);
  INIGetString(NULL, NULL, NULL, 0);
  INIKillKey(NULL);
  INIOpenFile(NULL);
  INISaveFile(NULL);
  INISetARGB(NULL, 0, 0, 0, 0);
  INISetComment(NULL);
  INISetHexByte(NULL, 0);
  INISetHexDWord(NULL, 0);
  INISetHexWord(NULL, 0);
  INISetInt(NULL, 0);
  INISetString(NULL, NULL);
  initCodeWrapper(0);
  InitTAPAPIFix();
  InitTAPex();
  InteractiveGetStatus();
  InteractiveSetStatus(FALSE);
  intLock();
  intUnlock(0);
  isAnyOSDVisible(0, 0, 0, 0);
  isLegalChar(0, 0);
  isMasterpiece();
  isMPMenu();
  iso639_1(0);
  isOSDRegionAlive(0);
  isValidChannel(NULL);
  LangGetString(0);
  LangLoadStrings(NULL, 0, 0);
  LangUnloadStrings();
  Log(NULL, NULL, FALSE, 0, NULL);
  LowerCase(NULL);
  MakeValidFileName(NULL, 0);
  MHEG_Status();
  MPDisplayClearDisplay();
  MPDisplayClearSegments(0, 0);
  MPDisplayDisplayLongString(NULL);
  MPDisplayDisplayShortString(NULL);
  MPDisplayGetDisplayByte(0);
  MPDisplayGetDisplayMask(0);
  MPDisplayInstallMPDisplayFwHook();
  MPDisplaySetAmFlag(0);
  MPDisplaySetColonFlag(0);
  MPDisplaySetDisplayByte(0, 0);
  MPDisplaySetDisplayMask(0, 0);
  MPDisplaySetDisplayMemory(NULL);
  MPDisplaySetDisplayMode(0);
  MPDisplaySetPmFlag(0);
  MPDisplaySetSegments(0, 0);
  MPDisplayToggleSegments(0, 0);
  MPDisplayUninstallMPDisplayFwHook();
  MPDisplayUpdateDisplay();
  Now(NULL);
  OSDCopy(0, 0, 0, 0, 0, 0, 0);
  OSDLinesForeDirty(FALSE);
  ParseLine(NULL, NULL, 0);
  ProfileDirty();
  ProfileInit();
  ProfileLoad(NULL, FALSE);
  ProfileMayReload();
  ReadEEPROM(0, 0, NULL);
  ReadIICRegister(0, 0, 0, 0, NULL);
  Reboot(0);
  ReceiveSector(0);
  RTrim(NULL);
  SaveBitmap(NULL, 0, 0, NULL);
  SendEvent(0, 0, 0, 0);
  SendEventHelper(NULL, 0, 0, 0);
  SendHDDCommand(0, 0, 0, 0, 0, 0, 0);
  SendToFP(NULL);
  SeparatePathComponents(NULL, NULL, NULL, NULL);
  SetCrashBehaviour(0);
  setSymbol14(0, 0);
  setSymbol17(0, 0);
  ShowMessageWin(NULL, NULL, NULL, 0);
  ShowMessageWindow(NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  Shutdown(0);
  SoundSinus(0, 0, 0);
  StrEndsWith(NULL, NULL);
  stricstr(NULL, NULL);
  SubtitleGetStatus();
  SubtitleSetStatus(FALSE);
  SuppressedAutoStart();
  SwapDWords(0);
  SwapWords(0);
  TAP_Osd_PutFreeColorGd(0, 0, 0, NULL, FALSE, 0);
  TAPCOM_CloseChannel(NULL);
  TAPCOM_Finish(NULL, 0);
  TAPCOM_GetChannel(0, NULL, NULL, NULL, NULL);
  TAPCOM_GetReturnValue(NULL);
  TAPCOM_GetStatus(NULL);
  TAPCOM_LastAlive(NULL);
  TAPCOM_OpenChannel(0, 0, 0, NULL);
  TAPCOM_Reject(NULL);
  TAPCOM_StillAlive(NULL);
  TFDSize(NULL);
  TimeDiff(0, 0);
  TimeFormat(0, 0, 0);
  TunerGet(0);
  TunerSet(0);
  UncompressBlock(NULL, 0, NULL, 0);
  UncompressedFirmwareSize(NULL);
  UncompressedLoaderSize(NULL);
  UncompressedTFDSize(NULL);
  UncompressFirmware(NULL, NULL, NULL);
  UncompressLoader(NULL, NULL, NULL);
  UncompressTFD(NULL, NULL, NULL);
  UpperCase(NULL);
  ValidFileName(NULL, 0);
  WindowDirty();
  WriteIICRegister(0, 0, 0, 0, NULL);
  YUV2RGB(0, 0, 0, NULL, NULL, NULL);
  YUV2RGB2(0, 0, 0, NULL, NULL, NULL);

  return 0;
}
void CheckPlaybackStatus( void )
{
   bool         matchFound;
   int          i, l, l1, l2;
  
     
   // Check for Playbackmode
   iOverRunCheck = ApiOverRunCheck;   // Set flag to catch any buffer overrun from API call.
   TAP_Hdd_GetPlayInfo (&CurrentPlaybackInfo);

   if ( iOverRunCheck != ApiOverRunCheck )  // TAP_Hdd_GetPlayInfo V1.22 has a buffer overrun issue, so check if it has overrun by more than 128 bytes.
   {
      ShowMessageWin( rgn, "Archive:  Error retrieving Playback Info", "TAP_Hdd_GetPlayInfo buffer overrun", "in 'CheckPlaybackStatus'.", 500 );
      return;
   }

   // Check the various playmodes to see if we are playing a file back.
   // PLAYMODE_None               Nothing playing
   // PLAYMODE_Playing            Playing a file
   // PLAYMODE_RecPlaying         Playing a currently recording file
   //
   // If we're not in playback then just return.
   if (CurrentPlaybackInfo.playMode != PLAYMODE_Playing)   // We're not in playback mode  
   {
       if (inPlaybackMode) // We were in playback mode, but now we've stopped.
       {
           SaveDatToFile(); // Write the information (particularly the last played file details) to disk
       }
       inPlaybackMode = FALSE;
       return;
   }    
   
   inPlaybackMode = TRUE;

   // Assign variable to the file entry for easier use.
   CurrentPlaybackFile = CurrentPlaybackInfo.file;
   
   // Copy the current playing info to the 'last' variable so we can restart the very last playback.
   playedFiles[0]->startCluster = CurrentPlaybackFile->startCluster;   // Save the disk start cluster.
   playedFiles[0]->currentBlock = CurrentPlaybackInfo.currentBlock;   // Save the current block position.
   playedFiles[0]->totalBlock   = CurrentPlaybackInfo.totalBlock;     // Save the total block size.
   strcpy(playedFiles[0]->name,CurrentPlaybackFile->name);        // Save the file name.
   
   matchFound = FALSE;
   
   // Search through the existing played file list to see if we have a match.
   for (i=1; i<=numberOfPlayedFiles; i++)
   {
        l1 = strlen(playedFiles[i]->name);
        l2 = strlen(CurrentPlaybackFile->name);
        l = max(l1, l2);
        if ((playedFiles[i]->startCluster == CurrentPlaybackFile->startCluster) && (strncmp(playedFiles[i]->name,CurrentPlaybackFile->name,TS_FILE_NAME_SIZE)==0))
        {
              // If we match an existing entry in our playedFiles array, update the currentBlock position information.
              playedFiles[i]->currentBlock = CurrentPlaybackInfo.currentBlock;
              matchFound = TRUE;
              break; // We've found a match, so don't bother checking other playback entries.
        }
   }

   // If we didn't find a match in our existing list of played files, so add to our list if we have space.   
   if ((!matchFound) && (numberOfPlayedFiles < MAX_FILES) && (strcmp(CurrentPlaybackFile->name,"__temprec__.ts")!=0))
   {
         numberOfPlayedFiles++;  // Increase the number of Played Files.
         playedFiles[numberOfPlayedFiles] = TAP_MemAlloc( sizeof (*playedFiles[numberOfPlayedFiles]));
         playedFiles[numberOfPlayedFiles]->startCluster = CurrentPlaybackFile->startCluster;   // Save the disk start cluster.
         playedFiles[numberOfPlayedFiles]->currentBlock = CurrentPlaybackInfo.currentBlock;   // Save the current block position.
         playedFiles[numberOfPlayedFiles]->totalBlock   = CurrentPlaybackInfo.totalBlock;     // Save the total block size.
         strcpy(playedFiles[numberOfPlayedFiles]->name,CurrentPlaybackFile->name);        // Save the file name.
         playinfoChanged = TRUE;  // Set flag so that playback info will get written to disk.
   }     
        
                
     
}