|
@@ -1154,6 +1154,9 @@ laProp *laAddRawProperty(laPropContainer *Container, const char *Identifier, con
|
|
la_AssignPropertyGeneralSub(p);
|
|
la_AssignPropertyGeneralSub(p);
|
|
return p;
|
|
return p;
|
|
}
|
|
}
|
|
|
|
+void laRawPropertyExtraFunctions(laProp* p, laRawMultiGetF MultiGet, laRawMultiCanGetF CanMultiGet){
|
|
|
|
+ laRawProp *rp=p; rp->RawMultiCanGet=CanMultiGet; rp->RawMultiGet=MultiGet;
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
//void laPropertySignal(laProp* p, int Throw, int Catch) {
|
|
//void laPropertySignal(laProp* p, int Throw, int Catch) {
|
|
@@ -2042,7 +2045,15 @@ void* laGetRaw(laPropPack *pp, int* r_size, int* return_is_a_copy){
|
|
return data;
|
|
return data;
|
|
} return 0;
|
|
} return 0;
|
|
}
|
|
}
|
|
-int laSetRaw(laPropPack *pp, void* data, int _size){
|
|
|
|
|
|
+int laGetMultiRaw(laPropPack* pp, int* r_chunks, int* r_sizes, void** pointers){
|
|
|
|
+ if (pp->LastPs->p->PropertyType == LA_PROP_RAW){
|
|
|
|
+ laRawProp* rp=pp->LastPs->p; if(!rp->RawMultiGet){ return 0; }
|
|
|
|
+ rp->RawMultiGet(pp->LastPs->UseInstance,r_chunks,r_sizes,pointers);
|
|
|
|
+ if(*r_chunks>0){ return 1; } return 0;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+int laSetRaw(laPropPack *pp, void* data, uint32_t _size){
|
|
if (pp->LastPs->p->PropertyType == LA_PROP_RAW){ laRawProp* rp=pp->LastPs->p;
|
|
if (pp->LastPs->p->PropertyType == LA_PROP_RAW){ laRawProp* rp=pp->LastPs->p;
|
|
if(rp->RawSet){ rp->RawSet(pp->LastPs->UseInstance, data, _size); return 1; }
|
|
if(rp->RawSet){ rp->RawSet(pp->LastPs->UseInstance, data, _size); return 1; }
|
|
if(rp->Base.OffsetIsPointer){ void** target=(((char*)pp->LastPs->UseInstance)+rp->Base.Offset); if(*target) free(*target);
|
|
if(rp->Base.OffsetIsPointer){ void** target=(((char*)pp->LastPs->UseInstance)+rp->Base.Offset); if(*target) free(*target);
|
|
@@ -2088,6 +2099,10 @@ int laGetFloatRange(laPropPack *pp, real *min, real *max){
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int laCanGetMultiRaw(laProp *p,void* inst){
|
|
|
|
+ laRawProp *rp = p; if (p->PropertyType == LA_PROP_RAW){
|
|
|
|
+ if (rp->RawMultiGet && (!rp->RawMultiCanGet || rp->RawMultiCanGet(inst))) return 1; } return 0;
|
|
|
|
+}
|
|
int laCanGetState(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetState) return 1; } return 0; }
|
|
int laCanGetState(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetState) return 1; } return 0; }
|
|
int laCanGetTheme(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetTheme) return 1; } return 0; }
|
|
int laCanGetTheme(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetTheme) return 1; } return 0; }
|
|
int laCanGetGap(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetGap) return 1; } return 0; }
|
|
int laCanGetGap(laProp *sub){ laSubProp *sp = sub; if (sub->PropertyType == LA_PROP_SUB){ if (sp->GetGap) return 1; } return 0; }
|
|
@@ -2415,6 +2430,9 @@ void la_WriteOnlyMBString(laUDF *udf, char *String){
|
|
void la_WriteInt(laUDF *udf, int Data){
|
|
void la_WriteInt(laUDF *udf, int Data){
|
|
fwrite(&Data, sizeof(int), 1, udf->DiskFile);
|
|
fwrite(&Data, sizeof(int), 1, udf->DiskFile);
|
|
}
|
|
}
|
|
|
|
+void la_WriteUInt(laUDF *udf, uint32_t Data){
|
|
|
|
+ fwrite(&Data, sizeof(uint32_t), 1, udf->DiskFile);
|
|
|
|
+}
|
|
void la_WriteUByte(laUDF *udf, unsigned char Data){
|
|
void la_WriteUByte(laUDF *udf, unsigned char Data){
|
|
fwrite(&Data, sizeof(unsigned char), 1, udf->DiskFile);
|
|
fwrite(&Data, sizeof(unsigned char), 1, udf->DiskFile);
|
|
}
|
|
}
|
|
@@ -2452,6 +2470,12 @@ int la_ReadInt(laUDF *udf){
|
|
else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(int)); udf->Seek += sizeof(int); }
|
|
else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(int)); udf->Seek += sizeof(int); }
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+uint32_t la_ReadUInt(laUDF *udf){
|
|
|
|
+ uint32_t result;
|
|
|
|
+ if(!udf->FileContent){ fread(&result, sizeof(uint32_t), 1, udf->DiskFile); }
|
|
|
|
+ else{ memcpy(&result, udf->FileContent + udf->Seek, sizeof(uint32_t)); udf->Seek += sizeof(uint32_t); }
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
u64bit la_ReadLong(laUDF *udf){
|
|
u64bit la_ReadLong(laUDF *udf){
|
|
u64bit result;
|
|
u64bit result;
|
|
if(!udf->FileContent){ fread(&result, sizeof(u64bit), 1, udf->DiskFile); }
|
|
if(!udf->FileContent){ fread(&result, sizeof(u64bit), 1, udf->DiskFile); }
|
|
@@ -2508,8 +2532,8 @@ void la_ReadBuffer(laUDF *udf, u64bit Size, void *Result){
|
|
if(!udf->FileContent){ fread(Result, Size, 1, udf->DiskFile); }
|
|
if(!udf->FileContent){ fread(Result, Size, 1, udf->DiskFile); }
|
|
else{ memcpy(Result, udf->FileContent + udf->Seek, Size); udf->Seek += Size; }
|
|
else{ memcpy(Result, udf->FileContent + udf->Seek, Size); udf->Seek += Size; }
|
|
}
|
|
}
|
|
-void* la_ReadRaw(laUDF *udf, int* _sz){
|
|
|
|
- int _size = la_ReadInt(udf);
|
|
|
|
|
|
+void* la_ReadRaw(laUDF *udf, uint32_t* _sz){
|
|
|
|
+ uint32_t _size = la_ReadUInt(udf);
|
|
if(_sz){
|
|
if(_sz){
|
|
if (_size){
|
|
if (_size){
|
|
void* data=calloc(1,_size);
|
|
void* data=calloc(1,_size);
|
|
@@ -2750,7 +2774,7 @@ void la_WriteEnumProp(laUDF *udf, laPropPack *pp){
|
|
void la_ReadRawProp(laUDF *udf, laPropPack *pp){
|
|
void la_ReadRawProp(laUDF *udf, laPropPack *pp){
|
|
la_ReadShort(udf);//mark
|
|
la_ReadShort(udf);//mark
|
|
if (pp) {
|
|
if (pp) {
|
|
- int _size=0;
|
|
|
|
|
|
+ uint32_t _size=0;
|
|
void* data=la_ReadRaw(udf,&_size);
|
|
void* data=la_ReadRaw(udf,&_size);
|
|
laSetRaw(pp, data, _size); free(data);
|
|
laSetRaw(pp, data, _size); free(data);
|
|
}else{
|
|
}else{
|
|
@@ -2759,11 +2783,22 @@ void la_ReadRawProp(laUDF *udf, laPropPack *pp){
|
|
}
|
|
}
|
|
void la_WriteRawProp(laUDF *udf, laPropPack *pp){
|
|
void la_WriteRawProp(laUDF *udf, laPropPack *pp){
|
|
laProp *p = pp->LastPs->p;
|
|
laProp *p = pp->LastPs->p;
|
|
- void* data; int _size=0, IsCopy=0;
|
|
|
|
- data=laGetRaw(pp, &_size, &IsCopy);
|
|
|
|
la_WriteShort(udf, LA_UDF_RAW_MARK);
|
|
la_WriteShort(udf, LA_UDF_RAW_MARK);
|
|
|
|
+ if(laCanGetMultiRaw(p,pp->LastPs->UseInstance)){
|
|
|
|
+ int chunks=0; uint32_t sizes[128]={0}; void* pointers[128]={0};
|
|
|
|
+ uint32_t totalsize=0;
|
|
|
|
+ if(laGetMultiRaw(pp,&chunks,sizes,pointers)){ TNS_CLAMP(chunks,1,128);
|
|
|
|
+ for(int i=0;i<chunks;i++){ totalsize+=sizes[i]; } la_WriteUInt(udf,totalsize);
|
|
|
|
+ if(totalsize){
|
|
|
|
+ for(int i=0;i<chunks;i++){ if(sizes[i] && pointers[i]){ la_WriteSized(udf,pointers[i],sizes[i]); free(pointers[i]); } }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ void* data; uint32_t _size=0, IsCopy=0;
|
|
|
|
+ data=laGetRaw(pp, &_size, &IsCopy);
|
|
if(!data){ _size=0; }
|
|
if(!data){ _size=0; }
|
|
- la_WriteInt(udf,_size);
|
|
|
|
|
|
+ la_WriteUInt(udf,_size);
|
|
if(_size){ la_WriteSized(udf,data,_size); }
|
|
if(_size){ la_WriteSized(udf,data,_size); }
|
|
if(IsCopy && data){ free(data); }
|
|
if(IsCopy && data){ free(data); }
|
|
}
|
|
}
|