- Fix LinearAlloc bug not using *sizeof(T)
- Add WaitForRead to net backend
- Add a Get func to Tween
- Skip \r in Text Rendering
- Add Citro3D Max Texsize check
This commit is contained in:
2025-05-02 15:09:21 +02:00
parent 13c2869ba8
commit f75f7067ff
10 changed files with 91 additions and 30 deletions

View File

@ -39,7 +39,8 @@ class LinearAlloc : public Allocator<T> {
LinearAlloc() = default;
~LinearAlloc() = default;
T* Allocate(size_t n) override { return (T*)linearAlloc(n); }
/** Never forget the sizeof(T) again (most painful bug i created) */
T* Allocate(size_t n) override { return (T*)linearAlloc(n * sizeof(T)); }
void Deallocate(T* ptr) { linearFree(ptr); }
};
namespace LI {

View File

@ -66,6 +66,20 @@ class NetBackend3DS : public Net::Backend {
bool Listen(int sock_id, int backlog = 5) {
return listen(sock_id, backlog) != -1;
}
bool WaitForRead(int sock_id, int timeout_ms) override {
fd_set set;
FD_ZERO(&set);
FD_SET(sock_id, &set);
timeval timeout{};
timeout.tv_sec = timeout_ms / 1000;
timeout.tv_usec = (timeout_ms % 1000) * 1000;
int result = select(sock_id + 1, &set, nullptr, nullptr, &timeout);
return (result > 0 && FD_ISSET(sock_id, &set));
}
bool Accept(int sock_id, Net::Socket::Ref client) {
int client_soc = accept(sock_id, nullptr, nullptr);
if (client_soc == -1) {