suXinjke / cruncheevos

Set of tools to deal with RetroAchievements achievement sets using JavaScript
MIT License
4 stars 0 forks source link

Rich Presence API #5

Open suXinjke opened 5 months ago

suXinjke commented 5 months ago

There should be some helper functions to define and generate Rich Presence with, whatever that's present in the docs is bandaid.

No exact idea on how it should be like for now, would prefer it to look declarative.

suXinjke commented 3 months ago

Been working abit on this recently, it may look like this

  const { richPresence, lookup, displays } = makeRichPresence({
    keyFormat: 'hex',
    format: {
      Score: 'VALUE',
    },
    lookup: {
      Car: {
        name: 'CarOverrideName',
        values: {
          '*': '- -',
          3: 'Car no. 3',
          1: 'Car no. 1',
          4: 'Car no. 4',
        },
        keyFormat: 'dec',
        defaultAddress: 0x100,
      },
      Track: {
        values: {
          10: 'Track no. 10',
          22: 'Track no. 22',
          33: 'Track no. 33',
        },
        defaultAddress: 0x200,
      },
    },
    displays: ({ lookup, format, str }) => [
      [$('0xCAFE=1'), str`Cafe at value 1, Car: ${lookup.Car}, Track: ${lookup.Track}`],
      ['0xCAFE=2', str`Cafe at value 2, Track: ${lookup.Track}`],
      ['0xCAFE=3', str`Format test ${format.Score.at(0xfeed)}`],

      'Playing a good game',
    ],
  })
suXinjke commented 2 months ago

Mostly got implemented in 0.0.5, including rich-save command

I'd also like to implement rich-diff and rich-diff-save command, acting similar to diff and diff-save commands