See description
* Add ConVar to allow user to set/unset FCVAR_DEVELOPMENTONLY ConVar's (default behavior would never be hit without this ConVar). * Add icons to display the flags of a certain CommandBase. * Fixed Dear ImGui not displaying images correctly (descriptor needs DXGI_FORMAT_R8G8B8A8_UNORM_SRGB due to the nature of this game). * Dynamically obtain buffer sizes of resources taken from modules. * Light SDK cleanup.
@ -2,14 +2,31 @@
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by r5dev.rc
|
||||
//
|
||||
#define PNG 256
|
||||
#define IDB_PNG1 101
|
||||
#define IDB_PNG2 102
|
||||
#define IDB_PNG3 103
|
||||
#define IDB_PNG4 104
|
||||
#define IDB_PNG5 105
|
||||
#define IDB_PNG6 106
|
||||
#define IDB_PNG7 107
|
||||
#define IDB_PNG8 108
|
||||
#define IDB_PNG9 109
|
||||
#define IDB_PNG10 110
|
||||
#define IDB_PNG11 111
|
||||
#define IDB_PNG12 112
|
||||
#define IDB_PNG13 113
|
||||
#define IDB_PNG14 114
|
||||
#define IDB_PNG15 115
|
||||
#define IDB_PNG16 116
|
||||
#define IDB_PNG17 117
|
||||
#define DEV 256
|
||||
#define PNG 256
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_RESOURCE_VALUE 118
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
@ -19,6 +19,7 @@ History:
|
||||
#include "tier1/cvar.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/console.h"
|
||||
#include "windows/resource.h"
|
||||
#include "engine/net.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "engine/host_state.h"
|
||||
@ -72,18 +73,7 @@ IBrowser::IBrowser(void)
|
||||
|
||||
hostingServerRequestThread.detach();
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
/* Obtain handle to module */
|
||||
static HGLOBAL rcData = NULL;
|
||||
HMODULE handle;
|
||||
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)"unnamed", &handle);
|
||||
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(IDB_PNG1), MAKEINTRESOURCE(PNG));
|
||||
/* Obtain assets from 'rsrc' */
|
||||
if (rc != NULL)
|
||||
{ rcData = LoadResource(handle, rc); }
|
||||
else { assert(rc == NULL); }
|
||||
if (rcData != NULL) { m_vucLockedIconBlob = (std::vector<unsigned char>*)LockResource(rcData); }
|
||||
else { assert(rcData == NULL); }
|
||||
m_rLockedIconBlob = GetModuleResource(IDB_PNG2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -368,14 +358,15 @@ void IBrowser::HiddenServersModal(void)
|
||||
|
||||
if (!m_idLockedIcon)
|
||||
{
|
||||
bool ret = LoadTextureBuffer((unsigned char*)m_vucLockedIconBlob, 0x1000 /*TODO [ AMOS ]: Calculate size dynamically*/, &m_idLockedIcon, &m_nLockedIconWidth, &m_nLockedIconHeight);
|
||||
bool ret = LoadTextureBuffer(reinterpret_cast<unsigned char*>(m_rLockedIconBlob.m_pData), static_cast<int>(m_rLockedIconBlob.m_nSize),
|
||||
&m_idLockedIcon, &m_rLockedIconBlob.m_nWidth, &m_rLockedIconBlob.m_nHeight);
|
||||
IM_ASSERT(ret);
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.00f, 0.00f, 0.00f, 0.00f)); // Override the style color for child bg.
|
||||
|
||||
ImGui::BeginChild("##HiddenServersConnectModal_IconParent", ImVec2(m_nLockedIconWidth, m_nLockedIconHeight));
|
||||
ImGui::Image(m_idLockedIcon, ImVec2(m_nLockedIconWidth, m_nLockedIconHeight)); // Display texture.
|
||||
ImGui::BeginChild("##HiddenServersConnectModal_IconParent", ImVec2(m_rLockedIconBlob.m_nWidth, m_rLockedIconBlob.m_nHeight));
|
||||
ImGui::Image(m_idLockedIcon, ImVec2(m_rLockedIconBlob.m_nWidth, m_rLockedIconBlob.m_nHeight)); // Display texture.
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::PopStyleColor(); // Pop the override for the child bg.
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#ifndef DEDICATED
|
||||
#include "common/sdkdefs.h"
|
||||
#include "windows/resource.h"
|
||||
#include "networksystem/serverlisting.h"
|
||||
#include "networksystem/r5net.h"
|
||||
|
||||
@ -115,9 +117,7 @@ public:
|
||||
|
||||
/* Texture */
|
||||
ID3D11ShaderResourceView* m_idLockedIcon = nullptr;
|
||||
std::vector<unsigned char>* m_vucLockedIconBlob;
|
||||
int m_nLockedIconWidth = 0;
|
||||
int m_nLockedIconHeight = 0;
|
||||
MODULERESOURCE m_rLockedIconBlob;
|
||||
|
||||
void SetSection(eSection section)
|
||||
{
|
||||
|
@ -14,10 +14,12 @@ History:
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "core/init.h"
|
||||
#include "core/resource.h"
|
||||
#include "tier0/commandline.h"
|
||||
#include "tier1/cvar.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/console.h"
|
||||
#include "windows/resource.h"
|
||||
#include "gameui/IConsole.h"
|
||||
#include "client/vengineclient_impl.h"
|
||||
|
||||
@ -50,6 +52,32 @@ CConsole::~CConsole(void)
|
||||
m_vsvHistory.clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: game console setup
|
||||
// Output : true on success, false otherwise
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CConsole::Setup(void)
|
||||
{
|
||||
SetStyleVar();
|
||||
|
||||
int k = 0; // Get all image resources for displaying flags.
|
||||
for (int i = IDB_PNG3; i <= IDB_PNG17; i++)
|
||||
{
|
||||
m_vFlagIcons.push_back(MODULERESOURCE());
|
||||
m_vFlagIcons[k] = GetModuleResource(i);
|
||||
|
||||
bool ret = LoadTextureBuffer(reinterpret_cast<unsigned char*>(m_vFlagIcons[k].m_pData), static_cast<int>(m_vFlagIcons[k].m_nSize),
|
||||
&m_vFlagIcons[k].m_idIcon, &m_vFlagIcons[k].m_nWidth, &m_vFlagIcons[k].m_nHeight);
|
||||
if (!ret)
|
||||
{
|
||||
IM_ASSERT(ret);
|
||||
return false;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: game console main render loop
|
||||
// Input : *pszTitle -
|
||||
@ -59,9 +87,9 @@ void CConsole::Draw(const char* pszTitle, bool* bDraw)
|
||||
{
|
||||
if (!m_bInitialized)
|
||||
{
|
||||
SetStyleVar();
|
||||
m_bInitialized = true;
|
||||
Setup();
|
||||
m_pszConsoleTitle = pszTitle;
|
||||
m_bInitialized = true;
|
||||
}
|
||||
|
||||
{
|
||||
@ -217,7 +245,7 @@ void CConsole::BasePanel(bool* bDraw)
|
||||
if (m_nSuggestPos != -1)
|
||||
{
|
||||
// Remove the default value from ConVar before assigning it to the input buffer.
|
||||
std::string svConVar = m_vsvSuggest[m_nSuggestPos].substr(0, m_vsvSuggest[m_nSuggestPos].find(' ')) + " ";
|
||||
string svConVar = m_vsvSuggest[m_nSuggestPos].m_svName.substr(0, m_vsvSuggest[m_nSuggestPos].m_svName.find(' ')) + " ";
|
||||
memmove(m_szInputBuf, svConVar.c_str(), svConVar.size() + 1);
|
||||
|
||||
ResetAutoComplete();
|
||||
@ -252,7 +280,7 @@ void CConsole::BasePanel(bool* bDraw)
|
||||
}
|
||||
m_vecSuggestWindowPos = ImGui::GetItemRectMin();
|
||||
m_vecSuggestWindowPos.y += ImGui::GetItemRectSize().y;
|
||||
m_vecSuggestWindowSize = ImVec2(600, nPad + std::clamp(static_cast<int>(m_vsvSuggest.size()) * 18, 37, 122));
|
||||
m_vecSuggestWindowSize = ImVec2(600, nPad + std::clamp(static_cast<float>(m_vsvSuggest.size()) * 13.0f, 37.0f, 127.5f));
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Submit"))
|
||||
@ -317,31 +345,43 @@ void CConsole::SuggestPanel(void)
|
||||
for (int i = 0; i < m_vsvSuggest.size(); i++)
|
||||
{
|
||||
bool bIsIndexActive = m_nSuggestPos == i;
|
||||
|
||||
ImGui::PushID(i);
|
||||
if (ImGui::Selectable(m_vsvSuggest[i].c_str(), bIsIndexActive))
|
||||
|
||||
if (con_suggestion_showflags->GetBool())
|
||||
{
|
||||
int k = ColorCodeFlags(m_vsvSuggest[i].m_nFlags);
|
||||
ImGui::Image(m_vFlagIcons[k].m_idIcon, ImVec2(m_vFlagIcons[k].m_nWidth, m_vFlagIcons[k].m_nHeight));
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (ImGui::Selectable(m_vsvSuggest[i].m_svName.c_str(), bIsIndexActive))
|
||||
{
|
||||
ImGui::Separator();
|
||||
|
||||
// Remove the default value from ConVar before assigning it to the input buffer.
|
||||
std::string svConVar = m_vsvSuggest[i].substr(0, m_vsvSuggest[i].find(' ')) + " ";
|
||||
string svConVar = m_vsvSuggest[i].m_svName.substr(0, m_vsvSuggest[i].m_svName.find(' ')) + " ";
|
||||
memmove(m_szInputBuf, svConVar.c_str(), svConVar.size() + 1);
|
||||
|
||||
ResetAutoComplete();
|
||||
}
|
||||
ImGui::PopID();
|
||||
|
||||
if (bIsIndexActive)
|
||||
// Make sure we bring the currently 'active' item into view.
|
||||
if (m_bSuggestMoved && bIsIndexActive)
|
||||
{
|
||||
// Make sure we bring the currently 'active' item into view.
|
||||
if (m_bSuggestMoved)
|
||||
{
|
||||
ImGuiWindow* pWindow = ImGui::GetCurrentWindow();
|
||||
ImRect imRect = ImGui::GetCurrentContext()->LastItemData.Rect;
|
||||
ImGuiWindow* pWindow = ImGui::GetCurrentWindow();
|
||||
ImRect imRect = ImGui::GetCurrentContext()->LastItemData.Rect;
|
||||
|
||||
ImGui::ScrollToBringRectIntoView(pWindow, imRect);
|
||||
m_bSuggestMoved = false;
|
||||
}
|
||||
// Reset to keep flag in display.
|
||||
imRect.Min.x = pWindow->InnerRect.Min.x;
|
||||
imRect.Max.x = pWindow->InnerRect.Min.x; // Set to Min.x on purpose!
|
||||
|
||||
// Eliminate jiggle when going up/down in the menu.
|
||||
imRect.Min.y += 1;
|
||||
imRect.Max.y -= 1;
|
||||
|
||||
ImGui::ScrollToRect(pWindow, imRect);
|
||||
m_bSuggestMoved = false;
|
||||
}
|
||||
|
||||
if (m_bSuggestUpdate)
|
||||
@ -411,18 +451,20 @@ void CConsole::FindFromPartial(void)
|
||||
m_bSuggestUpdate = true;
|
||||
m_vsvSuggest.clear();
|
||||
|
||||
for (int i = 0; i < g_vsvCommandBases.size(); i++)
|
||||
for (int i = 0; i < m_vsvCommandBases.size(); i++)
|
||||
{
|
||||
if (m_vsvSuggest.size() < con_suggestion_limit->GetInt())
|
||||
{
|
||||
if (g_vsvCommandBases[i].find(m_szInputBuf) != std::string::npos)
|
||||
if (m_vsvCommandBases[i].m_svName.find(m_szInputBuf) != string::npos)
|
||||
{
|
||||
if (std::find(m_vsvSuggest.begin(), m_vsvSuggest.end(), g_vsvCommandBases[i]) == m_vsvSuggest.end())
|
||||
if (std::find(m_vsvSuggest.begin(), m_vsvSuggest.end(),
|
||||
m_vsvCommandBases[i].m_svName) == m_vsvSuggest.end())
|
||||
{
|
||||
std::string svValue;
|
||||
ConCommandBase* pCommandBase = g_pCVar->FindCommandBase(g_vsvCommandBases[i].c_str());
|
||||
int nFlags{};
|
||||
string svValue;
|
||||
ConCommandBase* pCommandBase = g_pCVar->FindCommandBase(m_vsvCommandBases[i].m_svName.c_str());
|
||||
|
||||
if (pCommandBase != nullptr)
|
||||
if (pCommandBase)
|
||||
{
|
||||
if (!pCommandBase->IsCommand())
|
||||
{
|
||||
@ -432,11 +474,11 @@ void CConsole::FindFromPartial(void)
|
||||
svValue.append(pConVar->GetString());
|
||||
svValue.append("]");
|
||||
}
|
||||
if (con_suggestion_helptext->GetBool())
|
||||
if (con_suggestion_showhelptext->GetBool())
|
||||
{
|
||||
if (pCommandBase->GetHelpText())
|
||||
{
|
||||
std::string svHelpText = pCommandBase->GetHelpText();
|
||||
string svHelpText = pCommandBase->GetHelpText();
|
||||
if (!svHelpText.empty())
|
||||
{
|
||||
svValue.append(" - \"" + svHelpText + "\"");
|
||||
@ -444,21 +486,32 @@ void CConsole::FindFromPartial(void)
|
||||
}
|
||||
if (pCommandBase->GetUsageText())
|
||||
{
|
||||
std::string svUsageText = pCommandBase->GetUsageText();
|
||||
string svUsageText = pCommandBase->GetUsageText();
|
||||
if (!svUsageText.empty())
|
||||
{
|
||||
svValue.append(" - \"" + svUsageText + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (con_suggestion_showflags->GetBool())
|
||||
{
|
||||
if (con_suggestion_flags_realtime->GetBool())
|
||||
{
|
||||
nFlags = pCommandBase->GetFlags();
|
||||
}
|
||||
else // Display compile-time flags instead.
|
||||
{
|
||||
nFlags = m_vsvCommandBases[i].m_nFlags;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_vsvSuggest.push_back(g_vsvCommandBases[i] + svValue);
|
||||
m_vsvSuggest.push_back(CSuggest(m_vsvCommandBases[i].m_svName + svValue, nFlags));
|
||||
}
|
||||
}
|
||||
}
|
||||
else { break; }
|
||||
}
|
||||
std::sort(m_vsvSuggest.begin(), m_vsvSuggest.end(), CompareStringLexicographically);
|
||||
std::sort(m_vsvSuggest.begin(), m_vsvSuggest.end());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -524,6 +577,47 @@ void CConsole::ProcessCommand(const char* pszCommand)
|
||||
m_bScrollToBottom = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: returns flag image index for CommandBase (must be aligned with resource.h!)
|
||||
// Input : nFlags -
|
||||
//-----------------------------------------------------------------------------
|
||||
int CConsole::ColorCodeFlags(int nFlags) const
|
||||
{
|
||||
switch (nFlags)
|
||||
{
|
||||
case FCVAR_NONE:
|
||||
return 1;
|
||||
case FCVAR_DEVELOPMENTONLY:
|
||||
return 2;
|
||||
case FCVAR_GAMEDLL:
|
||||
return 3;
|
||||
case FCVAR_CLIENTDLL:
|
||||
return 4;
|
||||
case FCVAR_CHEAT:
|
||||
return 5;
|
||||
case FCVAR_RELEASE:
|
||||
return 6;
|
||||
case FCVAR_DEVELOPMENTONLY | FCVAR_GAMEDLL:
|
||||
return 7;
|
||||
case FCVAR_DEVELOPMENTONLY | FCVAR_CLIENTDLL:
|
||||
return 8;
|
||||
case FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED:
|
||||
return 9;
|
||||
case FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT:
|
||||
return 10;
|
||||
case FCVAR_REPLICATED | FCVAR_CHEAT:
|
||||
return 11;
|
||||
case FCVAR_REPLICATED | FCVAR_RELEASE:
|
||||
return 12;
|
||||
case FCVAR_GAMEDLL | FCVAR_CHEAT:
|
||||
return 13;
|
||||
case FCVAR_CLIENTDLL | FCVAR_CHEAT:
|
||||
return 14;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: console input box callback
|
||||
// Input : *iData -
|
||||
@ -593,7 +687,7 @@ int CConsole::TextEditCallback(ImGuiInputTextCallbackData* iData)
|
||||
}
|
||||
if (nPrevHistoryPos != m_nHistoryPos)
|
||||
{
|
||||
std::string svHistory = (m_nHistoryPos >= 0) ? m_vsvHistory[m_nHistoryPos] : "";
|
||||
string svHistory = (m_nHistoryPos >= 0) ? m_vsvHistory[m_nHistoryPos] : "";
|
||||
|
||||
if (!svHistory.empty())
|
||||
{
|
||||
|
@ -1,5 +1,27 @@
|
||||
#pragma once
|
||||
#include "common/sdkdefs.h"
|
||||
#include "windows/resource.h"
|
||||
|
||||
#ifndef DEDICATED
|
||||
struct CSuggest
|
||||
{
|
||||
CSuggest(const string& svName, int nFlags)
|
||||
{
|
||||
m_svName = svName;
|
||||
m_nFlags = nFlags;
|
||||
}
|
||||
bool operator==(const string& a) const
|
||||
{
|
||||
return m_svName.compare(a) == 0;
|
||||
}
|
||||
bool operator<(const CSuggest& a) const
|
||||
{
|
||||
return m_svName < a.m_svName;
|
||||
}
|
||||
string m_svName;
|
||||
int m_nFlags;
|
||||
};
|
||||
|
||||
class CConsole
|
||||
{
|
||||
private:
|
||||
@ -8,8 +30,8 @@ private:
|
||||
char m_szSummary[256] = { 0 };
|
||||
const char* m_pszConsoleTitle = { 0 };
|
||||
|
||||
std::vector<std::string> m_vsvCommands;
|
||||
std::vector<std::string> m_vsvHistory;
|
||||
vector<string> m_vsvCommands;
|
||||
vector<string> m_vsvHistory;
|
||||
int m_nHistoryPos = -1;
|
||||
int m_nScrollBack = 0;
|
||||
ImGuiTextFilter m_itFilter;
|
||||
@ -20,11 +42,12 @@ private:
|
||||
bool m_bScrollToBottom = false;
|
||||
bool m_bCopyToClipBoard = false;
|
||||
|
||||
std::vector<std::string> m_vsvSuggest;
|
||||
bool m_bSuggestActive = false;
|
||||
bool m_bSuggestMoved = false;
|
||||
bool m_bSuggestUpdate = false;
|
||||
int m_nSuggestPos = -1;
|
||||
vector<CSuggest> m_vsvSuggest;
|
||||
vector<MODULERESOURCE> m_vFlagIcons;
|
||||
|
||||
ImVec2 m_vecSuggestWindowPos;
|
||||
ImVec2 m_vecSuggestWindowSize;
|
||||
@ -37,7 +60,7 @@ private:
|
||||
ImGuiInputTextFlags_CallbackEdit |
|
||||
ImGuiInputTextFlags_EnterReturnsTrue;
|
||||
|
||||
ImGuiWindowFlags popup_window_flags =
|
||||
ImGuiWindowFlags popup_window_flags =
|
||||
ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoSavedSettings |
|
||||
@ -47,13 +70,15 @@ private:
|
||||
ImGuiWindowFlags_AlwaysHorizontalScrollbar;
|
||||
|
||||
public:
|
||||
bool m_bActivate = false;
|
||||
ImVector<char*> m_ivConLog;
|
||||
bool m_bActivate = false;
|
||||
ImVector<char*> m_ivConLog;
|
||||
vector<CSuggest> m_vsvCommandBases;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
CConsole(void);
|
||||
~CConsole(void);
|
||||
|
||||
bool Setup(void);
|
||||
void Draw(const char* pszTitle, bool* bDraw);
|
||||
void Think(void);
|
||||
|
||||
@ -66,9 +91,10 @@ public:
|
||||
|
||||
void FindFromPartial(void);
|
||||
void ProcessCommand(const char* pszCommand);
|
||||
int ColorCodeFlags(int nFlags) const;
|
||||
|
||||
int TextEditCallback(ImGuiInputTextCallbackData* data);
|
||||
static int TextEditCallbackStub(ImGuiInputTextCallbackData* data);
|
||||
int TextEditCallback(ImGuiInputTextCallbackData* pData);
|
||||
static int TextEditCallbackStub(ImGuiInputTextCallbackData* pData);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void AddLog(const char* fmt, ...) IM_FMTARGS(2);
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "engine/host_cmd.h"
|
||||
#include "server/vengineserver_impl.h"
|
||||
#include "client/cdll_engine_int.h"
|
||||
#ifndef DEDICATED
|
||||
#include "gameui/IConsole.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -54,10 +57,13 @@ bool CModAppSystemGroup::Create(CModAppSystemGroup* pModAppSystemGroup)
|
||||
g_pConCommand->Init();
|
||||
g_pFactory->GetFactoriesFromRegister();
|
||||
|
||||
#ifndef DEDICATED
|
||||
for (auto& map : g_pCVar->DumpToMap())
|
||||
{
|
||||
g_vsvCommandBases.push_back(map.first.c_str());
|
||||
g_pIConsole->m_vsvCommandBases.push_back(
|
||||
CSuggest(map.first.c_str(), map.second->GetFlags()));
|
||||
}
|
||||
#endif // !DEDICATED
|
||||
if (pModAppSystemGroup->IsServerOnly())
|
||||
{
|
||||
memset(gHLClient, '\0', sizeof(void*));
|
||||
|
@ -50,20 +50,6 @@ MODULEINFO GetModuleInfo(const char* szModule)
|
||||
return modinfo;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For finding a byte pattern in memory of the process.
|
||||
BOOL Compare(const unsigned char* pData, const unsigned char* szPattern, const char* szMask)
|
||||
{
|
||||
for (; *szMask; ++szMask, ++pData, ++szPattern)
|
||||
{
|
||||
if (*szMask == 'x' && *pData != *szPattern)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (*szMask) == NULL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For finding a pattern in memory of the process with SIMD.
|
||||
DWORD64 FindPatternSIMD(const char* szModule, const unsigned char* szPattern, const char* szMask)
|
||||
|
BIN
r5dev/resource/png/debugempty.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
r5dev/resource/png/vf_cheat.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_clientdll.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_clientdll_cheat.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_default.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
r5dev/resource/png/vf_developmentonly.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_developmentonly_cheat.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_developmentonly_clientdll.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_developmentonly_gamedll.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_developmentonly_replicated.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_gamedll.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_gamedll_cheat.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_none.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
r5dev/resource/png/vf_release.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_replicated_cheat.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
r5dev/resource/png/vf_replicated_release.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
@ -1,6 +1,6 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "core/resource.h"
|
||||
#include "../core/resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -27,7 +27,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"core/resource.h\0"
|
||||
"../core/resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
@ -44,13 +44,32 @@ END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DEV
|
||||
//
|
||||
IDB_PNG1 DEV "png\\debugempty.png"
|
||||
IDB_PNG2 DEV "png\\lockedserver.png"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PNG
|
||||
//
|
||||
|
||||
IDB_PNG1 PNG "resource\\png\\lockedserver.png"
|
||||
IDB_PNG3 PNG "png\\vf_default.png"
|
||||
IDB_PNG4 PNG "png\\vf_none.png"
|
||||
IDB_PNG5 PNG "png\\vf_developmentonly.png"
|
||||
IDB_PNG6 PNG "png\\vf_gamedll.png"
|
||||
IDB_PNG7 PNG "png\\vf_clientdll.png"
|
||||
IDB_PNG8 PNG "png\\vf_cheat.png"
|
||||
IDB_PNG9 PNG "png\\vf_release.png"
|
||||
IDB_PNG10 PNG "png\\vf_developmentonly_gamedll.png"
|
||||
IDB_PNG11 PNG "png\\vf_developmentonly_clientdll.png"
|
||||
IDB_PNG12 PNG "png\\vf_developmentonly_cheat.png"
|
||||
IDB_PNG13 PNG "png\\vf_developmentonly_replicated.png"
|
||||
IDB_PNG14 PNG "png\\vf_replicated_cheat.png"
|
||||
IDB_PNG15 PNG "png\\vf_replicated_release.png"
|
||||
IDB_PNG16 PNG "png\\vf_gamedll_cheat.png"
|
||||
IDB_PNG17 PNG "png\\vf_clientdll_cheat.png"
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -28,7 +28,7 @@ bool HIVEngineServer__PersistenceAvailable(void* entidx, int clientidx)
|
||||
int64_t nOriginID = pClient->GetOriginID();
|
||||
|
||||
DevMsg(eDLL_T::SERVER, "______________________________________________________________\n");
|
||||
DevMsg(eDLL_T::SERVER, "+- NetChannel details\n");
|
||||
DevMsg(eDLL_T::SERVER, "+- NetChannel:\n");
|
||||
DevMsg(eDLL_T::SERVER, " |- IDX : | '#%d'\n", clientidx);
|
||||
DevMsg(eDLL_T::SERVER, " |- UID : | '%s'\n", svClientName.c_str());
|
||||
DevMsg(eDLL_T::SERVER, " |- OID : | '%lld'\n", nOriginID);
|
||||
|
@ -47,10 +47,11 @@ void ConVar::Init(void) const
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
// ENGINE |
|
||||
cm_debug_cmdquery = new ConVar("cm_debug_cmdquery" , "0", FCVAR_DEVELOPMENTONLY, "Prints the flags of each ConVar/ConCommand query to the console ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_return_false_cmdquery_all = new ConVar("cm_return_false_cmdquery_all" , "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on every ConVar/ConCommand query ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_return_false_cmdquery_cheats = new ConVar("cm_return_false_cmdquery_cheats", "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on all FCVAR_DEVELOPMENTONLY and FCVAR_CHEAT ConVar/ConCommand queries ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_debug_overlay_nodecay = new ConVar("r_debug_overlay_nodecay" , "0", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , "Keeps all debug overlays alive regardless of their lifetime. Use command 'clear_debug_overlays' to clear everything.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_debug_cmdquery = new ConVar("cm_debug_cmdquery" , "0", FCVAR_DEVELOPMENTONLY, "Prints the flags of each ConVar/ConCommand query to the console ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_unset_all_cmdquery = new ConVar("cm_unset_all_cmdquery" , "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on every ConVar/ConCommand query ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_unset_dev_cmdquery = new ConVar("cm_unset_dev_cmdquery" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on all FCVAR_DEVELOPMENTONLY ConVar/ConCommand queries ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cm_unset_cheat_cmdquery = new ConVar("cm_unset_cheat_cmdquery", "0", FCVAR_DEVELOPMENTONLY | FCVAR_REPLICATED, "Returns false on all FCVAR_DEVELOPMENTONLY and FCVAR_CHEAT ConVar/ConCommand queries ( !warning! ).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_debug_overlay_nodecay = new ConVar("r_debug_overlay_nodecay", "0", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT , "Keeps all debug overlays alive regardless of their lifetime. Use command 'clear_debug_overlays' to clear everything.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
// TODO: RconPasswordChanged_f
|
||||
rcon_address = new ConVar("rcon_address", "::", FCVAR_SERVER_CANNOT_QUERY | FCVAR_DONTRECORD | FCVAR_RELEASE, "Remote server access address.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
@ -118,9 +119,11 @@ void ConVar::Init(void) const
|
||||
cl_gpustats_offset_x = new ConVar("cl_gpustats_offset_x" , "650", FCVAR_DEVELOPMENTONLY, "X offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
cl_gpustats_offset_y = new ConVar("cl_gpustats_offset_y" , "105", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
con_max_size_logvector = new ConVar("con_max_size_logvector", "1000", FCVAR_DEVELOPMENTONLY, "Maximum number of logs in the console until cleanup starts.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_limit = new ConVar("con_suggestion_limit" , "120" , FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_helptext = new ConVar("con_suggestion_helptext", "1" , FCVAR_DEVELOPMENTONLY, "Show ConVar help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_max_size_logvector = new ConVar("con_max_size_logvector" , "1000", FCVAR_DEVELOPMENTONLY, "Maximum number of logs in the console until cleanup starts.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_limit = new ConVar("con_suggestion_limit" , "120" , FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_showhelptext = new ConVar("con_suggestion_showhelptext" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase help text in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_showflags = new ConVar("con_suggestion_showflags" , "1" , FCVAR_DEVELOPMENTONLY, "Show CommandBase flags in autocomplete window.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
con_suggestion_flags_realtime = new ConVar("con_suggestion_flags_realtime" , "0" , FCVAR_DEVELOPMENTONLY, "Whether to show compile-time or run-time CommandBase flags.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
@ -140,7 +143,8 @@ void ConVar::Init(void) const
|
||||
sq_showvmwarning = new ConVar("sq_showvmwarning" , "0", FCVAR_DEVELOPMENTONLY, "Prints the VM warning output to the console. 1 = Log to file. 2 = 1 + log to console.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
net_userandomkey = new ConVar("net_userandomkey" , "1" , FCVAR_RELEASE , "If set to 1, the netchannel generates and sets a random base64 netkey.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
net_encryptpacket = new ConVar("net_encryptpacket" , "1" , FCVAR_DEVELOPMENTONLY, "Use encrpytion for in/out packets if set.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
net_userandomkey = new ConVar("net_userandomkey" , "1" , FCVAR_RELEASE , "Generates and sets a random base64 netkey for netchannel if set.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r5net_matchmaking_hostname = new ConVar("r5net_matchmaking_hostname", "r5a-comp-sv.herokuapp.com", FCVAR_RELEASE , "Holds the R5Net matchmaking hostname.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r5net_show_debug = new ConVar("r5net_show_debug" , "1" , FCVAR_DEVELOPMENTONLY, "Shows debug output for R5Net.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
//-------------------------------------------------------------------------
|
||||
@ -747,12 +751,12 @@ bool ConVar::IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf("--------------------------------------------------\n");
|
||||
printf(" Flaged: %08X\n", pConVar->m_nFlags);
|
||||
}
|
||||
if (cm_return_false_cmdquery_cheats->GetBool())
|
||||
if (cm_unset_cheat_cmdquery->GetBool())
|
||||
{
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
pConVar->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
}
|
||||
else // Mask off FCVAR_DEVELOPMENTONLY.
|
||||
else if(cm_unset_dev_cmdquery->GetBool())// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
{
|
||||
pConVar->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
}
|
||||
@ -762,17 +766,17 @@ bool ConVar::IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf(" Verify: %08X\n", nFlags);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (nFlags & FCVAR_RELEASE && !cm_return_false_cmdquery_all->GetBool())
|
||||
if (nFlags & FCVAR_RELEASE && !cm_unset_all_cmdquery->GetBool())
|
||||
{
|
||||
// Default retail behaviour.
|
||||
return IConVar_IsFlagSet(pConVar, nFlags);
|
||||
}
|
||||
if (cm_return_false_cmdquery_all->GetBool())
|
||||
if (cm_unset_all_cmdquery->GetBool())
|
||||
{
|
||||
// Returning false on all queries may cause problems.
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY query.
|
||||
// Default behavior.
|
||||
return pConVar->HasFlags(nFlags) != 0;
|
||||
}
|
||||
|
||||
|
@ -274,11 +274,11 @@ bool ConCommandBase::IsFlagSet(ConCommandBase* pCommandBase, int nFlags)
|
||||
printf(" Flaged: %08X\n", pCommandBase->m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
if (cm_return_false_cmdquery_cheats->GetBool())
|
||||
if (cm_unset_cheat_cmdquery->GetBool())
|
||||
{
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
}
|
||||
else // Mask off FCVAR_DEVELOPMENTONLY.
|
||||
else if (cm_unset_dev_cmdquery->GetBool())// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
{
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
}
|
||||
@ -288,17 +288,17 @@ bool ConCommandBase::IsFlagSet(ConCommandBase* pCommandBase, int nFlags)
|
||||
printf(" Verify: %08X\n", nFlags);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (nFlags & FCVAR_RELEASE && !cm_return_false_cmdquery_all->GetBool())
|
||||
if (nFlags & FCVAR_RELEASE && !cm_unset_all_cmdquery->GetBool())
|
||||
{
|
||||
// Default retail behaviour.
|
||||
return ConCommandBase_IsFlagSet(pCommandBase, nFlags);
|
||||
}
|
||||
if (cm_return_false_cmdquery_all->GetBool())
|
||||
if (cm_unset_all_cmdquery->GetBool())
|
||||
{
|
||||
// Returning false on all queries may cause problems.
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY || FCVAR_CHEAT query.
|
||||
// Default behavior.
|
||||
return pCommandBase->HasFlags(nFlags) != 0;
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,9 @@ ConVar* host_hasIrreversibleShutdown = nullptr;
|
||||
ConVar* mp_gamemode = nullptr;
|
||||
|
||||
ConVar* cm_debug_cmdquery = nullptr;
|
||||
ConVar* cm_return_false_cmdquery_all = nullptr;
|
||||
ConVar* cm_return_false_cmdquery_cheats = nullptr;
|
||||
ConVar* cm_unset_all_cmdquery = nullptr;
|
||||
ConVar* cm_unset_dev_cmdquery = nullptr;
|
||||
ConVar* cm_unset_cheat_cmdquery = nullptr;
|
||||
ConVar* r_debug_overlay_nodecay = nullptr;
|
||||
|
||||
ConVar* rcon_address = nullptr;
|
||||
@ -83,7 +84,9 @@ ConVar* cl_gpustats_offset_y = nullptr;
|
||||
|
||||
ConVar* con_max_size_logvector = nullptr;
|
||||
ConVar* con_suggestion_limit = nullptr;
|
||||
ConVar* con_suggestion_helptext = nullptr;
|
||||
ConVar* con_suggestion_showhelptext = nullptr;
|
||||
ConVar* con_suggestion_showflags = nullptr;
|
||||
ConVar* con_suggestion_flags_realtime = nullptr;
|
||||
#endif // !DEDICATED
|
||||
//-----------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
@ -103,6 +106,7 @@ ConVar* sq_showvmoutput = nullptr;
|
||||
ConVar* sq_showvmwarning = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
ConVar* net_encryptpacket = nullptr;
|
||||
ConVar* net_userandomkey = nullptr;
|
||||
ConVar* net_usesocketsforloopback = nullptr;
|
||||
ConVar* r5net_matchmaking_hostname = nullptr;
|
||||
@ -195,5 +199,4 @@ unordered_map<string, ConCommandBase*> CCVar::DumpToMap(void)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
vector<string> g_vsvCommandBases;
|
||||
CCVar* g_pCVar = nullptr;
|
||||
|
@ -12,8 +12,9 @@ extern ConVar* host_hasIrreversibleShutdown;
|
||||
extern ConVar* mp_gamemode;
|
||||
|
||||
extern ConVar* cm_debug_cmdquery;
|
||||
extern ConVar* cm_return_false_cmdquery_all;
|
||||
extern ConVar* cm_return_false_cmdquery_cheats;
|
||||
extern ConVar* cm_unset_all_cmdquery;
|
||||
extern ConVar* cm_unset_dev_cmdquery;
|
||||
extern ConVar* cm_unset_cheat_cmdquery;
|
||||
extern ConVar* r_debug_overlay_nodecay;
|
||||
|
||||
extern ConVar* rcon_address;
|
||||
@ -80,7 +81,9 @@ extern ConVar* cl_gpustats_offset_y;
|
||||
|
||||
extern ConVar* con_max_size_logvector;
|
||||
extern ConVar* con_suggestion_limit;
|
||||
extern ConVar* con_suggestion_helptext;
|
||||
extern ConVar* con_suggestion_showhelptext;
|
||||
extern ConVar* con_suggestion_showflags;
|
||||
extern ConVar* con_suggestion_flags_realtime;
|
||||
#endif // !DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
@ -100,6 +103,7 @@ extern ConVar* sq_showvmoutput;
|
||||
extern ConVar* sq_showvmwarning;
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHANNEL |
|
||||
extern ConVar* net_encryptpacket;
|
||||
extern ConVar* net_userandomkey;
|
||||
extern ConVar* net_usesocketsforloopback;
|
||||
extern ConVar* r5net_matchmaking_hostname;
|
||||
@ -134,7 +138,6 @@ public:
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern vector<string> g_vsvCommandBases;
|
||||
extern CCVar* g_pCVar;
|
||||
|
||||
/* ==== CCVAR =========================================================================================================================================================== */
|
||||
|
@ -103,6 +103,7 @@
|
||||
<ClCompile Include="..\windows\console.cpp" />
|
||||
<ClCompile Include="..\windows\id3dx.cpp" />
|
||||
<ClCompile Include="..\windows\input.cpp" />
|
||||
<ClCompile Include="..\windows\resource.cpp" />
|
||||
<ClCompile Include="..\windows\system.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -364,6 +365,7 @@
|
||||
<ClInclude Include="..\windows\console.h" />
|
||||
<ClInclude Include="..\windows\id3dx.h" />
|
||||
<ClInclude Include="..\windows\input.h" />
|
||||
<ClInclude Include="..\windows\resource.h" />
|
||||
<ClInclude Include="..\windows\system.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -423,6 +423,9 @@
|
||||
<ClCompile Include="..\tier0\jobthread.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\windows\resource.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1202,6 +1205,9 @@
|
||||
<ClInclude Include="..\tier0\jobthread.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\windows\resource.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -111,6 +111,7 @@
|
||||
<ClCompile Include="..\windows\console.cpp" />
|
||||
<ClCompile Include="..\windows\id3dx.cpp" />
|
||||
<ClCompile Include="..\windows\input.cpp" />
|
||||
<ClCompile Include="..\windows\resource.cpp" />
|
||||
<ClCompile Include="..\windows\system.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -382,6 +383,7 @@
|
||||
<ClInclude Include="..\windows\console.h" />
|
||||
<ClInclude Include="..\windows\id3dx.h" />
|
||||
<ClInclude Include="..\windows\input.h" />
|
||||
<ClInclude Include="..\windows\resource.h" />
|
||||
<ClInclude Include="..\windows\system.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -453,6 +453,9 @@
|
||||
<ClCompile Include="..\tier0\jobthread.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\windows\resource.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1262,6 +1265,9 @@
|
||||
<ClInclude Include="..\tier0\jobthread.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\windows\resource.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -440,7 +440,7 @@ bool LoadTextureBuffer(unsigned char* buffer, int len, ID3D11ShaderResourceView*
|
||||
desc.Height = image_height;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
@ -454,7 +454,7 @@ bool LoadTextureBuffer(unsigned char* buffer, int len, ID3D11ShaderResourceView*
|
||||
|
||||
// Create texture view
|
||||
ZeroMemory(&srvDesc, sizeof(srvDesc));
|
||||
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||
|
35
r5dev/windows/resource.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/resource.h"
|
||||
#include "windows/resource.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* _resource.cpp
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
//#############################################################################
|
||||
//
|
||||
//#############################################################################
|
||||
MODULERESOURCE GetModuleResource(int iResource)
|
||||
{
|
||||
static HGLOBAL rcData = NULL;
|
||||
HMODULE handle;
|
||||
|
||||
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
|
||||
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)"unnamed", &handle);
|
||||
|
||||
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(iResource), MAKEINTRESOURCE(PNG));
|
||||
if (!rc)
|
||||
{
|
||||
assert(rc == NULL);
|
||||
return MODULERESOURCE();
|
||||
}
|
||||
|
||||
rcData = LoadResource(handle, rc);
|
||||
if (!rcData)
|
||||
{
|
||||
assert(rcData == NULL);
|
||||
return MODULERESOURCE();
|
||||
}
|
||||
return (MODULERESOURCE(LockResource(rcData), SizeofResource(handle, rc)));
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
28
r5dev/windows/resource.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
struct MODULERESOURCE
|
||||
{
|
||||
MODULERESOURCE(void)
|
||||
{
|
||||
m_pData = nullptr;
|
||||
m_nSize = NULL;
|
||||
m_idIcon = nullptr;
|
||||
m_nWidth = NULL;
|
||||
m_nHeight = NULL;
|
||||
}
|
||||
MODULERESOURCE(LPVOID pData, DWORD nSize, ID3D11ShaderResourceView* pIcon = nullptr)
|
||||
{
|
||||
m_pData = pData;
|
||||
m_nSize = nSize;
|
||||
m_idIcon = pIcon;
|
||||
m_nWidth = NULL;
|
||||
m_nHeight = NULL;
|
||||
}
|
||||
LPVOID m_pData;
|
||||
DWORD m_nSize;
|
||||
ID3D11ShaderResourceView* m_idIcon;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
};
|
||||
|
||||
MODULERESOURCE GetModuleResource(int iResource);
|