Add proto_copy_proto

This commit is contained in:
Alexander Batalov 2023-07-22 14:49:56 +03:00
parent ccabbd7688
commit a4daffa30e
2 changed files with 29 additions and 0 deletions

View File

@ -828,6 +828,34 @@ int _proto_dude_init(const char* path)
return 0;
}
// 0x49FE74
int proto_copy_proto(int srcPid, int dstPid)
{
int srcType;
int dstType;
Proto* src;
Proto* dst;
srcType = PID_TYPE(srcPid);
dstType = PID_TYPE(dstPid);
if (srcType != dstType) {
return -1;
}
if (protoGetProto(srcPid, &src) == -1) {
return -1;
}
if (protoGetProto(dstPid, &dst) == -1) {
return -1;
}
memcpy(dst, src, _proto_sizes[srcType]);
dst->pid = dstPid;
return 0;
}
// 0x49FEDC
bool proto_is_subtype(Proto* proto, int subtype)
{

View File

@ -118,6 +118,7 @@ int objectDataWrite(Object* obj, File* stream);
int _proto_update_init(Object* obj);
int _proto_dude_update_gender();
int _proto_dude_init(const char* path);
int proto_copy_proto(int srcPid, int dstPid);
bool proto_is_subtype(Proto* proto, int subtype);
int protoGetDataMember(int pid, int member, ProtoDataMemberValue* value);
int protoInit();