~ubuntu-branches/ubuntu/hardy/vice/hardy

« back to all changes in this revision

Viewing changes to src/arch/unix/macosx/joy.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2007-10-07 07:05:46 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071007070546-81yy0twlka7p2t0e
Tags: 1.22-1
* New upstream version (closes: #428280).
* Correct link to HTML documentation in manpage (closes: #409567).
* Fix most packaging mistakes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * macosx/joy.c - Mac OS X joystick support.
3
3
 *
4
4
 * Written by
5
 
 *   Christian Vogelsang <C.Vogelgsang@web.de>
 
5
 *   Christian Vogelgsang <C.Vogelgsang@web.de>
6
6
 *
7
7
 * This file is part of VICE, the Versatile Commodore Emulator.
8
8
 * See README for copyright notice.
34
34
#include "resources.h"
35
35
#include "types.h"
36
36
 
 
37
#ifdef HAS_JOYSTICK
 
38
 
37
39
/* (Used by `kbd.c').  */
38
40
int joystick_port_map[2];
39
41
 
40
 
#ifndef HAS_JOYSTICK
41
 
 
42
 
int joy_arch_init(void)
43
 
{
44
 
  return 0;
45
 
}
46
 
 
47
 
int joystick_init_resources(void)
48
 
{
49
 
  return 0;
50
 
}
51
 
 
52
 
int joystick_init_cmdline_options(void)
53
 
{
54
 
  return 0;
55
 
}
56
 
 
57
 
#else /* HAS_JOYSTICK */
58
 
 
59
42
/* NOTE: We use the HID Utilites Library provided by Apple for free
60
43
 
61
44
   http://developer.apple.com/samplecode/HID_Utilities_Source/index.html
69
52
 
70
53
/* ----- VICE Resources ----- */
71
54
 
72
 
static int joyport1select(resource_value_t v, void *param)
73
 
{
74
 
    joystick_port_map[0] = (int)v;
75
 
    return 0;
76
 
}
77
 
 
78
 
static int joyport2select(resource_value_t v, void *param)
79
 
{
80
 
    joystick_port_map[1] = (int)v;
81
 
    return 0;
82
 
}
83
 
 
84
 
static const resource_t resources[] = {
85
 
    { "JoyDevice1", RES_INTEGER, (resource_value_t)0,
86
 
      RES_EVENT_NO, NULL,                                   \
87
 
      (void *)&joystick_port_map[0], joyport1select, NULL },
88
 
    { "JoyDevice2", RES_INTEGER, (resource_value_t)0,
89
 
      RES_EVENT_NO, NULL,                                   \
90
 
      (void *)&joystick_port_map[1], joyport2select, NULL },
 
55
static int joyport1select(int val, void *param)
 
56
{
 
57
    joystick_port_map[0] = val;
 
58
    return 0;
 
59
}
 
60
 
 
61
static int joyport2select(int val, void *param)
 
62
{
 
63
    joystick_port_map[1] = val;
 
64
    return 0;
 
65
}
 
66
 
 
67
static const resource_int_t resources_int[] = {
 
68
    { "JoyDevice1", 0, RES_EVENT_NO, NULL,
 
69
      &joystick_port_map[0], joyport1select, NULL },
 
70
    { "JoyDevice2", 0, RES_EVENT_NO, NULL,
 
71
      &joystick_port_map[1], joyport2select, NULL },
91
72
    { NULL },
92
73
};
93
74
 
101
82
    { NULL },
102
83
};
103
84
 
104
 
int joystick_init_resources(void)
 
85
int joystick_arch_init_resources(void)
105
86
{
106
 
    return resources_register(resources);
 
87
    return resources_register_int(resources_int);
107
88
}
108
89
 
109
90
int joystick_init_cmdline_options(void)