From eb94c2a0cd2e945bf9e2bf599ab75abb61bfdddf Mon Sep 17 00:00:00 2001 From: Michael Miceli Date: Fri, 28 Apr 2023 17:57:43 -0400 Subject: [PATCH] add support for older powerhsell --- README.md | 4 +++- build.ps1 | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c3056de..fb5a3ff 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,9 @@ In the video starting at 35m 19s, there was a section where a speedrunner named `dk28` died in the middle of level 1, and was advanced to level 2 for their next life. The video explains that there still isn't a known explanation as to why this happened. This got me interested in the assembly and thus this project -began and has since changed in scope as my interest have changed. +began. Spoilers, I have not found the cause of the level skip bug. It is still +unknown whether the bug is from some bug in the code, or whether it was a +hardware glitch. The _Contra_ (US) NES ROM was disassembled using a NES disassembly tool. This provided a starting point for code investigation. The disassembler incorrectly diff --git a/build.ps1 b/build.ps1 index 1ee75aa..c59f504 100644 --- a/build.ps1 +++ b/build.ps1 @@ -21,11 +21,20 @@ function Set-Bytes { # only read baserom.nes once for speed improvements IF ($global:SOURCE_CONTRA -eq $null) { Write-Output " Reading input file baserom.nes." - $global:SOURCE_CONTRA = Get-Content .\baserom.nes -AsByteStream + IF ($PSVersionTable.PSVersion.Major -ge 6) { + $global:SOURCE_CONTRA = Get-Content .\baserom.nes -AsByteStream + } ELSE { + $global:SOURCE_CONTRA = Get-Content .\baserom.nes -Raw -Encoding Byte + } } Write-Output " Writing file $Output." - $global:SOURCE_CONTRA | Select-Object -Skip $Skip -First $Take | Set-Content $Output -AsByteStream + + IF ($PSVersionTable.PSVersion.Major -ge 6) { + $global:SOURCE_CONTRA | Select-Object -Skip $Skip -First $Take | Set-Content $Output -AsByteStream + } ELSE { + $global:SOURCE_CONTRA | Select-Object -Skip $Skip -First $Take | Set-Content $Output -Encoding Byte + } } IF (Test-Path -Path "contra.nes") {