Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c5a9b60
Fit the window to screens too short for it
ColorDumper Nov 12, 2026
f297d55
Fit the window reliably, and again when its screen changes
ColorDumper Nov 12, 2026
2972659
Send you to the download page when an update can't be installed
ColorDumper Nov 12, 2026
749aa45
Check HTTPS support and the window icon in the self-test
ColorDumper Nov 12, 2026
3515bc1
Save settings safely, and only when they changed on Start
ColorDumper Nov 12, 2026
39b4cb2
Say in the field log when Start saves your settings
ColorDumper Nov 12, 2026
8963d99
Stop instead of reconnecting when defaults are restored while running
ColorDumper Nov 12, 2026
2358b43
Keep Settings changes only on Save, and show when some are unsaved
ColorDumper Nov 12, 2026
048d310
Warn that Reset disconnects MapHide while it is running
ColorDumper Nov 12, 2026
05c300a
Keep trying to reach a copy that is still starting before saying it i…
ColorDumper Nov 12, 2026
59a71ab
Keep the status box text inside its box
ColorDumper Nov 12, 2026
1087176
Let the field log scroll sideways for lines too long to fit
ColorDumper Nov 13, 2026
48d16fe
Tighten the updater's download and hand-off to the installer
ColorDumper Nov 13, 2026
18c5f7c
Keep MapHide stopped when settings are saved while it is stopping
ColorDumper Nov 13, 2026
3573b98
Hide Host, Port and Password again when Settings closes
ColorDumper Nov 13, 2026
2d9c46d
Keep the overlay warning when stopped while reconnecting
ColorDumper Nov 13, 2026
210e362
Keep a settings reconnect from pushing the saved line out of the fiel…
ColorDumper Nov 13, 2026
96b2c32
Check the OBS port is between 1 and 65535
ColorDumper Nov 13, 2026
9e39409
Give each OBS failure its own reason in the field log
ColorDumper Nov 13, 2026
6130043
Drop an oversized command and say when a second launch can't reach Ma…
ColorDumper Nov 13, 2026
85f4ba1
Keep a hide delay drag on the slider when it drifts
ColorDumper Nov 13, 2026
559cf5d
Test that the OBS password never reaches a log
ColorDumper Nov 13, 2026
f52a7c2
Pin the Inno Setup version and test the names installer and app share
ColorDumper Nov 13, 2026
7da3dc9
Correct the download size in the changelog and reword a comment
ColorDumper Nov 13, 2026
ed50247
Remove unused colour constants, QML ids and font weights
ColorDumper Nov 13, 2026
03c1bca
Test Connect on startup and tidy weak or misnamed tests
ColorDumper Nov 13, 2026
1839d8f
Keep an install from being cancelled halfway
ColorDumper Nov 13, 2026
9366990
Start the update installer from its own folder with a clean environment
ColorDumper Nov 13, 2026
3a3022d
Retry a settings save while another program holds the file
ColorDumper Nov 13, 2026
23da922
Clear out old update downloads on every launch and on uninstall
ColorDumper Nov 13, 2026
ef8dfba
Drop Start's leftover settings save error
ColorDumper Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,21 @@ jobs:
id: installer
shell: pwsh
run: |
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) {
choco install innosetup --no-progress -y
# One known version builds every installer, whatever the runner
# image happens to come with.
$innoVersion = '6.7.1'
$innoDir = "${env:ProgramFiles(x86)}\Inno Setup 6"
$iscc = "$innoDir\ISCC.exe"
function Get-InnoVersion {
$uninstaller = "$innoDir\unins000.exe"
if (Test-Path $uninstaller) { (Get-Item $uninstaller).VersionInfo.ProductVersion.Trim() } else { '' }
}
if ((Get-InnoVersion) -ne $innoVersion) {
choco install innosetup --version $innoVersion --allow-downgrade --force --no-progress -y
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
$found = Get-InnoVersion
if ($found -ne $innoVersion) { throw "Inno Setup is $found, expected $innoVersion" }
$appVersion = python -c "from maphide.version import VERSION; print(VERSION)"
$name = 'MapHide-${{ steps.package.outputs.version }}-setup'
& $iscc /Qp installer/MapHide.iss "/DAppVersion=$appVersion" "/DOutputName=$name"
Expand All @@ -185,11 +195,16 @@ jobs:
$p = Start-Process "$app\MapHide.exe" '--selftest' -PassThru
if (-not $p.WaitForExit(60000)) { $p.Kill(); throw 'Installed MapHide.exe --selftest timed out' }
if ($p.ExitCode -ne 0) { throw "Installed MapHide.exe --selftest exited $($p.ExitCode)" }
# A download left from an update, which uninstalling removes.
$downloads = Join-Path $env:TEMP 'MapHide-update'
New-Item -ItemType Directory -Force -Path $downloads | Out-Null
Set-Content -Path "$downloads\MapHide-v9.9.9-setup.exe" -Value 'leftover'
$p = Start-Process "$app\unins000.exe" '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART' -PassThru -Wait
if ($p.ExitCode -ne 0) { throw "Uninstall exited $($p.ExitCode)" }
# The uninstaller removes its own copy a moment after it exits.
Start-Sleep -Seconds 3
if (Test-Path "$app\MapHide.exe") { throw 'Uninstall left MapHide.exe behind' }
if (Test-Path $downloads) { throw 'Uninstall left the update downloads behind' }

- name: Upload build artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
Expand Down
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ All notable changes to MapHide are documented here.
- Changed the empty-password warning to text next to the Password field
instead of an icon.
- Changed the debug log option to a switch under Behavior in Settings.
- Changed the download size to about 35 MB, because of the new window.
- Changed the download size to about 27 MB for the installer, or 35 MB for the
zip, because of the new window.
- Added Enter and Esc as ways to finish typing in a text field.
- Changed launching MapHide while it's already running to bring the open
window to the front, even from the tray, instead of showing a notice.
Expand All @@ -47,6 +48,26 @@ All notable changes to MapHide are documented here.
- Added a Check for updates switch under Behavior in Settings, on by default,
which looks for a new version when MapHide opens. The field log says when
one is out.
- Fixed your settings being lost if the PC crashed or lost power while
MapHide was saving them.
- Fixed Reset in Settings, while MapHide was running, trying to connect with
empty settings and ending on a connection error. Reset now stops MapHide.
- Changed Settings so only Save keeps a change: closing Settings without
Save puts your saved settings back, and Start uses your saved settings
instead of saving what's in Settings. Settings shows Unsaved changes while
you have any.
- Added a warning when you click Reset while MapHide is running, saying that
Reset disconnects MapHide from OBS.
- Fixed MapHide refusing to open after it was closed, saying it was already
running, while an earlier "already running" message was still open.
- Fixed MapHide starting again when you saved settings right after pressing
Stop.
- Changed Host, Port and Password to hide again whenever you close Settings
or MapHide goes to the tray, so they never stay shown on stream.
- Fixed MapHide only saying it stopped, when you pressed Stop while it was
reconnecting and the overlay might still be showing in OBS.
- Fixed Settings accepting an OBS port outside 1 to 65535, which could never
connect. It now says the port must be in that range.

## v0.2.6 - 2026-10-27

Expand Down
4 changes: 4 additions & 0 deletions installer/MapHide.iss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ SolidCompression=yes
; MapHide is closed with --quit below, which hides the overlay in OBS first.
CloseApplications=no
RestartApplications=no
; The old version's files are deleted before the new ones are copied (see
; [InstallDelete]), so a cancel in between would leave MapHide unable to start.
AllowCancelDuringInstall=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -80,6 +83,7 @@ Filename: "{app}\MapHide.exe"; Flags: nowait; Check: RelaunchRequested

[UninstallDelete]
Type: filesandordirs; Name: "{app}\_internal"
Type: filesandordirs; Name: "{%TEMP}\MapHide-update"

[Code]
var
Expand Down
30 changes: 25 additions & 5 deletions map_hider.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@
# than the window's own exit backstop, so a slow but working exit is never
# reported as a failure.
QUIT_WAIT_SECONDS = 20
# How long `--quit` keeps trying to reach a copy that isn't listening yet.
# How long `--quit`, and a second launch, keep trying to reach a copy that
# isn't listening yet, and how often.
QUIT_DELIVERY_SECONDS = 5
SHOW_DELIVERY_SECONDS = 5
DELIVERY_RETRY_SECONDS = 0.25
ALREADY_RUNNING_MESSAGE = "MapHide is already running."
ALREADY_RUNNING_NOTICE_MUTEX = "Local\\MapHide-AlreadyRunningNotice"
# Distinct from the main window's title ("MapHide") so FindWindowW below can
Expand Down Expand Up @@ -143,10 +146,25 @@ def quit_running_copy(wait_seconds=QUIT_WAIT_SECONDS):
return 0
if time.monotonic() >= deadline:
return 1
time.sleep(0.25)
time.sleep(DELIVERY_RETRY_SECONDS)
return 0 if wait_until_closed(wait_seconds) else 1


def show_running_copy():
"""Bring the running copy's window forward. Returns whether it got the
message. A copy started a moment ago holds the lock at once but only
listens once its window is built, so keep trying for a few seconds, as
--quit does. Gives up early if that copy closes meanwhile."""
import time

deadline = time.monotonic() + SHOW_DELIVERY_SECONDS
while not send_command(COMMAND_SHOW):
if not is_running() or time.monotonic() >= deadline:
return False
time.sleep(DELIVERY_RETRY_SECONDS)
return True


def report_already_running(headless, notice_name=ALREADY_RUNNING_NOTICE_MUTEX):
if headless:
print(ALREADY_RUNNING_MESSAGE)
Expand Down Expand Up @@ -177,10 +195,12 @@ def main():
if not acquire_single_instance():
# The running copy brings its own window forward; the notice is only
# for when it can't be reached.
if not headless and send_command(COMMAND_SHOW):
if not headless and show_running_copy():
sys.exit(0)
report_already_running(headless)
sys.exit(1)
# Unless it closed while this launch waited: then this one is MapHide.
if headless or not acquire_single_instance():
report_already_running(headless)
sys.exit(1)

if headless:
run_headless()
Expand Down
45 changes: 39 additions & 6 deletions maphide/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""The settings file: its shape, and reading and writing it."""

import json
import os
import shutil
import time
from dataclasses import dataclass, replace

from .hotkeys import (
Expand All @@ -23,6 +25,10 @@
MAX_HIDE_DELAY_MS = 400
MIN_PORT = 1
MAX_PORT = 65535
# How long a save keeps trying while another program has the settings file
# open, and how often.
SAVE_RETRY_SECONDS = 1.0
SAVE_RETRY_INTERVAL_SECONDS = 0.05
# Settings only the window uses. Changing these never needs the worker
# restarted, so saving them leaves the OBS connection and the overlay alone.
WINDOW_ONLY_FIELDS = frozenset({"auto_connect", "theme", "check_updates"})
Expand Down Expand Up @@ -171,7 +177,7 @@ def connection_from_form(host, port):
"""The OBS host and port from a settings form, as typed: (host, port).

Raises ValueError with a message fit to show the user when either is
missing or the port isn't a number.
missing, or the port isn't a number from MIN_PORT to MAX_PORT.
"""
host = str(host).strip()
port_text = str(port).strip()
Expand All @@ -180,9 +186,12 @@ def connection_from_form(host, port):
if not port_text:
raise ValueError("OBS Port is required.")
try:
return host, int(port_text)
port_number = int(port_text)
except ValueError as exc:
raise ValueError("OBS Port must be a number.") from exc
if not MIN_PORT <= port_number <= MAX_PORT:
raise ValueError(f"OBS Port must be between {MIN_PORT} and {MAX_PORT}.")
return host, port_number


def config_from_form(
Expand Down Expand Up @@ -242,8 +251,7 @@ def ensure_config_file(path=CONFIG_PATH):
if LEGACY_CONFIG_PATH.exists() and LEGACY_CONFIG_PATH.resolve() != path.resolve():
shutil.copy2(LEGACY_CONFIG_PATH, path)
return
with open(path, "w", encoding="utf-8") as file:
json.dump(default_config().to_dict(), file, indent=2)
save_config(default_config(), path)


def load_config(path=CONFIG_PATH):
Expand All @@ -252,7 +260,32 @@ def load_config(path=CONFIG_PATH):
return AppConfig.from_dict(json.load(file))


def _replace_when_free(source, target):
"""Swap `source` in for `target`. While another program has `target`
open, such as a virus scanner checking it, Windows refuses; that
usually lasts a moment, so try again for up to about a second."""
deadline = time.monotonic() + SAVE_RETRY_SECONDS
while True:
try:
os.replace(source, target)
return
except PermissionError:
if time.monotonic() >= deadline:
raise
time.sleep(SAVE_RETRY_INTERVAL_SECONDS)


def save_config(cfg, path=CONFIG_PATH):
"""Write `cfg` to a temporary file next to `path`, then swap it in, so a
crash or power cut mid-save leaves the old settings, never half a file."""
path.parent.mkdir(parents=True, exist_ok=True)
with open(path, "w", encoding="utf-8") as file:
json.dump(cfg.to_dict(), file, indent=2)
temporary = path.with_name(path.name + ".tmp")
try:
with open(temporary, "w", encoding="utf-8") as file:
json.dump(cfg.to_dict(), file, indent=2)
file.flush()
os.fsync(file.fileno())
_replace_when_free(temporary, path)
except BaseException:
temporary.unlink(missing_ok=True)
raise
Loading