summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uisimulator/win32/Makefile69
-rw-r--r--uisimulator/win32/Makefile.vc6101
-rw-r--r--uisimulator/win32/SOURCES12
-rw-r--r--uisimulator/win32/UI-fmrecorder.bmpbin236864 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-gmini120.bmpbin195416 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-h100.bmpbin194120 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-h120.bmpbin194120 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-h300.bmpbin168408 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-ipod4g.bmpbin217604 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-ipodcolor.bmpbin131232 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-ipodnano.bmpbin85280 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-ondiofm.bmpbin104264 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-ondiosp.bmpbin104264 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-player.bmpbin238616 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-recorder.bmpbin219296 -> 0 bytes
-rw-r--r--uisimulator/win32/UI-recorderv2.bmpbin236864 -> 0 bytes
-rw-r--r--uisimulator/win32/atoi.h20
-rw-r--r--uisimulator/win32/button.c286
-rw-r--r--uisimulator/win32/debug-win32.c66
-rw-r--r--uisimulator/win32/dir-win32.c91
-rw-r--r--uisimulator/win32/dir-win32.h46
-rw-r--r--uisimulator/win32/kernel.c167
-rw-r--r--uisimulator/win32/lcd-win32.c326
-rw-r--r--uisimulator/win32/lcd-win32.h47
-rw-r--r--uisimulator/win32/panic-win32.c43
-rw-r--r--uisimulator/win32/plugin-win32.h48
-rwxr-xr-xuisimulator/win32/plugin.def2
-rw-r--r--uisimulator/win32/resource.h19
-rw-r--r--uisimulator/win32/rockbox.dsp626
-rw-r--r--uisimulator/win32/rockbox.icobin3638 -> 0 bytes
-rw-r--r--uisimulator/win32/sound.c201
-rw-r--r--uisimulator/win32/sound.h22
-rw-r--r--uisimulator/win32/sprintf.h36
-rw-r--r--uisimulator/win32/stdbool.h46
-rw-r--r--uisimulator/win32/string-win32.c34
-rw-r--r--uisimulator/win32/thread-win32.c80
-rw-r--r--uisimulator/win32/thread-win32.h23
-rw-r--r--uisimulator/win32/timefuncs.h8
-rw-r--r--uisimulator/win32/uisw32.c344
-rw-r--r--uisimulator/win32/uisw32.h168
-rw-r--r--uisimulator/win32/uisw32.rc76
-rw-r--r--uisimulator/win32/uisw32.sln21
-rw-r--r--uisimulator/win32/uisw32.suobin13312 -> 0 bytes
-rw-r--r--uisimulator/win32/uisw32.vcproj280
-rw-r--r--uisimulator/x11/Makefile60
-rw-r--r--uisimulator/x11/README6
-rw-r--r--uisimulator/x11/SOURCES14
-rw-r--r--uisimulator/x11/archos/rockbox112.bmpbin5222 -> 0 bytes
-rw-r--r--uisimulator/x11/atoi.h2
-rw-r--r--uisimulator/x11/button-x11.c321
-rw-r--r--uisimulator/x11/config-x11.h362
-rw-r--r--uisimulator/x11/kernel.c165
-rw-r--r--uisimulator/x11/lcd-x11.c262
-rw-r--r--uisimulator/x11/lcd-x11.h26
-rw-r--r--uisimulator/x11/oss_sound.c84
-rw-r--r--uisimulator/x11/resources.c113
-rw-r--r--uisimulator/x11/resources.h23
-rw-r--r--uisimulator/x11/screenhack.c579
-rw-r--r--uisimulator/x11/screenhack.h52
-rw-r--r--uisimulator/x11/sound.c140
-rw-r--r--uisimulator/x11/sound.h22
-rw-r--r--uisimulator/x11/sprintf.h12
-rw-r--r--uisimulator/x11/thread.c148
-rw-r--r--uisimulator/x11/timefuncs.h7
-rw-r--r--uisimulator/x11/uibasic.c277
-rw-r--r--uisimulator/x11/utils.h22
-rw-r--r--uisimulator/x11/version.h1
-rw-r--r--uisimulator/x11/visual.c544
-rw-r--r--uisimulator/x11/visual.h29
-rw-r--r--uisimulator/x11/vroot.h126
-rw-r--r--uisimulator/x11/xmu.h14
71 files changed, 0 insertions, 6719 deletions
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
deleted file mode 100644
index 160924a0f3..0000000000
--- a/uisimulator/win32/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
1############################################################################
2# __________ __ ___.
3# Open \______ \ ____ ____ | | _\_ |__ _______ ___
4# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7# \/ \/ \/ \/ \/
8# $Id$
9#
10# Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11#
12# All files in this archive are subject to the GNU General Public License.
13# See the file COPYING in the source tree root for full license agreement.
14#
15# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16# KIND, either express or implied.
17#
18############################################################################
19
20SIMCOMMON = ../common
21
22DEPFILE = $(OBJDIR)/dep-simwin
23
24RM = rm -f
25DEBUG = -g
26
27INCLUDES = -I. -I$(SIMCOMMON) -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) \
28 -I$(BUILDDIR)
29
30DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
31$(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES)
32
33# This sets up 'SRC' based on the files mentioned in SOURCES
34include $(TOOLSDIR)/makesrc.inc
35
36OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
37
38SOURCES = $(SRC)
39DIRS = .
40
41CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall -mno-cygwin
42
43OUTFILE = $(BUILDDIR)/libsim.a
44
45all: $(OUTFILE)
46
47$(OUTFILE): $(OBJS) $(OBJDIR)/UI256.bmp $(OBJDIR)/uisw32-res.o
48 @echo "AR+RANLIB $@"
49 @$(AR) ruv $@ $(OBJS) $(OBJDIR)/uisw32-res.o >/dev/null 2>&1
50 @$(RANLIB) $@
51
52clean:
53 @echo "cleaning simwin"
54 @$(RM) $(OBJS) *~ core $(OUTFILE) $(OBJDIR)/uisw32-res.o \
55 $(OBJDIR)/UI256.bmp $(DEPFILE)
56 @$(MAKE) -C $(SIMCOMMON) clean
57
58################## Specific dependencies ##################
59$(OBJDIR)/UI256.bmp: UI-$(ARCHOS).bmp
60 @echo UI
61 @cp $< $@
62
63$(OBJDIR)/uisw32-res.o: uisw32.rc $(OBJDIR)/UI256.bmp
64 @echo "WINDRES"
65 @$(WINDRES) --include-dir $(OBJDIR) -i $< -o $@
66
67include $(TOOLSDIR)/make.inc
68
69-include $(DEPFILE)
diff --git a/uisimulator/win32/Makefile.vc6 b/uisimulator/win32/Makefile.vc6
deleted file mode 100644
index d92f18d86d..0000000000
--- a/uisimulator/win32/Makefile.vc6
+++ /dev/null
@@ -1,101 +0,0 @@
1############################################################################
2# __________ __ ___.
3# Open \______ \ ____ ____ | | _\_ |__ _______ ___
4# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7# \/ \/ \/ \/ \/
8# $Id$
9#
10# Copyright (C) 2002 by Felix Arends
11#
12# All files in this archive are subject to the GNU General Public License.
13# See the file COPYING in the source tree root for full license agreement.
14#
15# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16# KIND, either express or implied.
17#
18############################################################################
19
20
21#CHANGE THIS FIELD TO SPECIFY RECORDER OR PLAYER (Player does not work very well atm)
22TARGET = RECORDER
23
24FIRMWAREDIR = ../../firmware
25DRIVERS = $(FIRMWAREDIR)/drivers
26COMMON = $(FIRMWAREDIR)/common
27APPSCOMMON = ../common
28TOOLSDIR = ..\..\tools
29SIMDIR = ../win32/
30APPDIR = ../../apps/
31PLAYERDIR = $(APPDIR)player/
32RECDIR = $(APPDIR)recorder/
33RM = del
34LANGUAGE = english
35FONT = $(FIRMWAREDIR)/fonts/clR6x8.bdf
36
37!IF ("$(TARGET)" == "RECORDER")
38DISPLAY = -DHAVE_LCD_BITMAP
39KEYPAD = -DHAVE_RECORDER_KEYPAD
40MODEL_SPECIFIC_DIR = $(RECDIR)
41!ELSE
42DISPLAY = -DHAVE_LCD_CHARCELLS
43KEYPAD = -DHAVE_PLAYER_KEYPAD
44MODEL_SPECIFIC_DIR = $(PLAYERDIR)
45!ENDIF
46
47CC = cl
48RC = rc
49LINK = link
50DEFINES = $(DEFINES) -DWIN32 -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR $(KEYPAD) $(DISPLAY) -DAPPSVERSION=\"WIN32SIM\"
51LDFLAGS = /OUT:uisw32.exe /SUBSYSTEM:windows /NOLOGO /MACHINE:IX86 kernel32.lib user32.lib gdi32.lib
52INCLUDES = -I$(FIRMWAREDIR)/export -I$(DRIVERS) -I$(COMMON) -I$(APPSCOMMON) -I$(SIMDIR) -I$(APPDIR) -I$(MODEL_SPECIFIC_DIR)
53LIBS = /DEFAULTLIB:gdi32.lib /DEFAULTLIB:user32.lib /NODEFAULTLIB:libc.lib
54
55CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) /MD /Fd"Release/vc70.pdb" /c
56
57SRCS = *.c \
58 $(DRIVERS)/power.c \
59 $(APPDIR)*.c \
60 $(APPSCOMMON)/lcd-common.c $(APPSCOMMON)/mpegplay.c $(APPSCOMMON)/sim_icons.c $(APPSCOMMON)/stubs.c \
61 $(FIRMWAREDIR)/mpeg.c $(FIRMWAREDIR)/id3.c $(FIRMWAREDIR)/usb.c $(FIRMWAREDIR)/mpeg.c $(FIRMWAREDIR)/font.c $(FIRMWAREDIR)/powermgmt.c \
62 $(COMMON)/sprintf.c $(COMMON)/strtok.c $(COMMON)/errno.c
63
64!IF ("$(DISPLAY)" == "-DHAVE_LCD_BITMAP")
65SRCS = $(SRCS) $(RECDIR)/bmp.c $(RECDIR)/bounce.c $(RECDIR)/cube.c $(RECDIR)/icons.c $(RECDIR)/keyboard.c $(RECDIR)/peakmeter.c \
66 $(RECDIR)/snow.c $(RECDIR)/sokoban.c $(RECDIR)/tetris.c $(RECDIR)/widgets.c $(RECDIR)/wormlet.c $(DRIVERS)/lcd-recorder.c
67!ELSE
68SRCS = $(SRCS) $(APPSCOMMON)/lcd-playersim.c $(DRIVERS)/lcd-player.c $(PLAYERDIR)*.c
69!ENDIF
70
71OBJS = lang.obj $(SRCS:.c=.obj) uisw32.res
72
73all : uisw32.exe
74
75$(APPDIR)credits.raw:
76 perl $(APPDIR)credits.pl < ../../docs/CREDITS > $(APPDIR)credits.raw
77
78kernel.obj:
79 $(CC) $(CFLAGS) *.c
80
81sysfont.c: $(FONT)
82 $(TOOLSDIR)\convbdf -c -o sysfont.c $(FONT)
83
84sysfont.obj: sysfont.c
85 $(CC) $(CFLAGS) sysfont.c
86
87uisw32.exe: $(APPDIR)credits.raw $(OBJS) sysfont.obj kernel.obj
88 $(LINK) $(LIBS) $(LDFLAGS) *.obj uisw32.res
89
90uisw32.res:
91 $(RC) /r uisw32.rc
92
93build.lang: $(APPDIR)/lang/$(LANGUAGE).lang
94 perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $(APPDIR)/lang/$(LANGUAGE).lang > build.lang
95
96lang.obj: build.lang
97 perl -s $(TOOLSDIR)/genlang -p=lang build.lang
98 $(CC) $(CFLAGS) -c lang.c -o lang.obj
99
100clean:
101 $(RM) *.obj ..\..\apps\lang.c ..\..\apps\lang.h ..\..\apps\credits.raw lang.build uisw32.res uisw32.exe
diff --git a/uisimulator/win32/SOURCES b/uisimulator/win32/SOURCES
deleted file mode 100644
index 29710fd82c..0000000000
--- a/uisimulator/win32/SOURCES
+++ /dev/null
@@ -1,12 +0,0 @@
1button.c
2debug-win32.c
3#if 0 /* this is only for non-cygwin simulator builds */
4dir-win32.c
5#endif
6kernel.c
7lcd-win32.c
8panic-win32.c
9string-win32.c
10thread-win32.c
11uisw32.c
12sound.c
diff --git a/uisimulator/win32/UI-fmrecorder.bmp b/uisimulator/win32/UI-fmrecorder.bmp
deleted file mode 100644
index 53f705b9ef..0000000000
--- a/uisimulator/win32/UI-fmrecorder.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-gmini120.bmp b/uisimulator/win32/UI-gmini120.bmp
deleted file mode 100644
index afeaf74801..0000000000
--- a/uisimulator/win32/UI-gmini120.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-h100.bmp b/uisimulator/win32/UI-h100.bmp
deleted file mode 100644
index caeb81bc4b..0000000000
--- a/uisimulator/win32/UI-h100.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-h120.bmp b/uisimulator/win32/UI-h120.bmp
deleted file mode 100644
index caeb81bc4b..0000000000
--- a/uisimulator/win32/UI-h120.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-h300.bmp b/uisimulator/win32/UI-h300.bmp
deleted file mode 100644
index 5f099b717a..0000000000
--- a/uisimulator/win32/UI-h300.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-ipod4g.bmp b/uisimulator/win32/UI-ipod4g.bmp
deleted file mode 100644
index 85af574d7c..0000000000
--- a/uisimulator/win32/UI-ipod4g.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-ipodcolor.bmp b/uisimulator/win32/UI-ipodcolor.bmp
deleted file mode 100644
index de5dad4ffe..0000000000
--- a/uisimulator/win32/UI-ipodcolor.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-ipodnano.bmp b/uisimulator/win32/UI-ipodnano.bmp
deleted file mode 100644
index e33f7e81da..0000000000
--- a/uisimulator/win32/UI-ipodnano.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-ondiofm.bmp b/uisimulator/win32/UI-ondiofm.bmp
deleted file mode 100644
index e258720d28..0000000000
--- a/uisimulator/win32/UI-ondiofm.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-ondiosp.bmp b/uisimulator/win32/UI-ondiosp.bmp
deleted file mode 100644
index c62c2334a3..0000000000
--- a/uisimulator/win32/UI-ondiosp.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-player.bmp b/uisimulator/win32/UI-player.bmp
deleted file mode 100644
index db4003b120..0000000000
--- a/uisimulator/win32/UI-player.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-recorder.bmp b/uisimulator/win32/UI-recorder.bmp
deleted file mode 100644
index 98937fea2d..0000000000
--- a/uisimulator/win32/UI-recorder.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/UI-recorderv2.bmp b/uisimulator/win32/UI-recorderv2.bmp
deleted file mode 100644
index 53f705b9ef..0000000000
--- a/uisimulator/win32/UI-recorderv2.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/atoi.h b/uisimulator/win32/atoi.h
deleted file mode 100644
index c95cfca64f..0000000000
--- a/uisimulator/win32/atoi.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20int atoi(const char *);
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c
deleted file mode 100644
index 8f21fe4396..0000000000
--- a/uisimulator/win32/button.c
+++ /dev/null
@@ -1,286 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include "uisw32.h"
22#include "config.h"
23#include "button.h"
24#include "kernel.h"
25#include "backlight.h"
26#include "misc.h"
27
28/* how long until repeat kicks in */
29#define REPEAT_START 6
30
31/* the speed repeat starts at */
32#define REPEAT_INTERVAL_START 4
33
34/* speed repeat finishes at */
35#define REPEAT_INTERVAL_FINISH 2
36
37struct event_queue button_queue;
38
39static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
40
41void button_event(int key, bool pressed)
42{
43 int new_btn = 0;
44 int diff = 0;
45 static int count = 0;
46 static int lastbtn;
47 static int repeat_speed = REPEAT_INTERVAL_START;
48 static int repeat_count = 0;
49 static bool repeat = false;
50 static bool post = false;
51
52 switch (key)
53 {
54 case VK_NUMPAD4:
55 case VK_LEFT:
56 new_btn = BUTTON_LEFT;
57 break;
58 case VK_NUMPAD6:
59 case VK_RIGHT:
60 new_btn = BUTTON_RIGHT;
61 break;
62
63 case VK_NUMPAD8:
64 case VK_UP:
65#ifdef BUTTON_UP
66 new_btn = BUTTON_UP;
67#elif defined BUTTON_SCROLL_FWD
68 new_btn = BUTTON_SCROLL_FWD;
69#elif defined BUTTON_PLAY
70 new_btn = BUTTON_PLAY;
71#endif
72 break;
73
74 case VK_NUMPAD2:
75 case VK_DOWN:
76#ifdef BUTTON_DOWN
77 new_btn = BUTTON_DOWN;
78#elif defined BUTTON_SCROLL_BACK
79 new_btn = BUTTON_SCROLL_BACK;
80#elif defined BUTTON_STOP
81 new_btn = BUTTON_STOP;
82#endif
83 break;
84
85 case VK_ADD:
86#ifdef BUTTON_ON
87 new_btn = BUTTON_ON;
88#elif defined(BUTTON_SELECT) && defined(BUTTON_PLAY)
89 new_btn = BUTTON_PLAY;
90#endif
91 break;
92
93#ifdef BUTTON_OFF
94 case VK_RETURN:
95 new_btn = BUTTON_OFF;
96 break;
97#endif
98
99#ifdef BUTTON_F1
100 case VK_DIVIDE:
101 case VK_F1:
102 new_btn = BUTTON_F1;
103 break;
104 case VK_MULTIPLY:
105 case VK_F2:
106 new_btn = BUTTON_F2;
107 break;
108 case VK_SUBTRACT:
109 case VK_F3:
110 new_btn = BUTTON_F3;
111 break;
112#elif defined(BUTTON_REC)
113 case VK_DIVIDE:
114 case VK_F1:
115 new_btn = BUTTON_REC;
116 break;
117#endif
118
119 case VK_NUMPAD5:
120 case VK_SPACE:
121#if defined(BUTTON_PLAY) && !defined(BUTTON_SELECT)
122 new_btn = BUTTON_PLAY;
123#elif defined(BUTTON_SELECT)
124 new_btn = BUTTON_SELECT;
125#endif
126 break;
127
128#ifdef HAVE_LCD_BITMAP
129 case VK_NUMPAD0:
130 case VK_F5:
131 if(pressed)
132 {
133 screen_dump();
134 return;
135 }
136 break;
137#endif
138
139 case VK_DECIMAL:
140 case VK_INSERT:
141#ifdef BUTTON_MENU
142 new_btn = BUTTON_MENU;
143#elif defined(BUTTON_MODE)
144 new_btn = BUTTON_MODE;
145#endif
146 break;
147 }
148
149 if (pressed)
150 btn |= new_btn;
151 else
152 btn &= ~new_btn;
153
154 /* Lots of stuff copied from real button.c. Not good, I think... */
155
156 /* Find out if a key has been released */
157 diff = btn ^ lastbtn;
158
159 if(diff && (btn & diff) == 0)
160 {
161 queue_post(&button_queue, BUTTON_REL | diff, NULL);
162 }
163 else
164 {
165 if ( btn )
166 {
167 /* normal keypress */
168 if ( btn != lastbtn )
169 {
170 post = true;
171 repeat = false;
172 repeat_speed = REPEAT_INTERVAL_START;
173
174 }
175 else /* repeat? */
176 {
177 if ( repeat )
178 {
179 if (!post)
180 count--;
181 if (count == 0)
182 {
183 post = true;
184 /* yes we have repeat */
185 repeat_speed--;
186 if (repeat_speed < REPEAT_INTERVAL_FINISH)
187 repeat_speed = REPEAT_INTERVAL_FINISH;
188 count = repeat_speed;
189
190 repeat_count++;
191 }
192 }
193 else
194 {
195 if (count++ > REPEAT_START)
196 {
197 post = true;
198 repeat = true;
199 repeat_count = 0;
200 /* initial repeat */
201 count = REPEAT_INTERVAL_START;
202 }
203 }
204 }
205 if ( post )
206 {
207 if(repeat)
208 {
209 if (queue_empty(&button_queue))
210 {
211 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
212 post = false;
213 }
214 }
215 else
216 {
217 queue_post(&button_queue, btn, NULL);
218 post = false;
219 }
220
221#ifdef HAVE_REMOTE_LCD
222 if(btn & BUTTON_REMOTE)
223 remote_backlight_on();
224 else
225#endif
226 backlight_on();
227
228 }
229 }
230 else
231 {
232 repeat = false;
233 count = 0;
234 }
235 }
236 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
237}
238
239/* Again copied from real button.c... */
240
241long button_get(bool block)
242{
243 struct event ev;
244
245 if ( block || !queue_empty(&button_queue) ) {
246 queue_wait(&button_queue, &ev);
247 return ev.id;
248 }
249 return BUTTON_NONE;
250}
251
252long button_get_w_tmo(int ticks)
253{
254 struct event ev;
255 queue_wait_w_tmo(&button_queue, &ev, ticks);
256 return (ev.id != SYS_TIMEOUT)? ev.id: BUTTON_NONE;
257}
258
259void button_init(void)
260{
261}
262
263int button_status(void)
264{
265 return btn;
266}
267
268void button_clear_queue(void)
269{
270 queue_clear(&button_queue);
271}
272
273#ifdef HAS_BUTTON_HOLD
274bool button_hold(void) {
275 /* temp fix for hold button on irivers */
276 return false;
277}
278#endif
279
280#ifdef HAS_REMOTE_BUTTON_HOLD
281bool remote_button_hold(void) {
282 /* temp fix for hold button on irivers */
283 return false;
284}
285#endif
286
diff --git a/uisimulator/win32/debug-win32.c b/uisimulator/win32/debug-win32.c
deleted file mode 100644
index dbc0f10e85..0000000000
--- a/uisimulator/win32/debug-win32.c
+++ /dev/null
@@ -1,66 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include <stdio.h>
22
23char debugmembuf[200];
24
25void debug( const char *message )
26{
27 static int debugger = -1;
28
29 if (debugger == -1)
30 {
31 HINSTANCE hInst = LoadLibrary("kernel32.dll");
32 debugger = 0;
33
34 if (hInst != NULL)
35 {
36 FARPROC pIsDebuggerPresent = GetProcAddress(hInst, "IsDebuggerPresent");
37 if (pIsDebuggerPresent != NULL)
38 debugger = pIsDebuggerPresent();
39 }
40 }
41
42 if (debugger)
43 OutputDebugString (message);
44 else
45 printf("%s", message);
46}
47
48void debugf(const char *fmt, ...)
49{
50 va_list ap;
51
52 va_start( ap, fmt );
53 wvsprintf( debugmembuf, fmt, ap );
54 va_end( ap );
55 debug ( debugmembuf );
56}
57
58void Logf(char *fmt, ...)
59{
60 va_list ap;
61
62 va_start( ap, fmt );
63 wvsprintf( debugmembuf, fmt, ap );
64 va_end( ap );
65 debug ( debugmembuf );
66}
diff --git a/uisimulator/win32/dir-win32.c b/uisimulator/win32/dir-win32.c
deleted file mode 100644
index 6f14e798be..0000000000
--- a/uisimulator/win32/dir-win32.c
+++ /dev/null
@@ -1,91 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <io.h>
21#include <windows.h>
22#include <malloc.h>
23#include "dir-win32.h"
24
25// Directory operations
26//
27
28// opendir
29// open directory for scanning
30DIR *opendir (
31 const char *dirname // directory name
32 )
33{
34 DIR *p = (DIR*)malloc(sizeof(DIR));
35 struct _finddata_t fd;
36 unsigned int i;
37 char *s = (char*)malloc(strlen(dirname) + 5);
38 wsprintf (s, "%s", dirname);
39
40 for (i = 0; i < strlen(s); i++)
41 if (s[i] == '/')
42 s[i] = '\\';
43
44 if (s[i - 1] != '\\')
45 {
46 s[i] = '\\';
47 s[++i] = '\0';
48 }
49
50 OutputDebugString (s);
51
52 wsprintf (s, "%s*.*", s);
53
54 if ((p->handle = _findfirst (s, &fd)) == -1)
55 {
56 free (s);
57 free (p);
58 return 0;
59 }
60 free (s);
61 return p;
62}
63
64// closedir
65// close directory
66int closedir (
67 DIR *dir // previously opened dir search
68 )
69{
70 free(dir);
71 return 0;
72}
73
74// read dir
75// read next entry in directory
76struct dirent *readdir (
77 DIR *dir
78 )
79{
80 struct _finddata_t fd;
81 if (_findnext (dir->handle, &fd) == -1)
82 return 0;
83 memcpy (dir->fd.d_name, fd.name, 256);
84
85 dir->fd.attribute = fd.attrib & 0x3f;
86 dir->fd.size = fd.size;
87 dir->fd.startcluster = 0 ;
88
89
90 return &dir->fd;
91}
diff --git a/uisimulator/win32/dir-win32.h b/uisimulator/win32/dir-win32.h
deleted file mode 100644
index 95ce326e9f..0000000000
--- a/uisimulator/win32/dir-win32.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef _DIR_WIN32_H_
20#define _DIR_WIN32_H_
21
22#include <stdbool.h>
23
24struct dirent {
25 unsigned char d_name[MAX_PATH];
26 int attribute;
27 int size;
28 int startcluster;
29};
30
31typedef struct
32{
33 struct dirent fd;
34 int handle;
35} DIR;
36
37extern DIR* opendir(const char* name);
38extern int closedir(DIR* dir);
39extern int mkdir(const char* name);
40extern int rmdir(const char* name);
41
42extern struct dirent* readdir(DIR* dir);
43
44#define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
45
46#endif
diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c
deleted file mode 100644
index 34100a234e..0000000000
--- a/uisimulator/win32/kernel.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include "uisw32.h"
22#include "kernel.h"
23#include "thread-win32.h"
24#include "thread.h"
25#include "debug.h"
26
27static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
28
29int set_irq_level (int level)
30{
31 static int _lv = 0;
32 return (_lv = level);
33}
34
35void queue_init(struct event_queue *q)
36{
37 q->read = 0;
38 q->write = 0;
39}
40
41void queue_delete(struct event_queue *q)
42{
43 (void)q;
44}
45
46void queue_wait(struct event_queue *q, struct event *ev)
47{
48 while(q->read == q->write)
49 {
50 switch_thread();
51 }
52
53 *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK];
54}
55
56void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
57{
58 unsigned int timeout = current_tick + ticks;
59
60 while(q->read == q->write && TIME_BEFORE( current_tick, timeout ))
61 {
62 sleep(1);
63 }
64
65 if(q->read != q->write)
66 {
67 *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK];
68 }
69 else
70 {
71 ev->id = SYS_TIMEOUT;
72 }
73}
74
75void queue_post(struct event_queue *q, long id, void *data)
76{
77 int wr;
78 int oldlevel;
79
80 oldlevel = set_irq_level(15<<4);
81 wr = (q->write++) & QUEUE_LENGTH_MASK;
82
83 q->events[wr].id = id;
84 q->events[wr].data = data;
85 set_irq_level(oldlevel);
86}
87
88bool queue_empty(const struct event_queue* q)
89{
90 return ( q->read == q->write );
91}
92
93void queue_clear(struct event_queue* q)
94{
95 /* fixme: This is potentially unsafe in case we do interrupt-like processing */
96 q->read = 0;
97 q->write = 0;
98}
99
100void switch_thread (void)
101{
102 yield ();
103}
104
105void sim_tick_tasks(void)
106{
107 int i;
108
109 /* Run through the list of tick tasks */
110 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
111 {
112 if(tick_funcs[i])
113 {
114 tick_funcs[i]();
115 }
116 }
117}
118
119int tick_add_task(void (*f)(void))
120{
121 int i;
122
123 /* Add a task if there is room */
124 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
125 {
126 if(tick_funcs[i] == NULL)
127 {
128 tick_funcs[i] = f;
129 return 0;
130 }
131 }
132 DEBUGF("Error! tick_add_task(): out of tasks");
133 return -1;
134}
135
136int tick_remove_task(void (*f)(void))
137{
138 int i;
139
140 /* Remove a task if it is there */
141 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
142 {
143 if(tick_funcs[i] == f)
144 {
145 tick_funcs[i] = NULL;
146 return 0;
147 }
148 }
149
150 return -1;
151}
152
153/* TODO: Implement mutexes for win32 */
154void mutex_init(struct mutex *m)
155{
156 (void)m;
157}
158
159void mutex_lock(struct mutex *m)
160{
161 (void)m;
162}
163
164void mutex_unlock(struct mutex *m)
165{
166 (void)m;
167}
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
deleted file mode 100644
index 8afd025a16..0000000000
--- a/uisimulator/win32/lcd-win32.c
+++ /dev/null
@@ -1,326 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include <process.h>
22#include "uisw32.h"
23#include "lcd.h"
24#include "lcd-playersim.h"
25#include "debug.h"
26
27#if LCD_DEPTH == 16
28unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
29
30BITMAPINFO256 bmi =
31{
32 {sizeof (BITMAPINFOHEADER),
33 LCD_WIDTH, -LCD_HEIGHT, 1, 16,
34 BI_BITFIELDS, 0, 0, 0, 3, 3,
35 }, /* bitfield masks (RGB565) */
36 {{0x00, 0xf8, 0, 0}, {0xe0, 0x07, 0, 0}, {0x1f, 0x00, 0, 0}}
37}; /* bitmap information */
38#else
39unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
40RGBQUAD color_zero = {UI_LCD_BGCOLORLIGHT, 0};
41RGBQUAD color_max = {0, 0, 0, 0};
42
43BITMAPINFO256 bmi =
44{
45 {sizeof (BITMAPINFOHEADER),
46 LCD_WIDTH, -LCD_HEIGHT, 1, 8,
47 BI_RGB, 0, 0, 0, 2, 2,
48 },
49 {} /* colour lookup table gets filled later */
50}; /* bitmap information */
51#endif
52
53#ifdef HAVE_LCD_BITMAP
54
55#ifdef HAVE_REMOTE_LCD
56unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH];
57RGBQUAD remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
58RGBQUAD remote_color_max = {0, 0, 0, 0};
59
60BITMAPINFO256 remote_bmi =
61{
62 {sizeof (BITMAPINFOHEADER),
63 LCD_REMOTE_WIDTH, -LCD_REMOTE_HEIGHT, 1, 8,
64 BI_RGB, 0, 0, 0, 2, 2,
65 },
66 {} /* colour lookup table gets filled later */
67};
68#endif
69
70void lcd_update(void)
71{
72 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
73}
74
75void lcd_update_rect(int x_start, int y_start,
76 int width, int height)
77{
78 int x, y;
79 int xmax, ymax;
80 RECT r;
81
82 ymax = y_start + height;
83 xmax = x_start + width;
84
85 if (hGUIWnd == NULL)
86 _endthread ();
87
88 if(xmax > LCD_WIDTH)
89 xmax = LCD_WIDTH;
90 if(ymax >= LCD_HEIGHT)
91 ymax = LCD_HEIGHT;
92
93 for (x = x_start; x < xmax; x++)
94 for (y = y_start; y < ymax; y++)
95 {
96#if LCD_DEPTH == 1
97 bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1);
98#elif LCD_DEPTH == 2
99#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
100 bitmap[y][x] = ((lcd_framebuffer[y][x/4] >> (2 * (x & 3))) & 3);
101#else
102 bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3);
103#endif
104#elif LCD_DEPTH == 16
105#if LCD_PIXELFORMAT == RGB565SWAPPED
106 unsigned bits = lcd_framebuffer[y][x];
107 bitmap[y][x] = (bits >> 8) | (bits << 8);
108#else
109 bitmap[y][x] = lcd_framebuffer[y][x];
110#endif
111#endif
112 }
113
114 /* Invalidate only the window part that actually did change */
115 GetClientRect (hGUIWnd, &r);
116 r.left = (UI_LCD_POSX + (UI_LCD_WIDTH * x_start / LCD_WIDTH))
117 * r.right / UI_WIDTH;
118 r.top = (UI_LCD_POSY + (UI_LCD_HEIGHT * y_start / LCD_HEIGHT))
119 * r.bottom / UI_HEIGHT;
120 r.right = (UI_LCD_POSX + (UI_LCD_WIDTH * xmax / LCD_WIDTH))
121 * r.right / UI_WIDTH;
122 r.bottom = (UI_LCD_POSY + (UI_LCD_HEIGHT * ymax / LCD_HEIGHT))
123 * r.bottom / UI_HEIGHT;
124 InvalidateRect (hGUIWnd, &r, FALSE);
125}
126
127#ifdef HAVE_REMOTE_LCD
128
129extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
130
131void lcd_remote_update (void)
132{
133 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
134}
135
136void lcd_remote_update_rect(int x_start, int y_start,
137 int width, int height)
138{
139 int x, y;
140 int xmax, ymax;
141 RECT r;
142
143 ymax = y_start + height;
144 xmax = x_start + width;
145
146 if (hGUIWnd == NULL)
147 _endthread ();
148
149 if(xmax > LCD_REMOTE_WIDTH)
150 xmax = LCD_REMOTE_WIDTH;
151 if(ymax >= LCD_REMOTE_HEIGHT)
152 ymax = LCD_REMOTE_HEIGHT;
153
154 for (x = x_start; x < xmax; x++)
155 for (y = y_start; y < ymax; y++)
156 remote_bitmap[y][x] = ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1);
157
158 /* Invalidate only the window part that actually did change */
159 GetClientRect (hGUIWnd, &r);
160 r.left = (UI_REMOTE_POSX + (UI_REMOTE_WIDTH * x_start / LCD_REMOTE_WIDTH))
161 * r.right / UI_WIDTH;
162 r.top = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * y_start / LCD_REMOTE_HEIGHT))
163 * r.bottom / UI_HEIGHT;
164 r.right = (UI_REMOTE_POSX + (UI_REMOTE_WIDTH * xmax / LCD_REMOTE_WIDTH))
165 * r.right / UI_WIDTH;
166 r.bottom = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * ymax / LCD_REMOTE_HEIGHT))
167 * r.bottom / UI_HEIGHT;
168 InvalidateRect (hGUIWnd, &r, FALSE);
169}
170
171#endif /* HAVE_REMOTE_LCD */
172#endif /* HAVE_LCD_BITMAP */
173
174#ifdef HAVE_LCD_CHARCELLS
175/* Defined in lcd-playersim.c */
176extern void lcd_print_char(int x, int y);
177extern bool lcd_display_redraw;
178extern unsigned char hardware_buffer_lcd[11][2];
179static unsigned char lcd_buffer_copy[11][2];
180
181void lcd_update(void)
182{
183 int x, y;
184 bool changed = false;
185 RECT r;
186
187 if (hGUIWnd == NULL)
188 _endthread ();
189
190 for (y = 0; y < 2; y++)
191 {
192 for (x = 0; x < 11; x++)
193 {
194 if (lcd_display_redraw ||
195 lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y])
196 {
197 lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y];
198 lcd_print_char(x, y);
199 changed = true;
200 }
201 }
202 }
203 if (changed)
204 {
205 /* Invalidate only the window part that actually did change */
206 GetClientRect (hGUIWnd, &r);
207 r.left = UI_LCD_POSX * r.right / UI_WIDTH;
208 r.top = UI_LCD_POSY * r.bottom / UI_HEIGHT;
209 r.right = (UI_LCD_POSX + UI_LCD_WIDTH) * r.right / UI_WIDTH;
210 r.bottom = (UI_LCD_POSY + UI_LCD_HEIGHT) * r.bottom / UI_HEIGHT;
211 InvalidateRect (hGUIWnd, &r, FALSE);
212 }
213 lcd_display_redraw = false;
214}
215
216void drawdots(int color, struct coordinate *points, int count)
217{
218 while (count--)
219 {
220 bitmap[points[count].y][points[count].x] = color;
221 }
222}
223
224void drawrectangles(int color, struct rectangle *points, int count)
225{
226 while (count--)
227 {
228 int x;
229 int y;
230 int ix;
231 int iy;
232
233 for (x = points[count].x, ix = 0; ix < points[count].width; x++, ix++)
234 {
235 for (y = points[count].y, iy = 0; iy < points[count].height; y++, iy++)
236 {
237 bitmap[y][x] = color;
238 }
239 }
240 }
241}
242#endif /* HAVE_LCD_CHARCELLS */
243
244#if 0
245/* set backlight state of lcd */
246void lcd_backlight (bool on)
247{
248 if (on)
249 color_zero = {UI_LCD_BGCOLORLIGHT, 0};
250 else
251 color_zero = {UI_LCD_BGCOLOR, 0};
252
253 lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max);
254 InvalidateRect (hGUIWnd, NULL, FALSE);
255}
256#endif
257
258#if LCD_DEPTH <= 8
259/* set a range of bitmap indices to a gradient from startcolour to endcolour */
260void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
261{
262 int i;
263
264 bmi.bmiHeader.biClrUsed = index + count;
265 bmi.bmiHeader.biClrImportant = index + count;
266
267 count--;
268 for (i = 0; i <= count; i++)
269 {
270 bmi.bmiColors[i+index].rgbRed = start->rgbRed
271 + (end->rgbRed - start->rgbRed) * i / count;
272 bmi.bmiColors[i+index].rgbGreen = start->rgbGreen
273 + (end->rgbGreen - start->rgbGreen) * i / count;
274 bmi.bmiColors[i+index].rgbBlue = start->rgbBlue
275 + (end->rgbBlue - start->rgbBlue) * i / count;
276 }
277}
278#endif
279
280#ifdef HAVE_REMOTE_LCD
281/* set a range of bitmap indices to a gradient from startcolour to endcolour */
282void lcdremotecolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
283{
284 int i;
285
286 remote_bmi.bmiHeader.biClrUsed = index + count;
287 remote_bmi.bmiHeader.biClrImportant = index + count;
288
289 count--;
290 for (i = 0; i <= count; i++)
291 {
292 remote_bmi.bmiColors[i+index].rgbRed = start->rgbRed
293 + (end->rgbRed - start->rgbRed) * i / count;
294 remote_bmi.bmiColors[i+index].rgbGreen = start->rgbGreen
295 + (end->rgbGreen - start->rgbGreen) * i / count;
296 remote_bmi.bmiColors[i+index].rgbBlue = start->rgbBlue
297 + (end->rgbBlue - start->rgbBlue) * i / count;
298 }
299}
300#endif
301
302/* initialise simulator lcd driver */
303void simlcdinit(void)
304{
305#if LCD_DEPTH <= 8
306 lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max);
307#endif
308#ifdef HAVE_REMOTE_LCD
309 lcdremotecolors(0, (1<<LCD_REMOTE_DEPTH), &remote_color_zero, &remote_color_max);
310#endif
311}
312
313#ifdef CONFIG_BACKLIGHT
314void sim_backlight(int value)
315{
316 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
317}
318#endif
319
320#ifdef HAVE_REMOTE_LCD
321void sim_remote_backlight(int value)
322{
323 DEBUGF("remote backlight: %s\n", (value > 0) ? "on" : "off");
324}
325#endif
326
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h
deleted file mode 100644
index b3533ad0cb..0000000000
--- a/uisimulator/win32/lcd-win32.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __LCDWIN32_H__
21#define __LCDWIN32_H__
22
23#include "uisw32.h"
24#include "lcd.h"
25
26// BITMAPINFO256
27typedef struct
28{
29 BITMAPINFOHEADER bmiHeader;
30 RGBQUAD bmiColors[256];
31} BITMAPINFO256;
32
33#if LCD_DEPTH <= 8
34extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
35#elif LCD_DEPTH <= 16
36extern unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
37#endif
38extern BITMAPINFO256 bmi; // bitmap information
39
40#ifdef HAVE_REMOTE_LCD
41extern unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH];
42extern BITMAPINFO256 remote_bmi; // bitmap information
43#endif
44
45void simlcdinit(void);
46
47#endif // #ifndef __LCDWIN32_H__
diff --git a/uisimulator/win32/panic-win32.c b/uisimulator/win32/panic-win32.c
deleted file mode 100644
index 614510f3a8..0000000000
--- a/uisimulator/win32/panic-win32.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include "debug.h"
22
23char panic_buf[128];
24
25// panic
26// whatever it says ;)
27void panic( char *message )
28{
29 debugf ( message );
30 PostQuitMessage (-1);
31}
32
33
34// panicf
35// formatted panic
36void panicf( char *fmt, ...)
37{
38 va_list ap;
39 va_start( ap, fmt );
40 wsprintf( panic_buf, fmt, ap );
41 va_end( ap );
42 panic( panic_buf );
43}
diff --git a/uisimulator/win32/plugin-win32.h b/uisimulator/win32/plugin-win32.h
deleted file mode 100644
index dd1c79080b..0000000000
--- a/uisimulator/win32/plugin-win32.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef _PLUGIN_WIN32_H_
21#define _PLUGIN_WIN32_H_
22
23#define BOOL win32_BOOL /* Avoid conflicts with BOOL/INT defined as */
24#define INT win32_INT /* enum values in settings.h */
25
26#include <windows.h>
27#include "plugin.h"
28#include "file.h"
29
30#define RTLD_NOW 0
31
32#undef filesize
33#define filesize win32_filesize
34
35#undef ftruncate
36#define ftruncate NULL
37
38typedef enum plugin_status (*plugin_fn)(struct plugin_api* api, void* param);
39
40#define dlopen(_x_, _y_) LoadLibrary(_x_)
41#define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_)
42#define dlclose(_x_) FreeLibrary(_x_)
43#define dlerror() "Unknown"
44
45int strcasecmp (const char *a, const char *b);
46int strncasecmp (const char *a, const char *b, size_t n);
47
48#endif
diff --git a/uisimulator/win32/plugin.def b/uisimulator/win32/plugin.def
deleted file mode 100755
index e37ce20d8f..0000000000
--- a/uisimulator/win32/plugin.def
+++ /dev/null
@@ -1,2 +0,0 @@
1EXPORTS
2 __header
diff --git a/uisimulator/win32/resource.h b/uisimulator/win32/resource.h
deleted file mode 100644
index dc8a238d78..0000000000
--- a/uisimulator/win32/resource.h
+++ /dev/null
@@ -1,19 +0,0 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Visual C++ generated include file.
3// Used by uisw32.rc
4//
5#define IDB_BITMAP1 102
6#define IDR_JPG1 103
7#define IDB_BITMAP2 104
8#define IDB_UI 104
9
10// Next default values for new objects
11//
12#ifdef APSTUDIO_INVOKED
13#ifndef APSTUDIO_READONLY_SYMBOLS
14#define _APS_NEXT_RESOURCE_VALUE 105
15#define _APS_NEXT_COMMAND_VALUE 40001
16#define _APS_NEXT_CONTROL_VALUE 1001
17#define _APS_NEXT_SYMED_VALUE 101
18#endif
19#endif
diff --git a/uisimulator/win32/rockbox.dsp b/uisimulator/win32/rockbox.dsp
deleted file mode 100644
index ae43fdf7bb..0000000000
--- a/uisimulator/win32/rockbox.dsp
+++ /dev/null
@@ -1,626 +0,0 @@
1# Microsoft Developer Studio Project File - Name="rockbox" - Package Owner=<4>
2# Microsoft Developer Studio Generated Build File, Format Version 6.00
3# ** DO NOT EDIT **
4
5# TARGTYPE "Win32 (x86) Application" 0x0101
6
7CFG=rockbox - Win32 Player
8!MESSAGE This is not a valid makefile. To build this project using NMAKE,
9!MESSAGE use the Export Makefile command and run
10!MESSAGE
11!MESSAGE NMAKE /f "rockbox.mak".
12!MESSAGE
13!MESSAGE You can specify a configuration when running NMAKE
14!MESSAGE by defining the macro CFG on the command line. For example:
15!MESSAGE
16!MESSAGE NMAKE /f "rockbox.mak" CFG="rockbox - Win32 Player"
17!MESSAGE
18!MESSAGE Possible choices for configuration are:
19!MESSAGE
20!MESSAGE "rockbox - Win32 Recorder" (based on "Win32 (x86) Application")
21!MESSAGE "rockbox - Win32 Player" (based on "Win32 (x86) Application")
22!MESSAGE
23
24# Begin Project
25# PROP AllowPerConfigDependencies 0
26# PROP Scc_ProjName ""
27# PROP Scc_LocalPath ""
28CPP=cl.exe
29MTL=midl.exe
30RSC=rc.exe
31
32!IF "$(CFG)" == "rockbox - Win32 Recorder"
33
34# PROP BASE Use_MFC 0
35# PROP BASE Use_Debug_Libraries 1
36# PROP BASE Output_Dir "rockbox___Win32_Recorder"
37# PROP BASE Intermediate_Dir "rockbox___Win32_Recorder"
38# PROP BASE Target_Dir ""
39# PROP Use_MFC 0
40# PROP Use_Debug_Libraries 1
41# PROP Output_Dir "rockbox___Win32_Recorder"
42# PROP Intermediate_Dir "rockbox___Win32_Recorder"
43# PROP Ignore_Export_Lib 0
44# PROP Target_Dir ""
45# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
46# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../win32" /I "../../apps/recorder" /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../../apps" /D "ARCHOS_RECORDER" /D "HAVE_LCD_BITMAP" /D "HAVE_RECORDER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D "HAVE_RTC" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c
47# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
48# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
49# ADD BASE RSC /l 0x407 /d "_DEBUG"
50# ADD RSC /l 0x407 /d "_DEBUG"
51BSC32=bscmake.exe
52# ADD BASE BSC32 /nologo
53# ADD BSC32 /nologo
54LINK32=link.exe
55# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
56# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libcmtd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /pdbtype:sept
57
58!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
59
60# PROP BASE Use_MFC 0
61# PROP BASE Use_Debug_Libraries 1
62# PROP BASE Output_Dir "rockbox___Win32_Player"
63# PROP BASE Intermediate_Dir "rockbox___Win32_Player"
64# PROP BASE Target_Dir ""
65# PROP Use_MFC 0
66# PROP Use_Debug_Libraries 1
67# PROP Output_Dir "rockbox___Win32_Player"
68# PROP Intermediate_Dir "rockbox___Win32_Player"
69# PROP Ignore_Export_Lib 0
70# PROP Target_Dir ""
71# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
72# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../win32" /I "../../apps/player" /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../../apps" /D "ARCHOS_PLAYER" /D "HAVE_LCD_CHARCELLS" /D "HAVE_PLAYER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c
73# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
74# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75# ADD BASE RSC /l 0x407 /d "_DEBUG"
76# ADD RSC /l 0x407 /d "_DEBUG"
77BSC32=bscmake.exe
78# ADD BASE BSC32 /nologo
79# ADD BSC32 /nologo
80LINK32=link.exe
81# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
82# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libcmtd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /pdbtype:sept
83
84!ENDIF
85
86# Begin Target
87
88# Name "rockbox - Win32 Recorder"
89# Name "rockbox - Win32 Player"
90# Begin Group "Firmware"
91
92# PROP Default_Filter ""
93# Begin Source File
94
95SOURCE=..\..\firmware\buffer.c
96# End Source File
97# Begin Source File
98
99SOURCE=..\..\firmware\font.c
100
101!IF "$(CFG)" == "rockbox - Win32 Recorder"
102
103!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
104
105# PROP Exclude_From_Build 1
106
107!ENDIF
108
109# End Source File
110# Begin Source File
111
112SOURCE=..\..\firmware\id3.c
113# End Source File
114# Begin Source File
115
116SOURCE=..\..\firmware\mp3_playback.c
117# End Source File
118# Begin Source File
119
120SOURCE=..\..\firmware\mp3data.c
121# End Source File
122# Begin Source File
123
124SOURCE=..\..\firmware\mpeg.c
125# End Source File
126# Begin Source File
127
128SOURCE=..\..\firmware\powermgmt.c
129# End Source File
130# Begin Source File
131
132SOURCE=..\..\firmware\usb.c
133# End Source File
134# End Group
135# Begin Group "Drivers"
136
137# PROP Default_Filter ""
138# Begin Source File
139
140SOURCE="..\..\firmware\drivers\lcd-player-charset.c"
141
142!IF "$(CFG)" == "rockbox - Win32 Recorder"
143
144# PROP Exclude_From_Build 1
145
146!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
147
148!ENDIF
149
150# End Source File
151# Begin Source File
152
153SOURCE="..\..\firmware\drivers\lcd-player.c"
154
155!IF "$(CFG)" == "rockbox - Win32 Recorder"
156
157# PROP Exclude_From_Build 1
158
159!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
160
161!ENDIF
162
163# End Source File
164# Begin Source File
165
166SOURCE="..\common\lcd-playersim.c"
167
168!IF "$(CFG)" == "rockbox - Win32 Recorder"
169
170# PROP Exclude_From_Build 1
171
172!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
173
174!ENDIF
175
176# End Source File
177# Begin Source File
178
179SOURCE="..\..\firmware\drivers\lcd-recorder.c"
180
181!IF "$(CFG)" == "rockbox - Win32 Recorder"
182
183!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
184
185# PROP Exclude_From_Build 1
186
187!ENDIF
188
189# End Source File
190# Begin Source File
191
192SOURCE=..\..\firmware\drivers\power.c
193# End Source File
194# End Group
195# Begin Group "Common"
196
197# PROP Default_Filter ""
198# Begin Source File
199
200SOURCE=..\..\firmware\common\errno.c
201# End Source File
202# Begin Source File
203
204SOURCE=..\..\firmware\common\random.c
205# End Source File
206# Begin Source File
207
208SOURCE=..\..\firmware\common\sprintf.c
209# End Source File
210# Begin Source File
211
212SOURCE=..\..\firmware\common\strtok.c
213# End Source File
214# Begin Source File
215
216SOURCE=..\..\firmware\common\timefuncs.c
217# End Source File
218# End Group
219# Begin Group "Apps"
220
221# PROP Default_Filter ""
222# Begin Group "Player"
223
224# PROP Default_Filter ""
225# Begin Source File
226
227SOURCE=..\..\apps\player\icons.c
228
229!IF "$(CFG)" == "rockbox - Win32 Recorder"
230
231# PROP Exclude_From_Build 1
232
233!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
234
235!ENDIF
236
237# End Source File
238# Begin Source File
239
240SOURCE=..\..\apps\player\icons.h
241
242!IF "$(CFG)" == "rockbox - Win32 Recorder"
243
244# PROP Exclude_From_Build 1
245
246!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
247
248!ENDIF
249
250# End Source File
251# Begin Source File
252
253SOURCE=..\..\apps\player\keyboard.c
254
255!IF "$(CFG)" == "rockbox - Win32 Recorder"
256
257# PROP Exclude_From_Build 1
258
259!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
260
261!ENDIF
262
263# End Source File
264# End Group
265# Begin Group "Recorder"
266
267# PROP Default_Filter ""
268# Begin Source File
269
270SOURCE=..\..\apps\recorder\bmp.c
271
272!IF "$(CFG)" == "rockbox - Win32 Recorder"
273
274!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
275
276# PROP Exclude_From_Build 1
277
278!ENDIF
279
280# End Source File
281# Begin Source File
282
283SOURCE=..\..\apps\recorder\icons.c
284
285!IF "$(CFG)" == "rockbox - Win32 Recorder"
286
287!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
288
289# PROP Exclude_From_Build 1
290
291!ENDIF
292
293# End Source File
294# Begin Source File
295
296SOURCE=..\..\apps\recorder\keyboard.c
297
298!IF "$(CFG)" == "rockbox - Win32 Recorder"
299
300!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
301
302# PROP Exclude_From_Build 1
303
304!ENDIF
305
306# End Source File
307# Begin Source File
308
309SOURCE=..\..\apps\recorder\peakmeter.c
310
311!IF "$(CFG)" == "rockbox - Win32 Recorder"
312
313!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
314
315# PROP Exclude_From_Build 1
316
317!ENDIF
318
319# End Source File
320# Begin Source File
321
322SOURCE=..\..\apps\recorder\widgets.c
323
324!IF "$(CFG)" == "rockbox - Win32 Recorder"
325
326!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
327
328# PROP Exclude_From_Build 1
329
330!ENDIF
331
332# End Source File
333# End Group
334# Begin Source File
335
336SOURCE=..\..\apps\alarm_menu.c
337# End Source File
338# Begin Source File
339
340SOURCE=..\..\apps\bookmark.c
341# End Source File
342# Begin Source File
343
344SOURCE=..\..\apps\credits.c
345# End Source File
346# Begin Source File
347
348SOURCE=..\..\apps\debug_menu.c
349# End Source File
350# Begin Source File
351
352SOURCE=..\..\apps\filetypes.c
353# End Source File
354# Begin Source File
355
356SOURCE=..\..\apps\language.c
357# End Source File
358# Begin Source File
359
360SOURCE=..\..\apps\main.c
361# End Source File
362# Begin Source File
363
364SOURCE=..\..\apps\main_menu.c
365# End Source File
366# Begin Source File
367
368SOURCE=..\..\apps\menu.c
369# End Source File
370# Begin Source File
371
372SOURCE=..\..\apps\misc.c
373# End Source File
374# Begin Source File
375
376SOURCE=..\..\apps\onplay.c
377# End Source File
378# Begin Source File
379
380SOURCE=..\..\apps\playlist.c
381# End Source File
382# Begin Source File
383
384SOURCE=..\..\apps\playlist_menu.c
385# End Source File
386# Begin Source File
387
388SOURCE=..\..\apps\playlist_viewer.c
389# End Source File
390# Begin Source File
391
392SOURCE=..\..\apps\plugin.c
393# End Source File
394# Begin Source File
395
396SOURCE=..\..\apps\screens.c
397# End Source File
398# Begin Source File
399
400SOURCE=..\..\apps\settings.c
401# End Source File
402# Begin Source File
403
404SOURCE=..\..\apps\settings_menu.c
405# End Source File
406# Begin Source File
407
408SOURCE=..\..\apps\sleeptimer.c
409# End Source File
410# Begin Source File
411
412SOURCE=..\..\apps\sound_menu.c
413# End Source File
414# Begin Source File
415
416SOURCE=..\..\apps\status.c
417# End Source File
418# Begin Source File
419
420SOURCE=..\..\apps\tree.c
421# End Source File
422# Begin Source File
423
424SOURCE="..\..\apps\wps-display.c"
425# End Source File
426# Begin Source File
427
428SOURCE=..\..\apps\wps.c
429# End Source File
430# End Group
431# Begin Group "Win32"
432
433# PROP Default_Filter ""
434# Begin Group "AppsCommon"
435
436# PROP Default_Filter ""
437# Begin Source File
438
439SOURCE="..\common\lcd-common.c"
440# End Source File
441# Begin Source File
442
443SOURCE=..\common\mpegplay.c
444# End Source File
445# Begin Source File
446
447SOURCE=..\common\sim_icons.c
448# End Source File
449# Begin Source File
450
451SOURCE=..\common\stubs.c
452# End Source File
453# End Group
454# Begin Source File
455
456SOURCE=.\button.c
457# End Source File
458# Begin Source File
459
460SOURCE=".\debug-win32.c"
461# End Source File
462# Begin Source File
463
464SOURCE=".\dir-win32.c"
465# End Source File
466# Begin Source File
467
468SOURCE="..\common\font-player.c"
469
470!IF "$(CFG)" == "rockbox - Win32 Recorder"
471
472# PROP Exclude_From_Build 1
473
474!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
475
476!ENDIF
477
478# End Source File
479# Begin Source File
480
481SOURCE=..\common\io.c
482# End Source File
483# Begin Source File
484
485SOURCE=.\kernel.c
486# End Source File
487# Begin Source File
488
489SOURCE=.\lang.c
490# End Source File
491# Begin Source File
492
493SOURCE=".\lcd-win32.c"
494# End Source File
495# Begin Source File
496
497SOURCE=".\mpeg-win32.c"
498# End Source File
499# Begin Source File
500
501SOURCE=".\panic-win32.c"
502# End Source File
503# Begin Source File
504
505SOURCE=".\string-win32.c"
506# End Source File
507# Begin Source File
508
509SOURCE=.\sysfont.c
510# End Source File
511# Begin Source File
512
513SOURCE=".\thread-win32.c"
514# End Source File
515# Begin Source File
516
517SOURCE=.\uisw32.c
518# End Source File
519# End Group
520# Begin Group "Resource Files"
521
522# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
523# Begin Source File
524
525SOURCE=.\uisw32.rc
526# End Source File
527# End Group
528# Begin Group "Script inputs"
529
530# PROP Default_Filter ""
531# Begin Source File
532
533SOURCE=..\..\firmware\fonts\clR6x8.bdf
534
535!IF "$(CFG)" == "rockbox - Win32 Recorder"
536
537# Begin Custom Build - Creating font from $(InputPath)
538InputPath=..\..\firmware\fonts\clR6x8.bdf
539
540"sysfont.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
541 ..\..\tools\convbdf -c -o sysfont.c $(InputPath)
542
543# End Custom Build
544
545!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
546
547# Begin Custom Build - Creating font from $(InputPath)
548InputPath=..\..\firmware\fonts\clR6x8.bdf
549
550"sysfont.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
551 ..\..\tools\convbdf -c -o sysfont.c $(InputPath)
552
553# End Custom Build
554
555!ENDIF
556
557# End Source File
558# Begin Source File
559
560SOURCE=..\..\docs\CREDITS
561
562!IF "$(CFG)" == "rockbox - Win32 Recorder"
563
564# PROP Ignore_Default_Tool 1
565# Begin Custom Build - Creating credits from $(InputPath)
566InputPath=..\..\docs\CREDITS
567
568"../../apps/credits.raw" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
569 perl ../../apps/credits.pl < $(InputPath) > ../../apps/credits.raw
570
571# End Custom Build
572
573!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
574
575# PROP Ignore_Default_Tool 1
576# Begin Custom Build - Creating credits from $(InputPath)
577InputPath=..\..\docs\CREDITS
578
579"../../apps/credits.raw" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
580 perl ../../apps/credits.pl < $(InputPath) > ../../apps/credits.raw
581
582# End Custom Build
583
584!ENDIF
585
586# End Source File
587# Begin Source File
588
589SOURCE=..\..\apps\lang\english.lang
590
591!IF "$(CFG)" == "rockbox - Win32 Recorder"
592
593# Begin Custom Build - Creating language files from $(InputPath)
594InputPath=..\..\apps\lang\english.lang
595
596BuildCmds= \
597 perl -s ..\..\tools\genlang -p=lang $(InputPath)
598
599"lang.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
600 $(BuildCmds)
601
602"lang.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
603 $(BuildCmds)
604# End Custom Build
605
606!ELSEIF "$(CFG)" == "rockbox - Win32 Player"
607
608# Begin Custom Build - Creating language files from $(InputPath)
609InputPath=..\..\apps\lang\english.lang
610
611BuildCmds= \
612 perl -s ..\..\tools\genlang -p=lang $(InputPath)
613
614"lang.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
615 $(BuildCmds)
616
617"lang.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
618 $(BuildCmds)
619# End Custom Build
620
621!ENDIF
622
623# End Source File
624# End Group
625# End Target
626# End Project
diff --git a/uisimulator/win32/rockbox.ico b/uisimulator/win32/rockbox.ico
deleted file mode 100644
index 0769e6aec8..0000000000
--- a/uisimulator/win32/rockbox.ico
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/sound.c b/uisimulator/win32/sound.c
deleted file mode 100644
index 54140f59e4..0000000000
--- a/uisimulator/win32/sound.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Magnus Holmgren
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "autoconf.h"
21
22#ifdef ROCKBOX_HAS_SIMSOUND
23
24#define WINDOWS_LEAN_AND_MEAN
25#include <windows.h>
26
27#include <stdio.h>
28#include <stdlib.h>
29#include <stdbool.h>
30
31#include "sound.h"
32#include "kernel.h"
33#include "thread-win32.h"
34#include "debug.h"
35
36static bool playing = false;
37
38void pcm_play_stop(void);
39
40static void sound_play_chunk(HWAVEOUT wave_out, LPWAVEHDR header,
41 HANDLE event)
42{
43 unsigned char* buf;
44 long len;
45
46 if (!(header->dwFlags & WHDR_DONE) || !sound_get_pcm)
47 {
48 return;
49 }
50
51 EnterCriticalSection(&CriticalSection);
52 sound_get_pcm(&buf, &len);
53 LeaveCriticalSection(&CriticalSection);
54
55 if (len == 0)
56 {
57 DEBUGF("simulator got no pcm\n");
58 sound_get_pcm = NULL;
59 return;
60 }
61
62 header->lpData = buf;
63 header->dwBufferLength = len;
64 header->dwBytesRecorded = 0;
65 header->dwUser = 0;
66 header->dwFlags = 0;
67 header->dwLoops = 1;
68 header->lpNext = NULL;
69 header->reserved = 0;
70
71 if (MMSYSERR_NOERROR != waveOutPrepareHeader(wave_out, header,
72 sizeof(*header)))
73 {
74 return;
75 }
76
77 ResetEvent(event);
78
79 waveOutWrite(wave_out, header, sizeof(*header));
80}
81
82static int sound_init(LPHWAVEOUT wave_out, HANDLE event)
83{
84 static const WAVEFORMATEX format =
85 {
86 WAVE_FORMAT_PCM, /* Format */
87 2, /* Number of channels */
88 44100, /* Samples per second */
89 44100 * 4, /* Bytes per second */
90 4, /* Block align */
91 16, /* Bits per sample */
92 0 /* Extra size */
93 };
94
95 if (MMSYSERR_NOERROR != waveOutOpen(wave_out, WAVE_MAPPER, &format,
96 (DWORD_PTR) event, 0, CALLBACK_EVENT))
97 {
98 return -1;
99 }
100
101 /* Full volume on left and right */
102 waveOutSetVolume(*wave_out, 0xffffffff);
103
104 return 0;
105}
106
107void sound_playback_thread(void)
108{
109 /* To get smooth playback, two buffers are needed, which are queued for
110 * playback. (There can still be glitches though.)
111 */
112 HWAVEOUT wave_out;
113 WAVEHDR header1;
114 WAVEHDR header2;
115 HANDLE event;
116 int result = -1;
117
118 if ((event = CreateEvent(NULL, FALSE, FALSE, NULL)))
119 {
120 result = sound_init(&wave_out, event);
121 }
122
123 while(-1 == result || !event)
124 {
125 Sleep(100000); /* Wait forever, can't play sound! */
126 }
127
128 while (true)
129 {
130 while (!sound_get_pcm)
131 {
132 /* TODO: fix a fine thread-synch mechanism here */
133 Sleep(100);
134 }
135
136 DEBUGF("starting simulator playback\n");
137 header1.dwFlags = WHDR_DONE;
138 header2.dwFlags = WHDR_DONE;
139 sound_play_chunk(wave_out, &header1, event);
140 sound_play_chunk(wave_out, &header2, event);
141
142 while (sound_get_pcm
143 && (WAIT_FAILED != WaitForSingleObject(event, 1000)))
144 {
145 sound_play_chunk(wave_out, &header1, event);
146 sound_play_chunk(wave_out, &header2, event);
147 }
148
149 pcm_play_stop();
150
151 DEBUGF("stopping simulator playback\n");
152
153 waveOutReset(wave_out);
154 }
155}
156
157
158/* Stubs for PCM audio playback. */
159bool pcm_is_playing(void)
160{
161 return playing;
162}
163
164void pcm_mute(bool state)
165{
166 (void)state;
167}
168
169void pcm_play_pause(bool state)
170{
171 (void)state;
172}
173
174bool pcm_is_paused(void)
175{
176 return false;
177}
178
179void pcm_play_stop(void)
180{
181 playing = false;
182}
183
184void pcm_init(void)
185{
186}
187
188void (*sound_get_pcm)(unsigned char** start, long* size);
189void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
190{
191 sound_get_pcm = get_more;
192 playing = true;
193}
194
195long pcm_get_bytes_waiting(void)
196{
197 return 0;
198}
199
200
201#endif /* ROCKBOX_HAS_SIMSOUND */
diff --git a/uisimulator/win32/sound.h b/uisimulator/win32/sound.h
deleted file mode 100644
index 87499cac8e..0000000000
--- a/uisimulator/win32/sound.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20void sound_playback_thread(void);
21
22extern void (*sound_get_pcm)(unsigned char** start, long* size);
diff --git a/uisimulator/win32/sprintf.h b/uisimulator/win32/sprintf.h
deleted file mode 100644
index 24e1d4e352..0000000000
--- a/uisimulator/win32/sprintf.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __SPRINTF_H__
21#define __SPRINTF_H__
22
23#include <stddef.h>
24#include <stdarg.h>
25#include <stdio.h>
26
27int snprintf (char *buf, size_t size, const char *fmt, ...);
28char *strtok_r (char *, const char *, char **);
29
30int rockbox_fprintf (int fd, const char *fmt, ...);
31#define fprintf rockbox_fprintf
32
33int rockbox_vsnprintf (char *buf, int size, const char *fmt, va_list ap);
34#define vsnprintf rockbox_vsnprintf
35
36#endif /* __SPRINTF_H__ */
diff --git a/uisimulator/win32/stdbool.h b/uisimulator/win32/stdbool.h
deleted file mode 100644
index d91ef374b9..0000000000
--- a/uisimulator/win32/stdbool.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __STDBOOL_H__
21#define __STDBOOL_H__ 1
22
23#ifndef __MINGW32__
24typedef unsigned int bool;
25#define __attribute__(s)
26
27#define true 1
28#define false 0
29#else
30
31typedef enum
32{
33 false = 0,
34 true = 1
35} bool;
36
37#define false false
38#define true true
39
40/* Signal that all the definitions are present. */
41#define __bool_true_false_are_defined 1
42
43#endif
44
45#endif /* __STDBOOL_H__ */
46
diff --git a/uisimulator/win32/string-win32.c b/uisimulator/win32/string-win32.c
deleted file mode 100644
index ced1a410ca..0000000000
--- a/uisimulator/win32/string-win32.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __MINGW32__
21
22#include <string.h>
23
24int strcasecmp (const char *a, const char *b)
25{
26 return stricmp (a, b);
27}
28
29int strncasecmp (const char *a, const char *b, size_t n)
30{
31 return _strnicmp (a, b, n);
32}
33
34#endif
diff --git a/uisimulator/win32/thread-win32.c b/uisimulator/win32/thread-win32.c
deleted file mode 100644
index 7c33017c7e..0000000000
--- a/uisimulator/win32/thread-win32.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#define WINDOWS_LEAN_AND_MEAN
21#include <windows.h>
22#include <time.h>
23#include "thread-win32.h"
24#include "kernel.h"
25#include "debug.h"
26
27HANDLE lpThreads[256];
28int nThreads = 0,
29 nPos = 0;
30long current_tick = 0;
31CRITICAL_SECTION CriticalSection;
32
33
34void yield(void)
35{
36 LeaveCriticalSection(&CriticalSection);
37 Sleep(1);
38 EnterCriticalSection(&CriticalSection);
39}
40
41void sim_sleep(int ticks)
42{
43 LeaveCriticalSection(&CriticalSection);
44 Sleep((1000/HZ) * ticks);
45 EnterCriticalSection(&CriticalSection);
46}
47
48DWORD WINAPI runthread (LPVOID lpParameter)
49{
50 EnterCriticalSection(&CriticalSection);
51 ((void(*)())lpParameter) ();
52 LeaveCriticalSection(&CriticalSection);
53 return 0;
54}
55
56int create_thread(void (*fp)(void), void* sp, int stk_size)
57{
58 DWORD dwThreadID;
59
60 (void)sp;
61 (void)stk_size;
62
63 if (nThreads == 256)
64 return -1;
65
66 lpThreads[nThreads++] = CreateThread (NULL,
67 0,
68 runthread,
69 fp,
70 0,
71 &dwThreadID);
72
73 return 0;
74}
75
76void init_threads(void)
77{
78 InitializeCriticalSection(&CriticalSection);
79 EnterCriticalSection(&CriticalSection);
80}
diff --git a/uisimulator/win32/thread-win32.h b/uisimulator/win32/thread-win32.h
deleted file mode 100644
index 467c47ee39..0000000000
--- a/uisimulator/win32/thread-win32.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20extern HANDLE lpThreads[256];
21extern int nPos,
22 nThreads;
23extern CRITICAL_SECTION CriticalSection;
diff --git a/uisimulator/win32/timefuncs.h b/uisimulator/win32/timefuncs.h
deleted file mode 100644
index 8fbc5b1c85..0000000000
--- a/uisimulator/win32/timefuncs.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#include <stdio.h>
2#include <time.h>
3#include <stdbool.h>
4
5/* struct tm defined */
6struct tm *get_time(void);
7int set_time(const struct tm *tm);
8bool valid_time(const struct tm *tm);
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c
deleted file mode 100644
index 1b4dbbd410..0000000000
--- a/uisimulator/win32/uisw32.c
+++ /dev/null
@@ -1,344 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <windows.h>
21#include <process.h>
22#include <stdlib.h>
23#include <fcntl.h>
24#include "autoconf.h"
25#include "uisw32.h"
26#include "resource.h"
27#include "button.h"
28#include "thread.h"
29#include "thread-win32.h"
30#include "kernel.h"
31#include "sound.h"
32
33#ifndef LR_VGACOLOR /* Should be under MINGW32 builds? */
34#define LR_VGACOLOR LR_COLOR
35#endif
36
37// extern functions
38extern void app_main (void *); // mod entry point
39extern void new_key(int key);
40extern void sim_tick_tasks(void);
41
42void button_event(int key, bool pressed);
43
44// variables
45HWND hGUIWnd; // the GUI window handle
46unsigned int uThreadID; // id of mod thread
47PBYTE lpKeys;
48bool bActive; // window active?
49HANDLE hGUIThread; // thread for GUI
50#ifdef ROCKBOX_HAS_SIMSOUND
51HANDLE hSoundThread; // thread for sound
52#endif
53bool bIsWinNT; // Windows NT derivate?
54
55bool lcd_display_redraw=true; // Used for player simulator
56char having_new_lcd=true; // Used for player simulator
57
58// GUIWndProc
59// window proc for GUI simulator
60LRESULT CALLBACK GUIWndProc (
61 HWND hWnd,
62 UINT uMsg,
63 WPARAM wParam,
64 LPARAM lParam
65 )
66{
67 static HBITMAP hBkgnd;
68 static HDC hMemDc;
69
70 static LARGE_INTEGER persec, tick1, ticknow;
71 long new_tick;
72
73 switch (uMsg)
74 {
75 case WM_TIMER:
76 QueryPerformanceCounter(&ticknow);
77 new_tick = ((ticknow.QuadPart-tick1.QuadPart)*HZ)/persec.QuadPart;
78 if (new_tick != current_tick)
79 {
80 long i;
81 for (i = new_tick - current_tick; i > 0; i--)
82 sim_tick_tasks();
83 current_tick = new_tick;
84 }
85 return TRUE;
86 case WM_ACTIVATE:
87 if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE)
88 bActive = true;
89 else
90 bActive = false;
91 return TRUE;
92 case WM_CREATE:
93 QueryPerformanceFrequency(&persec);
94 QueryPerformanceCounter(&tick1);
95 SetTimer (hWnd, TIMER_EVENT, 1, NULL);
96
97 // load background image
98 hBkgnd = (HBITMAP)LoadImage (GetModuleHandle (NULL),
99 MAKEINTRESOURCE(IDB_UI), IMAGE_BITMAP, 0, 0, LR_VGACOLOR);
100 hMemDc = CreateCompatibleDC (GetDC (hWnd));
101 SelectObject (hMemDc, hBkgnd);
102 return TRUE;
103 case WM_SIZING:
104 {
105 LPRECT r = (LPRECT)lParam;
106 char s[256];
107 int v;
108 int h_add = GetSystemMetrics (SM_CXSIZEFRAME) * 2 + 4;
109 int v_add = GetSystemMetrics (SM_CYSIZEFRAME) * 2
110 + GetSystemMetrics (SM_CYCAPTION) + 4;
111
112 switch (wParam)
113 {
114 case WMSZ_BOTTOM:
115 v = (r->bottom - r->top) / (UI_HEIGHT / 5);
116 r->bottom = r->top + v * UI_HEIGHT / 5 + v_add;
117 r->right = r->left + v * UI_WIDTH / 5 + h_add;
118 break;
119 case WMSZ_RIGHT:
120 v = (r->right - r->left) / (UI_WIDTH / 5);
121 r->bottom = r->top + v * UI_HEIGHT / 5 + v_add;
122 r->right = r->left + v * UI_WIDTH / 5 + h_add;
123 break;
124 case WMSZ_TOP:
125 v = (r->bottom - r->top) / (UI_HEIGHT / 5);
126 r->top = r->bottom - v * UI_HEIGHT / 5 - v_add;
127 r->right = r->left + v * UI_WIDTH / 5 + h_add;
128 break;
129 case WMSZ_LEFT:
130 v = (r->right - r->left) / (UI_WIDTH / 5);
131 r->bottom = r->top + v * UI_HEIGHT / 5 + v_add;
132 r->left = r->right - v * UI_WIDTH / 5 - h_add;
133 break;
134 case WMSZ_BOTTOMRIGHT:
135 v = ((r->right - r->left) * UI_HEIGHT
136 +(r->bottom - r->top) * UI_WIDTH)
137 / (2 * UI_WIDTH * UI_HEIGHT / 5);
138 r->bottom = r->top + v * UI_HEIGHT / 5 + v_add;
139 r->right = r->left + v * UI_WIDTH / 5 + h_add;
140 break;
141 case WMSZ_BOTTOMLEFT:
142 v = ((r->right - r->left) * UI_HEIGHT
143 +(r->bottom - r->top) * UI_WIDTH)
144 / (2 * UI_WIDTH * UI_HEIGHT / 5);
145 r->bottom = r->top + v * UI_HEIGHT / 5 + v_add;
146 r->left = r->right - v * UI_WIDTH / 5 - h_add;
147 break;
148 case WMSZ_TOPRIGHT:
149 v = ((r->right - r->left) * UI_HEIGHT
150 +(r->bottom - r->top) * UI_WIDTH)
151 / (2 * UI_WIDTH * UI_HEIGHT / 5);
152 r->top = r->bottom - v * UI_HEIGHT / 5 - v_add;
153 r->right = r->left + v * UI_WIDTH / 5 + h_add;
154 break;
155 case WMSZ_TOPLEFT:
156 v = ((r->right - r->left) * UI_HEIGHT
157 +(r->bottom - r->top) * UI_WIDTH)
158 / (2 * UI_WIDTH * UI_HEIGHT / 5);
159 r->top = r->bottom - v * UI_HEIGHT / 5 - v_add;
160 r->left = r->right - v * UI_WIDTH / 5 - h_add;
161 break;
162 }
163
164 wsprintf (s, UI_TITLE " @%d%%",
165 (r->right - r->left - h_add + 1) * 100 / UI_WIDTH);
166 SetWindowText (hWnd, s);
167
168 return TRUE;
169 }
170 case WM_ERASEBKGND:
171 {
172 HDC hDc = (HDC) wParam;
173 RECT r;
174
175 GetClientRect (hWnd, &r);
176 // blit background image to screen
177 SetStretchBltMode(hDc, bIsWinNT ? HALFTONE : COLORONCOLOR);
178 StretchBlt (hDc, 0, 0, r.right, r.bottom,
179 hMemDc, 0, 0, UI_WIDTH, UI_HEIGHT, SRCCOPY);
180 return TRUE;
181 }
182 case WM_PAINT:
183 {
184 PAINTSTRUCT ps;
185 RECT r;
186 HDC hDc = BeginPaint (hWnd, &ps);
187
188 GetClientRect (hWnd, &r);
189 // draw lcd screen
190 SetStretchBltMode(hDc, bIsWinNT ? HALFTONE : COLORONCOLOR);
191 StretchDIBits (hDc,
192 UI_LCD_POSX * r.right / UI_WIDTH,
193 UI_LCD_POSY * r.bottom / UI_HEIGHT,
194 UI_LCD_WIDTH * r.right / UI_WIDTH,
195 UI_LCD_HEIGHT * r.bottom / UI_HEIGHT,
196 0, 0, LCD_WIDTH, LCD_HEIGHT,
197 bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS,
198 SRCCOPY);
199#ifdef HAVE_REMOTE_LCD
200 StretchDIBits (hDc,
201 UI_REMOTE_POSX * r.right / UI_WIDTH,
202 UI_REMOTE_POSY * r.bottom / UI_HEIGHT,
203 UI_REMOTE_WIDTH * r.right / UI_WIDTH,
204 UI_REMOTE_HEIGHT * r.bottom / UI_HEIGHT,
205 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
206 remote_bitmap, (BITMAPINFO *) &remote_bmi,
207 DIB_RGB_COLORS, SRCCOPY);
208#endif
209 EndPaint (hWnd, &ps);
210 return TRUE;
211 }
212 case WM_CLOSE:
213 // close simulator
214 KillTimer (hWnd, TIMER_EVENT);
215 hGUIWnd = NULL;
216 PostQuitMessage (0);
217 break;
218 case WM_DESTROY:
219 // close simulator
220 hGUIWnd = NULL;
221 PostQuitMessage (0);
222 break;
223 case WM_KEYDOWN:
224 button_event(wParam, true);
225 break;
226 case WM_KEYUP:
227 button_event(wParam, false);
228 break;
229 }
230
231 return DefWindowProc (hWnd, uMsg, wParam, lParam);
232}
233
234// GUIStartup
235// register window class, show window, init GUI
236BOOL GUIStartup ()
237{
238 WNDCLASS wc;
239
240 // create window class
241 ZeroMemory (&wc, sizeof(wc));
242 wc.hbrBackground = GetSysColorBrush (COLOR_WINDOW);
243 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
244 wc.hInstance = GetModuleHandle (NULL);
245 wc.lpfnWndProc = GUIWndProc;
246 wc.lpszClassName = "RockBoxUISimulator";
247 wc.style = CS_HREDRAW | CS_VREDRAW;
248
249 if (RegisterClass (&wc) == 0)
250 return FALSE;
251
252 // create window
253 hGUIWnd = CreateWindowEx (
254 WS_EX_OVERLAPPEDWINDOW,
255 "RockBoxUISimulator", UI_TITLE,
256 WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPEDWINDOW,
257 CW_USEDEFAULT, CW_USEDEFAULT,
258 UI_WIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2 +4,
259 UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
260 GetSystemMetrics (SM_CYCAPTION) +4,
261 NULL, NULL, GetModuleHandle (NULL), NULL);
262
263 if (hGUIWnd == NULL)
264 return FALSE;
265
266 simlcdinit();
267
268 return TRUE;
269}
270
271// GUIDown
272// destroy window, unregister window class
273int GUIDown ()
274{
275 int i;
276
277 DestroyWindow (hGUIWnd);
278 CloseHandle (hGUIThread);
279#ifdef ROCKBOX_HAS_SIMSOUND
280 CloseHandle (hSoundThread);
281#endif
282
283 for (i = 0; i < nThreads; i++)
284 {
285 CloseHandle (lpThreads[i]);
286 }
287 return 0;
288}
289
290// GUIMessageLoop
291// standard message loop for GUI window
292void GUIMessageLoop ()
293{
294 MSG msg;
295 while (GetMessage (&msg, NULL, 0, 0))
296 {
297 TranslateMessage (&msg);
298 DispatchMessage (&msg);
299 }
300}
301
302
303// WinMain
304// program entry point
305int WINAPI WinMain (
306 HINSTANCE hInstance, // current instance
307 HINSTANCE hPrevInstance, // previous instance
308 LPSTR lpCmd, // command line
309 int nShowCmd // show command
310 )
311{
312 DWORD dwThreadID;
313
314 (void)hInstance;
315 (void)hPrevInstance;
316 (void)lpCmd;
317 (void)nShowCmd;
318
319 /* default file mode should be O_BINARY to be consistent with rockbox */
320 _fmode = _O_BINARY;
321
322 bIsWinNT = ((GetVersion() & 0x80000000) == 0);
323
324 if (!GUIStartup ())
325 return 0;
326
327 hGUIThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)app_main,
328 NULL, 0, &dwThreadID);
329
330 if (hGUIThread == NULL)
331 return MessageBox (NULL, "Error creating gui thread!", "Error", MB_OK);
332
333#ifdef ROCKBOX_HAS_SIMSOUND
334 hSoundThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)
335 sound_playback_thread, NULL, 0, &dwThreadID);
336
337 if (hSoundThread == NULL)
338 MessageBox (NULL, "Error creating sound thread!", "Warning", MB_OK);
339#endif
340
341 GUIMessageLoop ();
342
343 return GUIDown ();
344}
diff --git a/uisimulator/win32/uisw32.h b/uisimulator/win32/uisw32.h
deleted file mode 100644
index 22a9015196..0000000000
--- a/uisimulator/win32/uisw32.h
+++ /dev/null
@@ -1,168 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __UISW32_H__
21#define __UISW32_H__
22
23#ifdef _MSC_VER
24typedef unsigned short wchar_t;
25#define _WCHAR_T_DEFINED
26#endif
27#include <windows.h>
28#include "lcd-win32.h"
29
30#if defined(ARCHOS_RECORDER)
31#define UI_TITLE "Jukebox Recorder"
32#define UI_WIDTH 270 // width of GUI window
33#define UI_HEIGHT 406 // height of GUI window
34#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
35#define UI_LCD_BGCOLORLIGHT 126, 229, 126 // bkgnd color of LCD (backlight)
36#define UI_LCD_BLACK 0, 0, 0 // black
37#define UI_LCD_POSX 80 // x position of lcd
38#define UI_LCD_POSY 104 // y position of lcd (96 for real aspect)
39#define UI_LCD_WIDTH 112
40#define UI_LCD_HEIGHT 64 // (80 for real aspect)
41
42#elif defined(ARCHOS_PLAYER)
43#define UI_TITLE "Jukebox Player"
44#define UI_WIDTH 284 // width of GUI window
45#define UI_HEIGHT 420 // height of GUI window
46#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
47#define UI_LCD_BGCOLORLIGHT 126, 229, 126 // bkgnd color of LCD (backlight)
48#define UI_LCD_BLACK 0, 0, 0 // black
49#define UI_LCD_POSX 75 // x position of lcd
50#define UI_LCD_POSY 116 // y position of lcd
51#define UI_LCD_WIDTH 132
52#define UI_LCD_HEIGHT 64
53
54#elif defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2)
55#define UI_TITLE "Jukebox FM Recorder"
56#define UI_WIDTH 285 // width of GUI window
57#define UI_HEIGHT 414 // height of GUI window
58#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
59#define UI_LCD_BGCOLORLIGHT 126, 229, 126 // bkgnd color of LCD (backlight)
60#define UI_LCD_BLACK 0, 0, 0 // black
61#define UI_LCD_POSX 87 // x position of lcd
62#define UI_LCD_POSY 77 // y position of lcd (69 for real aspect)
63#define UI_LCD_WIDTH 112
64#define UI_LCD_HEIGHT 64 // (80 for real aspect)
65
66#elif defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM)
67#define UI_TITLE "Ondio"
68#define UI_WIDTH 155 // width of GUI window
69#define UI_HEIGHT 334 // height of GUI window
70#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
71#define UI_LCD_BGCOLORLIGHT 90, 145, 90 // bkgnd color of LCD (backlight)
72#define UI_LCD_BLACK 0, 0, 0 // black
73#define UI_LCD_POSX 21 // x position of lcd
74#define UI_LCD_POSY 82 // y position of lcd (74 for real aspect)
75#define UI_LCD_WIDTH 112
76#define UI_LCD_HEIGHT 64 // (80 for real aspect)
77
78#elif defined(IRIVER_H100_SERIES)
79#define UI_TITLE "iriver H1x0"
80#define UI_WIDTH 379 // width of GUI window
81#define UI_HEIGHT 508 // height of GUI window
82#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
83#define UI_LCD_BGCOLORLIGHT 230, 216, 173 // bkgnd color of LCD (backlight)
84#define UI_LCD_BLACK 0, 0, 0 // black
85#define UI_LCD_POSX 109 // x position of lcd
86#define UI_LCD_POSY 23 // y position of lcd
87#define UI_LCD_WIDTH 160
88#define UI_LCD_HEIGHT 128
89#define UI_REMOTE_BGCOLOR 90, 145, 90 // bkgnd of remote lcd (no bklight)
90#define UI_REMOTE_BGCOLORLIGHT 250, 180, 130 // bkgnd of remote lcd (bklight)
91#define UI_REMOTE_POSX 50 // x position of remote lcd
92#define UI_REMOTE_POSY 403 // y position of remote lcd
93#define UI_REMOTE_WIDTH 128
94#define UI_REMOTE_HEIGHT 64
95
96#elif defined(IRIVER_H300_SERIES)
97#define UI_TITLE "iriver H300"
98#define UI_WIDTH 288 // width of GUI window
99#define UI_HEIGHT 581 // height of GUI window
100/* high-colour */
101#define UI_LCD_POSX 26 // x position of lcd
102#define UI_LCD_POSY 36 // y position of lcd
103#define UI_LCD_WIDTH 220
104#define UI_LCD_HEIGHT 176
105#define UI_REMOTE_BGCOLOR 90, 145, 90 // bkgnd of remote lcd (no bklight)
106#define UI_REMOTE_BGCOLORLIGHT 250, 180, 130 // bkgnd of remote lcd (bklight)
107#define UI_REMOTE_POSX 12 // x position of remote lcd
108#define UI_REMOTE_POSY 478 // y position of remote lcd
109#define UI_REMOTE_WIDTH 128
110#define UI_REMOTE_HEIGHT 64
111
112#elif defined(IPOD_4G)
113#define UI_TITLE "iPod 4G"
114#define UI_WIDTH 196 // width of GUI window
115#define UI_HEIGHT 370 // height of GUI window
116#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
117#define UI_LCD_BGCOLORLIGHT 173, 216, 230 // bkgnd color of LCD (backlight)
118#define UI_LCD_BLACK 0, 0, 0 // black
119#define UI_LCD_POSX 19 // x position of lcd
120#define UI_LCD_POSY 14 // y position of lcd
121#define UI_LCD_WIDTH 160
122#define UI_LCD_HEIGHT 128
123
124#elif defined(IPOD_COLOR)
125#define UI_TITLE "iPod Color"
126#define UI_WIDTH 261 // width of GUI window
127#define UI_HEIGHT 493 // height of GUI window
128/* high-colour */
129#define UI_LCD_POSX 21 // x position of lcd
130#define UI_LCD_POSY 16 // y position of lcd
131#define UI_LCD_WIDTH 220
132#define UI_LCD_HEIGHT 176
133
134#elif defined(IPOD_NANO)
135#define UI_TITLE "iPod Nano"
136#define UI_WIDTH 199 // width of GUI window
137#define UI_HEIGHT 421 // height of GUI window
138/* high-colour */
139#define UI_LCD_POSX 13 // x position of lcd
140#define UI_LCD_POSY 14 // y position of lcd
141#define UI_LCD_WIDTH 176
142#define UI_LCD_HEIGHT 132
143
144#elif defined(ARCHOS_GMINI120)
145#define UI_TITLE "Gmini 120"
146#define UI_WIDTH 370 // width of GUI window
147#define UI_HEIGHT 264 // height of GUI window
148#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
149#define UI_LCD_BGCOLORLIGHT 230, 160, 60 // bkgnd color of LCD (backlight)
150#define UI_LCD_BLACK 0, 0, 0 // black
151#define UI_LCD_POSX 85 // x position of lcd
152#define UI_LCD_POSY 61 // y position of lcd (74 for real aspect)
153#define UI_LCD_WIDTH 192 // * 1.5
154#define UI_LCD_HEIGHT 96 // * 1.5
155
156#endif
157
158#define TIMER_EVENT 0x34928340
159
160extern HWND hGUIWnd; // the GUI window handle
161extern unsigned int uThreadID; // id of mod thread
162extern bool bActive;
163
164// typedefs
165typedef unsigned char uchar;
166typedef unsigned int uint32;
167
168#endif // #ifndef __UISW32_H__
diff --git a/uisimulator/win32/uisw32.rc b/uisimulator/win32/uisw32.rc
deleted file mode 100644
index 379b76ecb1..0000000000
--- a/uisimulator/win32/uisw32.rc
+++ /dev/null
@@ -1,76 +0,0 @@
1// Microsoft Visual C++ generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10
11#ifndef __MINGW32__
12 #include "afxres.h"
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16#undef APSTUDIO_READONLY_SYMBOLS
17
18/////////////////////////////////////////////////////////////////////////////
19// English (U.S.) resources
20
21#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
22#ifdef _WIN32
23#ifndef __MINGW32__
24LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
25#endif
26#pragma code_page(1252)
27#endif //_WIN32
28
29#ifdef APSTUDIO_INVOKED
30/////////////////////////////////////////////////////////////////////////////
31//
32// TEXTINCLUDE
33//
34
351 TEXTINCLUDE
36BEGIN
37 "resource.h\0"
38END
39
402 TEXTINCLUDE
41BEGIN
42 "#include ""afxres.h""\r\n"
43 "\0"
44END
45
463 TEXTINCLUDE
47BEGIN
48 "\r\n"
49 "\0"
50END
51
52#endif // APSTUDIO_INVOKED
53
54
55/////////////////////////////////////////////////////////////////////////////
56//
57// Bitmap
58//
59
60IDB_UI BITMAP "UI256.bmp"
61IDI_ICON1 ICON DISCARDABLE "rockbox.ico"
62#endif // English (U.S.) resources
63/////////////////////////////////////////////////////////////////////////////
64
65
66
67#ifndef APSTUDIO_INVOKED
68/////////////////////////////////////////////////////////////////////////////
69//
70// Generated from the TEXTINCLUDE 3 resource.
71//
72
73
74/////////////////////////////////////////////////////////////////////////////
75#endif // not APSTUDIO_INVOKED
76
diff --git a/uisimulator/win32/uisw32.sln b/uisimulator/win32/uisw32.sln
deleted file mode 100644
index ada5e11e7c..0000000000
--- a/uisimulator/win32/uisw32.sln
+++ /dev/null
@@ -1,21 +0,0 @@
1Microsoft Visual Studio Solution File, Format Version 7.00
2Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uisw32", "uisw32.vcproj", "{A81A8EFA-647A-427A-BD04-F6B469752E7A}"
3EndProject
4Global
5 GlobalSection(SolutionConfiguration) = preSolution
6 ConfigName.0 = Debug
7 ConfigName.1 = Release
8 EndGlobalSection
9 GlobalSection(ProjectDependencies) = postSolution
10 EndGlobalSection
11 GlobalSection(ProjectConfiguration) = postSolution
12 {A81A8EFA-647A-427A-BD04-F6B469752E7A}.Debug.ActiveCfg = Debug|Win32
13 {A81A8EFA-647A-427A-BD04-F6B469752E7A}.Debug.Build.0 = Debug|Win32
14 {A81A8EFA-647A-427A-BD04-F6B469752E7A}.Release.ActiveCfg = Release|Win32
15 {A81A8EFA-647A-427A-BD04-F6B469752E7A}.Release.Build.0 = Release|Win32
16 EndGlobalSection
17 GlobalSection(ExtensibilityGlobals) = postSolution
18 EndGlobalSection
19 GlobalSection(ExtensibilityAddIns) = postSolution
20 EndGlobalSection
21EndGlobal
diff --git a/uisimulator/win32/uisw32.suo b/uisimulator/win32/uisw32.suo
deleted file mode 100644
index be68cf93f9..0000000000
--- a/uisimulator/win32/uisw32.suo
+++ /dev/null
Binary files differ
diff --git a/uisimulator/win32/uisw32.vcproj b/uisimulator/win32/uisw32.vcproj
deleted file mode 100644
index 449bb19adf..0000000000
--- a/uisimulator/win32/uisw32.vcproj
+++ /dev/null
@@ -1,280 +0,0 @@
1<?xml version="1.0" encoding = "Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="7.00"
5 Name="uisw32"
6 ProjectGUID="{A81A8EFA-647A-427A-BD04-F6B469752E7A}"
7 Keyword="Win32Proj">
8 <Platforms>
9 <Platform
10 Name="Win32"/>
11 </Platforms>
12 <Configurations>
13 <Configuration
14 Name="Debug|Win32"
15 OutputDirectory="Debug"
16 IntermediateDirectory="Debug"
17 ConfigurationType="1"
18 CharacterSet="2">
19 <Tool
20 Name="VCCLCompilerTool"
21 Optimization="0"
22 AdditionalIncludeDirectories="&quot;..\..\apps\recorder&quot;;&quot;..\..\apps&quot;;&quot;..\..\firmware&quot;;&quot;..\win32&quot;;&quot;..\..\firmware\drivers&quot;;&quot;..\..\firmware\common&quot;"
23 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;HAVE_RECORDER_KEYPAD;HAVE_LCD_BITMAP;SIMULATOR;SIMULATOR;LCD_PROPFONTS;"
24 MinimalRebuild="TRUE"
25 BasicRuntimeChecks="3"
26 RuntimeLibrary="1"
27 UsePrecompiledHeader="0"
28 WarningLevel="3"
29 Detect64BitPortabilityProblems="FALSE"
30 DebugInformationFormat="4"
31 CompileAs="1"/>
32 <Tool
33 Name="VCCustomBuildTool"/>
34 <Tool
35 Name="VCLinkerTool"
36 OutputFile="$(OutDir)/uisw32.exe"
37 LinkIncremental="2"
38 GenerateDebugInformation="TRUE"
39 ProgramDatabaseFile="$(OutDir)/uisw32.pdb"
40 SubSystem="2"
41 TargetMachine="1"/>
42 <Tool
43 Name="VCMIDLTool"/>
44 <Tool
45 Name="VCPostBuildEventTool"/>
46 <Tool
47 Name="VCPreBuildEventTool"/>
48 <Tool
49 Name="VCPreLinkEventTool"/>
50 <Tool
51 Name="VCResourceCompilerTool"/>
52 <Tool
53 Name="VCWebServiceProxyGeneratorTool"/>
54 <Tool
55 Name="VCWebDeploymentTool"/>
56 </Configuration>
57 <Configuration
58 Name="Release|Win32"
59 OutputDirectory="Release"
60 IntermediateDirectory="Release"
61 ConfigurationType="1"
62 CharacterSet="2">
63 <Tool
64 Name="VCCLCompilerTool"
65 Optimization="2"
66 InlineFunctionExpansion="1"
67 OmitFramePointers="TRUE"
68 AdditionalIncludeDirectories="&quot;..\..\firmware\drivers&quot;;&quot;..\..\firmware&quot;;&quot;..\..\firmware\common&quot;"
69 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ARCHOS_RECORDER;SIMULATOR;WIN32"
70 StringPooling="TRUE"
71 RuntimeLibrary="0"
72 EnableFunctionLevelLinking="TRUE"
73 UsePrecompiledHeader="0"
74 WarningLevel="3"
75 Detect64BitPortabilityProblems="FALSE"
76 DebugInformationFormat="3"
77 CompileAs="1"/>
78 <Tool
79 Name="VCCustomBuildTool"/>
80 <Tool
81 Name="VCLinkerTool"
82 OutputFile="$(OutDir)/uisw32.exe"
83 LinkIncremental="1"
84 GenerateDebugInformation="TRUE"
85 SubSystem="2"
86 OptimizeReferences="2"
87 EnableCOMDATFolding="2"
88 TargetMachine="1"/>
89 <Tool
90 Name="VCMIDLTool"/>
91 <Tool
92 Name="VCPostBuildEventTool"/>
93 <Tool
94 Name="VCPreBuildEventTool"/>
95 <Tool
96 Name="VCPreLinkEventTool"/>
97 <Tool
98 Name="VCResourceCompilerTool"/>
99 <Tool
100 Name="VCWebServiceProxyGeneratorTool"/>
101 <Tool
102 Name="VCWebDeploymentTool"/>
103 </Configuration>
104 </Configurations>
105 <Files>
106 <Filter
107 Name="Source Files"
108 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
109 <File
110 RelativePath="backlight-win32.c">
111 </File>
112 <File
113 RelativePath="..\..\apps\recorder\bmp.c">
114 </File>
115 <File
116 RelativePath="..\..\apps\recorder\bounce.c">
117 </File>
118 <File
119 RelativePath="..\..\apps\recorder\boxes.c">
120 </File>
121 <File
122 RelativePath="button.c">
123 </File>
124 <File
125 RelativePath="..\..\firmware\chartables.c">
126 </File>
127 <File
128 RelativePath="..\..\apps\credits.c">
129 </File>
130 <File
131 RelativePath="debug-win32.c">
132 </File>
133 <File
134 RelativePath="dir-win32.c">
135 </File>
136 <File
137 RelativePath="..\..\apps\games_menu.c">
138 </File>
139 <File
140 RelativePath="..\..\apps\recorder\icons.c">
141 </File>
142 <File
143 RelativePath="..\..\firmware\id3.c">
144 </File>
145 <File
146 RelativePath="kernel.c">
147 </File>
148 <File
149 RelativePath="lcd-win32.c">
150 </File>
151 <File
152 RelativePath="..\..\firmware\drivers\lcd.c">
153 </File>
154 <File
155 RelativePath="..\..\apps\main.c">
156 </File>
157 <File
158 RelativePath="..\..\apps\main_menu.c">
159 </File>
160 <File
161 RelativePath="..\..\apps\menu.c">
162 <FileConfiguration
163 Name="Debug|Win32">
164 <Tool
165 Name="VCCLCompilerTool"
166 ObjectFile="$(IntDir)/$(InputName)1.obj"/>
167 </FileConfiguration>
168 <FileConfiguration
169 Name="Release|Win32">
170 <Tool
171 Name="VCCLCompilerTool"
172 ObjectFile="$(IntDir)/$(InputName)1.obj"/>
173 </FileConfiguration>
174 </File>
175 <File
176 RelativePath="mpeg.c">
177 </File>
178 <File
179 RelativePath="panic-win32.c">
180 </File>
181 <File
182 RelativePath="..\..\apps\playlist.c">
183 </File>
184 <File
185 RelativePath="..\..\apps\screensavers_menu.c">
186 </File>
187 <File
188 RelativePath="..\..\apps\settings.c">
189 <FileConfiguration
190 Name="Debug|Win32">
191 <Tool
192 Name="VCCLCompilerTool"
193 ObjectFile="$(IntDir)/$(InputName)1.obj"/>
194 </FileConfiguration>
195 <FileConfiguration
196 Name="Release|Win32">
197 <Tool
198 Name="VCCLCompilerTool"
199 ObjectFile="$(IntDir)/$(InputName)1.obj"/>
200 </FileConfiguration>
201 </File>
202 <File
203 RelativePath="..\..\apps\settings_menu.c">
204 </File>
205 <File
206 RelativePath="..\..\apps\recorder\sokoban.c">
207 </File>
208 <File
209 RelativePath="..\..\apps\sound_menu.c">
210 </File>
211 <File
212 RelativePath="..\..\firmware\common\sprintf.c">
213 </File>
214 <File
215 RelativePath="string-win32.c">
216 </File>
217 <File
218 RelativePath="..\..\firmware\common\strtok.c">
219 </File>
220 <File
221 RelativePath="..\..\apps\recorder\tetris.c">
222 </File>
223 <File
224 RelativePath="thread-win32.c">
225 </File>
226 <File
227 RelativePath="..\..\apps\tree.c">
228 </File>
229 <File
230 RelativePath="uisw32.c">
231 </File>
232 <File
233 RelativePath="..\..\apps\wps.c">
234 </File>
235 </Filter>
236 <Filter
237 Name="Header Files"
238 Filter="h;hpp;hxx;hm;inl;inc">
239 <File
240 RelativePath="dir-win32.h">
241 </File>
242 <File
243 RelativePath="..\x11\dir.h">
244 </File>
245 <File
246 RelativePath="lcd-win32.h">
247 </File>
248 <File
249 RelativePath="..\play.h">
250 </File>
251 <File
252 RelativePath="resource.h">
253 </File>
254 <File
255 RelativePath="..\screensaver.h">
256 </File>
257 <File
258 RelativePath="thread-win32.h">
259 </File>
260 <File
261 RelativePath="..\tree.h">
262 </File>
263 <File
264 RelativePath="uisw32.h">
265 </File>
266 </Filter>
267 <Filter
268 Name="Resource Files"
269 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
270 <File
271 RelativePath="UI256.bmp">
272 </File>
273 <File
274 RelativePath="uisw32.rc">
275 </File>
276 </Filter>
277 </Files>
278 <Globals>
279 </Globals>
280</VisualStudioProject>
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
deleted file mode 100644
index 989ac65223..0000000000
--- a/uisimulator/x11/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
1############################################################################
2# __________ __ ___.
3# Open \______ \ ____ ____ | | _\_ |__ _______ ___
4# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7# \/ \/ \/ \/ \/
8# $Id$
9#
10# Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11#
12# All files in this archive are subject to the GNU General Public License.
13# See the file COPYING in the source tree root for full license agreement.
14#
15# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16# KIND, either express or implied.
17#
18############################################################################
19
20SIMCOMMON = ../common
21
22DEPFILE = $(OBJDIR)/dep-sim
23
24RM = rm -f
25DEBUG = -g
26
27# Use this for simulator-only files
28INCLUDES = -I. -I$(SIMCOMMON) -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) \
29 -I$(BUILDDIR)
30
31# This sets up 'SRC' based on the files mentioned in SOURCES
32include $(TOOLSDIR)/makesrc.inc
33
34OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
35
36DEFINES := -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
37$(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES)
38
39SOURCES = $(SRC)
40
41DIRS = .
42
43CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS)
44
45OUTFILE = $(BUILDDIR)/libsim.a
46
47all: $(OUTFILE)
48
49include $(TOOLSDIR)/make.inc
50
51clean:
52 @echo "cleaning sim"
53 @$(RM) $(OBJS) *~ core $(OUTFILE) $(DEPFILE)
54 @$(MAKE) -C $(SIMCOMMON) clean
55
56$(OUTFILE): $(OBJS)
57 @echo "AR $@"
58 @$(AR) ruv $@ $(OBJS) >/dev/null 2>&1
59
60-include $(DEPFILE)
diff --git a/uisimulator/x11/README b/uisimulator/x11/README
deleted file mode 100644
index 0a293f6ad2..0000000000
--- a/uisimulator/x11/README
+++ /dev/null
@@ -1,6 +0,0 @@
1To build:
2
3 $ ../tools/configure
4 [answer questions]
5 $ make
6 $ ./rockboxui
diff --git a/uisimulator/x11/SOURCES b/uisimulator/x11/SOURCES
deleted file mode 100644
index 0aabfb2c03..0000000000
--- a/uisimulator/x11/SOURCES
+++ /dev/null
@@ -1,14 +0,0 @@
1button-x11.c
2kernel.c
3lcd-x11.c
4#if 0 /* if sound is enabled */
5oss_sound.c
6#endif
7resources.c
8screenhack.c
9thread.c
10uibasic.c
11visual.c
12#if CONFIG_CODEC == SWCODEC
13sound.c
14#endif
diff --git a/uisimulator/x11/archos/rockbox112.bmp b/uisimulator/x11/archos/rockbox112.bmp
deleted file mode 100644
index 45392f9f7a..0000000000
--- a/uisimulator/x11/archos/rockbox112.bmp
+++ /dev/null
Binary files differ
diff --git a/uisimulator/x11/atoi.h b/uisimulator/x11/atoi.h
deleted file mode 100644
index 74474f110c..0000000000
--- a/uisimulator/x11/atoi.h
+++ /dev/null
@@ -1,2 +0,0 @@
1
2int atoi(const char *);
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
deleted file mode 100644
index 673f71ea7b..0000000000
--- a/uisimulator/x11/button-x11.c
+++ /dev/null
@@ -1,321 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include <stdlib.h>
20#include "config.h"
21#include "button.h"
22#include "kernel.h"
23#include "debug.h"
24#include "backlight.h"
25#include "misc.h"
26
27#include "X11/keysym.h"
28
29extern int screenhack_handle_events(bool *release);
30
31struct event_queue button_queue;
32
33static int button_state = 0; /* keeps track of pressed keys */
34static long lastbtn; /* Last valid button status */
35
36/* how often we check to see if a button is pressed */
37#define POLL_FREQUENCY HZ/25
38
39/* how long until repeat kicks in */
40#define REPEAT_START 8
41
42/* the speed repeat starts at */
43#define REPEAT_INTERVAL_START 4
44
45/* speed repeat finishes at */
46#define REPEAT_INTERVAL_FINISH 2
47
48/* mostly copied from real button.c */
49void button_read (void);
50
51static void button_tick(void)
52{
53 static int tick = 0;
54 static int count = 0;
55 static int repeat_speed = REPEAT_INTERVAL_START;
56 static int repeat_count = 0;
57 static bool repeat = false;
58 static bool post = false;
59 int diff;
60 int btn;
61
62 /* only poll every X ticks */
63 if ( ++tick >= POLL_FREQUENCY )
64 {
65 button_read();
66 btn = button_state;
67
68 /* Find out if a key has been released */
69 diff = btn ^ lastbtn;
70 if(diff && (btn & diff) == 0)
71 {
72 queue_post(&button_queue, BUTTON_REL | diff, NULL);
73 }
74 else
75 {
76 if ( btn )
77 {
78 /* normal keypress */
79 if ( btn != lastbtn )
80 {
81 post = true;
82 repeat = false;
83 repeat_speed = REPEAT_INTERVAL_START;
84
85 }
86 else /* repeat? */
87 {
88 if ( repeat )
89 {
90 count--;
91 if (count == 0) {
92 post = true;
93 /* yes we have repeat */
94 repeat_speed--;
95 if (repeat_speed < REPEAT_INTERVAL_FINISH)
96 repeat_speed = REPEAT_INTERVAL_FINISH;
97 count = repeat_speed;
98
99 repeat_count++;
100
101 }
102 }
103 else
104 {
105 if (count++ > REPEAT_START)
106 {
107 post = true;
108 repeat = true;
109 repeat_count = 0;
110 /* initial repeat */
111 count = REPEAT_INTERVAL_START;
112 }
113 }
114 }
115 if ( post )
116 {
117 if (repeat)
118 {
119 if (queue_empty(&button_queue))
120 {
121 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
122 post = false;
123 }
124 }
125 else
126 {
127 queue_post(&button_queue, btn, NULL);
128 post = false;
129 }
130#ifdef HAVE_REMOTE_LCD
131 if(btn & BUTTON_REMOTE)
132 remote_backlight_on();
133 else
134#endif
135 backlight_on();
136
137 }
138 }
139 else
140 {
141 repeat = false;
142 count = 0;
143 }
144 }
145 lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT);
146 tick = 0;
147 }
148}
149
150/*
151 * Read X keys and translate to rockbox buttons
152 */
153
154void button_read (void)
155{
156 int k;
157 bool release = false; /* is this a release event */
158 int ev = screenhack_handle_events(&release);
159
160 switch (ev)
161 {
162 case XK_KP_Left:
163 case XK_Left:
164 case XK_KP_4:
165 k = BUTTON_LEFT;
166 break;
167
168 case XK_KP_Right:
169 case XK_Right:
170 case XK_KP_6:
171 k = BUTTON_RIGHT;
172 break;
173
174 case XK_KP_Up:
175 case XK_Up:
176 case XK_KP_8:
177#ifdef BUTTON_UP
178 k = BUTTON_UP;
179#elif defined BUTTON_PLAY
180 k = BUTTON_PLAY;
181#endif
182 break;
183
184 case XK_KP_Down:
185 case XK_Down:
186 case XK_KP_2:
187#ifdef BUTTON_DOWN
188 k = BUTTON_DOWN;
189#elif defined BUTTON_STOP
190 k = BUTTON_STOP;
191#endif
192 break;
193
194#ifdef BUTTON_ON
195 case XK_KP_Add:
196 case XK_Q:
197 case XK_q:
198 k = BUTTON_ON;
199 break;
200#endif
201
202#ifdef BUTTON_OFF
203 case XK_KP_Enter:
204 case XK_A:
205 case XK_a:
206 k = BUTTON_OFF;
207 break;
208#endif
209
210#ifdef BUTTON_F1
211 case XK_KP_Divide:
212 case XK_1:
213 k = BUTTON_F1;
214 break;
215
216 case XK_KP_Multiply:
217 case XK_2:
218 k = BUTTON_F2;
219 break;
220
221 case XK_KP_Subtract:
222 case XK_3:
223 k = BUTTON_F3;
224 break;
225#elif defined(BUTTON_REC)
226 case XK_KP_Divide:
227 case XK_1:
228 k = BUTTON_REC;
229 break;
230#endif
231
232 case XK_KP_Space:
233 case XK_KP_5:
234 case XK_KP_Begin:
235 case XK_space:
236#ifdef BUTTON_PLAY
237 k = BUTTON_PLAY;
238#elif defined(BUTTON_SELECT)
239 k = BUTTON_SELECT;
240#endif
241 break;
242
243#ifdef HAVE_LCD_BITMAP
244 case XK_5:
245 if(!release)
246 screen_dump();
247 break;
248#endif
249
250 case XK_KP_Separator:
251 case XK_KP_Insert:
252 case XK_Insert:
253#ifdef BUTTON_MENU
254 k = BUTTON_MENU;
255#elif defined(BUTTON_MODE)
256 k = BUTTON_MODE;
257#endif
258 break;
259
260 default:
261 k = 0;
262 if(ev)
263 DEBUGF("received ev %d\n", ev);
264 break;
265 }
266
267 if (release)
268 button_state &= ~k;
269 else
270 button_state |= k;
271}
272
273/* Again copied from real button.c... */
274
275long button_get(bool block)
276{
277 struct event ev;
278
279 if ( block || !queue_empty(&button_queue) )
280 {
281 queue_wait(&button_queue, &ev);
282 return ev.id;
283 }
284 return BUTTON_NONE;
285}
286
287long button_get_w_tmo(int ticks)
288{
289 struct event ev;
290 queue_wait_w_tmo(&button_queue, &ev, ticks);
291 return (ev.id != SYS_TIMEOUT)? ev.id: BUTTON_NONE;
292}
293
294void button_init(void)
295{
296 tick_add_task(button_tick);
297}
298
299int button_status(void)
300{
301 return lastbtn;
302}
303
304void button_clear_queue(void)
305{
306 queue_clear(&button_queue);
307}
308
309#ifdef HAS_BUTTON_HOLD
310bool button_hold(void) {
311 /* temp fix for hold button on irivers */
312 return false;
313}
314#endif
315
316#ifdef HAS_REMOTE_BUTTON_HOLD
317bool remote_button_hold(void) {
318 /* temp fix for hold button on irivers */
319 return false;
320}
321#endif
diff --git a/uisimulator/x11/config-x11.h b/uisimulator/x11/config-x11.h
deleted file mode 100644
index 1c520cfbac..0000000000
--- a/uisimulator/x11/config-x11.h
+++ /dev/null
@@ -1,362 +0,0 @@
1/* config.h. Generated automatically by configure. */
2/* config.h.in --- xscreensaver, Copyright (c) 1998 Jamie Zawinski.
3 *
4 * The best way to set these parameters is by running the included `configure'
5 * script. That examines your system, and generates `config.h' from
6 * `config.h.in'.
7 *
8 * If something goes very wrong, you can edit `config.h' directly, but beware
9 * that your changes will be lost if you ever run `configure' again.
10 */
11
12
13/* *************************************************************************
14 CONFIGURING SERVER EXTENSIONS
15 ************************************************************************* */
16
17/* Define this if you have the XReadDisplay extension (I think this is an
18 SGI-only thing; it's in <X11/extensions/readdisplay.h>.) A few of the
19 screenhacks will take advantage of this if it's available.
20 */
21/* #undef HAVE_READ_DISPLAY_EXTENSION */
22
23/* Define this if you have the Iris Video Library (dmedia/vl.h on SGI.)
24 A few of the screenhacks will take advantage of this if it's available.
25 */
26/* #undef HAVE_SGI_VIDEO */
27
28/* Define this if you have the XHPDisableReset function (an HP only thing.)
29 */
30/* #undef HAVE_XHPDISABLERESET */
31
32/* First, some background: there are three distinct server extensions which
33 * are useful to a screen saver program: they are XIDLE, MIT-SCREEN-SAVER,
34 * and SCREEN_SAVER.
35 *
36 * The XIDLE extension resides in .../contrib/extensions/xidle/ on the X11R5
37 * contrib tape. This extension lets the client get accurate idle-time
38 * information from the X server in a potentially more reliable way than by
39 * simply watching for keyboard and mouse activity. However, the XIDLE
40 * extension has apparently not been ported to X11R6.
41 *
42 * The SCREEN_SAVER extension is found (as far as I know) only in the SGI
43 * X server, and it exists in all releases since (at least) Irix 5. The
44 * relevant header file is /usr/include/X11/extensions/XScreenSaver.h.
45 *
46 * The similarly-named MIT-SCREEN-SAVER extension came into existence long
47 * after the SGI SCREEN_SAVER extension was already in use, and resides in
48 * .../contrib/extensions/screensaver/ on the X11R6 contrib tape. It is
49 * also found in certain recent X servers built in to NCD X terminals.
50 *
51 * The MIT extension does basically the same thing that the XIDLE extension
52 * does, but there are two things wrong with it: first, because of the way
53 * the extension was designed, the `fade' option to XScreenSaver will be
54 * uglier: just before the screen fades out, there will be an unattractive
55 * flicker to black, because this extension blanks the screen *before*
56 * telling us that it is time to do so. Second, this extension is known to
57 * be buggy; on the systems I use, it works, but some people have reported
58 * X server crashes as a result of using it. XScreenSaver uses this
59 * extension rather conservatively, because when I tried to use any of its
60 * more complicated features, I could get it to crash the server at the
61 * drop of a hat.
62 *
63 * In short, the MIT-SCREEN-SAVER extension is a piece of junk. The older
64 * SGI SCREEN_SAVER extension works great, as does XIDLE. It would be nice
65 * If those two existed on more systems, that is, would be adopted by the
66 * X Consortium in favor of their inferior "not-invented-here" entry.
67 */
68
69/* Define this if you have the XIDLE extension installed. If you have the
70 * XIDLE extension, this is recommended. (You have this extension if the
71 * file /usr/include/X11/extensions/xidle.h exists.) Turning on this flag
72 * lets XScreenSaver work better with servers which support this extension;
73 * but it will still work with servers which do not suport it, so it's a good
74 * idea to compile in support for it if you can.
75 */
76/* #undef HAVE_XIDLE_EXTENSION */
77
78/* Define this if you have the MIT-SCREEN-SAVER extension installed. See the
79 * caveats about this extension, above. (It's available if the file
80 * /usr/include/X11/extensions/scrnsaver.h exists.)
81 */
82#define HAVE_MIT_SAVER_EXTENSION 1
83
84/* Define this if you have the SGI SCREEN_SAVER extension. This is standard
85 * on Irix systems, and not available elsewhere.
86 */
87/* #undef HAVE_SGI_SAVER_EXTENSION */
88
89/* Define this if you have the SGI-VIDEO-CONTROL extension. This is standard
90 * on Irix systems, and not available elsewhere.
91 */
92/* #undef HAVE_SGI_VC_EXTENSION */
93
94/* Define this if you have the XDPMS extension. This is standard on
95 * sufficiently-recent XFree86 systems, and possibly elsewhere. (It's
96 * available if the file /usr/include/X11/extensions/dpms.h exists.)
97 */
98/* #undef HAVE_DPMS_EXTENSION */
99
100/* Define this if you have the functions XF86VidModeGetModeLine() and
101 * XF86VidModeGetViewPort(), in support of virtual desktops where the
102 * X server's root window is bigger than the actual screen. This is
103 * an XFree86 thing, and probably doesn't exist elsewhere. (It's
104 * available if the file /usr/include/X11/extensions/xf86vmode.h exists.)
105 */
106/* #undef HAVE_XF86VMODE */
107
108/* Define this if you have a Linux-like /proc/interrupts file which can be
109 * examined to determine when keyboard activity has occurred.
110 */
111/* #undef HAVE_PROC_INTERRUPTS */
112
113
114
115/* *************************************************************************
116 CONFIGURING GRAPHICS TOOLKITS
117 ************************************************************************* */
118
119/* Define this if you have Motif.
120 */
121#define HAVE_MOTIF 1
122
123/* Define this if you have Gtk.
124 */
125/* #undef HAVE_GTK */
126
127/* Define this if you have Athena (-Xaw).
128 */
129#define HAVE_ATHENA 1
130
131/* Define this if you have Athena, and the version you have includes the
132 * XawViewportSetCoordinates function in Viewport.h (some old versions of
133 * the library didn't have this function.)
134 */
135#define HAVE_XawViewportSetCoordinates 1
136
137/* Define this if you have the XPM library installed. Some of the demos can
138 * make use of this if it is available.
139 */
140#define HAVE_XPM 1
141
142/* Define this if you have the Xmu library. This is standard part of X, and
143 * if your vendor doesn't ship it, you should report that as a bug.
144 */
145#define HAVE_XMU 1
146
147/* Define this if you have OpenGL. Some of the demos require it, so if you
148 * don't have it, then those particular demos won't be built. (This won't
149 * affect the screen saver as a whole.)
150 */
151/* #undef HAVE_GL */
152
153/* Define this if you have OpenGL, but it's the MesaGL variant. (The
154 libraries have different names.) (HAVE_GL should be defined too.)
155 */
156/* #undef HAVE_MESA_GL */
157
158/* Define this if your version of OpenGL has the glBindTexture() routine.
159 This is the case for OpenGL 1.1, but not for OpenGL 1.0.
160 */
161/* #undef HAVE_GLBINDTEXTURE */
162
163/* Define this if you have the -lgle and -lmatrix libraries (GL extrusion.)
164 */
165/* #undef HAVE_GLE */
166
167/* Define this if the `xscreensaver' process itself (the driver process)
168 should be linked against GL. Most systems won't want this (in particular,
169 if you're using Linux and/or Mesa, you don't want this) but SGI systems
170 do want this. It may also be useful on other systems that have serious
171 GL support -- you only need this if you have a lot of different visuals,
172 not all of which work with GL programs.
173 */
174/* #undef DAEMON_USE_GL */
175
176/* Define this if you have the X Shared Memory Extension.
177 */
178#define HAVE_XSHM_EXTENSION 1
179
180/* Define this if you have the X Double Buffer Extension.
181 */
182#define HAVE_DOUBLE_BUFFER_EXTENSION 1
183
184/* Some screenhacks like to run an external program to generate random pieces
185 of text; set this to the one you like ("yow" and "fortune" are the most
186 likely prospects.) Note that this is just the default; X resources can
187 be used to override it.
188 */
189#define ZIPPY_PROGRAM "/usr/local/libexec/emacs/20.4/sparc-sun-solaris2.6/yow"
190
191
192
193/* *************************************************************************
194 CONFIGURING PASSWORD AUTHENTICATION
195 ************************************************************************* */
196
197/* Define this to remove the option of locking the screen at all.
198 */
199/* #undef NO_LOCKING */
200
201/* Define this if you want to use Kerberos authentication to lock/unlock the
202 * screen instead of your local password. This currently uses Kerberos V4,
203 * but a V5 server with V4 compatibility will work. WARNING: DO NOT USE AFS
204 * string-to-key passwords with this option. This option currently *only*
205 * works with standard Kerberos des_string_to_key. If your password is an
206 * AFS password and not a kerberos password, it will not authenticate
207 * properly. See the comments in driver/kpasswd.c for more information if you
208 * need it.
209 */
210/* #undef HAVE_KERBEROS */
211
212/* Define this if you want to use PAM (Pluggable Authentication Modules)
213 * to lock/unlock the screen, instead of standard /etc/passwd authentication.
214 */
215/* #undef HAVE_PAM */
216
217/* If PAM is being used, this is the name of the PAM service that xscreensaver
218 * will authenticate as. The default is "xscreensaver", which means that the
219 * PAM library will look for an "xscreensaver" line in /etc/pam.conf, or (on
220 * recent Linux systems) will look for a file called /etc/pam.d/xscreensaver.
221 * Some systems might already have a PAM installation that is configured for
222 * xlock, so setting this to "xlock" would also work in that case.
223 */
224#define PAM_SERVICE_NAME "xscreensaver"
225
226/* Define if you have PAM and pam_strerror() requires two arguments. */
227/* #undef PAM_STRERROR_TWO_ARGS */
228
229/* Define this if your system uses `shadow' passwords, that is, the passwords
230 * live in /etc/shadow instead of /etc/passwd, and one reads them with
231 * getspnam() instead of getpwnam(). (Note that SCO systems do some random
232 * other thing; others might as well. See the ifdefs in driver/passwd-pwent.c
233 * if you're having trouble related to reading passwords.)
234 */
235#define HAVE_SHADOW_PASSWD 1
236
237/* Define this if your system is Digital or SCO Unix with so-called ``Enhanced
238 Security'', that is, the passwords live in /tcb/files/auth/<x>/<xyz>
239 instead of in /etc/passwd, and one reads them with getprpwnam() instead
240 of getpwnam().
241 */
242/* #undef HAVE_ENHANCED_PASSWD */
243
244/* Define this if your system is Solaris with ``adjunct'' passwords (this is
245 the version where one gets at the passwords with getpwanam() instead of
246 getpwnam().) I haven't tested this one, let me know if it works.
247 */
248/* #undef HAVE_ADJUNCT_PASSWD */
249
250/* Define this if you are running HPUX with so-called ``Secure Passwords''
251 (if you have /usr/include/hpsecurity.h, you probably have this.) I
252 haven't tested this one, let me know if it works.
253 */
254/* #undef HAVE_HPUX_PASSWD */
255
256/* Define this if you are on a system that supports the VT_LOCKSWITCH and
257 VT_UNLOCKSWITCH ioctls. If this is defined, then when the screen is
258 locked, switching to another virtual terminal will also be prevented.
259 That is, the whole console will be locked, rather than just the VT on
260 which X is running. (Well, that's the theory anyway -- in practice,
261 I haven't yet figured out how to make that work.)
262 */
263/* #undef HAVE_VT_LOCKSWITCH */
264
265
266/* Define this if you the openlog(), syslog(), and closelog() functions.
267 This is used for logging failed login attempts.
268 */
269#define HAVE_SYSLOG 1
270
271
272/* *************************************************************************
273 OTHER C ENVIRONMENT JUNK
274 ************************************************************************* */
275
276/* Define this to void* if you're using X11R4 or earlier. */
277/* #undef XPointer */
278
279/* Define if you have the nice function. */
280#define HAVE_NICE 1
281
282/* Define if you have the setpriority function. */
283#define HAVE_SETPRIORITY 1
284
285/* Define to empty if the keyword does not work. */
286/* #undef const */
287
288/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
289#define HAVE_SYS_WAIT_H 1
290
291/* Define as __inline if that's what the C compiler calls it. */
292/* #undef inline */
293
294/* Define to `int' if <sys/types.h> doesn't define. */
295/* #undef mode_t */
296
297/* Define to `int' if <sys/types.h> doesn't define. */
298/* #undef pid_t */
299
300/* Define as the return type of signal handlers (int or void). */
301#define RETSIGTYPE void
302
303/* Define to `unsigned' if <sys/types.h> doesn't define. */
304/* #undef size_t */
305
306/* Define if you have the ANSI C header files. */
307#define STDC_HEADERS 1
308
309/* Define if you can safely include both <sys/time.h> and <time.h>. */
310#define TIME_WITH_SYS_TIME 1
311
312/* Define if you have the gettimeofday function. */
313#define HAVE_GETTIMEOFDAY 1
314
315/* Define if gettimeofday requires two arguments. */
316#define GETTIMEOFDAY_TWO_ARGS 1
317
318/* Define if you have the putenv function. */
319#define HAVE_PUTENV 1
320
321/* Define if you have the select function. */
322#define HAVE_SELECT 1
323
324/* Define if you have the getcwd function. */
325#define HAVE_GETCWD 1
326
327/* Define if you have the getcwd function. */
328#define HAVE_GETWD 1
329
330/* Define if you have the realpath function. */
331#define HAVE_REALPATH 1
332
333/* Define if you have the uname function. */
334#define HAVE_UNAME 1
335
336/* Define if you have the fcntl function. */
337#define HAVE_FCNTL 1
338
339/* Define if you have the sigaction function. */
340#define HAVE_SIGACTION 1
341
342/* Define if you have the <unistd.h> header file. */
343#define HAVE_UNISTD_H 1
344
345/* Define if you have the <crypt.h> header file. */
346#define HAVE_CRYPT_H 1
347
348/* Define if you have <sys/select.h> that defines fd_set and FD_SET. */
349#define HAVE_SYS_SELECT_H 1
350
351/* Define to use sigaction() instead of signal() for SIGCHLD-related activity.
352 This is necessary at least on SCO OpenServer 5, due to a Unix kernel bug.
353 */
354/* #undef USE_SIGACTION */
355
356/* Define this if you do pings with a `struct icmp' and a `icmp_id' slot.
357 */
358#define HAVE_ICMP 1
359
360/* Define this if you do pings with a `struct icmphdr' and a `un.echo.id' slot.
361 */
362/* #undef HAVE_ICMPHDR */
diff --git a/uisimulator/x11/kernel.c b/uisimulator/x11/kernel.c
deleted file mode 100644
index 947d82a550..0000000000
--- a/uisimulator/x11/kernel.c
+++ /dev/null
@@ -1,165 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Jens Arnold
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <stddef.h>
21#include "kernel.h"
22#include "thread.h"
23#include "debug.h"
24
25static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
26
27int set_irq_level (int level)
28{
29 static int _lv = 0;
30 return (_lv = level);
31}
32
33void queue_init(struct event_queue *q)
34{
35 q->read = 0;
36 q->write = 0;
37}
38
39void queue_delete(struct event_queue *q)
40{
41 (void)q;
42}
43
44void queue_wait(struct event_queue *q, struct event *ev)
45{
46 while(q->read == q->write)
47 {
48 switch_thread();
49 }
50
51 *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK];
52}
53
54void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
55{
56 unsigned int timeout = current_tick + ticks;
57
58 while(q->read == q->write && TIME_BEFORE( current_tick, timeout ))
59 {
60 sleep(1);
61 }
62
63 if(q->read != q->write)
64 {
65 *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK];
66 }
67 else
68 {
69 ev->id = SYS_TIMEOUT;
70 }
71}
72
73void queue_post(struct event_queue *q, long id, void *data)
74{
75 int wr;
76 int oldlevel;
77
78 oldlevel = set_irq_level(15<<4);
79 wr = (q->write++) & QUEUE_LENGTH_MASK;
80
81 q->events[wr].id = id;
82 q->events[wr].data = data;
83 set_irq_level(oldlevel);
84}
85
86bool queue_empty(const struct event_queue* q)
87{
88 return ( q->read == q->write );
89}
90
91void queue_clear(struct event_queue* q)
92{
93 /* fixme: This is potentially unsafe in case we do interrupt-like processing */
94 q->read = 0;
95 q->write = 0;
96}
97
98void switch_thread (void)
99{
100 yield ();
101}
102
103void sim_tick_tasks(void)
104{
105 int i;
106
107 /* Run through the list of tick tasks */
108 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
109 {
110 if(tick_funcs[i])
111 {
112 tick_funcs[i]();
113 }
114 }
115}
116
117int tick_add_task(void (*f)(void))
118{
119 int i;
120
121 /* Add a task if there is room */
122 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
123 {
124 if(tick_funcs[i] == NULL)
125 {
126 tick_funcs[i] = f;
127 return 0;
128 }
129 }
130 DEBUGF("Error! tick_add_task(): out of tasks");
131 return -1;
132}
133
134int tick_remove_task(void (*f)(void))
135{
136 int i;
137
138 /* Remove a task if it is there */
139 for(i = 0;i < MAX_NUM_TICK_TASKS;i++)
140 {
141 if(tick_funcs[i] == f)
142 {
143 tick_funcs[i] = NULL;
144 return 0;
145 }
146 }
147
148 return -1;
149}
150
151void mutex_init(struct mutex *m)
152{
153 (void)m;
154}
155
156void mutex_lock(struct mutex *m)
157{
158 (void)m;
159}
160
161void mutex_unlock(struct mutex *m)
162{
163 (void)m;
164}
165
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
deleted file mode 100644
index c85848c18b..0000000000
--- a/uisimulator/x11/lcd-x11.c
+++ /dev/null
@@ -1,262 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <stdio.h>
21#include <string.h>
22#include <stdarg.h>
23#include <stdlib.h>
24#include <ctype.h>
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <fcntl.h>
28
29#include <errno.h>
30#include <ctype.h>
31#include <time.h>
32
33#include "screenhack.h"
34#include "config.h"
35#include "debug.h"
36
37/*
38 * Specific implementations for X11, using the generic LCD API and data.
39 */
40
41#include "lcd-x11.h"
42#include "lcd-playersim.h"
43
44#if LCD_DEPTH == 2
45#define YBLOCK 4
46#define ANDBIT 3 /* AND with this to get the color number */
47#else
48#define YBLOCK 8
49#define ANDBIT 1
50#endif
51
52extern void screen_resized(int width, int height);
53extern bool lcd_display_redraw;
54
55#ifdef HAVE_LCD_BITMAP
56#if LCD_DEPTH==16
57fb_data lcd_framebuffer_copy[LCD_HEIGHT][LCD_WIDTH*2];
58#else
59fb_data lcd_framebuffer_copy[LCD_HEIGHT/YBLOCK][LCD_WIDTH];
60#endif
61
62void lcd_update (void)
63{
64 /* update a full screen rect */
65 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
66}
67
68void lcd_update_rect(int x_start, int y_start,
69 int width, int height)
70{
71 int x;
72 int yline=y_start;
73 int y;
74 int p=0;
75 int bit;
76 int xmax;
77 int ymax;
78 int colors[LCD_WIDTH * LCD_HEIGHT];
79 struct coordinate points[LCD_WIDTH * LCD_HEIGHT];
80 unsigned force_mask = lcd_display_redraw ? 0xFF : 0;
81
82#if 0
83 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n",
84 counter++, x_start, y_start, width, height);
85#endif
86 /* The Y coordinates have to work on even YBLOCK pixel rows */
87 ymax = (yline + height)/YBLOCK;
88 yline /= YBLOCK;
89
90 xmax = x_start + width;
91
92 if(xmax > LCD_WIDTH)
93 xmax = LCD_WIDTH;
94 if(ymax >= LCD_HEIGHT/YBLOCK)
95 ymax = LCD_HEIGHT/YBLOCK-1;
96
97 for(; yline <= ymax; yline++) {
98 y = yline * YBLOCK;
99 for(x = x_start; x < xmax; x++) {
100 unsigned char diff = (lcd_framebuffer[yline][x]
101 ^ lcd_framebuffer_copy[yline][x])
102 | force_mask;
103 if(diff) {
104 /* one or more bits/pixels are changed */
105 unsigned char mask = ANDBIT;
106 for(bit = 0; bit < YBLOCK; bit++) {
107 if(diff & mask) {
108 /* pixel has changed */
109 unsigned int col = lcd_framebuffer[yline][x] & mask;
110#if LCD_DEPTH == 2
111 colors[p] = col >> (bit * LCD_DEPTH);
112#else
113 colors[p] = col ? 3 : 0;
114#endif
115 points[p].x = x + MARGIN_X;
116 points[p].y = y + bit + MARGIN_Y;
117 p++; /* increase the point counter */
118 }
119 mask <<= LCD_DEPTH;
120 }
121
122 /* update the copy */
123 lcd_framebuffer_copy[yline][x] = lcd_framebuffer[yline][x];
124 }
125 }
126 }
127
128 dots(colors, &points[0], p);
129 /* printf("lcd_update_rect: Draws %d pixels, clears %d pixels\n", p, cp);*/
130 XtAppLock(app);
131 XSync(dpy,False);
132 XtAppUnlock(app);
133 lcd_display_redraw=false;
134}
135
136#ifdef LCD_REMOTE_HEIGHT
137extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
138unsigned char lcd_remote_framebuffer_copy[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
139
140#define REMOTE_START_Y (LCD_HEIGHT + 2*MARGIN_Y)
141
142void lcd_remote_update (void)
143{
144 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
145}
146
147void lcd_remote_update_rect(int x_start, int y_start,
148 int width, int height)
149{
150 int x;
151 int yline=y_start;
152 int y;
153 int p=0;
154 int bit;
155 int xmax;
156 int ymax;
157 struct coordinate points[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
158 int colors[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
159 unsigned force_mask = lcd_display_redraw ? 0xFF : 0;
160
161#if 0
162 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n",
163 counter++, x_start, y_start, width, height);
164#endif
165 /* The Y coordinates have to work on even 8 pixel rows */
166 ymax = (yline + height)/8;
167 yline /= 8;
168
169 xmax = x_start + width;
170
171 if(xmax > LCD_REMOTE_WIDTH)
172 xmax = LCD_REMOTE_WIDTH;
173 if(ymax >= LCD_REMOTE_HEIGHT/8)
174 ymax = LCD_REMOTE_HEIGHT/8-1;
175
176 for(; yline <= ymax; yline++) {
177 y = yline * 8;
178 for(x = x_start; x < xmax; x++) {
179 unsigned char diff = (lcd_remote_framebuffer[yline][x]
180 ^ lcd_remote_framebuffer_copy[yline][x])
181 | force_mask;
182 if(diff) {
183 unsigned char mask = 1;
184 for(bit = 0; bit < 8; bit++) {
185 if(diff & mask) {
186 unsigned int col = lcd_remote_framebuffer[yline][x] & mask;
187 colors[p] = col ? 3 : 0;
188 points[p].x = x + MARGIN_X;
189 points[p].y = y + bit + (REMOTE_START_Y + MARGIN_Y);
190 p++; /* increase the point counter */
191 }
192 mask <<= 1;
193 }
194
195 /* update the copy */
196 lcd_remote_framebuffer_copy[yline][x] =
197 lcd_remote_framebuffer[yline][x];
198 }
199 }
200 }
201
202 dots(colors, &points[0], p);
203 /* printf("lcd_update_rect: Draws %d pixels, clears %d pixels\n", p, cp);*/
204 XtAppLock(app);
205 XSync(dpy,False);
206 XtAppUnlock(app);
207 lcd_display_redraw=false;
208}
209
210
211#endif
212
213#endif
214#ifdef HAVE_LCD_CHARCELLS
215
216/* Defined in lcd-playersim.c */
217extern void lcd_print_char(int x, int y);
218extern unsigned char lcd_buffer[2][11];
219extern void drawrect(int color, int x1, int y1, int x2, int y2);
220
221extern unsigned char hardware_buffer_lcd[11][2];
222static unsigned char lcd_buffer_copy[11][2];
223
224void lcd_update (void)
225{
226 bool changed=false;
227 int x, y;
228 for (y=0; y<2; y++) {
229 for (x=0; x<11; x++) {
230 if (lcd_display_redraw ||
231 lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y]) {
232 lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y];
233 lcd_print_char(x, y);
234 changed=true;
235 }
236 }
237 }
238 if (changed)
239 {
240 XtAppLock(app);
241 XSync(dpy,False);
242 XtAppUnlock(app);
243 }
244 lcd_display_redraw=false;
245}
246
247#endif
248
249#ifdef CONFIG_BACKLIGHT
250void sim_backlight(int value)
251{
252 DEBUGF("backlight: %s\n", (value > 0) ? "on" : "off");
253}
254#endif
255
256#ifdef HAVE_REMOTE_LCD
257void sim_remote_backlight(int value)
258{
259 DEBUGF("remote backlight: %s\n", (value > 0) ? "on" : "off");
260}
261#endif
262
diff --git a/uisimulator/x11/lcd-x11.h b/uisimulator/x11/lcd-x11.h
deleted file mode 100644
index 07911b2530..0000000000
--- a/uisimulator/x11/lcd-x11.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#define MARGIN_X 3
21#define MARGIN_Y 3
22
23/* include the "real" lcd.h file here */
24#include <lcd.h>
25
26
diff --git a/uisimulator/x11/oss_sound.c b/uisimulator/x11/oss_sound.c
deleted file mode 100644
index 51d85470e7..0000000000
--- a/uisimulator/x11/oss_sound.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2002 Dave Chapman
10 *
11 * oss_sound - a sound driver for Linux (and others?) OSS audio
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include <stdio.h>
22#include <fcntl.h>
23
24#include <sys/soundcard.h>
25#include "../common/sound.h"
26
27/* We want to use the "real" open in this file */
28#undef open
29
30int init_sound(sound_t* sound) {
31 sound->fd=open("/dev/dsp", O_WRONLY);
32 sound->freq=-1;
33 sound->channels=-1;
34
35 if (sound->fd <= 0) {
36 fprintf(stderr,"Can not open /dev/dsp - simulating sound output\n");
37 sound->fd=0;
38 }
39}
40
41int config_sound(sound_t* sound, int sound_freq, int channels) {
42 int format=AFMT_S16_NE;
43 int setting=0x000C000D; // 12 fragments size 8kb ? WHAT IS THIS?
44
45 sound->freq=sound_freq;
46 sound->channels=channels;
47
48 if (sound->fd) {
49 if (ioctl(sound->fd,SNDCTL_DSP_SETFRAGMENT,&setting)==-1) {
50 perror("SNDCTL_DSP_SETFRAGMENT");
51 }
52
53 if (ioctl(sound->fd,SNDCTL_DSP_CHANNELS,&channels)==-1) {
54 perror("SNDCTL_DSP_STEREO");
55 }
56 if (channels==0) { fprintf(stderr,"Warning, only mono supported\n"); }
57
58 if (ioctl(sound->fd,SNDCTL_DSP_SETFMT,&format)==-1) {
59 perror("SNDCTL_DSP_SETFMT");
60 }
61
62 if (ioctl(sound->fd,SNDCTL_DSP_SPEED,&sound_freq)==-1) {
63 perror("SNDCTL_DSP_SPEED");
64 }
65 }
66}
67
68int output_sound(sound_t* sound,const void* buf, int count) {
69 unsigned long long t;
70
71 if (sound->fd) {
72 return(write(sound->fd,buf,count));
73 } else {
74 t=(unsigned int)(((unsigned int)(1000000/sound->channels)*count)/sound->freq);
75// fprintf(stderr,"writing %d bytes at %d frequency - sleeping for %u microseconds\n",count,sound->freq,t);
76 usleep(t);
77 return(count);
78 }
79}
80
81void close_sound(sound_t* sound) {
82 if (sound->fd) close(sound->fd);
83 sound->fd=-1;
84}
diff --git a/uisimulator/x11/resources.c b/uisimulator/x11/resources.c
deleted file mode 100644
index feaf3b8216..0000000000
--- a/uisimulator/x11/resources.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/* xscreensaver, Copyright (c) 1992, 1997, 1998
2 * Jamie Zawinski <jwz@jwz.org>
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
10 * implied warranty.
11 */
12
13#include "utils.h"
14#include "resources.h"
15#include <X11/Xresource.h>
16
17
18/* Resource functions. Assumes: */
19
20extern char *progname;
21extern char *progclass;
22extern XrmDatabase db;
23
24#ifndef isupper
25# define isupper(c) ((c) >= 'A' && (c) <= 'Z')
26#endif
27#ifndef _tolower
28# define _tolower(c) ((c) - 'A' + 'a')
29#endif
30
31char *
32get_string_resource (char *res_name, char *res_class)
33{
34 XrmValue value;
35 char *type;
36 char full_name [1024], full_class [1024];
37 strcpy (full_name, progname);
38 strcat (full_name, ".");
39 strcat (full_name, res_name);
40 strcpy (full_class, progclass);
41 strcat (full_class, ".");
42 strcat (full_class, res_class);
43 if (XrmGetResource (db, full_name, full_class, &type, &value))
44 {
45 char *str = (char *) malloc (value.size + 1);
46 strncpy (str, (char *) value.addr, value.size);
47 str [value.size] = 0;
48 return str;
49 }
50 return 0;
51}
52
53Bool
54get_boolean_resource (char *res_name, char *res_class)
55{
56 char *tmp, buf [100];
57 char *s = get_string_resource (res_name, res_class);
58 char *os = s;
59 if (! s) return 0;
60 for (tmp = buf; *s; s++)
61 *tmp++ = isupper (*s) ? _tolower (*s) : *s;
62 *tmp = 0;
63 free (os);
64
65 while (*buf &&
66 (buf[strlen(buf)-1] == ' ' ||
67 buf[strlen(buf)-1] == '\t'))
68 buf[strlen(buf)-1] = 0;
69
70 if (!strcmp (buf, "on") || !strcmp (buf, "true") || !strcmp (buf, "yes"))
71 return 1;
72 if (!strcmp (buf,"off") || !strcmp (buf, "false") || !strcmp (buf,"no"))
73 return 0;
74 fprintf (stderr, "%s: %s must be boolean, not %s.\n",
75 progname, res_name, buf);
76 return 0;
77}
78
79unsigned int
80get_pixel_resource (char *res_name, char *res_class,
81 Display *dpy, Colormap cmap)
82{
83 XColor color;
84 char *s = get_string_resource (res_name, res_class);
85 char *s2;
86 if (!s) goto DEFAULT;
87
88 for (s2 = s + strlen(s) - 1; s2 > s; s2--)
89 if (*s2 == ' ' || *s2 == '\t')
90 *s2 = 0;
91 else
92 break;
93
94 if (! XParseColor (dpy, cmap, s, &color))
95 {
96 fprintf (stderr, "%s: can't parse color %s\n", progname, s);
97 goto DEFAULT;
98 }
99 if (! XAllocColor (dpy, cmap, &color))
100 {
101 fprintf (stderr, "%s: couldn't allocate color %s\n", progname, s);
102 goto DEFAULT;
103 }
104 free (s);
105 return color.pixel;
106 DEFAULT:
107 if (s) free (s);
108 return ((strlen(res_class) >= 10 &&
109 !strcmp ("Background", res_class + strlen(res_class) - 10))
110 ? BlackPixel (dpy, DefaultScreen (dpy))
111 : WhitePixel (dpy, DefaultScreen (dpy)));
112}
113
diff --git a/uisimulator/x11/resources.h b/uisimulator/x11/resources.h
deleted file mode 100644
index 1fbcfa7ce7..0000000000
--- a/uisimulator/x11/resources.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
2 *
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
9 * implied warranty.
10 */
11
12#ifndef __XSCREENSAVER_RESOURCES_H__
13#define __XSCREENSAVER_RESOURCES_H__
14extern char *get_string_resource (char*,char*);
15extern Bool get_boolean_resource (char*,char*);
16extern int get_integer_resource (char*,char*);
17extern double get_float_resource (char*,char*);
18extern unsigned int get_pixel_resource (char*,char*,Display*,Colormap);
19extern unsigned int get_minutes_resource (char*,char*);
20extern unsigned int get_seconds_resource (char*,char*);
21extern int parse_time (const char *string, Bool seconds_default_p,
22 Bool silent_p);
23#endif /* __XSCREENSAVER_RESOURCES_H__ */
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c
deleted file mode 100644
index c3aa2e4c63..0000000000
--- a/uisimulator/x11/screenhack.c
+++ /dev/null
@@ -1,579 +0,0 @@
1/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998
2 * Jamie Zawinski <jwz@jwz.org>
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
10 * implied warranty.
11 *
12 * And remember: X Windows is to graphics hacking as roman numerals are to
13 * the square root of pi.
14 */
15
16/* This file contains simple code to open a window or draw on the root.
17 The idea being that, when writing a graphics hack, you can just link
18 with this .o to get all of the uninteresting junk out of the way.
19
20 - create a procedure `screenhack(dpy, window)'
21
22 - create a variable `char *progclass' which names this program's
23 resource class.
24
25 - create a variable `char defaults []' for the default resources, and
26 null-terminate it.
27
28 - create a variable `XrmOptionDescRec options[]' for the command-line,
29 and null-terminate it.
30
31 And that's it...
32 */
33
34#include <stdio.h>
35#include <X11/Intrinsic.h>
36#include <X11/IntrinsicP.h>
37#include <X11/CoreP.h>
38#include <X11/Shell.h>
39#include <X11/StringDefs.h>
40#include <X11/Xutil.h>
41#include <X11/keysym.h>
42
43#ifdef __sgi
44# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
45#endif /* __sgi */
46
47#ifdef HAVE_XMU
48# ifndef VMS
49# include <X11/Xmu/Error.h>
50# else /* VMS */
51# include <Xmu/Error.h>
52# endif
53#else
54# include "xmu.h"
55#endif
56#include "lcd-x11.h"
57#include "screenhack.h"
58#include "version.h"
59#include "vroot.h"
60
61#include "debug.h"
62#include "config.h"
63
64#ifndef isupper
65# define isupper(c) ((c) >= 'A' && (c) <= 'Z')
66#endif
67#ifndef _tolower
68# define _tolower(c) ((c) - 'A' + 'a')
69#endif
70
71#define KEYBOARD_GENERIC \
72 "Keyboard Rockbox\n" \
73 "-------- ------------\n" \
74 "4, Left LEFT\n" \
75 "6, Right RIGHT\n"
76
77#if CONFIG_KEYPAD == PLAYER_PAD
78#define KEYBOARD_SPECIFIC \
79 "8, Up PLAY\n" \
80 "2, Down STOP\n" \
81 "+, Q ON\n" \
82 "., INS MENU\n"
83
84#elif CONFIG_KEYPAD == RECORDER_PAD
85#define KEYBOARD_SPECIFIC \
86 "8, Up UP\n" \
87 "2, Down DOWN\n" \
88 "5, Space PLAY\n" \
89 "+, Q ON\n" \
90 "Enter, A OFF\n" \
91 "/, (1) F1\n" \
92 "*, (2) F2\n" \
93 "-, (3) F3\n"
94
95#elif CONFIG_KEYPAD == ONDIO_PAD
96#define KEYBOARD_SPECIFIC \
97 "8, Up UP\n" \
98 "2, Down DOWN\n" \
99 "., INS MENU\n" \
100 "Enter, A OFF\n"
101
102#elif CONFIG_KEYPAD == IRIVER_H100_PAD
103#define KEYBOARD_SPECIFIC \
104 "8, Up UP\n" \
105 "2, Down DOWN\n" \
106 "5, Space SELECT\n" \
107 "+, Q ON\n" \
108 "Enter, A OFF\n" \
109 "., INS MODE\n" \
110 "/, (1) RECORD\n"
111
112#elif CONFIG_KEYPAD == IRIVER_H300_PAD
113#define KEYBOARD_SPECIFIC \
114 "[not written yet]"
115
116#elif CONFIG_KEYPAD == GMINI100_PAD
117#define KEYBOARD_SPECIFIC \
118 "8, Up UP\n" \
119 "2, Down DOWN\n" \
120 "5, Space PLAY\n" \
121 "+, Q ON\n" \
122 "Enter, A OFF\n" \
123 "., INS MENU\n"
124
125#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
126#define KEYBOARD_SPECIFIC \
127 "[not written yet]"
128
129#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
130#define KEYBOARD_SPECIFIC \
131 "[not written yet]"
132#else
133#error "Put your defines here"
134#endif
135
136
137char having_new_lcd=True;
138
139char *progname;
140XrmDatabase db;
141XtAppContext app;
142Display* dpy;
143Window window;
144Bool mono_p;
145
146static XrmOptionDescRec default_options [] = {
147 { "-root", ".root", XrmoptionNoArg, "True" },
148 { "-window", ".root", XrmoptionNoArg, "False" },
149 { "-mono", ".mono", XrmoptionNoArg, "True" },
150 { "-install", ".installColormap", XrmoptionNoArg, "True" },
151 { "-noinstall", ".installColormap", XrmoptionNoArg, "False" },
152 { "-visual", ".visualID", XrmoptionSepArg, 0 },
153 { "-window-id", ".windowID", XrmoptionSepArg, 0 },
154 { 0, 0, 0, 0 }
155};
156
157static char *default_defaults[] = {
158 ".root: false",
159#define GEOMETRY_POSITION 1
160 "*geometry: 120x68", /* to be replaced anyway */
161 "*mono: false",
162 "*installColormap: false",
163 "*visualID: default",
164 "*windowID: ",
165 0
166};
167
168extern int display_zoom;
169extern long current_tick;
170
171static XrmOptionDescRec *merged_options;
172static int merged_options_size;
173static char **merged_defaults;
174
175static void merge_options (void)
176{
177 int def_opts_size, opts_size;
178 int def_defaults_size, defaults_size;
179
180 for (def_opts_size = 0; default_options[def_opts_size].option;
181 def_opts_size++)
182 ;
183 for (opts_size = 0; options[opts_size].option; opts_size++)
184 ;
185
186 merged_options_size = def_opts_size + opts_size;
187 merged_options = (XrmOptionDescRec *)
188 malloc ((merged_options_size + 1) * sizeof(*default_options));
189 memcpy (merged_options, default_options,
190 (def_opts_size * sizeof(*default_options)));
191 memcpy (merged_options + def_opts_size, options,
192 ((opts_size + 1) * sizeof(*default_options)));
193
194 for (def_defaults_size = 0; default_defaults[def_defaults_size];
195 def_defaults_size++)
196 ;
197 for (defaults_size = 0; defaults[defaults_size]; defaults_size++)
198 ;
199
200 merged_defaults = (char **)
201 malloc ((def_defaults_size + defaults_size + 1) * sizeof (*defaults));
202
203 memcpy (merged_defaults, default_defaults,
204 def_defaults_size * sizeof(*defaults));
205 memcpy (merged_defaults + def_defaults_size, defaults,
206 (defaults_size + 1) * sizeof(*defaults));
207
208 /* This totally sucks. Xt should behave like this by default.
209 If the string in `defaults' looks like ".foo", change that
210 to "Progclass.foo".
211 */
212 {
213 char **s;
214 for (s = merged_defaults; *s; s++)
215 if (**s == '.')
216 {
217 const char *oldr = *s;
218 char *newr = (char *) malloc(strlen(oldr)
219 + strlen(progclass) + 3);
220 strcpy (newr, progclass);
221 strcat (newr, oldr);
222 *s = newr;
223 }
224 }
225}
226
227
228/* Make the X errors print out the name of this program, so we have some
229 clue which one has a bug when they die under the screensaver.
230 */
231
232static int screenhack_ehandler (Display *dpy, XErrorEvent *error)
233{
234 fprintf (stderr, "\nX error in %s:\n", progname);
235 if (XmuPrintDefaultErrorMessage (dpy, error, stderr))
236 exit (-1);
237 else
238 fprintf (stderr, " (nonfatal.)\n");
239 return 0;
240}
241
242static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
243{
244 (void)dpy;
245 return (event->xany.type == MapNotify &&
246 event->xvisibility.window == (Window) window);
247}
248
249static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW;
250
251
252static void kb_disable_auto_repeat(bool on)
253{
254 XKeyboardControl kb;
255
256 kb.auto_repeat_mode = on ? AutoRepeatModeOff : AutoRepeatModeDefault;
257 XChangeKeyboardControl(dpy, KBAutoRepeatMode, &kb);
258}
259
260static void kb_restore_auto_repeat(void) /* registered as an exit handler */
261{
262 kb_disable_auto_repeat(false);
263 XSync(dpy, false); /* force the X server to process that */
264}
265
266/* Dead-trivial event handling.
267 Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received.
268 */
269int screenhack_handle_event(XEvent *event, bool *release)
270{
271 int key=0;
272
273 *release = FALSE;
274
275 switch (event->xany.type) {
276 case KeyPress:
277 {
278 KeySym keysym;
279 unsigned char c = 0;
280 XLookupString (&event->xkey, (char *)&c, 1, &keysym, 0);
281 key = keysym;
282#if 0
283 DEBUGF("Got keypress: %c (%02x) %x, tick %ld\n", c, c,
284 event->xkey.keycode, current_tick);
285#endif
286 }
287 break;
288 case KeyRelease:
289 {
290 KeySym keysym;
291 unsigned char c = 0;
292 XLookupString (&event->xkey, (char *)&c, 1, &keysym, 0);
293 key = keysym;
294#if 0
295 DEBUGF("Got keyrelease: %c (%02x) %x, tick %ld\n", c, c,
296 event->xkey.keycode, current_tick);
297#endif
298 *release = TRUE;
299 }
300 break;
301 case Expose:
302 screen_redraw();
303 break;
304 case FocusIn:
305 kb_disable_auto_repeat(true);
306 break;
307 case FocusOut:
308 kb_disable_auto_repeat(false);
309 break;
310 case ClientMessage:
311 if (event->xclient.message_type != XA_WM_PROTOCOLS) {
312 char *s = XGetAtomName(dpy, event->xclient.message_type);
313 if (!s)
314 s = "(null)";
315 fprintf (stderr, "%s: unknown ClientMessage %s received!\n",
316 progname, s);
317 }
318 else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) {
319 char *s1 = XGetAtomName(dpy, event->xclient.message_type);
320 char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]);
321 if (!s1)
322 s1 = "(null)";
323 if (!s2)
324 s2 = "(null)";
325 fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n",
326 progname, s1, s2);
327 }
328 else {
329 exit (0);
330 }
331 break;
332 default:
333 break;
334 }
335 return key;
336}
337
338
339int screenhack_handle_events(bool *release)
340{
341 int key=0;
342 XtAppLock(app);
343 if(XPending(dpy))
344 {
345 XEvent event;
346 XNextEvent(dpy, &event);
347 key=screenhack_handle_event(&event, release);
348 }
349 XtAppUnlock(app);
350 return key;
351}
352
353
354static Visual *pick_visual (Screen *screen)
355{
356#ifdef USE_GL
357 /* If we're linking against GL (that is, this is the version of
358 screenhack.o that the GL hacks will use, which is different from the
359 one that the non-GL hacks will use) then try to pick the "best" visual
360 by interrogating the GL library instead of by asking Xlib. GL knows
361 better.
362 */
363 Visual *v = 0;
364 char *string = get_string_resource ("visualID", "VisualID");
365 char *s;
366
367 if (string)
368 for (s = string; *s; s++)
369 if (isupper (*s)) *s = _tolower (*s);
370
371 if (!string || !*string ||
372 !strcmp (string, "gl") ||
373 !strcmp (string, "best") ||
374 !strcmp (string, "color") ||
375 !strcmp (string, "default"))
376 v = get_gl_visual (screen); /* from ../utils/visual-gl.c */
377
378 if (string)
379 free (string);
380 if (v)
381 return v;
382#endif /* USE_GL */
383
384 return get_visual_resource (screen, "visualID", "VisualID", False);
385}
386
387int main (int argc, char **argv)
388{
389 Widget toplevel;
390 Screen *screen;
391 Visual *visual;
392 Colormap cmap;
393 XEvent event;
394 char version[255];
395
396 sprintf(version,"rockboxui %s",ROCKBOXUI_VERSION);
397#ifdef HAVE_LCD_BITMAP
398 display_zoom=2;
399 {
400 char *env=getenv("RECORDER_ZOOM");
401 if (env) {
402 display_zoom=atoi(env);
403 }
404 }
405#else
406 display_zoom=1;
407 {
408 char *env=getenv("PLAYER_ZOOM");
409 if (env) {
410 display_zoom=atoi(env);
411 }
412 }
413#endif
414
415 if (argc > 1)
416 {
417 int x;
418 for (x=1; x<argc; x++) {
419 if (!strcmp("--old_lcd", argv[x])) {
420 having_new_lcd=FALSE;
421 printf("Using old LCD layout.\n");
422 } else if (!strcmp("--zoom", argv[x])) {
423 x++;
424 display_zoom=atoi(argv[x]);
425 printf("Window zoom is %d\n", display_zoom);
426 } else {
427 printf("rockboxui\n");
428 printf("Arguments:\n");
429 printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n");
430 printf(" --zoom \t window zoom\n");
431 printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
432 exit(0);
433 }
434 }
435 }
436 {
437 static char geometry[40];
438 unsigned int height = (LCD_HEIGHT+2*MARGIN_Y);
439#ifdef LCD_REMOTE_HEIGHT
440 height += (LCD_REMOTE_HEIGHT+2*MARGIN_Y);
441#endif
442 printf("height: %d\n", height);
443 snprintf(geometry, 40, "*geometry: %dx%d",
444 (LCD_WIDTH+2*MARGIN_X) * display_zoom, height * display_zoom);
445 default_defaults[GEOMETRY_POSITION]=geometry;
446 }
447 printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
448
449 merge_options ();
450
451#ifdef __sgi
452 /* We have to do this on SGI to prevent the background color from being
453 overridden by the current desktop color scheme (we'd like our
454 backgrounds to be black, thanks.) This should be the same as setting
455 the "*useSchemes: none" resource, but it's not -- if that resource is
456 present in the `default_defaults' above, it doesn't work, though it
457 does work when passed as an -xrm arg on the command line. So screw it,
458 turn them off from C instead.
459 */
460 SgiUseSchemes ("none");
461#endif /* __sgi */
462
463 XtToolkitThreadInitialize();
464
465 toplevel = XtAppInitialize (&app, progclass, merged_options,
466 merged_options_size, &argc, argv,
467 merged_defaults, 0, 0);
468 dpy = XtDisplay (toplevel);
469 screen = XtScreen (toplevel);
470 db = XtDatabase (dpy);
471
472 XtGetApplicationNameAndClass (dpy, &progname, &progclass);
473
474 /* half-assed way of avoiding buffer-overrun attacks. */
475 if (strlen (progname) >= 100) progname[100] = 0;
476
477 XSetErrorHandler (screenhack_ehandler);
478
479 XA_WM_PROTOCOLS = XInternAtom (dpy, "WM_PROTOCOLS", False);
480 XA_WM_DELETE_WINDOW = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
481
482
483 if (CellsOfScreen (DefaultScreenOfDisplay (dpy)) <= 2)
484 mono_p = True;
485
486 {
487 Boolean def_visual_p;
488 visual = pick_visual (screen);
489
490 if (toplevel->core.width <= 0)
491 toplevel->core.width = 600;
492 if (toplevel->core.height <= 0)
493 toplevel->core.height = 480;
494
495 def_visual_p = (visual == DefaultVisualOfScreen (screen));
496
497 if (!def_visual_p)
498 {
499 unsigned int bg, bd;
500 Widget new;
501
502 cmap = XCreateColormap (dpy, RootWindowOfScreen(screen),
503 visual, AllocNone);
504 bg = get_pixel_resource ("background", "Background", dpy, cmap);
505 bd = get_pixel_resource ("borderColor", "Foreground", dpy, cmap);
506
507 new = XtVaAppCreateShell (progname, progclass,
508 topLevelShellWidgetClass, dpy,
509 XtNmappedWhenManaged, False,
510 XtNvisual, visual,
511 XtNdepth, visual_depth (screen, visual),
512 XtNwidth, toplevel->core.width,
513 XtNheight, toplevel->core.height,
514 XtNcolormap, cmap,
515 XtNbackground, (Pixel) bg,
516 XtNborderColor, (Pixel) bd,
517 XtNinput, True, /* for WM_HINTS */
518 0);
519 XtDestroyWidget (toplevel);
520 toplevel = new;
521 XtRealizeWidget (toplevel);
522 window = XtWindow (toplevel);
523 }
524 else
525 {
526 XtVaSetValues (toplevel,
527 XtNmappedWhenManaged, False,
528 XtNinput, True, /* for WM_HINTS */
529 0);
530 XtRealizeWidget (toplevel);
531 window = XtWindow (toplevel);
532
533 if (get_boolean_resource ("installColormap", "InstallColormap"))
534 {
535 cmap = XCreateColormap (dpy, window,
536 DefaultVisualOfScreen (XtScreen
537 (toplevel)),
538 AllocNone);
539 XSetWindowColormap (dpy, window, cmap);
540 }
541 else
542 {
543 cmap = DefaultColormap (dpy, DefaultScreen (dpy));
544 }
545 }
546
547 XtPopup (toplevel, XtGrabNone);
548
549 XtVaSetValues(toplevel, XtNtitle, version, 0);
550
551 /* For screenhack_handle_events(): select KeyPress, and
552 announce that we accept WM_DELETE_WINDOW. */
553 {
554 XWindowAttributes xgwa;
555 XGetWindowAttributes (dpy, window, &xgwa);
556 XSelectInput (dpy, window,
557 xgwa.your_event_mask | KeyPressMask | KeyRelease |
558 ButtonPressMask | ExposureMask | FocusChangeMask );
559 XChangeProperty (dpy, window, XA_WM_PROTOCOLS, XA_ATOM, 32,
560 PropModeReplace,
561 (unsigned char *) &XA_WM_DELETE_WINDOW, 1);
562 }
563 }
564
565 XSetWindowBackground (dpy, window,
566 get_pixel_resource ("background", "Background",
567 dpy, cmap));
568 XClearWindow (dpy, window);
569
570 /* wait for it to be mapped */
571 XIfEvent (dpy, &event, MapNotify_event_p, (XPointer) window);
572
573 XSync (dpy, False);
574
575 atexit(kb_restore_auto_repeat);
576 kb_disable_auto_repeat(true);
577 screenhack(); /* doesn't return */
578 return 0;
579}
diff --git a/uisimulator/x11/screenhack.h b/uisimulator/x11/screenhack.h
deleted file mode 100644
index 5c2e5321ac..0000000000
--- a/uisimulator/x11/screenhack.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@jwz.org>
2 *
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
9 * implied warranty.
10 */
11
12#ifndef __SCREENHACK_H__
13#define __SCREENHACK_H__
14
15#include <stdlib.h>
16#include <stdbool.h>
17
18#include "config-x11.h"
19
20#ifdef __hpux
21 /* Which of the ten billion standards does values.h belong to?
22 What systems always have it? */
23# include <values.h>
24#endif
25
26#include <stdio.h>
27
28#include <X11/Xlib.h>
29#include <X11/Xresource.h>
30#include <X11/Xos.h>
31#include <X11/Intrinsic.h>
32
33#include "resources.h"
34#include "visual.h"
35
36extern Bool mono_p;
37extern char *progname;
38extern char *progclass;
39extern XrmDatabase db;
40extern XrmOptionDescRec options [];
41extern char *defaults [];
42extern XtAppContext app;
43extern Display* dpy;
44extern Window window;
45
46extern void screenhack();
47extern int screenhack_handle_event(XEvent*, bool *);
48extern int screenhack_handle_events(bool *);
49extern void screen_redraw();
50extern void screen_resized();
51
52#endif /* __SCREENHACK_H__ */
diff --git a/uisimulator/x11/sound.c b/uisimulator/x11/sound.c
deleted file mode 100644
index 06d9c014ff..0000000000
--- a/uisimulator/x11/sound.c
+++ /dev/null
@@ -1,140 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "autoconf.h"
21
22#ifdef ROCKBOX_HAS_SIMSOUND /* play sound in sim enabled */
23
24#include <stdbool.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <unistd.h>
28#include <sys/stat.h>
29#include <fcntl.h>
30#include <sys/ioctl.h>
31#include <sys/soundcard.h>
32
33#include "sound.h"
34
35static bool playing = false;
36
37int sim_sound_init(void)
38{
39 int fd;
40 int pcmbits;
41 int rc;
42 int channels;
43 int rate;
44
45 fd = open("/dev/dsp", O_WRONLY);
46 if(-1 == fd)
47 return 1;
48
49 pcmbits = 16;
50 rc = ioctl(fd, SOUND_PCM_WRITE_BITS, &pcmbits);
51 rc = ioctl(fd, SOUND_PCM_READ_BITS, &pcmbits);
52
53 channels = 2; /* Number of channels, 1=mono */
54 rc = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &channels);
55 rc = ioctl(fd, SOUND_PCM_READ_CHANNELS, &channels);
56
57 rate = 44100; /* Yeah. sampling rate */
58 rc = ioctl(fd, SOUND_PCM_WRITE_RATE, &rate);
59 rc = ioctl(fd, SOUND_PCM_READ_RATE, &rate);
60
61 return fd;
62}
63
64void sim_sound_play(int soundfd, char *buffer, long len)
65{
66 write(soundfd, buffer, len);
67}
68
69void sound_playback_thread(void)
70{
71 int soundfd = sim_sound_init();
72 unsigned char *buf;
73 long size;
74
75 while(-1 == soundfd)
76 sleep(100000); /* wait forever, can't play sound! */
77
78 do {
79
80 while(!sound_get_pcm)
81 /* TODO: fix a fine thread-synch mechanism here */
82 usleep(10000);
83
84 do {
85 sound_get_pcm(&buf, &size);
86 if(!size) {
87 sound_get_pcm = NULL;
88 break;
89 }
90 sim_sound_play(soundfd, (char *)buf, size);
91 usleep(10000);
92 } while(size);
93
94 } while(1);
95
96}
97
98/* Stubs for PCM audio playback. */
99bool pcm_is_playing(void)
100{
101 return playing;
102}
103
104void pcm_mute(bool state)
105{
106 (void)state;
107}
108
109void pcm_play_pause(bool state)
110{
111 (void)state;
112}
113
114bool pcm_is_paused(void)
115{
116 return false;
117}
118
119void pcm_play_stop(void)
120{
121 playing = false;
122}
123
124void pcm_init(void)
125{
126}
127
128void (*sound_get_pcm)(unsigned char** start, long* size);
129void pcm_play_data(void (*get_more)(unsigned char** start, long* size))
130{
131 sound_get_pcm = get_more;
132 playing = true;
133}
134
135long pcm_get_bytes_waiting(void)
136{
137 return 0;
138}
139
140#endif /* ROCKBOX_HAS_SIMSOUND */
diff --git a/uisimulator/x11/sound.h b/uisimulator/x11/sound.h
deleted file mode 100644
index 87499cac8e..0000000000
--- a/uisimulator/x11/sound.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20void sound_playback_thread(void);
21
22extern void (*sound_get_pcm)(unsigned char** start, long* size);
diff --git a/uisimulator/x11/sprintf.h b/uisimulator/x11/sprintf.h
deleted file mode 100644
index 64a22f3c6e..0000000000
--- a/uisimulator/x11/sprintf.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#include <stdarg.h>
2#include <stdio.h>
3
4int rockbox_snprintf (char *buf, size_t size, const char *fmt, ...);
5int rockbox_vsnprintf (char *buf, int size, const char *fmt, va_list ap);
6int rockbox_fprintf (int fd, const char *fmt, ...);
7
8#ifndef NO_REDEFINES_PLEASE
9#define snprintf rockbox_snprintf
10#define vsnprintf rockbox_vsnprintf
11#define fprintf rockbox_fprintf
12#endif
diff --git a/uisimulator/x11/thread.c b/uisimulator/x11/thread.c
deleted file mode 100644
index 6d9139c35d..0000000000
--- a/uisimulator/x11/thread.c
+++ /dev/null
@@ -1,148 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Daniel Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "autoconf.h"
21
22#include <stdio.h>
23#include <pthread.h>
24
25#include "kernel.h"
26#include <sys/time.h>
27
28#ifdef ROCKBOX_HAS_SIMSOUND
29#include "sound.h"
30#endif
31
32long current_tick = 0;
33extern void sim_tick_tasks(void);
34
35static void msleep(int msec)
36{
37 struct timeval delay;
38
39 delay.tv_sec = msec / 1000;
40 delay.tv_usec = (msec % 1000) * 1000;
41 select(0, NULL, NULL, NULL, &delay); /* portable sub-second sleep */
42}
43
44/*
45 * This is not a target thread, so it does not fall under the 1 thread at a
46 * time thing.
47 */
48static void update_tick_thread()
49{
50 struct timeval start, now;
51 long new_tick;
52
53 gettimeofday(&start, NULL);
54 while (1)
55 {
56 msleep(5); /* check twice per simulated target tick */
57 gettimeofday(&now, NULL);
58 new_tick = (now.tv_sec - start.tv_sec) * HZ
59 + (now.tv_usec - start.tv_usec) / (1000000/HZ);
60 if (new_tick > current_tick)
61 {
62 sim_tick_tasks();
63 current_tick = new_tick;
64 }
65 }
66}
67
68/*
69 * We emulate the target threads by using pthreads. We have a mutex that only
70 * allows one thread at a time to execute. It forces each thread to yield()
71 * for the other(s) to run.
72 */
73
74pthread_mutex_t mp;
75
76void init_threads(void)
77{
78 pthread_t tick_tid;
79
80 pthread_mutex_init(&mp, NULL);
81 /* get mutex to only allow one thread running at a time */
82 pthread_mutex_lock(&mp);
83
84 /* start a tick thread */
85 pthread_create(&tick_tid, NULL, (void *(*)(void *)) update_tick_thread,
86 NULL);
87
88#ifdef ROCKBOX_HAS_SIMSOUND /* start thread that plays PCM data */
89 {
90 pthread_t sound_tid;
91 pthread_create(&sound_tid, NULL,
92 (void *(*)(void *)) sound_playback_thread,
93 NULL);
94 }
95#endif
96
97}
98/*
99 int pthread_create(pthread_t *new_thread_ID,
100 const pthread_attr_t *attr,
101 void * (*start_func)(void *), void *arg);
102*/
103
104void yield(void)
105{
106 pthread_mutex_unlock(&mp); /* return */
107 msleep(1); /* prevent busy loop */
108 pthread_mutex_lock(&mp); /* get it again */
109}
110
111void newfunc(void (*func)(void))
112{
113 pthread_mutex_lock(&mp);
114 func();
115 pthread_mutex_unlock(&mp);
116}
117
118
119int create_thread(void (*fp)(void), void* sp, int stk_size)
120{
121 pthread_t tid;
122 int i;
123 int error;
124
125 /* we really don't care about these arguments */
126 (void)sp;
127 (void)stk_size;
128 error = pthread_create(&tid,
129 NULL, /* default attributes please */
130 (void *(*)(void *)) newfunc, /* function to start */
131 fp /* start argument */);
132 if(0 != error)
133 fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
134 else
135 fprintf(stderr, "Thread %ld is running\n", (long)tid);
136
137 yield();
138
139 return error;
140}
141
142void sim_sleep(int ticks)
143{
144 pthread_mutex_unlock(&mp); /* return */
145 msleep((1000/HZ) * ticks);
146 pthread_mutex_lock(&mp); /* get it again */
147}
148
diff --git a/uisimulator/x11/timefuncs.h b/uisimulator/x11/timefuncs.h
deleted file mode 100644
index de17fcdc73..0000000000
--- a/uisimulator/x11/timefuncs.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#include <time.h>
2#include <stdbool.h>
3
4/* struct tm defined */
5struct tm *get_time(void);
6int set_time(const struct tm *tm);
7bool valid_time(const struct tm *tm);
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
deleted file mode 100644
index 57870c39d3..0000000000
--- a/uisimulator/x11/uibasic.c
+++ /dev/null
@@ -1,277 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include <stdio.h>
20#include <string.h>
21#include <stdarg.h>
22#include <stdlib.h>
23#include <ctype.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26#include <fcntl.h>
27
28#include <errno.h>
29#include <ctype.h>
30#include <time.h>
31
32#include "config.h"
33#include "screenhack.h"
34
35#include "version.h"
36
37#include "lcd-x11.h"
38#include "lcd-playersim.h"
39
40#define MAX(x,y) ((x)>(y)?(x):(y))
41#define MIN(x,y) ((x)<(y)?(x):(y))
42
43#define PROGNAME "rockboxui"
44
45/* -- -- */
46
47GC draw_gc;
48static Colormap cmap;
49
50int display_zoom=1;
51bool lcd_display_redraw=true;
52
53XrmOptionDescRec options [] = {
54 /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */
55 { "-server", ".server", XrmoptionSepArg, 0 },
56 { "-help", ".help", XrmoptionNoArg, "false" },
57 { 0, 0, 0, 0 }
58};
59char *progclass = "rockboxui";
60
61#ifdef IRIVER_H100_SERIES
62#define BGCOLOR "lightblue"
63#elif defined ARCHOS_GMINI120
64#define BGCOLOR "royalblue"
65#else
66#define BGCOLOR "lightgreen"
67#endif
68
69
70char *defaults [] = {
71 ".background: " BGCOLOR,
72 ".foreground: black",
73 "*help: false",
74 0
75};
76
77static XColor getcolor[4];
78
79/* set a range of bitmap indices to a gradient from startcolour to endcolour
80 inherited from the win32 sim code by Jens Arnold */
81static void lcdcolors(int index, int count, XColor *start, XColor *end)
82{
83 int i;
84 count--;
85 for (i = 0; i <= count; i++)
86 {
87 getcolor[i+index].red = start->red
88 + (end->red - start->red) * i / count;
89 getcolor[i+index].green = start->green
90 + (end->green - start->green) * i / count;
91 getcolor[i+index].blue = start->blue
92 + (end->blue - start->blue) * i / count;
93 XAllocColor (dpy, cmap, &getcolor[i+index]);
94 }
95}
96
97
98void init_window ()
99{
100 XGCValues gcv;
101 XWindowAttributes xgwa;
102
103 XGetWindowAttributes (dpy, window, &xgwa);
104 XColor bg;
105 XColor fg;
106
107 cmap = xgwa.colormap;
108
109 XParseColor (dpy, cmap, BGCOLOR, &bg);
110 XParseColor (dpy, cmap, "black", &fg);
111 getcolor[0] = bg;
112 getcolor[1] = bg;
113 getcolor[2] = bg;
114 getcolor[3] = bg;
115
116 lcdcolors(0, 4, &bg, &fg);
117
118#if 0
119 for(i=0; i<4; i++) {
120 printf("color %d: %d %d %d\n",
121 i,
122 getcolor[i].red,
123 getcolor[i].green,
124 getcolor[i].blue);
125 }
126#endif
127
128 gcv.function = GXxor;
129 gcv.foreground = getcolor[3].pixel;
130 draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
131
132 screen_resized(LCD_WIDTH, LCD_HEIGHT);
133}
134
135void screen_resized(int width, int height)
136{
137 int maxx, maxy;
138 maxx = width;
139 maxy = height;
140
141 XtAppLock(app);
142 XSetForeground(dpy, draw_gc, getcolor[0].pixel);
143
144 XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom,
145 height*display_zoom);
146 XtAppUnlock(app);
147 screen_redraw();
148}
149
150void drawrect(int color, int x1, int y1, int x2, int y2)
151{
152 XtAppLock(app);
153 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
154 XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
155 x2*display_zoom, y2*display_zoom);
156 XtAppUnlock(app);
157}
158
159static void help(void)
160{
161 printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n"
162 "usage: " PROGNAME "\n");
163}
164
165static void drawline(int color, int x1, int y1, int x2, int y2)
166{
167 XtAppLock(app);
168 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
169
170 XDrawLine(dpy, window, draw_gc,
171 (int)(x1*display_zoom),
172 (int)(y1*display_zoom),
173 (int)(x2*display_zoom),
174 (int)(y2*display_zoom));
175 XtAppUnlock(app);
176}
177
178void dots(int *colors, struct coordinate *points, int count)
179{
180 int color;
181 XtAppLock(app);
182
183 while (count--) {
184 color = colors[count];
185 XSetForeground(dpy, draw_gc, getcolor[color].pixel);
186 XFillRectangle(dpy, window, draw_gc,
187 points[count].x*display_zoom,
188 points[count].y*display_zoom,
189 display_zoom,
190 display_zoom);
191 }
192 XtAppUnlock(app);
193}
194
195/* this is where the applicaton starts */
196extern void app_main(void);
197
198void screenhack()
199{
200 Bool helpme;
201
202 /* This doesn't work, but I don't know why (Daniel 1999-12-01) */
203 helpme = get_boolean_resource ("help", "Boolean");
204 if(helpme)
205 help();
206
207 printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
208
209 init_window();
210
211 screen_redraw();
212
213 app_main();
214}
215
216/* used for the player sim */
217void drawdots(int color, struct coordinate *points, int count)
218{
219 XtAppLock(app);
220 XSetForeground(dpy, draw_gc, getcolor[color==0?0:3].pixel);
221
222 while (count--) {
223 XFillRectangle(dpy, window, draw_gc,
224 points[count].x*display_zoom,
225 points[count].y*display_zoom,
226 display_zoom,
227 display_zoom);
228 }
229 XtAppUnlock(app);
230}
231
232/* used for the player sim */
233void drawrectangles(int color, struct rectangle *points, int count)
234{
235 XtAppLock(app);
236
237 XSetForeground(dpy, draw_gc, getcolor[color==0?0:3].pixel);
238 while (count--) {
239 XFillRectangle(dpy, window, draw_gc,
240 points[count].x*display_zoom,
241 points[count].y*display_zoom,
242 points[count].width*display_zoom,
243 points[count].height*display_zoom);
244 }
245 XtAppUnlock(app);
246}
247
248
249void screen_redraw()
250{
251 /* draw a border around the screen */
252#define X1 0
253#define Y1 0
254#define X2 (LCD_WIDTH + 2*MARGIN_X - 1)
255#define Y2 (LCD_HEIGHT + 2*MARGIN_Y - 1)
256
257 drawline(1, X1, Y1, X2, Y1);
258 drawline(1, X2, Y1, X2, Y2);
259 drawline(1, X1, Y2, X2, Y2);
260 drawline(1, X1, Y1, X1, Y2);
261 lcd_display_redraw = true;
262 lcd_update();
263#ifdef LCD_REMOTE_HEIGHT
264 /* draw a border around the remote LCD screen */
265#define RX1 0
266#define RY1 (Y2 + 1)
267#define RX2 (LCD_REMOTE_WIDTH + 2*MARGIN_X - 1)
268#define RY2 (RY1 + LCD_REMOTE_HEIGHT + 2*MARGIN_Y - 1)
269
270 drawline(1, RX1, RY1, RX2, RY1);
271 drawline(1, RX2, RY1, RX2, RY2);
272 drawline(1, RX1, RY2, RX2, RY2);
273 drawline(1, RX1, RY1, RX1, RY2);
274 lcd_display_redraw = true;
275 lcd_remote_update();
276#endif
277}
diff --git a/uisimulator/x11/utils.h b/uisimulator/x11/utils.h
deleted file mode 100644
index 5045d4aa6d..0000000000
--- a/uisimulator/x11/utils.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
2 *
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
9 * implied warranty.
10 */
11
12#ifdef HAVE_CONFIG_H
13# include "config-x11.h"
14#endif
15
16#include <stdlib.h>
17#include <stdio.h>
18#include <string.h>
19#include <math.h>
20
21#include <X11/Xlib.h>
22#include <X11/Xos.h>
diff --git a/uisimulator/x11/version.h b/uisimulator/x11/version.h
deleted file mode 100644
index 1d40c08781..0000000000
--- a/uisimulator/x11/version.h
+++ /dev/null
@@ -1 +0,0 @@
1#define ROCKBOXUI_VERSION "0.2"
diff --git a/uisimulator/x11/visual.c b/uisimulator/x11/visual.c
deleted file mode 100644
index 57b73151c5..0000000000
--- a/uisimulator/x11/visual.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/* xscreensaver, Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
2 * by Jamie Zawinski <jwz@jwz.org>
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
10 * implied warranty.
11 */
12
13/* This file contains some code for intelligently picking the best visual
14 (where "best" is biased in the direction of either: high color counts;
15 or: having writable color cells...)
16 */
17
18#include "utils.h"
19#include "resources.h" /* for get_string_resource() */
20#include "visual.h"
21
22#include <X11/Xutil.h>
23
24extern char *progname;
25
26
27#ifndef isupper
28# define isupper(c) ((c) >= 'A' && (c) <= 'Z')
29#endif
30#ifndef _tolower
31# define _tolower(c) ((c) - 'A' + 'a')
32#endif
33
34
35static Visual *pick_best_visual (Screen *, Bool, Bool);
36static Visual *pick_mono_visual (Screen *);
37static Visual *pick_best_visual_of_class (Screen *, int);
38static Visual *pick_best_gl_visual (Screen *);
39static Visual *id_to_visual (Screen *, int);
40static Visual *id_to_visual (Screen *screen, int id);
41
42
43#define DEFAULT_VISUAL -1
44#define BEST_VISUAL -2
45#define MONO_VISUAL -3
46#define GRAY_VISUAL -4
47#define COLOR_VISUAL -5
48#define GL_VISUAL -6
49#define SPECIFIC_VISUAL -7
50
51Visual *
52get_visual (Screen *screen, const char *string, Bool prefer_writable_cells,
53 Bool verbose_p)
54{
55 char *v = (string ? strdup(string) : 0);
56 char c, *tmp;
57 int vclass;
58 unsigned long id;
59 Visual *result = 0;
60
61 if (v)
62 for (tmp = v; *tmp; tmp++)
63 if (isupper (*tmp)) *tmp = _tolower (*tmp);
64
65 if (!v || !*v) vclass = BEST_VISUAL;
66 else if (!strcmp (v, "default")) vclass = DEFAULT_VISUAL;
67 else if (!strcmp (v, "best")) vclass = BEST_VISUAL;
68 else if (!strcmp (v, "mono")) vclass = MONO_VISUAL;
69 else if (!strcmp (v, "monochrome")) vclass = MONO_VISUAL;
70 else if (!strcmp (v, "gray")) vclass = GRAY_VISUAL;
71 else if (!strcmp (v, "grey")) vclass = GRAY_VISUAL;
72 else if (!strcmp (v, "color")) vclass = COLOR_VISUAL;
73 else if (!strcmp (v, "gl")) vclass = GL_VISUAL;
74 else if (!strcmp (v, "staticgray")) vclass = StaticGray;
75 else if (!strcmp (v, "staticcolor")) vclass = StaticColor;
76 else if (!strcmp (v, "truecolor")) vclass = TrueColor;
77 else if (!strcmp (v, "grayscale")) vclass = GrayScale;
78 else if (!strcmp (v, "greyscale")) vclass = GrayScale;
79 else if (!strcmp (v, "pseudocolor")) vclass = PseudoColor;
80 else if (!strcmp (v, "directcolor")) vclass = DirectColor;
81 else if (1 == sscanf (v, " %ld %c", &id, &c)) vclass = SPECIFIC_VISUAL;
82 else if (1 == sscanf (v, " 0x%lx %c", &id, &c)) vclass = SPECIFIC_VISUAL;
83 else
84 {
85 fprintf (stderr, "%s: unrecognized visual \"%s\".\n", progname, v);
86 vclass = DEFAULT_VISUAL;
87 }
88
89 if (vclass == DEFAULT_VISUAL)
90 result = DefaultVisualOfScreen (screen);
91 else if (vclass == BEST_VISUAL)
92 result = pick_best_visual (screen, prefer_writable_cells, False);
93 else if (vclass == MONO_VISUAL)
94 {
95 result = pick_mono_visual (screen);
96 if (!result && verbose_p)
97 fprintf (stderr, "%s: no monochrome visuals.\n", progname);
98 }
99 else if (vclass == GRAY_VISUAL)
100 {
101 if (prefer_writable_cells)
102 result = pick_best_visual_of_class (screen, GrayScale);
103 if (!result)
104 result = pick_best_visual_of_class (screen, StaticGray);
105 if (!result)
106 result = pick_best_visual_of_class (screen, GrayScale);
107 if (!result && verbose_p)
108 fprintf (stderr, "%s: no GrayScale or StaticGray visuals.\n",
109 progname);
110 }
111 else if (vclass == COLOR_VISUAL)
112 {
113 int class;
114 /* First see if the default visual will do. */
115 result = DefaultVisualOfScreen (screen);
116 class = visual_class(screen, result);
117 if (class != TrueColor &&
118 class != PseudoColor &&
119 class != DirectColor &&
120 class != StaticColor)
121 result = 0;
122 if (result && visual_depth(screen, result) <= 1)
123 result = 0;
124
125 /* Else, find the best non-default color visual */
126 if (!result)
127 result = pick_best_visual (screen, prefer_writable_cells, True);
128
129 if (!result && verbose_p)
130 fprintf (stderr, "%s: no color visuals.\n", progname);
131 }
132 else if (vclass == GL_VISUAL)
133 {
134 Visual *visual = pick_best_gl_visual (screen);
135 if (visual)
136 result = visual;
137 else if (verbose_p)
138 fprintf (stderr, "%s: no visual suitable for GL.\n", progname);
139 }
140 else if (vclass == SPECIFIC_VISUAL)
141 {
142 result = id_to_visual (screen, id);
143 if (!result && verbose_p)
144 fprintf (stderr, "%s: no visual with id 0x%x.\n", progname,
145 (unsigned int) id);
146 }
147 else
148 {
149 Visual *visual = pick_best_visual_of_class (screen, vclass);
150 if (visual)
151 result = visual;
152 else if (verbose_p)
153 fprintf (stderr, "%s: no visual of class %s.\n", progname, v);
154 }
155
156 if (v) free (v);
157 return result;
158}
159
160Visual *
161get_visual_resource (Screen *screen, char *name, char *class,
162 Bool prefer_writable_cells)
163{
164 char *string = get_string_resource (name, class);
165 Visual *v = get_visual (screen, string, prefer_writable_cells, True);
166 if (string)
167 free(string);
168 if (v)
169 return v;
170 else
171 return DefaultVisualOfScreen (screen);
172}
173
174
175static Visual *
176pick_best_visual (Screen *screen, Bool prefer_writable_cells, Bool color_only)
177{
178 Visual *visual;
179
180 if (!prefer_writable_cells)
181 {
182 /* If we don't prefer writable cells, then the "best" visual is the one
183 on which we can allocate the largest range and number of colors.
184
185 Therefore, a TrueColor visual which is at least 16 bits deep is best.
186 (The assumption here being that a TrueColor of less than 16 bits is
187 really just a PseudoColor visual with a pre-allocated color cube.)
188
189 The next best thing is a PseudoColor visual of any type. After that
190 come the non-colormappable visuals, and non-color visuals.
191 */
192 if ((visual = pick_best_visual_of_class (screen, TrueColor)) &&
193 visual_depth (screen, visual) >= 16)
194 return visual;
195 }
196
197#define TRY_CLASS(CLASS) \
198 if ((visual = pick_best_visual_of_class (screen, CLASS)) && \
199 (!color_only || visual_depth(screen, visual) > 1)) \
200 return visual
201 TRY_CLASS(PseudoColor);
202 TRY_CLASS(TrueColor);
203 TRY_CLASS(DirectColor);
204 TRY_CLASS(StaticColor);
205 if (!color_only)
206 {
207 TRY_CLASS(GrayScale);
208 TRY_CLASS(StaticGray);
209 }
210#undef TRY_CLASS
211
212 visual = DefaultVisualOfScreen (screen);
213 if (!color_only || visual_depth(screen, visual) > 1)
214 return visual;
215 else
216 return 0;
217}
218
219static Visual *
220pick_mono_visual (Screen *screen)
221{
222 Display *dpy = DisplayOfScreen (screen);
223 XVisualInfo vi_in, *vi_out;
224 int out_count;
225
226 vi_in.depth = 1;
227 vi_in.screen = screen_number (screen);
228 vi_out = XGetVisualInfo (dpy, (VisualDepthMask | VisualScreenMask),
229 &vi_in, &out_count);
230 if (vi_out)
231 {
232 Visual *v = (out_count > 0 ? vi_out [0].visual : 0);
233 if (v && vi_out[0].depth != 1)
234 v = 0;
235 XFree ((char *) vi_out);
236 return v;
237 }
238 else
239 return 0;
240}
241
242
243static Visual *
244pick_best_visual_of_class (Screen *screen, int visual_class)
245{
246 /* The best visual of a class is the one which on which we can allocate
247 the largest range and number of colors, which means the one with the
248 greatest depth and number of cells.
249
250 (But actually, for XDaliClock, all visuals of the same class are
251 probably equivalent - either we have writable cells or we don't.)
252 */
253 Display *dpy = DisplayOfScreen (screen);
254 XVisualInfo vi_in, *vi_out;
255 int out_count;
256
257 vi_in.class = visual_class;
258 vi_in.screen = screen_number (screen);
259 vi_out = XGetVisualInfo (dpy, (VisualClassMask | VisualScreenMask),
260 &vi_in, &out_count);
261 if (vi_out)
262 {
263 /* choose the 'best' one, if multiple */
264 int i, best;
265 Visual *visual;
266/* for (i = 0, best = 0; i < out_count; i++) */
267 for (i = out_count-1, best = i; i >= 0; i--) /* go backwards */
268 /* It's better if it's deeper, or if it's the same depth with
269 more cells (does that ever happen? Well, it could...) */
270 if ((vi_out [i].depth > vi_out [best].depth) ||
271 ((vi_out [i].depth == vi_out [best].depth) &&
272 (vi_out [i].colormap_size > vi_out [best].colormap_size)))
273 best = i;
274 visual = (best < out_count ? vi_out [best].visual : 0);
275 XFree ((char *) vi_out);
276 return visual;
277 }
278 else
279 return 0;
280}
281
282static Visual *
283pick_best_gl_visual (Screen *screen)
284{
285 /* The best visual for GL is a TrueColor visual that is half as deep as
286 the screen. If such a thing doesn't exist, then TrueColor is best.
287 Failing that, the deepest available color visual is best.
288
289 Compare this function to get_gl_visual() in visual-gl.c.
290 This function tries to find the best GL visual using Xlib calls,
291 whereas that function does the same thing using GLX calls.
292 */
293 Display *dpy = DisplayOfScreen (screen);
294 XVisualInfo vi_in, *vi_out;
295 int out_count;
296 Visual *result = 0;
297
298 int ndepths = 0;
299 int *depths = XListDepths (dpy, screen_number (screen), &ndepths);
300 int screen_depth = depths[ndepths];
301 XFree (depths);
302
303 vi_in.class = TrueColor;
304 vi_in.screen = screen_number (screen);
305 vi_in.depth = screen_depth / 2;
306 vi_out = XGetVisualInfo (dpy, (VisualClassMask | VisualScreenMask |
307 VisualDepthMask),
308 &vi_in, &out_count);
309 if (out_count > 0)
310 result = vi_out[0].visual;
311
312 if (vi_out)
313 XFree ((char *) vi_out);
314
315 if (!result && screen_depth > 24)
316 {
317 /* If it's a 32-deep screen and we didn't find a depth-16 visual,
318 see if there's a depth-12 visual. */
319 vi_in.class = TrueColor;
320 vi_in.screen = screen_number (screen);
321 vi_in.depth = 12;
322 vi_out = XGetVisualInfo (dpy, (VisualClassMask | VisualScreenMask |
323 VisualDepthMask),
324 &vi_in, &out_count);
325 if (out_count > 0)
326 result = vi_out[0].visual;
327 }
328
329 if (!result)
330 /* No half-depth TrueColor? Ok, try for any TrueColor (the deepest.) */
331 result = pick_best_visual_of_class (screen, TrueColor);
332
333 if (!result)
334 /* No TrueColor? Ok, try for anything. */
335 result = pick_best_visual (screen, False, False);
336
337 return result;
338}
339
340
341static Visual *
342id_to_visual (Screen *screen, int id)
343{
344 Display *dpy = DisplayOfScreen (screen);
345 XVisualInfo vi_in, *vi_out;
346 int out_count;
347 vi_in.screen = screen_number (screen);
348 vi_in.visualid = id;
349 vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualIDMask),
350 &vi_in, &out_count);
351 if (vi_out)
352 {
353 Visual *v = vi_out[0].visual;
354 XFree ((char *) vi_out);
355 return v;
356 }
357 return 0;
358}
359
360int
361visual_depth (Screen *screen, Visual *visual)
362{
363 Display *dpy = DisplayOfScreen (screen);
364 XVisualInfo vi_in, *vi_out;
365 int out_count, d;
366 vi_in.screen = screen_number (screen);
367 vi_in.visualid = XVisualIDFromVisual (visual);
368 vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask,
369 &vi_in, &out_count);
370 if (! vi_out) abort ();
371 d = vi_out [0].depth;
372 XFree ((char *) vi_out);
373 return d;
374}
375
376
377#if 0
378/* You very probably don't want to be using this.
379 Pixmap depth doesn't refer to the depths of pixmaps, but rather, to
380 the depth of protocol-level on-the-wire pixmap data, that is, XImages.
381 To get this info, you should be looking at XImage->bits_per_pixel
382 instead. (And allocating the data for your XImage structures by
383 multiplying ximage->bytes_per_line by ximage->height.)
384 */
385int
386visual_pixmap_depth (Screen *screen, Visual *visual)
387{
388 Display *dpy = DisplayOfScreen (screen);
389 int vdepth = visual_depth (screen, visual);
390 int pdepth = vdepth;
391 int i, pfvc = 0;
392 XPixmapFormatValues *pfv = XListPixmapFormats (dpy, &pfvc);
393
394 /* Return the first matching depth in the pixmap formats. If there are no
395 matching pixmap formats (which shouldn't be able to happen at all) then
396 return the visual depth instead. */
397 for (i = 0; i < pfvc; i++)
398 if (pfv[i].depth == vdepth)
399 {
400 pdepth = pfv[i].bits_per_pixel;
401 break;
402 }
403 if (pfv)
404 XFree (pfv);
405 return pdepth;
406}
407#endif /* 0 */
408
409
410int
411visual_class (Screen *screen, Visual *visual)
412{
413 Display *dpy = DisplayOfScreen (screen);
414 XVisualInfo vi_in, *vi_out;
415 int out_count, c;
416 vi_in.screen = screen_number (screen);
417 vi_in.visualid = XVisualIDFromVisual (visual);
418 vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask,
419 &vi_in, &out_count);
420 if (! vi_out) abort ();
421 c = vi_out [0].class;
422 XFree ((char *) vi_out);
423 return c;
424}
425
426Bool
427has_writable_cells (Screen *screen, Visual *visual)
428{
429 switch (visual_class (screen, visual))
430 {
431 case GrayScale: /* Mappable grays. */
432 case PseudoColor: /* Mappable colors. */
433 return True;
434 case StaticGray: /* Fixed grays. */
435 case TrueColor: /* Fixed colors. */
436 case StaticColor: /* (What's the difference again?) */
437 case DirectColor: /* DirectColor visuals are like TrueColor, but have
438 three colormaps - one for each component of RGB.
439 Screw it. */
440 return False;
441 default:
442 abort();
443 return False;
444 }
445}
446
447void
448describe_visual (FILE *f, Screen *screen, Visual *visual, Bool private_cmap_p)
449{
450 char n[10];
451 Display *dpy = DisplayOfScreen (screen);
452 XVisualInfo vi_in, *vi_out;
453 int out_count;
454 vi_in.screen = screen_number (screen);
455 vi_in.visualid = XVisualIDFromVisual (visual);
456 vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualIDMask),
457 &vi_in, &out_count);
458 if (! vi_out) abort ();
459 if (private_cmap_p)
460 sprintf(n, "%3d", vi_out->colormap_size);
461 else
462 strcpy(n, "default");
463
464 fprintf (f, "0x%02x (%s depth: %2d, cmap: %s)\n",
465 (unsigned int) vi_out->visualid,
466 (vi_out->class == StaticGray ? "StaticGray, " :
467 vi_out->class == StaticColor ? "StaticColor," :
468 vi_out->class == TrueColor ? "TrueColor, " :
469 vi_out->class == GrayScale ? "GrayScale, " :
470 vi_out->class == PseudoColor ? "PseudoColor," :
471 vi_out->class == DirectColor ? "DirectColor," :
472 "UNKNOWN: "),
473 vi_out->depth, n);
474 XFree ((char *) vi_out);
475}
476
477int
478screen_number (Screen *screen)
479{
480 Display *dpy = DisplayOfScreen (screen);
481 int i;
482 for (i = 0; i < ScreenCount (dpy); i++)
483 if (ScreenOfDisplay (dpy, i) == screen)
484 return i;
485 abort ();
486 return 0;
487}
488
489int
490visual_cells (Screen *screen, Visual *visual)
491{
492 Display *dpy = DisplayOfScreen (screen);
493 XVisualInfo vi_in, *vi_out;
494 int out_count, c;
495 vi_in.screen = screen_number (screen);
496 vi_in.visualid = XVisualIDFromVisual (visual);
497 vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask,
498 &vi_in, &out_count);
499 if (! vi_out) abort ();
500 c = vi_out [0].colormap_size;
501 XFree ((char *) vi_out);
502 return c;
503}
504
505Visual *
506find_similar_visual(Screen *screen, Visual *old_visual)
507{
508 Display *dpy = DisplayOfScreen (screen);
509 XVisualInfo vi_in, *vi_out;
510 Visual *result = 0;
511 int out_count;
512
513 vi_in.screen = screen_number (screen);
514 vi_in.class = visual_class (screen, old_visual);
515 vi_in.depth = visual_depth (screen, old_visual);
516
517 /* Look for a visual of the same class and depth.
518 */
519 vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualClassMask |
520 VisualDepthMask),
521 &vi_in, &out_count);
522 if (vi_out && out_count > 0)
523 result = vi_out[0].visual;
524 if (vi_out) XFree (vi_out);
525 vi_out = 0;
526
527 /* Failing that, look for a visual of the same class.
528 */
529 if (!result)
530 {
531 vi_out = XGetVisualInfo (dpy, (VisualScreenMask | VisualClassMask),
532 &vi_in, &out_count);
533 if (vi_out && out_count > 0)
534 result = vi_out[0].visual;
535 if (vi_out) XFree (vi_out);
536 vi_out = 0;
537 }
538
539 /* Failing that, return the default visual. */
540 if (!result)
541 result = DefaultVisualOfScreen (screen);
542
543 return result;
544}
diff --git a/uisimulator/x11/visual.h b/uisimulator/x11/visual.h
deleted file mode 100644
index dd45708ea0..0000000000
--- a/uisimulator/x11/visual.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* xscreensaver, Copyright (c) 1993-1999 by Jamie Zawinski <jwz@jwz.org>
2 *
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
9 * implied warranty.
10 */
11
12#ifndef __VISUAL_H__
13#define __VISUAL_H__
14
15extern Visual *get_visual (Screen *, const char *name, Bool, Bool);
16extern Visual *get_visual_resource (Screen *, char *, char *, Bool);
17extern int visual_depth (Screen *, Visual *);
18/* extern int visual_pixmap_depth (Screen *, Visual *); */
19extern int visual_class (Screen *, Visual *);
20extern int visual_cells (Screen *, Visual *);
21extern int screen_number (Screen *);
22extern Visual *find_similar_visual (Screen *, Visual *old);
23extern void describe_visual (FILE *f, Screen *, Visual *, Bool private_cmap_p);
24extern Visual *get_overlay_visual (Screen *, unsigned long *pixel_return);
25extern Bool has_writable_cells (Screen *screen, Visual *visual);
26
27Visual *get_gl_visual (Screen *screen);
28
29#endif /* __VISUAL_H__ */
diff --git a/uisimulator/x11/vroot.h b/uisimulator/x11/vroot.h
deleted file mode 100644
index 83c7ba9acc..0000000000
--- a/uisimulator/x11/vroot.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*****************************************************************************/
2/** Copyright 1991 by Andreas Stolcke **/
3/** Copyright 1990 by Solbourne Computer Inc. **/
4/** Longmont, Colorado **/
5/** **/
6/** All Rights Reserved **/
7/** **/
8/** Permission to use, copy, modify, and distribute this software and **/
9/** its documentation for any purpose and without fee is hereby **/
10/** granted, provided that the above copyright notice appear in all **/
11/** copies and that both that copyright notice and this permis- **/
12/** sion notice appear in supporting documentation, and that the **/
13/** name of Solbourne not be used in advertising **/
14/** in publicity pertaining to distribution of the software without **/
15/** specific, written prior permission. **/
16/** **/
17/** ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
18/** WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF **/
19/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/
20/** OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL **/
21/** DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
22/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
23/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
24/** OR PERFORMANCE OF THIS SOFTWARE. **/
25/*****************************************************************************/
26/*
27 * vroot.h -- Virtual Root Window handling header file
28 *
29 * This header file redefines the X11 macros RootWindow and DefaultRootWindow,
30 * making them look for a virtual root window as provided by certain `virtual'
31 * window managers like swm and tvtwm. If none is found, the ordinary root
32 * window is returned, thus retaining backward compatibility with standard
33 * window managers.
34 * The function implementing the virtual root lookup remembers the result of
35 * its last invocation to avoid overhead in the case of repeated calls
36 * on the same display and screen arguments.
37 * The lookup code itself is taken from Tom LaStrange's ssetroot program.
38 *
39 * Most simple root window changing X programs can be converted to using
40 * virtual roots by just including
41 *
42 * #include <X11/vroot.h>
43 *
44 * after all the X11 header files. It has been tested on such popular
45 * X clients as xphoon, xfroot, xloadimage, and xaqua.
46 * It also works with the core clients xprop, xwininfo, xwd, and editres
47 * (and is necessary to get those clients working under tvtwm).
48 * It does NOT work with xsetroot; get the xsetroot replacement included in
49 * the tvtwm distribution instead.
50 *
51 * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
52 * - replaced all NULL's with properly cast 0's, 5/6/91
53 * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
54 * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
55 */
56
57#ifndef _VROOT_H_
58#define _VROOT_H_
59
60#if !defined(lint) && !defined(SABER)
61static const char vroot_rcsid[] = "#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #";
62#endif
63
64#include <X11/X.h>
65#include <X11/Xatom.h>
66#include <X11/Xlib.h>
67
68static Window
69#ifdef __STDC__ /* ANSIfication added by jwz, to avoid superfluous warnings. */
70VirtualRootWindowOfScreen(Screen *screen)
71#else /* !__STDC__ */
72VirtualRootWindowOfScreen(screen) Screen *screen;
73#endif /* !__STDC__ */
74{
75 static Screen *save_screen = (Screen *)0;
76 static Window root = (Window)0;
77
78 if (screen != save_screen) {
79 Display *dpy = DisplayOfScreen(screen);
80 Atom __SWM_VROOT = None;
81 unsigned int i;
82 Window rootReturn, parentReturn, *children;
83 unsigned int numChildren;
84
85 root = RootWindowOfScreen(screen);
86
87 /* go look for a virtual root */
88 __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
89 if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
90 &children, &numChildren)) {
91 for (i = 0; i < numChildren; i++) {
92 Atom actual_type;
93 int actual_format;
94 unsigned long nitems, bytesafter;
95 Window *newRoot = (Window *)0;
96
97 if (XGetWindowProperty(dpy, children[i],
98 __SWM_VROOT, 0, 1, False, XA_WINDOW,
99 &actual_type, &actual_format,
100 &nitems, &bytesafter,
101 (unsigned char **) &newRoot) == Success
102 && newRoot) {
103 root = *newRoot;
104 break;
105 }
106 }
107 if (children)
108 XFree((char *)children);
109 }
110
111 save_screen = screen;
112 }
113
114 return root;
115}
116
117#undef RootWindowOfScreen
118#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
119
120#undef RootWindow
121#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
122
123#undef DefaultRootWindow
124#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
125
126#endif /* _VROOT_H_ */
diff --git a/uisimulator/x11/xmu.h b/uisimulator/x11/xmu.h
deleted file mode 100644
index 48084f747e..0000000000
--- a/uisimulator/x11/xmu.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* This file contains compatibility routines for systems without Xmu.
2 * You would be better served by installing Xmu on your machine or
3 * yelling at your vendor to ship it.
4 */
5
6#ifndef __XMU_H__
7#define __XMU_H__
8
9#include <X11/Xlib.h>
10#include <stdio.h>
11
12int XmuPrintDefaultErrorMessage (Display *dpy, XErrorEvent *event, FILE *fp);
13
14#endif /* __XMU_H__ */