Author Topic: C# AGILE  (Read 87679 times)

0 Members and 1 Guest are viewing this topic.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #105 on: October 19, 2022, 12:38:06 AM »
I am wondering if it might not be best to just zip Agile. An MSI seems a bit heavy handed for what can used for what is essentially a portable app. It needs no Registry entries or system files written. All settings are saved in its AppData folder during usage.

A zip or even an NSIS installer is more transparent as the files are easily extracted from either. Additionally, a zip distribution would allow the user to simply extract it to an AGI game folder to run that game automatically without any browse for game dialog, like NAGI.

I wasn't sure what people would prefer. I went with the MSI because I thought they might like to get it added to their Windows menu, but maybe people would prefer to unzip it themselves, wherever they like, such as, like you say, in a game folder. I guess it could be provided in two forms, both an MSI and ZIP. The current ZIP contains the MSI and a setup.exe. When I read up on why the installer project creates both, apparently the setup.exe does checks on dependencies. I wasn't sure if that meant the .NET framework, or other dependencies. If it is the latter, then there are no other dependencies. If someone were to run the MSI directly (rather than the setup.exe), and they didn't have the .NET framework installed, would it prompt them to do so? And is there a difference between how that behaves when running the setup.exe vs the MSI?

What do other people prefer? A ZIP of only the application files themselves? Or the MSI & setup.exe files? If everyone here prefers the ZIP of only the main AGILE.exe and dll files, then I'll go with that. Let me know what you all think.

Offline MusicallyInspired

Re: C# AGI Interpreter
« Reply #106 on: October 19, 2022, 09:04:44 AM »
ZIP. I don't ever depend on adding programs to the Start Menu. Just desktop shortcuts if anything. And I do that manually if I wish. I'm not a big fan of installers in general. Though, many appreciate it of course judging by Collector's popular patches and custom installers, but that's a different case really where one is trying to get the original games working properly. I don't even use installers for DOSBox. I wouldn't for ScummVM either but the daily builds only come in installer EXE form so not much I can do about it. But if I could get ZIPs of them instead, I would.
« Last Edit: October 19, 2022, 03:30:38 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Collector

Re: C# AGI Interpreter
« Reply #107 on: October 19, 2022, 12:46:51 PM »
First choice Zip, second NSIS. It would be a very simple script and could add it to the start menu and/or desktop. It could also be in the Windows remove program list as well as be treated as a simple ZIP with 7zip. Both a zip and an NSIS installer could be offered and let the user choose which they want to want to download.

I can easily see many that would want to simply drop the Agile files in their AGI game folders to run each game as if it was a native Windows game, or whatever platform Agile will run on.
KQII Remake Pic

Offline Collector

Re: C# AGI Interpreter
« Reply #108 on: October 19, 2022, 06:09:22 PM »
I was experimenting doing and it somehow it got mixed up on my GitHub repo and I can't seem to get it to revert back to the same as your master. It is showing 19 commits that were nothing more than restoring it to the same state as your repo. Not sure if I'll need to remove my Agile repository and rebranch it. From now on I'll do my experimentation on another copy and not my local GitHub repo.

I have a couple of additions that I want to commit. One is just a fix for the context menu to check the chosen aspect ratio item on relaunch. I have also added an argument for the program.cs that would send a selected game folder to Agile on a folder context menu item, "Run with Agile". This would require a static location for the program. Right click on an AGI game folder and select "Run with Agile". Probably needs to give a message if no AGI game is found in that folder and then open the browse dialog.
KQII Remake Pic

Offline Charles

Re: C# AGI Interpreter
« Reply #109 on: October 19, 2022, 08:43:31 PM »
My vote?s for ZIP while you?re still in development. A faster update cycle and your target audience during such probably prefers the zip. When you get to a stable release phase the installer is nice as long at looks/acts modern. The MSI one you?re using doesn?t.

I gave it a look today, and there were two UI-type annoyances I had. I hate that folder dialog. Can you implement something like https://stackoverflow.com/a/15386992/57611, and toggling the aspect ratio correction on and off caused the window to slowly get wider. I would expect changing the aspect ratio to only affect hight.

I can?t really speak to the technical AGI aspects. Leisure Suit Larry worked for the 30s I played it.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #110 on: October 19, 2022, 08:58:52 PM »
My vote's for ZIP while you're still in development. A faster update cycle and your target audience during such probably prefers the zip. When you get to a stable release phase the installer is nice as long at looks/acts modern. The MSI one you're using doesn't.

Cool. That's three people in a row so far that prefer the ZIP for now. Windows programming and installers are all new to me, so I wasn't really sure what options I had. I have never heard of the NSIS installer that Collector mentioned. Will need to look that up. Is that an example of a more modern looking/acting one?

I gave it a look today, and there were two UI-type annoyances I had. I hate that folder dialog. Can you implement something like https://stackoverflow.com/a/15386992/57611, and toggling the aspect ratio correction on and off caused the window to slowly get wider. I would expect changing the aspect ratio to only affect hight.

Yeah, I agree about the aspect ratio option. I'll take a look at that. I still have a ticket under the Issues on github to properly implement aspect ratio correction. I know Collector said that this was an initial short term solution for now. I have an idea of an alternative approach that involves keeping the window size the same but adjusting how the image is rendered within it, so that it gets the black bands either above or to the side (letterbox/pillarbox), depending on the window size.

Regarding the folder browser dialog, I also totally agree. I spent a long time searching online trying to make that default FolderBrowserDialog look and behave better, but it seems that it just doesn't have the capability. I think how I have it is about as good as that one gets. I did see that there were alternative implementations to the default one that I could use, so perhaps now is the time to take a look at one of those. Thanks for the stackoverflow link. I think I might give that implementation a go.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #111 on: October 19, 2022, 09:04:55 PM »
First choice Zip, second NSIS. It would be a very simple script and could add it to the start menu and/or desktop. It could also be in the Windows remove program list as well as be treated as a simple ZIP with 7zip. Both a zip and an NSIS installer could be offered and let the user choose which they want to want to download.

Is setting up an NSIS installer something that you could try on your fork of the repo? I was thinking I should leave that to someone who knows what they are doing.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #112 on: October 19, 2022, 09:14:34 PM »
I was experimenting doing and it somehow it got mixed up on my GitHub repo and I can't seem to get it to revert back to the same as your master. It is showing 19 commits that were nothing more than restoring it to the same state as your repo. Not sure if I'll need to remove my Agile repository and rebranch it. From now on I'll do my experimentation on another copy and not my local GitHub repo.

I'm not familiar with merging forks back to the original repo. I'm very familiar with pull requests that involve merging a feature branch back to master within the same repo, as we use github every day at work, but never with forked repos. I wonder whether the appropriate best practice for forked repos is to create a feature branch in the forked repo, and then do a pull request to get that feature branch merged back into the original repo, from where it could then be merged back to master in the original repo, and then the forked repo could then resync master with the original repo? Just thinking out loud. Will need to read up on the best practice.

I would also have to read up on whether it is possible to "re branch" a forked repo, as you suggested. I'm sure there must be a way, either to rebranch/recreate the fork from the current original repo state, or to bring the forked repo back to exactly the same state as the original repo.

I have a couple of additions that I want to commit. One is just a fix for the context menu to check the chosen aspect ratio item on relaunch. I have also added an argument for the program.cs that would send a selected game folder to Agile on a folder context menu item, "Run with Agile". This would require a static location for the program. Right click on an AGI game folder and select "Run with Agile". Probably needs to give a message if no AGI game is found in that folder and then open the browse dialog.

Sounds like a useful feature. Yeah, if we can work out the best set of steps to follow to merge features from a forked repo, then we can get that submitted as another pull request.

Offline Collector

Re: C# AGI Interpreter
« Reply #113 on: October 20, 2022, 01:12:04 AM »
NSIS is very flexible. You can easily customize the UI or look. It can have as light of a footprint on the user's system as a self extracting zip, but in a "wizard" form. What I am thinking is that the installer should write nothing more in the Registry than what is required for the uninstaller (little more than a path to the program) and the folder context menu I talked about. The only systems files it would write would be the start menu shortcuts.

I'll write this NSIS installer after I get my Git repo straightened out. I can implement the folder context menu from it. I can also add a preference for it in the options form that simply use the assembly's current path for it, even if the user downloaded a zip instead of the installer.

Right now with my branch you can start a game from:
  • The same browse dialog as Lance's main repo, but starting from the last used folder selected. Restarting the same game only requires you to hit enter when the dialog opens.
  • Copying the Agile exe and DLLs to a game's folder and starting Agile from there. A shortcut can be made from that copy of the Agile exe to directly run that game.
  • Right clicking an AGI game's folder and selecting "Run with Agile". This would work as an IDE add-on where the the IDE would only have to pass a game's folder path to Agile to run it. It could work like SCI Companion's plugin system. Just drop a folder with Agile in it in the IDE's "Plugin" subfolder.

Currently the aspect correction in my branch keeps the current width and changes only the height of the window. My Agile context menu currently includes an open config file for viewing and editing. This is mostly for debugging purposes and can be removed from the release version. It looks for the system's default XML editor and if it does not find one it will offer the user to select one. But mostly the config file will be unseen by the user. Given that the config is unique per location, if a user wants to have a copy in each AGI game like NAGI, each will have its own preferences. Official games could have its aspect ratio set to true, while any fan games that had its graphics created for the wider aspect could have its aspect ratio set to false, for example.

Anyway, this is what I have done with it so far. I'm having a blast playing with this.
KQII Remake Pic

Offline Charles

Re: C# AGI Interpreter
« Reply #114 on: October 20, 2022, 10:35:08 AM »
Right clicking an AGI game's folder and selecting "Run with Agile". This would work as an IDE add-on where the the IDE would only have to pass a game's folder path to Agile to run it. It could work like SCI Companion's plugin system. Just drop a folder with Agile in it in the IDE's "Plugin" subfolder.

Honestly, that feature's a hard pass from me.  The amount of folder on my computer that I do not want to open in Agile far exceeds that amount of folders I do. Having a folder-browser dialog that I can paste a url into solves that ease of use problem for me.

Copying the Agile exe and DLLs to a game's folder and starting Agile from there.
That's a good one though. In fact, Agile should automatically check the folder it's run from for a valid AGI game and run it if found, otherwise prompt with the folder browser dialog.  And command-line arguments are of course good too.

Offline Collector

Re: C# AGI Interpreter
« Reply #115 on: October 20, 2022, 01:40:50 PM »
The folder context menu could easily be an option from the installer or a preference setting in Agile itself. If added to a preference dialog it could be added or removed at the users discretion. One other ability it has is that the folder path flag allows is that you can drop an AGI folder on an Agile shortcut to start the game, with or without the folder context menu.

Agile already checks its folder the see if there is an AGI game in it, first.
KQII Remake Pic

Offline Charles

Re: C# AGI Interpreter
« Reply #116 on: October 20, 2022, 03:01:16 PM »
Agile already checks its folder the see if there is an AGI game in it, first.
Oh awesome. I didn't realize.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #117 on: October 21, 2022, 06:52:25 PM »
I gave it a look today, and there were two UI-type annoyances I had. I hate that folder dialog. Can you implement something like https://stackoverflow.com/a/15386992/57611, and toggling the aspect ratio correction on and off caused the window to slowly get wider. I would expect changing the aspect ratio to only affect hight.

Yeah, I agree about the aspect ratio option. I'll take a look at that. I still have a ticket under the Issues on github to properly implement aspect ratio correction. I know Collector said that this was an initial short term solution for now. I have an idea of an alternative approach that involves keeping the window size the same but adjusting how the image is rendered within it, so that it gets the black bands either above or to the side (letterbox/pillarbox), depending on the window size.

Going back to this one, do people have a preference with regards to how the aspect ratio correction works? The current quick solution that Collector implemented adjusts the window size to make the aspect ratio correct. This works because the image inside the window automatically stretches to fill the window. I've been working on an alternative implementation, as mentioned above, where the window size stays the same, but the image inside the window is adjusted, so that we get those letterbox/pillarbox black bands. I don't see any issue with that, as its exactly how scummvm does it, and it has to be done that way for full screen in any case. It seems to be working quite well. I just added an event handler for the window resize and adjusted the PictureBox to match, keeping it centered, and maintaining the aspect ratio. I can set it up such that this happens only when the aspect correction option is ticked, and if it isn't, then it would instead fill the window size as it currently does.

Offline Collector

Re: C# AGI Interpreter
« Reply #118 on: October 21, 2022, 07:33:45 PM »
I don't see a need to pillarbox or letterbox a window. Full screen is another matter. This is how DOSBox handles it, even if the window size cannot be changed on the fly without access to its command line. My current method merely adjusts height, keeping the user's current width. It also remembers aspect correction between sessions. The main reason for the selection is for the proper aspect for which the art was created. All of the official games' art would be best with aspect correction, but many of the fan games' art would have been made without.

What might be nice whichever option is selected, is to force it to keep the same aspect ratio when a window is stretched. I might be able to implement this.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #119 on: October 21, 2022, 08:16:35 PM »
What might be nice whichever option is selected, is to force it to keep the same aspect ratio when a window is stretched. I might be able to implement this.

This is essentially what I have implemented. - Edit: Actually, perhaps you meant to keep the window size in the same aspect ratio when resized. I'm not doing that yet, but I can see how that would avoid the need for the letterbox/pillarbox affect.

Since my last post, I've come up with a hybrid between your code and the "keep same aspect ratio when the window is stretched", in relation to the PictureBox. So what I've got it doing at the moment is that when the aspect ratio correction is turned on, it adjusts the GameScreen PictureBox size to the correct aspect ratio to fit in the current window size (depending on the current window dimensions, this might mean that it matches either the width or the height, whichever is appropriate for the current dimensions) and then it crops the window size to exactly fit that adjusted GameScreen size, which is using your code. Then if the user happens to adjust the window size, which I do a lot actually, then they will get the letterbox/pillarbox effect (Edit: Although, as mentioned above, I guess we could dynamically adjust the window size to keep it cropped to the PictureBox when not in fullscreen mode). I don't think it makes sense to adjust the window size when exiting out of aspect correction mode though, in fact I think that is what caused the issue Charles reported. So I've removed the ClientSize adjustment that was happening when turning off aspect correction and instead the image just fills up, i.e. stretches to fill, whatever size the window is currently in (i.e. when aspect correction mode is off).

I'll create a branch on my repo, and a PR associated with it, so that you can see the changes I've made. I think it works quite well. I'll leave it unmerged and just as example code for now, until we agree how the whole thing should work.

I guess whichever way we go, the new code I've written works well for full screen, so is good for that scenario.
« Last Edit: October 21, 2022, 08:26:04 PM by lance.ewing »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.078 seconds with 22 queries.