Not refreshing / drawing Canvas Screen when no animations on screen

This is a hard question and I can’t really post any code here since it’s very long javascript I’ll just add a link to it.

I pretty much have a bug on my website which a similar website doesn’t seem to have and I can’t figure out the cause of it.

My website is camspark.com/gameboy

It seems to have no canvas drawing issues when stuff is animated or blinking in the gameboy game. But when it gets to some screen where no screen refreshes are done such as in the second game on the website which says Playing Pokemon Silver: Nuzlocke Edition, since in that nothing else will change, the screen (canvas) stays white, until you press A or B button on the Gamepad.

It’s not a client-side web-browser issue, but rather a issue with the command gameboy.returnFromState() in the functions.min.js file which I believe receives malformed Saved State from server-side, Yeah I know I may be sending malformed saved states from server because the server is a custom port of this Gameboy emulator from javascript to nashorn, minor edits but I completely removed Canvas on the server side so nothing is getting rendered anywhere, I don’t think anything I removed was connected to gameboy.saveState() which is what server sends to webbrowser and is used in gameboy.returnFromState() to load the same exact game.

There is a website similar to this www.letsplaygameboy.com which uses the same exact client-side code with some code removed.

Yet they never have this problem, I don’t really know whats wrong with the saved state file it has many variables over 200 and very big arrays,

I already found a way to fix it client-sided when the saved state is finished loading I would run this command gameboy.graphicsJIT(); or gameboy.midScanLineJIT(); which forces the screen to draw.

But I feel like this is a poor way to fix this, As I don’t have to edit anything client-side since it’s obviously something wrong with the saved state file sent from server.

Sorry I can’t post any code the code is fairly large. (The code can be found at http://camspark.com/gameboy/js/GameBoyCore.js which is the same client-side which the website without this bug uses. Maybe someone by looking at this file can figure out whats coming in wrong in the GameBoyCore.prototype.returnFromState function.

You could see what variables the server sends by doing the command gameboy.saveState() in Console if you don’t make the screen refresh it should be similar data minus the ever changing audio memory that was sent by the server.

What I’m asking for is for someone to go to the website www.camspark.com/gameboy click the second game then open up Chrome’s Console Mode (Shift+Ctrl+J) and mess around with gameboy variables maybe do some gameboy.memory[XXX] = YYY; and let me know which variable is messing it up. Yeah it feels like this is too much to ask for but I just can’t find it I tried for 6 days now, I’ll keep trying just thought maybe you guys can find it quicker.

I thought it was variables gameboy.bgEnabled or gameboy.BGPriorityEnabled

gameboy.bgEnabled if set to false by Console keeps the audio running but the screen never refreshes exactly whats happening, but it’s always true so it’s not the issue.

I got it down to which ever commands have to use either gameboy.graphicsJIT(); or gameboy.midScanLineJIT(); may hold where the bug happens. You could also go to the first game go into a screen which has constant animations and see the bug never happens there, no idea what variable is used to determine where animations happen? or don’t happen?

Yeah I didn’t make this emulator I have no idea how it works or where to find the problem it’s over 9000 lines long.