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:
@@ -27,6 +27,6 @@ SOFTWARE.
|
||||
#include <pd-3ds/bknd-hid.hpp>
|
||||
|
||||
namespace PD {
|
||||
PD::Li::Font::Ref LoadSystemFont();
|
||||
PD::Li::Font::Ref LoadSystemFont(Context& ctx);
|
||||
void Init(void* data = nullptr);
|
||||
} // namespace PD
|
||||
@@ -32,7 +32,7 @@ SOFTWARE.
|
||||
namespace PD {
|
||||
class GfxC3D : public GfxDriver {
|
||||
public:
|
||||
GfxC3D() : GfxDriver("Citro3D") {}
|
||||
GfxC3D(PDDriverData data = nullptr) : GfxDriver("Citro3D") {}
|
||||
~GfxC3D() = default;
|
||||
|
||||
PD_SHARED(GfxC3D);
|
||||
|
||||
@@ -28,7 +28,7 @@ SOFTWARE.
|
||||
namespace PD {
|
||||
class Hid3DS : public HidDriver {
|
||||
public:
|
||||
Hid3DS();
|
||||
Hid3DS(PDDriverData data = nullptr);
|
||||
~Hid3DS() = default;
|
||||
|
||||
PD_SHARED(Hid3DS);
|
||||
|
||||
@@ -42,7 +42,7 @@ class LinearAllocator {
|
||||
|
||||
T* allocate(std::size_t n) {
|
||||
if (n > max_size()) {
|
||||
throw std::runtime_error("[PD] LinearAllocator: Bad alloc!");
|
||||
PD::Throw("[PD] LinearAllocator: Bad alloc!");
|
||||
}
|
||||
return static_cast<T*>(linearAlloc(n * sizeof(T)));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user