Splash Png Crashes Game


TrevorBradley

Active Member
Joined
Nov 6, 2007
Messages
732
I'm so close to getting my game finished. I'm having a few last problems.

As described in the gp2x fenix readme, I've placed a 320x240 png file in my data folder to get a Fenix splash screen. The splash screen works great. However when I actually start the game it runs for perhaps half a second and then crashes to desktop.

To make sure it wasn't a png problem I used a png from another game's splash screen... same effect.

Any ideas as to what might be going wrong? I'm getting close to the point where all my bugs are now GP2X and not fenix related... :|
 
Are you sure it isn't a problem with the launching script? Never had a problem with splash screens and the only time fenix has crashed like that is if there was an error in the launch script - eg. an incorrect filename. Remove the png completely and see if it works.
 
ruckage said:
Are you sure it isn't a problem with the launching script? Never had a problem with splash screens and the only time fenix has crashed like that is if there was an error in the launch script - eg. an incorrect filename. Remove the png completely and see if it works.
If I remove the png, it works. If I insert the png in the data directory, it breaks. A png in the root directory (game 32x32 icon)

It's also crashing if I leave it be for about 5 minutes. It's not crashing on Windows.. Makes it tricky to diagnose. I had earlier GP2X crashes that showed obvious memory leaks from Windows Task Manager... once they were fixed crash bugs went away.

*Thinks after a good long break*... I'm suspecting an F200 audio issue... Hmm, I can test that... Nope, that's not it.

I'll try cutting chunks out of my program... I should be able to find what's causing the issue. brb.

BTW, Ruckage (and others), I want to thank you for your help on the forums. I released v0.1 of my game today, posted to announcements and to archive.gp2x.de. Looks like it needs to get approved in both places, but I'm looking forward to joining the development community here.
 
Last edited by a moderator:
One thing to be aware of when compiling for GP2X is to make sure you switch off debug mode, when I first started coding for 2x I had random crashes and that was the cause. It may not be the cause of your crashes but it isn't something that is well documented so you may not know about. If you are using FB2 debug mode can be switched off in the preferences.
 
I've spent at least two hours looking at this, and I now know what's causing the problem. It's so evil, I'm not even sure if it isn't F200 exclusive, or would vary from version of Fenix to Fenix. There was a fair amount of swearing in finding it, and you're not going to believe this either.

Here is my code Snippet. Obviously this program doesn't make sense, but it's the very core of the problem I was having in my 600 line program.

CODE
Program Splash;
Global
int count, counttext;
String s;
Begin
set_fps(60,0);
set_mode(320,240);

count=0;
Repeat
count++;
s=1;
counttext = write (0,10,10,0,count);
frame;
delete_text(counttext);
Until (key(_enter)&&key(_space));

let_me_alone();
exit();
End;


The key line here is "s=1", integer allocation to a String. This is usually a pretty expensive operation. Languages like to do it seamlessly for the user so that they can get away with it, but under many many iterations it can blow up.

If you run this program with a Fenix splash screen (on my F200) the count goes up to about 508 or 509, and then crashes back to menu.

If you run this program with a Fenix WITHOUT a splash screen (on my F200) the count is still going, now up to 25000 and counting.

If you change s from a String to an integer, it works fine with a splash screen (12000 or so and counting).

If you use s=itoa(1) on this script, or s="A", it works. I tried converting my program over to itoa(), but this didn't fix my original problem. Eventually I rewrote the code and swapped everything over to int and everything was OK.

I think it's possible my other crash bugs are gone now too... gonna let my main menu run and churn away at arbitrary length multiplication over and over again and see if it dies... it's gone for 3 minutes now which is a good sign. EDIT: 10 minutes.. It's stable. :) :) :)

I'm guessing this is some strange memory allocation issue with Fenix's native code dealing with = and +. Guess I shouldn't have written a program that made heavy use of mathematics.... :)
 
OK, this is really starting to get me disgruntled and is shying me away from Fenix.

The following code crashes my F200, using either Fenix Beta 6 (v0.84) or Ultimate Fenix (v0.92a) ONLY if I use a png splashscreen. Warning: It takes about 30 seconds to crash and only produces a black screen.

CODE

Program SplashTest;
Private
String s;
Begin
set_mode(320,240);

Repeat
s = "A"+"B";
frame;
Until (key(_enter));

let_me_alone();
exit();
End;



If your remove s="A"+"B"; or change it to s="AB"; it works fine.

If you remove the splash screen png, it runs and runs without crashing.

write(timer[0]) also appears to crash it, but I think this is the same as my s=1 post above.

There's something about string concatenation and using a png splashscreen that's messing Fenix up. Maybe it overrides the memory used for strings and causes Fenix to break.

I'd really appreciate some help on this one.
 
ruckage said:
One thing to be aware of when compiling for GP2X is to make sure you switch off debug mode, when I first started coding for 2x I had random crashes and that was the cause. It may not be the cause of your crashes but it isn't something that is well documented so you may not know about. If you are using FB2 debug mode can be switched off in the preferences.
That sounds like such a beautiful and elegant solution to my problem. I have been compiling everything in debug mode.

Except it's not the problem. I'm still getting the same crashes with or without debug mode. :(
 
Last edited by a moderator:
Trevor Bradley said:
OK, this is really starting to get me disgruntled and is shying me away from Fenix.

The following code crashes my F200, using either Fenix Beta 6 (v0.84) or Ultimate Fenix (v0.92a) ONLY if I use a png splashscreen. Warning: It takes about 30 seconds to crash and only produces a black screen.
If you remove the splash screen png, it runs and runs without crashing.

There's something about string concatenation and using a png splashscreen that's messing Fenix up. Maybe it overrides the memory used for strings and causes Fenix to break.

I'd really appreciate some help on this one.



So you've answered your own question. Don't use the built in splashscreen feature.

I realise this isn't what you want to hear but if you've found a bug like this (and I do believe it's a bug, it crashes on my 2x also) and you know the cause and a way to work around it why waste hours on the problem. You can contact the author of the 2x port to let him know (puck2099) as I'm sure he won't be aware of it and he will most likely fix the problem in a future version of the runtime.

In the meantime if you want a splashscreen just write a small piece of code to do this at the beginning of your program. I tend to do this now anyway as I then have control over what happens in my intros. You can completely disable the splashscreen in the launch script so your code starts immediately (see the fenix readme).

Anyway please don't just give up with fenix, any language you could use will most likely display some odd behaviour.
 
Last edited by a moderator:
Mmm, I'll take a look as soon as possible to splash screen code and try to get your crashes.

By the way, does it happen only with F200 or also F100?

Regards
 
Puck2099 said:
Mmm, I'll take a look as soon as possible to splash screen code and try to get your crashes.

By the way, does it happen only with F200 or also F100?

Regards
Thanks so much. Let me build a "crash package" for you (including prg's) so it will be faster to test. Give me 10 minutes...

I only have an F200, so it would be good to get others here to test as well...
 
Last edited by a moderator:
Trevor Bradley said:
Thanks so much. Let me build a "crash package" for you (including prg's) so it will be faster to test. Give me 10 minutes...

I only have an F200, so it would be good to get others here to test as well...
Please, build me a "crash package" for Fenix and another one for uFenix in order to test both of them :)

Thanks
 
Last edited by a moderator:
Puck2099 said:
Mmm, I'll take a look as soon as possible to splash screen code and try to get your crashes.

By the way, does it happen only with F200 or also F100?

Regards
Hi Puck. Just tested it and it also crashes on the F100. By the way did you get the pm I sent you last week regarding a crash in beta 6 being caused by setting the flags local variable to flags=16?
 
Last edited by a moderator:
OK, here goes:

Crash Tests

CrashTest1.gpe : String concatenation
CrashTest2.gpe: Integer to String conversion
CrashTest3.gpe : Another integer to String conversion: write(timer[0])

Test 1 and 2 have just a black screen (boring), but I was trying to whittle down the problem to the fundamentals. Test 3 has a visible timer counter.

Each takes about 23 seconds to crash after the splash screen is clicked away from. Perhaps relevant, in my testing when I set my fps to 60 my looping programs crashed a bit faster twice as fast. (It's iteration dependent, not time dependent).

I've included prg, dcb, gpe and png files for each, along with ufxi. It's ready to crash right out of the box. :)

Delete the png files and the tests run "forever" (at least 4 minutes).

These are all running on fenix 0.92a/ufenix, but I've tried the tests on fenix beta 6 (using fxc 0.84 on Windows) and got similar results.

I'd love it if someone with an F100, or even another F200 could test this to verify I'm not going crazy... :)
 
Trevor Bradley said:
Perhaps relevant, in my testing when I set my fps to 60 my looping programs crashed a bit faster twice as fast. (It's iteration dependent, not time dependent).
Oh.... OOOOOOOO...

I'm not going to change my rar file... but I did make a CrashTest4 on this end

Try this:

counter=0;
Loop
write(0,10,10,0,++counter);
End;

EXACTLY 509 loops before each crash. Every time I run it.

Now that's way too close to 512 and sends my spidey senses tingling. This screams out gp2x specific memory leak to me.... This is probably an avenue worth persuing.

Let me run this without the splash screen. I bet it crashes around 20000 or something... If so it's definitely a leak, aggrivated by the splash screen.

I'll get back to you...
 
Last edited by a moderator:
Trevor Bradley said:
Trevor Bradley said:
Perhaps relevant, in my testing when I set my fps to 60 my looping programs crashed a bit faster twice as fast. (It's iteration dependent, not time dependent).
Oh.... OOOOOOOO...

I'm not going to change my rar file... but I did make a CrashTest4 on this end

Try this:

counter=0;
Loop
write(0,10,10,0,++counter);
End;

EXACTLY 509 loops before each crash. Every time I run it.

Now that's way too close to 512 and sends my spidey senses tingling. This screams out gp2x specific memory leak to me.... This is probably an avenue worth persuing.

Let me run this without the splash screen. I bet it crashes around 20000 or something... If so it's definitely a leak, aggrivated by the splash screen.

I'll get back to you...


OK, I'll go back home from university in 2-3 hours, I'll take a look at your results without splash then :)

Regards
 
Last edited by a moderator:
Puck2099 said:
Trevor Bradley said:
Thanks so much. Let me build a "crash package" for you (including prg's) so it will be faster to test. Give me 10 minutes...

I only have an F200, so it would be good to get others here to test as well...
Please, build me a "crash package" for Fenix and another one for uFenix in order to test both of them :)

Thanks


Done. Includes CrashTest4, which is an iteration rather than a timer counter.

Crash Tests 2

And of course, now that I've packaged it all together, I am not seeing these crashes on Fenix Beta 6....wait... No, CrashTest1 crashes, as does 2, but not 3 and 4. 3 and 4 write integers. So maybe something is different with the write method in Ufenix?

Puck2099 said:
OK, I'll go back home from university in 2-3 hours, I'll take a look at your results without splash then :)

Regards
It's 3:30AM here on the west coast of Canada, and I really need to get some sleep!

Thank you both so much for looking into this!!!


ruckage said:
So you've answered your own question. Don't use the built in splashscreen feature.

I realise this isn't what you want to hear but if you've found a bug like this (and I do believe it's a bug, it crashes on my 2x also) and you know the cause and a way to work around it why waste hours on the problem. You can contact the author of the 2x port to let him know (puck2099) as I'm sure he won't be aware of it and he will most likely fix the problem in a future version of the runtime.

In the meantime if you want a splashscreen just write a small piece of code to do this at the beginning of your program. I tend to do this now anyway as I then have control over what happens in my intros. You can completely disable the splashscreen in the launch script so your code starts immediately (see the fenix readme).

Anyway please don't just give up with fenix, any language you could use will most likely display some odd behaviour.
It's not just the splashscreen.. I'm getting rare crashes in my program without it. I'm suspecting that certain operations that puck's fenix does are leaky, and that would affect the program with or without the splash screen. I have a way of testing this too.... (12,000 and counting....)

I think what I'm looking for is a rock solid programming platform to work from which will push my enthusiasm even higher for coding. I need to know where I stand with the language so I know how far I can push it before I dream up a project. (I'm pretty sure I'm pushing gp2x fenix in ways it's never been pushed before, and to me that's kinda cool)

My greatest fear is that my enthusiastic bug reporting is going to drive established guys like you nuts. Thanks for your support and patience!

ruckage said:
So you've answered your own question. Don't use the built in splashscreen feature.

I realise this isn't what you want to hear but if you've found a bug like this (and I do believe it's a bug, it crashes on my 2x also) and you know the cause and a way to work around it why waste hours on the problem. You can contact the author of the 2x port to let him know (puck2099) as I'm sure he won't be aware of it and he will most likely fix the problem in a future version of the runtime.

In the meantime if you want a splashscreen just write a small piece of code to do this at the beginning of your program. I tend to do this now anyway as I then have control over what happens in my intros. You can completely disable the splashscreen in the launch script so your code starts immediately (see the fenix readme).

Anyway please don't just give up with fenix, any language you could use will most likely display some odd behaviour.
It's not just the splashscreen.. I'm getting rare crashes in my program without it. I'm suspecting that certain operations that puck's fenix does are leaky, and that would affect the program with or without the splash screen. I have a way of testing this too.... (12,000 and counting....)

I think what I'm looking for is a rock solid programming platform to work from which will push my enthusiasm even higher for coding. I need to know where I stand with the language so I know how far I can push it before I dream up a project. (I'm pretty sure I'm pushing gp2x fenix in ways it's never been pushed before, and to me that's kinda cool)

My greatest fear is that my enthusiastic bug reporting is going to drive established guys like you nuts. Thanks for your support and patience!
 
Last edited by a moderator:
ruckage said:
So you've answered your own question. Don't use the built in splashscreen feature.

I realise this isn't what you want to hear but if you've found a bug like this (and I do believe it's a bug, it crashes on my 2x also) and you know the cause and a way to work around it why waste hours on the problem. You can contact the author of the 2x port to let him know (puck2099) as I'm sure he won't be aware of it and he will most likely fix the problem in a future version of the runtime.

In the meantime if you want a splashscreen just write a small piece of code to do this at the beginning of your program. I tend to do this now anyway as I then have control over what happens in my intros. You can completely disable the splashscreen in the launch script so your code starts immediately (see the fenix readme).

Anyway please don't just give up with fenix, any language you could use will most likely display some odd behaviour.
It's not just the splashscreen.. I'm getting rare crashes in my program without it. I'm suspecting that certain operations that puck's fenix does are leaky, and that would affect the program with or without the splash screen. I have a way of testing this too.... (12,000 and counting....)

I think what I'm looking for is a rock solid programming platform to work from which will push my enthusiasm even higher for coding. I need to know where I stand with the language so I know how far I can push it before I dream up a project. (I'm pretty sure I'm pushing gp2x fenix in ways it's never been pushed before, and to me that's kinda cool)

My greatest fear is that my enthusiastic bug reporting is going to drive established guys like you nuts. Thanks for your support and patience!
 
Last edited by a moderator:
Trevor Bradley said:
counter=0;
Loop
write(0,10,10,0,++counter);
End;
Besides that there is no frame; statement (which would cause a freeze) this code will crash because there will be too many texts simultaneously on screen (511 is max). This happens in any Fenix port afaik. The error message is "Demasiados textos en pantalla", which translates to "Too many texts on the screen".

Talking about texts, I noticed in your other posts that you use write() and delete_text() to keep an int updated. Why not use write_int() for this?
 
Last edited by a moderator:
Puck2099 said:
OK, I'll go back home from university in 2-3 hours, I'll take a look at your results without splash then :)

One more bit of info. CrashTest4 without the splash screen runs for at least 44,500 iterations on ufenix. Considering the graphic is 36,864 bytes, I'm doubtful that this is a more general memory leak issue, and that it is a splash screen specific issue. (Ruckage is right, I should just nuke the splash screen in the interim...)

A tiny thought. Is that splash screen loaded in ufenix? Can it be unloaded somehow?

I think my next attempt won't involve so much integer/string manipulation. Go shiny!

Thanks so much for looking into this, both of you. I really appreciate it.

(and now I really must sleep!)



Sandman said:
Trevor Bradley said:
counter=0;
Loop
write(0,10,10,0,++counter);
End;
Besides that there is no frame; statement (which would cause a freeze) this code will crash because there will be too many texts simultaneously on screen (511 is max). This happens in any Fenix port afaik. The error message is "Demasiados textos en pantalla", which translates to "Too many texts on the screen".

Talking about texts, I noticed in your other posts that you use write() and delete_text() to keep an int updated. Why not use write_int() for this?


Sorry, I was eagerly writing pseudocode. Download the CrashTests in the other posts in this thread and look for CrashTest4, which is the code above.

If you have a look at my game, I'm not dealing with ints. I'm dealing with arbitrary length integers, stored as integer arrays and later concatenated into strings, multiplied over and over again. I'm trying to do a *LOT* of math operations like:

15970327580237501827502375034525*19

I suspect if fenix had proper longs I wouldn't be having this problem. :)

Originally I was storing 40 digit integers as String[40] arrays with a single base 10 digit in each value and then doing mathematics with each column, which caused horrible crash problems. I then went to an int[40] array of single base 10 digits, and then later again to and int[5] array of integer base(10^8) "digits", which is much easier on the processor and requires less steps. But at the end you still need to sew all these integers together to make a big string, and that's the kind of operations that are causing Fenix to crash on the gp2x.

And if you want to ask, as is natural, FOR THE LOVE OF ZEUS, WHY?!?, the answer is that I'm a geek, and I have my degree in mathematics, and this is my idea of *fun*. And I think the final game is fun, but too many people will be scared to try it. ;)

I think my next game will be far more shiny and involve less math. :)

EDIT... OK, at some point the forum decides to add to your last post rather than posting a threaded reply... apologies for that...
 
Last edited by a moderator:
QUOTE
And if you want to ask, as is natural, FOR THE LOVE OF ZEUS, WHY?!?, the answer is that I'm a geek, and I have my degree in mathematics, and this is my idea of *fun*. And I think the final game is fun, but too many people will be scared to try it. wink.gif

Nothing wrong with that, we all do this for our reasons. I'm always happy to help out where I can but don't be surprised if I often have the opinion 'FOR THE LOVE OF ZEUS, WHY?!?' as I think we are at opposite ends of the spectrum as far as coding is concerned. I tend to think if it works that's fine, even if the code is an horrendous mess - the finished result is what's important to me.

Handy to know there are plenty of mathematicians around as I know who to talk to if I get stuck.

(What happened to your last post :blink: )
 
Back
Top