mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Engine optimization and test.sh rewrite
This commit is contained in:
parent
116ba28508
commit
d9894dcee3
10 changed files with 45 additions and 69 deletions
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
VALUE meow(std::vector<std::string> vec){
|
||||
VALUE meow(const std::vector<std::string> 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());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{};
|
||||
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ int Input::mouseY(){
|
|||
return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
|
||||
}
|
||||
|
||||
void Input::setBinding(std::vector<SourceDesc> descs, Input::ButtonCode target){
|
||||
void Input::setBinding(const std::vector<SourceDesc> descs, Input::ButtonCode target){
|
||||
p->setBindingDescs(descs, target);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
|
|||
22
src/meow.cpp
22
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ void DynamicLightShader::setTileMapOffset(int x, int y){
|
|||
gl.Uniform2f(u_tileMapOffset, x, y);
|
||||
}
|
||||
|
||||
void DynamicLightShader::setLightSources(std::vector<LightSource> sources){
|
||||
void DynamicLightShader::setLightSources(const std::vector<LightSource> sources){
|
||||
int count = 0;
|
||||
int screenWidth = shState->graphics().width();
|
||||
int screenHeight = shState->graphics().height();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
62
tests.sh
Normal file → Executable file
62
tests.sh
Normal file → Executable file
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue