Commit 09e06eab authored by Grant Kim's avatar Grant Kim
Browse files

[Maintenance] Update missing files

parent 76037120
set(Boost_COMPILER "mgw112" CACHE STRING "Override Boost's broken detection for mingw")
\ No newline at end of file
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
PROJECT(BOSSDummy)
......
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
CMAKE_MINIMUM_REQUIRED (VERSION 3.13)
project(hookdll)
find_package(Boost REQUIRED COMPONENTS thread)
......@@ -42,6 +42,9 @@ target_link_libraries( hookdll PUBLIC psapi version shlwapi bsatk z Boost::threa
target_include_directories(hookdll PUBLIC
${CMAKE_SOURCE_DIR}/src/common/platforms/msw)
target_compile_options(hookdll PRIVATE -fno-tree-vectorize -static -static-libgcc -static-libstdc++)
set_target_properties(hookdll PROPERTIES STATIC_LIBRARY_OPTIONS ON)
# include_directories()
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="lib" version="1.0.0.0" processorArchitecture="x86"/>
<file name="Qt5Core.dll"/>
<file name="Qt5Gui.dll"/>
<file name="Qt5Network.dll"/>
<file name="Qt5Qml.dll"/>
<file name="Qt5QmlModels.dll"/>
<file name="Qt5Quick.dll"/>
<file name="Qt5QuickWidgets.dll"/>
<file name="Qt5Widgets.dll"/>
<file name="Qt5WinExtras.dll"/>
<file name="Qt5Xml.dll"/>
</assembly>
add_executable(molauncher WIN32 src/molauncher.c src/molauncher.rc)
add_executable(molauncher WIN32 src/molauncher.c)
target_link_libraries(molauncher PRIVATE shlwapi)
target_link_options(molauncher PRIVATE -Wl,--large-address-aware)
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity name='lib' processorArchitecture='x86' version='1.0.0.0' type='win32' />
</dependentAssembly>
</dependency>
</assembly>
#include "Winver.h"
1 24 "nxmhandler.manifests.xml"
#define VER_FILEVERSION 1,1,0,0
#define VER_FILEVERSION_STR "1,1,0,0\0"
......
......@@ -34,7 +34,7 @@
<dependency>
<dependentAssembly>
<assemblyIdentity name='dlls' processorArchitecture='x86' version='1.0.0.0' type='win32' />
<assemblyIdentity name='lib' processorArchitecture='x86' version='1.0.0.0' type='win32' />
</dependentAssembly>
</dependency>
......
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
CMAKE_POLICY(SET CMP0020 NEW)
CMAKE_POLICY(SET CMP0043 NEW)
......
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
CMAKE_POLICY(SET CMP0020 NEW)
CMAKE_POLICY(SET CMP0043 NEW)
......
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
CMAKE_POLICY(SET CMP0020 NEW)
......
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
CMAKE_POLICY(SET CMP0020 NEW)
......
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0020 NEW)
......@@ -7,18 +7,17 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} gameGamebryo_SRCS)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt5Widgets REQUIRED)
find_package(
Qt5
COMPONENTS Widgets
REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
set(default_project_path "${CMAKE_SOURCE_DIR}/..")
set(default_project_path "${CMAKE_SOURCE_DIR}")
get_filename_component(${default_project_path} ${default_project_path} REALPATH)
set(project_path
......@@ -34,14 +33,11 @@ message(STATUS ${project_path})
link_directories(${lib_path})
add_library(gameGamebryo STATIC ${gameGamebryo_SRCS})
target_link_libraries(gameGamebryo
Qt5::Widgets
${Boost_LIBRARIES}
uibase)
target_include_directories(gameGamebryo
INTERFACE ${project_path}/uibase
${project_path}/plugins/gameFeatures)
target_link_libraries(gameGamebryo Qt5::Widgets Boost::boost uibase)
# FIXME: target_include_directories doesn't work for Qt's moc.
include_directories(gameGamebryo ${project_path}/ModOrganizer/src/uibase
${project_path}/ModOrganizer/src/plugins/gameFeatures)
# SET_TARGET_PROPERTIES(gameGamebryo PROPERTIES COMPILE_FLAGS /GL)
# SET_TARGET_PROPERTIES(gameGamebryo PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LTCG
......
import os
Import('qt_env')
env = qt_env.Clone()
env.AppendUnique(CPPPATH = [
os.path.join('..', 'gamefeatures'),
'${BOOSTPATH}'
])
env.StaticLibrary('gameGamebryo', env.Glob('*.cpp'))
res = env['QT_USED_MODULES']
Return('res')
......@@ -18,227 +18,174 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dummybsa.h"
#include <QFile>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
static void writeUlong( unsigned char *buffer, int offset, unsigned long value )
static void writeUlong(unsigned char* buffer, int offset, unsigned long value)
{
union
{
union {
unsigned long ulValue;
unsigned char cValue[4];
};
ulValue = value;
memcpy( buffer + offset, cValue, 4 );
memcpy(buffer + offset, cValue, 4);
}
static void
writeUlonglong( unsigned char *buffer, int offset, unsigned long long value )
static void writeUlonglong(unsigned char* buffer, int offset, unsigned long long value)
{
union
{
union {
unsigned long long ullValue;
unsigned char cValue[8];
unsigned char cValue[8];
};
ullValue = value;
memcpy( buffer + offset, cValue, 8 );
memcpy(buffer + offset, cValue, 8);
}
static unsigned long
genHashInt( const unsigned char *pos, const unsigned char *end )
static unsigned long genHashInt(const unsigned char *pos, const unsigned char *end)
{
unsigned long hash = 0;
for ( ; pos < end; ++pos )
{
for (; pos < end; ++pos) {
hash *= 0x1003f;
hash += *pos;
}
return hash;
}
static unsigned long long genHash( const char *fileName )
static unsigned long long genHash(const char* fileName)
{
char fileNameLower[MAX_PATH + 1];
int i = 0;
for ( ; i < MAX_PATH && fileName[i] != '\0'; ++i )
{
fileNameLower[i] = static_cast<char>( tolower( fileName[i] ) );
if ( fileNameLower[i] == '\\' )
{
int i = 0;
for (; i < MAX_PATH && fileName[i] != '\0'; ++i) {
fileNameLower[i] = static_cast<char>(tolower(fileName[i]));
if (fileNameLower[i] == '\\') {
fileNameLower[i] = '/';
}
}
fileNameLower[i] = '\0';
unsigned char *fileNameLowerU =
reinterpret_cast<unsigned char *>( fileNameLower );
unsigned char *fileNameLowerU = reinterpret_cast<unsigned char*>(fileNameLower);
char *ext = strrchr( fileNameLower, '.' );
if ( ext == nullptr )
{
ext = fileNameLower + strlen( fileNameLower );
char* ext = strrchr(fileNameLower, '.');
if (ext == nullptr) {
ext = fileNameLower + strlen(fileNameLower);
}
unsigned char *extU = reinterpret_cast<unsigned char *>( ext );
unsigned char *extU = reinterpret_cast<unsigned char*>(ext);
int length = ext - fileNameLower;
unsigned long long hash = 0ULL;
if ( length > 0 )
{
hash = *( extU - 1 ) | ( ( length > 2 ? *( ext - 2 ) : 0 ) << 8 ) |
( length << 16 ) | ( fileNameLowerU[0] << 24 );
if (length > 0) {
hash = *(extU - 1) |
((length > 2 ? *(ext - 2) : 0) << 8) |
(length << 16) |
(fileNameLowerU[0] << 24);
}
if ( strlen( ext ) > 0 )
{
if ( strcmp( ext + 1, "kf" ) == 0 )
{
if (strlen(ext) > 0) {
if (strcmp(ext + 1, "kf") == 0) {
hash |= 0x80;
}
else if ( strcmp( ext + 1, "nif" ) == 0 )
{
} else if (strcmp(ext + 1, "nif") == 0) {
hash |= 0x8000;
}
else if ( strcmp( ext + 1, "dds" ) == 0 )
{
} else if (strcmp(ext + 1, "dds") == 0) {
hash |= 0x8080;
}
else if ( strcmp( ext + 1, "wav" ) == 0 )
{
} else if (strcmp(ext + 1, "wav") == 0) {
hash |= 0x80000000;
}
unsigned long long temp = static_cast<unsigned long long>(
genHashInt( fileNameLowerU + 1, extU - 2 ) );
temp += static_cast<unsigned long long>(
genHashInt( extU, extU + strlen( ext ) ) );
unsigned long long temp = static_cast<unsigned long long>(genHashInt(
fileNameLowerU + 1, extU - 2));
temp += static_cast<unsigned long long>(genHashInt(
extU, extU + strlen(ext)));
hash |= ( temp & 0xFFFFFFFF ) << 32;
hash |= (temp & 0xFFFFFFFF) << 32;
}
return hash;
}
DummyBSA::DummyBSA( unsigned long bsaVersion )
: m_Version( bsaVersion )
, m_FolderName( "" )
, m_FileName( "dummy.dds" )
, m_TotalFileNameLength( 0 )
DummyBSA::DummyBSA(unsigned long bsaVersion)
: m_Version(bsaVersion)
, m_FolderName("")
, m_FileName("dummy.dds")
, m_TotalFileNameLength(0)
{
}
void DummyBSA::writeHeader( QFile &file )
void DummyBSA::writeHeader(QFile &file)
{
unsigned char header[] = {
'B', 'S', 'A', '\0', // magic string
0xDE, 0xAD, 0xBE, 0xEF, // version - insert later
0x24, 0x00, 0x00, 0x00, // offset to folder recors. header size is static
0xDE, 0xAD, 0xBE, 0xEF, // archive flags - insert later
0x01, 0x00, 0x00, 0x00, // folder count
0x01, 0x00, 0x00, 0x00, // file count
0xDE, 0xAD, 0xBE, 0xEF, // total folder names length - insert later
0xDE, 0xAD, 0xBE, 0xEF, // total file names length - insert later
0xDE, 0xAD, 0xBE, 0xEF // file flags - insert later
};
writeUlong( header, 4, m_Version );
writeUlong( header, 12, 0x01 | 0x02 ); // has directories and has files.
writeUlong( header, 24, m_FolderName.length() + 1 ); // empty folder name
writeUlong( header, 28, m_TotalFileNameLength ); // single character file name
writeUlong( header, 32, 2 ); // has dds
file.write( reinterpret_cast<char *>( header ), sizeof( header ) );
'B', 'S', 'A', '\0', // magic string
0xDE, 0xAD, 0xBE, 0xEF, // version - insert later
0x24, 0x00, 0x00, 0x00, // offset to folder recors. header size is static
0xDE, 0xAD, 0xBE, 0xEF, // archive flags - insert later
0x01, 0x00, 0x00, 0x00, // folder count
0x01, 0x00, 0x00, 0x00, // file count
0xDE, 0xAD, 0xBE, 0xEF, // total folder names length - insert later
0xDE, 0xAD, 0xBE, 0xEF, // total file names length - insert later
0xDE, 0xAD, 0xBE, 0xEF // file flags - insert later
};
writeUlong(header, 4, m_Version);
writeUlong(header, 12, 0x01 | 0x02); // has directories and has files.
writeUlong(header, 24, m_FolderName.length() + 1); // empty folder name
writeUlong(header, 28, m_TotalFileNameLength); // single character file name
writeUlong(header, 32, 2); // has dds
file.write(reinterpret_cast<char*>(header), sizeof(header));
}
void DummyBSA::writeFolderRecord( QFile &file, const std::string &folderName )
void DummyBSA::writeFolderRecord(QFile &file, const std::string &folderName)
{
unsigned char folderRecord[] = {
0xDE,
0xAD,
0xBE,
0xEF,
0xDE,
0xAD,
0xBE,
0xEF, // folder hash
0x01,
0x00,
0x00,
0x00, // file count
0xDE,
0xAD,
0xBE,
0xEF, // offset to folder name
};
0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF, // folder hash
0x01, 0x00, 0x00, 0x00, // file count
0xDE, 0xAD, 0xBE, 0xEF, // offset to folder name
};
// we'd usually have to sort folders be the hash value generated here
writeUlonglong( folderRecord, 0, genHash( folderName.c_str() ) );
writeUlong(
folderRecord,
12,
0x34 +
m_TotalFileNameLength ); // TODO: this should be calculated properly
file.write(
reinterpret_cast<char *>( folderRecord ), sizeof( folderRecord ) );
writeUlonglong(folderRecord, 0, genHash(folderName.c_str()));
writeUlong( folderRecord, 12, 0x34 + m_TotalFileNameLength); // TODO: this should be calculated properly
file.write(reinterpret_cast<char*>(folderRecord), sizeof(folderRecord));
}
void DummyBSA::writeFileRecord( QFile &file, const std::string &fileName )
void DummyBSA::writeFileRecord(QFile &file, const std::string &fileName)
{
unsigned char fileRecord[] = {
0xDE,
0xAD,
0xBE,
0xEF,
0xDE,
0xAD,
0xBE,
0xEF, // file name hash
0xDE,
0xAD,
0xBE,
0xEF, // size
0xDE,
0xAD,
0xBE,
0xEF, // offset to file data
};
0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF, // file name hash
0xDE, 0xAD, 0xBE, 0xEF, // size
0xDE, 0xAD, 0xBE, 0xEF, // offset to file data
};
// we'd usually have to sort files by the value generated here
writeUlonglong( fileRecord, 0, genHash( fileName.c_str() ) );
writeUlong( fileRecord, 8, 0 );
writeUlong(
fileRecord,
12,
0x44 + ( fileName.length() + 1 ) +
4 ); // after this record we expect the filename and 4 bytes of file
// size
file.write( reinterpret_cast<char *>( fileRecord ), sizeof( fileRecord ) );
writeUlonglong(fileRecord, 0, genHash(fileName.c_str()));
writeUlong( fileRecord, 8, 0);
writeUlong( fileRecord, 12, 0x44 + (fileName.length() + 1) + 4); // after this record we expect the filename and 4 bytes of file size
file.write(reinterpret_cast<char*>(fileRecord), sizeof(fileRecord));
}
void DummyBSA::writeFileRecordBlocks(
QFile &file, const std::string &folderName )
void DummyBSA::writeFileRecordBlocks(QFile &file, const std::string &folderName)
{
file.write( folderName.c_str(), folderName.length() + 1 );
file.write(folderName.c_str(), folderName.length() + 1);
writeFileRecord( file, m_FileName );
writeFileRecord(file, m_FileName);
}
void DummyBSA::write( const QString &fileName )
void DummyBSA::write(const QString &fileName)
{
QFile file( fileName );
file.open( QIODevice::WriteOnly );
QFile file(fileName);
file.open(QIODevice::WriteOnly);
m_TotalFileNameLength = m_FileName.length() + 1;
writeHeader( file );
writeFolderRecord( file, m_FolderName );
writeFileRecordBlocks( file, m_FolderName );
file.write( m_FileName.c_str(), m_FileName.length() + 1 );
char fileSize[] = {0x00, 0x00, 0x00, 0x00};
file.write( fileSize, sizeof( fileSize ) );
writeHeader(file);
writeFolderRecord(file, m_FolderName);
writeFileRecordBlocks(file, m_FolderName);
file.write(m_FileName.c_str() , m_FileName.length() + 1);
char fileSize[] = { 0x00, 0x00, 0x00, 0x00 };
file.write(fileSize, sizeof(fileSize));
file.close();
}
......@@ -20,8 +20,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef DUMMYBSA_H
#define DUMMYBSA_H
#include <QFile>
#include <QString>
#include <QFile>
/**
* @brief Class for creating a dummy bsa used for archive invalidation
......@@ -30,30 +30,35 @@ class DummyBSA
{
public:
/**
* @brief constructor
*
**/
DummyBSA( unsigned long bsaVersion );
DummyBSA(unsigned long bsaVersion);
/**
* @brief write to the specified file
*
* @param fileName name of the file to write to
**/
void write( const QString &fileName );
void write(const QString &fileName);
private:
void writeHeader( QFile &file );
void writeFolderRecord( QFile &file, const std::string &folderName );
void writeFileRecord( QFile &file, const std::string &fileName );
void writeFileRecordBlocks( QFile &file, const std::string &folderName );
void writeHeader(QFile &file);
void writeFolderRecord(QFile &file, const std::string &folderName);
void writeFileRecord(QFile &file, const std::string &fileName);
void writeFileRecordBlocks(QFile &file, const std::string &folderName);
private:
unsigned long m_Version;
std::string m_FolderName;
std::string m_FileName;
std::string m_FolderName;
std::string m_FileName;
unsigned long m_TotalFileNameLength;
};
#endif // DUMMYBSA_H
#-------------------------------------------------
#
# Project created by QtCreator 2015-01-26T19:47:42
#
#-------------------------------------------------
TARGET = gameGamebryo
TEMPLATE = lib
CONFIG += staticlib
SOURCES += gamegamebryo.cpp \
dummybsa.cpp \
gamebryobsainvalidation.cpp \
gamebryodataarchives.cpp
HEADERS += gamegamebryo.h \
dummybsa.h \
gamebryobsainvalidation.h \
gamebryodataarchives.h
include(../plugin_template