PlaydateLinux / twitterdemo

Crank through a Twitter user's recent tweets.
11 stars 0 forks source link

API/ABI version consistency #1

Open ginger-mochi opened 2 years ago

ginger-mochi commented 2 years ago

You could consider checking playdate.apiVersion() and then setting the values in gWifiApi / EnableWifiApiMacOSSimulator accordingly. This might help improve the stability of main.c should the code be updated when firmware v 1.12 come out, and also it will enable any apps made with this library to gracefully fail if the firmware version updates. It will also ensure that v 1.11.0 firmware continues to be supported by this library in the future.

To ensure API consistency should the pd_api.h header change, you may wish to change the declaration of the PlaydateAPIExt struct like so:

struct PlaydateAPIExt
{
  const void*[9]; // size of publicly-available PlaydateApi as of version 1.11.0
  PlaydateWifiAPI* wifi;
  PlaydateDeviceAPI* device;
}
zhuowei commented 2 years ago

I did try this: playdate.apiVersion() returns 11000 as the API version even on an 1.11 simulator, though? (Note that 1.9.3 simulator returns 10900, so it looks like it only changes for breaking changes?)

ericlewis commented 2 years ago

you can use playdate.systemInfo.sdk which returns a string with exact version.