Author Topic: C# AGILE  (Read 86679 times)

0 Members and 1 Guest are viewing this topic.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #210 on: November 18, 2022, 09:28:15 PM »
I was thinking that a real fix would involve a PInvoke. I'm getting an odd error with this update:
Quote
The designer must create an instance of type System.Windows.Forms.CommonDialog', but it cannot because the type is declared as abstract

Which is odd since there is no designer for this class. However it does compile and seems to address the issue. I am not sure why VS is not treating it as simply a non WinForm class.

Yeah, I'm not surprised actually, as I did kind of hack it. I think there were some "designer" comments in there, which I ripped out not really understanding what they were used for. Perhaps they were important  ;D.

Since this works well for me I I'll be abandoning my GongShell branch.

I am curious as to what this is from. There are references to unrelated things such as selecting a printer or computer dialog as well as references to an 'EditBox', none of which is needed by AGILE. I can probably trim the unused parts out for AGILE, but I am in the middle of an 8day work week and won't have much time for a few days.

Okay, thanks for confirming that it works for you.

Now that I think back, I think it was from someone's github repo, and I got the link from a stackoverflow answer. Let me see if I can find it again...

Found it. It came from here:
https://github.com/jkells/folder-browser-dialog-example/blob/master/FolderBrowserDialogEx.cs

and then I added the bit that does the ensure visible when the selection changes.

I'm happy for whoever knows what they're doing to clean it up. I did notice all those unused bits that you mention, but haven't yet tried to rip them out.

Edit: Since this solution is now working for everyone, I'll remove the FolderBrowserLauncher class from the repo, as that was from the previous attempt.

« Last Edit: November 18, 2022, 09:30:17 PM by lance.ewing »

Offline Collector

Re: C# AGI Interpreter
« Reply #211 on: November 18, 2022, 11:03:55 PM »
I removed all of the most obvious unneeded methods and variables. There was quite a bit. There may be more that could be removed, but not much. I also added the required NSIS plugin for the NSIS installer for convenience.

It is nice to not have to muddle though the age questions for LSL, but I cannot remember if LSLAGI had a dirtiness setting. In SCI you can skip the age questions with a script, but it can drop the "dirtiness level" its lowest setting. If LSLAGI has no dirtiness level it does not matter, but if it does will this patch keep it at its highest level? I haven't had a chance to see if the house buyer shows up in Gold Rush!. This was a bug with the most common cracked GR game.

I see it does not bypass the manual check questions of KQ4, but the 'marble' bypass still works with version 2.0, as well as the pirate Easter Egg.

KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #212 on: November 18, 2022, 11:30:03 PM »
I removed all of the most obvious unneeded methods and variables. There was quite a bit. There may be more that could be removed, but not much. I also added the required NSIS plugin for the NSIS installer for convenience.

Thanks, I have merged your PR.

It is nice to not have to muddle though the age questions for LSL, but I cannot remember if LSLAGI had a dirtiness setting. In SCI you can skip the age questions with a script, but it can drop the "dirtiness level" its lowest setting. If LSLAGI has no dirtiness level it does not matter, but if it does will this patch keep it at its highest level?

I don't recall it having a dirtiness level, but I do remember that the later games had it. @vafada implemented the question skipping patch for LSL1, so he may know. Even now I have to look up the answers to those questions. I wouldn't have a clue in some cases. Perhaps the questions have dated a bit, and some seem American specific. Either way, it is definitely a nice feature to skip them ;)

I haven't had a chance to see if the house buyer shows up in Gold Rush!. This was a bug with the most common cracked GR game.

Can you elaborate on the bug?

I have both the cracked and uncracked versions. I was going to start playing GR through to the end, which I guess means all three journey paths. Might take a while to get through this one.

One thing I did notice is that, before the question skipping patch was added to AGILE, the cracked version of GR showed a partly broken title screen, whereas after the patch, it now shows the correct looking title screen. Not sure why yet. I guess whatever broke it (probably where the crack is) has been skipped by the patch AGILE applies. I am half expecting there to be issues further down the track whilst playing GR, in relation to the patch, which may require further work. I'm guessing the house buyer bug that you mentioned might be one. It's been a long time since I played GR beyond a few screens, so can't recall it now.

I see it does not bypass the manual check questions of KQ4, but the 'marble' bypass still works with version 2.0, as well as the pirate Easter Egg.

Really? Is it definitely a clean copy? I've tried it with versions 2.0, 2.2 and 2.3 and the manual check skip patch works for all of them. What version of KQ4 does it show in the window title?

Offline Collector

Re: C# AGI Interpreter
« Reply #213 on: November 19, 2022, 12:07:32 AM »
As to the Gold Rush bug, https://www.sierragamers.com/forums/topic/gold-rush-problem/

King's Quest 4 v2.0 int3.002.086 still asks the questions. I just noticed that it says it is an unrecognized game and realized that this is a copy that was decompiled and recompiled.
KQII Remake Pic

Offline AGKorson

Re: C# AGI Interpreter
« Reply #214 on: November 19, 2022, 03:18:15 AM »
@AGKorson, are you able to test this on both of your systems?
I couldn't find an installer, so I just downloaded your repo and am checking it out in VS. It seems to be working fine for me. No surprise there.

I noticed your code uses GetDlgItem call to locate the treeview- I like that better than my way (searching for object classname text). I've implemented that in my WiAGI project, so thx for that.

I have a couple suggestions to improve your code -

  • Get rid of the editbox. The editbox is the text input control just below the treeview. It lets the user type in a folder location manually. But I'd bet nobody is ever going to do that given how complex folder hierarchies are these days. To make it disappear, change the _showEditBox property to false in the Reset method.

  • Skip the search for dialog handle in the callback function. There's no need to look for it- the handle is passed as the first argument of the callback function.

  • Use the default root folder. If you set _rootFolderLocation to zero, instead of forcing it to the Desktop, the root folder will default to the user's Desktop, but with the custom folder icons instead of the generic yellow folder. Also, when I run AGILE with the original code that sets root to the Desktop, the starting folder is always the root, instead of last folder. The call to SHGetPathFromIDList in the callback function fails when the dialog first loads. After loading, it starts working correctly. I'm not sure what's going on there, but if you just use the default, that issue doesn't show up.

One other glitch I noticed is that when the main form is first shown, the "Loading... Please wait" message flashes briefly before the folder dialog is displayed. It would look better if no message is shown until a game is actually being loaded.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #215 on: November 19, 2022, 03:43:13 AM »
As to the Gold Rush bug, https://www.sierragamers.com/forums/topic/gold-rush-problem/

My patch sounds quite similar to what the cracked version has done then. Instead of changing the DIR file though, it changes LOGIC.0 so that the new.room command that goes to room 129 instead goes to 73. So very similar, but not exactly the same. It sounds like I might encounter some of the same issues though, as it isn't running LOGIC.129 at all. I probably need a different patch then, as the same speed issue will probably happen.

From reading those posts, I understand now why my patch, when applied to the cracked version, doesn't have the title screen bug that the cracked version without the patch does.

King's Quest 4 v2.0 int3.002.086 still asks the questions. I just noticed that it says it is an unrecognized game and realized that this is a copy that was decompiled and recompiled.

Yeah, that would explain it. The game detection is based on the md5 checksum of the DIR file, so if it has been recompiled, then that will be different.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #216 on: November 19, 2022, 03:49:48 AM »
I have a couple suggestions to improve your code -

Thanks for the suggestions. Yeah, we'll definitely get those incorporated. I agree that the editbox won't be used much.

One other glitch I noticed is that when the main form is first shown, the "Loading... Please wait" message flashes briefly before the folder dialog is displayed. It would look better if no message is shown until a game is actually being loaded.

Okay, I'll take a look at that as well.

Offline Collector

Re: C# AGI Interpreter
« Reply #217 on: November 19, 2022, 08:50:00 AM »
AGKorson, you must have grabbed it before Lance merged my cleanup. I had already removed the editbox references and should be gone from Lance's repo. That editbox control was in a demo form from the original project that Lance found. Agile only uses the FolderSelectionDialog class from that project.
KQII Remake Pic

Offline vafada

Re: C# AGI Interpreter
« Reply #218 on: November 19, 2022, 09:12:24 AM »
I don't think LSL1 has a dirtiness level... I've playthru the entire LSL1 w/o answering the trivia by modifying the LOGIC file using WinAGI and compiling it back and did not notice anything different.

I did all the naughty stuff in the game (got the top score)

Offline vafada

Re: C# AGI Interpreter
« Reply #219 on: November 19, 2022, 09:16:14 AM »
I've been playing thru games using AGILE and fixing bugs as I see them and so far so good

I've finished

KQ1, KQ2, KQ3
LSL1
PQ1

currently playing Black Cauldron

I just bought Gold Rush in Steam and will play that after

been busy at work also so haven't played that much

Offline Collector

Re: C# AGI Interpreter
« Reply #220 on: November 19, 2022, 10:25:52 AM »
I compiled a new NSIS installer and added a preview release on my fork so anyone that wants to try AGILE and does not want to bother having to compile it can grab the installer. My branch is currently in sync with Lance's master branch. Since it is an NSIS installer you can treat it as a simple ZIP file with 7zip. If you run the installer instead, it will give you the option to add the "Run in AGILE" folder shell extension as well as a desktop shortcut. It will add no files in system folders other than in the Start Menu and has a light foot on the registry. Only AGILE path info for the uninstaller and the folder shell extension, which can be removed or readded via the AGILE options dialog.

https://github.com/ABranscom/AGILE
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #221 on: November 19, 2022, 11:38:40 AM »
AGKorson, you must have grabbed it before Lance merged my cleanup. I had already removed the editbox references and should be gone from Lance's repo. That editbox control was in a demo form from the original project that Lance found. Agile only uses the FolderSelectionDialog class from that project.

The edit box was still present on my branch after merging your pull request, and looking at the changes in the PR, it doesn't look like the edit box was removed. It did remove the setter and getter for it though, but the field itself was still there and being set to true on reset. I have now removed it and pushed the change to my master branch on github.
« Last Edit: November 19, 2022, 05:19:15 PM by lance.ewing »

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #222 on: November 19, 2022, 05:22:18 PM »
I've finished

KQ1, KQ2, KQ3
LSL1
PQ1

currently playing Black Cauldron

I just bought Gold Rush in Steam and will play that after

I have so far played through:

KQ1, KQ2, KQ4
SQ1, SQ2

My plan was also to play Gold Rush next, but I'll let you do that, as it sounds like you might have more time than me over the coming weeks.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #223 on: November 19, 2022, 05:29:45 PM »
  • Skip the search for dialog handle in the callback function. There's no need to look for it- the handle is passed as the first argument of the callback function.

That one is a classic copy and paste issue. I simply copied that code from an example on stackoverflow and didn't check to see if the method already had that value.

I have now removed it and it is still working. That allowed me to also remove the constant for the dialog title, which makes it a bit cleaner. I've just pushed the change to my repo.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #224 on: November 19, 2022, 05:44:05 PM »
  • Use the default root folder. If you set _rootFolderLocation to zero, instead of forcing it to the Desktop, the root folder will default to the user's Desktop, but with the custom folder icons instead of the generic yellow folder. Also, when I run AGILE with the original code that sets root to the Desktop, the starting folder is always the root, instead of last folder. The call to SHGetPathFromIDList in the callback function fails when the dialog first loads. After loading, it starts working correctly. I'm not sure what's going on there, but if you just use the default, that issue doesn't show up.

I didn't completely follow what you were saying with this one but I'll take your word for it. Currently it is setting the RootFolder to MyComputer. I have tried commenting that line out, and it changes to have Desktop at the root, rather than "This PC". Given that, I couldn't work out what you meant by the second bit regarding the original code that sets root to Desktop, or in what scenario the starting folder is always the root.

But in summary, is this the line you are saying should be removed, from the AgileForm class:

Code: [Select]
folderDialog.RootFolder = Environment.SpecialFolder.MyComputer;


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

Page created in 0.094 seconds with 23 queries.