CLion/CMake on Linux (Ubuntu) - Couldn't find pdz file main.pdz

Hi there, I think I've got the SDK setup properly with CLion using CMakeLists, but I'm getting this error when launching PlayDate Simulator:
Couldn't find pdz file main.pdz

The only files in the .pdx are pdex.bin and pdxinfo. Let me know if you need any more information. Thank you!

pdz files are compiled Lua files. This error message is displayed when the Lua engine does not find the main Lua file. You may not be setting properly the update callback inside the eventHandler method to disable the Lua engine.

You should have something like:

#include "pd_api.h"

PlaydateAPI * _Nullable playdate;
static const int kFrameRate = 30;

static int update(void * _Nullable userdata);

#ifdef _WINDLL
__declspec(dllexport)
#endif
int eventHandler(PlaydateAPI * _Nonnull api, PDSystemEvent event, uint32_t arg) {
    switch (event) {
        case kEventInit:
            playdate = api;
            api->display->setRefreshRate(kFrameRate);
            playdate->system->setUpdateCallback(update, NULL /* userdata */);
            break;
        case kEventTerminate:
        case kEventLowPower:
            // TODO: Save state.
            break;
        default:
            break;
    }
    return 0;
}

static int update(void * _Nullable userdata) {
    // TODO: Put your game code here.
    return 1;
}
1 Like

Thank you for the advice! I do have that, and it appears to be setup properly. I'm using the code from the "Hello World" example just to make sure I'm doing it how they intend.

After a bit of research, it appears the .pdx file should contain a pdex.so file for the simulator. Is that correct? It is not creating a .so file for me with CMakeLists.

How do you build the project ? When using CMake you have to call it when you want to switch between arm builds for the Playdate and x86_64 builds for the simulator.

Otherwise you still have the possibility to use Make instead:

~$ cd Developer/PlaydateSDK/C_API/Examples/Life
Life$ make
detected_OS is "Darwin"
mkdir -p build
mkdir -p build/dep
mkdir -p `dirname build/main.o`
# A whole lot of lines

Life $ ls GameOfLife.pdx/ 
pdex.bin   pdex.dylib pdxinfo

(On my system, dynamic libraries extension is dylib and not so).

2 Likes

Wow, thank you so much! It wasn't clear from the tutorial(to me at least) that the simulator build should not be using arm.

That solved it, I added another build profile without any CMake Options specified. =)

2 Likes