Good pull request idea maybe

Moderator: Mask of Destiny
Grind wrote: Tue Mar 20, 2018 6:53 pm I've gotten burned by this one so many times. I think adding bounds checking for debug only would be very helpful to catch this stuff.
Good pull request idea maybe![]()
SGDK could have its own crash screen when asserts fail in debug mode, maybe? With some kind of (human readable) stack trace.Stef wrote: Tue Mar 20, 2018 5:19 pm For sure it could lead to incorrect frame pointer if you use setAnim (or setFrameAndAnim / setFrame) with incorrect index :p i'm not doing any bounds verification (for performance reason obviously).
In fact the crash screen you got is already generated by SGDK, and even if i can arrange it a bit to make it more pleasant to read, it will still generate hexa code. In debug mode i could eventually try to get method name or something like that but honestly i think it would be quite difficult (i've no idea about how get them from embedded debug data) :-/mix256 wrote: Wed Mar 21, 2018 7:31 am SGDK could have its own crash screen when asserts fail in debug mode, maybe? With some kind of (human readable) stack trace.![]()
Sprite maskingI have, though, found a strange sprite issue that you Stef probably knows something about.
The "main lander" sprite is 168px wide. It is not visible when having some specific coordinates.
Namely -128 and -160. The -128 one only happens when there are more sprites on the same row, it seems. But the -160 one happens even when the sprites is a bit down on the screen. (the screenshots show 5F instead of 60 and 7F because of 80...Fusions screenshot-taker advanced a frame...but not fully...was really strange.)
...
Any ideas about this? I would understand it if there was a glitch when the whole sprite is on screen, but it's just at these X-coordinates it glitches.
Code: Select all
SPR_setVisibility(sprite, AUTO_SLOW);
Code: Select all
SPR_setVisibility(sprite, AUTO_FAST);
Ah, I didn't know that but the crash screen is great as it is, I think. Did you see my comment about it not being fully on screen a lot of times? Like the x-scroll value wasn't reset, or something. Is that something you are in control of, even after a crash?
OMG.
Yeah i saw it but i'm surprised as i'm doing a VDP_init() call to be sure to reset everything with display, so i don't understand how the scroll value can be incorrect (normally VRAM should be reset as well). I need to investigate that...mix256 wrote: Wed Mar 21, 2018 10:53 am Ah, I didn't know that but the crash screen is great as it is, I think. Did you see my comment about it not being fully on screen a lot of times? Like the x-scroll value wasn't reset, or something. Is that something you are in control of, even after a crash?
Oh i see, well adding some kind of assert / debug method as enterMethod(methodName) / exitMethod() so exeption handler use them if available..I was thinking there could be a different kind of crash screen for debug-assertions, that would require the programmer to jack itself into if proper stack traces would be needed. Could be as easy as adding the function name and some parameters to a list at the start of a function and removing it at the end and all failed asserts in the function could just show the crash. Just thinking out loud here.![]()
You're welcome :pStef wrote: Wed Mar 21, 2018 8:52 am OMG.![]()
I could have swore I'd read about x-coord 0 somewhere, when I first saw the glitching behavior, but couldn't find it. But I see now that's in the vdp documentation. Thanks!
I'll just add AUTO_SLOW to the lander ship sprite and take the rest as they show problems, or not. Again, huge thanks!
Yeah, but one could start doing that just when doing the trouble shooting. Using two simple-to-use macros.Stef wrote: Wed Mar 21, 2018 11:28 am Still it would be annoying for the developer to do that for each method :-/
You already have a logo? Where is it?Stef wrote: Wed Mar 21, 2018 1:20 pm ...i think i prefer my original SGDK logo, need to change the text though :p
Not yet put on the repository, in fact this is the one you can find from the profil picture here :
normally VDP_init() reset everything (registers and VRAM)... that's weird.Grind wrote: Wed Mar 21, 2018 3:25 pm Are you using tile/line hoz scroll instead of plane scroll? Perhaps VDP_init() doesn't set the mode back to plane but didn't check myself.
I will probably add boundaries check here and add warning messages in the KMod output log (as i'm already doing for some severe errors). It's a good practice to stay with "make debug" when developing / debugging game and just pass to release for testing performance and on final release of courseTo expand on the debug assertion idea, GCC provides the macros __FILE__, __LINE__, and __FUNCTION__, which could be fed to an error handler if an assertion fails. Though that would need macro versions of most library calls to get the right info, and all those strings could take up quite a bit of space.
For something specific like sprite frame bounds it would probably be enough to verify the argument of setFrame and setAnim are less than the actual frame/animation count of the sprite. If it is too large or negative, crash with the index that tried to be accessed with a message like "sprite frame x out of bounds". Though, I wonder how many people would actually think to switch to 'make debug' after getting an address error.
Apart from the lens flare, it should look ok.Stef wrote: Wed Mar 21, 2018 3:53 pm but the color conversion make it not really nice on MD, i guess that needs some work...
It'd still be helpful for people who know to do it. And we could always just say "use make debug" here as a reply :vGrind wrote: Wed Mar 21, 2018 3:25 pm Though, I wonder how many people would actually think to switch to 'make debug' after getting an address error.
A failed assert is an intentional (and controlled) crash.Miquel wrote: Wed Mar 21, 2018 7:15 pm I'm completely against checking everything philosophy, on the contrary I think you should embrace the crash as soon as possible idea.
Wow looks nice!