diff options
Diffstat (limited to 'uisimulator/sdl/uisdl.c')
-rw-r--r-- | uisimulator/sdl/uisdl.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c index e0a449ed48..09210926b5 100644 --- a/uisimulator/sdl/uisdl.c +++ b/uisimulator/sdl/uisdl.c | |||
@@ -40,19 +40,13 @@ | |||
40 | #include "SDL_thread.h" | 40 | #include "SDL_thread.h" |
41 | 41 | ||
42 | /* extern functions */ | 42 | /* extern functions */ |
43 | extern void app_main (void *); /* mod entry point */ | 43 | extern void new_key(int key); |
44 | extern void new_key(int key); | ||
45 | extern void sim_tick_tasks(void); | ||
46 | extern bool sim_io_init(void); | ||
47 | extern void sim_io_shutdown(void); | ||
48 | 44 | ||
49 | void button_event(int key, bool pressed); | 45 | void button_event(int key, bool pressed); |
50 | 46 | ||
51 | SDL_Surface *gui_surface; | 47 | SDL_Surface *gui_surface; |
52 | bool background = false; /* Don't use backgrounds by default */ | 48 | bool background = false; /* Don't use backgrounds by default */ |
53 | 49 | ||
54 | SDL_TimerID tick_timer_id; | ||
55 | |||
56 | bool lcd_display_redraw = true; /* Used for player simulator */ | 50 | bool lcd_display_redraw = true; /* Used for player simulator */ |
57 | char having_new_lcd = true; /* Used for player simulator */ | 51 | char having_new_lcd = true; /* Used for player simulator */ |
58 | bool sim_alarm_wakeup = false; | 52 | bool sim_alarm_wakeup = false; |
@@ -63,31 +57,6 @@ bool debug_audio = false; | |||
63 | bool debug_wps = false; | 57 | bool debug_wps = false; |
64 | int wps_verbose_level = 3; | 58 | int wps_verbose_level = 3; |
65 | 59 | ||
66 | long start_tick; | ||
67 | |||
68 | Uint32 tick_timer(Uint32 interval, void *param) | ||
69 | { | ||
70 | long new_tick; | ||
71 | |||
72 | (void) interval; | ||
73 | (void) param; | ||
74 | |||
75 | new_tick = (SDL_GetTicks() - start_tick) / (1000/HZ); | ||
76 | |||
77 | if (new_tick != current_tick) { | ||
78 | long i; | ||
79 | for (i = new_tick - current_tick; i > 0; i--) | ||
80 | { | ||
81 | sim_enter_irq_handler(); | ||
82 | sim_tick_tasks(); | ||
83 | sim_exit_irq_handler(); | ||
84 | } | ||
85 | current_tick = new_tick; | ||
86 | } | ||
87 | |||
88 | return 1; | ||
89 | } | ||
90 | |||
91 | void gui_message_loop(void) | 60 | void gui_message_loop(void) |
92 | { | 61 | { |
93 | SDL_Event event; | 62 | SDL_Event event; |
@@ -181,8 +150,6 @@ bool gui_startup(void) | |||
181 | SDL_UpdateRect(gui_surface, 0, 0, 0, 0); | 150 | SDL_UpdateRect(gui_surface, 0, 0, 0, 0); |
182 | } | 151 | } |
183 | 152 | ||
184 | start_tick = SDL_GetTicks(); | ||
185 | |||
186 | return true; | 153 | return true; |
187 | } | 154 | } |
188 | 155 | ||
@@ -191,7 +158,6 @@ bool gui_shutdown(void) | |||
191 | /* Order here is relevent to prevent deadlocks and use of destroyed | 158 | /* Order here is relevent to prevent deadlocks and use of destroyed |
192 | sync primitives by kernel threads */ | 159 | sync primitives by kernel threads */ |
193 | thread_sdl_shutdown(); | 160 | thread_sdl_shutdown(); |
194 | SDL_RemoveTimer(tick_timer_id); | ||
195 | sim_kernel_shutdown(); | 161 | sim_kernel_shutdown(); |
196 | return true; | 162 | return true; |
197 | } | 163 | } |
@@ -287,8 +253,6 @@ int main(int argc, char *argv[]) | |||
287 | return -1; | 253 | return -1; |
288 | } | 254 | } |
289 | 255 | ||
290 | tick_timer_id = SDL_AddTimer(10, tick_timer, NULL); | ||
291 | |||
292 | gui_message_loop(); | 256 | gui_message_loop(); |
293 | 257 | ||
294 | return gui_shutdown(); | 258 | return gui_shutdown(); |