Skip to main content
Topic: Port of Simutrans to the iPhone & iPod Touch (AppStore) (Read 36805 times) previous topic - next topic

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #35
Update to the bug hunt:
I added logging by text file and found out the crash is within...
EDIT:
void karte_t::sync_step(long delta_t, bool sync, bool display )
within the function inside it:
intr_refresh_display( false );

So I'm stepping through intr_refresh_display now... Fun times. :P

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #36
This is the routine that draws everything (we are doing cooperative multitasking). We had some errors with ggc 4.xx which aparently produces some wrong clipping coordinates in the schedule window. Maybe it is related to this.

valgrind is probably not an option on a iPhone ...

By the way, non-rectangular buttons (19x30) are perfectly possible.

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #37
Ah this would make sense!
I traced things further and found:
The segfault is further within "display_win" and more specifically at the line:
komp->zeichnen(wins[win].pos, gr);

The disp_height was clipped to 288 from 320 in win_display_flush.

I'm forced to use GCC 4.x in this case. Any workarounds at the moment?

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #38
In the meantime I will try to fix the clipping issue in GCC 4.x. I might know why...

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #39
I am not sure, but maybe the problem is the dirty tile puffer is written into negative values?

One workaround would be to have some extra buffer around *textur [pseudocode textur=malloc(width*(height+32)*2)+width*16] Since on Windows debugging GCC ist crap, and GCC 4.0 is not yet stable (sigh) I did not yet dug deeper in it. If that helps, then maybe there is another error in the program. (Btw. you use the code from the svn?)

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #40
Ok, I will look into that. Also yes, I use the code from the SVN. :)

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #41
I isolated the bug, and by removed the following code, the crash no longer occurs. Researching a fix now...

In the function: fahrplan_gui_t::fahrplan_gui_t
Commenting out this code within that function gets rid of the segfault crash:
#if 0
   ypos += BUTTON_HEIGHT;
   scrolly.set_pos( koord( 0, ypos ) );
   // scrolly.set_show_scroll_x(false);
   add_komponente(&scrolly);
#endif

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #42
More specifically the crash is here:
Function: void gui_scrollpane_t::zeichnen(koord pos)
Line: if(old_komp_groesse!=komp->get_groesse()) {

Im going to look into the get_groesse() function now...So close to a fix!

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #43
YAY! I fixed the bug! There was a buffer overflow occuring that threw off everything on the iPhone. It's a simple fix:
Inside: void fahrplan_gui_t::gimme_stop_name(cbuffer_t & buf, karte_t *welt, const schedule_t *fpl, int i, int max_chars)
Change: char tmp [256];
To: char tmp [512];

The reason was the max_chars p****ed to the function is 512, the size of 'buf'. But tmp was only 256 chars. Increasing it to the proper 512 fixed this bug!

 

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #44
Change: char tmp [256];
To: char tmp [512];
Thank you!
Parsley, sage, rosemary, and maggikraut.

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #45
No problem. :)
That was a tricky bug to find! Glad it's fixed though, things are going smoothly for this port! I'm seeking out beta testers.

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #46
you really need to update it. we should develop a pak just for it! :D

Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #47
i.Pak? ;-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.



Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #50
The iPhone port also needs:

 - a keyboard interface
 - bigger buttons to close and move windows etc.
 - a better way to scroll around the map

Having it's own pak set would help too :-)


Re: Port of Simutrans to the iPhone & iPod Touch (AppStore)

Reply #51
Hello all

Simutrans can be one of the best app of the appstore !

There are some problem of ergonomy, id don't know what it is possible and what not.

Add some dropdown menus, maybe use multitouch to zoom screen...

But... does this project is active, or have you abandoned it ?

P.S: Sorry for my poo english, and thanks a lot cause i have discovered this "so nice" game with you :)