mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-14 16:40:52 +00:00
- unified demo path handling for all platforms
The current game subdirectory is now created on all platforms
This commit is contained in:
parent
787211c9dc
commit
1479e1feae
7 changed files with 22 additions and 14 deletions
|
@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "network.h"
|
||||
#include "player.h"
|
||||
#include "screen.h"
|
||||
#include "i_specialpaths.h"
|
||||
#include "view.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "menu/menu.h"
|
||||
|
@ -127,7 +126,7 @@ bool CDemo::Create(const char *pzFile)
|
|||
{
|
||||
for (int i = 0; i < 8 && !vc; i++)
|
||||
{
|
||||
snprintf(buffer, BMAX_PATH, "%s%s0%02d.dem", M_GetDemoPath().GetChars(), BloodIniPre, i);
|
||||
snprintf(buffer, BMAX_PATH, "%s%s0%02d.dem", G_GetDemoPath().GetChars(), BloodIniPre, i);
|
||||
if (access(buffer, 0) != -1)
|
||||
vc = 1;
|
||||
}
|
||||
|
@ -140,7 +139,7 @@ bool CDemo::Create(const char *pzFile)
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(buffer, BMAX_PATH, "%s%s", M_GetDemoPath().GetChars(), pzFile);
|
||||
snprintf(buffer, BMAX_PATH, "%s%s", G_GetDemoPath().GetChars(), pzFile);
|
||||
hRFile = fopen(buffer, "wb");
|
||||
if (hRFile == NULL)
|
||||
return false;
|
||||
|
@ -401,7 +400,7 @@ void CDemo::LoadDemoInfo(void)
|
|||
auto pDemo = &pFirstDemo;
|
||||
at59ef = 0;
|
||||
char zFN[BMAX_PATH];
|
||||
snprintf(zFN, BMAX_PATH, "%s%s*.dem", M_GetDemoPath().GetChars(), BloodIniPre);
|
||||
snprintf(zFN, BMAX_PATH, "%s%s*.dem", G_GetDemoPath().GetChars(), BloodIniPre);
|
||||
TArray<FString> demos;
|
||||
D_AddWildFile(demos, zFN);
|
||||
|
||||
|
|
|
@ -878,3 +878,13 @@ int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int
|
|||
return clamp(xs_RoundToInt(ratio * 65536), 0, 65536);
|
||||
}
|
||||
|
||||
|
||||
FString G_GetDemoPath()
|
||||
{
|
||||
FString path = M_GetDemoPath();
|
||||
|
||||
path << LumpFilter << '/';
|
||||
CreatePath(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,8 @@ void G_HandleMemErr(int32_t lineNum, const char* fileName, const char* funcName)
|
|||
void G_FatalEngineError(void);
|
||||
int CalcSmoothRatio(const ClockTicks& totalclk, const ClockTicks& ototalclk, int realgameticspersec);
|
||||
|
||||
FString G_GetDemoPath();
|
||||
|
||||
|
||||
struct FStartupInfo
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "menus.h"
|
||||
#include "savegame.h"
|
||||
#include "screens.h"
|
||||
#include "i_specialpaths.h"
|
||||
#include "printf.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
|
@ -152,7 +151,7 @@ void G_OpenDemoWrite(void)
|
|||
if (demonum == MAXDEMOS)
|
||||
return;
|
||||
|
||||
if (snprintf(demofn, sizeof(demofn), "%s" DEMOFN_FMT, M_GetDemoPath().GetChars(), demonum))
|
||||
if (snprintf(demofn, sizeof(demofn), "%s" DEMOFN_FMT, G_GetDemoPath().GetChars(), demonum))
|
||||
{
|
||||
initprintf("Couldn't start demo writing: INTERNAL ERROR: file name too long\n");
|
||||
goto error_wopen_demo;
|
||||
|
|
|
@ -239,7 +239,7 @@ FString M_GetDemoPath()
|
|||
{
|
||||
path += "/" GAME_DIR "/Demos/";
|
||||
}
|
||||
CreatePath(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "printf.h"
|
||||
#include "cmdlib.h"
|
||||
#include "i_findfile.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "version.h" // for GAMENAME
|
||||
|
||||
// Stuff that needs to be set up later.
|
||||
|
@ -349,7 +348,7 @@ FString M_GetDemoPath()
|
|||
FStringf inipath("%s" GAMENAME "_portable.ini", progdir.GetChars());
|
||||
if (FileExists(inipath) || !UseKnownFolders())
|
||||
{
|
||||
path << progdir << "Demos/" << LumpFilter << '/';
|
||||
path << progdir << "Demos/";
|
||||
}
|
||||
else
|
||||
// Try defacto My Documents/My Games folder
|
||||
|
@ -357,13 +356,13 @@ FString M_GetDemoPath()
|
|||
{
|
||||
// I assume since this isn't a standard folder, it doesn't have
|
||||
// a localized name either.
|
||||
path << "/My Games/" GAMENAME "/" << LumpFilter << '/';
|
||||
path << "/My Games/" GAMENAME "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
path << progdir << "Demos/" << LumpFilter << '/';
|
||||
path << progdir << "Demos/";
|
||||
}
|
||||
CreatePath(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "menus.h"
|
||||
#include "savegame.h"
|
||||
#include "screens.h"
|
||||
#include "i_specialpaths.h"
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
|
@ -151,7 +150,7 @@ void G_OpenDemoWrite(void)
|
|||
if (demonum == MAXDEMOS)
|
||||
return;
|
||||
|
||||
if (snprintf(demofn, sizeof(demofn), "%s" DEMOFN_FMT, M_GetDemoPath().GetChars(), demonum))
|
||||
if (snprintf(demofn, sizeof(demofn), "%s" DEMOFN_FMT, G_GetDemoPath().GetChars(), demonum))
|
||||
{
|
||||
initprintf("Couldn't start demo writing: INTERNAL ERROR: file name too long\n");
|
||||
goto error_wopen_demo;
|
||||
|
|
Loading…
Reference in a new issue