1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (c) 2006 Anton Romanov
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
27 bool exit_requested
=false;
29 extern bool zxbox_menu(void);
31 /* DUMMIES ... to clean */
34 int small_screen
,pause_on_iconify
;
38 #include "zxvid_com.h"
42 struct zxbox_settings settings
;
44 /* doesn't fit into .ibss */
45 unsigned char image_array
[ HEIGHT
* WIDTH
];
47 static int previous_state
;
51 static unsigned char *gbuf
;
52 static size_t gbuf_size
= 0;
55 long video_frames IBSS_ATTR
= 0 ;
56 long start_time IBSS_ATTR
= 0;
58 enum plugin_status
plugin_start(const void* parameter
)
61 rb
->lcd_set_backdrop(NULL
);
63 rb
->splash(HZ
, "Welcome to ZXBox");
69 /* get the remainder of the plugin buffer */
70 gbuf
= (unsigned char *) rb
->plugin_get_buffer(&gbuf_size
);
71 #ifdef USE_BUFFERED_GREY
72 grey_init(gbuf
, gbuf_size
, GREY_BUFFERED
|GREY_ON_COP
, LCD_WIDTH
,
75 grey_init(gbuf
, gbuf_size
, GREY_ON_COP
, LCD_WIDTH
, LCD_HEIGHT
, NULL
);
76 #endif /* USE_BUFFERED_GREY */
77 /* switch on greyscale overlay */
82 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
86 start_time
= *rb
->current_tick
;
92 start_spectemu(parameter
);
98 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
107 #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
114 void init_spect_key(void)
120 void spkb_process_events( int evenframe
)
125 #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
126 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
127 if (rb
->button_hold())
129 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
130 rb
->cpu_boost(false);
139 int buttons
= rb
->button_status();
140 if ( buttons
== previous_state
)
142 previous_state
= buttons
;
143 #if (CONFIG_KEYPAD != IPOD_4G_PAD) && (CONFIG_KEYPAD != IPOD_3G_PAD) && \
144 (CONFIG_KEYPAD != IPOD_1G2G_PAD)
145 if (buttons
& ZX_MENU
)
147 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
148 rb
->cpu_boost(false);
157 spkb_state_changed
= 1;
158 if (settings
.kempston
){
159 if ( buttons
& ZX_RIGHT
){
160 ki
= KS_TO_KEY(SK_KP_Right
);
161 spkb_kbstate
[ki
].state
= 1;
163 else if (buttons
& ZX_LEFT
){
164 ki
= KS_TO_KEY(SK_KP_Left
);
165 spkb_kbstate
[ki
].state
= 1;
169 ki
= KS_TO_KEY(SK_KP_Right
);
170 spkb_kbstate
[ki
].state
= 0;
171 ki
= KS_TO_KEY(SK_KP_Left
);
172 spkb_kbstate
[ki
].state
= 0;
175 if ( buttons
& ZX_UP
){
176 ki
= KS_TO_KEY(SK_KP_Up
);
177 spkb_kbstate
[ki
].state
= 1;
179 else if (buttons
& ZX_DOWN
){
180 ki
= KS_TO_KEY(SK_KP_Down
);
181 spkb_kbstate
[ki
].state
= 1;
184 ki
= KS_TO_KEY(SK_KP_Up
);
185 spkb_kbstate
[ki
].state
= 0;
186 ki
= KS_TO_KEY(SK_KP_Down
);
187 spkb_kbstate
[ki
].state
= 0;
190 if ( buttons
& ZX_SELECT
){
191 ki
= KS_TO_KEY(SK_KP_Insert
);
192 spkb_kbstate
[ki
].state
= 1;
195 ki
= KS_TO_KEY(SK_KP_Insert
);
196 spkb_kbstate
[ki
].state
= 0;
202 if ( buttons
& ZX_RIGHT
){
203 ki
= KS_TO_KEY(intkeys
[3]);
204 spkb_kbstate
[ki
].state
= 1;
207 ki
= KS_TO_KEY(intkeys
[3]);
208 spkb_kbstate
[ki
].state
= 0;
211 if ( buttons
& ZX_LEFT
){
212 ki
= KS_TO_KEY(intkeys
[2]);
213 spkb_kbstate
[ki
].state
= 1;
216 ki
= KS_TO_KEY(intkeys
[2]);
217 spkb_kbstate
[ki
].state
= 0;
220 if ( buttons
& ZX_UP
){
221 ki
= KS_TO_KEY(intkeys
[0]);
222 spkb_kbstate
[ki
].state
= 1;
225 ki
= KS_TO_KEY(intkeys
[0]);
226 spkb_kbstate
[ki
].state
= 0;
229 if ( buttons
& ZX_DOWN
){
230 ki
= KS_TO_KEY(intkeys
[1]);
231 spkb_kbstate
[ki
].state
= 1;
234 ki
= KS_TO_KEY(intkeys
[1]);
235 spkb_kbstate
[ki
].state
= 0;
238 if ( buttons
& ZX_SELECT
){
239 ki
= KS_TO_KEY(intkeys
[4]);
240 spkb_kbstate
[ki
].state
= 1;
243 ki
= KS_TO_KEY(intkeys
[4]);
244 spkb_kbstate
[ki
].state
= 0;
251 void press_key(int c
){
252 spkb_state_changed
= 1;
255 ki
= KS_TO_KEY(SK_KP_Enter
);
257 ki
= KS_TO_KEY(SK_KP_Space
);
260 spkb_kbstate
[ki
].state
= 1;