Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings, bump deps etc. #3318

Merged
merged 15 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/stable-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
VER="(GA, `date +%Y-%m-%d`)"
cmake -G Ninja -B build . \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wdeprecated -fsanitize=address,undefined" \
-DPLAYER_BUILD_LIBLCF=ON -DPLAYER_VERSION_APPEND="$VER"
cmake --build build

Expand Down
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "3ds")
$<TARGET_OBJECTS:3ds-assets> PRIVATE
src/platform/3ds/audio.cpp
src/platform/3ds/audio.h
src/platform/3ds/clock.cpp
src/platform/3ds/clock.h
src/platform/3ds/input_buttons.cpp
src/platform/3ds/ui.cpp
Expand All @@ -661,7 +660,6 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "psvita")
target_sources(${PROJECT_NAME} PRIVATE
src/platform/psvita/audio.cpp
src/platform/psvita/audio.h
src/platform/psvita/clock.cpp
src/platform/psvita/clock.h
src/platform/psvita/input_buttons.cpp
src/platform/psvita/ui.cpp
Expand All @@ -679,7 +677,6 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "switch")
$<TARGET_OBJECTS:switch-assets> PRIVATE
src/platform/switch/audio.cpp
src/platform/switch/audio.h
src/platform/switch/clock.cpp
src/platform/switch/clock.h
src/platform/switch/input_buttons.cpp
src/platform/switch/ui.cpp
Expand All @@ -692,7 +689,6 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "wii")
target_sources(${PROJECT_NAME} PRIVATE
src/platform/wii/audio.cpp
src/platform/wii/audio.h
src/platform/wii/clock.cpp
src/platform/wii/clock.h
src/platform/wii/input_buttons.cpp
src/platform/sdl/axis.h
Expand Down Expand Up @@ -845,8 +841,9 @@ else()
endif()

# Detect all required libraries
player_find_package(NAME PNG TARGET PNG::PNG REQUIRED)
player_find_package(NAME fmt TARGET fmt::fmt REQUIRED)
# PNG pulls in zlib which has a broken config when not both static and shared library are installed
player_find_package(NAME PNG TARGET PNG::PNG REQUIRED CONFIG_BROKEN)
player_find_package(NAME fmt TARGET fmt::fmt VERSION 5.2 REQUIRED)

# Do not use player_find_package. enable_language used by pixman on Android does not work properly inside function calls
find_package(Pixman REQUIRED)
Expand Down
12 changes: 7 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = --install -I builds/autoconf/m4

EXTRA_DIST = CMakeLists.txt README.md builds docs resources
EXTRA_DIST = CMakeLists.txt CMakePresets.json README.md builds docs resources
MOSTLYCLEANFILES = $(DX_CLEANFILES)

bin_PROGRAMS = easyrpg-player
Expand Down Expand Up @@ -528,13 +528,13 @@ EXTRA_DIST += \
bench/variables.cpp \
src/platform/3ds/audio.cpp \
src/platform/3ds/audio.h \
src/platform/3ds/clock.cpp \
src/platform/3ds/clock.h \
src/platform/3ds/input_buttons.cpp \
src/platform/3ds/main.cpp \
src/platform/3ds/ui.cpp \
src/platform/3ds/ui.h \
src/platform/amigaos4/cmath \
src/platform/android/android.cpp \
src/platform/android/android.h \
src/platform/android/filesystem_apk.cpp \
src/platform/android/filesystem_apk.h \
Expand All @@ -560,24 +560,26 @@ EXTRA_DIST += \
src/platform/psp/psp_input_buttons.cpp \
src/platform/psvita/audio.cpp \
src/platform/psvita/audio.h \
src/platform/psvita/clock.cpp \
src/platform/psvita/clock.h \
src/platform/psvita/input_buttons.cpp \
src/platform/psvita/main.cpp \
src/platform/psvita/ui.cpp \
src/platform/psvita/ui.h \
src/platform/switch/audio.cpp \
src/platform/switch/audio.h \
src/platform/switch/clock.cpp \
src/platform/switch/clock.h \
src/platform/switch/input_buttons.cpp \
src/platform/switch/main.cpp \
src/platform/switch/ui.cpp \
src/platform/switch/ui.h \
src/platform/wii/clock.cpp \
src/platform/wii/audio.cpp \
src/platform/wii/audio.h \
src/platform/wii/clock.h \
src/platform/wii/input_buttons.cpp \
src/platform/wii/main.cpp \
src/platform/wiiu/input_buttons.cpp \
src/platform/wiiu/main.cpp \
src/platform/wiiu/main.h \
src/platform/windows/midiout_device_win32.cpp \
src/platform/windows/midiout_device_win32.h \
src/platform/windows/utils.cpp \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 6;
private static final int SDL_MICRO_VERSION = 11;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
Expand Down Expand Up @@ -91,7 +91,7 @@ public static void debugSource(int sources, String prefix) {
| InputDevice.SOURCE_CLASS_POSITION
| InputDevice.SOURCE_CLASS_TRACKBALL);

if (s2 != 0) cls += "Some_Unkown";
if (s2 != 0) cls += "Some_Unknown";

s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;

Expand Down Expand Up @@ -165,7 +165,7 @@ public static void debugSource(int sources, String prefix) {
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
s2 &= ~FLAG_TAINTED;

if (s2 != 0) src += " Some_Unkown";
if (s2 != 0) src += " Some_Unknown";

Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
}
Expand Down
8 changes: 7 additions & 1 deletion builds/cmake/Modules/PlayerFindPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function(player_find_package)

set(MODULE "")
if(PLAYER_FIND_PACKAGE_CONFIG_BROKEN)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG_OLD ${CMAKE_FIND_PACKAGE_PREFER_CONFIG})
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
set(MODULE "MODULE")
endif()

Expand All @@ -69,7 +71,7 @@ function(player_find_package)
set(DEP_FOUND TRUE)

if(${PLAYER_FIND_PACKAGE_NAME}_DIR)
message(STATUS "Found ${PLAYER_FIND_PACKAGE_NAME}: ${${PLAYER_FIND_PACKAGE_NAME}_DIR} (${TARGET_ITEM})")
message(STATUS "Found ${PLAYER_FIND_PACKAGE_NAME}: ${${PLAYER_FIND_PACKAGE_NAME}_DIR} (${TARGET_ITEM}, v${${PLAYER_FIND_PACKAGE_NAME}_VERSION})")
endif()

target_link_libraries(${PROJECT_NAME} ${TARGET_ITEM})
Expand All @@ -85,4 +87,8 @@ function(player_find_package)
message(STATUS "Could NOT find ${PLAYER_FIND_PACKAGE_NAME} (missing: ${PLAYER_FIND_PACKAGE_NAME}Config.cmake)")
endif()
endif()

if(PLAYER_FIND_PACKAGE_CONFIG_BROKEN)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${CMAKE_FIND_PACKAGE_PREFER_CONFIG_OLD})
endif()
endfunction()
2 changes: 0 additions & 2 deletions src/audio_decoder_midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

using namespace std::chrono_literals;

constexpr int AudioDecoderMidi::midi_default_tempo;

constexpr int bytes_per_sample = sizeof(int16_t) * 2;

// ~1.5 ms of MIDI message resolution
Expand Down
1 change: 0 additions & 1 deletion src/audio_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class GenericAudio : public AudioInterface {
BgmChannel BGM_Channels[nr_of_bgm_channels];
SeChannel SE_Channels[nr_of_se_channels];
mutable bool BGM_PlayedOnceIndicator;
bool Muted;

std::vector<int16_t> sample_buffer = {};
std::vector<uint8_t> scrap_buffer = {};
Expand Down
8 changes: 8 additions & 0 deletions src/audio_midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ std::unique_ptr<AudioDecoderBase> MidiDecoder::CreateFluidsynth(bool resample) {
if (mididec && resample) {
mididec = std::make_unique<AudioResampler>(std::move(mididec));
}
#else
(void)resample;
#endif

return mididec;
Expand All @@ -107,6 +109,8 @@ std::unique_ptr<AudioDecoderBase> MidiDecoder::CreateWildMidi(bool resample) {
if (mididec && resample) {
mididec = std::make_unique<AudioResampler>(std::move(mididec));
}
#else
(void)resample;
#endif

return mididec;
Expand All @@ -126,6 +130,8 @@ std::unique_ptr<AudioDecoderBase> MidiDecoder::CreateFmMidi(bool resample) {
if (mididec && resample) {
mididec = std::make_unique<AudioResampler>(std::move(mididec));
}
#else
(void)resample;
#endif

return mididec;
Expand All @@ -152,6 +158,8 @@ void MidiDecoder::ChangeFluidsynthSoundfont(StringView sf_path) {
// Was initialized before
works.fluidsynth = FluidSynthDecoder::ChangeGlobalSoundfont(sf_path, works.fluidsynth_status);
Output::Debug("Fluidsynth: {}", works.fluidsynth_status);
#else
(void)sf_path;
#endif
}

Expand Down
6 changes: 1 addition & 5 deletions src/autobattle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ template <typename... Args>
static void DebugLog(const char*, Args&&...) {}
#endif

constexpr decltype(RpgRtCompat::name) RpgRtCompat::name;
constexpr decltype(AttackOnly::name) AttackOnly::name;
constexpr decltype(RpgRtImproved::name) RpgRtImproved::name;

std::unique_ptr<AlgorithmBase> CreateAlgorithm(StringView name) {
if (Utils::StrICmp(name, RpgRtImproved::name) == 0) {
return std::make_unique<RpgRtImproved>();
Expand Down Expand Up @@ -304,7 +300,7 @@ void SelectAutoBattleAction(Game_Actor& source,
}
}
}
DebugLog("AUTOBATTLE: Actor {} Best Skill Rank : {}({}): {}", source.GetName(), skill->name, skill->ID, skill_rank);
DebugLog("AUTOBATTLE: Actor {} Best Skill Rank : {}({}): {}", source.GetName(), skill ? skill->name : "None", skill ? skill->ID : 0, skill_rank);
}

double normal_attack_rank = CalcNormalAttackAutoBattleRank(source, weapon, cond, attack_variance, emulate_bugs);
Expand Down
1 change: 0 additions & 1 deletion src/decoder_fluidsynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ FluidSynthDecoder::FluidSynthDecoder() {
// Sharing is only not possible when a Midi is played as a SE (unlikely)
if (instances > 1) {
std::string error_message;
int unused = -1;
local_synth = create_synth(error_message);
if (!local_synth) {
// unlikely, the SF was already allocated once
Expand Down
3 changes: 0 additions & 3 deletions src/enemyai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ template <typename... Args>
static void DebugLog(const char*, Args&&...) {}
#endif

constexpr decltype(RpgRtCompat::name) RpgRtCompat::name;
constexpr decltype(RpgRtImproved::name) RpgRtImproved::name;

static std::shared_ptr<Game_BattleAlgorithm::AlgorithmBase> MakeAttack(Game_Enemy& enemy, int hits) {
return std::make_shared<Game_BattleAlgorithm::Normal>(&enemy, Main_Data::game_party->GetRandomActiveBattler(), hits);
}
Expand Down
Loading
Loading