Rebuilt tools

Updated the Mac and PC tools to convert IIgs video files back into
animated GIF files.
This commit is contained in:
Rebecca Heineman 2015-07-31 01:06:19 -07:00
parent b3f838d128
commit 10ea4b36ea
6 changed files with 17 additions and 47 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@
# Ignore project files in the root # Ignore project files in the root
**/bin **/bin
**/temp **/temp
**/ipch
# Allow this folder to be saved # Allow this folder to be saved
!/tools/bin !/tools/bin

Binary file not shown.

Binary file not shown.

BIN
tools/bin/windows/x64/packvideo.exe Normal file → Executable file

Binary file not shown.

Binary file not shown.

View File

@ -391,7 +391,7 @@ static Word ExtractVideo(OutputMemoryStream *pOutput,const Word8 *pInput,WordPtr
static char Name[] = "filexxx.gif"; static char Name[] = "filexxx.gif";
static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilename,const Word8 *pInput,WordPtr uInputLength) static Word EncapsulateToGIF(OutputMemoryStream *pOutput,const Word8 *pInput,WordPtr uInputLength)
{ {
// Too small? // Too small?
if (uInputLength<2) { if (uInputLength<2) {
@ -409,12 +409,11 @@ static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilena
// //
// Decompress a chunk // Decompress a chunk
// //
Word uFrame = 0; Word uFrame = 0;
for (;;) { for (;;) {
Word uChunkSize = LittleEndian::LoadAny(reinterpret_cast<const Word16 *>(pInput)); Word uChunkSize = LittleEndian::LoadAny(reinterpret_cast<const Word16 *>(pInput));
if (uChunkSize>=0xFF00) { if (uChunkSize>=0xFF00) {
printf("End of data, frames = %u\n",uFrame); // printf("End of data, frames = %u\n",uFrame);
break; break;
} }
++uFrame; ++uFrame;
@ -426,7 +425,7 @@ static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilena
printf("Chunk size too small\n"); printf("Chunk size too small\n");
return 10; return 10;
} }
printf("Chunk is %u bytes\n",uChunkSize); // printf("Chunk is %u bytes\n",uChunkSize);
const Word8 *pWork = pInput+2; const Word8 *pWork = pInput+2;
uInputLength -= uChunkSize; uInputLength -= uChunkSize;
pInput+= uChunkSize; pInput+= uChunkSize;
@ -438,7 +437,7 @@ static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilena
Word uType = pWork[0]; Word uType = pWork[0];
++pWork; ++pWork;
--uChunkSize; --uChunkSize;
printf("Token = 0x%02X\n",uType); // printf("Token = 0x%02X\n",uType);
if (uType&0x80) { if (uType&0x80) {
@ -487,7 +486,6 @@ static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilena
} }
} else { } else {
Word uTemp; Word uTemp;
Word8 *pDest = MyImage.GetImage(); Word8 *pDest = MyImage.GetImage();
Word8 *pEnd = pDest+(320*200); Word8 *pEnd = pDest+(320*200);
@ -527,19 +525,12 @@ static Word EncapsulateToGIF(OutputMemoryStream *pOutput,Filename *pOutputFilena
} while (pDest<pEnd); } while (pDest<pEnd);
} }
} }
GIF.Save(pOutput,&MyImage); if (uFrame==1) {
Filename TempName(pOutputFilename[0]); GIF.AnimationSaveStart(pOutput,&MyImage);
TempName.SetFileExtension(NULL); }
NumberString Namex(static_cast<Word32>(uFrame),LEADINGZEROS|3); GIF.AnimationSaveFrame(pOutput,&MyImage,(100U/8U));
String Name2(TempName.GetPtr());
Name2.Remove(Name2.GetLength()-1);
Name2.Append(Namex,3);
TempName.Set(Name2.GetPtr());
TempName.SetFileExtension("gif");
printf("Frame %s\n",TempName.GetPtr());
pOutput->SaveFile(&TempName);
pOutput->Clear();
} }
GIF.AnimationSaveFinish(pOutput);
return 0; return 0;
} }
@ -558,28 +549,6 @@ int BURGER_ANSIAPI main(int argc,const char **argv)
&DoVideo, &DoVideo,
&ConvertToGIF &ConvertToGIF
}; };
#if 0
Filename DeathName;
DeathName.SetFromNative("D:\\projects\\burger\\games\\spaceace\\iigs\\assets\\death\\death07.gif");
FileGIF Giffy;
InputMemoryStream InputMem;
if (!InputMem.Open(&DeathName)) {
Image MyImage;
if (!Giffy.Load(&MyImage,&InputMem)) {
OutputMemoryStream OutputMem;
int i = 1;
do {
OutputMem.Clear();
Giffy.Save(&OutputMem,&MyImage);
char name[256];
sprintf(name,"D:\\projects\\burger\\games\\spaceace\\iigs\\assets\\death\\death07x%d.gif",i);
DeathName.SetFromNative(name);
OutputMem.SaveFile(&DeathName);
++i;
} while (!Giffy.LoadNextFrame(&MyImage,&InputMem));
}
}
#endif
argc = MyApp.GetArgc(); argc = MyApp.GetArgc();
argv = MyApp.GetArgv(); argv = MyApp.GetArgv();
argc = CommandParameter::Process(argc,argv,MyParms,sizeof(MyParms)/sizeof(MyParms[0]), argc = CommandParameter::Process(argc,argv,MyParms,sizeof(MyParms)/sizeof(MyParms[0]),
@ -617,17 +586,17 @@ int BURGER_ANSIAPI main(int argc,const char **argv)
// Convert raw video to GIF // Convert raw video to GIF
} else if (ConvertToGIF.GetValue()) { } else if (ConvertToGIF.GetValue()) {
Filename OutputName;
OutputName.SetFromNative(argv[2]);
OutputMemoryStream Output; OutputMemoryStream Output;
if (EncapsulateToGIF(&Output,&OutputName,pInput,uInputLength)) { if (EncapsulateToGIF(&Output,pInput,uInputLength)) {
printf("Can't convert %s!\n",argv[1]); printf("Can't convert %s!\n",argv[1]);
Globals::SetErrorCode(10); Globals::SetErrorCode(10);
} else { } else {
// if (Output.SaveFile(&OutputName)) { Filename OutputName;
// printf("Can't save %s!\n",argv[2]); OutputName.SetFromNative(argv[2]);
// Globals::SetErrorCode(10); if (Output.SaveFile(&OutputName)) {
// } printf("Can't save %s!\n",argv[2]);
Globals::SetErrorCode(10);
}
} }
} else { } else {
printf("No conversion selected for %s!\n",argv[1]); printf("No conversion selected for %s!\n",argv[1]);