Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PUAE
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
PUAE
Commits
01b63a62
Commit
01b63a62
authored
May 30, 2011
by
CeRiAl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GUI-SDL: Added support for 4 drives, disks & roms in subdirectories, general cleanup
parent
7732d3fa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
894 additions
and
324 deletions
+894
-324
Makefile.am
src/gui-sdl/Makefile.am
+1
-1
inputmode.c
src/gui-sdl/inputmode.c
+10
-11
inputmode.h
src/gui-sdl/inputmode.h
+2
-2
menu.c
src/gui-sdl/menu.c
+282
-194
menu_disks.c
src/gui-sdl/menu_disks.c
+293
-0
menu_prefs.c
src/gui-sdl/menu_prefs.c
+20
-18
menu_roms.c
src/gui-sdl/menu_roms.c
+188
-0
menu_tweak.c
src/gui-sdl/menu_tweak.c
+78
-72
vkbd.h
src/gui-sdl/vkbd.h
+11
-11
volumecontrol.c
src/gui-sdl/volumecontrol.c
+7
-13
volumecontrol.h
src/gui-sdl/volumecontrol.h
+2
-2
No files found.
src/gui-sdl/Makefile.am
View file @
01b63a62
...
...
@@ -5,7 +5,7 @@ AM_CFLAGS += @SDL_CFLAGS@
noinst_LIBRARIES
=
libguidep.a
libguidep_a_SOURCES
=
inputmode.c menu.c menu_
load
.c menu_prefs.c menu_tweak.c vkbd.cpp volumecontrol.c
libguidep_a_SOURCES
=
inputmode.c menu.c menu_
roms.c menu_disks
.c menu_prefs.c menu_tweak.c vkbd.cpp volumecontrol.c
noinst_HEADERS
=
inputmode.h menu.h vkbd.h volumecontrol.h
src/gui-sdl/inputmode.c
View file @
01b63a62
#include <SDL.h>
#include "inputmode.h"
extern
char
launchDir
[
256
];
extern
SDL_Surface
*
prSDLScreen
;
extern
char
launchDir
[
MAX_PATH
];
extern
SDL_Surface
*
prSDLScreen
;
static
SDL_Surface
*
ksur
;
static
SDL_Surface
*
inputMode
[
3
];
int
show_inputmode
=
0
;
int
inputmode_init
(
void
)
{
int
inputmode_init
(
void
)
{
int
i
;
char
tmpchar
[
256
];
char
tmpchar
[
MAX_PATH
];
SDL_Surface
*
tmp
;
sprintf
(
tmpchar
,
"%s/images/joystick.bmp"
,
launchDir
);
tmp
=
SDL_LoadBMP
(
tmpchar
);
if
(
tmp
)
{
...
...
@@ -33,14 +32,14 @@ int inputmode_init(void) {
}
void
inputmode_redraw
(
void
)
{
void
inputmode_redraw
(
void
)
{
SDL_Rect
r
;
SDL_Surface
*
surface
;
r
.
x
=
80
;
r
.
y
=
60
;
r
.
w
=
160
;
r
.
h
=
120
;
r
.
x
=
80
;
r
.
y
=
60
;
r
.
w
=
160
;
r
.
h
=
120
;
if
(
inputMode
[
0
]
&&
inputMode
[
1
])
{
// if (gp2xMouseEmuOn) {
...
...
@@ -50,6 +49,6 @@ void inputmode_redraw(void) {
surface
=
inputMode
[
0
];
}
SDL_BlitSurface
(
surface
,
NULL
,
prSDLScreen
,
&
r
);
SDL_BlitSurface
(
surface
,
NULL
,
prSDLScreen
,
&
r
);
}
}
src/gui-sdl/inputmode.h
View file @
01b63a62
int
inputmode_init
(
void
);
void
inputmode_redraw
(
void
);
int
inputmode_init
(
void
);
void
inputmode_redraw
(
void
);
extern
int
show_inputmode
;
src/gui-sdl/menu.c
View file @
01b63a62
...
...
@@ -20,10 +20,10 @@
#endif
#define GUI_DEBUG
#ifdef
GUI_DEBUG
#define DEBUG_LOG write_log
( "%s: ", __func__); write_log
#ifdef GUI_DEBUG
#define DEBUG_LOG write_log
( "%s: ", __func__); write_log
#else
#define DEBUG_LOG(...) do ; while(0)
#define DEBUG_LOG(...) do ; while(0)
#endif
#define VIDEO_FLAGS SDL_HWSURFACE
...
...
@@ -33,32 +33,31 @@ extern SDL_Surface* display;
bool
sdlGuiInitialized
=
false
;
int
menuSelection
=
0
;
char
yol
[
256
];
char
msg
[
50
];
char
msg_status
[
50
];
char
launchDir
[
MAX_PATH
];
//extern char launchDir[256];
char
launchDir
[
256
];
extern
int
dirz
(
int
parametre
);
extern
int
tweakz
(
int
parametre
);
extern
int
prefz
(
int
parametre
);
extern
int
diskz
(
void
);
extern
int
romz
(
void
);
extern
int
tweakz
(
void
);
extern
int
prefz
(
void
);
int
soundVolume
=
100
;
extern
int
flashLED
;
static
int
gui_available
=
0
;
void
write_text
(
int
x
,
int
y
,
char
*
txt
)
{
SDL_Surface
*
pText_Surface
=
TTF_RenderText_Solid
(
amiga_font
,
txt
,
text_color
);
if
(
strlen
(
txt
)
>
0
)
{
SDL_Surface
*
pText_Surface
=
TTF_RenderText_Solid
(
amiga_font
,
txt
,
text_color
);
rect
.
x
=
x
;
rect
.
y
=
y
;
rect
.
w
=
pText_Surface
->
w
;
rect
.
h
=
pText_Surface
->
h
;
rect
.
x
=
x
;
rect
.
y
=
y
;
rect
.
w
=
pText_Surface
->
w
;
rect
.
h
=
pText_Surface
->
h
;
SDL_BlitSurface
(
pText_Surface
,
NULL
,
tmpSDLScreen
,
&
rect
);
SDL_FreeSurface
(
pText_Surface
);
SDL_BlitSurface
(
pText_Surface
,
NULL
,
tmpSDLScreen
,
&
rect
);
SDL_FreeSurface
(
pText_Surface
);
}
}
void
blit_image
(
SDL_Surface
*
img
,
int
x
,
int
y
)
{
...
...
@@ -69,17 +68,17 @@ void blit_image (SDL_Surface* img, int x, int y) {
}
void
drawMenuIcon
(
int
ix
,
int
iy
,
int
mx
,
int
my
,
SDL_Surface
*
img
,
int
hangi
)
{
int
selection
=
0
;
if
(
mx
>=
ix
&&
mx
<=
ix
+
iconsizex
)
{
if
(
my
>=
iy
&&
my
<=
iy
+
iconsizey
)
{
selection
=
1
;
}
}
if
(
selection
==
1
)
{
SDL_SetAlpha
(
img
,
SDL_SRCALPHA
,
100
);
menuSelection
=
hangi
;
}
else
{
SDL_SetAlpha
(
img
,
SDL_SRCALPHA
,
255
);
int
selection
=
0
;
if
(
mx
>=
ix
&&
mx
<=
ix
+
iconsizex
)
{
if
(
my
>=
iy
&&
my
<=
iy
+
iconsizey
)
{
selection
=
1
;
}
}
if
(
selection
==
1
)
{
SDL_SetAlpha
(
img
,
SDL_SRCALPHA
,
100
);
menuSelection
=
hangi
;
}
else
{
SDL_SetAlpha
(
img
,
SDL_SRCALPHA
,
255
);
}
}
...
...
@@ -90,26 +89,26 @@ int gui_init (void) {
SDL_ShowCursor
(
SDL_DISABLE
);
TTF_Init
();
amiga_font
=
TTF_OpenFont
(
"fonts/amiga4ever_pro2.ttf"
,
8
);
amiga_font
=
TTF_OpenFont
(
"fonts/amiga4ever_pro2.ttf"
,
8
);
text_color
.
r
=
0
;
text_color
.
g
=
0
;
text_color
.
b
=
0
;
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
pMouse_Pointer
=
SDL_LoadBMP
(
"images/mousep.bmp"
);
SDL_SetColorKey
(
pMouse_Pointer
,
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
pMouse_Pointer
->
format
,
85
,
170
,
153
));
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
pMouse_Pointer
=
SDL_LoadBMP
(
"images/mousep.bmp"
);
SDL_SetColorKey
(
pMouse_Pointer
,
SDL_SRCCOLORKEY
,
SDL_MapRGB
(
pMouse_Pointer
->
format
,
85
,
170
,
153
));
icon_expansion
=
SDL_LoadBMP
(
"images/icon-expansion.bmp"
);
icon_preferences
=
SDL_LoadBMP
(
"images/icon-preferences.bmp"
);
icon_keymaps
=
SDL_LoadBMP
(
"images/icon-keymaps.bmp"
);
icon_expansion
=
SDL_LoadBMP
(
"images/icon-expansion.bmp"
);
icon_preferences
=
SDL_LoadBMP
(
"images/icon-preferences.bmp"
);
icon_keymaps
=
SDL_LoadBMP
(
"images/icon-keymaps.bmp"
);
icon_floppy
=
SDL_LoadBMP
(
"images/icon-floppy.bmp"
);
icon_reset
=
SDL_LoadBMP
(
"images/icon-reset.bmp"
);
icon_storage
=
SDL_LoadBMP
(
"images/icon-storage.bmp"
);
icon_run
=
SDL_LoadBMP
(
"images/icon-run.bmp"
);
icon_exit
=
SDL_LoadBMP
(
"images/icon-exit.bmp"
);
icon_tweaks
=
SDL_LoadBMP
(
"images/icon-tweaks.bmp"
);
icon_reset
=
SDL_LoadBMP
(
"images/icon-reset.bmp"
);
icon_storage
=
SDL_LoadBMP
(
"images/icon-storage.bmp"
);
icon_run
=
SDL_LoadBMP
(
"images/icon-run.bmp"
);
icon_exit
=
SDL_LoadBMP
(
"images/icon-exit.bmp"
);
icon_tweaks
=
SDL_LoadBMP
(
"images/icon-tweaks.bmp"
);
tmpSDLScreen
=
SDL_CreateRGBSurface
(
display
->
flags
,
display
->
w
,
display
->
h
,
display
->
format
->
BitsPerPixel
,
display
->
format
->
Rmask
,
display
->
format
->
Gmask
,
display
->
format
->
Bmask
,
display
->
format
->
Amask
);
tmpSDLScreen
=
SDL_CreateRGBSurface
(
display
->
flags
,
display
->
w
,
display
->
h
,
display
->
format
->
BitsPerPixel
,
display
->
format
->
Rmask
,
display
->
format
->
Gmask
,
display
->
format
->
Bmask
,
display
->
format
->
Amask
);
#ifdef TOUCHUI
SDL_TUI_Init
(
"sdl_touchui.xml"
,
"keyboard-off"
);
#endif
...
...
@@ -119,27 +118,25 @@ int gui_init (void) {
return
0
;
}
void
gui_exit
(
void
){
void
gui_exit
(
void
)
{
if
(
0
!=
1
)
{
SDL_FreeSurface
(
tmpSDLScreen
);
SDL_FreeSurface
(
pMenu_Surface
);
SDL_FreeSurface
(
pMouse_Pointer
);
SDL_FreeSurface
(
icon_expansion
);
SDL_FreeSurface
(
icon_preferences
);
SDL_FreeSurface
(
icon_keymaps
);
SDL_FreeSurface
(
icon_floppy
);
SDL_FreeSurface
(
icon_reset
);
SDL_FreeSurface
(
icon_storage
);
SDL_FreeSurface
(
icon_run
);
SDL_FreeSurface
(
icon_exit
);
SDL_FreeSurface
(
icon_tweaks
);
SDL_FreeSurface
(
icon_expansion
);
SDL_FreeSurface
(
icon_preferences
);
SDL_FreeSurface
(
icon_keymaps
);
SDL_FreeSurface
(
icon_floppy
);
SDL_FreeSurface
(
icon_reset
);
SDL_FreeSurface
(
icon_storage
);
SDL_FreeSurface
(
icon_run
);
SDL_FreeSurface
(
icon_exit
);
SDL_FreeSurface
(
icon_tweaks
);
}
SDL_Quit
;
}
void
gui_display
(
int
shortcut
){
void
gui_display
(
int
shortcut
)
{
SDL_Event
event
;
int
menu_exitcode
=
-
1
;
...
...
@@ -158,7 +155,7 @@ void gui_display (int shortcut){
gui_init
();
}
getcwd
(
launchDir
,
256
);
getcwd
(
launchDir
,
MAX_PATH
);
while
(
!
mainloopdone
)
{
while
(
SDL_PollEvent
(
&
event
))
{
...
...
@@ -168,9 +165,9 @@ void gui_display (int shortcut){
if
(
event
.
type
==
SDL_QUIT
)
{
mainloopdone
=
1
;
}
#if GP2X
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
#if 0
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_R
:
break
;
case
GP2X_BUTTON_L
:
break
;
case
GP2X_BUTTON_UP
:
kup
=
1
;
break
;
...
...
@@ -181,17 +178,17 @@ void gui_display (int shortcut){
case
GP2X_BUTTON_B
:
ksel
=
1
;
break
;
case
GP2X_BUTTON_Y
:
break
;
case
GP2X_BUTTON_START
:
mainloopdone
=
1
;
break
;
#endif
}
}
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
mainloopdone
=
1
;
break
;
case
SDLK_UP
:
kup
=
1
;
break
;
case
SDLK_DOWN
:
kdown
=
1
;
break
;
case
SDLK_LEFT
:
kleft
=
1
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_b
:
ksel
=
1
;
break
;
#endif
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
mainloopdone
=
1
;
break
;
case
SDLK_UP
:
kup
=
1
;
break
;
case
SDLK_DOWN
:
kdown
=
1
;
break
;
case
SDLK_LEFT
:
kleft
=
1
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_RETURN
:
ksel
=
1
;
break
;
default:
break
;
}
}
...
...
@@ -202,7 +199,7 @@ void gui_display (int shortcut){
if
(
event
.
type
==
SDL_MOUSEBUTTONDOWN
)
{
if
(
menuSelection
==
0
)
{
if
(
mouse_x
>=
0
&&
mouse_x
<=
20
)
{
if
(
mouse_y
>=
0
&&
mouse_y
<=
20
)
{
if
(
mouse_y
>=
0
&&
mouse_y
<=
20
)
{
mainloopdone
=
1
;
}
}
...
...
@@ -213,36 +210,31 @@ void gui_display (int shortcut){
}
if
(
ksel
==
1
)
{
if
(
menuSelection
==
menu_sel_expansion
)
{
sprintf
(
msg
,
"%s"
,
"Select KickStart ROM"
);
sprintf
(
msg_status
,
"%s"
,
" "
);
sprintf
(
yol
,
"%s/roms"
,
launchDir
);
dirz
(
1
);
// select kickstart rom
romz
();
}
if
(
menuSelection
==
menu_sel_floppy
)
{
sprintf
(
msg
,
"%s"
,
"Select Disk Image"
);
sprintf
(
msg_status
,
"%s"
,
"DF0: B DF1: A"
);
sprintf
(
yol
,
"%s/disks"
,
launchDir
);
dirz
(
0
);
// select diskimages
diskz
();
}
if
(
menuSelection
==
menu_sel_prefs
)
{
sprintf
(
msg
,
"%s"
,
" "
);
sprintf
(
msg_status
,
"%s"
,
" "
);
prefz
(
0
);
// preferences
prefz
();
}
if
(
menuSelection
==
menu_sel_reset
)
{
//reset amiga
//
reset amiga
menu_exitcode
=
2
;
mainloopdone
=
1
;
}
if
(
menuSelection
==
menu_sel_keymaps
)
{
// keymaps
}
if
(
menuSelection
==
menu_sel_tweaks
)
{
sprintf
(
msg
,
"%s"
,
"Tweaks"
);
sprintf
(
msg_status
,
"%s"
,
"L/R = -/+ B: Apply"
);
tweakz
(
0
);
// tweaks
tweakz
();
}
if
(
menuSelection
==
menu_sel_storage
)
{
// storage
}
if
(
menuSelection
==
menu_sel_run
)
{
menu_exitcode
=
1
;
...
...
@@ -250,7 +242,6 @@ void gui_display (int shortcut){
}
if
(
menuSelection
==
menu_sel_exit
)
{
SDL_Quit
();
#ifdef GP2X
//remove mmuhack module
system
(
"/sbin/rmmod mmuhack"
);
...
...
@@ -263,85 +254,96 @@ void gui_display (int shortcut){
}
ksel
=
0
;
}
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// icons
iconpos_x
=
10
;
iconpos_y
=
23
;
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_floppy
,
menu_sel_floppy
);
blit_image
(
icon_floppy
,
iconpos_x
,
iconpos_y
);
// icons
iconpos_x
=
10
;
iconpos_y
=
23
;
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_preferences
,
menu_sel_prefs
);
blit_image
(
icon_preferences
,
iconpos_x
,
iconpos_y
);
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_floppy
,
menu_sel_floppy
);
blit_image
(
icon_floppy
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_tweaks
,
menu_sel_tweak
s
);
blit_image
(
icon_tweak
s
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_preferences
,
menu_sel_pref
s
);
blit_image
(
icon_preference
s
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_keymaps
,
menu_sel_keymaps
);
blit_image
(
icon_keymaps
,
iconpos_x
,
iconpos_y
);
#ifdef GP2X
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_tweaks
,
menu_sel_tweaks
);
blit_image
(
icon_tweaks
,
iconpos_x
,
iconpos_y
);
#endif
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_expansion
,
menu_sel_expansion
);
blit_image
(
icon_expansion
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_keymaps
,
menu_sel_keymaps
);
blit_image
(
icon_keymaps
,
iconpos_x
,
iconpos_y
);
iconpos_x
=
10
;
iconpos_y
=
93
;
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_expansion
,
menu_sel_expansion
);
blit_image
(
icon_expansion
,
iconpos_x
,
iconpos_y
);
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_storage
,
menu_sel_storage
);
blit_image
(
icon_storage
,
iconpos_x
,
iconpos_y
);
#ifdef GP2X
iconpos_x
=
10
;
iconpos_y
=
93
;
#else
iconpos_x
+=
iconsizex
+
bosluk
;
#endif
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_storage
,
menu_sel_storage
);
blit_image
(
icon_storage
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_reset
,
menu_sel_reset
);
blit_image
(
icon_reset
,
iconpos_x
,
iconpos_y
);
#ifndef GP2X
iconpos_x
=
10
;
iconpos_y
=
93
;
#else
iconpos_x
+=
iconsizex
+
bosluk
;
#endif
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_reset
,
menu_sel_reset
);
blit_image
(
icon_reset
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_run
,
menu_sel_run
);
blit_image
(
icon_run
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_run
,
menu_sel_run
);
blit_image
(
icon_run
,
iconpos_x
,
iconpos_y
);
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_exit
,
menu_sel_exit
);
blit_image
(
icon_exit
,
iconpos_x
,
iconpos_y
);
// texts
iconpos_x
+=
iconsizex
+
bosluk
;
drawMenuIcon
(
iconpos_x
,
iconpos_y
,
mouse_x
,
mouse_y
,
icon_exit
,
menu_sel_exit
);
blit_image
(
icon_exit
,
iconpos_x
,
iconpos_y
);
// texts
char
tmpMsg
[
50
];
sprintf
(
tmpMsg
,
"P-
UAE %d.%d.%d"
,
UAEMAJOR
,
UAEMINOR
,
UAESUBREV
);
write_text
(
26
,
3
,
tmpMsg
);
char
tmpMsg
[
50
];
sprintf
(
tmpMsg
,
"P
UAE %d.%d.%d"
,
UAEMAJOR
,
UAEMINOR
,
UAESUBREV
);
write_text
(
25
,
5
,
tmpMsg
);
// mouse pointer ------------------------------
// mouse pointer ------------------------------
if
(
kleft
==
1
)
{
mouse_x
-=
(
iconsizex
+
bosluk
);
kleft
=
0
;
mouse_x
-=
(
iconsizex
+
bosluk
);
kleft
=
0
;
}
if
(
kright
==
1
)
{
mouse_x
+=
(
iconsizex
+
bosluk
);
kright
=
0
;
mouse_x
+=
(
iconsizex
+
bosluk
);
kright
=
0
;
}
if
(
kup
==
1
)
{
mouse_y
-=
(
iconsizey
+
bosluk
);
kup
=
0
;
if
(
kup
==
1
)
{
mouse_y
-=
(
iconsizey
+
bosluk
);
kup
=
0
;
}
if
(
kdown
==
1
)
{
kdown
=
0
;
mouse_y
+=
(
iconsizey
+
bosluk
);
kdown
=
0
;
mouse_y
+=
(
iconsizey
+
bosluk
);
}
if
(
mouse_x
<
1
)
{
mouse_x
=
1
;
}
if
(
mouse_y
<
1
)
{
mouse_y
=
1
;
}
if
(
mouse_x
>
320
)
{
mouse_x
=
320
;
}
if
(
mouse_y
>
240
)
{
mouse_y
=
240
;
}
if
(
mouse_x
<
1
)
{
mouse_x
=
1
;
}
if
(
mouse_y
<
1
)
{
mouse_y
=
1
;
}
if
(
mouse_x
>
320
)
{
mouse_x
=
320
;
}
if
(
mouse_y
>
240
)
{
mouse_y
=
240
;
}
rect
.
x
=
mouse_x
;
rect
.
y
=
mouse_y
;
//rect.w = pMouse_Pointer->w;
//rect.h = pMouse_Pointer->h;
SDL_BlitSurface
(
pMouse_Pointer
,
NULL
,
tmpSDLScreen
,
&
rect
);
// mouse pointer-end
SDL_BlitSurface
(
pMouse_Pointer
,
NULL
,
tmpSDLScreen
,
&
rect
);
// mouse pointer-end
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
SDL_TUI_UpdateAll
();
#endif
...
...
@@ -350,118 +352,117 @@ void gui_display (int shortcut){
}
void
gui_handle_events
(
void
)
{
void
gui_handle_events
(
void
)
{
if
(
!
gui_available
)
return
;
return
;
#if
0
#if
GP2X
while
(
comm_pipe_has_data
(
&
from_gui_pipe
))
{
int
cmd
=
read_comm_pipe_int_blocking
(
&
from_gui_pipe
);
switch
(
cmd
)
{
case
UAECMD_EJECTDISK
:
{
int n = read_comm_pipe_int_blocking
(&from_gui_pipe);
uae_sem_wait
(&gui_sem);
int
n
=
read_comm_pipe_int_blocking
(
&
from_gui_pipe
);
uae_sem_wait
(
&
gui_sem
);
changed_prefs
.
floppyslots
[
n
].
df
[
0
]
=
'\0'
;
uae_sem_post
(&gui_sem);
uae_sem_post
(
&
gui_sem
);
if
(
pause_uae
)
{
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
//
write_comm_pipe_int
(&to_gui_pipe, n, 1);
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
//
write_comm_pipe_int
(&to_gui_pipe, n, 1);
}
break
;
}
}
case
UAECMD_INSERTDISK
:
{
int n = read_comm_pipe_int_blocking
(&from_gui_pipe);
uae_sem_wait
(&gui_sem);
strncpy
(changed_prefs.floppyslots[n].df, new_disk_string[n], 255);
free
(new_disk_string[n]);
int
n
=
read_comm_pipe_int_blocking
(
&
from_gui_pipe
);
uae_sem_wait
(
&
gui_sem
);
strncpy
(
changed_prefs
.
floppyslots
[
n
].
df
,
new_disk_string
[
n
],
255
);
free
(
new_disk_string
[
n
]);
new_disk_string
[
n
]
=
0
;
changed_prefs
.
floppyslots
[
n
].
df
[
255
]
=
'\0'
;
uae_sem_post
(&gui_sem);
uae_sem_post
(
&
gui_sem
);
if
(
pause_uae
)
{
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
//
write_comm_pipe_int
(&to_gui_pipe, GUICMD_DISKCHANGE, 0);
//
write_comm_pipe_int
(&to_gui_pipe, n, 1);
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
//
write_comm_pipe_int
(&to_gui_pipe, GUICMD_DISKCHANGE, 0);
//
write_comm_pipe_int
(&to_gui_pipe, n, 1);
}
break
;
}
case
UAECMD_RESET
:
uae_reset
(0);
uae_reset
(
0
);
break
;
#ifdef DEBUGGER
case
UAECMD_DEBUG
:
activate_debugger
();
activate_debugger
();
break
;
#endif
case
UAECMD_QUIT
:
uae_quit
();
uae_quit
();
break
;
case
UAECMD_PAUSE
:
pause_uae
=
1
;
uae_pause
();
uae_pause
();
break
;
case
UAECMD_RESUME
:
pause_uae
=
0
;
uae_resume
();
uae_resume
();
break
;
case
UAECMD_SAVE_CONFIG
:
uae_sem_wait
(&gui_sem);
uae_sem_wait
(
&
gui_sem
);
//uae_save_config ();
uae_sem_post
(&gui_sem);
uae_sem_post
(
&
gui_sem
);
break
;
case
UAECMD_SELECT_ROM
:
uae_sem_wait
(&gui_sem);
strncpy
(changed_prefs.romfile, gui_romname, 255);
uae_sem_wait
(
&
gui_sem
);
strncpy
(
changed_prefs
.
romfile
,
gui_romname
,
255
);
changed_prefs
.
romfile
[
255
]
=
'\0'
;
free
(gui_romname);
uae_sem_post
(&gui_sem);
free
(
gui_romname
);
uae_sem_post
(
&
gui_sem
);
break
;
case
UAECMD_SELECT_KEY
:
uae_sem_wait
(&gui_sem);
strncpy
(changed_prefs.keyfile, gui_keyname, 255);
uae_sem_wait
(
&
gui_sem
);
strncpy
(
changed_prefs
.
keyfile
,
gui_keyname
,
255
);
changed_prefs
.
keyfile
[
255
]
=
'\0'
;
free
(gui_keyname);
uae_sem_post
(&gui_sem);
free
(
gui_keyname
);
uae_sem_post
(
&
gui_sem
);
break
;
case
UAECMD_SAVESTATE_LOAD
:
uae_sem_wait
(&gui_sem);
savestate_initsave
(gui_sstate_name, 0, 0);
uae_sem_wait
(
&
gui_sem
);
savestate_initsave
(
gui_sstate_name
,
0
,
0
);
savestate_state
=
STATE_DORESTORE
;
write_log
("Restoring state from '%s'...\n", gui_sstate_name);
uae_sem_post
(&gui_sem);
write_log
(
"Restoring state from '%s'...
\n
"
,
gui_sstate_name
);
uae_sem_post
(
&
gui_sem
);
break
;
case
UAECMD_SAVESTATE_SAVE
:
uae_sem_wait
(&gui_sem);
savestate_initsave
(gui_sstate_name, 0, 0);
save_state
(gui_sstate_name, "puae");
write_log
("Saved state to '%s'...\n", gui_sstate_name);
uae_sem_post
(&gui_sem);
uae_sem_wait
(
&
gui_sem
);
savestate_initsave
(
gui_sstate_name
,
0
,
0
);
save_state
(
gui_sstate_name
,
"puae"
);
write_log
(
"Saved state to '%s'...
\n
"
,
gui_sstate_name
);
uae_sem_post
(
&
gui_sem
);
break
;
/* case UAECMD_START:
uae_start
();
uae_start();
break;
case UAECMD_STOP:
uae_stop
();
uae_stop();
break;*/
}
}
#endif
}
void
gui_message
(
const
char
*
format
,...)
{
char
msg
[
2048
];
va_list
parms
;
void
gui_message
(
const
char
*
format
,
...)
{
char
msg
[
2048
];
va_list
parms
;
va_start
(
parms
,
format
);
vsprintf
(
msg
,
format
,
parms
);
va_end
(
parms
);
va_start
(
parms
,
format
);
vsprintf
(
msg
,
format
,
parms
);
va_end
(
parms
);
write_log
(
msg
);
write_log
(
msg
);
}
void
gui_fps
(
int
fps
,
int
idle
)
{
...
...
@@ -469,6 +470,94 @@ void gui_fps (int fps, int idle) {
gui_data
.
idle
=
idle
;
}
char
**
dirstack
=
NULL
;
int
dirstackcount
=
0
;
int
pushdir
(
char
*
directory
)
{
void
**
_tmp
=
(
char
**
)
realloc
(
dirstack
,
(
dirstackcount
+
1
)
*
sizeof
(
char
*
));
if
(
!
_tmp
)
{
write_log
(
"ERROR: Couldn't realloc more memory for dirstack!
\n
"
);
return
(
-
1
);
}
dirstack
=
(
char
**
)
_tmp
;
dirstack
[
dirstackcount
]
=
(
char
*
)
malloc
(
MAX_PATH
);
if
(
!
dirstack
[
dirstackcount
])
{
write_log
(
"ERROR: Couldn't malloc memory for dirstack entry!
\n
"
);
return
(
-
1
);
}
strncpy
(
dirstack
[
dirstackcount
],
directory
,
MAX_PATH
);
dirstackcount
++
;
// write_log( "added '%s', now at %d\n", dirstack[dirstackcount-1], dirstackcount);
return
dirstackcount
;
}
char
*
popdir
(
void
)
{
if
((
dirstackcount
>
0
)
&&
(
dirstack
!=
NULL
))
{
char
*
_tmp
=
(
char
*
)
malloc
(
MAX_PATH
);
dirstackcount
--
;
strncpy
(
_tmp
,
dirstack
[
dirstackcount
],
MAX_PATH
);
free
(
dirstack
[
dirstackcount
]);
// write_log( "returning '%s', now at %d\n", _tmp, dirstackcount);
return
_tmp
;
}
else
{
return
NULL
;
}
}
int
getdirstackcount
(
void
)
{
return
dirstackcount
;
}
void
freedirstack
(
void
)
{
if
(
dirstack
!=
NULL
)
{
int
i
=
0
;
for
(
i
=
dirstackcount
;
i
>
0
;
i
--
)
{
free
(
dirstack
[
i
]);
dirstackcount
--
;
}
free
(
dirstack
);
}
}
#define MAX_FILES 1024
int
getdirectory
(
char
**
filez
,
char
*
directory
,
bool
hide_parent
)
{
int
i
;
char
launchDir
[
MAX_PATH
];
int
num_of_files
=
0
;
DIR
*
d
=
opendir
(
directory
);
struct
dirent
*
ep
;
getcwd
(
launchDir
,
MAX_PATH
);
if
(
d
!=
NULL
)
{
for
(
i
=
0
;
i
<
MAX_FILES
;
i
++
)
{
ep
=
readdir
(
d
);
if
(
ep
==
NULL
)
{
break
;
}
else
{
struct
stat
sstat
;
char
*
tmp
=
(
char
*
)
calloc
(
1
,
MAX_PATH
);
strcpy
(
tmp
,
directory
);
strcat
(
tmp
,
"/"
);
strcat
(
tmp
,
ep
->
d_name
);
if
(
(
strcasecmp
(
ep
->
d_name
,
"."
)
!=
0
)
)
{
if
(
(
!
hide_parent
)
||
(
strcasecmp
(
ep
->
d_name
,
".."
)
!=
0
)
)
{
filez
[
num_of_files
]
=
(
char
*
)
malloc
(
64
);
strncpy
(
filez
[
num_of_files
],
ep
->
d_name
,
64
);
num_of_files
++
;
}
}
free
(
tmp
);
}
}
closedir
(
d
);
}
return
num_of_files
;
}
int
gui_update
(
void
)
{
return
0
;
}
void
gui_flicker_led
(
int
led
,
int
unitnum
,
int
status
)
{}
void
gui_led
(
int
led
,
int
on
)
{}
...
...
@@ -478,4 +567,3 @@ void gui_lock (void) {}
void
gui_unlock
(
void
)
{}
void
gui_gameport_button_change
(
int
port
,
int
button
,
int
onoff
)
{}
void
gui_gameport_axis_change
(
int
port
,
int
axis
,
int
state
,
int
max
)
{}
src/gui-sdl/menu_disks.c
0 → 100644
View file @
01b63a62
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#ifdef TOUCHUI
#include <SDL_TouchUI.h>
#endif
extern
void
write_text
(
int
x
,
int
y
,
char
*
txt
);
extern
void
blit_image
(
SDL_Surface
*
img
,
int
x
,
int
y
);
extern
int
pushdir
(
char
*
directory
);
extern
char
*
popdir
(
void
);
extern
int
getdirstackcount
(
void
);
extern
void
freedirstack
(
void
);
extern
int
getdirectory
(
char
**
filez
,
char
*
directory
,
bool
hide_parent
);
extern
SDL_Surface
*
display
;
extern
SDL_Surface
*
tmpSDLScreen
;
extern
SDL_Surface
*
pMenu_Surface
;
extern
SDL_Color
text_color
;
#define MAX_FILES 1024
extern
char
msg
[];
extern
char
msg_status
[];
char
disksSubDir
[
MAX_PATH
];
int
diskz
(
void
);
void
changeDisk
(
int
drive
);
int
diskz
(
void
)
{
SDL_Event
event
;
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_load.bmp"
);
int
drivesloopdone
=
0
;
int
menuSelection
=
0
;
int
currLine
;
int
kright
=
0
;
int
kb
=
0
;
char
*
drives
[]
=
{
"df0:"
,
"df1:"
,
"df2:"
,
"df3:"
};
char
*
tmp
;
tmp
=
(
char
*
)
malloc
(
MAX_PATH
);
if
(
display
==
NULL
)
{
gui_init
();
}
sprintf
(
msg
,
"%s"
,
"Select Disk Drive"
);
sprintf
(
msg_status
,
"%s"
,
"[RIGHT] to eject disk"
);
while
(
!
drivesloopdone
)
{
while
(
SDL_PollEvent
(
&
event
))
{
#ifdef TOUCHUI
SDL_TUI_HandleEvent
(
&
event
);
#endif
if
(
event
.
type
==
SDL_QUIT
)
{
drivesloopdone
=
1
;
}
#if GP2X
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_UP
:
menuSelection
--
;
break
;
case
GP2X_BUTTON_DOWN
:
menuSelection
++
;
break
;
case
GP2X_BUTTON_RIGHT
:
kright
=
1
;
break
;
case
GP2X_BUTTON_SELECT
:
drivesloopdone
=
1
;
break
;
case
GP2X_BUTTON_B
:
kb
=
1
;
break
;
}
}
#endif
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
drivesloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
--
;
break
;
case
SDLK_DOWN
:
menuSelection
++
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_RETURN
:
kb
=
1
;
break
;
default:
break
;
}
}
}
if
(
kright
==
1
)
{
// eject diskimage
disk_eject
(
menuSelection
);
kright
=
0
;
}
if
(
kb
==
1
)
{
// select disk image
changeDisk
(
menuSelection
);
kb
=
0
;
}
if
(
menuSelection
<
0
)
{
menuSelection
=
3
;
}
if
(
menuSelection
>
3
)
{
menuSelection
=
0
;
}
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// texts
for
(
currLine
=
0
;
currLine
<
4
;
currLine
++
)
{
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
255
;
text_color
.
g
=
100
;
text_color
.
b
=
100
;
}
write_text
(
10
,
(
currLine
*
10
)
+
25
,
drives
[
currLine
]
);
sprintf
(
tmp
,
"%s"
,
changed_prefs
.
floppyslots
[
currLine
].
df
);
write_text
(
50
,
(
currLine
*
10
)
+
25
,
tmp
);
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
0
;
text_color
.
g
=
0
;
text_color
.
b
=
0
;
}
}
write_text
(
25
,
5
,
msg
);
write_text
(
15
,
230
,
msg_status
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
SDL_TUI_UpdateAll
();
#endif
redraw_frame
();
}
//while done
freedirstack
();
strcpy
(
disksSubDir
,
"disks"
);
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
return
0
;
}
void
changeDisk
(
int
drive
)
{
char
launchDir
[
MAX_PATH
];
SDL_Event
event
;
int
getdir
=
1
;
bool
hide_parent
=
false
;
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_load.bmp"
);
int
loadloopdone
=
0
;
int
num_of_files
=
0
;
int
menuSelection
=
0
;
int
currLine
;
int
bas
=
0
;
int
kb
=
0
;
char
**
filez
=
(
char
**
)
malloc
(
MAX_FILES
*
sizeof
(
char
*
));
if
(
display
==
NULL
)
{
gui_init
();
}
sprintf
(
msg
,
"%s"
,
"Select Disk Image"
);
sprintf
(
msg_status
,
"%s"
,
" "
);
getcwd
(
launchDir
,
MAX_PATH
);
int
paging
=
18
;
if
(
strcmp
(
disksSubDir
,
"
\0
"
)
==
0
)
{
strcpy
(
disksSubDir
,
"disks"
);
}
if
(
strcasecmp
(
disksSubDir
,
"disks"
)
==
0
)
{
hide_parent
=
true
;
}
num_of_files
=
getdirectory
(
filez
,
disksSubDir
,
hide_parent
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
while
(
!
loadloopdone
)
{
while
(
SDL_PollEvent
(
&
event
))
{
#ifdef TOUCHUI
SDL_TUI_HandleEvent
(
&
event
);
#endif
if
(
event
.
type
==
SDL_QUIT
)
{
loadloopdone
=
1
;
}
#if GP2X
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_UP
:
menuSelection
-=
1
;
break
;
case
GP2X_BUTTON_DOWN
:
menuSelection
+=
1
;
break
;
case
GP2X_BUTTON_B
:
kb
=
1
;
break
;
case
GP2X_BUTTON_SELECT
:
loadloopdone
=
1
;
break
;
}
}
#endif
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
loadloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
-=
1
;
break
;
case
SDLK_DOWN
:
menuSelection
+=
1
;
break
;
case
SDLK_RETURN
:
kb
=
1
;
break
;
default:
break
;
}
}
}
if
(
kb
==
1
)
{
// Check if a directory was selected
struct
stat
sstat
;
char
*
tmp
=
(
char
*
)
calloc
(
1
,
MAX_PATH
);
strcpy
(
tmp
,
disksSubDir
);
strcat
(
tmp
,
"/"
);
strcat
(
tmp
,
filez
[
menuSelection
]);
if
(
stat
(
tmp
,
&
sstat
)
!=
-
1
)
{
if
(
sstat
.
st_mode
&
S_IFDIR
)
{
// Select subdirectory
if
(
strcasecmp
(
filez
[
menuSelection
],
".."
)
==
0
)
{
// Back to parent
char
*
tmp2
=
NULL
;
tmp2
=
popdir
();
if
(
tmp2
)
{
menuSelection
=
0
;
paging
=
18
;
strcpy
(
disksSubDir
,
tmp2
);
int
i
;
hide_parent
=
false
;
if
(
getdirstackcount
()
==
0
)
{
hide_parent
=
true
;
}
for
(
i
=
0
;
i
<
num_of_files
;
i
++
)
{
free
(
filez
[
i
]);
}
num_of_files
=
getdirectory
(
filez
,
disksSubDir
,
hide_parent
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
}
free
(
tmp2
);
}
else
{
// go into subdirectory
pushdir
(
disksSubDir
);
menuSelection
=
0
;
paging
=
18
;
strcpy
(
disksSubDir
,
tmp
);
int
i
;
for
(
i
=
0
;
i
<
num_of_files
;
i
++
)
{
free
(
filez
[
i
]);
}
num_of_files
=
getdirectory
(
filez
,
disksSubDir
,
false
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
}
}
else
{
// Select diskimage
write_log
(
"Old Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
drive
].
df
);
strncpy
(
changed_prefs
.
floppyslots
[
drive
].
df
,
tmp
,
255
);
write_log
(
"Selected Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
drive
].
df
);
loadloopdone
=
1
;
}
}
free
(
tmp
);
kb
=
0
;
}
if
(
menuSelection
<
0
)
{
menuSelection
=
0
;
}
if
(
menuSelection
>=
num_of_files
)
{
menuSelection
=
num_of_files
-
1
;
}
if
(
menuSelection
>
(
bas
+
paging
-
1
))
{
bas
+=
1
;
}
if
(
menuSelection
<
bas
)
{
bas
-=
1
;
}
if
((
bas
+
paging
)
>
num_of_files
)
{
bas
=
(
num_of_files
-
paging
);
}
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// texts
int
lineOffset
=
0
;
for
(
currLine
=
bas
;
currLine
<
(
bas
+
paging
);
currLine
++
)
{
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
255
;
text_color
.
g
=
100
;
text_color
.
b
=
100
;
}
write_text
(
10
,
(
lineOffset
*
10
)
+
25
,
filez
[
currLine
]);
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
0
;
text_color
.
g
=
0
;
text_color
.
b
=
0
;
}
lineOffset
++
;
}
write_text
(
25
,
5
,
msg
);
write_text
(
15
,
238
,
msg_status
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
SDL_TUI_UpdateAll
();
#endif
redraw_frame
();
}
//while done
free
(
filez
);
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_load.bmp"
);
return
;
}
src/gui-sdl/menu_prefs.c
View file @
01b63a62
...
...
@@ -18,12 +18,15 @@ extern SDL_Color text_color;
extern
char
msg
[
50
];
extern
char
msg_status
[
50
];
int
prefz
(
int
parametre
)
{
int
prefz
(
void
)
{
SDL_Event
event
;
if
(
display
==
NULL
)
{
gui_init
();
}
sprintf
(
msg
,
"%s"
,
" "
);
sprintf
(
msg_status
,
"%s"
,
" "
);
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_tweak.bmp"
);
int
prefsloopdone
=
0
;
...
...
@@ -55,15 +58,13 @@ int prefz (int parametre) {
char
*
p_floppy
[]
=
{
"0"
,
"100"
,
"200"
,
"300"
};
//3
int
defaults
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
// defaults[0] = changed_prefs.cpu_level;
defaults
[
0
]
=
changed_prefs
.
cpu_model
;
if
(
changed_prefs
.
address_space_24
!=
0
)
{
// if (changed_prefs.cpu_level == 2) { defaults[0] = 4; }
// if (changed_prefs.cpu_level == 3) { defaults[0] = 5; }
if
(
changed_prefs
.
cpu_model
==
2
)
{
defaults
[
0
]
=
4
;
}
if
(
changed_prefs
.
cpu_model
==
3
)
{
defaults
[
0
]
=
5
;
}
}
defaults
[
1
]
=
changed_prefs
.
m68k_speed
;
//defaults[1] = changed_prefs.m68k_speed;
defaults
[
1
]
=
0
;
defaults
[
2
]
=
changed_prefs
.
chipset_mask
;
defaults
[
3
]
=
changed_prefs
.
chipmem_size
;
defaults
[
4
]
=
changed_prefs
.
fastmem_size
;
...
...
@@ -83,26 +84,26 @@ int prefz (int parametre) {
if
(
event
.
type
==
SDL_QUIT
)
{
prefsloopdone
=
1
;
}
#if GP2X
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
#if 0
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_UP
:
menuSelection
--
;
break
;
case
GP2X_BUTTON_DOWN
:
menuSelection
++
;
break
;
case
GP2X_BUTTON_LEFT
:
kleft
=
1
;
break
;
case
GP2X_BUTTON_RIGHT
:
kright
=
1
;
break
;
case
GP2X_BUTTON_SELECT
:
prefsloopdone
=
1
;
break
;
case
GP2X_BUTTON_B
:
prefsloopdone
=
1
;
break
;
#endif
}
}
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
#endif
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
prefsloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
--
;
break
;
case
SDLK_DOWN
:
menuSelection
++
;
break
;
case
SDLK_LEFT
:
kleft
=
1
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_
b
:
prefsloopdone
=
1
;
break
;
case
SDLK_
RETURN
:
prefsloopdone
=
1
;
break
;
default:
break
;
}
}
...
...
@@ -158,17 +159,18 @@ int prefz (int parametre) {
if
(
menuSelection
<
0
)
{
menuSelection
=
8
;
}
if
(
menuSelection
>
8
)
{
menuSelection
=
0
;
}
// background
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// texts
// texts
int
sira
=
0
;
int
skipper
=
0
;
for
(
q
=
0
;
q
<
9
;
q
++
)
{
for
(
q
=
0
;
q
<
8
;
q
++
)
{
if
(
menuSelection
==
q
)
{
text_color
.
r
=
150
;
text_color
.
g
=
50
;
text_color
.
b
=
50
;
}
write_text
(
10
,
skipper
+
25
+
(
sira
*
10
),
prefs
[
q
]);
//
write_text
(
10
,
skipper
+
25
+
(
sira
*
10
),
prefs
[
q
]);
//
if
(
q
==
0
)
{
write_text
(
130
,
skipper
+
25
+
(
sira
*
10
),
p_cpu
[
defaults
[
q
]]);
}
if
(
q
==
1
)
{
...
...
@@ -194,10 +196,10 @@ int prefz (int parametre) {
sira
++
;
}
write_text
(
25
,
6
,
msg
);
//
write_text
(
25
,
240
,
msg_status
);
//
write_text
(
25
,
5
,
msg
);
//
write_text
(
25
,
230
,
msg_status
);
//
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
SDL_TUI_UpdateAll
();
#endif
...
...
src/gui-sdl/menu_
load
.c
→
src/gui-sdl/menu_
roms
.c
View file @
01b63a62
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
...
...
@@ -16,62 +16,48 @@
extern
void
write_text
(
int
x
,
int
y
,
char
*
txt
);
extern
void
blit_image
(
SDL_Surface
*
img
,
int
x
,
int
y
);
extern
int
pushdir
(
char
*
directory
);
extern
char
*
popdir
(
void
);
extern
int
getdirstackcount
(
void
);
extern
void
freedirstack
(
void
);
extern
int
getdirectory
(
char
**
filez
,
char
*
directory
,
bool
hide_parent
);
extern
SDL_Surface
*
display
;
extern
SDL_Surface
*
tmpSDLScreen
;
extern
SDL_Surface
*
pMenu_Surface
;
extern
SDL_Color
text_color
;
#define MAX_FILES 1024
extern
char
yol
[];
extern
char
msg
[];
extern
char
msg_status
[];
int
dirz
(
int
parametre
)
{
char
launchDir
[
256
];
int
romz
(
void
)
{
char
subDir
[
MAX_PATH
];
char
launchDir
[
MAX_PATH
];
SDL_Event
event
;
int
getdir
=
1
;
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_load.bmp"
);
int
loadloopdone
=
0
;
int
num_of_files
=
0
;
int
menuSelection
=
0
;
int
q
;
int
currLine
;
int
bas
=
0
;
int
ka
=
0
;
int
kb
=
0
;
char
**
filez
=
(
char
**
)
malloc
(
MAX_FILES
*
sizeof
(
char
*
));
char
**
filez
=
(
char
**
)
malloc
(
MAX_FILES
*
sizeof
(
char
*
));
if
(
display
==
NULL
)
{
gui_init
();
}
sprintf
(
msg
,
"%s"
,
"Select Kickstart ROM"
);
sprintf
(
msg_status
,
"%s"
,
" "
);
getcwd
(
launchDir
,
MAX_PATH
);
int
i
;
int
paging
=
18
;
DIR
*
d
=
opendir
(
yol
);
struct
dirent
*
ep
;
getcwd
(
launchDir
,
256
);
if
(
d
!=
NULL
)
{
for
(
i
=
0
;
i
<
MAX_FILES
;
i
++
)
{
ep
=
readdir
(
d
);
if
(
ep
==
NULL
)
{
break
;
}
else
{
struct
stat
sstat
;
char
*
tmp
=
(
char
*
)
calloc
(
1
,
256
);
strcpy
(
tmp
,
launchDir
);
strcat
(
tmp
,
"/"
);
strcat
(
tmp
,
ep
->
d_name
);
filez
[
i
]
=
(
char
*
)
malloc
(
64
);
strncpy
(
filez
[
i
],
ep
->
d_name
,
64
);
num_of_files
++
;
free
(
tmp
);
}
}
closedir
(
d
);
}
if
(
num_of_files
<
18
)
{
strcpy
(
subDir
,
"roms"
);
num_of_files
=
getdirectory
(
filez
,
subDir
,
true
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
...
...
@@ -83,75 +69,82 @@ int dirz (int parametre) {
if
(
event
.
type
==
SDL_QUIT
)
{
loadloopdone
=
1
;
}
#if GP2X
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
#if 0
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_UP
:
menuSelection
-=
1
;
break
;
case
GP2X_BUTTON_DOWN
:
menuSelection
+=
1
;
break
;
case GP2X_BUTTON_A: ka = 1; break;
case
GP2X_BUTTON_B
:
kb
=
1
;
break
;
case
GP2X_BUTTON_SELECT
:
loadloopdone
=
1
;
break
;
#endif
}
}
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
loadloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
-
=
1
;
break
;
case
SDLK_DOWN
:
menuSelection
+
=
1
;
break
;
case
SDLK_
a
:
ka
=
1
;
break
;
case
SDLK_
b
:
kb
=
1
;
break
;
#endif
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
loadloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
-
=
1
;
break
;
case
SDLK_
DOWN
:
menuSelection
+
=
1
;
break
;
case
SDLK_
RETURN
:
kb
=
1
;
break
;
default:
break
;
}
}
}
if
(
parametre
==
0
)
{
if
(
ka
==
1
)
{
//df1
// Select Disk Image
char
*
tmp
=
(
char
*
)
calloc
(
1
,
256
);
//strcpy(tmp,launchDir);
strcat
(
tmp
,
"disks/"
);
strcat
(
tmp
,
filez
[
menuSelection
]);
//strcpy(changed_prefs.floppyslots[1].df,tmp);
write_log
(
"Old Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
1
].
df
);
strncpy
(
changed_prefs
.
floppyslots
[
1
].
df
,
tmp
,
255
);
write_log
(
"Selected Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
1
].
df
);
free
(
tmp
);
loadloopdone
=
1
;
ka
=
0
;
}
if
(
kb
==
1
)
{
//df0;
// Select Disk Image
char
*
tmp
=
(
char
*
)
calloc
(
1
,
256
);
//strcpy(tmp,launchDir);
strcat
(
tmp
,
"disks/"
);
strcat
(
tmp
,
filez
[
menuSelection
]);
//strcpy(changed_prefs.floppyslots[0].df,tmp);
write_log
(
"Old Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
0
].
df
);
strncpy
(
changed_prefs
.
floppyslots
[
0
].
df
,
tmp
,
255
);
write_log
(
"Selected Disk Image: %s
\n
"
,
changed_prefs
.
floppyslots
[
0
].
df
);
free
(
tmp
);
loadloopdone
=
1
;
kb
=
0
;
}
}
else
{
if
(
kb
==
1
)
{
// Select KickStart ROM
char
*
tmp
=
(
char
*
)
calloc
(
1
,
256
);
//strcpy(tmp,launchDir);
strcat
(
tmp
,
"roms/"
);
strcat
(
tmp
,
filez
[
menuSelection
]);
//strcpy(changed_prefs.romfile,tmp);
write_log
(
"Old KickStart ROM: %s
\n
"
,
changed_prefs
.
romfile
);
strncpy
(
changed_prefs
.
romfile
,
tmp
,
255
);
write_log
(
"Selected KickStart ROM: %s
\n
"
,
changed_prefs
.
romfile
);
free
(
tmp
);
loadloopdone
=
1
;
if
(
kb
==
1
)
{
// Check if a directory was selected
struct
stat
sstat
;
char
*
tmp
=
(
char
*
)
calloc
(
1
,
MAX_PATH
);
strcpy
(
tmp
,
subDir
);
strcat
(
tmp
,
"/"
);
strcat
(
tmp
,
filez
[
menuSelection
]);
if
(
stat
(
tmp
,
&
sstat
)
!=
-
1
)
{
if
(
sstat
.
st_mode
&
S_IFDIR
)
{
// Select subdirectory
if
(
strcasecmp
(
filez
[
menuSelection
],
".."
)
==
0
)
{
// Back to parent
char
*
tmp2
=
NULL
;
tmp2
=
popdir
();
if
(
tmp2
)
{
menuSelection
=
0
;
paging
=
18
;
strcpy
(
subDir
,
tmp2
);
int
i
;
bool
hide_parent
=
false
;
if
(
getdirstackcount
()
==
0
)
{
hide_parent
=
true
;
}
for
(
i
=
0
;
i
<
num_of_files
;
i
++
)
{
free
(
filez
[
i
]);
}
num_of_files
=
getdirectory
(
filez
,
subDir
,
hide_parent
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
}
free
(
tmp2
);
}
else
{
// go into subdirectory
pushdir
(
subDir
);
menuSelection
=
0
;
paging
=
18
;
strcpy
(
subDir
,
tmp
);
int
i
;
for
(
i
=
0
;
i
<
num_of_files
;
i
++
)
{
free
(
filez
[
i
]);
}
num_of_files
=
getdirectory
(
filez
,
subDir
,
false
);
if
(
num_of_files
<
18
)
{
paging
=
num_of_files
;
}
}
}
else
{
// Select kickstart rom
write_log
(
"Old KickStart ROM: %s
\n
"
,
changed_prefs
.
romfile
);
strncpy
(
changed_prefs
.
romfile
,
tmp
,
255
);
write_log
(
"Selected KickStart ROM: %s
\n
"
,
changed_prefs
.
romfile
);
loadloopdone
=
1
;
}
}
ka
=
0
;
free
(
tmp
)
;
kb
=
0
;
}
...
...
@@ -161,24 +154,24 @@ int dirz (int parametre) {
if
(
menuSelection
<
bas
)
{
bas
-=
1
;
}
if
((
bas
+
paging
)
>
num_of_files
)
{
bas
=
(
num_of_files
-
paging
);
}
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// texts
int
sira
=
0
;
for
(
q
=
bas
;
q
<
(
bas
+
paging
);
q
++
)
{
if
(
menuSelection
==
q
)
{
// texts
int
lineOffset
=
0
;
for
(
currLine
=
bas
;
currLine
<
(
bas
+
paging
);
currLine
++
)
{
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
255
;
text_color
.
g
=
100
;
text_color
.
b
=
100
;
}
write_text
(
10
,
25
+
(
sira
*
10
),
filez
[
q
]);
//
if
(
menuSelection
==
q
)
{
write_text
(
10
,
(
lineOffset
*
10
)
+
25
,
filez
[
currLine
]);
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
0
;
text_color
.
g
=
0
;
text_color
.
b
=
0
;
}
sira
++
;
lineOffset
++
;
}
write_text
(
25
,
3
,
msg
);
write_text
(
15
,
228
,
msg_status
);
write_text
(
25
,
5
,
msg
);
write_text
(
15
,
238
,
msg_status
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
...
...
@@ -188,6 +181,7 @@ int dirz (int parametre) {
}
//while done
free
(
filez
);
freedirstack
();
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
return
0
;
...
...
src/gui-sdl/menu_tweak.c
View file @
01b63a62
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "SDL.h"
...
...
@@ -10,8 +9,8 @@
#include <SDL_TouchUI.h>
#endif
extern
void
write_text
(
int
x
,
int
y
,
char
*
txt
);
extern
void
blit_image
(
SDL_Surface
*
img
,
int
x
,
int
y
);
extern
void
write_text
(
int
x
,
int
y
,
char
*
txt
);
extern
void
blit_image
(
SDL_Surface
*
img
,
int
x
,
int
y
);
extern
SDL_Surface
*
display
;
extern
SDL_Surface
*
tmpSDLScreen
;
extern
SDL_Surface
*
pMenu_Surface
;
...
...
@@ -19,10 +18,11 @@ extern SDL_Color text_color;
extern
char
msg
[
50
];
extern
char
msg_status
[
50
];
int
tweakz
(
int
parametre
)
{
int
tweakz
(
void
)
{
#ifdef GP2X
SDL_Event
event
;
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_tweak.bmp"
);
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu_tweak.bmp"
);
int
tweakloopdone
=
0
;
int
kup
=
0
;
int
kdown
=
0
;
...
...
@@ -30,26 +30,42 @@ int tweakz (int parametre) {
int
kright
=
0
;
int
kb
=
0
;
int
menuSelection
=
0
;
int
q
;
char
*
tweaks
[]
=
{
"CPU Mhz"
,
"tRC"
,
"tRAS"
,
"tWR"
,
"tMRD"
,
"tRFC"
,
"tRP"
,
"tRCD"
,
"PLL"
,
"Timing"
,
"Default (200mhz)"
,
"Default (266mhz)"
,
"Evil Dragon (266mhz)"
};
int
defaults
[]
=
{
200
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
def_slow_tweak
[]
=
{
200
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
def_fast_tweak
[]
=
{
266
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
evil_tweak
[]
=
{
266
,
6
,
4
,
1
,
1
,
1
,
2
,
2
,
1
,
1
};
int
currLine
;
char
*
tweaks
[]
=
{
"CPU Mhz"
,
"tRC"
,
"tRAS"
,
"tWR"
,
"tMRD"
,
"tRFC"
,
"tRP"
,
"tRCD"
,
"PLL"
,
"Timing"
,
"Default (200mhz)"
,
"Default (266mhz)"
,
"Evil Dragon (266mhz)"
};
int
defaults
[]
=
{
200
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
def_slow_tweak
[]
=
{
200
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
def_fast_tweak
[]
=
{
266
,
8
,
16
,
3
,
8
,
8
,
8
,
8
,
1
,
1
};
int
evil_tweak
[]
=
{
266
,
6
,
4
,
1
,
1
,
1
,
2
,
2
,
1
,
1
};
char
*
tmp
;
tmp
=
(
char
*
)
malloc
(
5
);
tmp
=
(
char
*
)
malloc
(
5
);
if
(
display
==
NULL
)
{
gui_init
();
}
sprintf
(
msg
,
"%s"
,
"Tweaks"
);
sprintf
(
msg_status
,
"%s"
,
"L/R = -/+ B: Apply"
);
#ifdef GP2X
unsigned
sysfreq
=
0
;
unsigned
sysfreq
=
0
;
int
cpufreq
;
sysfreq
=
get_freq_920_CLK
();
sysfreq
*
=
get_920_Div
()
+
1
;
cpufreq
=
sysfreq
/
1000000
;
sysfreq
*
=
get_920_Div
()
+
1
;
cpufreq
=
sysfreq
/
1000000
;
defaults
[
0
]
=
cpufreq
;
defaults
[
1
]
=
get_tRC
();
...
...
@@ -59,66 +75,58 @@ int tweakz (int parametre) {
defaults
[
5
]
=
get_tRFC
();
defaults
[
6
]
=
get_tRP
();
defaults
[
7
]
=
get_tRCD
();
#endif
while
(
!
tweakloopdone
)
{
while
(
SDL_PollEvent
(
&
event
))
{
#ifdef TOUCHUI
SDL_TUI_HandleEvent
(
&
event
);
#endif
if
(
event
.
type
==
SDL_QUIT
)
{
tweakloopdone
=
1
;
}
if
(
event
.
type
==
SDL_JOYBUTTONDOWN
)
{
switch
(
event
.
jbutton
.
button
)
{
#if 0
switch
(
event
.
jbutton
.
button
)
{
case
GP2X_BUTTON_UP
:
menuSelection
--
;
break
;
case
GP2X_BUTTON_DOWN
:
menuSelection
++
;
break
;
case
GP2X_BUTTON_LEFT
:
kleft
=
1
;
break
;
case
GP2X_BUTTON_RIGHT
:
kright
=
1
;
break
;
case
GP2X_BUTTON_SELECT
:
tweakloopdone
=
1
;
break
;
case GP2X_BUTTON_B: kb =1; break;
#endif
case
GP2X_BUTTON_B
:
kb
=
1
;
break
;
}
}
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
tweakloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
--
;
break
;
case
SDLK_DOWN
:
menuSelection
++
;
break
;
case
SDLK_LEFT
:
kleft
=
1
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_
b
:
kb
=
1
;
break
;
if
(
event
.
type
==
SDL_KEYDOWN
)
{
switch
(
event
.
key
.
keysym
.
sym
)
{
case
SDLK_ESCAPE
:
tweakloopdone
=
1
;
break
;
case
SDLK_UP
:
menuSelection
--
;
break
;
case
SDLK_DOWN
:
menuSelection
++
;
break
;
case
SDLK_LEFT
:
kleft
=
1
;
break
;
case
SDLK_RIGHT
:
kright
=
1
;
break
;
case
SDLK_
RETURN
:
kb
=
1
;
break
;
default:
break
;
}
}
}
if
(
kb
==
1
)
{
if
(
menuSelection
==
10
)
{
for
(
q
=
0
;
q
<
10
;
q
++
)
{
defaults
[
q
]
=
def_slow_tweak
[
q
];
}
for
(
currLine
=
0
;
currLine
<
10
;
currLine
++
)
{
defaults
[
currLine
]
=
def_slow_tweak
[
currLine
];
}
}
if
(
menuSelection
==
11
)
{
for
(
q
=
0
;
q
<
10
;
q
++
)
{
defaults
[
q
]
=
def_fast_tweak
[
q
];
}
for
(
currLine
=
0
;
currLine
<
10
;
currLine
++
)
{
defaults
[
currLine
]
=
def_fast_tweak
[
currLine
];
}
}
if
(
menuSelection
==
12
)
{
for
(
q
=
0
;
q
<
10
;
q
++
)
{
defaults
[
q
]
=
evil_tweak
[
q
];
}
for
(
currLine
=
0
;
currLine
<
10
;
currLine
++
)
{
defaults
[
currLine
]
=
evil_tweak
[
currLine
];
}
}
if
(
menuSelection
<
10
)
{
#if 0
//apply
//printf("FLCK: %d",0);
set_CAS(0);
printf("FLCK: %d",
defaults[0]);
set_FCLK(defaults[0]);
printf("tRC : %d",
defaults[1]); set_tRC(defaults[1]-
1);
printf("tRAS: %d",
defaults[2]); set_tRAS(defaults[2]-
1);
printf("tWR : %d",
defaults[3]); set_tWR(defaults[3]-
1);
printf("tMRD: %d",
defaults[4]); set_tMRD(defaults[4]-
1);
printf("tRFC: %d",
defaults[5]); set_tRFC(defaults[5]-
1);
printf("tRP : %d",
defaults[6]); set_tRP(defaults[6]-
1);
printf("tRCD: %d",
defaults[7]); set_tRCD(defaults[7]-
1);
//printf("FLCK: %d",0);
set_CAS(0);
printf
(
"FLCK: %d"
,
defaults
[
0
]);
set_FCLK
(
defaults
[
0
]);
printf
(
"tRC : %d"
,
defaults
[
1
]);
set_tRC
(
defaults
[
1
]
-
1
);
printf
(
"tRAS: %d"
,
defaults
[
2
]);
set_tRAS
(
defaults
[
2
]
-
1
);
printf
(
"tWR : %d"
,
defaults
[
3
]);
set_tWR
(
defaults
[
3
]
-
1
);
printf
(
"tMRD: %d"
,
defaults
[
4
]);
set_tMRD
(
defaults
[
4
]
-
1
);
printf
(
"tRFC: %d"
,
defaults
[
5
]);
set_tRFC
(
defaults
[
5
]
-
1
);
printf
(
"tRP : %d"
,
defaults
[
6
]);
set_tRP
(
defaults
[
6
]
-
1
);
printf
(
"tRCD: %d"
,
defaults
[
7
]);
set_tRCD
(
defaults
[
7
]
-
1
);
if
(
defaults
[
8
]
==
0
)
{
printf("FLCD: %d",
defaults[9]); set_add_FLCDCLK(defaults[9]-
1);
printf
(
"FLCD: %d"
,
defaults
[
9
]);
set_add_FLCDCLK
(
defaults
[
9
]
-
1
);
}
else
{
printf("ULCD: %d",
defaults[9]); set_add_ULCDCLK(defaults[9]-
1);
printf
(
"ULCD: %d"
,
defaults
[
9
]);
set_add_ULCDCLK
(
defaults
[
9
]
-
1
);
}
#endif
tweakloopdone
=
1
;
}
kb
=
0
;
...
...
@@ -156,46 +164,44 @@ int tweakz (int parametre) {
if
(
menuSelection
<
0
)
{
menuSelection
=
12
;
}
if
(
menuSelection
>
12
)
{
menuSelection
=
0
;
}
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// background
SDL_BlitSurface
(
pMenu_Surface
,
NULL
,
tmpSDLScreen
,
NULL
);
// texts
int
sira
=
0
;
// texts
int
lineOffset
=
0
;
int
skipper
=
0
;
for
(
q
=
0
;
q
<
13
;
q
++
)
{
if
(
q
==
10
)
{
skipper
=
30
;
}
if
(
menuSelection
==
q
)
{
for
(
currLine
=
0
;
currLine
<
13
;
currLine
++
)
{
if
(
currLine
==
10
)
{
skipper
=
30
;
}
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
255
;
text_color
.
g
=
100
;
text_color
.
b
=
100
;
}
write_text
(
10
,
skipper
+
25
+
(
sira
*
10
),
tweaks
[
q
]);
//
if
(
q
<
10
)
{
if
(
q
==
8
)
{
write_text
(
10
,
skipper
+
25
+
(
lineOffset
*
10
),
tweaks
[
currLine
]);
if
(
currLine
<
10
)
{
if
(
currLine
==
8
)
{
if
(
defaults
[
8
]
==
0
)
{
sprintf
(
tmp
,
"%s"
,
"FPLL"
);
sprintf
(
tmp
,
"%s"
,
"FPLL"
);
}
else
{
sprintf
(
tmp
,
"%s"
,
"UPLL"
);
sprintf
(
tmp
,
"%s"
,
"UPLL"
);
}
}
else
{
sprintf
(
tmp
,
"%d"
,
defaults
[
q
]);
sprintf
(
tmp
,
"%d"
,
defaults
[
currLine
]);
}
write_text
(
100
,
skipper
+
25
+
(
sira
*
10
),
tmp
);
write_text
(
100
,
skipper
+
25
+
(
lineOffset
*
10
),
tmp
);
}
if
(
menuSelection
==
q
)
{
if
(
menuSelection
==
currLine
)
{
text_color
.
r
=
0
;
text_color
.
g
=
0
;
text_color
.
b
=
0
;
}
sira
++
;
lineOffset
++
;
}
write_text
(
25
,
3
,
msg
);
write_text
(
15
,
228
,
msg_status
);
write_text
(
25
,
5
,
msg
);
write_text
(
15
,
238
,
msg_status
);
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
#ifdef TOUCHUI
SDL_TUI_UpdateAll
();
#endif
SDL_BlitSurface
(
tmpSDLScreen
,
NULL
,
display
,
NULL
);
redraw_frame
();
}
//while done
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
pMenu_Surface
=
SDL_LoadBMP
(
"images/menu.bmp"
);
#endif
return
0
;
}
src/gui-sdl/vkbd.h
View file @
01b63a62
...
...
@@ -3,18 +3,18 @@
#define VKBD_X 20
#define VKBD_Y 200
#define VKBD_LEFT
1
#define VKBD_RIGHT
2
#define VKBD_UP
4
#define VKBD_DOWN
8
#define VKBD_BUTTON
16
#define VKBD_BUTTON2
32
#define VKBD_LEFT
1
#define VKBD_RIGHT
2
#define VKBD_UP
4
#define VKBD_DOWN
8
#define VKBD_BUTTON
16
#define VKBD_BUTTON2
32
int
vkbd_init
(
void
);
void
vkbd_quit
(
void
);
void
vkbd_redraw
(
void
);
SDLKey
vkbd_process
(
void
);
void
vkbd_init_button2
(
void
);
int
vkbd_init
(
void
);
void
vkbd_quit
(
void
);
void
vkbd_redraw
(
void
);
SDLKey
vkbd_process
(
void
);
void
vkbd_init_button2
(
void
);
extern
int
vkbd_mode
;
extern
int
vkbd_move
;
...
...
src/gui-sdl/volumecontrol.c
View file @
01b63a62
#include <SDL.h>
#include "volumecontrol.h"
extern
SDL_Surface
*
prSDLScreen
;
static
SDL_Surface
*
ksur
;
//
int show_volumecontrol = 0;
int
show_volumecontrol
=
0
;
int
volumecontrol_init
(
void
)
{
int
volumecontrol_init
(
void
)
{
// don't know if we'll ever need anything here.
return
0
;
}
void
volumecontrol_redraw
(
void
)
{
/*
void
volumecontrol_redraw
(
void
)
{
SDL_Rect
r
;
SDL_Surface
*
surface
;
int
i
;
Uint32 green = SDL_MapRGB(prSDLScreen->format, 250,
250,
0);
Uint32
green
=
SDL_MapRGB
(
prSDLScreen
->
format
,
250
,
250
,
0
);
r
.
x
=
110
;
r
.
y
=
prSDLScreen
->
h
-
30
;
r.w = soundVolume;
//r.w = soundVolume;
r
.
w
=
50
;
r
.
h
=
15
;
// draw the blocks now
SDL_FillRect
(
prSDLScreen
,
&
r
,
green
);
SDL_BlitSurface(surface,NULL,prSDLScreen,&r);
*/
SDL_BlitSurface
(
surface
,
NULL
,
prSDLScreen
,
&
r
);
}
src/gui-sdl/volumecontrol.h
View file @
01b63a62
int
volumecontrol_init
(
void
);
void
volumecontrol_redraw
(
void
);
int
volumecontrol_init
(
void
);
void
volumecontrol_redraw
(
void
);
extern
int
show_volumecontrol
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment