Francommit / win10_emulation_station

Emulation Station for Windows 10/11
https://francommit.com/emulationstation/
158 stars 27 forks source link

Downloader Doesn't Work #27

Closed kernelpickle closed 4 years ago

kernelpickle commented 4 years ago

I had to re-write every line where you attempted to use a variable in a filepath, because whatever language where it's OK to jam things together with a plus sign, doesn't work consistently or well with PowerShell. Even after all of that, the downloading process never worked--I had to manually located and download each and every one of the files you referenced in your JSON file. I don't mess with JSONs normally, so I don't have any clue (nor do I have an patience left) to bother figuring out what went sideways with that part of the script. I'll upload a transcript of what happened when I ran the thing, and my code with all the changes--but after messing around with this nonsense that was supposed make things easy, ended up killing the better part of my day.

I'd recommend swapping out whatever you're writing PowerShell scripts in for Notepad++ and a an open PowerShell window. I snap one to either side of my screen in Windows 10, and it makes trying out lines of code as you go nice and easy. Even if you think something is gonna work in PowerShell, because you did almost the exact same thing, you still need to try it out, and watch how the colors change. I've literally had the exact same snippets of code, with ONLY the alias swapped in for the verbose cmdlet name and had stuff break--so you really have to fiddled with everything until you get them perfect. I know you were trying to get fancy with that JSON file, but I'd recommend loading everything into a plain text file, and running your script "ForEach" line in the file, or just straight up write out each line in long form. The less that can go wrong, the better.

Good luck, hope this helped.

prepare.ps1.txt transcript1.txt

Francommit commented 4 years ago

Hey mate,

Sorry you had to go through all that trouble. Can I ask why you used Powershell Transcript?

I've never seen/had this happen before, are you not running by admin by any chance? Are you using a 32-bit version of Windows 10?

I'd love to figure out what went wrong!

Thanks.

Francommit commented 4 years ago

Just for reference - I've run is multiple times all night sorting out a few other issues until I got it just right.

kernelpickle commented 4 years ago

Hey,

It’s alright, I ultimately ended up figuring it out—but I figured I’d pass what I did along to you, in case it helps you fix something.

I used PowerShell transcript, because when the script was failing, I wanted to see a more detailed account of what was happening, so I could troubleshoot where the script was getting hung up.

When I ran the script it was in an elevated prompt, and I actually used the Registry hack you posted, which is a pretty handy trick.

It’s been a minute since I ran the script, but if I recall the bulk of the issues I kept encountering were with the way you formatted the file path variables. Joining them with the + sign was yielding inconsistent results, or straight up failures on my system for some reason (which is just the latest 64-bit versions of Windows 10, and probably the final version of PowerShell 5.1.x that was for Windows only).

Once, I had the file paths fixed, the only part I wasn’t able to figure out how to get working was the thing you did with converting that JSON file with all the Github paths, and downloading all of those files. Since my experience is more focused on Batch, PS, and Python scripts, I ended up taking the lazy way out. My workaround was to just manually download the files and dump them into the folder that the script was looking for them, and once I did that, I was able to run it from start to finish without any issues.

I don’t know if there was any particular reason you opted to use the JSON file, instead of a plain text file to build the contents of the array—but that might be an area you could streamline or simplify further.

I would assume that one of Microsoft’s more recent updates is what borked the syntax you were using. I’ve found PoweShell to be quite fickle, and had it behave in all sorts of strange ways. I’ve literally seen the formatting of something in quotes broken just by switching from an alias to the verbose name of a cmdlet. (I wish I could recall the exact command, because it was super weird.)

In any case, I hope that helps you make some tweaks to get your script running smoothly again, because it looked like you had a decent foundation before someone at Microsoft “fixed” PowerShell since your first wrote it. I’m sure I can’t be the only one who encountered issues, but if I didn’t get paid to write PS scripts as part of my day job, I probably would’ve given up and just followed a walkthrough of the manual install process your script was automating.

(Given the state of the version that I posted, if you find anything I modified useful, feel free to incorporate it back into your script and take full credit—I’m sure that by the time you’re done untangling that mess, you’ll have earned it anyway! lol)

Regards,

Scott Tousignant

On Feb 17, 2020, at 6:08 AM, Chris Franco notifications@github.com wrote:

Hey mate,

Sorry you had to go through all that trouble. Can I ask why you used Powershell Transcript?

I've never seen/had this happen before, are you not running by admin by any chance? Are you using a 32-bit version of Windows 10?

I'd love to figure out what went wrong!

Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MagikGimp commented 4 years ago

Hi both. Thanks for all your hard work; I appreciate it a lot. In the three months or so since the script file was last updated however there have been some changes on the Interwebs which have broken it somewhat:

  1. PCSX2 has been updated to v1.6.0 and the download link for v1.4.0 is dead now anyway. The download at the official site is a redirect so I can only link this for now- https://pcsx2.net/download/releases/windows.html
  2. The link for Marilyn_In_the_Magic_World is now behind a Cloudflare layer which choco doesn't like.
  3. The link for recalbox has changed or rather the file that downloads from the link has. This means that the script doesn't see it and even if it's renamed it doesn't extract to the same folder as referred to in either of your files.
  4. I had problems downloading jrassa's build. For some reason the file was truncated which caused problems. Might be a problem GitHub's end.

Also the shortcut generated for windowed mode is coded wrong. The speech marks should only encompass the executable's path and not its arguments / parameters.

Other than that everything else worked OK so thank you again. I might suggest that a few more writehost output wouldn't go amis so the user knows each step e.g. writing to config files has been completed and some of your additions, Scott I thought were good ideas which, Franc you may wish to also include in the new revision; if you intend to continue this project of course.

PRElias commented 4 years ago

Hi @MagikGimp

I've updated the links for problemns 1 and 2, but couldn't get what to do wit the last 2.

As soon as @Francommit accepts the pull request you'll be able to test (I only tested the downloads on browser)

ps.: @Francommit sorry again for my wrong PRs which I closed myself

MagikGimp commented 4 years ago

OK but testing via browser for point 2 won't give you the same results as through choco. Browsers can handle redirects and such but choco can't, which was my point. Before the site presumably wasn't behind Cloudfare. The script can be changed as necessary for point 3 if the new filenames and archive structure are looked at. Yeah, I agree about point 4. Perhaps it was a one-off? Is it possible to put a check in the script followed by a loop to retry if there's a problem? It uses hashes to check some of the other files I think I'm right in saying?

Francommit commented 4 years ago