Index: webos/buildpkg.sh =================================================================== --- webos/buildpkg.sh (revision 0) +++ webos/buildpkg.sh (revision 0) @@ -0,0 +1,4 @@ +#!/bin/sh + +cp ../debian/maemo/rockbox.png ./package +palm-package package Property changes on: webos/buildpkg.sh ___________________________________________________________________ Added: svn:executable + * Index: webos/package/dashboard.js =================================================================== --- webos/package/dashboard.js (revision 0) +++ webos/package/dashboard.js (revision 0) @@ -0,0 +1,48 @@ +enyo.kind({ + name: "RockboxDash", + kind: "HFlexBox", + align: "center", + className: "music-notification", + components: [ + { + kind: "Control", + flex: 1, + className: "info", + components: [ + { + name: "lblSongTitle", + content: "Song", + className: "title" + }, + { + name: "lblArtistName", + content: "Artist", + className: "dashboardSubtitle" + } + ] + }, + + { + kind: "ApplicationEvents", + onWindowParamsChange: "handleWindowParamsChange" + } + ], + + create: function() + { + this.inherited(arguments); + }, + + handleWindowParamsChange: function() + { + if (enyo.windowParams.strTrackTitle && enyo.windowParams.strTrackArtist) { + this.$.lblSongTitle.setContent(enyo.windowParams.strTrackTitle); + this.$.lblArtistName.setContent(enyo.windowParams.strTrackArtist); + /* + enyo.windows.addBannerMessage( + enyo.windowParams.strTrackArtist + " - " + + enyo.windowParams.strTrackTitle, "{}"); + */ + } + } +}); Index: webos/package/appinfo.json =================================================================== --- webos/package/appinfo.json (revision 0) +++ webos/package/appinfo.json (revision 0) @@ -0,0 +1,14 @@ +{ + "id": "org.rockbox.raap-hybrid", + "version": "0.0.1", + "vendor": "The Rockbox Crew", + "vendor_email": "jasonayu@gmail.com", + "vendor_url": "http://www.rockbox.org/", + "type": "web", + "main": "index.html", + "title": "Rockbox", + "icon": "rockbox.png", + "miniicon": "rockbox.png", + "uiRevision": 2, + "plug-ins": true +} Index: webos/package/package.properties =================================================================== --- webos/package/package.properties (revision 0) +++ webos/package/package.properties (revision 0) @@ -0,0 +1,2 @@ +filemode.755 = rockbox + Index: webos/package/app.css =================================================================== --- webos/package/app.css (revision 0) +++ webos/package/app.css (revision 0) @@ -0,0 +1 @@ + Index: webos/package/index.html =================================================================== --- webos/package/index.html (revision 0) +++ webos/package/index.html (revision 0) @@ -0,0 +1,12 @@ + + + +Text To Speech Test + + + + + + Index: webos/package/dashboard.html =================================================================== --- webos/package/dashboard.html (revision 0) +++ webos/package/dashboard.html (revision 0) @@ -0,0 +1,13 @@ + + + +RockboxDash + + + + + + + Index: webos/package/app.js =================================================================== --- webos/package/app.js (revision 0) +++ webos/package/app.js (revision 0) @@ -0,0 +1,99 @@ +enyo.kind({ + name: "Rockbox", + kind: "VFlexBox", + components: [ + { + kind: enyo.Hybrid, + name: "plugin", + width: 320, + height: 480, + executable: "rockbox", + cachePlugin: true, + onPluginReady: "handlePluginReady", + onPluginConnected: "handlePluginConnected" + }, + + { + kind: "ApplicationEvents", + onWindowRotated: "handleWindowRotated", + onWindowDeactivated: "handleWindowDeactivated", + onWindowActivated: "handleWindowActivated", + onUnload: "handleUnload" + }, + + { kind: enyo.Control, name: "output", style: "color: #000000; padding: 2px 6px;" }, + ], + pluginReady: false, + height: 0, + width: 0, + title: "", + artist: "", + album: "", + + create: function() { + this.inherited(arguments); + //enyo.setFullScreen(true); + this.$.plugin.addCallback("settrackinfo", enyo.bind(this, "handleSetTrackInfo"), true); + this.$.plugin.addCallback("setdims", enyo.bind(this, "handleSetDims"), true); + }, + + outputMessage: function(message) { + this.$.output.setContent(message); + console.log("*** " + message); + }, + + handlePluginReady: function(inSender) { + this.pluginReady = true; + //this.outputMessage("plugin initalized"); + //this.outputMessage("width: " + window.innerWidth + " height: " + window.innerHeight); + this.handleWindowRotated(); + }, + + handlePluginConnected: function(inSender) { + this.outputMessage("plugin connected"); + }, + + handleSetTrackInfo: function(title, artist, album) { + this.title = title; + this.artist = artist; + this.album = album; + if ( this.dashWindow != null ) { + enyo.windows.setWindowParams( + this.dashWindow, {strTrackTitle:this.title, strTrackArtist:this.artist} + ); + } + }, + + handleSetDims: function(width, height) { + this.width = width; + this.height = height; + this.outputMessage("width: " + width + " height: " + height); + }, + + handleWindowRotated: function() { + //this.$.plugin.setWidth(window.innerWidth); + //this.$.plugin.setHeight(window.innerHeight); + }, + + handleWindowDeactivated: function() { + //if ( this.title != "") { + this.dashWindow = enyo.windows.openDashboard( + "dashboard.html", "RockboxDash", + {strTrackTitle:this.title, strTrackArtist:this.artist}, {} + ); + //} + }, + + handleWindowActivated: function() { + if ( this.dashWindow != null ) { + this.dashWindow.close(); + } + }, + + handleUnload: function() { + if ( this.dashWindow != null ) { + this.dashWindow.close(); + } + enyo.application.app.cleanup(); + } +}); Index: webos/package/depends.js =================================================================== --- webos/package/depends.js (revision 0) +++ webos/package/depends.js (revision 0) @@ -0,0 +1,6 @@ +enyo.depends( + "app.js", + "app.css", + "dashboard.js", + "dashboard.css" +); Index: webos/package/dashboard.css =================================================================== --- webos/package/dashboard.css (revision 0) +++ webos/package/dashboard.css (revision 0) @@ -0,0 +1,29 @@ +body { + color: white; + background: transparent; +} + +.music-notification { + padding:0 5px; + background:transparent; +} + +.music-notification .info { + font-size:14px; + line-height:1.3em; + margin: 0 0 0 8px; + color:#fff; +} + +.music-notification .info div { + overflow:hidden; + text-overflow:ellipsis; + width: 100%; + white-space:nowrap; +} + +.music-notification .info .title { + font-weight:bold; + font-size:16px; + line-height:1.4em; +} Index: tools/configure =================================================================== --- tools/configure (revision 31646) +++ tools/configure (working copy) @@ -535,6 +535,22 @@ gccchoice="4.1.2" } +weboscc () { + PALMPDK="/opt/PalmPDK" + + prefixtools "$PALMPDK/arm-gcc/bin/arm-none-linux-gnueabi-" + + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef// -e s/-O//` + GCCOPTS="$GCCOPTS -fno-builtin -g" + LDOPTS='-lm' # button-sdl.c uses sqrt() + GLOBAL_LDOPTS="-Wl,--allow-shlib-undefined" + + INCLUDEDIR="$PALMPDK/include" + LIBDIR="$PALMPDK/device/lib" + GCCOPTS="$GCCOPTS -I$INCLUDEDIR -I$INCLUDEDIR/SDL -D_GNU_SOURCE=1 -D_REENTRANT" + LDOPTS="$LDOPTS -L$LIBDIR -Wl,-rpath-link,$LIBDIR,-noinhibit-exec -lSDL -lGLES_CM -lSDL_image -lpdl -lpthread" +} + maemocc () { # Scratchbox sets up "gcc" based on the active target prefixtools "" @@ -1313,7 +1329,7 @@ 203) Nokia N900 ==ROCKCHIP== ==HiFiMAN== 204) Pandora 180) rk27xx generic 190) HM-60x 205) Samsung YP-R0 191) HM-801 - + 206) WebOS EOF buildfor=`input`; @@ -3298,6 +3314,32 @@ t_model="app" ;; + 206|WebOS) + application="yes" + target_id=78 + modelname="webos" + target="WEBOS" + rbdir="/media/cryptofs/apps/usr/palm/applications/org.rockbox.raap-hybrid/app" + app_set_lcd_size + memory=32 + uname=`uname` + simcc "sdl-app" + weboscc + tool="cp " + boottool="cp " + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" + output="rockbox" + bootoutput="rockbox" + appextra="recorder:gui:radio" + plugins="yes" + swcodec="yes" + # architecture, manufacturer and model for the target-tree build + t_cpu="hosted" + t_manufacturer="webos" + t_model="app" + ;; + *) echo "Please select a supported target platform!" exit 7 Index: tools/buildzip.pl =================================================================== --- tools/buildzip.pl (revision 31646) +++ tools/buildzip.pl (working copy) @@ -130,6 +130,12 @@ $bindir .= "/$rbdir"; $libdir = $userdir = $bindir; } + + if ($modelname =~ /webos/) { + $bindir = "./package"; + $libdir = $userdir = $bindir . "/app"; + } + if ($dest =~ /\/dev\/null/) { die "ERROR: No PREFIX given\n" } Index: firmware/export/rbpaths.h =================================================================== --- firmware/export/rbpaths.h (revision 31646) +++ firmware/export/rbpaths.h (working copy) @@ -66,6 +66,11 @@ #define HOME_DIR "" /* replaced at runtime */ #define HOME_DIR_LEN (sizeof(HOME_DIR)-1) +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) +#define PLUGIN_DIR ROCKBOX_DIR "/rocks" +#define CODECS_DIR ROCKBOX_DIR "/codecs" +#else + #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks" #if (CONFIG_PLATFORM & PLATFORM_ANDROID) #define CODECS_DIR ROCKBOX_BINARY_PATH @@ -73,6 +78,8 @@ #define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs" #endif +#endif + extern void paths_init(void); #endif /* !APPLICATION || SAMSUNG_YPR0 */ Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (revision 31646) +++ firmware/export/config.h (working copy) @@ -89,6 +89,7 @@ #define PLATFORM_MAEMO5 (1<<5) #define PLATFORM_MAEMO (PLATFORM_MAEMO4|PLATFORM_MAEMO5) #define PLATFORM_PANDORA (1<<6) +#define PLATFORM_WEBOS (1<<7) /* CONFIG_KEYPAD */ #define PLAYER_PAD 1 @@ -495,6 +496,8 @@ #include "config/pandora.h" #elif defined(SAMSUNG_YPR0) #include "config/samsungypr0.h" +#elif defined(WEBOS) +#include "config/webos.h" #else /* no known platform */ #endif Index: firmware/export/config/webos.h =================================================================== --- firmware/export/config/webos.h (revision 0) +++ firmware/export/config/webos.h (revision 0) @@ -0,0 +1,107 @@ +/* + * This config file is for the SDL application + */ +#define TARGET_TREE /* this target is using the target tree system */ + +/* We don't run on hardware directly */ +#define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_SDL|PLATFORM_WEBOS) + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 100 + +#define MODEL_NAME "Rockbox" + +#define USB_NONE + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN +/* define this if you have access to the pitchscreen */ +#define HAVE_PITCHSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +/* LCD dimensions + * + * overriden by configure for application builds */ +#ifndef LCD_WIDTH +#define LCD_WIDTH 320 +#endif + +#ifndef LCD_HEIGHT +#define LCD_HEIGHT 480 +#endif + +#define LCD_DEPTH 16 +#define LCD_PIXELFORMAT 565 + +/* define this to indicate your device's keypad */ +#define HAVE_TOUCHSCREEN +#define HAVE_BUTTON_DATA + +/* define this if you have RTC RAM available for settings */ +//#define HAVE_RTC_RAM + +/* define this if you have a real-time clock */ +#define CONFIG_RTC APPLICATION + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x100000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x80000 + +#define AB_REPEAT_ENABLE + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +#define HAVE_SCROLLWHEEL +#define CONFIG_KEYPAD SDL_PAD + +/* Use SDL audio/pcm in a SDL app build */ +#define HAVE_SDL +#define HAVE_SDL_AUDIO + +/* define this if the host platform can change volume outside of rockbox */ +#define PLATFORM_HAS_VOLUME_CHANGE + +#define HAVE_SW_TONE_CONTROLS + +/* Define current usage levels. */ +#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */ +#define CURRENT_BACKLIGHT 30 /* TBD */ +#define CURRENT_RECORD 0 /* no recording yet */ + +/* Define this to the CPU frequency */ +/* +#define CPU_FREQ 48000000 +*/ + +/* Offset ( in the firmware file's header ) to the file CRC */ +#define FIRMWARE_OFFSET_FILE_CRC 0 + +/* Offset ( in the firmware file's header ) to the real data */ +#define FIRMWARE_OFFSET_FILE_DATA 8 + +#define CONFIG_LCD LCD_COWOND2 + +/* Define this if a programmable hotkey is mapped */ +#define HAVE_HOTKEY + +#define BOOTDIR "/.rockbox" Index: firmware/target/hosted/webos/buttonmap.h =================================================================== --- firmware/target/hosted/webos/buttonmap.h (revision 0) +++ firmware/target/hosted/webos/buttonmap.h (revision 0) @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: buttonmap.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2010 by Fred Bauer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __BUTTONMAP_H__ +#define __BUTTONMAP_H__ +/* Button maps: simulated key, x, y, radius, name */ +/* Run sim with --mapping to get coordinates */ +/* or --debugbuttons to check */ +/* The First matching button is returned */ +struct button_map { + int button, x, y, radius; + char *description; +}; + +extern struct button_map bm[]; + +int xy2button( int x, int y); + +/* for the sim, these function is implemented in uisimulator/buttonmap/ *.c */ +int key_to_button(int keyboard_button); +#ifdef HAVE_TOUCHSCREEN +int key_to_touch(int keyboard_button, unsigned int mouse_coords); +#endif + +#endif /* __BUTTONMAP_H__ */ Index: firmware/target/hosted/webos/app/adc-target.h =================================================================== --- firmware/target/hosted/webos/app/adc-target.h (revision 0) +++ firmware/target/hosted/webos/app/adc-target.h (revision 0) @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: adc-target.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2010 by Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __ADC_TARGET_H__ +#define __ADC_TARGET_H__ + +#endif /* __ADC_TARGET_H__ */ Index: firmware/target/hosted/webos/app/backlight-target.h =================================================================== --- firmware/target/hosted/webos/app/backlight-target.h (revision 0) +++ firmware/target/hosted/webos/app/backlight-target.h (revision 0) @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: backlight-target.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2010 by Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __BACKLIGHT_TARGET_H__ +#define __BACKLIGHT_TARGET_H__ + +#endif /* __BACKLIGHT_TARGET_H__ */ Index: firmware/target/hosted/webos/app/usb-target.h =================================================================== --- firmware/target/hosted/webos/app/usb-target.h (revision 0) +++ firmware/target/hosted/webos/app/usb-target.h (revision 0) @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: usb-target.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2010 by Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __USB_TARGET_H__ +#define __USB_TARGET_H__ + +#endif /* __USB_TARGET_H__ */ Index: firmware/target/hosted/webos/app/button-target.h =================================================================== --- firmware/target/hosted/webos/app/button-target.h (revision 0) +++ firmware/target/hosted/webos/app/button-target.h (revision 0) @@ -0,0 +1,71 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: button-target.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2007 by Rob Purchase + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" +/* + +#define HAS_BUTTON_HOLD + +bool button_hold(void); +*/ +void button_init_device(void); +#ifdef HAVE_BUTTON_DATA +int button_read_device(int *data); +#else +int button_read_device(void); +#endif + +/* Main unit's buttons */ +#define BUTTON_UP 0x00000001 +#define BUTTON_DOWN 0x00000002 +#define BUTTON_LEFT 0x00000004 +#define BUTTON_RIGHT 0x00000008 +#define BUTTON_SELECT 0x00000010 +#define BUTTON_MENU 0x00000020 +#define BUTTON_BACK 0x00000040 +#define BUTTON_SCROLL_FWD 0x00000100 +#define BUTTON_SCROLL_BACK 0x00000200 + +/* Touch Screen Area Buttons */ +#define BUTTON_TOPLEFT 0x00001000 +#define BUTTON_TOPMIDDLE 0x00002000 +#define BUTTON_TOPRIGHT 0x00004000 +#define BUTTON_MIDLEFT 0x00008000 +#define BUTTON_CENTER 0x00010000 +#define BUTTON_MIDRIGHT 0x00020000 +#define BUTTON_BOTTOMLEFT 0x00040000 +#define BUTTON_BOTTOMMIDDLE 0x00080000 +#define BUTTON_BOTTOMRIGHT 0x00100000 + +#define BUTTON_MAIN 0x1FFF + +/* No remote */ +#define BUTTON_REMOTE 0 + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ Index: firmware/target/hosted/webos/app/i2c-target.h =================================================================== --- firmware/target/hosted/webos/app/i2c-target.h (revision 0) +++ firmware/target/hosted/webos/app/i2c-target.h (revision 0) @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: i2c-target.h 29516 2011-03-05 15:31:52Z thomasjfox $ + * + * Copyright (C) 2010 by Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __I2C_TARGET_H__ +#define __I2C_TARGET_H__ + +#endif /* __I2C_TARGET_H__ */ Index: firmware/target/hosted/webos/button-sdl.h =================================================================== --- firmware/target/hosted/webos/button-sdl.h (revision 0) +++ firmware/target/hosted/webos/button-sdl.h (revision 0) @@ -0,0 +1,40 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: button-sdl.h 29248 2011-02-08 20:05:25Z thomasjfox $ + * + * Copyright (C) 2009 by Thomas Martitz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#ifndef __BUTTON_SDL_H__ +#define __BUTTON_SDL_H__ + +#include +#include "config.h" + +extern int sdl_app_has_input_focus; + +bool button_hold(void); +#undef button_init_device +void button_init_device(void); +#ifdef HAVE_BUTTON_DATA +int button_read_device(int *data); +#else +int button_read_device(void); +#endif + +#endif /* __BUTTON_SDL_H__ */ Index: firmware/target/hosted/webos/system-sdl.h =================================================================== --- firmware/target/hosted/webos/system-sdl.h (revision 0) +++ firmware/target/hosted/webos/system-sdl.h (revision 0) @@ -0,0 +1,64 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: system-sdl.h 31339 2011-12-17 07:27:24Z jethead71 $ + * + * Copyright (C) 2007 by Michael Sevakis + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _SYSTEM_SDL_H_ +#define _SYSTEM_SDL_H_ + +#include +#include "config.h" +#include "gcc_extensions.h" + +#define HIGHEST_IRQ_LEVEL 1 + +int set_irq_level(int level); + +#define disable_irq() \ + ((void)set_irq_level(HIGHEST_IRQ_LEVEL)) + +#define enable_irq() \ + ((void)set_irq_level(0)) + +#define disable_irq_save() \ + set_irq_level(HIGHEST_IRQ_LEVEL) + +#define restore_irq(level) \ + ((void)set_irq_level(level)) + +void sim_enter_irq_handler(void); +void sim_exit_irq_handler(void); +void sim_kernel_shutdown(void); +void sys_poweroff(void); +void sys_handle_argv(int argc, char *argv[]); +void gui_message_loop(void); +void sim_do_exit(void) NORETURN_ATTR; +#ifndef HAVE_SDL_THREADS +void wait_for_interrupt(void); +#endif + +extern bool background; /* True if the background image is enabled */ +extern bool showremote; +extern int display_zoom; +extern long start_tick; + +static inline void commit_dcache(void) {} +static inline void commit_discard_dcache(void) {} +static inline void commit_discard_idcache(void) {} + +#endif /* _SYSTEM_SDL_H_ */ Index: firmware/target/hosted/webos/system-target.h =================================================================== --- firmware/target/hosted/webos/system-target.h (revision 0) +++ firmware/target/hosted/webos/system-target.h (revision 0) @@ -0,0 +1,4 @@ +#include "system-sdl.h" + +#define NEED_GENERIC_BYTESWAPS + Index: firmware/target/hosted/sdl/system-sdl.c =================================================================== --- firmware/target/hosted/sdl/system-sdl.c (revision 31646) +++ firmware/target/hosted/sdl/system-sdl.c (working copy) @@ -47,6 +47,16 @@ #endif +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) +#include +#include "metadata.h" +#include "appevents.h" +#include "PDL.h" +#include +GLuint textureid; +SDL_Surface *pdk_stage; +#endif + SDL_Surface *gui_surface; bool background = true; /* use backgrounds by default */ @@ -71,6 +81,42 @@ bool debug_wps = false; int wps_verbose_level = 3; + + + +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) +int pdk_width, pdk_height; +PDL_bool PDK_InitVideo(PDL_JSParameters *params) +{ + return PDL_TRUE; +} + +static void track_changed_callback(void *param) +{ + struct mp3entry* id3 = (struct mp3entry*)param; + if (id3) + { + const char *params[3]; + params[0] = id3->title; + params[1] = id3->artist; + params[2] = id3->album; + PDL_CallJS("settrackinfo", params, 3); + } +} + +static void track_finished_callback(void *param) +{ + /* + const char *params[3]; + params[0] = ""; + params[1] = ""; + params[2] = ""; + PDL_CallJS("settrackinfo", params, 3); + */ +} + +#endif + /* * This thread will read the buttons in an interrupt like fashion, and * also initializes SDL_INIT_VIDEO and the surfaces @@ -82,7 +128,10 @@ **/ static int sdl_event_thread(void * param) { +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) +#else SDL_InitSubSystem(SDL_INIT_VIDEO); +#endif #if (CONFIG_PLATFORM & PLATFORM_MAEMO) SDL_sem *wait_for_maemo_startup; @@ -132,10 +181,14 @@ /* Fullscreen mode for maemo app */ flags |= SDL_FULLSCREEN; #endif - +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) + pdk_height = height; + pdk_width = width; +#else if ((gui_surface = SDL_SetVideoMode(width * display_zoom, height * display_zoom, depth, flags)) == NULL) { panicf("%s", SDL_GetError()); } +#endif #if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA)) /* SDL touch screen fix: Work around a SDL assumption that returns @@ -193,6 +246,7 @@ #ifdef HAVE_SDL_THREADS sim_thread_shutdown(); /* not needed for native threads */ #endif + return 0; } @@ -226,6 +280,9 @@ { sim_kernel_shutdown(); +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) + PDL_Quit(); +#endif SDL_Quit(); exit(EXIT_SUCCESS); } @@ -244,8 +301,14 @@ g_type_init(); #endif +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) + openlog("ROCKBOX", 0, LOG_USER); + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER)) + panicf("%s", SDL_GetError()); +#else if (SDL_Init(SDL_INIT_TIMER)) panicf("%s", SDL_GetError()); +#endif s = SDL_CreateSemaphore(0); /* 0-count so it blocks */ @@ -256,6 +319,53 @@ SDL_SemWait(s); /* cleanup */ SDL_DestroySemaphore(s); + + +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) + // Tell it to use OpenGL version 1.0 + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + // Set the video mode to full screen + pdk_stage = SDL_SetVideoMode(0, 0, 0, SDL_OPENGL); + + // setup openGL + glClearColor (0.0f, 0.0f, 0.0f, 0.0f); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrthof(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); + glMatrixMode(GL_MODELVIEW); + + glEnable(GL_TEXTURE_2D); + + glGenTextures(1, &textureid); + glBindTexture(GL_TEXTURE_2D, textureid); + + //change to texture matrix and do the trick + glMatrixMode(GL_TEXTURE); + glRotatef(180.0f,0.0f,0.0f,1.0f); + glScalef(-1.0f,1.0f,1.0f); + glMatrixMode(GL_MODELVIEW); + + gui_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, pdk_width, pdk_height, 32, 0, 0, 0, 0); + + PDL_Init(0); + PDL_RegisterJSHandler("initvideo", PDK_InitVideo); + PDL_JSRegistrationComplete(); + + const char *params[2]; + char str_width[5], str_height[5]; + snprintf(str_width, 5, "%d", pdk_width); + snprintf(str_height, 5, "%d", pdk_height); + params[0] = str_width; + params[1] = str_height; + PDL_CallJS("setdims", params, 2); + PDL_CallJS("ready", NULL, 0); + PDL_NotifyMusicPlaying(true); + add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback); + add_event(PLAYBACK_EVENT_TRACK_FINISH, false, track_finished_callback); +#endif } Index: firmware/target/hosted/sdl/lcd-bitmap.c =================================================================== --- firmware/target/hosted/sdl/lcd-bitmap.c (revision 31646) +++ firmware/target/hosted/sdl/lcd-bitmap.c (working copy) @@ -133,8 +133,8 @@ return; /* Don't update if we don't have the input focus */ - if (!sdl_app_has_input_focus) - return; + // if (!sdl_app_has_input_focus) + // return; #endif sdl_update_rect(lcd_surface, x_start, y_start, width, height, Index: firmware/target/hosted/sdl/lcd-sdl.c =================================================================== --- firmware/target/hosted/sdl/lcd-sdl.c (revision 31646) +++ firmware/target/hosted/sdl/lcd-sdl.c (working copy) @@ -24,6 +24,7 @@ #include "sim-ui-defines.h" #include "system.h" /* for MIN() and MAX() */ + int display_zoom = 1; void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, @@ -101,6 +102,7 @@ #endif } + void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, int height, int max_x, int max_y, int ui_x, int ui_y) { @@ -120,7 +122,39 @@ SDL_BlitSurface(surface, &src, gui_surface, &dest); - SDL_Flip(gui_surface); + //SDL_Flip(gui_surface); + + + glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, gui_surface->w, gui_surface->h, 0, GL_BGRA, GL_UNSIGNED_BYTE, gui_surface->pixels); + + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + + GLfloat square[] = { + 0.0, 0.0, 0.0, + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 1.0, 1.0, 0.0 + }; + + GLfloat tex[] = { + 0,0, + 1,0, + 0,1, + 1,1 + }; + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glVertexPointer(3, GL_FLOAT, 0, square); + glTexCoordPointer(2, GL_FLOAT, 0, tex); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + SDL_GL_SwapBuffers(); } /* set a range of bitmap indices to a gradient from startcolour to endcolour */ Index: firmware/target/hosted/sdl/lcd-sdl.h =================================================================== --- firmware/target/hosted/sdl/lcd-sdl.h (revision 31646) +++ firmware/target/hosted/sdl/lcd-sdl.h (working copy) @@ -25,6 +25,16 @@ #include "lcd.h" #include "SDL.h" +#if (CONFIG_PLATFORM & PLATFORM_WEBOS) +#include +#include +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +extern GLuint textureid; +extern SDL_Surface *pdk_stage; +extern int pdk_width, pdk_height; +#endif + /* Default display zoom level */ extern int display_zoom; extern SDL_Surface *gui_surface; Index: firmware/target/hosted/sdl/button-sdl.c =================================================================== --- firmware/target/hosted/sdl/button-sdl.c (revision 31646) +++ firmware/target/hosted/sdl/button-sdl.c (working copy) @@ -37,6 +37,9 @@ #include "debug.h" #include "powermgmt.h" +#include "lcd-sdl.h" +#include + #ifdef HAVE_TOUCHSCREEN #include "touchscreen.h" static int mouse_coords = 0; @@ -217,9 +220,45 @@ static bool event_handler(SDL_Event *event) { SDLKey ev_key; - + switch(event->type) { + case SDL_VIDEORESIZE: + syslog(LOG_INFO, "SDL_VIDEORESIZE %d %d", event->resize.w, event->resize.h); + syslog(LOG_INFO, "%d %d", pdk_width, pdk_height); + pdk_stage = SDL_SetVideoMode(event->resize.w, event->resize.h, 0, SDL_OPENGL); + //if ( pdk_stage == NULL ) { + syslog(LOG_INFO, "pdk_stage %s", SDL_GetError()); + //} + + // setup openGL + glClearColor (0.0f, 0.0f, 0.0f, 0.0f); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrthof(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); + glMatrixMode(GL_MODELVIEW); + + glEnable(GL_TEXTURE_2D); + + glGenTextures(1, &textureid); + glBindTexture(GL_TEXTURE_2D, textureid); + + //change to texture matrix and do the trick + glMatrixMode(GL_TEXTURE); + glRotatef(180.0f,0.0f,0.0f,1.0f); + glScalef(-1.0f,1.0f,1.0f); + glMatrixMode(GL_MODELVIEW); + + gui_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, pdk_width, pdk_height, 32, 0, 0, 0, 0); + //if ( gui_surface == NULL ) { + syslog(LOG_INFO, "gui_surface %s", SDL_GetError()); + //} + + + + + break; case SDL_ACTIVEEVENT: if (event->active.state & SDL_APPINPUTFOCUS) {