[retro-gtk/count: 4/4] controller-codes: Drop the COUNT values




commit e18eacad405a4a37c7e005fd1e4fbdd39f92e901
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Sep 11 10:29:58 2020 +0200

    controller-codes: Drop the COUNT values
    
    They aren't per-se values and hence shouldn't be presented as such.

 retro-gtk/retro-core-view.c             |  2 +-
 retro-gtk/retro-key-joypad-mapping.c    |  1 +
 shared/retro-controller-codes-private.h | 20 ++++++++++++++++++++
 shared/retro-controller-codes.c         |  2 +-
 shared/retro-controller-codes.h         | 12 ------------
 shared/retro-controller-state.c         |  1 +
 shared/retro-controller-type.c          |  2 +-
 shared/retro-input.c                    |  2 ++
 8 files changed, 27 insertions(+), 15 deletions(-)
---
diff --git a/retro-gtk/retro-core-view.c b/retro-gtk/retro-core-view.c
index 9f331400..b67cdbdf 100644
--- a/retro-gtk/retro-core-view.c
+++ b/retro-gtk/retro-core-view.c
@@ -10,7 +10,7 @@
 #include "retro-core-view.h"
 
 #include "retro-gl-display-private.h"
-#include "retro-controller-codes.h"
+#include "retro-controller-codes-private.h"
 #include "retro-core-view-controller-private.h"
 #include "retro-input-private.h"
 #include "retro-keyboard-private.h"
diff --git a/retro-gtk/retro-key-joypad-mapping.c b/retro-gtk/retro-key-joypad-mapping.c
index fc5b91ad..4a6a2dae 100644
--- a/retro-gtk/retro-key-joypad-mapping.c
+++ b/retro-gtk/retro-key-joypad-mapping.c
@@ -10,6 +10,7 @@
 #include "retro-key-joypad-mapping.h"
 
 #include <linux/input-event-codes.h>
+#include "retro-controller-codes-private.h"
 
 static guint16 DEFAULT_KEY_JOYPAD_BUTTON_MAPPING[RETRO_JOYPAD_ID_COUNT] = {
   KEY_S,
diff --git a/shared/retro-controller-codes-private.h b/shared/retro-controller-codes-private.h
new file mode 100644
index 00000000..c83cd7b7
--- /dev/null
+++ b/shared/retro-controller-codes-private.h
@@ -0,0 +1,20 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#pragma once
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include "retro-controller-codes.h"
+
+G_BEGIN_DECLS
+
+#define RETRO_ANALOG_ID_COUNT (RETRO_ANALOG_ID_Y + 1)
+#define RETRO_ANALOG_INDEX_COUNT (RETRO_ANALOG_INDEX_RIGHT + 1)
+#define RETRO_JOYPAD_ID_COUNT (RETRO_JOYPAD_ID_R3 + 1)
+#define RETRO_LIGHTGUN_ID_COUNT (RETRO_LIGHTGUN_ID_START + 1)
+#define RETRO_MOUSE_ID_COUNT (RETRO_MOUSE_ID_HORIZ_WHEELDOWN + 1)
+#define RETRO_POINTER_ID_COUNT (RETRO_POINTER_ID_PRESSED + 1)
+
+G_END_DECLS
diff --git a/shared/retro-controller-codes.c b/shared/retro-controller-codes.c
index 803b35af..ef6b4db6 100644
--- a/shared/retro-controller-codes.c
+++ b/shared/retro-controller-codes.c
@@ -8,7 +8,7 @@
  */
 
 #include <linux/input-event-codes.h>
-#include "retro-controller-codes.h"
+#include "retro-controller-codes-private.h"
 
 static guint16 RETRO_JOYPAD_ID_EVENT_CODE_MAPPING[RETRO_JOYPAD_ID_COUNT] = {
   BTN_A,
diff --git a/shared/retro-controller-codes.h b/shared/retro-controller-codes.h
index 043061f7..f6f63248 100644
--- a/shared/retro-controller-codes.h
+++ b/shared/retro-controller-codes.h
@@ -32,7 +32,6 @@ GType retro_joypad_id_get_type (void) G_GNUC_CONST;
  * @RETRO_JOYPAD_ID_R2: the second right shoulder button
  * @RETRO_JOYPAD_ID_L3: the left thumb button
  * @RETRO_JOYPAD_ID_R3: the right thumb button
- * @RETRO_JOYPAD_ID_COUNT: the number of ids
  *
  * Represents the buttons for the Libretro gamepad. The available buttons are
  * the same as the W3C Standard Gamepad, the SDL GameController and many other
@@ -59,7 +58,6 @@ typedef enum
   RETRO_JOYPAD_ID_R2,
   RETRO_JOYPAD_ID_L3,
   RETRO_JOYPAD_ID_R3,
-  RETRO_JOYPAD_ID_COUNT,
 } RetroJoypadId;
 
 guint16 retro_joypad_id_to_button_code (RetroJoypadId joypad_id);
@@ -80,7 +78,6 @@ GType retro_mouse_id_get_type (void) G_GNUC_CONST;
  * @RETRO_MOUSE_ID_MIDDLE: the middle button of a mouse
  * @RETRO_MOUSE_ID_HORIZ_WHEELUP: the horizontal up direction of a mouse wheel
  * @RETRO_MOUSE_ID_HORIZ_WHEELDOWN: the horizontal down direction of a mouse wheel
- * @RETRO_MOUSE_ID_COUNT: the number of ids
  *
  * Represents the inputs for the Libretro mouse.
  */
@@ -95,7 +92,6 @@ typedef enum
   RETRO_MOUSE_ID_MIDDLE,
   RETRO_MOUSE_ID_HORIZ_WHEELUP,
   RETRO_MOUSE_ID_HORIZ_WHEELDOWN,
-  RETRO_MOUSE_ID_COUNT,
 } RetroMouseId;
 
 #define RETRO_TYPE_LIGHTGUN_ID (retro_lightgun_id_get_type ())
@@ -111,7 +107,6 @@ GType retro_lightgun_id_get_type (void) G_GNUC_CONST;
  * @RETRO_LIGHTGUN_ID_TURBO: the turbo button of a lightgun
  * @RETRO_LIGHTGUN_ID_PAUSE: the pause button of a lightgun
  * @RETRO_LIGHTGUN_ID_START: the start button of a lightgun
- * @RETRO_LIGHTGUN_ID_COUNT: the number of ids
  *
  * Represents the inputs for the Libretro lightgun.
  */
@@ -124,7 +119,6 @@ typedef enum
   RETRO_LIGHTGUN_ID_TURBO,
   RETRO_LIGHTGUN_ID_PAUSE,
   RETRO_LIGHTGUN_ID_START,
-  RETRO_LIGHTGUN_ID_COUNT,
 } RetroLightgunId;
 
 #define RETRO_TYPE_ANALOG_ID (retro_analog_id_get_type ())
@@ -135,7 +129,6 @@ GType retro_analog_id_get_type (void) G_GNUC_CONST;
  * RetroAnalogId:
  * @RETRO_ANALOG_ID_X: the X axis of an analog stick
  * @RETRO_ANALOG_ID_Y: the Y axis of an analog stick
- * @RETRO_ANALOG_ID_COUNT: the number of ids
  *
  * Represents the axes of the analog sticks for the Libretro gamepad.
  */
@@ -143,7 +136,6 @@ typedef enum
 {
   RETRO_ANALOG_ID_X,
   RETRO_ANALOG_ID_Y,
-  RETRO_ANALOG_ID_COUNT,
 } RetroAnalogId;
 
 #define RETRO_TYPE_ANALOG_INDEX (retro_analog_index_get_type ())
@@ -154,7 +146,6 @@ GType retro_analog_index_get_type (void) G_GNUC_CONST;
  * RetroAnalogIndex:
  * @RETRO_ANALOG_INDEX_LEFT: the left analog stick
  * @RETRO_ANALOG_INDEX_RIGHT: the right analog stick
- * @RETRO_ANALOG_INDEX_COUNT: the number of indexes
  *
  * Represents the analog sticks for the Libretro gamepad.
  */
@@ -162,7 +153,6 @@ typedef enum
 {
   RETRO_ANALOG_INDEX_LEFT,
   RETRO_ANALOG_INDEX_RIGHT,
-  RETRO_ANALOG_INDEX_COUNT,
 } RetroAnalogIndex;
 
 #define RETRO_TYPE_POINTER_ID (retro_pointer_id_get_type ())
@@ -174,7 +164,6 @@ GType retro_pointer_id_get_type (void) G_GNUC_CONST;
  * @RETRO_POINTER_ID_X: the X axis of a pointer
  * @RETRO_POINTER_ID_Y: the Y axis of a pointer
  * @RETRO_POINTER_ID_PRESSED: the pression of a pointer
- * @RETRO_POINTER_ID_COUNT: the number of ids
  *
  * Represents the inputs for the Libretro pointer.
  */
@@ -183,7 +172,6 @@ typedef enum
   RETRO_POINTER_ID_X,
   RETRO_POINTER_ID_Y,
   RETRO_POINTER_ID_PRESSED,
-  RETRO_POINTER_ID_COUNT,
 } RetroPointerId;
 
 G_END_DECLS
diff --git a/shared/retro-controller-state.c b/shared/retro-controller-state.c
index 292e1ae7..edc3331f 100644
--- a/shared/retro-controller-state.c
+++ b/shared/retro-controller-state.c
@@ -6,6 +6,7 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include "retro-controller-codes-private.h"
 #include "retro-controller-type.h"
 #include "retro-input-private.h"
 
diff --git a/shared/retro-controller-type.c b/shared/retro-controller-type.c
index 1a847344..401b2bf8 100644
--- a/shared/retro-controller-type.c
+++ b/shared/retro-controller-type.c
@@ -9,7 +9,7 @@
 
 #include "retro-controller-type.h"
 
-#include "retro-controller-codes.h"
+#include "retro-controller-codes-private.h"
 #include "retro-keyboard-key-private.h"
 
 int
diff --git a/shared/retro-input.c b/shared/retro-input.c
index f60a025c..d2932fee 100644
--- a/shared/retro-input.c
+++ b/shared/retro-input.c
@@ -18,6 +18,8 @@
 
 #include "retro-input-private.h"
 
+#include "retro-controller-codes-private.h"
+
 G_DEFINE_BOXED_TYPE (RetroInput, retro_input, retro_input_copy, retro_input_free)
 
 /* Private */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]