Add console fonticon autocomplete

This commit is contained in:
Jan
2021-09-08 00:31:56 +02:00
parent 4497b991be
commit 6e0586a335
5 changed files with 370 additions and 25 deletions

View File

@ -339,6 +339,8 @@ namespace Game
RandWithSeed_t RandWithSeed = RandWithSeed_t(0x495580);
GetDecayingLetterInfo_t GetDecayingLetterInfo = GetDecayingLetterInfo_t(0x5351C0);
Field_Draw_t Field_Draw = Field_Draw_t(0x4F5B40);
XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x7998A8);
unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x7995E8);
@ -429,6 +431,11 @@ namespace Game
GfxScene* scene = reinterpret_cast<GfxScene*>(0x6944914);
ConDrawInputGlob* conDrawInputGlob = reinterpret_cast<ConDrawInputGlob*>(0x9FD6F8);
field_t* g_consoleField = reinterpret_cast<field_t*>(0xA1B6B0);
clientStatic_t* cls = reinterpret_cast<clientStatic_t*>(0xA7FE90);
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
{
int elSize = DB_GetXAssetSizeHandlers[type]();
@ -550,37 +557,32 @@ namespace Game
while (lock && *reinterpret_cast<volatile long*>(0x16B8A58)) std::this_thread::sleep_for(1ms);
unsigned int index = 0;
do
const auto pool = Components::Maps::GetAssetEntryPool();
for(auto hash = 0; hash < 37000; hash++)
{
unsigned short hashIndex = db_hashTable[index];
if (hashIndex)
auto hashIndex = db_hashTable[hash];
while(hashIndex)
{
do
auto* assetEntry = &pool[hashIndex];
if(assetEntry->asset.type == type)
{
XAssetEntry* asset = &Components::Maps::GetAssetEntryPool()[hashIndex];
hashIndex = asset->nextHash;
if (asset->asset.type == type)
callback(assetEntry);
if (overrides)
{
callback(asset);
if (overrides)
auto overrideIndex = assetEntry->nextOverride;
while (overrideIndex)
{
unsigned short overrideIndex = asset->nextOverride;
if (asset->nextOverride)
{
do
{
asset = &Components::Maps::GetAssetEntryPool()[overrideIndex];
callback(asset);
overrideIndex = asset->nextOverride;
} while (overrideIndex);
}
auto* overrideEntry = &pool[overrideIndex];
callback(overrideEntry);
overrideIndex = overrideEntry->nextOverride;
}
}
} while (hashIndex);
}
hashIndex = assetEntry->nextHash;
}
++index;
} while (index < 74000);
}
if(lock) InterlockedDecrement(lockVar);
}
@ -609,6 +611,20 @@ namespace Game
return hash;
}
unsigned int R_HashString(const char* string, size_t maxLen)
{
unsigned int hash = 0;
while (*string && maxLen > 0)
{
hash = (*string | 0x20) ^ (33 * hash);
++string;
maxLen--;
}
return hash;
}
void SV_KickClientError(client_t* client, const std::string& reason)
{
if (client->state < 5)

View File

@ -788,6 +788,9 @@ namespace Game
typedef void(__cdecl* GetDecayingLetterInfo_t)(unsigned int letter, int* randSeed, int decayTimeElapsed, int fxBirthTime, int fxDecayDuration, unsigned __int8 alpha, bool* resultSkipDrawing, char* resultAlpha, unsigned int* resultLetter, bool* resultDrawExtraFxChar);
extern GetDecayingLetterInfo_t GetDecayingLetterInfo;
typedef void(__cdecl * Field_Draw_t)(int localClientNum, field_t* edit, int x, int y, int horzAlign, int vertAlign);
extern Field_Draw_t Field_Draw;
extern XAssetHeader* DB_XAssetPool;
extern unsigned int* g_poolSize;
@ -878,6 +881,11 @@ namespace Game
extern GfxScene* scene;
extern ConDrawInputGlob* conDrawInputGlob;
extern field_t* g_consoleField;
extern clientStatic_t* cls;
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_s* item);
const char* TableLookup(StringTable* stringtable, int row, int column);
@ -898,6 +906,7 @@ namespace Game
void ShowMessageBox(const std::string& message, const std::string& title);
unsigned int R_HashString(const char* string);
unsigned int R_HashString(const char* string, size_t maxLen);
void R_LoadSunThroughDvars(const char* mapname, sunflare_t* sun);
void R_SetSunFromDvars(sunflare_t* sun);

View File

@ -3720,10 +3720,10 @@ namespace Game
{
XAsset asset;
char zoneIndex;
volatile char inuse;
volatile char inuseMask;
bool printedMissingAsset;
unsigned __int16 nextHash;
unsigned __int16 nextOverride;
unsigned __int16 usageFrame;
};
enum XFileLanguage : unsigned char
@ -5298,6 +5298,121 @@ namespace Game
char buffer[256];
};
struct clientLogo_t
{
int startTime;
int duration;
int fadein;
int fadeout;
Material* material[2];
};
struct vidConfig_t
{
unsigned int sceneWidth;
unsigned int sceneHeight;
unsigned int displayWidth;
unsigned int displayHeight;
unsigned int displayFrequency;
int isFullscreen;
float aspectRatioWindow;
float aspectRatioScenePixel;
float aspectRatioDisplayPixel;
unsigned int maxTextureSize;
unsigned int maxTextureMaps;
bool deviceSupportsGamma;
};
struct trDebugLine_t
{
float start[3];
float end[3];
float color[4];
int depthTest;
};
struct trDebugString_t
{
float xyz[3];
float color[4];
float scale;
char text[96];
};
struct clientDebugStringInfo_t
{
int max;
int num;
trDebugString_t* strings;
int* durations;
};
struct clientDebugLineInfo_t
{
int max;
int num;
trDebugLine_t* lines;
int* durations;
};
struct clientDebug_t
{
int prevFromServer;
int fromServer;
clientDebugStringInfo_t clStrings;
clientDebugStringInfo_t svStringsBuffer;
clientDebugStringInfo_t svStrings;
clientDebugLineInfo_t clLines;
clientDebugLineInfo_t svLinesBuffer;
clientDebugLineInfo_t svLines;
};
struct ClientMatchData
{
char def[64];
char data[1024];
};
struct clientStatic_t
{
int quit;
int hunkUsersStarted;
char servername[256];
int rendererStarted;
int soundStarted;
int uiStarted;
int frametime;
float frametime_base;
int realtime;
bool gpuSyncedPrevFrame;
bool inputUpdatedPrevFrame;
clientLogo_t logo;
float mapCenter[3];
int lastServerPinged;
int pingedServerCount;
int totalServersParsed;
int pingUpdateSource;
Material* whiteMaterial;
Material* consoleMaterial;
Font_s* consoleFont;
// ... tbc
};
struct ConDrawInputGlob
{
char autoCompleteChoice[64];
int matchIndex;
int matchCount;
const char* inputText;
int inputTextLen;
bool hasExactMatch;
bool mayAutoComplete;
float x;
float y;
float leftX;
float fontHeight;
};
#pragma endregion
#ifndef IDA