improved lots of stuff
This commit is contained in:
@@ -75,6 +75,8 @@ CUtlString client_lib;
|
||||
#include "game/server/__build.cpp"
|
||||
#include "game/client/__build.cpp"
|
||||
|
||||
#include "materialsystem/__build.cpp"
|
||||
|
||||
#include "rapier/__build.cpp"
|
||||
#include "engine/__build.cpp"
|
||||
|
||||
|
||||
@@ -10,10 +10,8 @@ extern "C" void FunnyMain( int argc, char **argv )
|
||||
{
|
||||
CommandLine()->CreateCommandLine(argc, argv);
|
||||
|
||||
filesystem = (IFileSystem*)CreateInterface(FILESYSTEM_INTERFACE_NAME, NULL);
|
||||
filesystem->Init();
|
||||
|
||||
gamewindow = (IGameWindow*)CreateInterface(GAME_WINDOW_INTERFACE_NAME, NULL);
|
||||
gamewindow->Init();
|
||||
|
||||
ServerGameDLL()->Init();
|
||||
|
||||
@@ -32,9 +32,7 @@ class CFileSystem : public IFileSystem
|
||||
{
|
||||
public:
|
||||
virtual void Init() override {
|
||||
filesystem_backend = (IFileSystem*)CreateInterface(FILESYSTEM_BACKEND_INTERFACE_NAME, NULL);
|
||||
filesystem_backend->Init();
|
||||
filesystem_pak = (IFileSystem*)CreateInterface(FILESYSTEM_PAK_INTERFACE_NAME, NULL);
|
||||
filesystem_pak->Init();
|
||||
};
|
||||
virtual void Shutdown() override {
|
||||
@@ -79,8 +77,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
IFileSystem *filesystem;
|
||||
IFileSystem *filesystem_backend;
|
||||
IFileSystem *filesystem_pak;
|
||||
|
||||
EXPOSE_INTERFACE(CFileSystem, IFileSystem, FILESYSTEM_INTERFACE_NAME);
|
||||
CFileSystem g_fileSystem;
|
||||
IFileSystem *filesystem = &g_fileSystem;
|
||||
|
||||
@@ -91,4 +91,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE(CLIBCFileSystem, IFileSystem, FILESYSTEM_BACKEND_INTERFACE_NAME);
|
||||
CLIBCFileSystem g_libcFileSystem;
|
||||
IFileSystem *filesystem_backend = &g_libcFileSystem;
|
||||
|
||||
@@ -78,4 +78,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE(CPAKFileSystem, IFileSystem, FILESYSTEM_PAK_INTERFACE_NAME);
|
||||
CPAKFileSystem g_pakFileSystem;
|
||||
IFileSystem *filesystem_pak = &g_pakFileSystem;
|
||||
|
||||
9
engine/funnyformat.cpp
Normal file
9
engine/funnyformat.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "funnyformat.h"
|
||||
|
||||
class CFunnyFormatManager: public IFunnyFormatManager
|
||||
{
|
||||
virtual FunnyFormatData_t ReadFile( IFileHandle *pHandle ) override;
|
||||
virtual void WriteFile( IFileHandle *pHandle, FunnyFormatData_t data ) override;
|
||||
virtual FunnyFormatData_t ReadBinaryFile( IFileHandle *pHandle ) override;
|
||||
virtual void WriteBinaryFile( IFileHandle *pHandle, FunnyFormatData_t data ) override;
|
||||
};
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "SDL3/SDL_events.h"
|
||||
|
||||
SDL_Window *g_pWindow;
|
||||
IGameWindow *gamewindow;
|
||||
|
||||
class CSDLGameWindow: public IGameWindow
|
||||
{
|
||||
@@ -22,6 +21,9 @@ public:
|
||||
virtual void UpdateWindow() override;
|
||||
};
|
||||
|
||||
CSDLGameWindow g_sdlGameWindow;
|
||||
IGameWindow *gamewindow = &g_sdlGameWindow;
|
||||
|
||||
|
||||
void CSDLGameWindow::Init()
|
||||
{
|
||||
@@ -54,7 +56,3 @@ void CSDLGameWindow::UpdateWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
EXPOSE_INTERFACE(CSDLGameWindow, IGameWindow, GAME_WINDOW_INTERFACE_NAME);
|
||||
|
||||
@@ -37,6 +37,10 @@ CUtlVector<CUtlString> g_IncludeDirectories = {
|
||||
|
||||
DECLARE_BUILD_STAGE(fpc)
|
||||
{
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
g_CompiledFiles.AppendTail("library/clang/c_libclang.cpp");
|
||||
else
|
||||
V_printf("Warning: to support included files libclang must be installed.");
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
@@ -44,6 +48,8 @@ DECLARE_BUILD_STAGE(fpc)
|
||||
compileProject.files = g_CompiledFiles;
|
||||
compileProject.includeDirectories = g_IncludeDirectories;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
if (linker->IsLibraryExists("clang"))
|
||||
ldProject.libraries.AppendTail("clang");
|
||||
|
||||
CUtlString outputProject = linker->Link(&ldProject);
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "c.h"
|
||||
#include "c_libclang.h"
|
||||
#include "helper.h"
|
||||
#include "obj.h"
|
||||
#include "target.h"
|
||||
#include "tier0/lib.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/commandline.h"
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
@@ -26,14 +28,26 @@ public:
|
||||
EXPOSE_INTERFACE(CClangCompiler, ICCompiler, CLANG_C_COMPILER_INTERFACE_NAME);
|
||||
|
||||
CUtlVector<ClangFile_t> g_clangFiles;
|
||||
IClangBackend *clangbackend = NULL;
|
||||
|
||||
LinkProject_t CClangCompiler::Compile( CProject_t *pProject )
|
||||
{
|
||||
if (!clangbackend && CommandLine()->CheckParam("-experimental_header_include"))
|
||||
clangbackend = (IClangBackend*)CreateInterface(CLANG_BACKEND_INTERFACE_NAME, NULL);
|
||||
V_printf("CLANG: %p\n", clangbackend);
|
||||
|
||||
if (pProject->m_szName == 0)
|
||||
{
|
||||
Plat_FatalErrorFunc("m_szName must be present\n");
|
||||
}
|
||||
|
||||
LinkProject_t proj = {};
|
||||
proj.m_szName = pProject->m_szName;
|
||||
proj.m_target = pProject->m_target;
|
||||
proj.m_androidmanifest = pProject->m_androidmanifest;
|
||||
unsigned int hash = pProject->GenerateProjectHash();
|
||||
|
||||
// Get output directories
|
||||
for (auto &file: pProject->files)
|
||||
{
|
||||
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||
@@ -42,12 +56,16 @@ LinkProject_t CClangCompiler::Compile( CProject_t *pProject )
|
||||
szOutputDir = dirname(szOutputDir);
|
||||
filesystem2->MakeDirectory(szOutputDir);
|
||||
}
|
||||
|
||||
// Run CC
|
||||
for (auto &file: pProject->files)
|
||||
{
|
||||
CUtlVector<CUtlString> args;
|
||||
V_printf(" CC %s\n", file.GetString());
|
||||
|
||||
CUtlVector<CUtlString> args;
|
||||
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||
CUtlString szCompiledTarget = szTarget;
|
||||
bool bAreDependenciesUpdated = false;
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
{
|
||||
szCompiledTarget = CUtlString("%s%u", szTarget.GetString(), pProject->m_androidmanifest.m_nTargetVersion);
|
||||
@@ -57,11 +75,6 @@ LinkProject_t CClangCompiler::Compile( CProject_t *pProject )
|
||||
args = {
|
||||
"-target",
|
||||
szCompiledTarget,
|
||||
"-g",
|
||||
"-c",
|
||||
"-o",
|
||||
szOutputFile,
|
||||
file,
|
||||
};
|
||||
if (!strcmp(Plat_GetExtension(file),"cpp"))
|
||||
args.AppendTail("-std=c++17");
|
||||
@@ -106,9 +119,17 @@ LinkProject_t CClangCompiler::Compile( CProject_t *pProject )
|
||||
args.AppendTail("-include");
|
||||
args.AppendTail(include);
|
||||
}
|
||||
if (!filesystem2->ShouldRecompile(file, szOutputFile))
|
||||
|
||||
if (clangbackend)
|
||||
bAreDependenciesUpdated = clangbackend->AreFileDependenciesUpdated(file, szOutputFile, args);
|
||||
if (!filesystem2->ShouldRecompile(file, szOutputFile) && !bAreDependenciesUpdated)
|
||||
goto skipcompile;
|
||||
|
||||
args.AppendTail("-c");
|
||||
args.AppendTail("-o");
|
||||
args.AppendTail(szOutputFile);
|
||||
args.AppendTail(file);
|
||||
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
{
|
||||
if (!pProject->m_target.szSysroot)
|
||||
|
||||
64
fpc/library/clang/c_libclang.cpp
Normal file
64
fpc/library/clang/c_libclang.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
#include "c_libclang.h"
|
||||
#include "helper.h"
|
||||
#include "tier1/interface.h"
|
||||
|
||||
#include "clang-c/Index.h"
|
||||
#include <clang-c/CXFile.h>
|
||||
#include <clang-c/CXString.h>
|
||||
|
||||
class CClangBackend: public IClangBackend
|
||||
{
|
||||
public:
|
||||
virtual bool AreFileDependenciesUpdated( CUtlString szFile, CUtlString szOutputFile, CUtlVector<CUtlString> arguments ) override;
|
||||
|
||||
bool bAnyOutdated;
|
||||
CUtlString szCurrentFile;
|
||||
|
||||
private:
|
||||
static void InclusionVisitor( CXFile included_file, CXSourceLocation *include_stack, unsigned include_len, CXClientData client_data );
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE(CClangBackend, IClangBackend, CLANG_BACKEND_INTERFACE_NAME);
|
||||
|
||||
bool CClangBackend::AreFileDependenciesUpdated( CUtlString szFile, CUtlString szOutputFile, CUtlVector<CUtlString> arguments )
|
||||
{
|
||||
szCurrentFile = szOutputFile;
|
||||
bAnyOutdated = false;
|
||||
|
||||
CUtlVector<const char *> cArguments = {};
|
||||
for (auto &arg: arguments)
|
||||
cArguments.AppendTail(arg);
|
||||
|
||||
CXIndex index = clang_createIndex(0, 0);
|
||||
CXTranslationUnit tu;
|
||||
CXErrorCode err = clang_parseTranslationUnit2(index, szFile.GetString(), cArguments.GetData(), cArguments.GetSize(), NULL, 0, 0, &tu);
|
||||
|
||||
if (err != CXError_Success) {
|
||||
printf("clang_parseTranslationUnit2 failed with error code %d\n", err);
|
||||
return false;
|
||||
}
|
||||
|
||||
clang_getInclusions(tu, CClangBackend::InclusionVisitor, NULL);
|
||||
|
||||
clang_disposeTranslationUnit(tu);
|
||||
clang_disposeIndex(index);
|
||||
return bAnyOutdated;
|
||||
}
|
||||
|
||||
void CClangBackend::InclusionVisitor( CXFile included_file, CXSourceLocation *include_stack, unsigned include_len, CXClientData client_data )
|
||||
{
|
||||
if (((CClangBackend*)clangbackend)->bAnyOutdated)
|
||||
return;
|
||||
CXString filename = clang_getFileName(included_file);
|
||||
|
||||
bool bUpdate =
|
||||
filesystem2->ShouldRecompile(clang_getCString(filename), ((CClangBackend*)clangbackend)->szCurrentFile);
|
||||
if (bUpdate)
|
||||
{
|
||||
((CClangBackend*)clangbackend)->bAnyOutdated = true;
|
||||
}
|
||||
|
||||
clang_disposeString(filename);
|
||||
}
|
||||
|
||||
17
fpc/library/clang/c_libclang.h
Normal file
17
fpc/library/clang/c_libclang.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef C_LIBCLANG_H
|
||||
#define C_LIBCLANG_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
#define CLANG_BACKEND_INTERFACE_NAME "ClangBackend001"
|
||||
|
||||
abstract_class IClangBackend
|
||||
{
|
||||
public:
|
||||
virtual bool AreFileDependenciesUpdated( CUtlString szFile, CUtlString szOutputFile, CUtlVector<CUtlString> arguments ) = 0;
|
||||
};
|
||||
|
||||
extern IClangBackend *clangbackend;
|
||||
|
||||
#endif
|
||||
@@ -10,12 +10,19 @@ class CClangLinker : public ILinker
|
||||
{
|
||||
public:
|
||||
virtual CUtlString Link( LinkProject_t *pProject ) override;
|
||||
virtual bool IsLibraryExists( CUtlString szName ) override;
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE(CClangLinker, ILinker, CLANG_LINKER_INTERFACE_NAME);
|
||||
|
||||
CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
{
|
||||
if (pProject->m_szName == 0)
|
||||
{
|
||||
Plat_FatalErrorFunc("m_szName must be present\n");
|
||||
}
|
||||
|
||||
// Find a name for the file
|
||||
CUtlString szFileName;
|
||||
unsigned int hash = pProject->GenerateProjectHash();
|
||||
switch(pProject->linkType)
|
||||
@@ -67,10 +74,13 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
args.AppendTail(object.m_szObjectFile);
|
||||
runner->Run("ar", args);
|
||||
runner->Wait();
|
||||
|
||||
} else {
|
||||
V_printf(" LINK %s\n", pProject->m_szName.GetString());
|
||||
bool shouldRecompile = false;
|
||||
CUtlVector<CUtlString> args;
|
||||
|
||||
// Check if any of the files have changed
|
||||
for (auto object: pProject->objects)
|
||||
{
|
||||
if (filesystem2->ShouldRecompile(object.m_szObjectFile,szOutputFile))
|
||||
@@ -81,6 +91,8 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
}
|
||||
if (!shouldRecompile)
|
||||
goto compiled;
|
||||
|
||||
|
||||
CUtlString szTarget = pProject->m_target.GetTriplet();
|
||||
CUtlString szCompiledTarget = szTarget;
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
@@ -93,14 +105,20 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
"-target",
|
||||
szCompiledTarget,
|
||||
};
|
||||
|
||||
// Disable stdlib
|
||||
if (pProject->bNoStdLib)
|
||||
{
|
||||
args.AppendTail("-nostdlib");
|
||||
}
|
||||
|
||||
// Sysroots
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_DARWIN)
|
||||
{
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk");
|
||||
|
||||
// Shouldn't be here
|
||||
args.AppendTail("-Wl,-export_dynamic");
|
||||
args.AppendTail("-undefined");
|
||||
args.AppendTail("dynamic_lookup");
|
||||
@@ -109,21 +127,26 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
{
|
||||
args.AppendTail("-isysroot");
|
||||
args.AppendTail("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk");
|
||||
args.AppendTail("-miphoneos-version-min=18.0 ");
|
||||
// Shouldn't be here ?
|
||||
args.AppendTail("-fembed-bitcode");
|
||||
args.AppendTail("-Wl,-rpath,@executable_path");
|
||||
args.AppendTail("-Wl,-all_load");
|
||||
args.AppendTail("-w");
|
||||
args.AppendTail("-miphoneos-version-min=18.0 ");
|
||||
}
|
||||
else if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
{
|
||||
args.AppendTail(CUtlString("--sysroot=%s/sysroot", pProject->m_target.szSysroot));
|
||||
|
||||
// Shouldn't be here ?
|
||||
args.AppendTail("-static-libstdc++");
|
||||
}
|
||||
else if (pProject->m_target.szSysroot)
|
||||
{
|
||||
args.AppendTail(CUtlString("--sysroot=%s", pProject->m_target.szSysroot));
|
||||
}
|
||||
|
||||
// Magic for the systems
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_WINDOWS)
|
||||
{
|
||||
args.AppendTail("-fuse-ld=ld");
|
||||
@@ -132,21 +155,30 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
{
|
||||
args.AppendTail("-rdynamic");
|
||||
}
|
||||
|
||||
// Dynamic libraries
|
||||
// Android can't run executables
|
||||
if (pProject->linkType == ELINK_DYNAMIC_LIBRARY || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
{
|
||||
args.AppendTail("-shared");
|
||||
}
|
||||
|
||||
// All the objects
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_WINDOWS || pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
args.AppendTail("-Wl,--whole-archive");
|
||||
for (auto object: pProject->objects)
|
||||
args.AppendTail(object.m_szObjectFile);
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_WINDOWS || pProject->m_target.kernel == TARGET_KERNEL_LINUX || pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
args.AppendTail("-Wl,--no-whole-archive");
|
||||
|
||||
// Libraries
|
||||
for (auto lib: pProject->libraries)
|
||||
{
|
||||
args.AppendTail("-l");
|
||||
args.AppendTail(lib);
|
||||
}
|
||||
|
||||
// Apple frameworks
|
||||
for (auto &directory: pProject->frameworkDirectories)
|
||||
{
|
||||
args.AppendTail("-F");
|
||||
@@ -157,10 +189,12 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
args.AppendTail("-framework");
|
||||
args.AppendTail(framework);
|
||||
}
|
||||
|
||||
// Android SDK requires sysroot
|
||||
if (pProject->m_target.kernel == TARGET_KERNEL_ANDROID)
|
||||
{
|
||||
if (!pProject->m_target.szSysroot)
|
||||
Plat_FatalErrorFunc("-sysroot must be specified for android\n");
|
||||
Plat_FatalErrorFunc("szSysroot must be specified for android\n");
|
||||
runner->Run(CUtlString("%s/bin/clang++",pProject->m_target.szSysroot), args);
|
||||
|
||||
}
|
||||
@@ -173,3 +207,13 @@ CUtlString CClangLinker::Link( LinkProject_t *pProject )
|
||||
compiled:
|
||||
return szOutputFile;
|
||||
};
|
||||
|
||||
bool CClangLinker::IsLibraryExists( CUtlString szName )
|
||||
{
|
||||
szName = CUtlString("lib%s.so", szName.GetString());
|
||||
void *pLib = Plat_LoadLibrary(szName.GetString());
|
||||
if (!pLib)
|
||||
return false;
|
||||
Plat_UnloadLibrary(pLib);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ public:
|
||||
|
||||
// Links project
|
||||
virtual CUtlString Link( LinkProject_t *pProject ) = 0;
|
||||
|
||||
virtual bool IsLibraryExists( CUtlString szName ) = 0;
|
||||
};
|
||||
|
||||
extern ILinker *linker;
|
||||
|
||||
31
materialsystem/__build.cpp
Normal file
31
materialsystem/__build.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/commandline.h"
|
||||
|
||||
CUtlVector<CUtlString> MaterialSystem_CompiledFiles = {
|
||||
"materialsystem/vulkan/material.cpp",
|
||||
"materialsystem/vulkan/materialsystem.cpp",
|
||||
"materialsystem/vulkan/shader.cpp",
|
||||
"materialsystem/vulkan/vulkan_state.cpp",
|
||||
};
|
||||
CUtlString material_lib;
|
||||
|
||||
DECLARE_BUILD_STAGE(MaterialSystem)
|
||||
{
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
compileProject.m_szName = "MaterialSystem";
|
||||
compileProject.files = MaterialSystem_CompiledFiles;
|
||||
compileProject.includeDirectories = all_IncludeDirectories;
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.linkType = ELINK_STATIC_LIBRARY;
|
||||
|
||||
CUtlString outputProject = linker->Link(&ldProject);
|
||||
material_lib = outputProject;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "materialsystem/imaterialsystem.h"
|
||||
|
||||
class CVkRenderingContext
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
CVkRenderingContext g_vkRenderingContext;
|
||||
|
||||
class CVkMaterialSystem: public IMaterialSystem
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void Frame( float fDeltaTime );
|
||||
virtual void Shutdown();
|
||||
|
||||
IRenderContext *GetRenderContext();
|
||||
};
|
||||
|
||||
CVkMaterialSystem g_vkMaterialSystem;
|
||||
IMaterialSystem *materials = &g_vkMaterialSystem;
|
||||
|
||||
|
||||
void CVkMaterialSystem::Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CVkMaterialSystem::Frame( float fDeltaTime )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CVkMaterialSystem::Shutdown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
0
materialsystem/vulkan/vulkan_state.cpp
Normal file
0
materialsystem/vulkan/vulkan_state.cpp
Normal file
0
materialsystem/vulkan/vulkan_state.h
Normal file
0
materialsystem/vulkan/vulkan_state.h
Normal file
@@ -7,20 +7,31 @@
|
||||
|
||||
struct FunnyFormatParameter_t
|
||||
{
|
||||
const char *szName;
|
||||
uint32_t nDataSize;
|
||||
void *pData;
|
||||
const char *m_szName;
|
||||
uint32_t m_nDataSize;
|
||||
void *m_pData;
|
||||
};
|
||||
|
||||
struct FunnyFormatObject_t
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct FunnyFormatData_t
|
||||
{
|
||||
bool m_bIsBinary;
|
||||
CUtlVector<FunnyFormatParameter_t> m_parameters;
|
||||
CUtlVector<FunnyFormatObject_t> m_parameters;
|
||||
};
|
||||
|
||||
abstract_class IFunnyFormatManager
|
||||
{
|
||||
public:
|
||||
virtual FunnyFormatData_t ReadFile( IFileHandle *pHandle ) = 0;
|
||||
virtual FunnyFormatData_t ReadBinaryFile( IFileHandle *pHandle ) = 0;
|
||||
virtual void WriteFile( IFileHandle *pHandle, FunnyFormatData_t data ) = 0;
|
||||
};
|
||||
|
||||
IFunnyFormatManager *FunnyFormatManager();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#include "iappsystem.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#define FILESYSTEM_INTERFACE_NAME "FileSystem001"
|
||||
#define FILESYSTEM_BACKEND_INTERFACE_NAME "FileSystemBackend001"
|
||||
#define FILESYSTEM_PAK_INTERFACE_NAME "FileSystemPAK001"
|
||||
|
||||
enum EFileMode
|
||||
{
|
||||
FILEMODE_READ = 0x01,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
#include "iappsystem.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#define GAME_WINDOW_INTERFACE_NAME "GameWindow001"
|
||||
#define GAME_SDL_WINDOW_INTERFACE_NAME "SDLGameWindow001"
|
||||
|
||||
abstract_class IGameWindow: public IAppSystem
|
||||
{
|
||||
public:
|
||||
|
||||
0
public/jsonformat.h
Normal file
0
public/jsonformat.h
Normal file
@@ -1,6 +1,7 @@
|
||||
#ifndef MATERIAL_SYSTEM_H
|
||||
#define MATERIAL_SYSTEM_H
|
||||
|
||||
#include "iappsystem.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
|
||||
@@ -62,9 +63,10 @@ abstract_class IImage : public IRenderingObject
|
||||
public:
|
||||
virtual void BlitTo( IImage *pImage );
|
||||
};
|
||||
abstract_class IRenderContext
|
||||
abstract_class IRenderContext: public IAppSystem
|
||||
{
|
||||
public:
|
||||
|
||||
virtual IVertexBuffer *CreateVertexBuffer( uint32_t nSize ) = 0;
|
||||
virtual IIndexBuffer *CreateIndexBuffer( uint32_t nSize ) = 0;
|
||||
virtual IImage *CreateRenderTarget( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType );
|
||||
@@ -74,9 +76,13 @@ public:
|
||||
virtual void DestroyImage( IImage *pImage );
|
||||
};
|
||||
|
||||
abstract_class IMaterialSystem
|
||||
abstract_class IMaterialSystem: public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void Frame( float fTime );
|
||||
virtual void Shutdown();
|
||||
|
||||
IRenderContext *GetRenderContext();
|
||||
};
|
||||
|
||||
|
||||
30
public/tier2/fileformats/ini.h
Normal file
30
public/tier2/fileformats/ini.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef TIER2_INI_H
|
||||
#define TIER2_INI_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
abstract_class IINISection
|
||||
{
|
||||
public:
|
||||
virtual bool GetBoolValue( const char *szKeyName ) = 0;
|
||||
virtual int GetIntValue( const char *szKeyName ) = 0;
|
||||
virtual const char *GetStringValue( const char *szKeyName ) = 0;
|
||||
virtual CUtlString GetUTLStringValue( const char *szKeyName ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IINIFile
|
||||
{
|
||||
public:
|
||||
virtual void GetSection( const char *szSectionName ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IINIManager
|
||||
{
|
||||
public:
|
||||
virtual IINIFile *ReadString( const char *psz ) = 0;
|
||||
};
|
||||
|
||||
IINIManager *INIManager();
|
||||
|
||||
#endif
|
||||
0
public/tier2/fileformats/json.h
Normal file
0
public/tier2/fileformats/json.h
Normal file
41
tier2/fileformats/ini.cpp
Normal file
41
tier2/fileformats/ini.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
#include "tier2/fileformats/ini.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
abstract_class CINISection: public IINISection
|
||||
{
|
||||
public:
|
||||
virtual bool GetBoolValue( const char *szKeyName ) override;
|
||||
virtual int GetIntValue( const char *szKeyName ) override;
|
||||
virtual const char *GetStringValue( const char *szKeyName ) override;
|
||||
virtual CUtlString GetUTLStringValue( const char *szKeyName ) override;
|
||||
|
||||
CUtlVector<CUtlString> m_values;
|
||||
};
|
||||
|
||||
class CINIFile: public IINIFile
|
||||
{
|
||||
virtual void GetSection( const char *szSectionName ) override;
|
||||
|
||||
CUtlVector<CINISection*> m_sections;
|
||||
};
|
||||
|
||||
class CINIManager: public IINIManager
|
||||
{
|
||||
public:
|
||||
virtual IINIFile *ReadString( const char *psz ) override;
|
||||
};
|
||||
|
||||
IINIFile *CINIManager::ReadString( const char *psz )
|
||||
{
|
||||
CINIFile *pFile = new CINIFile;
|
||||
return (IINIFile*)pFile;
|
||||
}
|
||||
|
||||
IINIManager *INIManager()
|
||||
{
|
||||
static CINIManager manager;
|
||||
return &manager;
|
||||
}
|
||||
|
||||
0
tier2/fileformats/json.cpp
Normal file
0
tier2/fileformats/json.cpp
Normal file
Reference in New Issue
Block a user