Skip to content

Commit

Permalink
Switch inline to INLINE macro
Browse files Browse the repository at this point in the history
  • Loading branch information
schellingb committed Dec 23, 2023
1 parent 646e684 commit a451420
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions dosbox_pure_libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,11 +998,11 @@ struct DBP_PadMapping
enum EPreset : Bit8u { PRESET_NONE, PRESET_AUTOMAPPED, PRESET_GENERICKEYBOARD, PRESET_MOUSE_LEFT_ANALOG, PRESET_MOUSE_RIGHT_ANALOG, PRESET_GRAVIS_GAMEPAD, PRESET_BASIC_JOYSTICK_1, PRESET_BASIC_JOYSTICK_2, PRESET_THRUSTMASTER_FLIGHTSTICK, PRESET_BOTH_DOS_JOYSTICKS, PRESET_CUSTOM };
enum EPortMode : Bit8u { MODE_DISABLED, MODE_MAPPER, MODE_PRESET_AUTOMAPPED, MODE_PRESET_GENERICKEYBOARD, MODE_PRESET_LAST = MODE_PRESET_AUTOMAPPED + (PRESET_CUSTOM - PRESET_AUTOMAPPED) - 1, MODE_KEYBOARD, MODE_KEYBOARD_MOUSE1, MODE_KEYBOARD_MOUSE2 };

inline static EPreset DefaultPreset(Bit8u port) { return ((port || !dbp_auto_mapping) ? PRESET_GENERICKEYBOARD : PRESET_AUTOMAPPED); }
inline static bool IsCustomized(Bit8u port) { return (dbp_port_mode[port] == MODE_MAPPER && GetPreset(port, DefaultPreset(port)) == PRESET_CUSTOM); }
inline static const char* GetPortPresetName(Bit8u port) { return GetPresetName(GetPreset(port)); }
inline static void FillGenericKeys(Bit8u port) { Apply(port, PresetBinds(PRESET_GENERICKEYBOARD, port), true, true); }
inline static const char* GetKeyAutoMapButtonLabel(Bit8u key) { return FindAutoMapButtonLabel(1, 0, &key); }
INLINE static EPreset DefaultPreset(Bit8u port) { return ((port || !dbp_auto_mapping) ? PRESET_GENERICKEYBOARD : PRESET_AUTOMAPPED); }
INLINE static bool IsCustomized(Bit8u port) { return (dbp_port_mode[port] == MODE_MAPPER && GetPreset(port, DefaultPreset(port)) == PRESET_CUSTOM); }
INLINE static const char* GetPortPresetName(Bit8u port) { return GetPresetName(GetPreset(port)); }
INLINE static void FillGenericKeys(Bit8u port) { Apply(port, PresetBinds(PRESET_GENERICKEYBOARD, port), true, true); }
INLINE static const char* GetKeyAutoMapButtonLabel(Bit8u key) { return FindAutoMapButtonLabel(1, 0, &key); }

static void Load()
{
Expand Down Expand Up @@ -1316,8 +1316,8 @@ struct DBP_PadMapping
#define DBP_ANALOGBINDID2(INDEX,ID) (16+((INDEX)*2)+(ID))
#define DBP_ANALOGBINDID(SIDE,AXIS) DBP_ANALOGBINDID2(RETRO_DEVICE_INDEX_ANALOG_##SIDE, RETRO_DEVICE_ID_ANALOG_##AXIS)

inline static DBP_InputBind BindForBtn(Bit8u port, Bit8u id) { if (id < 16) return { port, RETRO_DEVICE_JOYPAD, 0, id }; else return { port, RETRO_DEVICE_ANALOG, (Bit8u)(id >= 18), (Bit8u)(id & 1) }; }
inline static Bit32u PortDeviceIndexIdForBtn(Bit8u port, Bit8u id) { DBP_InputBind bnd = BindForBtn(port, id); return PORT_DEVICE_INDEX_ID(bnd); }
INLINE static DBP_InputBind BindForBtn(Bit8u port, Bit8u id) { if (id < 16) return { port, RETRO_DEVICE_JOYPAD, 0, id }; else return { port, RETRO_DEVICE_ANALOG, (Bit8u)(id >= 18), (Bit8u)(id & 1) }; }
INLINE static Bit32u PortDeviceIndexIdForBtn(Bit8u port, Bit8u id) { DBP_InputBind bnd = BindForBtn(port, id); return PORT_DEVICE_INDEX_ID(bnd); }

static const Bit8u* Apply(Bit8u port, const Bit8u* mapping, bool is_preset, bool only_unbound = false)
{
Expand Down
6 changes: 3 additions & 3 deletions dosbox_pure_osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct DBP_BufferDrawing : DBP_Buffer
}

bool DrawButtonAt(Bit32u blend, int btny, int lh, int padu, int padd, int btnx, int btnr, bool on, const struct DBP_MenuMouse& m, const char* txt);
inline bool DrawButton(Bit32u blend, int btny, int lh, int i, int n, bool on, const struct DBP_MenuMouse& m, const char* txt)
INLINE bool DrawButton(Bit32u blend, int btny, int lh, int i, int n, bool on, const struct DBP_MenuMouse& m, const char* txt)
{ int w = width; return DrawButtonAt(blend, btny, lh, 4, 4, (!i ? 8 : (w*i/n + 2)), (i == (n-1) ? w - 8 : (w*(i+1)/n - 2)), on, m, txt); }
};
DBP_STATIC_ASSERT(sizeof(DBP_BufferDrawing) == sizeof(DBP_Buffer)); // drawing is just for function expansions, we're just casting one to the other
Expand Down Expand Up @@ -533,8 +533,8 @@ struct DBP_MapperMenuState : DBP_MenuState
bind_dev = 0;
}

inline bool is_mapper_disabled_top() { return list[1].info == 11; } // see menu_top
inline bool is_presets_menu() { return list[0].info == 22; } // see menu_presets
INLINE bool is_mapper_disabled_top() { return list[1].info == 11; } // see menu_top
INLINE bool is_presets_menu() { return list[0].info == 22; } // see menu_presets

void menu_presets(Bit16s info)
{
Expand Down
4 changes: 2 additions & 2 deletions dosbox_pure_run.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ struct DBP_Run
RunShell(startup.info);
}

inline static void ResetStartup() { startup.mode = RUN_NONE; }
inline static void ResetAutoboot() { autoboot.use = autoboot.have = false; }
INLINE static void ResetStartup() { startup.mode = RUN_NONE; }
INLINE static void ResetAutoboot() { autoboot.use = autoboot.have = false; }
static char GetDosBoxMachineChar() { return *((const char*)control->GetSection("dosbox")->GetProp("machine")->GetValue()); }

static bool HandleStartup(bool is_boot)
Expand Down
10 changes: 5 additions & 5 deletions src/dbp_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ static struct DBP_Net_Cleanup { ~DBP_Net_Cleanup() { delete dbp_net; } } _dbp_ne
#define NET_WRITE_LE16(p,v) { ((Bit8u*)(p))[0] = (Bit8u)((Bit16u)(v) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); }
#define NET_WRITE_BE16(p,v) { ((Bit8u*)(p))[0] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)((Bit16u)(v) & 0xFF); }
#else
inline Bit16u NET_READ_LE16(const void* p) { return ((Bit16u)(((const Bit8u *)(p))[0]) | ((Bit16u)(((const Bit8u *)(p))[1]) << 8U)); }
inline Bit16u NET_READ_BE16(const void* p) { return (((Bit16u)(((const Bit8u *)(p))[0]) << 8U) | (Bit16u)(((const Bit8u *)(p))[1])); }
inline void NET_WRITE_LE16(void* p, Bit16u v) { ((Bit8u*)(p))[0] = (Bit8u)((Bit16u)(v) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); }
inline void NET_WRITE_BE16(void* p, Bit16u v) { ((Bit8u*)(p))[0] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)((Bit16u)(v) & 0xFF); }
INLINE Bit16u NET_READ_LE16(const void* p) { return ((Bit16u)(((const Bit8u *)(p))[0]) | ((Bit16u)(((const Bit8u *)(p))[1]) << 8U)); }
INLINE Bit16u NET_READ_BE16(const void* p) { return (((Bit16u)(((const Bit8u *)(p))[0]) << 8U) | (Bit16u)(((const Bit8u *)(p))[1])); }
INLINE void NET_WRITE_LE16(void* p, Bit16u v) { ((Bit8u*)(p))[0] = (Bit8u)((Bit16u)(v) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); }
INLINE void NET_WRITE_BE16(void* p, Bit16u v) { ((Bit8u*)(p))[0] = (Bit8u)(((Bit16u)(v) >> 8) & 0xFF); ((Bit8u*)(p))[1] = (Bit8u)((Bit16u)(v) & 0xFF); }
#endif

static void DBP_Net_InitMac(uint16_t client_id = 0)
Expand Down Expand Up @@ -2793,7 +2793,7 @@ struct NetCallBacks
DBP_EnableNetwork();
}

static inline Bit16u client_id_from_mac(const Bit8u* mac)
static INLINE Bit16u client_id_from_mac(const Bit8u* mac)
{
// Consider unknown first octet to be a multicast of some sort
return (mac[0] == DBP_Net::FIRST_MAC_OCTET ? NET_READ_BE16(&mac[4]) : (Bit16u)RETRO_NETPACKET_BROADCAST);
Expand Down

0 comments on commit a451420

Please sign in to comment.