Fix noborder stuff

This commit is contained in:
momo5502 2016-06-28 12:46:28 +02:00
parent 9b2d709211
commit 8a4c64c2db
12 changed files with 39 additions and 53 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit ced823cd95b70b313fa56baad544ccec5d6ccd5b
Subproject commit 4d65cb1c0ff6c8e50127afd6d9e2a88fe5f30972

View File

@ -8,4 +8,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void Load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -8,4 +8,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void Load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -9,4 +9,4 @@ namespace Assets
virtual void Mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void Load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -7,4 +7,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -8,4 +8,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void Mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -7,4 +7,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -8,4 +8,4 @@ namespace Assets
virtual void Save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
virtual void Load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
};
}
}

View File

@ -10,4 +10,4 @@ namespace Assets
void Save_StructuredDataEnumArray(Game::StructuredDataEnum* enums, int numEnums, Components::ZoneBuilder::Zone* builder);
void Save_StructuredDataStructArray(Game::StructuredDataStruct* structs, int numStructs, Components::ZoneBuilder::Zone* builder);
};
}
}

View File

@ -61,18 +61,26 @@ namespace Components
return ((point.x - rect.left) > 0 && (point.y - rect.top) > 0 && (rect.right - point.x) > 0 && (rect.bottom - point.y) > 0);
}
int Window::IsNoBorder()
{
return Window::NoBorder.Get<bool>();
}
void __declspec(naked) Window::StyleHookStub()
{
if (Window::NoBorder.Get<bool>())
__asm
{
__asm mov ebp, WS_VISIBLE | WS_POPUP
}
else
{
__asm mov ebp, WS_VISIBLE | WS_SYSMENU | WS_CAPTION
}
call Window::IsNoBorder
test al, al
jz setBorder
__asm retn
mov ebp, WS_VISIBLE | WS_POPUP
retn
setBorder:
mov ebp, WS_VISIBLE | WS_SYSMENU | WS_CAPTION
retn
}
}
void Window::DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material)

View File

@ -22,6 +22,8 @@ namespace Components
static HWND MainWindow;
static int IsNoBorder();
static int WINAPI ShowCursorHook(BOOL show);
static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material);

View File

@ -214,7 +214,7 @@ namespace Components
FILETIME fileTime;
GetSystemTimeAsFileTime(&fileTime);
Game::XFileHeader header = { XFILE_MAGIC_UNSIGNED, XFILE_VERSION_IW4X, Game::XFileLanguage::XLANG_NONE, fileTime.dwHighDateTime, fileTime.dwLowDateTime };
Game::XFileHeader header = { XFILE_MAGIC_UNSIGNED, XFILE_VERSION_IW4X, Game::XFileLanguage::XLANG_NONE, fileTime.dwHighDateTime, fileTime.dwLowDateTime };
std::string outBuffer;
outBuffer.append(reinterpret_cast<char*>(&header), sizeof(header));
@ -317,12 +317,16 @@ namespace Components
}
// Add branding asset
// TODO: Check if a RawFile with the same name has already been added, to prevent conflicts.
void ZoneBuilder::Zone::AddBranding()
{
char* data = "FastFile built using IW4x ZoneTool!";
ZoneBuilder::Zone::Branding = { ZoneBuilder::Zone::ZoneName.data(), (int)strlen(data), 0, data };
if (ZoneBuilder::Zone::FindAsset(Game::XAssetType::ASSET_TYPE_RAWFILE, ZoneBuilder::Zone::Branding.name) != -1)
{
Logger::Error("Unable to add branding. Asset '%s' already exists!", ZoneBuilder::Zone::Branding.name);
}
Game::XAssetHeader header = { &Branding };
Game::XAsset brandingAsset = { Game::XAssetType::ASSET_TYPE_RAWFILE, header };
ZoneBuilder::Zone::LoadedAssets.push_back(brandingAsset);
@ -387,16 +391,14 @@ namespace Components
// Find a local scriptString
int ZoneBuilder::Zone::FindScriptString(std::string str)
{
int loc = 0;
for (auto it : ZoneBuilder::Zone::ScriptStrings)
for (unsigned int i = 0; i < ZoneBuilder::Zone::ScriptStrings.size(); ++i)
{
++loc;
if (!it.compare(str))
if (ZoneBuilder::Zone::ScriptStrings[i] == str)
{
return loc;
return (i + 1);
}
}
return -1;
}
@ -461,37 +463,11 @@ namespace Components
ZoneBuilder::ZoneBuilder()
{
static_assert(sizeof(Game::XFileHeader) == 21, "Invalid XFileHeader structure!");
static_assert(sizeof(Game::XFile) == 40, "Invalid XFile structure!");
Assert_Size(Game::XFileHeader, 21);
Assert_Size(Game::XFile, 40);
static_assert(Game::MAX_XFILE_COUNT == 8, "XFile block enum is invalid!");
ZoneBuilder::EndAssetTrace();
AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
{
// static void* blocTable = 0;
//
// if (FastFiles::Current() == "iw4x_ui_mp" && type == Game::XAssetType::ASSET_TYPE_MATERIAL)
// {
// if (name == "preview_mp_bloc"s)
// {
// blocTable = asset.material->stateBitTable;
// }
// else if (blocTable)
// {
// void* thisTable = asset.material->stateBitTable;
//
// if (thisTable != blocTable)
// {
// OutputDebugStringA("DIFF!");
// }
// else
// {
// OutputDebugStringA("YAY!");
// }
// }
// }
});
if (ZoneBuilder::IsEnabled())
{