mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Show comptime emits as embedded sourceviews
This commit is contained in:
parent
ee27f6fd02
commit
4d1e14a1c3
65 changed files with 3360 additions and 633 deletions
|
@ -1624,6 +1624,7 @@ copy /y "$(OutDir)$(TargetName).lib" "$(SolutionDir)\BeefLibs\Beefy2D\dist\"</Co
|
|||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">TurnOffAllWarnings</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="third_party\miniz\miniz.c" />
|
||||
<ClCompile Include="third_party\png\png.c">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level1</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">Level1</WarningLevel>
|
||||
|
@ -1950,6 +1951,7 @@ copy /y "$(OutDir)$(TargetName).lib" "$(SolutionDir)\BeefLibs\Beefy2D\dist\"</Co
|
|||
<ClCompile Include="util\UTF8.cpp" />
|
||||
<ClCompile Include="util\Vector.cpp" />
|
||||
<ClCompile Include="util\WorkThread.cpp" />
|
||||
<ClCompile Include="util\ZipFile.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BFApp.h" />
|
||||
|
@ -2133,6 +2135,7 @@ copy /y "$(OutDir)$(TargetName).lib" "$(SolutionDir)\BeefLibs\Beefy2D\dist\"</Co
|
|||
<ClInclude Include="third_party\jpeg\transupp.h" />
|
||||
<ClInclude Include="third_party\libffi\i686-pc-cygwin\include\ffi.h" />
|
||||
<ClInclude Include="third_party\libffi\i686-pc-cygwin\include\ffitarget.h" />
|
||||
<ClInclude Include="third_party\miniz\miniz.h" />
|
||||
<ClInclude Include="third_party\png\png.h" />
|
||||
<ClInclude Include="third_party\png\pngasmrd.h" />
|
||||
<ClInclude Include="third_party\png\pngconf.h" />
|
||||
|
@ -2190,6 +2193,7 @@ copy /y "$(OutDir)$(TargetName).lib" "$(SolutionDir)\BeefLibs\Beefy2D\dist\"</Co
|
|||
<ClInclude Include="util\UTF8.h" />
|
||||
<ClInclude Include="util\Vector.h" />
|
||||
<ClInclude Include="util\WorkThread.h" />
|
||||
<ClInclude Include="util\ZipFile.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="third_party\libffi\i686-pc-cygwin\src\x86\win64.asm">
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
<Filter Include="src\third_party\stb">
|
||||
<UniqueIdentifier>{b85b0989-3047-46e9-93d7-5bc352fb0df7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\third_party\miniz">
|
||||
<UniqueIdentifier>{a159b9ee-1a71-44f5-a412-1e01e20b70c7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="platform\win\DXRenderDevice.cpp">
|
||||
|
@ -722,6 +725,12 @@
|
|||
<ClCompile Include="util\Compress.cpp">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="third_party\miniz\miniz.c">
|
||||
<Filter>src\third_party\miniz</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="util\ZipFile.cpp">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common.h">
|
||||
|
@ -1108,6 +1117,12 @@
|
|||
<ClInclude Include="util\BitSet.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="third_party\miniz\miniz.h">
|
||||
<Filter>src\third_party\miniz</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="util\ZipFile.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="third_party\libffi\i686-pc-cygwin\src\x86\win32.asm">
|
||||
|
|
|
@ -677,6 +677,7 @@
|
|||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Level1</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Level1</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="third_party\miniz\miniz.c" />
|
||||
<ClCompile Include="third_party\png\png.c">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level1</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Level1</WarningLevel>
|
||||
|
@ -883,6 +884,7 @@
|
|||
<ClCompile Include="util\UTF8.cpp" />
|
||||
<ClCompile Include="util\Vector.cpp" />
|
||||
<ClCompile Include="util\WorkThread.cpp" />
|
||||
<ClCompile Include="util\ZipFile.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BFApp.h" />
|
||||
|
@ -1007,6 +1009,7 @@
|
|||
<ClInclude Include="third_party\jpeg\transupp.h" />
|
||||
<ClInclude Include="third_party\libffi\i686-pc-cygwin\include\ffi.h" />
|
||||
<ClInclude Include="third_party\libffi\i686-pc-cygwin\include\ffitarget.h" />
|
||||
<ClInclude Include="third_party\miniz\miniz.h" />
|
||||
<ClInclude Include="third_party\png\png.h" />
|
||||
<ClInclude Include="third_party\png\pngasmrd.h" />
|
||||
<ClInclude Include="third_party\png\pngconf.h" />
|
||||
|
@ -1049,6 +1052,7 @@
|
|||
<ClInclude Include="util\UTF8.h" />
|
||||
<ClInclude Include="util\Vector.h" />
|
||||
<ClInclude Include="util\WorkThread.h" />
|
||||
<ClInclude Include="util\ZipFile.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="third_party\libffi\i686-pc-cygwin\src\x86\win64.asm">
|
||||
|
|
|
@ -66,6 +66,9 @@
|
|||
<Filter Include="src\third_party\utf8proc">
|
||||
<UniqueIdentifier>{1309f90f-4745-4623-ab21-5d7b1450103c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\third_party\miniz">
|
||||
<UniqueIdentifier>{d32cb9b0-e79b-49fe-82e2-33302be0baf6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="platform\win\DXRenderDevice.cpp">
|
||||
|
@ -575,6 +578,12 @@
|
|||
<ClCompile Include="util\Compress.cpp">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="util\ZipFile.cpp">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="third_party\miniz\miniz.c">
|
||||
<Filter>src\third_party\miniz</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common.h">
|
||||
|
@ -883,6 +892,12 @@
|
|||
<ClInclude Include="util\Compress.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="util\ZipFile.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="third_party\miniz\miniz.h">
|
||||
<Filter>src\third_party\miniz</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="third_party\libffi\i686-pc-cygwin\src\x86\win32.asm">
|
||||
|
|
|
@ -1152,6 +1152,9 @@ String Beefy::FixPath(const StringImpl& pathIn)
|
|||
|
||||
String Beefy::FixPathAndCase(const StringImpl& pathIn)
|
||||
{
|
||||
if ((!pathIn.IsEmpty()) && (pathIn[0] == '$'))
|
||||
return pathIn;
|
||||
|
||||
String path = FixPath(pathIn);
|
||||
#ifdef _WIN32
|
||||
for (int i = 0; i < (int)path.length(); ++i)
|
||||
|
@ -1180,8 +1183,7 @@ String Beefy::RemoveTrailingSlash(const StringImpl& str)
|
|||
|
||||
bool Beefy::FileNameEquals(const StringImpl& filePathA, const StringImpl& filePathB)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
//return _stricmp(filePathA.c_str(), filePathB.c_str()) == 0;
|
||||
#ifdef _WIN32
|
||||
if (filePathA.length() != filePathB.length())
|
||||
return false;
|
||||
|
||||
|
|
110
BeefySysLib/util/ZipFile.cpp
Normal file
110
BeefySysLib/util/ZipFile.cpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
#include "ZipFile.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "miniz/miniz.h"
|
||||
}
|
||||
|
||||
USING_NS_BF;
|
||||
|
||||
class ZipFile::Data
|
||||
{
|
||||
public:
|
||||
bool mIsWriter;
|
||||
mz_zip_archive mZip;
|
||||
};
|
||||
|
||||
ZipFile::ZipFile()
|
||||
{
|
||||
mData = NULL;
|
||||
}
|
||||
|
||||
ZipFile::~ZipFile()
|
||||
{
|
||||
if (mData != NULL)
|
||||
Close();
|
||||
}
|
||||
|
||||
bool ZipFile::Open(const StringImpl& filePath)
|
||||
{
|
||||
if (mData != NULL)
|
||||
Close();
|
||||
|
||||
mData = new ZipFile::Data();
|
||||
memset(mData, 0, sizeof(ZipFile::Data));
|
||||
if (!mz_zip_reader_init_file(&mData->mZip, filePath.c_str(), 0))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZipFile::Create(const StringImpl& filePath)
|
||||
{
|
||||
if (mData != NULL)
|
||||
Close();
|
||||
|
||||
mData = new ZipFile::Data();
|
||||
memset(mData, 0, sizeof(ZipFile::Data));
|
||||
if (!mz_zip_writer_init_file(&mData->mZip, filePath.c_str(), 0))
|
||||
{
|
||||
delete mData;
|
||||
mData = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
mData->mIsWriter = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZipFile::Close()
|
||||
{
|
||||
if (mData == NULL)
|
||||
return false;
|
||||
|
||||
if (mData->mIsWriter)
|
||||
{
|
||||
if (!mz_zip_writer_finalize_archive(&mData->mZip))
|
||||
return false;
|
||||
if (!mz_zip_writer_end(&mData->mZip))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mz_zip_reader_end(&mData->mZip))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZipFile::IsOpen()
|
||||
{
|
||||
return mData != NULL;
|
||||
}
|
||||
|
||||
bool ZipFile::Add(const StringImpl& fileName, Span<uint8> data)
|
||||
{
|
||||
if (mData == NULL)
|
||||
return false;
|
||||
|
||||
if (!mz_zip_writer_add_mem(&mData->mZip, fileName.c_str(), data.mVals, data.mSize, MZ_NO_COMPRESSION))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZipFile::Get(const StringImpl& fileName, Array<uint8>& data)
|
||||
{
|
||||
if (mData == NULL)
|
||||
return false;
|
||||
|
||||
int idx = mz_zip_reader_locate_file(&mData->mZip, fileName.c_str(), NULL, 0);
|
||||
if (idx < 0)
|
||||
return false;
|
||||
|
||||
size_t size = 0;
|
||||
void* ptr = mz_zip_reader_extract_to_heap(&mData->mZip, idx, &size, 0);
|
||||
data.Insert(data.mSize, (uint8*)ptr, (intptr)size);
|
||||
return true;
|
||||
}
|
30
BeefySysLib/util/ZipFile.h
Normal file
30
BeefySysLib/util/ZipFile.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Span.h"
|
||||
|
||||
NS_BF_BEGIN
|
||||
|
||||
|
||||
class ZipFile
|
||||
{
|
||||
public:
|
||||
class Data;
|
||||
|
||||
public:
|
||||
Data* mData;
|
||||
|
||||
public:
|
||||
ZipFile();
|
||||
~ZipFile();
|
||||
|
||||
bool Open(const StringImpl& filePath);
|
||||
bool Create(const StringImpl& filePath);
|
||||
bool Close();
|
||||
bool IsOpen();
|
||||
bool Add(const StringImpl& fileName, Span<uint8> data);
|
||||
bool Get(const StringImpl& fileName, Array<uint8>& data);
|
||||
};
|
||||
|
||||
|
||||
NS_BF_END
|
Loading…
Add table
Add a link
Reference in a new issue