# Fixes
- 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:
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -44,7 +44,6 @@ unsigned char li_shader[] = {
|
||||
};
|
||||
// clang-format on
|
||||
size_t li_shader_size = 0x124;
|
||||
|
||||
namespace PD {
|
||||
namespace LI {
|
||||
GPU_TEXCOLOR GetTexFmt(Texture::Type type) {
|
||||
@ -170,6 +169,9 @@ PD::LI::Texture::Ref Backend_C3D::LoadTexture(const std::vector<PD::u8>& pixels,
|
||||
PD::LI::Texture::Type type,
|
||||
PD::LI::Texture::Filter filter) {
|
||||
std::cout << "Loading Tex " << std::format("[{}, {}]", w, h) << std::endl;
|
||||
if (w > 1024 || h > 1024) {
|
||||
return nullptr;
|
||||
}
|
||||
// Don't check here as check done before
|
||||
PD::LI::Texture::Ref res = PD::LI::Texture::New();
|
||||
int bpp = GetBPP(type);
|
||||
@ -226,4 +228,4 @@ PD::LI::Texture::Ref Backend_C3D::LoadTexture(const std::vector<PD::u8>& pixels,
|
||||
return res;
|
||||
}
|
||||
} // namespace LI
|
||||
} // namespace PD
|
||||
} // namespace PD
|
||||
|
Reference in New Issue
Block a user