SOLVED: Looking for some source code...

Discussions about Coding and Scripting
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

SOLVED: Looking for some source code...

Post 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...
Last edited by Aldebaran on Sat Sep 30, 2017 10:24 am, edited 1 time in total.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Looking for some source code...

Post 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.
Attachments
RextendedUTv2-5-2.7z
(13.65 KiB) Downloaded 72 times
Last edited by sektor2111 on Tue Aug 29, 2017 1:05 pm, edited 1 time in total.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for some source code...

Post 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).
So long, and thanks for all the fish
User avatar
OjitroC
Godlike
Posts: 3605
Joined: Sat Sep 12, 2015 8:46 pm

Re: Looking for some source code...

Post 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?
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for some source code...

Post 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.
So long, and thanks for all the fish
User avatar
OjitroC
Godlike
Posts: 3605
Joined: Sat Sep 12, 2015 8:46 pm

Re: Looking for some source code...

Post by OjitroC »

@JackGriffin - that's very illuminating and very useful info :tu:
Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Looking for some source code...

Post 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:
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Looking for some source code...

Post 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 :(.
nogardilaref
Masterful
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: Looking for some source code...

Post 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.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for some source code...

Post 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.
So long, and thanks for all the fish
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Looking for some source code...

Post 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.)
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Looking for some source code...

Post 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...
SC]-[WARTZ_{HoF}
Adept
Posts: 426
Joined: Tue Feb 21, 2012 7:29 pm

Re: Looking for some source code...

Post 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:
Image
Image
Image
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for some source code...

Post 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?
So long, and thanks for all the fish
SC]-[WARTZ_{HoF}
Adept
Posts: 426
Joined: Tue Feb 21, 2012 7:29 pm

Re: Looking for some source code...

Post 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:
Image
Image
Image
Post Reply