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