Skip to content
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

Steam client reference #92

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

FlashyReese
Copy link

@FlashyReese FlashyReese commented Aug 27, 2023

Using the SDH Discord server, GitHub, and personal findings, I have attempted to document as many functions as possible within the SteamClient object. Feedback is greatly appreciated. If you come across any functions that are not documented and you already understand their purpose, please consider leaving a comment or suggestion.

To do list will be done on a separate PR.
To-Do List:
- [ ] Verify the functionality of all documented functions.
- [ ] Organize and restructure all the interfaces for better readability.

@AAGaming00
Copy link
Member

After reading the latest commit message, how are you detecting the interface changes so quickly?

@FlashyReese
Copy link
Author

After reading the latest commit message, how are you detecting the interface changes so quickly?

Using the CEF debugger console, I've written this function to quickly extract every method for any object.

function mapFunctions(obj) {
  const methods = {};

  function extractMethods(obj, path = []) {
    for (const key in obj) {
      if (typeof obj[key] === 'function') {
        if (!methods[path.join('.')]) {
          methods[path.join('.')] = [];
        }
        methods[path.join('.')].push(key);
      } else if (typeof obj[key] === 'object' && obj[key] !== null) {
        extractMethods(obj[key], [...path, key]);
      }
    }
  }

  extractMethods(obj);

  return methods;
}

Then I simply apply this to the SteamClient object, deserialize it as JSON, and compare it to a previous version using git's diff tool.

@AAGaming00
Copy link
Member

That's awesome, I'll add this to my update diff system if you don't mind

@FlashyReese
Copy link
Author

FlashyReese commented Sep 22, 2023

That's awesome, I'll add this to my update diff system if you don't mind

That would be awesome!

I think we can write a tool to generate the aforementioned TypeScript interfaces from it. This could prove useful, as it can be utilized anywhere. Unfortunately, native code does not provide parameters for these functions. This means documenting parameters must be done manually, unless someone is aware of a method I am not familiar with.

Edit: I decided to spend some time and write one: https://gist.github.com/FlashyReese/05748e25b9feabe14e62ef873a8058cb

@PartyWumpus PartyWumpus added the enhancement New feature or request label Nov 11, 2023
Steam Version:  1700160213
Steam Client Build Date:  Fri, Nov 17 2:23 AM UTC +08:00
@PartyWumpus
Copy link
Member

Edit: I decided to spend some time and write one: https://gist.github.com/FlashyReese/05748e25b9feabe14e62ef873a8058cb

Noticed you weren't able to get the name of the object from the object. If it's a global object then this should work Object.getOwnPropertyNames(window).filter(name => window[name] === obj)[0]. Probably not actually useful though.

ricewind012 and others added 17 commits November 26, 2023 20:36
docs(SteamClient): document some interfaces
Steam Version:  1702515219
Steam Client Build Date:  Thu, Dec 14 00:36 UTC -08:00
Steam Version:  1704329464
Steam Client Build Date:  Thu, Jan 4 12:23 AM UTC -08:00
Steam Version:  1705630720
Steam Client Build Date:  Fri, Jan 19 1:58 AM UTC -08:00
Steam Version:  1706914901
Steam Client Build Date:  Fri, Feb 2 8:46 PM UTC -08:00
Steam Version:  1709920887
Steam Client Build Date:  Thu, Mar 7 5:29 PM UTC -08:00
Steam Version:  1710786209
Steam Client Build Date:  Mon, Mar 18 7:07 PM UTC -08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants