﻿MHMic — версия 1.0 (RU/ENG)
Микрофон для Manhunt (PC) / Microphone support for Manhunt (PC)

РУССКИЙ
=======

MHMic возвращает поведение гарнитуры из версии для PS2. Когда вы достаточно громко говорите в микрофон, охотники слышат шум и могут пойти проверить его источник. В меню и на паузе микрофон на охотников не влияет.

Установка
1. Установите 32-битный (Win32/x86) ASI-загрузчик. Например, Ultimate ASI Loader: https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dinput8-Win32.zip. Положите dinput8.dll рядом с manhunt.exe. Версия x64 не подходит даже на 64-битной Windows.
2. Положите MHMic.asi и MHMic.ini вместе в папку Manhunt\scripts или рядом с manhunt.exe. Не оставляйте копии MHMic.asi сразу в двух местах.
3. Запустите игру. Страница «ГАРНИТУРА» находится в настройках.

Настройки в игре
«МИКРОФОН» меняет чувствительность голоса, «НАУШНИК» — громкость голоса Режиссёра. Обе шкалы по умолчанию стоят посередине (0 дБ). «ИСТОЧНИК» выбирает микрофон: по умолчанию используется устройство записи Windows. «РЕЖИССЕР» предлагает «ПО УМОЛЧАНИЮ» (обычный звук игры), геймпад и доступные устройства вывода Windows, например колонки или наушники. Нажмите «Подтвердить», чтобы сохранить изменения.

Для голоса Режиссёра в динамике нужен DualSense или DualShock 4, подключённый по USB. Через Bluetooth звук на геймпад не выводится.

Перевод для MHLL
Обычные подписи страницы берутся из текущего перевода игры. Для шести добавленных MHMic подписей положите файл перевода в data\MHMic\lang внутри папки игры. Образец — data\MHMic\lang\template.txt.example в архиве. Скопируйте его под именем, оканчивающимся на .txt (например, polski.txt), и сохраните как UTF-8.

В строке Match укажите точный текст игрового пункта «тип управления» (ключ CONTTYP, первая строка Настройки → Управление) на нужном языке. Затем переведите MicInput, Director, Default, DefaultOutput, NotConnected и Gamepad. Default — выбор микрофона Windows по умолчанию; DefaultOutput — обычный звук игры для Режиссёра. Буквы записывайте так, как их хранит GXT этого перевода, если шрифт использует особые коды. После изменения файла перезапустите игру. При смене языка через MHLL мод автоматически выберет файл с подходящим Match. Отсутствующие строки останутся на встроенном русском или английском.

Если что-то не работает
Для диагностики откройте MHMic.ini, поставьте Log=1 в разделе [Debug] и перезапустите игру. Рядом с MHMic.asi появится MHMic.log. Скопируйте его до следующего запуска игры: при запуске журнал начинается заново. После диагностики верните Log=0. Проверьте также, что ASI-загрузчик имеет разрядность Win32, а в Windows выбран нужный микрофон по умолчанию. Подробные параметры описаны ниже.

В CrossOver для manhunt.exe добавьте библиотеку dinput8 с порядком загрузки native, builtin. Если macOS запросит доступ к микрофону, разрешите его.

Подробная настройка
-------------------

Файл MHMic.ini лежит рядом с MHMic.asi. Открывайте его обычным Блокнотом. После ручного изменения параметров перезапустите игру. Строки, начинающиеся с «;», — пояснения. Страница «ГАРНИТУРА» позволяет менять основные настройки без редактирования файла.

[General]
Enabled: 1 — мод работает, 0 — отключён.
PushToTalk: 0 — микрофон работает постоянно, 1 — только при удержании клавиши.
PushToTalkKey: код клавиши для PushToTalk; 0x54 означает T.

[Microphone]
Device и DeviceId: оставьте обе строки пустыми для микрофона Windows по умолчанию. Device — часть имени устройства, DeviceId — его точный ID. Выбор в игровом меню записывает DeviceId. Если выбранный микрофон отключён, мод временно использует доступное устройство.
Sensitivity: дополнительная чувствительность; 1.0 — исходный уровень, 2.0 — вдвое выше.
NoiseGate: минимальный уровень в dBFS; более тихие звуки игнорируются. Более высокое значение, например -35 вместо -40, сильнее отсекает фон.
AutoCalibrateMs: время первоначального замера шума комнаты в миллисекундах; 0 отключает замер.
GateHeadroom: насколько дБ порог должен быть выше измеренного шума комнаты.
AdaptiveGate: 1 — подстраивать порог под меняющийся фон во время игры, 0 — не подстраивать.
HighPassHz: отсечение низкочастотного гула; 0 отключает фильтр.
AttackMs и ReleaseMs: скорость реакции измерителя на повышение и спад громкости.
HoldMs: как долго голос должен оставаться выше порога, прежде чем охотники услышат шум. Более высокое значение лучше отсекает короткие щелчки.

[Levels]
VeryLowAt, LowAt, MediumAt, HighAt: четыре порога громкости в dBFS от тихого голоса до крика. Для более лёгкого срабатывания ставьте более низкие числа, например -40 вместо -36. Сохраняйте порядок от самого низкого порога к самому высокому.
VeryLowSound, LowSound, MediumSound, HighSound: номера игровых звуковых событий для этих четырёх ступеней. Их таблица находится в конце MHMic.ini; при обычной настройке менять номера не нужно.

[Behaviour]
CooldownMs: минимальная пауза между двумя звуками, отправленными охотникам.
RepeatWhileTalking: 1 — повторять звуки при долгой речи, 0 — один звук до следующей паузы.
OnlyWhenInGame: 1 — учитывать микрофон только на уровне, 0 — убрать эту проверку.
RadarNoise: 1 — показывать импульс микрофона на штатном радаре, 0 — не показывать.

[Headset]
MicrophoneStep и EarpieceStep: 0 — выключено, 1 — -4 дБ, 2 — -2 дБ, 3 — 0 дБ, 4 — +2 дБ, 5 — +4 дБ. По умолчанию обе строки равны 3.
EarpieceDevice и EarpieceDeviceId: оставьте пустыми для пункта «ПО УМОЛЧАНИЮ», то есть обычного звука игры. Gamepad в EarpieceDevice направляет голос Режиссёра в подключённый по USB геймпад. Выбор колонок или наушников в игровом меню сохраняет их точный ID в EarpieceDeviceId; вручную можно также указать часть имени устройства.
PadSpeaker: 1 — автоматически включать динамик подходящего геймпада, 0 — не менять его настройки.
AnnounceHeadset: 1 — показывать уведомление о новой гарнитуре, 0 — не показывать.
SeenDevices: служебный список уже замеченных устройств; обычно менять не нужно.

[Debug] и поиск неполадок
Log=0 по умолчанию: журнал не создаётся. Для диагностики поставьте Log=1 и перезапустите игру; MHMic.log появится рядом с MHMic.asi. После диагностики верните Log=0. Журнал перезаписывается при каждом запуске игры, поэтому после сбоя скопируйте его до повторного запуска.
LogLevel=1 дополнительно записывает уровень микрофона и текущий порог примерно четыре раза в секунду. Включайте для калибровки, затем возвращайте 0, чтобы журнал не разрастался.
MenuMirrorAudio — служебный параметр диагностики меню; оставьте 0.

Для калибровки установите Log=1 и LogLevel=1, запустите уровень, помолчите, поговорите обычным голосом и громко. Посмотрите строки [level] в MHMic.log, затем настройте NoiseGate и пороги VeryLowAt...HighAt по фактическим значениям. Верните Log=0 и LogLevel=0 и перезапустите игру.

Если при Log=1 файл MHMic.log не появляется, сначала проверьте Win32 ASI-загрузчик и расположение MHMic.asi/MHMic.ini. Строка [core] ready означает, что основные перехваты установлены; [mic] capturing from сообщает, какой микрофон используется. При обращении за помощью приложите MHMic.log и опишите, что именно не работает.


ENGLISH
=======

MHMic restores the PS2 headset behavior. When you speak loudly enough into your microphone, hunters hear a noise and may investigate it. Microphone noise does not reach hunters while a menu is open or the game is paused.

Installation
1. Install a 32-bit (Win32/x86) ASI loader. For example, Ultimate ASI Loader: https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dinput8-Win32.zip . Put dinput8.dll next to manhunt.exe. The x64 version will not work, even on 64-bit Windows.
2. Put MHMic.asi and MHMic.ini together in Manhunt\scripts or next to manhunt.exe. Do not keep MHMic.asi in both places.
3. Start the game. Open the HEADSET page in Settings.

In-game settings
MICROPHONE adjusts voice sensitivity; EARPIECE adjusts the Director's voice volume. Both sliders start in the middle (0 dB). SOURCE selects a microphone; the Windows default recording device is used initially. DIRECTOR offers DEFAULT (normal game audio), a gamepad, and available Windows playback devices such as speakers or headphones. Choose Confirm to save changes.

The Director can speak through a DualSense or DualShock 4 connected by USB. Bluetooth gamepad audio is not supported.

MHLL translation
The standard HEADSET labels come from the game's active language. For the six labels added by MHMic, put a translation file in data\MHMic\lang under the game directory. The archive includes data\MHMic\lang\template.txt.example. Copy it to a name ending in .txt (for example, polski.txt) and save it as UTF-8.

Set Match to the exact in-game "control type" label (GXT key CONTTYP, first row of Settings > Controls) in that language. Then translate MicInput, Director, Default, DefaultOutput, NotConnected, and Gamepad. Default names the Windows default microphone; DefaultOutput names normal game audio for the Director. If the language font remaps characters, use the same character codes as its GXT files. Restart the game after editing a file. When the language changes through MHLL, the mod selects the file with the matching Match value. Missing labels fall back to built-in Russian or English.

If something goes wrong
For diagnostics, open MHMic.ini, set Log=1 under [Debug], and restart the game. MHMic.log will appear next to MHMic.asi. Copy it before the next game launch: a new launch starts a fresh log. Set Log=0 again when finished. Also check that the ASI loader is Win32 and that the correct default microphone is selected in Windows. Detailed settings are below.

In CrossOver, add dinput8 for manhunt.exe with the load order native, builtin. Allow microphone access if macOS prompts for it.

Detailed configuration
----------------------

MHMic.ini is located next to MHMic.asi. Open it in a plain text editor. Restart the game after editing it. Lines beginning with ";" are comments. The HEADSET page changes common settings without editing the file.

[General]
Enabled: 1 enables the mod; 0 disables it.
PushToTalk: 0 keeps the microphone active; 1 requires holding a key.
PushToTalkKey: virtual key code for push to talk; 0x54 is T.

[Microphone]
Device and DeviceId: leave both blank to follow the Windows default microphone. Device matches part of a name; DeviceId identifies an exact device. In-game selection writes DeviceId. If the selected microphone disappears, the mod temporarily uses an available device.
Sensitivity: extra input sensitivity; 1.0 is unchanged, 2.0 doubles the measured level.
NoiseGate: minimum level in dBFS; quieter sounds are ignored. A higher value, such as -35 instead of -40, rejects more background noise.
AutoCalibrateMs: initial room-noise measurement time in milliseconds; 0 disables it.
GateHeadroom: how many dB above measured room noise to place the gate.
AdaptiveGate: 1 tracks changing background noise during play; 0 does not.
HighPassHz: low-frequency rumble filter; 0 disables it.
AttackMs and ReleaseMs: how quickly the meter reacts when loudness rises and falls.
HoldMs: how long sound must stay above the gate before it is sent to hunters. A higher value rejects more short clicks.

[Levels]
VeryLowAt, LowAt, MediumAt, HighAt: four loudness thresholds in dBFS, from quiet speech to shouting. Lower numbers, such as -40 instead of -36, trigger more easily. Keep the thresholds in ascending order.
VeryLowSound, LowSound, MediumSound, HighSound: game sound event IDs for those tiers. The ID table is at the end of MHMic.ini; most users can leave these unchanged.

[Behaviour]
CooldownMs: minimum time between two noises sent to hunters.
RepeatWhileTalking: 1 repeats noises during continuous speech; 0 sends one until the next pause.
OnlyWhenInGame: 1 processes speech only on a level; 0 disables that check.
RadarNoise: 1 shows microphone noise on the game's radar; 0 hides it.

[Headset]
MicrophoneStep and EarpieceStep: 0 = off, 1 = -4 dB, 2 = -2 dB, 3 = 0 dB, 4 = +2 dB, 5 = +4 dB. Both default to 3.
EarpieceDevice and EarpieceDeviceId: leave both blank for DEFAULT, meaning normal game audio. Set EarpieceDevice to Gamepad for the Director's voice through a USB gamepad. Selecting speakers or headphones in the game saves their exact ID in EarpieceDeviceId; a partial device name can also be entered manually.
PadSpeaker: 1 activates a supported gamepad speaker automatically; 0 leaves its audio settings alone.
AnnounceHeadset: 1 shows a notice for a newly seen headset; 0 hides the notice.
SeenDevices: internal list of devices already seen; normally leave it alone.

[Debug] and troubleshooting
Log=0 by default: no log file is created. For diagnostics, set Log=1 and restart the game; MHMic.log will appear next to MHMic.asi. Restore Log=0 when finished. Each game launch starts a fresh log, so copy it after a failure and before restarting.
LogLevel=1 also writes the microphone level and current gate about four times per second. Use it for calibration, then return it to 0 to keep the log small.
MenuMirrorAudio is a menu diagnostic setting; leave it at 0.

To calibrate, set Log=1 and LogLevel=1, enter a level, stay quiet, speak normally, and shout. Read the [level] entries in MHMic.log. Adjust NoiseGate and VeryLowAt...HighAt to match your levels. Restore Log=0 and LogLevel=0 and restart the game.

If MHMic.log is absent with Log=1, check the Win32 ASI loader and the location of MHMic.asi/MHMic.ini first. [core] ready means the main hooks were installed; [mic] capturing from identifies the active microphone. When requesting help, include MHMic.log and describe the problem.
