mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Threading is working on uisw32 as well now, code is up-to-date, makefile is up-to-date
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@981 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d0b23126f1
commit
0053ec0c72
11 changed files with 189 additions and 53 deletions
|
|
@ -34,52 +34,58 @@ void button_init(void)
|
|||
|
||||
int button_get(bool block)
|
||||
{
|
||||
|
||||
int btn = 0;
|
||||
if (bActive)
|
||||
do
|
||||
{
|
||||
if (KEY (VK_NUMPAD4) ||
|
||||
KEY (VK_LEFT)) // left button
|
||||
btn |= BUTTON_LEFT;
|
||||
if (bActive)
|
||||
{
|
||||
if (KEY (VK_NUMPAD4) ||
|
||||
KEY (VK_LEFT)) // left button
|
||||
btn |= BUTTON_LEFT;
|
||||
|
||||
if (KEY (VK_NUMPAD6) ||
|
||||
KEY (VK_RIGHT))
|
||||
btn |= BUTTON_RIGHT; // right button
|
||||
if (KEY (VK_NUMPAD6) ||
|
||||
KEY (VK_RIGHT))
|
||||
btn |= BUTTON_RIGHT; // right button
|
||||
|
||||
if (KEY (VK_NUMPAD8) ||
|
||||
KEY (VK_UP))
|
||||
btn |= BUTTON_UP; // up button
|
||||
if (KEY (VK_NUMPAD8) ||
|
||||
KEY (VK_UP))
|
||||
btn |= BUTTON_UP; // up button
|
||||
|
||||
if (KEY (VK_NUMPAD2) ||
|
||||
KEY (VK_DOWN))
|
||||
btn |= BUTTON_DOWN; // down button
|
||||
if (KEY (VK_NUMPAD2) ||
|
||||
KEY (VK_DOWN))
|
||||
btn |= BUTTON_DOWN; // down button
|
||||
|
||||
if (KEY (VK_ADD))
|
||||
btn |= BUTTON_ON; // on button
|
||||
if (KEY (VK_ADD))
|
||||
btn |= BUTTON_ON; // on button
|
||||
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
if (KEY (VK_RETURN))
|
||||
btn |= BUTTON_OFF; // off button
|
||||
#ifdef HAVE_RECORDER_KEYPAD
|
||||
if (KEY (VK_RETURN))
|
||||
btn |= BUTTON_OFF; // off button
|
||||
|
||||
if (KEY (VK_DIVIDE))
|
||||
btn |= BUTTON_F1; // F1 button
|
||||
if (KEY (VK_DIVIDE))
|
||||
btn |= BUTTON_F1; // F1 button
|
||||
|
||||
if (KEY (VK_MULTIPLY))
|
||||
btn |= BUTTON_F2; // F2 button
|
||||
if (KEY (VK_MULTIPLY))
|
||||
btn |= BUTTON_F2; // F2 button
|
||||
|
||||
if (KEY (VK_SUBTRACT))
|
||||
btn |= BUTTON_F3; // F3 button
|
||||
if (KEY (VK_SUBTRACT))
|
||||
btn |= BUTTON_F3; // F3 button
|
||||
|
||||
if (KEY (VK_NUMPAD5) ||
|
||||
KEY (VK_SPACE))
|
||||
btn |= BUTTON_PLAY; // play button
|
||||
#else
|
||||
if (KEY (VK_RETURN))
|
||||
btn |= BUTTON_MENU; // menu button
|
||||
#endif
|
||||
if (KEY (VK_NUMPAD5) ||
|
||||
KEY (VK_SPACE))
|
||||
btn |= BUTTON_PLAY; // play button
|
||||
#else
|
||||
if (KEY (VK_RETURN))
|
||||
btn |= BUTTON_MENU; // menu button
|
||||
#endif
|
||||
|
||||
if (btn != 0) {
|
||||
last_key = 0 ;
|
||||
}
|
||||
if (btn != 0) {
|
||||
last_key = 0 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (btn == 0 && block);
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
|
@ -18,9 +18,17 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include "uisw32.h"
|
||||
#include "kernel.h"
|
||||
#include "thread-win32.h"
|
||||
|
||||
void sleep(int ticks)
|
||||
{
|
||||
Sleep (1000 / HZ * ticks);
|
||||
}
|
||||
|
||||
|
||||
void yield (void)
|
||||
{
|
||||
PostThreadMessage (GetWindowThreadProcessId (hGUIWnd,NULL), TM_YIELD, 0, 0);
|
||||
}
|
||||
|
|
@ -40,13 +40,6 @@ BITMAPINFO2 bmi =
|
|||
}; // bitmap information
|
||||
|
||||
|
||||
// lcd_init
|
||||
// init lcd controler
|
||||
void lcd_init()
|
||||
{
|
||||
lcd_clear_display ();
|
||||
}
|
||||
|
||||
// lcd_update
|
||||
// update lcd
|
||||
void lcd_update()
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ APPDIR = ../../apps/
|
|||
RECDIR = $(APPDIR)recorder/
|
||||
RM = del
|
||||
|
||||
#DISPLAY = -DHAVE_LCD_CHARCELLS
|
||||
DISPLAY = -DHAVE_LCD_BITMAP
|
||||
DISPLAY = -DHAVE_LCD_CHARCELLS
|
||||
#DISPLAY = -DHAVE_LCD_BITMAP
|
||||
|
||||
#KEYPAD = -DHAVE_PLAYER_KEYPAD
|
||||
KEYPAD = -DHAVE_RECORDER_KEYPAD
|
||||
KEYPAD = -DHAVE_PLAYER_KEYPAD
|
||||
#KEYPAD = -DHAVE_RECORDER_KEYPAD
|
||||
|
||||
CC = cl
|
||||
DEFINES = -DWIN32 -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
|
||||
|
|
@ -46,7 +46,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) /MD /Fd"Release/vc70.pdb"
|
|||
SRCS = lcd-win32.c uisw32.c lcd.c button.c tree.c main.c \
|
||||
chartables.c kernel.c uisw32.res dir-win32.c main_menu.c \
|
||||
play.c debug-win32.c menu.c credits.c sound_menu.c mpeg.c \
|
||||
id3.c settings.c sprintf.c
|
||||
id3.c settings.c sprintf.c thread-win32.c playlist.c
|
||||
|
||||
!IF ("$(DISPLAY)" == "-DHAVE_LCD_BITMAP")
|
||||
SRCS = $(SRCS) tetris.c screensaver.c icons.c bmp.c
|
||||
|
|
@ -105,5 +105,8 @@ settings.obj: $(FIRMWAREDIR)/settings.c
|
|||
sprintf.obj: $(FIRMWAREDIR)/common/sprintf.c
|
||||
$(CC) $(CFLAGS) -c $(FIRMWAREDIR)/common/sprintf.c -osprintf.obj
|
||||
|
||||
playlist.obj: ../../apps/playlist.c
|
||||
$(CC) $(CFLAGS) -c ../../apps/playlist.c -oplaylist.obj
|
||||
|
||||
clean:
|
||||
$(RM) *.obj
|
||||
$(RM) *.obj
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
/* This file is for emulating some of the mpeg controlling functions of
|
||||
the target */
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
void mpeg_volume(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -35,3 +37,12 @@ void mpeg_treble(void)
|
|||
void mpeg_stop(void)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef MPEGPLAY
|
||||
void mpeg_play(char *tune)
|
||||
{
|
||||
DEBUGF("We instruct the MPEG thread to play %s for us\n",
|
||||
tune);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
53
uisimulator/win32/thread-win32.c
Normal file
53
uisimulator/win32/thread-win32.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* 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 "thread-win32.h"
|
||||
|
||||
HANDLE lpThreads[256];
|
||||
int nThreads = 0,
|
||||
nPos = 0;
|
||||
|
||||
|
||||
DWORD WINAPI runthread (LPVOID lpParameter)
|
||||
{
|
||||
((void(*)())lpParameter) ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int create_thread(void* fp, void* sp, int stk_size)
|
||||
{
|
||||
DWORD dwThreadID;
|
||||
|
||||
if (nThreads == 256)
|
||||
return -1;
|
||||
|
||||
lpThreads[nThreads++] = CreateThread (NULL,
|
||||
0,
|
||||
runthread,
|
||||
fp,
|
||||
0,
|
||||
&dwThreadID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void init_threads(void)
|
||||
{
|
||||
}
|
||||
22
uisimulator/win32/thread-win32.h
Normal file
22
uisimulator/win32/thread-win32.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* 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;
|
||||
|
|
@ -22,6 +22,8 @@
|
|||
#include "uisw32.h"
|
||||
#include "resource.h"
|
||||
#include "button.h"
|
||||
#include "thread.h"
|
||||
#include "thread-win32.h"
|
||||
|
||||
// extern functions
|
||||
extern void app_main (void *); // mod entry point
|
||||
|
|
@ -32,6 +34,7 @@ HWND hGUIWnd; // the GUI window handle
|
|||
unsigned int uThreadID; // id of mod thread
|
||||
PBYTE lpKeys;
|
||||
bool bActive; // window active?
|
||||
HANDLE hGUIThread; // thread for GUI
|
||||
|
||||
// GUIWndProc
|
||||
// window proc for GUI simulator
|
||||
|
|
@ -186,6 +189,11 @@ LRESULT GUIWndProc (
|
|||
hGUIWnd = NULL;
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
// close simulator
|
||||
hGUIWnd = NULL;
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||
|
|
@ -229,8 +237,16 @@ BOOL GUIStartup ()
|
|||
// destroy window, unregister window class
|
||||
int GUIDown ()
|
||||
{
|
||||
int i;
|
||||
|
||||
DestroyWindow (hGUIWnd);
|
||||
_endthreadex (uThreadID);
|
||||
CloseHandle (hGUIThread);
|
||||
for (i = 0; i < nThreads; i++)
|
||||
{
|
||||
ResumeThread (lpThreads[i]);
|
||||
WaitForSingleObject (lpThreads[i], 1);
|
||||
CloseHandle (lpThreads[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -239,10 +255,17 @@ int GUIDown ()
|
|||
void GUIMessageLoop ()
|
||||
{
|
||||
MSG msg;
|
||||
while (GetMessage (&msg, hGUIWnd, 0, 0) && hGUIWnd != NULL)
|
||||
while (GetMessage (&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage (&msg);
|
||||
DispatchMessage (&msg);
|
||||
if (msg.message == TM_YIELD)
|
||||
{
|
||||
SuspendThread (lpThreads[nPos]);
|
||||
if (++nPos >= nThreads)
|
||||
nPos = 0;
|
||||
ResumeThread (lpThreads[nPos]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -256,12 +279,15 @@ int WINAPI WinMain (
|
|||
int nShowCmd // show command
|
||||
)
|
||||
{
|
||||
DWORD dwThreadID;
|
||||
if (!GUIStartup ())
|
||||
return 0;
|
||||
|
||||
uThreadID = _beginthread (app_main, 0, NULL);
|
||||
if (uThreadID == -0L)
|
||||
return MessageBox (NULL, "Error creating mod thread!", "Error", MB_OK);
|
||||
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);
|
||||
|
||||
GUIMessageLoop ();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
#define UI_LCD_POSX 59 // x position of lcd
|
||||
#define UI_LCD_POSY 95 // y position of lcd
|
||||
|
||||
#define TM_YIELD WM_USER + 101 // thread message for yield
|
||||
|
||||
extern HWND hGUIWnd; // the GUI window handle
|
||||
extern unsigned int uThreadID; // id of mod thread
|
||||
extern bool bActive;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -182,7 +182,10 @@
|
|||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\firmware\playlist.c">
|
||||
RelativePath="..\..\apps\playlist.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\apps\recorder\screensaver.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\firmware\settings.c">
|
||||
|
|
@ -193,6 +196,12 @@
|
|||
<File
|
||||
RelativePath="..\..\firmware\common\sprintf.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\apps\recorder\tetris.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="thread-win32.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\apps\tree.c">
|
||||
</File>
|
||||
|
|
@ -221,6 +230,9 @@
|
|||
<File
|
||||
RelativePath="..\screensaver.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="thread-win32.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\tree.h">
|
||||
</File>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue