Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

@ VFS prefix

- ozCore
  * File
    + '@' prefix for VFS paths, File::FileSystem--
    + realPath()
  * String::first(), last() for const char* strings
- ozEngine
  * move ctor/operators for AL*, GL* classes
  * WAVE loader fixed for big-endian machines
  • Loading branch information...
commit fbcf588c5b3cc91cab1fe374eaceb528dacd0e2e 1 parent ce26dd1
@ducakar authored
Showing with 971 additions and 437 deletions.
  1. +1 −1  build.sh
  2. +2 −0  doc/Doxyfile
  3. +3 −1 doc/Doxyfile.liboz
  4. +4 −4 src/builder/BSP.cc
  5. +62 −63 src/builder/Builder.cc
  6. +2 −2 src/builder/Builder.hh
  7. +3 −3 src/builder/Caelum.cc
  8. +1 −1  src/builder/Class.cc
  9. +12 −12 src/builder/Context.cc
  10. +1 −1  src/builder/FragPool.cc
  11. +15 −15 src/builder/Lingua.cc
  12. +6 −5 src/builder/MD2.cc
  13. +8 −7 src/builder/MD3.cc
  14. +7 −5 src/builder/OBJ.cc
  15. +10 −10 src/builder/Terra.cc
  16. +10 −11 src/builder/UI.cc
  17. +1 −1  src/client/BSP.cc
  18. +1 −1  src/client/Caelum.cc
  19. +1 −1  src/client/CinematicProxy.cc
  20. +10 −10 src/client/Client.cc
  21. +3 −3 src/client/Context.cc
  22. +3 −3 src/client/GameStage.cc
  23. +2 −2 src/client/Input.cc
  24. +2 −2 src/client/Lua.cc
  25. +1 −1  src/client/MD2.cc
  26. +1 −1  src/client/MD3.cc
  27. +1 −1  src/client/NaClDownloader.cc
  28. +9 −9 src/client/NaClUpdater.cc
  29. +1 −1  src/client/Profile.cc
  30. +1 −1  src/client/SMM.cc
  31. +4 −4 src/client/Shader.cc
  32. +1 −1  src/client/Sound.cc
  33. +1 −1  src/client/Terra.cc
  34. +1 −1  src/client/luaapi.hh
  35. +1 −1  src/client/ui/CreditsMenu.cc
  36. +1 −1  src/client/ui/Font.cc
  37. +4 −4 src/client/ui/GalileoFrame.cc
  38. +11 −11 src/client/ui/HudArea.cc
  39. +5 −5 src/client/ui/Inventory.cc
  40. +5 −5 src/client/ui/MissionMenu.cc
  41. +1 −1  src/client/ui/Mouse.cc
  42. +1 −1  src/client/ui/Style.cc
  43. +6 −6 src/common/Lingua.cc
  44. +2 −2 src/matrix/BSP.cc
  45. +16 −16 src/matrix/Liber.cc
  46. +1 −1  src/matrix/Lua.cc
  47. +1 −1  src/matrix/NamePool.cc
  48. +1 −1  src/matrix/Terra.cc
  49. +1 −1  src/nirvana/Lua.cc
  50. +0 −4 src/ozCore/Buffer.cc
  51. +1 −1  src/ozCore/Chain.hh
  52. +2 −2 src/ozCore/DArray.hh
  53. +2 −2 src/ozCore/DChain.hh
  54. +98 −75 src/ozCore/File.cc
  55. +70 −33 src/ozCore/File.hh
  56. +3 −3 src/ozCore/List.hh
  57. +3 −3 src/ozCore/Map.hh
  58. +7 −2 src/ozCore/Mutex.hh
  59. +4 −4 src/ozCore/Pool.hh
  60. +7 −2 src/ozCore/Semaphore.hh
  61. +3 −3 src/ozCore/Set.hh
  62. +7 −2 src/ozCore/SharedLib.hh
  63. +2 −2 src/ozCore/SpinLock.hh
  64. +8 −16 src/ozCore/String.cc
  65. +57 −3 src/ozCore/String.hh
  66. +5 −0 src/ozCore/System.hh
  67. +7 −2 src/ozCore/Thread.hh
  68. +20 −2 src/ozEngine/ALBuffer.cc
  69. +24 −0 src/ozEngine/ALBuffer.hh
  70. +24 −0 src/ozEngine/ALSource.hh
  71. +10 −1 src/ozEngine/CMakeLists.txt
  72. +258 −2 src/ozEngine/GLTexture.cc
  73. +82 −19 src/ozEngine/GLTexture.hh
  74. +1 −1  src/tests/CMakeLists.txt
  75. +10 −3 src/tests/test.cc
  76. +1 −1  src/tools/ozBuild.cc
  77. +5 −5 src/tools/ozGettext.cc
  78. +2 −2 src/tools/ozManifest.cc
View
2  build.sh
@@ -28,7 +28,7 @@ platforms=(
# NaCl-i686
# NaCl-ARM
# PNaCl
-# Android14-i686
+ Android14-i686
# Android14-ARM
# Android14-ARMv7a
# Android14-MIPS
View
2  doc/Doxyfile
@@ -108,6 +108,8 @@ WARN_LOGFILE =
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = src/ozCore \
+ src/ozDynamics \
+ src/ozEngine \
src/common \
src/tools
INPUT_ENCODING = UTF-8
View
4 doc/Doxyfile.liboz
@@ -107,7 +107,9 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = src/ozCore
+INPUT = src/ozCore \
+ src/ozDynamics \
+ src/ozEngine
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.hh \
*.dox
View
8 src/builder/BSP.cc
@@ -44,8 +44,8 @@ const float BSP::GLASS_SPECULAR = 2.00f;
void BSP::load()
{
- File configFile( File::VIRTUAL, String::str( "baseq3/maps/%s.json", name.cstr() ) );
- File bspFile( File::VIRTUAL, String::str( "baseq3/maps/%s.bsp", name.cstr() ) );
+ File configFile( String::str( "@baseq3/maps/%s.json", name.cstr() ) );
+ File bspFile( String::str( "@baseq3/maps/%s.bsp", name.cstr() ) );
JSON config;
if( !config.load( configFile ) ) {
@@ -987,7 +987,7 @@ void BSP::check() const
void BSP::saveMatrix()
{
- File destFile( File::NATIVE, "bsp/" + name + ".ozBSP" );
+ File destFile( "bsp/" + name + ".ozBSP" );
Log::print( "Dumping BSP structure to '%s' ...", destFile.path().cstr() );
@@ -1127,7 +1127,7 @@ void BSP::saveMatrix()
void BSP::saveClient()
{
- File destFile( File::NATIVE, "bsp/" + name + ".ozcBSP" );
+ File destFile( "bsp/" + name + ".ozcBSP" );
compiler.beginMesh();
View
125 src/builder/Builder.cc
@@ -80,35 +80,35 @@ void Builder::printUsage( const char* invocationName )
invocationName );
}
-void Builder::copyFiles( const char* srcDir, const char* destDir, const char* ext, bool recurse )
+void Builder::copyFiles( const File& srcDir, const File& destDir, const char* ext, bool recurse )
{
- String sSrcDir = srcDir;
- String sDestDir = destDir;
- File dir( File::VIRTUAL, sSrcDir );
- DArray<File> dirList = dir.ls();
+ String sSrcDir = srcDir.path();
+ String sDestDir = destDir.path();
+ DArray<File> dirList = srcDir.ls();
if( dirList.isEmpty() ) {
return;
}
- if( !sSrcDir.isEmpty() ) {
+ if( !sSrcDir.fileIsEmpty() ) {
sSrcDir = sSrcDir + "/";
}
- if( !sDestDir.isEmpty() ) {
+ if( !sDestDir.fileIsEmpty() ) {
sDestDir = sDestDir + "/";
}
Log::println( "Copying '%s*.%s' -> '%s' {", sSrcDir.cstr(), ext, sDestDir.cstr() );
Log::indent();
- File::mkdir( destDir );
+ File::mkdir( destDir.path() );
foreach( file, dirList.iter() ) {
String fileName = file->name();
if( file->type() == File::DIRECTORY ) {
if( recurse ) {
- copyFiles( srcDir + ( "/" + file->name() ), destDir + ( "/" + file->name() ), ext, true );
+ copyFiles( srcDir.path() + "/" + file->name(), destDir.path() + "/" + file->name(), ext,
+ true );
}
}
else if( file->hasExtension( ext ) || fileName.beginsWith( "README" ) ||
@@ -116,9 +116,9 @@ void Builder::copyFiles( const char* srcDir, const char* destDir, const char* ex
{
Log::print( "Copying '%s' ...", fileName.cstr() );
- File destFile( File::NATIVE, sDestDir + fileName );
+ File destFile( sDestDir + fileName );
if( !destFile.write( file->read() ) ) {
- OZ_ERROR( "Failed to write '%s'", file->path().cstr() );
+ OZ_ERROR( "Failed to write '%s'", destFile.path().cstr() );
}
Log::printEnd( " OK" );
@@ -135,8 +135,8 @@ void Builder::buildCaela()
Log::println( "Building Caela {" );
Log::indent();
- String srcDir = "caelum";
- File dir( File::VIRTUAL, srcDir );
+ String srcDir = "@caelum";
+ File dir( srcDir );
DArray<File> dirList = dir.ls();
srcDir = srcDir + "/";
@@ -161,8 +161,8 @@ void Builder::buildTerrae()
Log::println( "Building Terrae {" );
Log::indent();
- String srcDir = "terra";
- File dir( File::VIRTUAL, srcDir );
+ String srcDir = "@terra";
+ File dir( srcDir );
DArray<File> dirList = dir.ls();
srcDir = srcDir + "/";
@@ -185,9 +185,9 @@ void Builder::buildBSPs()
Log::println( "Building BSPs {" );
Log::indent();
- String srcDir = "baseq3/maps";
+ String srcDir = "@baseq3/maps";
String destDir = "bsp";
- File dir( File::VIRTUAL, srcDir );
+ File dir( srcDir );
DArray<File> dirList = dir.ls();
srcDir = srcDir + "/";
@@ -217,7 +217,7 @@ void Builder::buildBSPTextures()
Set<String> usedDirs;
- File dir( File::VIRTUAL, "baseq3/textures" );
+ File dir( "@baseq3/textures" );
DArray<File> dirList = dir.ls();
foreach( subDir, dirList.iter() ) {
@@ -260,7 +260,7 @@ void Builder::buildBSPTextures()
File::mkdir( "tex" );
File::mkdir( "tex/" + subDir->name() );
- File destFile( File::NATIVE, String::str( "tex/%s.ozcTex", name.cstr() ) );
+ File destFile( String::str( "tex/%s.ozcTex", name.cstr() ) );
Context::Texture diffuseTex, masksTex, normalsTex;
context.loadTextures( &diffuseTex, &masksTex, &normalsTex, path );
@@ -299,7 +299,7 @@ void Builder::buildBSPTextures()
}
foreach( subDirPath, usedDirs.citer() ) {
- File subDir( File::VIRTUAL, *subDirPath );
+ File subDir( "@" + *subDirPath );
DArray<File> texList = subDir.ls();
@@ -317,7 +317,7 @@ void Builder::buildBSPTextures()
File::mkdir( "tex" );
File::mkdir( "tex/" + subDir.name() );
- File destFile( File::NATIVE, String::str( "tex/%s/%s", subDir.name().cstr(), name.cstr() ) );
+ File destFile( String::str( "tex/%s/%s", subDir.name().cstr(), name.cstr() ) );
if( !destFile.write( file->read() ) ) {
OZ_ERROR( "Failed to write '%s'", destFile.path().cstr() );
}
@@ -337,8 +337,8 @@ void Builder::buildClasses( const String& pkgName )
Log::println( "Building object classes {" );
Log::indent();
- String dirName = "class";
- File dir( File::VIRTUAL, dirName );
+ String dirName = "@class";
+ File dir( dirName );
DArray<File> dirList = dir.ls();
OutputStream os( 0 );
@@ -389,7 +389,7 @@ void Builder::buildClasses( const String& pkgName )
headerStream.deallocate();
File::mkdir( "class" );
- File outFile( File::NATIVE, "class/" + pkgName + ".ozClasses" );
+ File outFile( "class/" + pkgName + ".ozClasses" );
Log::print( "Writing to '%s' ...", outFile.path().cstr() );
@@ -411,8 +411,8 @@ void Builder::buildFragPools( const String& pkgName )
Log::println( "Building fragment pools {" );
Log::indent();
- String dirName = "frag";
- File dir( File::VIRTUAL, dirName );
+ String dirName = "@frag";
+ File dir( dirName );
DArray<File> dirList = dir.ls();
OutputStream os( 0 );
@@ -433,7 +433,7 @@ void Builder::buildFragPools( const String& pkgName )
if( os.tell() != 0 ) {
File::mkdir( "frag" );
- File outFile( File::NATIVE, "frag/" + pkgName + ".ozFragPools" );
+ File outFile( "frag/" + pkgName + ".ozFragPools" );
Log::print( "Writing to '%s' ...", outFile.path().cstr() );
@@ -459,7 +459,7 @@ void Builder::buildModels()
Log::println( "Building used models {" );
Log::indent();
- File mdlDir( File::VIRTUAL, "mdl" );
+ File mdlDir( "@mdl" );
File::mkdir( mdlDir.path() );
DArray<File> dirList = mdlDir.ls();
@@ -482,7 +482,7 @@ void Builder::buildModels()
if( name.beginsWith( "COPYING" ) || name.beginsWith( "README" ) ) {
Log::print( "Copying '%s' ...", path.cstr() );
- File destFile( File::NATIVE, path );
+ File destFile( &path[1] );
if( !destFile.write( file->read() ) ) {
OZ_ERROR( "Failed to write '%s'", destFile.path().cstr() );
}
@@ -492,10 +492,10 @@ void Builder::buildModels()
}
}
- if( File( File::VIRTUAL, dir->path() + "/data.obj" ).type() != File::MISSING ) {
+ if( File( dir->path() + "/data.obj" ).type() != File::MISSING ) {
obj.build( dir->path() );
}
- else if( File( File::VIRTUAL, dir->path() + "/tris.md2" ).type() != File::MISSING ) {
+ else if( File( dir->path() + "/tris.md2" ).type() != File::MISSING ) {
md2.build( dir->path() );
}
else {
@@ -518,7 +518,7 @@ void Builder::copySounds()
Set<String> usedDirs;
- File dir( File::VIRTUAL, "snd" );
+ File dir( "@snd" );
DArray<File> dirList = dir.ls();
foreach( subDir, dirList.iter() ) {
@@ -558,7 +558,7 @@ void Builder::copySounds()
File::mkdir( "snd" );
File::mkdir( "snd/" + subDir->name() );
- File destFile( File::NATIVE, file->path() );
+ File destFile( &file->path()[1] );
if( !destFile.write( file->read() ) ) {
OZ_ERROR( "Failed to write '%s'", destFile.path().cstr() );
}
@@ -568,7 +568,7 @@ void Builder::copySounds()
}
foreach( subDirPath, usedDirs.citer() ) {
- File subDir( File::VIRTUAL, *subDirPath );
+ File subDir( *subDirPath );
DArray<File> texList = subDir.ls();
foreach( file, texList.iter() ) {
@@ -585,7 +585,7 @@ void Builder::copySounds()
File::mkdir( "snd" );
File::mkdir( "snd/" + subDir.name() );
- File destFile( File::NATIVE, path );
+ File destFile( &path[1] );
if( !destFile.write( file->read() ) ) {
OZ_ERROR( "Failed to write '%s'", destFile.path().cstr() );
}
@@ -611,11 +611,10 @@ void Builder::buildModules()
void Builder::checkLua( const char* path )
{
- Log::println( "Checking Lua scripts '%s' {", path );
+ Log::println( "Checking Lua scripts in '%s' {", path );
Log::indent();
- String srcDir = String::str( "%s/", path );
- File dir( File::VIRTUAL, path );
+ File dir( path );
DArray<File> dirList = dir.ls();
String sources;
@@ -625,7 +624,7 @@ void Builder::checkLua( const char* path )
continue;
}
- String cmdLine = "luac -p " + file->realDir() + "/" + file->path();
+ String cmdLine = "luac -p " + file->realPath();
Log::println( "%s", cmdLine.cstr() );
if( system( cmdLine ) != 0 ) {
@@ -642,15 +641,15 @@ void Builder::buildMissions()
Log::println( "Building missions {" );
Log::indent();
- DArray<File> missions = File( File::VIRTUAL, "mission" ).ls();
+ DArray<File> missions = File( "@mission" ).ls();
foreach( mission, missions.citer() ) {
checkLua( mission->path() );
- copyFiles( mission->path(), mission->path(), "lua", false );
- copyFiles( mission->path(), mission->path(), "json", false );
+ copyFiles( mission->path(), &mission->path()[1], "lua", false );
+ copyFiles( mission->path(), &mission->path()[1], "json", false );
- File srcFile( File::VIRTUAL, mission->path() + "/description.png" );
- File outFile( File::NATIVE, mission->path() + "/description.ozImage" );
+ File srcFile( mission->path() + "/description.png" );
+ File outFile( &( mission->path() + "/description.ozImage" )[1] );
if( srcFile.type() == File::MISSING ) {
continue;
@@ -683,7 +682,7 @@ void Builder::packArchive( const char* name, bool useCompression, bool use7zip )
Log::println( "Packing archive {" );
Log::indent();
- File archive( File::NATIVE, String::str( "../%s.%s", name, use7zip ? "7z" : "zip" ) );
+ File archive( String::str( "../%s.%s", name, use7zip ? "7z" : "zip" ) );
String cmdLine = use7zip ? String::str( "7z u -ms=off -mx=9 '%s' *", archive.path().cstr() ) :
String::str( "zip -ur %s '%s' *",
@@ -874,7 +873,7 @@ int Builder::main( int argc, char** argv )
outDir = File::cwd() + "/" + outDir + "/" + pkgName;
}
- File::init( File::VIRTUAL );
+ File::initVFS();
FreeImage_Initialise();
File::mkdir( outDir );
@@ -905,8 +904,8 @@ int Builder::main( int argc, char** argv )
uint startTime = Time::clock();
// copy package README/COPYING and credits
- copyFiles( "", "", "txt", false );
- copyFiles( "credits", "credits", "txt", false );
+ copyFiles( "@", "", "txt", false );
+ copyFiles( "@credits", "credits", "txt", false );
if( doCat ) {
lingua.build();
@@ -916,14 +915,14 @@ int Builder::main( int argc, char** argv )
UI::buildIcons();
UI::copyScheme();
- copyFiles( "ui/font", "ui/font", "ttf", false );
- copyFiles( "ui/icon", "ui/icon", "", true );
+ copyFiles( "@ui/font", "ui/font", "ttf", false );
+ copyFiles( "@ui/icon", "ui/icon", "", true );
}
if( doShaders ) {
- copyFiles( "glsl", "glsl", "glsl", false );
- copyFiles( "glsl", "glsl", "vert", false );
- copyFiles( "glsl", "glsl", "frag", false );
- copyFiles( "glsl", "glsl", "json", false );
+ copyFiles( "@glsl", "glsl", "glsl", false );
+ copyFiles( "@glsl", "glsl", "vert", false );
+ copyFiles( "@glsl", "glsl", "frag", false );
+ copyFiles( "@glsl", "glsl", "json", false );
}
if( doCaela ) {
buildCaela();
@@ -937,11 +936,11 @@ int Builder::main( int argc, char** argv )
}
if( doClasses ) {
buildClasses( pkgName );
- copyFiles( "class", "class", "txt", false );
+ copyFiles( "@class", "class", "txt", false );
}
if( doFrags ) {
buildFragPools( pkgName );
- copyFiles( "frag", "frag", "txt", false );
+ copyFiles( "@frag", "frag", "txt", false );
}
if( doModels ) {
buildModels();
@@ -950,13 +949,13 @@ int Builder::main( int argc, char** argv )
copySounds();
}
if( doNames ) {
- copyFiles( "name", "name", "txt", false );
+ copyFiles( "@name", "name", "txt", false );
}
if( doLua ) {
- checkLua( "lua/matrix" );
- checkLua( "lua/nirvana" );
+ checkLua( "@lua/matrix" );
+ checkLua( "@lua/nirvana" );
- copyFiles( "lua", "lua", "lua", true );
+ copyFiles( "@lua", "lua", "lua", true );
}
if( doMissions ) {
buildMissions();
@@ -965,8 +964,8 @@ int Builder::main( int argc, char** argv )
buildModules();
}
if( doMusic ) {
- copyFiles( "music", "music", "oga", true );
- copyFiles( "music", "music", "ogg", true );
+ copyFiles( "@music", "music", "oga", true );
+ copyFiles( "@music", "music", "ogg", true );
}
packArchive( pkgName, useCompression, use7zip );
@@ -979,7 +978,7 @@ int Builder::main( int argc, char** argv )
config.clear();
FreeImage_DeInitialise();
- File::destroy( File::VIRTUAL );
+ File::destroyVFS();
return EXIT_SUCCESS;
}
View
4 src/builder/Builder.hh
@@ -38,8 +38,8 @@ class Builder
void printUsage( const char* invocationName );
- void copyFiles( const char* srcDir, const char* destDir, const char* ext, bool recurse );
- void buildTextures( const char* srcDir, const char* destDir, bool wrap,
+ void copyFiles( const File& srcDir, const File& destDir, const char* ext, bool recurse );
+ void buildTextures( const File& srcDir, const File& destDir, bool wrap,
int magFilter, int minFilter );
void buildCaela();
View
6 src/builder/Caelum.cc
@@ -40,7 +40,7 @@ void Caelum::build( const char* name )
Log::println( "Prebuilding Caelum '%s' {", name );
Log::indent();
- File destFile( File::NATIVE, String::str( "caelum/%s.ozcCaelum", name ) );
+ File destFile( String::str( "caelum/%s.ozcCaelum", name ) );
OutputStream os( 0 );
@@ -93,10 +93,10 @@ void Caelum::build( const char* name )
os.writeUShort( ushort( i * 4 + 2 ) );
}
- Context::Texture texture = context.loadTexture( "caelum/sun.png", false );
+ Context::Texture texture = context.loadTexture( "@caelum/sun.png", false );
texture.write( &os );
- texture = context.loadTexture( "caelum/moon.png", false );
+ texture = context.loadTexture( "@caelum/moon.png", false );
texture.write( &os );
Log::print( "Dumping into '%s' ...", destFile.path().cstr() );
View
2  src/builder/Class.cc
@@ -777,7 +777,7 @@ void Class::writeVehicle( OutputStream* os )
void Class::build( OutputStream* os, const char* className )
{
- File configFile( File::VIRTUAL, String::str( "class/%s.json", className ) );
+ File configFile( String::str( "@class/%s.json", className ) );
if( !config.load( configFile ) ) {
OZ_ERROR( "Failed to load '%s'", configFile.path().cstr() );
View
24 src/builder/Context.cc
@@ -308,8 +308,8 @@ Context::Image Context::loadImage( const char* path, int forceFormat )
{
Log::print( "Loading image '%s' ...", path );
- File file( File::VIRTUAL, path );
- String realPath = file.realDir() + "/" + file.path();
+ File file( path );
+ String realPath = file.realPath();
if( file.type() == File::MISSING ) {
OZ_ERROR( "File '%s' does not exits", realPath.cstr() );
@@ -440,38 +440,38 @@ void Context::loadTextures( Texture* diffuseTex, Texture* masksTex, Texture* nor
for( int i = 0; i < aLength( IMAGE_EXTENSIONS ); ++i ) {
if( diffuse.path().isEmpty() || diffuse.type() == File::MISSING ) {
- diffuse = File( File::VIRTUAL, diffuseBasePath + IMAGE_EXTENSIONS[i] );
+ diffuse = File( diffuseBasePath + IMAGE_EXTENSIONS[i] );
}
if( diffuse.type() == File::MISSING ) {
- diffuse = File( File::VIRTUAL, diffuse1BasePath + IMAGE_EXTENSIONS[i] );
+ diffuse = File( diffuse1BasePath + IMAGE_EXTENSIONS[i] );
}
if( masks.path().isEmpty() || masks.type() == File::MISSING ) {
- masks = File( File::VIRTUAL, masksBasePath + IMAGE_EXTENSIONS[i] );
+ masks = File( masksBasePath + IMAGE_EXTENSIONS[i] );
}
if( specular.path().isEmpty() || specular.type() == File::MISSING ) {
- specular = File( File::VIRTUAL, specularBasePath + IMAGE_EXTENSIONS[i] );
+ specular = File( specularBasePath + IMAGE_EXTENSIONS[i] );
}
if( specular.type() == File::MISSING ) {
- specular = File( File::VIRTUAL, specular1BasePath + IMAGE_EXTENSIONS[i] );
+ specular = File( specular1BasePath + IMAGE_EXTENSIONS[i] );
}
if( emission.path().isEmpty() || emission.type() == File::MISSING ) {
- emission = File( File::VIRTUAL, emissionBasePath + IMAGE_EXTENSIONS[i] );
+ emission = File( emissionBasePath + IMAGE_EXTENSIONS[i] );
}
if( normals.path().isEmpty() || normals.type() == File::MISSING ) {
- normals = File( File::VIRTUAL, normalsBasePath + IMAGE_EXTENSIONS[i] );
+ normals = File( normalsBasePath + IMAGE_EXTENSIONS[i] );
}
if( normals.type() == File::MISSING ) {
- normals = File( File::VIRTUAL, normals1BasePath + IMAGE_EXTENSIONS[i] );
+ normals = File( normals1BasePath + IMAGE_EXTENSIONS[i] );
}
if( normals.type() == File::MISSING ) {
- normals = File( File::VIRTUAL, normals2BasePath + IMAGE_EXTENSIONS[i] );
+ normals = File( normals2BasePath + IMAGE_EXTENSIONS[i] );
}
if( normals.type() == File::MISSING ) {
- normals = File( File::VIRTUAL, normals3BasePath + IMAGE_EXTENSIONS[i] );
+ normals = File( normals3BasePath + IMAGE_EXTENSIONS[i] );
}
}
View
2  src/builder/FragPool.cc
@@ -38,7 +38,7 @@ namespace builder
void FragPool::build( OutputStream* os, const char* className )
{
- File configFile( File::VIRTUAL, String::str( "frag/%s.json", className ) );
+ File configFile( String::str( "@frag/%s.json", className ) );
JSON config;
if( !config.load( configFile ) ) {
View
30 src/builder/Lingua.cc
@@ -27,12 +27,12 @@ namespace builder
void Lingua::buildCatalogue( const char* directory, const char* catalogue )
{
- Log::print( "%s/%s ...", directory, catalogue );
+ Log::print( "%s/%s ...", &directory[1], catalogue );
- File::mkdir( directory );
+ File::mkdir( &directory[1] );
- File srcFile( File::VIRTUAL, String::str( "%s/%s.po", directory, catalogue ) );
- File outFile( File::NATIVE, String::str( "%s/%s.ozCat", directory, catalogue ) );
+ File srcFile( String::str( "%s/%s.po", directory, catalogue ) );
+ File outFile( String::str( "%s/%s.ozCat", &directory[1], catalogue ) );
if( srcFile.type() != File::REGULAR ) {
OZ_ERROR( "Cannot read catalogue source file '%s'", srcFile.path().cstr() );
@@ -161,11 +161,11 @@ void Lingua::build()
Log::println( "Building package localisations {" );
Log::indent();
- File linguaDir( File::VIRTUAL, "lingua" );
+ File linguaDir( "@lingua" );
DArray<File> languages = linguaDir.ls();
if( !languages.isEmpty() ) {
- File::mkdir( linguaDir.path() );
+ File::mkdir( &linguaDir.path()[1] );
}
foreach( langDir, languages.iter() ) {
@@ -176,7 +176,7 @@ void Lingua::build()
DArray<File> catalogues = langDir->ls();
if( !catalogues.isEmpty() ) {
- File::mkdir( langDir->path() );
+ File::mkdir( &langDir->path()[1] );
}
foreach( catalogue, catalogues.citer() ) {
@@ -188,11 +188,11 @@ void Lingua::build()
}
}
- File missionsDir( File::VIRTUAL, "mission" );
+ File missionsDir( "@mission" );
DArray<File> missions = missionsDir.ls();
foreach( mission, missions.citer() ) {
- linguaDir = File( File::VIRTUAL, mission->path() + "/lingua" );
+ linguaDir = File( mission->path() + "/lingua" );
languages = linguaDir.ls();
foreach( catalogue, languages.citer() ) {
@@ -201,8 +201,8 @@ void Lingua::build()
}
File::mkdir( "mission" );
- File::mkdir( mission->path() );
- File::mkdir( linguaDir.path() );
+ File::mkdir( &mission->path()[1] );
+ File::mkdir( &linguaDir.path()[1] );
buildCatalogue( linguaDir.path(), catalogue->baseName() );
}
@@ -217,11 +217,11 @@ void Lingua::buildMissions()
Log::println( "Building mission localisations {" );
Log::indent();
- File missionsDir( File::VIRTUAL, "mission" );
+ File missionsDir( "@mission" );
DArray<File> missions = missionsDir.ls();
foreach( mission, missions.citer() ) {
- File linguaDir( File::VIRTUAL, mission->path() + "/lingua" );
+ File linguaDir( mission->path() + "/lingua" );
DArray<File> languages = linguaDir.ls();
foreach( catalogue, languages.citer() ) {
@@ -230,8 +230,8 @@ void Lingua::buildMissions()
}
File::mkdir( "mission" );
- File::mkdir( mission->path() );
- File::mkdir( linguaDir.path() );
+ File::mkdir( &mission->path()[1] );
+ File::mkdir( &linguaDir.path()[1] );
buildCatalogue( linguaDir.path(), catalogue->baseName() );
}
View
11 src/builder/MD2.cc
@@ -203,8 +203,8 @@ void MD2::build( const char* path )
{
String sPath = path;
- File modelFile( File::VIRTUAL, sPath + "/tris.md2" );
- File configFile( File::VIRTUAL, sPath + "/config.json" );
+ File modelFile( sPath + "/tris.md2" );
+ File configFile( sPath + "/config.json" );
String skinPath = sPath + "/skin";
Log::println( "Prebuilding MD2 model '%s' {", path );
@@ -385,10 +385,11 @@ void MD2::build( const char* path )
compiler.writeMesh( &os );
- File::mkdir( sPath );
+ String sDestDir = &sPath[1];
+ File::mkdir( sDestDir );
if( header.nFrames != 1 ) {
- File destFile( File::NATIVE, sPath + "/data.ozcMD2" );
+ File destFile( sDestDir + "/data.ozcMD2" );
Log::print( "Writing to '%s' ...", destFile.path().cstr() );
@@ -399,7 +400,7 @@ void MD2::build( const char* path )
Log::printEnd( " OK" );
}
else {
- File destFile( File::NATIVE, sPath + "/data.ozcSMM" );
+ File destFile( sDestDir + "/data.ozcSMM" );
Log::print( "Writing to '%s' ...", destFile.path().cstr() );
View
15 src/builder/MD3.cc
@@ -34,7 +34,7 @@ namespace builder
void MD3::readAnimData()
{
- File animFile( File::VIRTUAL, sPath + "/animation.cfg" );
+ File animFile( sPath + "/animation.cfg" );
String realPath = animFile.realDir() + "/" + animFile.path();
@@ -56,7 +56,7 @@ void MD3::buildMesh( const char* name, int frame )
{
Log::print( "Mesh '%s' ...", name );
- File file( File::VIRTUAL, String::str( "%s/%s.md3", sPath.cstr(), name ) );
+ File file( String::str( "%s/%s.md3", sPath.cstr(), name ) );
if( file.type() != File::REGULAR ) {
OZ_ERROR( "Cannot read MD3 model part file '%s'", file.path().cstr() );
@@ -210,11 +210,11 @@ void MD3::buildMesh( const char* name, int frame )
}
if( skin.isEmpty() ) {
- File skinFile( File::VIRTUAL, String::replace( surfaceShaders[0].name, '\\', '/' ) );
+ File skinFile( String::replace( surfaceShaders[0].name, '\\', '/' ) );
texture = skinFile.baseName();
}
else {
- File skinFile( File::VIRTUAL, skin );
+ File skinFile( skin );
texture = skinFile.baseName();
}
@@ -271,7 +271,7 @@ void MD3::buildMesh( const char* name, int frame )
void MD3::load()
{
- File configFile( File::VIRTUAL, sPath + "/config.json" );
+ File configFile( sPath + "/config.json" );
JSON config( configFile );
@@ -359,10 +359,11 @@ void MD3::save()
compiler.endMesh();
compiler.writeMesh( &os );
+ String sDestDir = &sPath[1];
File::mkdir( sPath );
if( frame < 0 ) {
- File destFile( File::NATIVE, sPath + "/data.ozcMD3" );
+ File destFile( sDestDir + "/data.ozcMD3" );
Log::print( "Writing to '%s' ...", destFile.path().cstr() );
@@ -373,7 +374,7 @@ void MD3::save()
Log::printEnd( " OK" );
}
else {
- File destFile( File::NATIVE, sPath + "/data.ozcSMM" );
+ File destFile( sDestDir + "/data.ozcSMM" );
Log::print( "Writing to '%s' ...", destFile.path().cstr() );
View
12 src/builder/OBJ.cc
@@ -274,8 +274,8 @@ void OBJ::load()
{
Log::print( "Loading OBJ model '%s' ...", path.cstr() );
- File modelFile( File::VIRTUAL, path + "/data.obj" );
- File configFile( File::VIRTUAL, path + "/config.json" );
+ File modelFile( path + "/data.obj" );
+ File configFile( path + "/config.json" );
int currentMaterial = 0;
@@ -288,7 +288,7 @@ void OBJ::load()
config.clear( true );
- String realPath = modelFile.realDir() + "/" + path;
+ String realPath = modelFile.realDir() + "/" + &path[1];
loadMaterials( realPath + "/data.mtl" );
@@ -356,8 +356,10 @@ void OBJ::load()
void OBJ::save()
{
- File::mkdir( path );
- File destFile( File::NATIVE, path + "/data.ozcSMM" );
+ String sDestDir = &path[1];
+
+ File::mkdir( sDestDir );
+ File destFile( sDestDir + "/data.ozcSMM" );
compiler.beginMesh();
compiler.enable( Compiler::UNIQUE );
View
20 src/builder/Terra.cc
@@ -36,8 +36,8 @@ namespace builder
void Terra::load()
{
- File configFile( File::VIRTUAL, "terra/" + name + ".json" );
- File imageFile( File::VIRTUAL, "terra/" + name + ".png" );
+ File configFile( "@terra/" + name + ".json" );
+ File imageFile( "@terra/" + name + ".png" );
JSON config;
if( !config.load( configFile ) ) {
@@ -68,7 +68,7 @@ void Terra::load()
Log::print( "Loading terrain heightmap '%s' ...", name.cstr() );
- String realPath = imageFile.realDir() + "/" + imageFile.path();
+ String realPath = imageFile.realPath();
FIBITMAP* image = FreeImage_Load( FIF_PNG, realPath );
if( image == nullptr ) {
@@ -152,7 +152,7 @@ void Terra::load()
void Terra::saveMatrix()
{
- File destFile( File::NATIVE, "terra/" + name + ".ozTerra" );
+ File destFile( "terra/" + name + ".ozTerra" );
Log::print( "Dumping terrain structure to '%s' ...", destFile.path().cstr() );
@@ -177,15 +177,15 @@ void Terra::saveMatrix()
void Terra::saveClient()
{
- File destFile( File::NATIVE, "terra/" + name + ".ozcTerra" );
- File minimapFile( File::NATIVE, "terra/" + name + ".ozcTex" );
+ File destFile( "terra/" + name + ".ozcTerra" );
+ File minimapFile( "terra/" + name + ".ozcTex" );
Log::println( "Compiling terrain model to '%s' {", destFile.path().cstr() );
Log::indent();
- Context::Texture liquidTex = context.loadTexture( "terra/" + liquidTexture );
- Context::Texture detailTex = context.loadTexture( "terra/" + detailTexture );
- Context::Texture mapTex = context.loadTexture( "terra/" + mapTexture );
+ Context::Texture liquidTex = context.loadTexture( "@terra/" + liquidTexture );
+ Context::Texture detailTex = context.loadTexture( "@terra/" + detailTexture );
+ Context::Texture mapTex = context.loadTexture( "@terra/" + mapTexture );
OutputStream os( 0 );
@@ -272,7 +272,7 @@ void Terra::saveClient()
bool useS3TC = context.useS3TC;
context.useS3TC = false;
- mapTex = context.loadTexture( "terra/" + mapTexture );
+ mapTex = context.loadTexture( "@terra/" + mapTexture );
Log::print( "Writing minimap texture '%s' ...", minimapFile.path().cstr() );
View
21 src/builder/UI.cc
@@ -53,7 +53,7 @@ const char* const UI::ICON_NAMES[] = {
void UI::buildCursors()
{
- if( File( File::VIRTUAL, "ui/cur" ).type() != File::DIRECTORY ) {
+ if( File( "@ui/cur" ).type() != File::DIRECTORY ) {
return;
}
@@ -67,10 +67,10 @@ void UI::buildCursors()
File::mkdir( "ui/cur" );
for( int i = 0; i < ui::Mouse::CURSORS_MAX; ++i ) {
- File inFile( File::VIRTUAL, String::str( "ui/cur/%s.in", ui::Mouse::NAMES[i] ) );
- File destFile( File::NATIVE, String::str( "ui/cur/%s.ozCur", ui::Mouse::NAMES[i] ) );
+ File inFile( String::str( "@ui/cur/%s.in", ui::Mouse::NAMES[i] ) );
+ File destFile( String::str( "ui/cur/%s.ozCur", ui::Mouse::NAMES[i] ) );
- String realPath = inFile.realDir() + "/" + inFile.path();
+ String realPath = inFile.realPath();
FILE* fs = fopen( realPath, "r" );
if( fs == nullptr ) {
@@ -87,9 +87,8 @@ void UI::buildCursors()
fclose( fs );
- Context::Texture tex = context.loadTexture( String::str( "ui/cur/%s", imgPath ), false,
+ Context::Texture tex = context.loadTexture( String::str( "@ui/cur/%s", imgPath ), false,
GL_NEAREST, GL_NEAREST );
-
OutputStream os( 0 );
os.writeInt( size );
@@ -108,7 +107,7 @@ void UI::buildCursors()
void UI::buildIcons()
{
- if( File( File::VIRTUAL, "ui/icon" ).type() != File::DIRECTORY ) {
+ if( File( "@ui/icon" ).type() != File::DIRECTORY ) {
return;
}
@@ -122,7 +121,7 @@ void UI::buildIcons()
File::mkdir( "ui/icon" );
foreach( name, citer( ICON_NAMES ) ) {
- String srcPath = String::str( "ui/icon/%s.png", *name );
+ String srcPath = String::str( "@ui/icon/%s.png", *name );
String destPath = String::str( "ui/icon/%s.ozIcon", *name );
Context::Texture tex = context.loadTexture( srcPath, false, GL_NEAREST, GL_NEAREST );
@@ -133,7 +132,7 @@ void UI::buildIcons()
Log::println( "Compiling '%s'", destPath.cstr() );
tex.write( &os );
- if( !File( File::NATIVE, destPath ).write( os.begin(), os.tell() ) ) {
+ if( !File( destPath ).write( os.begin(), os.tell() ) ) {
OZ_ERROR( "Texture writing failed" );
}
}
@@ -146,8 +145,8 @@ void UI::buildIcons()
void UI::copyScheme()
{
- File srcFile( File::VIRTUAL, "ui/style.json" );
- File outFile( File::NATIVE, "ui/style.json" );
+ File srcFile( "@ui/style.json" );
+ File outFile( "ui/style.json" );
if( srcFile.type() == File::REGULAR ) {
Log::print( "Copying UI colour scheme '%s' ...", srcFile.path().cstr() );
View
2  src/client/BSP.cc
@@ -54,7 +54,7 @@ BSP::~BSP()
void BSP::preload()
{
- File file( File::VIRTUAL, "bsp/" + bsp->name + ".ozcBSP" );
+ File file( "@bsp/" + bsp->name + ".ozcBSP" );
buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/client/Caelum.cc
@@ -167,7 +167,7 @@ void Caelum::load()
Math::sin( orbis.caelum.heading ),
0.0f );
- Buffer buffer = File( File::VIRTUAL, path ).read();
+ Buffer buffer = File( path ).read();
if( buffer.isEmpty() ) {
OZ_ERROR( "Caelum file '%s' read failed", path.cstr() );
}
View
2  src/client/CinematicProxy.cc
@@ -53,7 +53,7 @@ void CinematicProxy::addTransform( const Quat& rot, const Point& p, const Mat44&
void CinematicProxy::executeSequence( const char* path, const Lingua* missionLingua )
{
JSON sequence;
- File file( File::VIRTUAL, path );
+ File file( path );
if( !sequence.load( file ) ) {
OZ_ERROR( "Failed to load sequence from '%s'", file.path().cstr() );
View
20 src/client/Client.cc
@@ -151,7 +151,7 @@ int Client::init( int argc, char** argv )
#elif defined( __native_client__ )
- File::init( File::NATIVE, File::TEMPORARY, 64*1024*1024 );
+ File::init( File::TEMPORARY, 64*1024*1024 );
String configDir = "/config/openzone";
String localDir = "/local/share/openzone";
@@ -241,7 +241,7 @@ int Client::init( int argc, char** argv )
Log::println( "}" );
Log::verboseMode = false;
- File::init( File::VIRTUAL, File::TEMPORARY, 32*1024*1024 );
+ File::initVFS();
initFlags |= INIT_PHYSFS;
OZ_MAIN_CALL( this, {
@@ -261,7 +261,7 @@ int Client::init( int argc, char** argv )
// Clean up after previous versions.
File::rm( configDir + "/client.rc" );
- File configFile( File::NATIVE, configDir + "/client.json" );
+ File configFile( configDir + "/client.json" );
if( config.load( configFile ) ) {
Log::printEnd( "Configuration read from '%s'", configFile.path().cstr() );
@@ -322,7 +322,7 @@ int Client::init( int argc, char** argv )
#ifdef __native_client__
foreach( pkg, packages.citer() ) {
- File pkgFile( File::NATIVE, localDir + "/" + *pkg );
+ File pkgFile( "@" + localDir + "/" + *pkg );
if( File::mount( pkgFile.path(), nullptr, true ) ) {
Log::println( "%s", pkgFile.path().cstr() );
@@ -346,7 +346,7 @@ int Client::init( int argc, char** argv )
if( File::mount( localDir, nullptr, true ) ) {
Log::println( "%s", localDir.cstr() );
- DArray<File> list = File( File::NATIVE, localDir ).ls();
+ DArray<File> list = File( localDir ).ls();
foreach( file, list.citer() ) {
if( file->hasExtension( "7z" ) || file->hasExtension( "zip" ) ) {
@@ -362,7 +362,7 @@ int Client::init( int argc, char** argv )
if( File::mount( dataDir, nullptr, true ) ) {
Log::println( "%s", dataDir.cstr() );
- DArray<File> list = File( File::NATIVE, dataDir ).ls();
+ DArray<File> list = File( dataDir ).ls();
foreach( file, list.citer() ) {
if( file->hasExtension( "7z" ) || file->hasExtension( "zip" ) ) {
@@ -479,7 +479,7 @@ int Client::init( int argc, char** argv )
Stage::nextStage = nullptr;
if( !mission.isEmpty() || !layoutFile.isEmpty() ) {
- gameStage.layoutFile = File( File::NATIVE, layoutFile );
+ gameStage.layoutFile = File( layoutFile );
gameStage.mission = mission;
stage = &gameStage;
@@ -535,7 +535,7 @@ void Client::shutdown()
window.destroy();
}
if( ( initFlags & ( INIT_CONFIG | INIT_MAIN_LOOP ) ) == INIT_MAIN_LOOP ) {
- File configFile( File::NATIVE, config["dir.config"].asString() + "/client.json" );
+ File configFile( config["dir.config"].asString() + "/client.json" );
config.exclude( "dir.config" );
config.exclude( "dir.local" );
@@ -555,7 +555,7 @@ void Client::shutdown()
#ifdef __native_client__
- File::destroy( File::NATIVE );
+ File::destroy();
#else
@@ -563,7 +563,7 @@ void Client::shutdown()
SDL_Quit();
}
if( initFlags & INIT_PHYSFS ) {
- File::destroy( File::VIRTUAL );
+ File::destroyVFS();
}
#endif
View
6 src/client/Context.cc
@@ -317,7 +317,7 @@ uint Context::readTextureLayer( InputStream* istream )
uint Context::loadTextureLayer( const char* path )
{
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -344,7 +344,7 @@ Texture Context::readTexture( InputStream* istream )
Texture Context::loadTexture( const char* path )
{
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -402,7 +402,7 @@ uint Context::requestSound( int id )
const String& name = liber.sounds[id].name;
const String& path = liber.sounds[id].path;
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
View
6 src/client/GameStage.cc
@@ -228,7 +228,7 @@ bool GameStage::update()
}
}
if( input.keys[Input::KEY_SAVE_LAYOUT] && !input.oldKeys[Input::KEY_SAVE_LAYOUT] ) {
- layoutFile = File( File::NATIVE, config["dir.config"].asString() + "/layouts/default.json" );
+ layoutFile = File( config["dir.config"].asString() + "/layouts/default.json" );
writeLayout();
layoutFile = File();
}
@@ -535,8 +535,8 @@ void GameStage::init()
Log::println( "Initialising GameStage {" );
Log::indent();
- autosaveFile = File( File::NATIVE, config["dir.config"].asString() + "/saves/autosave.ozState" );
- quicksaveFile = File( File::NATIVE, config["dir.config"].asString() + "/saves/quicksave.ozState" );
+ autosaveFile = File( config["dir.config"].asString() + "/saves/autosave.ozState" );
+ quicksaveFile = File( config["dir.config"].asString() + "/saves/quicksave.ozState" );
matrix.init();
nirvana.init();
View
4 src/client/Input.cc
@@ -548,7 +548,7 @@ void Input::update()
void Input::init()
{
- File configFile( File::NATIVE, config["dir.config"].asString() + "/input.json" );
+ File configFile( config["dir.config"].asString() + "/input.json" );
Log::print( "Initialising Input from '%s' ...", configFile.path().cstr() );
@@ -642,7 +642,7 @@ void Input::destroy()
return;
}
- File configFile( File::NATIVE, config["dir.config"].asString() + "/input.json" );
+ File configFile( config["dir.config"].asString() + "/input.json" );
Log::print( "Writing Input configuration to '%s' ...", configFile.path().cstr() );
View
4 src/client/Lua.cc
@@ -80,7 +80,7 @@ void Lua::create( const char* mission_ )
Log::println( "Executing scripts for mission %s {", cs.mission.cstr() );
Log::indent();
- File missionDir( File::VIRTUAL, "mission/" + cs.mission );
+ File missionDir( "@mission/" + cs.mission );
DArray<File> files = missionDir.ls();
if( missionDir.type() != File::DIRECTORY ) {
@@ -124,7 +124,7 @@ void Lua::read( InputStream* istream )
Log::print( "Deserialising scripts for mission %s ...", cs.mission.cstr() );
- File missionDir( File::VIRTUAL, "mission/" + cs.mission );
+ File missionDir( "@mission/" + cs.mission );
DArray<File> files = missionDir.ls();
if( missionDir.type() != File::DIRECTORY ) {
View
2  src/client/MD2.cc
@@ -237,7 +237,7 @@ MD2::MD2( int id_ ) :
void MD2::preload()
{
- File file( File::VIRTUAL, liber.models[id].path );
+ File file( liber.models[id].path );
buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/client/MD3.cc
@@ -38,7 +38,7 @@ MD3::MD3( int id_ ) :
void MD3::preload()
{
- File file( File::VIRTUAL, liber.models[id].path );
+ File file( liber.models[id].path );
buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/client/NaClDownloader.cc
@@ -45,7 +45,7 @@ void NaClDownloader::readCallback( void* data, int result )
downloader->buffer.deallocate();
}
else {
- int length = downloader->buffer.length() - 4096 + result;
+ int length = downloader->buffer.tell() - 4096 + result;
downloader->buffer.rewind();
downloader->buffer.forward( length );
View
18 src/client/NaClUpdater.cc
@@ -80,9 +80,9 @@ void NaClUpdater::writeLocalManifest() const
os.writeLong64( pkg->time );
}
- File localManifest( File::NATIVE, LOCAL_MANIFEST );
+ File localManifest( LOCAL_MANIFEST );
- if( !localManifest.write( os.begin(), os.length() ) ) {
+ if( !localManifest.write( os.begin(), os.tell() ) ) {
OZ_ERROR( "Failed to write local manifest" );
}
@@ -96,7 +96,7 @@ bool NaClUpdater::checkUpdates()
localPackages.clear();
remotePackages.clear();
- File localManifest( File::NATIVE, LOCAL_MANIFEST );
+ File localManifest( LOCAL_MANIFEST );
if( localManifest.map() ) {
InputStream is = localManifest.inputStream();
@@ -136,7 +136,7 @@ void NaClUpdater::downloadUpdates()
int packageNum = 1;
foreach( pkg, remotePackages.citer() ) {
- File pkgFile( File::NATIVE, "/local/share/openzone/" + pkg->name );
+ File pkgFile( "/local/share/openzone/" + pkg->name );
if( pkgFile.type() == File::REGULAR ) {
long64 localTime = 0;
@@ -183,16 +183,16 @@ void NaClUpdater::downloadUpdates()
OutputStream os = downloader.take();
- Log::printRaw( " %.2f MiB transferred ...", float( os.length() ) / ( 1024.0f*1024.0f ) );
+ Log::printRaw( " %.2f MiB transferred ...", float( os.tell() ) / ( 1024.0f*1024.0f ) );
- if( os.length() < 2 || ( ( os[0] != 'P' || os[1] != 'K' ) &&
- ( os[0] != '7' || os[1] != 'z' ) ) )
+ if( os.tell() < 2 || ( ( os[0] != 'P' || os[1] != 'K' ) &&
+ ( os[0] != '7' || os[1] != 'z' ) ) )
{
Log::printEnd( " Failed" );
continue;
}
- if( !pkgFile.write( os.begin(), os.length() ) ) {
+ if( !pkgFile.write( os.begin(), os.tell() ) ) {
OZ_ERROR( "Cannot write to local storage" );
}
@@ -212,7 +212,7 @@ void NaClUpdater::downloadUpdates()
}
if( isOrphan ) {
- File pkgFile( File::NATIVE, "/local/share/openzone/" + localPkg->name );
+ File pkgFile( "/local/share/openzone/" + localPkg->name );
Log::print( "Deleting obsolete package '%s' ...", pkgFile.path().cstr() );
if( File::rm( pkgFile.path() ) ) {
View
2  src/client/Profile.cc
@@ -39,7 +39,7 @@ namespace client
void Profile::init()
{
- File profileFile( File::NATIVE, config["dir.config"].asString() + "/profile.json" );
+ File profileFile( config["dir.config"].asString() + "/profile.json" );
JSON profileConfig;
bool configExists = profileConfig.load( profileFile );
View
2  src/client/SMM.cc
@@ -42,7 +42,7 @@ SMM::SMM( int id_ ) :
void SMM::preload()
{
- File file( File::VIRTUAL, liber.models[id].path );
+ File file( liber.models[id].path );
buffer = file.read();
if( buffer.isEmpty() ) {
View
8 src/client/Shader.cc
@@ -123,7 +123,7 @@ Shader::Light::Light( const Point& pos_, const Vec4& diffuse_ ) :
void Shader::compileShader( uint id, const char* path, const char** sources, int* lengths ) const
{
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -165,7 +165,7 @@ void Shader::loadProgram( int id )
{
const String& name = liber.shaders[id].name;
- File configFile( File::VIRTUAL, "glsl/" + name + ".json" );
+ File configFile( "@glsl/" + name + ".json" );
JSON programConfig;
if( !programConfig.load( configFile ) ) {
@@ -376,7 +376,7 @@ void Shader::init()
sources[0] = defines;
lengths[0] = defines.length();
- File file( File::VIRTUAL, "glsl/header.glsl" );
+ File file( "@glsl/header.glsl" );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -386,7 +386,7 @@ void Shader::init()
sources[1] = buffer.begin();
lengths[1] = buffer.length();
- File dir( File::VIRTUAL, "glsl" );
+ File dir( "@glsl" );
DArray<File> shaderFiles = dir.ls();
foreach( file, shaderFiles.citer() ) {
View
2  src/client/Sound.cc
@@ -98,7 +98,7 @@ void Sound::soundMain( void* )
void Sound::musicOpen( const char* path )
{
- File file( File::VIRTUAL, path );
+ File file( path );
if( file.hasExtension( "oga" ) || file.hasExtension( "ogg" ) ) {
musicStreamType = OGG;
View
2  src/client/Terra.cc
@@ -161,7 +161,7 @@ void Terra::load()
const String& name = liber.terrae[id].name;
- File file( File::VIRTUAL, "terra/" + name + ".ozcTerra" );
+ File file( "@terra/" + name + ".ozcTerra" );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/client/luaapi.hh
@@ -248,7 +248,7 @@ static int ozCameraExecuteSequence( lua_State* l )
{
ARG( 1 );
- String file = String::str( "mission/%s/%s.sequence.json", cs.mission.cstr(), l_tostring( 1 ) );
+ String file = String::str( "@mission/%s/%s.sequence.json", cs.mission.cstr(), l_tostring( 1 ) );
camera.setState( Camera::CINEMATIC );
camera.cinematic.executeSequence( file, &cs.missionLingua );
View
2  src/client/ui/CreditsMenu.cc
@@ -148,7 +148,7 @@ CreditsMenu::CreditsMenu() :
Button* backButton = new Button( OZ_GETTEXT( "Back" ), back, 200, 30 );
add( backButton, -20, 20 );
- File creditsDir( File::VIRTUAL, "credits" );
+ File creditsDir( "@credits" );
DArray<File> creditsFiles = creditsDir.ls();
lines.add( "OpenZone " OZ_VERSION );
View
2  src/client/ui/Font.cc
@@ -70,7 +70,7 @@ void Font::init( const char* name, int height_ )
{
height = height_;
- File file( File::VIRTUAL, String::str( "ui/font/%s.ttf", name ) );
+ File file( String::str( "@ui/font/%s.ttf", name ) );
buffer = file.read();
if( buffer.isEmpty() ) {
View
8 src/client/ui/GalileoFrame.cc
@@ -40,7 +40,7 @@ namespace ui
uint GalileoFrame::loadTexture( const char* path ) const
{
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -92,7 +92,7 @@ void GalileoFrame::onUpdate()
void GalileoFrame::onDraw()
{
if( mapTexId == 0 ) {
- mapTexId = loadTexture( "terra/" + liber.terrae[orbis.terra.id].name + ".ozcTex" );
+ mapTexId = loadTexture( "@terra/" + liber.terrae[orbis.terra.id].name + ".ozcTex" );
}
float pX = camera.p.x;
@@ -148,8 +148,8 @@ GalileoFrame::GalileoFrame() :
{
flags = PINNED_BIT | UPDATE_BIT;
- arrowTexId = loadTexture( "ui/icon/arrow.ozIcon" );
- markerTexId = loadTexture( "ui/icon/marker.ozIcon" );
+ arrowTexId = loadTexture( "@ui/icon/arrow.ozIcon" );
+ markerTexId = loadTexture( "@ui/icon/marker.ozIcon" );
normalWidth = width;
normalHeight = height;
View
22 src/client/ui/HudArea.cc
@@ -416,17 +416,17 @@ HudArea::HudArea() :
Log::verboseMode = true;
- crossTexId = context.loadTextureLayer( "ui/icon/crosshair.ozIcon" );
- useTexId = context.loadTextureLayer( "ui/icon/use.ozIcon" );
- deviceTexId = context.loadTextureLayer( "ui/icon/device.ozIcon" );
- equipTexId = context.loadTextureLayer( "ui/icon/equip.ozIcon" );
- mountTexId = context.loadTextureLayer( "ui/icon/mount.ozIcon" );
- takeTexId = context.loadTextureLayer( "ui/icon/take.ozIcon" );
- browseTexId = context.loadTextureLayer( "ui/icon/browse.ozIcon" );
- liftTexId = context.loadTextureLayer( "ui/icon/lift.ozIcon" );
- grabTexId = context.loadTextureLayer( "ui/icon/grab.ozIcon" );
- lockedTexId = context.loadTextureLayer( "ui/icon/locked.ozIcon" );
- unlockedTexId = context.loadTextureLayer( "ui/icon/unlocked.ozIcon" );
+ crossTexId = context.loadTextureLayer( "@ui/icon/crosshair.ozIcon" );
+ useTexId = context.loadTextureLayer( "@ui/icon/use.ozIcon" );
+ deviceTexId = context.loadTextureLayer( "@ui/icon/device.ozIcon" );
+ equipTexId = context.loadTextureLayer( "@ui/icon/equip.ozIcon" );
+ mountTexId = context.loadTextureLayer( "@ui/icon/mount.ozIcon" );
+ takeTexId = context.loadTextureLayer( "@ui/icon/take.ozIcon" );
+ browseTexId = context.loadTextureLayer( "@ui/icon/browse.ozIcon" );
+ liftTexId = context.loadTextureLayer( "@ui/icon/lift.ozIcon" );
+ grabTexId = context.loadTextureLayer( "@ui/icon/grab.ozIcon" );
+ lockedTexId = context.loadTextureLayer( "@ui/icon/locked.ozIcon" );
+ unlockedTexId = context.loadTextureLayer( "@ui/icon/unlocked.ozIcon" );
Log::verboseMode = false;
}
View
10 src/client/ui/Inventory.cc
@@ -387,11 +387,11 @@ Inventory::Inventory() :
Log::verboseMode = true;
- scrollUpTexId = context.loadTextureLayer( "ui/icon/scrollUp.ozIcon" );
- scrollDownTexId = context.loadTextureLayer( "ui/icon/scrollDown.ozIcon" );
- useTexId = context.loadTextureLayer( "ui/icon/use.ozIcon" );
- equipTexId = context.loadTextureLayer( "ui/icon/equip.ozIcon" );
- unequipTexId = context.loadTextureLayer( "ui/icon/unequip.ozIcon" );
+ scrollUpTexId = context.loadTextureLayer( "@ui/icon/scrollUp.ozIcon" );
+ scrollDownTexId = context.loadTextureLayer( "@ui/icon/scrollDown.ozIcon" );
+ useTexId = context.loadTextureLayer( "@ui/icon/use.ozIcon" );
+ equipTexId = context.loadTextureLayer( "@ui/icon/equip.ozIcon" );
+ unequipTexId = context.loadTextureLayer( "@ui/icon/unequip.ozIcon" );
Log::verboseMode = false;
}
View
10 src/client/ui/MissionMenu.cc
@@ -189,11 +189,11 @@ MissionMenu::MissionMenu() :
Button* backButton = new Button( OZ_GETTEXT( "Back" ), back, 200, 30 );
add( backButton, -20, 20 );
- File missionRootDir( File::VIRTUAL, "mission" );
+ File missionRootDir( "@mission" );
DArray<File> missionDirs = missionRootDir.ls();
foreach( missionDir, missionDirs.citer() ) {
- File descriptionFile( File::VIRTUAL, missionDir->path() + "/description.json" );
+ File descriptionFile( missionDir->path() + "/description.json" );
JSON descriptionConfig;
if( !descriptionConfig.load( descriptionFile ) ) {
@@ -208,7 +208,7 @@ MissionMenu::MissionMenu() :
const char* title = lingua.get( descriptionConfig["title"].get( missionName ) );
const char* description = lingua.get( descriptionConfig["description"].get( "" ) );
- File image( File::VIRTUAL, missionDir->path() + "/description.ozImage" );
+ File image( missionDir->path() + "/description.ozImage" );
uint imageId = 0;
if( image.type() != File::MISSING ) {
@@ -221,8 +221,8 @@ MissionMenu::MissionMenu() :
lingua.destroy();
}
- scrollUpTexId = context.loadTextureLayer( "ui/icon/scrollUp.ozIcon" );
- scrollDownTexId = context.loadTextureLayer( "ui/icon/scrollDown.ozIcon" );
+ scrollUpTexId = context.loadTextureLayer( "@ui/icon/scrollUp.ozIcon" );
+ scrollDownTexId = context.loadTextureLayer( "@ui/icon/scrollDown.ozIcon" );
}
MissionMenu::~MissionMenu()
View
2  src/client/ui/Mouse.cc
@@ -106,7 +106,7 @@ void Mouse::init()
doShow = false;
for( int i = 0; i < CURSORS_MAX; ++i ) {
- File file( File::VIRTUAL, String::str( "ui/cur/%s.ozCur", NAMES[i] ) );
+ File file( String::str( "@ui/cur/%s.ozCur", NAMES[i] ) );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/client/ui/Style.cc
@@ -73,7 +73,7 @@ void Style::init()
{
Log::print( "Initialising Style ..." );
- File configFile( File::VIRTUAL, "ui/style.json" );
+ File configFile( "@ui/style.json" );
JSON config( configFile );
const JSON& fontsConfig = config["fonts"];
View
12 src/common/Lingua.cc
@@ -45,7 +45,7 @@ String Lingua::detectLanguage( const char* language_ )
String lang = language_;
if( !lang.isEmpty() ) {
- if( File( File::VIRTUAL, "lingua/" + lang ).type() == File::MISSING ) {
+ if( File( "@lingua/" + lang ).type() == File::MISSING ) {
lang = "";
}
return lang;
@@ -53,7 +53,7 @@ String Lingua::detectLanguage( const char* language_ )
lang = getenv( "LANGUAGE" );
- if( !lang.isEmpty() && File( File::VIRTUAL, "lingua/" + lang ).type() != File::MISSING ) {
+ if( !lang.isEmpty() && File( "@lingua/" + lang ).type() != File::MISSING ) {
return lang;
}
@@ -63,7 +63,7 @@ String Lingua::detectLanguage( const char* language_ )
if( underscore >= 2 ) {
lang = lang.substring( 0, underscore );
- if( File( File::VIRTUAL, "lingua/" + lang ).type() != File::MISSING ) {
+ if( File( "@lingua/" + lang ).type() != File::MISSING ) {
return lang;
}
}
@@ -74,7 +74,7 @@ String Lingua::detectLanguage( const char* language_ )
if( underscore >= 2 ) {
lang = lang.substring( 0, underscore );
- if( File( File::VIRTUAL, "lingua/" + lang ).type() != File::MISSING ) {
+ if( File( "@lingua/" + lang ).type() != File::MISSING ) {
return lang;
}
}
@@ -107,7 +107,7 @@ bool Lingua::initMission( const char* mission )
{
hard_assert( messages == nullptr );
- File file( File::VIRTUAL, String::str( "mission/%s/lingua/%s.ozCat", mission, language.cstr() ) );
+ File file( String::str( "@mission/%s/lingua/%s.ozCat", mission, language.cstr() ) );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -143,7 +143,7 @@ bool Lingua::init( const char* language_ )
language = language_;
- File dir( File::VIRTUAL, "lingua/" + language );
+ File dir( "@lingua/" + language );
if( dir.type() == File::MISSING ) {
OZ_ERROR( "Invalid locale '%s', does not match any subdirectory in lingua/", language.cstr() );
}
View
4 src/matrix/BSP.cc
@@ -37,7 +37,7 @@ void BSP::load()
{
Log::print( "Loading BSP structure '%s' ...", name.cstr() );
- File file( File::VIRTUAL, "bsp/" + name + ".ozBSP" );
+ File file( "@bsp/" + name + ".ozBSP" );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
@@ -252,7 +252,7 @@ BSP::BSP( const char* name_, int id_ ) :
nBrushSides( 0 ), nBoundObjects( 0 ),
name( name_ ), id( id_ ), nUsers( 0 )
{
- File file( File::VIRTUAL, String::str( "bsp/%s.ozBSP", name_ ) );
+ File file( String::str( "@bsp/%s.ozBSP", name_ ) );
if( file.type() != File::REGULAR ) {
OZ_ERROR( "BSP file '%s' read failed", file.path().cstr() );
View
32 src/matrix/Liber.cc
@@ -188,7 +188,7 @@ void Liber::initShaders()
List<Resource> shadersList;
- File dir( File::VIRTUAL, "glsl" );
+ File dir( "@glsl" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.citer() ) {
@@ -218,7 +218,7 @@ void Liber::initTextures()
List<Resource> texturesList;
- File dir( File::VIRTUAL, "tex" );
+ File dir( "@tex" );
DArray<File> dirList = dir.ls();
foreach( subDir, dirList.iter() ) {
@@ -256,7 +256,7 @@ void Liber::initSounds()
List<Resource> soundsList;
- File dir( File::VIRTUAL, "snd" );
+ File dir( "@snd" );
DArray<File> dirList = dir.ls();
foreach( subDir, dirList.iter() ) {
@@ -294,7 +294,7 @@ void Liber::initCaela()
List<Resource> caelaList;
- File dir( File::VIRTUAL, "caelum" );
+ File dir( "@caelum" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.citer() ) {
@@ -324,7 +324,7 @@ void Liber::initTerrae()
List<Resource> terraeList;
- File dir( File::VIRTUAL, "terra" );
+ File dir( "@terra" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.citer() ) {
@@ -354,7 +354,7 @@ void Liber::initModels()
List<Resource> modelsList;
- File dir( File::VIRTUAL, "mdl" );
+ File dir( "@mdl" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.iter() ) {
@@ -365,13 +365,13 @@ void Liber::initModels()
String name = file->name();
String path;
- if( File( File::VIRTUAL, file->path() + "/data.ozcSMM" ).type() == File::REGULAR ) {
+ if( File( file->path() + "/data.ozcSMM" ).type() == File::REGULAR ) {
path = file->path() + "/data.ozcSMM";
}
- else if( File( File::VIRTUAL, file->path() + "/data.ozcMD2" ).type() == File::REGULAR ) {
+ else if( File( file->path() + "/data.ozcMD2" ).type() == File::REGULAR ) {
path = file->path() + "/data.ozcMD2";
}
- else if( File( File::VIRTUAL, file->path() + "/data.ozcMD3" ).type() == File::REGULAR ) {
+ else if( File( file->path() + "/data.ozcMD3" ).type() == File::REGULAR ) {
path = file->path() + "/data.ozcMD3";
}
else {
@@ -402,7 +402,7 @@ void Liber::initNameLists()
List<Resource> nameListsList;
- File dir( File::VIRTUAL, "name" );
+ File dir( "@name" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.citer() ) {
@@ -430,7 +430,7 @@ void Liber::initFragPools()
Log::println( "Fragment pools (*.ozFragPools in 'frag') {" );
Log::indent();
- File dir( File::VIRTUAL, "frag" );
+ File dir( "@frag" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.iter() ) {
@@ -471,7 +471,7 @@ void Liber::initClasses()
Log::println( "Object classes (*.ozClasses in 'class') {" );
Log::indent();
- File dir( File::VIRTUAL, "class" );
+ File dir( "@class" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.iter() ) {
@@ -629,7 +629,7 @@ void Liber::initBSPs()
Log::println( "BSP structures (*.ozBSP, *.ozcBSP in 'bsp') {" );
Log::indent();
- File dir( File::VIRTUAL, "bsp" );
+ File dir( "@bsp" );
DArray<File> dirList = dir.ls();
foreach( file, dirList.citer() ) {
@@ -652,7 +652,7 @@ void Liber::initBSPs()
void Liber::initMusicRecurse( const char* path, List<Resource>* musicTracksList )
{
- File dir( File::VIRTUAL, path );
+ File dir( path );
DArray<File> dirList = dir.ls();
foreach( file, dirList.iter() ) {
@@ -683,13 +683,13 @@ void Liber::initMusic( const char* userMusicPath )
List<Resource> musicTracksList;
- initMusicRecurse( "music", &musicTracksList );
+ initMusicRecurse( "@music", &musicTracksList );
for( int i = 0; i < musicTracksList.length(); ++i ) {
musicTrackIndices.add( musicTracksList[i].name, i );
}
- initMusicRecurse( "userMusic", &musicTracksList );
+ initMusicRecurse( "@userMusic", &musicTracksList );
musicTracks.resize( musicTracksList.length() );
aMove<Resource>( musicTracks.begin(), musicTracksList.begin(), musicTracksList.length() );
View
2  src/matrix/Lua.cc
@@ -424,7 +424,7 @@ void Lua::init()
l_setglobal( "ozLocalData" );
l_getglobal( "ozLocalData" );
- File luaDir( File::VIRTUAL, "lua/matrix" );
+ File luaDir( "@lua/matrix" );
DArray<File> luaFiles = luaDir.ls();
foreach( file, luaFiles.iter() ) {
View
2  src/matrix/NamePool.cc
@@ -54,7 +54,7 @@ void NamePool::init()
listPositions.add( names.length() );
for( int i = 0; i < liber.nameLists.length(); ++i ) {
- File file( File::VIRTUAL, liber.nameLists[i].path );
+ File file( liber.nameLists[i].path );
if( file.type() != File::REGULAR ) {
OZ_ERROR( "Reading '%s' failed", liber.nameLists[i].path.cstr() );
View
2  src/matrix/Terra.cc
@@ -55,7 +55,7 @@ void Terra::load( int id_ )
Log::print( "Loading terrain '%s' ...", name.cstr() );
- File file( File::VIRTUAL, path );
+ File file( path );
Buffer buffer = file.read();
if( buffer.isEmpty() ) {
View
2  src/nirvana/Lua.cc
@@ -475,7 +475,7 @@ void Lua::init()
l_setglobal( "ozLocalData" );
l_getglobal( "ozLocalData" );
- File luaDir( File::VIRTUAL, "lua/nirvana" );
+ File luaDir( "@lua/nirvana" );
DArray<File> luaFiles = luaDir.ls();
foreach( file, luaFiles.iter() ) {