Fix compilation in Linux (missing entry in module.mk).

Fix compilation warnings in a few places.
Use float instead of floats and doubles in Paddles class (otherwise we get warnings).  Thomas, can you check that this doesn't affect functionality?
This commit is contained in:
Stephen Anthony 2021-09-15 15:14:31 -02:30
parent 4d78865ab2
commit 2858cdb7ec
5 changed files with 35 additions and 34 deletions

View File

@ -301,7 +301,7 @@ class MovieInputs : public Serializable
// Automatically generated
// Several not used
#define addr_kernel_48 0x800
// #define addr_kernel_48 0x800
#define addr_transport_direction 0x880
#define addr_transport_buttons 0x894
#define addr_right_line 0x948
@ -317,7 +317,7 @@ class MovieInputs : public Serializable
#define addr_set_gcol7 0x96a
#define addr_set_gdata7 0x96e
#define addr_set_gcol8 0x972
#define addr_left_line 0x980
// #define addr_left_line 0x980
#define addr_set_gdata1 0x982
#define addr_set_gcol1 0x988
#define addr_set_aud_left 0x98c
@ -331,27 +331,27 @@ class MovieInputs : public Serializable
#define addr_set_gdata2 0x9a8
#define addr_set_gcol3 0x9ac
#define addr_pick_continue 0x9be
#define addr_main_start 0xa00
#define addr_aud_bank_setup 0xa0c
#define addr_tg0 0xa24
#define addr_title_again 0xa3b
#define addr_wait_cnt 0xa77
// #define addr_main_start 0xa00
// #define addr_aud_bank_setup 0xa0c
// #define addr_tg0 0xa24
// #define addr_title_again 0xa3b
// #define addr_wait_cnt 0xa77
#define addr_end_lines 0xa80
#define addr_set_aud_endlines 0xa80
#define addr_set_overscan_size 0xa9a
#define addr_set_vblank_size 0xab0
#define addr_pick_extra_lines 0xab9
#define addr_pick_transport 0xac6
#define addr_wait_lines 0xac9
#define addr_transport_done1 0xada
#define addr_draw_title 0xb00
// #define addr_wait_lines 0xac9
// #define addr_transport_done1 0xada
// #define addr_draw_title 0xb00
#define addr_title_loop 0xb50
#define addr_black_bar 0xb52
#define addr_animate_bar1 0xb58
#define addr_animate_bar_again1 0xb5a
#define addr_animate_dex1 0xb65
// #define addr_black_bar 0xb52
// #define addr_animate_bar1 0xb58
// #define addr_animate_bar_again1 0xb5a
// #define addr_animate_dex1 0xb65
#define addr_audio_bank 0xb80
#define addr_reset_loop 0xbfa
// #define addr_reset_loop 0xbfa
// scale adjustments, automatically generated
static constexpr uInt8 scale0[16] = {
@ -480,7 +480,7 @@ static constexpr uInt8 brightLabelEven[] = {
0, 49, 48, 12, 96,
6, 140, 231, 96, 0,
0, 225, 48, 12, 96,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
@ -497,7 +497,7 @@ static constexpr uInt8 brightLabelOdd[] = {
0, 113, 48, 12, 96,
7, 142, 127, 96, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
@ -514,7 +514,7 @@ static constexpr uInt8 volumeLabelEven[] = {
0, 12, 192, 15, 192,
30, 112, 119, 176, 0,
0, 7, 252, 12, 254,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
@ -531,7 +531,7 @@ static constexpr uInt8 volumeLabelOdd[] = {
0, 14, 192, 13, 192,
14, 224, 62, 48, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};

View File

@ -16,6 +16,7 @@
//============================================================================
#include <cassert>
#include <cmath>
#include "System.hxx"
#include "Control.hxx"

View File

@ -302,7 +302,7 @@ class Controller : public Serializable
/**
Retrieves the effective analog dead zone value
*/
static int Controller::analogDeadZoneValue(int deadZone);
static int analogDeadZoneValue(int deadZone);
inline static int digitalDeadZone() { return DIGITAL_DEAD_ZONE; }
@ -410,10 +410,10 @@ class Controller : public Serializable
/// The callback that is dispatched whenver an analog pin has changed
onAnalogPinUpdateCallback myOnAnalogPinUpdateCallback{nullptr};
/// Defines the dead zone of analog joysticks for digital Atari controllers</summary>
/// Defines the dead zone of analog joysticks for digital Atari controllers
static int DIGITAL_DEAD_ZONE;
/// Defines the dead zone of analog joysticks for analog Atari controllers</summary>
/// Defines the dead zone of analog joysticks for analog Atari controllers
static int ANALOG_DEAD_ZONE;
static int MOUSE_SENSITIVITY;

View File

@ -197,7 +197,7 @@ void Paddles::update()
AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int center)
{
const double range = ANALOG_RANGE - analogDeadZone() * 2;
const float range = ANALOG_RANGE - analogDeadZone() * 2;
// dead zone, ignore changes inside the dead zone
if(newAxis > analogDeadZone())
@ -207,23 +207,23 @@ AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int ce
else
newAxis = 0; // treat any dead zone value as zero
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
static constexpr std::array<float, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
// higher values mean more dejitter strength
0, // off
0.50, 0.59, 0.67, 0.74, 0.80,
0.85, 0.89, 0.92, 0.94, 0.95
};
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> dFac = {
static constexpr std::array<float, MAX_DEJITTER - MIN_DEJITTER + 1> dFac = {
// lower values mean more dejitter strength
1, // off
1.0 / 181, 1.0 / 256, 1.0 / 362, 1.0 / 512, 1.0 / 724,
1.0 / 1024, 1.0 / 1448, 1.0 / 2048, 1.0 / 2896, 1.0 / 4096
};
const double baseFactor = bFac[DEJITTER_BASE];
const double diffFactor = dFac[DEJITTER_DIFF];
const float baseFactor = bFac[DEJITTER_BASE];
const float diffFactor = dFac[DEJITTER_DIFF];
// dejitter, suppress small changes only
double dejitter = pow(baseFactor, abs(newAxis - lastAxis) * diffFactor);
float dejitter = powf(baseFactor, std::abs(newAxis - lastAxis) * diffFactor);
int newVal = newAxis * (1 - dejitter) + lastAxis * dejitter;
// only use new dejittered value for larger differences
@ -231,12 +231,12 @@ AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int ce
newAxis = newVal;
// apply linearity
double linearVal = newAxis / (range / 2); // scale to -1.0..+1.0
float linearVal = newAxis / (range / 2); // scale to -1.0..+1.0
if(newAxis >= 0)
linearVal = pow(abs(linearVal), LINEARITY);
linearVal = powf(std::abs(linearVal), LINEARITY);
else
linearVal = -pow(abs(linearVal), LINEARITY);
linearVal = -powf(std::abs(linearVal), LINEARITY);
newAxis = linearVal * (range / 2); // scale back to ANALOG_RANGE
@ -245,8 +245,8 @@ AnalogReadout::Connection Paddles::getReadOut(int lastAxis, int& newAxis, int ce
// scale result
return AnalogReadout::connectToVcc(MAX_RESISTANCE *
BSPF::clamp((ANALOG_MAX_VALUE - (scaledAxis * SENSITIVITY + center)) / double(ANALOG_RANGE),
0.0, 1.0));
BSPF::clamp((ANALOG_MAX_VALUE - (scaledAxis * SENSITIVITY + center)) /
float(ANALOG_RANGE), 0.F, 1.F));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -35,7 +35,7 @@ MODULE_OBJS := \
src/gui/MessageMenu.o \
src/gui/MinUICommandDialog.o\
src/gui/OptionsDialog.o \
src/gui/OptionMenu.o \
src/gui/OptionsMenu.o \
src/gui/PlusRomsMenu.o\
src/gui/PlusRomsSetupDialog.o\
src/gui/PopUpWidget.o \