From 1b241dfb24a70f35bedb443cc44947bc09491976 Mon Sep 17 00:00:00 2001 From: Andrej Redeky Date: Sun, 2 Jul 2023 21:23:17 +0200 Subject: [PATCH] Updated README.md, fixed third party licenses, added docs for formats (WIP) --- LICENSE_ThirdParty.md | 95 +++++++++++ README.md | 71 +++++--- data/localization/English.toml | 8 +- .../localization/\304\214e\305\241tina.toml" | 8 +- docs/HitmanBloodMoney/Formats/SND.h | 161 ++++++++++++++++++ docs/HitmanBloodMoney/Formats/STR.h | 34 ++++ docs/HitmanBloodMoney/Formats/WHD+WAV.h | 94 ++++++++++ docs/HitmanCodename47/Formats/IDX+BIN.h | 19 +++ docs/HitmanCodename47/Formats/WAV.h | 20 +++ docs/HitmanContracts/Formats/SND.h | 18 ++ docs/HitmanContracts/Formats/WAV.h | 30 ++++ docs/HitmanContracts/Formats/WHD+WAV.h | 50 ++++++ docs/HitmanSilentAssassin/Formats/SND.h | 18 ++ docs/HitmanSilentAssassin/Formats/WAV.h | 25 +++ docs/HitmanSilentAssassin/Formats/WHD+WAV.h | 50 ++++++ 15 files changed, 666 insertions(+), 35 deletions(-) create mode 100644 docs/HitmanBloodMoney/Formats/SND.h create mode 100644 docs/HitmanBloodMoney/Formats/STR.h create mode 100644 docs/HitmanBloodMoney/Formats/WHD+WAV.h create mode 100644 docs/HitmanCodename47/Formats/IDX+BIN.h create mode 100644 docs/HitmanCodename47/Formats/WAV.h create mode 100644 docs/HitmanContracts/Formats/SND.h create mode 100644 docs/HitmanContracts/Formats/WAV.h create mode 100644 docs/HitmanContracts/Formats/WHD+WAV.h create mode 100644 docs/HitmanSilentAssassin/Formats/SND.h create mode 100644 docs/HitmanSilentAssassin/Formats/WAV.h create mode 100644 docs/HitmanSilentAssassin/Formats/WHD+WAV.h diff --git a/LICENSE_ThirdParty.md b/LICENSE_ThirdParty.md index fd8ec9b..3551888 100644 --- a/LICENSE_ThirdParty.md +++ b/LICENSE_ThirdParty.md @@ -819,3 +819,98 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# NotoSans +Copyright 2022 The Noto Project Authors (https://github.com/notofonts) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/README.md b/README.md index 05eba87..9a8a502 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,51 @@ -# Hitman Audio Tool +# Glacier 1 Audio Tool + +## Supported + +### Hitman: Codename 47 +Format | Open | Save | Export | Import +:---|:---:|:---:|:---:|:---: +\*.IDX + \*.BIN | ✔ | ✔ | ✔ | ✔ +Repeat.WAV + PackRepeat.WAV | ✘ | ✘ | ✘ | ✘ + + +### Hitman: Silent Assassin +Format | Open | Save | Export | Import +:---|:---:|:---:|:---:|:---: +\*.WAV + \*.WHD + streams.wav | ✔ | ✔ | ✔ | ✔ +\*.SND (in scene's \*.ZIP) | ✘ | ✘ | ✘ | ✘ + +### Hitman: Contracts +Format | Open | Save | Export | Import +:---|:---:|:---:|:---:|:---: +\*.WAV + \*.WHD + streams.wav | ✔ | ✔ | ✔ | ✔ +\*.SND (in scene's \*.ZIP) | ✘ | ✘ | ✘ | ✘ + +### Hitman: Blood Money +Format | Open | Save | Export | Import +:---|:---:|:---:|:---:|:---: +\*.WAV + \*.WHD + \*.STR | ✔ | ✘ | ✔ | ✘ +\*.SND (in scene's \*.ZIP) | ✘ | ✘ | ✘ | ✘ ## Features - * Full support of import and export of the Hitman: Codename 47 *.idx/*.bin pairs existing entries - * Support for adding new ones is not planned for now - * Full supports of import and export of the Hitman 2: Silent Assassin and Hitman 3: Silent Assassin *.whd/*.wav pairs + streams.wav existing entries - * Support for adding new ones is not planned for now - * Automatically convert input data to exact game format - * Note that reimported files won't be 100% the same, but they will have exact same format (unless user tunes the options) - * Tool can also import all audio in highest quality as PCM 16-bit signed WAVs - * Conversions can be completely disabled, in which case tool tries to import data directly - * Automatically ignore unchanged original files from original archives when trying to import - * This feature can be turned off in case someone wants to reimport original files also for whatever reason - * Currently 2 supported languages - English and Czech + * Supports multiple Glacier 1 games (see list of supported formats and games above). + * Import and save functionality currently only encompasses replacements, not new additions. + * Automatically converts data to desired format on import. + * Offers nearly perfect reimport of data with default settings (imperfections are there only due to decompression and recompression). + * Ability to import in highest quality PCM S16 (best quality format game supports out of the box, this is not default and enabling this is experimental!). + * Automatically fixes number of channels and sample rate (both are enabled by default, disabling these options is experimental!). + * Tool can try to import data as-is for fastest imports (not enabled by default, disabling this option is experimental!). + * Ability to show modified entries in archives thanks to original records caching. + * Automatically ignore unchanged original files from original archives when trying to import. + * Records caching feature can be disabled, same as the option which ignores unchanged files on import. Beware that disabling records caching also causes unchanged files to get imported. + * Currently pre-packaged with __Steam__ data and default __English__ language. + * When you have different version, just remove `data/records` folder and let it regenerate records on first archive reload. + * Currently 2 supported languages - __English__ and __Czech__ * New localizations can be added by copying `data/localization/English.toml`, translating the entries and placing the copied file back into `data/localization` - * For example, you could create Deutsch.toml which would contain translations to German language and place it in the mentioned folder - * New option would then appear in the Options tab under Language - * If newly added language is missing glyphs in fonts used by the tool, you may add additional font defining them into `data/fonts` folder (note that fonts are currently being read in alphabetical order) + * For example, you could create `Deutsch.toml` which would contain translations to __German__ language and place it in the mentioned folder. + * New option would then appear in the __Options__ tab under __Language__. + * If newly added language is missing glyphs in fonts used by the tool, you may add additional font defining them into `data/fonts` folder (note that fonts are currently being read in alphabetical order, first font should always be the base font!). -## Future - * Definitely some more cleanup/refactor of the source code - * Code is clean enough to be readable and usable I would say, but it lacks comments and there is still a lot of duplication all around - * Some parts are also glued together from my previous projects, so there is inconsistent styling and some other stuff... - * I would still consider the tool in its early stages, but it can do much more for old Hitman 1, 2 and 3 games than the old Hitman Audio Tool floating around the internet (not mentioning it not correctly interpreting parts of the data, making exports broken and import from these exports impossible) - * I would like to expand this beyond older Hitman titles to all Glacier 1 games - * Freedom Fighters should be technically already in working state also, just have to update few smaller things in the tool - * Potential rename of the tool (considering it should support all Glacier 1 games....) - * Version 1.0.0 tagged code contains Hitman: Blood Money WIP code which seems to work for exports - * This code is currently locked under debug builds, so you have to build the tool yourself if you want to try this feature out for now - * Will be made as part of regular release when I figure out enough to be able to reliably import the files back and save the archives - ## Used "Open-Source Licensed" Tools * [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code. * [ReSharper C++](https://www.jetbrains.com/community/opensource/#support) - provides multiple features for increasing productivity when working with C++ code. diff --git a/data/localization/English.toml b/data/localization/English.toml index 184e79a..4c04222 100644 --- a/data/localization/English.toml +++ b/data/localization/English.toml @@ -33,8 +33,8 @@ SETTINGS_DIALOG_COMMON_GROUP = "Common" SETTINGS_DIALOG_DISABLE_WARNINGS = "Disable warnings" SETTINGS_DIALOG_CHECK_DATA_ORIGINALITY = "Check the originality of the data in archive" SETTINGS_DIALOG_IMPORT_ORIGINAL_FILES = "Import the unchanged original files" -SETTINGS_DIALOG_DIRECT_IMPORT = "Import the files directly without conversions" -SETTINGS_DIALOG_FIX_CHANNELS = "Fix the number of channels" -SETTINGS_DIALOG_FIX_SAMPLE_RATE = "Fix the sample rate" -SETTINGS_DIALOG_TRANSCODE_TO_ORIGINAL_FORMAT = "Transcode to the exact format of original game data" +SETTINGS_DIALOG_DIRECT_IMPORT = "Import the files directly without conversions (turning this OFF is experimental!)" +SETTINGS_DIALOG_FIX_CHANNELS = "Fix the number of channels on import (turning this OFF is experimental!)" +SETTINGS_DIALOG_FIX_SAMPLE_RATE = "Fix the sample rate on import (turning this OFF is experimental!)" +SETTINGS_DIALOG_TRANSCODE_TO_ORIGINAL_FORMAT = "Transcode to the exact format of original game data on import" SETTINGS_DIALOG_LANGUAGE = "Language" diff --git "a/data/localization/\304\214e\305\241tina.toml" "b/data/localization/\304\214e\305\241tina.toml" index e1ca9af..db83a87 100644 --- "a/data/localization/\304\214e\305\241tina.toml" +++ "b/data/localization/\304\214e\305\241tina.toml" @@ -33,8 +33,8 @@ SETTINGS_DIALOG_COMMON_GROUP = "Pro všechny" SETTINGS_DIALOG_DISABLE_WARNINGS = "Vypnout upozornění" SETTINGS_DIALOG_CHECK_DATA_ORIGINALITY = "Skontrolovat originalitu dat v archivu" SETTINGS_DIALOG_IMPORT_ORIGINAL_FILES = "Importovat i nezměnené originální soubory" -SETTINGS_DIALOG_DIRECT_IMPORT = "Importovat soubory napřímo bez konverzií" -SETTINGS_DIALOG_FIX_CHANNELS = "Opravit počet kanálů" -SETTINGS_DIALOG_FIX_SAMPLE_RATE = "Opravit vzorkovací frekvenci" -SETTINGS_DIALOG_TRANSCODE_TO_ORIGINAL_FORMAT = "Transkódovat na originální formát" +SETTINGS_DIALOG_DIRECT_IMPORT = "Importovat soubory napřímo bez konverzií (vypnuti tohodle nastavení je experimentální!)" +SETTINGS_DIALOG_FIX_CHANNELS = "Opravit počet kanálů při importu (vypnuti tohodle nastavení je experimentální!)" +SETTINGS_DIALOG_FIX_SAMPLE_RATE = "Opravit vzorkovací frekvenci při importu (vypnuti tohodle nastavení je experimentální!)" +SETTINGS_DIALOG_TRANSCODE_TO_ORIGINAL_FORMAT = "Převést při importu na originální formát" SETTINGS_DIALOG_LANGUAGE = "Jazyk" diff --git a/docs/HitmanBloodMoney/Formats/SND.h b/docs/HitmanBloodMoney/Formats/SND.h new file mode 100644 index 0000000..c423896 --- /dev/null +++ b/docs/HitmanBloodMoney/Formats/SND.h @@ -0,0 +1,161 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of SND files used by Hitman Blood Money. +// It is specific for Hitman Blood Money, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// Files represent a sound graph for specific scene with same name. They are contained in scene's ZIP file. +// + +#pragma once + +// always just 16 bytes like this +struct SND_Header +{ + uint32_t offsetToFooter; // points at the SND_Footer + uint32_t fileSize; // total file size including header + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; + +// footer is always at the end of the file, always of size 0x1E0 +struct SND_Footer +{ + uint32_t offsetToReservedTable1; // table always filled with nulls + uint32_t offsetToStreamsFilename; // always 0x10 as this is always right after basic header + uint32_t offsetToRootGroupEntry; // seems to point to some SND_EntryGroup... maybe some root group? if null it is not present in file + char unkC[0x74 - 0xC]; + uint32_t offsetsToTableOfSoundEntries; // all offsets points to SND_EntrySound, if null it is not present in file + uint32_t offsetsToTableOfSetEntries; // all offsets points to SND_EntrySet, if null it is not present in file + uint32_t offsetsToTableOfSequenceEntries; // all offsets points to SND_EntrySequence, if null it is not present in file + uint32_t offsetsToTableOfWaveEntries; // all offsets points to SND_EntryWave, if null it is not present in file + uint32_t offsetsToTableOfDefineEntries; // all offsets points to SND_EntryDefine, if null it is not present in file + uint32_t unk_offsetsToTableOfEntriesWithType_6; // unknown, assume that this is type table for 6 entries, all offsets points to SNDENTRY, if null it is not present in file + uint32_t offsetsToTableOfUnknownOffsets1; // all offsets points to seemingly null bytes, at least always a single row of 16-bytes with 0, had not observed more than 16-bytes yet + char unk90[0x1E0 - 0x90]; +}; + +// all observed types, types seem to be aligned on 16-byte boundary +enum SND_EntryType +{ + INVALID = 0x00, // if it does not exists... maybe it is used as some unknown or something + SOUND = 0x01, // looks like "audio:#sound" + SET = 0x02, // looks like "audio:#set" + SEQUENCE = 0x03, // looks like "audio:#seq" + WAVE = 0x04, // does not have ID used it seems, but can be seen in file as "audio:#waves" + DEFINE = 0x05, // does not have ID used it seems, but can be seen in file as "audio:#def" + GROUP = 0x17, // looks like "audio:#group" +}; + +// seems to be before SND_UNKTYPE1 +struct SND_UNKTYPE2 +{ + uint32_t unk_size; // possibly number of bytes that follows? seems to be 12 in test cases I looked at + uint32_t offsetToGroupEntry; // offset to SNDENTRY of group this belongs to + uint32_t nullsOrReservedOrUnknown[2]; +}; + +struct SND_UNKTYPE1 +{ + uint32_t offsetToUnknown2; // offset to SNDUNKTYPE2 + uint32_t nullsOrReservedOrUnknown[3]; +}; + +struct SND_EntrySound +{ + uint32_t type; // enum SND_EntryType::SOUND + uint32_t unk4; // seems to be 0xCDCDCDCD in test files, check what it does, may be reserved or padding + uint32_t offsetToIdentifier; // aligned on 16 bytes, null-terminated string, seems to always be some kind of string ID aligned like specified + uint16_t unkC; // equals 1 for example + uint16_t unkE; // equals 0xCDCD in test files, check what it does, may be reserved + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t offsetToUnknown1; // some offset to some 16-byte type + uint32_t offsetToWaveEntry; // offset to wave entry SND_EntryWave, if null then not present in file + char unk18[0x30 - 0x18]; // unknown, doesn't seem important for now... +}; + +struct SND_EntrySet +{ + uint32_t type; // enum SND_EntryType::SET + uint32_t unk4; // seems to be 0xCDCDCDCD in test files, check what it does, may be reserved or padding + uint32_t offsetToIdentifier; // aligned on 16 bytes, null-terminated string, seems to always be some kind of string ID aligned like specified + uint16_t unkC; // equals 2 for example + uint16_t unkE; // equals 0xCDCD in test files, check what it does, may be reserved + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t unk10; // maybe offset or size, was 0x40 in test case + uint32_t offsetToTableOfSoundEntries; // offset to table of offsets to SND_EntrySound entries, if null then not present in file, if entry in table is null then that is the table end, 16-byte aligned, probably any size possible, took 32 bytes in test case + uint16_t unk18; // was 6 in example, same as number of entries in table... + uint16_t unk1A; // was 6 in example, same as number of entries in table... + uint32_t unk1C; // was 0 in example + uint32_t unk20; // was 2 in example + char unk24[0x30 - 0x24]; // unknown, doesn't seem important for now... seem like nulls anyway +}; + +struct SND_EntrySequence +{ + uint32_t type; // enum SND_EntryType::SEQUENCE + uint32_t unk4; // seems to be 0xCDCDCDCD in test files, check what it does, may be reserved or padding + uint32_t offsetToIdentifier; // aligned on 16 bytes, null-terminated string, seems to always be some kind of string ID aligned like specified + uint16_t unkC; // equals 1 for example + uint16_t unkE; // equals 0xCDCD in test files, check what it does, may be reserved + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t unk10; // maybe offset or size, was 0x30 in test case + uint32_t offsetToSetEntry; // offset to wave entry SND_EntrySet, if null then not present in file + uint16_t unk18; // was 2 in example + uint16_t unk1A; // was 2 in example + uint16_t unk1C; // was 0x64 in example + uint16_t unk1E; // was 0xCDCD in example +}; + +struct SND_EntryWave +{ + uint32_t type; // enum SND_EntryType::WAVE + uint32_t waveFileNameLength; // length of wave file name contained in the following offset, without null-terminator + uint32_t waveFileNameOffset; // offset to null-terminated wave file name, aligned on 16-bytes + uint32_t unkC; // maybe reserved, seens to be 0, check + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t unk10; // maybe reserved, seens to be 0, check + uint32_t offsetToSetEntryID; // offset to ID of sound set, in form "audio:#set" + uint32_t unk_timestamp32bit; // may be timestamp time_t in 32-bit format, check + uint32_t unk_nullMaybeReserved; // unknown, seems to be null +}; + +struct SND_EntryDefine +{ + uint32_t type; // enum SND_EntryType::DEFINE + uint32_t unk4; // seems to be 0xCDCDCDCD in test files, check what it does, may be reserved or padding + uint32_t offsetToIdentifier; // aligned on 16 bytes, null-terminated string, seems to always be some kind of string ID aligned like specified + uint16_t unkC; // equals 0 for example + uint16_t unkE; // equals 0xCDCD in test files, check what it does, may be reserved + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t unk10; // maybe offset, was 0 in test case + uint32_t offsetToUnknown; // all offsets points to seemingly null bytes, at least always a single row of 16-bytes with 0, had not observed more than 16-bytes yet, possibly same offset as some which can be found in SND_Footer::offsetsToTableOfUnknownOffsets1 table + uint16_t unk18; // was 16 in example + uint16_t unk1A; // was 16 in example + uint32_t unk1C; // was 0 in example +}; + +struct SND_EntryGroup +{ + uint32_t type; // enum SND_EntryType::GROUP + uint32_t unk4; // (seems to be 0xCDCDCDCD in test files, check what it does, may be reserved or padding) + uint32_t offsetToIdentifier; // (aligned on 16 bytes, null-terminated string, seems to always be some kind of string ID aligned like specified) + uint16_t unkC; // equals 0 for example + uint16_t unkE; // equals 0xCDCD in test files, check what it does, may be reserved + + // TODO - these may or may not belong to the entry, unsure of sizes + uint32_t unk10; // was 0 in example + uint32_t offsetToTableOfChildGroupEntries; // offset to table of offsets to other SND_EntryGroup entries, if null then not present in file, unsure if some fixed size or alignemnt, assume 16-byte alignemnt, maybe fixed size of 0xA0, may contain NULLs (no childs either) + char unk18[0x70 - 0x18]; // unknown, doesn't seem important for now... possibly 0x30 instead of 0x70 as in SNDENTRY_SOUND, but not known... +}; diff --git a/docs/HitmanBloodMoney/Formats/STR.h b/docs/HitmanBloodMoney/Formats/STR.h new file mode 100644 index 0000000..bc3bd59 --- /dev/null +++ b/docs/HitmanBloodMoney/Formats/STR.h @@ -0,0 +1,34 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of STR files used by Hitman Blood Money. +// It is specific for Hitman Blood Money, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents audio streams data, shared between multiple scenes. +// Streams readability may be dependent on WHD information also, similiarly to previous games, needs to be checked. +// + +#pragma once + +struct STR_Header { + char id[0x10]; + uint32_t offsetToFooter; // points at the STR_Footer, right after string table ends + uint32_t unk14[0x100 - 0x14]; +}; + +struct STR_Footer { +}; + +// LIP chunk which may be at the start of some sound files data, it is aligned on 0x100 boundary +struct STR_LIPChunk +{ + uint32_t id; // compares to first 4 chars from "LIP " + uint32_t dataSize; + // follows dataSize, note that structure is aligned on 0x100 (same as header) +}; diff --git a/docs/HitmanBloodMoney/Formats/WHD+WAV.h b/docs/HitmanBloodMoney/Formats/WHD+WAV.h new file mode 100644 index 0000000..7499ff3 --- /dev/null +++ b/docs/HitmanBloodMoney/Formats/WHD+WAV.h @@ -0,0 +1,94 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WHD+WAV files used by Hitman Blood Money. +// It is specific for Hitman Blood Money, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents sound data for specific scene with same name. They can't be opened without each other. +// Streams readability may be dependent on WHD information also, similiarly to other Glacier 1 games, needs to be checked. +// + +#pragma once + +struct WHD_Header +{ + uint32_t fileSizeWithoutHeader; + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; + +union WHD_Record +{ + struct WHD_RecordScene { + uint32_t filePathLength; + uint32_t filePathOffset; + uint16_t formatTag; // 1 - PCM 16-bit, 17 - IMA ADPCM, 4096 - OGG + uint16_t dataInStreams; // always 0 + uint32_t sampleRate; + uint32_t bitsPerSample; // 0 for OGG + uint32_t dataSizeUncompressed; + uint32_t dataSize; + uint32_t channels; + uint32_t dataOffset; + uint32_t samplesCount; + uint32_t blockAlign; // something weird for OGG! + uint32_t fmtExtra; // 0xCDCDCDCD for PCMs, 2041 for ADPCM, 0x004F3E93 for OGG... + uint32_t nullBytes[4]; + }; + + struct WHD_RecordSceneAliased + { + uint32_t nullByte; // always 0 + uint32_t filePathOffset; + uint16_t formatTag; // 1 - PCM 16-bit, 17 - IMA ADPCM, 4096 - OGG + uint16_t dataInStreams; // either 0 when in scene data or 128 when in streams (if 128. filePathLength must be equal "PHO\0") + uint32_t sampleRate; + uint32_t bitsPerSample; // 0 for OGG + uint32_t dataSizeUncompressed; + uint32_t dataSize; + uint32_t channels; + uint32_t dataOffset; + uint32_t samplesCount; + uint32_t blockAlign; // something weird for OGG! + uint32_t fmtExtra; // 0xCDCDCDCD for PCMs, 2041 for ADPCM, 0x004F3E93 for OGG... + uint32_t nullBytes[4]; + }; + + struct WHD_RecordStreams + { + uint32_t id; // always "PHO\0" (0x004F4850) + uint32_t filePathOffset; + uint16_t formatTag; // 1 - PCM 16-bit, 17 - IMA ADPCM, 4096 - OGG + uint16_t dataInStreams; // either 0 when in scene data or 128 when in streams (if 128. filePathLength must be equal "PHO\0") + uint32_t unkC; // weird values in case filePathLength is "PHO\0" and dataInStreams is 128 + uint32_t bitsPerSample; // 0 for OGG + uint32_t dataSizeUncompressed; + uint32_t dataSize; + uint32_t channels; + uint32_t dataOffset; // may start with "LIP " (0x2050494C) chunk, ignore lip->dataSize bytes aligned on 0x100 boundary + uint32_t samplesCount; + uint32_t unk18; + uint32_t fmtExtra; // 0xCDCDCDCD for PCMs, 2041 for ADPCM, 0x004F3E93 for OGG... + uint32_t unk2C; + uint32_t nullBytes[3]; + }; + + // sizes of all different record types must match! + static_assert(sizeof(WHD_RecordScene) == sizeof(WHD_RecordSceneAliased)); + static_assert(sizeof(WHD_RecordScene) == sizeof(WHD_RecordStreams)); +}; + +union WHDWAV_Header +{ + uint32_t unk0; // always 0 + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; diff --git a/docs/HitmanCodename47/Formats/IDX+BIN.h b/docs/HitmanCodename47/Formats/IDX+BIN.h new file mode 100644 index 0000000..d9a2c6e --- /dev/null +++ b/docs/HitmanCodename47/Formats/IDX+BIN.h @@ -0,0 +1,19 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of IDX+BIN files used by Hitman Codename 47. +// It is specific for Hitman Codename 47, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It contains language-specific sound data, with IDX functioning as index to BIN file. +// All audio files are dumped together right next to each other according to order in IDX file. +// + +#pragma once + +// TBD diff --git a/docs/HitmanCodename47/Formats/WAV.h b/docs/HitmanCodename47/Formats/WAV.h new file mode 100644 index 0000000..769f40f --- /dev/null +++ b/docs/HitmanCodename47/Formats/WAV.h @@ -0,0 +1,20 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WAV files used by Hitman Blood Money. +// It is specific for Hitman Blood Money, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// Repeat.WAV represents audio streams data, shared between multiple scenes. There is also PackRepeat.WAV +// with different structure which sounds like it should reference Repeat.WAV. It is unknown exactly where +// to take filenames from. +// + +#pragma once + +// TBD diff --git a/docs/HitmanContracts/Formats/SND.h b/docs/HitmanContracts/Formats/SND.h new file mode 100644 index 0000000..4fb1921 --- /dev/null +++ b/docs/HitmanContracts/Formats/SND.h @@ -0,0 +1,18 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of SND files used by Hitman Contracts. +// It is specific for Hitman Contracts, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// Files represent a sound graph for specific scene with same name. They are contained in scene's ZIP file. +// + +#pragma once + +// TBD diff --git a/docs/HitmanContracts/Formats/WAV.h b/docs/HitmanContracts/Formats/WAV.h new file mode 100644 index 0000000..1c76b9e --- /dev/null +++ b/docs/HitmanContracts/Formats/WAV.h @@ -0,0 +1,30 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WAV files used by Hitman Contracts. +// It is specific for Hitman Contracts, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents audio streams data, shared between multiple scenes. +// Streams readability may be dependent on WHD information also, similiarly to other Glacier 1 games, needs to be checked. +// + +#pragma once + +// possibly 32-byte aligned, considering the header is? +struct StreamsWAV_Header +{ + uint32_t unk0; // footer offset? + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 + uint32_t unk10; // always 5 + uint32_t unk14; // always 6 + uint32_t unk18; // always 7 + uint32_t unk1C; // always 8 +}; diff --git a/docs/HitmanContracts/Formats/WHD+WAV.h b/docs/HitmanContracts/Formats/WHD+WAV.h new file mode 100644 index 0000000..33e7dc7 --- /dev/null +++ b/docs/HitmanContracts/Formats/WHD+WAV.h @@ -0,0 +1,50 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WHD+WAV files used by Hitman Contracts. +// It is specific for Hitman Contracts, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents sound data for specific scene with same name. They can't be opened without each other. +// Streams readability may be dependent on WHD information also, similiarly to other Glacier 1 games, needs to be checked. +// + +#pragma once + +struct WHD_Header +{ + uint32_t fileSizeWithoutHeader; + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; + +struct WHD_Record +{ + uint32_t type; // always 6 + uint32_t filePathOffset; + uint16_t formatTag; // either 4096 == OGG, 17 == IMA ADPCM, 1 == PCM (S16) + uint16_t dataInStreams; // either 0 or 32768, dataInStreams != 0 => data is in streams + uint32_t sampleRate; + uint32_t bitsPerSample; + uint32_t dataSizeUncompressed; // uncompressed data size, equal dataSize when formatTag == 1 + uint32_t dataSize; + uint32_t channels; + uint32_t dataOffset; + uint32_t samplesCount; // always half of dataSizeUncompressed + uint32_t blockAlign; + uint32_t fmtExtra; // always 1 when formatTag == 1 +}; + +struct WHDWAV_Header +{ + uint32_t unk0; // always 0 + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; diff --git a/docs/HitmanSilentAssassin/Formats/SND.h b/docs/HitmanSilentAssassin/Formats/SND.h new file mode 100644 index 0000000..70a5674 --- /dev/null +++ b/docs/HitmanSilentAssassin/Formats/SND.h @@ -0,0 +1,18 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of SND files used by Hitman Silent Assassin. +// It is specific for Hitman Silent Assassin, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// Files represent a sound graph for specific scene with same name. They are contained in scene's ZIP file. +// + +#pragma once + +// TBD diff --git a/docs/HitmanSilentAssassin/Formats/WAV.h b/docs/HitmanSilentAssassin/Formats/WAV.h new file mode 100644 index 0000000..12bc3c5 --- /dev/null +++ b/docs/HitmanSilentAssassin/Formats/WAV.h @@ -0,0 +1,25 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WAV files used by Hitman Silent Assassin. +// It is specific for Hitman Silent Assassin, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents audio streams data, shared between multiple scenes. +// Streams readability may be dependent on WHD information also, similiarly to other Glacier 1 games, needs to be checked. +// + +#pragma once + +struct StreamsWAV_Header +{ + uint32_t unk0; // footer offset? + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; diff --git a/docs/HitmanSilentAssassin/Formats/WHD+WAV.h b/docs/HitmanSilentAssassin/Formats/WHD+WAV.h new file mode 100644 index 0000000..dda3abf --- /dev/null +++ b/docs/HitmanSilentAssassin/Formats/WHD+WAV.h @@ -0,0 +1,50 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: Unlicense +// +// This file is not licensed the same way as is the rest of the project. You may freely copy and use this file +// in any of your projects. See Unlicense license. +// +// Header partially defines structure of WHD+WAV files used by Hitman Silent Assassin. +// It is specific for Hitman Silent Assassin, it is written as simply as possible wihtout using anything fancy, +// with any information I had about each field written next to it. +// +// It represents sound data for specific scene with same name. They can't be opened without each other. +// Streams readability may be dependent on WHD information also, similiarly to other Glacier 1 games, needs to be checked. +// + +#pragma once + +struct WHD_Header +{ + uint32_t fileSizeWithoutHeader; + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +}; + +struct WHD_Record +{ + uint32_t type; // always 6 + uint32_t filePathOffset; + uint16_t formatTag; // either 4096 == OGG, 17 == IMA ADPCM, 1 == PCM (S16) + uint16_t dataInStreams; // either 0 or 32768, dataInStreams != 0 => data is in streams + uint32_t sampleRate; + uint32_t bitsPerSample; + uint32_t dataSizeUncompressed; // uncompressed data size, equal dataSize when formatTag == 1 + uint32_t dataSize; + uint32_t channels; + uint32_t dataOffset; + uint32_t samplesCount; // always half of dataSizeUncompressed + uint32_t blockAlign; + uint32_t fmtExtra; // always 1 when formatTag == 1 +}; + +struct WHDWAV_Header +{ + uint32_t unk0; // always 0 + uint32_t fileSizeWithHeader; + uint32_t unk8; // always 3 + uint32_t unkC; // always 4 +};