|
@@ -1861,7 +1861,7 @@ void *laGetInstance(laProp *sub, void *FromInstance, laPropIterator *Iter){
|
|
|
if (!FromInstance) return 0;
|
|
|
if (sp->Get) return sp->Get(FromInstance, Iter);
|
|
|
else if (sp->ListHandleOffset){
|
|
|
- void *address = *((long long *)((BYTE *)FromInstance + sp->ListHandleOffset));
|
|
|
+ void *address = *((u64bit*)((BYTE *)FromInstance + sp->ListHandleOffset));
|
|
|
return address;
|
|
|
}else return laGetActiveInstance(sub, FromInstance, Iter);
|
|
|
}
|
|
@@ -2319,8 +2319,8 @@ void la_WriteUByte(laUDF *udf, unsigned char Data){
|
|
|
void la_WriteShort(laUDF *udf, short Data){
|
|
|
fwrite(&Data, sizeof(short), 1, udf->DiskFile);
|
|
|
}
|
|
|
-void la_WriteLong(laUDF *udf, long Data){
|
|
|
- fwrite(&Data, sizeof(long), 1, udf->DiskFile);
|
|
|
+void la_WriteLong(laUDF *udf, u64bit Data){
|
|
|
+ fwrite(&Data, sizeof(u64bit), 1, udf->DiskFile);
|
|
|
}
|
|
|
void la_WritePointer(laUDF *udf, void *Data){
|
|
|
fwrite(&Data, sizeof(void *), 1, udf->DiskFile);
|
|
@@ -2350,10 +2350,10 @@ int la_ReadInt(laUDF *udf){
|
|
|
else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(int)); udf->Seek += sizeof(int); }
|
|
|
return result;
|
|
|
}
|
|
|
-long la_ReadLong(laUDF *udf){
|
|
|
- long result;
|
|
|
- if(!udf->FileContent){ fread(&result, sizeof(long), 1, udf->DiskFile); }
|
|
|
- else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(long)); udf->Seek += sizeof(long); }
|
|
|
+u64bit la_ReadLong(laUDF *udf){
|
|
|
+ u64bit result;
|
|
|
+ if(!udf->FileContent){ fread(&result, sizeof(u64bit), 1, udf->DiskFile); }
|
|
|
+ else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(u64bit)); udf->Seek += sizeof(u64bit); }
|
|
|
return result;
|
|
|
}
|
|
|
void *la_ReadPointer(laUDF *udf){
|
|
@@ -2716,7 +2716,7 @@ int la_WriteProp(laUDF *udf, laPropPack *pp, int FromThis, int UseInstanceList){
|
|
|
u64bit pReserve = 0, pContinue = 0;
|
|
|
int ItemNum = 0, PropNum = 0;
|
|
|
int counted = 0;
|
|
|
- long pEachCount;
|
|
|
+ u64bit pEachCount;
|
|
|
|
|
|
SubPP.LastPs = &SubPS;
|
|
|
|
|
@@ -3731,20 +3731,20 @@ void laClearUDFRegistries(){
|
|
|
}
|
|
|
}
|
|
|
void laGetSubResourceDirectories(char* rootpath_with_slash, laListHandle* out){
|
|
|
- laSafeString*s=0; strSafePrint(&s, "%sUDFExtra/", rootpath_with_slash); lstAppendPointer(out,s);
|
|
|
+ laSafeString*s=0; strSafePrint(&s, "%sUDFExtra" LA_PATH_SEPSTR, rootpath_with_slash); lstAppendPointer(out,s);
|
|
|
char Final[1024];
|
|
|
sprintf(Final, "%s.udfextra",rootpath_with_slash);
|
|
|
FILE* f=fopen(Final, "r"); if(!f){ return; }
|
|
|
char dir[1024];
|
|
|
- while(fgets(dir,1024,f)){ laSafeString*s=0; strSafePrint(&s, "%s%s/", rootpath_with_slash, dir); lstAppendPointer(out,s); }
|
|
|
+ while(fgets(dir,1024,f)){ laSafeString*s=0; strSafePrint(&s, "%s%s" LA_PATH_SEPSTR, rootpath_with_slash, dir); lstAppendPointer(out,s); }
|
|
|
fclose(f);
|
|
|
}
|
|
|
void laRefreshUDFResourcesIn(char* rootpath){
|
|
|
-#ifdef __linux__
|
|
|
char Final[2048];
|
|
|
- int len=strlen(rootpath);
|
|
|
+ int NumFiles=-1;
|
|
|
+ int len = strlen(rootpath);
|
|
|
if (rootpath[len - 1] != LA_PATH_SEP) strcat(rootpath, LA_PATH_SEPSTR);
|
|
|
-
|
|
|
+#ifdef __linux__
|
|
|
struct dirent **NameList=0;
|
|
|
int NumFiles=scandir(rootpath,&NameList,0,alphasort);
|
|
|
|
|
@@ -3766,16 +3766,43 @@ void laRefreshUDFResourcesIn(char* rootpath){
|
|
|
}
|
|
|
}
|
|
|
for (int i=0;i<NumFiles;i++){ free(NameList[i]); } if(NameList) free(NameList);
|
|
|
+#endif
|
|
|
+#ifdef _WIN32
|
|
|
+ WIN32_FIND_DATA FindFileData;
|
|
|
+ HANDLE hFind;
|
|
|
+ SYSTEMTIME stUTC, stLocal;
|
|
|
+ char Lookup[PATH_MAX];
|
|
|
+ strCopyFull(Lookup, rootpath); strcat(Lookup, "*.*");
|
|
|
+ hFind = FindFirstFile(Lookup, &FindFileData);
|
|
|
+ if (hFind == INVALID_HANDLE_VALUE) return;
|
|
|
+
|
|
|
+ while (1){
|
|
|
+ NumFiles++;
|
|
|
+ char* format = strGetLastSegment(FindFileData.cFileName, '.'); int file_okay = 0;
|
|
|
+ for (laExtensionType* et = MAIN.ExtraExtensions.pFirst; et; et = et->Item.pNext) { if (et->FileType == LA_FILETYPE_UDF && strSame(et->Extension, format)) { file_okay = 1; break; } }
|
|
|
+ if (file_okay) {
|
|
|
+ sprintf(Final, "%s%s", rootpath, FindFileData.cFileName);
|
|
|
+ struct stat s; stat(Final, &s);
|
|
|
+ if (!(s.st_mode & S_IFDIR)) {
|
|
|
+ if (!laFindUDFRegistry(Final)) {
|
|
|
+ laUDFRegistry* r = laCreateUDFRegistry(Final);
|
|
|
+ laUDF* udf = laOpenUDF(Final, 0, r, 0);
|
|
|
+ if (udf) laCloseUDF(udf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!FindNextFile(hFind, &FindFileData))
|
|
|
+ break;
|
|
|
+ }
|
|
|
+#endif
|
|
|
|
|
|
- if(NumFiles>=0){
|
|
|
- laListHandle additionals={0}; laSafeString* s;
|
|
|
+ if (NumFiles >= 0) {
|
|
|
+ laListHandle additionals = { 0 }; laSafeString* s;
|
|
|
laGetSubResourceDirectories(rootpath, &additionals);
|
|
|
- while(s=lstPopPointer(&additionals)){ laRefreshUDFResourcesIn(s->Ptr); strSafeDestroy(&s); }
|
|
|
+ while (s = lstPopPointer(&additionals)) { laRefreshUDFResourcesIn(s->Ptr); strSafeDestroy(&s); }
|
|
|
}
|
|
|
-#endif
|
|
|
}
|
|
|
void laRefreshUDFRegistries(){
|
|
|
-#ifdef __linux__
|
|
|
laClearUDFRegistries();
|
|
|
char LookupM[PATH_MAX];
|
|
|
for(laResourceFolder* rf = MAIN.ResourceFolders.pFirst;rf;rf=rf->Item.pNext){
|
|
@@ -3783,7 +3810,6 @@ void laRefreshUDFRegistries(){
|
|
|
realpath(rf->Path->Ptr, LookupM);
|
|
|
laRefreshUDFResourcesIn(LookupM);
|
|
|
}
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
void laStopManageUDF(laManagedUDF* m){
|