forked from TheAssemblyArmada/Vanilla-Conquer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
750 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/build* | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is free | ||
// software: you can redistribute it and/or modify it under the terms of | ||
// the GNU General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
|
||
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed | ||
// in the hope that it will be useful, but with permitted additional restrictions | ||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT | ||
// distributed with this program. You should have received a copy of the | ||
// GNU General Public License along with permitted additional restrictions | ||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection | ||
|
||
#include "paths.h" | ||
|
||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <cstring> | ||
#include <pwd.h> | ||
#include <stdexcept> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#include <unistd.h> | ||
#include <vector> | ||
|
||
#define PATH_MAX 256 | ||
|
||
#include <psp2/io/dirent.h> | ||
|
||
std::string vitaGamePath; | ||
|
||
const char* PathsClass::Program_Path() | ||
{ | ||
if (ProgramPath.empty()) { | ||
ProgramPath = vitaGamePath; | ||
} | ||
|
||
return ProgramPath.c_str(); | ||
} | ||
|
||
const char* PathsClass::Data_Path() | ||
{ | ||
if (DataPath.empty()) { | ||
if (ProgramPath.empty()) { | ||
// Init the program path first if it hasn't been done already. | ||
Program_Path(); | ||
} | ||
|
||
DataPath = vitaGamePath; | ||
|
||
if (!Suffix.empty()) { | ||
DataPath += SEP + Suffix; | ||
} | ||
} | ||
|
||
return DataPath.c_str(); | ||
} | ||
|
||
const char* PathsClass::User_Path() | ||
{ | ||
if (UserPath.empty()) { | ||
UserPath = vitaGamePath; | ||
|
||
if (!Suffix.empty()) { | ||
UserPath += SEP + Suffix; | ||
} | ||
|
||
Create_Directory(UserPath.c_str()); | ||
} | ||
|
||
return UserPath.c_str(); | ||
} | ||
|
||
bool PathsClass::Create_Directory(const char* dirname) | ||
{ | ||
bool ret = true; | ||
|
||
if (dirname == nullptr) { | ||
return ret; | ||
} | ||
|
||
std::string temp = dirname; | ||
size_t pos = 0; | ||
do { | ||
pos = temp.find_first_of("/", pos + 1); | ||
sceIoMkdir(temp.substr(0, pos).c_str(), 0700); | ||
} while (pos != std::string::npos); | ||
|
||
return ret; | ||
} | ||
|
||
bool PathsClass::Is_Absolute(const char* path) | ||
{ | ||
return path != nullptr && path[0] == 'u' && path[1] == 'x' && path[2] == '0'; | ||
} | ||
|
||
std::string PathsClass::Argv_Path(const char* cmd_arg) | ||
{ | ||
vitaGamePath = cmd_arg; | ||
return vitaGamePath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.