Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
81-libretro
Commits
5e5dd844
Commit
5e5dd844
authored
Nov 23, 2015
by
Andre Leiradella
Browse files
fixes to the input system, to the embedded keyboard, and to the LOAD "" command
parent
263b262f
Changes
2
Show whitespace changes
Inline
Side-by-side
src/keybovl.c
View file @
5e5dd844
...
...
@@ -8,6 +8,7 @@ static int timer; // milliseconds counter to release the key
static
uint32_t
joystate
=
0
;
// joystick button states
static
uint32_t
keystate
[
(
RETROK_LAST
+
31
)
/
32
]
=
{
0
};
// key states
#define TOGGLE 1
#define PRESSED 2
#define SELECTED 4
...
...
@@ -295,7 +296,7 @@ static void update( retro_input_state_t input_cb, unsigned* devices, int ms )
}
}
}
else
else
if
(
timer
<=
0
)
{
// virtual keyboard navigation
...
...
@@ -315,15 +316,15 @@ static void update( retro_input_state_t input_cb, unsigned* devices, int ms )
case
RETRO_DEVICE_ID_JOYPAD_A
:
case
RETRO_DEVICE_ID_JOYPAD_B
:
{
if
(
key
->
meta
&
1
)
if
(
key
->
meta
&
TOGGLE
)
{
key
->
meta
^=
PRESSED
;
}
else
if
(
timer
<=
0
)
else
{
for
(
k
=
ovl
->
keys
;
k
->
id
!=
0xffff
;
k
++
)
{
if
(
(
k
->
meta
&
(
PRESSED
|
1
)
)
==
(
PRESSED
|
1
)
)
if
(
(
k
->
meta
&
(
PRESSED
|
TOGGLE
)
)
==
(
PRESSED
|
TOGGLE
)
)
{
ovl
->
keypress
(
ovl
,
k
->
mapped
);
}
...
...
@@ -346,6 +347,8 @@ static void update( retro_input_state_t input_cb, unsigned* devices, int ms )
// Process the keyboard
if
(
!
visible
)
{
for
(
p
=
0
;
p
<
2
;
p
++
)
{
if
(
(
devices
[
p
]
&
RETRO_DEVICE_MASK
)
!=
RETRO_DEVICE_KEYBOARD
)
...
...
@@ -377,6 +380,7 @@ static void update( retro_input_state_t input_cb, unsigned* devices, int ms )
}
}
}
}
}
void
keybovl_set
(
keybovl_t
*
ovl_
)
...
...
src/libretro.cpp
View file @
5e5dd844
...
...
@@ -12,8 +12,8 @@
#include <zx81.h>
#include <tzx/TZXFILE.h>
#define RETRO_DEVICE_SINCLAIR_KEYBOARD RETRO_DEVICE_KEYBOARD
#define RETRO_DEVICE_CURSOR_JOYSTICK RETRO_DEVICE_JOYPAD
#define RETRO_DEVICE_SINCLAIR_KEYBOARD
RETRO_DEVICE_SUBCLASS(
RETRO_DEVICE_KEYBOARD
, 0)
#define RETRO_DEVICE_CURSOR_JOYSTICK
RETRO_DEVICE_SUBCLASS(
RETRO_DEVICE_JOYPAD
, 0)
#ifdef LOG_PERFORMANCE
#define RETRO_PERFORMANCE_INIT( name ) do { static struct retro_perf_counter name = { #name }; if ( !name.registered ) perf_cb.perf_register( &( name ) ) } while ( 0 )
...
...
@@ -67,6 +67,8 @@ extern TTZXFile TZXFile;
static
state_t
state
;
#define ZX81KEYS "default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
static
const
struct
retro_variable
core_vars
[]
=
{
{
"81_fast_load"
,
"Tape Fast Load; enabled|disabled"
},
...
...
@@ -75,20 +77,20 @@ static const struct retro_variable core_vars[] =
{
"81_chroma_81"
,
"Emulate Chroma 81; disabled|enabled"
},
{
"81_video_presets"
,
"Video Presets; clean|tv|noisy"
},
{
"81_sound"
,
"Sound emulation; none|Zon X-81"
},
{
"81_joypad_up"
,
"Joypad Up mapping;
default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
},
{
"81_joypad_down"
,
"Joypad Down mapping;
default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
},
{
"81_joypad_left"
,
"Joypad Left mapping;
default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
},
{
"81_joypad_right"
,
"Joypad Right mapping;
default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
},
{
"81_joypad_fire"
,
"Joypad Fire mapping;
default|new line|shift|space|.|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z"
},
{
"81_joypad_up"
,
"Joypad Up mapping;
"
ZX81KEYS
},
{
"81_joypad_down"
,
"Joypad Down mapping;
"
ZX81KEYS
},
{
"81_joypad_left"
,
"Joypad Left mapping;
"
ZX81KEYS
},
{
"81_joypad_right"
,
"Joypad Right mapping;
"
ZX81KEYS
},
{
"81_joypad_fire"
,
"Joypad Fire mapping;
"
ZX81KEYS
},
{
"81_keybovl_transp"
,
"Transparent Keyboard Overlay; enabled|disabled"
},
{
"81_key_hold_time"
,
"Time to Release Key in ms;
5
00|
10
00|
1
00|
3
00"
},
{
"81_key_hold_time"
,
"Time to Release Key in ms;
1
00|
3
00|
5
00|
10
00"
},
{
NULL
,
NULL
},
};
#define UPDATE_RESET 1
#define UPDATE_AV 2
static
int
update_variables
(
void
)
static
int
update_variables
()
{
int
reset
=
0
;
int
old_scaled
=
state
.
scaled
;
...
...
@@ -325,9 +327,6 @@ bool retro_load_game( const struct retro_game_info* info )
memcpy
(
state
.
data
,
info
->
data
,
state
.
size
);
state
.
devices
[
0
]
=
RETRO_DEVICE_CURSOR_JOYSTICK
;
state
.
devices
[
1
]
=
RETRO_DEVICE_SINCLAIR_KEYBOARD
;
state
.
cfg
.
machine
=
MACHINEZX81
;
state
.
cfg
.
LambdaColour
=
COLOURDISABLED
;
state
.
cfg
.
LowRAMContents
=
LOWRAM_ROMSHADOW
;
...
...
@@ -343,6 +342,7 @@ bool retro_load_game( const struct retro_game_info* info )
state
.
cfg
.
Chroma81
=
0
;
state
.
scaled
=
-
1
;
TZXFile
.
AddTextBlock
(
""
);
// prevent a crash if the user does a LOAD ""
TZXFile
.
FlashLoad
=
true
;
update_variables
();
...
...
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