diff --git a/binding-mri/modloader-binding.cpp b/binding-mri/modloader-binding.cpp index fc033c8..ba72bfe 100644 --- a/binding-mri/modloader-binding.cpp +++ b/binding-mri/modloader-binding.cpp @@ -20,7 +20,7 @@ namespace fs = std::filesystem; -VALUE meow(std::vector vec){ +VALUE meow(const std::vector vec){ VALUE ary = rb_ary_new_capa((long)vec.size()); for (const std::string &s : vec) { VALUE str = rb_str_new_cstr(s.c_str()); diff --git a/changelogs/0.1.2.txt b/changelogs/0.1.2.txt index 42a4028..c7c9ce9 100644 --- a/changelogs/0.1.2.txt +++ b/changelogs/0.1.2.txt @@ -59,4 +59,7 @@ Rewrited audio system from SDL3_sound and OpenAL to SDL_mixer Added Master Volume setting Added viewports scaling Build script for Windows MinGW - +Added Pantheon DE support +Added Badgi DE support +Added Wallpaper Manager Settings +Added X11 Window Managers support diff --git a/src/etc.h b/src/etc.h index 4efaffc..6059016 100644 --- a/src/etc.h +++ b/src/etc.h @@ -205,7 +205,7 @@ struct LightSource { : x(0), y(0), power(0), radius(0), color(Color()) {}; - LightSource(float x, float y, float power, float radius, Color color) + LightSource(float x, float y, float power, float radius, const Color color) : x(x), y(y), power(power), radius(radius), color(color) {}; diff --git a/src/input.cpp b/src/input.cpp index 0a01349..7ae3e43 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -833,7 +833,7 @@ int Input::mouseY(){ return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y; } -void Input::setBinding(std::vector descs, Input::ButtonCode target){ +void Input::setBinding(const std::vector descs, Input::ButtonCode target){ p->setBindingDescs(descs, target); } diff --git a/src/lightmap.cpp b/src/lightmap.cpp index 457cf1d..bba4945 100644 --- a/src/lightmap.cpp +++ b/src/lightmap.cpp @@ -196,10 +196,10 @@ void LightMap::clearStaticLightSources(){ void LightMap::clearDynamicLightSources(){ p->dynamicLightSources.clear(); } -void LightMap::addStaticLightSource(LightSource source){ +void LightMap::addStaticLightSource(const LightSource source){ p->staticLightSources.push_back(source); } -void LightMap::addDynamicLightSource(LightSource source){ +void LightMap::addDynamicLightSource(const LightSource source){ p->dynamicLightSources.push_back(source); } void LightMap::removeStaticLightSource(float x, float y){ @@ -258,4 +258,4 @@ void LightMap::releaseResources(){ unlink(); delete p; -} \ No newline at end of file +} diff --git a/src/meow.cpp b/src/meow.cpp index 352944d..ba563e7 100644 --- a/src/meow.cpp +++ b/src/meow.cpp @@ -53,6 +53,26 @@ static inline const char* glGetStringInt(GLenum name){ return (const char*) gl.GetString(name); } +#define STR2(x) #x +#define STR(x) STR2(x) + +#if defined(__clang__) + #define COMPILER_NAME "Clang" + #define COMPILER_VER STR(__clang_major__) "." STR(__clang_minor__) "." STR(__clang_patchlevel__) +#elif defined(__GNUC__) + #define COMPILER_NAME "GCC" + #define COMPILER_VER STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) +#elif defined(_MSC_VER) + #define COMPILER_NAME "MSVC" + #define COMPILER_VER STR(_MSC_VER) +#elif defined(__INTEL_COMPILER) + #define COMPILER_NAME "Intel" + #define COMPILER_VER "n/a" +#else + #define COMPILER_NAME "Unknown compiler" + #define COMPILER_VER "n/a" +#endif + static void get_reason_and_solution(Exception::Type t) { switch (t) { case Exception::ModLoaderError: @@ -164,6 +184,8 @@ void crash_screen(SDL_Window* win){ #endif o << "VERSION: " << VERSION_STRING << endl; o << "REASON: " << crash_message << endl; + o << "Compiler info: " << COMPILER_NAME << " " << COMPILER_VER << endl << endl; + o << "[BOOST stacktrace()]" << endl << endl; o << boost::stacktrace::stacktrace() << endl; diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 3558c78..87448d0 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -464,10 +464,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title){ // Message boxes and UI changes must be performed from the main thread on macOS Mojave and above. // This block ensures the message box will show from the main thread. - dispatch_sync(dispatch_get_main_queue(), - ^{ - SDL_ShowMessageBox(&data, btn); - }); + dispatch_sync(dispatch_get_main_queue(), { SDL_ShowMessageBox(&data, btn); }); #else SDL_ShowMessageBox(&data, &button); #endif diff --git a/src/shader.cpp b/src/shader.cpp index d0e9218..303eae8 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -310,7 +310,7 @@ void DynamicLightShader::setTileMapOffset(int x, int y){ gl.Uniform2f(u_tileMapOffset, x, y); } -void DynamicLightShader::setLightSources(std::vector sources){ +void DynamicLightShader::setLightSources(const std::vector sources){ int count = 0; int screenWidth = shState->graphics().width(); int screenHeight = shState->graphics().height(); diff --git a/src/sound/audioplayback.cpp b/src/sound/audioplayback.cpp index 01a5b61..2a79694 100644 --- a/src/sound/audioplayback.cpp +++ b/src/sound/audioplayback.cpp @@ -129,13 +129,13 @@ double AudioPlayback::getLengthNormalized() const { return 0.0; } -void AudioPlayback::addTag(std::string tagName) { +void AudioPlayback::addTag(const std::string tagName) { if (!p_track) return; MIX_TagTrack(p_track, tagName.data()); } -void AudioPlayback::removeTag(std::string tagName) { +void AudioPlayback::removeTag(const std::string tagName) { if (!p_track) return; @@ -296,4 +296,4 @@ void AudioPlayback::update() { MIX_SetTrackFrequencyRatio(p_track, p_pitch); } } -} \ No newline at end of file +} diff --git a/tests.sh b/tests.sh old mode 100644 new mode 100755 index 1d17b49..c61fe1d --- a/tests.sh +++ b/tests.sh @@ -1,56 +1,10 @@ #!/bin/bash -# -# ПЕРЕПИСАТЬ ЭТУ ХУЙНЮ ОНА НЕ РАБОТАЕТ -# +# Scripts for static analysis +set -eo pipefail +cppcheck . --force --check-level=exhaustive -q --enable=performance -set -euo pipefail -FASTERER_PATH="$1" - -check_c(){ - local f="$1" - - case "$f" in - *.c|*.cc|*.cpp|*.cxx) - #cppcheck --check-level=exhaustive --disable=missingInclude --enable=all --force -q -I . "$f" \ - # || echo "cppcheck is not installed or reported issues for: $f" - - #gcc -fanalyzer -Wall -Wextra -Wpedantic -std=c11 -c "$f" -o /dev/null 2>/dev/null \ - # || echo "gcc is not installed or analyzer reported issues for: $f" - - cbmc "$f" \ - || echo "cbmc is not installed or reported issues for: $f" - ;; - *.h|*.hh|*.hpp|*.hxx) - cppcheck --check-level=exhaustive --enable=all --disable=missingInclude -q "$f" \ - || echo "cppcheck is not installed or reported issues for header: $f" - ;; - esac -} - -check_shader(){ - local f="$1" - case "$f" in - *.vert) - #glslangValidator -S vert --target-env opengl --client opengl100 -t "$f" - ;; - *.frag) - glslangValidator -S frag --target-env opengl --client opengl100 -t -DGLSLES -DFRAGMENT_SHADER "$f" - ;; - esac -} -export -f check_c -export -f check_shader - -find . -type f \( \ - -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cxx' \ - -o -name '*.h' -o -name '*.hh' -o -name '*.hpp' -o -name '*.hxx' \ -\) -print0 \ -| xargs -0 -n 1 bash -c 'check_c "$1"' _ - -find . -type f \( \ - -name '*.frag' -o -name '*.vert' \ -\) -print0 \ -| xargs -0 -n 1 bash -c 'check_shader "$1"' _ - -find . | grep .rb | $FASTERER_PATH -glslangValidator +if [ -n "$1" ]; then + find . | grep .rb | "$1" +else + echo "path to Ruby FASTERER not present, skip" +fi