WIP Backend System Redesign Step 1

- Created 1 Context for Backend Management and Sharing
- Made every class that used a static Backend require the Context or specific Backend
- Bring Back 3ds support
This commit is contained in:
2026-01-26 20:46:27 +01:00
parent 892f8ce0c4
commit e8072a064c
47 changed files with 350 additions and 242 deletions

View File

@@ -156,7 +156,7 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) {
// C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, pLocProjection, (C3D_Mtx*)&proj);
size_t index = 0;
while (index < Commands.Size()) {
PD::Li::Texture::Ref Tex = Commands.GetCmd(index)->Tex;
PD::Li::TexAddress Tex = Commands.GetCmd(index)->Tex;
if (!Tex) {
index++;
continue;
@@ -186,8 +186,8 @@ void GfxC3D::RenderDrawData(const PD::Li::CmdPool& Commands) {
} else {
C3D_SetScissor(GPU_SCISSOR_DISABLE, 0, 0, 0, 0);
}
FragCfg(((C3D_Tex*)Tex->Address)->fmt);
BindTex(Tex->Address);
FragCfg(((C3D_Tex*)Tex)->fmt);
BindTex(Tex);
auto bufInfo = C3D_GetBufInfo();
BufInfo_Init(bufInfo);
BufInfo_Add(bufInfo, VertexBuffer.data(), sizeof(Li::Vertex), 3, 0x210);

View File

@@ -26,7 +26,7 @@ SOFTWARE.
#include <pd-3ds/bknd-hid.hpp>
namespace PD {
Hid3DS::Hid3DS() : HidDriver("Hid3DS") {
Hid3DS::Hid3DS(PDDriverData data) : HidDriver("Hid3DS") {
this->Flags |= Flags_HasTouch;
this->Flags |= FLags_HasGamepad;
pBinds[KEY_A] = A;
@@ -64,7 +64,7 @@ void Hid3DS::Update() {
u32 kd = hidKeysDown();
u32 kh = hidKeysHeld();
u32 ku = hidKeysUp();
for (auto &b : pBinds) {
for (auto& b : pBinds) {
if (b.first & kd) {
KeyEvents[0][Event_Down] |= b.second;
}

View File

@@ -27,9 +27,9 @@ SOFTWARE.
#include <pd-3ds.hpp>
namespace PD {
PD::Li::Font::Ref LoadSystemFont() {
TT::Scope st("LI_SystemFont"); // Trace loading time
Li::Font::Ref ret = Li::Font::New();
PD::Li::Font::Ref LoadSystemFont(Context& ctx) {
TT::Scope st(*ctx.Os(), "LI_SystemFont"); // Trace loading time
Li::Font::Ref ret = Li::Font::New(ctx);
fontEnsureMapped(); // Call this to be sure the font is mapped
// Get some const references for system font loading
const auto fnt = fontGetSystemFont();
@@ -124,8 +124,8 @@ PD::Li::Font::Ref LoadSystemFont() {
void Init(void* data) {
// Dekstop Init Stage
// First use default OS Driver
PD::OS::Init();
PD::Gfx::Init(PD::GfxC3D::New());
PD::Hid::Init(PD::Hid3DS::New());
// PD::OS::Init();
// PD::Gfx::Init(PD::GfxC3D::New());
// PD::Hid::Init(PD::Hid3DS::New());
}
} // namespace PD