[OLD-1] AGS engine Linux port

Started by BigMc, Sun 03/06/2012 19:04:20

Previous topic - Next topic

JJS

Yes and fullscreen is the default.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

scottchiefbaker

Using the newest binary, when I run a test version of GeminiRue that Wadjet got me I get a "prog.res" and a "Saves" directory in the data/ directory. The Saves directory is chmoded 000, so it's hard to work with, and empty. Is this something the engine is creating, or is it a script in the game that's doing that?

scottchiefbaker

Looking in to it further, it appears the new GeminiRue creates a separate directory for the save games, and the achievements to go in. The problem is, that it defaults to creating the directory chmod 000. Does the AGS engine allow a game to create a directory? Does the game specify permissions for that directory, or does the engine?

If I manually chmod 755 the directory it works as it should. I'm thinking maybe it's a bug if we allow a directory to be created with 0 permissions?

scottchiefbaker

#303
Not to spam the thread but I got this from Wadjet

I used the command

Game.SetSaveGameDirectory("Saves");

to do this.

http://www.adventuregamestudio.co.uk/manual/Game.SetSaveGameDirectory.htm


The documentation doesn't say anything about permissions. I believe the relevant piece of code is in ac/game.cpp at line #368:

#if defined (WINDOWS_VERSION)
    mkdir(newSaveGameDir);
#else
    mkdir(newSaveGameDir, 0);
#endif


Should that 0 be 0755 instead?

Crimson Wizard

Yes, thats a bug.
I checked a code quickly, in some cases mkdir for unix platforms is made with 755 mod, but in some cases it is made with 0 mod.

E: Well, right as you say.
Better search all project for mkdirs and do as in validate_user_file_path():
Code: cpp

      mkdir(output
#if !defined (WINDOWS_VERSION)
                  , 0755
#endif
      );

scottchiefbaker

I just did an ack scan of all the mkdir commands in the source and didn't find any other permissions errors.

All the checks in platform/linux/acpllnx.cpp are correct
All the checks in platform/windows/acplwin.cpp are Windows only calls, and don't matter
ac/file.cpp while technically correct, it's some fugly code. Not that way I would do it :)
ac/game.cpp is the only one the needs to be corrected.

s_d

So it's disobeying umask?  Probably we could use umask() to set the process permissions mask for file and directory creation somewhere in the Linux port's initialization code (in an "#ifdef linux" section).

scottchiefbaker

Quote from: s_d on Fri 08/02/2013 00:43:28
So it's disobeying umask?  Probably we could use umask() to set the process permissions mask for file and directory creation somewhere in the Linux port's initialization code (in an "#ifdef linux" section).

I don't think it's disobeying, it's specifically being told use 0.

http://www.gnu.org/software/libc/manual/html_node/Creating-Directories.html

s_d

Quote from: scottchiefbaker on Fri 08/02/2013 01:00:15
I don't think it's disobeying, it's specifically being told use 0.

Ah!  So, we simply need to make a platform-dependant define and drop that into the mkdir() and open() calls (set to zero on on-UNIX platforms).  Or do something a bit more clever where we query the current umask on UNIX platforms.  I'll play with that this evening once my family is asleep (my kid is currently crawling up my shoulder and singing "She'll be coming 'round the mountain when she comes..." ... hard to concentrate (laugh) ).

Crimson Wizard

#309
Quote from: s_d on Fri 08/02/2013 01:03:44
Ah!  So, we simply need to make a platform-dependant define and drop that into the mkdir() and open() calls (set to zero on on-UNIX platforms).
Windows (or rather DOS) version of mkdir does not take any permission parameter at all.
I'd suggest keeping the style when there's a helper functions made for tasks, that require different implementations/default parameters on different platforms. Check Common/util/file.h&cpp, Common/util/path.h&cpp.
It is ok to put the quick fixes in place, where needed, for now though, if you need that really urgent.

s_d

No, quick hacks are bad news.  They just build and build until nobody wants to fix it!  We can do it properly and I have no problem conforming to the style.  Staying awake right now... that's another issue entirely.

Crimson Wizard

Quote from: s_d on Fri 08/02/2013 09:02:06
No, quick hacks are bad news.  They just build and build until nobody wants to fix it!  We can do it properly and I have no problem conforming to the style.
I just remembered I have a branch with directory helpers in my local repository, and all mkdir calls are replaced with custom CreateDirectory implementation. Did that a while ago, but could not find time to finish/test these. Probably something to do on current weekends.

scottchiefbaker

I'm working with Wadjet to figure out the rain on the GeminiRue menu. They were able to fix the rain sound effect, but I still don't see actual rain falling from the sky:

http://www.perturb.org/tmp/20130207_153430.mp4
http://www.perturb.org/tmp/no-rain.png

Was this a rain plugin that was used? Is that something that's going to be available on their Linux build.

Crimson Wizard

Quote from: scottchiefbaker on Fri 08/02/2013 22:03:49
Was this a rain plugin that was used? Is that something that's going to be available on their Linux build.
I don't know the situation around this release, but doesn't WE have game source? In that case you could check how this rain was run.
Secondly, you may test your build on Windows using the very same package (running game data file as an executable). Does it behave same way?

BigMc

Janet already said here that they are using a rain module.

scottchiefbaker

She said to me:

QuoteThe plugin to create rain (the SnowRain plugin) was indeed removed. BUT it was replaced by the SnowRain module which does EXACTLY the same thing. We absolutely would not remove the rain from Gemini Rue as it would irreparably damage the atmosphere of the game. So if you see rain missing, it is a very, very bad bug!

I wasn't sure if that module was in the Linux version of the engine.

BigMc

Modules are written in AGS code and included in games, not in the engine.

Crimson Wizard

I'll ask this again: does the game behaves like this only on Linux, or on Windows too when using our engine(!!)?
Does this problem persist if the game is compiled and run from the Editor (on Windows)?
This is important to know, if that's Linux port problem, or general bug in the engine.

I can provide you with Windows build of our engine if you need one.

BigMc

Quote from: Crimson Wizard on Fri 08/02/2013 22:36:01
I can provide you with Windows build of our engine if you need one.

Didn't you know that JJS already does this?
http://jjs.at/daily/

scottchiefbaker

I just loaded the GeminiRue build in Windows and I do see rain. It's not displaying via our Linux engine though. If need be I can post the updated package I have.

SMF spam blocked by CleanTalk