Frictional Games Forum (read-only)
[TEAM] Modloader GitHub Repository - Printable Version

+- Frictional Games Forum (read-only) (
+-- Forum: Amnesia: The Dark Descent (
+--- Forum: Custom Stories, TCs & Mods - Development (
+--- Thread: [TEAM] Modloader GitHub Repository (/thread-26743.html)

Pages: 1 2

Modloader GitHub Repository - Mudbill - 10-13-2014

Amnesia Modloader (Open-Source Project)

I created this thread after discussing a few ideas in this thread over here. I've now set up a public GitHub repository of the source code for my Amnesia ModLoader Java application. If anyone wants to check it out, feel free to do so. Any contributions are of course awesome.

If you're confused as to what this whole deal is about, I recommend reading the above thread. I honestly don't know everything myself either, but if discussions arise, maybe we'll all become a bit wiser.

Click here for the online source code repository!

You are free to download the code and play around with it, whether you wish to improve it or just learn from it.

If you know more about GitHub than me (which might be likely) then any tips on how to properly operate it would be nice. I still find it somewhat confusing.

RE: Modloader GitHub Repository - Daemian - 10-13-2014

Awesome. I'm in.

RE: Modloader GitHub Repository - Daemian - 10-14-2014

Great looking app you have sir, everything is clear and tidy.
I found some small errors but everything should be fine now.

Loader can't load mods and can't save settings
Spoiler below!

In my win7, I don't have the directory structure the app expects:
( C:\Users\Daemian\Documents\Amnesia\ModLoader\ )

My documents folder is this: C:\Users\Daemian\My Documents\Amnesia

So it raises this error:
PHP Code:\Users\Daemian\Documents\Amnesia\ModLoader\ (The system cannot find the path specified
The app tries to create the file in a dir I don't have (Win7, dir: %user%/documents/Amnesia/ModLoader)

It's just me, probably, I did change my documents folder to my documents instead of just documents a while back.

So to temporary avoid this error I created the directories myself ( C:\Users\Daemian\Documents\Amnesia )
Then the error stopped and the dir and file ModLoader/ were created by the loader.

A permanent solution for this specific error may be to store the properties file somewhere else, like %PROGRAMFILES%/ModLoader

Couldn't load card settings
Spoiler below!

It's an Amnesia error, my mods gave me that, as if Amnesia forgot where the files are, (cause the launcher didn't have text in their buttons either).

So I checked the app how was it calling the launcher and it turned out, it didn't know where it was standing, because of how the method works. I found another one -same name, diff parameters- that accepts the working directory as parameter.

PHP Code:
String[] null;
File f = new File(gameDirectory);
runTime.exec(gameDirectory File.separator CurrentOS.getGameExe() + " " filePathaf); 

Then, every mod works perfectly.

That is all, for now, probably you -mud- couldn't test it yet cause you mentioned you don't have a retail version. Anyways, rest is working great.
In case you find this useful, you want me to upload this as a fork version? or you're gonna just edit yours?
Whatever you want.

RE: Modloader GitHub Repository - Mudbill - 10-14-2014

Awesome work!

I did figure out that the file couldn't be created if the Amnesia directory in \Documents didn't exist. Unsure why, but I'm guessing it's related. I did ask the code to create the path if it didn't exist, but I probably don't have the priviledges to go too deep. This is also a reason why I do not wanna save anything in a Program Files folder (because you'll need to authorize it every time).

Perhaps there's an alias I can use that points directly to the user's documents folder. I think because it doesn't accept "My Documents" might also be a reason for it to not function properly on Windows XP (tested on VM).

If you are able to upload your version to the GitHub page, that'd be great. I don't really know for sure if you're able to though xP
I mean, you should be able to but I might've forgotten something.

RE: Modloader GitHub Repository - Viper85626 - 10-16-2014

I'd love to help out, but I don't know Java. Sad

RE: Modloader GitHub Repository - Daemian - 10-16-2014

(10-16-2014, 12:17 AM)Viper85626 Wrote: I'd love to help out, but I don't know Java. Sad
You could help by testing and giving advice on how to solve stuff or what to implement.

I think the loader is ok to use right now -I use it while testing my mod-, but it would be better if we add some more functionality to it.
Cause right now it just makes a list of mods and runs them depending the OS.
It's a good start, easier for modders and users, but it needs more.

For the shaders deal, how about this:

Whenever the user starts a given mod, the loader:
  • Checks for .glsl files inside the mod dir
  • If any, it moves them to [game_dir]/core/shaders (just temporally)
  • Instead of replacing the original files, it renames those to .glsl_back (or whatever)
  • Runs the game, user plays.
  • When the loader closes, it makes a check: looks for any .glsl_back, and renames them back, removing the custom ones.

Example, let's say I upload a mod, let's call it Rabbit. I include my custom shader in Rabbit/MyShaders

When people use the loader with my mod, it finds my shader in there, and places it in my game dir/core/shaders but it does not replace any files, it just renames the originals and places the custom ones.

So, my custom shaders get included when the users launch my mod. And it gets rid of them later, when the user is not using them.
Would this work? I think this it's the proper way to go.

As for the %my documents% issue, you could save the file ( in the same dir the loader was opened from.
If the user starts moving the loader around his disk, hopefully, he moves both files or the whole folder /ModLoader.
The worst thing that could happen is that he/she has to set his/her preferences again.

RE: Modloader GitHub Repository - Mudbill - 10-16-2014

Perhaps there is an easier way of saving preferences better, but saving them in the same directory CAN put them into the same issue as saving it in \Program Files. I have heard of a simulated \Program Files save though, by saving it in, I believe \Local instead, but I'm not too sure. I also just imagine some people running it from their desktop or downloads folder, and I think it'd be ugly to have a preferences file on the desktop. We can surely try out a few things though. UAC might not actually be a problem, at least not in Windows 7+. Vista had some issues with it, and XP didn't have it at all. I just hope we wouldn't run into an "authentication failed" issue.

Other than that, I think the proposed method of using shaders can work well. It's similar to how I imagined it be done before. A few more things that can be done:

If the program happens to shut down unintentionally while the game is running, the shaders would likely be left modified. Don't think this can be easily avoided. We can, however, add a check to try to restore original shaders on startup, if they happen to be modified already.

RE: Modloader GitHub Repository - Daemian - 10-16-2014

(10-16-2014, 07:32 AM)Mudbill Wrote: add a check to try to restore original shaders on startup, if they happen to be modified already.
Yep. That too.

RE: Modloader GitHub Repository - Mudbill - 10-18-2014

How do I even use GitHub? I'm thoroughly confused by how it works. I just want to make a simple change ò.ó

RE: Modloader GitHub Repository - Daemian - 10-18-2014

Yeah it's very confusing.

To make changes, at least how I did it, I had to install this GitHub app. It recognizes local changes vs online repository.
Then, If you want to update the repository with what you have, you should get a commit button.
I did it and it worked. edit: by getting a commit button I mean the button appears after you make changes to the files.

It was a little difficult to set up this GitHub app to recognize my eclipse project.
I ended up having two diff dirs, so when I make changes, I have to copy&paste from here to there. :/
But it works.

Oh and, I wanna use the same tool you use to generate an .exe what do you use? :o