mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-12 17:22:26 -04:00
Fixed the update-libraries script (thanks to Anderson Souza) and added a basic Linux daemon for the server
This commit is contained in:
parent
bb904c4698
commit
5444c9aea6
19 changed files with 260 additions and 84 deletions
|
@ -102,18 +102,16 @@ void (* const iff_free_function[])(void*) = {
|
|||
** API public functions
|
||||
*/
|
||||
|
||||
IFFFile * iff_create()
|
||||
int iff_create(IFFFile * IFFFileInfo)
|
||||
{
|
||||
IFFFile *ptr = calloc(1, sizeof(IFFFile));
|
||||
if(ptr == NULL) return NULL;
|
||||
memset(IFFFileInfo, 0, sizeof(IFFFile));
|
||||
|
||||
ptr->Chunks = calloc(1, sizeof(IFFChunk));
|
||||
if(ptr->Chunks == NULL){
|
||||
free(ptr);
|
||||
return NULL;
|
||||
}
|
||||
ptr->SizeAllocated = sizeof(IFFChunk);
|
||||
return ptr;
|
||||
IFFFileInfo->Chunks = calloc(1, sizeof(IFFChunk));
|
||||
if(IFFFileInfo->Chunks == NULL)
|
||||
return 0;
|
||||
IFFFileInfo->SizeAllocated = sizeof(IFFChunk);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iff_read_header(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned FileSize)
|
||||
|
@ -250,7 +248,4 @@ void iff_delete(IFFFile * IFFFileInfo){
|
|||
free(IFFFileInfo->ResourceMap->FormattedData);
|
||||
free(IFFFileInfo->ResourceMap);
|
||||
}
|
||||
|
||||
free(IFFFileInfo);
|
||||
IFFFileInfo = NULL;
|
||||
}
|
|
@ -345,7 +345,7 @@ extern "C" {
|
|||
** IFF file functions
|
||||
*/
|
||||
|
||||
IFFFile * iff_create();
|
||||
int iff_create(IFFFile * IFFFileInfo);
|
||||
int iff_read_header(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned FileSize);
|
||||
|
||||
IFFChunk * iff_add_chunk(IFFFile * IFFFileInfo);
|
||||
|
|
|
@ -40,7 +40,7 @@ int main(int argc, char *argv[]){
|
|||
clock_t BeginningTime;
|
||||
unsigned chunkcount, chunk;
|
||||
unsigned exported = 0;
|
||||
IFFFile * IFFFileInfo;
|
||||
IFFFile IFFFileInfo;
|
||||
IFFChunk * ChunkData;
|
||||
|
||||
if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){
|
||||
|
@ -95,12 +95,11 @@ int main(int argc, char *argv[]){
|
|||
** Load header information
|
||||
*/
|
||||
|
||||
IFFFileInfo = iff_create();
|
||||
if(IFFFileInfo == NULL){
|
||||
if(!iff_create(&IFFFileInfo)){
|
||||
printf("%sMemory for this file could not be allocated.", "iffexport: error: ");
|
||||
return -1;
|
||||
}
|
||||
if(!iff_read_header(IFFFileInfo, IFFData, FileSize)){
|
||||
if(!iff_read_header(&IFFFileInfo, IFFData, FileSize)){
|
||||
printf("%sNot a valid IFF file.", "iffexport: error: ");
|
||||
return -1;
|
||||
}
|
||||
|
@ -109,19 +108,19 @@ int main(int argc, char *argv[]){
|
|||
** Load entry information
|
||||
*/
|
||||
|
||||
if(!iff_enumerate_chunks(IFFFileInfo, IFFData+64, FileSize-64)){
|
||||
if(!iff_enumerate_chunks(&IFFFileInfo, IFFData+64, FileSize-64)){
|
||||
printf("%sChunk data is corrupt.", "iffexport: error: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
chunkcount = IFFFileInfo->ChunkCount;
|
||||
chunkcount = IFFFileInfo.ChunkCount;
|
||||
printf("This IFF file contains %u chunks.\n\nExporting\n", chunkcount);
|
||||
BeginningTime = clock();
|
||||
|
||||
/****
|
||||
** Extract each entry
|
||||
*/
|
||||
for(chunk = 1, ChunkData = IFFFileInfo->Chunks; chunk <= chunkcount; chunk++, ChunkData++){
|
||||
for(chunk = 1, ChunkData = IFFFileInfo.Chunks; chunk <= chunkcount; chunk++, ChunkData++){
|
||||
char name[256], destination[256];
|
||||
char filter[] = "\\/:*?\"<>|";
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue