evilynux patch for joypad support
This commit is contained in:
parent
7b37990d8f
commit
3afd618c0d
|
@ -3,7 +3,7 @@ desmume_glade_SOURCES = \
|
|||
callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h desmume.c desmume.h \
|
||||
globals.h keyval_names.c main.c printscreen.c \
|
||||
dTools/callbacks_1_ioregs.c dTools/callbacks_dtools.h \
|
||||
../sndsdl.h ../sndsdl.c
|
||||
../sndsdl.h ../sndsdl.c joysdl.h joysdl.c
|
||||
desmume_glade_LDADD = ../libdesmume.a $(SDL_LIBS) $(LIBGLADE_LIBS)
|
||||
desmume_glade_CFLAGS = $(SDL_CFLAGS) $(LIBGLADE_CFLAGS)
|
||||
desmume_glade_LDFLAGS = -rdynamic
|
||||
|
|
|
@ -66,6 +66,7 @@ BOOL desmume_running()
|
|||
|
||||
void desmume_cycle()
|
||||
{
|
||||
process_joy_events();
|
||||
desmume_last_cycle = NDS_exec((560190 << 1) - desmume_last_cycle, FALSE);
|
||||
SPU_Emulate();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#define DESMUME_KEY_BOOST 14
|
||||
|
||||
#include "globals.h"
|
||||
#include "joysdl.h"
|
||||
|
||||
extern void desmume_init();
|
||||
extern void desmume_free();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
uint Frameskip;
|
||||
gint Keypad_Config[DESMUME_NB_KEYS];
|
||||
gint Keypad_Temp[DESMUME_NB_KEYS];
|
||||
u16 Joypad_Config[DESMUME_NB_KEYS];
|
||||
|
||||
/* main.c */
|
||||
GtkWidget * pWindow;
|
||||
|
|
|
@ -21,6 +21,23 @@ NULL
|
|||
|
||||
gint Keypad_Config[DESMUME_NB_KEYS];
|
||||
|
||||
const u16 Default_Joypad_Config[DESMUME_NB_KEYS] =
|
||||
{ 1, // A
|
||||
0, // B
|
||||
5, // select
|
||||
8, // start
|
||||
20, // Right -- Start cheating abit...
|
||||
21, // Left
|
||||
22, // Up
|
||||
23, // Down -- End of cheating.
|
||||
7, // R
|
||||
6, // L
|
||||
3, // Y
|
||||
4, // X
|
||||
-1, // DEBUG
|
||||
-1 // BOOST
|
||||
};
|
||||
|
||||
const char *Ini_Keypad_Values[DESMUME_NB_KEYS] =
|
||||
{
|
||||
"KEY_A",
|
||||
|
@ -128,21 +145,44 @@ int WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgumen
|
|||
int main(int argc, char *argv[]) {
|
||||
|
||||
const char *commandLine_File = NULL;
|
||||
|
||||
int nbJoysticks;
|
||||
int i;
|
||||
|
||||
if(argc == 2) commandLine_File = argv[1];
|
||||
|
||||
#ifdef DEBUG
|
||||
LogStart();
|
||||
#endif
|
||||
init_keyvals();
|
||||
|
||||
memcpy(Joypad_Config, Default_Joypad_Config, sizeof(Joypad_Config));
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) == -1)
|
||||
{
|
||||
fprintf(stderr, "Error trying to initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
desmume_init();
|
||||
|
||||
|
||||
CONFIG_FILE = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL);
|
||||
Read_ConfigFile();
|
||||
|
||||
/* Initialize joysticks */
|
||||
nbJoysticks = SDL_NumJoysticks();
|
||||
printf("Nbr of joysticks: %d\n\n", nbJoysticks);
|
||||
|
||||
for (i = 0; i < nbJoysticks; i++)
|
||||
{
|
||||
SDL_Joystick * joy = SDL_JoystickOpen(i);
|
||||
printf("Joystick %s\n", i, SDL_JoystickName(i));
|
||||
printf("Axes: %d\n", SDL_JoystickNumAxes(joy));
|
||||
printf("Buttons: %d\n", SDL_JoystickNumButtons(joy));
|
||||
printf("Trackballs: %d\n", SDL_JoystickNumBalls(joy));
|
||||
printf("Hats: %d\n\n", SDL_JoystickNumHats(joy));
|
||||
}
|
||||
|
||||
/* load the interface */
|
||||
xml = glade_xml_new("glade/DeSmuMe.glade", NULL, NULL);
|
||||
xml_tools = glade_xml_new("glade/DeSmuMe_Dtools.glade", NULL, NULL);
|
||||
|
|
Loading…
Reference in New Issue