fix: reimplement saving system and thumbnail generator, other fixes

This commit is contained in:
NOTPIES 2026-03-04 19:31:09 -03:00
parent 5a7e1474b5
commit 2e6f281391
90 changed files with 92225 additions and 28 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,357 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Storage.h"
#include "STO_Main.h"
C4JStorage StorageManager;
XMARKETPLACE_CONTENTOFFER_INFO InternalContentOfferInfo;
C4JStorage::C4JStorage() {}
void C4JStorage::Tick(void)
{
InternalStorageManager.Tick();
}
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad,
int (*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam,
C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton)
{
return EMessage_Undefined;
}
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult()
{
return EMessage_Undefined;
}
bool C4JStorage::SetSaveDevice(int (*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice)
{
return true;
}
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize,
int (*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID)
{
InternalStorageManager.Init(Func, lpParam, szGroupID);
}
void C4JStorage::ResetSaveData()
{
InternalStorageManager.m_SaveGame.ResetSaveData();
}
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName)
{
;
}
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
{
InternalStorageManager.m_SaveGame.SetSaveTitle(pwchDefaultSaveName);
}
LPCWSTR C4JStorage::GetSaveTitle()
{
return InternalStorageManager.m_SaveGame.GetSaveTitle();
}
bool C4JStorage::GetSaveUniqueNumber(INT *piVal)
{
return InternalStorageManager.m_SaveGame.GetSaveUniqueNumber(piVal);
}
bool C4JStorage::GetSaveUniqueFilename(char *pszName)
{
return InternalStorageManager.m_SaveGame.GetSaveUniqueFilename(pszName);
}
void C4JStorage::SetSaveUniqueFilename(char *szFilename)
{
InternalStorageManager.m_SaveGame.SetSaveUniqueFilename(szFilename);
}
void C4JStorage::SetState(ESaveGameControlState eControlState, int (*Func)(LPVOID, const bool), LPVOID lpParam)
{
;
}
void C4JStorage::SetSaveDisabled(bool bDisable)
{
InternalStorageManager.m_SaveGame.SetSaveDisabled(bDisable);
}
bool C4JStorage::GetSaveDisabled(void)
{
return InternalStorageManager.m_SaveGame.GetSaveDisabled();
}
unsigned int C4JStorage::GetSaveSize()
{
return InternalStorageManager.m_SaveGame.GetSaveSize();
}
void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes)
{
InternalStorageManager.m_SaveGame.GetSaveData(pvData, puiBytes);
}
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes)
{
return InternalStorageManager.m_SaveGame.AllocateSaveData(uiBytes);
}
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes)
{
InternalStorageManager.m_SaveGame.SetSaveImages(pbThumbnail, dwThumbnailBytes, pbImage, dwImageBytes, pbTextData, dwTextDataBytes);
}
void C4JStorage::SetDefaultImages(PBYTE pbOptionsImage, DWORD dwOptionsImageBytes, PBYTE pbSaveImage, DWORD dwSaveImageBytes, PBYTE pbSaveThumbnail, DWORD dwSaveThumbnailBytes)
{
InternalStorageManager.m_SaveGame.SetDefaultImages(pbOptionsImage, dwOptionsImageBytes, pbSaveImage, dwSaveImageBytes, pbSaveThumbnail, dwSaveThumbnailBytes);
}
void C4JStorage::GetDefaultSaveImage(PBYTE *ppbSaveImage, DWORD *pdwSaveImageBytes)
{
InternalStorageManager.m_SaveGame.GetDefaultSaveImage(ppbSaveImage, pdwSaveImageBytes);
}
void C4JStorage::GetDefaultSaveThumbnail(PBYTE *ppbSaveThumbnail, DWORD *pdwSaveThumbnailBytes)
{
InternalStorageManager.m_SaveGame.GetDefaultSaveThumbnail(ppbSaveThumbnail, pdwSaveThumbnailBytes);
}
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.SaveSaveData(Func, lpParam);
}
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam)
{
InternalStorageManager.m_SaveGame.CopySaveDataToNewSave(pbThumbnail, cbThumbnail, wchNewName, Func, lpParam);
}
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected)
{
;
}
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad)
{
return true;
}
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists)
{
return InternalStorageManager.m_SaveGame.DoesSaveExist(pbExists);
}
bool C4JStorage::EnoughSpaceForAMinSaveGame()
{
return true;
}
void C4JStorage::SetMaxSaves(int iMaxC)
{
(void)iMaxC;
}
void C4JStorage::SetIncompleteSaveCallback(void (*Func)(LPVOID, const ESaveIncompleteType, int blocksRequired), LPVOID param)
{
(void)Func;
(void)param;
}
void C4JStorage::ContinueIncompleteOperation()
{
}
C4JStorage::ESaveGameState C4JStorage::GetSaveState()
{
return C4JStorage::ESaveGame_Idle;
}
void C4JStorage::SetSaveMessageVPosition(float fY)
{
;
}
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
char *pszSavePackName)
{
return InternalStorageManager.m_SaveGame.GetSavesInfo(iPad, Func, lpParam, pszSavePackName);
}
PSAVE_DETAILS C4JStorage::ReturnSavesInfo()
{
return InternalStorageManager.m_SaveGame.ReturnSavesInfo();
}
void C4JStorage::ClearSavesInfo()
{
InternalStorageManager.m_SaveGame.ClearSavesInfo();
}
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,
int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.LoadSaveDataThumbnail(pSaveInfo, Func, lpParam);
}
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData)
{
;
}
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes)
{
;
}
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.LoadSaveData(pSaveInfo, Func, lpParam);
}
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.DeleteSaveData(pSaveInfo, Func, lpParam);
}
C4JStorage::ESaveGameState C4JStorage::RenameSaveData(int iRenameIndex, uint16_t *pui16NewName, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.RenameSaveData(iRenameIndex, pui16NewName, Func, lpParam);
}
void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam)
{
;
}
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot)
{
InternalStorageManager.m_DLC.SetPackageRoot(pszDLCRoot);
}
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
{
return EDLC_Idle;
}
DWORD C4JStorage::CancelGetDLCOffers()
{
return 0;
}
void C4JStorage::ClearDLCOffers()
{
;
}
XMARKETPLACE_CONTENTOFFER_INFO &C4JStorage::GetOffer(DWORD dw)
{
return InternalContentOfferInfo;
}
int C4JStorage::GetOfferCount()
{
return 0;
}
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int (*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial)
{
return 0;
}
DWORD C4JStorage::GetAvailableDLCCount(int iPad)
{
return InternalStorageManager.m_DLC.GetAvailableDLCCount(iPad);
}
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam)
{
return InternalStorageManager.m_DLC.GetInstalledDLC(iPad, Func, lpParam);
}
XCONTENT_DATA &C4JStorage::GetDLC(DWORD dw)
{
return InternalStorageManager.m_DLC.GetDLC(dw);
}
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
{
return InternalStorageManager.m_DLC.MountInstalledDLC(iPad, dwDLC, Func, lpParam, szMountDrive);
}
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive)
{
return InternalStorageManager.m_DLC.UnmountInstalledDLC(szMountDrive);
}
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
{
InternalStorageManager.m_DLC.GetMountedDLCFileList(szMountDrive, fileList);
}
std::string C4JStorage::GetMountedPath(std::string szMount)
{
return InternalStorageManager.m_DLC.GetMountedPath(szMount);
}
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize,
int (*Func)(LPVOID, WCHAR *, int, bool, int), LPVOID lpParam, int iAction)
{
return ETMSStatus_Idle;
}
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize)
{
return true;
}
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename)
{
return true;
}
void C4JStorage::StoreTMSPathName(WCHAR *pwchName)
{
;
}
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,
LPCSTR szFilename, int (*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam,
int iUserData)
{
return ETMSStatus_Idle;
}
unsigned int C4JStorage::CRC(unsigned char *buf, int len)
{
return 0;
}

View file

@ -78,6 +78,7 @@
#define GAMESETTING_ANIMATEDCHARACTER 0x00008000
#define GAMESETTING_PS3EULAREAD 0x00010000
#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000
#define GAMESETTING_FULLSCREEN 0x00040000
// defines for languages

View file

@ -175,6 +175,8 @@ enum eGameSetting
// PSVita
eGameSetting_PSVita_NetworkModeAdhoc,
// Windows64
eGameSetting_Fullscreen,
};

View file

@ -756,6 +756,9 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
// PS3DEC13
SetGameSettings(iPad,eGameSetting_PS3_EULA_Read,0); // EULA not read
// Windows64
SetGameSettings(iPad,eGameSetting_Fullscreen,1); // fullscreen on by default
// PS3 1.05 - added Greek
GameSettingsA[iPad]->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language
//#endif
@ -1378,6 +1381,9 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_PSVita_NetworkModeAdhoc:
//nothing to do here
break;
case eGameSetting_Fullscreen:
//nothing to do here
break;
}
}
@ -2047,6 +2053,21 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV
GameSettingsA[iPad]->bSettingsChanged=true;
}
break;
case eGameSetting_Fullscreen:
if((GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_FULLSCREEN)!=((ucVal&0x01)<<18))
{
if(ucVal==1)
{
GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_FULLSCREEN;
}
else
{
GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_FULLSCREEN;
}
ActionGameSettings(iPad,eVal);
GameSettingsA[iPad]->bSettingsChanged=true;
}
break;
}
}
@ -2173,6 +2194,9 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_PSVita_NetworkModeAdhoc:
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17;
case eGameSetting_Fullscreen:
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_FULLSCREEN)>>18;
}
return 0;
}

View file

@ -1491,7 +1491,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void *
// 4J Stu - All our flash controls that allow replacing textures use a special 64x64 symbol
// Force this size here so that our images don't get scaled wildly
#if (defined __ORBIS__ || defined _DURANGO )
#if (defined __ORBIS__ || defined _DURANGO || defined _WIN64)
*width = 96;
*height = 96;
#else

View file

@ -60,7 +60,7 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu(int iPad, voi
m_saveDetails = NULL;
m_iSaveDetailsCount = 0;
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO)
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64)
// Always clear the saves when we enter this menu
StorageManager.ClearSavesInfo();
#endif

View file

@ -191,7 +191,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
else
{
#if defined(__PS3__) || defined(__ORBIS__)|| defined(_DURANGO) || defined (__PSVITA__)
#if defined(__PS3__) || defined(__ORBIS__)|| defined(_DURANGO) || defined (__PSVITA__) || defined(_WINDOWS64)
// convert to utf16
uint16_t u16Message[MAX_SAVEFILENAME_LENGTH];
size_t srclen,dstlen;
@ -202,6 +202,10 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye
#elif defined(_DURANGO)
// Already utf16 on durango
memcpy(u16Message,params->saveDetails->UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH);
#elif defined(_WINDOWS64)
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
params->saveDetails->UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH,
(wchar_t *)u16Message, MAX_SAVEFILENAME_LENGTH);
#else // __ORBIS__
{
SceCesUcsContext Context;

View file

@ -158,7 +158,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer
}
#endif
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO)
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64)
// Always clear the saves when we enter this menu
StorageManager.ClearSavesInfo();
#endif
@ -1174,7 +1174,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo
// check the name is valid
if(ui16Text[0]!=0)
{
#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__))
#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__) || defined(_WINDOWS64))
// open the save and overwrite the metadata
StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass);
#endif

View file

@ -18,7 +18,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"Fullscreen");
m_checkboxFullscreen.init(TempString,eControl_Fullscreen,false);
m_checkboxFullscreen.init(TempString,eControl_Fullscreen,(app.GetGameSettings(m_iPad,eGameSetting_Fullscreen)!=0));
swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),app.GetGameSettings(m_iPad,eGameSetting_Gamma));
@ -116,7 +116,19 @@ void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, b
app.SetGameSettings(m_iPad,eGameSetting_BedrockFog,m_checkboxBedrockFog.IsChecked()?1:0);
app.SetGameSettings(m_iPad,eGameSetting_CustomSkinAnim,m_checkboxCustomSkinAnim.IsChecked()?1:0);
// toggle fullscreen stuff here
// toggle fullscreen
{
bool wantFullscreen = m_checkboxFullscreen.IsChecked();
bool wasFullscreen = (app.GetGameSettings(m_iPad,eGameSetting_Fullscreen)!=0);
app.SetGameSettings(m_iPad,eGameSetting_Fullscreen,wantFullscreen?1:0);
if(wantFullscreen != wasFullscreen)
{
#ifdef _WINDOWS64
extern void ToggleFullscreen();
ToggleFullscreen();
#endif
}
}
navigateBack();
handled = true;
@ -161,11 +173,14 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal
break;
case eControl_FOV:
{
int fovValue = (int)currentValue;
m_sliderFov.handleSliderMove(fovValue);
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->gameRenderer->SetFovVal((float)currentValue);
WCHAR TempString[256];
swprintf( (WCHAR *)TempString, 256, L"FOV: %d", (int)currentValue);
swprintf( (WCHAR *)TempString, 256, L"FOV: %d", fovValue);
m_sliderFov.setLabel(TempString);
}
break;

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
@ -348,6 +348,15 @@
<Filter Include="Windows64\4JLibs\Media">
<UniqueIdentifier>{e634a43c-ee4c-4adc-8847-c667fdc73c5f}</UniqueIdentifier>
</Filter>
<Filter Include="Windows64\4JLibs\Storage">
<UniqueIdentifier>{a1b2c3d4-e5f6-7890-abcd-ef0123456789}</UniqueIdentifier>
</Filter>
<Filter Include="Windows64\4JLibs\Render">
<UniqueIdentifier>{b2c3d4e5-f6a7-8901-bcde-f01234567890}</UniqueIdentifier>
</Filter>
<Filter Include="Windows64\4JLibs\Render\libpng">
<UniqueIdentifier>{c3d4e5f6-a7b8-9012-cdef-012345678901}</UniqueIdentifier>
</Filter>
<Filter Include="Windows64\GameConfig">
<UniqueIdentifier>{71d6ccac-7a6e-4399-987b-06b606056f59}</UniqueIdentifier>
</Filter>
@ -4779,6 +4788,84 @@
<ClCompile Include="Windows64\Windows64_App.cpp">
<Filter>Windows64</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Storage\4J_Storage.cpp">
<Filter>Windows64\4JLibs\Storage</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Storage\STO_Main.cpp">
<Filter>Windows64\4JLibs\Storage</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Storage\STO_SaveGame.cpp">
<Filter>Windows64\4JLibs\Storage</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Storage\STO_DLC.cpp">
<Filter>Windows64\4JLibs\Storage</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\4J_Render.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererCBuff.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererCore.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererMatrix.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererState.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererTexture.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\RendererVertex.cpp">
<Filter>Windows64\4JLibs\Render</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\png.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngerror.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngget.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngmem.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngpread.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngread.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngrio.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngrtran.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngrutil.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngset.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngtrans.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngwio.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngwrite.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngwtran.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows_Libs\Dev\Render\libpng\pngwutil.c">
<Filter>Windows64\4JLibs\Render\libpng</Filter>
</ClCompile>
<ClCompile Include="Windows64\Network\WinsockNetLayer.cpp">
<Filter>Windows64</Filter>
</ClCompile>
@ -6020,4 +6107,4 @@
<ItemGroup>
<Xml Include="Durango\manifest.xml" />
</ItemGroup>
</Project>
</Project>

View file

@ -149,7 +149,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
//localIp = settings->getString(L"server-ip", L"");
//onlineMode = settings->getBoolean(L"online-mode", true);
//motd = settings->getString(L"motd", L"A Minecraft Server");
//motd.replace('§', '$');
//motd.replace('<EFBFBD>', '$');
setAnimals(settings->getBoolean(L"spawn-animals", true));
setNpcsEnabled(settings->getBoolean(L"spawn-npcs", true));
@ -925,7 +925,7 @@ void MinecraftServer::stopServer()
// On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete
// the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving.
#if defined(_DURANGO) || defined(__ORBIS__) || defined(__PSVITA__)
#if defined(_DURANGO) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_WINDOWS64)
while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle )
{
Sleep(10);

View file

@ -14,6 +14,7 @@ CConsoleMinecraftApp app;
CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
{
memset(&m_ThumbnailBuffer, 0, sizeof(ImageFileBuffer));
}
void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId)
@ -35,12 +36,32 @@ void CConsoleMinecraftApp::FatalLoadError()
void CConsoleMinecraftApp::CaptureSaveThumbnail()
{
RenderManager.CaptureThumbnail(&m_ThumbnailBuffer);
}
void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize)
{
if (m_ThumbnailBuffer.Allocated())
{
if (pbData)
{
*pbData = new BYTE[m_ThumbnailBuffer.GetBufferSize()];
*pdwSize = m_ThumbnailBuffer.GetBufferSize();
memcpy(*pbData, m_ThumbnailBuffer.GetBufferPointer(), *pdwSize);
}
m_ThumbnailBuffer.Release();
}
else
{
if (pbData) *pbData = NULL;
if (pdwSize) *pdwSize = 0;
}
}
void CConsoleMinecraftApp::ReleaseSaveThumbnail()
{
if (m_ThumbnailBuffer.Allocated())
{
m_ThumbnailBuffer.Release();
}
}
void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)

View file

@ -29,6 +29,8 @@ public:
// original code
virtual void TemporaryCreateGameStart();
ImageFileBuffer m_ThumbnailBuffer;
};
extern CConsoleMinecraftApp app;

View file

@ -423,6 +423,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (vk == VK_F11)
{
ToggleFullscreen();
app.SetGameSettings(0, eGameSetting_Fullscreen, g_isFullscreen ? 1 : 0);
break;
}
if (vk == VK_SHIFT)
@ -969,6 +970,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
#endif
StorageManager.Init(1, app.GetString(IDS_DEFAULT_SAVENAME), "savegame.dat", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, "MinecraftWindows64");
StorageManager.SetMaxSaves(99);
StorageManager.StoreTMSPathName();
// Ensure the GameHDD save directory exists at runtime (the 4J_Storage lib expects it)
{
wchar_t exePath[MAX_PATH];
@ -1052,6 +1058,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
app.InitGameSettings();
if(app.GetGameSettings(eGameSetting_Fullscreen) != 0)
{
if(!g_isFullscreen)
{
ToggleFullscreen();
}
}
#if 0
//bool bDisplayPauseMenu=false;

435
Minecraft.Client/Windows_Libs/.gitignore vendored Normal file
View file

@ -0,0 +1,435 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.env
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Dd]ebug/x64/
[Dd]ebugPublic/x64/
[Rr]elease/x64/
[Rr]eleases/x64/
bin/x64/
obj/x64/
[Dd]ebug/x86/
[Dd]ebugPublic/x86/
[Rr]elease/x86/
[Rr]eleases/x86/
bin/x86/
obj/x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
[Aa][Rr][Mm]64[Ee][Cc]/
bld/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Build results on 'Bin' directories
**/[Bb]in/*
# Uncomment if you have tasks that rely on *.refresh files to move binaries
# (https://github.com/github/gitignore/pull/3736)
#!**/[Bb]in/*.refresh
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.trx
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Approval Tests result files
*.received.*
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.idb
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
**/.paket/paket.exe
paket-files/
# FAKE - F# Make
**/.fake/
# CodeRush personal settings
**/.cr/personal
# Python Tools for Visual Studio (PTVS)
**/__pycache__/
*.pyc
# Cake - Uncomment if you are using it
#tools/**
#!tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
MSBuild_Logs/
# AWS SAM Build and Temporary Artifacts folder
.aws-sam
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
**/.mfractor/
# Local History for Visual Studio
**/.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
**/.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
4J_Input.h
4J_Storage.h
4J_Render.h
4J_Profile.h
extraX64.h

View file

@ -0,0 +1,13 @@
# Format Style Options - Created with Clang Power Tools
---
AccessModifierOffset: -4
AlignConsecutiveMacros: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortEnumsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
ColumnLimit: 150
EmptyLineBeforeAccessModifier: Never
IndentAccessModifiers: false
IndentWidth: 4
NamespaceIndentation: All
BreakBeforeBraces: Allman

View file

@ -0,0 +1,10 @@
<Solution>
<Configurations>
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Project Path="Input/Input.vcxproj" Id="258f8cf7-6317-480d-b07d-52a6846adf67" />
<Project Path="Profile/Profile.vcxproj" Id="d68297b9-ca86-4a8c-b81f-61811d7f96b8" />
<Project Path="Render/Render.vcxproj" Id="cc99eb47-7231-4067-8717-c6bf4abde338" />
<Project Path="Storage/Storage.vcxproj" Id="6ded1618-2ada-4d72-a11f-425e83c7042e" />
</Solution>

View file

@ -0,0 +1,503 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "4J_Render.h"
#include "Renderer.h"
C4JRender RenderManager;
void C4JRender::Tick()
{
InternalRenderManager.CBuffTick();
}
void C4JRender::UpdateGamma(unsigned short usGamma)
{
InternalRenderManager.UpdateGamma(usGamma);
}
void C4JRender::MatrixMode(int type)
{
InternalRenderManager.MatrixMode(type);
}
void C4JRender::MatrixSetIdentity()
{
InternalRenderManager.MatrixSetIdentity();
}
void C4JRender::MatrixTranslate(float x, float y, float z)
{
InternalRenderManager.MatrixTranslate(x, y, z);
}
void C4JRender::MatrixRotate(float angle, float x, float y, float z)
{
InternalRenderManager.MatrixRotate(angle, x, y, z);
}
void C4JRender::MatrixScale(float x, float y, float z)
{
InternalRenderManager.MatrixScale(x, y, z);
}
void C4JRender::MatrixPerspective(float fovy, float aspect, float zNear, float zFar)
{
InternalRenderManager.MatrixPerspective(fovy, aspect, zNear, zFar);
}
void C4JRender::MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar)
{
InternalRenderManager.MatrixOrthogonal(left, right, bottom, top, zNear, zFar);
}
void C4JRender::MatrixPop()
{
InternalRenderManager.MatrixPop();
}
void C4JRender::MatrixPush()
{
InternalRenderManager.MatrixPush();
}
void C4JRender::MatrixMult(float* mat)
{
InternalRenderManager.MatrixMult(mat);
}
const float* C4JRender::MatrixGet(int type)
{
return InternalRenderManager.MatrixGet(type);
}
void C4JRender::Set_matrixDirty()
{
InternalRenderManager.Set_matrixDirty();
}
void C4JRender::Initialise(ID3D11Device* pDevice, IDXGISwapChain* pSwapChain)
{
InternalRenderManager.Initialise(pDevice, pSwapChain);
}
void C4JRender::InitialiseContext()
{
InternalRenderManager.InitialiseContext(false);
}
void C4JRender::StartFrame()
{
InternalRenderManager.StartFrame();
}
void C4JRender::DoScreenGrabOnNextPresent()
{
InternalRenderManager.DoScreenGrabOnNextPresent();
}
void C4JRender::Present()
{
InternalRenderManager.Present();
}
void C4JRender::Clear(int flags, D3D11_RECT* pRect)
{
InternalRenderManager.Clear(flags, pRect);
}
void C4JRender::SetClearColour(const float colourRGBA[4])
{
InternalRenderManager.SetClearColour(colourRGBA);
}
bool C4JRender::IsWidescreen()
{
return InternalRenderManager.IsWidescreen();
}
bool C4JRender::IsHiDef()
{
return InternalRenderManager.IsHiDef();
}
void C4JRender::CaptureThumbnail(ImageFileBuffer* pngOut)
{
InternalRenderManager.CaptureThumbnail(pngOut);
}
void C4JRender::CaptureScreen(ImageFileBuffer* jpgOut, XSOCIAL_PREVIEWIMAGE* previewOut)
{
InternalRenderManager.CaptureScreen(jpgOut, previewOut);
}
void C4JRender::BeginConditionalSurvey(int identifier)
{
InternalRenderManager.BeginConditionalSurvey(identifier);
}
void C4JRender::EndConditionalSurvey()
{
InternalRenderManager.EndConditionalSurvey();
}
void C4JRender::BeginConditionalRendering(int identifier)
{
InternalRenderManager.BeginConditionalRendering(identifier);
}
void C4JRender::EndConditionalRendering()
{
InternalRenderManager.EndConditionalRendering();
}
void C4JRender::DrawVertices(ePrimitiveType PrimitiveType, int count, void* dataIn, eVertexType vType, ePixelShaderType psType)
{
InternalRenderManager.DrawVertices(PrimitiveType, count, dataIn, vType, psType);
}
void C4JRender::DrawVertexBuffer(ePrimitiveType PrimitiveType, int count, ID3D11Buffer* buffer, eVertexType vType, ePixelShaderType psType)
{
InternalRenderManager.DrawVertexBuffer(PrimitiveType, count, buffer, vType, psType);
}
void C4JRender::CBuffLockStaticCreations()
{
InternalRenderManager.CBuffLockStaticCreations();
}
int C4JRender::CBuffCreate(int count)
{
return InternalRenderManager.CBuffCreate(count);
}
void C4JRender::CBuffDelete(int first, int count)
{
InternalRenderManager.CBuffDelete(first, count);
}
void C4JRender::CBuffStart(int index, bool full)
{
InternalRenderManager.CBuffStart(index, full);
}
void C4JRender::CBuffClear(int index)
{
InternalRenderManager.CBuffClear(index);
}
int C4JRender::CBuffSize(int index)
{
return InternalRenderManager.CBuffSize(index);
}
void C4JRender::CBuffEnd()
{
InternalRenderManager.CBuffEnd();
}
bool C4JRender::CBuffCall(int index, bool full)
{
return InternalRenderManager.CBuffCall(index, full);
}
void C4JRender::CBuffTick()
{
InternalRenderManager.CBuffTick();
}
void C4JRender::CBuffDeferredModeStart()
{
InternalRenderManager.CBuffDeferredModeStart();
}
void C4JRender::CBuffDeferredModeEnd()
{
InternalRenderManager.CBuffDeferredModeEnd();
}
int C4JRender::TextureCreate()
{
return InternalRenderManager.TextureCreate();
}
void C4JRender::TextureFree(int idx)
{
InternalRenderManager.TextureFree(idx);
}
void C4JRender::TextureBind(int idx)
{
InternalRenderManager.TextureBind(idx);
}
void C4JRender::TextureBindVertex(int idx)
{
InternalRenderManager.TextureBindVertex(idx);
}
void C4JRender::TextureSetTextureLevels(int levels)
{
InternalRenderManager.TextureSetTextureLevels(levels);
}
int C4JRender::TextureGetTextureLevels()
{
return InternalRenderManager.TextureGetTextureLevels();
}
void C4JRender::TextureData(int width, int height, void* data, int level, eTextureFormat format)
{
InternalRenderManager.TextureData(width, height, data, level, format);
}
void C4JRender::TextureDataUpdate(int xoffset, int yoffset, int width, int height, void* data, int level)
{
InternalRenderManager.TextureDataUpdate(xoffset, yoffset, width, height, data, level);
}
void C4JRender::TextureSetParam(int param, int value)
{
InternalRenderManager.TextureSetParam(param, value);
}
void C4JRender::TextureDynamicUpdateStart()
{
InternalRenderManager.TextureDynamicUpdateStart();
}
void C4JRender::TextureDynamicUpdateEnd()
{
InternalRenderManager.TextureDynamicUpdateEnd();
}
HRESULT C4JRender::LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
return InternalRenderManager.LoadTextureData(szFilename, pSrcInfo, ppDataOut);
}
HRESULT C4JRender::LoadTextureData(BYTE* pbData, DWORD dwBytes, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
return InternalRenderManager.LoadTextureData(pbData, dwBytes, pSrcInfo, ppDataOut);
}
HRESULT C4JRender::SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int* ppDataOut)
{
return InternalRenderManager.SaveTextureData(szFilename, pSrcInfo, ppDataOut);
}
HRESULT C4JRender::SaveTextureDataToMemory(void* pOutput, int outputCapacity, int* outputLength, int width, int height, int* ppDataIn)
{
return InternalRenderManager.SaveTextureDataToMemory(pOutput, outputCapacity, outputLength, width, height, ppDataIn);
}
void C4JRender::TextureGetStats()
{
}
ID3D11ShaderResourceView* C4JRender::TextureGetTexture(int idx)
{
return InternalRenderManager.TextureGetTexture(idx);
}
void C4JRender::StateSetColour(float r, float g, float b, float a)
{
InternalRenderManager.StateSetColour(r, g, b, a);
}
void C4JRender::StateSetDepthMask(bool enable)
{
InternalRenderManager.StateSetDepthMask(enable);
}
void C4JRender::StateSetBlendEnable(bool enable)
{
InternalRenderManager.StateSetBlendEnable(enable);
}
void C4JRender::StateSetBlendFunc(int src, int dst)
{
InternalRenderManager.StateSetBlendFunc(src, dst);
}
void C4JRender::StateSetBlendFactor(unsigned int colour)
{
InternalRenderManager.StateSetBlendFactor(colour);
}
void C4JRender::StateSetAlphaFunc(int func, float param)
{
InternalRenderManager.StateSetAlphaFunc(func, param);
}
void C4JRender::StateSetDepthFunc(int func)
{
InternalRenderManager.StateSetDepthFunc(func);
}
void C4JRender::StateSetFaceCull(bool enable)
{
InternalRenderManager.StateSetFaceCull(enable);
}
void C4JRender::StateSetFaceCullCW(bool enable)
{
InternalRenderManager.StateSetFaceCullCW(enable);
}
void C4JRender::StateSetLineWidth(float width)
{
InternalRenderManager.StateSetLineWidth(width);
}
void C4JRender::StateSetWriteEnable(bool red, bool green, bool blue, bool alpha)
{
InternalRenderManager.StateSetWriteEnable(red, green, blue, alpha);
}
void C4JRender::StateSetDepthTestEnable(bool enable)
{
InternalRenderManager.StateSetDepthTestEnable(enable);
}
void C4JRender::StateSetAlphaTestEnable(bool enable)
{
InternalRenderManager.StateSetAlphaTestEnable(enable);
}
void C4JRender::StateSetDepthSlopeAndBias(float slope, float bias)
{
InternalRenderManager.StateSetDepthSlopeAndBias(slope, bias);
}
void C4JRender::StateSetFogEnable(bool enable)
{
InternalRenderManager.StateSetFogEnable(enable);
}
void C4JRender::StateSetFogMode(int mode)
{
InternalRenderManager.StateSetFogMode(mode);
}
void C4JRender::StateSetFogNearDistance(float dist)
{
InternalRenderManager.StateSetFogNearDistance(dist);
}
void C4JRender::StateSetFogFarDistance(float dist)
{
InternalRenderManager.StateSetFogFarDistance(dist);
}
void C4JRender::StateSetFogDensity(float density)
{
InternalRenderManager.StateSetFogDensity(density);
}
void C4JRender::StateSetFogColour(float red, float green, float blue)
{
InternalRenderManager.StateSetFogColour(red, green, blue);
}
void C4JRender::StateSetLightingEnable(bool enable)
{
InternalRenderManager.StateSetLightingEnable(enable);
}
void C4JRender::StateSetVertexTextureUV(float u, float v)
{
InternalRenderManager.StateSetVertexTextureUV(u, v);
}
void C4JRender::StateSetLightColour(int light, float red, float green, float blue)
{
InternalRenderManager.StateSetLightColour(light, red, green, blue);
}
void C4JRender::StateSetLightAmbientColour(float red, float green, float blue)
{
InternalRenderManager.StateSetLightAmbientColour(red, green, blue);
}
void C4JRender::StateSetLightDirection(int light, float x, float y, float z)
{
InternalRenderManager.StateSetLightDirection(light, x, y, z);
}
void C4JRender::StateSetLightEnable(int light, bool enable)
{
InternalRenderManager.StateSetLightEnable(light, enable);
}
void C4JRender::StateSetViewport(eViewportType viewportType)
{
InternalRenderManager.StateSetViewport(viewportType);
}
void C4JRender::StateSetEnableViewportClipPlanes(bool enable)
{
InternalRenderManager.StateSetEnableViewportClipPlanes(enable);
}
void C4JRender::StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace)
{
InternalRenderManager.StateSetTexGenCol(col, x, y, z, w, eyeSpace);
}
void C4JRender::StateSetStencil(int Function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask)
{
InternalRenderManager.StateSetStencil((D3D11_COMPARISON_FUNC)Function, stencil_ref, stencil_func_mask, stencil_write_mask);
}
void C4JRender::StateSetForceLOD(int LOD)
{
InternalRenderManager.StateSetForceLOD(LOD);
}
void C4JRender::BeginEvent(LPCWSTR eventName)
{
InternalRenderManager.BeginEvent(eventName);
}
void C4JRender::EndEvent()
{
InternalRenderManager.EndEvent();
}
void C4JRender::Suspend()
{
InternalRenderManager.Suspend();
}
bool C4JRender::Suspended()
{
return InternalRenderManager.Suspended();
}
void C4JRender::Resume()
{
InternalRenderManager.Resume();
}

View file

@ -0,0 +1,39 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Vertex shaders
#include "VS_PF3_TF2_CB4_NB4_XW1.h"
#include "VS_PF3_TF2_CB4_NB4_XW1_Lighting.h"
#include "VS_PF3_TF2_CB4_NB4_XW1_TexGen.h"
#include "VS_Compressed.h"
#include "VS_ScreenClear.h"
#include "VS_ScreenSpace.h"
// Pixel shaders
#include "PS_ForceLOD.h"
#include "PS_ScreenClear.h"
#include "PS_ScreenSpace.h"
#include "PS_Standard.h"
#include "PS_TextureProjection.h"

View file

@ -0,0 +1,187 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : SV_POSITION0,
float4 vCol : COLOR0,
linear centroid float4 vTex : TEXCOORD0,
out float4 oCol : SV_TARGET0)
{
float4 texColor = diffuse_texture.SampleLevel(diffuse_sampler_s, vTex.xy, forcedLod.x);
texColor *= diffuse_colour;
texColor.w *= vCol.w;
if (texColor.w < alphaTestRef.w) discard;
float3 finalColor = texColor.xyz * vCol.xyz;
oCol.xyz = lerp(fog_colour.xyz, finalColor, vTex.z);
oCol.w = texColor.w;
}
*/
static unsigned char g_main_PS_ForceLOD[] =
{
0x44, 0x58, 0x42, 0x43, 0x8A, 0x1E, 0x45, 0x87, 0xE0, 0xB2,
0xDE, 0x2C, 0x00, 0x06, 0x9B, 0x08, 0x7F, 0x92, 0xEA, 0xE6,
0x01, 0x00, 0x00, 0x00, 0x54, 0x05, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00,
0x08, 0x03, 0x00, 0x00, 0x3C, 0x03, 0x00, 0x00, 0xD8, 0x04,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x58, 0x02, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x1C, 0x01, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, 0xDC, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xEC, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x5F, 0x73, 0x61,
0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00, 0x64, 0x69, 0x66, 0x66,
0x75, 0x73, 0x65, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x00,
0x66, 0x6F, 0x67, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x54,
0x65, 0x73, 0x74, 0x00, 0x66, 0x6F, 0x72, 0x63, 0x65, 0x64,
0x4C, 0x4F, 0x44, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x7C, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xB4, 0x01, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xD8, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x94, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x64, 0x69, 0x66, 0x66, 0x75, 0x73,
0x65, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB,
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xA4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x66, 0x6F, 0x67, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x75, 0x72,
0x00, 0xAB, 0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6C, 0x70, 0x68,
0x61, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x66, 0x00, 0xAB,
0xAB, 0xAB, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA4, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6F, 0x72, 0x63,
0x65, 0x64, 0x4C, 0x6F, 0x64, 0x00, 0x4D, 0x69, 0x63, 0x72,
0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20,
0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65,
0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72,
0x20, 0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30,
0x2E, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xAB, 0xAB, 0xAB,
0x49, 0x53, 0x47, 0x4E, 0x6C, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0F, 0x0F, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x0F, 0x07, 0x00, 0x00, 0x53, 0x56,
0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00,
0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43,
0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E,
0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54,
0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xAB, 0xAB, 0x53, 0x48,
0x44, 0x52, 0x94, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5A, 0x00,
0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03,
0xF2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x18,
0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x0C, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x46, 0x7E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3A, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00,
0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x80,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x04, 0x03, 0x0A, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0B, 0x72, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x82, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA6, 0x1A,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05,
0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,95 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : SV_POSITION0,
out float4 oCol : SV_TARGET0)
{
oCol = clear_colour;
}
*/
static unsigned char g_main_PS_ScreenClear[] =
{
0x44, 0x58, 0x42, 0x43, 0xF5, 0xD0, 0x7D, 0x98, 0xF4, 0x78,
0x62, 0xB1, 0x25, 0x1A, 0x74, 0x57, 0xF0, 0x48, 0x57, 0x90,
0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00,
0x38, 0x01, 0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0xB4, 0x01,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xC8, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x63, 0x62, 0x75, 0x66, 0x66, 0x00, 0xAB, 0xAB, 0x3C, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x84, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6C, 0x65, 0x61,
0x72, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB,
0xAB, 0xAB, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x69,
0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52,
0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61,
0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C,
0x65, 0x72, 0x20, 0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32,
0x30, 0x30, 0x2E, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xAB,
0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F,
0x4E, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x41, 0x52, 0x47, 0x45,
0x54, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x40, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x04, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03,
0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x06, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,101 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : SV_POSITION0,
float2 vTex : TEXCOORD0,
out float4 oCol : SV_TARGET0)
{
oCol = screen_texture.Sample(screen_sampler_s, vTex);
}
*/
static unsigned char g_main_PS_ScreenSpace[] =
{
0x44, 0x58, 0x42, 0x43, 0xB8, 0xC0, 0x6E, 0x7D, 0xDE, 0x9F,
0x85, 0xBA, 0x86, 0xB9, 0x41, 0xAB, 0xCA, 0x09, 0x13, 0x95,
0x01, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00,
0x44, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0xE4, 0x01,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xB0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x5C, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x6B, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x5F, 0x73,
0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00, 0x73, 0x63, 0x72,
0x65, 0x65, 0x6E, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C,
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F,
0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x33,
0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E, 0x31, 0x36, 0x33,
0x38, 0x34, 0x00, 0xAB, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E,
0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F,
0x4E, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0xAB, 0xAB, 0xAB, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x41, 0x52,
0x47, 0x45, 0x54, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52,
0x64, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x19, 0x00,
0x00, 0x00, 0x5A, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xF2, 0x20,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x7E, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,191 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : SV_POSITION0,
float4 vCol : COLOR0,
linear centroid float4 vTex : TEXCOORD0,
out float4 oCol : SV_TARGET0)
{
float4 texColor;
if (vTex.x > 1.0) {
texColor = diffuse_texture.SampleLevel(diffuse_sampler_s, vTex.xy, 0);
} else {
texColor = diffuse_texture.Sample(diffuse_sampler_s, vTex.xy);
}
texColor *= diffuse_colour;
texColor.w *= vCol.w;
if (texColor.w < alphaTestRef.w) discard;
float3 finalColor = texColor.xyz * vCol.xyz;
// Fog lerping: vTex.z contains the fog blend factor
oCol.xyz = lerp(fog_colour.xyz, finalColor, vTex.z);
oCol.w = texColor.w;
}
*/
static unsigned char g_main_PS_Standard[] =
{
0x44, 0x58, 0x42, 0x43, 0x3E, 0xD7, 0x47, 0x3D, 0x43, 0x30,
0xB0, 0x7E, 0x8F, 0xF4, 0xBD, 0xA7, 0xCA, 0xCF, 0x70, 0x12,
0x01, 0x00, 0x00, 0x00, 0x2C, 0x05, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x2C, 0x02, 0x00, 0x00,
0xA0, 0x02, 0x00, 0x00, 0xD4, 0x02, 0x00, 0x00, 0xB0, 0x04,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x01, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF,
0x00, 0x01, 0x00, 0x00, 0xBD, 0x01, 0x00, 0x00, 0xBC, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xCC, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x69,
0x66, 0x66, 0x75, 0x73, 0x65, 0x5F, 0x73, 0x61, 0x6D, 0x70,
0x6C, 0x65, 0x72, 0x00, 0x64, 0x69, 0x66, 0x66, 0x75, 0x73,
0x65, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00,
0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x00, 0x66, 0x6F,
0x67, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x54, 0x65, 0x73,
0x74, 0x00, 0xAB, 0xAB, 0xDC, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x98, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x5F, 0x63, 0x6F,
0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x64, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6F, 0x67, 0x5F,
0x63, 0x6F, 0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB, 0xB0, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x54, 0x65, 0x73,
0x74, 0x52, 0x65, 0x66, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F,
0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48,
0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20,
0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E,
0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0x49, 0x53, 0x47, 0x4E,
0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0F, 0x07, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53,
0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F,
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x41, 0x52, 0x47, 0x45,
0x54, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52, 0xD4, 0x01,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5A, 0x00,
0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03,
0xF2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x18,
0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x31, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x0A, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1F, 0x00,
0x04, 0x03, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x0B, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x46, 0x7E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x01, 0x45, 0x00,
0x00, 0x09, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x38, 0x00,
0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3A, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00,
0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x80,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x04, 0x03, 0x0A, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0B, 0x72, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x82, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA6, 0x1A,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05,
0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x0E, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,177 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : SV_POSITION0,
float4 vCol : COLOR0,
linear centroid float4 vTex : TEXCOORD0,
out float4 oCol : SV_TARGET0)
{
float2 projUV = vTex.xy / vTex.ww;
float4 texColor = diffuse_texture.Sample(diffuse_sampler_s, projUV);
texColor *= diffuse_colour;
texColor.w *= vCol.w;
if (texColor.w < alphaTestRef.w) discard;
float3 finalColor = texColor.xyz * vCol.xyz;
oCol.xyz = lerp(fog_colour.xyz, finalColor, vTex.z);
oCol.w = texColor.w;
}
*/
static unsigned char g_main_PS_TextureProjection[] =
{
0x44, 0x58, 0x42, 0x43, 0x31, 0x2E, 0x38, 0xEB, 0x1E, 0x13,
0x9F, 0xFA, 0xC3, 0x6B, 0xC2, 0x09, 0xD6, 0xCC, 0xBF, 0x4E,
0x01, 0x00, 0x00, 0x00, 0xEC, 0x04, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x2C, 0x02, 0x00, 0x00,
0xA0, 0x02, 0x00, 0x00, 0xD4, 0x02, 0x00, 0x00, 0x70, 0x04,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x01, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF,
0x00, 0x01, 0x00, 0x00, 0xBD, 0x01, 0x00, 0x00, 0xBC, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xCC, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x69,
0x66, 0x66, 0x75, 0x73, 0x65, 0x5F, 0x73, 0x61, 0x6D, 0x70,
0x6C, 0x65, 0x72, 0x00, 0x64, 0x69, 0x66, 0x66, 0x75, 0x73,
0x65, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00,
0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x00, 0x66, 0x6F,
0x67, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x54, 0x65, 0x73,
0x74, 0x00, 0xAB, 0xAB, 0xDC, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x98, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x5F, 0x63, 0x6F,
0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x64, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6F, 0x67, 0x5F,
0x63, 0x6F, 0x6C, 0x6F, 0x75, 0x72, 0x00, 0xAB, 0xB0, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x54, 0x65, 0x73,
0x74, 0x52, 0x65, 0x66, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F,
0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48,
0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20,
0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E,
0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0x49, 0x53, 0x47, 0x4E,
0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0F, 0x0F, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53,
0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F,
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x41, 0x52, 0x47, 0x45,
0x54, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x94, 0x01,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5A, 0x00,
0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03,
0xF2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x18,
0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x0E, 0x00, 0x00, 0x07, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0xF6, 0x1F, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x45, 0x00,
0x00, 0x09, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07,
0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x08, 0x12, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x80, 0x20, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x04, 0x03,
0x0A, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0B, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x80,
0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0x72, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA6, 0x1A, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x82, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x74, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,37 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// enable only if you know what you're doing
// requires linking Minecraft.Client against Ws2_32.lib
// stats are available at http://127.0.0.1:1338/
//#define ENABLE_PROFILING
#ifdef ENABLE_PROFILING
#include "microprofile/microprofile.h"
#define PROFILER_SCOPE(group, name, color) MICROPROFILE_SCOPEI(group, name, color);
#else
#define PROFILER_SCOPE(group, name, color) ((void)0);
#endif

View file

@ -0,0 +1,353 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>18.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{cc99eb47-7231-4067-8717-c6bf4abde338}</ProjectGuid>
<RootNamespace>render</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Render_PC</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>4J_$(ProjectName)_d</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>4J_$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>libpng\;zlib\;microprofile\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>libpng\;zlib\;microprofile\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="4J_Render.h" />
<ClInclude Include="CompiledShaders.h" />
<ClInclude Include="libpng\png.h" />
<ClInclude Include="libpng\pngconf.h" />
<ClInclude Include="libpng\pngdebug.h" />
<ClInclude Include="libpng\pnginfo.h" />
<ClInclude Include="libpng\pnglibconf.h" />
<ClInclude Include="libpng\pngpriv.h" />
<ClInclude Include="libpng\pngstruct.h" />
<ClInclude Include="microprofile\microprofile.h" />
<ClInclude Include="microprofile\microprofile_html.h" />
<ClInclude Include="microprofile\microprofile_icons.h" />
<ClInclude Include="Profiler.h" />
<ClInclude Include="PS_ForceLOD.h" />
<ClInclude Include="PS_ScreenClear.h" />
<ClInclude Include="PS_ScreenSpace.h" />
<ClInclude Include="PS_Standard.h" />
<ClInclude Include="PS_TextureProjection.h" />
<ClInclude Include="Renderer.h" />
<ClInclude Include="VS_Compressed.h" />
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1.h" />
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Lighting.h" />
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Texgen.h" />
<ClInclude Include="VS_ScreenClear.h" />
<ClInclude Include="VS_ScreenSpace.h" />
<ClInclude Include="zlib\zconf.h" />
<ClInclude Include="zlib\zlib.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="4J_Render.cpp" />
<ClCompile Include="libpng\png.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngerror.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngget.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngmem.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngpread.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngread.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngrio.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngrtran.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngrutil.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngset.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngtest.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngtrans.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngwio.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngwrite.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngwtran.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="libpng\pngwutil.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Default</CompileAs>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="microprofile\microprofile.cpp" />
<ClCompile Include="RendererCBuff.cpp" />
<ClCompile Include="RendererCore.cpp" />
<ClCompile Include="RendererMatrix.cpp" />
<ClCompile Include="RendererState.cpp" />
<ClCompile Include="RendererTexture.cpp" />
<ClCompile Include="RendererVertex.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Header Files\zlib">
<UniqueIdentifier>{e5716c14-38f4-49f7-bf1a-916fbc7613a8}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\libpng">
<UniqueIdentifier>{0681221a-1efa-43e4-b0f7-0b525172e486}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\libpng">
<UniqueIdentifier>{0629c87a-576d-4163-8c60-dad190ee97d0}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\microprofile">
<UniqueIdentifier>{8be558c7-c6e6-4ef7-bfcb-83d29f079240}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\microprofile">
<UniqueIdentifier>{6cbd8b95-ff51-42d2-a66f-282d3a11c042}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="4J_Render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PS_Standard.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PS_TextureProjection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PS_ForceLOD.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_ScreenClear.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_ScreenSpace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Lighting.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_PF3_TF2_CB4_NB4_XW1_Texgen.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="VS_Compressed.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CompiledShaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PS_ScreenClear.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PS_ScreenSpace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="zlib\zconf.h">
<Filter>Header Files\zlib</Filter>
</ClInclude>
<ClInclude Include="zlib\zlib.h">
<Filter>Header Files\zlib</Filter>
</ClInclude>
<ClInclude Include="libpng\png.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pngconf.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pngdebug.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pnginfo.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pnglibconf.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pngpriv.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="libpng\pngstruct.h">
<Filter>Header Files\libpng</Filter>
</ClInclude>
<ClInclude Include="microprofile\microprofile.h">
<Filter>Header Files\microprofile</Filter>
</ClInclude>
<ClInclude Include="microprofile\microprofile_html.h">
<Filter>Header Files\microprofile</Filter>
</ClInclude>
<ClInclude Include="microprofile\microprofile_icons.h">
<Filter>Header Files\microprofile</Filter>
</ClInclude>
<ClInclude Include="Profiler.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="4J_Render.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererCBuff.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererCore.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererMatrix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererState.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererTexture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RendererVertex.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="libpng\png.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngerror.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngget.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngmem.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngpread.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngread.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngrio.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngrtran.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngrutil.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngset.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngtest.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngtrans.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngwio.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngwrite.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngwtran.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="libpng\pngwutil.c">
<Filter>Source Files\libpng</Filter>
</ClCompile>
<ClCompile Include="microprofile\microprofile.cpp">
<Filter>Source Files\microprofile</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,476 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Render.h"
#include "Profiler.h"
#include <cstdint>
#include <unordered_map>
#include <vector>
#define MATRIX_MODE_MODELVIEW 0
#define MATRIX_MODE_MODELVIEW_PROJECTION 1
#define MATRIX_MODE_MODELVIEW_TEXTURE 2
#define MATRIX_MODE_MODELVIEW_CBUFF 3
#define MATRIX_MODE_MODELVIEW_MAX 4
#define STACK_TYPES 4
#define STACK_SIZE 16
#define MAX_MIP_LEVELS 5
#define MAX_TEXTURES 512
#define NUM_COMMAND_HANDLES 0x800000
#define MAX_COMMAND_BUFFERS 16000
class Renderer
{
public:
struct Context;
struct CommandBuffer;
void UpdateGamma(unsigned short usGamma);
void MatrixMode(int type);
void MatrixSetIdentity();
void MatrixTranslate(float x, float y, float z);
void MatrixRotate(float angle, float x, float y, float z);
void MatrixScale(float x, float y, float z);
void MatrixPerspective(float fovy, float aspect, float zNear, float zFar);
void MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar);
void MatrixPop();
void MatrixPush();
void MatrixMult(float *mat);
const float *MatrixGet(int type);
void Set_matrixDirty();
void Initialise(ID3D11Device *pDevice, IDXGISwapChain *pSwapChain);
ID3D11DeviceContext *InitialiseContext(bool fromPresent);
void StartFrame();
void DoScreenGrabOnNextPresent();
void Present();
void Clear(int flags, D3D11_RECT *pRect);
void SetClearColour(const float colourRGBA[4]);
bool IsWidescreen();
bool IsHiDef();
void CaptureThumbnail(ImageFileBuffer *pngOut);
void CaptureScreen(ImageFileBuffer *jpgOut, XSOCIAL_PREVIEWIMAGE *previewOut);
void BeginConditionalSurvey(int identifier);
void EndConditionalSurvey();
void BeginConditionalRendering(int identifier);
void EndConditionalRendering();
void DrawVertices(C4JRender::ePrimitiveType PrimitiveType, int count, void *dataIn, C4JRender::eVertexType vType,
C4JRender::ePixelShaderType psType);
void DrawVertexBuffer(C4JRender::ePrimitiveType PrimitiveType, int count, ID3D11Buffer *buffer, C4JRender::eVertexType vType,
C4JRender::ePixelShaderType psType);
void CBuffLockStaticCreations();
int CBuffCreate(int count);
void CBuffDelete(int first, int count);
void CBuffStart(int index, bool full);
void CBuffClear(int index);
int CBuffSize(int index);
void CBuffEnd();
bool CBuffCall(int index, bool full);
void CBuffTick();
void CBuffDeferredModeStart();
void CBuffDeferredModeEnd();
int TextureCreate();
void TextureFree(int idx);
void TextureBind(int idx);
void TextureBindVertex(int idx);
void TextureSetTextureLevels(int levels);
int TextureGetTextureLevels();
void TextureSetParam(int param, int value);
void TextureDynamicUpdateStart();
void TextureDynamicUpdateEnd();
void TextureData(int width, int height, void *data, int level, C4JRender::eTextureFormat format);
void TextureDataUpdate(int xoffset, int yoffset, int width, int height, void *data, int level);
HRESULT LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut);
HRESULT LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut);
HRESULT SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut);
HRESULT SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn);
void TextureGetStats();
ID3D11ShaderResourceView *TextureGetTexture(int idx);
void StateSetColour(float r, float g, float b, float a);
void StateSetDepthMask(bool enable);
void StateSetBlendEnable(bool enable);
void StateSetBlendFunc(int src, int dst);
void StateSetBlendFactor(unsigned int colour);
void StateSetAlphaFunc(int func, float param);
void StateSetDepthFunc(int func);
void StateSetFaceCull(bool enable);
void StateSetFaceCullCW(bool enable);
void StateSetLineWidth(float width);
void StateSetWriteEnable(bool red, bool green, bool blue, bool alpha);
void StateSetDepthTestEnable(bool enable);
void StateSetAlphaTestEnable(bool enable);
void StateSetDepthSlopeAndBias(float slope, float bias);
void StateSetFogEnable(bool enable);
void StateSetFogMode(int mode);
void StateSetFogNearDistance(float dist);
void StateSetFogFarDistance(float dist);
void StateSetFogDensity(float density);
void StateSetFogColour(float red, float green, float blue);
void StateSetLightingEnable(bool enable);
void StateSetVertexTextureUV(float u, float v);
void StateSetLightColour(int light, float red, float green, float blue);
void StateSetLightAmbientColour(float red, float green, float blue);
void StateSetLightDirection(int light, float x, float y, float z);
void StateSetLightEnable(int light, bool enable);
void StateSetViewport(C4JRender::eViewportType viewportType);
void StateSetEnableViewportClipPlanes(bool enable);
void StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace);
void StateSetStencil(D3D11_COMPARISON_FUNC function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask);
void StateSetForceLOD(int LOD);
void BeginEvent(LPCWSTR eventName);
void EndEvent();
void Suspend();
bool Suspended();
void Resume();
void StateUpdate();
private:
void SetupShaders();
void ConvertLinearToPng(ImageFileBuffer *pngOut, unsigned char *linearData, unsigned int width, unsigned int height);
void DrawVertexSetup(C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType, C4JRender::ePrimitiveType primitiveType, int *count,
bool *drawIndexed);
void UpdateTexGenState();
void UpdateLightingState();
void UpdateViewportState();
void UpdateFogState();
void UpdateTextureState(bool vertexSampler);
void MultWithStack(DirectX::XMMATRIX matrix);
ID3D11DepthStencilState *GetManagedDepthStencilState();
ID3D11BlendState *GetManagedBlendState();
ID3D11RasterizerState *GetManagedRasterizerState();
ID3D11SamplerState *GetManagedSamplerState();
void DeleteInternalBuffer(int index);
Renderer::Context &getContext();
public:
struct Texture
{
bool allocated;
ID3D11Texture2D *texture;
ID3D11ShaderResourceView *view;
DWORD textureFlags;
DWORD mipLevels;
DWORD textureFormat;
DWORD samplerParams;
};
struct TexgenCBuffer
{
DirectX::XMMATRIX unk0;
DirectX::XMMATRIX unk1;
};
enum eCommandType
{
COMMAND_ADD_MATRIX,
COMMAND_ADD_VERTICES,
COMMAND_BIND_TEXTURE,
COMMAND_SET_COLOR,
COMMAND_SET_DEPTH_FUNC,
COMMAND_SET_DEPTH_MASK,
COMMAND_SET_DEPTH_TEST,
COMMAND_SET_LIGHTING_ENABLE,
COMMAND_SET_LIGHT_ENABLE,
COMMAND_SET_LIGHT_DIRECTION,
COMMAND_SET_LIGHT_COLOUR,
COMMAND_SET_LIGHT_AMBIENT_COLOUR,
COMMAND_SET_BLEND_ENABLE,
COMMAND_SET_BLEND_FUNC,
COMMAND_SET_BLEND_FACTOR,
COMMAND_SET_FACE_CULL,
};
struct CommandBuffer
{
CommandBuffer(bool full);
~CommandBuffer();
void StartRecording();
void EndRecording(ID3D11Device *device);
std::uint64_t GetAllocated();
bool IsBusy();
void AddMatrix(const float *matrix);
void AddVertices(unsigned int stride, unsigned int count, void *dataIn, Renderer::Context &c);
void BindTexture(int idx);
void SetColor(float r, float g, float b, float a);
void SetDepthFunc(int func);
void SetDepthMask(bool enable);
void SetDepthTestEnable(bool enable);
void SetLightingEnable(bool enable);
void SetLightEnable(int light, bool enable);
void SetLightDirection(int light, float x, float y, float z);
void SetLightColour(int light, float r, float g, float b);
void SetLightAmbientColour(float r, float g, float b);
void SetBlendEnable(bool enable);
void SetBlendFunc(int src, int dst);
void SetBlendFactor(unsigned int factor);
void SetFaceCull(bool enable);
void Render(C4JRender::eVertexType vType, Renderer::Context &c, int primitiveType);
struct Command
{
Renderer::eCommandType m_command_type;
BYTE commandPadding[12];
union
{
BYTE data[64];
struct
{
float m_matrix[16];
// DirectX::XMMATRIX m_matrix;
} add_matrix;
struct
{
unsigned int m_vertex_index_start;
unsigned int m_vertex_count;
} add_vertices;
struct
{
unsigned int m_texture_index;
} bind_texture;
struct
{
float m_color[4];
} set_color;
struct
{
int m_depth_func;
} set_depth_func;
struct
{
bool m_enable;
} set_depth_mask;
struct
{
bool m_enable;
} set_depth_test;
struct
{
bool m_enable;
} set_lighting_enable;
struct
{
int m_light_index;
bool m_enable;
} set_light_enable;
struct
{
int m_light_index;
float padding[3];
float m_direction[4];
} set_light_direction;
struct
{
int m_light_index;
float m_color[3];
} set_light_colour;
struct
{
BYTE padding;
float m_color[3];
} set_light_ambient_colour;
struct
{
bool m_enable;
} set_blend_enable;
struct
{
int m_src;
int m_dst;
} set_blend_func;
struct
{
unsigned int m_blend_factor;
} set_blend_factor;
struct
{
bool m_enable;
} set_face_cull;
};
};
ID3D11Buffer *m_vertexBuffer;
void *m_vertexData;
std::uint64_t m_vertexDataLength;
std::vector<Command> m_commands;
std::uint64_t m_allocated;
BYTE isActive;
};
struct DeferredCBuff
{
Renderer::CommandBuffer *m_command_buf;
int m_vertex_index;
int m_vertex_type;
int m_primitive_type;
DirectX::XMMATRIX m_matrix;
};
struct Context
{
static const unsigned int VERTEX_BUFFER_SIZE = 0x100000;
Context(ID3D11Device *device, ID3D11DeviceContext *deviceContext);
ID3D11DeviceContext *m_pDeviceContext;
ID3DUserDefinedAnnotation *userAnnotation;
DWORD annotateDepth;
DirectX::XMMATRIX matrixStacks[MATRIX_MODE_MODELVIEW_MAX][STACK_SIZE];
bool matrixDirty[MATRIX_MODE_MODELVIEW_MAX];
DWORD stackPos[MATRIX_MODE_MODELVIEW_MAX];
DWORD stackType;
DWORD textureIdx;
bool faceCullEnabled;
bool depthTestEnabled;
bool alphaTestEnabled;
float alphaReference;
bool depthWriteEnabled;
bool fogEnabled;
float fogNearDistance;
float fogFarDistance;
float fogDensity;
float fogColourRed;
float fogColourBlue;
float fogColourGreen;
DWORD fogMode;
bool lightingEnabled;
bool lightEnabled[2];
bool lightingDirty;
DWORD forcedLOD;
BYTE paddingAfterForceLOD[4];
DirectX::XMFLOAT4 lightDirection[2];
DirectX::XMFLOAT4 lightColour[2];
DirectX::XMFLOAT4 lightAmbientColour;
ID3D11Buffer *m_modelViewMatrix;
ID3D11Buffer *m_localTransformMatrix;
ID3D11Buffer *m_projectionMatrix;
ID3D11Buffer *m_textureMatrix;
ID3D11Buffer *m_vertexTexcoordBuffer;
ID3D11Buffer *m_fogParamsBuffer;
ID3D11Buffer *m_lightingStateBuffer;
ID3D11Buffer *m_texGenMatricesBuffer;
ID3D11Buffer *m_compressedTranslationBuffer;
ID3D11Buffer *m_thumbnailBoundsBuffer;
ID3D11Buffer *m_tintColorBuffer;
ID3D11Buffer *m_fogColourBuffer;
ID3D11Buffer *m_unkColorBuffer;
ID3D11Buffer *m_alphaTestBuffer;
ID3D11Buffer *m_clearColorBuffer;
ID3D11Buffer *m_forcedLODBuffer;
uint64_t dynamicVertexBase;
DWORD dynamicVertexOffset;
ID3D11Buffer *dynamicVertexBuffer;
DirectX::XMMATRIX texGenMatrices[2];
Renderer::CommandBuffer *commandBuffer;
DWORD recordingBufferIndex;
DWORD recordingVertexType;
DWORD recordingPrimitiveType;
bool deferredModeEnabled;
std::vector<DeferredCBuff> deferredBuffers;
D3D11_BLEND_DESC blendDesc;
D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
D3D11_RASTERIZER_DESC rasterizerDesc;
float blendFactor[4];
};
static DWORD tlsIdx;
static _RTL_CRITICAL_SECTION totalAllocCS;
static DWORD s_auiWidths[];
static DWORD s_auiHeights[];
static DXGI_FORMAT textureFormats[];
static D3D_PRIMITIVE_TOPOLOGY g_topologies[];
static int totalAlloc;
float m_fClearColor[4];
ID3D11Device *m_pDevice;
ID3D11DeviceContext *m_pDeviceContext;
IDXGISwapChain *m_pSwapChain;
ID3D11RenderTargetView *renderTargetView;
ID3D11RenderTargetView *renderTargetViews[4];
ID3D11ShaderResourceView *renderTargetShaderResourceView;
ID3D11ShaderResourceView *renderTargetShaderResourceViews[4];
ID3D11Texture2D *renderTargetTextures[4];
ID3D11DepthStencilView *depthStencilView;
ID3D11VertexShader **vertexShaderTable;
ID3D11VertexShader *screenSpaceVertexShader;
ID3D11VertexShader *screenClearVertexShader;
ID3D11PixelShader **pixelShaderTable;
ID3D11PixelShader *screenSpacePixelShader;
ID3D11PixelShader *screenClearPixelShader;
unsigned int *vertexStrideTable;
ID3D11InputLayout **inputLayoutTable;
ID3D11Buffer *quadIndexBuffer;
ID3D11Buffer *fanIndexBuffer;
DWORD defaultTextureIndex;
WORD reservedRendererWord0;
BYTE paddingAfterRendererWord0[2];
DWORD presentCount;
BYTE rendererFlag0;
BYTE paddingAfterRendererFlag0[3];
_RTL_CRITICAL_SECTION m_commandBufferCS;
DWORD activeVertexType;
DWORD activePixelType;
C4JRender::eViewportType m_ViewportType;
BYTE reservedRendererByte0;
BYTE paddingAfterViewportType[3];
Renderer::Texture m_textures[512];
DWORD backBufferWidth;
DWORD backBufferHeight;
BYTE reservedRendererByte1;
BYTE paddingAfterRendererByte1[3];
DWORD reservedRendererDword1;
int16_t *m_commandHandleToIndex;
CommandBuffer **m_commandBuffers;
uint8_t *m_commandPrimitiveTypes;
DirectX::XMMATRIX *m_commandMatrices;
int *m_commandIndexToHandle;
uint8_t *m_commandVertexTypes;
DWORD reservedRendererDword2;
DWORD reservedRendererDword3;
std::unordered_map<int, ID3D11BlendState *> managedBlendStates;
std::unordered_map<int, ID3D11DepthStencilState *> managedDepthStencilStates;
std::unordered_map<int, ID3D11SamplerState *> managedSamplerStates;
std::unordered_map<int, ID3D11RasterizerState *> managedRasterizerStates;
bool m_bShouldScreenGrabNextFrame;
bool m_bSuspended;
BYTE paddingAfterSuspendState[2];
};
// Singleton
extern Renderer InternalRenderManager;

View file

@ -0,0 +1,832 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "Renderer.h"
#include <cstdint>
#include <cstring>
#include <new>
Renderer::CommandBuffer::CommandBuffer(bool full)
: m_vertexBuffer(NULL)
, m_vertexData(NULL)
, m_vertexDataLength(0)
, m_commands()
, m_allocated(0x1000)
, isActive(full ? 1 : 0)
{
m_vertexData = malloc(m_allocated);
EnterCriticalSection(&Renderer::totalAllocCS);
Renderer::totalAlloc += static_cast<int>(m_allocated);
LeaveCriticalSection(&Renderer::totalAllocCS);
}
Renderer::CommandBuffer::~CommandBuffer()
{
if (m_vertexBuffer)
m_vertexBuffer->Release();
free(m_vertexData);
EnterCriticalSection(&Renderer::totalAllocCS);
Renderer::totalAlloc -= static_cast<int>(m_allocated);
LeaveCriticalSection(&Renderer::totalAllocCS);
}
void Renderer::CommandBuffer::StartRecording() {}
void Renderer::CommandBuffer::EndRecording(ID3D11Device *device)
{
if (m_vertexDataLength != 0)
{
D3D11_BUFFER_DESC desc = {};
desc.ByteWidth = static_cast<UINT>(m_vertexDataLength);
desc.Usage = D3D11_USAGE_IMMUTABLE;
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
D3D11_SUBRESOURCE_DATA data = {};
data.pSysMem = m_vertexData;
device->CreateBuffer(&desc, &data, &m_vertexBuffer);
}
free(m_vertexData);
m_vertexData = NULL;
}
std::uint64_t Renderer::CommandBuffer::GetAllocated()
{
return m_allocated;
}
bool Renderer::CommandBuffer::IsBusy()
{
return false;
}
void Renderer::CommandBuffer::AddMatrix(const float *matrix)
{
Command command = {};
command.m_command_type = COMMAND_ADD_MATRIX;
memcpy(command.add_matrix.m_matrix, matrix, sizeof(command.add_matrix.m_matrix));
m_commands.push_back(command);
}
void Renderer::CommandBuffer::AddVertices(unsigned int stride, unsigned int count, void *dataIn, Renderer::Context &c)
{
PROFILER_SCOPE("Renderer::CommandBuffer::AddVertices", "AddVertices", MP_ORANGE)
if (c.matrixDirty[MATRIX_MODE_MODELVIEW_CBUFF])
{
AddMatrix(InternalRenderManager.MatrixGet(MATRIX_MODE_MODELVIEW_CBUFF));
c.matrixDirty[MATRIX_MODE_MODELVIEW_CBUFF] = false;
}
const std::uint64_t vertexOffset = m_vertexDataLength;
const std::uint64_t copySize = std::uint64_t(stride) * std::uint64_t(count);
Command command = {};
command.m_command_type = COMMAND_ADD_VERTICES;
command.add_vertices.m_vertex_index_start = (unsigned int)vertexOffset;
command.add_vertices.m_vertex_count = count;
m_vertexDataLength = vertexOffset + copySize;
if (m_vertexDataLength > m_allocated)
{
EnterCriticalSection(&Renderer::totalAllocCS);
Renderer::totalAlloc -= static_cast<int>(m_allocated);
LeaveCriticalSection(&Renderer::totalAllocCS);
m_allocated = ((m_vertexDataLength + (0x1000 - 1)) & ~(0x1000 - 1));
m_vertexData = std::realloc(m_vertexData, m_allocated);
EnterCriticalSection(&Renderer::totalAllocCS);
Renderer::totalAlloc += static_cast<int>(m_allocated);
LeaveCriticalSection(&Renderer::totalAllocCS);
}
const std::size_t byteCount = std::size_t(stride) * std::size_t(count);
memcpy(static_cast<std::uint8_t *>(m_vertexData) + vertexOffset, dataIn, byteCount);
m_commands.push_back(command);
}
void Renderer::CommandBuffer::BindTexture(int idx)
{
Command command = {};
command.m_command_type = COMMAND_BIND_TEXTURE;
command.bind_texture.m_texture_index = idx;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetColor(float r, float g, float b, float a)
{
Command command = {};
command.m_command_type = COMMAND_SET_COLOR;
command.set_color.m_color[0] = r;
command.set_color.m_color[1] = g;
command.set_color.m_color[2] = b;
command.set_color.m_color[3] = a;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetDepthFunc(int func)
{
Command command = {};
command.m_command_type = COMMAND_SET_DEPTH_FUNC;
command.set_depth_func.m_depth_func = func;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetDepthMask(bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_DEPTH_MASK;
command.set_depth_mask.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetDepthTestEnable(bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_DEPTH_TEST;
command.set_depth_test.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetLightingEnable(bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_LIGHTING_ENABLE;
command.set_lighting_enable.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetLightEnable(int light, bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_LIGHT_ENABLE;
command.set_light_enable.m_light_index = light;
command.set_light_enable.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetLightDirection(int light, float x, float y, float z)
{
Renderer::Context &c = InternalRenderManager.getContext();
const std::uint32_t depth = c.stackPos[MATRIX_MODE_MODELVIEW_CBUFF];
const DirectX::XMMATRIX &matrix = c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][depth];
DirectX::XMVECTOR direction = DirectX::XMVectorSet(x, y, z, 0.0f);
direction = DirectX::XMVector3TransformNormal(direction, matrix);
direction = DirectX::XMVector3Normalize(direction);
Command command = {};
command.m_command_type = COMMAND_SET_LIGHT_DIRECTION;
command.set_light_direction.m_light_index = light;
DirectX::XMFLOAT4 outDirection;
DirectX::XMStoreFloat4(&outDirection, direction);
command.set_light_direction.m_direction[0] = outDirection.x;
command.set_light_direction.m_direction[1] = outDirection.y;
command.set_light_direction.m_direction[2] = outDirection.z;
command.set_light_direction.m_direction[3] = outDirection.w;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetLightColour(int light, float r, float g, float b)
{
Command command = {};
command.m_command_type = COMMAND_SET_LIGHT_COLOUR;
command.set_light_colour.m_light_index = light;
command.set_light_colour.m_color[0] = r;
command.set_light_colour.m_color[1] = g;
command.set_light_colour.m_color[2] = b;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetLightAmbientColour(float r, float g, float b)
{
Command command = {};
command.m_command_type = COMMAND_SET_LIGHT_AMBIENT_COLOUR;
command.set_light_ambient_colour.m_color[0] = r;
command.set_light_ambient_colour.m_color[1] = g;
command.set_light_ambient_colour.m_color[2] = b;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetBlendEnable(bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_BLEND_ENABLE;
command.set_blend_enable.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetBlendFunc(int src, int dst)
{
Command command = {};
command.m_command_type = COMMAND_SET_BLEND_FUNC;
command.set_blend_func.m_src = src;
command.set_blend_func.m_dst = dst;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetBlendFactor(unsigned int factor)
{
Command command = {};
command.m_command_type = COMMAND_SET_BLEND_FACTOR;
command.set_blend_factor.m_blend_factor = factor;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::SetFaceCull(bool enable)
{
Command command = {};
command.m_command_type = COMMAND_SET_FACE_CULL;
command.set_face_cull.m_enable = enable;
m_commands.push_back(command);
}
void Renderer::CommandBuffer::Render(C4JRender::eVertexType vType, Renderer::Context &c, int primitiveType)
{
PROFILER_SCOPE("Renderer::CommandBuffer::Render", "Render", MP_ORANGE)
if (!m_vertexBuffer)
return;
int drawVertexType = vType;
int shaderVertexType = drawVertexType;
bool matrixOverride = false;
for (const Command &command : m_commands)
{
PROFILER_SCOPE("Renderer::CommandBuffer::Render", "ProcessCommand", MP_ORANGE)
switch (command.m_command_type)
{
case COMMAND_ADD_MATRIX:
{
if (drawVertexType == C4JRender::VERTEX_TYPE_COMPRESSED)
{
const float row[4] = {
command.add_matrix.m_matrix[12], command.add_matrix.m_matrix[13],
command.add_matrix.m_matrix[14], command.add_matrix.m_matrix[15]
};
D3D11_MAPPED_SUBRESOURCE mappedAux0 = {};
c.m_pDeviceContext->Map(c.m_compressedTranslationBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedAux0);
memcpy(mappedAux0.pData, row, sizeof(row));
c.m_pDeviceContext->Unmap(c.m_compressedTranslationBuffer, 0);
}
else
{
D3D11_MAPPED_SUBRESOURCE mappedMatrix1 = {};
c.m_pDeviceContext->Map(c.m_localTransformMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedMatrix1);
memcpy(mappedMatrix1.pData, command.add_matrix.m_matrix, sizeof(command.add_matrix.m_matrix));
c.m_pDeviceContext->Unmap(c.m_localTransformMatrix, 0);
matrixOverride = true;
}
break;
}
case COMMAND_ADD_VERTICES:
{
if (isActive)
{
InternalRenderManager.UpdateLightingState();
if (drawVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1)
{
if (c.lightingEnabled)
{
drawVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
shaderVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
}
}
else if (drawVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT && !c.lightingEnabled)
{
drawVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1;
shaderVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1;
}
if (static_cast<DWORD>(drawVertexType) != InternalRenderManager.activeVertexType)
{
c.m_pDeviceContext->VSSetShader(InternalRenderManager.vertexShaderTable[shaderVertexType], NULL, 0);
c.m_pDeviceContext->IASetInputLayout(InternalRenderManager.inputLayoutTable[shaderVertexType]);
InternalRenderManager.activeVertexType = drawVertexType;
}
}
unsigned int drawCount = command.add_vertices.m_vertex_count;
bool drawIndexed = false;
if (primitiveType == C4JRender::PRIMITIVE_TYPE_QUAD_LIST)
{
drawCount = (drawCount * 6) / 4;
drawIndexed = true;
}
else if (primitiveType == C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN)
{
drawCount = (drawCount - 2) * 3;
drawIndexed = true;
}
ID3D11Buffer *buffer = m_vertexBuffer;
const UINT stride = InternalRenderManager.vertexStrideTable[drawVertexType];
const UINT offset = command.add_vertices.m_vertex_index_start;
c.m_pDeviceContext->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
if (drawIndexed)
c.m_pDeviceContext->DrawIndexed(drawCount, 0, 0);
else
c.m_pDeviceContext->Draw(drawCount, 0);
break;
}
case COMMAND_BIND_TEXTURE:
{
c.textureIdx = command.bind_texture.m_texture_index;
ID3D11ShaderResourceView *view = InternalRenderManager.m_textures[c.textureIdx].view;
c.m_pDeviceContext->PSSetShaderResources(0, 1, &view);
InternalRenderManager.UpdateTextureState(false);
break;
}
case COMMAND_SET_COLOR:
{
D3D11_MAPPED_SUBRESOURCE mappedColour = {};
c.m_pDeviceContext->Map(c.m_tintColorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedColour);
memcpy(mappedColour.pData, command.set_color.m_color, sizeof(command.set_color.m_color));
c.m_pDeviceContext->Unmap(c.m_tintColorBuffer, 0);
break;
}
case COMMAND_SET_DEPTH_FUNC:
{
c.depthStencilDesc.DepthFunc = static_cast<D3D11_COMPARISON_FUNC>(command.set_depth_func.m_depth_func);
c.m_pDeviceContext->OMSetDepthStencilState(InternalRenderManager.GetManagedDepthStencilState(), 0);
break;
}
case COMMAND_SET_DEPTH_MASK:
{
c.depthWriteEnabled = command.set_depth_mask.m_enable;
c.depthStencilDesc.DepthWriteMask = command.set_depth_mask.m_enable ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
c.m_pDeviceContext->OMSetDepthStencilState(InternalRenderManager.GetManagedDepthStencilState(), 0);
break;
}
case COMMAND_SET_DEPTH_TEST:
{
c.depthTestEnabled = command.set_depth_test.m_enable;
c.depthStencilDesc.DepthEnable = command.set_depth_test.m_enable;
c.m_pDeviceContext->OMSetDepthStencilState(InternalRenderManager.GetManagedDepthStencilState(), 0);
break;
}
case COMMAND_SET_LIGHTING_ENABLE:
{
c.lightingEnabled = command.set_lighting_enable.m_enable;
break;
}
case COMMAND_SET_LIGHT_ENABLE:
{
const int light = command.set_light_enable.m_light_index;
if (light >= 0 && light < 2)
{
c.lightEnabled[light] = command.set_light_enable.m_enable;
c.lightingDirty = true;
}
break;
}
case COMMAND_SET_LIGHT_DIRECTION:
{
const int light = command.set_light_direction.m_light_index;
if (light >= 0 && light < 2)
{
c.lightDirection[light].x = command.set_light_direction.m_direction[0];
c.lightDirection[light].y = command.set_light_direction.m_direction[1];
c.lightDirection[light].z = command.set_light_direction.m_direction[2];
c.lightDirection[light].w = command.set_light_direction.m_direction[3];
c.lightingDirty = true;
}
break;
}
case COMMAND_SET_LIGHT_COLOUR:
{
const int light = command.set_light_colour.m_light_index;
if (light >= 0 && light < 2)
{
c.lightColour[light].x = command.set_light_colour.m_color[0];
c.lightColour[light].y = command.set_light_colour.m_color[1];
c.lightColour[light].z = command.set_light_colour.m_color[2];
c.lightColour[light].w = 1.0f;
c.lightingDirty = true;
}
break;
}
case COMMAND_SET_LIGHT_AMBIENT_COLOUR:
{
c.lightAmbientColour.x = command.set_light_ambient_colour.m_color[0];
c.lightAmbientColour.y = command.set_light_ambient_colour.m_color[1];
c.lightAmbientColour.z = command.set_light_ambient_colour.m_color[2];
c.lightAmbientColour.w = 1.0f;
c.lightingDirty = true;
break;
}
case COMMAND_SET_BLEND_ENABLE:
{
c.blendDesc.RenderTarget[0].BlendEnable = command.set_blend_enable.m_enable;
break;
}
case COMMAND_SET_BLEND_FUNC:
{
c.blendDesc.RenderTarget[0].SrcBlend = static_cast<D3D11_BLEND>(command.set_blend_func.m_src);
c.blendDesc.RenderTarget[0].DestBlend = static_cast<D3D11_BLEND>(command.set_blend_func.m_dst);
c.m_pDeviceContext->OMSetBlendState(InternalRenderManager.GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
break;
}
case COMMAND_SET_BLEND_FACTOR:
{
const unsigned int factor = command.set_blend_factor.m_blend_factor;
c.blendFactor[0] = float((factor >> 0) & 0xFF) / 255.0f;
c.blendFactor[1] = float((factor >> 8) & 0xFF) / 255.0f;
c.blendFactor[2] = float((factor >> 16) & 0xFF) / 255.0f;
c.blendFactor[3] = float((factor >> 24) & 0xFF) / 255.0f;
c.m_pDeviceContext->OMSetBlendState(InternalRenderManager.GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
break;
}
case COMMAND_SET_FACE_CULL:
{
c.rasterizerDesc.CullMode = command.set_face_cull.m_enable ? D3D11_CULL_BACK : D3D11_CULL_NONE;
c.m_pDeviceContext->RSSetState(InternalRenderManager.GetManagedRasterizerState());
c.faceCullEnabled = command.set_face_cull.m_enable;
break;
}
default:
break;
}
}
if (matrixOverride)
{
const DirectX::XMMATRIX identity = DirectX::XMMatrixIdentity();
D3D11_MAPPED_SUBRESOURCE mappedIdentity = {};
c.m_pDeviceContext->Map(c.m_localTransformMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedIdentity);
memcpy(mappedIdentity.pData, &identity, sizeof(identity));
c.m_pDeviceContext->Unmap(c.m_localTransformMatrix, 0);
}
}
bool Renderer::CBuffCall(int index, bool full)
{
EnterCriticalSection(&m_commandBufferCS);
bool result = false;
const int commandIndex = m_commandHandleToIndex[index];
if (commandIndex >= 0)
{
Renderer::Context &c = getContext();
const std::uint8_t vertexType = m_commandVertexTypes[commandIndex];
const std::uint8_t primitiveType = m_commandPrimitiveTypes[commandIndex];
if (full)
{
if (c.matrixDirty[MATRIX_MODE_MODELVIEW])
{
D3D11_MAPPED_SUBRESOURCE mappedMatrix0 = {};
c.m_pDeviceContext->Map(c.m_modelViewMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedMatrix0);
memcpy(mappedMatrix0.pData, MatrixGet(MATRIX_MODE_MODELVIEW), sizeof(DirectX::XMMATRIX));
c.m_pDeviceContext->Unmap(c.m_modelViewMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW] = false;
}
if (c.matrixDirty[MATRIX_MODE_MODELVIEW_PROJECTION])
{
D3D11_MAPPED_SUBRESOURCE mappedMatrix2 = {};
c.m_pDeviceContext->Map(c.m_projectionMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedMatrix2);
memcpy(mappedMatrix2.pData, MatrixGet(MATRIX_MODE_MODELVIEW_PROJECTION), sizeof(DirectX::XMMATRIX));
c.m_pDeviceContext->Unmap(c.m_projectionMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW_PROJECTION] = false;
}
if (c.matrixDirty[MATRIX_MODE_MODELVIEW_TEXTURE])
{
D3D11_MAPPED_SUBRESOURCE mappedMatrix3 = {};
c.m_pDeviceContext->Map(c.m_textureMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedMatrix3);
memcpy(mappedMatrix3.pData, MatrixGet(MATRIX_MODE_MODELVIEW_TEXTURE), sizeof(DirectX::XMMATRIX));
c.m_pDeviceContext->Unmap(c.m_textureMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW_TEXTURE] = false;
}
UpdateFogState();
UpdateLightingState();
UpdateViewportState();
UpdateTexGenState();
if (vertexType != activeVertexType)
{
c.m_pDeviceContext->VSSetShader(vertexShaderTable[vertexType], NULL, 0);
c.m_pDeviceContext->IASetInputLayout(inputLayoutTable[vertexType]);
activeVertexType = vertexType;
}
int pixelType = 0;
if (static_cast<int>(c.forcedLOD) > -1)
{
const float forcedLod[4] = {static_cast<float>(static_cast<int>(c.forcedLOD)), 0.0f, 0.0f, 0.0f};
D3D11_MAPPED_SUBRESOURCE mappedAux4 = {};
c.m_pDeviceContext->Map(c.m_forcedLODBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedAux4);
memcpy(mappedAux4.pData, forcedLod, sizeof(forcedLod));
c.m_pDeviceContext->Unmap(c.m_forcedLODBuffer, 0);
pixelType = C4JRender::PIXEL_SHADER_TYPE_FORCELOD;
}
if (static_cast<DWORD>(pixelType) != activePixelType)
{
c.m_pDeviceContext->PSSetShader(pixelShaderTable[pixelType], NULL, 0);
activePixelType = pixelType;
}
c.m_pDeviceContext->IASetPrimitiveTopology(g_topologies[primitiveType]);
ID3D11Buffer *indexBuffer = NULL;
if (primitiveType == C4JRender::PRIMITIVE_TYPE_QUAD_LIST)
indexBuffer = quadIndexBuffer;
else if (primitiveType == C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN)
indexBuffer = fanIndexBuffer;
c.m_pDeviceContext->IASetIndexBuffer(indexBuffer, DXGI_FORMAT_R16_UINT, 0);
}
m_commandBuffers[commandIndex]->Render(static_cast<C4JRender::eVertexType>(vertexType), c, primitiveType);
if (full)
{
MultWithStack(m_commandMatrices[commandIndex]);
c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][0] = DirectX::XMMatrixIdentity();
c.matrixDirty[MATRIX_MODE_MODELVIEW_CBUFF] = true;
}
result = true;
}
LeaveCriticalSection(&m_commandBufferCS);
return result;
}
void Renderer::CBuffClear(int index)
{
EnterCriticalSection(&m_commandBufferCS);
std::int16_t *externalToInternal = static_cast<std::int16_t *>(m_commandHandleToIndex);
const int internalIndex = externalToInternal[index];
if (internalIndex >= 0)
{
DeleteInternalBuffer(internalIndex);
externalToInternal[index] = static_cast<std::int16_t>(-2);
}
LeaveCriticalSection(&m_commandBufferCS);
}
int Renderer::CBuffCreate(int count)
{
EnterCriticalSection(&m_commandBufferCS);
int first = reservedRendererDword1;
if (first < NUM_COMMAND_HANDLES)
{
int probe = first;
int end = first + count;
while (true)
{
assert(first < NUM_COMMAND_HANDLES);
int cursor = probe;
while (cursor < end && cursor < NUM_COMMAND_HANDLES && m_commandHandleToIndex[cursor] == static_cast<std::int16_t>(-1))
{
++cursor;
}
if (cursor >= end)
break;
++first;
++probe;
++end;
if (first >= NUM_COMMAND_HANDLES || end > NUM_COMMAND_HANDLES)
{
first = -1;
break;
}
}
if (first >= 0)
{
const int allocationEnd = first + count;
for (int i = first; i < allocationEnd; ++i)
m_commandHandleToIndex[i] = static_cast<std::int16_t>(-2);
if (reservedRendererByte1)
reservedRendererDword1 = allocationEnd;
}
}
else
{
first = -1;
}
LeaveCriticalSection(&m_commandBufferCS);
return first;
}
void Renderer::CBuffDeferredModeEnd()
{
Renderer::Context &c = getContext();
if (!c.deferredModeEnabled)
return;
EnterCriticalSection(&m_commandBufferCS);
c.deferredModeEnabled = false;
for (std::vector<Renderer::DeferredCBuff>::const_iterator it = c.deferredBuffers.begin(); it != c.deferredBuffers.end(); ++it)
{
const Renderer::DeferredCBuff &deferred = *it;
const int existingIndex = m_commandHandleToIndex[deferred.m_vertex_index];
if (existingIndex >= 0)
DeleteInternalBuffer(existingIndex);
if (static_cast<int>(reservedRendererDword2 + reservedRendererDword3 + 10) > MAX_COMMAND_BUFFERS)
DebugBreak();
const int internalSlot = reservedRendererDword2;
++reservedRendererDword2;
m_commandHandleToIndex[deferred.m_vertex_index] = static_cast<std::int16_t>(internalSlot);
m_commandIndexToHandle[internalSlot] = deferred.m_vertex_index;
m_commandVertexTypes[internalSlot] = static_cast<std::uint8_t>(deferred.m_vertex_type);
m_commandPrimitiveTypes[internalSlot] = static_cast<std::uint8_t>(deferred.m_primitive_type);
m_commandBuffers[internalSlot] = deferred.m_command_buf;
m_commandMatrices[internalSlot] = deferred.m_matrix;
}
c.deferredBuffers.clear();
LeaveCriticalSection(&m_commandBufferCS);
}
void Renderer::CBuffDeferredModeStart()
{
getContext().deferredModeEnabled = true;
}
void Renderer::CBuffDelete(int first, int count)
{
EnterCriticalSection(&m_commandBufferCS);
const int end = first + count;
for (int i = first; i < end; ++i)
{
const int internalIndex = m_commandHandleToIndex[i];
if (internalIndex >= 0)
DeleteInternalBuffer(internalIndex);
m_commandHandleToIndex[i] = static_cast<std::int16_t>(-1);
}
LeaveCriticalSection(&m_commandBufferCS);
}
void Renderer::CBuffEnd()
{
Renderer::Context &c = getContext();
assert(c.stackType == MATRIX_MODE_MODELVIEW_CBUFF);
assert(c.stackPos[MATRIX_MODE_MODELVIEW_CBUFF] == 0);
EnterCriticalSection(&m_commandBufferCS);
if (c.deferredModeEnabled)
{
Renderer::DeferredCBuff deferred;
deferred.m_command_buf = c.commandBuffer;
deferred.m_vertex_index = c.recordingBufferIndex;
deferred.m_vertex_type = c.recordingVertexType;
deferred.m_primitive_type = c.recordingPrimitiveType;
deferred.m_matrix = c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][0];
c.deferredBuffers.push_back(deferred);
}
else
{
const int existingIndex = m_commandHandleToIndex[c.recordingBufferIndex];
if (existingIndex >= 0)
DeleteInternalBuffer(existingIndex);
if (static_cast<int>(reservedRendererDword2 + reservedRendererDword3 + 10) > MAX_COMMAND_BUFFERS)
DebugBreak();
const int internalSlot = reservedRendererDword2;
++reservedRendererDword2;
m_commandHandleToIndex[c.recordingBufferIndex] = static_cast<std::int16_t>(internalSlot);
m_commandIndexToHandle[internalSlot] = c.recordingBufferIndex;
m_commandVertexTypes[internalSlot] = static_cast<std::uint8_t>(c.recordingVertexType);
m_commandPrimitiveTypes[internalSlot] = static_cast<std::uint8_t>(c.recordingPrimitiveType);
m_commandBuffers[internalSlot] = c.commandBuffer;
m_commandMatrices[internalSlot] = c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][0];
}
c.stackType = MATRIX_MODE_MODELVIEW;
c.commandBuffer->EndRecording(m_pDevice);
c.commandBuffer = NULL;
LeaveCriticalSection(&m_commandBufferCS);
}
void Renderer::CBuffLockStaticCreations()
{
reservedRendererByte1 = 0;
}
int Renderer::CBuffSize(int index)
{
if (index == -1)
return totalAlloc < 0 ? 0 : totalAlloc;
unsigned int size = 0;
EnterCriticalSection(&m_commandBufferCS);
const int commandIndex = m_commandHandleToIndex[index];
if (commandIndex >= 0)
size = static_cast<unsigned int>(m_commandBuffers[commandIndex]->GetAllocated());
LeaveCriticalSection(&m_commandBufferCS);
return size;
}
void Renderer::CBuffStart(int index, bool full)
{
Renderer::Context &c = getContext();
c.commandBuffer = new (std::nothrow) Renderer::CommandBuffer(full);
c.recordingBufferIndex = index;
assert(c.stackType == MATRIX_MODE_MODELVIEW);
c.stackType = MATRIX_MODE_MODELVIEW_CBUFF;
c.stackPos[MATRIX_MODE_MODELVIEW_CBUFF] = 0;
c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][0] = DirectX::XMMatrixIdentity();
c.matrixDirty[MATRIX_MODE_MODELVIEW_CBUFF] = true;
}
void Renderer::CBuffTick()
{
EnterCriticalSection(&m_commandBufferCS);
const int firstPending = MAX_COMMAND_BUFFERS - static_cast<int>(reservedRendererDword3);
for (int i = firstPending; i < MAX_COMMAND_BUFFERS; ++i)
{
Renderer::CommandBuffer *buffer = m_commandBuffers[i];
if (buffer)
delete buffer;
m_commandBuffers[i] = NULL;
}
reservedRendererDword3 = 0;
LeaveCriticalSection(&m_commandBufferCS);
}
void Renderer::DeleteInternalBuffer(int index)
{
EnterCriticalSection(&m_commandBufferCS);
++reservedRendererDword3;
const int recycledSlot = MAX_COMMAND_BUFFERS - static_cast<int>(reservedRendererDword3);
m_commandBuffers[recycledSlot] = m_commandBuffers[index];
m_commandMatrices[recycledSlot] = m_commandMatrices[index];
if (reservedRendererDword2-- != 1)
{
const int lastActive = reservedRendererDword2;
m_commandBuffers[index] = m_commandBuffers[lastActive];
m_commandMatrices[index] = m_commandMatrices[lastActive];
m_commandVertexTypes[index] = m_commandVertexTypes[lastActive];
m_commandPrimitiveTypes[index] = m_commandPrimitiveTypes[lastActive];
const int commandIndex = m_commandIndexToHandle[lastActive];
m_commandHandleToIndex[commandIndex] = static_cast<std::int16_t>(index);
m_commandIndexToHandle[index] = commandIndex;
}
LeaveCriticalSection(&m_commandBufferCS);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,143 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "Renderer.h"
#include <cstring>
const float *Renderer::MatrixGet(int type)
{
Context &c = getContext();
const int depth = c.stackPos[type];
return reinterpret_cast<const float *>(&c.matrixStacks[type][depth]);
}
void Renderer::MatrixMode(int type)
{
Context &c = getContext();
assert(type >= 0);
assert(type < STACK_TYPES);
c.stackType = type;
}
void Renderer::MatrixMult(float *mat)
{
DirectX::XMMATRIX matrix;
std::memcpy(&matrix, mat, sizeof(matrix));
MultWithStack(matrix);
}
void Renderer::MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar)
{
const DirectX::XMMATRIX matrix = DirectX::XMMatrixOrthographicOffCenterRH(left, right, bottom, top, zNear, zFar);
MultWithStack(matrix);
}
void Renderer::MatrixPerspective(float fovy, float aspect, float zNear, float zFar)
{
const float fovRadians = fovy * (3.14159274f / 180.0f);
const DirectX::XMMATRIX matrix = DirectX::XMMatrixPerspectiveFovRH(fovRadians, aspect, zNear, zFar);
MultWithStack(matrix);
}
void Renderer::MatrixPop()
{
Context &c = getContext();
assert(c.stackPos[c.stackType] > 0);
const int mode = c.stackType;
--c.stackPos[mode];
c.matrixDirty[mode] = true;
}
void Renderer::MatrixPush()
{
Context &c = getContext();
assert(c.stackPos[c.stackType] < (STACK_SIZE - 1));
const int mode = c.stackType;
const int depth = c.stackPos[mode];
c.matrixStacks[mode][depth + 1] = c.matrixStacks[mode][depth];
++c.stackPos[mode];
}
void Renderer::MatrixRotate(float angle, float x, float y, float z)
{
const DirectX::XMVECTOR axis = DirectX::XMVectorSet(x, y, z, 0.0f);
const DirectX::XMMATRIX matrix = DirectX::XMMatrixRotationAxis(axis, angle);
MultWithStack(matrix);
}
void Renderer::MatrixScale(float x, float y, float z)
{
const DirectX::XMMATRIX matrix = DirectX::XMMatrixScaling(x, y, z);
MultWithStack(matrix);
}
void Renderer::MatrixSetIdentity()
{
Context &c = getContext();
const int mode = c.stackType;
const int depth = c.stackPos[mode];
c.matrixStacks[mode][depth] = DirectX::XMMatrixIdentity();
c.matrixDirty[mode] = true;
}
void Renderer::MatrixTranslate(float x, float y, float z)
{
const DirectX::XMMATRIX matrix = DirectX::XMMatrixTranslation(x, y, z);
MultWithStack(matrix);
}
void Renderer::MultWithStack(DirectX::XMMATRIX matrix)
{
Context &c = getContext();
const int mode = c.stackType;
const int depth = c.stackPos[mode];
DirectX::XMMATRIX &current = c.matrixStacks[mode][depth];
current = DirectX::XMMatrixMultiply(matrix, current);
c.matrixDirty[mode] = true;
}
void Renderer::Set_matrixDirty()
{
Context &c = getContext();
const DirectX::XMMATRIX identity = DirectX::XMMatrixIdentity();
c.matrixStacks[MATRIX_MODE_MODELVIEW][0] = identity;
c.matrixStacks[MATRIX_MODE_MODELVIEW_PROJECTION][0] = identity;
c.matrixStacks[MATRIX_MODE_MODELVIEW_TEXTURE][0] = identity;
c.matrixStacks[MATRIX_MODE_MODELVIEW_CBUFF][0] = identity;
c.matrixDirty[MATRIX_MODE_MODELVIEW] = true;
c.matrixDirty[MATRIX_MODE_MODELVIEW_PROJECTION] = true;
c.matrixDirty[MATRIX_MODE_MODELVIEW_TEXTURE] = true;
c.matrixDirty[MATRIX_MODE_MODELVIEW_CBUFF] = true;
activeVertexType = -1;
activePixelType = -1;
}

View file

@ -0,0 +1,648 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "Renderer.h"
#include <cstring>
#include <limits>
ID3D11BlendState *Renderer::GetManagedBlendState()
{
PROFILER_SCOPE("Renderer::GetManagedBlendState", "GetManagedBlendState", MP_ORCHID1)
Context &c = getContext();
const D3D11_RENDER_TARGET_BLEND_DESC &rtBlend = c.blendDesc.RenderTarget[0];
const int key = (rtBlend.BlendEnable ? 1 : 0) | ((static_cast<int>(rtBlend.SrcBlend) & 0x1F) << 1) |
((static_cast<int>(rtBlend.DestBlend) & 0x1F) << 6) | ((static_cast<int>(rtBlend.RenderTargetWriteMask) & 0x0F) << 11);
auto it = managedBlendStates.find(key);
if (it != managedBlendStates.end())
return it->second;
ID3D11BlendState *state = NULL;
m_pDevice->CreateBlendState(&c.blendDesc, &state);
managedBlendStates.emplace(key, state);
return state;
}
ID3D11DepthStencilState *Renderer::GetManagedDepthStencilState()
{
PROFILER_SCOPE("Renderer::GetManagedBlendState", "GetManagedDepthStencilState", MP_ORCHID1)
Context &c = getContext();
const int key = (c.depthStencilDesc.DepthEnable ? 2 : 0) | ((static_cast<int>(c.depthStencilDesc.DepthFunc) & 0x0F) << 2) |
(c.depthStencilDesc.DepthWriteMask == D3D11_DEPTH_WRITE_MASK_ALL ? 1 : 0);
auto it = managedDepthStencilStates.find(key);
if (it != managedDepthStencilStates.end())
return it->second;
ID3D11DepthStencilState *state = NULL;
m_pDevice->CreateDepthStencilState(&c.depthStencilDesc, &state);
managedDepthStencilStates.emplace(key, state);
return state;
}
ID3D11RasterizerState *Renderer::GetManagedRasterizerState()
{
PROFILER_SCOPE("Renderer::GetManagedRasterizerState", "GetManagedRasterizerState", MP_ORCHID1)
Context &c = getContext();
const int key = (static_cast<std::uint8_t>(c.rasterizerDesc.DepthBias)) |
(static_cast<std::uint8_t>(static_cast<int>(c.rasterizerDesc.SlopeScaledDepthBias)) << 8) |
((static_cast<int>(c.rasterizerDesc.CullMode) & 0x03) << 16);
auto it = managedRasterizerStates.find(key);
if (it != managedRasterizerStates.end())
return it->second;
ID3D11RasterizerState *state = NULL;
m_pDevice->CreateRasterizerState(&c.rasterizerDesc, &state);
managedRasterizerStates.emplace(key, state);
return state;
}
ID3D11SamplerState *Renderer::GetManagedSamplerState()
{
PROFILER_SCOPE("Renderer::GetManagedSamplerState", "GetManagedSamplerState", MP_ORCHID1)
Context &c = getContext();
const int key = m_textures[c.textureIdx].samplerParams;
auto it = managedSamplerStates.find(key);
if (it != managedSamplerStates.end())
return it->second;
const bool clampU = (key & 0x01) != 0;
const bool clampV = (key & 0x02) != 0;
const bool linearFilter = (key & 0x04) != 0;
const bool mipLinear = (key & 0x08) != 0;
const int filterBits = (mipLinear ? 0x08 : 0x00) | (linearFilter ? 0x22 : 0x02);
D3D11_SAMPLER_DESC desc = {};
desc.Filter = static_cast<D3D11_FILTER>(filterBits >> 1);
desc.AddressU = clampU ? D3D11_TEXTURE_ADDRESS_CLAMP : D3D11_TEXTURE_ADDRESS_WRAP;
desc.AddressV = clampV ? D3D11_TEXTURE_ADDRESS_CLAMP : D3D11_TEXTURE_ADDRESS_WRAP;
desc.AddressW = static_cast<D3D11_TEXTURE_ADDRESS_MODE>(3);
desc.MipLODBias = 0.0f;
desc.MaxAnisotropy = 16;
desc.ComparisonFunc = static_cast<D3D11_COMPARISON_FUNC>(1);
desc.BorderColor[0] = 0.0f;
desc.BorderColor[1] = 0.0f;
desc.BorderColor[2] = 0.0f;
desc.BorderColor[3] = 0.0f;
desc.MinLOD = -(std::numeric_limits<float>::max)();
desc.MaxLOD = (std::numeric_limits<float>::max)();
ID3D11SamplerState *state = NULL;
m_pDevice->CreateSamplerState(&desc, &state);
managedSamplerStates.emplace(key, state);
return state;
}
void Renderer::StateSetFogEnable(bool enable)
{
Context &c = getContext();
c.fogEnabled = enable;
}
void Renderer::StateSetFogMode(int mode)
{
Context &c = getContext();
c.fogMode = mode;
}
void Renderer::StateSetFogNearDistance(float dist)
{
Context &c = getContext();
c.fogNearDistance = dist;
}
void Renderer::StateSetFogFarDistance(float dist)
{
Context &c = getContext();
c.fogFarDistance = dist;
}
void Renderer::StateSetFogDensity(float density)
{
Context &c = getContext();
c.fogDensity = density;
}
void Renderer::StateSetFogColour(float red, float green, float blue)
{
Context &c = getContext();
c.fogColourRed = red;
c.fogColourBlue = blue;
c.fogColourGreen = green;
}
void Renderer::UpdateViewportState() {}
void Renderer::StateSetLightingEnable(bool enable)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetLightingEnable(enable);
return;
}
c.lightingEnabled = enable;
}
void Renderer::StateSetLightColour(int light, float red, float green, float blue)
{
if (light >= 2)
return;
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetLightColour(light, red, green, blue);
return;
}
c.lightColour[light].x = red;
c.lightColour[light].y = green;
c.lightColour[light].z = blue;
c.lightColour[light].w = 1.0f;
c.lightingDirty = true;
}
void Renderer::StateSetLightAmbientColour(float red, float green, float blue)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetLightAmbientColour(red, green, blue);
return;
}
c.lightAmbientColour.x = red;
c.lightAmbientColour.y = green;
c.lightAmbientColour.z = blue;
c.lightAmbientColour.w = 1.0f;
c.lightingDirty = true;
}
void Renderer::StateSetLightEnable(int light, bool enable)
{
if (light >= 2)
return;
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetLightEnable(light, enable);
return;
}
c.lightEnabled[light] = enable;
c.lightingDirty = true;
}
void Renderer::StateSetColour(float r, float g, float b, float a)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetColor(r, g, b, a);
return;
}
ID3D11DeviceContext *d3d11 = c.m_pDeviceContext;
const float colour[4] = {r, g, b, a};
D3D11_MAPPED_SUBRESOURCE mapped = {};
d3d11->Map(c.m_tintColorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, colour, sizeof(colour));
d3d11->Unmap(c.m_tintColorBuffer, 0);
}
void Renderer::StateSetDepthMask(bool enable)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetDepthMask(enable);
return;
}
c.depthStencilDesc.DepthWriteMask = enable ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
c.m_pDeviceContext->OMSetDepthStencilState(GetManagedDepthStencilState(), 0);
c.depthWriteEnabled = enable;
}
void Renderer::StateSetBlendEnable(bool enable)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetBlendEnable(enable);
return;
}
c.blendDesc.RenderTarget[0].BlendEnable = enable;
c.m_pDeviceContext->OMSetBlendState(GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
}
void Renderer::StateSetBlendFunc(int src, int dst)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetBlendFunc(src, dst);
return;
}
c.blendDesc.RenderTarget[0].SrcBlend = static_cast<D3D11_BLEND>(src);
c.blendDesc.RenderTarget[0].DestBlend = static_cast<D3D11_BLEND>(dst);
c.m_pDeviceContext->OMSetBlendState(GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
}
void Renderer::StateSetBlendFactor(unsigned int colour)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetBlendFactor(colour);
return;
}
const float scale = 255.0f;
c.blendFactor[0] = static_cast<float>((colour >> 0) & 0xFF) / scale;
c.blendFactor[1] = static_cast<float>((colour >> 8) & 0xFF) / scale;
c.blendFactor[2] = static_cast<float>((colour >> 16) & 0xFF) / scale;
c.blendFactor[3] = static_cast<float>((colour >> 24) & 0xFF) / scale;
c.m_pDeviceContext->OMSetBlendState(GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
}
void Renderer::StateSetAlphaFunc(int, float param)
{
Context &c = getContext();
c.alphaReference = param;
const float alpha[4] = {0.0f, 0.0f, 0.0f, c.alphaTestEnabled ? c.alphaReference : 0.0f};
D3D11_MAPPED_SUBRESOURCE mapped = {};
c.m_pDeviceContext->Map(c.m_alphaTestBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, alpha, sizeof(alpha));
c.m_pDeviceContext->Unmap(c.m_alphaTestBuffer, 0);
}
void Renderer::StateSetDepthFunc(int func)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetDepthFunc(func);
return;
}
c.depthStencilDesc.DepthFunc = static_cast<D3D11_COMPARISON_FUNC>(func);
c.m_pDeviceContext->OMSetDepthStencilState(GetManagedDepthStencilState(), 0);
}
void Renderer::StateSetFaceCull(bool enable)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetFaceCull(enable);
return;
}
c.rasterizerDesc.CullMode = enable ? D3D11_CULL_BACK : D3D11_CULL_NONE;
c.m_pDeviceContext->RSSetState(GetManagedRasterizerState());
c.faceCullEnabled = enable;
}
void Renderer::StateSetFaceCullCW(bool enable)
{
Context &c = getContext();
if (c.faceCullEnabled)
c.rasterizerDesc.CullMode = enable ? D3D11_CULL_BACK : D3D11_CULL_FRONT;
else
c.rasterizerDesc.CullMode = D3D11_CULL_NONE;
c.m_pDeviceContext->RSSetState(GetManagedRasterizerState());
}
void Renderer::StateSetLineWidth(float) {}
void Renderer::StateSetWriteEnable(bool red, bool green, bool blue, bool alpha)
{
Context &c = getContext();
std::uint8_t mask = 0;
mask |= red ? 0x1 : 0;
mask |= green ? 0x2 : 0;
mask |= blue ? 0x4 : 0;
mask |= alpha ? 0x8 : 0;
c.blendDesc.RenderTarget[0].RenderTargetWriteMask = mask;
c.m_pDeviceContext->OMSetBlendState(GetManagedBlendState(), c.blendFactor, 0xFFFFFFFF);
}
void Renderer::StateSetDepthTestEnable(bool enable)
{
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetDepthTestEnable(enable);
return;
}
c.depthStencilDesc.DepthEnable = enable;
c.m_pDeviceContext->OMSetDepthStencilState(GetManagedDepthStencilState(), 0);
c.depthTestEnabled = enable;
}
void Renderer::StateSetAlphaTestEnable(bool enable)
{
Context &c = getContext();
c.alphaTestEnabled = enable;
const float alpha[4] = {0.0f, 0.0f, 0.0f, enable ? c.alphaReference : 0.0f};
D3D11_MAPPED_SUBRESOURCE mapped = {};
c.m_pDeviceContext->Map(c.m_alphaTestBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, alpha, sizeof(alpha));
c.m_pDeviceContext->Unmap(c.m_alphaTestBuffer, 0);
}
void Renderer::StateSetDepthSlopeAndBias(float slope, float bias)
{
Context &c = getContext();
const float scale = 65536.0f;
c.rasterizerDesc.DepthBias = static_cast<int>(bias * scale);
c.rasterizerDesc.SlopeScaledDepthBias = slope * scale;
c.m_pDeviceContext->RSSetState(GetManagedRasterizerState());
}
void Renderer::UpdateFogState()
{
PROFILER_SCOPE("Renderer::UpdateFogState", "UpdateFogState", MP_ORCHID1)
Context &c = getContext();
ID3D11DeviceContext *d3d11 = c.m_pDeviceContext;
float fogParams[4] = {};
if (c.fogEnabled)
{
if (c.fogMode == 1)
{
fogParams[0] = c.fogFarDistance;
fogParams[1] = 1.0f / (c.fogFarDistance - c.fogNearDistance);
fogParams[2] = 1.0f;
}
else
{
fogParams[0] = c.fogDensity;
fogParams[2] = 2.0f;
}
}
const float fogColour[4] = {c.fogColourRed, c.fogColourGreen, c.fogColourBlue, 1.0f};
D3D11_MAPPED_SUBRESOURCE mapped = {};
d3d11->Map(c.m_fogParamsBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, fogParams, sizeof(fogParams));
d3d11->Unmap(c.m_fogParamsBuffer, 0);
d3d11->Map(c.m_fogColourBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, fogColour, sizeof(fogColour));
d3d11->Unmap(c.m_fogColourBuffer, 0);
}
void Renderer::StateSetVertexTextureUV(float u, float v)
{
Context &c = getContext();
const float texgen[4] = {u - 1.0f, v - 1.0f, 0.0f, 0.0f};
D3D11_MAPPED_SUBRESOURCE mapped = {};
c.m_pDeviceContext->Map(c.m_vertexTexcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, texgen, sizeof(texgen));
c.m_pDeviceContext->Unmap(c.m_vertexTexcoordBuffer, 0);
}
void Renderer::UpdateTexGenState()
{
PROFILER_SCOPE("Renderer::UpdateTexGenState", "UpdateTexGenState", MP_ORCHID1)
Context &c = getContext();
D3D11_MAPPED_SUBRESOURCE mapped = {};
c.m_pDeviceContext->Map(c.m_texGenMatricesBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, c.texGenMatrices, sizeof(c.texGenMatrices));
c.m_pDeviceContext->Unmap(c.m_texGenMatricesBuffer, 0);
}
void Renderer::UpdateLightingState()
{
PROFILER_SCOPE("Renderer::UpdateLightingState", "UpdateLightingState", MP_ORCHID1)
Context &c = getContext();
if (!c.lightingDirty || !c.lightingEnabled)
{
return;
}
if (!c.lightEnabled[0])
{
std::memset(&c.lightDirection[0], 0, sizeof(c.lightDirection[0]));
std::memset(&c.lightColour[0], 0, sizeof(c.lightColour[0]));
}
if (!c.lightEnabled[1])
{
std::memset(&c.lightDirection[1], 0, sizeof(c.lightDirection[1]));
std::memset(&c.lightColour[1], 0, sizeof(c.lightColour[1]));
}
const std::size_t lightingBytes = sizeof(c.lightDirection) + sizeof(c.lightColour) + sizeof(c.lightAmbientColour);
D3D11_MAPPED_SUBRESOURCE mapped = {};
c.m_pDeviceContext->Map(c.m_lightingStateBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
std::memcpy(mapped.pData, c.lightDirection, lightingBytes);
c.m_pDeviceContext->Unmap(c.m_lightingStateBuffer, 0);
c.lightingDirty = false;
}
void Renderer::StateSetLightDirection(int light, float x, float y, float z)
{
if (light >= 2)
return;
Context &c = getContext();
if (c.commandBuffer != NULL && c.commandBuffer->isActive != 0)
{
c.commandBuffer->SetLightDirection(light, x, y, z);
return;
}
const std::uint32_t stackIndex = c.stackPos[MATRIX_MODE_MODELVIEW];
const DirectX::XMMATRIX &modelView = c.matrixStacks[MATRIX_MODE_MODELVIEW][stackIndex];
const DirectX::XMVECTOR direction = DirectX::XMVectorSet(x, y, z, 0.0f);
const DirectX::XMVECTOR transformed = DirectX::XMVector3TransformNormal(direction, modelView);
const DirectX::XMVECTOR normalized = DirectX::XMVector3Normalize(transformed);
DirectX::XMStoreFloat4(&c.lightDirection[light], normalized);
c.lightingDirty = true;
}
void Renderer::StateSetViewport(C4JRender::eViewportType viewportType)
{
getContext();
m_ViewportType = viewportType;
const float fullWidth = static_cast<float>(backBufferWidth);
const float fullHeight = static_cast<float>(backBufferHeight);
float x = 0.0f;
float y = 0.0f;
float width = fullWidth;
float height = fullHeight;
switch (viewportType)
{
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
break;
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
y = fullHeight * 0.5f;
height = fullHeight * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
height = fullHeight * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
width = fullWidth * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
x = fullWidth * 0.5f;
width = fullWidth * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
width = fullWidth * 0.5f;
height = fullHeight * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
x = fullWidth * 0.5f;
width = fullWidth * 0.5f;
height = fullHeight * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
y = fullHeight * 0.5f;
width = fullWidth * 0.5f;
height = fullHeight * 0.5f;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
x = fullWidth * 0.5f;
y = fullHeight * 0.5f;
width = fullWidth * 0.5f;
height = fullHeight * 0.5f;
break;
default:
break;
}
D3D11_VIEWPORT viewport = {};
viewport.TopLeftX = x;
viewport.TopLeftY = y;
viewport.Width = width;
viewport.Height = height;
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
m_pDeviceContext->RSSetViewports(1, &viewport);
m_pDeviceContext->OMSetRenderTargets(1, &renderTargetView, depthStencilView);
}
void Renderer::StateSetEnableViewportClipPlanes(bool) {}
void Renderer::StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace)
{
Context &c = getContext();
DirectX::XMVECTOR plane = DirectX::XMVectorSet(x, y, z, w);
if (eyeSpace)
{
DirectX::XMFLOAT4X4 modelView;
std::memset(&modelView, 0, sizeof(modelView));
std::memcpy(&modelView, MatrixGet(MATRIX_MODE_MODELVIEW), sizeof(modelView));
DirectX::XMVECTOR determinant = DirectX::XMVectorZero();
const DirectX::XMMATRIX inverse = DirectX::XMMatrixInverse(&determinant, DirectX::XMLoadFloat4x4(&modelView));
plane = DirectX::XMVector4Transform(plane, inverse);
}
DirectX::XMFLOAT4 transformed;
DirectX::XMStoreFloat4(&transformed, plane);
const int activeSet = eyeSpace ? 0 : 1;
const int inactiveSet = eyeSpace ? 1 : 0;
float *active = reinterpret_cast<float *>(&c.texGenMatrices[activeSet]);
active[col + 0] = transformed.x;
active[col + 4] = transformed.y;
active[col + 8] = transformed.z;
active[col + 12] = transformed.w;
float *inactive = reinterpret_cast<float *>(&c.texGenMatrices[inactiveSet]);
inactive[col + 0] = 0.0f;
inactive[col + 4] = 0.0f;
inactive[col + 8] = 0.0f;
inactive[col + 12] = 0.0f;
}
void Renderer::StateSetStencil(D3D11_COMPARISON_FUNC function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask)
{
Context &c = getContext();
D3D11_DEPTH_STENCIL_DESC desc = c.depthStencilDesc;
desc.StencilEnable = true;
desc.StencilReadMask = stencil_func_mask;
desc.StencilWriteMask = stencil_write_mask;
desc.FrontFace.StencilFunc = function;
desc.BackFace.StencilFunc = function;
ID3D11DepthStencilState *state = NULL;
m_pDevice->CreateDepthStencilState(&desc, &state);
m_pDeviceContext->OMSetDepthStencilState(state, stencil_ref);
if (state != NULL) state->Release();
}
void Renderer::StateSetForceLOD(int LOD)
{
Context &c = getContext();
c.forcedLOD = LOD;
}
void Renderer::StateUpdate()
{
PROFILER_SCOPE("Renderer::StateUpdate", "StateUpdate", MP_ORCHID1)
Context &c = getContext();
StateSetFaceCull(c.faceCullEnabled);
StateSetDepthMask(c.depthWriteEnabled);
StateSetDepthTestEnable(c.depthTestEnabled);
StateSetAlphaTestEnable(c.alphaTestEnabled);
}

View file

@ -0,0 +1,350 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "Renderer.h"
#include "libpng/png.h"
unsigned char* dataStart;
unsigned char *dataCurr;
unsigned char *dataEnd;
DXGI_FORMAT Renderer::textureFormats[] = { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN };
void user_write_data_init(unsigned char* pBuffer, int size)
{
dataStart = pBuffer;
dataCurr = pBuffer;
dataEnd = pBuffer + size;
}
int user_write_data_bytes_written()
{
return static_cast<int>(dataCurr - dataStart);
}
void user_write_data(png_struct_def* png_ptr, unsigned char* src, size_t length)
{
int bytesToWrite = static_cast<int>(dataEnd - dataCurr);
if (static_cast<int>(length) < bytesToWrite)
bytesToWrite = static_cast<int>(length);
memcpy(dataCurr, src, bytesToWrite);
dataCurr += bytesToWrite;
}
void user_flush_data(png_struct_def* png_ptr)
{
// TODO(3UR): this is for a different platform? it's empty in Render_PC.lib but not Render.lib
}
int Renderer::TextureCreate()
{
PROFILER_SCOPE("Renderer::TextureCreate", "TextureCreate", MP_PURPLE4)
for (int i = 0; i < MAX_TEXTURES; i++)
{
if (!m_textures[i].allocated)
{
m_textures[i].texture = NULL;
m_textures[i].allocated = true;
m_textures[i].mipLevels = 1;
m_textures[i].textureFormat = 0;
return i;
}
}
return -1;
}
void Renderer::TextureFree(int idx)
{
PROFILER_SCOPE("Renderer::TextureFree", "TextureFree", MP_PURPLE4)
if (m_textures[idx].texture)
{
m_textures[idx].texture->Release();
m_textures[idx].texture = NULL;
}
if (m_textures[idx].view)
{
m_textures[idx].view->Release();
m_textures[idx].view = NULL;
}
m_textures[idx].allocated = false;
}
void Renderer::TextureBind(int idx)
{
PROFILER_SCOPE("Renderer::TextureBind", "TextureBind", MP_PURPLE4)
if (idx == -1)
idx = defaultTextureIndex;
Context& c = getContext();
if (c.commandBuffer && c.commandBuffer->isActive)
c.commandBuffer->BindTexture(idx);
c.textureIdx = idx;
c.m_pDeviceContext->PSSetShaderResources(0, 1, &m_textures[idx].view);
UpdateTextureState(false);
}
void Renderer::TextureBindVertex(int idx)
{
PROFILER_SCOPE("Renderer::TextureBindVertex", "TextureBindVertex", MP_PURPLE4)
if (idx == -1)
idx = defaultTextureIndex;
Context& c = getContext();
c.textureIdx = idx;
c.m_pDeviceContext->VSSetShaderResources(0, 1, &m_textures[idx].view);
UpdateTextureState(true);
}
void Renderer::TextureSetTextureLevels(int levels)
{
Context& c = getContext();
m_textures[c.textureIdx].mipLevels = levels;
}
int Renderer::TextureGetTextureLevels()
{
Context& c = getContext();
return m_textures[c.textureIdx].mipLevels;
}
void Renderer::TextureData(int width, int height, void* data, int level, C4JRender::eTextureFormat format)
{
PROFILER_SCOPE("Renderer::TextureData", "TextureData", MP_PURPLE4)
Context& c = getContext();
int idx = c.textureIdx;
m_textures[idx].textureFormat = format;
if (level == 0)
{
D3D11_TEXTURE2D_DESC desc;
desc.Width = width;
desc.Height = height;
desc.MipLevels = m_textures[idx].mipLevels;
desc.ArraySize = 1;
desc.Format = textureFormats[format];
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
m_pDevice->CreateTexture2D(&desc, NULL, &m_textures[idx].texture);
m_pDevice->CreateShaderResourceView(m_textures[idx].texture, NULL, &m_textures[idx].view);
}
c.m_pDeviceContext->UpdateSubresource(
m_textures[idx].texture,
level,
NULL,
data,
static_cast<UINT>(width * 4),
static_cast<UINT>(width * height * 4)
);
}
void Renderer::TextureDataUpdate(int xoffset, int yoffset, int width, int height, void* data, int level)
{
PROFILER_SCOPE("Renderer::TextureDataUpdate", "TextureDataUpdate", MP_PURPLE4)
Context& c = getContext();
int idx = c.textureIdx;
D3D11_TEXTURE2D_DESC desc;
m_textures[idx].texture->GetDesc(&desc);
D3D11_BOX box;
box.left = xoffset;
box.top = yoffset;
box.right = xoffset + width;
box.bottom = yoffset + height;
box.front = 0;
box.back = 1;
c.m_pDeviceContext->UpdateSubresource(
m_textures[idx].texture,
level,
&box,
data,
static_cast<UINT>(width * 4),
static_cast<UINT>(width * height * 4)
);
}
void Renderer::TextureSetParam(int param, int value)
{
Context& c = getContext();
int idx = c.textureIdx;
switch (param)
{
case GL_TEXTURE_MIN_FILTER:
m_textures[idx].samplerParams &= ~4u;
if (value == GL_LINEAR)
m_textures[idx].samplerParams |= 4u;
break;
case GL_TEXTURE_MAG_FILTER:
m_textures[idx].samplerParams &= ~8u;
if (value == GL_LINEAR)
m_textures[idx].samplerParams |= 8u;
break;
case GL_TEXTURE_WRAP_S:
m_textures[idx].samplerParams &= ~1u;
if (value == GL_CLAMP)
m_textures[idx].samplerParams |= 1u;
break;
case GL_TEXTURE_WRAP_T:
m_textures[idx].samplerParams &= ~2u;
if (value == GL_CLAMP)
m_textures[idx].samplerParams |= 2u;
break;
}
}
void Renderer::TextureDynamicUpdateStart()
{
// TODO(3UR): this is for a different platform? it's empty in Render_PC.lib but not Render.lib
}
void Renderer::TextureDynamicUpdateEnd()
{
// TODO(3UR): this is for a different platform? it's empty in Render_PC.lib but not Render.lib
}
void Renderer::UpdateTextureState(bool bVertex)
{
Context& c = getContext();
ID3D11SamplerState* pSampler = GetManagedSamplerState();
if (bVertex)
c.m_pDeviceContext->VSSetSamplers(0, 1, &pSampler);
else
c.m_pDeviceContext->PSSetSamplers(0, 1, &pSampler);
}
HRESULT Renderer::LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
PROFILER_SCOPE("Renderer::LoadTextureData_File", "LoadTextureData_File", MP_PURPLE4)
png_image image;
memset(&image, 0, sizeof(image));
image.version = PNG_IMAGE_VERSION;
if (!png_image_begin_read_from_file(&image, szFilename))
return -1;
// TODO(3UR): why crash?
//if ((image.format & 3u) > 1)
// return -1;
image.format = PNG_FORMAT_BGRA;
*ppDataOut = new int[image.width * image.height];
if (!*ppDataOut || !png_image_finish_read(&image, NULL, *ppDataOut, 0, NULL))
return -1;
pSrcInfo->Width = image.width;
pSrcInfo->Height = image.height;
return S_OK;
}
HRESULT Renderer::LoadTextureData(BYTE* pbData, DWORD dwBytes, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut)
{
PROFILER_SCOPE("Renderer::LoadTextureData_Memory", "LoadTextureData_Memory", MP_PURPLE4)
png_image image;
memset(&image, 0, sizeof(image));
image.version = PNG_IMAGE_VERSION;
if (!png_image_begin_read_from_memory(&image, pbData, dwBytes))
return -1;
// TODO(3UR): why crash?
//if ((image.format & 3u) > 1)
// return -1;
image.format = PNG_FORMAT_BGRA;
*ppDataOut = new int[image.width * image.height];
if (!*ppDataOut || !png_image_finish_read(&image, NULL, *ppDataOut, 0, NULL))
return -1;
pSrcInfo->Width = image.width;
pSrcInfo->Height = image.height;
return S_OK;
}
HRESULT Renderer::SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int* ppDataOut)
{
PROFILER_SCOPE("Renderer::SaveTextureData", "SaveTextureData", MP_PURPLE4)
png_image image;
memset(&image, 0, sizeof(image));
image.width = pSrcInfo->Width;
image.height = pSrcInfo->Height;
image.version = PNG_IMAGE_VERSION;
image.format = PNG_FORMAT_BGRA;
png_image_write_to_file(&image, szFilename, 0, ppDataOut, 0, NULL);
return S_OK;
}
HRESULT Renderer::SaveTextureDataToMemory(void* pOutput, int outputCapacity, int* outputLength, int width, int height, int* ppDataIn)
{
PROFILER_SCOPE("Renderer::SaveTextureDataToMemory", "SaveTextureDataToMemory", MP_PURPLE4)
png_image image;
memset(&image, 0, sizeof(image));
image.width = width;
image.height = height;
image.version = PNG_IMAGE_VERSION;
image.format = PNG_FORMAT_RGBA;
dataEnd = (BYTE*)pOutput + outputCapacity;
dataStart = (BYTE*)pOutput;
dataCurr = (BYTE*)pOutput;
png_image_write_to_stdio(&image, NULL, 0, ppDataIn, 0, NULL, user_write_data, user_flush_data);
*outputLength = static_cast<int>(dataCurr - dataStart);
return S_OK;
}
void Renderer::TextureGetStats()
{
// TODO(3UR): this is for a different platform? it's empty in Render_PC.lib but not Render.lib
}
ID3D11ShaderResourceView* Renderer::TextureGetTexture(int idx)
{
if ((unsigned int)idx <= 511)
{
if (m_textures[idx].allocated)
return m_textures[idx].view;
}
return NULL;
}

View file

@ -0,0 +1,185 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"
#include "Renderer.h"
void Renderer::DrawVertexBuffer(C4JRender::ePrimitiveType PrimitiveType, int count, ID3D11Buffer *buffer, C4JRender::eVertexType vType,
C4JRender::ePixelShaderType psType)
{
PROFILER_SCOPE("Renderer::DrawVertexBuffer", "DrawVertexBuffer", MP_RED2)
Renderer::Context &c = getContext();
ID3D11DeviceContext *d3d11 = c.m_pDeviceContext;
int drawCount = count;
bool indexed = false;
PROFILER_SCOPE("Renderer::DrawVertexBuffer", "DrawVertexSetup", MP_RED2)
DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
StateUpdate();
const UINT stride = vertexStrideTable[vType];
const UINT offset = 0;
d3d11->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
if (indexed)
d3d11->DrawIndexed(drawCount, 0, 0);
else
d3d11->Draw(count, 0);
}
void Renderer::DrawVertexSetup(C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType, C4JRender::ePrimitiveType PrimitiveType, int *count,
bool *indexed)
{
PROFILER_SCOPE("Renderer::DrawVertexSetup", "DrawVertexSetup", MP_RED2)
Renderer::Context &c = getContext();
ID3D11DeviceContext *d3d11 = c.m_pDeviceContext;
C4JRender::eVertexType effectiveVertexType = vType;
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && c.lightingEnabled)
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
if (effectiveVertexType != activeVertexType)
{
d3d11->VSSetShader(vertexShaderTable[effectiveVertexType], NULL, 0);
d3d11->IASetInputLayout(inputLayoutTable[effectiveVertexType]);
activeVertexType = effectiveVertexType;
}
if (psType != activePixelType)
{
d3d11->PSSetShader(pixelShaderTable[psType], NULL, 0);
activePixelType = psType;
}
D3D11_MAPPED_SUBRESOURCE mapped = {};
if (c.matrixDirty[MATRIX_MODE_MODELVIEW])
{
d3d11->Map(c.m_modelViewMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
memcpy(mapped.pData, MatrixGet(MATRIX_MODE_MODELVIEW), sizeof(DirectX::XMMATRIX));
d3d11->Unmap(c.m_modelViewMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW] = false;
}
if (c.matrixDirty[MATRIX_MODE_MODELVIEW_PROJECTION])
{
d3d11->Map(c.m_projectionMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
memcpy(mapped.pData, MatrixGet(MATRIX_MODE_MODELVIEW_PROJECTION), sizeof(DirectX::XMMATRIX));
d3d11->Unmap(c.m_projectionMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW_PROJECTION] = false;
}
if (c.matrixDirty[MATRIX_MODE_MODELVIEW_TEXTURE])
{
d3d11->Map(c.m_textureMatrix, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
memcpy(mapped.pData, MatrixGet(MATRIX_MODE_MODELVIEW_TEXTURE), sizeof(DirectX::XMMATRIX));
d3d11->Unmap(c.m_textureMatrix, 0);
c.matrixDirty[MATRIX_MODE_MODELVIEW_TEXTURE] = false;
}
UpdateFogState();
UpdateViewportState();
UpdateLightingState();
UpdateTexGenState();
d3d11->IASetPrimitiveTopology(g_topologies[PrimitiveType]);
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_QUAD_LIST)
{
d3d11->IASetIndexBuffer(quadIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
*count = (*count * 6) / 4;
*indexed = true;
return;
}
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN)
{
d3d11->IASetIndexBuffer(fanIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
*count = (*count - 2) * 3;
*indexed = true;
return;
}
d3d11->IASetIndexBuffer(NULL, DXGI_FORMAT_R16_UINT, 0);
*indexed = false;
}
void Renderer::DrawVertices(C4JRender::ePrimitiveType PrimitiveType, int count, void *vertices, C4JRender::eVertexType vType,
C4JRender::ePixelShaderType psType)
{
PROFILER_SCOPE("Renderer::DrawVertices", "DrawVertices", MP_RED2)
Renderer::Context &c = getContext();
ID3D11DeviceContext *d3d11 = c.m_pDeviceContext;
Renderer::CommandBuffer *commandBuffer = c.commandBuffer;
if (commandBuffer != NULL)
{
C4JRender::eVertexType effectiveVertexType = vType;
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && c.lightingEnabled)
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
c.recordingPrimitiveType = PrimitiveType;
c.recordingVertexType = effectiveVertexType;
const UINT stride = vertexStrideTable[effectiveVertexType];
commandBuffer->AddVertices(stride, static_cast<UINT>(count), vertices, c);
return;
}
int drawCount = count;
bool indexed = false;
PROFILER_SCOPE("Renderer::DrawVertices", "DrawVertexSetup", MP_RED2)
DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
const UINT stride = vertexStrideTable[vType];
const UINT vertexBytes = stride * static_cast<UINT>(count);
assert(vertexBytes <= Context::VERTEX_BUFFER_SIZE);
UINT vertexOffset = c.dynamicVertexOffset;
if (vertexOffset + vertexBytes > Context::VERTEX_BUFFER_SIZE)
vertexOffset = 0;
D3D11_MAPPED_SUBRESOURCE mapped = {};
const D3D11_MAP mapType = vertexOffset == 0 ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
const HRESULT hr = d3d11->Map(c.dynamicVertexBuffer, 0, mapType, 0, &mapped);
if (FAILED(hr))
printf("ERROR: 0x%x\n", static_cast<unsigned int>(hr));
memcpy(reinterpret_cast<std::uint8_t *>(mapped.pData) + vertexOffset, vertices, vertexBytes);
d3d11->Unmap(c.dynamicVertexBuffer, 0);
StateUpdate();
ID3D11Buffer *dynamicBuffer = c.dynamicVertexBuffer;
d3d11->IASetVertexBuffers(0, 1, &dynamicBuffer, &stride, &vertexOffset);
if (indexed)
d3d11->DrawIndexed(drawCount, 0, 0);
else
d3d11->Draw(count, 0);
c.dynamicVertexOffset = vertexOffset + vertexBytes;
}

View file

@ -0,0 +1,295 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
int4 vPosComp : POSITION0,
int4 vTexComp : TEXCOORD0,
out float4 oPos : SV_POSITION0,
out float4 oCol : COLOR0,
out float4 oTex : TEXCOORD0)
{
// Unpack Compressed Position
float4 pos = float4(vPosComp);
pos.xyz = (pos.xyz * 0.0009765625) + vecWV2Trans.xyz;
pos.w += 32768.0;
float3 lightUV = frac(pos.www * float3(1.52587891e-05, 0.00048828125, 0.03125));
float4 posWV = mul(matWV, pos);
oPos = mul(matP, posWV);
// Unpack UVs
float4 unpackedTex = float4(vTexComp.zwxy) * float4(0.00390625, 0.00390625, 0.000122070312, 0.000122070312);
float2 finalUV = frac(max(vecUVT2.xy, unpackedTex.xy));
oTex.xy = unpackedTex.zw;
float4 sampledLight = light_texture.SampleLevel(light_sampler_s, finalUV, 0);
oCol = float4(sampledLight.xyz * lightUV, 1.0);
// Fog
float depth = posWV.z;
float fogLinear = saturate(vecFog.y * (vecFog.x + depth));
float fogExp2 = min(1.0, exp2(1.44269502 * (vecFog.x * depth)));
oTex.z = (vecFog.z == 1.0) ? fogLinear : ((vecFog.z == 2.0) ? fogExp2 : 1.0);
oTex.w = 1.0;
}
*/
static unsigned char g_main_VS_Compressed[] =
{
0x44, 0x58, 0x42, 0x43, 0x1F, 0x76, 0x17, 0xC2, 0xF2, 0x5A,
0x47, 0x81, 0x55, 0xD3, 0x6E, 0xD1, 0x0A, 0xB0, 0xBF, 0x4A,
0x01, 0x00, 0x00, 0x00, 0xF8, 0x08, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
0x64, 0x03, 0x00, 0x00, 0xD8, 0x03, 0x00, 0x00, 0x7C, 0x08,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xD4, 0x02, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0xFC, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0A, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4D, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x51, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x6C, 0x69, 0x67, 0x68, 0x74, 0x5F, 0x73, 0x61,
0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00, 0x6C, 0x69, 0x67, 0x68,
0x74, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00,
0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x72,
0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x57, 0x56, 0x00,
0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x72,
0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x50, 0x72, 0x6F,
0x6A, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x55,
0x56, 0x32, 0x00, 0x66, 0x6F, 0x67, 0x00, 0x70, 0x6F, 0x73,
0x69, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73,
0x66, 0x6F, 0x72, 0x6D, 0x32, 0x00, 0x18, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2C, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x02,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x42, 0x01, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x2C, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x02, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x51, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x7C, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6D, 0x61, 0x74, 0x57, 0x56, 0x00, 0xAB, 0xAB, 0x03, 0x00,
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x24, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61,
0x74, 0x50, 0x00, 0xAB, 0xAB, 0xAB, 0x44, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x4C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x76, 0x65, 0x63, 0x55, 0x56, 0x54, 0x32, 0x00, 0x01, 0x00,
0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x4C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x65,
0x63, 0x46, 0x6F, 0x67, 0x00, 0xAB, 0x94, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x4C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x76, 0x65, 0x63, 0x57, 0x56, 0x32, 0x54, 0x72, 0x61, 0x6E,
0x73, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C,
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F,
0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E, 0x33,
0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E, 0x31, 0x36, 0x33,
0x38, 0x34, 0x00, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x4C, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x0F, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x50, 0x4F,
0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x54, 0x45, 0x58,
0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0xAB, 0x4F, 0x53,
0x47, 0x4E, 0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50,
0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F,
0x4C, 0x4F, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F,
0x52, 0x44, 0x00, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x9C, 0x04,
0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x27, 0x01, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x5A, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x5F, 0x00,
0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xF2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00,
0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00,
0x2B, 0x00, 0x00, 0x05, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x1E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0D, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3A, 0x00, 0x00,
0x80, 0x3A, 0x00, 0x00, 0x80, 0x3A, 0x00, 0x00, 0x00, 0x00,
0x46, 0x82, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47,
0x38, 0x00, 0x00, 0x0A, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x37, 0x00, 0x00,
0x00, 0x3A, 0x00, 0x00, 0x00, 0x3D, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x0A, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xA6, 0x0A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x05,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE6, 0x14,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00,
0x00, 0x39, 0x00, 0x00, 0x00, 0x39, 0x34, 0x00, 0x00, 0x08,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0xE6, 0x0A, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1A, 0x00,
0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00,
0x00, 0x0B, 0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x20, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x00, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x80, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x80, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x3B, 0xAA,
0xB8, 0x3F, 0x19, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x33, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x38, 0x20, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x80, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x00, 0x0B, 0xC2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA6, 0x8A, 0x20, 0x00, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x3F, 0x00, 0x00, 0x00, 0x40, 0x37, 0x00, 0x00, 0x09,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00,
0x80, 0x3F, 0x37, 0x00, 0x00, 0x09, 0x42, 0x20, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x3E, 0x00,
0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,324 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : POSITION0,
float4 vCol : COLOR0,
float3 vNorm : NORMAL0,
float4 vTex0 : TEXCOORD0,
int2 vTex1 : TEXCOORD1,
out float4 oPos : SV_POSITION0,
out float4 oCol : COLOR0,
out float4 oTex : TEXCOORD0)
{
// World/View/Projection Transforms
float4 posWV2 = mul(matWV2, vPos);
float4 posWV = mul(matWV, posWV2);
oPos = mul(matP, posWV);
// Lightmap Sampling
float2 lightmapUV = frac(max(vecUVT2.xy, float2(vTex1) * 0.00390625));
float4 lightColor = light_texture.SampleLevel(light_sampler_s, lightmapUV, 0);
oCol = vCol.wzyx * float4(lightColor.xyz, 1.0);
// Fog Calculation
float depth = posWV.z;
float fogLinear = saturate(vecFog.y * (vecFog.x + depth));
float fogExp2 = min(1.0, exp2(1.44269502 * (vecFog.x * depth)));
oTex.z = (vecFog.z == 1.0) ? fogLinear : ((vecFog.z == 2.0) ? fogExp2 : 1.0);
// UV Transform
oTex.xy = mul(float3x2(matUV._m00_m10, matUV._m01_m11, matUV._m03_m13), float3(vTex0.xy, 1.0));
oTex.w = 1.0;
}
*/
static unsigned char g_main_VS_PF3_TF2_CB4_NB4_XW1[] =
{
0x44, 0x58, 0x42, 0x43, 0x83, 0x66, 0x28, 0xAB, 0x3F, 0xFA,
0xEB, 0x49, 0x6F, 0xE0, 0x81, 0x37, 0x2A, 0x0E, 0x62, 0x6E,
0x01, 0x00, 0x00, 0x00, 0x30, 0x0A, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x78, 0x03, 0x00, 0x00,
0x20, 0x04, 0x00, 0x00, 0x94, 0x04, 0x00, 0x00, 0xB4, 0x09,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x3C, 0x03, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x1C, 0x01,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x2A, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x61, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x77, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x88, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x93, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x6C, 0x69, 0x67, 0x68, 0x74, 0x5F,
0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00, 0x6C, 0x69,
0x67, 0x68, 0x74, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E,
0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x57,
0x56, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E,
0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D, 0x57,
0x56, 0x32, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F,
0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72, 0x6D,
0x50, 0x72, 0x6F, 0x6A, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75,
0x72, 0x65, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72,
0x6D, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x55,
0x56, 0x32, 0x00, 0x66, 0x6F, 0x67, 0x00, 0xAB, 0x38, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x4C, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x58, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x77, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x02,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xB8, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE8, 0x02, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x74, 0x57,
0x56, 0x00, 0xAB, 0xAB, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x74, 0x57, 0x56, 0x32,
0x00, 0xAB, 0x90, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x74, 0x50,
0x00, 0xAB, 0xAB, 0xAB, 0xB0, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61,
0x74, 0x55, 0x56, 0x00, 0xAB, 0xAB, 0xD0, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xD8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x76, 0x65, 0x63, 0x55, 0x56, 0x54, 0x32, 0x00, 0x01, 0x00,
0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xD8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x65,
0x63, 0x46, 0x6F, 0x67, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F,
0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48,
0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20,
0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E,
0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xAB, 0xAB, 0x49, 0x53,
0x47, 0x4E, 0xA0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x89, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F,
0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
0x96, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x03, 0x03, 0x00, 0x00, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49,
0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x4E,
0x4F, 0x52, 0x4D, 0x41, 0x4C, 0x00, 0x54, 0x45, 0x58, 0x43,
0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E,
0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53,
0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F,
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x18, 0x05, 0x00, 0x00,
0x40, 0x00, 0x01, 0x00, 0x46, 0x01, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x5A, 0x00, 0x00, 0x03, 0x00, 0x60,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04,
0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03,
0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x5F, 0x00,
0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
0x67, 0x00, 0x00, 0x04, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03,
0xF2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00,
0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xA6, 0x1A, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xF6, 0x1F, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x0A, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x0A,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x20,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF6, 0x0F,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x05, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0A, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00,
0x80, 0x3B, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x08, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x05,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0B,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x38, 0x00, 0x00, 0x07, 0xF2, 0x20, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0xB6, 0x11, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80,
0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x80, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x3B, 0xAA, 0xB8, 0x3F,
0x19, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x33, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x38, 0x20,
0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80,
0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x0B, 0xC2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0xA6, 0x8A, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x00, 0x00, 0x00, 0x40, 0x37, 0x00, 0x00, 0x09, 0x22, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x37, 0x00, 0x00, 0x09, 0x42, 0x20, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15,
0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x80, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x80,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00,
0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,417 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : POSITION0,
float4 vCol : COLOR0,
float3 vNorm : NORMAL0,
float4 vTex0 : TEXCOORD0,
int2 vTex1 : TEXCOORD1,
out float4 oPos : SV_POSITION0,
out float4 oCol : COLOR0,
out float4 oTex : TEXCOORD0)
{
float4 posWV2 = mul(matWV2, vPos);
float4 posWV = mul(matWV, posWV2);
oPos = mul(matP, posWV);
// Normal transform & Lighting
float3 normWV2 = mul((float3x3)matWV2, vNorm);
float3 normWV = normalize(mul((float3x3)matWV, normWV2));
float NdotL0 = max(0.0, dot(vecLight0.xyz, normWV));
float NdotL1 = max(0.0, dot(vecLight1.xyz, normWV));
float4 lighting = saturate(vecLightAmbientCol + (vecLight0Col * NdotL0) + (vecLight1Col * NdotL1));
float2 lightmapUV = frac(max(vecUVT2.xy, float2(vTex1) * 0.00390625));
float4 sampledLight = light_texture.SampleLevel(light_sampler_s, lightmapUV, 0);
oCol.xyz = lighting.xyz * (vCol.wzy * sampledLight.xyz);
oCol.w = lighting.w;
// Fog & UV
float depth = posWV.z;
float fogLinear = saturate(vecFog.y * (vecFog.x + depth));
float fogExp2 = min(1.0, exp2(1.44269502 * (vecFog.x * depth)));
oTex.z = (vecFog.z == 1.0) ? fogLinear : ((vecFog.z == 2.0) ? fogExp2 : 1.0);
oTex.xy = mul(float3x2(matUV._m00_m10, matUV._m01_m11, matUV._m03_m13), float3(vTex0.xy, 1.0));
oTex.w = 1.0;
}
*/
static unsigned char g_main_VS_PF3_TF2_CB4_NB4_XW1_LIGHTING[] =
{
0x44, 0x58, 0x42, 0x43, 0x94, 0x85, 0x62, 0xA8, 0x82, 0x54,
0xB8, 0xE6, 0x16, 0x24, 0x6D, 0x3A, 0xB4, 0x0D, 0x4A, 0x7C,
0x01, 0x00, 0x00, 0x00, 0x80, 0x0D, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x84, 0x04, 0x00, 0x00,
0x2C, 0x05, 0x00, 0x00, 0xA0, 0x05, 0x00, 0x00, 0x04, 0x0D,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x48, 0x04, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x13, 0x04, 0x00, 0x00, 0x3C, 0x01,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x4A, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0x58, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x97, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xA8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xB3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xB7, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6C, 0x69, 0x67, 0x68,
0x74, 0x5F, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00,
0x6C, 0x69, 0x67, 0x68, 0x74, 0x5F, 0x74, 0x65, 0x78, 0x74,
0x75, 0x72, 0x65, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69,
0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72,
0x6D, 0x57, 0x56, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69,
0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72,
0x6D, 0x57, 0x56, 0x32, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74,
0x69, 0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F,
0x72, 0x6D, 0x50, 0x72, 0x6F, 0x6A, 0x00, 0x74, 0x65, 0x78,
0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66,
0x6F, 0x72, 0x6D, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x55, 0x56, 0x32, 0x00, 0x66, 0x6F, 0x67, 0x00, 0x6C,
0x69, 0x67, 0x68, 0x74, 0x69, 0x6E, 0x67, 0x00, 0x58, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x98, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xB8, 0x02, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x97, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD8, 0x02,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA8, 0x01, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xF8, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB3, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xB7, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x48, 0x03, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6D, 0x61, 0x74, 0x57, 0x56, 0x00, 0xAB, 0xAB, 0x03, 0x00,
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB0, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61,
0x74, 0x57, 0x56, 0x32, 0x00, 0xAB, 0xD0, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6D, 0x61, 0x74, 0x50, 0x00, 0xAB, 0xAB, 0xAB, 0xF0, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6D, 0x61, 0x74, 0x55, 0x56, 0x00, 0xAB, 0xAB,
0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0x65, 0x63, 0x55, 0x56, 0x54,
0x32, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0x65, 0x63, 0x46, 0x6F, 0x67, 0x00, 0xAB,
0xC0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xCC, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xDC, 0x03, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xCC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x03,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF3, 0x03, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x76, 0x65, 0x63, 0x4C, 0x69, 0x67, 0x68, 0x74, 0x30, 0x00,
0xAB, 0xAB, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x65,
0x63, 0x4C, 0x69, 0x67, 0x68, 0x74, 0x31, 0x00, 0x76, 0x65,
0x63, 0x4C, 0x69, 0x67, 0x68, 0x74, 0x30, 0x43, 0x6F, 0x6C,
0x00, 0x76, 0x65, 0x63, 0x4C, 0x69, 0x67, 0x68, 0x74, 0x31,
0x43, 0x6F, 0x6C, 0x00, 0x76, 0x65, 0x63, 0x4C, 0x69, 0x67,
0x68, 0x74, 0x41, 0x6D, 0x62, 0x69, 0x65, 0x6E, 0x74, 0x43,
0x6F, 0x6C, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53,
0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43,
0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39, 0x2E,
0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E, 0x31, 0x36,
0x33, 0x38, 0x34, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E,
0xA0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0E, 0x00, 0x00,
0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x07, 0x07, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x96, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x03,
0x00, 0x00, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E,
0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x4E, 0x4F, 0x52,
0x4D, 0x41, 0x4C, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F,
0x52, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, 0x6C, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x62, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54,
0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00,
0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB,
0x53, 0x48, 0x44, 0x52, 0x5C, 0x07, 0x00, 0x00, 0x40, 0x00,
0x01, 0x00, 0xD7, 0x01, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x04, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x5A, 0x00,
0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03,
0xF2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00,
0x00, 0x03, 0xE2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10,
0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04,
0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xA6, 0x1A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0xF6, 0x1F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xA6, 0x0A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xA6, 0x0A, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0A, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0xB2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x46, 0x88, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xB2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x88, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x0C, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xB2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x88, 0x20, 0x00, 0x01, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x1A, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x0C, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x72, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0x72, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xB2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x88, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xF6, 0x0F,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x08, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x07, 0x12, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x03, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x03, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x44, 0x00, 0x00, 0x05, 0x12, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xB2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0C, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x03, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x03, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x07, 0x12, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x05, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0A, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00,
0x80, 0x3B, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x08, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x05,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0B,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0xB2, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x08, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0xB6, 0x17, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x07, 0x72, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05,
0x82, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3A, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80,
0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x3B, 0xAA, 0xB8, 0x3F, 0x19, 0x00,
0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00,
0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40,
0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x38, 0x20, 0x00, 0x08,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x0B, 0xC2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA6, 0x8A, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00,
0x00, 0x40, 0x37, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x37, 0x00,
0x00, 0x09, 0x42, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x32, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00,
0x03, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x80,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x00,
0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x3E, 0x00,
0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,376 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
float4 vPos : POSITION0,
float4 vCol : COLOR0,
float3 vNorm : NORMAL0,
float4 vTex0 : TEXCOORD0,
int2 vTex1 : TEXCOORD1,
out float4 oPos : SV_POSITION0,
out float4 oCol : COLOR0,
out float4 oTex : TEXCOORD0)
{
float4 posWV2 = mul(matWV2, vPos);
float4 posWV = mul(matWV, posWV2);
oPos = mul(matP, posWV);
float2 lightmapUV = frac(max(vecUVT2.xy, float2(vTex1) * 0.00390625));
float4 lightColor = light_texture.SampleLevel(light_sampler_s, lightmapUV, 0);
oCol = vCol.wzyx * float4(lightColor.xyz, 1.0);
// TexGen
float4 eyeGen = mul(matTexGenEye, posWV);
float4 objGen = mul(matTexGenObj, vPos);
float4 texGen = objGen + eyeGen;
oTex.xyw = mul(float3x3(matUV._m00_m10_m30, matUV._m01_m11_m31, matUV._m02_m12_m32), texGen.xyw);
// Fog
float depth = posWV.z;
float fogLinear = saturate(vecFog.y * (vecFog.x + depth));
float fogExp2 = min(1.0, exp2(1.44269502 * (vecFog.x * depth)));
oTex.z = (vecFog.z == 1.0) ? fogLinear : ((vecFog.z == 2.0) ? fogExp2 : 1.0);
}
*/
static unsigned char g_main_VS_PF3_TF2_CB4_NB4_XW1_TEXGEN[] =
{
0x44, 0x58, 0x42, 0x43, 0xD7, 0x13, 0x1B, 0xCA, 0xDF, 0xE8,
0xA9, 0xCC, 0xDA, 0x19, 0x1B, 0x6D, 0x0C, 0x53, 0xED, 0xEE,
0x01, 0x00, 0x00, 0x00, 0x28, 0x0C, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,
0xAC, 0x04, 0x00, 0x00, 0x20, 0x05, 0x00, 0x00, 0xAC, 0x0B,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xC8, 0x03, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x92, 0x03, 0x00, 0x00, 0x3C, 0x01,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x4A, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0D, 0x00,
0x00, 0x00, 0x58, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x97, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xA8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xB3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xB7, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6C, 0x69, 0x67, 0x68,
0x74, 0x5F, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x00,
0x6C, 0x69, 0x67, 0x68, 0x74, 0x5F, 0x74, 0x65, 0x78, 0x74,
0x75, 0x72, 0x65, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69,
0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72,
0x6D, 0x57, 0x56, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x69,
0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F, 0x72,
0x6D, 0x57, 0x56, 0x32, 0x00, 0x70, 0x6F, 0x73, 0x69, 0x74,
0x69, 0x6F, 0x6E, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66, 0x6F,
0x72, 0x6D, 0x50, 0x72, 0x6F, 0x6A, 0x00, 0x74, 0x65, 0x78,
0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x66,
0x6F, 0x72, 0x6D, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x55, 0x56, 0x32, 0x00, 0x66, 0x6F, 0x67, 0x00, 0x74,
0x65, 0x78, 0x67, 0x65, 0x6E, 0x00, 0xAB, 0xAB, 0x58, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x98, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xB8, 0x02, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x97, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD8, 0x02,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA8, 0x01, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xF8, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB3, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xB7, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x48, 0x03, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6D, 0x61, 0x74, 0x57, 0x56, 0x00, 0xAB, 0xAB, 0x03, 0x00,
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB0, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61,
0x74, 0x57, 0x56, 0x32, 0x00, 0xAB, 0xD0, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6D, 0x61, 0x74, 0x50, 0x00, 0xAB, 0xAB, 0xAB, 0xF0, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6D, 0x61, 0x74, 0x55, 0x56, 0x00, 0xAB, 0xAB,
0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0x65, 0x63, 0x55, 0x56, 0x54,
0x32, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0x65, 0x63, 0x46, 0x6F, 0x67, 0x00, 0xAB,
0x78, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x85, 0x03, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61,
0x74, 0x54, 0x65, 0x78, 0x47, 0x65, 0x6E, 0x45, 0x79, 0x65,
0x00, 0x6D, 0x61, 0x74, 0x54, 0x65, 0x78, 0x47, 0x65, 0x6E,
0x4F, 0x62, 0x6A, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73,
0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C,
0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20,
0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39,
0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E, 0x31,
0x36, 0x33, 0x38, 0x34, 0x00, 0xAB, 0xAB, 0xAB, 0x49, 0x53,
0x47, 0x4E, 0xA0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x89, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F,
0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x96, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x03, 0x03, 0x00, 0x00, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49,
0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x4E,
0x4F, 0x52, 0x4D, 0x41, 0x4C, 0x00, 0x54, 0x45, 0x58, 0x43,
0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E,
0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53,
0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F,
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x84, 0x06, 0x00, 0x00,
0x40, 0x00, 0x01, 0x00, 0xA1, 0x01, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x02, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04,
0x46, 0x8E, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x59, 0x00,
0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E,
0x20, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x5A, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x5F, 0x00,
0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xF2, 0x20,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x03, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x1A,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF6, 0x1F,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xA6, 0x0A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xA6, 0x0A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00,
0x00, 0x0A, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x8E, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0xF6, 0x0F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x0E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2B, 0x00,
0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x10, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x0A, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40,
0x00, 0x00, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, 0x80, 0x3B,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00,
0x00, 0x08, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x80,
0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x0B, 0xF2, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x7E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3F, 0x38, 0x00, 0x00, 0x07, 0xF2, 0x20,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0xB6, 0x11, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x07, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA6, 0x0A,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00,
0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF6, 0x0F,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x07, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0xA6, 0x1A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xF2, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8E,
0x20, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0xF6, 0x1F, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0xF2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0E,
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xB2, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x8C, 0x20, 0x00, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xB2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8C,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xB2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8C,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xA6, 0x0A, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A,
0xB2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8C,
0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0xF6, 0x0F, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0C,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0x08, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80,
0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x3B, 0xAA, 0xB8, 0x3F, 0x19, 0x00,
0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00,
0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40,
0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x38, 0x20, 0x00, 0x08,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x20, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x0B, 0xC2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA6, 0x8A, 0x20, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00,
0x00, 0x40, 0x37, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x37, 0x00,
0x00, 0x09, 0x42, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54,
0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};

View file

@ -0,0 +1,105 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
uint vID : SV_VertexID0,
out float4 oPos : SV_POSITION0)
{
float x = (float)(((vID << 1) & 2) - 1);
float y = (float)((vID & 0xFFFFFFFE) - 1);
oPos = float4(x, y, 1.0, 1.0);
}
*/
static unsigned char g_main_VS_ScreenClear[] =
{
0x44, 0x58, 0x42, 0x43, 0xFB, 0x82, 0xC7, 0xF7, 0x5E, 0x97,
0x42, 0x30, 0xDA, 0xAE, 0x62, 0x79, 0x54, 0x21, 0x37, 0xA2,
0x01, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00,
0xC0, 0x00, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00, 0x04, 0x02,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x4D, 0x69,
0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52,
0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61,
0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C,
0x65, 0x72, 0x20, 0x39, 0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32,
0x30, 0x30, 0x2E, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xAB,
0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x53, 0x56, 0x5F, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49,
0x44, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54,
0x49, 0x4F, 0x4E, 0x00, 0x53, 0x48, 0x44, 0x52, 0x08, 0x01,
0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x42, 0x00, 0x00, 0x00,
0x60, 0x00, 0x00, 0x04, 0x12, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04,
0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
0x29, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x07,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x2B, 0x00, 0x00, 0x05, 0x12, 0x20,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x12, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xFE, 0xFF,
0xFF, 0xFF, 0x1E, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x2B, 0x00, 0x00, 0x05, 0x22, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x08, 0xC2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00,
0x80, 0x3F, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x74, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View file

@ -0,0 +1,143 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
void main(
uint vID : SV_VertexID0,
out float4 oPos : SV_POSITION0,
out float2 oTex : TEXCOORD0)
{
// Full-screen triangle/quad generation from VertexID
float x = (float)(((vID << 1) & 2) - 1);
float y = (float)((vID & 0xFFFFFFFE) - 1);
oPos = float4(x, y, 1.0, 1.0);
// Screen-space UV derivation
float u = (float)(vID & 1);
float v = (float)(1 - (vID >> 1));
oTex = float2(u, v) * v_scaleoffset.zw + v_scaleoffset.xy;
}
*/
static unsigned char g_main_VS_ScreenSpace[] =
{
0x44, 0x58, 0x42, 0x43, 0xB6, 0x90, 0x0F, 0x5D, 0x1E, 0x08,
0xBC, 0x0E, 0xCD, 0x1F, 0xED, 0xD0, 0xAE, 0x45, 0x7E, 0xDA,
0x01, 0x00, 0x00, 0x00, 0xA4, 0x03, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00,
0x48, 0x01, 0x00, 0x00, 0xA0, 0x01, 0x00, 0x00, 0x28, 0x03,
0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xD8, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF,
0x00, 0x01, 0x00, 0x00, 0xA4, 0x00, 0x00, 0x00, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x73, 0x63, 0x72, 0x65, 0x65, 0x6E, 0x73, 0x70, 0x61, 0x63,
0x65, 0x5F, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74,
0x73, 0x00, 0xAB, 0xAB, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0x5F, 0x73, 0x63, 0x61, 0x6C, 0x65, 0x6F,
0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0xAB, 0xAB, 0x01, 0x00,
0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73,
0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C,
0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20,
0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x39,
0x2E, 0x33, 0x30, 0x2E, 0x39, 0x32, 0x30, 0x30, 0x2E, 0x31,
0x36, 0x33, 0x38, 0x34, 0x00, 0xAB, 0x49, 0x53, 0x47, 0x4E,
0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x56,
0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x4F, 0x53,
0x47, 0x4E, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x44, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x0C,
0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54,
0x49, 0x4F, 0x4E, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F,
0x52, 0x44, 0x00, 0xAB, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52,
0x80, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x60, 0x00,
0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00,
0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00,
0x00, 0x04, 0x12, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xF2, 0x20,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x08, 0xC2, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00,
0x80, 0x3F, 0x01, 0x00, 0x00, 0x0A, 0x32, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x29, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x00, 0x0A, 0x62, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x56, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x2B, 0x00, 0x00, 0x05, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2B, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x0A, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x55, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0A, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1E, 0x00,
0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x2B, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x32, 0x00, 0x00, 0x0B, 0x32, 0x20, 0x10, 0x00, 0x01, 0x00,
0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0xE6, 0x8A, 0x20, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x46, 0x80, 0x20, 0x00, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54,
0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,616 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.6.2 - April 25, 2013
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
*/
/* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text,
* and png_info.
*/
#ifndef PNGCONF_H
#define PNGCONF_H
/* To do: Do all of this in scripts/pnglibconf.dfa */
#ifdef PNG_SAFE_LIMITS_SUPPORTED
# ifdef PNG_USER_WIDTH_MAX
# undef PNG_USER_WIDTH_MAX
# define PNG_USER_WIDTH_MAX 1000000L
# endif
# ifdef PNG_USER_HEIGHT_MAX
# undef PNG_USER_HEIGHT_MAX
# define PNG_USER_HEIGHT_MAX 1000000L
# endif
# ifdef PNG_USER_CHUNK_MALLOC_MAX
# undef PNG_USER_CHUNK_MALLOC_MAX
# define PNG_USER_CHUNK_MALLOC_MAX 4000000L
# endif
# ifdef PNG_USER_CHUNK_CACHE_MAX
# undef PNG_USER_CHUNK_CACHE_MAX
# define PNG_USER_CHUNK_CACHE_MAX 128
# endif
#endif
#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
* compiler for correct compilation. The following header files are required by
* the standard. If your compiler doesn't provide these header files, or they
* do not match the standard, you will need to provide/improve them.
*/
#include <limits.h>
#include <stddef.h>
/* Library header files. These header files are all defined by ISOC90; libpng
* expects conformant implementations, however, an ISOC90 conformant system need
* not provide these header files if the functionality cannot be implemented.
* In this case it will be necessary to disable the relevant parts of libpng in
* the build of pnglibconf.h.
*
* Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
* include this unnecessary header file.
*/
#ifdef PNG_STDIO_SUPPORTED
/* Required for the definition of FILE: */
# include <stdio.h>
#endif
#ifdef PNG_SETJMP_SUPPORTED
/* Required for the definition of jmp_buf and the declaration of longjmp: */
# include <setjmp.h>
#endif
#ifdef PNG_CONVERT_tIME_SUPPORTED
/* Required for struct tm: */
# include <time.h>
#endif
#endif /* PNG_BUILDING_SYMBOL_TABLE */
/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
* PNG_NO_CONST; this is no longer supported except for data declarations which
* apparently still cause problems in 2011 on some compilers.
*/
#define PNG_CONST const /* backward compatibility only */
/* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used when the function is called.
* The library builder sets the default; if read functions are not
* built into the library the macro implementation is forced on.
*/
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
# define PNG_USE_READ_MACROS
#endif
#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
# if PNG_DEFAULT_READ_MACROS
# define PNG_USE_READ_MACROS
# endif
#endif
/* COMPILER SPECIFIC OPTIONS.
*
* These options are provided so that a variety of difficult compilers
* can be used. Some are fixed at build time (e.g. PNG_API_RULE
* below) but still have compiler specific implementations, others
* may be changed on a per-file basis when compiling against libpng.
*/
/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
* against legacy (pre ISOC90) compilers that did not understand function
* prototypes. It is not required for modern C compilers.
*/
#ifndef PNGARG
# define PNGARG(arglist) arglist
#endif
/* Function calling conventions.
* =============================
* Normally it is not necessary to specify to the compiler how to call
* a function - it just does it - however on x86 systems derived from
* Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
* and some others) there are multiple ways to call a function and the
* default can be changed on the compiler command line. For this reason
* libpng specifies the calling convention of every exported function and
* every function called via a user supplied function pointer. This is
* done in this file by defining the following macros:
*
* PNGAPI Calling convention for exported functions.
* PNGCBAPI Calling convention for user provided (callback) functions.
* PNGCAPI Calling convention used by the ANSI-C library (required
* for longjmp callbacks and sometimes used internally to
* specify the calling convention for zlib).
*
* These macros should never be overridden. If it is necessary to
* change calling convention in a private build this can be done
* by setting PNG_API_RULE (which defaults to 0) to one of the values
* below to select the correct 'API' variants.
*
* PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
* This is correct in every known environment.
* PNG_API_RULE=1 Use the operating system convention for PNGAPI and
* the 'C' calling convention (from PNGCAPI) for
* callbacks (PNGCBAPI). This is no longer required
* in any known environment - if it has to be used
* please post an explanation of the problem to the
* libpng mailing list.
*
* These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases
* (x86 DOS/Windows sytems) and, even then, this does not apply to
* Cygwin running on those systems.
*
* Note that the value must be defined in pnglibconf.h so that what
* the application uses to call the library matches the conventions
* set when building the library.
*/
/* Symbol export
* =============
* When building a shared library it is almost always necessary to tell
* the compiler which symbols to export. The png.h macro 'PNG_EXPORT'
* is used to mark the symbols. On some systems these symbols can be
* extracted at link time and need no special processing by the compiler,
* on other systems the symbols are flagged by the compiler and just
* the declaration requires a special tag applied (unfortunately) in a
* compiler dependent way. Some systems can do either.
*
* A small number of older systems also require a symbol from a DLL to
* be flagged to the program that calls it. This is a problem because
* we do not know in the header file included by application code that
* the symbol will come from a shared library, as opposed to a statically
* linked one. For this reason the application must tell us by setting
* the magic flag PNG_USE_DLL to turn on the special processing before
* it includes png.h.
*
* Four additional macros are used to make this happen:
*
* PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
* the build or imported if PNG_USE_DLL is set - compiler
* and system specific.
*
* PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
* 'type', compiler specific.
*
* PNG_DLL_EXPORT Set to the magic to use during a libpng build to
* make a symbol exported from the DLL. Not used in the
* public header files; see pngpriv.h for how it is used
* in the libpng build.
*
* PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
* from a DLL - used to define PNG_IMPEXP when
* PNG_USE_DLL is set.
*/
/* System specific discovery.
* ==========================
* This code is used at build time to find PNG_IMPEXP, the API settings
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
* import processing is possible. On Windows systems it also sets
* compiler-specific macros to the values required to change the calling
* conventions of the various functions.
*/
#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
/* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
* MinGW on any architecture currently supported by Windows. Also includes
* Watcom builds but these need special treatment because they are not
* compatible with GCC or Visual C because of different calling conventions.
*/
# if PNG_API_RULE == 2
/* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom!
*/
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
/* If this line results in an error __stdcall is not understood and
* PNG_API_RULE should not have been set to '1'.
*/
# define PNGAPI __stdcall
# endif
# else
/* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct
* variants for the compiler.
*/
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
# if PNG_API_RULE == 1 && !defined(PNGAPI)
# define PNGAPI _stdcall
# endif
# endif /* compiler/api */
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
# endif
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
#else /* !Windows */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */
/* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!)
*/
# endif /* other system, !OS/2 */
#endif /* !Windows/x86 */
/* Now do all the defaulting . */
#ifndef PNGCAPI
# define PNGCAPI
#endif
#ifndef PNGCBAPI
# define PNGCBAPI PNGCAPI
#endif
#ifndef PNGAPI
# define PNGAPI PNGCAPI
#endif
/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
* then in an internal header file when building the library, otherwise (when
* using the library) it is set here.
*/
#ifndef PNG_IMPEXP
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
/* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT
# endif
# ifndef PNG_IMPEXP
# define PNG_IMPEXP
# endif
#endif
/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
* 'attributes' as a storage class - the attributes go at the start of the
* function definition, and attributes are always appended regardless of the
* compiler. This considerably simplifies these macros but may cause problems
* if any compilers both need function attributes and fail to handle them as
* a storage class (this is unlikely.)
*/
#ifndef PNG_FUNCTION
# define PNG_FUNCTION(type, name, args, attributes) attributes type name args
#endif
#ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif
/* The ordinal value is only relevant when preprocessing png.h for symbol
* table entries, so we discard it here. See the .dfn files in the
* scripts directory.
*/
#ifndef PNG_EXPORTA
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
extern attributes)
#endif
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
* so make something non-empty to satisfy the requirement:
*/
#define PNG_EMPTY /*empty list*/
#define PNG_EXPORT(ordinal, type, name, args)\
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
/* Use PNG_REMOVED to comment out a removed interface. */
#ifndef PNG_REMOVED
# define PNG_REMOVED(ordinal, type, name, args, attributes)
#endif
#ifndef PNG_CALLBACK
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
#endif
/* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API
* functions in png.h will generate compiler warnings.
*
* Added at libpng-1.2.41.
*/
#ifndef PNG_NO_PEDANTIC_WARNINGS
# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
# define PNG_PEDANTIC_WARNINGS_SUPPORTED
# endif
#endif
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
/* Support for compiler specific function attributes. These are used
* so that where compiler support is available, incorrect use of API
* functions in png.h will generate compiler warnings. Added at libpng
* version 1.2.41. Disabling these removes the warnings but may also produce
* less efficient code.
*/
# if defined(__GNUC__)
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__))
# endif
# if __GNUC__ >= 3
# ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__))
# endif
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng.")))
# else
# define PNG_PRIVATE \
__attribute__((__deprecated__))
# endif
# endif
# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
# ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
# endif /* __GNUC__ == 3.0 */
# endif /* __GNUC__ >= 3 */
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* not supported */
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __declspec(noreturn)
# endif
# ifndef PNG_ALLOCATED
# if (_MSC_VER >= 1400)
# define PNG_ALLOCATED __declspec(restrict)
# endif
# endif
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __declspec(deprecated)
# endif
# ifndef PNG_PRIVATE
# define PNG_PRIVATE __declspec(deprecated)
# endif
# ifndef PNG_RESTRICT
# if (_MSC_VER >= 1400)
# define PNG_RESTRICT __restrict
# endif
# endif
# elif defined(__WATCOMC__)
# ifndef PNG_RESTRICT
# define PNG_RESTRICT __restrict
# endif
# endif /* _MSC_VER */
#endif /* PNG_PEDANTIC_WARNINGS */
#ifndef PNG_DEPRECATED
# define PNG_DEPRECATED /* Use of this function is deprecated */
#endif
#ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* The result of this function must be checked */
#endif
#ifndef PNG_NORETURN
# define PNG_NORETURN /* This function does not return */
#endif
#ifndef PNG_ALLOCATED
# define PNG_ALLOCATED /* The result of the function is new memory */
#endif
#ifndef PNG_PRIVATE
# define PNG_PRIVATE /* This is a private libpng function */
#endif
#ifndef PNG_RESTRICT
# define PNG_RESTRICT /* The C99 "restrict" feature */
#endif
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args);
# else /* No floating point APIs */
# define PNG_FP_EXPORT(ordinal, type, name, args)
# endif
#endif
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args);
# else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
# endif
#endif
#ifndef PNG_BUILDING_SYMBOL_TABLE
/* Some typedefs to get us started. These should be safe on most of the common
* platforms.
*
* png_uint_32 and png_int_32 may, currently, be larger than required to hold a
* 32-bit value however this is not normally advisable.
*
* png_uint_16 and png_int_16 should always be two bytes in size - this is
* verified at library build time.
*
* png_byte must always be one byte in size.
*
* The checks below use constants from limits.h, as defined by the ISOC90
* standard.
*/
#if CHAR_BIT == 8 && UCHAR_MAX == 255
typedef unsigned char png_byte;
#else
# error "libpng requires 8 bit bytes"
#endif
#if INT_MIN == -32768 && INT_MAX == 32767
typedef int png_int_16;
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
typedef short png_int_16;
#else
# error "libpng requires a signed 16 bit type"
#endif
#if UINT_MAX == 65535
typedef unsigned int png_uint_16;
#elif USHRT_MAX == 65535
typedef unsigned short png_uint_16;
#else
# error "libpng requires an unsigned 16 bit type"
#endif
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
typedef int png_int_32;
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
typedef long int png_int_32;
#else
# error "libpng requires a signed 32 bit (or more) type"
#endif
#if UINT_MAX > 4294967294
typedef unsigned int png_uint_32;
#elif ULONG_MAX > 4294967294
typedef unsigned long int png_uint_32;
#else
# error "libpng requires an unsigned 32 bit (or more) type"
#endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
*/
typedef size_t png_size_t;
typedef ptrdiff_t png_ptrdiff_t;
/* libpng needs to know the maximum value of 'size_t' and this controls the
* definition of png_alloc_size_t, below. This maximum value of size_t limits
* but does not control the maximum allocations the library makes - there is
* direct application control of this through png_set_user_limits().
*/
#ifndef PNG_SMALL_SIZE_T
/* Compiler specific tests for systems where size_t is known to be less than
* 32 bits (some of these systems may no longer work because of the lack of
* 'far' support; see above.)
*/
# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
(defined(_MSC_VER) && defined(MAXSEG_64K))
# define PNG_SMALL_SIZE_T
# endif
#endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
* them at all so that the compiler can complain when something turns out to be
* problematic.
*
* Casts in the other direction (from png_alloc_size_t to png_size_t or
* png_uint_32) should be explicitly applied; however, we do not expect to
* encounter practical situations that require such conversions.
*
* PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
* 4294967295 - i.e. less than the maximum value of png_uint_32.
*/
#ifdef PNG_SMALL_SIZE_T
typedef png_uint_32 png_alloc_size_t;
#else
typedef png_size_t png_alloc_size_t;
#endif
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
* implementations of Intel CPU specific support of user-mode segmented address
* spaces, where 16-bit pointers address more than 65536 bytes of memory using
* separate 'segment' registers. The implementation requires two different
* types of pointer (only one of which includes the segment value.)
*
* If required this support is available in version 1.2 of libpng and may be
* available in versions through 1.5, although the correctness of the code has
* not been verified recently.
*/
/* Typedef for floating-point numbers that are converted to fixed-point with a
* multiple of 100,000, e.g., gamma
*/
typedef png_int_32 png_fixed_point;
/* Add typedefs for pointers */
typedef void * png_voidp;
typedef const void * png_const_voidp;
typedef png_byte * png_bytep;
typedef const png_byte * png_const_bytep;
typedef png_uint_32 * png_uint_32p;
typedef const png_uint_32 * png_const_uint_32p;
typedef png_int_32 * png_int_32p;
typedef const png_int_32 * png_const_int_32p;
typedef png_uint_16 * png_uint_16p;
typedef const png_uint_16 * png_const_uint_16p;
typedef png_int_16 * png_int_16p;
typedef const png_int_16 * png_const_int_16p;
typedef char * png_charp;
typedef const char * png_const_charp;
typedef png_fixed_point * png_fixed_point_p;
typedef const png_fixed_point * png_const_fixed_point_p;
typedef png_size_t * png_size_tp;
typedef const png_size_t * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p;
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double * png_doublep;
typedef const double * png_const_doublep;
#endif
/* Pointers to pointers; i.e. arrays */
typedef png_byte * * png_bytepp;
typedef png_uint_32 * * png_uint_32pp;
typedef png_int_32 * * png_int_32pp;
typedef png_uint_16 * * png_uint_16pp;
typedef png_int_16 * * png_int_16pp;
typedef const char * * png_const_charpp;
typedef char * * png_charpp;
typedef png_fixed_point * * png_fixed_point_pp;
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double * * png_doublepp;
#endif
/* Pointers to pointers to pointers; i.e., pointer to array */
typedef char * * * png_charppp;
#endif /* PNG_BUILDING_SYMBOL_TABLE */
#endif /* PNGCONF_H */

View file

@ -0,0 +1,157 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*
* png_debug[1-2]?(level, message ,arg{0-2})
* Expands to a statement (either a simple expression or a compound
* do..while(0) statement) that outputs a message with parameter
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
* is undefined, 0 or 1 every png_debug expands to a simple expression
* (actually ((void)0)).
*
* level: level of detail of message, starting at 0. A level 'n'
* message is preceded by 'n' tab characters (not implemented
* on Microsoft compilers unless PNG_DEBUG_FILE is also
* defined, to allow debug DLL compilation with no standard IO).
* message: a printf(3) style text string. A trailing '\n' is added
* to the message.
* arg: 0 to 2 arguments for printf(3) style substitution in message.
*/
#ifndef PNGDEBUG_H
#define PNGDEBUG_H
/* These settings control the formatting of messages in png.c and pngerror.c */
/* Moved to pngdebug.h at 1.5.0 */
# ifndef PNG_LITERAL_SHARP
# define PNG_LITERAL_SHARP 0x23
# endif
# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
# endif
# ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
# endif
# ifndef PNG_STRING_NEWLINE
# define PNG_STRING_NEWLINE "\n"
# endif
#ifdef PNG_DEBUG
# if (PNG_DEBUG > 0)
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
# include <crtdbg.h>
# if (PNG_DEBUG > 1)
# ifndef _DEBUG
# define _DEBUG
# endif
# ifndef png_debug
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
# endif
# endif
# else /* PNG_DEBUG_FILE || !_MSC_VER */
# ifndef PNG_STDIO_SUPPORTED
# include <stdio.h> /* not included yet */
# endif
# ifndef PNG_DEBUG_FILE
# define PNG_DEBUG_FILE stderr
# endif /* PNG_DEBUG_FILE */
# if (PNG_DEBUG > 1)
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
* non-ISO compilers
*/
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
} while (0)
# endif
# else /* __STDC __ */
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
} while (0)
# endif
# endif /* __STDC __ */
# endif /* (PNG_DEBUG > 1) */
# endif /* _MSC_VER */
# endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
# define png_debug(l, m) ((void)0)
#endif
#ifndef png_debug1
# define png_debug1(l, m, p1) ((void)0)
#endif
#ifndef png_debug2
# define png_debug2(l, m, p1, p2) ((void)0)
#endif
#endif /* PNGDEBUG_H */

View file

@ -0,0 +1,932 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.6.1 [March 28, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all error handling. Users who
* need special error handling are expected to write replacement functions
* and use png_set_error_fn() to use those functions. See the instructions
* at each function.
*/
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
png_const_charp error_message)),PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_const_structrp png_ptr,
png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently,
* you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time.
*/
#ifdef PNG_ERROR_TEXT_SUPPORTED
PNG_FUNCTION(void,PNGAPI
png_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16];
if (png_ptr != NULL)
{
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
for (offset = 1; offset<15; offset++)
if (error_message[offset] == ' ')
break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
int i;
for (i = 0; i < offset - 1; i++)
msg[i] = error_message[i + 1];
msg[i - 1] = '\0';
error_message = msg;
}
else
error_message += offset;
}
else
{
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{
msg[0] = '0';
msg[1] = '\0';
error_message = msg;
}
}
}
}
#endif
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
error_message);
/* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */
png_default_error(png_ptr, error_message);
}
#else
PNG_FUNCTION(void,PNGAPI
png_err,(png_const_structrp png_ptr),PNG_NORETURN)
{
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
* apparently an error, introduced in libpng-1.2.20, and png_default_error
* will crash in this case.
*/
if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr), "");
/* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */
png_default_error(png_ptr, "");
}
#endif /* PNG_ERROR_TEXT_SUPPORTED */
/* Utility to safely appends strings to a buffer. This never errors out so
* error checking is not required in the caller.
*/
size_t
png_safecat(png_charp buffer, size_t bufsize, size_t pos,
png_const_charp string)
{
if (buffer != NULL && pos < bufsize)
{
if (string != NULL)
while (*string != '\0' && pos < bufsize-1)
buffer[pos++] = *string++;
buffer[pos] = '\0';
}
return pos;
}
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
/* Utility to dump an unsigned value into a buffer, given a start pointer and
* and end pointer (which should point just *beyond* the end of the buffer!)
* Returns the pointer to the start of the formatted string.
*/
png_charp
png_format_number(png_const_charp start, png_charp end, int format,
png_alloc_size_t number)
{
int count = 0; /* number of digits output */
int mincount = 1; /* minimum number required */
int output = 0; /* digit output (for the fixed point format) */
*--end = '\0';
/* This is written so that the loop always runs at least once, even with
* number zero.
*/
while (end > start && (number != 0 || count < mincount))
{
static const char digits[] = "0123456789ABCDEF";
switch (format)
{
case PNG_NUMBER_FORMAT_fixed:
/* Needs five digits (the fraction) */
mincount = 5;
if (output || number % 10 != 0)
{
*--end = digits[number % 10];
output = 1;
}
number /= 10;
break;
case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */
mincount = 2;
/* FALL THROUGH */
case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10];
number /= 10;
break;
case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */
mincount = 2;
/* FALL THROUGH */
case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf];
number >>= 4;
break;
default: /* an error */
number = 0;
break;
}
/* Keep track of the number of digits added */
++count;
/* Float a fixed number here: */
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
{
/* End of the fraction, but maybe nothing was output? In that case
* drop the decimal point. If the number is a true zero handle that
* here.
*/
if (output)
*--end = '.';
else if (number == 0) /* and !output */
*--end = '0';
}
}
return end;
}
#endif
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use
* png_set_error_fn() to replace the warning function at run-time.
*/
void PNGAPI
png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{
int offset = 0;
if (png_ptr != NULL)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
{
if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
break;
}
}
}
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
warning_message + offset);
else
png_default_warning(png_ptr, warning_message + offset);
}
/* These functions support 'formatted' warning messages with up to
* PNG_WARNING_PARAMETER_COUNT parameters. In the format string the parameter
* is introduced by @<number>, where 'number' starts at 1. This follows the
* standard established by X/Open for internationalizable error messages.
*/
void
png_warning_parameter(png_warning_parameters p, int number,
png_const_charp string)
{
if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT)
(void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string);
}
void
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
png_alloc_size_t value)
{
char buffer[PNG_NUMBER_BUFFER_SIZE];
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
}
void
png_warning_parameter_signed(png_warning_parameters p, int number, int format,
png_int_32 value)
{
png_alloc_size_t u;
png_charp str;
char buffer[PNG_NUMBER_BUFFER_SIZE];
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
u = (png_alloc_size_t)value;
if (value < 0)
u = ~u + 1;
str = PNG_FORMAT_NUMBER(buffer, format, u);
if (value < 0 && str > buffer)
*--str = '-';
png_warning_parameter(p, number, str);
}
void
png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
png_const_charp message)
{
/* The internal buffer is just 192 bytes - enough for all our messages,
* overflow doesn't happen because this code checks! If someone figures
* out how to send us a message longer than 192 bytes, all that will
* happen is that the message will be truncated appropriately.
*/
size_t i = 0; /* Index in the msg[] buffer: */
char msg[192];
/* Each iteration through the following loop writes at most one character
* to msg[i++] then returns here to validate that there is still space for
* the trailing '\0'. It may (in the case of a parameter) read more than
* one character from message[]; it must check for '\0' and continue to the
* test if it finds the end of string.
*/
while (i<(sizeof msg)-1 && *message != '\0')
{
/* '@' at end of string is now just printed (previously it was skipped);
* it is an error in the calling code to terminate the string with @.
*/
if (p != NULL && *message == '@' && message[1] != '\0')
{
int parameter_char = *++message; /* Consume the '@' */
static const char valid_parameters[] = "123456789";
int parameter = 0;
/* Search for the parameter digit, the index in the string is the
* parameter to use.
*/
while (valid_parameters[parameter] != parameter_char &&
valid_parameters[parameter] != '\0')
++parameter;
/* If the parameter digit is out of range it will just get printed. */
if (parameter < PNG_WARNING_PARAMETER_COUNT)
{
/* Append this parameter */
png_const_charp parm = p[parameter];
png_const_charp pend = p[parameter] + (sizeof p[parameter]);
/* No need to copy the trailing '\0' here, but there is no guarantee
* that parm[] has been initialized, so there is no guarantee of a
* trailing '\0':
*/
while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
msg[i++] = *parm++;
/* Consume the parameter digit too: */
++message;
continue;
}
/* else not a parameter and there is a character after the @ sign; just
* copy that. This is known not to be '\0' because of the test above.
*/
}
/* At this point *message can't be '\0', even in the bad parameter case
* above where there is a lone '@' at the end of the message string.
*/
msg[i++] = *message++;
}
/* i is always less than (sizeof msg), so: */
msg[i] = '\0';
/* And this is the formatted message. It may be larger than
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these
* are not (currently) formatted.
*/
png_warning(png_ptr, msg);
}
#endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
{
# ifdef PNG_READ_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
png_ptr->chunk_name != 0)
png_chunk_warning(png_ptr, error_message);
else
# endif
png_warning(png_ptr, error_message);
}
else
{
# ifdef PNG_READ_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
png_ptr->chunk_name != 0)
png_chunk_error(png_ptr, error_message);
else
# endif
png_error(png_ptr, error_message);
}
}
void /* PRIVATE */
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
}
void /* PRIVATE */
png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
}
#endif /* BENIGN_ERRORS */
/* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
* this is used to prefix the message. The message is limited in length
* to 63 bytes, the name characters are output as hex digits wrapped in []
* if the character is invalid.
*/
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
error_message)
{
png_uint_32 chunk_name = png_ptr->chunk_name;
int iout = 0, ishift = 24;
while (ishift >= 0)
{
int c = (int)(chunk_name >> ishift) & 0xff;
ishift -= 8;
if (isnonalpha(c))
{
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
}
else
{
buffer[iout++] = (char)c;
}
}
if (error_message == NULL)
buffer[iout] = '\0';
else
{
int iin = 0;
buffer[iout++] = ':';
buffer[iout++] = ' ';
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
}
}
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI
png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_error(png_ptr, error_message);
else
{
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
}
}
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI
png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_warning(png_ptr, warning_message);
else
{
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
}
}
#endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
}
#endif
#endif /* PNG_READ_SUPPORTED */
void /* PRIVATE */
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
{
/* This is always supported, but for just read or just write it
* unconditionally does the right thing.
*/
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
# endif
# ifdef PNG_READ_SUPPORTED
{
if (error < PNG_CHUNK_ERROR)
png_chunk_warning(png_ptr, message);
else
png_chunk_benign_error(png_ptr, message);
}
# endif
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
# endif
# ifdef PNG_WRITE_SUPPORTED
{
if (error < PNG_CHUNK_WRITE_ERROR)
png_app_warning(png_ptr, message);
else
png_app_error(png_ptr, message);
}
# endif
}
#ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void,
png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
int iin;
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
memcpy(msg, fixed_message, fixed_message_ln);
iin = 0;
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
{
msg[fixed_message_ln + iin] = name[iin];
++iin;
}
msg[fixed_message_ln + iin] = 0;
png_error(png_ptr, msg);
}
#endif
#endif
#ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used,
* otherwise it is necessary for png_default_error to be overridden.
*/
jmp_buf* PNGAPI
png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size)
{
/* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
* and it must not change after that. Libpng doesn't care how big the
* buffer is, just that it doesn't change.
*
* If the buffer size is no *larger* than the size of jmp_buf when libpng is
* compiled a built in jmp_buf is returned; this preserves the pre-1.6.0
* semantics that this call will not fail. If the size is larger, however,
* the buffer is allocated and this may fail, causing the function to return
* NULL.
*/
if (png_ptr == NULL)
return NULL;
if (png_ptr->jmp_buf_ptr == NULL)
{
png_ptr->jmp_buf_size = 0; /* not allocated */
if (jmp_buf_size <= (sizeof png_ptr->jmp_buf_local))
png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local;
else
{
png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
png_malloc_warn(png_ptr, jmp_buf_size));
if (png_ptr->jmp_buf_ptr == NULL)
return NULL; /* new NULL return on OOM */
png_ptr->jmp_buf_size = jmp_buf_size;
}
}
else /* Already allocated: check the size */
{
size_t size = png_ptr->jmp_buf_size;
if (size == 0)
{
size = (sizeof png_ptr->jmp_buf_local);
if (png_ptr->jmp_buf_ptr != &png_ptr->jmp_buf_local)
{
/* This is an internal error in libpng: somehow we have been left
* with a stack allocated jmp_buf when the application regained
* control. It's always possible to fix this up, but for the moment
* this is a png_error because that makes it easy to detect.
*/
png_error(png_ptr, "Libpng jmp_buf still allocated");
/* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */
}
}
if (size != jmp_buf_size)
{
png_warning(png_ptr, "Application jmp_buf size changed");
return NULL; /* caller will probably crash: no choice here */
}
}
/* Finally fill in the function, now we have a satisfactory buffer. It is
* valid to change the function on every call.
*/
png_ptr->longjmp_fn = longjmp_fn;
return png_ptr->jmp_buf_ptr;
}
void /* PRIVATE */
png_free_jmpbuf(png_structrp png_ptr)
{
if (png_ptr != NULL)
{
jmp_buf *jb = png_ptr->jmp_buf_ptr;
/* A size of 0 is used to indicate a local, stack, allocation of the
* pointer; used here and in png.c
*/
if (jb != NULL && png_ptr->jmp_buf_size > 0)
{
/* This stuff is so that a failure to free the error control structure
* does not leave libpng in a state with no valid error handling: the
* free always succeeds, if there is an error it gets ignored.
*/
if (jb != &png_ptr->jmp_buf_local)
{
/* Make an internal, libpng, jmp_buf to return here */
jmp_buf free_jmp_buf;
if (!setjmp(free_jmp_buf))
{
png_ptr->jmp_buf_ptr = &free_jmp_buf; /* come back here */
png_ptr->jmp_buf_size = 0; /* stack allocation */
png_ptr->longjmp_fn = longjmp;
png_free(png_ptr, jb); /* Return to setjmp on error */
}
}
}
/* *Always* cancel everything out: */
png_ptr->jmp_buf_size = 0;
png_ptr->jmp_buf_ptr = NULL;
png_ptr->longjmp_fn = 0;
}
}
#endif
/* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This
* function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn().
*/
static PNG_FUNCTION(void /* PRIVATE */,
png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
/* Check on NULL only added in 1.5.4 */
if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
error_number[offset] = error_message[offset + 1];
if (error_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s",
error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
#endif
{
fprintf(stderr, "libpng error: %s", error_message ? error_message :
"undefined");
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
PNG_UNUSED(error_message) /* Make compiler happy */
#endif
png_longjmp(png_ptr, 1);
}
PNG_FUNCTION(void,PNGAPI
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
{
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
#endif
/* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT();
}
#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything
* here if you don't want them to. In the default configuration, png_ptr is
* not used, but it is passed in case it may be useful.
*/
static void /* PRIVATE */
png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == PNG_LITERAL_SHARP)
{
int offset;
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s",
warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
# endif
{
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT
* return to the calling routine or serious problems will occur. The return
* method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1)
*/
void PNGAPI
png_set_error_fn(png_structrp png_ptr, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warning_fn)
{
if (png_ptr == NULL)
return;
png_ptr->error_ptr = error_ptr;
png_ptr->error_fn = error_fn;
#ifdef PNG_WARNINGS_SUPPORTED
png_ptr->warning_fn = warning_fn;
#else
PNG_UNUSED(warning_fn)
#endif
}
/* This function returns a pointer to the error_ptr associated with the user
* functions. The application should free any memory associated with this
* pointer before png_write_destroy and png_read_destroy are called.
*/
png_voidp PNGAPI
png_get_error_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return NULL;
return ((png_voidp)png_ptr->error_ptr);
}
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
void PNGAPI
png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
{
if (png_ptr != NULL)
{
png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
}
}
#endif
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be
* possible to implement without setjmp support just so long as there is some
* way to handle the error return here:
*/
PNG_FUNCTION(void /* PRIVATE */,
png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
PNG_NORETURN)
{
const png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* An error is always logged here, overwriting anything (typically a warning)
* that is already there:
*/
if (image != NULL)
{
png_safecat(image->message, (sizeof image->message), 0, error_message);
image->warning_or_error |= PNG_IMAGE_ERROR;
/* Retrieve the jmp_buf from within the png_control, making this work for
* C++ compilation too is pretty tricky: C++ wants a pointer to the first
* element of a jmp_buf, but C doesn't tell us the type of that.
*/
if (image->opaque != NULL && image->opaque->error_buf != NULL)
longjmp(png_control_jmp_buf(image->opaque), 1);
/* Missing longjmp buffer, the following is to help debugging: */
{
size_t pos = png_safecat(image->message, (sizeof image->message), 0,
"bad longjmp: ");
png_safecat(image->message, (sizeof image->message), pos,
error_message);
}
}
/* Here on an internal programming error. */
abort();
}
#ifdef PNG_WARNINGS_SUPPORTED
void /* PRIVATE */
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
{
const png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* A warning is only logged if there is no prior warning or error. */
if (image->warning_or_error == 0)
{
png_safecat(image->message, (sizeof image->message), 0, warning_message);
image->warning_or_error |= PNG_IMAGE_WARNING;
}
}
#endif
int /* PRIVATE */
png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
{
volatile png_imagep image = image_in;
volatile int result;
volatile png_voidp saved_error_buf;
jmp_buf safe_jmpbuf;
/* Safely execute function(arg) with png_error returning to this function. */
saved_error_buf = image->opaque->error_buf;
result = setjmp(safe_jmpbuf) == 0;
if (result)
{
image->opaque->error_buf = safe_jmpbuf;
result = function(arg);
}
image->opaque->error_buf = saved_error_buf;
/* And do the cleanup prior to any failure return. */
if (!result)
png_image_free(image);
return result;
}
#endif /* SIMPLIFIED READ/WRITE */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,260 @@
/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.6.1 [March 28, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, using png_set_*() functions, then
* call png_write_info().
*
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality. In libpng-1.5.0 this was moved into a separate private
* file that is not visible to applications.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
* are automatically freed when the info structure is deallocated, if they were
* allocated internally by libpng. This behavior can be changed by means
* of the png_data_freer() function.
*
* More allocation details: all the chunk-reading functions that
* change these members go through the corresponding png_set_*
* functions. A function to clear these members is available: see
* png_free_data(). The png_set_* functions do not depend on being
* able to point info structure members to any of the storage they are
* passed (they make their own copies), EXCEPT that the png_set_text
* functions use the same storage passed to them in the text_ptr or
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/
#ifndef PNGINFO_H
#define PNGINFO_H
struct png_info_def
{
/* The following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following are set by png_set_IHDR, called from the application on
* write, but the are never actually used by the write code.
*/
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */
#ifdef PNG_READ_SUPPORTED
/* This is never set during write */
png_byte signature[8]; /* magic bytes read by libpng from start of file */
#endif
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
* are writing, set the valid field to those chunks you want written,
* and initialize the appropriate fields below.
*/
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
* defined. When COLORSPACE is switched on all the colorspace-defining
* chunks should be enabled, when GAMMA is switched on all the gamma-defining
* chunks should be enabled. If this is not done it becomes possible to read
* inconsistent PNG files and assign a probably incorrect interpretation to
* the information. (In other words, by carefully choosing which chunks to
* recognize the system configuration can select an interpretation for PNG
* files containing ambiguous data and this will result in inconsistent
* behavior between different libpng builds!)
*/
png_colorspace colorspace;
#endif
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_bytep iccp_profile; /* International Color Consortium profile data */
png_uint_32 iccp_proflen; /* ICC profile data length */
#endif
#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
* null-terminated C strings. Each chunk has a keyword that describes the
* textual data contained in that chunk. Keywords are not required to be
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
int num_text; /* number of comments read or comments to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read or comments to write */
#endif /* PNG_TEXT_SUPPORTED */
#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
png_time mod_time;
#endif
#ifdef PNG_sBIT_SUPPORTED
/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
png_color_8 sig_bit; /* significant bits in color channels */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The tRNS chunk supplies transparency data for paletted images and
* other image types that don't need a full alpha channel. There are
* "num_trans" transparency values for a paletted image, stored in the
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans_alpha; /* alpha values for paletted image */
png_color_16 trans_color; /* transparent color for non-palette image */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The bKGD chunk gives the suggested image background color if the
* display program does not have its own background color and the image
* is needs to composited onto a background before display. The colors
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
png_color_16 background;
#endif
#ifdef PNG_oFFs_SUPPORTED
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
png_int_32 x_offset; /* x offset on page */
png_int_32 y_offset; /* y offset on page */
png_byte offset_unit_type; /* offset units type */
#endif
#ifdef PNG_pHYs_SUPPORTED
/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
png_uint_16p hist;
#endif
#ifdef PNG_pCAL_SUPPORTED
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
* range given by [pcal_X0, pcal_X1], and are further transformed by a
* (possibly non-linear) transformation function given by "pcal_type"
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
* defines below, and the PNG-Group's PNG extensions document for a
* complete description of the transformations and how they should be
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
png_charp pcal_purpose; /* pCAL chunk description string */
png_int_32 pcal_X0; /* minimum value */
png_int_32 pcal_X1; /* maximum value */
png_charp pcal_units; /* Latin-1 string giving physical units */
png_charpp pcal_params; /* ASCII strings containing parameter values */
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
png_byte pcal_nparams; /* number of parameters given in pcal_params */
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
/* The type of this field is limited by the type of
* png_struct::user_chunk_cache_max, else overflow can occur.
*/
int unknown_chunks_num;
#endif
#ifdef PNG_sPLT_SUPPORTED
/* Data on sPLT chunks (there may be more than one). */
png_sPLT_tp splt_palettes;
int splt_palettes_num; /* Match type returned by png_get API */
#endif
#ifdef PNG_sCAL_SUPPORTED
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height corresponsing to one pixel
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero.
*/
png_byte scal_unit; /* unit of physical scale */
png_charp scal_s_width; /* string containing height */
png_charp scal_s_height; /* string containing width */
#endif
#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers; /* the image bits */
#endif
};
#endif /* PNGINFO_H */

View file

@ -0,0 +1,211 @@
/* libpng 1.6.2 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* Libpng version 1.6.2 - April 25, 2013 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */
/* and license in png.h */
/* pnglibconf.h */
/* Machine generated file: DO NOT EDIT */
/* Derived from: scripts/pnglibconf.dfa */
#ifndef PNGLCONF_H
#define PNGLCONF_H
/* options */
#define PNG_16BIT_SUPPORTED
#define PNG_ALIGNED_MEMORY_SUPPORTED
/*#undef PNG_ARM_NEON_API_SUPPORTED*/
/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
/*#undef PNG_ARM_NEON_SUPPORTED*/
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_COLORSPACE_SUPPORTED
//#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED
#define PNG_FORMAT_AFIRST_SUPPORTED
#define PNG_FORMAT_BGR_SUPPORTED
#define PNG_GAMMA_SUPPORTED
#define PNG_GET_PALETTE_MAX_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
#define PNG_READ_ALPHA_MODE_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_GAMMA_SUPPORTED
#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_INTERLACING_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#define PNG_READ_INVERT_SUPPORTED
#define PNG_READ_OPT_PLTE_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
#define PNG_READ_TRANSFORMS_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED
#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_pCAL_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_sPLT_SUPPORTED
#define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_tEXt_SUPPORTED
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
#define PNG_SAVE_INT_32_SUPPORTED
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
/*#undef PNG_SET_OPTION_SUPPORTED*/
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
#define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_TEXT_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED
#define PNG_USER_TRANSFORM_INFO_SUPPORTED
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
#define PNG_WARNINGS_SUPPORTED
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
#define PNG_WRITE_TEXT_SUPPORTED
#define PNG_WRITE_TRANSFORMS_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_iTXt_SUPPORTED
#define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_pCAL_SUPPORTED
#define PNG_WRITE_pHYs_SUPPORTED
#define PNG_WRITE_sBIT_SUPPORTED
#define PNG_WRITE_sCAL_SUPPORTED
#define PNG_WRITE_sPLT_SUPPORTED
#define PNG_WRITE_sRGB_SUPPORTED
#define PNG_WRITE_tEXt_SUPPORTED
#define PNG_WRITE_tIME_SUPPORTED
#define PNG_WRITE_tRNS_SUPPORTED
#define PNG_WRITE_zTXt_SUPPORTED
#define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED
#define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED
#define PNG_tEXt_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_tRNS_SUPPORTED
#define PNG_zTXt_SUPPORTED
/* end of options */
/* settings */
#define PNG_API_RULE 0
#define PNG_CALLOC_SUPPORTED
#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
#define PNG_INFLATE_BUF_SIZE 1024
#define PNG_MAX_GAMMA_8 11
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5
#define PNG_QUANTIZE_RED_BITS 5
#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192
#define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1
#define PNG_sCAL_PRECISION 5
#define PNG_sRGB_PROFILE_CHECKS 2
/* end of settings */
#endif /* PNGLCONF_H */

View file

@ -0,0 +1,277 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all memory allocation. Users who
* need special memory handling are expected to supply replacement
* functions for png_malloc() and png_free(), and to use
* png_create_read_struct_2() and png_create_write_struct_2() to
* identify the replacement functions.
*/
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Free a png_struct */
void /* PRIVATE */
png_destroy_png_struct(png_structrp png_ptr)
{
if (png_ptr != NULL)
{
/* png_free might call png_error and may certainly call
* png_get_mem_ptr, so fake a temporary png_struct to support this.
*/
png_struct dummy_struct = *png_ptr;
memset(png_ptr, 0, (sizeof *png_ptr));
png_free(&dummy_struct, png_ptr);
# ifdef PNG_SETJMP_SUPPORTED
/* We may have a jmp_buf left to deallocate. */
png_free_jmpbuf(&dummy_struct);
# endif
}
}
/* Allocate memory. For reasonable files, size should never exceed
* 64K. However, zlib may allocate more then 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
ret = png_malloc(png_ptr, size);
if (ret != NULL)
memset(ret, 0, size);
return ret;
}
/* png_malloc_base, an internal function added at libpng 1.6.0, does the work of
* allocating memory, taking into account limits and PNG_USER_MEM_SUPPORTED.
* Checking and error handling must happen outside this routine; it returns NULL
* if the allocation cannot be done (for any reason.)
*/
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED)
{
/* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
* allocators have also been removed in 1.6.0, so any 16-bit system now has
* to implement a user memory handler. This checks to be sure it isn't
* called with big numbers.
*/
#ifdef PNG_USER_MEM_SUPPORTED
PNG_UNUSED(png_ptr)
#endif
if (size > 0 && size <= PNG_SIZE_MAX
# ifdef PNG_MAX_MALLOC_64K
&& size <= 65536U
# endif
)
{
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
else
#endif
return malloc((size_t)size); /* checked for truncation above */
}
else
return NULL;
}
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
* that arises because of the checks in png_realloc_array that are repeated in
* png_malloc_array.
*/
static png_voidp
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
size_t element_size)
{
png_alloc_size_t req = nelements; /* known to be > 0 */
if (req <= PNG_SIZE_MAX/element_size)
return png_malloc_base(png_ptr, req * element_size);
/* The failure case when the request is too large */
return NULL;
}
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_array,(png_const_structrp png_ptr, int nelements,
size_t element_size),PNG_ALLOCATED)
{
if (nelements <= 0 || element_size == 0)
png_error(png_ptr, "internal error: array alloc");
return png_malloc_array_checked(png_ptr, nelements, element_size);
}
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
{
/* These are internal errors: */
if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
(old_array == NULL && old_elements > 0))
png_error(png_ptr, "internal error: array realloc");
/* Check for overflow on the elements count (so the caller does not have to
* check.)
*/
if (add_elements <= INT_MAX - old_elements)
{
png_voidp new_array = png_malloc_array_checked(png_ptr,
old_elements+add_elements, element_size);
if (new_array != NULL)
{
/* Because png_malloc_array worked the size calculations below cannot
* overflow.
*/
if (old_elements > 0)
memcpy(new_array, old_array, element_size*(unsigned)old_elements);
memset((char*)new_array + element_size*(unsigned)old_elements, 0,
element_size*(unsigned)add_elements);
return new_array;
}
}
return NULL; /* error */
}
/* Various functions that have different error handling are derived from this.
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
* function png_malloc_default is also provided.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
if (png_ptr == NULL)
return NULL;
ret = png_malloc_base(png_ptr, size);
if (ret == NULL)
png_error(png_ptr, "Out of memory"); /* 'm' means png_malloc */
return ret;
}
#ifdef PNG_USER_MEM_SUPPORTED
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED PNG_DEPRECATED)
{
png_voidp ret;
if (png_ptr == NULL)
return NULL;
/* Passing 'NULL' here bypasses the application provided memory handler. */
ret = png_malloc_base(NULL/*use malloc*/, size);
if (ret == NULL)
png_error(png_ptr, "Out of Memory"); /* 'M' means png_malloc_default */
return ret;
}
#endif /* PNG_USER_MEM_SUPPORTED */
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will issue a png_warning and return NULL instead of issuing a
* png_error, if it fails to allocate the requested memory.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED)
{
if (png_ptr != NULL)
{
png_voidp ret = png_malloc_base(png_ptr, size);
if (ret != NULL)
return ret;
png_warning(png_ptr, "Out of memory");
}
return NULL;
}
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
* without taking any action.
*/
void PNGAPI
png_free(png_const_structrp png_ptr, png_voidp ptr)
{
if (png_ptr == NULL || ptr == NULL)
return;
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL)
png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
else
png_free_default(png_ptr, ptr);
}
PNG_FUNCTION(void,PNGAPI
png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
{
if (png_ptr == NULL || ptr == NULL)
return;
#endif /* PNG_USER_MEM_SUPPORTED */
free(ptr);
}
#ifdef PNG_USER_MEM_SUPPORTED
/* This function is called when the application wants to use another method
* of allocating and freeing memory.
*/
void PNGAPI
png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
{
if (png_ptr != NULL)
{
png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn;
}
}
/* This function returns a pointer to the mem_ptr associated with the user
* functions. The application should free any memory associated with this
* pointer before png_write_destroy and png_read_destroy are called.
*/
png_voidp PNGAPI
png_get_mem_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return NULL;
return png_ptr->mem_ptr;
}
#endif /* PNG_USER_MEM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,118 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all input. Users who need
* special handling are expected to write a function that has the same
* arguments as this and performs a similar function, but that possibly
* has a different input method. Note that you shouldn't change this
* function, but rather write a replacement function and then make
* libpng use it at run time with png_set_read_fn(...).
*/
#include "pngpriv.h"
#ifdef PNG_READ_SUPPORTED
/* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered reads. This should never be asked
* to read more then 64K on a 16 bit machine.
*/
void /* PRIVATE */
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
{
png_debug1(4, "reading %d bytes", (int)length);
if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length);
else
png_error(png_ptr, "Call to NULL read function");
}
#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are
* not reading from a standard C stream, you should create a replacement
* read_data function and use it at run time with png_set_read_fn(), rather
* than changing the library.
*/
void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
if (png_ptr == NULL)
return;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
if (check != length)
png_error(png_ptr, "Read Error");
}
#endif
/* This function allows the application to supply a new input function
* for libpng if standard C streams aren't being used.
*
* This function takes as its arguments:
*
* png_ptr - pointer to a png input data structure
*
* io_ptr - pointer to user supplied structure containing info about
* the input functions. May be NULL.
*
* read_data_fn - pointer to a new input function that takes as its
* arguments a pointer to a png_struct, a pointer to
* a location where input data can be stored, and a 32-bit
* unsigned int that is the number of bytes to be read.
* To exit and output any fatal error messages the new write
* function should call png_error(png_ptr, "Error msg").
* May be NULL, in which case libpng's default function will
* be used.
*/
void PNGAPI
png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn)
{
if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr;
#ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn;
else
png_ptr->read_data_fn = png_default_read_data;
#else
png_ptr->read_data_fn = read_data_fn;
#endif
/* It is an error to write to a read device */
if (png_ptr->write_data_fn != NULL)
{
png_ptr->write_data_fn = NULL;
png_warning(png_ptr,
"Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL;
#endif
}
#endif /* PNG_READ_SUPPORTED */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,489 @@
/* pngstruct.h - header file for PNG reference library
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.6.1 [March 28, 2013]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* The structure that holds the information to read and write PNG files.
* The only people who need to care about what is inside of this are the
* people who will be modifying the library for their own special needs.
* It should NOT be accessed directly by an application.
*/
#ifndef PNGSTRUCT_H
#define PNGSTRUCT_H
/* zlib.h defines the structure z_stream, an instance of which is included
* in this structure and is required for decompressing the LZ compressed
* data in PNG files.
*/
#ifndef ZLIB_CONST
/* We must ensure that zlib uses 'const' in declarations. */
# define ZLIB_CONST
#endif
#include "zlib.h"
#ifdef const
/* zlib.h sometimes #defines const to nothing, undo this. */
# undef const
#endif
/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
* with older builds.
*/
#if ZLIB_VERNUM < 0x1260
# define PNGZ_MSG_CAST(s) png_constcast(char*,s)
# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
#else
# define PNGZ_MSG_CAST(s) (s)
# define PNGZ_INPUT_CAST(b) (b)
#endif
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximuum for png_size_t. The value can be overriden in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
*/
#ifndef ZLIB_IO_MAX
# define ZLIB_IO_MAX ((uInt)-1)
#endif
#ifdef PNG_WRITE_SUPPORTED
/* The type of a compression buffer list used by the write code. */
typedef struct png_compression_buffer
{
struct png_compression_buffer *next;
png_byte output[1]; /* actually zbuf_size */
} png_compression_buffer, *png_compression_bufferp;
#define PNG_COMPRESSION_BUFFER_SIZE(pp)\
(offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
#endif
/* Colorspace support; structures used in png_struct, png_info and in internal
* functions to hold and communicate information about the color space.
*
* PNG_COLORSPACE_SUPPORTED is only required if the application will perform
* colorspace corrections, otherwise all the colorspace information can be
* skipped and the size of libpng can be reduced (significantly) by compiling
* out the colorspace support.
*/
#ifdef PNG_COLORSPACE_SUPPORTED
/* The chromaticities of the red, green and blue colorants and the chromaticity
* of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
*/
typedef struct png_xy
{
png_fixed_point redx, redy;
png_fixed_point greenx, greeny;
png_fixed_point bluex, bluey;
png_fixed_point whitex, whitey;
} png_xy;
/* The same data as above but encoded as CIE XYZ values. When this data comes
* from chromaticities the sum of the Y values is assumed to be 1.0
*/
typedef struct png_XYZ
{
png_fixed_point red_X, red_Y, red_Z;
png_fixed_point green_X, green_Y, green_Z;
png_fixed_point blue_X, blue_Y, blue_Z;
} png_XYZ;
#endif /* COLORSPACE */
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* A colorspace is all the above plus, potentially, profile information,
* however at present libpng does not use the profile internally so it is only
* stored in the png_info struct (if iCCP is supported.) The rendering intent
* is retained here and is checked.
*
* The file gamma encoding information is also stored here and gamma correction
* is done by libpng, whereas color correction must currently be done by the
* application.
*/
typedef struct png_colorspace
{
#ifdef PNG_GAMMA_SUPPORTED
png_fixed_point gamma; /* File gamma */
#endif
#ifdef PNG_COLORSPACE_SUPPORTED
png_xy end_points_xy; /* End points as chromaticities */
png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */
png_uint_16 rendering_intent; /* Rendering intent of a profile */
#endif
/* Flags are always defined to simplify the code. */
png_uint_16 flags; /* As defined below */
} png_colorspace, * PNG_RESTRICT png_colorspacerp;
typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
/* General flags for the 'flags' field */
#define PNG_COLORSPACE_HAVE_GAMMA 0x0001
#define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002
#define PNG_COLORSPACE_HAVE_INTENT 0x0004
#define PNG_COLORSPACE_FROM_gAMA 0x0008
#define PNG_COLORSPACE_FROM_cHRM 0x0010
#define PNG_COLORSPACE_FROM_sRGB 0x0020
#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
#define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
#define PNG_COLORSPACE_INVALID 0x8000
#define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
#endif /* COLORSPACE || GAMMA */
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
size_t jmp_buf_size; /* size of the above, if allocated */
#endif
png_error_ptr error_fn; /* function for printing errors and aborting */
#ifdef PNG_WARNINGS_SUPPORTED
png_error_ptr warning_fn; /* function for printing warnings */
#endif
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions */
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
/* These were added in libpng-1.0.2 */
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#endif
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
z_stream zstream; /* decompression structure */
#ifdef PNG_WRITE_SUPPORTED
png_compression_bufferp zbuffer_list; /* Created on demand during write */
uInt zbuffer_size; /* size of the actual buffer */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
#endif
/* Added at libpng 1.5.4 */
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
int zlib_text_level; /* holds zlib compression level */
int zlib_text_method; /* holds zlib compression method */
int zlib_text_window_bits; /* holds zlib compression window bits */
int zlib_text_mem_level; /* holds zlib compression memory level */
int zlib_text_strategy; /* holds zlib compression strategy */
#endif
/* End of material added at libpng 1.5.4 */
/* Added at libpng 1.6.0 */
#ifdef PNG_WRITE_SUPPORTED
int zlib_set_level; /* Actual values set into the zstream on write */
int zlib_set_method;
int zlib_set_window_bits;
int zlib_set_mem_level;
int zlib_set_strategy;
#endif
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_size_t rowbytes; /* size of row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
png_bytep prev_row; /* buffer to save previous (unfiltered) row.
* This is a pointer into big_prev_row
*/
png_bytep row_buf; /* buffer to save current (unfiltered) row.
* This is a pointer into big_row_buf
*/
#ifdef PNG_WRITE_SUPPORTED
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
#endif
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
/* Added at libpng-1.5.10 */
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
int num_palette_max; /* maximum palette index found in IDAT */
#endif
png_uint_16 num_trans; /* number of transparency values */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row: write only */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
#ifdef PNG_WRITE_SUPPORTED
png_byte usr_channels; /* channels at start of write: write only */
#endif
png_byte sig_bytes; /* magic bytes read/written from start of file */
png_byte maximum_pixel_depth;
/* pixel depth used for the row buffers */
png_byte transformed_pixel_depth;
/* pixel depth after read/write transforms */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
png_byte background_gamma_type;
png_fixed_point background_gamma;
png_color_16 background; /* background color in screen gamma space */
#ifdef PNG_READ_GAMMA_SUPPORTED
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_flush_ptr output_flush_fn; /* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans_alpha; /* alpha values for paletted files */
png_color_16 trans_color; /* transparent color for non-paletted files */
#endif
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* For the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
#ifdef PNG_READ_QUANTIZE_SUPPORTED
png_bytep palette_lookup; /* lookup table for quantizing */
png_bytep quantize_index; /* index translation for palette files */
#endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
/* Options */
#ifdef PNG_SET_OPTION_SUPPORTED
png_byte options; /* On/off state (up to 4 options) */
#endif
#if PNG_LIBPNG_VER < 10700
/* To do: remove this from libpng-1.7 */
#ifdef PNG_TIME_RFC1123_SUPPORTED
char time_buffer[29]; /* String to hold RFC 1123 time text */
#endif
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp user_chunk_ptr;
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
#endif
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
int unknown_default; /* As PNG_HANDLE_* */
unsigned int num_chunk_list; /* Number of entries in the list */
png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name
* followed by a PNG_HANDLE_* byte */
#endif
/* New members added in libpng-1.0.3 */
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte rgb_to_gray_status;
/* Added in libpng 1.5.5 to record setting of coefficients: */
png_byte rgb_to_gray_coefficients_set;
/* These were changed from png_byte in libpng-1.0.6 */
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
png_uint_32 mng_features_permitted;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_byte filter_type;
#endif
/* New members added in libpng-1.2.0 */
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
/* New member added in libpng-1.0.13 and 1.2.0 */
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
#ifdef PNG_READ_QUANTIZE_SUPPORTED
/* The following three members were added at version 1.0.14 and 1.2.4 */
png_bytep quantize_sort; /* working sort array */
png_bytep index_to_palette; /* where the original index currently is
in the palette */
png_bytep palette_to_index; /* which original index points to this
palette color */
#endif
/* New members added in libpng-1.0.16 and 1.2.6 */
png_byte compression_type;
#ifdef PNG_USER_LIMITS_SUPPORTED
png_uint_32 user_width_max;
png_uint_32 user_height_max;
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
* chunks that can be stored (0 means unlimited).
*/
png_uint_32 user_chunk_cache_max;
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
* can occupy when decompressed. 0 means unlimited.
*/
png_alloc_size_t user_chunk_malloc_max;
#endif
/* New member added in libpng-1.0.25 and 1.2.17 */
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
/* Temporary storage for unknown chunk that the library doesn't recognize,
* used while reading the chunk.
*/
png_unknown_chunk unknown_chunk;
#endif
/* New member added in libpng-1.2.26 */
png_size_t old_big_row_buf_size;
#ifdef PNG_READ_SUPPORTED
/* New member added in libpng-1.2.30 */
png_bytep read_buffer; /* buffer for reading chunk data */
png_alloc_size_t read_buffer_size; /* current size of the buffer */
#endif
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
uInt IDAT_read_size; /* limit on read buffer size for IDAT */
#endif
#ifdef PNG_IO_STATE_SUPPORTED
/* New member added in libpng-1.4.0 */
png_uint_32 io_state;
#endif
/* New member added in libpng-1.5.6 */
png_bytep big_prev_row;
/* New member added in libpng-1.5.7 */
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row);
#ifdef PNG_READ_SUPPORTED
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
png_colorspace colorspace;
#endif
#endif
};
#endif /* PNGSTRUCT_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,841 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.6.2 [April 25, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Turn on BGR-to-RGB mapping */
void PNGAPI
png_set_bgr(png_structrp png_ptr)
{
png_debug(1, "in png_set_bgr");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_BGR;
}
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Turn on 16 bit byte swapping */
void PNGAPI
png_set_swap(png_structrp png_ptr)
{
png_debug(1, "in png_set_swap");
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth == 16)
png_ptr->transformations |= PNG_SWAP_BYTES;
}
#endif
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* Turn on pixel packing */
void PNGAPI
png_set_packing(png_structrp png_ptr)
{
png_debug(1, "in png_set_packing");
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth < 8)
{
png_ptr->transformations |= PNG_PACK;
png_ptr->usr_bit_depth = 8;
}
}
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* Turn on packed pixel swapping */
void PNGAPI
png_set_packswap(png_structrp png_ptr)
{
png_debug(1, "in png_set_packswap");
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth < 8)
png_ptr->transformations |= PNG_PACKSWAP;
}
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
void PNGAPI
png_set_shift(png_structrp png_ptr, png_const_color_8p true_bits)
{
png_debug(1, "in png_set_shift");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_SHIFT;
png_ptr->shift = *true_bits;
}
#endif
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED)
int PNGAPI
png_set_interlace_handling(png_structrp png_ptr)
{
png_debug(1, "in png_set_interlace handling");
if (png_ptr && png_ptr->interlaced)
{
png_ptr->transformations |= PNG_INTERLACE;
return (7);
}
return (1);
}
#endif
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
/* Add a filler byte on read, or remove a filler or alpha byte on write.
* The filler type has changed in v0.95 to allow future 2-byte fillers
* for 48-bit input data, as well as to avoid problems with some compilers
* that don't like bytes as parameters.
*/
void PNGAPI
png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_filler");
if (png_ptr == NULL)
return;
/* In libpng 1.6 it is possible to determine whether this is a read or write
* operation and therefore to do more checking here for a valid call.
*/
if (png_ptr->mode & PNG_IS_READ_STRUCT)
{
# ifdef PNG_READ_FILLER_SUPPORTED
/* On read png_set_filler is always valid, regardless of the base PNG
* format, because other transformations can give a format where the
* filler code can execute (basically an 8 or 16-bit component RGB or G
* format.)
*
* NOTE: usr_channels is not used by the read code! (This has led to
* confusion in the past.) The filler is only used in the read code.
*/
png_ptr->filler = (png_uint_16)filler;
# else
png_app_error(png_ptr, "png_set_filler not supported on read");
PNG_UNUSED(filler) /* not used in the write case */
return;
# endif
}
else /* write */
{
# ifdef PNG_WRITE_FILLER_SUPPORTED
/* On write the usr_channels parameter must be set correctly at the
* start to record the number of channels in the app-supplied data.
*/
switch (png_ptr->color_type)
{
case PNG_COLOR_TYPE_RGB:
png_ptr->usr_channels = 4;
break;
case PNG_COLOR_TYPE_GRAY:
if (png_ptr->bit_depth >= 8)
{
png_ptr->usr_channels = 2;
break;
}
else
{
/* There simply isn't any code in libpng to strip out bits
* from bytes when the components are less than a byte in
* size!
*/
png_app_error(png_ptr,
"png_set_filler is invalid for low bit depth gray output");
return;
}
default:
png_app_error(png_ptr,
"png_set_filler: inappropriate color type");
return;
}
# else
png_app_error(png_ptr, "png_set_filler not supported on write");
return;
# endif
}
/* Here on success - libpng supports the operation, set the transformation
* and the flag to say where the filler channel is.
*/
png_ptr->transformations |= PNG_FILLER;
if (filler_loc == PNG_FILLER_AFTER)
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
else
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
}
/* Added to libpng-1.2.7 */
void PNGAPI
png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_add_alpha");
if (png_ptr == NULL)
return;
png_set_filler(png_ptr, filler, filler_loc);
/* The above may fail to do anything. */
if (png_ptr->transformations & PNG_FILLER)
png_ptr->transformations |= PNG_ADD_ALPHA;
}
#endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
void PNGAPI
png_set_swap_alpha(png_structrp png_ptr)
{
png_debug(1, "in png_set_swap_alpha");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_SWAP_ALPHA;
}
#endif
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
void PNGAPI
png_set_invert_alpha(png_structrp png_ptr)
{
png_debug(1, "in png_set_invert_alpha");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_INVERT_ALPHA;
}
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
void PNGAPI
png_set_invert_mono(png_structrp png_ptr)
{
png_debug(1, "in png_set_invert_mono");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_INVERT_MONO;
}
/* Invert monochrome grayscale data */
void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_invert");
/* This test removed from libpng version 1.0.13 and 1.2.0:
* if (row_info->bit_depth == 1 &&
*/
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
{
png_bytep rp = row;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i++)
{
*rp = (png_byte)(~(*rp));
rp++;
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
row_info->bit_depth == 8)
{
png_bytep rp = row;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 2)
{
*rp = (png_byte)(~(*rp));
rp += 2;
}
}
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
row_info->bit_depth == 16)
{
png_bytep rp = row;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 4)
{
*rp = (png_byte)(~(*rp));
*(rp + 1) = (png_byte)(~(*(rp + 1)));
rp += 4;
}
}
#endif
}
#endif
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swaps byte order on 16 bit depth images */
void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_swap");
if (row_info->bit_depth == 16)
{
png_bytep rp = row;
png_uint_32 i;
png_uint_32 istop= row_info->width * row_info->channels;
for (i = 0; i < istop; i++, rp += 2)
{
png_byte t = *rp;
*rp = *(rp + 1);
*(rp + 1) = t;
}
}
}
#endif
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
static PNG_CONST png_byte onebppswaptable[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4,
0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC,
0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA,
0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6,
0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1,
0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9,
0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED,
0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3,
0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7,
0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF,
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
static PNG_CONST png_byte twobppswaptable[256] = {
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4,
0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8,
0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8,
0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC,
0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC,
0x01, 0x41, 0x81, 0xC1, 0x11, 0x51, 0x91, 0xD1,
0x21, 0x61, 0xA1, 0xE1, 0x31, 0x71, 0xB1, 0xF1,
0x05, 0x45, 0x85, 0xC5, 0x15, 0x55, 0x95, 0xD5,
0x25, 0x65, 0xA5, 0xE5, 0x35, 0x75, 0xB5, 0xF5,
0x09, 0x49, 0x89, 0xC9, 0x19, 0x59, 0x99, 0xD9,
0x29, 0x69, 0xA9, 0xE9, 0x39, 0x79, 0xB9, 0xF9,
0x0D, 0x4D, 0x8D, 0xCD, 0x1D, 0x5D, 0x9D, 0xDD,
0x2D, 0x6D, 0xAD, 0xED, 0x3D, 0x7D, 0xBD, 0xFD,
0x02, 0x42, 0x82, 0xC2, 0x12, 0x52, 0x92, 0xD2,
0x22, 0x62, 0xA2, 0xE2, 0x32, 0x72, 0xB2, 0xF2,
0x06, 0x46, 0x86, 0xC6, 0x16, 0x56, 0x96, 0xD6,
0x26, 0x66, 0xA6, 0xE6, 0x36, 0x76, 0xB6, 0xF6,
0x0A, 0x4A, 0x8A, 0xCA, 0x1A, 0x5A, 0x9A, 0xDA,
0x2A, 0x6A, 0xAA, 0xEA, 0x3A, 0x7A, 0xBA, 0xFA,
0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xDE,
0x2E, 0x6E, 0xAE, 0xEE, 0x3E, 0x7E, 0xBE, 0xFE,
0x03, 0x43, 0x83, 0xC3, 0x13, 0x53, 0x93, 0xD3,
0x23, 0x63, 0xA3, 0xE3, 0x33, 0x73, 0xB3, 0xF3,
0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7,
0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7,
0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB,
0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB,
0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF,
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
};
static PNG_CONST png_byte fourbppswaptable[256] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1,
0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72,
0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2,
0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73,
0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3,
0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74,
0x84, 0x94, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4,
0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75,
0x85, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5,
0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76,
0x86, 0x96, 0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6,
0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77,
0x87, 0x97, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7,
0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78,
0x88, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8,
0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79,
0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9,
0x0A, 0x1A, 0x2A, 0x3A, 0x4A, 0x5A, 0x6A, 0x7A,
0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA,
0x0B, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B,
0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB,
0x0C, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C,
0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xDC, 0xEC, 0xFC,
0x0D, 0x1D, 0x2D, 0x3D, 0x4D, 0x5D, 0x6D, 0x7D,
0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD,
0x0E, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E,
0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE,
0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F,
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
};
/* Swaps pixel packing order within bytes */
void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_packswap");
if (row_info->bit_depth < 8)
{
png_bytep rp;
png_const_bytep end, table;
end = row + row_info->rowbytes;
if (row_info->bit_depth == 1)
table = onebppswaptable;
else if (row_info->bit_depth == 2)
table = twobppswaptable;
else if (row_info->bit_depth == 4)
table = fourbppswaptable;
else
return;
for (rp = row; rp < end; rp++)
*rp = table[*rp];
}
}
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
/* Remove a channel - this used to be 'png_do_strip_filler' but it used a
* somewhat weird combination of flags to determine what to do. All the calls
* to png_do_strip_filler are changed in 1.5.2 to call this instead with the
* correct arguments.
*
* The routine isn't general - the channel must be the channel at the start or
* end (not in the middle) of each pixel.
*/
void /* PRIVATE */
png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{
png_bytep sp = row; /* source pointer */
png_bytep dp = row; /* destination pointer */
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
/* At the start sp will point to the first byte to copy and dp to where
* it is copied to. ep always points just beyond the end of the row, so
* the loop simply copies (channels-1) channels until sp reaches ep.
*
* at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc.
* nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
*/
/* GA, GX, XG cases */
if (row_info->channels == 2)
{
if (row_info->bit_depth == 8)
{
if (at_start) /* Skip initial filler */
++sp;
else /* Skip initial channel and, for sp, the filler */
sp += 2, ++dp;
/* For a 1 pixel wide image there is nothing to do */
while (sp < ep)
*dp++ = *sp, sp += 2;
row_info->pixel_depth = 8;
}
else if (row_info->bit_depth == 16)
{
if (at_start) /* Skip initial filler */
sp += 2;
else /* Skip initial channel and, for sp, the filler */
sp += 4, dp += 2;
while (sp < ep)
*dp++ = *sp++, *dp++ = *sp, sp += 3;
row_info->pixel_depth = 16;
}
else
return; /* bad bit depth */
row_info->channels = 1;
/* Finally fix the color type if it records an alpha channel */
if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
row_info->color_type = PNG_COLOR_TYPE_GRAY;
}
/* RGBA, RGBX, XRGB cases */
else if (row_info->channels == 4)
{
if (row_info->bit_depth == 8)
{
if (at_start) /* Skip initial filler */
++sp;
else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3;
/* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep)
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
row_info->pixel_depth = 24;
}
else if (row_info->bit_depth == 16)
{
if (at_start) /* Skip initial filler */
sp += 2;
else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6;
while (sp < ep)
{
/* Copy 6 bytes, skip 2 */
*dp++ = *sp++, *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp, sp += 3;
}
row_info->pixel_depth = 48;
}
else
return; /* bad bit depth */
row_info->channels = 3;
/* Finally fix the color type if it records an alpha channel */
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
row_info->color_type = PNG_COLOR_TYPE_RGB;
}
else
return; /* The filler channel has gone already */
/* Fix the rowbytes value. */
row_info->rowbytes = dp-row;
}
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Swaps red and blue bytes within a pixel */
void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_bgr");
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
{
png_uint_32 row_width = row_info->width;
if (row_info->bit_depth == 8)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
{
png_bytep rp;
png_uint_32 i;
for (i = 0, rp = row; i < row_width; i++, rp += 3)
{
png_byte save = *rp;
*rp = *(rp + 2);
*(rp + 2) = save;
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_bytep rp;
png_uint_32 i;
for (i = 0, rp = row; i < row_width; i++, rp += 4)
{
png_byte save = *rp;
*rp = *(rp + 2);
*(rp + 2) = save;
}
}
}
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
{
png_bytep rp;
png_uint_32 i;
for (i = 0, rp = row; i < row_width; i++, rp += 6)
{
png_byte save = *rp;
*rp = *(rp + 4);
*(rp + 4) = save;
save = *(rp + 1);
*(rp + 1) = *(rp + 5);
*(rp + 5) = save;
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_bytep rp;
png_uint_32 i;
for (i = 0, rp = row; i < row_width; i++, rp += 8)
{
png_byte save = *rp;
*rp = *(rp + 4);
*(rp + 4) = save;
save = *(rp + 1);
*(rp + 1) = *(rp + 5);
*(rp + 5) = save;
}
}
}
#endif
}
}
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
/* Added at libpng-1.5.10 */
void /* PRIVATE */
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
{
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
{
/* Calculations moved outside switch in an attempt to stop different
* compiler warnings. 'padding' is in *bits* within the last byte, it is
* an 'int' because pixel_depth becomes an 'int' in the expression below,
* and this calculation is used because it avoids warnings that other
* forms produced on either GCC or MSVC.
*/
int padding = (-row_info->pixel_depth * row_info->width) & 7;
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth)
{
case 1:
{
/* in this case, all bytes must be 0 so we don't need
* to unpack the pixels except for the rightmost one.
*/
for (; rp > png_ptr->row_buf; rp--)
{
if (*rp >> padding != 0)
png_ptr->num_palette_max = 1;
padding = 0;
}
break;
}
case 2:
{
for (; rp > png_ptr->row_buf; rp--)
{
int i = ((*rp >> padding) & 0x03);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
i = (((*rp >> padding) >> 2) & 0x03);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
i = (((*rp >> padding) >> 4) & 0x03);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
i = (((*rp >> padding) >> 6) & 0x03);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
padding = 0;
}
break;
}
case 4:
{
for (; rp > png_ptr->row_buf; rp--)
{
int i = ((*rp >> padding) & 0x0f);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
i = (((*rp >> padding) >> 4) & 0x0f);
if (i > png_ptr->num_palette_max)
png_ptr->num_palette_max = i;
padding = 0;
}
break;
}
case 8:
{
for (; rp > png_ptr->row_buf; rp--)
{
if (*rp > png_ptr->num_palette_max)
png_ptr->num_palette_max = (int) *rp;
}
break;
}
default:
break;
}
}
}
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
void PNGAPI
png_set_user_transform_info(png_structrp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels)
{
png_debug(1, "in png_set_user_transform_info");
if (png_ptr == NULL)
return;
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
{
png_app_error(png_ptr,
"info change after png_start_read_image or png_read_update_info");
return;
}
#endif
png_ptr->user_transform_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
}
#endif
/* This function returns a pointer to the user_transform_ptr associated with
* the user transform functions. The application should free any memory
* associated with this pointer before png_write_destroy and png_read_destroy
* are called.
*/
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_voidp PNGAPI
png_get_user_transform_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
return png_ptr->user_transform_ptr;
}
#endif
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
png_uint_32 PNGAPI
png_get_current_row_number(png_const_structrp png_ptr)
{
/* See the comments in png.h - this is the sub-image row when reading and
* interlaced image.
*/
if (png_ptr != NULL)
return png_ptr->row_number;
return PNG_UINT_32_MAX; /* help the app not to fail silently */
}
png_byte PNGAPI
png_get_current_pass_number(png_const_structrp png_ptr)
{
if (png_ptr != NULL)
return png_ptr->pass;
return 8; /* invalid */
}
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View file

@ -0,0 +1,164 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all output. Users who need
* special handling are expected to write functions that have the same
* arguments as these and perform similar functions, but that possibly
* use different output methods. Note that you shouldn't change these
* functions, but rather write replacement functions and then change
* them at run time with png_set_write_fn(...).
*/
#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
/* Write the data to whatever output you are using. The default routine
* writes to a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered writes. This should never be asked
* to write more than 64K on a 16 bit machine.
*/
void /* PRIVATE */
png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
{
/* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
length);
else
png_error(png_ptr, "Call to NULL write function");
}
#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual writing of data. If you are
* not writing to a standard C stream, you should create a replacement
* write_data function and use it at run time with png_set_write_fn(), rather
* than changing the library.
*/
void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
if (png_ptr == NULL)
return;
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
if (check != length)
png_error(png_ptr, "Write Error");
}
#endif
/* This function is called to output any data pending writing (normally
* to disk). After png_flush is called, there should be no data pending
* writing in any buffers.
*/
#ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */
png_flush(png_structrp png_ptr)
{
if (png_ptr->output_flush_fn != NULL)
(*(png_ptr->output_flush_fn))(png_ptr);
}
# ifdef PNG_STDIO_SUPPORTED
void PNGCBAPI
png_default_flush(png_structp png_ptr)
{
png_FILE_p io_ptr;
if (png_ptr == NULL)
return;
io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr));
fflush(io_ptr);
}
# endif
#endif
/* This function allows the application to supply new output functions for
* libpng if standard C streams aren't being used.
*
* This function takes as its arguments:
* png_ptr - pointer to a png output data structure
* io_ptr - pointer to user supplied structure containing info about
* the output functions. May be NULL.
* write_data_fn - pointer to a new output function that takes as its
* arguments a pointer to a png_struct, a pointer to
* data to be written, and a 32-bit unsigned int that is
* the number of bytes to be written. The new write
* function should call png_error(png_ptr, "Error msg")
* to exit and output any fatal error messages. May be
* NULL, in which case libpng's default function will
* be used.
* flush_data_fn - pointer to a new flush function that takes as its
* arguments a pointer to a png_struct. After a call to
* the flush function, there should be no data in any buffers
* or pending transmission. If the output method doesn't do
* any buffering of output, a function prototype must still be
* supplied although it doesn't have to do anything. If
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
* time, output_flush_fn will be ignored, although it must be
* supplied for compatibility. May be NULL, in which case
* libpng's default function will be used, if
* PNG_WRITE_FLUSH_SUPPORTED is defined. This is not
* a good idea if io_ptr does not point to a standard
* *FILE structure.
*/
void PNGAPI
png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
{
if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr;
#ifdef PNG_STDIO_SUPPORTED
if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn;
else
png_ptr->write_data_fn = png_default_write_data;
#else
png_ptr->write_data_fn = write_data_fn;
#endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;
else
png_ptr->output_flush_fn = png_default_flush;
# else
png_ptr->output_flush_fn = output_flush_fn;
# endif
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
/* It is an error to read while writing a png file */
if (png_ptr->read_data_fn != NULL)
{
png_ptr->read_data_fn = NULL;
png_warning(png_ptr,
"Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
}
#endif /* PNG_WRITE_SUPPORTED */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,637 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
/* Transform the data according to the user's wishes. The order of
* transformations is significant.
*/
void /* PRIVATE */
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
{
png_debug(1, "in png_do_write_transformations");
if (png_ptr == NULL)
return;
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform
function */
(png_ptr, /* png_ptr */
row_info, /* row_info: */
/* png_uint_32 width; width of row */
/* png_size_t rowbytes; number of bytes in row */
/* png_byte color_type; color type of pixels */
/* png_byte bit_depth; bit depth of samples */
/* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#endif
#ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
#endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(row_info, png_ptr->row_buf + 1);
#endif
#ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_pack(row_info, png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth);
#endif
#ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(row_info, png_ptr->row_buf + 1);
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(row_info, png_ptr->row_buf + 1,
&(png_ptr->shift));
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
#endif
#ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR)
png_do_bgr(row_info, png_ptr->row_buf + 1);
#endif
#ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(row_info, png_ptr->row_buf + 1);
#endif
}
#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
* row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images).
*/
void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
png_debug(1, "in png_do_pack");
if (row_info->bit_depth == 8 &&
row_info->channels == 1)
{
switch ((int)bit_depth)
{
case 1:
{
png_bytep sp, dp;
int mask, v;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
sp = row;
dp = row;
mask = 0x80;
v = 0;
for (i = 0; i < row_width; i++)
{
if (*sp != 0)
v |= mask;
sp++;
if (mask > 1)
mask >>= 1;
else
{
mask = 0x80;
*dp = (png_byte)v;
dp++;
v = 0;
}
}
if (mask != 0x80)
*dp = (png_byte)v;
break;
}
case 2:
{
png_bytep sp, dp;
int shift, v;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
sp = row;
dp = row;
shift = 6;
v = 0;
for (i = 0; i < row_width; i++)
{
png_byte value;
value = (png_byte)(*sp & 0x03);
v |= (value << shift);
if (shift == 0)
{
shift = 6;
*dp = (png_byte)v;
dp++;
v = 0;
}
else
shift -= 2;
sp++;
}
if (shift != 6)
*dp = (png_byte)v;
break;
}
case 4:
{
png_bytep sp, dp;
int shift, v;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
sp = row;
dp = row;
shift = 4;
v = 0;
for (i = 0; i < row_width; i++)
{
png_byte value;
value = (png_byte)(*sp & 0x0f);
v |= (value << shift);
if (shift == 0)
{
shift = 4;
*dp = (png_byte)v;
dp++;
v = 0;
}
else
shift -= 4;
sp++;
}
if (shift != 4)
*dp = (png_byte)v;
break;
}
default:
break;
}
row_info->bit_depth = (png_byte)bit_depth;
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
row_info->width);
}
}
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift pixel values to take advantage of whole range. Pass the
* true number of bits in bit_depth. The row should be packed
* according to row_info->bit_depth. Thus, if you had a row of
* bit depth 4, but the pixels only had values from 0 to 7, you
* would pass 3 as bit_depth, and this routine would translate the
* data to 0 to 15.
*/
void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row,
png_const_color_8p bit_depth)
{
png_debug(1, "in png_do_shift");
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{
int shift_start[4], shift_dec[4];
int channels = 0;
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
{
shift_start[channels] = row_info->bit_depth - bit_depth->red;
shift_dec[channels] = bit_depth->red;
channels++;
shift_start[channels] = row_info->bit_depth - bit_depth->green;
shift_dec[channels] = bit_depth->green;
channels++;
shift_start[channels] = row_info->bit_depth - bit_depth->blue;
shift_dec[channels] = bit_depth->blue;
channels++;
}
else
{
shift_start[channels] = row_info->bit_depth - bit_depth->gray;
shift_dec[channels] = bit_depth->gray;
channels++;
}
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
{
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
shift_dec[channels] = bit_depth->alpha;
channels++;
}
/* With low row depths, could only be grayscale, so one channel */
if (row_info->bit_depth < 8)
{
png_bytep bp = row;
png_size_t i;
unsigned int mask;
png_size_t row_bytes = row_info->rowbytes;
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
mask = 0x55;
else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
mask = 0x11;
else
mask = 0xff;
for (i = 0; i < row_bytes; i++, bp++)
{
int j;
unsigned int v, out;
v = *bp;
out = 0;
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
{
if (j > 0)
out |= v << j;
else
out |= (v >> (-j)) & mask;
}
*bp = (png_byte)(out & 0xff);
}
}
else if (row_info->bit_depth == 8)
{
png_bytep bp = row;
png_uint_32 i;
png_uint_32 istop = channels * row_info->width;
for (i = 0; i < istop; i++, bp++)
{
const unsigned int c = i%channels;
int j;
unsigned int v, out;
v = *bp;
out = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
out |= v << j;
else
out |= v >> (-j);
}
*bp = (png_byte)(out & 0xff);
}
}
else
{
png_bytep bp;
png_uint_32 i;
png_uint_32 istop = channels * row_info->width;
for (bp = row, i = 0; i < istop; i++)
{
const unsigned int c = i%channels;
int j;
unsigned int value, v;
v = png_get_uint_16(bp);
value = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
value |= v << j;
else
value |= v >> (-j);
}
*bp++ = (png_byte)((value >> 8) & 0xff);
*bp++ = (png_byte)(value & 0xff);
}
}
}
}
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_swap_alpha");
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
if (row_info->bit_depth == 8)
{
/* This converts from ARGB to RGBA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
png_byte save = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = save;
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This converts from AARRGGBB to RRGGBBAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
png_byte save[2];
save[0] = *(sp++);
save[1] = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = save[0];
*(dp++) = save[1];
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
if (row_info->bit_depth == 8)
{
/* This converts from AG to GA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
png_byte save = *(sp++);
*(dp++) = *(sp++);
*(dp++) = save;
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This converts from AAGG to GGAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
png_byte save[2];
save[0] = *(sp++);
save[1] = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = save[0];
*(dp++) = save[1];
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
}
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_invert_alpha");
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
if (row_info->bit_depth == 8)
{
/* This inverts the alpha channel in RGBA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*/
sp+=3; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This inverts the alpha channel in RRGGBBAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*/
sp+=6; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
if (row_info->bit_depth == 8)
{
/* This inverts the alpha channel in GA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
*(dp++) = *(sp++);
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This inverts the alpha channel in GGAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
/* Does nothing
*(dp++) = *(sp++);
*(dp++) = *(sp++);
*/
sp+=2; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
}
#endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_intrapixel");
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
{
int bytes_per_pixel;
png_uint_32 row_width = row_info->width;
if (row_info->bit_depth == 8)
{
png_bytep rp;
png_uint_32 i;
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
bytes_per_pixel = 3;
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
bytes_per_pixel = 4;
else
return;
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
png_bytep rp;
png_uint_32 i;
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
bytes_per_pixel = 6;
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
bytes_per_pixel = 8;
else
return;
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)((red >> 8) & 0xff);
*(rp + 1) = (png_byte)(red & 0xff);
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
*(rp + 5) = (png_byte)(blue & 0xff);
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
#endif /* PNG_MNG_FEATURES_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
#define MICROPROFILE_ENABLED 1
#define MICROPROFILE_GPU_TIMERS_D3D11 1
#define MICROPROFILE_GPU_TIMERS_D3D12 1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,333 @@
#ifdef MICROPROFILE_EMBED_HTML
#include <stdint.h>
const uint32_t uprof_16[] = {
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x10000000, 0x10000000, 0x00000308, 0x0f2d2800, 0x00000053, 0x47527301, 0xc9d90142, 0x00007f2c, 0x48700900, 0x00007359, 0x0000130b, 0x0001130b,
0x00189c9a, 0x50ff0000, 0x0045544c, 0x3d190000, 0x366b3818, 0x296ad96f, 0x6b382757, 0x214b2336, 0x37245226, 0x6b383569, 0x183e1936, 0x3569d76e, 0x411b336e, 0x2652281a, 0x19183d19, 0x6b38183d,
0x46924936, 0x20275729, 0x57291e49, 0x4fa45327, 0x38193e1a, 0x7d40366b, 0x5cbd603e, 0x2665ce6a, 0x6b382456, 0x366b3836, 0x4557b05b, 0x4f244286, 0x2e673122, 0x38275929, 0xcc68366b, 0x27572963,
0x3c265628, 0xb65c3a75, 0x27572958, 0x19183d19, 0x7439183d, 0x23532636, 0x6b316933, 0x512566d1, 0x366b3823, 0x66366b38, 0x6b3862c9, 0x376d3936, 0x29408043, 0x5d2a2757, 0x27572927, 0x2f275729,
0x3d192d62, 0x53ac5718, 0x2f4a964d, 0x3d192d62, 0x438d4718, 0x521a411b, 0x6b384f9f, 0x5ec36336, 0x1938793a, 0x6a37183d, 0x3b773e35, 0x385bb95f, 0x3d19366b, 0x183d1918, 0x5947954b, 0x9a4f55b0,
0x2a5e2d4c, 0x2b366b38, 0x67252959, 0x00002581, 0x52745500, 0xff00534e, 0xf6ffffff, 0x33ffffff, 0xffffffff, 0x2d1ff3ff, 0x23fff1ff, 0xffa97fff, 0xc9ffffff, 0xffffff89, 0xff30ffff, 0xffa2ff25,
0xffae5bbd, 0x5cffff8b, 0x81ffc34c, 0xffb2ff67, 0x27a17a3e, 0x38ffffff, 0x57ff89ff, 0xff62ffff, 0x2337ffff, 0xffffffb3, 0x6bffccff, 0x00656578, 0x49c30000, 0x78544144, 0x458f3d9c, 0x0c40c316,
0xa8753d43, 0x9999940d, 0xe1999999, 0x4ce967fe, 0x2f3ff692, 0x190b4b2c, 0x05897180, 0xfc2b3102, 0x3a2dbeb0, 0xb7a1a751, 0x6f84c5bc, 0xc1d53ee9, 0xc7ea53f8, 0x32cf12e7, 0xf06d6a51, 0xa570fa2e,
0x0c806d49, 0x2ab19ecb, 0xb4115114, 0xecba0663, 0xd08fc610, 0xa0a2f390, 0x0890a0f5, 0x4d98129e, 0x461a182b, 0x4c1ae922, 0x0bba8b5e, 0x1b0edf65, 0xaeaa9b29, 0xdc71cc61, 0x859c6503, 0x39084930,
0x3a1e8e40, 0x4210f798, 0x40299087, 0xd6614b89, 0xb46e0c46, 0xb8add787, 0x3bb6a6f6, 0x3b91d558, 0x4bec0669, 0x40ef19e3, 0x38ae9954, 0x9ae6fffe, 0xaaf97f7e, 0xa5be5faf, 0x2b110712, 0x00001d18,
0x45490000, 0x42ae444e, 0x00008260,
};
const uint32_t uprof_16_len = 650;
const uint32_t uprof_32[] = {
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x20000000, 0x20000000, 0x00000308, 0x8aa44400, 0x000000c6, 0x47527301, 0xc9d90142, 0x00007f2c, 0x48700900, 0x00007359, 0x0000130b, 0x0001130b,
0x00189c9a, 0x50b90100, 0x0045544c, 0x3d190000, 0x366b3818, 0x296ad96f, 0x4b232757, 0x224d2421, 0x34193f1a, 0x6b383264, 0x366b3836, 0x3a255727, 0x5729386e, 0x2b662e27, 0x3e2a5f2c, 0x3d193b76,
0x285e2b18, 0x19366b38, 0x6b38183d, 0x67d46c36, 0x1f225224, 0x6b381d49, 0x285c2a36, 0x2255ae59, 0x3d192050, 0x2f673218, 0x38366b38, 0x3d19366b, 0x69d76e18, 0x2d1d461e, 0x713b2a63, 0x214c2339,
0x3366d16b, 0x56283164, 0x40834326, 0x192c602d, 0x7137183d, 0x5dc16235, 0x38468d49, 0x5729366b, 0x366b3827, 0x383b7c3e, 0xd06a366b, 0x4c9f5065, 0x3057b55b, 0x83412d63, 0x2757293e, 0x6637763a,
0x6b3862c8, 0x27572936, 0x19366b38, 0x6c34183d, 0x3f864331, 0x693e7b40, 0x743c64cd, 0x366b383a, 0x29245126, 0xc4642757, 0x366b3860, 0x38469049, 0x4b213574, 0x366b3820, 0x3c3f7e41, 0xbb603978,
0x2757295c, 0x2552ab56, 0xb75c2351, 0x2e643158, 0x29183d19, 0x3d192757, 0x2c612f18, 0x1c183d19, 0x57291b41, 0x366b3827, 0x56275729, 0x864552a7, 0x183d1943, 0x29366b38, 0x57292757, 0x183d1927,
0x5a366b38, 0x3d1956b0, 0x366b3818, 0x29275729, 0x4e232757, 0x366b3822, 0x21275729, 0x3d19204e, 0x183d1918, 0x19366b38, 0x5729183d, 0x27572927, 0x20469649, 0x612c1e48, 0x30613229, 0x535ab85e,
0x6b3850a2, 0x366b3836, 0x291b421c, 0x7f3d2757, 0x4488473a, 0x19183d19, 0x3d19183d, 0x366b3818, 0x38356a37, 0x944d366b, 0x27572949, 0x4c3d823f, 0x9d514998, 0x2554274e, 0x3850a653, 0x6b38366b,
0x2a5c2c36, 0x40e8e81c, 0x93000000, 0x534e5274, 0xffffff00, 0xffffffff, 0xff26fdff, 0xfffffcff, 0xd5ff19ff, 0xffff1127, 0xffffddff, 0x3aff0cff, 0xffff3709, 0xffffffff, 0xffffffff, 0xffffffcd,
0xff8b0643, 0xffffffa7, 0xff84ffff, 0xce2b1eff, 0xffffffc1, 0xffc8ffff, 0xff9eff14, 0xff38ffff, 0xffc7ffff, 0x04ffffff, 0x802371b6, 0x8e01d6ff, 0xc0b424ff, 0x33301ded, 0x6d99de10, 0xade3f703,
0xf028f9ff, 0xffc30e8d, 0xffffff2a, 0x19aefbff, 0xd3ffffbe, 0xff492f94, 0xff22ffe9, 0xffffffff, 0x2cffd806, 0x002e00bf, 0x49ff0100, 0x78544144, 0x8993759c, 0x18511257, 0x016f1fc5, 0x14150505,
0x40410104, 0x2b525c91, 0x4d295cb7, 0x36972d41, 0xd17db4b5, 0xf6cb2f68, 0x2feb353d, 0x1ad9beee, 0xce67ba06, 0xbf7ce77c, 0x337df73b, 0x66210def, 0x51a33a1d, 0x8ff921e7, 0xeef5dd6e, 0x3bd76852,
0x77065733, 0x8d26a69f, 0xe6e0b17e, 0xac5a4abe, 0x7e66f537, 0x512d37f2, 0xb7c4d3a3, 0xdfa5394b, 0x57b3470c, 0xd4d554ed, 0x26a24a9c, 0x8664ab51, 0xf68ccabe, 0xd8c66bc8, 0x21a50eec, 0x343689d4,
0xd51e54fa, 0xd00b3be7, 0x67a1da91, 0x0af62350, 0xc315ba74, 0x56d17d35, 0x6d10b480, 0xec1ac671, 0xd7463a42, 0xc07a9dc1, 0x10a7783c, 0x84350862, 0x8bf21d2a, 0xfb01e8f5, 0xc7007b00, 0x754208e5,
0x7c60c0f4, 0x430057c1, 0x2251cbe8, 0x1a38aec2, 0x5f2c7861, 0x80595e50, 0x6036e83f, 0x2b708f04, 0x936f5f19, 0x9df5da7a, 0xece92576, 0x48b0f824, 0x11c8754d, 0x6a60e9dc, 0xcf084ea9, 0xdf31b20b,
0xa161fedb, 0x2ae5727d, 0xe127b2c0, 0xf73c2397, 0x77090227, 0x15d2fdc0, 0x33c69723, 0xdefe8591, 0x900cbe01, 0x3f1a6bad, 0x5fc27a86, 0xd936adb0, 0x1896811c, 0x0d35ca79, 0x72b8a933, 0x9b0e9d67,
0x5c8447aa, 0x333f7957, 0x6dc6bdeb, 0xa99e4261, 0x95b40986, 0xcb2e4cf4, 0x7f8d79e2, 0xaa0e6bc4, 0x9cc04586, 0xd74053cb, 0x03d2e4b1, 0xa370c32e, 0x1dc8315a, 0x3e86fa32, 0x20bacdcb, 0xb5d30679,
0x4c7cac3a, 0x1911cdd9, 0xc5808031, 0x7a988092, 0xf0c0ae20, 0x569f860b, 0x513b49fe, 0xbe71cf47, 0x5b060c12, 0x5848fc2c, 0x6bd3943f, 0x0c954f9c, 0xdff6a770, 0xc6469eb1, 0x79e5aac1, 0x832ac713,
0xb45d3cd5, 0x293093c4, 0xce03c8d6, 0xbcde06f3, 0xfcefe659, 0x96ddef71, 0x2ec70f84, 0x4560cafa, 0x7cfadff7, 0x5a8be7b5, 0x0e16017f, 0xe8187143, 0x00000636, 0x45490000, 0x42ae444e, 0x00008260,
};
const uint32_t uprof_32_len = 1214;
const uint32_t uprof_192[] = {
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0xc0000000, 0xc0000000, 0x00000308, 0x9c026500, 0x00000035, 0x47527301, 0xc9d90142, 0x00007f2c, 0x48700900, 0x00007359, 0x0000130b, 0x0001130b,
0x00189c9a, 0x50c20100, 0x0045544c, 0x3d190000, 0x366b3818, 0x296ad96f, 0x4b232757, 0x224d2421, 0x1a69d66e, 0x421c193f, 0x2556271b, 0x253e9443, 0x592b2351, 0x3e844129, 0x3e60c565, 0x753b3a8a,
0x3c8e4039, 0x60295e2b, 0x54265bbd, 0x2b5c2d24, 0x49357f39, 0xcd69468f, 0x5ab85e64, 0x3c62c967, 0x88443885, 0x3f804141, 0x3567d36c, 0xc1633276, 0x2b622d5e, 0x2f366f38, 0x6b382c69, 0x51a75536,
0x513b7b3e, 0x6b384da0, 0x66d06a36, 0x4f2e6030, 0x6a334c99, 0x49954c31, 0x30347a37, 0x5c292e65, 0x1d471e26, 0x3350a354, 0x8c463071, 0x55af5943, 0x4e366b38, 0x6b384a9c, 0x57b45b36, 0x382e6e31,
0x6b37366b, 0x27572935, 0x20366b38, 0x3d191f4b, 0x366b3818, 0x19366b38, 0x5729183d, 0x53ab5627, 0x38366b38, 0x3d19366b, 0x366b3818, 0x38183d19, 0x3d19366b, 0x366b3818, 0x29366b38, 0x57292757,
0x366b3827, 0x29275729, 0x3e192757, 0x183d1918, 0x38183d19, 0x3d19366b, 0x183d1918, 0x19366b38, 0x5729183d, 0x366b3827, 0x29275729, 0x57292757, 0x366b3827, 0x38183d19, 0x6b38366b, 0x46944a36,
0x38366b38, 0x6b38366b, 0x27572936, 0x29183d19, 0x57292757, 0x27572927, 0x19366b38, 0x5729183d, 0x366b3827, 0x19183d19, 0x3d19183d, 0x183d1918, 0x19183d19, 0x6b38183d, 0x27572936, 0x29366b38,
0x3d192757, 0x183d1918, 0x19366b38, 0x6b38183d, 0x183d1936, 0x29275729, 0x3d192757, 0x366b3818, 0x29275729, 0x3d192757, 0x27572918, 0x45366b38, 0x57294098, 0x2d633027, 0x6d448c47, 0xa05068d6,
0x62c8664d, 0x2868d56d, 0xd56d2656, 0xe6ab1468, 0x000000dc, 0x4e527496, 0xffff0053, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcffff,
0xff02ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff6ffee, 0x03ff1dff, 0x0e03ffd6, 0xff0cfb40, 0xcf231507, 0xb61b2312, 0x85fd2495, 0x0b4ed0e7, 0x70cbaca5, 0xc7f79fde, 0xe7f03dc4, 0xff7853f3,
0x864ca429, 0xa7dc17ec, 0x7173e5bf, 0x7e96bdb1, 0xb363d536, 0x5d89312e, 0x3e37645c, 0x8c2c9d49, 0x5bdb5366, 0x0593ff6c, 0x78b998d4, 0x67d57f01, 0x007fccad, 0x49831000, 0x78544144, 0xf95bed9c,
0x1f47135f, 0x3b9b26ce, 0x1721b721, 0x80920490, 0x84120102, 0x4a9c8080, 0x0aada811, 0xa282d56a, 0xb5bc55a8, 0xd5eb155a, 0xe8f7db6a, 0x33befffb, 0xbb3639bb, 0x4863ddf3, 0xf1f3f636, 0x7491a1f9,
0xbe679f74, 0x31677ce7, 0x2be2be18, 0xe819a2be, 0xb9313d9d, 0x7f7f7cf2, 0x7f6e6e6e, 0xe4cafaff, 0x56ded989, 0xa58b5253, 0x6b4fb995, 0x1c2fa777, 0x5631ef1d, 0xf47e33d0, 0xdaeaf4c2, 0x2fc9b9b3,
0xcaef465a, 0xd31bd3d5, 0x8c24da35, 0xdb5c6f4f, 0x53356c9d, 0xf7f91002, 0xc9e4b697, 0xad6c4557, 0xb2fdde9e, 0xdafd716c, 0xee2ab8f2, 0xf4bd1c35, 0xb0d10be9, 0x4176bbb4, 0xa60af923, 0xb52fefdf,
0xf3ef7d98, 0xeeb4976b, 0xee1d9d7d, 0xbd0ed4b6, 0x6107ab73, 0xb1b0d65f, 0x93fa22df, 0x475d68d7, 0x27fbe58c, 0xbbdf6774, 0xf451ba72, 0xefa67a11, 0x4f5a9ceb, 0x38da3fbc, 0xaeb61cfa, 0x93cf18e9,
0xfaee0fef, 0x67a70904, 0xfb3fa1f5, 0xf409ba69, 0xaf967a11, 0x7f6121ea, 0x39f439b9, 0x37af7709, 0x86e4fe9b, 0x5a8176ba, 0x46a6fbc2, 0x06abd2f3, 0xcb001ea6, 0x6cabcdbb, 0xddcdabb3, 0x6b3d1e7e,
0xde848a4d, 0xd03a5b57, 0xdbb0b8c7, 0x6bb3fe0c, 0x649dc8cd, 0xbc6fdf8c, 0x989a5611, 0x6d58087c, 0x5b6782b4, 0x6547f2ba, 0xb191ae6d, 0x3f5f74bc, 0x782aa9f7, 0x4b0538d6, 0x47d3ba6b, 0x28dd39e8,
0xb52e2705, 0x8dc23f82, 0x2bd974c6, 0x346fe2ad, 0xc142346e, 0x6eb526f5, 0xf07cb0aa, 0xab7cf464, 0x8291fc85, 0xfb777683, 0xe47e6fcd, 0xcd60e971, 0xf356f3dd, 0x0fa71a37, 0x5b2b0712, 0x708fa6ad,
0xbf9e8569, 0x0403edbe, 0xf662b6ea, 0x97a9ab6e, 0xd1574ab1, 0xfe14be96, 0xcd1ae346, 0x74e962c4, 0x30d769ab, 0x06c29f7e, 0x7d38f4cf, 0x9cf8c5a9, 0x8dbbfe66, 0x0c1d5c9e, 0xb416b547, 0x002fad13,
0x56d558f5, 0xb556960e, 0x99edf3fd, 0x48c8c8cc, 0x823b972e, 0xd0303031, 0x23e8a1ce, 0x2f10ef2f, 0x77d7e1df, 0x4d623cc8, 0xd35c1853, 0x3498dfc6, 0x9c391111, 0x211f2e27, 0xb00d372f, 0x8c47c0c7,
0x7fc0d2bf, 0xff1b4b6e, 0xd0991f6c, 0x4fd2cba8, 0x04041f5a, 0x586ecd64, 0x5df551c1, 0x0ed692d1, 0xb420007a, 0x485b3663, 0x9af40036, 0x053966dc, 0x8356d437, 0xf91af7de, 0x4201471b, 0x70523369,
0x03bcb258, 0xcb431e58, 0x745e32cd, 0x6903ad4d, 0x2103c13e, 0x64947780, 0x1960c803, 0x06c65cbc, 0x3adaea5b, 0xda442ded, 0x04a3b32a, 0x0101441b, 0x21fd7e59, 0x555dc150, 0x10b7b402, 0x88d08009,
0x07c0a899, 0xbb9f4084, 0xc1b61ebc, 0x27fc1555, 0x286097b5, 0x5477962b, 0x810a00ac, 0xdeb2a5a4, 0x59693d0d, 0xdef51339, 0x0a1fccd0, 0x6643ce81, 0x0a2382a2, 0x045ec306, 0xa2b4ea3d, 0x3ded3980,
0x6953b65c, 0x01029147, 0xb5672825, 0x368396d5, 0xc714aa38, 0x0c087b5a, 0x66320428, 0x4836aa21, 0xadcbc87b, 0x0a1566fd, 0x7808286e, 0xcd043145, 0x758a0201, 0xd16eaa02, 0xe82c1801, 0xa1172e20,
0xed2dbe47, 0x416299a5, 0x5ebfb159, 0xa1536540, 0x2f231810, 0x1ebe4317, 0xf7f052ef, 0x3c84c8c5, 0x72a3116e, 0x02012f82, 0x89cb243a, 0xdb3d938f, 0x218cd12c, 0xcb19408a, 0xf88cc458, 0x9af4054d,
0x64e59252, 0x02321b05, 0x07f052ae, 0x424240ab, 0x7c746b88, 0x6108f2c0, 0xc68bd139, 0xb011c39f, 0x6d402341, 0x8e94f008, 0xa3e58115, 0xa216d584, 0xa444e00d, 0x00c38bbd, 0x8bab031a, 0x2eccc024,
0x88da0202, 0xc60a49cb, 0x9525d3c1, 0xa100b201, 0xd9909120, 0x41015405, 0x22f456d9, 0xa59eada8, 0xbd40441a, 0x962b38b1, 0x80aa0291, 0xa2306c87, 0x26032d17, 0x1fc34678, 0x32698acc, 0x33862821,
0x2f64e5e4, 0xb3a53722, 0xbe315754, 0x84509908, 0x0c81d325, 0xa059ca46, 0x74b0f202, 0xd7146a9f, 0xa0815401, 0x00700ab4, 0xe625660c, 0x2f521e2c, 0x10fa22da, 0xda142cdd, 0x9bb01cd1, 0x024b1940,
0xf06c0306, 0x041e61a9, 0xc692c6f6, 0xb3940780, 0x8290bd00, 0x5d808269, 0x069022aa, 0x3cd6330e, 0x2018c999, 0xaa055c80, 0x0f517b10, 0x774664e1, 0x9401df1b, 0x5c6f5131, 0x0fb65405, 0x1c100bcb,
0x933c7827, 0xe69ba00a, 0xcb8dedaa, 0x4f210170, 0xa844846a, 0xa486c1b7, 0xe2a15ea9, 0xfa0435af, 0x46a4e581, 0x2f7a8448, 0x3e888e92, 0x1a0009d1, 0x02101303, 0x10a72750, 0xbcea3c02, 0xedea3c48,
0x02217ba5, 0xe47dabaa, 0xa601602a, 0x242350ba, 0x6b06d082, 0xe8270122, 0xf3a0642e, 0xc0cc897c, 0x127c840d, 0xfac48468, 0x45960a05, 0x8a8e78c5, 0x080331bf, 0x38332768, 0x1b872c06, 0x5e6a1121,
0x6bb61e24, 0x01e0d1bd, 0x119a484e, 0x366a1c02, 0x14743510, 0x3c2338f3, 0x55018ad2, 0xc8cc3800, 0xd4224235, 0x41f57c46, 0x834af9a0, 0x40a3b407, 0x83003808, 0x21bd57d5, 0x885ee9e9, 0x3ae5828a,
0x62e9cf01, 0xefcf3a18, 0x03ed9f90, 0xd55d58ca, 0xf2c378b3, 0xd17b2846, 0x7b295d78, 0xadab7745, 0xa317e830, 0x8772cd5d, 0x939f2e33, 0x37545e2a, 0xa56ba3a2, 0x1f4cc3a1, 0xd95004e0, 0xe9bf200e,
0xf6ea2cae, 0x26f243fb, 0x5d517b28, 0xe71d5314, 0x4b80ed8d, 0x042d8094, 0xc8be00aa, 0x1657f419, 0x439dbb85, 0x7ab8020a, 0x508ffd90, 0x418bdd00, 0xf92f75e0, 0x396029b9, 0x677102ae, 0x3fc87459,
0x628f97e3, 0x4745ef33, 0x201425fe, 0xe10ee18a, 0x24b67995, 0x944c5de2, 0xf75d00ff, 0x858fc8fa, 0x72f0666e, 0xbbdb657f, 0x84f0b6e3, 0x45ec0092, 0x59ff7fc9, 0xa22b3fe3, 0x3e721418, 0x30bd1262,
0x9ff28910, 0x980aa069, 0x1e5d5324, 0xabe00840, 0x5e338b31, 0x278517e0, 0x652eae98, 0xcefe9601, 0x0135dbe9, 0x9d3a5ed5, 0x3d1472c9, 0xa6a3be02, 0x121857fa, 0x48af1891, 0x0a57baf6, 0xc61c7007,
0x3bd67fc7, 0x3989e711, 0x7d774c43, 0x2311751e, 0x71fa552a, 0x0d09d09d, 0xd3b00698, 0x4db52358, 0xedac7b4f, 0x09d9e6f5, 0x21a6cb16, 0x202c9163, 0x5205532f, 0xc51f0761, 0x199db881, 0x3dfdd6f2,
0x4840bfaf, 0xe5b0854b, 0x65404d45, 0xf3ed9d2a, 0x7b47d064, 0xf4db5929, 0x4474a7a2, 0x33a3bfc8, 0x0d951035, 0xd330e001, 0x55c72c06, 0xcc3130a0, 0x3760f147, 0xc2bcb8c3, 0x53f9773d, 0x54694e5d,
0x676c87c4, 0x97ee026a, 0x77048dc9, 0x81d1b730, 0x91e71ad1, 0x508cb1d1, 0xf5946640, 0x708da675, 0x4bace815, 0xcaee8122, 0x89b800d1, 0x1fcec4ea, 0x01fdd94f, 0x618bad8e, 0x1de5bd86, 0x61523ee7,
0x171dd31b, 0x87790ff3, 0x01359799, 0x3a2397e5, 0x27ace962, 0xb2c74c6d, 0x0e28b563, 0x4309b4ee, 0xb349e7da, 0x99096287, 0x394ca810, 0x4f51b827, 0x579873f8, 0x17e60160, 0xb66b2741, 0x970c43f8,
0x1b4e027b, 0x7cbcd8c3, 0x15700a46, 0x4664db0d, 0x5e52db52, 0xd25e731b, 0xd847468b, 0x7a8b27bc, 0xd56dc3cc, 0xa6774e28, 0x1a4149d3, 0x2cdd45ca, 0x8728cb9b, 0x4e33eb80, 0xd0e71626, 0xadef17a0,
0x63281fb9, 0x3982aec5, 0x52661ce4, 0x57516883, 0xc8308317, 0xd78b6595, 0x7e2d3e89, 0x9b06fe07, 0x09a81529, 0xd71f0bc0, 0x0c56ac04, 0x84c1b2c0, 0xd36318b1, 0x5f70939c, 0x48f95326, 0x53c026b6,
0xe7d65964, 0xf9e7c1f1, 0xe1372772, 0x600e738c, 0xcab817b7, 0x7cde1d04, 0xd0863fc8, 0xb7cf63c6, 0xa65b31c4, 0x80d1e5c0, 0x5b8c2bb3, 0x4df461a3, 0x2bdd8fc0, 0xe7996d8e, 0xc037adf2, 0x04d4bf30,
0xa477af70, 0x5b883b93, 0x1b98c466, 0x157df365, 0x963923ce, 0xba42d6b5, 0x8b479623, 0xf0097ddc, 0x722a6330, 0xbbf8b6e6, 0x53c72bb1, 0x3843f1e8, 0x5bc3a140, 0xe734e42a, 0x77630cbd, 0xaf01cc3a,
0x70080b1d, 0x089e1d01, 0x94e65df9, 0x8c337f1f, 0xdc5767fe, 0xebd29d8f, 0xcec3600c, 0x5123cc30, 0x3b103127, 0x07b5b884, 0xeb04d18d, 0xd9d4a24e, 0x9a22cb1e, 0xa9eb2c1d, 0x1628d1e5, 0x198bb2c9,
0x632a0263, 0x6e2ece63, 0xeee1ecff, 0xb571fef2, 0x73dbba15, 0x41857220, 0x329bcab4, 0xb44fe177, 0x2075e0be, 0x78b6c3e6, 0xc854ecaa, 0x99ce0287, 0xd632f202, 0x98b7e13f, 0xf4a46103, 0x5fc04d62,
0xd8933a38, 0xc46cd839, 0x8647e9e7, 0x7db221c8, 0x13b674d1, 0xe71478ed, 0x2e4523a4, 0x0273f687, 0x1434c912, 0x20d2a602, 0x0b88284e, 0x2f6e8df2, 0xb8a1f8f7, 0x772d0f25, 0x30a9bcd8, 0x5c26540a,
0xc3031ce0, 0xc2bb0e1e, 0xb4970605, 0x8df710f8, 0x609f1e23, 0xb98b4e42, 0xcdec30ab, 0x1826bb9b, 0xfeff80a1, 0xa853812f, 0xb7eb531b, 0x88027bb6, 0xebe8c961, 0xdbda46cc, 0x50add863, 0x38ac26cc,
0x8e517394, 0xe8758e3f, 0x6a34c362, 0x905b889f, 0x272e3347, 0x3dd841ef, 0xd450d002, 0x050a6294, 0x9a2d086f, 0x63b0bb08, 0x1e217ff0, 0xc6185a77, 0x87f874e2, 0x9138a379, 0x29bdd977, 0x0cc5d397,
0x2c7e1df9, 0xc0555ceb, 0x8a457f9f, 0x472cbebe, 0x968b102d, 0x8f31c7d0, 0xcee2332f, 0xe8238246, 0x3ab85407, 0x3b58c53c, 0x5e3ea1ca, 0x8398bb00, 0xb514c25c, 0xd405e3d9, 0x64763193, 0xccf1fe6d,
0x7aaa17a0, 0xf0e31f26, 0xbc86cb72, 0xb2b65d13, 0xf00b5400, 0x61bcdb1e, 0x14abf96f, 0x4f0818d6, 0xc3c69360, 0x009d7b4e, 0x9e63f7c3, 0xa78062d2, 0x431cea56, 0x99d43dff, 0xa3b22088, 0x30ef2cd6,
0x58f745c1, 0xb78478d4, 0xe40afe12, 0x90588a6f, 0x29d8bdad, 0x32e1fd06, 0x1418c09f, 0x6d9ca631, 0xf31fb3f8, 0x03faf199, 0x5cc3154c, 0x073b7738, 0x4eec0119, 0x1d77fe3f, 0x0533ce4e, 0x3bbdf031,
0x532fea67, 0xe07531db, 0x83d44f0f, 0xc531655d, 0x324ccd65, 0xb2c7f6cf, 0x22f29dc9, 0x00a069e4, 0x42250253, 0xe38c00ec, 0xe4fcaa73, 0x11b55002, 0x338c033a, 0xfc4979ce, 0xc22330f3, 0xbaeee7f0,
0x49bcc39f, 0x0122130b, 0x85775997, 0xe3ebeb3f, 0x4d6a38fe, 0x31b655b0, 0x8247762e, 0xe0e50e5c, 0xc3f3de86, 0x3d8c4294, 0x9162e364, 0xde80e467, 0x1a50e167, 0xa699f30e, 0x8fe62e2b, 0xfdd50bbe,
0xfc121968, 0x3fa34820, 0x12a435b3, 0xc58c9b9c, 0xdcafd552, 0xf9412e51, 0xf57739ac, 0x700aa82b, 0xc18f2a94, 0xec73606e, 0x5845adc8, 0xab7176ec, 0x00a90e5d, 0x5dfa4dbb, 0xf6428205, 0xef209596,
0x87c0fc13, 0x35573b87, 0xfa0fdb13, 0x4edf4634, 0x7627cf80, 0xbb24b647, 0x18a44392, 0x10c26982, 0xa53712b4, 0x75001402, 0x63583572, 0x26444f1e, 0x821a4452, 0x0156bca5, 0x9eee6682, 0x5a600166,
0x467586a7, 0x043d7299, 0xcd47f4ed, 0x1691a002, 0xf2b5163d, 0x9a070467, 0xf7f95a2b, 0x129169c3, 0x633294d6, 0x04d49e11, 0xd0156bac, 0xd5b9daa6, 0xcad76822, 0x4d64fb7f, 0x015682c0, 0x0a9d89b2,
0x7806cd09, 0x804d4dfa, 0x028d3be1, 0x1686cec0, 0x500d4211, 0x02b383c0, 0xf1b59701, 0x76e72b77, 0x14c9c88d, 0x4282002c, 0xd1dc306c, 0x68dd2026, 0xcd7ea6fe, 0xc06585fc, 0x9b5bf860, 0xf3469d80,
0x8037698f, 0x0c1a8b30, 0x85ab7fbf, 0x55e1bbbf, 0x7f3b5da0, 0xc050a4e6, 0x7c514d0b, 0x1e25fa18, 0xa3c58005, 0xff9da5cf, 0x80a171fc, 0x08b5efa9, 0xe5e7ee80, 0xa087cc91, 0x30a195e4, 0x0ea1a6c0,
0xba18a29a, 0x758392eb, 0x019c750c, 0xa83114e0, 0x478257cc, 0xb53402f5, 0xabbbd073, 0x9df20832, 0x06d10cc2, 0x1c7dcd49, 0xd4618a23, 0xe288690d, 0x14070a43, 0x95fd4a29, 0x236f632c, 0x2af68fc4,
0x4eb730cc, 0xfdb80bd5, 0x3e017aa3, 0xc81837e8, 0xd8b9da41, 0xdaeb3825, 0x04891902, 0x851855ed, 0x017af1c0, 0x316a1a53, 0x797c0554, 0xed3c6982, 0xab96d392, 0x4a2ebf58, 0x021c5fc1, 0xf507c306,
0x6ea9a002, 0x16f9b188, 0x26b1d605, 0xfc965973, 0x98a14b78, 0x6bce568b, 0x2f011a05, 0xd5d602c5, 0x12300107, 0x1106e3ea, 0x973160ec, 0x76e4cc59, 0x1981d2da, 0x1b6afab9, 0x74f9b176, 0x4dada3b6,
0x81514c32, 0x02c5275b, 0xe5a93f0c, 0x4b394d0f, 0x8b491b34, 0x0225c773, 0x002b50fe, 0xc9a2ebba, 0x7890d425, 0xebf0c190, 0x80052a0f, 0xf91d7e83, 0x0a929fcf, 0x4dd95058, 0x473f6f40, 0x2d11aa68,
0x55fca536, 0x54d0d4b7, 0xd2192a94, 0x804935e2, 0x850c62ca, 0xfc8e98c0, 0x935865c5, 0xf9e7410f, 0x1e028eac, 0x53a3f890, 0x6efe1a8d, 0x06b625a0, 0x30db9f94, 0x580b219c, 0x410fd350, 0x8eaa2d23,
0xdf9b1292, 0x3aa80590, 0xbdd74014, 0x6a056314, 0x1bf8079c, 0x0130a8ae, 0x875696f4, 0x21b7fc7e, 0x7ea61803, 0x9d001656, 0xc70f350a, 0xe21171e9, 0x62b1aa8f, 0x43437526, 0x8c8e9a51, 0x3ed2db0e,
0x8ac616ae, 0x3ce802a7, 0xbf8dd49f, 0xc29576f0, 0x5d6fe004, 0xfb7fc6e9, 0xa5009c8d, 0x05540af1, 0x09ba5d4c, 0xa46d28b8, 0xdf28f885, 0x9181e693, 0x64c52756, 0x32f30e8a, 0x4099c011, 0x2181113e,
0x827af9a0, 0x8011b216, 0x41d2df21, 0xd19a79e7, 0x6dc8151a, 0xde099d5c, 0xce8009ca, 0xc69dbaf3, 0x97f12b1e, 0xa0a5109f, 0x78c51691, 0x8a9b0a9f, 0x1bf84006, 0xf42ca276, 0xc57a788b, 0xd686d030,
0x638e0163, 0x517b7ae8, 0xce0618a7, 0x015c6201, 0x96f42953, 0x04fdcd16, 0x5214f605, 0xe0530568, 0x0dd013ab, 0x011f5a45, 0x512d1b60, 0xe863d400, 0xfa4d3957, 0xb3c5c084, 0x4e2bd4ca, 0x8271be44,
0x5d11330e, 0x25ca330e, 0x7df20040, 0x46055407, 0xaf3fe0f5, 0x9d55032a, 0x4cba7488, 0xa6d02141, 0xe45f8087, 0x6e31389b, 0x87bd6613, 0x11e800da, 0x73c10f02, 0xf9d20024, 0xcb5ba1d8, 0x96b6c126,
0x6a41e000, 0xce7a1dac, 0x25b8853f, 0x63218a7b, 0xa5a926ea, 0x3d38eb30, 0xbcfe61a9, 0x2b2800b6, 0x9614b620, 0x18d02856, 0x9b9015c0, 0x81fe90a2, 0x518eb840, 0x45627587, 0x03c15dd6, 0x86a809ad,
0xac8ae4db, 0xd43f286f, 0x6c94809e, 0x80206ba0, 0x78755c93, 0xb4bcbe41, 0x9b46e6e8, 0xd8685b2a, 0xd22f6406, 0x9d54102b, 0x90141521, 0x5d0e8dc7, 0x1b9aa186, 0x740a2d08, 0xe403e508, 0x91a0211f,
0xfcd9a5af, 0xc13fa91f, 0x76202828, 0x6aeb2c15, 0x536c206a, 0x82800ff5, 0x7e73e47b, 0xbdec1533, 0x847f1c6e, 0xd464e48f, 0xef7b06bc, 0x23e9235d, 0x22d303ac, 0xcfe85373, 0xf84c6b9f, 0x07f0b10a,
0x8cd8e679, 0xbe7dbcaa, 0xc42be151, 0x3764afd4, 0xc15c3572, 0xd9944f6f, 0x2de16150, 0x5c1b9631, 0x371fe795, 0x0aaa7dde, 0x46b6277e, 0x9bcaad0d, 0x7d9a1a67, 0x10ee1224, 0xaab0d08d, 0x2fedccdc,
0x1d3105e3, 0xe6102635, 0xf7b41dcf, 0x0f858354, 0x034243a4, 0xe6fcda6a, 0x1f246699, 0x847b8492, 0x50e07a8c, 0x13ad7bde, 0xf7db8c7d, 0x40f52908, 0x29b4fca1, 0xd4c61fa9, 0xc49fcdfa, 0xf6439e1d,
0xcc395745, 0xf07f3d3f, 0x2c668b83, 0x54e4907c, 0x7cde50ca, 0x57eeefa9, 0xade57531, 0x42281828, 0xb351ef79, 0x092aaeea, 0xae5dee2f, 0x431a0c2b, 0xf3c3d6f9, 0xb75a9b27, 0xd14068d4, 0x4fca1940,
0x356a9f1f, 0x3fd632fb, 0x2565a9dc, 0x6fe9ed75, 0x297f5ee7, 0xad4c39ec, 0xf979bc7f, 0x29556fbb, 0xf87bdf98, 0x8a2f99cb, 0x0b53197d, 0xf9ddee2f, 0x50d907e9, 0xee7a7ede, 0xe516bbf5, 0x5a98951c,
0xdfc3f5ff, 0xfe6c1e8f, 0xdd5db7b6, 0xa7bdedf2, 0x7a3c1f0f, 0xcb4df2fc, 0x8e355623, 0xf2753d9f, 0x4f27bbe4, 0xf379bcde, 0x93bbdde4, 0xfb39bea7, 0x15fea18f, 0xc2cff15f, 0x69e401ff, 0x6f1037bd,
0x000063a5, 0x45490000, 0x42ae444e, 0x00008260,
};
const uint32_t uprof_192_len = 4942;
const uint32_t uprof_512[] = {
0x474e5089, 0x0a1a0a0d, 0x0d000000, 0x52444849, 0x00020000, 0x00020000, 0x00000308, 0x24a6c300, 0x000000c8, 0x47527301, 0xc9d90142, 0x00007f2c, 0x48700900, 0x00007359, 0x0000130b, 0x0001130b,
0x00189c9a, 0x50c20100, 0x0045544c, 0x3d190000, 0x366b3818, 0x296ad96f, 0x4b232757, 0x40994521, 0x2a224e24, 0x9644285a, 0x1b431c3f, 0x26193f1a, 0xbf612451, 0x68d56d5d, 0x42265628, 0xd76e3e93,
0x48954b69, 0x2567d26c, 0x5f2b2354, 0x42894529, 0x2d468f49, 0x3d192b62, 0x5bbb5f18, 0x68366b38, 0xcf6a64cc, 0x346a3765, 0x5b2b5d2d, 0xab5657b2, 0x2e683053, 0x672e6e31, 0x873d62c9, 0x38703b38,
0x65316834, 0xa25260c5, 0x3a763c4f, 0x3f2f6231, 0x70343a8b, 0x59b75d31, 0x3e50a654, 0x672e3b7a, 0x3378362b, 0x38327535, 0xaf59366b, 0x3f814255, 0x38275729, 0x8040347c, 0x4b994e3d, 0x381d481f,
0x833b366b, 0x5ec16237, 0x44357338, 0x7f3a4285, 0x27572936, 0x21366b38, 0x6b381f4b, 0x183d1936, 0x4e366b38, 0x57294a9e, 0x366b3827, 0x384d9d50, 0x8e40366b, 0x366b383c, 0x38366b38, 0x6b38366b,
0x366b3836, 0x19183d19, 0x3d19183d, 0x366b3818, 0x38366b38, 0x3d19366b, 0x438e4618, 0x38275729, 0x6b38366b, 0x366b3836, 0x29183d19, 0x57292757, 0x183d1927, 0x38366b38, 0x3d19366b, 0x27572918,
0x19183d19, 0x5729183d, 0x366b3827, 0x38366b38, 0x5729366b, 0x183d1927, 0x29275729, 0x3d192757, 0x27572918, 0x29275729, 0x6b382757, 0x183d1936, 0x29275729, 0x3d192757, 0x366b3818, 0x38366b38,
0x6b38366b, 0x366b3836, 0x29275729, 0x3d192757, 0x183d1918, 0x38183d19, 0x3d19366b, 0x366b3818, 0x19183d19, 0x5729183d, 0x366b3827, 0x29183d19, 0x3d192757, 0x27572918, 0x6e183d19, 0xd96f69d6,
0x6ad96f6a, 0x6f52a756, 0xd96f6ad9, 0xf9a3176a, 0x00000094, 0x4e527496, 0xffff0053, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff04ffff, 0xfffffffc, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xfffff6ff, 0xfffffffa, 0xffff02ff, 0x04ffffff, 0xfb0cff06, 0x2910ff17, 0x20ff95ff, 0x3489d5e9, 0xef2917f1, 0xffb1c0ce, 0xaf3cdcf1, 0x5163e83c, 0x324762a8,
0x4426c00f, 0x58734b9f, 0x1b73c53f, 0x655bd14b, 0xb9dd94dc, 0x70e3c652, 0x8b217cb9, 0x69807832, 0x80a1e597, 0x86a3adc8, 0xac5507d2, 0x127dd934, 0x00bc7d27, 0x49422f00, 0x78544144, 0xf99ded9c,
0x9a46d47f, 0xddba6987, 0x8f7df03e, 0xc19f17b1, 0x303e3076, 0x83180d8c, 0xcb9a7301, 0x662f1009, 0xe1308136, 0x92c0d848, 0x3930201d, 0x99612048, 0x6efff9ec, 0x492ae955, 0x6f4952a5, 0x5ddd5549,
0x19f32fcf, 0x7a356da7, 0xdf7d555f, 0x8763b4ab, 0x183060c1, 0xc183060c, 0x0c183060, 0x60c18306, 0x060c1830, 0xf271d543, 0xd7f3a5f4, 0x6f6f6dae, 0x5f6c203f, 0xd2fe76bb, 0xbfaa9399, 0x4e432195,
0xf67eda5e, 0xdbc3eafa, 0x795c6f37, 0x27717d75, 0x5fd7dd93, 0xf371badd, 0x6f8b9df6, 0x7f383eee, 0x3637f55a, 0xf6f4e148, 0x6e77abdd, 0x9bbcb95e, 0xd70e736d, 0xfb7f7d6f, 0x9747ebe2, 0x27feaa8e,
0x7a715218, 0x2f8bd7fb, 0x6c4f5c6e, 0xb78b10f7, 0xf37c3e6e, 0x7fea8ce0, 0xa398418f, 0xbc5eefe7, 0x23f92af9, 0x8dfae7cf, 0x8db66f3b, 0xa39cd04c, 0xb9df5ed7, 0xcbc3b111, 0xdbadf760, 0xea303fbf,
0x3cce4f40, 0xeda5987b, 0x72b82f29, 0xa379f5e7, 0xd2e2b40c, 0xe56fb7af, 0xcb8f7b61, 0x66bf7e2f, 0xce0b409c, 0x55fb7afc, 0xb877c6be, 0x8138d37e, 0x7cbf4e62, 0xf18d4578, 0xfedf2e1d, 0x8a0804d5,
0x66e6f4b8, 0x2c7e7b2e, 0x9b6e2e57, 0xb66f2085, 0xf47e2a2f, 0xfdbe5cfd, 0xb90704cc, 0x9dd1f471, 0x1e2daacb, 0xafc5f166, 0x407207c6, 0x2c5beb4f, 0x903e34de, 0x6a1ed731, 0xc58b7d6b, 0xba4ccf17,
0x5d2e2b30, 0x4fd839cd, 0x0f3bf5c7, 0x6aa9df54, 0xdfafe4e4, 0x67ef4ecb, 0x26abadc7, 0xf6cb9436, 0xbd75091d, 0xd37dd93c, 0x38d2056c, 0x6a86faf9, 0xf2e1a67b, 0xefaa4bc5, 0xfe70555c, 0xfc3d8561,
0xbc5fbb1e, 0x18221934, 0xd0565f47, 0xd6e2cfce, 0xa618131b, 0x8a9bf4e7, 0xae7cfd90, 0x413b343f, 0xac5cce3a, 0xcfdfb5d8, 0xaadb17ee, 0x720565ef, 0x951e8efe, 0xff7c391e, 0xacfdf552, 0xaeddae30,
0xcc3fadec, 0x0f466795, 0xa2fdb30a, 0xb98fccda, 0x80b8d775, 0x5537db10, 0x8c2b2a9b, 0xad70080b, 0x077e9f2a, 0x9c3102e3, 0x3fbdbaaf, 0x072315c8, 0xa77339a3, 0xb98fcdda, 0x36428261, 0x5356afa7,
0xc5e3c7e0, 0x5af7d579, 0xd6be8e43, 0x2643d5bc, 0x729a1fbb, 0x5a478071, 0xcf6678f5, 0xb54ddff5, 0x0bfce298, 0x9fc906d5, 0x3a0d465b, 0x2b58be9c, 0x9b9fbf9b, 0xee100a46, 0x52ec9a2a, 0x5345e2cf,
0xbe71de2b, 0x227ef36a, 0x7df5aabc, 0x84cd64e0, 0xa8bc517e, 0x07816ee9, 0x01f0d055, 0xcd4df165, 0x3f4f8766, 0x5fc485ac, 0x546a373c, 0x59acbe0c, 0xf16417f1, 0x05260d6a, 0x7d51df4e, 0xcae275db,
0xc8f6d535, 0x9435479b, 0x776115f8, 0x27022d6d, 0xa21feecd, 0xb6c09496, 0x160cff11, 0x3848d75f, 0x79aaf470, 0xacdcd9fc, 0xa5e11a89, 0x67df55ef, 0x48fcb97d, 0xe7b275b5, 0x7b4c9559, 0x2ac5c464,
0x1f2782d7, 0xbac3beaa, 0x53aaa373, 0xac6be7c3, 0x8b0d23ed, 0x295b54cf, 0xe59aee3b, 0x5587845f, 0xbd1c0dba, 0x56cefaa8, 0x0db9d50a, 0x63c8a99c, 0xb970d43e, 0x7a998f0a, 0x09bf7260, 0xb57bfdd8,
0xd75e8525, 0x5247e37a, 0xb755576e, 0xfd1351d8, 0x154ae625, 0x26338109, 0xcb8297f9, 0x76423355, 0xa47e74de, 0x6aaef162, 0x91e1c9cb, 0x72d3fe89, 0xe0a41ab5, 0x4bfb536b, 0x4148154f, 0x7101fd93,
0xc42bc2a3, 0x1fe74d27, 0x1d155b90, 0xf2369c0c, 0x0ae5cc1f, 0x633d17ee, 0x58127f8a, 0x112ed8ac, 0x61c9fe13, 0x88168577, 0xbfec99af, 0xb6ab5e2c, 0x981e1a65, 0xbf1e5ff0, 0x7266b6ab, 0x8fea9a5e,
0x5a562e4c, 0xb199e84a, 0x561e5cbf, 0x35dc0796, 0x9dcd97f6, 0xbb146a4a, 0xf2bfd26b, 0xf80f20a9, 0x0b3fd8d5, 0x078a576e, 0x233fe798, 0x8c03c42a, 0x4ee333fd, 0xa3412825, 0x02a433ff, 0xff130162,
0x1ef68a67, 0x3fd8c8f0, 0xb6aa2e5b, 0xc6079f30, 0x557359fe, 0x5c798db5, 0xecfff933, 0x7432b8d1, 0xf2ffd4de, 0xe166db40, 0x9ffea633, 0xed35bb0b, 0xfa6d3910, 0x5162727f, 0x93b12ecb, 0x372fffa6,
0xa478ebae, 0xcdffe99c, 0x75fa5791, 0x7d555f8b, 0x1b8b6a4f, 0x988c4dba, 0xdcce6002, 0x68252bd6, 0xa3b94012, 0xbce84255, 0x8fe50049, 0xd380e946, 0x055fece6, 0xfce6d6ec, 0xfd35a380, 0x5c7527de,
0xd06c65d7, 0xe22b000c, 0x80a11e8a, 0x865200e9, 0x35c0a116, 0xe3a80013, 0x9beb6a8d, 0x9462900a, 0x008c85d7, 0x21728b54, 0x8ac03268, 0x55b6a1b9, 0x8011a5fc, 0x24da51aa, 0x0064c978, 0xf8f0a3d5,
0x0f4aa388, 0x9d9b9f00, 0xba9a9a9d, 0xe88c3880, 0x43ececec, 0xf6f6f56c, 0x3a1c471e, 0x31196874, 0x8d373737, 0xfb2108f8, 0xeaf853f2, 0xc9d5de53, 0x1fabbde5, 0xd99eaeb2, 0xd5163de5, 0xcda80735,
0x26285d00, 0xd5d115a6, 0x188435d5, 0x7d5d841c, 0x3bd5f93a, 0x97dbabac, 0x5dce58ff, 0x1f30a9d8, 0x00ad48f4, 0x04dc9fd8, 0x25f55d34, 0x613bd5c8, 0xd40e2f57, 0x11bac835, 0x19c064aa, 0x83c03dc5,
0xd48c0b30, 0xae01b5d5, 0x80740c3e, 0x1e893abe, 0x038952f0, 0xcc00ce28, 0xbc702d01, 0x3fc0790e, 0x38fcbea5, 0x75abf2f0, 0x49403d12, 0xac8de036, 0xc3929f6f, 0xadec0b40, 0x0a407883, 0x54a7e009,
0x6e03d327, 0x38145fe6, 0x0004baaf, 0x9a3b835c, 0x9aea05b1, 0x54007a53, 0xab90b402, 0xdc80f3cb, 0x2a8e85c7, 0xae00021f, 0x0596c3c1, 0x41c07ad2, 0xda7403a0, 0xe923df97, 0x0b1ee46e, 0x43014f2a,
0x3aade0d7, 0x024c0790, 0x275abf2f, 0xe4ae03d9, 0x56de129b, 0xae86029e, 0x107533c1, 0x03a8f80f, 0x9d52f978, 0xb5c80f6c, 0xfaa4f449, 0x18684026, 0xf10756d6, 0xd5e03e80, 0x9757798f, 0xf3bb01e5,
0xa0d3179c, 0x06b80c09, 0xa81650b7, 0xf49bde6b, 0x700950ea, 0x07be4eb8, 0x136fcadc, 0x8001bf50, 0xda4ee0d7, 0x49f57502, 0x012a003d, 0xf032eba6, 0x140edc80, 0x000360d6, 0x75abc1af, 0x4b000f10,
0x0cba8680, 0x4db7203c, 0xb0047940, 0x0706be13, 0x03d0902c, 0x1f57817a, 0x925d5c0f, 0x0914e407, 0x0a05d168, 0x1643835c, 0x2301e648, 0x10b80740, 0x0f1cbcba, 0x5447a7c8, 0x4380b787, 0x05b0e0d7,
0xd413eaea, 0x1d018f67, 0x797c3a60, 0x4b901e29, 0x8cb5e83a, 0xba050a6f, 0x2d85cf06, 0x5a03c490, 0xc3df9781, 0x0f14bcb8, 0x7026a1c8, 0x302e8b46, 0xcfdc1ae8, 0x07b880b0, 0x3d5e071c, 0xf34901bc,
0xc3fbec80, 0x9af8cb6e, 0xf06b8060, 0x04d33d50, 0x301e8275, 0x2980740b, 0x7865d5f6, 0x8facf5c0, 0xe120790e, 0xb8004a4b, 0x2db08f06, 0x2d01ea20, 0x6d600740, 0x203cb240, 0xa3a0eee3, 0x7600a41a,
0x43e0d7c2, 0xe6200e51, 0xcbc05d01, 0x2c8024b3, 0x1938c80f, 0x1bfc3bf0, 0x06ba00ca, 0x803a468f, 0x010e0d88, 0xba083eaf, 0x67df1c7a, 0x50f503a9, 0xb835e080, 0x04da39b5, 0x02983602, 0x0484403a,
0x5901e590, 0x8e5d40ea, 0xc1ae0382, 0x080b1cc3, 0xe80060d8, 0x40125100, 0xce5c0792, 0x9afc4bae, 0x011022fa, 0x72f706ba, 0x06d6201d, 0x33cbc043, 0x1e895063, 0x48515d90, 0xa140b397, 0xd70cf06b,
0x58367102, 0x239d5e06, 0xc078e401, 0xc23d5662, 0x4cdfa0cf, 0x9835d016, 0xdc080127, 0x1314cd5e, 0xe3663e49, 0x80f60eae, 0x5fd8d93b, 0x27701093, 0x881e0d78, 0x1d5d40b3, 0x3808686f, 0x8e5c5491,
0x03d83abd, 0x550509b2, 0x40b8020f, 0x58cee0d7, 0x203d700b, 0x8040095b, 0x12660dce, 0xe6d69e0a, 0x35d0106d, 0x02de3578, 0x4e800f1c, 0xa1a54524, 0x16407aa5, 0xd0e8c727, 0x5d016206, 0x06f14b83,
0x1a1e8ba8, 0xc5244e82, 0x1e19004a, 0x12fe4570, 0x680e4ba0, 0x742a7827, 0x9102c852, 0x04bd901e, 0xf201e190, 0x683545c7, 0xae81b604, 0x1d0567c1, 0x8003c220, 0x58fc57ee, 0x0f30eaf0, 0x3bbb2578,
0x7d0e92ec, 0x35d01660, 0x138ed198, 0x00606b01, 0x2424913a, 0x80782401, 0x1fa4a3ec, 0x548dbe82, 0x64706ba0, 0x03c84e2d, 0x5917eea0, 0x01ec9689, 0x1ac21392, 0xa9d0002d, 0x5c44b8d0, 0x2740078c,
0xd12ba292, 0xee403d92, 0x02d1a012, 0xc5835d00, 0x07a47854, 0xe0860f40, 0x7ae5a254, 0x2a9965c0, 0x0005a740, 0xa82a153a, 0x003c23c2, 0xc25d7eea, 0x01ec0012, 0x8d009732, 0x1af00016, 0xac11e89c,
0x420e0e0b, 0x04812fdd, 0xc4807a80, 0x468ce025, 0x2474000b, 0x5823e124, 0x81191817, 0x9125244e, 0x900f5000, 0x93e804b7, 0x848f8003, 0x016a4c1c, 0xa74007bf, 0x3fae9342, 0x96900f10, 0x4fad380b,
0x153e1012, 0x120cd31a, 0xf75001e3, 0xfebc4d6b, 0x56403c40, 0x2a9f503a, 0x1af84ec0, 0x038537bc, 0x75001e78, 0x0feb14bf, 0x552403c0, 0x536a4e04, 0xd700c406, 0x66d88ee0, 0xd807b610, 0xdfba8046,
0x4f5754f1, 0xa40f01ed, 0x7d368038, 0x1ae81800, 0x05953fbc, 0x4a800f5c, 0x4feb5480, 0x29b80f7a, 0x34fafec3, 0x80b66102, 0xe94be816, 0x80079600, 0xf5ba4025, 0xc807bd27, 0xa6d20d68, 0x9d009013,
0x066a150a, 0x74023489, 0x04953928, 0x43c07880, 0x4ba00e09, 0x7405b02b, 0x19ac5f32, 0x5008ca24, 0x82134bf7, 0xbd392458, 0x7c376280, 0x649af456, 0x4e01020b, 0xbf8b1e85, 0x800f3cd5, 0x094a5fba,
0xf800f000, 0x0cba2199, 0xa7405903, 0xdfc70f42, 0x80119e69, 0x025a97ee, 0xeb80f7a4, 0x69f0aad0, 0xf0c0b29d, 0x66f150a9, 0xc0331610, 0x0097a7ab, 0x3a003de9, 0x38c9a829, 0x327403b0, 0x0833413f,
0x28256803, 0xef4804bd, 0x0e803701, 0x080c55a0, 0x9f650a9e, 0xb40c22cd, 0x01200917, 0x2c007bd2, 0xdd247c12, 0x53a02084, 0x6cc1bca1, 0x07ee8001, 0x3da90092, 0xc8647600, 0x8446f90b, 0x4d0a9d00,
0x60120cd8, 0xfceaf02f, 0x3cacf4a9, 0x03221160, 0xd8046ab5, 0x150a9f09, 0xa366c96d, 0xc12910a2, 0x016d2003, 0x7701d55a, 0x92f2c782, 0x80f88337, 0x254122f6, 0xb80f4a40, 0xcd007002, 0x2a742024,
0x563f6934, 0x0848e000, 0xf4a4025c, 0x5032f480, 0x5ce13393, 0xe9a153a0, 0x1f0eb18a, 0x412eaf03, 0x901e5802, 0xf4fb6cf4, 0xe3d112ef, 0xb50f4850, 0x10b41861, 0x10024329, 0xea407a92, 0x5966a06c,
0x5e58f040, 0x071066ca, 0x4c48bd25, 0xda407a92, 0xb35ff161, 0xa06a6331, 0x9b69a153, 0x90f46c41, 0x1e848400, 0x03a53b70, 0x6c377e28, 0xde58e808, 0xe59dfc56, 0x757807b0, 0x90801259, 0x165203cc,
0x7268cf85, 0x540b9c28, 0x0e1dc402, 0x0cda07c6, 0x10024d22, 0xba407992, 0xbd568054, 0x58e81880, 0x7dfc5b5e, 0x066d00e5, 0x08012791, 0xfbe03c89, 0xc3a00e54, 0xa068419b, 0xf12d7963, 0xd0079577,
0x004a64fd, 0x480f2242, 0x25e07273, 0x680076dd, 0x70e45631, 0x801a68b0, 0x012a9757, 0x203c4908, 0x75a5bbcd, 0xa783034b, 0xa0fd0142, 0xa78f8c88, 0x0f02434d, 0xa015d348, 0x96000edb, 0xc537c100,
0x8bda0325, 0x10025924, 0xf2407812, 0xca5d49b7, 0x80a994d0, 0x9b03e4f6, 0x21238041, 0x410025d2, 0xef9203dc, 0x82f59a01, 0x60f2c7c1, 0xe02520cd, 0x004be5d5, 0x2407b082, 0xdbb403df, 0x5899a001,
0xb1fd29ee, 0x19910b40, 0xb0820048, 0x038d2407, 0x8102cbb4, 0x8e04f2c7, 0xa3a0e5e8, 0x7a882004, 0x905cd240, 0xa487af16, 0xf1004a81, 0x0098f9f3, 0x91b24247, 0x0f410400, 0x01d09178, 0x84066b34,
0x9ac2854f, 0x3ff2da41, 0x31184497, 0xac9dd80f, 0xa7527c26, 0xd0084143, 0xc3e26c4c, 0x0b407c79, 0x9456b091, 0x203cc418, 0xb3584d59, 0xf09df076, 0x87e4d0a9, 0xdb40d0f3, 0x00933391, 0x480f2104,
0xd3ae1ed6, 0x2a1670b9, 0xeaeaf2c7, 0x9d4f7cb2, 0xe03c4404, 0xa323a27a, 0x8506eb34, 0xe2c2854f, 0xfba066f0, 0xac012965, 0x01e0282f, 0xb5437a49, 0xa782034b, 0xf8716142, 0x99eaf02a, 0x8082004a,
0x06492407, 0x000ad76a, 0x35850a9e, 0x5e059c83, 0x40095b3d, 0x2480f788, 0x17690607, 0xd7df8204, 0xbbba0ddc, 0xaca489c0, 0xd6210025, 0x82041203, 0x020bb547, 0x8158c5a1, 0x8071c537, 0xb9910c1e,
0x5eb02004, 0xfc43e16f, 0x5cedb8d0, 0x68049a8c, 0x066b0618, 0x10025fd1, 0x7c403ce2, 0x5ebb4440, 0x2854f010, 0xda0419ac, 0x41cb0c8e, 0x01e31388, 0xba8243e2, 0x5fc383f5, 0x066b08d6, 0x0323b601,
0x10135267, 0xdda201e3, 0x0049fae1, 0xf4563168, 0xea6c714d, 0x38140a81, 0xbe049a93, 0x83668807, 0xd00093f5, 0x37e150a9, 0x9e8131c5, 0x432b050d, 0x01eb8324, 0xbb4022a2, 0x48f02066, 0x0419ac08,
0x979c8eda, 0x3cf02004, 0x482db440, 0x7d00093f, 0x70ec2359, 0x00918ab0, 0x08079e04, 0x8ead008a, 0x8b40c787, 0x14de89b1, 0x40a80617, 0x04009473, 0x6588078e, 0x68e7ce02, 0x79f2315a, 0xd014735f,
0x2760a1b3, 0xda20a553, 0x01cac403, 0xe7854dba, 0x08e6bef6, 0xb0c8eda0, 0x10d2a993, 0x736201e9, 0x0e9d7ae2, 0x848e818c, 0x9c004cc0, 0x23360248, 0x03ca22a6, 0x21de8516, 0xeb5f2573, 0x0a9d03c6,
0x26a6f34d, 0x8502a00a, 0x89293fed, 0x019100f2, 0x35da93a1, 0x30c34384, 0x1fa62d58, 0xfda17578, 0x72416c67, 0x03c230c1, 0xa623de44, 0x3a081a5f, 0x066b0a15, 0x8b23b681, 0x968c23cc, 0x8586b0cb,
0x100f6c30, 0xd7e90549, 0x0095020c, 0x9c0b7bb0, 0x410a1248, 0x09e5ca57, 0xc06497d0, 0xa69100f4, 0x2034ed10, 0x78042474, 0xfdd01838, 0xeb124644, 0x76e5cb1b, 0xc16497d0, 0x814580f2, 0x86ed50ce,
0x1861a102, 0x7a0419ac, 0x16489436, 0xe500ed1a, 0x21aefcb2, 0xabc40796, 0x1dbaa3c0, 0x0a9e080e, 0x38a6fd4d, 0x286cf402, 0x0af42c91, 0xc5580076, 0x03c3099a, 0x9a820be2, 0x276a24bd, 0xd6142a7c,
0x489c020c, 0xa0953a12, 0x6c003b11, 0xd84d9578, 0x225fe203, 0x101e5da5, 0x6f40012a, 0x0c1f038a, 0x12e04171, 0x7232e5fd, 0xd7d03181, 0x01e4208c, 0x9d40b9f1, 0x804f155e, 0x37b06186, 0x86cf41c5,
0x3552def2, 0xcbb514b6, 0x4031409f, 0xfa00bcb9, 0x3d04519e, 0x03ac72e0, 0x860b5768, 0xdec2854e, 0x476d0714, 0xf9f67776, 0xc440f972, 0xe5cbda35, 0x0579729e, 0x09233df4, 0x456c407a, 0x331a95f8,
0x0a9d0347, 0x0e29bd85, 0xf5e49138, 0x7cc7a1a2, 0xc812fb1f, 0xb29afbf8, 0x7c2d0388, 0xf23d301e, 0xd7f6313f, 0xec0c112f, 0x833607c9, 0xb7802500, 0xbe45a0fc, 0x2c49aecc, 0x85f3cb95, 0x40e22cf6,
0x0e03da0b, 0xc62bff16, 0x020bb401, 0xb0a153a0, 0x50129066, 0x48117a81, 0xb7a4647b, 0xb0a33c81, 0x89865caf, 0x9e6d0e55, 0xff178c07, 0xee01c62f, 0x1335b42a, 0xec2854e8, 0x3b683070, 0x66d46bb2,
0xb3cde91c, 0x5680d12e, 0x44e142ff, 0x85a07136, 0xc5d301eb, 0x38c77fe2, 0x21337680, 0x5850a9d0, 0xfdd00833, 0x7b89e3bc, 0x853003b0, 0x008a02fe, 0xe503850b, 0xa3bd8672, 0x2e1c078e, 0xc637ff16,
0x4b7b7401, 0x142a780c, 0x54020cd6, 0xda44dea0, 0xa6007618, 0x403b440a, 0x9f30a177, 0x61681c55, 0x62fec07b, 0xf27fe0f1, 0x12bc401d, 0x91ff1d30, 0x85c75d63, 0xb347dcff, 0xc342cfcc, 0x6e4b5830,
0xb00934b7, 0x8c3d9244, 0x7686d32f, 0x42855d80, 0xa0716677, 0x01e2197d, 0xdee2c583, 0x85030398, 0x8b67823b, 0x411f71e3, 0x76116bc6, 0xd762c980, 0x431f8c47, 0xcd6142a7, 0x245ed020, 0x13050def,
0x50c3d924, 0x3fed6881, 0x8e142850, 0x5a071764, 0x2b980f60, 0x8f4a8716, 0x8f17f6b9, 0x16745102, 0x0de378f7, 0x16546594, 0x97a7ebb8, 0x54e873f1, 0x17306c28, 0x1d547ee8, 0x4b010512, 0x8fb8154c,
0x028500ec, 0x08907d7b, 0x012400f2, 0xb94f4b66, 0x12dc200e, 0xc3e6978e, 0xfac19f31, 0xeff0596d, 0x308ecfe1, 0x0a9d0e7e, 0x01cd9d85, 0x4bdea054, 0xd010508a, 0xd1e6dcce, 0xc26c687f, 0x1c65900e,
0x4ff6d168, 0x2a1c0248, 0x0075cd7d, 0xf0e1e3e1, 0xcc70deb4, 0x870a7067, 0x203354f5, 0xe15d1fa3, 0x30c3439f, 0xf4083358, 0x15af286c, 0xeb7aa709, 0x89102a59, 0x7f6c05c3, 0x40f6071c, 0x6d00abbe,
0x968c0248, 0x8075c6fe, 0xa76213c8, 0xff7cb647, 0xc7eab71f, 0x49520088, 0x6c255b8f, 0x787f9aac, 0x854e814f, 0x0714dec2, 0xc9d40094, 0xd6386330, 0x2bf2ad63, 0x07101848, 0x240e36c8, 0x063b6694,
0x73bfa54b, 0x16b2201d, 0xf56c5938, 0x2bd27ec9, 0x49e0dfcd, 0xc8566715, 0x47a11ffe, 0x53f6ed0d, 0x1d00ffa1, 0x29bd8109, 0x1436780e, 0xda1d3475, 0x0c0a7bff, 0xc19b8815, 0xe0500ec8, 0x31648b14,
0x5b3d9e56, 0xd73bfd2a, 0x00d2a201, 0x8fab3878, 0xb3d6fffa, 0x556b8871, 0x101f4692, 0xa0f40072, 0x96b2ac0f, 0x2854e814, 0xa80419ac, 0x3a012940, 0x42dea581, 0x968e0558, 0xfd8827cb, 0x71626d0b,
0x8989db60, 0x35b76903, 0x94f4dab4, 0xe35e7f4a, 0x6cf7c039, 0xb5847d03, 0x5b30fd18, 0x3c9d7a7d, 0x51d47ea3, 0x26dd8d6c, 0xddd1c66c, 0x25860d2a, 0x142a7423, 0xa838a6f6, 0x7496a004, 0x291c0414,
0x205587f4, 0x00e589b6, 0x10dc0e28, 0x384b4ef8, 0x9a32b4a1, 0x5fc0602a, 0x7a54a9a2, 0x888073c2, 0x16c94213, 0xc1ffe2dd, 0x776cb631, 0x70dd8141, 0x881c58ab, 0x435742d4, 0x18ac2469, 0xb0a153a0,
0xcf01c537, 0x5072a286, 0x1635ff48, 0xd8150c0a, 0x42c31d88, 0x28dc0e2c, 0x244f1a13, 0xa0341caf, 0x4d0a17cb, 0x073c7ba5, 0xe681e760, 0x4ad0a3c8, 0x7f5904fd, 0xcf00f90b, 0x0428c3aa, 0x9cf64f40,
0xa5a00380, 0x4254b3b6, 0xf0327f8a, 0x0012a01f, 0xd0183876, 0x70b1a8fd, 0x6cb0041c, 0xbcfd6f3c, 0xf181c760, 0x270e15eb, 0x601f6c17, 0xcc389696, 0xe143a290, 0x74132f08, 0x42079d94, 0xf49e1876,
0xc47912d9, 0x07628e9e, 0xf8c8aacf, 0xd9f10333, 0x0774c422, 0x0d4a4f0e, 0x2062c55d, 0x091d0cbf, 0x00833581, 0x86550025, 0x7deeb31a, 0x709e0548, 0x38c10077, 0x0a12e710, 0x8da43d4d, 0x3fe131b8,
0x1b52fd07, 0x1c17d0be, 0x34c33807, 0xccfa4e10, 0x0bda07a0, 0xd1238f04, 0x3ee49a56, 0xed38d3de, 0x8e97e238, 0x1d4fa011, 0x8386212c, 0x899a02aa, 0x060e1d85, 0x5a8a1b3d, 0x432c97a4, 0xda205487,
0x0e394f95, 0xda071420, 0xa470a87f, 0xde71237f, 0xbe3809c0, 0xbb0038e3, 0x7a59041d, 0x8e9674a4, 0x76d0a6d2, 0xb1c5ed8d, 0x1e3b492e, 0x21768566, 0xc55cc290, 0xac1bd00e, 0x42a7401d, 0x1714dec5,
0xcf02f3b5, 0xc2c7a286, 0x6f7cac27, 0x90f60550, 0x2846d95d, 0x9b87dc0e, 0x49330847, 0x012446c3, 0xfe6fc826, 0x978071c2, 0x3320fb2c, 0x1de3f6b4, 0x23fbbf7a, 0xf9ce38b4, 0x4904225d, 0x4f8f1e3b,
0x99571217, 0xed2ff6c4, 0xe8466a09, 0x3348a854, 0xd4637cc8, 0xfdd0265c, 0x0f3c165a, 0x5eb4b0d8, 0x66920550, 0x07140730, 0xb2fb889e, 0xcbb06d38, 0xa4a9f8fa, 0x615e007b, 0xe5be6fc8, 0x28730038,
0x7d678500, 0x9d3f52a5, 0x453925aa, 0x18844b9f, 0x0d591fc2, 0x6830baeb, 0x0e25e981, 0x581fda50, 0x4012a053, 0x6f0b2c64, 0xc8cc13a7, 0x4740a81a, 0x511cfbca, 0x61010567, 0x3ee1b815, 0x607151cf,
0xfd0ae37f, 0xb4ddfadd, 0x898d1101, 0x157b00f6, 0xe33e142a, 0x80eb0038, 0x9ab459b8, 0x19d641ed, 0xd91a24f4, 0x112efddf, 0xac7910e4, 0x8763f8f7, 0xeeb64fa8, 0xcfa01cb1, 0x478060bf, 0x52a11842,
0x24ff01f3, 0xca993d7e, 0x6fe860d9, 0xeb3804a8, 0x11c1b419, 0x68157efb, 0xb0b98335, 0xff09c0e2, 0xb502f8dc, 0x6c258c64, 0x8e737121, 0xc00e39ef, 0xa34f04c8, 0x7ed97975, 0x4f451d3c, 0x4b9f77f6,
0xe12a4084, 0x6c47cc6c, 0x624fad86, 0x52b54b90, 0x2a74007b, 0xcb387594, 0xfe24c081, 0x97d3a928, 0x0bfac31b, 0x78d43678, 0xdf5ba34f, 0xfe6ab31b, 0x35681541, 0x846cb983, 0xb286c0e3, 0x9f70597f,
0x480f7b62, 0x71ea0f90, 0x1ce7ce23, 0x2abc6007, 0xa067d908, 0xca675b01, 0x5b0cd3cb, 0xc82f368b, 0xa12ac16b, 0xcb896a54, 0xc0329317, 0xa500ed8c, 0x21f2be63, 0x75942a74, 0x6046db3e, 0xb8a9c61b,
0xbbb1dc06, 0x4099bc10, 0x59453009, 0x01eed1db, 0x9941b815, 0x5e12b113, 0xa6044fd3, 0xd8a7dd46, 0xec124e5e, 0xb1e2de01, 0x708071c9, 0xc3ae6029, 0xa0b4e896, 0x366cb49b, 0x21f629cb, 0x915bf6b3,
0x881c4c5d, 0xc77ec8fe, 0x525758fe, 0x54e845d9, 0x5688e328, 0xbd499bd2, 0xdc99a23c, 0x70fb23d2, 0x08405ec3, 0x1ce81500, 0xe2b7e6d5, 0x02a7da58, 0x973066ed, 0x8da0a970, 0x15bc7c64, 0x1bca81ab,
0x89603d91, 0x3f12ecfa, 0x1e2d4431, 0x80768a7f, 0x06429bf0, 0x54bd18ec, 0xf626ebda, 0xc1bf9671, 0x460edb0a, 0x0a249598, 0x0446cbfc, 0xe152d683, 0x1593c35e, 0x68c00960, 0xe8113906, 0x1137c6ce,
0x9c2692dd, 0x3ff0df62, 0x9456c04f, 0xdb46bc79, 0x1370ded6, 0x8f3ef4be, 0xfeca2377, 0x3139f085, 0xd02d5be8, 0x90ae62ad, 0xb7a35477, 0xc7b73407, 0xfc5e07ac, 0xb46bf850, 0x416a8403, 0x16761b78,
0x48272ee8, 0xb43f6e3b, 0x3d6ba37b, 0x5bb92423, 0x14c56d2a, 0x398c700c, 0x003ae0d4, 0xbbb92e4e, 0xb42a740a, 0x44f6d0c8, 0xd6d151f2, 0x9f8e5384, 0x1e8042c7, 0x5e051dd0, 0x677bc91c, 0x010707da,
0xdb65dcbb, 0xf9f7d15d, 0x43428077, 0xcbc40e30, 0xf09d3d53, 0xc6fff159, 0xb04b3504, 0x6f3aec14, 0x15a15a5e, 0x78b53f45, 0x00ed127c, 0x71e09ea1, 0x19b1f19c, 0xc773f670, 0x844b9eba, 0x34f99b40,
0x5c74c4fe, 0x84891841, 0x78fecf2d, 0x0b7370c5, 0xaed0a9d0, 0x43d1fdb0, 0x373f42b6, 0x16434edd, 0x10b1c30a, 0x0084f258, 0xed768150, 0x6a7536f2, 0xf996a6e5, 0x2c2dcf66, 0x456b054e, 0x3a79784b,
0xda7c2540, 0xdbe00969, 0xb3d84a03, 0xbffd9b1b, 0x5ffd413c, 0x31f87e3a, 0x478201da, 0xdfb92204, 0xce31c7b5, 0x1da99388, 0x48ed5670, 0x6f578789, 0x8c7f5cf2, 0xfd9e701e, 0x0f77bd71, 0x537400e5,
0x942a7400, 0xbac40791, 0x074ed689, 0x578e791c, 0x780d1c54, 0x04a07925, 0x64902818, 0x76ed98dd, 0x152855ce, 0x398336e8, 0xcff46aec, 0x00059207, 0xe12706cb, 0x8713a253, 0x7cf2e378, 0x38395f79,
0x3feed479, 0x6e5e8273, 0x80768d3e, 0xb7183540, 0xa7cf7801, 0x590f9cbb, 0x9d14af02, 0x9573efea, 0xf8414c5d, 0x7a5015a0, 0xd0014d50, 0xc1f0d0a9, 0x2f81e800, 0x5b518d37, 0x6e156fad, 0x02f30642,
0x90f1e831, 0xe0be9ad4, 0x15287c95, 0x66d76138, 0xd9b7d03c, 0x0b22c547, 0xede1c2d6, 0xb0fe6301, 0x4603da91, 0x5be5fef1, 0x43b1c840, 0xa35fee1b, 0xc2858852, 0xf00ed1cf, 0x639e642a, 0x39d3f40d,
0x56b53f69, 0x19d4b6ea, 0xec35f2d5, 0x62bf0e3a, 0x55c06384, 0x4d78039f, 0x50a9d001, 0x38100cdc, 0xf03c8194, 0x0a8ddedd, 0xef25f0ea, 0x818f8e9c, 0x9fb3ef17, 0xe8b7fc50, 0x8155dbad, 0xf5fe8dcd,
0x5a1872dc, 0xbf5bb405, 0x4ffd25e6, 0x61c58238, 0x563cfede, 0xdabbf380, 0x09e2bee9, 0x7423a9ff, 0x97f0b10a, 0xb7f00768, 0x901ce003, 0x0d4bd0a7, 0xfc0ec5ad, 0x8f0ae334, 0xba6993f5, 0xf5a1737a,
0x8facfb98, 0x3f71d2bb, 0xc17c20b7, 0xbc3c160e, 0x54e800a6, 0xf4007228, 0x1ed06c18, 0xedde0560, 0x10b8206e, 0x5e6de1d0, 0x40aa05da, 0x37050b97, 0x0105e3b5, 0xa51c0a94, 0xd419e24d, 0xecc7f0db,
0xfa4bdf05, 0xd0877fd3, 0x862e1f64, 0x585dfbf7, 0x8cbfb85f, 0x4a1ec803, 0xf44fa015, 0xff80388b, 0x3a61b084, 0x34912f44, 0xc7eb21cd, 0xa0976dc7, 0xa8b8bd32, 0x69b7e8ef, 0x17e3e1d2, 0xddc64c0e,
0x997ae53f, 0x9d0014db, 0xe24e2d0a, 0x992e8307, 0xbc0f58f5, 0xc811a037, 0x2dcbd0c4, 0x64b50934, 0x897828af, 0xab9ed5a6, 0x56a85702, 0x413c1700, 0x1bb53ce8, 0xa49c07ce, 0x733fb37f, 0x1721598c,
0x37472bc0, 0x795c5ed9, 0x3b019d8b, 0xdfaff39b, 0xbe1d5747, 0xd2007414, 0xe71b4006, 0x7be5b5a0, 0xc0bd378f, 0x3f6ecd13, 0xfd7187ec, 0xc0976638, 0xe28e7af4, 0x400536e2, 0x838b42a7, 0x12a7e824,
0x252c2769, 0xb42ce3dc, 0xa01d810d, 0xe86e4940, 0x6d92ca40, 0x1d5403cf, 0xc0aae316, 0x5ce3e0c6, 0xeec65db0, 0xbf75180a, 0xa5fd98dc, 0xfd492d28, 0x5d6215b5, 0xb0a92722, 0xdd1f6c90, 0x1fdebfee,
0x423a7071, 0xe9300e7c, 0x26369199, 0xd5aef852, 0x72112ea8, 0x4dadc6c7, 0x60f7bf60, 0x81864bfb, 0x2701d009, 0x9a70a49e, 0xa153a002, 0x932a7168, 0x55d3cfa0, 0x85fb568d, 0x82179e2b, 0x6e5bcaa2,
0x2717a097, 0x3e49600e, 0x151ce19f, 0xea4bef38, 0x38ad34b9, 0xbb9f7e62, 0x6a5f3842, 0x3466bc29, 0xc661c0e1, 0xdcc76589, 0x5ade6fc8, 0x7050dc2c, 0xc577cad4, 0xb49d003b, 0x6800dab1, 0xed1f2dac,
0x4fcec38e, 0x178b16ce, 0x760f4fdc, 0x1e009b39, 0x313fb542, 0x0d164be3, 0x5ca83b17, 0xe60addbf, 0x800a69c7, 0x9022854e, 0x3dda9b7d, 0xd54a3fcd, 0x45ec7ae4, 0x47703eb6, 0x19b6e5ed, 0xce28839a,
0x8bb6bfe1, 0x043a3e48, 0x09e05577, 0x4d800ed6, 0x6341be8a, 0x47426583, 0x6a5fda23, 0xe2ebf85f, 0x46b1b23e, 0xeec77f67, 0x2fece6d0, 0x7a0ff6fd, 0x71c3bec2, 0x63c3ba00, 0xf801b49c, 0xfcb6436c,
0xdee7ea11, 0xfa8b8df3, 0x3f081478, 0x5aa4cbe1, 0x74e9ef6c, 0xf39e20e7, 0x47491aa1, 0x8d3334dc, 0x9d0014dd, 0x459c450a, 0x212b10b7, 0x709bb43b, 0x081d82ee, 0x54f784f6, 0x00b2b727, 0x8f1441cd,
0x10d6ae3b, 0x2ad9dfc8, 0x03b99db0, 0xded01ed8, 0x281dad86, 0x3922fafc, 0xf6221e87, 0x2f9fec57, 0xc24eded9, 0x1983fc5d, 0xa0dc143b, 0x0e78cf5a, 0xe6549ff0, 0x036eca7e, 0x7e5b21a0, 0xc3e49d8b,
0xab1e79b8, 0x6d603fa8, 0x2f57e802, 0x1543bfb8, 0x64499784, 0x43026def, 0x609018c1, 0x37400537, 0xb76cc461, 0x65adc375, 0x4e2bbdd0, 0xc7ebe820, 0x513f6e71, 0x608dcdce, 0xfe49d201, 0xf3f3e91c,
0x054b7ddf, 0xc0bad0f6, 0x1be411cf, 0x8a5efd1b, 0xf6fc29d2, 0x268d36b0, 0x1676db92, 0xb37b6e86, 0x7c567058, 0x598e00bc, 0x9df291f2, 0xe00e786f, 0x021c7668, 0x436d06f6, 0x3a56fcb6, 0xd798e777,
0x5bf7ea2a, 0x1d00c09b, 0xe3357a3d, 0x56e1f469, 0xb6e47eaa, 0x9ab1f982, 0xa153a002, 0x3f722d98, 0x45596d1b, 0x40acfd65, 0xa4b19db0, 0xaf997f62, 0x84ce025b, 0x0f3a0e21, 0xff9d52e8, 0x2054b5c9,
0xba1cf9cb, 0x79695189, 0x0380f642, 0x42c15fcc, 0x41ffc177, 0x27e9ba3a, 0x4fea3d0e, 0xc03b463a, 0xacf95e1a, 0xfc521edc, 0x4e81412d, 0xb3d100ba, 0x89fbcc7e, 0xbb69de6d, 0x026d6fa8, 0x10a64ead,
0x16cdd073, 0x6bbdb5a2, 0x70ec58ae, 0x86498416, 0x5348618b, 0x142a7400, 0x63853d63, 0xc54c3876, 0x9c10247c, 0xdd56240f, 0xd6d1363b, 0xd1020d08, 0x1afe48c2, 0xf06af36e, 0x0a96ec3f, 0x010aaff4,
0x5003881a, 0x03d9043b, 0xab318256, 0x26f6d9f3, 0x5c2783fa, 0xa1204809, 0x70704060, 0x191fa01c, 0xfac715a5, 0x0d001b5e, 0xd02ff2de, 0x096e3beb, 0xf376b4e8, 0x8c438efd, 0x7def1d63, 0x13a382e2,
0xc65baab1, 0x2365b01f, 0x72160ad5, 0x48f011b3, 0xf918e608, 0x904d36e7, 0x5a87a958, 0x78204906, 0xe144f982, 0x1944f535, 0x3548012c, 0x0b1240b0, 0x0de88133, 0x8606c0ab, 0x5dc0a0fc, 0x90eff40b,
0x287b6fc2, 0x6a584873, 0xcac2dca7, 0xff50ad0c, 0x6a119c32, 0xb45bb80b, 0xf528ec03, 0x3437e923, 0xe1f15647, 0xead069b0, 0x7dba443c, 0x0096ec5d, 0x378fa8b7, 0x705f2181, 0x1c0d34e7, 0xc585256a,
0x4fe2b765, 0x21f982b5, 0xa9d0014d, 0xdd08ca50, 0xdb422ca4, 0xec82049b, 0xe2449c40, 0xc4020965, 0xf3e2314a, 0x868e0341, 0xaf82e055, 0xbe661fb0, 0x205beedc, 0x318cefd0, 0x3820ac17, 0xfdf6682a,
0x2c4856cb, 0x4e3773ec, 0x8d2a5014, 0x383f3ba2, 0xd001b74d, 0xee38ffa0, 0x12257885, 0x8afa4de5, 0xfaf1d6fa, 0x5627ded3, 0x0b1eb8ad, 0xc0fc0180, 0x825bda4f, 0x0fcc15af, 0x227408fa, 0xfad562c0,
0x9bc01f07, 0x14fd2340, 0x5b03904c, 0x59388158, 0x0012e17f, 0xc86184b7, 0xa5fe60e1, 0x50c0ab1b, 0xe048320a, 0x7e231f59, 0x6cfec634, 0x1c6fdbe0, 0x47fd05f0, 0xadf0a288, 0xf8071c41, 0xd1f60a33,
0x1e3e3c33, 0x859274f1, 0x09fe8879, 0xa2e9da89, 0xa8df093e, 0x1deedda5, 0x4439bf46, 0x3b61c184, 0xe40d9c12, 0x88a62999, 0xa0e0499b, 0x4837377d, 0x9bbfa7e7, 0x88111caa, 0x56788523, 0x6c5002c2,
0x37610f25, 0x69ef90b9, 0x7cdab7ee, 0x8f1d1142, 0x534e5623, 0x843893e0, 0x81d77bf0, 0x1df2afd0, 0x3a4cb4a0, 0xdb98bab1, 0xf8cec933, 0x1f5c7762, 0x877acb40, 0x09bc71fb, 0xba4b2cf8, 0xc7657046,
0x74f624da, 0xd7d1ba59, 0x3807e60a, 0xab614b95, 0xbda0b6fc, 0x8b3283bb, 0x5a046162, 0xe520b687, 0x42e45da0, 0x5bd7633e, 0x63013a75, 0xfc844c52, 0x6e620228, 0x50e1779f, 0xe54fffd0, 0xe33fc038,
0xf1564ffb, 0x8e69a62d, 0x1613fe87, 0x796ec3f9, 0x877afc90, 0x1723dc5f, 0xf0ebee59, 0x112cc174, 0x30568105, 0x0004523f, 0x6a31d7a6, 0x5097ecb9, 0x609ca6f8, 0x0926c1de, 0xa0c24829, 0x7053f673,
0xed0c6eef, 0x25e0f10a, 0xd16451ab, 0x5f856b20, 0x1507cedc, 0xf418a727, 0x6ffee42f, 0x5ccf6fa1, 0x57a44a00, 0xe01d17de, 0x376040fa, 0xb3e43d5f, 0xa0eeae2c, 0xf3bf7535, 0x091251c3, 0x18f944b6,
0x75889c06, 0x1a1fb2e8, 0xb6f814fc, 0x1da8a5c1, 0x004247a0, 0x6fbc4360, 0x5b01b821, 0x3190b34f, 0x67bcb029, 0x1310964a, 0x44eda5e1, 0x38dddfbb, 0x01cb60e5, 0x117d734a, 0xe7af0cf2, 0x5c2e16be,
0x150c181f, 0x92cc7df5, 0x9790cff4, 0x6091c019, 0x8fcc15b0, 0xc5902c8c, 0x8daec761, 0x4fa4be8d, 0x5419994f, 0x59ca7535, 0x78ad09fe, 0x3d0f9de3, 0x889f2c90, 0xd7744567, 0x4049f068, 0xf8071c26,
0x1d218e77, 0x7ef8b5e3, 0x2d55bd60, 0x58c7376a, 0x5c5495dd, 0x50c12380, 0x068f982b, 0xa2706679, 0x47fe5dad, 0x0c092d0e, 0x2740cc1b, 0x1e4cfc11, 0x60dc6921, 0xf87f57e7, 0x6d760247, 0x8880d214,
0xba56319e, 0x12d38680, 0x0e716ff6, 0x09754230, 0x1ebd605b, 0xec979bbd, 0x5657d9c7, 0x026b249a, 0xfbe00ca3, 0x6c1872a3, 0xfa84df66, 0x05617086, 0x621c8c3a, 0x36a211ff, 0x29f22b02, 0x0313eaf6,
0x85a70be3, 0xeb1a14d3, 0x5d5dd300, 0xbbe1c301, 0xb0fec7d6, 0xc30dd605, 0x47210f3e, 0x8d76f0af, 0x1091d03d, 0xbe70c98a, 0x88c3499f, 0x0c3a8bc4, 0x6e8f429c, 0x489e4568, 0x854803be, 0xaffe16d3,
0x96800e71, 0xc7ffc0e7, 0xe67e9349, 0x8aba1d27, 0xe00ffe83, 0x0ad83048, 0x0cde03e6, 0x0ece3142, 0x1d8cfdf7, 0xf8fcc0cc, 0xc605a3e2, 0x59ed2b83, 0x3067074e, 0x0ef1efe4, 0x2b6f6410, 0xacc7376f,
0xe525056e, 0x2c15a32c, 0xd225dff0, 0xe0b319d1, 0xddc9f7d6, 0x0acc7dfb, 0xc23940ae, 0x8ffb0d19, 0x9a500ee4, 0xf3968dee, 0xd38ff411, 0xe03084f5, 0x8300d07e, 0xaba2d19d, 0x9b206fa7, 0xf5a1df87,
0x3f98c26c, 0xa1c33873, 0x8070a5bf, 0x7d703434, 0x58c48f66, 0xa47261cc, 0xafc7a973, 0xaf7576c6, 0xcb4b0e76, 0xd818f139, 0xeabc51ea, 0xc3c6f0d3, 0x039396ff, 0x0f9f01f0, 0xe4d7491a, 0xd991c1c0,
0x91d9a9a9, 0x0cc981e1, 0xa19a2cdc, 0xcb7db3fd, 0xd3ab33ab, 0xde0397ea, 0xa83f1101, 0x56413db6, 0xd44b5632, 0x11de024b, 0xb6ab9f31, 0x3f42413d, 0xa88cb6a8, 0x90ff3f36, 0x6daaa7a8, 0x0798918f,
0x55848fd4, 0x1de02cc0, 0xb54f7713, 0xf3e031f1, 0x30663541, 0x3a500a79, 0x9f2283bc, 0x463e36a8, 0xae8e3f46, 0x27dbc6f4, 0xc5477873, 0x3e36a9ae, 0xa83f4646, 0x018fa8ae, 0x3b4587f8, 0x80a560f5,
0x65f43287, 0x31f1b558, 0x40b06a9c, 0xe47b383d, 0xc7e98435, 0xb279bc4c, 0x140c5387, 0x8d6506aa, 0x2d60869c, 0x0240d219, 0xe9416b72, 0xa992018a, 0xa5b00962, 0x7598f6da, 0x8b40294e, 0x9e8cb05c,
0xa9294d6c, 0x97863e36, 0xe3b1de09, 0x2fe6d56b, 0xa0d35f01, 0xdb55fb33, 0xd715f09e, 0x02a7d401, 0xac0258ab, 0x813db6aa, 0xb1dc0897, 0xfb6abee3, 0xe637a497, 0x16974369, 0x2df0b012, 0xfed601d7,
0x7201daac, 0xa12bd029, 0x2de9b553, 0xf52079b8, 0x6be02099, 0xb046741a, 0xb86b3bad, 0x89f52079, 0xe111f000, 0xdaa032da, 0x9e9c36f2, 0x44ea8c60, 0x0e6cfc00, 0x6d56995d, 0x1a7e0b79, 0x7f8ec760,
0x0c807628, 0xd2d573fb, 0xce459eca, 0xf6f83f9d, 0x0413dd57, 0x5f59a33d, 0xbcb6aace, 0x071887cd, 0xd212dc50, 0x994edaab, 0x929e3221, 0x5028fc07, 0x6d281c79, 0x8e375c30, 0x1e17d2e9, 0x2eaa0513,
0x04ad5708, 0x786d5658, 0xb068ce07, 0x30e98a45, 0x0a9cc879, 0x910e8ad5, 0x81725de3, 0xa1661733, 0x75281eb4, 0xa627542a, 0xe1dddb54, 0xd5fd9c5d, 0xa7720186, 0xf2223542, 0xe1bcd85c, 0x2858050d,
0x9ec9072d, 0x4985d50a, 0x6c60245d, 0x80c28010, 0xff67567f, 0xb542a62c, 0xc8091b40, 0x21cc213b, 0xec9094f6, 0x542a6ec8, 0x0207ea31, 0x012a621d, 0xc446bc98, 0x54eb5419, 0xb36a88e8, 0x54c66cbb,
0xbb0a3002, 0x0a9bf4c2, 0x91955aed, 0x0c1ee099, 0x7efc2b9d, 0xc9750b30, 0x42a6fd60, 0x120bba07, 0x1875549a, 0xcde1b408, 0x4ba83a05, 0x15376b06, 0x372d87da, 0x1d4b760a, 0x626d0206, 0x6518c113,
0xa9b3502a, 0xe57b71d0, 0x27a6819e, 0x542a8e23, 0x54068081, 0x92f502a8, 0x02dd8700, 0x0d6c0cfe, 0xe2d2a838, 0xa034447e, 0x4ea05cc2, 0xfd2da153, 0x051b7dd4, 0x062d337d, 0xf3e22d02, 0x87551880,
0x15346804, 0xafc87ada, 0x67001adb, 0x1031ead7, 0x1a3bc168, 0x67514280, 0x21233eb0, 0x9b894367, 0x93dbf4fa, 0x36810316, 0x0ec11d31, 0xbac22a8a, 0xb30e854c, 0x0e9a779a, 0x8973fda7, 0x8ecf060f,
0xb05ad8f5, 0xe2c3a285, 0x6d0a98f4, 0xccdaca89, 0x7a7efba4, 0xf05a040c, 0x51a3880e, 0x62d20a93, 0x2665b42a, 0x9f576eba, 0x8f4d5faa, 0x910b4081, 0x4d461034, 0x09035041, 0x5f97b030, 0xae499db6,
0x08193505, 0x052810b4, 0x0111285a, 0x7850a9c0, 0x7f48d933, 0xa9bed56c, 0x404a6937, 0x0b408193, 0x68a00941, 0x1538043a, 0x26eb0bda, 0x1313ed6a, 0xc95b756b, 0x8193405c, 0x4cdc4240, 0x110a8788,
0x1d0a9d00, 0xfe97d5dd, 0x8aaff797, 0x5a9cedcf, 0xe811b04e, 0x10481032, 0x04480095, 0x4004c828, 0xa14f42a7, 0x22dd3a2d, 0x309bde32, 0x7fd5db52, 0xa8353456, 0xcd140493, 0x88146002, 0x2854e000,
0xa9f85379, 0x78fac1e4, 0x9bfca3ba, 0xd6453b46, 0x02065d01, 0x0059a209, 0x10a6828c, 0xfd85e360, 0x4486c082, 0xc703454d, 0xe8722f21, 0xe71b3d5e, 0xffe38704, 0x15887e4a, 0x2ff22c02, 0x42a74007,
0x7bb6b5dd, 0x33612c4b, 0x42467879, 0xe8fd5ea7, 0x744b54f2, 0x40cba200, 0x10b04120, 0x80fb9160, 0x942a7418, 0xe69bc6da, 0xa062f93b, 0x5eef60eb, 0x4d9a6d99, 0x9d73a3dd, 0xe1c2c723, 0x81033681,
0xa109ee04, 0x0f9f7241, 0x76854e02, 0xdb756e05, 0x2300e76a, 0xee1c1b5e, 0xce6d1e5c, 0xda472cca, 0x9757467a, 0x46a73ab7, 0x265a0786, 0x35070707, 0xe2c21339, 0x802f509d, 0x1dbce3c3, 0x58012800,
0xeabb174d, 0x2ead8cf7, 0x76756ef7, 0x9a1ef56e, 0xa9ed199b, 0x972b29d7, 0xb1253f3b, 0xe0d9ee7f, 0xef22607e, 0xabdbea90, 0x6079c23f, 0x41039c8b, 0x36a854e8, 0x92da77b3, 0xe4c40824, 0x9d0617dc,
0xde29d50a, 0x412493d6, 0xbe5ce620, 0x60c7e1cd, 0xfaa63ff6, 0x37cfeaf6, 0xdf201d09, 0x07a10303, 0x73556843, 0x5bee13d3, 0x9ae45802, 0x854e840c, 0xd772956a, 0x30999112, 0x01eeb93f, 0x8d50a9d0,
0x2534eefa, 0x22d01a51, 0x38003dcf, 0x034c1212, 0xde244219, 0x0d6d7201, 0x8e854e85, 0xdabdbea8, 0x4a0eda23, 0x3dbf24f3, 0xaa153a00, 0xba1c01cf, 0xc8076292, 0x4e800f73, 0xdfc7f685, 0xc5271a81,
0x1c67900e, 0x350a9d00, 0x9218a069, 0xf22c8166, 0x5380038b, 0xefaa2da1, 0xce24f6af, 0x55e45902, 0x854e800f, 0x0c50349a, 0x0e00eb49, 0x5203d579, 0x68d9dd8f, 0x27ad7f34, 0x47c44771, 0x184d5791,
0xd26a153a, 0xac243140, 0x74e47b04, 0x2a700856, 0x6281a4d4, 0x84173b10, 0x22033e45, 0x11d0a9d0, 0x775837d5, 0x424207c4, 0x145e72e4, 0xa4d42a74, 0xd4486281, 0x9727ea0d, 0x5df43074, 0xc40d26a1,
0xd81a4d27, 0x00549721, 0x26a15df4, 0x6527c40d, 0x8722c012, 0xa74208d7, 0x881a4d42, 0x24ca66cf, 0xed0e4580, 0x50a9d0e1, 0x93e20693, 0x443c1dac, 0xfa1032f6, 0x069350ae, 0x809003e2, 0x422bec98,
0x08f82380, 0xb0efaadd, 0x05ef24de, 0xeb2e73f3, 0x2a74206c, 0x81a4c874, 0x0f1d08b8, 0x6ceb23cd, 0x742a7420, 0xd61df556, 0x8113649b, 0x897eb22c, 0xa15df414, 0x25c40d26, 0xb15125fe, 0x86145c64,
0xa4c391be, 0xa7ac7881, 0xf3f2056a, 0x43fb5334, 0x1a4d42a7, 0xb85bcb88, 0x048e33fd, 0x5aa153a1, 0x1fa5c31d, 0x22d018c0, 0xe810bed3, 0xea9f6854, 0xe935ac5b, 0xac83017a, 0x0c5e7965, 0xa4d42a70,
0x3824b881, 0x86478e18, 0xebf04135, 0x881a4dc2, 0x0c707bc3, 0xbb2e7168, 0x81972373, 0x69341ff6, 0x5ba90e20, 0x776482c1, 0x2a743076, 0x3881a4d4, 0x016921fc, 0x0c1f32c8, 0x6931091d, 0x46a00e20,
0x9d593f00, 0x577e071a, 0x312756a8, 0x6973c66a, 0x4b76400b, 0xa15df800, 0x5bf07d35, 0x8017120c, 0xe80096cc, 0x0349a854, 0x01732345, 0x80096cc8, 0x0693004a, 0x02ea468a, 0x0012d590, 0x49a8577d,
0x77224503, 0x0968c801, 0xd42bbf00, 0x012281a4, 0xc9048237, 0x9d001722, 0x7d541d0a, 0x5e45f597, 0x8b21c00e, 0x2a742074, 0x2281a4d4, 0xf4049691, 0x0022a0c8, 0x9ce8577d, 0x2dacdbea, 0x3400aab2,
0xe0828bf2, 0x349a8577, 0xca921450, 0xf7a47e80, 0x42a74005, 0x281a4c3b, 0x007d3902, 0xb764d641, 0x42a74106, 0xb32f7a75, 0x0469485e, 0x4e7b230a, 0xba153a0c, 0xeb3efaa5, 0x2c1a700a, 0xc20db91a,
0x9350a9d0, 0x53608a06, 0x9b302b42, 0xc5a752fb, 0xc5a153a1, 0x5a77d566, 0x02cc2453, 0x21352144, 0x350a9d0c, 0xb2362069, 0x5234c093, 0xa9d041b3, 0x77d529d0, 0xc832535a, 0x0c487901, 0xa153a105,
0xe6c40d26, 0x00170cb3, 0x3bca0a14, 0x153a1a41, 0x4c40d26a, 0xd2cc7fd6, 0x8e4f32fe, 0x9a854e83, 0xc0131034, 0x48627099, 0x4e87171b, 0x10349a85, 0x13a0778b, 0xa5904481, 0xa153c103, 0x22c40d26,
0x21680553, 0xa7420749, 0xaa638b42, 0x648eb5ef, 0xe46d00ab, 0x54e840e8, 0x0be65168, 0xec85abe0, 0xf7348072, 0x418774a5, 0x55c742a7, 0x491d6cdf, 0xe4a06af5, 0x010d68c8, 0x349a854f, 0xda2c9850,
0xa8c85840, 0x42a7430b, 0xcc281a4d, 0xe055467a, 0x45e0f730, 0xa854e821, 0xc9850349, 0x041408b0, 0x1d0c22de, 0xa0693109, 0x006d7910, 0x0026f018, 0x69350a9e, 0x6df920a0, 0x67681800, 0xb42a7800,
0xd6fdf557, 0x00371c8e, 0x8012300c, 0xf716854e, 0xbadfbeaa, 0x1b8e55f1, 0x16580600, 0x93004a84, 0x99b00a06, 0xcc301171, 0x083a5013, 0xd26a153a, 0xcf240140, 0xa9008b02, 0x42a78009, 0xe1bea82f,
0x0d4b919a, 0x75e00820, 0xd0a9d032, 0x3beab4e2, 0x72ef17ae, 0x390401a9, 0x0c567e97, 0x6c5a153a, 0xf5cb7d50, 0xb0499322, 0x0427d278, 0x26a153a1, 0xf323e40d, 0xd228a02e, 0xa9e082c6, 0xb7d561d0,
0x8ef22b5c, 0x52d63d00, 0xa7410a8e, 0x881a4d42, 0xd008ff26, 0x187f6523, 0x38b42a74, 0xeba6faaa, 0x605d0e44, 0x254e3cd1, 0x805b8603, 0xe9bea9d4, 0x004ca11a, 0xad7aa458, 0xe239b35c, 0x04ea1a59,
0xaa5ac580, 0x519b406c, 0x935092f1, 0x9749a001, 0x201e300d, 0x19457587, 0x3d949a00, 0xdf54a7a2, 0xa720aabb, 0x293e502e, 0xea662b5f, 0x2ade7079, 0x29360016, 0x0a4641f3, 0x002d5142, 0x4109d21d,
0xa8a00423, 0x690e8017, 0xccdb045b, 0xac011f5b, 0xeedaacff, 0x16d24f1e, 0x4c148d06, 0x600cd28f, 0xfb697b90, 0x108dea83, 0x4dce4948, 0x7ea471a0, 0x8291b0c3, 0x0024d0e9, 0x139548f0, 0x982918c6,
0x603d2506, 0x211fd27c, 0x6260a467, 0x20fcc8fe, 0x0da4e490, 0xb8a61106, 0x027d1097, 0xa8c01a40, 0x89829180, 0x0a75ccd8, 0xe9739c4c, 0x8dbb0627, 0x43a38807, 0xea4d8805, 0x82918074, 0x012ad049,
0xe03ee7e0, 0x05233108, 0x04305105, 0xfce40e24, 0x85052320, 0x1c02a2d0, 0x6094ea4d, 0x8484e4c9, 0x18012cd0, 0x03c031e6, 0xe58c148c, 0x4012fd17, 0x0a35d241, 0x1829185b, 0x1fd80543, 0x0a4601e6,
0x12a9f972, 0xc763bfec, 0x18078853, 0x854d1829, 0x01e81fd8, 0x51460a46, 0xee07f631, 0x0846dd02, 0xfb20a930, 0x230162c3, 0x84549905, 0x7900f3fe, 0x61829180, 0xb0fecc2a, 0x1a19908c, 0xa56df108,
0x17561fd9, 0x80305230, 0x365ff9e6, 0x9bef41f7, 0x63c04237, 0xb6d50bfd, 0xd013c74c, 0x03c6c289, 0xae35d61c, 0x0739f2ff, 0x0cd44e3b, 0x3536100d, 0x0a49001a, 0x63104fa0, 0xb9e220a4, 0xe08023c2,
0x375ec1ac, 0xe160a46d, 0x9ffd96bd, 0x2f3d4809, 0x2179a840, 0xfd8699f0, 0x0a7909df, 0xf8d4084a, 0xa54568fc, 0x07b8a37f, 0x2d68d77b, 0xaaefc14b, 0x70d0fec1, 0x068776b0, 0xfc362b36, 0x160e720b,
0x14a8d40c, 0xf8e9ae7c, 0x60d61a47, 0x49a9986f, 0xf2055829, 0x0526068f, 0x583cb06b, 0x068ff215, 0xb5a81956, 0xad75b14e, 0x01d23fa7, 0x25350214, 0x70579f05, 0xb59a37f6, 0x1b2f41af, 0x582921ac,
0xc7bfdb65, 0xa0465063, 0x0560a466, 0xf2887f36, 0xac1e5604, 0xa9b82909, 0x0cb7f0ed, 0x0d60f180, 0x2acfc148, 0x0713f8bd, 0x76a81b6c, 0xc55eb829, 0x2c03bfcb, 0xf9eea81a, 0xff54ead1, 0x873ed641,
0x2cd50344, 0xab543f05, 0x1f720ffa, 0x55ab05a4, 0x68566e0a, 0xd61a67eb, 0xa3f3307e, 0xfd5eaa41, 0xc907b9f9, 0x4e61570c, 0x4a4ab368, 0xfdace2ff, 0x5408b003, 0x67e8fcdd, 0x99f9dd15, 0x3e807b92,
0x8292ea91, 0x5bf8f7b5, 0x15409480, 0xdb1ac149, 0xe12069fd, 0xc148b540, 0xf36a2fcd, 0xfb58b7f1, 0x48a37d3c, 0xb7c14875, 0x47fb12b5, 0xd4b7e4f1, 0x4205501e, 0xaeaa8fe0, 0x38f208fc, 0x74ac18b5,
0xf155a80f, 0x0fb00417, 0xc0d0f454, 0x7f15dadb, 0x1ea49e41, 0xf9dcac21, 0x5135f7d1, 0x5ee611f8, 0x42a078da, 0x6fbbe0a5, 0xe01feacc, 0x70e4ca69, 0xcd810a25, 0xfb5d6b6f, 0x052b48b3, 0xd47e6f2a,
0x9c11fe6c, 0x5e16a1fb, 0x8aa1ff45, 0xf3a4be46, 0xa8895d24, 0x67e0a482, 0x79f1fb46, 0x2e34b7f2, 0xf0522950, 0xf68c5ffd, 0x1a7ee58b, 0x2908a817, 0xbf3195f8, 0x405ca918, 0xcc68297b, 0x1b34809f,
0xd052de81, 0x4f213f98, 0x1a044792, 0x307c0d0f, 0xe7392fd2, 0x433a4f3e, 0x5c14a9a2, 0x1b16a9ff, 0xf6b064be, 0x58826134, 0xeef82947, 0x01f6935b, 0x64b7ef70, 0x29374062, 0xfba6bef8, 0xe4f0a47d,
0x813b44eb, 0xeb629d4e, 0xe6367f6f, 0xd3dac097, 0x00f027bf, 0xf3e0a46d, 0x2fdaccef, 0x883ffb8d, 0xcc5a032f, 0x307fae8f, 0xd65c9f61, 0x01ab0b1e, 0xfdf052f5, 0x9bdca637, 0x173ee701, 0x4a940a0d,
0x98bf77c1, 0xdc665f72, 0x6dac5aff, 0xdc149944, 0xfd2cc9fc, 0x07ef7319, 0x92501f11, 0xfb7cda13, 0x0e7eb1a5, 0x40f889ac, 0x58d052ee, 0xc7ee573f, 0xa55c81ea, 0xcc5ff3e0, 0xe73b9fca, 0xafc6fe9e,
0x0524e517, 0xeefabfd7, 0x357d6353, 0xfafbddac, 0x61c1395f, 0xf9f0520e, 0x889a5f4f, 0x1ee72d4f, 0xb67223ff, 0xf8295b2c, 0xa637c3ee, 0xe707a7cc, 0x96c0ff1e, 0x251d9904, 0x37edfcf2, 0x5f759a3f,
0xfe3dce2b, 0xf9c23ffc, 0xe0a40ce2, 0x7cbf57fa, 0x9afcb269, 0xd7e9e4f2, 0xd9902f41, 0xd5feb629, 0xc118df4f, 0x1e4f3da7, 0x7fb7fe7f, 0x9ca1b4f3, 0x1fe781a1, 0xd8c2fdbe, 0xbb5882be, 0xefe0dc8f,
0x829702ff, 0xe9b1ef9b, 0x50afd48d, 0xf83f21ce, 0x9eafb7e1, 0xfc3627af, 0x7e1ff7bb, 0x9fcbeef9, 0x7d4f313f, 0xbfa7f055, 0x2f97fa7e, 0x97f6f9bf, 0xf57d9fb7, 0xb64dbbc7, 0xfbbe6c3b, 0x1f67fde3,
0xbbf6fa7e, 0xa9f2fe2f, 0xf3757bb1, 0xf27ebfa7, 0x7e9f8fc9, 0x08cfe9fa, 0xfe3f3ff4, 0x8d5fc9f8, 0x83060dc5, 0x183060c1, 0xc183060c, 0x0c183060, 0x60c18306, 0xff1f5430, 0x3cd2fa0f, 0x05b0d517,
0x000000b2, 0x4e454900, 0x6042ae44, 0x00000082,
};
const uint32_t uprof_512_len = 12813;
#endif //MICROPROFILE_EMBED_HTML

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"

View file

@ -0,0 +1,39 @@
#ifndef PCH_H
#define PCH_H
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <cstdint>
#include <assert.h>
#include <Xinput.h>
#include <vector>
#include <d3d11.h>
#include <d3d11_1.h>
#include <DirectXMath.h>
#endif //PCH_H

View file

@ -0,0 +1,553 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
#define NO_snprintf
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols and init macros */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compress_z z_compress_z
# define compress2_z z_compress2_z
# define compressBound z_compressBound
# define compressBound_z z_compressBound_z
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_combine_gen z_crc32_combine_gen
# define crc32_combine_gen64 z_crc32_combine_gen64
# define crc32_combine_op z_crc32_combine_op
# define crc32_z z_crc32_z
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateBound_z z_deflateBound_z
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateGetDictionary z_deflateGetDictionary
# define deflateInit z_deflateInit
# define deflateInit2 z_deflateInit2
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflateUsed z_deflateUsed
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzfread z_gzfread
# define gzfwrite z_gzfwrite
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzvprintf z_gzvprintf
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit z_inflateBackInit
# define inflateBackInit_ z_inflateBackInit_
# define inflateCodesUsed z_inflateCodesUsed
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetDictionary z_inflateGetDictionary
# define inflateGetHeader z_inflateGetHeader
# define inflateInit z_inflateInit
# define inflateInit2 z_inflateInit2
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateResetKeep z_inflateResetKeep
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateValidate z_inflateValidate
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# define inflate_fixed z_inflate_fixed
# ifndef Z_SOLO
# define uncompress z_uncompress
# define uncompress2 z_uncompress2
# define uncompress_z z_uncompress_z
# define uncompress2_z z_uncompress2_z
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#ifndef z_const
# ifdef ZLIB_CONST
# define z_const const
# else
# define z_const
# endif
#endif
#ifdef Z_SOLO
# ifdef _WIN64
typedef unsigned long long z_size_t;
# else
typedef unsigned long z_size_t;
# endif
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include <stddef.h>
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(__WATCOMC__) || defined(__GO32__) || \
(defined(_LARGEFILE64_SOURCE) && !defined(_WIN32))
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#elif defined(__MINGW32__)
# define z_off64_t long long
#elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
#elif defined(__GO32__)
# define z_off64_t offset_t
#else
# define z_off64_t z_off_t
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,359 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Storage.h"
#include "STO_Main.h"
C4JStorage StorageManager;
XMARKETPLACE_CONTENTOFFER_INFO InternalContentOfferInfo;
C4JStorage::C4JStorage() {}
void C4JStorage::Tick(void)
{
InternalStorageManager.Tick();
}
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad,
int (*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam,
C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton)
{
return EMessage_Undefined;
}
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult()
{
return EMessage_Undefined;
}
bool C4JStorage::SetSaveDevice(int (*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice)
{
return true;
}
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize,
int (*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID)
{
InternalStorageManager.Init(Func, lpParam, szGroupID);
}
void C4JStorage::ResetSaveData()
{
InternalStorageManager.m_SaveGame.ResetSaveData();
}
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName)
{
;
}
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
{
InternalStorageManager.m_SaveGame.SetSaveTitle(pwchDefaultSaveName);
}
LPCWSTR C4JStorage::GetSaveTitle()
{
return InternalStorageManager.m_SaveGame.GetSaveTitle();
}
bool C4JStorage::GetSaveUniqueNumber(INT *piVal)
{
return InternalStorageManager.m_SaveGame.GetSaveUniqueNumber(piVal);
}
bool C4JStorage::GetSaveUniqueFilename(char *pszName)
{
return InternalStorageManager.m_SaveGame.GetSaveUniqueFilename(pszName);
}
void C4JStorage::SetSaveUniqueFilename(char *szFilename)
{
InternalStorageManager.m_SaveGame.SetSaveUniqueFilename(szFilename);
}
void C4JStorage::SetState(ESaveGameControlState eControlState, int (*Func)(LPVOID, const bool), LPVOID lpParam)
{
;
}
void C4JStorage::SetSaveDisabled(bool bDisable)
{
InternalStorageManager.m_SaveGame.SetSaveDisabled(bDisable);
}
bool C4JStorage::GetSaveDisabled(void)
{
return InternalStorageManager.m_SaveGame.GetSaveDisabled();
}
unsigned int C4JStorage::GetSaveSize()
{
return InternalStorageManager.m_SaveGame.GetSaveSize();
}
void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes)
{
InternalStorageManager.m_SaveGame.GetSaveData(pvData, puiBytes);
}
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes)
{
return InternalStorageManager.m_SaveGame.AllocateSaveData(uiBytes);
}
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes)
{
InternalStorageManager.m_SaveGame.SetSaveImages(pbThumbnail, dwThumbnailBytes, pbImage, dwImageBytes, pbTextData, dwTextDataBytes);
}
void C4JStorage::SetDefaultImages(PBYTE pbOptionsImage, DWORD dwOptionsImageBytes, PBYTE pbSaveImage, DWORD dwSaveImageBytes, PBYTE pbSaveThumbnail, DWORD dwSaveThumbnailBytes)
{
InternalStorageManager.m_SaveGame.SetDefaultImages(pbOptionsImage, dwOptionsImageBytes, pbSaveImage, dwSaveImageBytes, pbSaveThumbnail, dwSaveThumbnailBytes);
}
void C4JStorage::GetDefaultSaveImage(PBYTE *ppbSaveImage, DWORD *pdwSaveImageBytes)
{
InternalStorageManager.m_SaveGame.GetDefaultSaveImage(ppbSaveImage, pdwSaveImageBytes);
}
void C4JStorage::GetDefaultSaveThumbnail(PBYTE *ppbSaveThumbnail, DWORD *pdwSaveThumbnailBytes)
{
InternalStorageManager.m_SaveGame.GetDefaultSaveThumbnail(ppbSaveThumbnail, pdwSaveThumbnailBytes);
}
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.SaveSaveData(Func, lpParam);
}
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam)
{
InternalStorageManager.m_SaveGame.CopySaveDataToNewSave(pbThumbnail, cbThumbnail, wchNewName, Func, lpParam);
}
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected)
{
;
}
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad)
{
return true;
}
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists)
{
return InternalStorageManager.m_SaveGame.DoesSaveExist(pbExists);
}
bool C4JStorage::EnoughSpaceForAMinSaveGame()
{
return true;
}
void C4JStorage::SetMaxSaves(int iMaxC)
{
// Windows64: no limit enforced, but store for compatibility
(void)iMaxC;
}
void C4JStorage::SetIncompleteSaveCallback(void (*Func)(LPVOID, const ESaveIncompleteType, int blocksRequired), LPVOID param)
{
// Windows64: local filesystem, no incomplete-save recovery needed
(void)Func;
(void)param;
}
void C4JStorage::ContinueIncompleteOperation()
{
// Windows64: no-op (saves complete synchronously)
}
C4JStorage::ESaveGameState C4JStorage::GetSaveState()
{
// Windows64: saves are synchronous, always idle
return C4JStorage::ESaveGame_Idle;
}
void C4JStorage::SetSaveMessageVPosition(float fY)
{
;
}
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
char *pszSavePackName)
{
return InternalStorageManager.m_SaveGame.GetSavesInfo(iPad, Func, lpParam, pszSavePackName);
}
PSAVE_DETAILS C4JStorage::ReturnSavesInfo()
{
return InternalStorageManager.m_SaveGame.ReturnSavesInfo();
}
void C4JStorage::ClearSavesInfo()
{
InternalStorageManager.m_SaveGame.ClearSavesInfo();
}
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,
int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.LoadSaveDataThumbnail(pSaveInfo, Func, lpParam);
}
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData)
{
;
}
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes)
{
;
}
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.LoadSaveData(pSaveInfo, Func, lpParam);
}
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.DeleteSaveData(pSaveInfo, Func, lpParam);
}
C4JStorage::ESaveGameState C4JStorage::RenameSaveData(int iRenameIndex, uint16_t *pui16NewName, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
return InternalStorageManager.m_SaveGame.RenameSaveData(iRenameIndex, pui16NewName, Func, lpParam);
}
void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam)
{
;
}
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot)
{
InternalStorageManager.m_DLC.SetPackageRoot(pszDLCRoot);
}
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
{
return EDLC_Idle;
}
DWORD C4JStorage::CancelGetDLCOffers()
{
return 0;
}
void C4JStorage::ClearDLCOffers()
{
;
}
XMARKETPLACE_CONTENTOFFER_INFO &C4JStorage::GetOffer(DWORD dw)
{
return InternalContentOfferInfo;
}
int C4JStorage::GetOfferCount()
{
return 0;
}
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int (*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial)
{
return 0;
}
DWORD C4JStorage::GetAvailableDLCCount(int iPad)
{
return InternalStorageManager.m_DLC.GetAvailableDLCCount(iPad);
}
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam)
{
return InternalStorageManager.m_DLC.GetInstalledDLC(iPad, Func, lpParam);
}
XCONTENT_DATA &C4JStorage::GetDLC(DWORD dw)
{
return InternalStorageManager.m_DLC.GetDLC(dw);
}
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
{
return InternalStorageManager.m_DLC.MountInstalledDLC(iPad, dwDLC, Func, lpParam, szMountDrive);
}
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive)
{
return InternalStorageManager.m_DLC.UnmountInstalledDLC(szMountDrive);
}
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
{
InternalStorageManager.m_DLC.GetMountedDLCFileList(szMountDrive, fileList);
}
std::string C4JStorage::GetMountedPath(std::string szMount)
{
return InternalStorageManager.m_DLC.GetMountedPath(szMount);
}
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize,
int (*Func)(LPVOID, WCHAR *, int, bool, int), LPVOID lpParam, int iAction)
{
return ETMSStatus_Idle;
}
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize)
{
return true;
}
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename)
{
return true;
}
void C4JStorage::StoreTMSPathName(WCHAR *pwchName)
{
;
}
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,
LPCSTR szFilename, int (*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam,
int iUserData)
{
return ETMSStatus_Idle;
}
unsigned int C4JStorage::CRC(unsigned char *buf, int len)
{
return 0;
}

View file

@ -0,0 +1,271 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "STO_DLC.h"
#include "STO_Main.h"
XCONTENT_DATA &CDLC::GetDLC(DWORD dw)
{
return m_vInstalledDLCs[dw];
}
CDLC::CDLC(void) : m_vInstalledDLCs(), m_szMountPath(), m_vDLCDriveMappings()
{
m_iHasNewInstalledDLCs = false;
dword0 = 0;
dwordC0 = 0;
m_iHasNewMountedDLCs = false; // @Patoke fix
ZeroMemory(m_szDLCProductCode, sizeof(m_szDLCProductCode));
ZeroMemory(m_szProductUpgradeKey, sizeof(m_szProductUpgradeKey));
}
C4JStorage::EDLCStatus CDLC::GetOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
{
return C4JStorage::EDLC_NoOffers;
}
void CDLC::ClearOffers()
{
;
}
C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam)
{
if (m_iHasNewInstalledDLCs)
{
return C4JStorage::EDLC_Pending;
}
m_pInstalledDLCFunc = Func;
m_pInstalledDLCParam = lpParam;
m_iHasNewInstalledDLCs = true;
bool ret = false;
DWORD atts = GetFileAttributesA("Windows64Media/DLC");
if (atts == -1)
{
atts = GetFileAttributesA("Windows64/DLC");
ret = true;
}
bool validDir = atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY);
if (!validDir)
{
InternalStorageManager.DebugPrintf("No DLC directory, can't have any DLC installed\n");
return C4JStorage::EDLC_Error;
}
_WIN32_FIND_DATAA hFind;
HANDLE hFindFile;
if (ret)
{
hFindFile = FindFirstFileA("Windows64/DLC/*", &hFind);
}
else
{
hFindFile = FindFirstFileA("Windows64Media/DLC/*", &hFind);
}
if (hFindFile != (HANDLE)-1LL)
{
do
{
atts = hFind.dwFileAttributes;
bool isArt = hFind.dwFileAttributes != -1 && (hFind.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
if (isArt && hFind.cFileName[0] != '.')
{
XCONTENT_DATA data;
if (ret)
{
sprintf(data.szFileName, "Windows64/DLC/%s", hFind.cFileName);
}
else
{
sprintf(data.szFileName, "Windows64Media/DLC/%s", hFind.cFileName);
}
swprintf(data.szDisplayName, 256, L"%s", hFind.cFileName);
int displayNameLen = wcslen(data.szDisplayName);
data.DeviceID = 0;
data.dwContentType = 0;
AddInstalled(&data);
}
} while (FindNextFileA(hFindFile, &hFind));
FindClose(hFindFile);
}
return C4JStorage::EDLC_Idle;
}
DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
{
this->m_pMountedDLCFunc = Func;
this->m_pMountedDLCParam = lpParam;
if (szMountDrive)
{
m_szMountPath = szMountDrive;
}
else
{
m_szMountPath = this->m_szPackageRoot;
}
this->m_uiCurrentMappedDLC = dwDLC;
char *dlcdirPath = m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName;
m_vDLCDriveMappings.push_back(DriveMapping(dlcdirPath, m_szMountPath));
m_iHasNewMountedDLCs = true;
return 997;
}
DWORD CDLC::UnmountInstalledDLC(LPCSTR szMountDrive)
{
LPCSTR szDrive = nullptr;
if (szMountDrive)
{
szDrive = szMountDrive;
}
else
{
szDrive = this->m_szPackageRoot;
}
for (int i = 0; i < this->m_vDLCDriveMappings.size(); i++)
{
if (m_vDLCDriveMappings[i].m_szDirectoryPath == szDrive)
{
m_vDLCDriveMappings.erase(m_vDLCDriveMappings.begin() + i);
return 0;
}
}
return 0;
}
void CDLC::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
{
char *dlcdirPath = new char[256];
sprintf(dlcdirPath, "%s/*", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName);
_WIN32_FIND_DATAA atts;
HANDLE hFind = FindFirstFileA(dlcdirPath, &atts);
if (hFind != (HANDLE)-1LL)
{
do
{
if (atts.dwFileAttributes == -1 || (atts.dwFileAttributes & 0x10) != 0x10)
{
char dir[256];
sprintf(dir, "%s/%s", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName, atts.cFileName);
fileList.push_back(dir);
}
} while (FindNextFileA(hFind, &atts));
FindClose(hFind);
}
delete[] dlcdirPath;
}
std::string CDLC::GetMountedPath(std::string szMount)
{
for (int ch = 0; ch < szMount.size(); ++ch)
{
if (szMount[ch] == '/' || szMount[ch] == '\\')
{
return "";
}
if (szMount[ch] == ':')
{
std::string driveName = szMount.substr(0, ch);
for (int i = 0; i < m_vDLCDriveMappings.size(); ++i)
{
if (m_vDLCDriveMappings[i].m_szDirectoryPath == driveName)
{
std::string newPath = m_vDLCDriveMappings[i].m_szMountPath;
newPath.append(szMount.substr(ch + 1, -1));
return newPath;
}
}
break;
}
}
return "";
}
void CDLC::SetDLCProductCode(const char *szProductCode)
{
strcpy(m_szDLCProductCode, szProductCode);
}
void CDLC::SetProductUpgradeKey(const char *szProductCode)
{
strcpy(m_szProductUpgradeKey, szProductCode);
}
int CDLC::GetAvailableDLCCount(int iPad)
{
return 0;
}
void CDLC::SetPackageRoot(char *pszDLCRoot)
{
strcpy(this->m_szPackageRoot, pszDLCRoot);
}
void CDLC::Tick(void)
{
if (m_iHasNewInstalledDLCs)
{
m_iHasNewInstalledDLCs = false;
m_pInstalledDLCFunc(m_pInstalledDLCParam, m_vInstalledDLCs.size(), 0);
}
if (m_iHasNewMountedDLCs)
{
m_iHasNewMountedDLCs = false;
m_pMountedDLCFunc(m_pMountedDLCParam, 0, 0, dword94);
}
}
void CDLC::AddInstalled(XCONTENT_DATA *data)
{
m_vInstalledDLCs.push_back(*data);
}
DWORD CDLC::CancelOffers(void)
{
return 0;
}

View file

@ -0,0 +1,81 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Storage.h"
class CDLC
{
public:
struct DriveMapping
{
DriveMapping(std::string szDirectoryPath, std::string szMountPath) : m_szDirectoryPath(szDirectoryPath), m_szMountPath(szMountPath)
{
;
}
std::string m_szDirectoryPath;
std::string m_szMountPath;
};
XCONTENT_DATA &GetDLC(DWORD dw);
CDLC(void);
C4JStorage::EDLCStatus GetOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam,
DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
void ClearOffers();
C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam);
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL);
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
void GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList);
std::string GetMountedPath(std::string szMount);
void SetDLCProductCode(const char *szProductCode);
void SetProductUpgradeKey(const char *szProductCode);
int GetAvailableDLCCount(int iPad);
void SetPackageRoot(char *pszDLCRoot);
void Tick(void);
void AddInstalled(XCONTENT_DATA *data);
DWORD CancelOffers(void);
DWORD dword0;
int (*m_pInstalledDLCFunc)(LPVOID, int, int);
LPVOID m_pInstalledDLCParam;
BYTE gap18[16];
int m_iHasNewInstalledDLCs;
std::vector<XCONTENT_DATA> m_vInstalledDLCs;
BYTE gap48[4];
DWORD m_iHasNewMountedDLCs;
int (*m_pMountedDLCFunc)(LPVOID, int, DWORD, DWORD);
LPVOID m_pMountedDLCParam;
std::string m_szMountPath;
DWORD m_uiCurrentMappedDLC;
DWORD dword94;
char m_szPackageRoot[40];
DWORD dwordC0;
std::vector<DriveMapping> m_vDLCDriveMappings;
char m_szDLCProductCode[16];
char m_szProductUpgradeKey[60];
};

View file

@ -0,0 +1,94 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "STO_Main.h"
#include "4J_Storage.h"
CStorage InternalStorageManager;
CStorage::CStorage(void)
{
m_SaveGame = CSaveGame();
m_DLC = CDLC();
}
void CStorage::Init(int (*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID) {}
void CStorage::Tick(void)
{
m_DLC.Tick();
}
unsigned int CStorage::CRC(unsigned char *buf, int len)
{
return ~UpdateCRC(0xFFFFFFFF, buf, len);
}
void CStorage::MakeCRCTable(void)
{
for (int c = 0; c < 256; ++c)
{
unsigned int k = c;
for (int n = 0; n < 8; ++n)
{
if ((k & 1) != 0)
{
k = (k >> 1) ^ 0xEDB88320;
}
else
{
k >>= 1;
}
}
m_CRCTable[c] = k;
}
m_bHasCRCTable = true;
}
unsigned int CStorage::UpdateCRC(unsigned int crc, unsigned __int8 *buf, int len)
{
if (!m_bHasCRCTable)
{
MakeCRCTable();
}
for (int c = 0; c < len; ++c)
{
crc = (crc >> 8) ^ m_CRCTable[(unsigned __int8)(buf[c] ^ crc)];
}
return crc;
}
void CStorage::DebugPrintf(const char *szFormat, ...)
{
char buf[1024];
va_list va;
va_start(va, szFormat);
vsnprintf(buf, 1024, szFormat, va);
va_end(va);
}

View file

@ -0,0 +1,50 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "STO_DLC.h"
#include "STO_SaveGame.h"
class CStorage
{
public:
CStorage(void);
void Init(int (*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID);
void Tick(void);
unsigned int CRC(unsigned char *buf, int len);
void MakeCRCTable(void);
unsigned int UpdateCRC(unsigned int crc, unsigned __int8 *buf, int len);
void DebugPrintf(const char *szFormat, ...);
BYTE gap0[8];
CSaveGame m_SaveGame;
CDLC m_DLC;
BYTE gap278[0x10];
DWORD m_CRCTable[256];
bool m_bHasCRCTable;
};
// Singleton
extern CStorage InternalStorageManager;

View file

@ -0,0 +1,812 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "STO_SaveGame.h"
#include <stdio.h>
static unsigned long s_pngCrcTable[256];
static bool s_pngCrcTableReady = false;
static void BuildPngCrcTable()
{
for (unsigned int n = 0; n < 256; n++)
{
unsigned long c = n;
for (int k = 0; k < 8; k++)
c = (c & 1) ? (0xEDB88320L ^ (c >> 1)) : (c >> 1);
s_pngCrcTable[n] = c;
}
s_pngCrcTableReady = true;
}
static unsigned long PngCrc32(const unsigned char *buf, unsigned int len)
{
if (!s_pngCrcTableReady) BuildPngCrcTable();
unsigned long c = 0xFFFFFFFFL;
for (unsigned int i = 0; i < len; i++)
c = s_pngCrcTable[(c ^ buf[i]) & 0xFF] ^ (c >> 8);
return c ^ 0xFFFFFFFFL;
}
static inline unsigned int WriteBE32(unsigned int v)
{
return ((v >> 24) & 0xFF) |
((v >> 8) & 0xFF00) |
((v << 8) & 0xFF0000) |
((v << 24) & 0xFF000000);
}
static void GetGameHDDPath(char *outPath, int maxLen)
{
char curDir[256];
GetCurrentDirectoryA(sizeof(curDir), curDir);
sprintf_s(outPath, maxLen, "%s\\Windows64\\GameHDD", curDir);
}
CSaveGame::CSaveGame()
{
m_pSaveData = nullptr;
m_uiSaveSize = 0;
m_bIsSafeDisabled = false;
ZeroMemory(m_szSaveUniqueName, sizeof(m_szSaveUniqueName));
ZeroMemory(m_wszSaveTitle, sizeof(m_wszSaveTitle));
m_pSaveDetails = nullptr;
m_bHasSaveDetails = false;
m_pbThumbnail = nullptr;
m_dwThumbnailBytes = 0;
m_pbDefaultThumbnail = nullptr;
m_dwDefaultThumbnailBytes = 0;
m_pbDefaultSaveImage = nullptr;
m_dwDefaultSaveImageBytes = 0;
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char win64Path[256];
char curDir[256];
GetCurrentDirectoryA(sizeof(curDir), curDir);
sprintf_s(win64Path, sizeof(win64Path), "%s\\Windows64", curDir);
CreateDirectoryA(win64Path, 0);
CreateDirectoryA(gameHDDPath, 0);
}
void CSaveGame::SetSaveDisabled(bool bDisable)
{
m_bIsSafeDisabled = bDisable;
}
bool CSaveGame::GetSaveDisabled(void)
{
return m_bIsSafeDisabled;
}
void CSaveGame::ResetSaveData()
{
free(m_pSaveData);
m_pSaveData = nullptr;
m_uiSaveSize = 0;
}
C4JStorage::ESaveGameState CSaveGame::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
char *pszSavePackName)
{
WIN32_FIND_DATAA findFileData;
WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer;
if (!m_pSaveDetails)
{
m_pSaveDetails = new SAVE_DETAILS();
memset(m_pSaveDetails, 0, sizeof(SAVE_DETAILS));
}
delete[] m_pSaveDetails->SaveInfoA;
m_pSaveDetails->SaveInfoA = nullptr;
m_pSaveDetails->iSaveC = 0;
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char searchPattern[280];
sprintf_s(searchPattern, sizeof(searchPattern), "%s\\*", gameHDDPath);
int resultCount = 0;
HANDLE h = FindFirstFileExA(searchPattern, FindExInfoStandard, &findFileData, FindExSearchLimitToDirectories, 0, 0);
if (h == INVALID_HANDLE_VALUE)
{
DWORD error = GetLastError();
printf("Error finding save dirs: 0x%08x\n", error);
}
else
{
do
{
if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 &&
strcmp(findFileData.cFileName, ".") != 0 &&
strcmp(findFileData.cFileName, "..") != 0)
{
char saveFilePath[512];
sprintf_s(saveFilePath, sizeof(saveFilePath), "%s\\%s\\saveData.ms", gameHDDPath, findFileData.cFileName);
if (GetFileAttributesA(saveFilePath) != INVALID_FILE_ATTRIBUTES)
{
resultCount++;
}
}
} while (FindNextFileA(h, &findFileData));
FindClose(h);
}
if (resultCount > 0)
{
m_pSaveDetails->SaveInfoA = new SAVE_INFO[resultCount];
memset(m_pSaveDetails->SaveInfoA, 0, sizeof(SAVE_INFO) * resultCount);
m_pSaveDetails->iSaveC = 0;
int i = 0;
HANDLE fi = FindFirstFileExA(searchPattern, FindExInfoStandard, &findFileData, FindExSearchLimitToDirectories, 0, 0);
if (fi != INVALID_HANDLE_VALUE)
{
do
{
if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 &&
strcmp(findFileData.cFileName, ".") != 0 &&
strcmp(findFileData.cFileName, "..") != 0)
{
char saveFilePath[512];
sprintf_s(saveFilePath, sizeof(saveFilePath), "%s\\%s\\saveData.ms", gameHDDPath, findFileData.cFileName);
if (GetFileAttributesA(saveFilePath) == INVALID_FILE_ATTRIBUTES)
continue;
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, findFileData.cFileName);
char saveDirPath[512];
sprintf_s(saveDirPath, sizeof(saveDirPath), "%s\\%s", gameHDDPath, findFileData.cFileName);
char titleBuf[MAX_DISPLAYNAME_LENGTH];
if (LoadTitleFromFile(saveDirPath, titleBuf, sizeof(titleBuf)))
{
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, titleBuf);
}
else
{
// fallback: use the folder name as the display title
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, findFileData.cFileName);
}
GetFileAttributesExA(saveFilePath, GetFileExInfoStandard, &fileInfoBuffer);
m_pSaveDetails->SaveInfoA[i].metaData.dataSize = fileInfoBuffer.nFileSizeLow;
char thumbFilePath[512];
sprintf_s(thumbFilePath, sizeof(thumbFilePath), "%s\\%s\\saveThumbnail.png", gameHDDPath, findFileData.cFileName);
WIN32_FILE_ATTRIBUTE_DATA thumbInfo;
if (GetFileAttributesExA(thumbFilePath, GetFileExInfoStandard, &thumbInfo))
{
m_pSaveDetails->SaveInfoA[i].metaData.thumbnailSize = thumbInfo.nFileSizeLow;
}
FILETIME ft = fileInfoBuffer.ftLastWriteTime;
ULARGE_INTEGER ull;
ull.LowPart = ft.dwLowDateTime;
ull.HighPart = ft.dwHighDateTime;
m_pSaveDetails->SaveInfoA[i].metaData.modifiedTime = (time_t)((ull.QuadPart - 116444736000000000ULL) / 10000000ULL);
i++;
m_pSaveDetails->iSaveC++;
}
} while (FindNextFileA(fi, &findFileData));
FindClose(fi);
}
}
m_bHasSaveDetails = true;
if (Func)
{
Func(lpParam, m_pSaveDetails, true);
}
return C4JStorage::ESaveGame_Idle;
}
PSAVE_DETAILS CSaveGame::ReturnSavesInfo()
{
if (m_bHasSaveDetails)
return m_pSaveDetails;
else
return nullptr;
}
void CSaveGame::ClearSavesInfo()
{
m_bHasSaveDetails = false;
if (m_pSaveDetails)
{
if (m_pSaveDetails->SaveInfoA)
{
delete[] m_pSaveDetails->SaveInfoA;
m_pSaveDetails->SaveInfoA = nullptr;
m_pSaveDetails->iSaveC = 0;
}
delete m_pSaveDetails;
m_pSaveDetails = 0;
}
}
C4JStorage::ESaveGameState CSaveGame::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,
int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
{
PBYTE pbThumbnail = nullptr;
DWORD dwThumbnailBytes = 0;
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char thumbPath[512];
sprintf_s(thumbPath, sizeof(thumbPath), "%s\\%s\\saveThumbnail.png", gameHDDPath, pSaveInfo->UTF8SaveFilename);
HANDLE h = CreateFileA(thumbPath, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE)
{
DWORD fileSize = GetFileSize(h, NULL);
if (fileSize != 0 && fileSize != INVALID_FILE_SIZE)
{
pbThumbnail = (PBYTE)malloc(fileSize);
if (pbThumbnail)
{
DWORD bytesRead = 0;
if (ReadFile(h, pbThumbnail, fileSize, &bytesRead, 0) && bytesRead == fileSize)
{
dwThumbnailBytes = fileSize;
}
else
{
free(pbThumbnail);
pbThumbnail = nullptr;
}
}
}
CloseHandle(h);
}
Func(lpParam, pbThumbnail, dwThumbnailBytes);
if (pbThumbnail)
{
free(pbThumbnail);
}
return C4JStorage::ESaveGame_GetSaveThumbnail;
}
C4JStorage::ESaveGameState CSaveGame::LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
{
SetSaveUniqueFilename(pSaveInfo->UTF8SaveFilename);
if (m_pSaveData)
{
free(m_pSaveData);
m_pSaveData = nullptr;
}
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char saveDirPath[512];
sprintf_s(saveDirPath, sizeof(saveDirPath), "%s\\%s", gameHDDPath, m_szSaveUniqueName);
char titleBuf[MAX_DISPLAYNAME_LENGTH];
if (LoadTitleFromFile(saveDirPath, titleBuf, sizeof(titleBuf)))
{
MultiByteToWideChar(CP_UTF8, 0, titleBuf, -1, m_wszSaveTitle, MAX_DISPLAYNAME_LENGTH);
}
char fileName[512];
sprintf_s(fileName, sizeof(fileName), "%s\\saveData.ms", saveDirPath);
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
if (!GetFileAttributesExA(fileName, GetFileExInfoStandard, &fileInfo))
{
if (Func) Func(lpParam, 0, false);
return C4JStorage::ESaveGame_Idle;
}
m_uiSaveSize = fileInfo.nFileSizeLow;
m_pSaveData = malloc(m_uiSaveSize);
HANDLE h = CreateFileA(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
bool success = false;
if (h != INVALID_HANDLE_VALUE)
{
DWORD bytesRead = 0;
BOOL res = ReadFile(h, m_pSaveData, m_uiSaveSize, &bytesRead, 0);
_ASSERT(res && bytesRead == m_uiSaveSize);
CloseHandle(h);
success = (res && bytesRead == m_uiSaveSize);
}
if (!success && m_pSaveData)
{
free(m_pSaveData);
m_pSaveData = nullptr;
m_uiSaveSize = 0;
}
if (Func)
{
Func(lpParam, 0, success);
}
return C4JStorage::ESaveGame_Idle;
}
unsigned int CSaveGame::GetSaveSize()
{
return m_uiSaveSize;
}
void CSaveGame::GetSaveData(void *pvData, unsigned int *puiBytes)
{
if (pvData)
{
memmove(pvData, m_pSaveData, m_uiSaveSize);
*puiBytes = m_uiSaveSize;
}
else
{
*puiBytes = 0;
}
}
// @Patoke add
bool CSaveGame::GetSaveUniqueNumber(INT *piVal)
{
if (m_szSaveUniqueName[0] == '\0')
{
return 0;
}
int year, month, day, hour, minute;
sscanf(&m_szSaveUniqueName[4], "%02d%02d%02d%02d%02d", &year, &month, &day, &hour, &minute);
*piVal = 2678400 * year + 86400 * month + 3600 * day + 60 * hour + minute;
return true;
}
// @Patoke add
bool CSaveGame::GetSaveUniqueFilename(char *pszName)
{
if (m_szSaveUniqueName[0] == '\0')
{
return false;
}
memset(pszName, 0, 14);
for (int i = 0; i < 12; i++)
{
pszName[i] = m_szSaveUniqueName[i + 2];
}
return true;
}
void CSaveGame::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
{
if (m_szSaveUniqueName[0] == '\0')
{
CreateSaveUniqueName();
}
wcscpy_s(m_wszSaveTitle, MAX_DISPLAYNAME_LENGTH, pwchDefaultSaveName);
}
LPCWSTR CSaveGame::GetSaveTitle()
{
return m_wszSaveTitle;
}
PVOID CSaveGame::AllocateSaveData(unsigned int uiBytes)
{
free(m_pSaveData);
m_pSaveData = malloc(uiBytes);
if (m_pSaveData)
{
m_uiSaveSize = uiBytes;
}
return m_pSaveData;
}
void CSaveGame::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes)
{
if (m_pbThumbnail)
{
free(m_pbThumbnail);
m_pbThumbnail = nullptr;
m_dwThumbnailBytes = 0;
}
if (pbThumbnail && dwThumbnailBytes > 0)
{
const DWORD kInsertOffset = 33; // end of PNG sig + IHDR
if (pbTextData && dwTextDataBytes > 0 && dwThumbnailBytes > kInsertOffset)
{
const DWORD chunkOverhead = 4 + 4 + 4;
const DWORD chunkTotal = chunkOverhead + dwTextDataBytes;
const DWORD newSize = dwThumbnailBytes + chunkTotal;
m_pbThumbnail = (PBYTE)malloc(newSize);
if (m_pbThumbnail)
{
memcpy(m_pbThumbnail, pbThumbnail, kInsertOffset);
PBYTE p = m_pbThumbnail + kInsertOffset;
*(unsigned int *)p = WriteBE32(dwTextDataBytes);
p += 4;
p[0] = 't'; p[1] = 'E'; p[2] = 'X'; p[3] = 't';
p += 4;
memcpy(p, pbTextData, dwTextDataBytes);
p += dwTextDataBytes;
unsigned long crc = PngCrc32(m_pbThumbnail + kInsertOffset + 4,
4 + dwTextDataBytes);
*(unsigned int *)p = WriteBE32((unsigned int)crc);
memcpy(m_pbThumbnail + kInsertOffset + chunkTotal,
pbThumbnail + kInsertOffset,
dwThumbnailBytes - kInsertOffset);
m_dwThumbnailBytes = newSize;
}
}
else
{
m_pbThumbnail = (PBYTE)malloc(dwThumbnailBytes);
if (m_pbThumbnail)
{
memcpy(m_pbThumbnail, pbThumbnail, dwThumbnailBytes);
m_dwThumbnailBytes = dwThumbnailBytes;
}
}
}
}
C4JStorage::ESaveGameState CSaveGame::SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam)
{
if (!m_pSaveData || m_uiSaveSize == 0)
{
if (Func) Func(lpParam, false);
return C4JStorage::ESaveGame_Idle;
}
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char saveDirPath[512];
sprintf_s(saveDirPath, sizeof(saveDirPath), "%s\\%s", gameHDDPath, m_szSaveUniqueName);
CreateDirectoryA(saveDirPath, 0);
char saveFilePath[512];
sprintf_s(saveFilePath, sizeof(saveFilePath), "%s\\saveData.ms", saveDirPath);
HANDLE h = CreateFileA(saveFilePath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (h == INVALID_HANDLE_VALUE)
{
if (Func) Func(lpParam, false);
return C4JStorage::ESaveGame_Idle;
}
DWORD bytesWritten = 0;
BOOL res = WriteFile(h, m_pSaveData, m_uiSaveSize, &bytesWritten, 0);
CloseHandle(h);
SaveTitleFile(saveDirPath);
if (m_pbThumbnail && m_dwThumbnailBytes > 0)
{
char thumbPath[512];
sprintf_s(thumbPath, sizeof(thumbPath), "%s\\saveThumbnail.png", saveDirPath);
HANDLE hThumb = CreateFileA(thumbPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (hThumb != INVALID_HANDLE_VALUE)
{
DWORD thumbWritten = 0;
WriteFile(hThumb, m_pbThumbnail, m_dwThumbnailBytes, &thumbWritten, 0);
CloseHandle(hThumb);
}
free(m_pbThumbnail);
m_pbThumbnail = nullptr;
m_dwThumbnailBytes = 0;
}
bool success = (res && bytesWritten == m_uiSaveSize);
if (Func) Func(lpParam, success);
return C4JStorage::ESaveGame_Idle;
}
C4JStorage::ESaveGameState CSaveGame::DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char saveDirPath[512];
sprintf_s(saveDirPath, sizeof(saveDirPath), "%s\\%s", gameHDDPath, pSaveInfo->UTF8SaveFilename);
char searchPattern[512];
sprintf_s(searchPattern, sizeof(searchPattern), "%s\\*", saveDirPath);
WIN32_FIND_DATAA findData;
HANDLE hFind = FindFirstFileA(searchPattern, &findData);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
char filePath[512];
sprintf_s(filePath, sizeof(filePath), "%s\\%s", saveDirPath, findData.cFileName);
DeleteFileA(filePath);
}
} while (FindNextFileA(hFind, &findData));
FindClose(hFind);
}
RemoveDirectoryA(saveDirPath);
bool success = (GetFileAttributesA(saveDirPath) == INVALID_FILE_ATTRIBUTES);
if (Func) Func(lpParam, success);
return C4JStorage::ESaveGame_Idle;
}
C4JStorage::ESaveGameState CSaveGame::DoesSaveExist(bool *pbExists)
{
if (m_szSaveUniqueName[0] == '\0')
{
*pbExists = false;
return C4JStorage::ESaveGame_Idle;
}
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char saveFilePath[512];
sprintf_s(saveFilePath, sizeof(saveFilePath), "%s\\%s\\saveData.ms", gameHDDPath, m_szSaveUniqueName);
*pbExists = (GetFileAttributesA(saveFilePath) != INVALID_FILE_ATTRIBUTES);
return C4JStorage::ESaveGame_Idle;
}
void CSaveGame::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam)
{
char oldUniqueName[32];
strcpy_s(oldUniqueName, m_szSaveUniqueName);
CreateSaveUniqueName();
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char newSaveDirPath[512];
sprintf_s(newSaveDirPath, sizeof(newSaveDirPath), "%s\\%s", gameHDDPath, m_szSaveUniqueName);
CreateDirectoryA(newSaveDirPath, 0);
char oldSaveFile[512], newSaveFile[512];
sprintf_s(oldSaveFile, sizeof(oldSaveFile), "%s\\%s\\saveData.ms", gameHDDPath, oldUniqueName);
sprintf_s(newSaveFile, sizeof(newSaveFile), "%s\\saveData.ms", newSaveDirPath);
CopyFileA(oldSaveFile, newSaveFile, FALSE);
char oldThumbFile[512], newThumbFile[512];
sprintf_s(oldThumbFile, sizeof(oldThumbFile), "%s\\%s\\saveThumbnail.png", gameHDDPath, oldUniqueName);
sprintf_s(newThumbFile, sizeof(newThumbFile), "%s\\saveThumbnail.png", newSaveDirPath);
CopyFileA(oldThumbFile, newThumbFile, FALSE);
if (pbThumbnail && cbThumbnail > 0)
{
HANDLE hThumb = CreateFileA(newThumbFile, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (hThumb != INVALID_HANDLE_VALUE)
{
DWORD thumbWritten = 0;
WriteFile(hThumb, pbThumbnail, cbThumbnail, &thumbWritten, 0);
CloseHandle(hThumb);
}
}
if (wchNewName)
{
wcscpy_s(m_wszSaveTitle, MAX_DISPLAYNAME_LENGTH, wchNewName);
}
SaveTitleFile(newSaveDirPath);
bool success = (GetFileAttributesA(newSaveFile) != INVALID_FILE_ATTRIBUTES);
if (Func) Func(lpParam, success);
}
void CSaveGame::SetSaveUniqueFilename(char *szFilename)
{
strcpy_s(m_szSaveUniqueName, szFilename);
}
void CSaveGame::CreateSaveUniqueName(void)
{
_SYSTEMTIME UTCSysTime;
GetSystemTime(&UTCSysTime);
sprintf_s(m_szSaveUniqueName, sizeof(m_szSaveUniqueName), "%4d%02d%02d%02d%02d%02d", UTCSysTime.wYear, UTCSysTime.wMonth, UTCSysTime.wDay,
UTCSysTime.wHour, UTCSysTime.wMinute, UTCSysTime.wSecond);
}
void CSaveGame::SaveTitleFile(const char *saveDirPath)
{
if (m_wszSaveTitle[0] == L'\0')
return;
char titleFilePath[512];
sprintf_s(titleFilePath, sizeof(titleFilePath), "%s\\saveTitle.txt", saveDirPath);
char utf8Title[MAX_DISPLAYNAME_LENGTH * 3];
int len = WideCharToMultiByte(CP_UTF8, 0, m_wszSaveTitle, -1, utf8Title, sizeof(utf8Title), NULL, NULL);
if (len > 0)
{
HANDLE h = CreateFileA(titleFilePath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE)
{
DWORD bytesWritten = 0;
WriteFile(h, utf8Title, len - 1, &bytesWritten, 0); // don't write null terminator
CloseHandle(h);
}
}
}
bool CSaveGame::LoadTitleFromFile(const char *saveDirPath, char *outUTF8Title, int maxLen)
{
char titleFilePath[512];
sprintf_s(titleFilePath, sizeof(titleFilePath), "%s\\saveTitle.txt", saveDirPath);
HANDLE h = CreateFileA(titleFilePath, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (h == INVALID_HANDLE_VALUE)
return false;
DWORD fileSize = GetFileSize(h, NULL);
if (fileSize == 0 || fileSize == INVALID_FILE_SIZE || fileSize >= (DWORD)maxLen)
{
CloseHandle(h);
return false;
}
DWORD bytesRead = 0;
ReadFile(h, outUTF8Title, fileSize, &bytesRead, 0);
CloseHandle(h);
if (bytesRead > 0)
{
outUTF8Title[bytesRead] = '\0';
return true;
}
return false;
}
void CSaveGame::SetDefaultImages(PBYTE pbOptionsImage, DWORD dwOptionsImageBytes, PBYTE pbSaveImage, DWORD dwSaveImageBytes, PBYTE pbSaveThumbnail, DWORD dwSaveThumbnailBytes)
{
if (m_pbDefaultSaveImage)
{
free(m_pbDefaultSaveImage);
m_pbDefaultSaveImage = nullptr;
m_dwDefaultSaveImageBytes = 0;
}
if (pbSaveImage && dwSaveImageBytes > 0)
{
m_pbDefaultSaveImage = (PBYTE)malloc(dwSaveImageBytes);
if (m_pbDefaultSaveImage)
{
memcpy(m_pbDefaultSaveImage, pbSaveImage, dwSaveImageBytes);
m_dwDefaultSaveImageBytes = dwSaveImageBytes;
}
}
if (m_pbDefaultThumbnail)
{
free(m_pbDefaultThumbnail);
m_pbDefaultThumbnail = nullptr;
m_dwDefaultThumbnailBytes = 0;
}
if (pbSaveThumbnail && dwSaveThumbnailBytes > 0)
{
m_pbDefaultThumbnail = (PBYTE)malloc(dwSaveThumbnailBytes);
if (m_pbDefaultThumbnail)
{
memcpy(m_pbDefaultThumbnail, pbSaveThumbnail, dwSaveThumbnailBytes);
m_dwDefaultThumbnailBytes = dwSaveThumbnailBytes;
}
}
}
void CSaveGame::GetDefaultSaveImage(PBYTE *ppbSaveImage, DWORD *pdwSaveImageBytes)
{
if (ppbSaveImage) *ppbSaveImage = m_pbDefaultSaveImage;
if (pdwSaveImageBytes) *pdwSaveImageBytes = m_dwDefaultSaveImageBytes;
}
void CSaveGame::GetDefaultSaveThumbnail(PBYTE *ppbSaveThumbnail, DWORD *pdwSaveThumbnailBytes)
{
if (ppbSaveThumbnail) *ppbSaveThumbnail = m_pbDefaultThumbnail;
if (pdwSaveThumbnailBytes) *pdwSaveThumbnailBytes = m_dwDefaultThumbnailBytes;
}
C4JStorage::ESaveGameState CSaveGame::RenameSaveData(int iRenameIndex, uint16_t *pui16NewName, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
{
bool bSuccess = false;
if (m_pSaveDetails && iRenameIndex >= 0 && iRenameIndex < m_pSaveDetails->iSaveC && pui16NewName)
{
char gameHDDPath[256];
GetGameHDDPath(gameHDDPath, sizeof(gameHDDPath));
char saveDirPath[512];
sprintf_s(saveDirPath, sizeof(saveDirPath), "%s\\%s", gameHDDPath, m_pSaveDetails->SaveInfoA[iRenameIndex].UTF8SaveFilename);
wchar_t newTitle[MAX_DISPLAYNAME_LENGTH];
int i = 0;
while (i < MAX_DISPLAYNAME_LENGTH - 1 && pui16NewName[i] != 0)
{
newTitle[i] = (wchar_t)pui16NewName[i];
i++;
}
newTitle[i] = L'\0';
char titleFilePath[512];
sprintf_s(titleFilePath, sizeof(titleFilePath), "%s\\saveTitle.txt", saveDirPath);
char utf8Title[MAX_DISPLAYNAME_LENGTH * 3];
int len = WideCharToMultiByte(CP_UTF8, 0, newTitle, -1, utf8Title, sizeof(utf8Title), NULL, NULL);
if (len > 0)
{
HANDLE h = CreateFileA(titleFilePath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE)
{
DWORD bytesWritten = 0;
WriteFile(h, utf8Title, len - 1, &bytesWritten, 0);
CloseHandle(h);
WideCharToMultiByte(CP_UTF8, 0, newTitle, -1, m_pSaveDetails->SaveInfoA[iRenameIndex].UTF8SaveTitle, MAX_DISPLAYNAME_LENGTH, NULL, NULL);
bSuccess = true;
}
}
}
if (Func) Func(lpParam, bSuccess);
return C4JStorage::ESaveGame_Rename;
}

View file

@ -0,0 +1,81 @@
#pragma once
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "4J_Storage.h"
class CSaveGame
{
public:
CSaveGame();
void SetSaveDisabled(bool bDisable);
bool GetSaveDisabled(void);
void ResetSaveData();
C4JStorage::ESaveGameState GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
char *pszSavePackName);
PSAVE_DETAILS ReturnSavesInfo();
void ClearSavesInfo();
C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes),
LPVOID lpParam);
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam);
unsigned int GetSaveSize();
void GetSaveData(void *pvData, unsigned int *puiBytes);
bool GetSaveUniqueNumber(INT *piVal);
bool GetSaveUniqueFilename(char *pszName);
void SetSaveTitle(LPCWSTR pwchDefaultSaveName);
PVOID AllocateSaveData(unsigned int uiBytes);
void SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes);
C4JStorage::ESaveGameState SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam);
void CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam);
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam);
C4JStorage::ESaveGameState RenameSaveData(int iRenameIndex, uint16_t *pui16NewName, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam);
C4JStorage::ESaveGameState DoesSaveExist(bool *pbExists);
void SetSaveUniqueFilename(char *szFilename);
LPCWSTR GetSaveTitle();
void CreateSaveUniqueName(void);
void SaveTitleFile(const char *saveDirPath);
static bool LoadTitleFromFile(const char *saveDirPath, char *outUTF8Title, int maxLen);
void SetDefaultImages(PBYTE pbOptionsImage, DWORD dwOptionsImageBytes, PBYTE pbSaveImage, DWORD dwSaveImageBytes, PBYTE pbSaveThumbnail, DWORD dwSaveThumbnailBytes);
void GetDefaultSaveImage(PBYTE *ppbSaveImage, DWORD *pdwSaveImageBytes);
void GetDefaultSaveThumbnail(PBYTE *ppbSaveThumbnail, DWORD *pdwSaveThumbnailBytes);
void *m_pSaveData;
unsigned int m_uiSaveSize;
char m_szSaveUniqueName[32];
wchar_t m_wszSaveTitle[MAX_DISPLAYNAME_LENGTH];
bool m_bIsSafeDisabled;
bool m_bHasSaveDetails;
SAVE_DETAILS *m_pSaveDetails;
PBYTE m_pbThumbnail;
DWORD m_dwThumbnailBytes;
PBYTE m_pbDefaultThumbnail;
DWORD m_dwDefaultThumbnailBytes;
PBYTE m_pbDefaultSaveImage;
DWORD m_dwDefaultSaveImageBytes;
};

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>18.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6ded1618-2ada-4d72-a11f-425e83c7042e}</ProjectGuid>
<RootNamespace>Storage</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v145</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>4J_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>4J_$(ProjectName)_d</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="4J_Storage.h" />
<ClInclude Include="extraX64.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="STO_DLC.h" />
<ClInclude Include="STO_Main.h" />
<ClInclude Include="STO_SaveGame.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="4J_Storage.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="STO_DLC.cpp" />
<ClCompile Include="STO_Main.cpp" />
<ClCompile Include="STO_SaveGame.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="4J_Storage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="STO_DLC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="STO_Main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="STO_SaveGame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="extraX64.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="4J_Storage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="STO_DLC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="STO_Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="STO_SaveGame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,25 @@
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "stdafx.h"

View file

@ -0,0 +1,38 @@
#ifndef PCH_H
#define PCH_H
/*
MIT License
Copyright (c) 2026 Patoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <cstdint>
#include <assert.h>
#include <Xinput.h>
typedef unsigned __int64 __uint64;
#include "extraX64.h"
#endif //PCH_H

View file

@ -0,0 +1,47 @@
# 4JLibs
> Source: https://github.com/Patoke/4JLibs/tree/master
A project that aims at rebuilding the 4J libraries source code via decompilation for the Minecraft: Legacy Console Edition
## NOTICE
There's a bug in the main game code where the depth stencil view descriptor isn't zero initialized, this happens in the file ``Windows64_Minecraft.cpp`` at the
```D3D11_DEPTH_STENCIL_VIEW_DESC descDSView;``` line
This causes the depth stencil view creation to fail and consequently breaks the game, to fix this you will need to add the following line after the definition described:
```ZeroMemory(&descDSView, sizeof(descDSView));```
This issue only happens when building with newer versions of the Visual Studio compiler, Visual Studio 2012 isn't affected by this, so if you're working on a fork of the main source
remember to add this line to avoid breaking the game for other people
## Why?
This would allow compiling the Minecraft: Legacy Console Edition source code from newer versions of Visual Studio, expand the Renderer code, add new Input support, etc...
This would also help document the structure of their projects for decompilation projects of newer versions of this version of the game
## Does this use leaked code?
No, this does not use any code from the Minecraft: Legacy Console Edition source leak, this is all clean decompilation from binaries and debug binaries
## How can I build this?
You will need to get your hands with files from the source leak that are not included here or rebuild them and push to the repository
The files needed are the following:
* 4J_Input.h
* 4J_Storage.h
* 4J_Render.h
* 4J_Profile.h
* extraX64.h
You will need to modify ``extraX64.h`` as it has a couple errors
You will need to add every file into their respective project and add the ``extraX64.h`` header inside ``Profile`` and ``Storage``
## What is implemented?
All projects can be linked against the main game code, whilst there's some unnamed stuff in the Renderer, this works just fine and the game can be played

View file

@ -213,7 +213,7 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal()
VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT );
pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
#if defined _XBOX
#if defined _XBOX || defined _WINDOWS64
app.GetSaveThumbnail(NULL,NULL);
#elif defined __PS3__
app.GetSaveThumbnail(NULL,NULL, NULL,NULL);
@ -740,7 +740,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
PBYTE pbDataSaveImage=NULL;
DWORD dwDataSizeSaveImage=0;
#if ( defined _XBOX || defined _DURANGO )
#if ( defined _XBOX || defined _DURANGO || defined _WINDOWS64 )
app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize);
#elif ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ )
app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage);

View file

@ -586,7 +586,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit()
VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT );
pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
#if defined _XBOX
#if defined _XBOX || defined _WINDOWS64
app.GetSaveThumbnail(NULL,NULL);
#elif defined __PS3__
app.GetSaveThumbnail(NULL,NULL, NULL,NULL);
@ -1412,7 +1412,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
PBYTE pbDataSaveImage=NULL;
DWORD dwDataSizeSaveImage=0;
#if ( defined _XBOX || defined _DURANGO )
#if ( defined _XBOX || defined _DURANGO || defined _WINDOWS64 )
app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize);
#elif ( defined __PS3__ || defined __ORBIS__ )
app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage);

View file

@ -13,14 +13,22 @@
typedef unsigned char byte;
#ifndef XUSER_INDEX_ANY
const int XUSER_INDEX_ANY = 255;
#endif
#ifndef XUSER_INDEX_FOCUS
const int XUSER_INDEX_FOCUS = 254;
#endif
#ifdef __PSVITA__
#ifndef XUSER_MAX_COUNT
const int XUSER_MAX_COUNT = 1;
#endif
const int MINECRAFT_NET_MAX_PLAYERS = 4;
#else
#ifndef XUSER_MAX_COUNT
const int XUSER_MAX_COUNT = 4;
#endif
const int MINECRAFT_NET_MAX_PLAYERS = 8;
#endif