OlavStornes / ModBuddy

Mod buddy is a mod manager created with extensibility in mind
GNU General Public License v3.0
35 stars 3 forks source link

modbuddy mod file linking some how causing mod loading errors in java game. #16

Open alan-cugler opened 2 years ago

alan-cugler commented 2 years ago

Some how the linking of the mods I am loading into the mods directory from the ModBuddy .mods directory is resulting in this games java compiling to fail with a bad absolute path from .mods as /./mods/ for the mods. I flailed a bit by trying to escape the \. in the ModBuddy json file. XD

java.lang.RuntimeException: Error loading [data/missions/kayse_NoSuchOrg_test/descriptor.json] resource, not found in [
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/slightly better techmining,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/adjusted sector v0.4.2,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/another portrait pack,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/apex design collective,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/ss-armaa,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/battletech portrait pack,
/home/alan-cugler/Games/starsector/starsector_linux-0.95.1a-RC6/starsector/./mods/captainslog
...

I am currently testing switching out .mods/ with a non-hidden directory such as modbuddy/ to see if the period is really somehow being treated as its own directory.

alan-cugler commented 2 years ago

Huh I searched your repo for .mods and replcedthat with modbuddy and somehow .mods still showed up...

java.lang.RuntimeException: Error loading [data/world/factions/submarkets/dryDockButtonColour.faction] resource, not found in [
/home/alan-cugler/Games/starsector/starsector/./mods/adjusted sector v0.4.2,
/home/alan-cugler/Games/starsector/starsector/./mods/industrial.evolution2.2.h,
../starfarer.res/res,CLASSPATH]
alan-cugler commented 2 years ago

I can only surmise the hardlinking is an issue for some reason. I conducted two tests to isolate to that deduction.

1) I removed the same mod modbuddy had hardlinked to the starsector mods directory and replaced it with a archive version of the mod that I extracted myself.

2) I took the same mod already extracted by modbuddy and manually copied that into the starsector mods directory.

Both of these above tests resulted in a successful loading of the mod. So the mod isnt corrupted from patoolib, and its happy to load a mod directly copied in. I am still seeing the above pathing despite the directory naming change from .mods to modbuddy. I also had nuked the game and installed a new one in case somehow the java had cached something from previous tests.

alan-cugler commented 2 years ago

okay the /.mods/ path displayed by the logs of the game I am trying to mod is a red herring of java's output. Nonetheless, the linking method does seem to be an issue. I tried a different method (though maybe not a great solution) of getting the mods into the mod directory for the game and they loaded successfully.

import os
import shutil
from pathlib import Path

here = Path(os.path.dirname(os.path.realpath(__file__)))
target_path = Path("/home/alan-cugler/Games/starsector/starsector/mods")

for mod_husk in here.iterdir():
    if mod_husk.is_dir():
        for mod in mod_husk.iterdir():
            shutil.copytree(mod, target_path/mod.name, copy_function=os.link)
OlavStornes commented 2 years ago

Appreciate your enthusiasm. A lot of things to wrap my head around here. Some questions however:

  1. Does starsector use a folder called mods to apply its own mods?
  2. How does starsector handle mods? Is it demanded that all folderers get "merged" together, or is it capable of parsing individual mods?
alan-cugler commented 2 years ago

so starsector does use a mods directory. On the second question is more open for interpretation of when you consider them merged or not. Like with Skyrim everything is forcefully written over the base content in sequence and then loaded as a single completed game. I would have guessed starsector didnt do this since you can turn some mods on or off in the launch menu, however all errors that do come from mods show up for the entire PATH of all th mods rather than targeting a specific mod.

So maybe its merging them all at game launch after you've selected which ones to use in the launcher menu.

alan-cugler commented 2 years ago

lol and my enthusiasm is driven by wanting to play this game with 50+ mods, so cave man managing them one at a time takes a couple hours in all. which about how long I have to enjoy a game before family needs attention.

OlavStornes commented 2 years ago

Where modbuddy excels is with games that doesn't allow a separate folder for each mod, but where you need to jam everything into one particular folder (which can/will overwrite files). This case warrant a load order before launching a game. Ex: if all enabled mods contains a file called data/config/test.json, the actual content in the end will be whatever the last mods file.

If i read this correctly, starsector does have a mod manager in the launcher. Does that not work as intended?