chore: update some other stuff

This commit is contained in:
6arelyFuture 2025-04-01 18:48:40 +02:00
parent e5b8b29a01
commit 0541f9d095
Signed by: Future
GPG Key ID: F2000F181A4F7C85
4 changed files with 107 additions and 0 deletions

14
scripts/format.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Navigate to the repository root
cd "$(dirname "$0")/.." || exit 2
# Set the clang-format binary (defaults to 'clang-format')
CLANG_FORMAT_BIN="${CLANG_FORMAT_BIN:-clang-format}"
# Find and format all .hpp and .cpp files in the src directory
find ./src \( -iname '*.hpp' -o -iname '*.cpp' \) -print0 |
xargs -0 "$CLANG_FORMAT_BIN" -i || {
echo "Error: clang-format failed." >&2
exit 1
}

View File

@ -24,4 +24,25 @@ void __declspec(naked) Dvar_SetVariant(dvar_t* /*dvar*/, DvarValue /*value*/,
ret
}
}
XAssetEntry* db_find_x_asset_entry(int type_, const char* name) {
static DWORD DB_FindXAssetEntry_t = 0x5c88a0;
XAssetEntry* result{};
__asm {
pushad
push name
mov edi, type_
call DB_FindXAssetEntry_t
add esp, 0x4
mov result, eax
popad
}
return result;
}
XAssetEntry* DB_FindXAssetEntry(int type, const char* name) {
return db_find_x_asset_entry(type, name);
}
} // namespace game

View File

@ -18,6 +18,8 @@ private:
// clang-format off
extern ScreenPlacement* ScrPlace_GetUnsafeFullPlacement();
extern void Dvar_SetVariant(dvar_t* dvar, DvarValue value, DvarSetSource source);
extern XAssetEntry* DB_FindXAssetEntry(int type, const char* name);
// clang-format on
} // namespace game

View File

@ -9,6 +9,59 @@ typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
struct MaterialTechniqueSet {
const char* name;
unsigned char worldVertFormat;
unsigned char unused[2];
MaterialTechniqueSet* remappedTechniqueSet;
void* techniques[54];
};
struct __declspec(align(8)) GfxDrawSurfFields {
uint64_t unused : 1;
uint64_t primarySortKey : 6;
uint64_t surfType : 4;
uint64_t viewModelRender : 1;
uint64_t sceneLightIndex : 8;
uint64_t useHeroLighting : 1;
uint64_t prepass : 2;
uint64_t materialSortedIndex : 12;
uint64_t customIndex : 5;
uint64_t hasGfxEntIndex : 1;
uint64_t reflectionProbeIndex : 8;
uint64_t objectId : 15;
};
union GfxDrawSurf {
__declspec(align(8)) GfxDrawSurfFields fields;
__declspec(align(8)) uint64_t packed;
};
struct MaterialInfo {
const char* name;
unsigned char gameFlags;
unsigned char sortKey;
unsigned char textureAtlasRowCount;
unsigned char textureAtlasColumnCount;
GfxDrawSurf drawSurf;
unsigned int surfaceTypeBits;
};
struct Material {
MaterialInfo info;
char stateBitsEntry[54];
unsigned char textureCount;
unsigned char constantCount;
unsigned char stateBitsCount;
unsigned char stateFlags;
unsigned char cameraRegion;
MaterialTechniqueSet* techniqueSet;
void* textureTable;
void* constantTable;
void* stateBitsTable;
const char** subMaterials;
};
enum bdLogMessageType {
BD_LOG_INFO,
BD_LOG_WARNING,
@ -261,6 +314,8 @@ struct usercmd_s {
int remoteControlMove;
};
static_assert(offsetof(usercmd_s, buttons) == 0x4);
enum LocSelInputState {
LOC_SEL_INPUT_NONE = 0,
LOC_SEL_INPUT_CONFIRM = 1,
@ -367,6 +422,21 @@ struct Font_s {
union XAssetHeader {
Font_s* font;
Material* material;
};
struct XAsset {
int type;
XAssetHeader header;
};
struct XAssetEntry {
XAsset asset;
char zoneIndex;
volatile char inuseMask;
bool printedMissingAsset;
unsigned __int16 nextHash;
unsigned __int16 nextOverride;
};
} // namespace game