EliotVU / Unreal-Library

UnrealScript decompiler library for Unreal package files (.upk, .u, .uasset; etc), with support for Unreal Engine 1, 2, and 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Small issue

911reg opened this issue · comments

Hey there Eliot, first of all, thanks again for the great app! This issue isn't really related to a bug or a problem with the app, it's more like a question, if solved it might be useful for someone else as well.

So basically, i've been trying to extract *.uc files from a file (this one specifically)

The problem i'm having is the following:
This is what the defaultproperties look like:

Sin título

when they should look like this:

Screenshot_2

So basically it's showing up as "L2EffectEmitter" instead of "L2EffectEmiter'L2EffectEmiter0'

I'm 100% doing something wrong here, do you perhaps know how to solve this?
Here's the Array Definition i'm using: Package.Class.PreshotAction:ObjectProperty

Also, when i see the script inside UE Explorer, the reference is there, but it isn't applied to the ShotAction line for whatever reason

// Reference: L2EffectEmitter'l2_14207_skill.L2EffectEmitter53'
ShotAction(0)=L2EffectEmitter53

Screenshot_1

PD: i can fix this by hand, but sadly, i'd have to do that manually for over 4000 files.

commented

Are you trying to re-compile the code? If so, either references should be fine, the compiler generally just looks up the object by the name's hash.

Nonetheless I'll label this issue as an enhancement request to output a qualified reference instead.

I'm trying to recompile, yeah, but i'm getting the 'unknown property' warning in ucc.exe. The file gets compiled, but ot doesn't work ingame, though it works if i add the part that's missing manually

Screenshot_3

commented

Strange, normally the compiler understands such references, maybe it's different for L2.

I will address this issue in the next release by always outputting a fully qualified reference.

commented

Related issue #40

Nice! I just ended up making a small tool to "fix" the files for me, it worked as a temporary measure xD
i'll leave it here just in case

#include <iostream>
#include <fstream>
#include <dirent.h>
#include <string>

using namespace std;

int main() {
    DIR* dir;
    struct dirent* ent;
    if ((dir = opendir(".")) != NULL) {
        while ((ent = readdir(dir)) != NULL) {
            string fileName = ent->d_name;
            if (fileName.find(".uc") != string::npos) {
                // found a .uc file
                cout << "Editing file: " << fileName << endl;
                ifstream inputFile(fileName);
                string line;
                string editedFile;
                while (getline(inputFile, line)) {
                    if (line.find("Action(") != string::npos) {
                        // found a line with "Action("
                        int equalPos = line.find("=");
                        if (equalPos != string::npos) {
                            // found the "=" symbol on the same line as "Action("
                            line.replace(equalPos, 1, "=L2EffectEmitter'");
                            line += "'";
                        }
                    }
                    editedFile += line + "\n";
                }
                inputFile.close();
                // overwrite the .uc file with the edited content
                ofstream outputFile(fileName);
                outputFile << editedFile;
                outputFile.close();
            }
        }
        closedir(dir);
    }
    else {
        cout << "Error opening directory" << endl;
    }
    return 0;
}