Jump to content

How to either recompile obfuscated code or deobfuscate decompiled code.


Recommended Posts

Posted

Long story short: Can anybody tell me how to either recompile obfuscated code or deobfuscate decompiled code?

 

Short short long: I would like to alter the world-gen in one of my favorite (closed source) mods to make it compatible with some other mods. After decompiling the code with JD-GUI, it seems that the code could easily be made compatible by inserting a single, simple if statement in a single class. The problem is that JD-GUI decompiles the code into an obfuscated form. I really don't care, because I can easily tell what the code is doing, but it means I can't just drop the decompiled mod into my eclipse source tree like I would with an open source mod I'd edit. I either need to find some way to compile obfuscated code, or I need to de-obfuscate the whole mod so I can recompile it normally using forge.

 

Here is one idea, but before I spend the time to try it, I'd like to run it by the experts first: If I were to make a new project with nothing in it, put the obfuscated, decompiled class in (with my changes), generate stubs of all the obfuscated classes and methods referenced in the (single) class I'm editing, then compile the project, then drop the compiled class into the original mod's jar (replacing the original version) would everything "hook up" right? It seems like it might,  but despite having  programmed in java for years, the "guts" of the JVM are still kind of arcane to me.

 

Thanks for the help.

Posted

Your best bet might actually to be to download the version of minecraft (the jar) for the version that mod is for, install the mod as if it was a jar mod, then decompile that.  That worked previously (I did it once for Mystcraft, so I could look at the internals and figure out its API by example), not sure how well it works now (had trouble in 1.6.2?).

 

Give it a shot, at least.  Might not leave it in a re-compilable state without fixing errors, but if it works at all, it will work quite well.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

So, if I understand correctly, I would take the mod and move all it's class files into the appropriate folders in the mine-craft client jar file, then use the MCP to decompile and deobfuscate from there? Hmm... didn't realize I could do that. I'll give that a try and report back. If Anybody else has any additional insight, please let me know. Otherwise, I'll be back after I've tried it.

Posted

You would just need to move the main mod class folder directory into the main minecraft .jar directory.  You don't need to put things "in the appropriate place."

But other than that, yes.

 

No guarantee that it'll work, the decompiler might still throw a fit, but if it DOES work, 99% of the work will be done for you.  The rest would be making sure there are no errors and verifying that it runs.  From there it's just copying the decompiled source into your current dev environment (and then fixing any new errors that show up).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

My apologies, but I have run into a roadblock, and I haven't been able to get past in the two hours I've worked on it. You might know offhand.

 

I was expecting the MCP directory to have a minecraft client jar somewhere within it, but I couldn't find it. Instead, from what I've been able to tell, it just decompiles the minecraft jar from your .minecraft directory in %appdata%. Is this true?

 

If so, it's an inconvenience. I've got 1.7 on my computer right now, but my mod (obviously) targets 1.6.4. I'd rather not mess with my vanilla install, but instead have the decompilation target a minecraft jar of my choosing. Is there any way to do it? Command line parameters, perhaps? (I looked in the decompile.py script, but my python-fu is too weak to derive the correct command line parameters myself)

 

Thanks again.

Posted
  On 11/18/2013 at 7:48 PM, Talonos said:
I was expecting the MCP directory to have a minecraft client jar somewhere within it, but I couldn't find it. Instead, from what I've been able to tell, it just decompiles the minecraft jar from your .minecraft directory in %appdata%. Is this true?

 

That link is for ModLoader, not Forge (MCP is something else entirely).

 

What version of Minecraft are you trying to work with?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Noted, but both Forge and Modloader use MCP as their base, correct? I was simply trying to use that page as a basis for "Decompiling using MCP with mods installed." I figured the difference between decompiling with Modloader installed and forge/my mod installed was negligible. Was I incorrect in that assumption?

 

I'm working with 1.6.4.

Posted

MCP is not a codebase.  It's an external package that performs deobfuscation because it has the mapping between obfuscated and deobfuscated names.

 

As for version, I'm asking what version the mod is for because that's the version of minecraft you need to use to decompile.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Again, I understand your point. Given that MCP is a way to decompile minecraft that provides a mapping between obfuscated and de-obfuscated names, it shouldn't matter whether the tutorial was specific for modloader or not. By "Forge uses MCP as its base," I mean that forge uses the MCP derived mappings instead of coming up their their own mappings of obfuscated to human-readable names. Anything I decompile with MCP will have the same mappings that Forge uses.

 

And I understood your second question as well. By "Working with" 1.6.4, I mean that both the mod I wish to modify and my targeted minecraft release for the modified mod are both 1.6.4. I apologize for being ambiguous.

Posted

Ok.

 

Anyway, the jars are in (took me a little bit to figure this out, too) /mcp/jars/versions

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I searched for "jar" inside the jar folder because I knew that it didn't matter what it was called it would end in ".jar"

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Um... wow. Bearded Octo-nemesis. That's a deceptively off-topic title for such an on-topic utility. Thanks a ton. I'll look into that.

 

First, though, back to Draco: (And yes, that was a huge DERP moment on my part.)

 

I tried putting the mod into the JAR file, and the output was full of errors, so I tried putting both the mod and forge in the JAR file, and things were better. Still hundreds of errors, but much better. After that, I made the edits to the one source file I wish to modify, fixing any errors relating to missing methods by inserting method stubs into their appropriate classes. I can't compile it with MCP, because it complains about all the broken code, but after compiling it with Eclipse, I now have my one magic class file that does what I want it to. Problem is, it is still in deobfuscated form. I've tried to coax MCP into re-obfuscating just my one class file, but I cannot seem to get it to work. I'm only one step away from having my modded class file, now! You've been of wonderful help so far; do you have any advice on this last issue?

 

Edit: This Bearded Octo Nemesis thing is great stuff. I'm going to try a fresh install of forge and run BOC on the mod and see what happens.

Posted

Sorry, no. :x

The only time I decompiled another mod was to watch how the author was using his own API, as it wasn't well documented at the time.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Done.

 

Bearded Octo Nemesis worked wonders, then I decompiled with JDGui and dumped it in the SRC directory in eclipse. It had lots of parsing errors (JDGui doesn't seem to know how to add diamond operators) but I didn't care; all I needed was the one altered class file, so I stubbed out any method throwing fits until I could get it to compile. Then, I compiled and reobfuscated it with MCP, then took the single class file I wanted altered from the deobfuscated folder and put it in the mod's jar folder, overwriting its class. It works beautifully.

 

Seems like a long process for such a simple task. I wish there were some way to edit a single class file without having to go through the whole deobfuscate/reobfuscate process, but oh well. At least I know how to do it now.

 

Thanks all around! (And I mean this mechanically. I'm going around hitting the thanks button.)

Posted

I had a similar problem--updating someone else's semi-abandoned closed-source mod from 1.6.2 to 1.6.4.

 

BON using Searge deobfuscation got me something to work with, then I used JD-GUI, then sat down with MCPBot to update all the still semi-obfuscated names.

 

Which version of JD-GUI are you using? I had to grab a development snapshot (20130926) to get a version that would properly decompile classes with private internal classes, for example, and even then, I had to go in and hand-edit for bugs. It didn't apply trinary (?:) operators properly.

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Okay so I went to a different version of that mod and it booted right up, thank you
    • C:\Users\bruiser\curseforge\minecraft\Instances\Fazbear Remnants\essential\loader\stage1\launchwrapper\stage2.forge_1.12.2.jar: The process cannot access the file because it is being used by another process. Restart your system and test it again If there is no change, delete the mentioned essential folder or remove the mod essential
    • Does it work with newer versions? For 1.16.5 also make a test with Embeddium + Oculus as Optifine replacement
    • Looking for the best Temu coupon code $100 off? You’re in the right place! We’ve got the ultimate deal that helps you save big on your favorite items. Our exclusive ACS670886 Temu coupon code is perfect for shoppers in the USA, Canada, and Europe. Whether you're a new or existing customer, this code ensures you get maximum benefits. By using the Temu coupon $100 off, you can unlock exciting savings on Temu’s vast collection. Don’t miss this chance to claim your Temu 100 off coupon code today! What Is The Coupon Code For Temu $100 Off? Both new and existing customers can enjoy incredible benefits with our Temu coupon $100 off on the Temu app and website. This $100 off Temu coupon ensures huge savings for everyone! ACS670886 – Get a flat $100 off on selected purchases. ACS670886 – Unlock a $100 coupon pack for multiple uses. ACS670886 – Enjoy a $100 flat discount if you're a new customer. ACS670886 – Existing customers can claim an extra $100 promo code. ACS670886 – This $100 coupon is valid for shoppers in the USA and Canada. Temu Coupon Code $100 Off For New Users In 2025 New users can maximize their savings by applying our Temu coupon $100 off on the Temu app. This Temu coupon code $100 off unlocks amazing deals for first-time shoppers. ACS670886 – Get a flat $100 discount for new users. ACS670886 – Receive a $100 coupon bundle as a welcome offer. ACS670886 – Unlock up to $100 in coupons for multiple uses. ACS670886 – Enjoy free shipping to 68 countries. ACS670886 – Get an extra 30% off on any purchase as a first-time user. How To Redeem The Temu Coupon $100 Off For New Customers? Using the Temu $100 coupon is easy! Follow these steps to redeem your Temu $100 off coupon code for new users: Sign up on the Temu app or website. Browse and add your favorite items to the cart. Enter ACS670886 at checkout. See the $100 discount applied instantly. Complete your purchase and enjoy your savings! Temu Coupon $100 Off For Existing Customers Existing customers can also benefit from our exclusive Temu $100 coupon codes for existing users. Use this Temu coupon $100 off for existing customers free shipping deal and save more! ACS670886 – Get an extra $100 discount for existing users. ACS670886 – Enjoy a $100 coupon bundle for multiple purchases. ACS670886 – Receive a free gift with express shipping across the USA/Canada. ACS670886 – Grab an extra 30% off on top of existing discounts. ACS670886 – Avail free shipping to 68 countries. How To Use The Temu Coupon Code $100 Off For Existing Customers? Redeeming your Temu coupon code $100 off as an existing user is simple. Just follow these steps: Log in to your Temu account. Select your desired products and add them to your cart. Apply ACS670886 at checkout. Your Temu coupon $100 off code will be applied automatically. Confirm your order and enjoy massive savings! Latest Temu Coupon $100 Off First Order First-time buyers get the best deals with our Temu coupon code $100 off first order. This Temu coupon code first order ensures maximum savings. ACS670886 – Flat $100 discount for the first order. ACS670886 – Special $100 Temu coupon code for new customers. ACS670886 – Get up to $100 in coupons for multiple uses. ACS670886 – Free shipping to 68 countries. ACS670886 – Extra 30% off on any first-time purchase. How To Find The Temu Coupon Code $100 Off? Finding a Temu coupon $100 off is easy! Check out the Temu coupon $100 off Reddit section or follow these tips: Subscribe to the Temu newsletter for exclusive deals. Follow Temu’s official social media pages for the latest updates. Visit trusted coupon sites for verified and working codes. Is Temu $100 Off Coupon Legit? Yes, our Temu $100 Off Coupon Legit and verified! Wondering if the Temu 100 off coupon legit? Here’s why: The ACS670886 code is officially tested and confirmed. Valid for all customers in the USA, Canada, and Europe. No expiration date—use it anytime! How Does Temu $100 Off Coupon Work? The Temu coupon code $100 off first-time user works instantly upon applying at checkout. Simply enter the Temu coupon codes 100 off, and the discount is automatically deducted. How To Earn Temu $100 Coupons As A New Customer? To earn a Temu coupon code $100 off, sign up on Temu, make your first purchase, and refer friends. This 100 off Temu coupon code can be unlocked through special promotions. What Are The Advantages Of Using The Temu Coupon $100 Off? $100 discount on the first order $100 coupon bundle for multiple uses 70% discount on popular items Extra 30% off for existing customers Up to 90% off on selected products Free gifts for new users Free delivery to 68 countries Temu $100 Discount Code And Free Gift For New And Existing Customers Enjoy the Temu $100 off coupon code and get amazing benefits! Our $100 off Temu coupon code ensures huge savings. ACS670886 – $100 discount for the first order. ACS670886 – Extra 30% off on any item. ACS670886 – Free gift for new Temu users. ACS670886 – Up to 70% discount on all Temu items. ACS670886 – Free shipping in 68 countries including the USA and UK. Final Note: Use The Latest Temu Coupon Code $100 Off Using the Temu coupon code $100 off is the smartest way to save on Temu! Don’t wait—grab your discount now. Our Temu coupon $100 off is available for all customers, ensuring maximum savings. Get yours today! FAQs Of Temu $100 Off Coupon Q: How can I get the Temu $100 off coupon? A: Use code ACS670886 at checkout to claim your $100 discount. Q: Is the Temu $100 coupon valid for existing customers? A: Yes! Existing users can also apply ACS670886 and enjoy savings. Q: Does the Temu $100 off coupon have an expiration date? A: No, ACS670886 is valid indefinitely. Q: Can I use the Temu coupon on multiple orders? A: Yes! ACS670886 allows multiple redemptions. Q: Is the Temu $100 coupon applicable worldwide? A: Yes, it’s valid in the USA, Canada, Europe, and 68 other countries.
    • I tried both Vanilla and Optfine like you said, and both gave the same result. So I believe the issue is most likely with Minecraft in general and not Forge
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.