Page 1 of 2

SOLVED: Looking for some source code...

Posted: Tue Aug 29, 2017 12:25 pm
by Aldebaran
Is the source code of the RextendedUTv2-5-2 mutator available anywhere?
I can't find it but the author wrote in the readme that it is allowed to use the code...

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 12:52 pm
by sektor2111
Then export it and use it...
[attachment=0]RextendedUTv2-5-2.7z[/attachment]

By looking at it I might be confused here:

Code: Select all

	if (Level.NetMode == NM_DedicatedServer || bHUDMutator)
	{
		//Disable('Tick');
	}
	else
	{
		RegisterHUDMutator();
	}
2 facts:
1 - code can be simplified to a single NON-Server condition.
2 - simple or not, is this code useless ? I'm not sure if clients are registering mutators, because mutators are server's job as I know so far. I might be wrong but I'm not convinced.

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 12:56 pm
by JackGriffin
If you can't export it properly then you shouldn't be using it in the first place. Not trying to sound harsh but it's kind of a prerequisite to the process. That being said if you don't know how there are a number of people here that would be very happy to help you (myself included).

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 1:51 pm
by OjitroC
One way of doing it is to use UTPT.exe to view the .u file and then extract the scripts to .uc files - are there any problems with doing it this way though?

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 2:12 pm
by JackGriffin
Each way (WOTgreal, UTPT, UCC decompile, etc) has it's pros and cons. For instance WOT decompiles the easiest but it doesn't properly convert some values when it spits out the code. If you look throughout default properties you'll see things like "DrawType=2" instead of "DrawType=DT_Mesh". You'll need to manually ensure all those values are correct because your mod will compile with them written as numbers and you won't know there was a problem. It's also trivial to cause WOT to crash on purpose to try and protect your code from being read.

UTPT is by far the most powerful decompiler but most never learn how to properly use it. An example here is that it strips off the default properties of the class unless you select decompile. However choosing decompile rewrites the code somewhat to show you where the jump statements are and can be very confusing if you can't follow it. It also won't outwardly tell you if the code class has been stripped off or overwritten to be confusing by the author as an attempt to obscure his code.

Manual code extraction using UCC commands is the best all-around way since it can be configured to select for a variety of ways you might want to grab source. The issue here is that you need to use command line or create your own batch files. That's more than most people want to learn sadly.

It's best to use a combination of the above tools and take the time to learn the code you are trying to extract. Expect there to be problems and don't be afraid to work through them. This is why so little good, solid source code gets posted. It's time consuming to properly extract everything so it's just not done normally unless you need it for a specific thing.

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 2:25 pm
by OjitroC
@JackGriffin - that's very illuminating and very useful info :tu:

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 2:27 pm
by Aldebaran
sektor2111 wrote:Then export it and use it...
I have tried it but the default properties and icons wouldn't be exported.
So thank you for doing it in a right way. :tu:

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 2:41 pm
by sektor2111
I was right 1/2.
Mutator is announcing presence in client by registering because it do needs PostRender - client side.
bHudMutator becomes True in Client and is always False in server. These needs a wrapping...
Chapter 2. Tick keeps running in client :(.

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 4:49 pm
by nogardilaref
Just a quick note: if you decompile (UTPT) rather than just extracting the existing source (UCC), do not expect to actually get an accurate source code.

Things like "while" and "for" loops will be replaced by "goto"s, since that's what they translate to in terms of bytecode, and if you mean to actually do new versions of a mod from there, you either clean up the code at least or your experience won't be a happy one, specially when debugging.

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 5:06 pm
by JackGriffin
If all this sounds confusing don't be surprised because it really can be hard to work out and it takes a bit to understand the ins and outs. If anyone is still interested I'm happy to sit in TS with you and help as much as I am able to.

Re: Looking for some source code...

Posted: Tue Aug 29, 2017 11:08 pm
by Barbie
nogardilaref wrote:if you decompile (UTPT) rather than just extracting the existing source (UCC), do not expect to actually get an accurate source code.
Sometimes UTPT even creates invalid code (code lines are missing, wrong placed quotation marks and such).

(I usually load the package into an text editor, search for the class name and copy and paste the text into a separate UC text file. From UTPT I only take the default properties.)

Re: Looking for some source code...

Posted: Wed Aug 30, 2017 6:08 am
by sektor2111
Well now I'm getting more confused. Why all this decompile debate ? Mod is not stripped - source code is there, that's why is mentioned "free to use" by author (respect there) - like I do mods. Simply export this code from Editor - it does original source + default properties (cough there). Images can be exported and it is referring to the same PCX type with the same names used, it takes 1 minute to retrieve resources. Probably PCX are a bit different from originals but.. they do works fine. The only "manual override" operation is creating Textures folder for PCX files. Why UTPT WOT and other things which in fact cannot even decompile well not even a NON stripped Mod if some strings stuff and other complex codes are there - MapVote as a direct sample ? If author left the code there why we are not using THAT thing - already shared ? Seriously you are overthinking the problem in an useless way... especially when codes are internally shared like that...

The best plonk: if I'm compiling something for XCGE perhaps I'll wish you luck with decompiling source-code. The best way is to use internal Script Text as it is - properly exported with Editor - if Text is not removed, for such case only original source-code can be taken in account.

I think a debate toward what it does is way more productive. I see "bombingrun" things as well (I did not play that) - mainly tick from client can be stopped after registering HUD related things properly, and then functionality is getting improved. Without "bombingrun" references I think tick can be stopped in both server-client smoothing mutator or at lest client can be excepted from mooing an useless tick. But probably it can be speed up in a different form as well. I just made modifications and recompiling them - jumpboots and Udamage charge are working fine, they are shown ON-Screen. Mutator is educative - it shows how to put up HUD things without recreating a new HUD.

I know, some source-code can be a fake placed in mod (or a class) on purpose to bug new coders - BotPack has such borks - yeah EPIC - in hoping that you have stop drinking during work, It's not the case here or I did not see this. It was working fine at recompiling...

Re: Looking for some source code...

Posted: Wed Aug 30, 2017 6:45 am
by SC]-[WARTZ_{HoF}
Aldebaran was looking for source code for this mod. Whether or not he was able to decompile himself had nothing to do with his initial question. Lucky for him you all could help a guy out. :gj:

Re: Looking for some source code...

Posted: Wed Aug 30, 2017 2:44 pm
by JackGriffin
It actually does. If you can't first properly decompile something then you shouldn't be trying to recode it because you don't understand enough. No one ever figures uscript out on their own, you follow thousands of other examples. The way you get those examples is to learn how to pop mods open and look at how they were done. Crawl<walk<run.

It's the same with mapping. Do you think you could learn to map if you couldn't just open other people's maps? Of course not. If I said "I can't open a map in editor but I want to make maps" how far do you think I'll get?

Re: Looking for some source code...

Posted: Wed Aug 30, 2017 4:05 pm
by SC]-[WARTZ_{HoF}
JackGriffin wrote:If you can't first properly decompile something then you shouldn't be trying to recode it because you don't understand enough.
Good Point. :tu: