Watching menu shows what game the players are playing
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@354 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
71cbbcbd04
commit
1feff8677b
1
config.l
1
config.l
|
@ -62,6 +62,7 @@ COMMENT ^#.*
|
||||||
|
|
||||||
"chroot_path" { return TYPE_PATH_CHROOT; }
|
"chroot_path" { return TYPE_PATH_CHROOT; }
|
||||||
"game_name" { return TYPE_NAME_GAME; }
|
"game_name" { return TYPE_NAME_GAME; }
|
||||||
|
"short_name" { return TYPE_GAME_SHORT_NAME; }
|
||||||
"game_path" { return TYPE_PATH_GAME; }
|
"game_path" { return TYPE_PATH_GAME; }
|
||||||
"chdir" { return TYPE_PATH_CHDIR; }
|
"chdir" { return TYPE_PATH_CHDIR; }
|
||||||
"dglroot" { return TYPE_PATH_DGLDIR; }
|
"dglroot" { return TYPE_PATH_DGLDIR; }
|
||||||
|
|
9
config.y
9
config.y
|
@ -31,7 +31,7 @@ static const char* lookup_token (int t);
|
||||||
}
|
}
|
||||||
|
|
||||||
%token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
|
%token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
|
||||||
%token TYPE_PATH_CHDIR
|
%token TYPE_PATH_CHDIR TYPE_GAME_SHORT_NAME
|
||||||
%token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
|
%token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
|
||||||
%token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT TYPE_GAMENUM
|
%token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT TYPE_GAMENUM
|
||||||
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_SAVEFILEFMT
|
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_SAVEFILEFMT
|
||||||
|
@ -139,6 +139,11 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
||||||
myconfig[ncnf]->game_name = strdup($3);
|
myconfig[ncnf]->game_name = strdup($3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TYPE_GAME_SHORT_NAME:
|
||||||
|
if (myconfig[ncnf]->shortname) free (myconfig[ncnf]->shortname);
|
||||||
|
myconfig[ncnf]->shortname = strdup($3);
|
||||||
|
break;
|
||||||
|
|
||||||
case TYPE_PATH_CHDIR:
|
case TYPE_PATH_CHDIR:
|
||||||
if (myconfig[ncnf]->chdir) free(myconfig[ncnf]->chdir);
|
if (myconfig[ncnf]->chdir) free(myconfig[ncnf]->chdir);
|
||||||
myconfig[ncnf]->chdir = strdup ($3);
|
myconfig[ncnf]->chdir = strdup ($3);
|
||||||
|
@ -297,6 +302,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
|
||||||
| TYPE_PATH_CHROOT { $$ = TYPE_PATH_CHROOT; }
|
| TYPE_PATH_CHROOT { $$ = TYPE_PATH_CHROOT; }
|
||||||
| TYPE_PATH_GAME { $$ = TYPE_PATH_GAME; }
|
| TYPE_PATH_GAME { $$ = TYPE_PATH_GAME; }
|
||||||
| TYPE_NAME_GAME { $$ = TYPE_NAME_GAME; }
|
| TYPE_NAME_GAME { $$ = TYPE_NAME_GAME; }
|
||||||
|
| TYPE_GAME_SHORT_NAME { $$ = TYPE_GAME_SHORT_NAME; }
|
||||||
| TYPE_PATH_CHDIR { $$ = TYPE_PATH_CHDIR; }
|
| TYPE_PATH_CHDIR { $$ = TYPE_PATH_CHDIR; }
|
||||||
| TYPE_PATH_DGLDIR { $$ = TYPE_PATH_DGLDIR; }
|
| TYPE_PATH_DGLDIR { $$ = TYPE_PATH_DGLDIR; }
|
||||||
| TYPE_PATH_SPOOL { $$ = TYPE_PATH_SPOOL; }
|
| TYPE_PATH_SPOOL { $$ = TYPE_PATH_SPOOL; }
|
||||||
|
@ -327,6 +333,7 @@ const char* lookup_token (int t)
|
||||||
case TYPE_PATH_CHDIR: return "chdir";
|
case TYPE_PATH_CHDIR: return "chdir";
|
||||||
case TYPE_PATH_GAME: return "game_path";
|
case TYPE_PATH_GAME: return "game_path";
|
||||||
case TYPE_NAME_GAME: return "game_name";
|
case TYPE_NAME_GAME: return "game_name";
|
||||||
|
case TYPE_GAME_SHORT_NAME: return "short_name";
|
||||||
case TYPE_PATH_DGLDIR: return "dglroot";
|
case TYPE_PATH_DGLDIR: return "dglroot";
|
||||||
case TYPE_PATH_SPOOL: return "spooldir";
|
case TYPE_PATH_SPOOL: return "spooldir";
|
||||||
case TYPE_PATH_BANNER: return "banner";
|
case TYPE_PATH_BANNER: return "banner";
|
||||||
|
|
|
@ -367,8 +367,8 @@ inprogressmenu (int gameid)
|
||||||
snprintf (gametype, sizeof gametype, "%3dx%3d",
|
snprintf (gametype, sizeof gametype, "%3dx%3d",
|
||||||
games[i + offset]->ws_col, games[i + offset]->ws_row);
|
games[i + offset]->ws_col, games[i + offset]->ws_row);
|
||||||
|
|
||||||
mvprintw (7 + i, 1, "%c) %-15s (%s) %s %s (%ldm %lds idle)",
|
mvprintw (7 + i, 1, "%c) %-15s %-5s (%s) %s %s (%ldm %lds idle)",
|
||||||
i + 97, games[i + offset]->name, gametype,
|
i + 97, games[i + offset]->name, myconfig[games[i + offset]->gamenum]->shortname, gametype,
|
||||||
games[i + offset]->date, games[i + offset]->time,
|
games[i + offset]->date, games[i + offset]->time,
|
||||||
(time (&ctime) - games[i + offset]->idle_time) / 60,
|
(time (&ctime) - games[i + offset]->idle_time) / 60,
|
||||||
(time (&ctime) - games[i + offset]->idle_time) % 60);
|
(time (&ctime) - games[i + offset]->idle_time) % 60);
|
||||||
|
|
|
@ -39,12 +39,14 @@ struct dg_game
|
||||||
char *time;
|
char *time;
|
||||||
time_t idle_time;
|
time_t idle_time;
|
||||||
int ws_row, ws_col; /* Window size */
|
int ws_row, ws_col; /* Window size */
|
||||||
|
int gamenum;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dg_config
|
struct dg_config
|
||||||
{
|
{
|
||||||
char* game_path;
|
char* game_path;
|
||||||
char* game_name;
|
char* game_name;
|
||||||
|
char* shortname;
|
||||||
char* chdir;
|
char* chdir;
|
||||||
char* rcfile;
|
char* rcfile;
|
||||||
char* spool;
|
char* spool;
|
||||||
|
|
|
@ -21,6 +21,7 @@ struct dg_config defconfig = {
|
||||||
/* chroot = */ /*"/var/lib/dgamelaunch/",*/
|
/* chroot = */ /*"/var/lib/dgamelaunch/",*/
|
||||||
/* game_path = */ "/bin/nethack",
|
/* game_path = */ "/bin/nethack",
|
||||||
/* game_name = */ "NetHack",
|
/* game_name = */ "NetHack",
|
||||||
|
/* shortname = */ "NH",
|
||||||
/* chdir = */ NULL,
|
/* chdir = */ NULL,
|
||||||
/* dglroot = *//* "/dgldir/",*/
|
/* dglroot = *//* "/dgldir/",*/
|
||||||
/* lockfile = */ /*"/dgl-lock",*/
|
/* lockfile = */ /*"/dgl-lock",*/
|
||||||
|
@ -189,6 +190,8 @@ populate_games (int xgame, int *l)
|
||||||
|
|
||||||
games[len]->idle_time = pstat.st_mtime;
|
games[len]->idle_time = pstat.st_mtime;
|
||||||
|
|
||||||
|
games[len]->gamenum = game;
|
||||||
|
|
||||||
n = read(fd, pidws, sizeof(pidws) - 1);
|
n = read(fd, pidws, sizeof(pidws) - 1);
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
|
@ -326,6 +329,7 @@ create_config ()
|
||||||
|
|
||||||
if (!myconfig[tmp]->game_path) myconfig[tmp]->game_path = defconfig.game_path;
|
if (!myconfig[tmp]->game_path) myconfig[tmp]->game_path = defconfig.game_path;
|
||||||
if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name;
|
if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name;
|
||||||
|
if (!myconfig[tmp]->shortname) myconfig[tmp]->shortname = defconfig.shortname;
|
||||||
if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile;
|
if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile;
|
||||||
if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool;
|
if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool;
|
||||||
if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt;
|
if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt;
|
||||||
|
|
|
@ -57,7 +57,10 @@ lockfile = "/dgl-lock"
|
||||||
|
|
||||||
# From inside the jail, the location of the binary to be launched.
|
# From inside the jail, the location of the binary to be launched.
|
||||||
game_path = "/bin/nethackstub"
|
game_path = "/bin/nethackstub"
|
||||||
|
# Full name of the game
|
||||||
game_name = "NetHack stub"
|
game_name = "NetHack stub"
|
||||||
|
# Short name, used in the watching menu
|
||||||
|
short_name = "NHstb"
|
||||||
|
|
||||||
# arguments for when we exec the binary
|
# arguments for when we exec the binary
|
||||||
game_args = "/bin/nethackstub"
|
game_args = "/bin/nethackstub"
|
||||||
|
@ -95,6 +98,7 @@ game_num = 1
|
||||||
|
|
||||||
game_path = "/bin/nethack"
|
game_path = "/bin/nethack"
|
||||||
game_name = "NetHack 3.4.3"
|
game_name = "NetHack 3.4.3"
|
||||||
|
short_name = "NH343"
|
||||||
|
|
||||||
game_args = "/bin/nethack"
|
game_args = "/bin/nethack"
|
||||||
game_args = "-u"
|
game_args = "-u"
|
||||||
|
@ -118,6 +122,7 @@ inprogressdir = "inprogress-nethack/"
|
||||||
game_num = 2
|
game_num = 2
|
||||||
game_path = "/bin/crawl"
|
game_path = "/bin/crawl"
|
||||||
game_name = "Crawl Stone Soup 0.1.7"
|
game_name = "Crawl Stone Soup 0.1.7"
|
||||||
|
short_name = "Crawl"
|
||||||
|
|
||||||
chdir = "/crawl/"
|
chdir = "/crawl/"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue