Simulator: Detect when not pointed at directory and give proper error

Using SDK 1.10.0 on Linux.

If I run the simulator on the command line, and give it anything that's not a "pdx" directory as the first argument, it gives this error:

22:30:26: cmd line pdx path: /home/me/some_file.txt
22:30:26: Loading: /home/me
22:30:26: Loading: Failed
Load failed: "(null)" was built with an old version of the SDK.
  1. Why is it trying to load the home directory instead of the file?
  2. Why is it giving an error about "(null)" instead of telling me that the file I pointed it at is not a directory, or that the directory doesn't appear to be a game? It should only give an "old version" error if it really thinks the directory contains a game of an older version. (Another thread of a developer that was tripped by this error)

Another weird behavior:

Suppose directory dir/ contains the game dir/game.pdx.

  1. Enter dir/ and run PlaydateSimulator game.pdx. The game will run successfully. Quit the simulator.
  2. Now run PlaydateSimuator .. The Simuator will give the error "(null)" was built with an old version of the SDK..
  3. In the error box that pops up, choose "cancel" instead of "retry"

Result:
The Simulator will suddenly load the game. This is unexpected.

Console output:

22:46:26: Loading: Failed
Load failed: "(null)" was built with an old version of the SDK.
*snip*
update failed: "(null)" was built with an old version of the SDK.

The device firmware has introduced an incompatible change since this PDX file was compiled.

PDX version: 0
Firmware is compatible with 10000 and up.

Please update and try again. Thanks!
22:46:26: Update failed, simulator paused.
22:46:27: Loading: game.pdx
22:46:27: Loading: OK

I agree this could be better.

When you press cancel the Simulator is running the game from the previous session. Which in your case of the same as the one you're trying to run.

1 Like

I'll clean this up a bit. The intention was to allow the Playdate OS to handle all load errors, but as you can see it doesn't do much path sanitizing before attempting to load a game so you get odd errors like this. Thanks for the report!