Vcmieditor, gameConfig not found


#1

Hi,

I installed vcmi using ubuntu’s ppa
vcmi plays properly
I am trying to use the editor
I cloned vcmi/vcmi_editor, using master(41eeeeb64e7)

I installed the deps from .travis, make and make test ok
when launching ./bin/vcmieditor I first had
filesystem.json not found.

I then copied https://github.com/vcmi/vcmi_old_mirror/blob/master/config/filesystem.json and updated it via my configuration:

{
    // Complete filesystem available after initialization
    // All paths and names here are case-insensitive
    // If same filename is found twice entry from latest source will be used
    // NOTES:
    // - this file must be available as "config/filesystem.json"
    // - some locations are hardcoded (user config directory, cache/tmp directory, saved games location)
    "filesystem":
    {
        "DATA/" :
        [
            {"type" : "lod", "path" : "/home/$USER/.local/share/vcmi/Data/H3ab_bmp.lod"},
            {"type" : "lod", "path" : "/home/$USER/.local/share/vcmi/Data/H3bitmap.lod"},
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Data"}
        ],
        "SPRITES/":
        [
            {"type" : "lod", "path" : "/home/$USER/.local/share/vcmi/Data/H3ab_spr.lod"},
            {"type" : "lod", "path" : "/home/$USER/.local/share/vcmi/Data/H3sprite.lod"},
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Sprites"}
        ],
        "SOUNDS/":
        [
            {"type" : "snd", "path" : "/home/$USER/.local/share/vcmi/Data/H3ab_ahd.snd"},
            {"type" : "snd", "path" : "/home/$USER/.local/share/vcmi/Data/Heroes3-cd2.snd"},
            {"type" : "snd", "path" : "/home/$USER/.local/share/vcmi/Data/Heroes3.snd"},
            //WoG have overriden sounds with .82m extension in Data
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Data", "depth": 0}
        ],
        "MUSIC/":
        [
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Mp3"}
        ],
        "VIDEO/":
        [
            {"type" : "vid", "path" : "/home/$USER/.local/share/vcmi/Data/H3ab_ahd.vid"},
            {"type" : "vid", "path" : "/home/$USER/.local/share/vcmi/Data/Heroes3.vid"},
            {"type" : "vid", "path" : "/home/$USER/.local/share/vcmi/Data/video.vid"}
        ],
        "CONFIG/":
        [
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/"}
        ],
        "MAPS/":
        [
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Maps"}
        ],
        "MODS/":
        [
            {"type" : "dir",  "path" : "/home/$USER/.local/share/vcmi/Mods", "depth": 1}
        ]
    }
}

(paths do resolve in shell, i would replace $USER later on)

now error is:
Resource not found: config/gameConfig

I tried to look for “gameConfig” in repo, and in /home/$USER/.local/ but could not find it

So I tried to instead link vcmi/config to the the cloned vcmi_editor:
vcmi_editor$ ln -s …/vcmi/config .
make
./bin/vcmieditor

but then I still get the same error.
If I try to manually hardcode

GAME_CONFIG = '/home/xxdl/vcmi_editor/config'+DirectorySeparator+'gameConfig.json';

(the path does exist) I still get the same error from filesystem.pas

What am I doing wrong?


#2
+++ b/filesystem.pas
@@ -369,7 +369,7 @@ const
   FS_CONFIG = CONFIG+DirectorySeparator+'filesystem.json';
   FS_CONFIG_FIELD = 'filesystem';
 
-  GAME_CONFIG = CONFIG+DirectorySeparator+'gameConfig';
+  GAME_CONFIG = './config'+DirectorySeparator+'gameConfig.json';
 
   MOD_CONFIG = 'mod.json';
   MOD_ROOT = '/Content';
@@ -919,7 +919,6 @@ begin
   for s in FDataPath do
   begin
     tmp := IncludeTrailingPathDelimiter(s) + FS_CONFIG;
-
     if FileExistsUTF8(tmp) then
       config_fn:=tmp;
   end;
@@ -929,10 +928,12 @@ begin
     raise Exception.Create('Filesystem configuration not found');
   end;
 
+  writeln('trying '+config_fn);
   config_res := TJsonResource.Create(config_fn);
   try
     LoadFileResource(config_res, config_fn);
     config_res.DestreamTo(FConfig,FS_CONFIG_FIELD);
+    writeln('ok loaded');
   finally
     config_res.Free;
   end;
@@ -943,9 +944,11 @@ procedure TFSManager.LoadGameConfig;
 var
   res: TJsonResource;
 begin
+  writeln('trying '+GAME_CONFIG);
   res := TJsonResource.Create(GAME_CONFIG);
   try
-    res.Load(Self);
+    LoadFileResource(res, GAME_CONFIG);
+    //res.Load(Self);
     res.DestreamTo(FGameConfig);
   finally
     res.Free;

I somehow managed to pass the error, but now I encounter Resource not Found: DATA/GENRLTXT, presumably from locale_manager.pas

const
GENERAL_TEXTS_PATH = ‘DATA/GENRLTXT’;
VICTORY_PATH = ‘DATA/VCDESC’;
LOSS_PATH = ‘DATA/LCDESC’;

I am unable to find such filename (GENRLTXT).
Neither in ~/.local/share/vcmi, ~/dl/vcmi(git), ~/dl/vcmi_editor(git), nor the files from the game itself

any help?


#3

Linux support is not fully implemented yet in map editor. Missing part is vcmi.dirs.xdg.pas. There is a “development” workaround:
Create file gamepath.txt in ./bin/ directory where vcmieditor binary is. Each line should contain a possible vcmi data path. smth like:
/usr/share/games/vcmi
~/.local/share/vcmi

P.S.
Also do not use https://github.com/vcmi/vcmi_old_mirror for anything except historical research :wink:


#4

It should be in /usr/share/games/vcmi

here is a file in repo:


#5

thx a lot AVS

I managed to launch it thanks to your instruction!

[email protected]:~/dl/vcmi_editor/bin (master)$ cat gamepath.txt 
/home/xx/.local/share/vcmi
/home/xx/dl/vcmi

edit it also works with the suggested (installed) path instead of the cloned one
/home/xx/dl/vcmi -> /usr/share/vcmi/


#6

Also you could try building with lazbuild --bm=RD --widgetset=qt5 3rd_party/opengl/vcmiopenglcontext.lpk vcmieditor.lpr. QT5 build should look better than default GTK2 one.


#7

under ubuntu 16.04 there is no libQt5Pas so I will stick with the default build and won’t bother building the lib
thanks for the tip though