mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-25 01:12:39 +00:00
Better directory structure
(cherry picked from commit 8ee0a9309b289a1a3d1a7260a44a43c776180686) # Conflicts: # src/m_menu.c # src/m_menu.h # src/m_misc.h
This commit is contained in:
parent
464e3273a9
commit
e9110b660c
5 changed files with 68 additions and 22 deletions
|
|
@ -152,6 +152,7 @@ char srb2path[256] = ".";
|
|||
#endif
|
||||
boolean usehome = true;
|
||||
const char *pandf = "%s" PATHSEP "%s";
|
||||
static char addonsdir[MAX_WADPATH];
|
||||
|
||||
//
|
||||
// EVENT HANDLING
|
||||
|
|
@ -1090,7 +1091,6 @@ void D_SRB2Main(void)
|
|||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
I_mkdir(srb2home, 0700);
|
||||
#else
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
||||
|
|
@ -1111,6 +1111,10 @@ void D_SRB2Main(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Create addons dir
|
||||
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
|
||||
I_mkdir(addonsdir, 0755);
|
||||
|
||||
// rand() needs seeded regardless of password
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
|
|
|
|||
|
|
@ -790,6 +790,8 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_screenshot_option);
|
||||
CV_RegisterVar(&cv_screenshot_folder);
|
||||
CV_RegisterVar(&cv_moviemode);
|
||||
CV_RegisterVar(&cv_movie_option);
|
||||
CV_RegisterVar(&cv_movie_folder);
|
||||
// PNG variables
|
||||
CV_RegisterVar(&cv_zlib_level);
|
||||
CV_RegisterVar(&cv_zlib_memory);
|
||||
|
|
|
|||
44
src/m_misc.c
44
src/m_misc.c
|
|
@ -107,6 +107,9 @@ consvar_t cv_screenshot_folder = {"screenshot_folder", "", CV_SAVE, NULL, NULL,
|
|||
static CV_PossibleValue_t moviemode_cons_t[] = {{MM_GIF, "GIF"}, {MM_APNG, "aPNG"}, {MM_SCREENSHOT, "Screenshots"}, {0, NULL}};
|
||||
consvar_t cv_moviemode = {"moviemode_mode", "GIF", CV_SAVE|CV_CALL, moviemode_cons_t, Moviemode_mode_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_movie_option = {"movie_option", "Default", CV_SAVE|CV_CALL, screenshot_cons_t, Moviemode_option_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_movie_folder = {"movie_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t zlib_mem_level_t[] = {
|
||||
{1, "(Min Memory) 1"},
|
||||
{2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"},
|
||||
|
|
@ -1080,19 +1083,25 @@ static inline moviemode_t M_StartMovieGIF(const char *pathname)
|
|||
void M_StartMovie(void)
|
||||
{
|
||||
#if NUMSCREENS > 2
|
||||
const char *pathname = ".";
|
||||
char pathname[MAX_WADPATH];
|
||||
|
||||
if (moviemode)
|
||||
return;
|
||||
|
||||
if (cv_screenshot_option.value == 0)
|
||||
pathname = usehome ? srb2home : srb2path;
|
||||
else if (cv_screenshot_option.value == 1)
|
||||
pathname = srb2home;
|
||||
else if (cv_screenshot_option.value == 2)
|
||||
pathname = srb2path;
|
||||
else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0')
|
||||
pathname = cv_screenshot_folder.string;
|
||||
if (cv_movie_option.value == 0)
|
||||
strcpy(pathname, usehome ? srb2home : srb2path);
|
||||
else if (cv_movie_option.value == 1)
|
||||
strcpy(pathname, srb2home);
|
||||
else if (cv_movie_option.value == 2)
|
||||
strcpy(pathname, srb2path);
|
||||
else if (cv_movie_option.value == 3 && *cv_movie_folder.string != '\0')
|
||||
strcpy(pathname, cv_screenshot_folder.string);
|
||||
|
||||
if (cv_movie_option.value != 3)
|
||||
{
|
||||
strcat(pathname, PATHSEP"movies"PATHSEP);
|
||||
I_mkdir(pathname, 0755);
|
||||
}
|
||||
|
||||
if (rendermode == render_none)
|
||||
I_Error("Can't make a movie without a render system\n");
|
||||
|
|
@ -1424,7 +1433,8 @@ void M_ScreenShot(void)
|
|||
void M_DoScreenShot(void)
|
||||
{
|
||||
#if NUMSCREENS > 2
|
||||
const char *freename = NULL, *pathname = ".";
|
||||
const char *freename = NULL;
|
||||
char pathname[MAX_WADPATH];
|
||||
boolean ret = false;
|
||||
UINT8 *linear = NULL;
|
||||
|
||||
|
|
@ -1432,13 +1442,19 @@ void M_DoScreenShot(void)
|
|||
takescreenshot = false;
|
||||
|
||||
if (cv_screenshot_option.value == 0)
|
||||
pathname = usehome ? srb2home : srb2path;
|
||||
strcpy(pathname, usehome ? srb2home : srb2path);
|
||||
else if (cv_screenshot_option.value == 1)
|
||||
pathname = srb2home;
|
||||
strcpy(pathname, srb2home);
|
||||
else if (cv_screenshot_option.value == 2)
|
||||
pathname = srb2path;
|
||||
strcpy(pathname, srb2path);
|
||||
else if (cv_screenshot_option.value == 3 && *cv_screenshot_folder.string != '\0')
|
||||
pathname = cv_screenshot_folder.string;
|
||||
strcpy(pathname, cv_screenshot_folder.string);
|
||||
|
||||
if (cv_screenshot_option.value != 3)
|
||||
{
|
||||
strcat(pathname, PATHSEP"screenshots"PATHSEP);
|
||||
I_mkdir(pathname, 0755);
|
||||
}
|
||||
|
||||
#ifdef USE_PNG
|
||||
if (rendermode != render_none)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ typedef enum {
|
|||
extern moviemode_t moviemode;
|
||||
|
||||
extern consvar_t cv_screenshot_option, cv_screenshot_folder;
|
||||
extern consvar_t cv_moviemode;
|
||||
extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option;
|
||||
extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits;
|
||||
extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa;
|
||||
extern consvar_t cv_apng_delay;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "time.h" // For log timestamps
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
|
||||
#ifdef HAVE_TTF
|
||||
|
|
@ -114,6 +116,7 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
{
|
||||
const char *logdir = NULL;
|
||||
char logfile[MAX_WADPATH];
|
||||
myargc = argc;
|
||||
myargv = argv; /// \todo pull out path to exe from this string
|
||||
|
||||
|
|
@ -125,15 +128,35 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
logdir = D_Home();
|
||||
|
||||
#ifdef LOGMESSAGES
|
||||
if (!M_CheckParm("-nolog"))
|
||||
{
|
||||
logdir = D_Home();
|
||||
|
||||
time_t my_time;
|
||||
struct tm * timeinfo;
|
||||
char buf[26];
|
||||
my_time = time(NULL);
|
||||
timeinfo = localtime(&my_time);
|
||||
|
||||
strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo);
|
||||
strcpy(logfile, va("log-%s.txt", buf));
|
||||
|
||||
#ifdef DEFAULTDIR
|
||||
if (logdir)
|
||||
logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt");
|
||||
else
|
||||
if (logdir)
|
||||
{
|
||||
// Create dirs here because D_SRB2Main() is too late.
|
||||
I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755);
|
||||
I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, PATHSEP), 0755);
|
||||
logstream = fopen(va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfile), "wt");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
logstream = fopen("./log.txt", "wt");
|
||||
{
|
||||
I_mkdir("."PATHSEP"logs"PATHSEP, 0755);
|
||||
logstream = fopen(va("."PATHSEP"logs"PATHSEP"%s", logfile), "wt");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//I_OutputMsg("I_StartupSystem() ...\n");
|
||||
|
|
@ -161,6 +184,7 @@ int main(int argc, char **argv)
|
|||
CONS_Printf("Setting up SRB2Kart...\n");
|
||||
D_SRB2Main();
|
||||
CONS_Printf("Entering main game loop...\n");
|
||||
CONS_Printf("%s\n", logfile);
|
||||
// never return
|
||||
D_SRB2Loop();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue