Skip to content

Commit

Permalink
Config path linux same as windows. Fix..
Browse files Browse the repository at this point in the history
Config path linux same as windows. Fix spam opengl error 1282 (need fix it in future, issue with model .mdl render). Fix dump texture list remove values after delete texture.
  • Loading branch information
UnrealKaraulov committed Dec 5, 2023
1 parent 73f8172 commit 4798121
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gui::Gui(Renderer* app)

void Gui::init()
{
iniPath = getConfigDir() + "imgui.ini";
iniPath = g_config_dir + "imgui.ini";
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
Expand Down
3 changes: 2 additions & 1 deletion src/editor/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,10 @@ void Renderer::renderLoop()
}

int glerror = glGetError();
if (glerror != GL_NO_ERROR)
while (glerror != GL_NO_ERROR)
{
logf(get_localized_string(LANG_0905),glerror);
glerror = glGetError();
}

if (updatePickCount)
Expand Down
2 changes: 1 addition & 1 deletion src/gl/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Texture::~Texture()
glDeleteTextures(1, &id);
delete[] data;

std::remove(dumpTextures.begin(), dumpTextures.end(), this);
dumpTextures.erase(std::remove(dumpTextures.begin(), dumpTextures.end(), this), dumpTextures.end());
}

void Texture::upload(int _format, bool lightmap)
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ int main(int argc, char* argv[])
g_settings_path = GetCurrentDir() + "bspguy.cfg";
g_config_dir = GetCurrentDir();
#else
g_settings_path = fileExists(getConfigDir() + "bspguy.cfg") ? getConfigDir() + "bspguy.cfg" : GetCurrentDir() + "bspguy.cfg";
g_config_dir = fileExists(getConfigDir() + "bspguy.cfg") ? getConfigDir() : GetCurrentDir();
g_settings_path = GetCurrentDir() + "bspguy.cfg";
g_config_dir = GetCurrentDir();
#endif
// test svencoop merge
//return test();
Expand Down
27 changes: 2 additions & 25 deletions src/mdl/mdl_studio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,9 @@ Studio models are position independent, so the cache manager can move them.
==============================================================================
*/
#pragma pack(push, 1)
#define MAXSTUDIOTRIANGLES 20000 // TODO: tune this
#define MAXSTUDIOTRIANGLES 32768 // TODO: tune this
#define MAXSTUDIOVERTS 16384 // TODO: tune this
#define MAXSTUDIOSEQUENCES 2048 // total animation sequences -- KSH incremented
#define MAXSTUDIOSKINS 256 // total textures
#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement
#define MAXSTUDIOBONES 128 // total bones actually used
#define MAXSTUDIOMODELS 32 // sub-models per model
#define MAXSTUDIOBODYPARTS 32
#define MAXSTUDIOGROUPS 16
#define MAXSTUDIOANIMATIONS 2048
#define MAXSTUDIOMESHES 256
#define MAXSTUDIOEVENTS 1024
#define MAXSTUDIOPIVOTS 256
#define MAXSTUDIOCONTROLLERS 32

#define MAXSTUDIOBONES 128


#define MAX_TRIS_PER_BODYGROUP MAXSTUDIOTRIANGLES
Expand Down Expand Up @@ -83,17 +71,6 @@ Studio models are position independent, so the cache manager can move them.
#define STUDIO_TYPES 0x7FFF
#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance

// sequence flags
#define STUDIO_LOOPING 0x0001

// bone flags
#define STUDIO_HAS_NORMALS 0x0001
#define STUDIO_HAS_VERTICES 0x0002
#define STUDIO_HAS_BBOX 0x0004
#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them

#define RAD_TO_STUDIO (32768.0/M_PI)
#define STUDIO_TO_RAD (M_PI/32768.0)
#define MAXEVENTSTRING 64

typedef struct
Expand Down
12 changes: 0 additions & 12 deletions src/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,13 +1206,6 @@ void print_color(int colors)
colors = colors ? colors : (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
SetConsoleTextAttribute(console, (WORD)colors);
}

std::string getConfigDir()
{
wchar_t path[1024];
SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path);
return fs::path(path).string() + "/AppData/Roaming/bspguy/";
}
#else
void print_color(int colors)
{
Expand All @@ -1235,11 +1228,6 @@ void print_color(int colors)
}
logf(get_localized_string(LANG_1015),mode,color);
}

std::string getConfigDir()
{
return getenv("HOME") + std::string("/.config/bspguy/");
}
#endif


Expand Down
10 changes: 5 additions & 5 deletions src/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ inline void logf(const std::string & format, Args ...args) noexcept
outfile.flush();
#endif

std::cout << log_line;
g_log_buffer.push_back(log_line);

if (g_log_buffer.size() == 0 || g_log_buffer[g_log_buffer.size() - 1] != log_line)
{
std::cout << log_line;
g_log_buffer.push_back(log_line);
}
g_mutex_list[0].unlock();
}

Expand Down Expand Up @@ -164,8 +166,6 @@ void replaceAll(std::string& str, const std::string& from, const std::string& to

void WriteBMP(const std::string& fileName, unsigned char* pixels, int width, int height, int bytesPerPixel);

std::string getConfigDir();

extern fs::path g_current_dir;
std::string GetCurrentDir();
std::string GetWorkDir();
Expand Down

0 comments on commit 4798121

Please sign in to comment.