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 ****************************************************************************/
30 bool exit_requested
=false;
32 extern bool zxbox_menu(void);
34 /* DUMMIES ... to clean */
35 unsigned int scrmul
=0;
38 int small_screen
,pause_on_iconify
;
42 #include "zxvid_com.h"
46 struct zxbox_settings settings
;
48 /* doesn't fit into .ibss */
49 unsigned char image_array
[ HEIGHT
* WIDTH
];
51 static int previous_state
;
55 static unsigned char *gbuf
;
56 static size_t gbuf_size
= 0;
59 long video_frames IBSS_ATTR
= 0 ;
60 long start_time IBSS_ATTR
= 0;
62 enum plugin_status
plugin_start(UNUSED_ATTR
const void* parameter
)
67 rb
->lcd_set_backdrop(NULL
);
69 rb
->splash(HZ
, "Welcome to ZXBox");
75 /* get the remainder of the plugin buffer */
76 gbuf
= (unsigned char *) rb
->plugin_get_buffer(&gbuf_size
);
77 #ifdef USE_BUFFERED_GREY
78 grey_init(gbuf
, gbuf_size
, GREY_BUFFERED
|GREY_ON_COP
, LCD_WIDTH
,
81 grey_init(gbuf
, gbuf_size
, GREY_ON_COP
, LCD_WIDTH
, LCD_HEIGHT
, NULL
);
82 #endif /* USE_BUFFERED_GREY */
83 /* switch on greyscale overlay */
88 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
92 start_time
= *rb
->current_tick
;
98 start_spectemu(parameter
);
104 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
105 rb
->cpu_boost(false);
113 #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
120 void init_spect_key(void)
126 void spkb_process_events( int evenframe
)
131 #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
132 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
133 if (rb
->button_hold())
135 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
136 rb
->cpu_boost(false);
145 int buttons
= rb
->button_status();
146 if ( buttons
== previous_state
)
148 previous_state
= buttons
;
149 #if (CONFIG_KEYPAD != IPOD_4G_PAD) && (CONFIG_KEYPAD != IPOD_3G_PAD) && \
150 (CONFIG_KEYPAD != IPOD_1G2G_PAD)
151 if (buttons
& ZX_MENU
)
153 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
154 rb
->cpu_boost(false);
163 spkb_state_changed
= 1;
164 if (settings
.kempston
){
165 if ( buttons
& ZX_RIGHT
){
166 ki
= KS_TO_KEY(SK_KP_Right
);
167 spkb_kbstate
[ki
].state
= 1;
169 else if (buttons
& ZX_LEFT
){
170 ki
= KS_TO_KEY(SK_KP_Left
);
171 spkb_kbstate
[ki
].state
= 1;
175 ki
= KS_TO_KEY(SK_KP_Right
);
176 spkb_kbstate
[ki
].state
= 0;
177 ki
= KS_TO_KEY(SK_KP_Left
);
178 spkb_kbstate
[ki
].state
= 0;
181 if ( buttons
& ZX_UP
){
182 ki
= KS_TO_KEY(SK_KP_Up
);
183 spkb_kbstate
[ki
].state
= 1;
185 else if (buttons
& ZX_DOWN
){
186 ki
= KS_TO_KEY(SK_KP_Down
);
187 spkb_kbstate
[ki
].state
= 1;
190 ki
= KS_TO_KEY(SK_KP_Up
);
191 spkb_kbstate
[ki
].state
= 0;
192 ki
= KS_TO_KEY(SK_KP_Down
);
193 spkb_kbstate
[ki
].state
= 0;
196 if ( buttons
& ZX_SELECT
){
197 ki
= KS_TO_KEY(SK_KP_Insert
);
198 spkb_kbstate
[ki
].state
= 1;
201 ki
= KS_TO_KEY(SK_KP_Insert
);
202 spkb_kbstate
[ki
].state
= 0;
208 if ( buttons
& ZX_RIGHT
){
209 ki
= KS_TO_KEY(intkeys
[3]);
210 spkb_kbstate
[ki
].state
= 1;
213 ki
= KS_TO_KEY(intkeys
[3]);
214 spkb_kbstate
[ki
].state
= 0;
217 if ( buttons
& ZX_LEFT
){
218 ki
= KS_TO_KEY(intkeys
[2]);
219 spkb_kbstate
[ki
].state
= 1;
222 ki
= KS_TO_KEY(intkeys
[2]);
223 spkb_kbstate
[ki
].state
= 0;
226 if ( buttons
& ZX_UP
){
227 ki
= KS_TO_KEY(intkeys
[0]);
228 spkb_kbstate
[ki
].state
= 1;
231 ki
= KS_TO_KEY(intkeys
[0]);
232 spkb_kbstate
[ki
].state
= 0;
235 if ( buttons
& ZX_DOWN
){
236 ki
= KS_TO_KEY(intkeys
[1]);
237 spkb_kbstate
[ki
].state
= 1;
240 ki
= KS_TO_KEY(intkeys
[1]);
241 spkb_kbstate
[ki
].state
= 0;
244 if ( buttons
& ZX_SELECT
){
245 ki
= KS_TO_KEY(intkeys
[4]);
246 spkb_kbstate
[ki
].state
= 1;
249 ki
= KS_TO_KEY(intkeys
[4]);
250 spkb_kbstate
[ki
].state
= 0;
257 void press_key(int c
){
258 spkb_state_changed
= 1;
261 ki
= KS_TO_KEY(SK_KP_Enter
);
263 ki
= KS_TO_KEY(SK_KP_Space
);
266 spkb_kbstate
[ki
].state
= 1;