SteelSeries / gamesense-sdk

471 stars 145 forks source link

SteelSeries Engine crash with context-frame-key multi line #78

Closed mtricht closed 4 years ago

mtricht commented 4 years ago

The following event handler works just fine:

{
  "game": "TEST",

  "event": "TEST",
  "handlers": [
    {
      "datas": [
        {
          "lines": [
            {
              "has-text": true,
              "context-frame-key": "artist"
            },
            {
              "has-text": true,
              "context-frame-key": "song"
            }
          ]
        }
      ],
      "device-type": "screened",
      "mode": "screen",
      "zone": "one"
    }
  ]
}

Except that the SteelSeries Engine crashes when opening the 'Screens' tab: image with the following javascript error:

Message: Unable to process binding "foreach: function(){return events }"
Message: Cannot read property 'label' of undefined
    at file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/11.js:58:11333
    at Function.xd (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:24796)
    at Function.yd (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:24482)
    at Function.ha (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:24319)
    at Function.mb (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:25900)
    at Function.tc (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:23541)
    at Object.p (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:703)
    at Object.ac (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:17578)
    at n (file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:22436)
    at file:///C:/Program%20Files/SteelSeries/SteelSeries%20Engine%203/resources/app.asar/0.js:198:27308

Is it something I can fix from the event handler? It's an almost copy paste from the documentation on context-frame-key: https://github.com/SteelSeries/gamesense-sdk/blob/master/doc/api/json-handlers-screen.md#text-formatting-options

JHunz commented 4 years ago

@mtricht Apologies for this. There's an API documentation issue with not detailing how to provide metadata for the data fields sent with your event, and a compounding issue with a check that should have prevented that crash in the case where that metadata was defaulted.

Please try sending the data below. It's the same as your existing handler, but with a small amount of additional metadata added

{
  "game": "TEST",

  "event": "TEST",
  "handlers": [
    {
      "datas": [
        {
          "lines": [
            {
              "has-text": true,
              "context-frame-key": "artist"
            },
            {
              "has-text": true,
              "context-frame-key": "song"
            }
          ]
        }
      ],
      "device-type": "screened",
      "mode": "screen",
      "zone": "one"
    }
  ],
  "data_fields": [
    {
      "context-frame-key": "artist",
      "label": "Artist"
    },
    {
      "context-frame-key": "song",
      "label": "Song"
    }
  ]
}
mtricht commented 4 years ago

@JHunz That works, thanks!

While you're here, is it correct that the OLED screen does not support UTF-8 characters?

JHunz commented 4 years ago

The text sent to the OLED screen using the GameSense API is currently rendered using the Arial Bold and Arial Black fonts, so it should support the subset of UTF-8 characters that are included in those fonts.

mtricht commented 4 years ago

That sadly doesn't support Chinese/Japanese/Korean, but thanks for your help anyhow!

JHunz commented 4 years ago

The crash has now been fixed internally, and the fix will roll out with the next public release of SteelSeries Engine.

I've also logged a task to look at the feasibility of properly supporting Asian/non-Latin character sets in the future.