Skip to content

Commit

Permalink
( ͡° ͜ʖ ͡°)
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Jan 16, 2023
1 parent e118cd7 commit 0155b8a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
5 changes: 1 addition & 4 deletions platform/cafe/source/utilities/driver/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ Framebuffer::Framebuffer() :
{}

Framebuffer::~Framebuffer()
{
free(this->state);
this->state = nullptr;
}
{}

void Framebuffer::Create(Screen screen)
{
Expand Down
5 changes: 5 additions & 0 deletions platform/cafe/source/utilities/driver/renderer_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ Renderer<Console::CAFE>::~Renderer()

GX2Shutdown();

free(this->state);
this->state = nullptr;

free(this->commandBuffer);
this->commandBuffer = nullptr;
}
Expand Down Expand Up @@ -290,6 +293,8 @@ void Renderer<Console::CAFE>::Present()
if (Keyboard()->IsShowing())
{
nn::swkbd::DrawDRC();
this->ClearDepthStencil(0, 0xFF, 1.0);

GX2SetContextState(this->state);
}

Expand Down
25 changes: 21 additions & 4 deletions source/modules/love/scripts/callbacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,31 @@ function love.createhandlers()
error("Unknown event: " .. name)
end,
})

end

-----------------------------------------------------------
-- Default callbacks.
-----------------------------------------------------------

-- we need to fix some bugs/inconsistencies on Wii U
local is_wii_u = love._os == "Cafe"

-- Checks if `love.draw("gamepad")` should fire
-- This happens only when the software keyboard is shown
-- For some reason the software keyboard has some kind of depth testing enabled
local function shouldDraw(screen)
if not is_wii_u then
return true
end

-- when gamepad and keyboard shown, do not draw
if screen == "gamepad" and love.keyboard.hasTextInput() then
return false
end
-- when tv, always draw
return true
end

function love.run()
if love.load then
love.load(arg)
Expand All @@ -215,7 +233,6 @@ function love.run()
end

local delta = 0
local is_wii_u = love._os == "Cafe"

return function()
if love.window and g_windowShown then
Expand All @@ -240,7 +257,7 @@ function love.run()
delta = love.timer.step()
end

if love.update and (is_wii_u and not love.keyboard.hasTextInput()) then
if love.update then
love.update(delta)
end

Expand All @@ -253,7 +270,7 @@ function love.run()
love.graphics.setActiveScreen(screen)
love.graphics.clear(love.graphics.getBackgroundColor())

if love.draw then
if love.draw and shouldDraw(screen) then
love.draw(screen)
end
end
Expand Down

0 comments on commit 0155b8a

Please sign in to comment.