Merge latest TomB version as of 10 July 2016
This commit is contained in:
parent
6a8fc51848
commit
01740246dd
15 changed files with 633 additions and 124 deletions
|
@ -64,9 +64,6 @@ static gcn::Label *lblRight;
|
|||
static gcn::UaeDropDown* cboRight;
|
||||
static gcn::Label *lblKeyForMenu;
|
||||
static gcn::UaeDropDown* KeyForMenu;
|
||||
static gcn::Label *lblKeyForSwitching;
|
||||
static gcn::UaeDropDown* KeyForSwitching;
|
||||
|
||||
|
||||
|
||||
class StringListModel : public gcn::ListModel
|
||||
|
@ -110,6 +107,7 @@ const char *ControlKeyValues[] = { "F11", "F12", "LeftAlt", "LeftCtrl" };
|
|||
StringListModel ControlKeyList(ControlKeyValues, 4);
|
||||
|
||||
const char *mappingValues[] = {
|
||||
"CD32 rwd", "CD32 ffw", "CD32 play", "CD32 yellow", "CD32 green",
|
||||
"Joystick Right", "Joystick Left", "Joystick Down", "Joystick Up",
|
||||
"Joystick fire but.2", "Joystick fire but.1", "Mouse right button", "Mouse left button",
|
||||
"------------------",
|
||||
|
@ -127,31 +125,32 @@ const char *mappingValues[] = {
|
|||
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
|
||||
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "NULL"
|
||||
};
|
||||
StringListModel mappingList(mappingValues, 105);
|
||||
StringListModel mappingList(mappingValues, 110);
|
||||
static int amigaKey[] =
|
||||
{ -8, -7, -6, -5, -4, -3, -2, -1, /* 0 - 7 */
|
||||
0, AK_UP, AK_DN, AK_LF, AK_RT, AK_NP0, AK_NP1, AK_NP2, /* 8 - 15 */
|
||||
AK_NP3, AK_NP4, AK_NP5, AK_NP6, AK_NP7, AK_NP8, AK_NP9, AK_ENT, /* 16 - 23 */
|
||||
AK_NPDIV, AK_NPMUL, AK_NPSUB, AK_NPADD, AK_NPDEL, AK_NPLPAREN, AK_NPRPAREN, AK_SPC, /* 24 - 31 */
|
||||
AK_BS, AK_TAB, AK_RET, AK_ESC, AK_DEL, AK_LSH, AK_RSH, AK_CAPSLOCK, /* 32 - 39 */
|
||||
AK_CTRL, AK_LALT, AK_RALT, AK_LAMI, AK_RAMI, AK_HELP, AK_LBRACKET, AK_RBRACKET, /* 40 - 47 */
|
||||
AK_SEMICOLON, AK_COMMA, AK_PERIOD, AK_SLASH, AK_BACKSLASH, AK_QUOTE, AK_NUMBERSIGN, AK_LTGT, /* 48 - 55 */
|
||||
AK_BACKQUOTE, AK_MINUS, AK_EQUAL, AK_A, AK_B, AK_C, AK_D, AK_E, /* 56 - 63 */
|
||||
AK_F, AK_G, AK_H, AK_I, AK_J, AK_K, AK_L, AK_M, /* 64 - 71 */
|
||||
AK_N, AK_O, AK_P, AK_Q, AK_R, AK_S, AK_T, AK_U, /* 72 - 79 */
|
||||
AK_V, AK_W, AK_X, AK_Y, AK_Z, AK_1, AK_2, AK_3, /* 80 - 87 */
|
||||
AK_4, AK_5, AK_6, AK_7, AK_8, AK_9, AK_0, AK_F1, /* 88 - 95 */
|
||||
AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 96 - 104 */
|
||||
AK_F10, 0 }; /* 105 - 106 */
|
||||
{ REMAP_CD32_RWD, REMAP_CD32_FFW, REMAP_CD32_PLAY, REMAP_CD32_YELLOW, REMAP_CD32_GREEN,
|
||||
REMAP_JOY_RIGHT, REMAP_JOY_LEFT, REMAP_JOY_DOWN, REMAP_JOY_UP, REMAP_JOYBUTTON_TWO, REMAP_JOYBUTTON_ONE, REMAP_MOUSEBUTTON_RIGHT, REMAP_MOUSEBUTTON_LEFT,
|
||||
0, AK_UP, AK_DN, AK_LF, AK_RT, AK_NP0, AK_NP1, AK_NP2, /* 13 - 20 */
|
||||
AK_NP3, AK_NP4, AK_NP5, AK_NP6, AK_NP7, AK_NP8, AK_NP9, AK_ENT, /* 21 - 28 */
|
||||
AK_NPDIV, AK_NPMUL, AK_NPSUB, AK_NPADD, AK_NPDEL, AK_NPLPAREN, AK_NPRPAREN, AK_SPC, /* 29 - 36 */
|
||||
AK_BS, AK_TAB, AK_RET, AK_ESC, AK_DEL, AK_LSH, AK_RSH, AK_CAPSLOCK, /* 37 - 44 */
|
||||
AK_CTRL, AK_LALT, AK_RALT, AK_LAMI, AK_RAMI, AK_HELP, AK_LBRACKET, AK_RBRACKET, /* 45 - 52 */
|
||||
AK_SEMICOLON, AK_COMMA, AK_PERIOD, AK_SLASH, AK_BACKSLASH, AK_QUOTE, AK_NUMBERSIGN, AK_LTGT, /* 53 - 60 */
|
||||
AK_BACKQUOTE, AK_MINUS, AK_EQUAL, AK_A, AK_B, AK_C, AK_D, AK_E, /* 61 - 68 */
|
||||
AK_F, AK_G, AK_H, AK_I, AK_J, AK_K, AK_L, AK_M, /* 69 - 76 */
|
||||
AK_N, AK_O, AK_P, AK_Q, AK_R, AK_S, AK_T, AK_U, /* 77 - 84 */
|
||||
AK_V, AK_W, AK_X, AK_Y, AK_Z, AK_1, AK_2, AK_3, /* 85 - 92 */
|
||||
AK_4, AK_5, AK_6, AK_7, AK_8, AK_9, AK_0, AK_F1, /* 93 - 100 */
|
||||
AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 101 - 108 */
|
||||
AK_F10, 0 }; /* 109 - 110 */
|
||||
extern int customControlMap[SDLK_LAST];
|
||||
|
||||
static int GetAmigaKeyIndex(int key)
|
||||
{
|
||||
for(int i=0; i < 106; ++i) {
|
||||
for(int i=0; i < 110; ++i) {
|
||||
if(amigaKey[i] == key)
|
||||
return i;
|
||||
}
|
||||
return 8; // Default: no key
|
||||
return 13; // Default: no key
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,13 +186,13 @@ class InputActionListener : public gcn::ActionListener
|
|||
else if (actionEvent.getSource() == cboAutofire)
|
||||
{
|
||||
if(cboAutofire->getSelected() == 0)
|
||||
changed_prefs.input_autofire_framecnt = 0;
|
||||
changed_prefs.input_autofire_linecnt = 0;
|
||||
else if(cboAutofire->getSelected() == 1)
|
||||
changed_prefs.input_autofire_framecnt = 12;
|
||||
changed_prefs.input_autofire_linecnt = 12 * 312;
|
||||
else if (cboAutofire->getSelected() == 2)
|
||||
changed_prefs.input_autofire_framecnt = 8;
|
||||
changed_prefs.input_autofire_linecnt = 8 * 312;
|
||||
else
|
||||
changed_prefs.input_autofire_framecnt = 4;
|
||||
changed_prefs.input_autofire_linecnt = 4 * 312;
|
||||
}
|
||||
|
||||
else if (actionEvent.getSource() == sldMouseSpeed)
|
||||
|
@ -253,9 +252,6 @@ class InputActionListener : public gcn::ActionListener
|
|||
else if (actionEvent.getSource() == KeyForMenu)
|
||||
changed_prefs.key_for_menu = ControlKey_SDLKeyValues[KeyForMenu->getSelected()] ;
|
||||
|
||||
else if (actionEvent.getSource() == KeyForSwitching)
|
||||
changed_prefs.key_for_input_switching = ControlKey_SDLKeyValues[KeyForSwitching->getSelected()] ;
|
||||
|
||||
}
|
||||
};
|
||||
static InputActionListener* inputActionListener;
|
||||
|
@ -420,17 +416,6 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
KeyForMenu->setId("CKeyMenu");
|
||||
KeyForMenu->addActionListener(inputActionListener);
|
||||
|
||||
|
||||
lblKeyForSwitching = new gcn::Label("Mouse/joy sw:");
|
||||
lblKeyForSwitching->setSize(100, LABEL_HEIGHT);
|
||||
lblKeyForSwitching->setAlignment(gcn::Graphics::RIGHT);
|
||||
KeyForSwitching = new gcn::UaeDropDown(&ControlKeyList);
|
||||
KeyForSwitching->setSize(150, DROPDOWN_HEIGHT);
|
||||
KeyForSwitching->setBaseColor(gui_baseCol);
|
||||
KeyForSwitching->setId("CKeySwitching");
|
||||
KeyForSwitching->addActionListener(inputActionListener);
|
||||
|
||||
|
||||
int posY = DISTANCE_BORDER;
|
||||
category.panel->add(lblPort0, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboPort0, DISTANCE_BORDER + lblPort0->getWidth() + 8, posY);
|
||||
|
@ -483,10 +468,6 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
category.panel->add(KeyForMenu, DISTANCE_BORDER + lblLeft->getWidth() + 8, posY);
|
||||
posY += KeyForMenu->getHeight() + 4;
|
||||
|
||||
category.panel->add(lblKeyForSwitching, DISTANCE_BORDER, posY);
|
||||
category.panel->add(KeyForSwitching, DISTANCE_BORDER + lblLeft->getWidth() + 8, posY);
|
||||
posY += KeyForSwitching->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
RefreshPanelInput();
|
||||
}
|
||||
|
||||
|
@ -532,9 +513,6 @@ void ExitPanelInput(void)
|
|||
|
||||
delete lblKeyForMenu;
|
||||
delete KeyForMenu;
|
||||
delete lblKeyForSwitching;
|
||||
delete KeyForSwitching;
|
||||
|
||||
|
||||
delete inputActionListener;
|
||||
}
|
||||
|
@ -582,11 +560,11 @@ void RefreshPanelInput(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (changed_prefs.input_autofire_framecnt == 0)
|
||||
if (changed_prefs.input_autofire_linecnt == 0)
|
||||
cboAutofire->setSelected(0);
|
||||
else if (changed_prefs.input_autofire_framecnt == 12)
|
||||
else if (changed_prefs.input_autofire_linecnt > 10 * 312)
|
||||
cboAutofire->setSelected(1);
|
||||
else if (changed_prefs.input_autofire_framecnt == 8)
|
||||
else if (changed_prefs.input_autofire_linecnt > 6 * 312)
|
||||
cboAutofire->setSelected(2);
|
||||
else
|
||||
cboAutofire->setSelected(3);
|
||||
|
@ -630,12 +608,4 @@ void RefreshPanelInput(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
for(i=0; i<4; ++i)
|
||||
{
|
||||
if(changed_prefs.key_for_input_switching == ControlKey_SDLKeyValues[i])
|
||||
{
|
||||
KeyForSwitching->setSelected(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,8 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
|
|||
fscanf(f,"gp2xclock=%d\n", &dummy);
|
||||
int joybuffer = 0;
|
||||
fscanf(f,"joyconf=%d\n",&joybuffer);
|
||||
fscanf(f,"autofireRate=%d\n",&p->input_autofire_framecnt);
|
||||
fscanf(f,"autofireRate=%d\n",&p->input_autofire_linecnt);
|
||||
p->input_autofire_linecnt = p->input_autofire_linecnt * 312;
|
||||
fscanf(f,"autofire=%d\n", &dummy);
|
||||
fscanf(f,"stylusOffset=%d\n",&dummy);
|
||||
fscanf(f,"tapDelay=%d\n",&p->pandora_tapDelay);
|
||||
|
|
249
src/od-pandora/mp3decoder.cpp
Normal file
249
src/od-pandora/mp3decoder.cpp
Normal file
|
@ -0,0 +1,249 @@
|
|||
#include "sysconfig.h"
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include "target.h"
|
||||
#include "zfile.h"
|
||||
#include "mp3decoder.h"
|
||||
#include "cda_play.h"
|
||||
#include <mpg123.h>
|
||||
|
||||
|
||||
#define MP3_BLOCK_SIZE 522
|
||||
#define RAW_BLOCK_SIZE 32768
|
||||
|
||||
static int mp3_bitrates[] = {
|
||||
0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1,
|
||||
0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1,
|
||||
0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1,
|
||||
0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, -1,
|
||||
0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1
|
||||
};
|
||||
static int mp3_frequencies[] = {
|
||||
44100, 48000, 32000, 0,
|
||||
22050, 24000, 16000, 0,
|
||||
11025, 12000, 8000, 0
|
||||
};
|
||||
static int mp3_samplesperframe[] = {
|
||||
384, 384, 384,
|
||||
1152, 1152, 1152,
|
||||
1152, 576, 576
|
||||
};
|
||||
|
||||
mp3decoder::~mp3decoder()
|
||||
{
|
||||
}
|
||||
|
||||
mp3decoder::mp3decoder()
|
||||
{
|
||||
}
|
||||
|
||||
uae_u8 *mp3decoder::get (struct zfile *zf, uae_u8 *outbuf, int maxsize)
|
||||
{
|
||||
int outoffset = 0;
|
||||
unsigned char mp3buf[MP3_BLOCK_SIZE];
|
||||
unsigned char rawbuf[RAW_BLOCK_SIZE];
|
||||
|
||||
write_log(_T("MP3: decoding '%s'..\n"), zfile_getname(zf));
|
||||
|
||||
if(mpg123_init() != MPG123_OK) {
|
||||
write_log("MP3: failed to init mpeg123\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char** decoders = mpg123_decoders();
|
||||
if(decoders == NULL || decoders[0] == NULL) {
|
||||
write_log("MP3: no mp3 decoder available\n");
|
||||
mpg123_exit();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mpg123_handle *mh = mpg123_new(NULL, NULL); // Open default decoder
|
||||
if(mh == NULL) {
|
||||
write_log("MP3: failed to init default decoder\n");
|
||||
mpg123_exit();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(mpg123_open_feed(mh) == MPG123_OK) {
|
||||
zfile_fseek(zf, 0, SEEK_SET);
|
||||
for (; outoffset < maxsize; ) {
|
||||
int count = zfile_fread(mp3buf, 1, MP3_BLOCK_SIZE, zf);
|
||||
if (count != MP3_BLOCK_SIZE)
|
||||
break;
|
||||
|
||||
size_t decoded = 0;
|
||||
int ret = mpg123_decode(mh, mp3buf, MP3_BLOCK_SIZE, rawbuf, RAW_BLOCK_SIZE, &decoded);
|
||||
|
||||
if(ret != MPG123_ERR && decoded != 0) {
|
||||
if(outoffset + decoded > maxsize)
|
||||
decoded = maxsize - outoffset;
|
||||
memcpy(outbuf + outoffset, rawbuf, decoded);
|
||||
outoffset += decoded;
|
||||
}
|
||||
|
||||
while(ret != MPG123_ERR && ret != MPG123_NEED_MORE && outoffset < maxsize) {
|
||||
ret = mpg123_decode(mh, NULL, 0, rawbuf, RAW_BLOCK_SIZE, &decoded);
|
||||
if(ret != MPG123_ERR && decoded != 0) {
|
||||
if(outoffset + decoded > maxsize)
|
||||
decoded = maxsize - outoffset;
|
||||
memcpy(outbuf + outoffset, rawbuf, decoded);
|
||||
outoffset += decoded;
|
||||
}
|
||||
}
|
||||
|
||||
if(ret == MPG123_ERR) {
|
||||
write_log("MP3: error while decoding\n");
|
||||
outbuf = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mpg123_close(mh);
|
||||
}
|
||||
|
||||
mpg123_delete(mh);
|
||||
mpg123_exit();
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
uae_u32 mp3decoder::getsize (struct zfile *zf)
|
||||
{
|
||||
uae_u32 size;
|
||||
int frames, sameframes;
|
||||
int firstframe;
|
||||
int oldbitrate;
|
||||
int timelen = -1;
|
||||
|
||||
firstframe = -1;
|
||||
oldbitrate = -1;
|
||||
sameframes = -1;
|
||||
frames = 0;
|
||||
size = 0;
|
||||
uae_u8 id3[10];
|
||||
|
||||
if (zfile_fread(id3, sizeof id3, 1, zf) != 1)
|
||||
return 0;
|
||||
if (id3[0] == 'I' && id3[1] == 'D' && id3[2] == '3' && id3[3] == 3 && id3[4] != 0xff && id3[6] < 0x80 && id3[7] < 0x80 && id3[8] < 0x80 && id3[9] < 0x80) {
|
||||
int unsync = id3[5] & 0x80;
|
||||
int exthead = id3[5] & 0x40;
|
||||
int len = (id3[9] << 0) | (id3[8] << 7) | (id3[7] << 14) | (id3[6] << 21);
|
||||
len &= 0x0fffffff;
|
||||
uae_u8 *tag = xmalloc (uae_u8, len + 1);
|
||||
if (zfile_fread (tag, len, 1, zf) != 1) {
|
||||
xfree (tag);
|
||||
return 0;
|
||||
}
|
||||
uae_u8 *p = tag;
|
||||
if (exthead) {
|
||||
int size = (p[4] << 21) | (p[5] << 14) | (p[6] << 7);
|
||||
size &= 0x0fffffff;
|
||||
p += size;
|
||||
len -= size;
|
||||
}
|
||||
while (len > 0) {
|
||||
int size = unsync ? (p[4] << 21) | (p[5] << 14) | (p[6] << 7) | (p[7] << 0) : (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | (p[7] << 0);
|
||||
size &= 0x0fffffff;
|
||||
if (size > len)
|
||||
break;
|
||||
int compr = p[9] & 0x80;
|
||||
int enc = p[9] & 0x40;
|
||||
if (compr == 0 && enc == 0) {
|
||||
if (!memcmp (p, "TLEN", 4)) {
|
||||
uae_u8 *data = p + 10;
|
||||
data[size] = 0;
|
||||
if (data[0] == 0)
|
||||
timelen = atol ((char*)(data + 1));
|
||||
else
|
||||
timelen = _tstol ((char*)(data + 1));
|
||||
}
|
||||
}
|
||||
size += 10;
|
||||
p += size;
|
||||
len -= size;
|
||||
}
|
||||
xfree (tag);
|
||||
} else {
|
||||
zfile_fseek(zf, -(int)sizeof id3, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
||||
for (;;) {
|
||||
int ver, layer, bitrate, freq, padding, bitindex, iscrc;
|
||||
int samplerate, framelen, bitrateidx, channelmode;
|
||||
int isstereo;
|
||||
uae_u8 header[4];
|
||||
|
||||
if (zfile_fread(header, sizeof header, 1, zf) != 1)
|
||||
return size;
|
||||
if (header[0] != 0xff || ((header[1] & (0x80 | 0x40 | 0x20)) != (0x80 | 0x40 | 0x20))) {
|
||||
zfile_fseek (zf, -3, SEEK_CUR);
|
||||
continue;
|
||||
}
|
||||
if (firstframe < 0)
|
||||
firstframe = zfile_ftell (zf);
|
||||
|
||||
ver = (header[1] >> 3) & 3;
|
||||
if (ver == 1) {
|
||||
write_log (_T("MP3: ver==1?!\n"));
|
||||
return 0;
|
||||
}
|
||||
if (ver == 0)
|
||||
ver = 2;
|
||||
else if (ver == 2)
|
||||
ver = 1;
|
||||
else if (ver == 3)
|
||||
ver = 0;
|
||||
layer = 4 - ((header[1] >> 1) & 3);
|
||||
if (layer == 4) {
|
||||
write_log (_T("MP3: layer==4?!\n"));
|
||||
return 0;
|
||||
}
|
||||
iscrc = ((header[1] >> 0) & 1) ? 0 : 2;
|
||||
bitrateidx = (header[2] >> 4) & 15;
|
||||
freq = mp3_frequencies[(header[2] >> 2) & 3];
|
||||
if (!freq) {
|
||||
write_log (_T("MP3: reserved frequency?!\n"));
|
||||
return 0;
|
||||
}
|
||||
channelmode = (header[3] >> 6) & 3;
|
||||
isstereo = channelmode != 3;
|
||||
if (ver == 0) {
|
||||
bitindex = layer - 1;
|
||||
} else {
|
||||
if (layer == 1)
|
||||
bitindex = 3;
|
||||
else
|
||||
bitindex = 4;
|
||||
}
|
||||
bitrate = mp3_bitrates[bitindex * 16 + bitrateidx] * 1000;
|
||||
if (bitrate <= 0) {
|
||||
write_log (_T("MP3: reserved bitrate?!\n"));
|
||||
return 0;
|
||||
}
|
||||
padding = (header[2] >> 1) & 1;
|
||||
samplerate = mp3_samplesperframe[(layer - 1) * 3 + ver];
|
||||
framelen = ((samplerate / 8 * bitrate) / freq) + padding;
|
||||
if (framelen <= 4) {
|
||||
write_log (_T("MP3: too small frame size?!\n"));
|
||||
return 0;
|
||||
}
|
||||
zfile_fseek(zf, framelen - 4, SEEK_CUR);
|
||||
frames++;
|
||||
if (timelen > 0) {
|
||||
size = ((uae_u64)timelen * freq * 2 * (isstereo ? 2 : 1)) / 1000;
|
||||
break;
|
||||
}
|
||||
size += samplerate * 2 * (isstereo ? 2 : 1);
|
||||
if (bitrate != oldbitrate) {
|
||||
oldbitrate = bitrate;
|
||||
sameframes++;
|
||||
}
|
||||
if (sameframes == 0 && frames > 100) {
|
||||
// assume this is CBR MP3
|
||||
size = samplerate * 2 * (isstereo ? 2 : 1) * ((zfile_size (zf) - firstframe) / ((samplerate / 8 * bitrate) / freq));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
10
src/od-pandora/mp3decoder.h
Normal file
10
src/od-pandora/mp3decoder.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
class mp3decoder
|
||||
{
|
||||
void *g_mp3stream;
|
||||
public:
|
||||
mp3decoder();
|
||||
~mp3decoder();
|
||||
uae_u8 *get(struct zfile *zf, uae_u8 *, int maxsize);
|
||||
uae_u32 getsize(struct zfile *zf);
|
||||
};
|
|
@ -427,7 +427,7 @@ static void gui_to_prefs (void)
|
|||
static void after_leave_gui(void)
|
||||
{
|
||||
// Check if we have to set or clear autofire
|
||||
int new_af = (changed_prefs.input_autofire_framecnt == 0) ? 0 : 1;
|
||||
int new_af = (changed_prefs.input_autofire_linecnt == 0) ? 0 : 1;
|
||||
int update = 0;
|
||||
int num;
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
static int joyXviaCustom = 0;
|
||||
static int joyYviaCustom = 0;
|
||||
static int joyBut1viaCustom = 0;
|
||||
static int joyBut2viaCustom = 0;
|
||||
static int joyButXviaCustom[7] = { 0, 0, 0, 0, 0, 0, 0};
|
||||
static int mouseBut1viaCustom = 0;
|
||||
static int mouseBut2viaCustom = 0;
|
||||
|
||||
|
@ -371,12 +370,14 @@ static void read_joystick (void)
|
|||
if(!joyYviaCustom)
|
||||
setjoystickstate (0, 1, axis, 32767);
|
||||
}
|
||||
if(!joyBut1viaCustom)
|
||||
if(!joyButXviaCustom[0])
|
||||
setjoybuttonstate (0, 0, keystate[SDLK_PAGEDOWN]);
|
||||
if(!joyBut2viaCustom)
|
||||
if(!joyButXviaCustom[1])
|
||||
setjoybuttonstate (0, 1, keystate[SDLK_END]);
|
||||
setjoybuttonstate (0, 2, keystate[SDLK_HOME]);
|
||||
setjoybuttonstate (0, 3, keystate[SDLK_PAGEUP]);
|
||||
if(!joyButXviaCustom[2])
|
||||
setjoybuttonstate (0, 2, keystate[SDLK_HOME]);
|
||||
if(!joyButXviaCustom[3])
|
||||
setjoybuttonstate (0, 3, keystate[SDLK_PAGEUP]);
|
||||
|
||||
int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
|
||||
if(keystate[SDLK_LALT]) { // Pandora Start button
|
||||
|
@ -387,9 +388,12 @@ static void read_joystick (void)
|
|||
else
|
||||
cd32_start = 1;
|
||||
}
|
||||
setjoybuttonstate (0, 6, cd32_start);
|
||||
setjoybuttonstate (0, 5, cd32_ffw);
|
||||
setjoybuttonstate (0, 4, cd32_rwd);
|
||||
if(!joyButXviaCustom[6])
|
||||
setjoybuttonstate (0, 6, cd32_start);
|
||||
if(!joyButXviaCustom[5])
|
||||
setjoybuttonstate (0, 5, cd32_ffw);
|
||||
if(!joyButXviaCustom[4])
|
||||
setjoybuttonstate (0, 4, cd32_rwd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,46 +445,71 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int num, in
|
|||
void SimulateMouseOrJoy(int code, int keypressed)
|
||||
{
|
||||
switch(code) {
|
||||
case -1: // left mousebutton
|
||||
case REMAP_MOUSEBUTTON_LEFT:
|
||||
mouseBut1viaCustom = keypressed;
|
||||
setmousebuttonstate (0, 0, keypressed);
|
||||
setmousebuttonstate (1, 0, keypressed);
|
||||
break;
|
||||
|
||||
case -2: // right mousebutton
|
||||
case REMAP_MOUSEBUTTON_RIGHT:
|
||||
mouseBut2viaCustom = keypressed;
|
||||
setmousebuttonstate (0, 1, keypressed);
|
||||
setmousebuttonstate (1, 1, keypressed);
|
||||
break;
|
||||
|
||||
case -3: // joystick button 1
|
||||
joyBut1viaCustom = keypressed;
|
||||
case REMAP_JOYBUTTON_ONE:
|
||||
joyButXviaCustom[0] = keypressed;
|
||||
setjoybuttonstate (0, 0, keypressed);
|
||||
break;
|
||||
|
||||
case -4: // joystick button 2
|
||||
joyBut2viaCustom = keypressed;
|
||||
case REMAP_JOYBUTTON_TWO:
|
||||
joyButXviaCustom[1] = keypressed;
|
||||
setjoybuttonstate (0, 1, keypressed);
|
||||
break;
|
||||
|
||||
case -5: // joystick up
|
||||
case REMAP_JOY_UP:
|
||||
joyYviaCustom = keypressed;
|
||||
setjoystickstate (0, 1, keypressed ? -32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -6: // joystick down
|
||||
case REMAP_JOY_DOWN:
|
||||
joyYviaCustom = keypressed;
|
||||
setjoystickstate (0, 1, keypressed ? 32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -7: // joystick left
|
||||
case REMAP_JOY_LEFT:
|
||||
joyXviaCustom = keypressed;
|
||||
setjoystickstate (0, 0, keypressed ? -32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -8: // joystick right
|
||||
case REMAP_JOY_RIGHT:
|
||||
joyXviaCustom = keypressed;
|
||||
setjoystickstate (0, 0, keypressed ? 32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case REMAP_CD32_GREEN:
|
||||
joyButXviaCustom[2] = keypressed;
|
||||
setjoybuttonstate (0, 2, keypressed);
|
||||
break;
|
||||
|
||||
case REMAP_CD32_YELLOW:
|
||||
joyButXviaCustom[3] = keypressed;
|
||||
setjoybuttonstate (0, 3, keypressed);
|
||||
break;
|
||||
|
||||
case REMAP_CD32_PLAY:
|
||||
joyButXviaCustom[6] = keypressed;
|
||||
setjoybuttonstate (0, 6, keypressed);
|
||||
break;
|
||||
|
||||
case REMAP_CD32_FFW:
|
||||
joyButXviaCustom[5] = keypressed;
|
||||
setjoybuttonstate (0, 5, keypressed);
|
||||
break;
|
||||
|
||||
case REMAP_CD32_RWD:
|
||||
joyButXviaCustom[4] = keypressed;
|
||||
setjoybuttonstate (0, 4, keypressed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,20 @@ void keyboard_settrans (void);
|
|||
int translate_pandora_keys(int symbol, int *modifier);
|
||||
void SimulateMouseOrJoy(int code, int keypressed);
|
||||
|
||||
#define REMAP_MOUSEBUTTON_LEFT -1
|
||||
#define REMAP_MOUSEBUTTON_RIGHT -2
|
||||
#define REMAP_JOYBUTTON_ONE -3
|
||||
#define REMAP_JOYBUTTON_TWO -4
|
||||
#define REMAP_JOY_UP -5
|
||||
#define REMAP_JOY_DOWN -6
|
||||
#define REMAP_JOY_LEFT -7
|
||||
#define REMAP_JOY_RIGHT -8
|
||||
#define REMAP_CD32_GREEN -9
|
||||
#define REMAP_CD32_YELLOW -10
|
||||
#define REMAP_CD32_PLAY -11
|
||||
#define REMAP_CD32_FFW -12
|
||||
#define REMAP_CD32_RWD -13
|
||||
|
||||
void reinit_amiga(void);
|
||||
int count_HDs(struct uae_prefs *p);
|
||||
extern void gui_force_rtarea_hdchange(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue