UnSmod: Stonehearth Mod Decompiler


#1

This is a tool for the decompression and decompiling of .smod files. There is an alternative on Stonehearth Guru called unwrp. It’s an alternative and not necessarily better or worse, developed simultaneously and just different.


  1. The first you need is the java sdk, instructions on how to install it and found on the first section here. You only need to go as far as setting the PATH variable.
  2. The other thing you need is unluac for the decompiling, you can find it here make sure to get unluac and not unluac-source. It should contain a file called unluac.jar, you’ll need that in a minute.
  3. Save the linked script to a .bat file.
  4. At the very start of the code is a filepath to unluac.jar, change it to wherever you put unluac.jar. Alternatively, you can put it in the same folder as unluac.jar and it will find it itself.
    4A. If you have Stonehearth installed in a custom location perform this part. Either place the .bat file in the same folder as Stonehearth.exe or add the following line to the start of the file and place the correct path to the Stonehearth folder, the folder Stonehearth.exe is in to be precise.
    SET stonehearth=“C:\PATH\TO\STONEHEARTH”
  5. Double click on the file to run it. It will turn all .smod’s into folders of decompiled lua that the game can run off along with deleting old versions. If it seems to stop while running give it a little bit, it can be a bit slow decompressing the .smod’s.

WARNING: It currently sometimes throws an error halfway through, it doesn’t matter and it will keep going after a few seconds. I haven’t figured to how to get rid of it yet though.

WARNING: If it throws an error and crashes without creating the folders try running it in administrator mode, sometimes there is a permissions issue with creating folders in Program Files if you haven’t already done it.

CHANGES
V5: Fix administrator mode bug.
V4: Checks for non-steam standard install and current dir when looking for install location.
V3: Swapped to pastebin. Discourse code blocks are irritating to use.
V2: Added support for non-steam installs.

PLANS
Ability to ask for location of unluac.jar and if you have a non standard install on first run and remember them.


Community Mods List
[MOD] NorseHearth 0.3 [A24]
[Tutorial] Adding Custom Animations
Lua decompiler for Stonehearth
#2

Is there anything anyone would like added to this? Currently I’ve got those couple of plans mentioned but if you can think of anything else good just say so.


#3

have you reached out to the modding elite on our forums? i plan to dabble myself, but not until i (eventually) get my new rig…


#4

Looks good! Thanks for sharing it! :slight_smile: (Also, you used a very smart name, sir!)


#5

You’ve been talking about this ‘new rig’ for ages now… Stop wasting time and get it! :wink:


#6

@Xavion Thanks for the script… works like a charm if I run it from within the Stonehearth-folder. However, if I place both, the unluac.jar and the .bat-file in a stand-alone folder and link to the stonehearth folder ("SET mods=“D:\SteamLibrary\SteamApps\common\Stonehearth”) it will not find the folder and the script does not run.

The script also requires to have the smod-files unzipped first… maybe worth to mention.


#7

It should unzip them itself, I’m sure of it because it does it on my computer. I’ve also got no idea why it would be failing for a different directory. I’ve just uploaded a version with some basic logging, a copy of whatever that gives could be useful in figuring out the problems. Also if it pauses at the end of running with an error message tell me. That’s fairly important.

EDIT:
Missed something fairly obvious, in V2 I changed it to stonehearth instead of mods. This should just fix the issue.


#8

Well, I downloaded it, I’ve got the batch file and the .jar, and I’ve got all the files, but when I click the .bat, the console just flashes up and closes back down, instantly. I have both the .smod and the decompressed .smod files in that folder, and the .bat, .jar, and .exe files are all in the same folder. What am I doing wrong?


#9

Try opening command prompt then typing "start " before dragging the .bat onto it. It should start the script and not close instantly on the end. It’s probably just a problem resolving filepaths as that seems to be the most common problem for some reason. Tell me what the error says, generally it’s pretty easy to fix.


#10

The problem is, there isn’t an error. The console pops up and closes back down before I can read anything.


#11

If it’s just closing instantly without any errors than that means it’s not finding any .smod files. Make sure to try starting it from the command line as that prevents it from closing on an error. It should be producing an unsmod.log file as well, if not try updating. It should tell me how far it’s getting so I know the rough area to look for a problem.


#12

I’ve tried that, and… it still closed… And no unsmod.log, either. I’ve tried shifting the files around, and seeing if that would help, and I’ve tried putting the files into other folders, to no avail. If you’ve got TeamViewer, you could take a look, maybe? Just a thought.


#13

I’ve got teamviewer, I’ve just thrown up my current version though so try that first. If it isn’t generating an unsmod.log file with this version something is definitely going wrong.


#14

Works like a charm!

Thank you for scripting this this. :smiley:


#15

I am also having an error, log is as follows
unsmod.txt (323 Bytes)


#16

oh my god i just realised how much of a necro this is… i am so sorry :frowning:


#17

Follow step one. You’re missing some java stuff.