Welcome! Log In Create A New Profile

Advanced

More stupid exceptions!

Posted by SteelSLasher 
More stupid exceptions!
July 12, 2009 06:36PM
After continuing with my project I now get a consistent error no matter what I do, even if i remove the changes I still seem to get an error. The list addresses in the esception point me to line 383 of gui_window.cpp which is

try	{ _elements.at(i)->Update(t); }
catch (const std::exception& e) { }
which could be the problem, the exception is probably being given out instead being caught

But I am guessing the problem would also be in my latest addition to the project, i have now gotten to show a homepage but the app keeps giving an exception

static int home()
{
Debug(" begin home");
struct block HTML = downloadfile("http://google.com/");
Debug("end downfile");

char *text;
sprintf(text,"%s", HTML.data);

GuiText html("text", 16, (GXColor){0, 0, 0, 255});
html.SetAlignment(0,3);
html.SetPosition(0,0);
html.SetMaxWidth(screenwidth);
GuiTrigger trigDown;
trigDown.SetHeldTrigger(-1, WPAD_BUTTON_HOME, PAD_BUTTON_DOWN);
html.SetTrigger(&trigDown);

HaltGui();
mainWindow->Append(&html);
ResumeGui();

bool close = FALSE;
while(close)
	{
int ypos = html.GetTop();
int xpos = html.GetLeft();
		usleep(THREAD_SLEEP);
		if(trigDown.Down())
		{
		html.SetPosition(xpos, ypos+1);
		}
		else
		if(trigDown.Up())
		{
		html.SetPosition(xpos, ypos-1);
		}
		else
		if(html.GetState() == STATE_CLICKED)
		close = 1;
	}
	
ExitRequested = 1;
HaltGui();
mainWindow->Remove(&html);
ResumeGui();
return HOME;
}
I have yet to figure out if i have used Down() correctly or if the trigger related coding is at all correct but it seems that the exception is thrown because a http request is made during the thread is running since networking is thread friendly yet.
Re: More stupid exceptions!
July 13, 2009 05:54AM
Well for one, your returning a struct block, when your function should be returning an int. Second, the while(close) loop will never run, you should use while(!close) instead. Also, you should not set ExitRequested to 1 until you are done Remove()ing. If you are using the template, you need to instead return MENU_EXIT. If you need help understanding libwiigui, check out the libwiigui tutorial (still WIP, but it is coming along).
Re: More stupid exceptions!
July 13, 2009 10:16PM
yeah thanks for pointing out those problems but the real problem was calling downloadfile() since it just does not work for some reason
Re: More stupid exceptions!
July 13, 2009 11:34PM
It looks to me that you need to use downloadfile("http://www.google.com/index.php") if downloadfile parses the url like I think it does, otherwise, how would it know what file to download? Also, not to disappoint you, but there is already another wii browser in the works, WiiBrowse, which is already rendering some html.



Edited 2 time(s). Last edit at 07/13/2009 11:36PM by jsmaster.
Re: More stupid exceptions!
July 14, 2009 11:25AM
yeah i had a look at wiibrowse but if i can finish all the frontend stuff and if they do the parsing isnt that one browser?

Also, they are only working on a parser by looking at the SVN, i should talk with them to see if we should team up or go our own ways



Edited 1 time(s). Last edit at 07/14/2009 12:01PM by SteelSLasher.
Re: More stupid exceptions!
July 14, 2009 02:32PM
Fixed the exception, it was a sscanf related error, btw i got it to download [www.google.com] but thats it for now
Re: More stupid exceptions!
July 14, 2009 05:34PM
Quote
SteelSLasher
yeah i had a look at wiibrowse but if i can finish all the frontend stuff and if they do the parsing isnt that one browser?

Also, they are only working on a parser by looking at the SVN, i should talk with them to see if we should team up or go our own ways

When you say them, you mean me and scanff ;-) It doesn't just parse, it renders also (though it is still test quality). Right now it can render some html.
Re: More stupid exceptions!
July 14, 2009 08:01PM
i noticed you using SDL, personally i would prefer libwiigui since many gui elements of html can be reproduced in that library, i knew sscanf was doing it didnt know you were helping as well

btw, i believe i have found the html parser (just the parser) from firefox but even if it is just the parser a lot customising is still needed
Re: More stupid exceptions!
July 14, 2009 08:39PM
We already decided not to try to port any existing parser, because most depend on a ton of other libraries that are not ported to the wii, and starting from scratch would be less complicated. I wanted to use libwiigui also, but scanff wanted to use SDL since he is already familiar with it, and it can be compiled for windows and linux (which does make it much easier to test).
Re: More stupid exceptions!
July 14, 2009 08:41PM
true about the testing, we'll see how it goes, good luck on your project
Sorry, only registered users may post in this forum.

Click here to login