DLL Build

  • Konuyu Başlatan Konuyu Başlatan kyofl3x
  • Başlangıç tarihi Başlangıç tarihi

kyofl3x

Platinum Üye
Katılım
4 Mar 2026
Mesajlar
227
Beğeniler
39
// ScriptStruct CoreUObject.Color
// 0x0004 (0x0004 - 0x0000)
struct alignas(0x04) FColor final
{
public:
uint8_t B; // 0x0000(0x0001)(Edit, BlueprintVisible, ZeroConstructor, SaveGame, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
uint8_t G; // 0x0001(0x0001)(Edit, BlueprintVisible, ZeroConstructor, SaveGame, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
uint8_t R; // 0x0002(0x0001)(Edit, BlueprintVisible, ZeroConstructor, SaveGame, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
uint8_t A; // 0x0003(0x0001)(Edit, BlueprintVisible, ZeroConstructor, SaveGame, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
};
static_assert(alignof(FColor) == 0x000004, "Wrong alignment on FColor");
static_assert(sizeof(FColor) == 0x000004, "Wrong size on FColor");
static_assert(offsetof(FColor, B) == 0x000000, "Member 'FColor::B' has a wrong offset!");
static_assert(offsetof(FColor, G) == 0x000001, "Member 'FColor::G' has a wrong offset!");
static_assert(offsetof(FColor, R) == 0x000002, "Member 'FColor::R' has a wrong offset!");
static_assert(offsetof(FColor, A) == 0x000003, "Member 'FColor::A' has a wrong offset!");

// ScriptStruct ProceduralMeshComponent.ProcMeshTangent
// 0x0020 (0x0020 - 0x0000)
struct FProcMeshTangent final
{
public:
fvector TangentX; // 0x0000(0x0018)(Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
bool bFlipTangentY; // 0x0018(0x0001)(Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
uint8_t Pad_19[0x7]; // 0x0019(0x0007)(Fixing Struct Size After Last Property [ Dumper-7 ])
};
static_assert(alignof(FProcMeshTangent) == 0x000008, "Wrong alignment on FProcMeshTangent");
static_assert(sizeof(FProcMeshTangent) == 0x000020, "Wrong size on FProcMeshTangent");
static_assert(offsetof(FProcMeshTangent, TangentX) == 0x000000, "Member 'FProcMeshTangent::TangentX' has a wrong offset!");
static_assert(offsetof(FProcMeshTangent, bFlipTangentY) == 0x000018, "Member 'FProcMeshTangent::bFlipTangentY' has a wrong offset!");


struct MeshData {
TArray<FVector> Vertices;
TArray<int32_t> Triangles;
TArray<FVector> Normals;
TArray<FVector2D> UV0;
TArray<FColor> VertexColors;
TArray<FProcMeshTangent> Tangents;
};

MeshData ParseOBJFile(const char* filepath) {
MeshData data;

std::ifstream file(filepath);
if (!file.is_open()) {
//printf("[-] Failed to open OBJ file: %s\n", filepath);
return data;
}

std::vector<FVector> temp_vertices;
std::vector<FVector2D> temp_uvs;
std::vector<FVector> temp_normals;

std::string line;
while (std::getline(file, line)) {
std::istringstream iss(line);
std::string type;
iss >> type;

if (type == "v") {
// Vertex position
float x, y, z;
iss >> x >> y >> z;
temp_vertices.push_back(FVector(x * 100.0f, y * 100.0f, z * 100.0f)); // Scale to UE units
}
else if (type == "vt") {
// UV coordinate
float u, v;
iss >> u >> v;
temp_uvs.push_back(FVector2D(u, 1.0f - v)); // Flip V for UE
}
else if (type == "vn") {
// Normal
float x, y, z;
iss >> x >> y >> z;
temp_normals.push_back(FVector(x, y, z));
}
else if (type == "f") {
// Face (triangle)
// Format: f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3
std::string v1, v2, v3;
iss >> v1 >> v2 >> v3;

// Parse indices
auto parse_face_vertex = [&](const std::string& vert_data) {
std::istringstream vss(vert_data);
std::string index_str;
int v_idx = 0, vt_idx = 0, vn_idx = 0;

// Parse v/vt/vn format
std::getline(vss, index_str, '/');
v_idx = std::stoi(index_str) - 1; // OBJ is 1-indexed

std::getline(vss, index_str, '/');
if (!index_str.empty()) vt_idx = std::stoi(index_str) - 1;

std::getline(vss, index_str, '/');
if (!index_str.empty()) vn_idx = std::stoi(index_str) - 1;

// Add to arrays
int current_index = data.Vertices.Num();
data.Vertices.Add(temp_vertices[v_idx]);

if (vt_idx >= 0 && vt_idx < temp_uvs.size()) {
data.UV0.Add(temp_uvs[vt_idx]);
}
else {
data.UV0.Add(FVector2D(0, 0));
}

if (vn_idx >= 0 && vn_idx < temp_normals.size()) {
data.Normals.Add(temp_normals[vn_idx]);
}
else {
data.Normals.Add(FVector(0, 0, 1));
}

data.VertexColors.Add(FColor(61, 142, 185, 255));

return current_index;
};

int i1 = parse_face_vertex(v1);
int i2 = parse_face_vertex(v2);
int i3 = parse_face_vertex(v3);

// Add triangle indices
data.Triangles.Add(i1);
data.Triangles.Add(i2);
data.Triangles.Add(i3);
}
}

file.close();

// Generate tangents if needed
for (int i = 0; i < data.Vertices.Num(); i++) {
FProcMeshTangent tangent;
tangent.TangentX = FVector(1, 0, 0);
tangent.bFlipTangentY = false;
data.Tangents.Add(tangent);
}

//printf("[+] Loaded mesh: %d vertices, %d triangles\n",
//data.Vertices.Num(), data.Triangles.Num() / 3);

return data;
}

bool meshcreated = false;
void ReplaceWeaponMeshWith3DModel(AAresEquippable* Weapon, const char* objFilePath) {
if (!Weapon || !Weapon->GetMesh1P()) {
printf("[-] Invalid weapon\n");
return;
}

printf("\n=== Replacing 1P Weapon Mesh ===\n");
{

static UClass* ProcMeshClass = nullptr;
if (!ProcMeshClass {
ProcMeshClass = UObject::find_object<UClass>(
L"ProceduralMeshComponent.ProceduralMeshComponent"
);

static UObject* AddComponentFunc = UObject::find_object<UObject>(
L"ShooterGame.ShooterBlueprintLibrary.AddComponentByClass"
);
if (!AddComponentFunc) return;

struct {
AActor* Actor;
UActorComponent* ComponentClass;
UActorComponent* ReturnValue;
} Params = { (AActor*)Weapon, (UActorComponent*)ProcMeshClass, nullptr };

UObject::ProcessEvent(classes::defines::blueprint, AddComponentFunc, &Params);
auto* ProcMesh = (UProceduralMeshComponent*)Params.ReturnValue;

if (!ProcMesh) return;

printf("[+] Created procedural mesh: 0x%p\n", ProcMesh);

// Load mesh
MeshData weaponMesh = ParseOBJFile(objFilePath);
if (weaponMesh.Vertices.Num() == 0) return;

printf("[+] Loaded: %d verts, %d tris\n", weaponMesh.Vertices.Num(), weaponMesh.Triangles.Num() / 3);

// Fix normals
for (auto& normal : weaponMesh.Normals) {
normal = normal * -1.0f;
}

// Reverse triangle winding
for (int i = 0; i < weaponMesh.Triangles.Num(); i += 3) {
int32_t temp = weaponMesh.Triangles[i + 1];
weaponMesh.Triangles[i + 1] = weaponMesh.Triangles[i + 2];
weaponMesh.Triangles[i + 2] = temp;
}

// Set vertex colors
if (weaponMesh.VertexColors.Num() == 0) {
for (int i = 0; i < weaponMesh.Vertices.Num(); i++) {
weaponMesh.VertexColors.Add(FColor(61, 142, 185, 255));
}
}

// Create mesh section
static UObject* CreateMeshFunc = UObject::find_object<UObject>(
L"ProceduralMeshComponent.ProceduralMeshComponent.CreateMeshSection"
);
if (!CreateMeshFunc) return;

struct {
int32_t SectionIndex;
TArray<FVector> Vertices;
TArray<int32_t> Triangles;
TArray<FVector> Normals;
TArray<FVector2D> UV0;
TArray<FColor> VertexColors;
TArray<FProcMeshTangent> Tangents;
bool bCreateCollision;
} CreateParams = {
0, weaponMesh.Vertices, weaponMesh.Triangles, weaponMesh.Normals,
weaponMesh.UV0, weaponMesh.VertexColors, weaponMesh.Tangents, false
};

ProcMesh->ProcessEvent_(CreateMeshFunc, &CreateParams);
printf("[+] Mesh section created\n");
}

auto* OriginalMesh = Weapon->GetMesh1P();

// Copy material
static UObject* GetMaterialFunc = UObject::find_object<UObject>(
L"Engine.MeshComponent.GetMaterial"
);

if (GetMaterialFunc) {
struct { int32_t ElementIndex; UMaterialInterface* ReturnValue; } GetMatParams = { 0, nullptr };
OriginalMesh->ProcessEvent_(GetMaterialFunc, &GetMatParams);

if (GetMatParams.ReturnValue) {
static UObject* SetMaterialFunc = UObject::find_object<UObject>(
L"Engine.MeshComponent.SetMaterial"
);
if (SetMaterialFunc) {
struct { int32_t ElementIndex; UMaterialInterface* Material; } SetMatParams = { 0, GetMatParams.ReturnValue };
ProcMesh->ProcessEvent_(SetMaterialFunc, &SetMatParams);
printf("[+] Material applied\n");
}
}
}

// Attach to weapon
static UObject* AttachFunc = UObject::find_object<UObject>(
L"Engine.SceneComponent.K2_AttachToComponent"
);
FName [removed] = kismentsystemlibrary::string_to_name(L"R_WeaponPoint");
if (AttachFunc) {
struct {
USceneComponent* Parent;
FAttachmentTransformRules AttachmentRules;
FName SocketName;
} AttachParams = {
(USceneComponent*)OriginalMesh,
FAttachmentTransformRules::SnapToTargetNotIncludingScale,
[removed] // Attach to root - R_WeaponPoint socket is on the skeleton
};
ProcMesh->ProcessEvent_(AttachFunc, &AttachParams);
printf("[+] Attached to weapon\n");
}

// Adjust transform
printf("[*] Adjusting transform...\n");


// Rotate 90 degrees (adjust as needed for your model)
ProcMesh->SetRelativeRotation(FRotator(0, -90, 0), false, true);

// Adjust position if needed
static UObject* SetRelativeLocationFunc = UObject::find_object<UObject>(
L"Engine.SceneComponent.K2_SetRelativeLocation"
);
if (SetRelativeLocationFunc) {
struct {
FVector NewLocation;
bool bSweep;
FHitResult SweepHitResult;
bool bTeleport;
} LocParams = { FVector(0, 0, 0), false, FHitResult(), false };
ProcMesh->ProcessEvent_(SetRelativeLocationFunc, &LocParams);
}

// Adjust scale if needed
ProcMesh->SetRelativeScale3D(FVector(1, 1, 1));

printf("[+] Transform set\n");

// Hide original, show new
static UObject* SetVisibilityFunc = UObject::find_object<UObject>(
L"Engine.SceneComponent.SetVisibility"
);

if (SetVisibilityFunc) {
struct { bool bNewVisibility; bool bPropagateToChildren; } VisParams;

VisParams.bNewVisibility = false;
VisParams.bPropagateToChildren = true;
OriginalMesh->ProcessEvent_(SetVisibilityFunc, &VisParams);

VisParams.bNewVisibility = true;
ProcMesh->ProcessEvent_(SetVisibilityFunc, &VisParams);
printf("[+] Visibility swapped\n");
}

// Register
static UObject* RegisterFunc = UObject::find_object<UObject>(
L"Engine.ActorComponent.RegisterComponent"
);
if (RegisterFunc) {
ProcMesh->ProcessEvent_(RegisterFunc, nullptr);
}

auto location = fvector(-0.9434, 0.943392, -2.83019);
auto rotation = frotator(0, 90, -90);
auto scale = fvector(1.5, 1.5, 1.5);

ProcMesh->SetRelativeScale3D(scale);
ProcMesh->K2_SetRelativeRotation(rotation);

printf("[+] Custom weapon applied!\n");
}

bunu buildleyebilicek bi kral var mı custom weapon dll kodları ucden buldum ama buildleyemedim
 
ucden aldığın gibi buraya yaptıştırmışsın biraz daha baksan bir ton example var
 

Şuanda konuyu görüntüleyen kullanıcılar

Geri
Üst Alt