@@ -42,16 +42,44 @@ py::class_<BResources>(m, "BResources")
4242.def (" Unset" , &BResources::Unset," " )
4343.def (" InitCheck" , &BResources::InitCheck," " )
4444.def (" File" , &BResources::File," " )
45- .def (" LoadResource" , py::overload_cast<type_code, int32,size_t *>(&BResources::LoadResource)," " ,py::arg (" type" ),py::arg (" id" ),py::arg (" _size" ))
46- .def (" LoadResource" , py::overload_cast<type_code,const char *,size_t *>(&BResources::LoadResource)," " ,py::arg (" type" ),py::arg (" name" ),py::arg (" _size" ))
45+ .def (" LoadResource" , py::overload_cast<type_code, int32,size_t *>(&BResources::LoadResource)," " ,py::arg (" type" ),py::arg (" id" ),py::arg (" _size" ))// should we keep these 2 functions? they return const void *
46+ .def (" LoadResource" , py::overload_cast<type_code,const char *,size_t *>(&BResources::LoadResource)," " ,py::arg (" type" ),py::arg (" name" ),py::arg (" _size" ))//
4747.def (" PreloadResourceType" , &BResources::PreloadResourceType," " ,py::arg (" type" )=0 )
4848.def (" Sync" , &BResources::Sync," " )
4949.def (" MergeFrom" , &BResources::MergeFrom," " ,py::arg (" fromFile" ))
5050.def (" WriteTo" , &BResources::WriteTo," " ,py::arg (" file" ))
51- .def (" AddResource" , &BResources::AddResource," " ,py::arg (" type" ),py::arg (" id" ),py::arg (" data" ),py::arg (" length" ),py::arg (" name" )=NULL )
51+ .def (" AddResource" , &BResources::AddResource," " ,py::arg (" type" ),py::arg (" id" ),py::arg (" data" ),py::arg (" length" ),py::arg (" name" )=NULL )// to change <- cannot pass void* data from python
5252.def (" HasResource" , py::overload_cast<type_code, int32>(&BResources::HasResource)," " ,py::arg (" type" ),py::arg (" id" ))
5353.def (" HasResource" , py::overload_cast<type_code,const char *>(&BResources::HasResource)," " ,py::arg (" type" ),py::arg (" name" ))
5454// .def("GetResourceInfo", py::overload_cast<int32, type_code *, int32*, const char * *, size_t *>(&BResources::GetResourceInfo), "", py::arg("byIndex"), py::arg("typeFound"), py::arg("idFound"), py::arg("nameFound"), py::arg("lengthFound"))
55+ /* .def("GetResourceInfo", [](BResources& self, int32 byIndex) {
56+ type_code typeFound;
57+ int32 idFound;
58+ const char* nameFound;
59+ size_t lengthFound;
60+ bool result = self.GetResourceInfo(byIndex, &typeFound, &idFound, &nameFound, &lengthFound);
61+
62+ // Creare una lista Python per contenere i risultati
63+ py::list resultList;
64+
65+ // Iterare attraverso i dati restituiti estrarre ciascun blocco
66+ size_t currentIndex = 0;
67+ while (currentIndex < lengthFound) {
68+ // Trova la lunghezza del blocco corrente
69+ size_t currentBlockLength = strlen(nameFound + currentIndex);
70+
71+ // Estrai il blocco corrente
72+ std::string currentBlock(nameFound + currentIndex, currentBlockLength);
73+
74+ // Aggiungi il blocco alla lista Python
75+ resultList.append(py::bytes(currentBlock));
76+
77+ // Passa al prossimo blocco
78+ currentIndex += currentBlockLength + 1; // +1 per includere il terminatore nullo
79+ }
80+
81+ return py::make_tuple(result, static_cast<int>(typeFound), idFound, resultList);
82+ }, "", py::arg("byIndex"))*/
5583.def (" GetResourceInfo" , [](BResources& self, int32 byIndex){
5684 type_code typeFound;
5785 int32 idFound;
@@ -63,7 +91,6 @@ py::class_<BResources>(m, "BResources")
6391
6492return py::make_tuple (result,static_cast <int >(typeFound), idFound, byteSequence, lengthFound);
6593}," " ,py::arg (" byIndex" ))// <- this works
66-
6794// .def("GetResourceInfo", py::overload_cast<type_code, int32, int32*, const char * *, size_t *>(&BResources::GetResourceInfo), "", py::arg("byType"), py::arg("andIndex"), py::arg("idFound"), py::arg("nameFound"), py::arg("lengthFound"))
6895.def (" GetResourceInfo_byTypeAndIndex" , [](BResources& self, type_code byType, int32 andIndex){
6996 int32 idFound;