User Files
User files is a directory created by each GTA PC game. It usually is the location of setting files, replays and savegames. The user files directory usually is located inside the My Documents directory of the Microsoft Windows operating system:
-
%USERPROFILE%\My Documents\GTA3 User Files
or%USERPROFILE%\Documents\GTA3 User Files
-
%USERPROFILE%\My Documents\GTA Vice City User Files
or%USERPROFILE%\Documents\GTA Vice City User Files
-
%USERPROFILE%\My Documents\GTA San Andreas User Files
or%USERPROFILE%\Documents\GTA San Andreas User Files
Vice City
Vice City stores two additional files, the stats.html
and stats.txt
, that contains a dump of all statistics that can be seen in the menu. The file can be generated from the stats menu by pressing the S key. For the following formats, "\n" denotes a newline and "\t" denotes a tab character. Internally, all newline characters (0x0A) are prefixed by a carriage return character (0x0D) in order for them to be viewable on some text editing programs like Notepad. "%s" denotes a string placeholder that can change depending on the text.
stats.txt
Header
Some text can change depending on the GXT entry. They are denoted by dotted underlines that you can hover your mouse over and see the GXT string.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n
\t\t\tGTA VICE CITY STATS\n
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n
\n
\n
LAST MISSION PASSED: %s\n
DATE: %s\n
\n
\n
Criminal rating: %s (%d)\n
\n
\n
Body
Every stat in the menu is outputted individually into this format. The first string placeholder is the stat name and the second one is the stat value or content.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n
\n
%s\n
%s\n
\n
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n
\n
San Andreas
San Andreas does also store user track information and ingame screenshots there. Also the stats.html file gets exported to this location. The user tracks themselves can be stored as shortcuts, files or subdirectories inside the directory My Documents/GTA San Andreas User Files/User Tracks
.
After the directory got scanned by the game the file sa-ufiles.dat
gets created. It holds an list of unterminated strings where each represents a absolute file path of an audio file. The following C++ code snippet demonstrates an easy way to parse this file:
// parse sa-ufiles.dat
void parseFile(std::string &fileName)
{
// open the file with reading rights and search the end of the file
std::fstream stream(fileName.c_str(), std::ios::in | std::ios::ate);
// allocate an array of characters to read the whole file content
int size = static_cast<int>(stream->tellg());
char* buffer = new char[size];
// search the start of the file and read it's content
stream->seekg(0);
stream->read(buffer, size);
// parse the content, return value is an vector of strings containing the file names
std::string str(buffer);
parseContent(str);
// delete the memory for buffering and close the stream
delete[] buffer;
stream->close();
}
// parse the content of a sa-ufiles.dat file
std::vector<std::string> parseContent(std::string& buffer)
{
// vector for the file names
std::vector<std::string> fileNames;
// search for the partition letter until there is no one left
std::size_t found;
while ((found = (buffer.find_last_of(":") - 1)) != npos)
{
// push file name to the vector
fileNames.pus_back(buffer.substr(found));
// erase this file name from the file.
buffer.erase(found);
}
return fileNames;
}
Also there is an file called sa-utrax.dat
, but it appears to be unused.
The player is able to create screenshots from the game using an camera. Those screenshots get stored as jpeg compressed images inside the directory My Documents/GTA San Andreas User Files/Gallery
.