Loading [MathJax]/extensions/Safe.js

Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: Ok.. classfile questions  (Read 10006 times)

0 Members and 1 Guest are viewing this topic.

Ass Eagle

  • member
  • Offline Offline
  • Posts: 938
Ok.. classfile questions
« on: September 20, 2012, 05:48:08 PM »

Hello all!

Becouse I'm a dummy, You know when you open classfile with notepad or something and it looks like this:

" Êþ ¿€ 
   ! "Bp   # & this$0 %Lcom/maddox/il2/objects/trains/Cargo;    Synthetic <init> ;(Lcom/maddox/il2/objects/trains/Cargo;DLjava/lang/Object;)V Code
"

What tools do I need to read this in human terms, modify it, and more important, put it back again?
I need to make tweeks to certain aircraft.

Many thanks.
Logged

S3231541

  • s3231541
  • SAS Honourable Member
  • member
  • Offline Offline
  • Posts: 2387
Re: Ok.. classfile questions
« Reply #1 on: September 20, 2012, 09:03:36 PM »

you'll need a java editor: DJ or Netbean or eclipse and a special tool to make classfile for IL-2. Please check your pm.
Logged

mikoyan99

  • Modder
  • member
  • Offline Offline
  • Posts: 764
  • I'd give up rice fields to fight like you
Re: Ok.. classfile questions
« Reply #2 on: December 15, 2012, 10:45:20 AM »

I've downloaded netbean and clasfile hasher, but I have admit i'm totally lost now. Is there any chance you could post a brief tutorial on classfile editing with Java? I need to change very little, but at the moment I can't even seem to access the classfiles in Java; in fact the first time I clicked "build project" it just deleted most of the classfiles in the folder.

Edit: done it, just need to figure out what i'm doing now!
Logged

dhtsword

  • member
  • Offline Offline
  • Posts: 31
Re: Ok.. classfile questions
« Reply #3 on: January 18, 2013, 01:12:05 PM »

The classfile is a compiled .java file. If you want to edit (actually program) you need to decompile the .class file first which then generates a .java file.
I use the DJ Java Decompiler v 3.10.10.93. In order to use that you need the Java v1.3 Library installed on your computer. You can dowload that from www.oracle.com. Make sure you install this to a separate directory because you most likely need the newer java Version for normal functioning of your Computer.
Logged

yeikov

  • member
  • Offline Offline
  • Posts: 35
Re: Ok.. classfile questions
« Reply #4 on: January 24, 2013, 03:06:21 PM »

Hi dhtsword,

I use those same tools, but DJ uses JAD, and with JAD some of the classes are not fully decompiled (for instance, the one reported by IcE eAgLe). If I use JAD in a console, it reports the following type of warnings:

Couldn't fully decompile method _mthclass$
Couldn't resolve all exception handlers in method _mthclass$

And the mentioned method looks like this in the decompiled class:
Code: [Select]
    static Class _mthclass$(String s)
    {
        Class class1;
        try
        {
            class1 = Class.forName(s);
        }
        catch(ClassNotFoundException classnotfoundexception)
        {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
        return class1;
    }

    static Class _mthclass$(String s)
    {
        return Class.forName(s);
        ClassNotFoundException classnotfoundexception;
        classnotfoundexception;
        throw new NoClassDefFoundError(classnotfoundexception.getMessage());
    }

As you may have seen by now I have no real idea of Java programming...  :P Anyway, what should I do with those methods? Leave them as they are, or is there some editting required?
Thanks in advance!
Y.
Logged

dhtsword

  • member
  • Offline Offline
  • Posts: 31
Re: Ok.. classfile questions
« Reply #5 on: February 19, 2013, 03:44:02 AM »

Yes some structures he has problems, but those can easily being tackled.

The Decompiler has problems with try{} blocks which are used when you call a method which does access outside JVM ressources like files etc.
Try allows to catch the exception which might arise if the ressource is not there or corrupt or whatever.
try{
  // some code, reading the file or similar
}
catch(java.lang.Exception exception)
{
 // some code mostly a printf to log the error
}
If you are looking at an ac-file, well there are some additional restrictions with the weapons loadout, if you contact me via e-mail (hdaniel_sch@bluewin.ch) I can give you more insights into that subject.


Logged

StG77_HaDeS

  • Character is destiny
  • SAS Honourable Member
  • member
  • Offline Offline
  • Posts: 1308
  • Act quickly,think slowly
    • IL2 FREE Mods for the IL2 On-Line Community
Re: Ok.. classfile questions
« Reply #6 on: February 19, 2013, 06:04:40 AM »

Hi dhtsword,

I use those same tools, but DJ uses JAD, and with JAD some of the classes are not fully decompiled (for instance, the one reported by IcE eAgLe). If I use JAD in a console, it reports the following type of warnings:

Couldn't fully decompile method _mthclass$
Couldn't resolve all exception handlers in method _mthclass$

And the mentioned method looks like this in the decompiled class:
Code: [Select]
    static Class _mthclass$(String s)
    {
        Class class1;
        try
        {
            class1 = Class.forName(s);
        }
        catch(ClassNotFoundException classnotfoundexception)
        {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
        return class1;
    }

    static Class _mthclass$(String s)
    {
        return Class.forName(s);
        ClassNotFoundException classnotfoundexception;
        classnotfoundexception;
        throw new NoClassDefFoundError(classnotfoundexception.getMessage());
    }

As you may have seen by now I have no real idea of Java programming...  :P Anyway, what should I do with those methods? Leave them as they are, or is there some editting required?
Thanks in advance!
Y.

Simply Delete it. You can then save the Java file and compile it without issues.
Logged

SAS~Storebror

  • Editor
  • member
  • Offline Offline
  • Posts: 24055
  • Taking a timeout
    • STFU
Re: Ok.. classfile questions
« Reply #7 on: February 19, 2013, 06:25:29 AM »

The Decompiler has problems with try{} blocks which are used when you call a method which does access outside JVM ressources like files etc.
try-catch blocks have nothing to do with JNI calls, other than that you're basically right.
DJ Java Decompiler tends to generate messed up code whenever a method contains try-catch-blocks. It's recommended to use JD (i.e. JD-GUI) instead in this case (and only in this case, since JD in turn has issues with parameter initialization).
Besides that just do as HaDeS suggested, it's safe to remove those "_mthclass$" methods being generated by the decompiler.

Best regards - Mike
Logged
Don't split your mentality without thinking twice.

yeikov

  • member
  • Offline Offline
  • Posts: 35
Re: Ok.. classfile questions
« Reply #8 on: February 19, 2013, 08:50:42 AM »

Thanks a lot for those details dhtsword, HaDeS and Mike!
@dhtsword: it's a group of effects classes, but I really appreciate the offer anyway :)

You guys rock  ;D
Cheers
Logged

Chakal16

  • member
  • Offline Offline
  • Posts: 3
Re: Ok.. classfile questions
« Reply #9 on: March 24, 2013, 06:42:37 AM »

How i can edit the frequency of the tracers in a classfile?
Logged

SAS~Storebror

  • Editor
  • member
  • Offline Offline
  • Posts: 24055
  • Taking a timeout
    • STFU
Re: Ok.. classfile questions
« Reply #10 on: March 24, 2013, 06:52:23 AM »

You have to change the belting of the regarding gun.
For instance take the com.maddox.il2.objects.weapons.MGunBrowning50s class (cal .50 basic class, there are several other cal .50 classes derived from this, take care to pick the right one for your gun).
The class declares properties for each bullet in the belt, starting with
Code: [Select]
gunproperties.bullet[0]
For tracers you need the "traceMesh", "traceTrail" and "traceColor" properties. These three properties are set to "null" resp. "0" in case there is no tracer, e.g.:

Code: [Select]
        gunproperties.bullet[1].traceMesh = null;
        gunproperties.bullet[1].traceTrail = null;
        gunproperties.bullet[1].traceColor = 0;

You can change these properties of any bullet and add tracers, e.g. change the above code to:

Code: [Select]
        gunproperties.bullet[1].traceMesh = "3do/effects/tracers/20mmYellow/mono.sim";
        gunproperties.bullet[1].traceTrail = "effects/Smokes/SmokeBlack_BuletteTrail.eff";
        gunproperties.bullet[1].traceColor = 0xd200ffff;

to get both tracer and smoke trail (you can as well enable just tracer or just smoke trail if you wish).

Best regards - Mike
Logged
Don't split your mentality without thinking twice.

Chakal16

  • member
  • Offline Offline
  • Posts: 3
Re: Ok.. classfile questions
« Reply #11 on: March 24, 2013, 07:56:12 AM »

Thanks Storebor, what is the best editor for do it? im using the ClassEditor
Logged
Pages: [1] 2   Go Up
 

Page created in 0.04 seconds with 21 queries.