Compare commits

...

2 Commits

Author SHA1 Message Date
Ryan Walters
8f504d6c77 fix: correctly unhide in second pre-freeze stage 2025-09-01 10:28:08 -05:00
Ryan Walters
66499b6285 fix: remove broken console stream re-attach on Windows 2025-08-29 10:56:26 -05:00
2 changed files with 11 additions and 45 deletions

View File

@@ -24,44 +24,6 @@ impl CommonPlatform for Platform {
}
fn init_console(&self) -> Result<(), PlatformError> {
#[cfg(windows)]
{
unsafe {
use winapi::{
shared::ntdef::NULL,
um::{
fileapi::{CreateFileA, OPEN_EXISTING},
handleapi::INVALID_HANDLE_VALUE,
processenv::SetStdHandle,
winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE},
wincon::{AttachConsole, GetConsoleWindow},
winnt::{FILE_SHARE_READ, FILE_SHARE_WRITE, GENERIC_READ, GENERIC_WRITE},
},
};
if !std::ptr::eq(GetConsoleWindow(), std::ptr::null_mut()) {
return Ok(());
}
if AttachConsole(winapi::um::wincon::ATTACH_PARENT_PROCESS) != 0 {
let handle = CreateFileA(
c"CONOUT$".as_ptr(),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
std::ptr::null_mut(),
OPEN_EXISTING,
0,
NULL,
);
if handle != INVALID_HANDLE_VALUE {
SetStdHandle(STD_OUTPUT_HANDLE, handle);
SetStdHandle(STD_ERROR_HANDLE, handle);
}
}
}
}
Ok(())
}

View File

@@ -79,15 +79,19 @@ pub fn startup_stage_system(
if let Some((from, to)) = startup.tick() {
debug!("StartupSequence transition from {from:?} to {to:?}");
match (from, to) {
// (StartupSequence::TextOnly { .. }, StartupSequence::CharactersVisible { .. }) => {}
(StartupSequence::CharactersVisible { .. }, StartupSequence::GameActive) => {
// Unfreeze and unhide the player & ghosts
(StartupSequence::TextOnly { .. }, StartupSequence::CharactersVisible { .. }) => {
// Unhide the player & ghosts
for entity in player_query.iter_mut().chain(ghost_query.iter_mut()) {
commands.entity(entity).remove::<(Frozen, Hidden)>();
commands.entity(entity).remove::<Hidden>();
}
// Unfreeze pellet blinking
for entity in blinking_query.iter_mut() {
}
(StartupSequence::CharactersVisible { .. }, StartupSequence::GameActive) => {
// Unfreeze the player & ghosts & pellet blinking
for entity in player_query
.iter_mut()
.chain(ghost_query.iter_mut())
.chain(blinking_query.iter_mut())
{
commands.entity(entity).remove::<Frozen>();
}
}