Skip to content

ASC 3.0 Compatibilization #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

neimex23
Copy link
Contributor

@neimex23 neimex23 commented Sep 28, 2024

Hey good, I hope you are well. After a lot of time coding and very little because university things I started adding functionalities for ASC 3.0 after my new interface was finished.

I have a problem with the combobox that we used to set the active splitter did'nt set on Startup,

BEFORE HCM INTERFACE IMPLEMENT

LoadAutoSplitterSettings.Invoke(AutoSplitterInstance, [profCtrl, this]);
List<string> GameList = (List<string>)GetGames.Invoke(AutoSplitterInstance, null);
foreach (string i in GameList) comboBoxGame.Items.Add(i);
comboBoxGame.SelectedIndex = (int)GetSplitterEnable.Invoke(AutoSplitterInstance, null);
PracticeModeCheck.Checked = (bool)GetPracticeMode.Invoke(AutoSplitterInstance, null);

AFTER HCM INTERFACE IMPLEMENT

AutoSplitterCoreModule.AutoSplitterRegisterInterface(InterfaceASC);
comboBoxGame.Items.Clear();
foreach (string game in InterfaceASC.GameList)
{
    comboBoxGame.Items.Add(game);
}

 LoadAutoSplitterHotKeys();

You added
interfaceASC.ActiveGameIndex = GetSplitterEnable(); on ASC in RegisterHitCounterManagerInterface() Function
but the problem for manage this by the function is that called before fill ComboBox on HCM, then this raises an OutOfRange exception in the comboBox, to fix this im added GetActiveGameIndexMethod Function.
Remember that now ASC Fill ObservableCollection GameList after AutoSplitterRegisterInterface is invocated.

I dont know why PracticeMode still working but if it works that's enough, maybe is manage by other function.

@neimex23
Copy link
Contributor Author

Now ASC has the possibility to uploading and downloading profiles directly from a folder in the google drive and implement associated functions to handle profiles and splits effectively.

Implemented Functions:

  • GetProfiles(): Retrieves all profiles from HCM.
  • ProfileName(): Obtains the name of the current profile.
  • GetSplits(): Retrieves all splits for the current profile.

Enhanced Profile Creation:

To be able to enter the splits that are downloaded from drive I created a custom serialization that has as structure the name of the profile and the splits

  • Modified NewProfile(string profileTitle) to create a new profile using the provided parameter.
  • Maintains the existing window behavior when profiles are created in HCM.

The idea is after establishing the profile to go through a list that I have of splits and add them with

  • AddSplit(string SplitTitle);

Sin título
Sin título2
Roadmap.txt

Im still working in other functions like autohitcounter maybe i should edit some other function on HCM
I hope to release this in a few months after some beta testing, 
I got carried away by the size of this KEKW update. 
I'll leave you the roadmap so you have an idea of ​​how things are going.
I'll let you know when everything is official to do a new release of HCM, THX for all

@neimex23 neimex23 changed the title Bug fix where ActiveGameIndex is not set correctly on program Startup ASC 3.0 Compatibilization Mar 1, 2025
@neimex23
Copy link
Contributor Author

neimex23 commented Mar 1, 2025

I’m already in testing and beta phases with the new version of ASC. I’ll be coordinating with you soon to carry out an update.

Best regards

topeterk added a commit that referenced this pull request Mar 7, 2025
@topeterk
Copy link
Owner

topeterk commented Mar 7, 2025

Applied same changes as for v2 (see #40 for details)

@neimex23
Copy link
Contributor Author

neimex23 commented Mar 8, 2025

Awesome the names are clearer. I'm tested the new methods in Cloud Functions for profile creation, retrieval, and inserting splits, and everything is working correctly

@topeterk
Copy link
Owner

topeterk commented Mar 8, 2025

Nice to hear, shall we keep the PRs open (if you plan to add/change anything further) or shall I merge it already (from my side it looks fine).

@neimex23
Copy link
Contributor Author

i have some troubles removing GetActiveGameIndexMethod for this and HCMv2

foreach (string game in InterfaceASC.GameList)

HCM register ASCInterface First to get GameList before
https://github.com/neimex23/AutoSplitterCore/blob/335d8a39324fdf8108e65beb244f221ee700b1ad/Sources/ProgramModule/AutoSplitterMainModule.cs#L81

https://github.com/neimex23/AutoSplitterCore/blob/335d8a39324fdf8108e65beb244f221ee700b1ad/Sources/ProgramModule/AutoSplitterMainModule.cs#L98

after all

comboBoxGame.SelectedIndex = InterfaceASC.GetActiveGameIndex();

It is necessary to keep the GetActiveGameIndexMethod because RegisterHitCounterManagerInterface relies on the game list being populated before it can set the active game index. Specifically, the ComboBoxGame is not filled until after the registration process (referenced in Form1.cs line 88 and AutoSplitterMainModule.cs lines 81-98). This is important because ASC need ComboBox Filled to set a Active Index.
If insist on remove it i thinking in this solution

  Task.Run(async () =>
  {
      var expectedGameCount = GetGames().Count;
      while (interfaceASC.GameList.Count != expectedGameCount)
      {
          await Task.Delay(2000); // Wait Fill HCM comboboxGames to set Saved ActiveGameIndex
      }
      interfaceASC.ActiveGameIndex = GetSplitterEnable();
  });

but I'm not sure if this would be the right approach

topeterk added a commit that referenced this pull request Mar 19, 2025
(Required for better AutoSplitterCore integration, see #36)
@topeterk
Copy link
Owner

Yes you were right, the GameList was not changing the ComboBox directly when the collection gets changed by ASC. I fixed that in the commit, I just pushed. It should behave as in version 2 now.

So, in the debugger, when I change the result of GetSplitterEnable to, for example Celeste (7) then the ComboBox gets updated to the corrent entry in HCMv1 and HMCv2 on my side.

To test this, the ASC implementation looked this way in RegisterHitCounterManagerInterface which I think was the same what you were trying, right?

                interfaceASC.GameList.Clear();
                foreach (string game in GetGames())
                {
                    interfaceASC.GameList.Add(game);
                }

                interfaceASC.ActiveGameIndex = GetSplitterEnable(); //Before HCM Interface Change, ASC control mannualy on start the index of ComboBoxGame in Main Program
                //interfaceASC.GetActiveGameIndexMethod = () => GetSplitterEnable(); //After HCM Interface Change, HCM ask on Start The index of ComboBoxgame on ASC
                interfaceASC.SetActiveGameIndexMethod = (splitter) =>
                {

Hopefully this resolves the issue that you see or did I miss anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants