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 const struct plugin_api
* rb
;
32 bool exit_requested
=false;
34 extern bool zxbox_menu(void);
36 /* DUMMIES ... to clean */
37 unsigned int scrmul
=0;
40 int small_screen
,pause_on_iconify
;
44 #include "zxvid_com.h"
48 struct zxbox_settings settings
;
50 /* doesn't fit into .ibss */
51 unsigned char image_array
[ HEIGHT
* WIDTH
];
53 static int previous_state
;
57 static unsigned char *gbuf
;
58 static size_t gbuf_size
= 0;
61 long video_frames IBSS_ATTR
= 0 ;
62 long start_time IBSS_ATTR
= 0;
64 enum plugin_status
plugin_start(const struct plugin_api
* api
, const void* parameter
)
70 rb
->lcd_set_backdrop(NULL
);
72 rb
->splash(HZ
, "Welcome to ZXBox");
78 /* get the remainder of the plugin buffer */
79 gbuf
= (unsigned char *) rb
->plugin_get_buffer(&gbuf_size
);
80 #ifdef USE_BUFFERED_GREY
81 grey_init(rb
, gbuf
, gbuf_size
, GREY_BUFFERED
|GREY_ON_COP
, LCD_WIDTH
,
84 grey_init(rb
, gbuf
, gbuf_size
, GREY_ON_COP
, LCD_WIDTH
, LCD_HEIGHT
, NULL
);
85 #endif /* USE_BUFFERED_GREY */
86 /* switch on greyscale overlay */
91 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
95 start_time
= *rb
->current_tick
;
101 start_spectemu(parameter
);
107 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
108 rb
->cpu_boost(false);
116 #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
123 void init_spect_key(void)
129 void spkb_process_events( int evenframe
)
134 #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
135 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
136 if (rb
->button_hold())
138 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
139 rb
->cpu_boost(false);
148 int buttons
= rb
->button_status();
149 if ( buttons
== previous_state
)
151 previous_state
= buttons
;
152 #if (CONFIG_KEYPAD != IPOD_4G_PAD) && (CONFIG_KEYPAD != IPOD_3G_PAD) && \
153 (CONFIG_KEYPAD != IPOD_1G2G_PAD)
154 if (buttons
& ZX_MENU
)
156 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
157 rb
->cpu_boost(false);
166 spkb_state_changed
= 1;
167 if (settings
.kempston
){
168 if ( buttons
& ZX_RIGHT
){
169 ki
= KS_TO_KEY(SK_KP_Right
);
170 spkb_kbstate
[ki
].state
= 1;
172 else if (buttons
& ZX_LEFT
){
173 ki
= KS_TO_KEY(SK_KP_Left
);
174 spkb_kbstate
[ki
].state
= 1;
178 ki
= KS_TO_KEY(SK_KP_Right
);
179 spkb_kbstate
[ki
].state
= 0;
180 ki
= KS_TO_KEY(SK_KP_Left
);
181 spkb_kbstate
[ki
].state
= 0;
184 if ( buttons
& ZX_UP
){
185 ki
= KS_TO_KEY(SK_KP_Up
);
186 spkb_kbstate
[ki
].state
= 1;
188 else if (buttons
& ZX_DOWN
){
189 ki
= KS_TO_KEY(SK_KP_Down
);
190 spkb_kbstate
[ki
].state
= 1;
193 ki
= KS_TO_KEY(SK_KP_Up
);
194 spkb_kbstate
[ki
].state
= 0;
195 ki
= KS_TO_KEY(SK_KP_Down
);
196 spkb_kbstate
[ki
].state
= 0;
199 if ( buttons
& ZX_SELECT
){
200 ki
= KS_TO_KEY(SK_KP_Insert
);
201 spkb_kbstate
[ki
].state
= 1;
204 ki
= KS_TO_KEY(SK_KP_Insert
);
205 spkb_kbstate
[ki
].state
= 0;
211 if ( buttons
& ZX_RIGHT
){
212 ki
= KS_TO_KEY(intkeys
[3]);
213 spkb_kbstate
[ki
].state
= 1;
216 ki
= KS_TO_KEY(intkeys
[3]);
217 spkb_kbstate
[ki
].state
= 0;
220 if ( buttons
& ZX_LEFT
){
221 ki
= KS_TO_KEY(intkeys
[2]);
222 spkb_kbstate
[ki
].state
= 1;
225 ki
= KS_TO_KEY(intkeys
[2]);
226 spkb_kbstate
[ki
].state
= 0;
229 if ( buttons
& ZX_UP
){
230 ki
= KS_TO_KEY(intkeys
[0]);
231 spkb_kbstate
[ki
].state
= 1;
234 ki
= KS_TO_KEY(intkeys
[0]);
235 spkb_kbstate
[ki
].state
= 0;
238 if ( buttons
& ZX_DOWN
){
239 ki
= KS_TO_KEY(intkeys
[1]);
240 spkb_kbstate
[ki
].state
= 1;
243 ki
= KS_TO_KEY(intkeys
[1]);
244 spkb_kbstate
[ki
].state
= 0;
247 if ( buttons
& ZX_SELECT
){
248 ki
= KS_TO_KEY(intkeys
[4]);
249 spkb_kbstate
[ki
].state
= 1;
252 ki
= KS_TO_KEY(intkeys
[4]);
253 spkb_kbstate
[ki
].state
= 0;
260 void press_key(int c
){
261 spkb_state_changed
= 1;
264 ki
= KS_TO_KEY(SK_KP_Enter
);
266 ki
= KS_TO_KEY(SK_KP_Space
);
269 spkb_kbstate
[ki
].state
= 1;