# Stage 2.2

- Move Timer to core
- Use Timer for app_time
- Fix Deltatime Bug in App
- Add HwInfo to lib3ds (stolen from hbloader 2 pd-rewrite port)
- Add GetSystemLanguage to lib3ds
- Add Net Header for pd-net (still need to find a way to make this working)
- Add base Decoder and Player Headers for pd-sound
- Add Mp3 Decoder (useless and untested yet)
- Add GetDataDirectory to App
- Add InitFLag to App for HwInfo
- Actually write the Timer class
- Rework the UI7 Theme API to use SmartCtor
- UI7::Menu::JoinAlign: Use a loop to determinate max width for centering a group
- Add some Doctumentation around UI7::Menu
This commit is contained in:
2025-02-28 19:49:24 +01:00
parent f9a1d8aefb
commit debedf59c6
27 changed files with 840 additions and 98 deletions

View File

@ -26,6 +26,7 @@ SOFTWARE.
#include <pd/app/app.hpp>
#include <pd/core/sys.hpp>
#include <pd/lib3ds/hwinfo.hpp>
namespace PD {
int App::too;
@ -33,17 +34,17 @@ int App::too;
void App::Run() {
this->PreInit();
this->Init();
last_time = Sys::GetTime();
last_time = Sys::GetNanoTime();
while (aptMainLoop()) {
input_mgr->Update();
u64 current = Sys::GetNanoTime();
float dt = static_cast<float>(current - last_time) / 1000000.f;
app_time += dt / 1000.f;
app_time->Update();
last_time = current;
fps = 1000.f / dt;
if (runtimeflags & AppFLags_UserLoop) {
PD::TT::Beg("App_MainLoop");
if (!this->MainLoop(dt, app_time)) {
if (!this->MainLoop(dt, app_time->GetSeconds())) {
break;
}
PD::TT::End("App_MainLoop");
@ -73,6 +74,12 @@ void App::Run() {
this->PostDeinit();
}
std::string App::GetDataDirectory() {
Assert(SafeInitFlags & AppInitFlags_UnnamedOption1,
"Data Dir is not enabled!");
return "sdmc:/palladium/apps/" + name;
}
void App::PreInit() {
/// Create a Copy that won't get edit
SafeInitFlags = InitFlags;
@ -87,6 +94,9 @@ void App::PreInit() {
if (InitFlags & AppInitFlags_MountRomfs) {
romfsInit();
}
if (InitFlags & AppInitFlags_InitHwInfo) {
PD::HwInfo::Init();
}
if (InitFlags & AppInitFlags_UnnamedOption1) {
std::filesystem::create_directories("sdmc:/palladium/apps/" + name);
}
@ -103,6 +113,7 @@ void App::PreInit() {
msg_mgr = MessageMgr::New(renderer);
overlay_mgr = OverlayMgr::New(renderer, input_mgr);
}
app_time = Timer::New();
}
void App::PostDeinit() {
@ -116,6 +127,9 @@ void App::PostDeinit() {
}
gfxExit();
}
if (SafeInitFlags & AppInitFlags_InitHwInfo) {
PD::HwInfo::Deinit();
}
cfguExit();
if (SafeInitFlags & AppInitFlags_MountRomfs) {
romfsExit();