From 15fc8355462502005d367adcffbf9c1f25d711e9 Mon Sep 17 00:00:00 2001 From: Michael Sterrett Date: Fri, 7 Nov 2003 08:17:38 +0000 Subject: version bump for bug 32790 --- games-arcade/njam/files/digest-njam-1.00 | 1 + games-arcade/njam/files/njam-1.00-conf.patch | 112 +++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 games-arcade/njam/files/digest-njam-1.00 create mode 100644 games-arcade/njam/files/njam-1.00-conf.patch (limited to 'games-arcade/njam/files') diff --git a/games-arcade/njam/files/digest-njam-1.00 b/games-arcade/njam/files/digest-njam-1.00 new file mode 100644 index 000000000000..89bc9b172246 --- /dev/null +++ b/games-arcade/njam/files/digest-njam-1.00 @@ -0,0 +1 @@ +MD5 88b276a1334477295fc3ba3cc44e05fd njam-1.00-src.tar.gz 1342417 diff --git a/games-arcade/njam/files/njam-1.00-conf.patch b/games-arcade/njam/files/njam-1.00-conf.patch new file mode 100644 index 000000000000..d0acc9699367 --- /dev/null +++ b/games-arcade/njam/files/njam-1.00-conf.patch @@ -0,0 +1,112 @@ +--- njam.cpp.orig 2003-11-06 23:59:22.000000000 -0800 ++++ njam.cpp 2003-11-06 23:59:50.000000000 -0800 +@@ -33,6 +33,8 @@ + // needed for chdir + #ifdef __linux__ + #include ++#include ++#include + #endif + + #include +@@ -213,16 +215,30 @@ + if (m_NetworkAvailable) + SDLNet_Quit(); + ++ FILE *fp; + // write configuration options +- char filename[] = "njam.conf"; +- FILE *fp = fopen(filename, "w+"); +- if (fp) ++ if (getenv("HOME") && !chdir(getenv("HOME"))) + { +- fprintf(fp, "M=%d\n", (m_GameOptions.PlayMusic ? 1 : 0)); +- fprintf(fp, "S=%d\n", (m_GameOptions.PlaySound ? 1 : 0)); +- fprintf(fp, "A=%d\n", (m_GameOptions.UseAllSkins ? 1 : 0)); +- fprintf(fp, "I=%s\n", m_GameOptions.ServerIP); +- fclose(fp); ++ mkdir(".njam", 0774); ++ if (!chdir(".njam")) ++ { ++ char filename[] = "njam.conf"; ++ fp = fopen(filename, "w+"); ++ ++ if (fp) ++ { ++ fprintf(fp, ++ "M=%d\n" ++ "S=%d\n" ++ "A=%d\n" ++ "I=%s\n", ++ (m_GameOptions.PlayMusic ? 1 : 0), ++ (m_GameOptions.PlaySound ? 1 : 0), ++ (m_GameOptions.UseAllSkins ? 1 : 0), ++ m_GameOptions.ServerIP); ++ fclose(fp); ++ } ++ } + } + + // format: NAME#POINTS#LEVEL# +@@ -597,35 +613,39 @@ + m_FontBlue = new NjamFont("data/font-blue.bmp", 6, 9); + m_FontYellow = new NjamFont("data/font-yellow.bmp", 10, 15); + ++ FILE *fp; + // Load user settings from .conf file +- char filename[] = "njam.conf"; +- FILE *fp = fopen(filename, "r"); +- if (fp) ++ if (getenv("HOME") && !chdir(getenv("HOME")) && !chdir(".njam")) + { +- LogFile("Reading njam.conf file.\n"); +- char buff[20]; +- while (!feof(fp)) +- { +- fgets(buff, 20, fp); +- if (buff[1] == '=') ++ char filename[] = "njam.conf"; ++ fp = fopen(filename, "r"); ++ if (fp) ++ { ++ LogFile("Reading njam.conf file.\n"); ++ char buff[20]; ++ while (!feof(fp)) + { +- int i; +- switch (buff[0]) ++ fgets(buff, 20, fp); ++ if (buff[1] == '=') + { +- case 'M': m_GameOptions.PlayMusic = (buff[2] == '1'); break; +- case 'S': m_GameOptions.PlaySound = (buff[2] == '1'); break; +- case 'A': m_GameOptions.UseAllSkins = (buff[2] == '1'); break; +- case 'I': // serverIP +- for (i=2; buff[i] != '\n' && buff[i] && i<17; i++) +- m_GameOptions.ServerIP[i-2] = buff[i]; +- m_GameOptions.ServerIP[i] = '\0'; +- break; +- default: +- printf("Unknown configuration file option: %c\n", buff[0]); ++ int i; ++ switch (buff[0]) ++ { ++ case 'M': m_GameOptions.PlayMusic = (buff[2] == '1'); break; ++ case 'S': m_GameOptions.PlaySound = (buff[2] == '1'); break; ++ case 'A': m_GameOptions.UseAllSkins = (buff[2] == '1'); break; ++ case 'I': // serverIP ++ for (i=2; buff[i] != '\n' && buff[i] && i<17; i++) ++ m_GameOptions.ServerIP[i-2] = buff[i]; ++ m_GameOptions.ServerIP[i] = '\0'; ++ break; ++ default: ++ printf("Unknown configuration file option: %c\n", buff[0]); ++ } + } + } ++ fclose(fp); + } +- fclose(fp); + } + + // create default hiscore -- cgit v1.2.3-65-gdbad