Simulator "Upload Game To Device ..." should remember previous folder

I'm developing on Windows and testing on device. I like to iterate frequently and upload new builds many times during a coding session, which I do using the simulator. Every time I select Device > Upload To Device in the simulator I have to browse back to my project folder, which adds needless delays to my iteration time.

Note that this is inconsistent with Device > Run Game On Device ..., which does remember the previous setting.

It would also be nice to have a menu item and hotkey to reload the previously uploaded game image.

I suspect there is a command line way to upload and run my game that I could integrate into my VS Code workflow - I'll look into that, but I think this feature request makes sense regardless. Thanks!

I just learned that I should be able to upload and run a pdx to the device with the command line:
PlaydateSimulator.exe <pdx path>

However this is not working for me. I'm using the Windows Simulator Version 1.12.3.

When I run from the command line, the following appears in the Playdate Console:

22:13:54: SDK: D:\Personal\Playdate\PlaydateSDK
22:13:54: Release: 1.12.3
22:13:55: cmd line pdx path: D:\Personal\Playdate\Projects\playdate-explorer\app\explorer.pdx\
22:13:55: Loading: D:\Personal\Playdate\Projects\playdate-explorer\app\explorer.pdx
22:13:55: Loading: Failed
Load failed: /
Update error: /
22:13:55: Update failed, simulator paused.

When I load via Device > Upload Game To Device using the exact same path passed on the command line, it works fine. I tried relative and absolute paths and both forward and backward slashes.

Note that this might be windows-specific.

On Mac, when you open a pdx in simulator, you can press cmd+U to upload the currently loaded pdx to device without a selection dialog.

On another note: frequent uploads to device is best avoided for fast development cycles. Only run on hardware when performance-tuning. You can also use the hardware as controller for the simulator to get the right feel for how comfortable the inputs are.

@Nino you are correct, it's Windows-specific. On Windows there is an Alt-U hotkey, but it just opens the same selection dialog as the menu item. I'm not currently running in the simulator as I don't have a compiler suite installed for Windows compilation in VS Code. (Yes, it's something I've been meaning to get to!)

More importantly, the code I'm working on is testing for data and instruction cache size and behaviour, which is specific to the ARM processor and requires running on device.

I agree that my current workflow may not be ideal for typical game development, but I don't see any reason not to remember the last pdx upload folder. This should be a small and simple change in the simulator.

I'll add remembering the path to the Upload Game to device dialog. The cmd line command doesn't upload and run the game, it only runs the game in the Simulator. Try removing the trailing slash on your game path and seeing if that will open the game as expected. Edit: it could also fail if you only have an ARM build, which it seems like may be the case (?).

1 Like

Looking at the code, it is currently using the last opened pdx as the starting path and will upload that if it exists. I'm a bit hesitant to change that behavior.

Thanks @willco! And yes, I do only have an ARM build. A command line way to upload and run it on the device would be excellent, I could easily integrate that into VS Code. (Trailing slash makes no difference.)

The Windows Simulator definitely doesn't start from the folder of the last-opened pdx. Each time I select Device > Upload Game To Device it always starts in:
D:\Personal\Playdate\PlaydateSDK\Disk\System\Launcher.pdx

This happens on multiple uploads in the same simulator session, not just the first time I use the menu option after opening the Simulator.

In contrast, the Device > Run Game On Device menu selection does remember what was previously run. This option persists from one simulator run to the next.

Launcher.pdx is the last run pdx, it's just a system app. :slight_smile: However, for example, if you opened your game in the Sim first, it would be set to your game and when you selected the menu item it would automatically upload your game (without a file picker). But in your case you're going directly to uploading your game to device; it's still set to the launcher, so it shows the file picker. I'll think about how I can improve this...

Upload directly from the command line has been requested before and is in our tracker, I'll see if I can find some time to add it.

Run Game on Device is simply pre-filled with the prior run command which you aren't changing so it works how you want.

Alright, that "makes sense", but isn't how I want it to work. :laughing:

Command line upload would be ideal, though I'm also taking advantage of the Playdate Console, so I would want command line upload to pass console output through to standard output. In the meantime it seems like it ought to be straightforward to remember the last folder opened by the user?

I do intend to get Windows compilation working as well, which would allow me to load my game into the simulator, from where I guess Upload To Device would do what I want.

Anyways, thanks for considering this.