Windows Playdate Simulator Crash logs

Hi folks, I had searched already for this but didnt find an answer. Where can I find crash logs for the simulator straight up crashing on Windows? I have an inkling as to what's causing it, as I did get an error in the console in a previous version of the sdk. But in more recent versions (2.3+) it just hard crashes on me.

I looked in Event Viewer already, but nothing in there sadly. The text file under %LOCALAPPDATA%\Playdate Simulator doesnt have much.

The crashes are handled by a helper application. If you're hitting a hard crash on launch, hold shift on launch will reset the Simulator. Second, if your game is causing a crash, I recommend running your game in a debugger to catch the crash before it crashes the Simulator.

Was able to add a debugger via: GitHub - midouest/vscode-playdate-debug: Unofficial Playdate debug extension for Visual Studio Code on macOS, Windows and Ubuntu. I added a break point in my level loading code (3rd level is what leads to the crash). No errors in the loading code, but once it finishes and hits the next gfx.sprite.update(), I get the error i saw previously: main.lua:109: Sprite doesn't have a lua proxy!

If possible, could you post a sample program that shows this error? This shouldn't be causing a crash, so we'd like to get that fixed up.

The Depths.pdx.zip (830.4 KB)

If I knew the specific cause i could probably figure out a better example. To trigger it in my game, press A to go through the intro screen. You need to go down two levels. Use the dpad to move towards the stairs south east of the player. Then again right south of the player. It'll crash once you do that.

Thanks! I was able to reproduce the crash, hopefully we can sort it out soon!

Believe I found what was causing it. Switching the level_goDown/level_goUp methods in level.lua to set the next level in a variable rather than calling goto_level right away. I then added a new methods that calls goto_level() with the next level value outside of the sprite.update() stack. Here's a git diff to show:

--- a/source/level.lua
+++ b/source/level.lua
@@ -9,6 +9,7 @@ local entityReference = {}
 local pathingCache = {}
 local currentLevelNumber = nil
 local levelSprites = {}
+local levelChange = nil

 local function loadNewLevelEntities(levelN, levelName, pathingData, enemyEntities, stairsUpSprites)
   levelSprites[levelN] = {}
@@ -301,12 +302,19 @@ end

 function level_goDown()
   assert(currentLevelNumber ~= nil)
-  goto_level(currentLevelNumber + 1, false)
+  levelChange = currentLevelNumber + 1
 end

 function level_goUp()
   assert(currentLevelNumber ~= nil and currentLevelNumber > 0)
-  goto_level(currentLevelNumber - 1, false)
+  levelChange = currentLevelNumber - 1
+end
+
+function level_changeIfQueued()
+  if levelChange ~= nil then
+    goto_level(levelChange, false)
+    levelChange = nil
+  end
 end

 function level_removeEntity(entity)
diff --git a/source/main.lua b/source/main.lua
index ef59bc3..d8ab5ab 100644
--- a/source/main.lua
+++ b/source/main.lua
@@ -106,6 +106,7 @@ end
 setup()

 function playdate.update()
+  level_changeIfQueued()
   gfx.sprite.update()

   local aHeld = false