Merge latest TomB version as of 8 July 2016
This commit is contained in:
parent
a33d65dcda
commit
c7db909caf
68 changed files with 15264 additions and 4322 deletions
68
src/od-pandora/cda_play.cpp
Normal file
68
src/od-pandora/cda_play.cpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include "sysconfig.h"
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include "cda_play.h"
|
||||
#include "sd-pandora/sound.h"
|
||||
#include "uae.h"
|
||||
|
||||
|
||||
cda_audio::~cda_audio()
|
||||
{
|
||||
cdaudio_active = false;
|
||||
wait(0);
|
||||
wait(1);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
xfree (buffers[i]);
|
||||
buffers[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
cda_audio::cda_audio(int num_sectors)
|
||||
{
|
||||
active = false;
|
||||
playing = false;
|
||||
volume[0] = volume[1] = 0;
|
||||
|
||||
bufsize = num_sectors * 2352;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
buffers[i] = xcalloc (uae_u8, num_sectors * 4096);
|
||||
}
|
||||
this->num_sectors = num_sectors;
|
||||
active = true;
|
||||
playing = true;
|
||||
cdaudio_active = true;
|
||||
}
|
||||
|
||||
void cda_audio::setvolume(int master, int left, int right)
|
||||
{
|
||||
for (int j = 0; j < 2; j++) {
|
||||
volume[j] = j == 0 ? left : right;
|
||||
volume[j] = (100 - master) * volume[j] / 100;
|
||||
if (volume[j])
|
||||
volume[j]++;
|
||||
if (volume[j] >= 32768)
|
||||
volume[j] = 32768;
|
||||
}
|
||||
}
|
||||
|
||||
bool cda_audio::play(int bufnum)
|
||||
{
|
||||
if (!active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uae_s16 *p = (uae_s16*)(buffers[bufnum]);
|
||||
for (int i = 0; i < num_sectors * 2352 / 4; i++) {
|
||||
PUT_CDAUDIO_WORD_STEREO(p[i * 2 + 0] * volume[0] / 32768, p[i * 2 + 1] * volume[1] / 32768);
|
||||
check_cdaudio_buffers();
|
||||
}
|
||||
|
||||
return cdaudio_catchup();
|
||||
}
|
||||
|
||||
void cda_audio::wait(int bufnum)
|
||||
{
|
||||
if (!active || !playing) {
|
||||
return;
|
||||
}
|
||||
}
|
18
src/od-pandora/cda_play.h
Normal file
18
src/od-pandora/cda_play.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
class cda_audio {
|
||||
private:
|
||||
int bufsize;
|
||||
int volume[2];
|
||||
bool playing;
|
||||
bool active;
|
||||
|
||||
public:
|
||||
uae_u8 *buffers[2];
|
||||
int num_sectors;
|
||||
|
||||
cda_audio(int num_sectors);
|
||||
~cda_audio();
|
||||
void setvolume(int master, int left, int right);
|
||||
bool play(int bufnum);
|
||||
void wait(void);
|
||||
void wait(int bufnum);
|
||||
};
|
|
@ -43,25 +43,9 @@
|
|||
#define RELY_ON_LOADSEG_DETECTION
|
||||
*/
|
||||
|
||||
#undef USE_COMPILER
|
||||
#undef RELY_ON_LOADSEG_DETECTION
|
||||
|
||||
/***************************************************************************
|
||||
* Operating system/machine specific options
|
||||
* Configure these for your CPU. The default settings should work on any
|
||||
* machine, but may not give optimal performance everywhere.
|
||||
* (These don't do very much yet, except HAVE_RDTSC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define this on PPro's, K6's and maybe other non-x86 CPUs.
|
||||
#undef MULTIPLICATION_PROFITABLE
|
||||
*/
|
||||
|
||||
/*
|
||||
* PPros don't like branches. With this option, UAE tries to avoid them in some
|
||||
* places.
|
||||
#undef BRANCHES_ARE_EXPENSIVE
|
||||
*/
|
||||
|
||||
#define MUSIC_VOLUME 80
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* UAE - The Un*x Amiga Emulator
|
||||
*
|
||||
* exec.library multitasking emulation
|
||||
*
|
||||
* Copyright 1996 Bernd Schmidt
|
||||
*/
|
||||
|
||||
struct switch_struct {
|
||||
int dummy;
|
||||
};
|
||||
/* Looks weird. I think I had a report once that some compiler chokes if
|
||||
* the statement is empty. */
|
||||
#define EXEC_SWITCH_TASKS(run, ready) do { int i = 0; i++; } while(0)
|
||||
|
||||
#define EXEC_SETUP_SWS(t) do { int i = 0; i++; } while(0)
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef _GP2X_H
|
||||
#define _GP2X_H
|
||||
|
||||
#define GP2X_BUTTON_Y 0
|
||||
#define GP2X_BUTTON_A 1
|
||||
#define GP2X_BUTTON_X 2
|
||||
#define GP2X_BUTTON_B 3
|
||||
#define GP2X_BUTTON_R 8
|
||||
#define GP2X_BUTTON_L 7
|
||||
#define GP2X_BUTTON_START 5
|
||||
#define GP2X_BUTTON_SELECT 4
|
||||
|
||||
#define GP2X_UP (1<<0)
|
||||
#define GP2X_UP_LEFT (1<<1)
|
||||
#define GP2X_LEFT (1<<2)
|
||||
#define GP2X_DOWN_LEFT (1<<3)
|
||||
#define GP2X_DOWN (1<<4)
|
||||
#define GP2X_DOWN_RIGHT (1<<5)
|
||||
#define GP2X_RIGHT (1<<6)
|
||||
#define GP2X_UP_RIGHT (1<<7)
|
||||
#define GP2X_A (1<<12)
|
||||
#define GP2X_B (1<<13)
|
||||
#define GP2X_X (1<<15)
|
||||
#define GP2X_Y (1<<14)
|
||||
#define GP2X_L (1<<10)
|
||||
#define GP2X_R (1<<11)
|
||||
#define GP2X_SELECT (1<<9)
|
||||
#define GP2X_START (1<<8)
|
||||
#define GP2X_VOL_UP (1<<16)
|
||||
#define GP2X_VOL_DOWN (1<<17)
|
||||
#define GP2X_PUSH (1<<27)
|
||||
|
||||
#endif
|
|
@ -24,24 +24,25 @@ typedef struct
|
|||
|
||||
static NavigationMap navMap[] =
|
||||
{
|
||||
// active move left move right move up move down
|
||||
// active move left move right move up move down
|
||||
// main_window
|
||||
{ "Paths", "SystemROMs", "SystemROMs", "Reset", "Configurations" },
|
||||
{ "Configurations", "ConfigList", "ConfigList", "Paths", "CPU and FPU" },
|
||||
{ "CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset" },
|
||||
{ "Chipset", "Fast copper", "OCS", "CPU and FPU", "ROM" },
|
||||
{ "ROM", "MainROM", "cboMainROM", "Chipset", "RAM" },
|
||||
{ "RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives" },
|
||||
{ "Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives" },
|
||||
{ "Hard drives", "cmdDel0", "cmdProp0", "Floppy drives", "Display" },
|
||||
{ "Display", "sldWidth", "sldWidth", "Hard drives", "Sound" },
|
||||
{ "Sound", "sndDisable", "sndDisable", "Display", "Input" },
|
||||
{ "Input", "cboCtrlConfig", "cboCtrlConfig", "Sound", "Miscellaneous" },
|
||||
{ "Miscellaneous", "StatusLine", "StatusLine", "Input", "Savestates" },
|
||||
{ "Savestates", "State0", "State0", "Miscellaneous", "Reset" },
|
||||
{ "Reset", "Start", "Quit", "Savestates", "Paths" },
|
||||
{ "Quit", "Reset", "Start", "Savestates", "Paths" },
|
||||
{ "Start", "Quit", "Reset", "Savestates", "Paths" },
|
||||
{ "Paths", "SystemROMs", "SystemROMs", "Reset", "Configurations" },
|
||||
{ "Configurations", "ConfigList", "ConfigList", "Paths", "CPU and FPU" },
|
||||
{ "CPU and FPU", "7 Mhz", "68000", "Configurations", "Chipset" },
|
||||
{ "Chipset", "Fast copper", "OCS", "CPU and FPU", "ROM" },
|
||||
{ "ROM", "MainROM", "cboMainROM", "Chipset", "RAM" },
|
||||
{ "RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives" },
|
||||
{ "Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives / CD" },
|
||||
{ "Hard drives / CD", "cmdCreateHDF", "cmdAddDir", "Floppy drives", "Display" },
|
||||
{ "Display", "sldWidth", "sldWidth", "Hard drives / CD", "Sound" },
|
||||
{ "Sound", "sndDisable", "sndDisable", "Display", "Input" },
|
||||
{ "Input", "cboPort0", "cboPort0", "Sound", "Miscellaneous" },
|
||||
{ "Miscellaneous", "StatusLine", "StatusLine", "Input", "Savestates" },
|
||||
{ "Savestates", "State0", "State0", "Miscellaneous", "Reset" },
|
||||
{ "Reset", "Start", "Quit", "Savestates", "Paths" },
|
||||
{ "Quit", "Reset", "Restart", "Savestates", "Paths" },
|
||||
{ "Restart", "Quit", "Start", "Savestates", "Paths" },
|
||||
{ "Start", "Restart", "Reset", "Savestates", "Paths" },
|
||||
|
||||
// PanelPaths
|
||||
{ "SystemROMs", "Paths", "Paths", "RescanROMs", "ConfigPath" },
|
||||
|
@ -130,21 +131,26 @@ static NavigationMap navMap[] =
|
|||
{ "CreateDD", "SaveForDisk", "CreateHD", "DriveSpeed", "cboType0" },
|
||||
{ "CreateHD", "CreateDD", "Floppy drives", "DriveSpeed", "cmdEject0" },
|
||||
|
||||
// active move left move right move up move down
|
||||
// active move left move right move up move down
|
||||
// PanelHD
|
||||
{ "cmdProp0", "Hard drives", "cmdDel0", "cmdAddDir", "cmdProp1" },
|
||||
{ "cmdDel0", "cmdProp0", "Hard drives", "cmdAddHDF", "cmdDel1" },
|
||||
{ "cmdProp1", "Hard drives", "cmdDel1", "cmdProp0", "cmdProp2" },
|
||||
{ "cmdDel1", "cmdProp1", "Hard drives", "cmdDel0", "cmdDel2" },
|
||||
{ "cmdProp2", "Hard drives", "cmdDel2", "cmdProp1", "cmdProp3" },
|
||||
{ "cmdDel2", "cmdProp2", "Hard drives", "cmdDel1", "cmdDel3" },
|
||||
{ "cmdProp3", "Hard drives", "cmdDel3", "cmdProp2", "cmdProp4" },
|
||||
{ "cmdDel3", "cmdProp3", "Hard drives", "cmdDel2", "cmdDel4" },
|
||||
{ "cmdProp4", "Hard drives", "cmdDel4", "cmdProp3", "cmdAddDir" },
|
||||
{ "cmdDel4", "cmdProp4", "Hard drives", "cmdDel3", "cmdAddHDF" },
|
||||
{ "cmdAddDir", "Hard drives", "cmdAddHDF", "cmdProp4", "cmdProp0" },
|
||||
{ "cmdAddHDF", "cmdAddDir", "cmdCreateHDF", "cmdDel4", "cmdDel0" },
|
||||
{ "cmdCreateHDF", "cmdAddHDF", "Hard drives", "cmdDel4", "cmdDel0" },
|
||||
{ "cmdProp0", "Hard drives / CD", "cmdDel0", "CDVol", "cmdProp1" },
|
||||
{ "cmdDel0", "cmdProp0", "Hard drives / CD", "CDVol", "cmdDel1" },
|
||||
{ "cmdProp1", "Hard drives / CD", "cmdDel1", "cmdProp0", "cmdProp2" },
|
||||
{ "cmdDel1", "cmdProp1", "Hard drives / CD", "cmdDel0", "cmdDel2" },
|
||||
{ "cmdProp2", "Hard drives / CD", "cmdDel2", "cmdProp1", "cmdProp3" },
|
||||
{ "cmdDel2", "cmdProp2", "Hard drives / CD", "cmdDel1", "cmdDel3" },
|
||||
{ "cmdProp3", "Hard drives / CD", "cmdDel3", "cmdProp2", "cmdProp4" },
|
||||
{ "cmdDel3", "cmdProp3", "Hard drives / CD", "cmdDel2", "cmdDel4" },
|
||||
{ "cmdProp4", "Hard drives / CD", "cmdDel4", "cmdProp3", "cmdAddDir" },
|
||||
{ "cmdDel4", "cmdProp4", "Hard drives / CD", "cmdDel3", "cmdAddHDF" },
|
||||
{ "cmdAddDir", "Hard drives / CD", "cmdAddHDF", "cmdProp4", "CD drive" },
|
||||
{ "cmdAddHDF", "cmdAddDir", "cmdCreateHDF", "cmdDel4", "CD drive" },
|
||||
{ "cmdCreateHDF", "cmdAddHDF", "Hard drives / CD", "cmdDel4", "CD drive" },
|
||||
{ "CD drive", "Hard drives / CD", "cdEject", "cmdAddDir", "cboCD" },
|
||||
{ "cdEject", "CD drive", "CDSelect", "cmdCreateHDF", "cboCD" },
|
||||
{ "CDSelect", "cdEject", "Hard drives / CD", "cmdCreateHDF", "cboCD" },
|
||||
{ "cboCD", "Hard drives / CD", "Hard drives / CD", "CD drive", "CDVol" },
|
||||
{ "CDVol", "", "", "cboCD", "cmdProp0" },
|
||||
|
||||
#ifndef RASPBERRY
|
||||
// PanelDisplay
|
||||
|
@ -175,45 +181,25 @@ static NavigationMap navMap[] =
|
|||
{ "sldSeparation", "", "", "cboFilter", "sldStereoDelay" },
|
||||
{ "sldStereoDelay", "", "", "sldSeparation", "sndDisable" },
|
||||
|
||||
#ifndef RASPBERRY
|
||||
// active move left move right move up move down
|
||||
// PanelInput
|
||||
{ "cboCtrlConfig", "Input", "Input", "cboLeft", "cboJoystick" },
|
||||
{ "cboJoystick", "Input", "cboAutofire", "cboCtrlConfig", "cboTapDelay" },
|
||||
{ "cboAutofire", "cboJoystick", "Input", "cboCtrlConfig", "cboTapDelay" },
|
||||
{ "cboTapDelay", "Input", "Input", "cboJoystick", "MouseSpeed" },
|
||||
{ "MouseSpeed", "", "", "cboTapDelay", "cboDPAD" },
|
||||
{ "MouseHack", "MouseSpeed", "Input", "cboTapDelay", "CustomCtrl" },
|
||||
{ "cboDPAD", "Input", "CustomCtrl", "MouseSpeed", "cboA" },
|
||||
{ "CustomCtrl", "cboDPAD", "Input", "MouseHack", "cboB" },
|
||||
{ "cboA", "Input", "cboB", "cboDPAD", "cboX" },
|
||||
{ "cboB", "cboA", "Input", "CustomCtrl", "cboY" },
|
||||
{ "cboPort0", "Input", "Input", "cboLeft", "cboPort1" },
|
||||
{ "cboPort1", "Input", "cboAutofire", "cboPort0", "MouseSpeed" },
|
||||
{ "cboAutofire", "cboPort1", "Input", "cboPort0", "cboTapDelay" },
|
||||
{ "MouseSpeed", "", "", "cboPort1", "MouseHack" },
|
||||
{ "MouseHack", "Input", "cboTapDelay", "MouseSpeed", "CustomCtrl" },
|
||||
{ "cboTapDelay", "MouseHack", "Input", "cboAutofire", "cboB" },
|
||||
{ "CustomCtrl", "Input", "Input", "MouseHack", "cboA" },
|
||||
{ "cboA", "Input", "cboB", "CustomCtrl", "cboX" },
|
||||
{ "cboB", "cboA", "Input", "cboTapDelay", "cboY" },
|
||||
{ "cboX", "Input", "cboY", "cboA", "cboL" },
|
||||
{ "cboY", "cboX", "Input", "cboB", "cboR" },
|
||||
{ "cboL", "Input", "cboR", "cboX", "cboUp" },
|
||||
{ "cboR", "cboL", "Input", "cboY", "cboDown" },
|
||||
{ "cboUp", "Input", "cboDown", "cboL", "cboLeft" },
|
||||
{ "cboDown", "cboUp", "Input", "cboR", "cboRight" },
|
||||
{ "cboLeft", "Input", "cboRight", "cboUp", "cboCtrlConfig" },
|
||||
{ "cboRight", "cboLeft", "Input", "cboDown", "cboCtrlConfig" },
|
||||
#else
|
||||
// PanelInput
|
||||
{ "cboCtrlConfig", "Input", "Input", "cboLeft", "cboJoystick" },
|
||||
{ "cboJoystick", "Input", "cboAutofire", "cboCtrlConfig", "MouseSpeed" },
|
||||
{ "cboAutofire", "cboJoystick", "Input", "cboCtrlConfig", "MouseSpeed" },
|
||||
{ "MouseSpeed", "", "", "cboJoystick", "cboDPAD" },
|
||||
{ "cboDPAD", "Input", "CustomCtrl", "MouseSpeed", "cboA" },
|
||||
{ "CustomCtrl", "cboDPAD", "Input", "MouseSpeed", "cboB" },
|
||||
{ "cboA", "Input", "cboB", "cboDPAD", "cboX" },
|
||||
{ "cboB", "cboA", "Input", "CustomCtrl", "cboY" },
|
||||
{ "cboX", "Input", "cboY", "cboA", "cboL" },
|
||||
{ "cboY", "cboX", "Input", "cboB", "cboR" },
|
||||
{ "cboL", "Input", "cboR", "cboX", "cboUp" },
|
||||
{ "cboR", "cboL", "Input", "cboY", "cboDown" },
|
||||
{ "cboUp", "Input", "cboDown", "cboL", "cboLeft" },
|
||||
{ "cboDown", "cboUp", "Input", "cboR", "cboRight" },
|
||||
{ "cboLeft", "Input", "cboRight", "cboUp", "cboCtrlConfig" },
|
||||
{ "cboRight", "cboLeft", "Input", "cboDown", "cboCtrlConfig" },
|
||||
#endif
|
||||
{ "cboLeft", "Input", "cboRight", "cboUp", "cboPort0" },
|
||||
{ "cboRight", "cboLeft", "Input", "cboDown", "cboPort0" },
|
||||
|
||||
// PanelMisc
|
||||
{ "StatusLine", "Miscellaneous", "Miscellaneous", "BSDSocket", "HideIdle" },
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "uae.h"
|
||||
#include "blkdev.h"
|
||||
#include "gui.h"
|
||||
#include "target.h"
|
||||
#include "gui_handling.h"
|
||||
|
@ -47,6 +48,27 @@ bool LoadConfigByName(const char *name)
|
|||
return false;
|
||||
}
|
||||
|
||||
void load_buildin_config(int id)
|
||||
{
|
||||
if(changed_prefs.cdslots[0].inuse)
|
||||
gui_force_rtarea_hdchange();
|
||||
discard_prefs(&changed_prefs, 0);
|
||||
default_prefs(&changed_prefs, 0);
|
||||
switch(id) {
|
||||
case BUILDINID_A500:
|
||||
bip_a500(&changed_prefs, -1);
|
||||
break;
|
||||
|
||||
case BUILDINID_A1200:
|
||||
bip_a1200(&changed_prefs, -1);
|
||||
break;
|
||||
|
||||
case BUILDINID_CD32:
|
||||
bip_cd32(&changed_prefs, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetLastActiveConfig(const char *filename)
|
||||
{
|
||||
extractFileName(filename, last_active_config);
|
||||
|
@ -107,7 +129,12 @@ class ConfigButtonActionListener : public gcn::ActionListener
|
|||
// Load selected configuration
|
||||
//-----------------------------------------------
|
||||
i = lstConfigs->getSelected();
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0);
|
||||
if(ConfigFilesList[i]->BuildInID != BUILDINID_NONE) {
|
||||
load_buildin_config(ConfigFilesList[i]->BuildInID);
|
||||
strcpy(changed_prefs.description, ConfigFilesList[i]->Description);
|
||||
} else {
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0);
|
||||
}
|
||||
strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
|
@ -141,7 +168,7 @@ class ConfigButtonActionListener : public gcn::ActionListener
|
|||
//-----------------------------------------------
|
||||
char msg[256];
|
||||
i = lstConfigs->getSelected();
|
||||
if(i >= 0 && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME))
|
||||
if(i >= 0 && ConfigFilesList[i]->BuildInID == BUILDINID_NONE && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME))
|
||||
{
|
||||
snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name);
|
||||
if(ShowMessage("Delete Configuration", msg, "", "Yes", "No"))
|
||||
|
@ -176,7 +203,12 @@ class ConfigsListActionListener : public gcn::ActionListener
|
|||
//-----------------------------------------------
|
||||
// Selected same config again -> load and start it
|
||||
//-----------------------------------------------
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
|
||||
if(ConfigFilesList[selected_item]->BuildInID != BUILDINID_NONE) {
|
||||
load_buildin_config(ConfigFilesList[selected_item]->BuildInID);
|
||||
strcpy(changed_prefs.description, ConfigFilesList[selected_item]->Description);
|
||||
} else {
|
||||
target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
|
||||
}
|
||||
strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH);
|
||||
DisableResume();
|
||||
RefreshAllPanels();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "uae.h"
|
||||
#include "autoconf.h"
|
||||
#include "filesys.h"
|
||||
#include "blkdev.h"
|
||||
#include "gui.h"
|
||||
#include "target.h"
|
||||
#include "gui_handling.h"
|
||||
|
@ -33,6 +34,9 @@ static const int COLUMN_SIZE[] = {
|
|||
50 // Bootpri
|
||||
};
|
||||
|
||||
static const char *cdfile_filter[] = { ".cue", ".ccd", ".iso", "\0" };
|
||||
static void AdjustDropDownControls(void);
|
||||
|
||||
static gcn::Label* lblList[COL_COUNT];
|
||||
static gcn::Container* listEntry[MAX_HD_DEVICES];
|
||||
static gcn::TextField* listCells[MAX_HD_DEVICES][COL_COUNT];
|
||||
|
@ -41,7 +45,14 @@ static gcn::ImageButton* listCmdDelete[MAX_HD_DEVICES];
|
|||
static gcn::Button* cmdAddDirectory;
|
||||
static gcn::Button* cmdAddHardfile;
|
||||
static gcn::Button* cmdCreateHardfile;
|
||||
|
||||
static gcn::UaeCheckBox* chkCD;
|
||||
static gcn::UaeDropDown* cboCDFile;
|
||||
static gcn::Button* cmdCDEject;
|
||||
static gcn::Button* cmdCDSelect;
|
||||
static gcn::Label* lblCDVol;
|
||||
static gcn::Label* lblCDVolInfo;
|
||||
static gcn::Slider* sldCDVol;
|
||||
|
||||
|
||||
static int GetHDType(int index)
|
||||
{
|
||||
|
@ -58,6 +69,28 @@ static int GetHDType(int index)
|
|||
}
|
||||
|
||||
|
||||
class CDfileListModel : public gcn::ListModel
|
||||
{
|
||||
public:
|
||||
CDfileListModel()
|
||||
{
|
||||
}
|
||||
|
||||
int getNumberOfElements()
|
||||
{
|
||||
return lstMRUCDList.size();
|
||||
}
|
||||
|
||||
std::string getElementAt(int i)
|
||||
{
|
||||
if(i < 0 || i >= lstMRUCDList.size())
|
||||
return "---";
|
||||
return lstMRUCDList[i];
|
||||
}
|
||||
};
|
||||
static CDfileListModel cdfileList;
|
||||
|
||||
|
||||
class HDRemoveActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
|
@ -150,6 +183,125 @@ class CreateHardfileActionListener : public gcn::ActionListener
|
|||
CreateHardfileActionListener* createHardfileActionListener;
|
||||
|
||||
|
||||
class CDCheckActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
if(changed_prefs.cdslots[0].inuse) {
|
||||
changed_prefs.cdslots[0].inuse = false;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_DISABLED;
|
||||
} else {
|
||||
changed_prefs.cdslots[0].inuse = true;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
|
||||
}
|
||||
RefreshPanelHD();
|
||||
}
|
||||
};
|
||||
CDCheckActionListener* cdCheckActionListener;
|
||||
|
||||
|
||||
class CDButtonActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
if (actionEvent.getSource() == cmdCDEject)
|
||||
{
|
||||
//---------------------------------------
|
||||
// Eject CD from drive
|
||||
//---------------------------------------
|
||||
strcpy(changed_prefs.cdslots[0].name, "");
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else if(actionEvent.getSource() == cmdCDSelect)
|
||||
{
|
||||
char tmp[MAX_DPATH];
|
||||
|
||||
if(strlen(changed_prefs.cdslots[0].name) > 0)
|
||||
strncpy(tmp, changed_prefs.cdslots[0].name, MAX_DPATH);
|
||||
else
|
||||
strncpy(tmp, currentDir, MAX_DPATH);
|
||||
|
||||
if(SelectFile("Select CD image file", tmp, cdfile_filter))
|
||||
{
|
||||
if(strncmp(changed_prefs.cdslots[0].name, tmp, MAX_DPATH))
|
||||
{
|
||||
strncpy(changed_prefs.cdslots[0].name, tmp, sizeof(changed_prefs.cdslots[0].name));
|
||||
changed_prefs.cdslots[0].inuse = true;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
|
||||
AddFileToCDList(tmp, 1);
|
||||
extractPath(tmp, currentDir);
|
||||
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
}
|
||||
cmdCDSelect->requestFocus();
|
||||
}
|
||||
RefreshPanelHD();
|
||||
}
|
||||
};
|
||||
CDButtonActionListener* cdButtonActionListener;
|
||||
|
||||
|
||||
class GenericActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
if (actionEvent.getSource() == sldCDVol)
|
||||
{
|
||||
int newvol = 100 - (int) sldCDVol->getValue();
|
||||
if(changed_prefs.sound_volume_cd != newvol)
|
||||
{
|
||||
changed_prefs.sound_volume_cd = newvol;
|
||||
RefreshPanelHD();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
GenericActionListener* genericActionListener;
|
||||
|
||||
|
||||
static bool bIgnoreListChange = false;
|
||||
class CDFileActionListener : public gcn::ActionListener
|
||||
{
|
||||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
//---------------------------------------
|
||||
// CD image from list selected
|
||||
//---------------------------------------
|
||||
if(!bIgnoreListChange)
|
||||
{
|
||||
int idx = cboCDFile->getSelected();
|
||||
|
||||
if(idx < 0)
|
||||
{
|
||||
strcpy(changed_prefs.cdslots[0].name, "");
|
||||
AdjustDropDownControls();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cdfileList.getElementAt(idx).compare(changed_prefs.cdslots[0].name))
|
||||
{
|
||||
strncpy(changed_prefs.cdslots[0].name, cdfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.cdslots[0].name));
|
||||
changed_prefs.cdslots[0].inuse = true;
|
||||
changed_prefs.cdslots[0].type = SCSI_UNIT_IMAGE;
|
||||
lstMRUCDList.erase(lstMRUCDList.begin() + idx);
|
||||
lstMRUCDList.insert(lstMRUCDList.begin(), changed_prefs.cdslots[0].name);
|
||||
bIgnoreListChange = true;
|
||||
cboCDFile->setSelected(0);
|
||||
bIgnoreListChange = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
RefreshPanelHD();
|
||||
}
|
||||
};
|
||||
static CDFileActionListener* cdFileActionListener;
|
||||
|
||||
|
||||
void InitPanelHD(const struct _ConfigCategory& category)
|
||||
{
|
||||
int row, col;
|
||||
|
@ -214,6 +366,44 @@ void InitPanelHD(const struct _ConfigCategory& category)
|
|||
cmdCreateHardfile->setId("cmdCreateHDF");
|
||||
cmdCreateHardfile->addActionListener(createHardfileActionListener);
|
||||
|
||||
cdCheckActionListener = new CDCheckActionListener();
|
||||
cdButtonActionListener = new CDButtonActionListener();
|
||||
cdFileActionListener = new CDFileActionListener();
|
||||
genericActionListener = new GenericActionListener();
|
||||
|
||||
chkCD = new gcn::UaeCheckBox("CD drive");
|
||||
chkCD->addActionListener(cdCheckActionListener);
|
||||
|
||||
cmdCDEject = new gcn::Button("Eject");
|
||||
cmdCDEject->setSize(SMALL_BUTTON_WIDTH * 2, SMALL_BUTTON_HEIGHT);
|
||||
cmdCDEject->setBaseColor(gui_baseCol);
|
||||
cmdCDEject->setId("cdEject");
|
||||
cmdCDEject->addActionListener(cdButtonActionListener);
|
||||
|
||||
cmdCDSelect = new gcn::Button("...");
|
||||
cmdCDSelect->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT);
|
||||
cmdCDSelect->setBaseColor(gui_baseCol);
|
||||
cmdCDSelect->setId("CDSelect");
|
||||
cmdCDSelect->addActionListener(cdButtonActionListener);
|
||||
|
||||
cboCDFile = new gcn::UaeDropDown(&cdfileList);
|
||||
cboCDFile->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, DROPDOWN_HEIGHT);
|
||||
cboCDFile->setBaseColor(gui_baseCol);
|
||||
cboCDFile->setId("cboCD");
|
||||
cboCDFile->addActionListener(cdFileActionListener);
|
||||
|
||||
lblCDVol = new gcn::Label("CD Volume:");
|
||||
lblCDVol->setSize(80, LABEL_HEIGHT);
|
||||
lblCDVol->setAlignment(gcn::Graphics::RIGHT);
|
||||
sldCDVol = new gcn::Slider(0, 100);
|
||||
sldCDVol->setSize(200, SLIDER_HEIGHT);
|
||||
sldCDVol->setBaseColor(gui_baseCol);
|
||||
sldCDVol->setMarkerLength(20);
|
||||
sldCDVol->setStepLength(10);
|
||||
sldCDVol->setId("CDVol");
|
||||
sldCDVol->addActionListener(genericActionListener);
|
||||
lblCDVolInfo = new gcn::Label("80 %");
|
||||
|
||||
posX = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34;
|
||||
for(col=0; col<COL_COUNT; ++col)
|
||||
{
|
||||
|
@ -238,10 +428,23 @@ void InitPanelHD(const struct _ConfigCategory& category)
|
|||
posY += listEntry[row]->getHeight() + 4;
|
||||
}
|
||||
|
||||
posY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT;
|
||||
posY += DISTANCE_NEXT_Y;
|
||||
category.panel->add(cmdAddDirectory, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cmdAddHardfile, DISTANCE_BORDER + cmdAddDirectory->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
category.panel->add(cmdCreateHardfile, cmdAddHardfile->getX() + cmdAddHardfile->getWidth() + DISTANCE_NEXT_X, posY);
|
||||
|
||||
posY += cmdAddDirectory->getHeight() + 2 * DISTANCE_NEXT_Y;
|
||||
category.panel->add(chkCD, DISTANCE_BORDER, posY + 2);
|
||||
category.panel->add(cmdCDEject, category.panel->getWidth() - cmdCDEject->getWidth() - DISTANCE_NEXT_X - cmdCDSelect->getWidth() - DISTANCE_BORDER, posY);
|
||||
category.panel->add(cmdCDSelect, category.panel->getWidth() - cmdCDSelect->getWidth() - DISTANCE_BORDER, posY);
|
||||
posY += cmdCDSelect->getHeight() + DISTANCE_NEXT_Y;
|
||||
category.panel->add(cboCDFile, DISTANCE_BORDER, posY);
|
||||
posY += cboCDFile->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
category.panel->add(lblCDVol, DISTANCE_BORDER, posY);
|
||||
category.panel->add(sldCDVol, DISTANCE_BORDER + lblCDVol->getWidth() + 8, posY);
|
||||
category.panel->add(lblCDVolInfo, sldCDVol->getX() + sldCDVol->getWidth() + 12, posY);
|
||||
posY += sldCDVol->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
RefreshPanelHD();
|
||||
}
|
||||
|
@ -267,6 +470,19 @@ void ExitPanelHD(void)
|
|||
delete cmdAddHardfile;
|
||||
delete cmdCreateHardfile;
|
||||
|
||||
delete chkCD;
|
||||
delete cmdCDEject;
|
||||
delete cmdCDSelect;
|
||||
delete cboCDFile;
|
||||
delete lblCDVol;
|
||||
delete lblCDVolInfo;
|
||||
delete sldCDVol;
|
||||
|
||||
delete cdCheckActionListener;
|
||||
delete cdButtonActionListener;
|
||||
delete cdFileActionListener;
|
||||
delete genericActionListener;
|
||||
|
||||
delete hdRemoveActionListener;
|
||||
delete hdEditActionListener;
|
||||
delete addVirtualHDActionListener;
|
||||
|
@ -275,6 +491,24 @@ void ExitPanelHD(void)
|
|||
}
|
||||
|
||||
|
||||
static void AdjustDropDownControls(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
cboCDFile->clearSelected();
|
||||
if((changed_prefs.cdslots[0].inuse) && strlen(changed_prefs.cdslots[0].name) > 0)
|
||||
{
|
||||
for(i = 0; i < lstMRUCDList.size(); ++i)
|
||||
{
|
||||
if(!lstMRUCDList[i].compare(changed_prefs.cdslots[0].name))
|
||||
{
|
||||
cboCDFile->setSelected(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshPanelHD(void)
|
||||
{
|
||||
int row, col;
|
||||
|
@ -283,6 +517,8 @@ void RefreshPanelHD(void)
|
|||
struct uaedev_config_info *uci;
|
||||
int nosize = 0, type;
|
||||
|
||||
AdjustDropDownControls();
|
||||
|
||||
for(row=0; row<MAX_HD_DEVICES; ++row)
|
||||
{
|
||||
uci = &changed_prefs.mountconfig[row];
|
||||
|
@ -336,6 +572,16 @@ void RefreshPanelHD(void)
|
|||
listCmdDelete[row]->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
chkCD->setSelected(changed_prefs.cdslots[0].inuse);
|
||||
cmdCDEject->setEnabled(changed_prefs.cdslots[0].inuse);
|
||||
cmdCDSelect->setEnabled(changed_prefs.cdslots[0].inuse);
|
||||
cboCDFile->setEnabled(changed_prefs.cdslots[0].inuse);
|
||||
sldCDVol->setEnabled(changed_prefs.cdslots[0].inuse);
|
||||
|
||||
sldCDVol->setValue(100 - changed_prefs.sound_volume_cd);
|
||||
snprintf(tmp, 32, "%d %%", 100 - changed_prefs.sound_volume_cd);
|
||||
lblCDVolInfo->setCaption(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,15 +18,18 @@
|
|||
#include "gui.h"
|
||||
#include "target.h"
|
||||
#include "gui_handling.h"
|
||||
#include "keyboard.h"
|
||||
#include "inputdevice.h"
|
||||
|
||||
|
||||
static const char *mousespeed_list[] = { ".25", ".5", "1x", "2x", "4x" };
|
||||
static const int mousespeed_values[] = { 2, 5, 10, 20, 40 };
|
||||
|
||||
static gcn::Label *lblCtrlConfig;
|
||||
static gcn::UaeDropDown* cboCtrlConfig;
|
||||
static gcn::Label *lblJoystick;
|
||||
static gcn::UaeDropDown* cboJoystick;
|
||||
static gcn::Label *lblPort0;
|
||||
static gcn::UaeDropDown* cboPort0;
|
||||
static gcn::Label *lblPort1;
|
||||
static gcn::UaeDropDown* cboPort1;
|
||||
|
||||
static gcn::Label *lblAutofire;
|
||||
static gcn::UaeDropDown* cboAutofire;
|
||||
static gcn::Label* lblMouseSpeed;
|
||||
|
@ -39,8 +42,6 @@ static gcn::UaeCheckBox* chkMouseHack;
|
|||
#endif
|
||||
|
||||
static gcn::UaeCheckBox* chkCustomCtrl;
|
||||
static gcn::Label *lblDPAD;
|
||||
static gcn::UaeDropDown* cboDPAD;
|
||||
static gcn::Label *lblA;
|
||||
static gcn::UaeDropDown* cboA;
|
||||
static gcn::Label *lblB;
|
||||
|
@ -92,28 +93,16 @@ class StringListModel : public gcn::ListModel
|
|||
}
|
||||
};
|
||||
|
||||
const char *ctrlConfigValues[] = {
|
||||
"A=Autofire, X=Fire, Y=Space, B=2nd",
|
||||
"A=Fire, X=Autofire, Y=Space, B=2nd",
|
||||
"A=Autofire, X=Jump, Y=Fire, B=2nd",
|
||||
"A=Fire, X=Jump, Y=Autofire, B=2nd"
|
||||
};
|
||||
StringListModel ctrlConfigList(ctrlConfigValues, 4);
|
||||
static const char *inputport_list[] = { "Nubs as mouse", "dPad as mouse", "dPad as joystick", "dPad as CD32 contr.", "none" };
|
||||
StringListModel ctrlPortList(inputport_list, 5);
|
||||
|
||||
const char *joystickValues[] = { "Port0", "Port1", "Both" };
|
||||
StringListModel joystickList(joystickValues, 3);
|
||||
const char *autofireValues[] = { "Off", "Slow", "Medium", "Fast" };
|
||||
StringListModel autofireList(autofireValues, 4);
|
||||
|
||||
const char *autofireValues[] = { "Light", "Medium", "Heavy" };
|
||||
StringListModel autofireList(autofireValues, 3);
|
||||
#ifndef RASPBERRY
|
||||
const char *tapDelayValues[] = { "Normal", "Short", "None" };
|
||||
StringListModel tapDelayList(tapDelayValues, 3);
|
||||
const char *dPADValues[] = { "Joystick", "Mouse", "Custom" };
|
||||
#else
|
||||
const char *dPADValues[] = { "Joystick", "Keyboard", "Custom" };
|
||||
#endif
|
||||
StringListModel dPADList(dPADValues, 3);
|
||||
|
||||
|
||||
static const int ControlKey_SDLKeyValues[] = { SDLK_F11 , SDLK_F12, SDLK_LALT , SDLK_LCTRL };
|
||||
|
||||
|
@ -139,6 +128,31 @@ const char *mappingValues[] = {
|
|||
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "NULL"
|
||||
};
|
||||
StringListModel mappingList(mappingValues, 105);
|
||||
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 */
|
||||
extern int customControlMap[SDLK_LAST];
|
||||
|
||||
static int GetAmigaKeyIndex(int key)
|
||||
{
|
||||
for(int i=0; i < 106; ++i) {
|
||||
if(amigaKey[i] == key)
|
||||
return i;
|
||||
}
|
||||
return 8; // Default: no key
|
||||
}
|
||||
|
||||
|
||||
class InputActionListener : public gcn::ActionListener
|
||||
|
@ -146,17 +160,37 @@ class InputActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
if (actionEvent.getSource() == cboCtrlConfig)
|
||||
changed_prefs.pandora_joyConf = cboCtrlConfig->getSelected();
|
||||
|
||||
else if (actionEvent.getSource() == cboJoystick)
|
||||
changed_prefs.pandora_joyPort = (cboJoystick->getSelected() + 1) % 3;
|
||||
if (actionEvent.getSource() == cboPort0) {
|
||||
// Handle new device in port 0
|
||||
switch(cboPort0->getSelected()) {
|
||||
case 0: changed_prefs.jports[0].id = JSEM_MICE; changed_prefs.jports[0].mode = JSEM_MODE_MOUSE; break;
|
||||
case 1: changed_prefs.jports[0].id = JSEM_MICE + 1; changed_prefs.jports[0].mode = JSEM_MODE_MOUSE; break;
|
||||
case 2: changed_prefs.jports[0].id = JSEM_JOYS; changed_prefs.jports[0].mode = JSEM_MODE_JOYSTICK; break;
|
||||
case 3: changed_prefs.jports[0].id = JSEM_JOYS; changed_prefs.jports[0].mode = JSEM_MODE_JOYSTICK_CD32; break;
|
||||
case 4: changed_prefs.jports[0].id = -1; changed_prefs.jports[0].mode = JSEM_MODE_DEFAULT; break;
|
||||
}
|
||||
inputdevice_updateconfig(&changed_prefs);
|
||||
}
|
||||
|
||||
else if (actionEvent.getSource() == cboPort1) {
|
||||
// Handle new device in port 1
|
||||
switch(cboPort1->getSelected()) {
|
||||
case 0: changed_prefs.jports[1].id = JSEM_MICE; changed_prefs.jports[1].mode = JSEM_MODE_MOUSE; break;
|
||||
case 1: changed_prefs.jports[1].id = JSEM_MICE + 1; changed_prefs.jports[1].mode = JSEM_MODE_MOUSE; break;
|
||||
case 2: changed_prefs.jports[1].id = JSEM_JOYS; changed_prefs.jports[1].mode = JSEM_MODE_JOYSTICK; break;
|
||||
case 3: changed_prefs.jports[1].id = JSEM_JOYS; changed_prefs.jports[1].mode = JSEM_MODE_JOYSTICK_CD32; break;
|
||||
case 4: changed_prefs.jports[1].id = -1; changed_prefs.jports[1].mode = JSEM_MODE_DEFAULT; break;
|
||||
}
|
||||
inputdevice_updateconfig(&changed_prefs);
|
||||
}
|
||||
|
||||
else if (actionEvent.getSource() == cboAutofire)
|
||||
{
|
||||
if(cboAutofire->getSelected() == 0)
|
||||
changed_prefs.input_autofire_framecnt = 0;
|
||||
else if(cboAutofire->getSelected() == 1)
|
||||
changed_prefs.input_autofire_framecnt = 12;
|
||||
else if (cboAutofire->getSelected() == 1)
|
||||
else if (cboAutofire->getSelected() == 2)
|
||||
changed_prefs.input_autofire_framecnt = 8;
|
||||
else
|
||||
changed_prefs.input_autofire_framecnt = 4;
|
||||
|
@ -186,38 +220,35 @@ class InputActionListener : public gcn::ActionListener
|
|||
else if (actionEvent.getSource() == chkCustomCtrl)
|
||||
changed_prefs.pandora_customControls = chkCustomCtrl->isSelected() ? 1 : 0;
|
||||
|
||||
else if (actionEvent.getSource() == cboDPAD)
|
||||
changed_prefs.pandora_custom_dpad = cboDPAD->getSelected();
|
||||
|
||||
else if (actionEvent.getSource() == cboA)
|
||||
changed_prefs.pandora_custom_A = cboA->getSelected() - 8;
|
||||
customControlMap[SDLK_HOME] = amigaKey[cboA->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboB)
|
||||
changed_prefs.pandora_custom_B = cboB->getSelected() - 8;
|
||||
customControlMap[SDLK_END] = amigaKey[cboB->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboX)
|
||||
changed_prefs.pandora_custom_X = cboX->getSelected() - 8;
|
||||
customControlMap[SDLK_PAGEDOWN] = amigaKey[cboX->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboY)
|
||||
changed_prefs.pandora_custom_Y = cboY->getSelected() - 8;
|
||||
customControlMap[SDLK_PAGEUP] = amigaKey[cboY->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboL)
|
||||
changed_prefs.pandora_custom_L = cboL->getSelected() - 8;
|
||||
customControlMap[SDLK_RSHIFT] = amigaKey[cboL->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboR)
|
||||
changed_prefs.pandora_custom_R = cboR->getSelected() - 8;
|
||||
customControlMap[SDLK_RCTRL] = amigaKey[cboR->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboUp)
|
||||
changed_prefs.pandora_custom_up = cboUp->getSelected() - 8;
|
||||
customControlMap[SDLK_UP] = amigaKey[cboUp->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboDown)
|
||||
changed_prefs.pandora_custom_down = cboDown->getSelected() - 8;
|
||||
customControlMap[SDLK_DOWN] = amigaKey[cboDown->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboLeft)
|
||||
changed_prefs.pandora_custom_left = cboLeft->getSelected() - 8;
|
||||
customControlMap[SDLK_LEFT] = amigaKey[cboLeft->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == cboRight)
|
||||
changed_prefs.pandora_custom_right = cboRight->getSelected() - 8;
|
||||
customControlMap[SDLK_RIGHT] = amigaKey[cboRight->getSelected()];
|
||||
|
||||
else if (actionEvent.getSource() == KeyForMenu)
|
||||
changed_prefs.key_for_menu = ControlKey_SDLKeyValues[KeyForMenu->getSelected()] ;
|
||||
|
@ -234,23 +265,23 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
{
|
||||
inputActionListener = new InputActionListener();
|
||||
|
||||
lblCtrlConfig = new gcn::Label("Control Config:");
|
||||
lblCtrlConfig->setSize(100, LABEL_HEIGHT);
|
||||
lblCtrlConfig->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboCtrlConfig = new gcn::UaeDropDown(&ctrlConfigList);
|
||||
cboCtrlConfig->setSize(280, DROPDOWN_HEIGHT);
|
||||
cboCtrlConfig->setBaseColor(gui_baseCol);
|
||||
cboCtrlConfig->setId("cboCtrlConfig");
|
||||
cboCtrlConfig->addActionListener(inputActionListener);
|
||||
lblPort0 = new gcn::Label("Port0:");
|
||||
lblPort0->setSize(100, LABEL_HEIGHT);
|
||||
lblPort0->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboPort0 = new gcn::UaeDropDown(&ctrlPortList);
|
||||
cboPort0->setSize(160, DROPDOWN_HEIGHT);
|
||||
cboPort0->setBaseColor(gui_baseCol);
|
||||
cboPort0->setId("cboPort0");
|
||||
cboPort0->addActionListener(inputActionListener);
|
||||
|
||||
lblJoystick = new gcn::Label("Joystick:");
|
||||
lblJoystick->setSize(100, LABEL_HEIGHT);
|
||||
lblJoystick->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboJoystick = new gcn::UaeDropDown(&joystickList);
|
||||
cboJoystick->setSize(80, DROPDOWN_HEIGHT);
|
||||
cboJoystick->setBaseColor(gui_baseCol);
|
||||
cboJoystick->setId("cboJoystick");
|
||||
cboJoystick->addActionListener(inputActionListener);
|
||||
lblPort1 = new gcn::Label("Port1:");
|
||||
lblPort1->setSize(100, LABEL_HEIGHT);
|
||||
lblPort1->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboPort1 = new gcn::UaeDropDown(&ctrlPortList);
|
||||
cboPort1->setSize(160, DROPDOWN_HEIGHT);
|
||||
cboPort1->setBaseColor(gui_baseCol);
|
||||
cboPort1->setId("cboPort1");
|
||||
cboPort1->addActionListener(inputActionListener);
|
||||
|
||||
lblAutofire = new gcn::Label("Autofire Rate:");
|
||||
lblAutofire->setSize(100, LABEL_HEIGHT);
|
||||
|
@ -290,15 +321,6 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
chkCustomCtrl->setId("CustomCtrl");
|
||||
chkCustomCtrl->addActionListener(inputActionListener);
|
||||
|
||||
lblDPAD = new gcn::Label("Keyb DPAD:");
|
||||
lblDPAD->setSize(100, LABEL_HEIGHT);
|
||||
lblDPAD->setAlignment(gcn::Graphics::RIGHT);
|
||||
cboDPAD = new gcn::UaeDropDown(&dPADList);
|
||||
cboDPAD->setSize(80, DROPDOWN_HEIGHT);
|
||||
cboDPAD->setBaseColor(gui_baseCol);
|
||||
cboDPAD->setId("cboDPAD");
|
||||
cboDPAD->addActionListener(inputActionListener);
|
||||
|
||||
lblA = new gcn::Label("<A>:");
|
||||
lblA->setSize(100, LABEL_HEIGHT);
|
||||
lblA->setAlignment(gcn::Graphics::RIGHT);
|
||||
|
@ -410,31 +432,27 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
|
||||
|
||||
int posY = DISTANCE_BORDER;
|
||||
category.panel->add(lblCtrlConfig, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboCtrlConfig, DISTANCE_BORDER + lblCtrlConfig->getWidth() + 8, posY);
|
||||
posY += cboCtrlConfig->getHeight() + DISTANCE_NEXT_Y;
|
||||
category.panel->add(lblJoystick, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboJoystick, DISTANCE_BORDER + lblJoystick->getWidth() + 8, posY);
|
||||
category.panel->add(lblPort0, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboPort0, DISTANCE_BORDER + lblPort0->getWidth() + 8, posY);
|
||||
posY += cboPort0->getHeight() + DISTANCE_NEXT_Y;
|
||||
category.panel->add(lblPort1, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboPort1, DISTANCE_BORDER + lblPort1->getWidth() + 8, posY);
|
||||
category.panel->add(lblAutofire, 300, posY);
|
||||
category.panel->add(cboAutofire, 300 + lblAutofire->getWidth() + 8, posY);
|
||||
posY += cboAutofire->getHeight() + DISTANCE_NEXT_Y;
|
||||
#ifndef RASPBERRY
|
||||
category.panel->add(lblTapDelay, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboTapDelay, DISTANCE_BORDER + lblTapDelay->getWidth() + 8, posY);
|
||||
posY += cboTapDelay->getHeight() + DISTANCE_NEXT_Y;
|
||||
#endif
|
||||
|
||||
category.panel->add(lblMouseSpeed, DISTANCE_BORDER, posY);
|
||||
category.panel->add(sldMouseSpeed, DISTANCE_BORDER + lblMouseSpeed->getWidth() + 8, posY);
|
||||
category.panel->add(lblMouseSpeedInfo, sldMouseSpeed->getX() + sldMouseSpeed->getWidth() + 12, posY);
|
||||
#ifndef RASPBERRY
|
||||
category.panel->add(chkMouseHack, 320, posY);
|
||||
#endif
|
||||
posY += sldMouseSpeed->getHeight() + DISTANCE_NEXT_Y;
|
||||
|
||||
category.panel->add(lblDPAD, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboDPAD, DISTANCE_BORDER + lblDPAD->getWidth() + 8, posY);
|
||||
category.panel->add(chkCustomCtrl, 320, posY);
|
||||
posY += cboDPAD->getHeight() + DISTANCE_NEXT_Y;
|
||||
#ifndef RASPBERRY
|
||||
category.panel->add(chkMouseHack, DISTANCE_BORDER + lblA->getWidth() + 8, posY);
|
||||
category.panel->add(lblTapDelay, 300, posY);
|
||||
category.panel->add(cboTapDelay, 300 + lblTapDelay->getWidth() + 8, posY);
|
||||
posY += cboTapDelay->getHeight() + DISTANCE_NEXT_Y;
|
||||
#endif
|
||||
category.panel->add(chkCustomCtrl, DISTANCE_BORDER + lblA->getWidth() + 8, posY);
|
||||
posY += chkCustomCtrl->getHeight() + DISTANCE_NEXT_Y;
|
||||
category.panel->add(lblA, DISTANCE_BORDER, posY);
|
||||
category.panel->add(cboA, DISTANCE_BORDER + lblA->getWidth() + 8, posY);
|
||||
category.panel->add(lblB, 300, posY);
|
||||
|
@ -475,10 +493,11 @@ void InitPanelInput(const struct _ConfigCategory& category)
|
|||
|
||||
void ExitPanelInput(void)
|
||||
{
|
||||
delete lblCtrlConfig;
|
||||
delete cboCtrlConfig;
|
||||
delete lblJoystick;
|
||||
delete cboJoystick;
|
||||
delete lblPort0;
|
||||
delete cboPort0;
|
||||
delete lblPort1;
|
||||
delete cboPort1;
|
||||
|
||||
delete lblAutofire;
|
||||
delete cboAutofire;
|
||||
delete lblMouseSpeed;
|
||||
|
@ -490,8 +509,6 @@ void ExitPanelInput(void)
|
|||
delete chkMouseHack;
|
||||
#endif
|
||||
delete chkCustomCtrl;
|
||||
delete lblDPAD;
|
||||
delete cboDPAD;
|
||||
delete lblA;
|
||||
delete cboA;
|
||||
delete lblB;
|
||||
|
@ -527,15 +544,52 @@ void RefreshPanelInput(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
cboCtrlConfig->setSelected(changed_prefs.pandora_joyConf);
|
||||
cboJoystick->setSelected((changed_prefs.pandora_joyPort + 2) % 3);
|
||||
// Set current device in port 0
|
||||
switch(changed_prefs.jports[0].id) {
|
||||
case JSEM_MICE:
|
||||
cboPort0->setSelected(0);
|
||||
break;
|
||||
case JSEM_MICE + 1:
|
||||
cboPort0->setSelected(1);
|
||||
break;
|
||||
case JSEM_JOYS:
|
||||
if(changed_prefs.jports[0].mode != JSEM_MODE_JOYSTICK_CD32)
|
||||
cboPort0->setSelected(2);
|
||||
else
|
||||
cboPort0->setSelected(3);
|
||||
break;
|
||||
default:
|
||||
cboPort0->setSelected(4);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set current device in port 1
|
||||
switch(changed_prefs.jports[1].id) {
|
||||
case JSEM_MICE:
|
||||
cboPort1->setSelected(0);
|
||||
break;
|
||||
case JSEM_MICE + 1:
|
||||
cboPort1->setSelected(1);
|
||||
break;
|
||||
case JSEM_JOYS:
|
||||
if(changed_prefs.jports[1].mode != JSEM_MODE_JOYSTICK_CD32)
|
||||
cboPort1->setSelected(2);
|
||||
else
|
||||
cboPort1->setSelected(3);
|
||||
break;
|
||||
default:
|
||||
cboPort1->setSelected(4);
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed_prefs.input_autofire_framecnt == 12)
|
||||
cboAutofire->setSelected(0);
|
||||
else if (changed_prefs.input_autofire_framecnt == 8)
|
||||
if (changed_prefs.input_autofire_framecnt == 0)
|
||||
cboAutofire->setSelected(0);
|
||||
else if (changed_prefs.input_autofire_framecnt == 12)
|
||||
cboAutofire->setSelected(1);
|
||||
else
|
||||
else if (changed_prefs.input_autofire_framecnt == 8)
|
||||
cboAutofire->setSelected(2);
|
||||
else
|
||||
cboAutofire->setSelected(3);
|
||||
|
||||
for(i=0; i<5; ++i)
|
||||
{
|
||||
|
@ -557,17 +611,16 @@ void RefreshPanelInput(void)
|
|||
chkMouseHack->setSelected(changed_prefs.input_tablet == TABLET_MOUSEHACK);
|
||||
#endif
|
||||
chkCustomCtrl->setSelected(changed_prefs.pandora_customControls);
|
||||
cboDPAD->setSelected(changed_prefs.pandora_custom_dpad);
|
||||
cboA->setSelected(changed_prefs.pandora_custom_A + 8);
|
||||
cboB->setSelected(changed_prefs.pandora_custom_B + 8);
|
||||
cboX->setSelected(changed_prefs.pandora_custom_X + 8);
|
||||
cboY->setSelected(changed_prefs.pandora_custom_Y + 8);
|
||||
cboL->setSelected(changed_prefs.pandora_custom_L + 8);
|
||||
cboR->setSelected(changed_prefs.pandora_custom_R + 8);
|
||||
cboUp->setSelected(changed_prefs.pandora_custom_up + 8);
|
||||
cboDown->setSelected(changed_prefs.pandora_custom_down + 8);
|
||||
cboLeft->setSelected(changed_prefs.pandora_custom_left + 8);
|
||||
cboRight->setSelected(changed_prefs.pandora_custom_right + 8);
|
||||
cboA->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_HOME]));
|
||||
cboB->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_END]));
|
||||
cboX->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEDOWN]));
|
||||
cboY->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_PAGEUP]));
|
||||
cboL->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RSHIFT]));
|
||||
cboR->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RCTRL]));
|
||||
cboUp->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_UP]));
|
||||
cboDown->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_DOWN]));
|
||||
cboLeft->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_LEFT]));
|
||||
cboRight->setSelected(GetAmigaKeyIndex(customControlMap[SDLK_RIGHT]));
|
||||
|
||||
for(i=0; i<4; ++i)
|
||||
{
|
||||
|
|
|
@ -37,10 +37,16 @@ extern SDL_Surface* gui_screen;
|
|||
extern char currentDir[MAX_DPATH];
|
||||
extern char last_loaded_config[MAX_DPATH];
|
||||
|
||||
#define BUILDINID_NONE 0
|
||||
#define BUILDINID_A500 1
|
||||
#define BUILDINID_A1200 2
|
||||
#define BUILDINID_CD32 3
|
||||
|
||||
typedef struct {
|
||||
char Name[MAX_DPATH];
|
||||
char FullPath[MAX_DPATH];
|
||||
char Description[MAX_DPATH];
|
||||
int BuildInID;
|
||||
} ConfigFileInfo;
|
||||
extern std::vector<ConfigFileInfo*> ConfigFilesList;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ ConfigCategory categories[] = {
|
|||
{ "ROM", "data/chip.ico", NULL, NULL, InitPanelROM, ExitPanelROM, RefreshPanelROM },
|
||||
{ "RAM", "data/chip.ico", NULL, NULL, InitPanelRAM, ExitPanelRAM, RefreshPanelRAM },
|
||||
{ "Floppy drives", "data/35floppy.ico", NULL, NULL, InitPanelFloppy, ExitPanelFloppy, RefreshPanelFloppy },
|
||||
{ "Hard drives", "data/drive.ico", NULL, NULL, InitPanelHD, ExitPanelHD, RefreshPanelHD },
|
||||
{ "Hard drives / CD", "data/drive.ico", NULL, NULL, InitPanelHD, ExitPanelHD, RefreshPanelHD },
|
||||
{ "Display", "data/screen.ico", NULL, NULL, InitPanelDisplay, ExitPanelDisplay, RefreshPanelDisplay },
|
||||
{ "Sound", "data/sound.ico", NULL, NULL, InitPanelSound, ExitPanelSound, RefreshPanelSound },
|
||||
{ "Input", "data/joystick.ico", NULL, NULL, InitPanelInput, ExitPanelInput, RefreshPanelInput },
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<SDL.h>
|
||||
#include "sysconfig.h"
|
||||
#include "sysdeps.h"
|
||||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "gp2x.h"
|
||||
#include "inputmode.h"
|
||||
#include "uae.h"
|
||||
#include "target.h"
|
||||
|
||||
extern SDL_Surface *prSDLScreen;
|
||||
|
||||
static SDL_Surface *inputMode[3];
|
||||
|
||||
|
||||
void inputmode_close(void)
|
||||
{
|
||||
for(int i=0; i<3; ++i)
|
||||
{
|
||||
if(inputMode[i] != NULL)
|
||||
{
|
||||
SDL_FreeSurface(inputMode[i]);
|
||||
inputMode[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void inputmode_init(void)
|
||||
{
|
||||
int i;
|
||||
char tmpchar[256];
|
||||
SDL_Surface* tmp;
|
||||
|
||||
if(inputMode[0] == NULL)
|
||||
{
|
||||
snprintf(tmpchar, 256, "%s/data/joystick.bmp", start_path_data);
|
||||
tmp = SDL_LoadBMP(tmpchar);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
inputMode[0] = SDL_DisplayFormat(tmp);
|
||||
SDL_FreeSurface(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if(inputMode[1] == NULL)
|
||||
{
|
||||
snprintf(tmpchar, 256, "%s/data/mouse.bmp", start_path_data);
|
||||
tmp = SDL_LoadBMP(tmpchar);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
inputMode[1] = SDL_DisplayFormat(tmp);
|
||||
SDL_FreeSurface(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if(inputMode[2] == NULL)
|
||||
{
|
||||
snprintf(tmpchar, 256, "%s/data/remapping.bmp", start_path_data);
|
||||
tmp = SDL_LoadBMP(tmpchar);
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
inputMode[2] = SDL_DisplayFormat(tmp);
|
||||
SDL_FreeSurface(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
show_inputmode = 0;
|
||||
}
|
||||
|
||||
|
||||
void inputmode_redraw(void)
|
||||
{
|
||||
SDL_Rect r;
|
||||
SDL_Surface* surface;
|
||||
|
||||
r.x=(prSDLScreen->w-160)/2;
|
||||
r.y=(prSDLScreen->h-160)/2;
|
||||
r.w=160;
|
||||
r.h=160;
|
||||
|
||||
if (inputMode[0] && inputMode[1] && inputMode[2])
|
||||
{
|
||||
surface = inputMode[currprefs.pandora_custom_dpad];
|
||||
|
||||
SDL_BlitSurface(surface,NULL,prSDLScreen,&r);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_joyConf(struct uae_prefs *p)
|
||||
{
|
||||
if(p->pandora_joyConf == 0)
|
||||
{
|
||||
p->pandora_button1 = GP2X_BUTTON_X;
|
||||
p->pandora_button2 = GP2X_BUTTON_A;
|
||||
p->pandora_jump = -1;
|
||||
p->pandora_autofireButton1 = GP2X_BUTTON_B;
|
||||
}
|
||||
else if(p->pandora_joyConf == 1)
|
||||
{
|
||||
p->pandora_button1 = GP2X_BUTTON_B;
|
||||
p->pandora_button2 = GP2X_BUTTON_A;
|
||||
p->pandora_jump = -1;
|
||||
p->pandora_autofireButton1 = GP2X_BUTTON_X;
|
||||
}
|
||||
else if(p->pandora_joyConf == 2)
|
||||
{
|
||||
p->pandora_button1 = GP2X_BUTTON_Y;
|
||||
p->pandora_button2 = GP2X_BUTTON_A;
|
||||
p->pandora_jump = GP2X_BUTTON_X;
|
||||
p->pandora_autofireButton1 = GP2X_BUTTON_B;
|
||||
}
|
||||
else if(changed_prefs.pandora_joyConf == 3)
|
||||
{
|
||||
p->pandora_button1 = GP2X_BUTTON_B;
|
||||
p->pandora_button2 = GP2X_BUTTON_A;
|
||||
p->pandora_jump = GP2X_BUTTON_X;
|
||||
p->pandora_autofireButton1 = GP2X_BUTTON_Y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int is_tablet (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
|
||||
#define SIMULATE_SHIFT 0x200
|
||||
#define SIMULATE_RELEASED_SHIFT 0x400
|
||||
|
||||
void inputmode_close(void);
|
||||
void inputmode_init(void);
|
||||
void inputmode_redraw(void);
|
||||
|
||||
void set_joyConf(struct uae_prefs *p);
|
||||
|
||||
extern int show_inputmode;
|
|
@ -1,337 +0,0 @@
|
|||
/*
|
||||
* UAE - The Un*x Amiga Emulator
|
||||
*
|
||||
* Joystick emulation for Linux and BSD. They share too much code to
|
||||
* split this file.
|
||||
*
|
||||
* Copyright 1997 Bernd Schmidt
|
||||
* Copyright 1998 Krister Walfridsson
|
||||
*/
|
||||
|
||||
#include "sysconfig.h"
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "uae.h"
|
||||
#include "options.h"
|
||||
#include "memory.h"
|
||||
#include "newcpu.h"
|
||||
#include "custom.h"
|
||||
#include "joystick.h"
|
||||
#include "inputdevice.h"
|
||||
#include "SDL.h"
|
||||
|
||||
#ifdef GP2X
|
||||
#include "gp2x.h"
|
||||
#include "xwin.h"
|
||||
#if defined(PANDORA) || defined (ANDROIDSDL)
|
||||
extern int dpadUp;
|
||||
extern int dpadDown;
|
||||
extern int dpadLeft;
|
||||
extern int dpadRight;
|
||||
extern int buttonA;
|
||||
extern int buttonB;
|
||||
extern int buttonX;
|
||||
extern int buttonY;
|
||||
extern int triggerL;
|
||||
extern int triggerR;
|
||||
#endif
|
||||
|
||||
static int delay=0;
|
||||
#endif
|
||||
|
||||
|
||||
int nr_joysticks;
|
||||
char JoystickName[4][40];
|
||||
|
||||
static SDL_Joystick *uae4all_joy0 = 0, *uae4all_joy1 = 0 , *uae4all_joy2 = 0, *uae4all_joy3 = 0;
|
||||
|
||||
void read_joystick(int nr, unsigned int *dir, int *button)
|
||||
{
|
||||
int left = 0, right = 0, top = 0, bot = 0;
|
||||
SDL_Joystick *joy = nr == 1 ? uae4all_joy0 : uae4all_joy1;
|
||||
|
||||
if(nr == 0)
|
||||
{
|
||||
static int last_buttonstate0 = 0;
|
||||
static int delay_leftmouse = 0;
|
||||
|
||||
if(last_buttonstate0 != buttonstate[0])
|
||||
{
|
||||
last_buttonstate0 = buttonstate[0];
|
||||
if(buttonstate[0])
|
||||
{
|
||||
// Left mousebutton click -> delay click
|
||||
delay_leftmouse = 2;
|
||||
}
|
||||
}
|
||||
if(delay_leftmouse)
|
||||
{
|
||||
--delay_leftmouse;
|
||||
*button = (buttonstate[2] ? 2 : 0) | (buttonstate[1] ? 4 : 0);
|
||||
}
|
||||
else
|
||||
*button = (buttonstate[0] ? 1 : 0) | (buttonstate[2] ? 2 : 0) | (buttonstate[1] ? 4 : 0);
|
||||
}
|
||||
else
|
||||
*button = 0;
|
||||
|
||||
#ifndef RASPBERRY
|
||||
if(currprefs.pandora_joyPort != 0)
|
||||
{
|
||||
// Only one joystick active
|
||||
if((nr == 0 && currprefs.pandora_joyPort == 2) || (nr == 1 && currprefs.pandora_joyPort == 1))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
*dir = 0;
|
||||
|
||||
SDL_JoystickUpdate ();
|
||||
|
||||
|
||||
if (nr != 1)
|
||||
{
|
||||
// get joystick direction via joystick or Hat
|
||||
int hat = SDL_JoystickGetHat(joy,0);
|
||||
int val = SDL_JoystickGetAxis(joy, 0);
|
||||
if ((hat & SDL_HAT_RIGHT) || (val > 6000)) right=1;
|
||||
if ((hat & SDL_HAT_LEFT) || (val < -6000)) left=1;
|
||||
val = SDL_JoystickGetAxis(joy, 1);
|
||||
if ((hat & SDL_HAT_UP) || (val < -6000)) top=1;
|
||||
if ((hat & SDL_HAT_DOWN) || (val > 6000)) bot=1;
|
||||
|
||||
*button |= (SDL_JoystickGetButton(joy, 0)) & 1;
|
||||
*button |= ((SDL_JoystickGetButton(joy, 1)) & 1) << 1;
|
||||
|
||||
#ifdef SIX_AXIS_WORKAROUND
|
||||
*button |= (SDL_JoystickGetButton(joy, 13)) & 1;
|
||||
*button |= ((SDL_JoystickGetButton(joy, 14)) & 1) << 1;
|
||||
|
||||
if ( SDL_JoystickGetButton(joy, 4)) top =1;
|
||||
if ( SDL_JoystickGetButton(joy, 5)) right=1;
|
||||
if ( SDL_JoystickGetButton(joy, 6)) bot =1;
|
||||
if ( SDL_JoystickGetButton(joy, 7)) left =1;
|
||||
#endif
|
||||
|
||||
// Go over custom management which is only available for first joystick.
|
||||
goto no_custom;
|
||||
}
|
||||
|
||||
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if (!triggerR /*R+dpad = arrow keys*/ && currprefs.pandora_custom_dpad==0)
|
||||
#endif
|
||||
{
|
||||
// get joystick direction via dPad or joystick or Hat
|
||||
int hat = SDL_JoystickGetHat(joy,0);
|
||||
int val = SDL_JoystickGetAxis(joy, 0);
|
||||
if (((hat & SDL_HAT_RIGHT) && currprefs.pandora_custom_dpad < 2) || (dpadRight && currprefs.pandora_custom_dpad < 2) || val > 6000) right=1;
|
||||
if (((hat & SDL_HAT_LEFT) && currprefs.pandora_custom_dpad < 2) || (dpadLeft && currprefs.pandora_custom_dpad < 2) || val < -6000) left=1;
|
||||
val = SDL_JoystickGetAxis(joy, 1);
|
||||
if (((hat & SDL_HAT_UP) && currprefs.pandora_custom_dpad < 2) || (dpadUp && currprefs.pandora_custom_dpad < 2) || val < -6000) top=1;
|
||||
if (((hat & SDL_HAT_DOWN) && currprefs.pandora_custom_dpad < 2) || (dpadDown && currprefs.pandora_custom_dpad < 2) || val > 6000) bot=1;
|
||||
|
||||
if (currprefs.pandora_joyConf)
|
||||
{
|
||||
if ((buttonX && currprefs.pandora_jump > -1) || SDL_JoystickGetButton(joy, currprefs.pandora_jump))
|
||||
top = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(currprefs.pandora_customControls)
|
||||
{
|
||||
// get joystick direction via custom keys
|
||||
if((currprefs.pandora_custom_A==-5 && buttonA) || (currprefs.pandora_custom_B==-5 && buttonB) || (currprefs.pandora_custom_X==-5 && buttonX) || (currprefs.pandora_custom_Y==-5 && buttonY) || (currprefs.pandora_custom_L==-5 && triggerL) || (currprefs.pandora_custom_R==-5 && triggerR))
|
||||
top = 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-5 && dpadUp) || (currprefs.pandora_custom_down==-5 && dpadDown) || (currprefs.pandora_custom_left==-5 && dpadLeft) || (currprefs.pandora_custom_right==-5 && dpadRight))
|
||||
top = 1;
|
||||
}
|
||||
|
||||
if((currprefs.pandora_custom_A==-6 && buttonA) || (currprefs.pandora_custom_B==-6 && buttonB) || (currprefs.pandora_custom_X==-6 && buttonX) || (currprefs.pandora_custom_Y==-6 && buttonY) || (currprefs.pandora_custom_L==-6 && triggerL) || (currprefs.pandora_custom_R==-6 && triggerR))
|
||||
bot = 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-6 && dpadUp) || (currprefs.pandora_custom_down==-6 && dpadDown) || (currprefs.pandora_custom_left==-6 && dpadLeft) || (currprefs.pandora_custom_right==-6 && dpadRight))
|
||||
bot = 1;
|
||||
}
|
||||
|
||||
if((currprefs.pandora_custom_A==-7 && buttonA) || (currprefs.pandora_custom_B==-7 && buttonB) || (currprefs.pandora_custom_X==-7 && buttonX) || (currprefs.pandora_custom_Y==-7 && buttonY) || (currprefs.pandora_custom_L==-7 && triggerL) || (currprefs.pandora_custom_R==-7 && triggerR))
|
||||
left = 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-7 && dpadUp) || (currprefs.pandora_custom_down==-7 && dpadDown) || (currprefs.pandora_custom_left==-7 && dpadLeft) || (currprefs.pandora_custom_right==-7 && dpadRight))
|
||||
left = 1;
|
||||
}
|
||||
|
||||
if((currprefs.pandora_custom_A==-8 && buttonA) || (currprefs.pandora_custom_B==-8 && buttonB) || (currprefs.pandora_custom_X==-8 && buttonX) || (currprefs.pandora_custom_Y==-8 && buttonY) || (currprefs.pandora_custom_L==-8 && triggerL) || (currprefs.pandora_custom_R==-8 && triggerR))
|
||||
right = 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-8 && dpadUp) || (currprefs.pandora_custom_down==-8 && dpadDown) || (currprefs.pandora_custom_left==-8 && dpadLeft) || (currprefs.pandora_custom_right==-8 && dpadRight))
|
||||
right = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(currprefs.pandora_custom_dpad == 0) // dPad as joystick
|
||||
{
|
||||
// Handle autofire (only available if no custom controls active)
|
||||
if(!currprefs.pandora_customControls &&
|
||||
(((currprefs.pandora_autofireButton1==GP2X_BUTTON_B && buttonA)
|
||||
|| (currprefs.pandora_autofireButton1==GP2X_BUTTON_X && buttonX)
|
||||
|| (currprefs.pandora_autofireButton1==GP2X_BUTTON_Y && buttonY))
|
||||
&& delay > currprefs.input_autofire_framecnt))
|
||||
{
|
||||
if(!buttonB)
|
||||
*button |= 1;
|
||||
delay=0;
|
||||
*button |= (buttonB & 1) << 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(currprefs.pandora_customControls)
|
||||
{
|
||||
// get joystick button via custom controls
|
||||
if((currprefs.pandora_custom_A==-3 && buttonA) || (currprefs.pandora_custom_B==-3 && buttonB) || (currprefs.pandora_custom_X==-3 && buttonX) || (currprefs.pandora_custom_Y==-3 && buttonY) || (currprefs.pandora_custom_L==-3 && triggerL) || (currprefs.pandora_custom_R==-3 && triggerR))
|
||||
*button |= 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-3 && dpadUp) || (currprefs.pandora_custom_down==-3 && dpadDown) || (currprefs.pandora_custom_left==-3 && dpadLeft) || (currprefs.pandora_custom_right==-3 && dpadRight))
|
||||
*button |= 1;
|
||||
}
|
||||
|
||||
if((currprefs.pandora_custom_A==-4 && buttonA) || (currprefs.pandora_custom_B==-4 && buttonB) || (currprefs.pandora_custom_X==-4 && buttonX) || (currprefs.pandora_custom_Y==-4 && buttonY) || (currprefs.pandora_custom_L==-4 && triggerL) || (currprefs.pandora_custom_R==-4 && triggerR))
|
||||
*button |= 1 << 1;
|
||||
else if(currprefs.pandora_custom_dpad == 2)
|
||||
{
|
||||
if((currprefs.pandora_custom_up==-4 && dpadUp) || (currprefs.pandora_custom_down==-4 && dpadDown) || (currprefs.pandora_custom_left==-4 && dpadLeft) || (currprefs.pandora_custom_right==-4 && dpadRight))
|
||||
*button |= 1 << 1;
|
||||
}
|
||||
delay++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get joystick button via ABXY or joystick
|
||||
if (!currprefs.pandora_customControls)
|
||||
{
|
||||
if (!currprefs.pandora_button1 == 3 && currprefs.pandora_joyConf < 2)
|
||||
{
|
||||
*button |= ((currprefs.pandora_button1==GP2X_BUTTON_B && buttonA) || (currprefs.pandora_button1==GP2X_BUTTON_X && buttonX) || (currprefs.pandora_button1==GP2X_BUTTON_Y && buttonY) || SDL_JoystickGetButton(joy, currprefs.pandora_button1)) & 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*button |= ((currprefs.pandora_button1==GP2X_BUTTON_B && buttonA) || (currprefs.pandora_button1==GP2X_BUTTON_X && buttonX)) & 1;
|
||||
}
|
||||
delay++;
|
||||
}
|
||||
|
||||
if (!SDL_JoystickGetButton(joy, 1))
|
||||
*button |= ((buttonB || SDL_JoystickGetButton(joy, currprefs.pandora_button2)) & 1) << 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef RASPBERRY
|
||||
if(!currprefs.pandora_customControls || currprefs.pandora_custom_A == 0)
|
||||
*button |= (SDL_JoystickGetButton(joy, 0)) & 1;
|
||||
if(!currprefs.pandora_customControls || currprefs.pandora_custom_B == 0)
|
||||
*button |= ((SDL_JoystickGetButton(joy, 1)) & 1) << 1;
|
||||
#endif
|
||||
|
||||
#ifdef SIX_AXIS_WORKAROUND
|
||||
*button |= (SDL_JoystickGetButton(joy, 13)) & 1;
|
||||
*button |= ((SDL_JoystickGetButton(joy, 14)) & 1) << 1;
|
||||
if (!currprefs.pandora_customControls && SDL_JoystickGetButton(joy, 4)) top=1;
|
||||
if (!currprefs.pandora_customControls && SDL_JoystickGetButton(joy, 5)) right=1;
|
||||
if (!currprefs.pandora_customControls && SDL_JoystickGetButton(joy, 6)) bot=1;
|
||||
if (!currprefs.pandora_customControls && SDL_JoystickGetButton(joy, 7)) left=1;
|
||||
#endif
|
||||
|
||||
no_custom:
|
||||
|
||||
// normal joystick movement
|
||||
if (left)
|
||||
top = !top;
|
||||
if (right)
|
||||
bot = !bot;
|
||||
*dir = bot | (right << 1) | (top << 8) | (left << 9);
|
||||
}
|
||||
|
||||
void handle_joymouse(void)
|
||||
{
|
||||
int y = 1024;
|
||||
int mouseScale = currprefs.input_joymouse_multiplier / 2;
|
||||
|
||||
if (buttonY) // slow mouse active
|
||||
mouseScale = currprefs.input_joymouse_multiplier / 10;
|
||||
|
||||
if (dpadLeft) {
|
||||
setmousestate(0, 0, -mouseScale, 0);
|
||||
y = 0;
|
||||
}
|
||||
if (dpadRight) {
|
||||
setmousestate(0, 0, mouseScale, 0);
|
||||
y = 0;
|
||||
}
|
||||
if (dpadUp) {
|
||||
y = -mouseScale;
|
||||
}
|
||||
if (dpadDown) {
|
||||
y = mouseScale;
|
||||
}
|
||||
if(y < 1024)
|
||||
setmousestate(0, 1, y, 0);
|
||||
}
|
||||
|
||||
void init_joystick(void)
|
||||
{
|
||||
nr_joysticks = SDL_NumJoysticks ();
|
||||
if (nr_joysticks > 4)
|
||||
nr_joysticks = 4;
|
||||
if (nr_joysticks > 0)
|
||||
{
|
||||
uae4all_joy0 = SDL_JoystickOpen (0);
|
||||
strncpy(JoystickName[0],SDL_JoystickName(0),40);
|
||||
printf("Joystick0 : %s\n",JoystickName[0]);
|
||||
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(uae4all_joy0),SDL_JoystickNumAxes(uae4all_joy0),SDL_JoystickNumHats(uae4all_joy0));
|
||||
}
|
||||
if (nr_joysticks > 1)
|
||||
{
|
||||
uae4all_joy1 = SDL_JoystickOpen (1);
|
||||
strncpy(JoystickName[1],SDL_JoystickName(1),40);
|
||||
printf("Joystick1 : %s\n",JoystickName[1]);
|
||||
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(uae4all_joy1),SDL_JoystickNumAxes(uae4all_joy1),SDL_JoystickNumHats(uae4all_joy1));
|
||||
}
|
||||
if (nr_joysticks > 2)
|
||||
{
|
||||
uae4all_joy2 = SDL_JoystickOpen (2);
|
||||
strncpy(JoystickName[2],SDL_JoystickName(2),40);
|
||||
printf("Joystick2 : %s\n",JoystickName[2]);
|
||||
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(uae4all_joy2),SDL_JoystickNumAxes(uae4all_joy2),SDL_JoystickNumHats(uae4all_joy2));
|
||||
}
|
||||
if (nr_joysticks > 3)
|
||||
{
|
||||
uae4all_joy3 = SDL_JoystickOpen (3);
|
||||
strncpy(JoystickName[3],SDL_JoystickName(3),40);
|
||||
printf("Joystick3 : %s\n",JoystickName[3]);
|
||||
printf(" Buttons: %i Axis: %i Hats: %i\n",SDL_JoystickNumButtons(uae4all_joy3),SDL_JoystickNumAxes(uae4all_joy3),SDL_JoystickNumHats(uae4all_joy3));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void close_joystick(void)
|
||||
{
|
||||
if (nr_joysticks > 0)
|
||||
SDL_JoystickClose (uae4all_joy0);
|
||||
if (nr_joysticks > 1)
|
||||
SDL_JoystickClose (uae4all_joy1);
|
||||
if (nr_joysticks > 2)
|
||||
SDL_JoystickClose (uae4all_joy2);
|
||||
if (nr_joysticks > 3)
|
||||
SDL_JoystickClose (uae4all_joy3);
|
||||
}
|
|
@ -8,270 +8,283 @@
|
|||
#include "custom.h"
|
||||
#include "xwin.h"
|
||||
#include "drawing.h"
|
||||
#include "inputdevice.h"
|
||||
#include "keyboard.h"
|
||||
#include "keybuf.h"
|
||||
#include "gui.h"
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
/* Decode KeySyms. This function knows about all keys that are common
|
||||
* between different keyboard languages. */
|
||||
static int kc_decode (SDL_keysym *prKeySym)
|
||||
{
|
||||
#ifdef PANDORA
|
||||
// Special handling of Pandora keyboard:
|
||||
// Some keys requires shift on Amiga, so we simulate shift...
|
||||
static struct uae_input_device_kbr_default keytrans_amiga[] = {
|
||||
|
||||
switch (prKeySym->sym)
|
||||
{ SDLK_a, INPUTEVENT_KEY_A },
|
||||
{ SDLK_b, INPUTEVENT_KEY_B },
|
||||
{ SDLK_c, INPUTEVENT_KEY_C },
|
||||
{ SDLK_d, INPUTEVENT_KEY_D },
|
||||
{ SDLK_e, INPUTEVENT_KEY_E },
|
||||
{ SDLK_f, INPUTEVENT_KEY_F },
|
||||
{ SDLK_g, INPUTEVENT_KEY_G },
|
||||
{ SDLK_h, INPUTEVENT_KEY_H },
|
||||
{ SDLK_i, INPUTEVENT_KEY_I },
|
||||
{ SDLK_j, INPUTEVENT_KEY_J },
|
||||
{ SDLK_k, INPUTEVENT_KEY_K },
|
||||
{ SDLK_l, INPUTEVENT_KEY_L },
|
||||
{ SDLK_m, INPUTEVENT_KEY_M },
|
||||
{ SDLK_n, INPUTEVENT_KEY_N },
|
||||
{ SDLK_o, INPUTEVENT_KEY_O },
|
||||
{ SDLK_p, INPUTEVENT_KEY_P },
|
||||
{ SDLK_q, INPUTEVENT_KEY_Q },
|
||||
{ SDLK_r, INPUTEVENT_KEY_R },
|
||||
{ SDLK_s, INPUTEVENT_KEY_S },
|
||||
{ SDLK_t, INPUTEVENT_KEY_T },
|
||||
{ SDLK_u, INPUTEVENT_KEY_U },
|
||||
{ SDLK_v, INPUTEVENT_KEY_W },
|
||||
{ SDLK_w, INPUTEVENT_KEY_V },
|
||||
{ SDLK_x, INPUTEVENT_KEY_X },
|
||||
{ SDLK_y, INPUTEVENT_KEY_Y },
|
||||
{ SDLK_z, INPUTEVENT_KEY_Z },
|
||||
|
||||
{ SDLK_0, INPUTEVENT_KEY_0 },
|
||||
{ SDLK_1, INPUTEVENT_KEY_1 },
|
||||
{ SDLK_2, INPUTEVENT_KEY_2 },
|
||||
{ SDLK_3, INPUTEVENT_KEY_3 },
|
||||
{ SDLK_4, INPUTEVENT_KEY_4 },
|
||||
{ SDLK_5, INPUTEVENT_KEY_5 },
|
||||
{ SDLK_6, INPUTEVENT_KEY_6 },
|
||||
{ SDLK_7, INPUTEVENT_KEY_7 },
|
||||
{ SDLK_8, INPUTEVENT_KEY_8 },
|
||||
{ SDLK_9, INPUTEVENT_KEY_9 },
|
||||
|
||||
{ SDLK_BACKSPACE, INPUTEVENT_KEY_BACKSPACE },
|
||||
{ SDLK_TAB, INPUTEVENT_KEY_TAB },
|
||||
{ SDLK_RETURN, INPUTEVENT_KEY_RETURN },
|
||||
{ SDLK_ESCAPE, INPUTEVENT_KEY_ESC },
|
||||
{ SDLK_SPACE, INPUTEVENT_KEY_SPACE },
|
||||
{ SDLK_QUOTE, INPUTEVENT_KEY_SINGLEQUOTE },
|
||||
{ SDLK_COMMA, INPUTEVENT_KEY_COMMA },
|
||||
{ SDLK_MINUS, INPUTEVENT_KEY_SUB },
|
||||
{ SDLK_PERIOD, INPUTEVENT_KEY_PERIOD },
|
||||
{ SDLK_SLASH, INPUTEVENT_KEY_DIV },
|
||||
|
||||
{ SDLK_SEMICOLON, INPUTEVENT_KEY_SEMICOLON },
|
||||
{ SDLK_EQUALS, INPUTEVENT_KEY_EQUALS },
|
||||
{ SDLK_LEFTBRACKET, INPUTEVENT_KEY_LEFTBRACKET },
|
||||
{ SDLK_BACKSLASH, INPUTEVENT_KEY_BACKSLASH },
|
||||
{ SDLK_RIGHTBRACKET, INPUTEVENT_KEY_RIGHTBRACKET },
|
||||
{ SDLK_BACKQUOTE, INPUTEVENT_KEY_BACKQUOTE },
|
||||
{ SDLK_DELETE, INPUTEVENT_KEY_DEL },
|
||||
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
static struct uae_input_device_kbr_default *keytrans[] = {
|
||||
keytrans_amiga,
|
||||
keytrans_amiga,
|
||||
keytrans_amiga
|
||||
};
|
||||
|
||||
static int kb_none[] = { -1 };
|
||||
static int *kbmaps[] = { kb_none, kb_none, kb_none, kb_none, kb_none,
|
||||
kb_none, kb_none, kb_none, kb_none, kb_none };
|
||||
|
||||
|
||||
void keyboard_settrans (void)
|
||||
{
|
||||
inputdevice_setkeytranslation (keytrans, kbmaps);
|
||||
}
|
||||
|
||||
|
||||
int translate_pandora_keys(int symbol, int *modifier)
|
||||
{
|
||||
switch(symbol)
|
||||
{
|
||||
case SDLK_QUESTION:
|
||||
return SIMULATE_SHIFT | AK_SLASH;
|
||||
case SDLK_HASH:
|
||||
return SIMULATE_SHIFT | AK_3;
|
||||
case SDLK_DOLLAR:
|
||||
return SIMULATE_SHIFT | AK_4;
|
||||
case SDLK_QUOTEDBL:
|
||||
return SIMULATE_SHIFT | AK_QUOTE;
|
||||
case SDLK_PLUS:
|
||||
return SIMULATE_SHIFT | AK_EQUAL;
|
||||
case SDLK_AT:
|
||||
return SIMULATE_SHIFT | AK_2;
|
||||
case SDLK_LEFTPAREN:
|
||||
return SIMULATE_SHIFT | AK_9;
|
||||
case SDLK_RIGHTPAREN:
|
||||
return SIMULATE_SHIFT | AK_0;
|
||||
case SDLK_UP:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + dPad -> cursor keys
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_UP;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_DOWN:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + dPad -> cursor keys
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_DN;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_LEFT:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + dPad -> cursor keys
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_LF;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_RIGHT:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + dPad -> cursor keys
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_RT;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_HOME:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + button A -> CTRL
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_CTRL;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_END:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + button B -> left ALT
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_LALT;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_PAGEDOWN:
|
||||
if(*modifier == KMOD_RCTRL) { // Right shoulder + button X -> HELP
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_HELP;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_PAGEUP: // button Y -> Space
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_SPC;
|
||||
|
||||
case SDLK_F1:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F1;
|
||||
|
||||
case SDLK_F2:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F2;
|
||||
|
||||
case SDLK_F3:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F3;
|
||||
|
||||
case SDLK_F4:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F4;
|
||||
|
||||
case SDLK_F5:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F5;
|
||||
|
||||
case SDLK_F6:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F6;
|
||||
|
||||
case SDLK_F7:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F7;
|
||||
|
||||
case SDLK_F8:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F8;
|
||||
|
||||
case SDLK_F9:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F9;
|
||||
|
||||
case SDLK_F10:
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_F10;
|
||||
|
||||
case SDLK_EXCLAIM:
|
||||
return SIMULATE_SHIFT | AK_1;
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_1;
|
||||
|
||||
case SDLK_QUOTEDBL:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_QUOTE;
|
||||
|
||||
case SDLK_HASH:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_3;
|
||||
|
||||
case SDLK_DOLLAR:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_4;
|
||||
|
||||
case SDLK_AMPERSAND:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_7;
|
||||
|
||||
case SDLK_LEFTPAREN:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_9;
|
||||
|
||||
case SDLK_RIGHTPAREN:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_0;
|
||||
|
||||
case SDLK_ASTERISK:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_8;
|
||||
|
||||
case SDLK_PLUS:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_EQUAL;
|
||||
|
||||
case SDLK_COLON:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_SEMICOLON;
|
||||
|
||||
case SDLK_QUESTION:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_SLASH;
|
||||
|
||||
case SDLK_AT:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_2;
|
||||
|
||||
case SDLK_CARET:
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_6;
|
||||
|
||||
case SDLK_UNDERSCORE:
|
||||
return SIMULATE_SHIFT | AK_MINUS;
|
||||
case SDLK_2:
|
||||
if(prKeySym->mod == KMOD_LSHIFT)
|
||||
return SIMULATE_SHIFT | AK_LBRACKET;
|
||||
break;
|
||||
case SDLK_3:
|
||||
if(prKeySym->mod == KMOD_LSHIFT)
|
||||
return SIMULATE_SHIFT | AK_RBRACKET;
|
||||
break;
|
||||
case SDLK_4:
|
||||
if(prKeySym->mod == KMOD_LSHIFT)
|
||||
return SIMULATE_SHIFT | AK_BACKQUOTE;
|
||||
break;
|
||||
case SDLK_9:
|
||||
if(prKeySym->mod == KMOD_LSHIFT)
|
||||
return SIMULATE_RELEASED_SHIFT | AK_LBRACKET;
|
||||
break;
|
||||
case SDLK_0:
|
||||
if(prKeySym->mod == KMOD_LSHIFT)
|
||||
return SIMULATE_RELEASED_SHIFT | AK_RBRACKET;
|
||||
break;
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_MINUS;
|
||||
|
||||
case 124: // code for '|'
|
||||
return SIMULATE_SHIFT | AK_BACKSLASH;
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_BACKSLASH;
|
||||
|
||||
case SDLK_2:
|
||||
if(*modifier == KMOD_LSHIFT) { // '{'
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_LBRACKET;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_3:
|
||||
if(*modifier == KMOD_LSHIFT) { // '}'
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_RBRACKET;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_4:
|
||||
if(*modifier == KMOD_LSHIFT) { // '~'
|
||||
*modifier = KMOD_SHIFT;
|
||||
return AK_BACKQUOTE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_9:
|
||||
if(*modifier == KMOD_LSHIFT) { // '['
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_LBRACKET;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDLK_0:
|
||||
if(*modifier == KMOD_LSHIFT) { // ']'
|
||||
*modifier = KMOD_NONE;
|
||||
return AK_RBRACKET;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
switch (prKeySym->sym)
|
||||
{
|
||||
case SDLK_b: return AK_B;
|
||||
case SDLK_c: return AK_C;
|
||||
case SDLK_d: return AK_D;
|
||||
case SDLK_e: return AK_E;
|
||||
case SDLK_f: return AK_F;
|
||||
case SDLK_g: return AK_G;
|
||||
case SDLK_h: return AK_H;
|
||||
case SDLK_i: return AK_I;
|
||||
case SDLK_j: return AK_J;
|
||||
case SDLK_k: return AK_K;
|
||||
case SDLK_l: return AK_L;
|
||||
case SDLK_n: return AK_N;
|
||||
case SDLK_o: return AK_O;
|
||||
case SDLK_p: return AK_P;
|
||||
case SDLK_r: return AK_R;
|
||||
case SDLK_s: return AK_S;
|
||||
case SDLK_t: return AK_T;
|
||||
case SDLK_u: return AK_U;
|
||||
case SDLK_v: return AK_V;
|
||||
case SDLK_x: return AK_X;
|
||||
|
||||
case SDLK_0: return AK_0;
|
||||
case SDLK_1: return AK_1;
|
||||
case SDLK_2: return AK_2;
|
||||
case SDLK_3: return AK_3;
|
||||
case SDLK_4: return AK_4;
|
||||
case SDLK_5: return AK_5;
|
||||
case SDLK_6: return AK_6;
|
||||
case SDLK_7: return AK_7;
|
||||
case SDLK_8: return AK_8;
|
||||
case SDLK_9: return AK_9;
|
||||
|
||||
case SDLK_KP0: return AK_NP0;
|
||||
case SDLK_KP1: return AK_NP1;
|
||||
case SDLK_KP2: return AK_NP2;
|
||||
case SDLK_KP3: return AK_NP3;
|
||||
case SDLK_KP4: return AK_NP4;
|
||||
case SDLK_KP5: return AK_NP5;
|
||||
case SDLK_KP6: return AK_NP6;
|
||||
case SDLK_KP7: return AK_NP7;
|
||||
case SDLK_KP8: return AK_NP8;
|
||||
case SDLK_KP9: return AK_NP9;
|
||||
case SDLK_KP_DIVIDE: return AK_NPDIV;
|
||||
case SDLK_KP_MULTIPLY: return AK_NPMUL;
|
||||
case SDLK_KP_MINUS: return AK_NPSUB;
|
||||
case SDLK_KP_PLUS: return AK_NPADD;
|
||||
case SDLK_KP_PERIOD: return AK_NPDEL;
|
||||
case SDLK_KP_ENTER: return AK_ENT;
|
||||
|
||||
case SDLK_F1: return AK_F1;
|
||||
case SDLK_F2: return AK_F2;
|
||||
case SDLK_F3: return AK_F3;
|
||||
case SDLK_F4: return AK_F4;
|
||||
case SDLK_F5: return AK_F5;
|
||||
case SDLK_F6: return AK_F6;
|
||||
case SDLK_F7: return AK_F7;
|
||||
case SDLK_F8: return AK_F8;
|
||||
case SDLK_F9: return AK_F9;
|
||||
case SDLK_F10: return AK_F10;
|
||||
|
||||
case SDLK_BACKSPACE: return AK_BS;
|
||||
case SDLK_DELETE: return AK_DEL;
|
||||
case SDLK_LCTRL: return AK_CTRL;
|
||||
case SDLK_RCTRL: return AK_RCTRL;
|
||||
case SDLK_TAB: return AK_TAB;
|
||||
case SDLK_LALT: return AK_LALT;
|
||||
case SDLK_RALT: return AK_RALT;
|
||||
case SDLK_RMETA: return AK_RAMI;
|
||||
case SDLK_LMETA: return AK_LAMI;
|
||||
case SDLK_RETURN: return AK_RET;
|
||||
case SDLK_SPACE: return AK_SPC;
|
||||
case SDLK_LSHIFT: return AK_LSH;
|
||||
case SDLK_RSHIFT: return AK_RSH;
|
||||
case SDLK_ESCAPE: return AK_ESC;
|
||||
|
||||
case SDLK_INSERT: return AK_HELP;
|
||||
case SDLK_HOME: return AK_NPLPAREN;
|
||||
case SDLK_END: return AK_NPRPAREN;
|
||||
case SDLK_CAPSLOCK: return AK_CAPSLOCK;
|
||||
|
||||
case SDLK_UP: return AK_UP;
|
||||
case SDLK_DOWN: return AK_DN;
|
||||
case SDLK_LEFT: return AK_LF;
|
||||
case SDLK_RIGHT: return AK_RT;
|
||||
|
||||
case SDLK_PAGEUP: return AK_RAMI; /* PgUp mapped to right amiga */
|
||||
case SDLK_PAGEDOWN: return AK_LAMI; /* PgDn mapped to left amiga */
|
||||
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle keys specific to French (and Belgian) keymaps.
|
||||
*
|
||||
* Number keys are broken
|
||||
*/
|
||||
static int decode_fr (SDL_keysym *prKeySym)
|
||||
{
|
||||
switch(prKeySym->sym) {
|
||||
case SDLK_a: return AK_Q;
|
||||
case SDLK_m: return AK_SEMICOLON;
|
||||
case SDLK_q: return AK_A;
|
||||
case SDLK_y: return AK_Y;
|
||||
case SDLK_w: return AK_Z;
|
||||
case SDLK_z: return AK_W;
|
||||
case SDLK_LEFTBRACKET: return AK_LBRACKET;
|
||||
case SDLK_RIGHTBRACKET: return AK_RBRACKET;
|
||||
case SDLK_COMMA: return AK_M;
|
||||
case SDLK_LESS:
|
||||
case SDLK_GREATER: return AK_LTGT;
|
||||
case SDLK_PERIOD:
|
||||
case SDLK_SEMICOLON: return AK_COMMA;
|
||||
case SDLK_RIGHTPAREN: return AK_MINUS;
|
||||
case SDLK_EQUALS: return AK_SLASH;
|
||||
case SDLK_HASH: return AK_NUMBERSIGN;
|
||||
case SDLK_SLASH: return AK_PERIOD; // Is it true ?
|
||||
case SDLK_MINUS: return AK_EQUAL;
|
||||
case SDLK_BACKSLASH: return AK_SLASH;
|
||||
case SDLK_COLON: return AK_PERIOD;
|
||||
case SDLK_EXCLAIM: return AK_BACKSLASH; // Not really...
|
||||
default: printf("Unknown key: %i\n",prKeySym->sym); return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle keys specific to German keymaps.
|
||||
*/
|
||||
static int decode_de (SDL_keysym *prKeySym)
|
||||
{
|
||||
switch(prKeySym->sym) {
|
||||
case SDLK_a: return AK_A;
|
||||
case SDLK_m: return AK_M;
|
||||
case SDLK_q: return AK_Q;
|
||||
case SDLK_w: return AK_W;
|
||||
case SDLK_y: return AK_Z;
|
||||
case SDLK_z: return AK_Y;
|
||||
case SDLK_COLON: return SIMULATE_SHIFT | AK_SEMICOLON;
|
||||
/* German umlaut oe */
|
||||
case SDLK_WORLD_86: return AK_SEMICOLON;
|
||||
/* German umlaut ae */
|
||||
case SDLK_WORLD_68: return AK_QUOTE;
|
||||
/* German umlaut ue */
|
||||
case SDLK_WORLD_92: return AK_LBRACKET;
|
||||
case SDLK_PLUS:
|
||||
case SDLK_ASTERISK: return AK_RBRACKET;
|
||||
case SDLK_COMMA: return AK_COMMA;
|
||||
case SDLK_PERIOD: return AK_PERIOD;
|
||||
case SDLK_LESS:
|
||||
case SDLK_GREATER: return AK_LTGT;
|
||||
case SDLK_HASH: return AK_NUMBERSIGN;
|
||||
/* German sharp s */
|
||||
case SDLK_WORLD_63: return AK_MINUS;
|
||||
case SDLK_QUOTE: return AK_EQUAL;
|
||||
case SDLK_CARET: return AK_BACKQUOTE;
|
||||
case SDLK_MINUS: return AK_SLASH;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int decode_us (SDL_keysym *prKeySym)
|
||||
{
|
||||
switch(prKeySym->sym)
|
||||
{
|
||||
/* US specific */
|
||||
case SDLK_a: return AK_A;
|
||||
case SDLK_m: return AK_M;
|
||||
case SDLK_q: return AK_Q;
|
||||
case SDLK_y: return AK_Y;
|
||||
case SDLK_w: return AK_W;
|
||||
case SDLK_z: return AK_Z;
|
||||
case SDLK_COLON: return SIMULATE_SHIFT | AK_SEMICOLON;
|
||||
case SDLK_LEFTBRACKET: return AK_LBRACKET;
|
||||
case SDLK_RIGHTBRACKET: return AK_RBRACKET;
|
||||
case SDLK_COMMA: return AK_COMMA;
|
||||
case SDLK_PERIOD: return AK_PERIOD;
|
||||
case SDLK_SLASH: return AK_SLASH;
|
||||
case SDLK_SEMICOLON: return AK_SEMICOLON;
|
||||
case SDLK_MINUS: return AK_MINUS;
|
||||
case SDLK_EQUALS: return AK_EQUAL;
|
||||
/* this doesn't work: */
|
||||
case SDLK_BACKQUOTE: return AK_QUOTE;
|
||||
case SDLK_QUOTE: return AK_BACKQUOTE;
|
||||
case SDLK_BACKSLASH: return AK_BACKSLASH;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int keycode2amiga(SDL_keysym *prKeySym)
|
||||
{
|
||||
int iAmigaKeycode = kc_decode(prKeySym);
|
||||
if (iAmigaKeycode == -1)
|
||||
return decode_us(prKeySym);
|
||||
return iAmigaKeycode;
|
||||
}
|
||||
|
||||
int getcapslockstate (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setcapslockstate (int state)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,17 +10,16 @@
|
|||
#include "memory.h"
|
||||
#include "newcpu.h"
|
||||
#include "custom.h"
|
||||
#include "od-pandora/gp2x.h"
|
||||
#include "uae.h"
|
||||
#include "disk.h"
|
||||
#include "../inputmode.h"
|
||||
#include "SDL.h"
|
||||
|
||||
extern int customControlMap[SDLK_LAST];
|
||||
|
||||
static int kickstart;
|
||||
|
||||
static int presetModeId = 2;
|
||||
|
||||
int saveMenu_n_savestate = 0;
|
||||
|
||||
|
||||
static void SetPresetMode(int mode, struct uae_prefs *p)
|
||||
{
|
||||
|
@ -457,8 +456,6 @@ 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);
|
||||
p->pandora_joyConf = (joybuffer & 0x0f);
|
||||
p->pandora_joyPort = ((joybuffer >> 4) & 0x0f);
|
||||
fscanf(f,"autofireRate=%d\n",&p->input_autofire_framecnt);
|
||||
fscanf(f,"autofire=%d\n", &dummy);
|
||||
fscanf(f,"stylusOffset=%d\n",&dummy);
|
||||
|
@ -486,17 +483,17 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
|
|||
fscanf(f,"cutLeft=%d\n", &dummy);
|
||||
fscanf(f,"cutRight=%d\n", &dummy);
|
||||
fscanf(f,"customControls=%d\n",&p->pandora_customControls);
|
||||
fscanf(f,"custom_dpad=%d\n",&p->pandora_custom_dpad);
|
||||
fscanf(f,"custom_up=%d\n",&p->pandora_custom_up);
|
||||
fscanf(f,"custom_down=%d\n",&p->pandora_custom_down);
|
||||
fscanf(f,"custom_left=%d\n",&p->pandora_custom_left);
|
||||
fscanf(f,"custom_right=%d\n",&p->pandora_custom_right);
|
||||
fscanf(f,"custom_A=%d\n",&p->pandora_custom_A);
|
||||
fscanf(f,"custom_B=%d\n",&p->pandora_custom_B);
|
||||
fscanf(f,"custom_X=%d\n",&p->pandora_custom_X);
|
||||
fscanf(f,"custom_Y=%d\n",&p->pandora_custom_Y);
|
||||
fscanf(f,"custom_L=%d\n",&p->pandora_custom_L);
|
||||
fscanf(f,"custom_R=%d\n",&p->pandora_custom_R);
|
||||
fscanf(f,"custom_dpad=%d\n",&dummy);
|
||||
fscanf(f,"custom_up=%d\n",&customControlMap[SDLK_UP]);
|
||||
fscanf(f,"custom_down=%d\n",&customControlMap[SDLK_DOWN]);
|
||||
fscanf(f,"custom_left=%d\n",&customControlMap[SDLK_LEFT]);
|
||||
fscanf(f,"custom_right=%d\n",&customControlMap[SDLK_RIGHT]);
|
||||
fscanf(f,"custom_A=%d\n",&customControlMap[SDLK_HOME]);
|
||||
fscanf(f,"custom_B=%d\n",&customControlMap[SDLK_END]);
|
||||
fscanf(f,"custom_X=%d\n",&customControlMap[SDLK_PAGEDOWN]);
|
||||
fscanf(f,"custom_Y=%d\n",&customControlMap[SDLK_PAGEUP]);
|
||||
fscanf(f,"custom_L=%d\n",&customControlMap[SDLK_RSHIFT]);
|
||||
fscanf(f,"custom_R=%d\n",&customControlMap[SDLK_RCTRL]);
|
||||
fscanf(f,"cpu=%d\n", &cpu_level);
|
||||
if(cpu_level > 0) // M68000
|
||||
// Was old format
|
||||
|
@ -661,7 +658,6 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
|
|||
SetPresetMode(presetModeId, p);
|
||||
|
||||
CheckKickstart(p);
|
||||
set_joyConf(p);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -35,12 +35,13 @@
|
|||
#include "savestate.h"
|
||||
#include "traps.h"
|
||||
#include "bsdsocket.h"
|
||||
#include "blkdev.h"
|
||||
#include "native2amiga.h"
|
||||
#include "rtgmodes.h"
|
||||
#include "uaeresource.h"
|
||||
#include "rommgr.h"
|
||||
#include "akiko.h"
|
||||
#include <SDL.h>
|
||||
#include "gp2x.h"
|
||||
#include "pandora_rp9.h"
|
||||
|
||||
/*
|
||||
|
@ -97,43 +98,26 @@ void dbg_list_threads(void)
|
|||
extern void signal_segv(int signum, siginfo_t* info, void*ptr);
|
||||
extern void gui_force_rtarea_hdchange(void);
|
||||
|
||||
extern int doStylusRightClick;
|
||||
extern int mouseMoving;
|
||||
extern int justClicked;
|
||||
extern int fcounter;
|
||||
static int delayed_mousebutton = 0;
|
||||
static int doStylusRightClick;
|
||||
|
||||
extern int keycode2amiga(SDL_keysym *prKeySym);
|
||||
extern int loadconfig_old(struct uae_prefs *p, const char *orgpath);
|
||||
extern void SetLastActiveConfig(const char *filename);
|
||||
|
||||
/* Joystick */
|
||||
int JoystickButton[20];
|
||||
int JoystickQuit[2];
|
||||
|
||||
/* Keyboard and mouse */
|
||||
int buttonstate[3];
|
||||
|
||||
/* Keyboard */
|
||||
int uae4all_keystate[256];
|
||||
#ifdef PANDORA
|
||||
static int shiftWasPressed = 0;
|
||||
#endif
|
||||
int customControlMap[SDLK_LAST];
|
||||
|
||||
char start_path_data[MAX_DPATH];
|
||||
char currentDir[MAX_DPATH];
|
||||
int show_inputmode = 0;
|
||||
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
|
||||
static int capslock = 0;
|
||||
#endif
|
||||
int sleep_resolution = 1000 / 1;
|
||||
|
||||
static char config_path[MAX_DPATH];
|
||||
static char rom_path[MAX_DPATH];
|
||||
static char rp9_path[MAX_DPATH];
|
||||
char last_loaded_config[MAX_DPATH] = { '\0' };
|
||||
|
||||
static bool slow_mouse = false;
|
||||
|
||||
static bool cpuSpeedChanged = false;
|
||||
static int lastCpuSpeed = 600;
|
||||
int defaultCpuSpeed = 600;
|
||||
|
@ -146,6 +130,9 @@ void reinit_amiga(void)
|
|||
{
|
||||
write_log("reinit_amiga() called\n");
|
||||
DISK_free ();
|
||||
#ifdef CD32
|
||||
akiko_free ();
|
||||
#endif
|
||||
#ifdef FILESYS
|
||||
filesys_cleanup ();
|
||||
hardfile_reset();
|
||||
|
@ -156,6 +143,7 @@ void reinit_amiga(void)
|
|||
#endif
|
||||
expansion_cleanup ();
|
||||
#endif
|
||||
device_func_reset ();
|
||||
memory_cleanup ();
|
||||
|
||||
/* At this point, there might run some threads from bsdsocket.*/
|
||||
|
@ -315,33 +303,12 @@ void target_default_options (struct uae_prefs *p, int type)
|
|||
p->pandora_cpu_speed = defaultCpuSpeed;
|
||||
p->pandora_hide_idle_led = 0;
|
||||
|
||||
p->pandora_joyConf = 0;
|
||||
p->pandora_joyPort = 2;
|
||||
p->pandora_tapDelay = 10;
|
||||
|
||||
p->pandora_customControls = 0;
|
||||
#ifdef RASPBERRY
|
||||
p->pandora_custom_dpad = 1;
|
||||
#else
|
||||
p->pandora_custom_dpad = 0;
|
||||
#endif
|
||||
p->pandora_custom_up = 0;
|
||||
p->pandora_custom_down = 0;
|
||||
p->pandora_custom_left = 0;
|
||||
p->pandora_custom_right = 0;
|
||||
p->pandora_custom_A = 0;
|
||||
p->pandora_custom_B = 0;
|
||||
p->pandora_custom_X = 0;
|
||||
p->pandora_custom_Y = 0;
|
||||
p->pandora_custom_L = 0;
|
||||
p->pandora_custom_R = 0;
|
||||
p->pandora_customControls = 0;
|
||||
|
||||
p->pandora_button1 = GP2X_BUTTON_X;
|
||||
p->pandora_button2 = GP2X_BUTTON_A;
|
||||
p->pandora_autofireButton1 = GP2X_BUTTON_B;
|
||||
p->pandora_jump = -1;
|
||||
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8;
|
||||
|
||||
p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5 | RGBFF_R8G8B8A8;
|
||||
memset(customControlMap, 0, sizeof(customControlMap));
|
||||
}
|
||||
|
||||
|
||||
|
@ -349,27 +316,20 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
|
|||
{
|
||||
cfgfile_write (f, "pandora.cpu_speed", "%d", p->pandora_cpu_speed);
|
||||
cfgfile_write (f, "pandora.hide_idle_led", "%d", p->pandora_hide_idle_led);
|
||||
cfgfile_write (f, "pandora.joy_conf", "%d", p->pandora_joyConf);
|
||||
cfgfile_write (f, "pandora.joy_port", "%d", p->pandora_joyPort);
|
||||
cfgfile_write (f, "pandora.tap_delay", "%d", p->pandora_tapDelay);
|
||||
cfgfile_write (f, "pandora.custom_controls", "%d", p->pandora_customControls);
|
||||
cfgfile_write (f, "pandora.custom_dpad", "%d", p->pandora_custom_dpad);
|
||||
cfgfile_write (f, "pandora.custom_up", "%d", p->pandora_custom_up);
|
||||
cfgfile_write (f, "pandora.custom_down", "%d", p->pandora_custom_down);
|
||||
cfgfile_write (f, "pandora.custom_left", "%d", p->pandora_custom_left);
|
||||
cfgfile_write (f, "pandora.custom_right", "%d", p->pandora_custom_right);
|
||||
cfgfile_write (f, "pandora.custom_a", "%d", p->pandora_custom_A);
|
||||
cfgfile_write (f, "pandora.custom_b", "%d", p->pandora_custom_B);
|
||||
cfgfile_write (f, "pandora.custom_x", "%d", p->pandora_custom_X);
|
||||
cfgfile_write (f, "pandora.custom_y", "%d", p->pandora_custom_Y);
|
||||
cfgfile_write (f, "pandora.custom_l", "%d", p->pandora_custom_L);
|
||||
cfgfile_write (f, "pandora.custom_r", "%d", p->pandora_custom_R);
|
||||
cfgfile_write (f, "pandora.custom_up", "%d", customControlMap[SDLK_UP]);
|
||||
cfgfile_write (f, "pandora.custom_down", "%d", customControlMap[SDLK_DOWN]);
|
||||
cfgfile_write (f, "pandora.custom_left", "%d", customControlMap[SDLK_LEFT]);
|
||||
cfgfile_write (f, "pandora.custom_right", "%d", customControlMap[SDLK_RIGHT]);
|
||||
cfgfile_write (f, "pandora.custom_a", "%d", customControlMap[SDLK_HOME]);
|
||||
cfgfile_write (f, "pandora.custom_b", "%d", customControlMap[SDLK_END]);
|
||||
cfgfile_write (f, "pandora.custom_x", "%d", customControlMap[SDLK_PAGEDOWN]);
|
||||
cfgfile_write (f, "pandora.custom_y", "%d", customControlMap[SDLK_PAGEUP]);
|
||||
cfgfile_write (f, "pandora.custom_l", "%d", customControlMap[SDLK_RSHIFT]);
|
||||
cfgfile_write (f, "pandora.custom_r", "%d", customControlMap[SDLK_RCTRL]);
|
||||
cfgfile_write (f, "pandora.move_x", "%d", p->pandora_horizontal_offset);
|
||||
cfgfile_write (f, "pandora.move_y", "%d", p->pandora_vertical_offset);
|
||||
cfgfile_write (f, "pandora.button1", "%d", p->pandora_button1);
|
||||
cfgfile_write (f, "pandora.button2", "%d", p->pandora_button2);
|
||||
cfgfile_write (f, "pandora.autofire_button", "%d", p->pandora_autofireButton1);
|
||||
cfgfile_write (f, "pandora.jump", "%d", p->pandora_jump);
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,31 +342,31 @@ int target_parse_option (struct uae_prefs *p, const char *option, const char *va
|
|||
{
|
||||
int result = (cfgfile_intval (option, value, "cpu_speed", &p->pandora_cpu_speed, 1)
|
||||
|| cfgfile_intval (option, value, "hide_idle_led", &p->pandora_hide_idle_led, 1)
|
||||
|| cfgfile_intval (option, value, "joy_conf", &p->pandora_joyConf, 1)
|
||||
|| cfgfile_intval (option, value, "joy_port", &p->pandora_joyPort, 1)
|
||||
|| cfgfile_intval (option, value, "tap_delay", &p->pandora_tapDelay, 1)
|
||||
|| cfgfile_intval (option, value, "custom_controls", &p->pandora_customControls, 1)
|
||||
|| cfgfile_intval (option, value, "custom_dpad", &p->pandora_custom_dpad, 1)
|
||||
|| cfgfile_intval (option, value, "custom_up", &p->pandora_custom_up, 1)
|
||||
|| cfgfile_intval (option, value, "custom_down", &p->pandora_custom_down, 1)
|
||||
|| cfgfile_intval (option, value, "custom_left", &p->pandora_custom_left, 1)
|
||||
|| cfgfile_intval (option, value, "custom_right", &p->pandora_custom_right, 1)
|
||||
|| cfgfile_intval (option, value, "custom_a", &p->pandora_custom_A, 1)
|
||||
|| cfgfile_intval (option, value, "custom_b", &p->pandora_custom_B, 1)
|
||||
|| cfgfile_intval (option, value, "custom_x", &p->pandora_custom_X, 1)
|
||||
|| cfgfile_intval (option, value, "custom_y", &p->pandora_custom_Y, 1)
|
||||
|| cfgfile_intval (option, value, "custom_l", &p->pandora_custom_L, 1)
|
||||
|| cfgfile_intval (option, value, "custom_r", &p->pandora_custom_R, 1)
|
||||
|| cfgfile_intval (option, value, "custom_up", &customControlMap[SDLK_UP], 1)
|
||||
|| cfgfile_intval (option, value, "custom_down", &customControlMap[SDLK_DOWN], 1)
|
||||
|| cfgfile_intval (option, value, "custom_left", &customControlMap[SDLK_LEFT], 1)
|
||||
|| cfgfile_intval (option, value, "custom_right", &customControlMap[SDLK_RIGHT], 1)
|
||||
|| cfgfile_intval (option, value, "custom_a", &customControlMap[SDLK_HOME], 1)
|
||||
|| cfgfile_intval (option, value, "custom_b", &customControlMap[SDLK_END], 1)
|
||||
|| cfgfile_intval (option, value, "custom_x", &customControlMap[SDLK_PAGEDOWN], 1)
|
||||
|| cfgfile_intval (option, value, "custom_y", &customControlMap[SDLK_PAGEUP], 1)
|
||||
|| cfgfile_intval (option, value, "custom_l", &customControlMap[SDLK_RSHIFT], 1)
|
||||
|| cfgfile_intval (option, value, "custom_r", &customControlMap[SDLK_RCTRL], 1)
|
||||
|| cfgfile_intval (option, value, "move_x", &p->pandora_horizontal_offset, 1)
|
||||
|| cfgfile_intval (option, value, "move_y", &p->pandora_vertical_offset, 1)
|
||||
|| cfgfile_intval (option, value, "button1", &p->pandora_button1, 1)
|
||||
|| cfgfile_intval (option, value, "button2", &p->pandora_button2, 1)
|
||||
|| cfgfile_intval (option, value, "autofire_button", &p->pandora_autofireButton1, 1)
|
||||
|| cfgfile_intval (option, value, "jump", &p->pandora_jump, 1)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void fetch_datapath (char *out, int size)
|
||||
{
|
||||
strncpy(out, start_path_data, size);
|
||||
strncat(out, "/", size);
|
||||
}
|
||||
|
||||
|
||||
void fetch_saveimagepath (char *out, int size, int dir)
|
||||
{
|
||||
strncpy(out, start_path_data, size);
|
||||
|
@ -463,7 +423,11 @@ int target_cfgfile_load (struct uae_prefs *p, const char *filename, int type, in
|
|||
int i;
|
||||
int result = 0;
|
||||
|
||||
if(emulating && changed_prefs.cdslots[0].inuse)
|
||||
gui_force_rtarea_hdchange();
|
||||
|
||||
discard_prefs(p, type);
|
||||
default_prefs(p, 0);
|
||||
|
||||
char *ptr = strstr(filename, ".rp9");
|
||||
if(ptr > 0)
|
||||
|
@ -471,10 +435,7 @@ int target_cfgfile_load (struct uae_prefs *p, const char *filename, int type, in
|
|||
// Load rp9 config
|
||||
result = rp9_parse_file(p, filename);
|
||||
if(result)
|
||||
{
|
||||
set_joyConf(p);
|
||||
extractFileName(filename, last_loaded_config);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -485,10 +446,7 @@ int target_cfgfile_load (struct uae_prefs *p, const char *filename, int type, in
|
|||
result = cfgfile_load(p, filename, &type, 0, 1);
|
||||
}
|
||||
if(result)
|
||||
{
|
||||
set_joyConf(p);
|
||||
extractFileName(filename, last_loaded_config);
|
||||
}
|
||||
else
|
||||
result = loadconfig_old(p, filename);
|
||||
}
|
||||
|
@ -504,10 +462,11 @@ int target_cfgfile_load (struct uae_prefs *p, const char *filename, int type, in
|
|||
AddFileToDiskList(p->floppyslots[i].df, 1);
|
||||
}
|
||||
|
||||
inputdevice_updateconfig (p);
|
||||
|
||||
SetLastActiveConfig(filename);
|
||||
if(!isdefault)
|
||||
inputdevice_updateconfig (p);
|
||||
|
||||
SetLastActiveConfig(filename);
|
||||
|
||||
if(count_HDs(p) > 0) // When loading a config with HDs, always do a hardreset
|
||||
gui_force_rtarea_hdchange();
|
||||
}
|
||||
|
@ -652,6 +611,14 @@ void saveAdfDir(void)
|
|||
fputs(buffer, f);
|
||||
}
|
||||
|
||||
snprintf(buffer, MAX_DPATH, "MRUCDList=%d\n", lstMRUCDList.size());
|
||||
fputs(buffer, f);
|
||||
for(i=0; i<lstMRUCDList.size(); ++i)
|
||||
{
|
||||
snprintf(buffer, MAX_DPATH, "CDfile=%s\n", lstMRUCDList[i].c_str());
|
||||
fputs(buffer, f);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return;
|
||||
}
|
||||
|
@ -721,6 +688,22 @@ void loadAdfDir(void)
|
|||
lstMRUDiskList.push_back(disk);
|
||||
}
|
||||
}
|
||||
|
||||
lstMRUCDList.clear();
|
||||
int numCD = 0;
|
||||
char cd[MAX_PATH];
|
||||
fscanf(f1, "MRUCDList=%d\n", &numCD);
|
||||
for(i=0; i<numCD; ++i)
|
||||
{
|
||||
fscanf(f1, "CDfile=");
|
||||
get_string(f1, cd, sizeof(cd));
|
||||
FILE *f = fopen(cd, "rb");
|
||||
if(f != NULL)
|
||||
{
|
||||
fclose(f);
|
||||
lstMRUCDList.push_back(cd);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f1);
|
||||
}
|
||||
|
@ -729,12 +712,9 @@ void loadAdfDir(void)
|
|||
|
||||
void setCpuSpeed()
|
||||
{
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
char speedCmd[128];
|
||||
|
||||
#ifndef PANDORA_SPECIFIC
|
||||
return;
|
||||
#endif
|
||||
|
||||
currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed;
|
||||
|
||||
if(currprefs.pandora_cpu_speed != lastCpuSpeed)
|
||||
|
@ -751,7 +731,12 @@ void setCpuSpeed()
|
|||
else
|
||||
system("sudo /usr/pandora/scripts/op_lcdrate.sh 50");
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int getDefaultCpuSpeed(void)
|
||||
{
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
|
@ -777,7 +762,7 @@ int getDefaultCpuSpeed(void)
|
|||
}
|
||||
return speed;
|
||||
#else
|
||||
return;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -790,7 +775,6 @@ void resetCpuSpeed(void)
|
|||
lastCpuSpeed = defaultCpuSpeed - 10;
|
||||
currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed = defaultCpuSpeed;
|
||||
setCpuSpeed();
|
||||
printf("CPU speed reset to %d\n", defaultCpuSpeed);
|
||||
}
|
||||
#else
|
||||
return;
|
||||
|
@ -849,7 +833,8 @@ int main (int argc, char *argv[])
|
|||
|
||||
alloc_AmigaMem();
|
||||
RescanROMs();
|
||||
|
||||
|
||||
keyboard_settrans();
|
||||
real_main (argc, argv);
|
||||
|
||||
ClearAvailableROMList();
|
||||
|
@ -857,6 +842,7 @@ int main (int argc, char *argv[])
|
|||
free_keyring();
|
||||
free_AmigaMem();
|
||||
lstMRUDiskList.clear();
|
||||
lstMRUCDList.clear();
|
||||
rp9_cleanup();
|
||||
|
||||
logging_cleanup();
|
||||
|
@ -868,289 +854,181 @@ int main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
void keyboard_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 256; i--;)
|
||||
uae4all_keystate[i] = 0;
|
||||
shiftWasPressed = 0;
|
||||
}
|
||||
|
||||
|
||||
void handle_events (void)
|
||||
int handle_msgpump (void)
|
||||
{
|
||||
int got = 0;
|
||||
SDL_Event rEvent;
|
||||
int iAmigaKeyCode;
|
||||
int i, j;
|
||||
int iIsHotKey = 0;
|
||||
|
||||
/* Handle GUI events */
|
||||
gui_handle_events ();
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if (currprefs.pandora_custom_dpad == 1)
|
||||
handle_joymouse();
|
||||
else if(currprefs.input_tablet > TABLET_OFF) {
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
setmousestate(0, 0, x, 1);
|
||||
setmousestate(0, 1, y, 1);
|
||||
int keycode;
|
||||
int modifier;
|
||||
|
||||
if(delayed_mousebutton) {
|
||||
--delayed_mousebutton;
|
||||
if(delayed_mousebutton == 0)
|
||||
setmousebuttonstate (0, 0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (SDL_PollEvent(&rEvent))
|
||||
{
|
||||
|
||||
while (SDL_PollEvent(&rEvent)) {
|
||||
got = 1;
|
||||
|
||||
switch (rEvent.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
uae_quit();
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
if(rEvent.key.keysym.sym==SDLK_PAGEUP)
|
||||
slow_mouse=true;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if(currprefs.pandora_custom_dpad == 1) // dPad as mouse, why these emulation of key presses?
|
||||
{
|
||||
if(rEvent.key.keysym.sym==SDLK_RSHIFT)
|
||||
{
|
||||
uae4all_keystate[AK_LALT] = 1;
|
||||
record_key(AK_LALT << 1);
|
||||
}
|
||||
if(rEvent.key.keysym.sym==SDLK_RCTRL || rEvent.key.keysym.sym==SDLK_END || rEvent.key.keysym.sym==SDLK_HOME)
|
||||
{
|
||||
uae4all_keystate[AK_RALT] = 1;
|
||||
record_key(AK_RALT << 1);
|
||||
}
|
||||
if(rEvent.key.keysym.sym==SDLK_PAGEDOWN)
|
||||
{
|
||||
uae4all_keystate[AK_DN] = 1;
|
||||
record_key(AK_DN << 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rEvent.key.keysym.sym==currprefs.key_for_input_switching)
|
||||
{
|
||||
// state moves thus:
|
||||
// joystick mode
|
||||
// mouse mode (with mouse buttons on L and R)
|
||||
// remapping mode (with whatever's been supplied)
|
||||
// back to start of state
|
||||
|
||||
currprefs.pandora_custom_dpad++;
|
||||
#ifdef RASPBERRY
|
||||
if(currprefs.pandora_custom_dpad > 1)
|
||||
#else
|
||||
if(currprefs.pandora_custom_dpad > 2)
|
||||
#endif
|
||||
currprefs.pandora_custom_dpad = 0;
|
||||
changed_prefs.pandora_custom_dpad = currprefs.pandora_custom_dpad;
|
||||
|
||||
show_inputmode = 1;
|
||||
}
|
||||
|
||||
if (rEvent.key.keysym.sym==SDLK_RSHIFT || rEvent.key.keysym.sym==SDLK_RCTRL)
|
||||
doStylusRightClick = 1;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if (rEvent.key.keysym.sym!=SDLK_UP && rEvent.key.keysym.sym!=SDLK_DOWN && rEvent.key.keysym.sym!=SDLK_LEFT &&
|
||||
rEvent.key.keysym.sym!=SDLK_RIGHT && rEvent.key.keysym.sym!=SDLK_PAGEUP && rEvent.key.keysym.sym!=SDLK_PAGEDOWN &&
|
||||
rEvent.key.keysym.sym!=SDLK_HOME && rEvent.key.keysym.sym!=SDLK_END && rEvent.key.keysym.sym!=SDLK_LALT &&
|
||||
rEvent.key.keysym.sym!=SDLK_LCTRL && rEvent.key.keysym.sym!=SDLK_RSHIFT && rEvent.key.keysym.sym!=SDLK_RCTRL)
|
||||
#endif
|
||||
{
|
||||
iAmigaKeyCode = keycode2amiga(&(rEvent.key.keysym));
|
||||
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
|
||||
if (iAmigaKeyCode == AK_CAPSLOCK && uae4all_keystate[AK_CAPSLOCK] == 1) {iAmigaKeyCode = -1; capslock = 1;}
|
||||
#endif
|
||||
if (iAmigaKeyCode >= 0)
|
||||
{
|
||||
#ifdef PANDORA
|
||||
if(iAmigaKeyCode & SIMULATE_SHIFT)
|
||||
{
|
||||
// We need to simulate shift
|
||||
iAmigaKeyCode = iAmigaKeyCode & 0x1ff;
|
||||
shiftWasPressed = uae4all_keystate[AK_LSH];
|
||||
if(!shiftWasPressed)
|
||||
{
|
||||
uae4all_keystate[AK_LSH] = 1;
|
||||
record_key(AK_LSH << 1);
|
||||
}
|
||||
}
|
||||
if(iAmigaKeyCode & SIMULATE_RELEASED_SHIFT)
|
||||
{
|
||||
// We need to simulate released shift
|
||||
iAmigaKeyCode = iAmigaKeyCode & 0x1ff;
|
||||
shiftWasPressed = uae4all_keystate[AK_LSH];
|
||||
if(shiftWasPressed)
|
||||
{
|
||||
uae4all_keystate[AK_LSH] = 0;
|
||||
record_key((AK_LSH << 1) | 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!uae4all_keystate[iAmigaKeyCode])
|
||||
{
|
||||
uae4all_keystate[iAmigaKeyCode] = 1;
|
||||
record_key(iAmigaKeyCode << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
if(rEvent.key.keysym.sym==SDLK_PAGEUP)
|
||||
slow_mouse = false;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if(currprefs.pandora_custom_dpad == 1) // dPad as mouse, why these emulation of key presses?
|
||||
{
|
||||
if(rEvent.key.keysym.sym==SDLK_RSHIFT)
|
||||
{
|
||||
uae4all_keystate[AK_LALT] = 0;
|
||||
record_key((AK_LALT << 1) | 1);
|
||||
}
|
||||
if(rEvent.key.keysym.sym==SDLK_RCTRL || rEvent.key.keysym.sym==SDLK_END || rEvent.key.keysym.sym==SDLK_HOME)
|
||||
{
|
||||
uae4all_keystate[AK_RALT] = 0;
|
||||
record_key((AK_RALT << 1) | 1);
|
||||
}
|
||||
if(rEvent.key.keysym.sym==SDLK_PAGEDOWN)
|
||||
{
|
||||
uae4all_keystate[AK_DN] = 0;
|
||||
record_key((AK_DN << 1) | 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rEvent.key.keysym.sym==SDLK_RSHIFT || rEvent.key.keysym.sym==SDLK_RCTRL)
|
||||
{
|
||||
doStylusRightClick = 0;
|
||||
mouseMoving = 0;
|
||||
justClicked = 0;
|
||||
fcounter = 0;
|
||||
buttonstate[2] = 0;
|
||||
}
|
||||
|
||||
if (rEvent.key.keysym.sym==currprefs.key_for_input_switching)
|
||||
{
|
||||
show_inputmode = 0;
|
||||
}
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if (rEvent.key.keysym.sym!=SDLK_UP && rEvent.key.keysym.sym!=SDLK_DOWN && rEvent.key.keysym.sym!=SDLK_LEFT &&
|
||||
rEvent.key.keysym.sym!=SDLK_RIGHT && rEvent.key.keysym.sym!=SDLK_PAGEUP && rEvent.key.keysym.sym!=SDLK_PAGEDOWN &&
|
||||
rEvent.key.keysym.sym!=SDLK_HOME && rEvent.key.keysym.sym!=SDLK_END && rEvent.key.keysym.sym!=SDLK_LALT &&
|
||||
rEvent.key.keysym.sym!=SDLK_LCTRL && rEvent.key.keysym.sym!=SDLK_RSHIFT && rEvent.key.keysym.sym!=SDLK_RCTRL)
|
||||
#endif
|
||||
{
|
||||
iAmigaKeyCode = keycode2amiga(&(rEvent.key.keysym));
|
||||
#ifdef CAPSLOCK_DEBIAN_WORKAROUND
|
||||
if (iAmigaKeyCode == AK_CAPSLOCK) if (capslock==0) iAmigaKeyCode = -1; else capslock = 0;
|
||||
#endif
|
||||
if (iAmigaKeyCode >= 0)
|
||||
{
|
||||
#ifdef PANDORA
|
||||
if(iAmigaKeyCode & SIMULATE_SHIFT)
|
||||
{
|
||||
// We needed to simulate shift
|
||||
iAmigaKeyCode = iAmigaKeyCode & 0x1ff;
|
||||
if(!shiftWasPressed)
|
||||
{
|
||||
uae4all_keystate[AK_LSH] = 0;
|
||||
record_key((AK_LSH << 1) | 1);
|
||||
shiftWasPressed = 0;
|
||||
}
|
||||
}
|
||||
if(iAmigaKeyCode & SIMULATE_RELEASED_SHIFT)
|
||||
{
|
||||
// We needed to simulate released shift
|
||||
iAmigaKeyCode = iAmigaKeyCode & 0x1ff;
|
||||
if(shiftWasPressed)
|
||||
{
|
||||
uae4all_keystate[AK_LSH] = 1;
|
||||
record_key(AK_LSH << 1);
|
||||
shiftWasPressed = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
uae4all_keystate[iAmigaKeyCode] = 0;
|
||||
record_key((iAmigaKeyCode << 1) | 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (currprefs.pandora_custom_dpad < 2)
|
||||
buttonstate[(rEvent.button.button-1)%3] = 1;
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (currprefs.pandora_custom_dpad < 2)
|
||||
buttonstate[(rEvent.button.button-1)%3] = 0;
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
|
||||
if(rEvent.key.keysym.sym == currprefs.key_for_menu)
|
||||
inputdevice_add_inputcode (AKS_ENTERGUI, 1);
|
||||
switch(rEvent.key.keysym.sym)
|
||||
{
|
||||
|
||||
case SDLK_LSHIFT: // Shift key
|
||||
inputdevice_do_keyboard(AK_LSH, 1);
|
||||
break;
|
||||
|
||||
case SDLK_RSHIFT: // Left shoulder button
|
||||
case SDLK_RCTRL: // Right shoulder button
|
||||
if(currprefs.input_tablet > TABLET_OFF) {
|
||||
// Holding left or right shoulder button -> stylus does right mousebutton
|
||||
doStylusRightClick = 1;
|
||||
}
|
||||
// Fall through...
|
||||
|
||||
default:
|
||||
if(currprefs.pandora_customControls) {
|
||||
keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
if(keycode < 0) {
|
||||
// Simulate mouse or joystick
|
||||
SimulateMouseOrJoy(keycode, 1);
|
||||
break;
|
||||
}
|
||||
else if(keycode > 0) {
|
||||
// Send mapped key press
|
||||
inputdevice_do_keyboard(keycode, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
modifier = rEvent.key.keysym.mod;
|
||||
keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier);
|
||||
if(keycode)
|
||||
{
|
||||
if(modifier == KMOD_SHIFT)
|
||||
inputdevice_do_keyboard(AK_LSH, 1);
|
||||
else
|
||||
inputdevice_do_keyboard(AK_LSH, 0);
|
||||
inputdevice_do_keyboard(keycode, 1);
|
||||
} else {
|
||||
inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
switch(rEvent.key.keysym.sym)
|
||||
{
|
||||
|
||||
case SDLK_LSHIFT: // Shift key
|
||||
inputdevice_do_keyboard(AK_LSH, 0);
|
||||
break;
|
||||
|
||||
case SDLK_RSHIFT: // Left shoulder button
|
||||
case SDLK_RCTRL: // Right shoulder button
|
||||
if(currprefs.input_tablet > TABLET_OFF) {
|
||||
// Release left or right shoulder button -> stylus does left mousebutton
|
||||
doStylusRightClick = 0;
|
||||
}
|
||||
// Fall through...
|
||||
|
||||
default:
|
||||
if(currprefs.pandora_customControls) {
|
||||
keycode = customControlMap[rEvent.key.keysym.sym];
|
||||
if(keycode < 0) {
|
||||
// Simulate mouse or joystick
|
||||
SimulateMouseOrJoy(keycode, 0);
|
||||
break;
|
||||
}
|
||||
else if(keycode > 0) {
|
||||
// Send mapped key release
|
||||
inputdevice_do_keyboard(keycode, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
modifier = rEvent.key.keysym.mod;
|
||||
keycode = translate_pandora_keys(rEvent.key.keysym.sym, &modifier);
|
||||
if(keycode)
|
||||
{
|
||||
inputdevice_do_keyboard(keycode, 0);
|
||||
if(modifier == KMOD_SHIFT)
|
||||
inputdevice_do_keyboard(AK_LSH, 0);
|
||||
} else {
|
||||
inputdevice_translatekeycode(0, rEvent.key.keysym.sym, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if(currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) {
|
||||
if(rEvent.button.button == SDL_BUTTON_LEFT) {
|
||||
if(currprefs.input_tablet > TABLET_OFF && !doStylusRightClick) {
|
||||
// Delay mousebutton, we need new position first...
|
||||
delayed_mousebutton = currprefs.pandora_tapDelay << 1;
|
||||
} else {
|
||||
setmousebuttonstate (0, doStylusRightClick, 1);
|
||||
}
|
||||
}
|
||||
else if(rEvent.button.button == SDL_BUTTON_RIGHT)
|
||||
setmousebuttonstate (0, 1, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if(currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) {
|
||||
if(rEvent.button.button == SDL_BUTTON_LEFT) {
|
||||
setmousebuttonstate (0, doStylusRightClick, 0);
|
||||
}
|
||||
else if(rEvent.button.button == SDL_BUTTON_RIGHT)
|
||||
setmousebuttonstate (0, 1, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
if(currprefs.input_tablet == TABLET_OFF) {
|
||||
int x, y;
|
||||
int mouseScale = slow_mouse ? 1 : currprefs.input_joymouse_multiplier / 2;
|
||||
x = rEvent.motion.xrel;
|
||||
y = rEvent.motion.yrel;
|
||||
if(currprefs.jports[0].id == JSEM_MICE || currprefs.jports[1].id == JSEM_MICE) {
|
||||
int x, y;
|
||||
int mouseScale = currprefs.input_joymouse_multiplier / 2;
|
||||
x = rEvent.motion.xrel;
|
||||
y = rEvent.motion.yrel;
|
||||
#ifdef PANDORA_SPECIFIC
|
||||
if(rEvent.motion.x == 0 && x > -4)
|
||||
x = -4;
|
||||
if(rEvent.motion.y == 0 && y > -4)
|
||||
y = -4;
|
||||
if(rEvent.motion.x == currprefs.gfx_size.width - 1 && x < 4)
|
||||
x = 4;
|
||||
if(rEvent.motion.y == currprefs.gfx_size.height - 1 && y < 4)
|
||||
y = 4;
|
||||
if(rEvent.motion.x == 0 && x > -4)
|
||||
x = -4;
|
||||
if(rEvent.motion.y == 0 && y > -4)
|
||||
y = -4;
|
||||
if(rEvent.motion.x == currprefs.gfx_size.width - 1 && x < 4)
|
||||
x = 4;
|
||||
if(rEvent.motion.y == currprefs.gfx_size.height - 1 && y < 4)
|
||||
y = 4;
|
||||
#endif
|
||||
setmousestate(0, 0, x * mouseScale, 0);
|
||||
setmousestate(0, 1, y * mouseScale, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */
|
||||
// Handle custom only for first joystick
|
||||
if (rEvent.jbutton.which != 0)
|
||||
break;
|
||||
if (rEvent.jbutton.button == 8) JoystickQuit[0] = 1; //Next if statements are for buttons 8 & 9 together to quit emulator
|
||||
if (rEvent.jbutton.button == 9) JoystickQuit[1] = 1;
|
||||
if (JoystickQuit[0] && JoystickQuit[1])
|
||||
{
|
||||
JoystickQuit[0] = 0;
|
||||
JoystickQuit[1] = 0;
|
||||
uae_quit();
|
||||
break;
|
||||
}
|
||||
if (rEvent.jbutton.button > 5 && currprefs.pandora_custom_dpad < 3) break; //Ignore buttons num above 5 if Custom DPad is not on special
|
||||
if ((rEvent.jbutton.button == 0 || rEvent.jbutton.button == 1) && !currprefs.pandora_customControls) break; //Ignore buttons 0 & 1 if custom controls are not active to stop double triggering
|
||||
JoystickButton[rEvent.jbutton.button] = 1;
|
||||
break;
|
||||
|
||||
case SDL_JOYBUTTONUP: /* Handle Joystick Button Releases */
|
||||
// Handle custom only for first joystick
|
||||
if (rEvent.jbutton.which != 0)
|
||||
break;
|
||||
if (rEvent.jbutton.button == 8) JoystickQuit[0] = 0;
|
||||
if (rEvent.jbutton.button == 9) JoystickQuit[1] = 0;
|
||||
if (rEvent.jbutton.button > 5 && currprefs.pandora_custom_dpad < 3) break; //Ignore buttons num above 5 if Custom DPad is not on special
|
||||
if ((rEvent.jbutton.button == 0 || rEvent.jbutton.button == 1) && !currprefs.pandora_customControls) break; //Ignore buttons 0 & 1 if custom controls are not active to stop double triggering
|
||||
JoystickButton[rEvent.jbutton.button] = 0;
|
||||
break;
|
||||
|
||||
if (currprefs.pandora_custom_dpad == 2 )
|
||||
{
|
||||
case SDL_JOYHATMOTION:
|
||||
// Handle custom only for first joystick
|
||||
if (rEvent.jbutton.which != 0)
|
||||
break;
|
||||
if (rEvent.jhat.value & SDL_HAT_UP) JoystickButton[6] = 1; else JoystickButton[6] = 0;
|
||||
if (rEvent.jhat.value & SDL_HAT_DOWN) JoystickButton[7] = 1; else JoystickButton[7] = 0;
|
||||
if (rEvent.jhat.value & SDL_HAT_LEFT) JoystickButton[8] = 1; else JoystickButton[8] = 0;
|
||||
if (rEvent.jhat.value & SDL_HAT_RIGHT) JoystickButton[9] = 1; else JoystickButton[9] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
setmousestate(0, 0, x * mouseScale, 0);
|
||||
setmousestate(0, 1, y * mouseScale, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return got;
|
||||
}
|
||||
|
||||
|
||||
void handle_events (void)
|
||||
{
|
||||
/* Handle GUI events */
|
||||
gui_handle_events ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,17 @@
|
|||
#include "zfile.h"
|
||||
|
||||
|
||||
int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur)
|
||||
{
|
||||
int ret = 0;
|
||||
if (oldcur)
|
||||
getcwd(oldcur, MAX_DPATH);
|
||||
if (curdir)
|
||||
chdir (curdir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int my_mkdir (const char*name)
|
||||
{
|
||||
return mkdir(name, 0777);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "xwin.h"
|
||||
#include "drawing.h"
|
||||
#include "inputdevice.h"
|
||||
#include "od-pandora/inputmode.h"
|
||||
#include "savestate.h"
|
||||
#include "picasso96.h"
|
||||
|
||||
|
@ -24,8 +23,6 @@
|
|||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
extern int stylusClickOverride;
|
||||
|
||||
|
||||
/* SDL variable for output of emulation */
|
||||
SDL_Surface *prSDLScreen = NULL;
|
||||
|
@ -43,8 +40,6 @@ struct MultiDisplay Displays[MAX_DISPLAYS];
|
|||
|
||||
int screen_is_picasso = 0;
|
||||
|
||||
static int curr_layer_width = 0;
|
||||
|
||||
static SDL_Surface *current_screenshot = NULL;
|
||||
static char screenshot_filename_default[255]={
|
||||
'/', 't', 'm', 'p', '/', 'n', 'u', 'l', 'l', '.', 'p', 'n', 'g', '\0'
|
||||
|
@ -63,11 +58,6 @@ int delay_savestate_frame = 0;
|
|||
#endif
|
||||
|
||||
|
||||
int justClicked = 0;
|
||||
int mouseMoving = 0;
|
||||
int fcounter = 0;
|
||||
int doStylusRightClick = 0;
|
||||
|
||||
static unsigned long previous_synctime = 0;
|
||||
static unsigned long next_synctime = 0;
|
||||
|
||||
|
@ -169,15 +159,6 @@ static void CalcPandoraWidth(struct uae_prefs *p)
|
|||
}
|
||||
|
||||
|
||||
void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp)
|
||||
{
|
||||
*dxp = 0;
|
||||
*dyp = 0;
|
||||
*mxp = 1;
|
||||
*myp = 1;
|
||||
}
|
||||
|
||||
|
||||
static void open_screen(struct uae_prefs *p)
|
||||
{
|
||||
char layersize[20];
|
||||
|
@ -187,13 +168,11 @@ static void open_screen(struct uae_prefs *p)
|
|||
if(!screen_is_picasso)
|
||||
{
|
||||
CalcPandoraWidth(p);
|
||||
if(curr_layer_width != p->gfx_size_fs.width)
|
||||
{
|
||||
snprintf(layersize, 20, "%dx480", p->gfx_size_fs.width);
|
||||
|
||||
snprintf(layersize, 20, "%dx480", p->gfx_size_fs.width);
|
||||
#ifndef WIN32
|
||||
setenv("SDL_OMAP_LAYER_SIZE", layersize, 1);
|
||||
setenv("SDL_OMAP_LAYER_SIZE", layersize, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -235,8 +214,6 @@ static void open_screen(struct uae_prefs *p)
|
|||
{
|
||||
InitAmigaVidMode(p);
|
||||
init_row_map();
|
||||
|
||||
inputdevice_mouselimit(prSDLScreen->w, prSDLScreen->h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,9 +279,6 @@ void unlockscr (void)
|
|||
|
||||
void flush_screen ()
|
||||
{
|
||||
if (show_inputmode)
|
||||
inputmode_redraw();
|
||||
|
||||
if (savestate_state == STATE_DOSAVE)
|
||||
{
|
||||
if(delay_savestate_frame > 0)
|
||||
|
@ -342,40 +316,6 @@ void flush_screen ()
|
|||
next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
|
||||
|
||||
init_row_map();
|
||||
|
||||
if(stylusClickOverride)
|
||||
{
|
||||
justClicked = 0;
|
||||
mouseMoving = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(justClicked)
|
||||
{
|
||||
buttonstate[0] = 0;
|
||||
buttonstate[2] = 0;
|
||||
justClicked = 0;
|
||||
}
|
||||
|
||||
if(mouseMoving)
|
||||
{
|
||||
if(fcounter >= currprefs.pandora_tapDelay)
|
||||
{
|
||||
if(doStylusRightClick)
|
||||
{
|
||||
buttonstate[2] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonstate[0] = 1;
|
||||
mouseMoving = 0;
|
||||
justClicked = 1;
|
||||
fcounter = 0;
|
||||
}
|
||||
}
|
||||
fcounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,15 +427,10 @@ int GetSurfacePixelFormat(void)
|
|||
|
||||
int graphics_init (void)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
graphics_subinit ();
|
||||
|
||||
if (!init_colors ())
|
||||
return 0;
|
||||
|
||||
buttonstate[0] = buttonstate[1] = buttonstate[2] = 0;
|
||||
keyboard_init();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -617,6 +552,7 @@ static int save_thumb(char *path)
|
|||
|
||||
#ifdef PICASSO96
|
||||
|
||||
|
||||
int picasso_palette (void)
|
||||
{
|
||||
int i, changed;
|
||||
|
|
File diff suppressed because it is too large
Load diff
486
src/od-pandora/pandora_input.cpp
Normal file
486
src/od-pandora/pandora_input.cpp
Normal file
|
@ -0,0 +1,486 @@
|
|||
#include "sysconfig.h"
|
||||
#include "sysdeps.h"
|
||||
#include "options.h"
|
||||
#include "keyboard.h"
|
||||
#include "inputdevice.h"
|
||||
#include <SDL.h>
|
||||
|
||||
|
||||
static int joyXviaCustom = 0;
|
||||
static int joyYviaCustom = 0;
|
||||
static int joyBut1viaCustom = 0;
|
||||
static int joyBut2viaCustom = 0;
|
||||
static int mouseBut1viaCustom = 0;
|
||||
static int mouseBut2viaCustom = 0;
|
||||
|
||||
|
||||
#define MAX_MOUSE_BUTTONS 2
|
||||
#define MAX_MOUSE_AXES 2
|
||||
#define FIRST_MOUSE_AXIS 0
|
||||
#define FIRST_MOUSE_BUTTON MAX_MOUSE_AXES
|
||||
|
||||
|
||||
static int init_mouse (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void close_mouse (void)
|
||||
{
|
||||
}
|
||||
|
||||
static int acquire_mouse (int num, int flags)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void unacquire_mouse (int num)
|
||||
{
|
||||
}
|
||||
|
||||
static int get_mouse_num (void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static TCHAR *get_mouse_friendlyname (int mouse)
|
||||
{
|
||||
if(mouse == 0)
|
||||
return "Nubs as mouse";
|
||||
else
|
||||
return "dPad as mouse";
|
||||
}
|
||||
|
||||
static TCHAR *get_mouse_uniquename (int mouse)
|
||||
{
|
||||
if(mouse == 0)
|
||||
return "MOUSE0";
|
||||
else
|
||||
return "MOUSE1";
|
||||
}
|
||||
|
||||
static int get_mouse_widget_num (int mouse)
|
||||
{
|
||||
return MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS;
|
||||
}
|
||||
|
||||
static int get_mouse_widget_first (int mouse, int type)
|
||||
{
|
||||
switch (type) {
|
||||
case IDEV_WIDGET_BUTTON:
|
||||
return FIRST_MOUSE_BUTTON;
|
||||
case IDEV_WIDGET_AXIS:
|
||||
return FIRST_MOUSE_AXIS;
|
||||
case IDEV_WIDGET_BUTTONAXIS:
|
||||
return MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_mouse_widget_type (int mouse, int num, TCHAR *name, uae_u32 *code)
|
||||
{
|
||||
if (num >= MAX_MOUSE_AXES && num < MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS) {
|
||||
if (name)
|
||||
sprintf (name, "Button %d", num + 1 - MAX_MOUSE_AXES);
|
||||
return IDEV_WIDGET_BUTTON;
|
||||
} else if (num < MAX_MOUSE_AXES) {
|
||||
if (name) {
|
||||
if(num == 0)
|
||||
sprintf (name, "X Axis");
|
||||
else if (num == 1)
|
||||
sprintf (name, "Y Axis");
|
||||
else
|
||||
sprintf (name, "Axis %d", num + 1);
|
||||
}
|
||||
return IDEV_WIDGET_AXIS;
|
||||
}
|
||||
return IDEV_WIDGET_NONE;
|
||||
}
|
||||
|
||||
static void read_mouse (void)
|
||||
{
|
||||
if(currprefs.input_tablet > TABLET_OFF) {
|
||||
// Mousehack active
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
setmousestate(0, 0, x, 1);
|
||||
setmousestate(0, 1, y, 1);
|
||||
}
|
||||
|
||||
if(currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1) {
|
||||
// dPad is mouse
|
||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
int mouseScale = currprefs.input_joymouse_multiplier / 4;
|
||||
|
||||
if(keystate[SDLK_LEFT])
|
||||
setmousestate(1, 0, -mouseScale, 0);
|
||||
if(keystate[SDLK_RIGHT])
|
||||
setmousestate(1, 0, mouseScale, 0);
|
||||
if(keystate[SDLK_UP])
|
||||
setmousestate(1, 1, -mouseScale, 0);
|
||||
if(keystate[SDLK_DOWN])
|
||||
setmousestate(1, 1, mouseScale, 0);
|
||||
|
||||
if(!mouseBut1viaCustom)
|
||||
setmousebuttonstate (1, 0, keystate[SDLK_HOME]); // A button -> left mouse
|
||||
if(!mouseBut2viaCustom)
|
||||
setmousebuttonstate (1, 1, keystate[SDLK_END]); // B button -> right mouse
|
||||
}
|
||||
|
||||
// Nubs as mouse handled in handle_msgpump()
|
||||
}
|
||||
|
||||
|
||||
static int get_mouse_flags (int num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct inputdevice_functions inputdevicefunc_mouse = {
|
||||
init_mouse, close_mouse, acquire_mouse, unacquire_mouse, read_mouse,
|
||||
get_mouse_num, get_mouse_friendlyname, get_mouse_uniquename,
|
||||
get_mouse_widget_num, get_mouse_widget_type,
|
||||
get_mouse_widget_first,
|
||||
get_mouse_flags
|
||||
};
|
||||
|
||||
static void setid (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt)
|
||||
{
|
||||
uid->eventid[slot][SPARE_SUB_EVENT] = uid->eventid[slot][sub];
|
||||
uid->flags[slot][SPARE_SUB_EVENT] = uid->flags[slot][sub];
|
||||
uid->port[slot][SPARE_SUB_EVENT] = MAX_JPORTS + 1;
|
||||
|
||||
uid[i].eventid[slot][sub] = evt;
|
||||
uid[i].port[slot][sub] = port + 1;
|
||||
}
|
||||
|
||||
static void setid_af (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt, int af)
|
||||
{
|
||||
setid (uid, i, slot, sub, port, evt);
|
||||
uid[i].flags[slot][sub] &= ~ID_FLAG_AUTOFIRE_MASK;
|
||||
if (af >= JPORT_AF_NORMAL)
|
||||
uid[i].flags[slot][sub] |= ID_FLAG_AUTOFIRE;
|
||||
}
|
||||
|
||||
int input_get_default_mouse (struct uae_input_device *uid, int i, int port, int af)
|
||||
{
|
||||
setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ);
|
||||
setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT);
|
||||
setid_af (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af);
|
||||
setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
|
||||
|
||||
if (i == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int init_kb (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void close_kb (void)
|
||||
{
|
||||
}
|
||||
|
||||
static int acquire_kb (int num, int flags)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void unacquire_kb (int num)
|
||||
{
|
||||
}
|
||||
|
||||
static void read_kb (void)
|
||||
{
|
||||
}
|
||||
|
||||
static int get_kb_num (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static TCHAR *get_kb_friendlyname (int kb)
|
||||
{
|
||||
return strdup("Default Keyboard");
|
||||
}
|
||||
|
||||
static TCHAR *get_kb_uniquename (int kb)
|
||||
{
|
||||
return strdup("KEYBOARD0");
|
||||
}
|
||||
|
||||
static int get_kb_widget_num (int kb)
|
||||
{
|
||||
return 255;
|
||||
}
|
||||
|
||||
static int get_kb_widget_first (int kb, int type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_kb_widget_type (int kb, int num, TCHAR *name, uae_u32 *code)
|
||||
{
|
||||
if(code)
|
||||
*code = num;
|
||||
return IDEV_WIDGET_KEY;
|
||||
}
|
||||
|
||||
static int get_kb_flags (int num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct inputdevice_functions inputdevicefunc_keyboard = {
|
||||
init_kb, close_kb, acquire_kb, unacquire_kb, read_kb,
|
||||
get_kb_num, get_kb_friendlyname, get_kb_uniquename,
|
||||
get_kb_widget_num, get_kb_widget_type,
|
||||
get_kb_widget_first,
|
||||
get_kb_flags
|
||||
};
|
||||
|
||||
int input_get_default_keyboard (int num)
|
||||
{
|
||||
if (num == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define MAX_JOY_BUTTONS 7
|
||||
#define MAX_JOY_AXES 2
|
||||
#define FIRST_JOY_AXIS 0
|
||||
#define FIRST_JOY_BUTTON MAX_JOY_AXES
|
||||
|
||||
|
||||
static int get_joystick_num (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int init_joystick (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void close_joystick (void)
|
||||
{
|
||||
}
|
||||
|
||||
static int acquire_joystick (int num, int flags)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void unacquire_joystick (int num)
|
||||
{
|
||||
}
|
||||
|
||||
static TCHAR *get_joystick_friendlyname (int joy)
|
||||
{
|
||||
return "dPad as joystick";
|
||||
}
|
||||
|
||||
static TCHAR *get_joystick_uniquename (int joy)
|
||||
{
|
||||
return "JOY0";
|
||||
}
|
||||
|
||||
static int get_joystick_widget_num (int joy)
|
||||
{
|
||||
return MAX_JOY_AXES + MAX_JOY_BUTTONS;
|
||||
}
|
||||
|
||||
static int get_joystick_widget_first (int joy, int type)
|
||||
{
|
||||
switch (type) {
|
||||
case IDEV_WIDGET_BUTTON:
|
||||
return FIRST_JOY_BUTTON;
|
||||
case IDEV_WIDGET_AXIS:
|
||||
return FIRST_JOY_AXIS;
|
||||
case IDEV_WIDGET_BUTTONAXIS:
|
||||
return MAX_JOY_AXES + MAX_JOY_BUTTONS;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int get_joystick_widget_type (int joy, int num, TCHAR *name, uae_u32 *code)
|
||||
{
|
||||
if (num >= MAX_JOY_AXES && num < MAX_JOY_AXES + MAX_JOY_BUTTONS) {
|
||||
if (name) {
|
||||
switch(num)
|
||||
{
|
||||
case FIRST_JOY_BUTTON:
|
||||
sprintf (name, "Button X/CD32 red");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 1:
|
||||
sprintf (name, "Button B/CD32 blue");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 2:
|
||||
sprintf (name, "Button A/CD32 green");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 3:
|
||||
sprintf (name, "Button Y/CD32 yellow");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 4:
|
||||
sprintf (name, "CD32 start");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 5:
|
||||
sprintf (name, "CD32 ffw");
|
||||
break;
|
||||
case FIRST_JOY_BUTTON + 6:
|
||||
sprintf (name, "CD32 rwd");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return IDEV_WIDGET_BUTTON;
|
||||
} else if (num < MAX_JOY_AXES) {
|
||||
if (name) {
|
||||
if(num == 0)
|
||||
sprintf (name, "X Axis");
|
||||
else if (num == 1)
|
||||
sprintf (name, "Y Axis");
|
||||
else
|
||||
sprintf (name, "Axis %d", num + 1);
|
||||
}
|
||||
return IDEV_WIDGET_AXIS;
|
||||
}
|
||||
return IDEV_WIDGET_NONE;
|
||||
}
|
||||
|
||||
static int get_joystick_flags (int num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void read_joystick (void)
|
||||
{
|
||||
if(currprefs.jports[0].id == JSEM_JOYS || currprefs.jports[1].id == JSEM_JOYS) {
|
||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||
|
||||
if(!keystate[SDLK_RCTRL]) { // Right shoulder + dPad -> cursor keys
|
||||
int axis = (keystate[SDLK_LEFT] ? -32767 : (keystate[SDLK_RIGHT] ? 32767 : 0));
|
||||
if(!joyXviaCustom)
|
||||
setjoystickstate (0, 0, axis, 32767);
|
||||
axis = (keystate[SDLK_UP] ? -32767 : (keystate[SDLK_DOWN] ? 32767 : 0));
|
||||
if(!joyYviaCustom)
|
||||
setjoystickstate (0, 1, axis, 32767);
|
||||
}
|
||||
if(!joyBut1viaCustom)
|
||||
setjoybuttonstate (0, 0, keystate[SDLK_PAGEDOWN]);
|
||||
if(!joyBut2viaCustom)
|
||||
setjoybuttonstate (0, 1, keystate[SDLK_END]);
|
||||
setjoybuttonstate (0, 2, keystate[SDLK_HOME]);
|
||||
setjoybuttonstate (0, 3, keystate[SDLK_PAGEUP]);
|
||||
|
||||
int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
|
||||
if(keystate[SDLK_LALT]) { // Pandora Start button
|
||||
if(keystate[SDLK_RSHIFT]) // Left shoulder
|
||||
cd32_rwd = 1;
|
||||
else if (keystate[SDLK_RCTRL]) // Right shoulder
|
||||
cd32_ffw = 1;
|
||||
else
|
||||
cd32_start = 1;
|
||||
}
|
||||
setjoybuttonstate (0, 6, cd32_start);
|
||||
setjoybuttonstate (0, 5, cd32_ffw);
|
||||
setjoybuttonstate (0, 4, cd32_rwd);
|
||||
}
|
||||
}
|
||||
|
||||
struct inputdevice_functions inputdevicefunc_joystick = {
|
||||
init_joystick, close_joystick, acquire_joystick, unacquire_joystick,
|
||||
read_joystick, get_joystick_num, get_joystick_friendlyname, get_joystick_uniquename,
|
||||
get_joystick_widget_num, get_joystick_widget_type,
|
||||
get_joystick_widget_first,
|
||||
get_joystick_flags
|
||||
};
|
||||
|
||||
int input_get_default_joystick (struct uae_input_device *uid, int num, int port, int af, int mode)
|
||||
{
|
||||
int h, v;
|
||||
|
||||
h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;;
|
||||
v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT;
|
||||
|
||||
setid (uid, num, ID_AXIS_OFFSET + 0, 0, port, h);
|
||||
setid (uid, num, ID_AXIS_OFFSET + 1, 0, port, v);
|
||||
|
||||
setid_af (uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON);
|
||||
|
||||
if (mode == JSEM_MODE_JOYSTICK_CD32) {
|
||||
setid_af (uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED, af);
|
||||
setid_af (uid, num, ID_BUTTON_OFFSET + 0, 1, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON, af);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 1, 1, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 3, 0, port, port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 4, 0, port, port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW);
|
||||
setid (uid, num, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY);
|
||||
}
|
||||
if (num == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int input_get_default_joystick_analog (struct uae_input_device *uid, int num, int port, int af)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SimulateMouseOrJoy(int code, int keypressed)
|
||||
{
|
||||
switch(code) {
|
||||
case -1: // left mousebutton
|
||||
mouseBut1viaCustom = keypressed;
|
||||
setmousebuttonstate (0, 0, keypressed);
|
||||
setmousebuttonstate (1, 0, keypressed);
|
||||
break;
|
||||
|
||||
case -2: // right mousebutton
|
||||
mouseBut2viaCustom = keypressed;
|
||||
setmousebuttonstate (0, 1, keypressed);
|
||||
setmousebuttonstate (1, 1, keypressed);
|
||||
break;
|
||||
|
||||
case -3: // joystick button 1
|
||||
joyBut1viaCustom = keypressed;
|
||||
setjoybuttonstate (0, 0, keypressed);
|
||||
break;
|
||||
|
||||
case -4: // joystick button 2
|
||||
joyBut2viaCustom = keypressed;
|
||||
setjoybuttonstate (0, 1, keypressed);
|
||||
break;
|
||||
|
||||
case -5: // joystick up
|
||||
joyYviaCustom = keypressed;
|
||||
setjoystickstate (0, 1, keypressed ? -32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -6: // joystick down
|
||||
joyYviaCustom = keypressed;
|
||||
setjoystickstate (0, 1, keypressed ? 32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -7: // joystick left
|
||||
joyXviaCustom = keypressed;
|
||||
setjoystickstate (0, 0, keypressed ? -32767 : 0, 32767);
|
||||
break;
|
||||
|
||||
case -8: // joystick right
|
||||
joyXviaCustom = keypressed;
|
||||
setjoystickstate (0, 0, keypressed ? 32767 : 0, 32767);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -332,7 +332,7 @@ static void parse_boot(struct uae_prefs *p, xmlNode *node)
|
|||
{
|
||||
if(strcmp((const char *) attr, "hdf") == 0)
|
||||
{
|
||||
// Build-in hdf required
|
||||
// Built-in hdf required
|
||||
xmlChar *content = xmlNodeGetContent(curr_node);
|
||||
if(content != NULL)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
/* #define ENFORCER */ /* UAE Enforcer */
|
||||
#define ECS_DENISE /* ECS DENISE new features */
|
||||
#define AGA /* AGA chipset emulation (ECS_DENISE must be enabled) */
|
||||
/* #define CD32 */ /* CD32 emulation */
|
||||
#define CD32 /* CD32 emulation */
|
||||
/* #define CDTV */ /* CDTV emulation */
|
||||
/* #define PARALLEL_PORT */ /* parallel port emulation */
|
||||
/* #define SERIAL_PORT */ /* serial port emulation */
|
||||
|
@ -52,6 +52,7 @@
|
|||
/* #define CUSTOM_SIMPLE */ /* simplified custom chipset emulation */
|
||||
/* #define CPUEMU_68000_ONLY */ /* drop 68010+ commands from CPUEMU_0 */
|
||||
/* #define ADDRESS_SPACE_24BIT */
|
||||
#define INPUTDEVICE_SIMPLE /* simplified inputdevice for faster emulation */
|
||||
|
||||
#define SIZEOF_VOID_P 4
|
||||
|
||||
|
@ -465,6 +466,8 @@ typedef unsigned char boolean;
|
|||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define Sleep(x) usleep(x*1000)
|
||||
|
||||
/* Some defines to make it easier to compare files with WinUAE */
|
||||
#define _T(x) x
|
||||
#define TCHAR char
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#define OPTIONSFILENAME "uaeconfig"
|
||||
|
||||
extern int emulating;
|
||||
extern int JoystickButton[20]; //Joystick Button state
|
||||
extern int uae4all_keystate[256];
|
||||
|
||||
extern int z3_start_adr;
|
||||
extern int rtg_start_adr;
|
||||
|
@ -31,7 +29,9 @@ void graphics_subshutdown (void);
|
|||
|
||||
void pandora_stop_sound(void);
|
||||
|
||||
void keyboard_init(void);
|
||||
void keyboard_settrans (void);
|
||||
int translate_pandora_keys(int symbol, int *modifier);
|
||||
void SimulateMouseOrJoy(int code, int keypressed);
|
||||
|
||||
void reinit_amiga(void);
|
||||
int count_HDs(struct uae_prefs *p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue