chore: update

This commit is contained in:
2025-11-16 21:30:39 +01:00
parent f273adabf6
commit 3564f4d653
7 changed files with 19 additions and 19 deletions

2
deps/GSL vendored

Submodule deps/GSL updated: 7e0943d20d...543d0dd3fe

2
deps/gsc-tool vendored

2
deps/minhook vendored

View File

@@ -15,7 +15,7 @@ namespace demonware
{ {
std::string get_motd_text() std::string get_motd_text()
{ {
return "This is not a copy & pasted client"; return "Did you know aiming down sights increases accuracy? Online Interactions Not Rated by the ESRB.";
} }
} }

View File

@@ -1 +1 @@
Welcome to s1-mod. This is not a copy & pasted project. Welcome to s1-mod. Did you know aiming down sights increases accuracy? Online Interactions Not Rated by the ESRB.

View File

@@ -22,54 +22,54 @@ namespace utils::string
++this->current_buffer_ %= ARRAY_COUNT(this->string_pool_); ++this->current_buffer_ %= ARRAY_COUNT(this->string_pool_);
auto entry = &this->string_pool_[this->current_buffer_]; auto entry = &this->string_pool_[this->current_buffer_];
if (!entry->size || !entry->buffer) if (!entry->size_ || !entry->buffer_)
{ {
throw std::runtime_error("String pool not initialized"); throw std::runtime_error("String pool not initialized");
} }
while (true) while (true)
{ {
const int res = vsnprintf_s(entry->buffer, entry->size, _TRUNCATE, format, ap); const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap);
if (res > 0) break; // Success if (res > 0) break; // Success
if (res == 0) return nullptr; // Error if (res == 0) return nullptr; // Error
entry->double_size(); entry->double_size();
} }
return entry->buffer; return entry->buffer_;
} }
private: private:
class entry final class entry final
{ {
public: public:
explicit entry(const size_t _size = MinBufferSize) : size(_size), buffer(nullptr) explicit entry(const size_t size = MinBufferSize) : size_(size), buffer_(nullptr)
{ {
if (this->size < MinBufferSize) this->size = MinBufferSize; if (this->size_ < MinBufferSize) this->size_ = MinBufferSize;
this->allocate(); this->allocate();
} }
~entry() ~entry()
{ {
if (this->buffer) memory::get_allocator()->free(this->buffer); if (this->buffer_) memory::get_allocator()->free(this->buffer_);
this->size = 0; this->size_ = 0;
this->buffer = nullptr; this->buffer_ = nullptr;
} }
void allocate() void allocate()
{ {
if (this->buffer) memory::get_allocator()->free(this->buffer); if (this->buffer_) memory::get_allocator()->free(this->buffer_);
this->buffer = memory::get_allocator()->allocate_array<char>(this->size + 1); this->buffer_ = memory::get_allocator()->allocate_array<char>(this->size_ + 1);
} }
void double_size() void double_size()
{ {
this->size *= 2; this->size_ *= 2;
this->allocate(); this->allocate();
} }
size_t size; size_t size_;
char* buffer; char* buffer_;
}; };
size_t current_buffer_; size_t current_buffer_;