OpenJKDF2 icon indicating copy to clipboard operation
OpenJKDF2 copied to clipboard

Question/Request: Any way to load MOTS from a subfolder in exe root?

Open StrikerTheHedgefox opened this issue 2 years ago • 9 comments
trafficstars

Is there a way I can portably load MOTS from a single install of OpenJKDF2, by perhaps loading it from a subfolder? If not, could that feature be added, so I'm not forced to put it in appdata/openjkdf2/openjkmots or wherever it is?

StrikerTheHedgefox avatar Jun 21 '23 05:06 StrikerTheHedgefox

sorry for the late reply but yes, sent this blurb to someone else but I've really got to document it better:

the basic gist is,

  • If OpenJKDF2 is launched as a JK.EXE replacement, it checks if jk_.cd matches MoTS and applies -motsCompat automatically if it does. So openjkdf2-64.exe placed in a MoTS root will Just Work, but switching might not work unless you set the environment variables (see below).
  • If it's launched with an AppData installation (the default w/ the disk installation helper, basically works like Minecraft.exe), you can add -motsCompat as an argument for a Windows shortcut and it'll launch the MoTS install.
  • You can also override where AppData is stored using the OPENJKMOTS_ROOT and OPENJKDF2_ROOT environment variables (https://docs.oracle.com/en/database/oracle/machine-learning/oml4r/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html). Then you can just launch openjkdf2-64.exe from a shortcut with -motsCompat and it'll use OPENJKMOTS_ROOT. This also works for the Mods and Expansions menu, if you had MoTS and JK in two weird folders but still wanted the soft-reset switcher.

shinyquagsire23 avatar Jun 28 '23 08:06 shinyquagsire23

Doesn't seem to work. It complains the resources are missing, even though they are installed. Can't find the UI stuff or anything, even though it seems to be searching in the right path. (It asks to install to the folder I set, and if I say yes, it'll install the right files, in the same way I had them, but it still doesn't go.)

I made a simple batch file that does the following:

set OPENJKMOTS_ROOT=%~dp0.\mysteries
openjkdf2-64.exe -motsCompat

Folder contents: image

StrikerTheHedgefox avatar Jun 29 '23 02:06 StrikerTheHedgefox

what does the console log say? it ~should say which working paths it's using. Also what UI files is it failing on?

shinyquagsire23 avatar Jun 29 '23 02:06 shinyquagsire23

image

Recreating SDL2 Window!

Running from current working directory.
(00007ff7ee2825e0 .\General\stdBitmap.c:147) Error: Invalid load filename 'ui\bm\statusLeft16.bm'.
FATAL ERROR: ERR_CANNOT_LOAD_FILE ui\bm\statusLeft16.bm

StrikerTheHedgefox avatar Jun 29 '23 02:06 StrikerTheHedgefox

hmmmm, not a good sign that it says Running from current working directory, make sure you're not launching it from a folder where resource/jk_.cd exists because if that file exists it'll override everything else.

But also I'm not suuuure if the way you're setting the environment variable would work? I've only tested it as a user-global environment variable. Because the other possibility is that it doesn't seem OPENJKMOTS_ROOT as set, but even then it should fall back to the APPDATA folders instead of current working directory?

edit: not Episode/jk_.cd, resource/jk_.cd

shinyquagsire23 avatar Jun 29 '23 02:06 shinyquagsire23

It definitely sees it as set, because it asks to install to the folder I set, and does.

set OPENJKMOTS_ROOT=%~dp0.\mysteries resolves to D:\JediKnight\OpenJKDF2\mysteries

StrikerTheHedgefox avatar Jun 29 '23 02:06 StrikerTheHedgefox

Hmmm ok so, the only way it will fail to use OPENJKMOTS_ROOT if it worked for installation (which is a good sign), is if resource/jk_.cd does not exist, or if resource/jk_.cd exists in the current working directory (ie, where the batch script is located, I think). Because otherwise if it were using OPENJKMOTS_ROOT, it would print Using OPENJKDF2_ROOT, root directory: [your_path/whatever]

shinyquagsire23 avatar Jun 29 '23 02:06 shinyquagsire23

an alternative hack would be something like

set OPENJKMOTS_ROOT=%~dp0.\mysteries
pushd %OPENJKMOTS_ROOT%
..\openjkdf2-64.exe -motsCompat
popd

but also, probably good to verify that it's not seeing something in the current working directory (also I should probably double check that it doesn't just set the current working directory to wherever the EXE file is, because it might be doing that?)

shinyquagsire23 avatar Jun 29 '23 02:06 shinyquagsire23

I'm currently having the same problem. If I put all the MOTS files in /expansions/mots, the ingame menu picks up that folder but also has an entry to install MOTS (trying to run the mots folder just seems to relaunch the normal game). If I click to install it, the root dir is looking to AppData and not the Desktop folder I'm running it from.

If I make a .bat file like above, it looks in the correct root folder and installs the files, but then gives the same file loading error. If I remove -motsCompat from the .bat file, I can launch MOTS from the ingame menu, but then I still have the mots folder listed which again just relaunches the normal game.

chrism69 avatar Mar 01 '24 00:03 chrism69