Skip to content

Commit

Permalink
push some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Jan 7, 2023
1 parent 84997dc commit 402f392
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 224 deletions.
26 changes: 10 additions & 16 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,41 @@
"ctrIncludePaths": [
"${workspaceFolder}/platform/ctr/include/**",
"${workspaceFolder}/platform/ctr/libraries/**",
"${env:DEVKITPRO}/devkitARM/arm-none-eabi/include/**",
"${env:DEVKITPRO}/devkitARM/lib/gcc/arm-none-eabi/**",
"${env:DEVKITPRO}/libctru/include/**",
"${env:DEVKITPRO}/portlibs/3ds/include/**"
"C:/msys64/opt/devkitpro/libctru/include/**",
"C:/msys64/opt/devkitpro/portlibs/3ds/include/**"
],
"ctrDefines": [
"__3DS__",
"__OS__=\"Horizon\"",
"__CONSOLE__=\"3DS\""
],
"ctrCompilerPath": "${env:DEVKITPRO}/devkitARM/bin/arm-none-eabi-g++",
"ctrCompilerPath": "C:/msys64/opt/devkitpro/devkitARM/bin/arm-none-eabi-g++",
/* Switch paths and info */
"hacIncludePaths": [
"${workspaceFolder}/platform/hac/include/**",
"${env:DEVKITPRO}/devkitA64/aarch64-none-elf/include/**",
"${env:DEVKITPRO}/devkitA64/lib/gcc/aarch64-none-elf/**",
"${env:DEVKITPRO}/libnx/include/**",
"${env:DEVKITPRO}/portlibs/switch/include/**"
"C:/msys64/opt/devkitpro/libnx/include/**",
"C:/msys64/opt/devkitpro/portlibs/switch/include/**"
],
"hacDefines": [
"__SWITCH__",
"__BSD_VISIBLE",
"__CONSOLE__=\"Switch\"",
"__OS__=\"Horizon\""
],
"hacCompilerPath": "${env:DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++",
"hacCompilerPath": "C:/msys64/opt/devkitpro/devkitA64/bin/aarch64-none-elf-g++",
/* Wii U paths and info */
"cafeIncludePaths": [
"${workspaceFolder}/platform/cafe/include/**",
"${env:DEVKITPRO}/devkitPPC/powerpc-eabi/include/**",
"${env:DEVKITPRO}/devkitPPC/lib/gcc/powerpc-eabi/**",
"${env:DEVKITPRO}/wut/include/**",
"${env:DEVKITPRO}/portlibs/wiiu/include/**",
"${env:DEVKITPRO}/portlibs/ppc/include/**"
"C:/msys64/opt/devkitpro/wut/include/**",
"C:/msys64/opt/devkitpro/portlibs/wiiu/include/**",
"C:/msys64/opt/devkitpro/portlibs/ppc/include/**"
],
"cafeDefines": [
"__WIIU__",
"__OS__=\"Cafe\"",
"__CONSOLE__=\"Wii U\""
],
"cafeCompilerPath": "${env:DEVKITPRO}/devkitPPC/bin/powerpc-eabi-g++"
"cafeCompilerPath": "C:/msys64/opt/devkitpro/devkitPPC/bin/powerpc-eabi-g++"
},
"configurations": [
{
Expand Down
14 changes: 5 additions & 9 deletions platform/cafe/include/modules/keyboard_ext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ namespace love

virtual ~Keyboard();

void Draw(GX2ContextState* restored)
void SetContextState()
{
if (!this->showing)
if (!this->IsShowing())
return;

nn::swkbd::DrawDRC();

GX2SetContextState(restored);
Shader<>::current->Attach(true);
GX2SetContextState(this->state);
}

void SetTextInput(const KeyboardOptions& options);
Expand All @@ -45,13 +42,13 @@ namespace love

const bool IsShowing() const
{
return this->showing;
auto state = nn::swkbd::GetStateInputForm();
return state != nn::swkbd::State::Hidden;
}

void HideKeyboard()
{
nn::swkbd::DisappearInputForm();
this->showing = false;
}

void Utf16toUtf8Text();
Expand All @@ -72,6 +69,5 @@ namespace love
FSClient* client;

bool inited;
bool showing;
};
} // namespace love
14 changes: 7 additions & 7 deletions platform/cafe/source/modules/keyboard_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ Keyboard<Console::CAFE>::Keyboard() :
createArgs {},
appearArgs {},
client(nullptr),
inited(false),
showing(false)
inited(false)
{}

void Keyboard<Console::CAFE>::Initialize()
{
this->state = (GX2ContextState*)memalign(GX2_CONTEXT_STATE_ALIGNMENT, sizeof(GX2ContextState));

this->client = (FSClient*)MEMAllocFromDefaultHeap(sizeof(FSClient));
if (!this->state)
throw love::Exception("Failed to allocate GX2ContextState for nn::swkbd!");

GX2SetupContextStateEx(this->state, false);

this->client = (FSClient*)MEMAllocFromDefaultHeap(sizeof(FSClient));

if (!this->client)
throw love::Exception("Failed to allocate FSClient for nn::swkbd!");

Expand Down Expand Up @@ -83,8 +86,5 @@ void Keyboard<Console::CAFE>::SetTextInput(const KeyboardOptions& options)
this->appearArgs.inputFormArg.maxTextLength = options.maxLength;
this->appearArgs.inputFormArg.passwordMode = GetPasswordMode(options.isPassword);

if (!nn::swkbd::AppearInputForm(this->appearArgs))
return;

this->showing = true;
nn::swkbd::AppearInputForm(this->appearArgs);
}
6 changes: 5 additions & 1 deletion platform/cafe/source/utilities/driver/framebuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <utilities/driver/framebuffer.hpp>

#include <modules/keyboard_ext.hpp>

#include <objects/shader_ext.hpp>

#include <gx2/display.h>
Expand All @@ -15,6 +17,8 @@

using namespace love;

#define Keyboard() (Module::GetInstance<Keyboard<Console::CAFE>>(Module::M_KEYBOARD))

Framebuffer::Framebuffer() :
modelView(1.0f),
transform(nullptr),
Expand Down Expand Up @@ -182,7 +186,7 @@ void Framebuffer::SetDRCScanBuffer()

void Framebuffer::CopyScanBuffer()
{
const auto target = Framebuffer::SCAN_TARGETS[(uint8_t)this->id];
auto target = (this->Is(Screen::TV)) ? GX2_SCAN_TARGET_TV : GX2_SCAN_TARGET_DRC;
GX2CopyColorBufferToScanBuffer(&this->colorBuffer, target);
}

Expand Down
24 changes: 11 additions & 13 deletions platform/cafe/source/utilities/driver/renderer_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <malloc.h>
#include <stdlib.h>

#include <utilities/log/logfile.hpp>

using namespace love;

#define Keyboard() (Module::GetInstance<Keyboard<Console::CAFE>>(Module::M_KEYBOARD))
Expand Down Expand Up @@ -63,7 +61,8 @@ Renderer<Console::CAFE>::Renderer() :
GX2SetupContextStateEx(this->state, false);
GX2SetContextState(this->state);

GX2SetDepthOnlyControl(true, true, GX2_COMPARE_FUNC_ALWAYS);
GX2SetDepthOnlyControl(false, false, GX2_COMPARE_FUNC_ALWAYS);
// GX2SetAlphaTest(true, GX2_COMPARE_FUNC_GREATER, 0);

GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, false, true);
GX2SetSwapInterval(1);
Expand Down Expand Up @@ -249,22 +248,21 @@ void Renderer<Console::CAFE>::BindFramebuffer(Texture<Console::CAFE>* texture)

void Renderer<Console::CAFE>::Present()
{
if (Keyboard() != nullptr)
Keyboard()->Draw(this->state);

/* flush commands before copying color buffers */
GX2Flush();
if (Keyboard()->IsShowing())
{
nn::swkbd::DrawDRC();
GX2SetContextState(this->state);
Shader<Console::CAFE>::current->Attach(true);
}

/* copy our color buffers to their scan buffers */
for (auto& framebuffer : this->framebuffers)
framebuffer.second.CopyScanBuffer();
this->framebuffers[Screen::TV].CopyScanBuffer();

this->framebuffers[Screen::GAMEPAD].CopyScanBuffer();

/* swap scan buffers */
GX2SwapScanBuffers();

/* reset state for next frame */
GX2SetContextState(this->state);

/*
** flush again as GX2WaitForFlip
** will block the CPU
Expand Down
1 change: 0 additions & 1 deletion platform/hac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ target_sources(${PROJECT_NAME} PRIVATE
source/objects/wrap_imagedata_ext.cpp
source/objects/wrap_joystick_ext.cpp
source/runtime.cpp
source/utilities/driver/CImage.cpp
source/utilities/driver/CIntrusiveTree.cpp
source/utilities/driver/CMemPool.cpp
source/utilities/driver/dsp_ext.cpp
Expand Down
177 changes: 0 additions & 177 deletions platform/hac/source/utilities/driver/CImage.cpp

This file was deleted.

0 comments on commit 402f392

Please sign in to comment.