359 zone stuff, (360 seems to work as well, as an old shipment copy i have on my hdd loads, i just don't have the iwds), gfx world still broken, might be possible to fix!

This commit is contained in:
momo5502 2016-10-02 04:07:48 +02:00
parent b48df26c14
commit 080f9b3599
7 changed files with 1242 additions and 243 deletions

View File

@ -287,7 +287,7 @@ namespace Components
unsigned long outLen = sizeof(FastFiles::CurrentKey);
rsa_import(FastFiles::ZoneKey, sizeof(FastFiles::ZoneKey), &key);
rsa_decrypt_key_ex(encKey, 256, FastFiles::CurrentKey.data, &outLen, NULL, NULL, hash, 2, &stat, &key);
rsa_decrypt_key_ex(encKey, 256, FastFiles::CurrentKey.data, &outLen, NULL, NULL, hash, (Zones::Version() >= 359 ? 1 : 2), &stat, &key);
rsa_free(&key);
ctr_start(aes, FastFiles::CurrentKey.iv, FastFiles::CurrentKey.key, sizeof(FastFiles::CurrentKey.key), 0, 0, &FastFiles::CurrentCTR);

View File

@ -126,7 +126,7 @@ namespace Components
format = "maps/%s.d3dbsp";
}
if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s || mapname == "mp_cargoship"s || mapname == "mp_cross_fire"s || mapname == "mp_bog_sh"s || mapname == "mp_killhouse"s || mapname == "mp_bloc_sh"s || mapname == "mp_cargoship_sh"s)
if (_strnicmp("mp_", mapname, 3) || mapname == "mp_nuked"s || mapname == "mp_bloc"s || mapname == "mp_cargoship"s || mapname == "mp_cross_fire"s || mapname == "mp_bog_sh"s || mapname == "mp_killhouse"s || mapname == "mp_bloc_sh"s || mapname == "mp_cargoship_sh"s || mapname == "mp_firingrange"s)
{
// Adjust pointer to GameMap_Data
Utils::Hook::Set<Game::GameMap_Data**>(0x4D90B7, &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data));
@ -257,6 +257,7 @@ namespace Components
Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp");
Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp");
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
}
Maps::~Maps()

View File

@ -109,6 +109,12 @@ namespace Components
// Adapt death message to IW5 material format
Utils::Hook(0x5A30D9, Materials::DeathMessageStub, HOOK_JUMP).Install()->Quick();
#ifdef DEBUG
// Ignore missing images
Utils::Hook::Nop(0x51F5AC, 5);
Utils::Hook::Nop(0x51F4C4, 5);
#endif
// Renderer::OnFrame([] ()
// {
// Game::Font* font = Game::R_RegisterFont("fonts/normalFont");

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,7 @@ namespace Game
DB_GetXAssetTypeName_t DB_GetXAssetTypeName = (DB_GetXAssetTypeName_t)0x4CFCF0;
DB_IsXAssetDefault_t DB_IsXAssetDefault = (DB_IsXAssetDefault_t)0x48E6A0;
DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x4E5930;
DB_LoadXFileData_t DB_LoadXFileData = (DB_LoadXFileData_t)0x445460;
DB_ReadXFileUncompressed_t DB_ReadXFileUncompressed = (DB_ReadXFileUncompressed_t)0x4705E0;
DB_ReleaseXAssetHandler_t* DB_ReleaseXAssetHandlers = (DB_ReleaseXAssetHandler_t*)0x799AB8;
DB_XModelSurfsFixup_t DB_XModelSurfsFixup = (DB_XModelSurfsFixup_t)0x5BAC50;
@ -110,6 +111,7 @@ namespace Game
Load_SndAliasCustom_t Load_SndAliasCustom = (Load_SndAliasCustom_t)0x49B6B0;
Load_MaterialHandle_t Load_MaterialHandle = (Load_MaterialHandle_t)0x403960;
Load_PhysCollmapPtr_t Load_PhysCollmapPtr = (Load_PhysCollmapPtr_t)0x47E990;
Load_PhysPresetPtr_t Load_PhysPresetPtr = (Load_PhysPresetPtr_t)0x4FAD30;
Load_TracerDefPtr_t Load_TracerDefPtr = (Load_TracerDefPtr_t)0x493090;
Load_snd_alias_list_nameArray_t Load_snd_alias_list_nameArray = (Load_snd_alias_list_nameArray_t)0x4499F0;
@ -286,6 +288,7 @@ namespace Game
Material*** varMaterialHandle = (Material***)0x112A878;
FxEffectDef*** varFxEffectDefHandle = (FxEffectDef***)0x112ACC0;
PhysCollmap*** varPhysCollmapPtr = (PhysCollmap***)0x112B440;
PhysPreset*** varPhysPresetPtr = (PhysPreset***)0x112B378;
Game::MaterialPass** varMaterialPass = (Game::MaterialPass**)0x112A960;
snd_alias_list_t*** varsnd_alias_list_name = (snd_alias_list_t***)0x112AF38;

View File

@ -105,6 +105,9 @@ namespace Game
typedef void(*DB_LoadXAssets_t)(XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
extern DB_LoadXAssets_t DB_LoadXAssets;
typedef void(*DB_LoadXFileData_t)(char *pos, int size);
extern DB_LoadXFileData_t DB_LoadXFileData;
typedef void(__cdecl * DB_ReadXFileUncompressed_t)(void* buffer, int size);
extern DB_ReadXFileUncompressed_t DB_ReadXFileUncompressed;
@ -266,6 +269,9 @@ namespace Game
typedef void(__cdecl *Load_PhysCollmapPtr_t)(bool atStreamStart);
extern Load_PhysCollmapPtr_t Load_PhysCollmapPtr;
typedef void(__cdecl *Load_PhysPresetPtr_t)(bool atStreamStart);
extern Load_PhysPresetPtr_t Load_PhysPresetPtr;
typedef void(__cdecl *Load_TracerDefPtr_t)(bool atStreamStart);
extern Load_TracerDefPtr_t Load_TracerDefPtr;
@ -576,6 +582,7 @@ namespace Game
extern Material*** varMaterialHandle;
extern FxEffectDef*** varFxEffectDefHandle;
extern PhysCollmap*** varPhysCollmapPtr;
extern PhysPreset*** varPhysPresetPtr;
extern Game::MaterialPass** varMaterialPass;
extern snd_alias_list_t*** varsnd_alias_list_name;

View File

@ -227,7 +227,7 @@ namespace Game
short height;
short width;
short depth;
bool loaded;
char loaded;
char pad;
char* name;
};
@ -2312,6 +2312,469 @@ namespace Game
char pad[716];
};
struct XModelDrawInfo
{
unsigned __int16 lod;
unsigned __int16 surfId;
};
struct GfxSceneDynModel
{
XModelDrawInfo info;
unsigned __int16 dynEntId;
};
struct BModelDrawInfo
{
unsigned __int16 surfId;
};
struct GfxSceneDynBrush
{
BModelDrawInfo info;
unsigned __int16 dynEntId;
};
struct GfxStreamingAabbTree
{
unsigned __int16 firstItem;
unsigned __int16 itemCount;
unsigned __int16 firstChild;
unsigned __int16 childCount;
float mins[3];
float maxs[3];
};
struct GfxWorldStreamInfo
{
int aabbTreeCount;
GfxStreamingAabbTree *aabbTrees;
int leafRefCount;
int *leafRefs;
};
union GfxColor
{
unsigned int packed;
char array[4];
};
union PackedUnitVec
{
unsigned int packed;
};
struct GfxWorldVertex
{
float xyz[3];
float binormalSign;
GfxColor color;
float texCoord[2];
float lmapCoord[2];
PackedUnitVec normal;
PackedUnitVec tangent;
};
struct GfxWorldVertexData
{
GfxWorldVertex *vertices;
void/*IDirect3DVertexBuffer9*/* worldVb;
};
#pragma pack(push, 4)
struct GfxLightImage
{
GfxImage *image;
char samplerState;
};
#pragma pack(pop)
struct GfxLightDef
{
const char *name;
GfxLightImage attenuation;
int lmapLookupStart;
};
struct GfxLight
{
char type;
char canUseShadowMap;
char unused[2];
float color[3];
float dir[3];
float origin[3];
float radius;
float cosHalfFovOuter;
float cosHalfFovInner;
int exponent;
unsigned int spotShadowIndex;
GfxLightDef *def;
};
struct GfxReflectionProbe
{
float offset[3];
};
struct cplane_s;
struct GfxWorldDpvsPlanes
{
int cellCount;
cplane_s *planes;
unsigned __int16 *nodes;
unsigned int *sceneEntCellBits; //Size = cellCount << 11
};
struct GfxAabbTree
{
float mins[3];
float maxs[3];
unsigned __int16 childCount;
unsigned __int16 surfaceCount;
unsigned __int16 startSurfIndex;
unsigned __int16 smodelIndexCount;
unsigned __int16 *smodelIndexes;
int childrenOffset;
};
struct GfxLightGridEntry
{
unsigned __int16 colorsIndex;
char primaryLightIndex;
char needsTrace;
};
struct GfxLightGridColors
{
char rgb[56][3];
};
struct GfxStaticModelInst
{
float mins[3];
float maxs[3];
GfxColor groundLighting;
};
struct srfTriangles_t
{
int vertexLayerData;
int firstVertex;
unsigned __int16 vertexCount;
unsigned __int16 triCount;
int baseIndex;
};
struct GfxSurface
{
srfTriangles_t tris;
Material *material;
char lightmapIndex;
char reflectionProbeIndex;
char primaryLightIndex;
bool castsSunShadow;
};
struct GfxCullGroup
{
float mins[3];
float maxs[3];
int surfaceCount;
int startSurfIndex;
};
struct GfxDrawSurfFields
{
__int64 _bf0;
};
union GfxDrawSurf
{
GfxDrawSurfFields fields;
unsigned __int64 packed;
};
struct GfxStaticModelDrawInst;
struct GfxWorldDpvsStatic
{
unsigned int smodelCount;
unsigned int staticSurfaceCount;
unsigned int litSurfsBegin;
unsigned int litSurfsEnd;
char unknown1[0x20];
char *smodelVisData[3];
char *surfaceVisData[3];
unsigned __int16 *sortedSurfIndex;
GfxStaticModelInst *smodelInsts;
GfxSurface *surfaces;
GfxCullGroup *cullGroups;
GfxStaticModelDrawInst *smodelDrawInsts;
GfxDrawSurf *surfaceMaterials;
unsigned int *surfaceCastsSunShadow;
volatile int usageCount;
};
#pragma pack(push, 4)
struct GfxPackedPlacement
{
float origin[3];
PackedUnitVec axis[3];
float scale;
};
struct GfxStaticModelDrawInst
{
GfxPackedPlacement placement;
XModel *model;
float cullDist;
char reflectionProbeIndex;
char primaryLightIndex;
unsigned __int16 lightingHandle;
char flags;
};
struct cplane_s
{
float normal[3];
float dist;
char type;
char signbits;
};
struct GfxPortalWritable
{
bool isQueued;
bool isAncestor;
char recursionDepth;
char hullPointCount;
float(*hullPoints)[2];
};
struct DpvsPlane
{
float coeffs[4];
char side[3];
};
struct GfxPortal
{
GfxPortalWritable writable;
DpvsPlane plane;
float(*vertices)[3];
char unknown[2];
char vertexCount;
float hullAxis[2][3];
};
struct GfxCell
{
float mins[3];
float maxs[3];
int portalCount;
GfxPortal *portals;
char reflectionProbeCount;
char *reflectionProbes;
};
struct GfxLightmapArray
{
GfxImage *primary;
GfxImage *secondary;
};
struct GfxLightGrid
{
bool hasLightRegions;
unsigned int sunPrimaryLightIndex;
unsigned __int16 mins[3];
unsigned __int16 maxs[3];
unsigned int rowAxis;
unsigned int colAxis;
unsigned __int16 *rowDataStart;
unsigned int rawRowDataSize;
char *rawRowData;
unsigned int entryCount;
GfxLightGridEntry *entries;
unsigned int colorCount;
GfxLightGridColors *colors;
};
struct GfxBrushModelWritable
{
float mins[3];
float maxs[3];
};
struct GfxBrushModel
{
GfxBrushModelWritable writable;
float bounds[2][3];
unsigned int surfaceCount;
unsigned int startSurfIndex;
};
struct MaterialMemory
{
Material *material;
int memory;
};
struct sunflare_t
{
bool hasValidData;
Material *spriteMaterial;
Material *flareMaterial;
float spriteSize;
float flareMinSize;
float flareMinDot;
float flareMaxSize;
float flareMaxDot;
float flareMaxAlpha;
int flareFadeInTime;
int flareFadeOutTime;
float blindMinDot;
float blindMaxDot;
float blindMaxDarken;
int blindFadeInTime;
int blindFadeOutTime;
float glareMinDot;
float glareMaxDot;
float glareMaxLighten;
int glareFadeInTime;
int glareFadeOutTime;
float sunFxPosition[3];
};
struct GfxShadowGeometry
{
unsigned __int16 surfaceCount;
unsigned __int16 smodelCount;
unsigned __int16 *sortedSurfIndex;
unsigned __int16 *smodelIndex;
};
struct GfxLightRegionAxis
{
float dir[3];
float midPoint;
float halfSize;
};
struct GfxLightRegionHull
{
float kdopMidPoint[9];
float kdopHalfSize[9];
unsigned int axisCount;
GfxLightRegionAxis *axis;
};
struct GfxLightRegion
{
unsigned int hullCount;
GfxLightRegionHull *hulls;
};
struct GfxWorldDpvsDynamic
{
unsigned int dynEntClientWordCount[2];
unsigned int dynEntClientCount[2];
unsigned int *dynEntCellBits[2];
char *dynEntVisData[2][3];
};
struct SunLightParseParams
{
char name[64];
float ambientScale;
float ambientColor[3];
float diffuseFraction;
float sunLight;
float sunColor[3];
float diffuseColor[3];
bool diffuseColorHasBeenSet;
float angles[3];
};
struct GfxWorldVertexLayerData
{
char *data;
void/*IDirect3DVertexBuffer9*/* layerVb;
};
typedef char GfxTexture[0x34];
struct GfxWorldDraw
{
unsigned int reflectionProbeCount;
GfxImage * * reflectionImages;
GfxReflectionProbe *reflectionProbes;
GfxTexture * reflectionProbeTextures; //Count = refelctionProbeCount
int lightmapCount;
GfxLightmapArray *lightmaps;
GfxTexture * lightmapPrimaryTextures; //Count = lightmapCount
GfxTexture * lightmapSecondaryTextures; //Count = lightmapCount
GfxImage *skyImage;
GfxImage *outdoorImage;
unsigned int vertexCount;
GfxWorldVertexData vd;
unsigned int vertexLayerDataSize;
GfxWorldVertexLayerData vld;
int indexCount;
unsigned __int16 *indices;
void/*IDirect3DIndexBuffer9*/* indexBuffer;
};
struct unknownGfxWorldStruct2
{
int unknownCount;
int * unknownArray;
GfxImage * unknownImage;
int unknown;
};
struct GfxWorld
{
const char *name;
const char *baseName;
int planeCount;
int nodeCount;
int unknown2;
unsigned int unknownCount1;
unknownGfxWorldStruct2 * unknownStructs1; //Count = unknownCount1;
char unknown1[0x18];
GfxWorldDpvsPlanes dpvsPlanes; //The following rely on the count in this
char *unknown4;
GfxAabbTree *aabbTree;
GfxCell *cells;
GfxWorldDraw worldDraw;
GfxLightGrid lightGrid;
int modelCount;
GfxBrushModel *models;
float mins[3];
float maxs[3];
unsigned int checksum;
int materialMemoryCount;
MaterialMemory *materialMemory;
sunflare_t sun;
unsigned int *cellCasterBits[2];
GfxSceneDynModel *sceneDynModel;
GfxSceneDynBrush *sceneDynBrush;
unsigned int *primaryLightEntityShadowVis;
unsigned int *primaryLightDynEntShadowVis[2];
char *primaryLightForModelDynEnt;
GfxShadowGeometry *shadowGeom;
GfxLightRegion *lightRegion;
GfxWorldDpvsStatic dpvs;
GfxWorldDpvsDynamic dpvsDyn;
unsigned int unknownCount3;
char * unknown3; //Size = unknownCount2 * 0x38
int unknown5;
};
#pragma pack(pop)
union XAssetHeader
{
void *data;
@ -2345,6 +2808,7 @@ namespace Game
GameWorldSp* gameMapSP;
TracerDef* tracer;
VehicleDef* vehicle;
GfxWorld* gfxMap;
};
struct XAsset