mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
Added binding of joystick directions, add throttling info to the traffic meter
This commit is contained in:
parent
f317afd4e8
commit
1a29531f81
@ -1,10 +1,6 @@
|
||||
version 7:
|
||||
TODO: Add ability to select files to load from disks in
|
||||
a menu
|
||||
|
||||
TODO: Would it be possible for you to implement the
|
||||
binding of Joystick directions to buttons?
|
||||
|
||||
TODO: Multiple frodo versions, switch between
|
||||
|
||||
TODO: D-pad less responsive in v6 than v5
|
||||
@ -13,6 +9,10 @@ version 7:
|
||||
|
||||
TODO: Fix two-controller issue
|
||||
|
||||
version 7:
|
||||
* Allow binding 1 and other extra buttons to joystick directions
|
||||
and fire
|
||||
|
||||
-- Simon Kagstrom <simon.kagstrom@gmail.com>,
|
||||
|
||||
version 6:
|
||||
|
@ -570,6 +570,7 @@ void C64::network_vblank()
|
||||
for (int i = 0; i < this->network_server->n_clients; i++) {
|
||||
Uint8 *master = this->TheDisplay->BitmapBase();
|
||||
NetworkClient *remote = this->network_server->clients[i];
|
||||
static bool has_throttled;
|
||||
|
||||
remote->Tick( now - last_time_update );
|
||||
/* Has the client sent any data? */
|
||||
@ -589,6 +590,7 @@ void C64::network_vblank()
|
||||
}
|
||||
if (remote->ThrottleTraffic()) {
|
||||
/* Skip this frame if the data rate is too high */
|
||||
has_throttled = true;
|
||||
continue;
|
||||
}
|
||||
remote->EncodeDisplay(master, remote->screen);
|
||||
@ -606,8 +608,10 @@ void C64::network_vblank()
|
||||
|
||||
if (last_time_update - last_traffic_update > 300)
|
||||
{
|
||||
TheDisplay->NetworkTrafficMeter(remote->GetKbps() / (8 * 1024.0));
|
||||
TheDisplay->NetworkTrafficMeter(remote->GetKbps() / (8 * 1024.0),
|
||||
has_throttled);
|
||||
last_traffic_update = now;
|
||||
has_throttled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
void Update(void);
|
||||
void UpdateLEDs(int l0, int l1, int l2, int l3);
|
||||
void Speedometer(int speed);
|
||||
void NetworkTrafficMeter(float kb_per_s);
|
||||
void NetworkTrafficMeter(float kb_per_s, bool has_throttled);
|
||||
uint8 *BitmapBase(void);
|
||||
int BitmapXMod(void);
|
||||
#ifdef __riscos__
|
||||
@ -82,7 +82,8 @@ public:
|
||||
#if defined(HAVE_SDL)
|
||||
void FakeKeyPress(int kc, uint8 *CIA_key_matrix, uint8 *CIA_rev_matrix);
|
||||
void TranslateKey(SDLKey key, bool key_up, uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick);
|
||||
void UpdateKeyMatrix(int c64_key, bool key_up, uint8 *key_matrix, uint8 *rev_matrix);
|
||||
void UpdateKeyMatrix(int c64_key, bool key_up, uint8 *key_matrix,
|
||||
uint8 *rev_matrix, uint8 *joystick);
|
||||
void Update(uint8 *src_pixels);
|
||||
#endif
|
||||
bool NumLock(void);
|
||||
|
@ -306,10 +306,10 @@ void C64Display::Speedometer(int speed)
|
||||
delay++;
|
||||
}
|
||||
|
||||
void C64Display::NetworkTrafficMeter(float kb_per_s)
|
||||
void C64Display::NetworkTrafficMeter(float kb_per_s, bool is_throttled)
|
||||
{
|
||||
sprintf(this->networktraffic_string, "%6.2f KB/S",
|
||||
kb_per_s);
|
||||
sprintf(this->networktraffic_string, "%6.2f KB/S%s",
|
||||
kb_per_s, is_throttled ? " THROTTLED" : "");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -342,15 +342,27 @@ void C64Display::FakeKeyPress(int kc, uint8 *CIA_key_matrix,
|
||||
CIA_rev_matrix[i] = 0xFF;
|
||||
}
|
||||
if (kc != -1)
|
||||
this->UpdateKeyMatrix(kc, false, CIA_key_matrix, CIA_rev_matrix);
|
||||
this->UpdateKeyMatrix(kc, false, CIA_key_matrix, CIA_rev_matrix,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void C64Display::UpdateKeyMatrix(int c64_key, bool key_up, uint8 *key_matrix, uint8 *rev_matrix)
|
||||
void C64Display::UpdateKeyMatrix(int c64_key, bool key_up,
|
||||
uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||
{
|
||||
bool shifted = c64_key & 0x80;
|
||||
int c64_byte = (c64_key >> 3) & 7;
|
||||
int c64_bit = c64_key & 7;
|
||||
|
||||
// Handle joystick emulation
|
||||
if (joystick && (c64_key & 0x40)) {
|
||||
c64_key &= 0x1f;
|
||||
if (key_up)
|
||||
*joystick |= c64_key;
|
||||
else
|
||||
*joystick &= ~c64_key;
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_up) {
|
||||
if (shifted) {
|
||||
key_matrix[6] |= 0x10;
|
||||
@ -477,17 +489,7 @@ void C64Display::TranslateKey(SDLKey key, bool key_up, uint8 *key_matrix,
|
||||
if (c64_key < 0)
|
||||
return;
|
||||
|
||||
// Handle joystick emulation
|
||||
if (c64_key & 0x40) {
|
||||
c64_key &= 0x1f;
|
||||
if (key_up)
|
||||
*joystick |= c64_key;
|
||||
else
|
||||
*joystick &= ~c64_key;
|
||||
return;
|
||||
}
|
||||
|
||||
this->UpdateKeyMatrix(c64_key, key_up, key_matrix, rev_matrix);
|
||||
this->UpdateKeyMatrix(c64_key, key_up, key_matrix, rev_matrix, joystick);
|
||||
}
|
||||
|
||||
void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||
@ -679,13 +681,15 @@ uint8 C64::poll_joystick(int port)
|
||||
if (extra_keys[i])
|
||||
{
|
||||
TheDisplay->UpdateKeyMatrix(kc, false,
|
||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix);
|
||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
||||
&j);
|
||||
is_pressed[i] = true;
|
||||
}
|
||||
else if (is_pressed[i])
|
||||
{
|
||||
TheDisplay->UpdateKeyMatrix(kc, true,
|
||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix);
|
||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
||||
&j);
|
||||
is_pressed[i] = false;
|
||||
}
|
||||
}
|
||||
|
@ -46,16 +46,21 @@ typedef struct virtkey
|
||||
{ name, -1, false, false }
|
||||
#define D(name) \
|
||||
{ name, -1, false, true }
|
||||
#define J(name, v) \
|
||||
{ name, 0x40 | (v), false, false }
|
||||
|
||||
#define KEY_COLS 15
|
||||
#define KEY_ROWS 5
|
||||
#define KEY_ROWS 8
|
||||
|
||||
static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
|
||||
K("<-",7,1), K("1", 7,0), K("2", 7,3), K("3", 1,0), K("4", 1,3), K("5", 2,0), K("6", 2,3), K("7", 3,0), K("8", 3,3), K("9", 4,0), K("0", 4,3), K("+", 5,0), K("-", 5,3), K("£", 6,0), K("Hom", 6,3),
|
||||
K("Cr", 7,2), K("Q", 7,6), K("W", 1,1), K("E", 1,6), K("R", 2,1), K("T", 2,6), K("Y", 3,1), K("U", 3,6), K("I", 4,1), K("O", 4,6), K("P", 5,1), K("@", 5,6), K("*", 6,1), K("Au", 6,6),K("Rstr",4,0),
|
||||
K("R/Stp", 7,7), K(NULL,0,0), K("A", 1,2), K("S", 1,5), K("D", 2,2), K("F", 2,5), K("G", 3,2), K("H", 3,5), K("J", 4,2), K("K", 4,5), K("L", 5,2), K(":", 5,5), K(";", 6,2), K("=", 6,5), K("Ret", 0,1),
|
||||
K("C=", 7,5), S("Shft",1,7),K(NULL,0,0),K("Z", 1,4), K("X", 2,7), K("C", 2,4), K("V", 3,7), K("B", 3,4), K("N", 4,7), K("M", 4,4), K(",", 5,7), K(".", 5,4), K("/", 6,7), K("Dwn",0,7),K("Rgt", 0,2),
|
||||
N("None"), K(NULL,0,0), K(NULL,0,0), K("space", 7,4),K(0, 0,0),K(NULL,0,0), K("f1", 0,4),K("f3", 0,5),K("f5", 0,6),K("f7", 0,3),K("Del",0,0),K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), D("DONE"),
|
||||
N("None"), K(NULL,0,0), K(NULL,0,0), K("space", 7,4),K(0, 0,0),K(NULL,0,0), K("f1",0,4), K("f3",0,5), K("f5",0,6), K("f7",0,3), K("Del",0,0),K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), D("DONE"),
|
||||
K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(0, 0,0),J("Joystick up",1),K(0, 0,0),K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(NULL, 0,0),K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(NULL, 0,0),
|
||||
J("Joystick left",4),K(0, 0,0), K(NULL,0,0), K(NULL,0,0), K(0,0,0),J("Joystick fire",0x10),K(0,0,0),K(0,0,0), K(NULL,0,0), K(0,0,0),J("Joystick right",8),K(0, 0,0),K(0, 0,0), K(NULL,0,0), K(NULL,0,0),
|
||||
K(NULL,0,0), K(0, 0,0), K(NULL,0,0), K(NULL,0,0), K(0,0,0),J("Joystick down",2),K(0,0,0),K(NULL,0,0),K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(NULL,0,0), K(NULL, 0,0),K(NULL,0,0), K(NULL, 0,0),
|
||||
};
|
||||
|
||||
static const char *shifted_names[KEY_COLS * KEY_ROWS] = {
|
||||
|
Loading…
Reference in New Issue
Block a user