Mirror map when dumped

This commit is contained in:
momo5502 2016-10-09 12:34:06 +02:00
parent ad18adc187
commit aea12a25ef
4 changed files with 84 additions and 3 deletions

View File

@ -132,6 +132,32 @@ namespace Components
}
}
if (type == 21)
{
//asset->gfxMap->dpvs.staticSurfaceCount = 0;
//
// for (unsigned int i = 0; i < asset->gfxMap->dpvs.staticSurfaceCount; ++i)
// {
// //OutputDebugStringA(Utils::String::VA("%i\n", asset->gfxMap->dpvs.sortedSurfIndex[i] & 0xFFFF));
// asset->gfxMap->dpvs.sortedSurfIndex[i] = i;
// }
// OutputDebugStringA("\n");
// for (int i = 0; i < asset->gfxMap->unknown2; ++i)
// {
// if (i < (asset->gfxMap->unknown2 - 1))
// {
// asset->gfxMap->dpvs.surfaceMaterials[i].packed = 0;
// }
// }
}
if (type == 5 && Utils::String::StartsWith(name, "wc/"))
{
//asset->material->sortKey = rand() & 0xFF;
OutputDebugStringA(Utils::String::VA("%s: %X %s", FastFiles::Current().data(), asset->material->sortKey & 0xFF, asset->material->name));
}
if (type == 5 && name == "wc/codo_ui_viewer_black_decal3"s)
{
asset->material->sortKey = 0xE;

View File

@ -202,10 +202,9 @@ namespace Components
Logger::Print("Writing vertices...\n");
for (unsigned int i = 0; i < world->worldDraw.vertexCount; i++)
{
// Y/Z need to be inverted
float x = world->worldDraw.vd.vertices[i].xyz[0];
float x = world->worldDraw.vd.vertices[i].xyz[1];
float y = world->worldDraw.vd.vertices[i].xyz[2];
float z = world->worldDraw.vd.vertices[i].xyz[1];
float z = world->worldDraw.vd.vertices[i].xyz[0];
map.append(fmt::sprintf("v %.6f %.6f %.6f\n", x,y, z));
}

View File

@ -1083,6 +1083,9 @@ namespace Components
image->depth = image359.depth;
image->loaded = image359.loaded;
image->name = image359.name;
// Used for later stuff
image->pad = image359.pad3[1];
}
else
{
@ -1092,6 +1095,20 @@ namespace Components
return result;
}
Utils::Hook LoadTextureHook;
int LoadTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image)
{
if (Zones::Version() >= 359 && (((image->pad & 1) && !(image->pad & 2))))
{
image->loaded = 1;
image->texture = 0;
return 1;
}
return Game::Load_Texture(loadDef, image);
}
bool Zones::LoadXAsset(bool atStreamStart, char* buffer, int size)
{
size /= 8;
@ -1303,6 +1320,8 @@ namespace Components
Zones::LoadGfxWorldHook.Install();
Zones::Loadsunflare_tHook.Install();
LoadTextureHook.Install();
// menu stuff
Utils::Hook::Nop(0x41A590, 5);
}
@ -1314,6 +1333,8 @@ namespace Components
Zones::LoadGfxWorldHook.Uninstall();
Zones::Loadsunflare_tHook.Uninstall();
LoadTextureHook.Uninstall();
Utils::Hook(0x41A590, 0x4AF680, HOOK_CALL).Install()->Quick();
}
@ -1355,14 +1376,26 @@ namespace Components
Zones::LoadGfxWorldHook.Uninstall();
Zones::Loadsunflare_tHook.Uninstall();
LoadTextureHook.Uninstall();
Utils::Hook(0x41A590, 0x4AF680, HOOK_CALL).Install()->Quick();
}
AntiCheat::EmptyHash();
}
int ___test()
{
return 0;
}
Zones::Zones()
{
// Utils::Hook(0x525A90, ___test, HOOK_JUMP).Install()->Quick();
// Utils::Hook(0x50C4F0, ___test, HOOK_JUMP).Install()->Quick();
// Utils::Hook(0x514F90, ___test, HOOK_JUMP).Install()->Quick();
// Utils::Hook(0x54A2E0, ___test, HOOK_JUMP).Install()->Quick();
Zones::ZoneVersion = 0;
// Ignore missing soundaliases for now
@ -1404,6 +1437,8 @@ namespace Components
{
ZeroMemory(*Game::varPathData, sizeof(Game::PathData));
}, HOOK_CALL);
LoadTextureHook.Initialize(0x4D32BC, LoadTexture, HOOK_CALL);
}
Zones::~Zones()

View File

@ -237,6 +237,27 @@ namespace Game
char* name;
};
struct GfxImage_new
{
GfxImageLoadDef* texture;
char mapType;
char semantic;
char category;
char flags;
int cardMemory;
char pad[8]; // ?
int dataLen1;
int dataLen2;
char pad2[4]; // ?
short height;
short width;
short depth;
char loaded;
char pad3[5];
GfxImageLoadDef* storedTexture;
char* name;
};
struct water_t
{
float floatTime;