Skip to content

Conversation

@sxrmss
Copy link
Collaborator

@sxrmss sxrmss commented Dec 16, 2025

No description provided.

@sxrmss sxrmss requested a review from Crauzer December 16, 2025 18:05
Comment on lines -42 to -45
#[error("Failed to begin hook")]
HookFailed,
#[error("Hook initialization timed out")]
HookTimeout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove this, it's for the new patcher

match run_patcher_loop(
&dll_path,
&config_path,
&overlay_root_for_thread,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_path in new patcher is the equivalent of the overlay path, we need to make the backend implementation abstract enough so that it can support the current (legacy) patcher and the new one as well.

Comment on lines 157 to 200
let tid = loop {
if stop_flag.load(Ordering::SeqCst) {
return Err(PatcherLoopError::Stopped);
}
match api.find() {
Some(tid) => break tid.get(),
None => api.sleep(100),
}
};

tracing::info!("Found League process, thread id: {}", tid);

let count_before = api.hook_count();
let hook = api.hook_begin(tid);
if hook == 0 {
return Err(PatcherLoopError::HookFailed);
}

let mut time_remaining = timeout_ms as i64;
loop {
if stop_flag.load(Ordering::SeqCst) {
api.hook_end(tid, hook);
return Err(PatcherLoopError::Stopped);
}

if time_remaining <= 0 {
api.hook_end(tid, hook);
return Err(PatcherLoopError::HookTimeout);
}

api.hook_continue(tid, hook);
api.sleep(HOOK_STEP_MS);

if api.hook_count() != count_before {
tracing::info!("Hooks applied successfully");
api.hook_end(tid, hook);
break;
tracing::info!("Waiting for game to start (polling cslol_find)...");
let mut last_wait_log = Instant::now();
let tid = loop {
if stop_flag.load(Ordering::SeqCst) {
return Err(PatcherLoopError::Stopped);
}
match api.find() {
Some(tid) => break tid.get(),
None => {
if last_wait_log.elapsed() >= Duration::from_secs(5) {
tracing::info!("Still waiting for game process...");
last_wait_log = Instant::now();
}
api.sleep(100);
}
}
};

tracing::info!("Game found (thread id: {})", tid);

tracing::info!(
"Applying hook (timeout_ms={}, step_ms={})...",
timeout_ms,
HOOK_STEP_MS
);
api.hook(tid, timeout_ms, HOOK_STEP_MS)?;
tracing::info!("Hook applied, waiting for game to exit...");

while !stop_flag.load(Ordering::SeqCst) {
match api.find() {
Some(current) if current.get() == tid => {
while let Some(msg) = api.log_pull() {
tracing::info!("[cslol] {}", msg);
}
api.sleep(1000);
}
_ => break,
}
}

time_remaining -= HOOK_STEP_MS as i64;
tracing::info!("Game exited, returning to wait loop");
}

tracing::info!("Hook session completed");
Ok(())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove the new patcher hook routine implementation, instead move this code from the command file into the relevant patcher module and make it abstract at the point of calling - this file, so we support multiple patcher implementations.

…mod import

- Abstract patcher backend to support both legacy and new patcher APIs
- Move new patcher hook logic into patcher/runner.rs and patcher/api.rs
- Move legacy patcher loop into legacy_patcher/runner.rs
- Add MutexLockFailed error variant with MutexResultExt trait for cleaner mutex handling
- Fix fantome extractor: case-insensitive META/info.json lookup, UTF-8 BOM handling
- Add drag and drop support for mod installation in Library page
- Add overlay progress events and display in Start Patcher button
- Fix clippy warnings in mods/mod.rs and overlay/mod.rs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sxrmss sxrmss requested a review from Crauzer January 19, 2026 08:08
@sxrmss sxrmss added frontend backend epic Represents a large feature composed of multiple tasks labels Jan 20, 2026
This was linked to issues Jan 20, 2026
@sxrmss sxrmss self-assigned this Jan 20, 2026
@sxrmss sxrmss removed this from LTK Manager Jan 20, 2026
@Crauzer Crauzer merged commit b9562e4 into main Jan 23, 2026
9 checks passed
@Crauzer Crauzer deleted the support-for-old-patcher branch January 23, 2026 22:20
@github-actions github-actions bot mentioned this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend epic Represents a large feature composed of multiple tasks frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Play button Profile system

3 participants