Fix Render discard issue [pd-3ds]

- Clip Rects do now not discard when they move out of screen (cause the maths ends in < 0 which is not working with u32)
- Fixing ui7 crash wehn im input was nullptr
This commit is contained in:
2026-03-10 18:57:29 +01:00
parent 97efca5173
commit 02d2200edd
6 changed files with 15 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ target_include_directories(pd-3ds PUBLIC
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_link_libraries(pd-3ds PUBLIC m palladium ctru citro3d pica::pica) target_link_libraries(pd-3ds PUBLIC m palladium ctru citro3d pica::pica)
add_library(palladium::pd-3ds ALIAS pd-3ds) add_library(palladium::pd-3ds ALIAS pd-3ds)
install(TARGETS pd-3ds install(TARGETS pd-3ds

View File

@@ -180,8 +180,10 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) {
if (ScissorEnabled) { if (ScissorEnabled) {
// Figure out this setup was pain // Figure out this setup was pain
C3D_SetScissor(GPU_SCISSOR_NORMAL, C3D_SetScissor(GPU_SCISSOR_NORMAL,
ViewPort.y - (ScissorRect.y + ScissorRect.w), std::clamp(ViewPort.y - (ScissorRect.y + ScissorRect.w), 0,
ViewPort.x - (ScissorRect.x + ScissorRect.z), ViewPort.y),
std::clamp(ViewPort.x - (ScissorRect.x + ScissorRect.z), 0,
ViewPort.x),
ViewPort.y - ScissorRect.y, ViewPort.x - ScissorRect.x); ViewPort.y - ScissorRect.y, ViewPort.x - ScissorRect.x);
} else { } else {
C3D_SetScissor(GPU_SCISSOR_DISABLE, 0, 0, 0, 0); C3D_SetScissor(GPU_SCISSOR_DISABLE, 0, 0, 0, 0);

View File

@@ -153,7 +153,7 @@ class U8Iterator {
} }
bool PeekNext32(u32& ret) { bool PeekNext32(u32& ret) {
if (ptr + 1 == nullptr || *ptr + 1 == 0) return false; // if ((ptr + 1) == 0 || *(ptr + 1) == 0) return false;
u8 c = *ptr; u8 c = *ptr;
if (c < 0x80) { if (c < 0x80) {
ret = c; ret = c;

View File

@@ -38,6 +38,7 @@ class PD_API Image : public Container {
* @param size Custom Size of the Image * @param size Custom Size of the Image
*/ */
Image(Li::Texture::Ref img, fvec2 size = 0.f, Li::Rect uv = fvec4(0.f)) { Image(Li::Texture::Ref img, fvec2 size = 0.f, Li::Rect uv = fvec4(0.f)) {
if (!img) return;
this->img = img; this->img = img;
if (size == fvec2(0.f)) { if (size == fvec2(0.f)) {
size = img->GetSize(); size = img->GetSize();
@@ -60,7 +61,7 @@ class PD_API Image : public Container {
void Draw() override; void Draw() override;
private: private:
Li::Texture::Ref img; ///< Texture reference to the Image Li::Texture::Ref img = nullptr; ///< Texture reference to the Image
fvec2 newsize = 0.f; ///< New Size fvec2 newsize = 0.f; ///< New Size
Li::Rect cuv; ///< Custom UV Li::Rect cuv; ///< Custom UV
}; };

View File

@@ -26,6 +26,7 @@ SOFTWARE.
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
PD_API void Image::Draw() { PD_API void Image::Draw() {
if (!img) return;
// Assert(io.get() && list.get(), "Did you run Container::Init correctly?"); // Assert(io.get() && list.get(), "Did you run Container::Init correctly?");
// Assert(img.get(), "Image is nullptr!"); // Assert(img.get(), "Image is nullptr!");
// io->Ren->OnScreen(screen); // io->Ren->OnScreen(screen);