Cleanup Includes/Add PushMessage(string, string)

This commit is contained in:
tobid7 2024-05-17 11:33:09 +02:00
parent e0c03f2ec5
commit f3291963d4
23 changed files with 35 additions and 66 deletions

View File

@ -2,17 +2,13 @@
#include <unistd.h>
#include <cstring>
#include <functional>
#include <memory>
#include <regex>
#include <sstream>
#include <string>
#define UNPACK_RGBA(col) (uint8_t)(col >> 24), (col >> 16), (col >> 8), (col)
#define UNPACK_BGRA(col) (uint8_t)(col >> 8), (col >> 16), (col >> 24), (col)
inline uint32_t RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) {
#define ISIMPLEPAK(x, y) (((x)&0xff) << y)
#define ISIMPLEPAK(x, y) (((x) & 0xff) << y)
return (ISIMPLEPAK(r, 0) | ISIMPLEPAK(g, 8) | ISIMPLEPAK(b, 16) |
ISIMPLEPAK(a, 24));
}
@ -165,4 +161,4 @@ std::string RGB2Hex(int r, int g, int b);
/// @return Color32
uint32_t Hex(const std::string &color, uint8_t a = 255);
} // namespace Color
} // namespace RenderD7
} // namespace RenderD7

View File

@ -6,7 +6,6 @@
#include <renderd7/Image.hpp>
#include <renderd7/R7Vec.hpp>
#include <renderd7/font.hpp>
#include <string>
#define MAKEFLAG(x) (1 << x)
@ -51,4 +50,4 @@ void Text(R7Vec2 pos, const std::string& text, RD7TextFlags flags = 0);
void Image(RenderD7::Image* img, const R7Vec2& pos = R7Vec2(0, 0),
const R7Vec2& scale = R7Vec2(1, 1));
} // namespace Draw2
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,10 +1,7 @@
#pragma once
// Base includes
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
// 3ds does not support std::chrono
#include <3ds.h>
@ -50,4 +47,4 @@ inline void End(std::string group, std::string func_name) {
rd7_traces[trace_id].time_start / (float)TICKS_PER_MSEC);
}
} // namespace Ftrace
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,7 +1,6 @@
#pragma once
#include <cstdint>
#include <memory>
#include <cstddef>
namespace RenderD7 {
namespace Memory {

View File

@ -17,6 +17,9 @@ struct Message {
void ProcessMessages();
void PushMessage(const Message& msg);
inline void PushMessage(const std::string& head, const std::string& msg) {
PushMessage(Message(head, msg));
}
// Config
void SetMessageIdleStartFrame(int frame);
void SetMessageTotalAnimationFrames(int total_frames);

View File

@ -1,4 +1,5 @@
#pragma once
#include <map>
#include <memory>
namespace RenderD7 {
@ -24,4 +25,4 @@ class Ovl {
/// @brief Add an Overlay to the Screen
/// @param scene Overlay to push to Screen
void AddOvl(std::unique_ptr<RenderD7::Ovl> scene);
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,11 +1,6 @@
#pragma once
#include <3ds.h>
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
namespace RenderD7 {
namespace Init {
void Security();
@ -53,4 +48,4 @@ class Security {
} // namespace RenderD7
/// @brief RenderD7 Security Object
extern RenderD7::Security *rd7_security;
extern RenderD7::Security *rd7_security;

View File

@ -1,8 +1,6 @@
#pragma once
#include <3ds.h>
#include <vector>
namespace RenderD7 {
namespace Tasks {
/// @brief Push A Task
@ -11,4 +9,4 @@ void create(ThreadFunc entrypoint);
/// @brief Destroy all Tasks
void destroy(void);
} // namespace Tasks
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,11 +1,7 @@
#pragma once
#include <algorithm>
#include <functional>
#include <renderd7/DrawV2.hpp>
#include <renderd7/R7Vec.hpp>
#include <string>
#include <vector>
// UI7: The new RenderD7 UI Standart based on
// Draw2 (based on Citro2D)
@ -56,4 +52,4 @@ R7Vec2 GetCursorPos();
void SetCursorPos(R7Vec2 cp);
void RestoreCursor();
void SameLine();
} // namespace UI7
} // namespace UI7

View File

@ -4,7 +4,6 @@
#include <fstream>
#include <renderd7/Error.hpp>
#include <string>
namespace RenderD7 {
class Font {
@ -30,4 +29,4 @@ class Font {
private:
C2D_Font fnt = nullptr;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,9 +1,7 @@
#pragma once
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
#include <fstream>
#include <string>
/// @brief Log Class

View File

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
#define NPI_NIMG_ (uint32_t)0x4e494d47 // Magic: NIMG
@ -27,4 +27,4 @@ struct nimg {
nimg NIMG_Load(std::string path);
nimg NIMG_LoadFromMem(unsigned char* buffer, size_t bf_size);
void NIMG_Save(nimg image, std::string path);
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,18 +1,10 @@
#pragma once
/// c++ Includes
#include <algorithm>
#include <codecvt>
#include <cstring>
#include <filesystem>
#include <functional>
#include <iostream>
#include <locale>
#include <map>
#include <memory>
#include <random>
#include <stack>
#include <string>
#include <vector>
/// c includes
#include <dirent.h>
#include <stdio.h>

View File

@ -4,7 +4,6 @@
#include <atomic>
#include <functional>
#include <renderd7/parameter.hpp>
#include <string>
using CTRU_Thread = Thread;

View File

@ -149,4 +149,4 @@ void Sample::Logic() {
// Make sure to clear after processing!!!;
shared_requests.clear();
if (d7_hDown & KEY_B) debug_background = !debug_background;
}
}

View File

@ -1,6 +1,5 @@
#include <citro2d.h>
#include <algorithm>
#include <renderd7/DrawV2.hpp>
#include <renderd7/global_db.hpp>
#include <renderd7/internal_db.hpp>
@ -238,4 +237,4 @@ void Image(RenderD7::Image *img, const R7Vec2 &pos, const R7Vec2 &scale) {
C2D_DrawImageAt(img->get(), pos.x, pos.y, 0.5f, nullptr, scale.x, scale.y);
}
} // namespace Draw2
} // namespace RenderD7
} // namespace RenderD7

View File

@ -8,7 +8,6 @@
// Debugging
#include <algorithm>
#include <filesystem>
#include <memory>
#include <renderd7/stringtool.hpp>
bool ___dir__predicate__(const RenderD7::FileSystem::Entry &lhs,
@ -68,4 +67,4 @@ RenderD7::FileSystem::GetDirContentsExt(
}
std::sort(res.begin(), res.end(), ___dir__predicate__);
return res;
}
}

View File

@ -51,4 +51,4 @@ size_t GetTotalFreed() { return metrics.t_TotalFreed; }
size_t GetCurrent() { return metrics.t_CurrentlyAllocated(); }
} // namespace Memory
} // namespace RenderD7
} // namespace RenderD7

View File

@ -3,6 +3,7 @@
#include <string.h>
#include <renderd7/Tasks.hpp>
#include <vector>
static std::vector<Thread> threads;
@ -19,4 +20,4 @@ void RenderD7::Tasks::destroy(void) {
threadJoin(threads.at(i), U64_MAX);
threadFree(threads.at(i));
}
}
}

View File

@ -4,7 +4,6 @@
#include <time.h>
#include <unistd.h>
#include <fstream>
#include <memory>
#include <renderd7/Time.hpp>
#include <string>

View File

@ -1,5 +1,4 @@
#include <arpa/inet.h>
#include <errno.h>
#include <malloc.h>
#include <stdarg.h>
#include <stdio.h>
@ -7,7 +6,6 @@
#include <string.h>
#include <unistd.h>
#include <filesystem>
#include <renderd7/FileSystem.hpp>
#include <renderd7/external/json.hpp>
#include <renderd7/renderd7.hpp>
@ -253,4 +251,4 @@ void ServerThread(RenderD7::Parameter param) {
void IdbServer() {
rd7i_idb_server.initialize(ServerThread);
rd7i_idb_server.start(true);
}
}

View File

@ -1,15 +1,13 @@
#include <filesystem>
#include <fstream>
#include <map>
#include <iostream>
#include <renderd7/nimg.hpp>
#include <sstream>
// Use an Npi simplifier cause I am lazy
#define reca_cc(x) reinterpret_cast<const char*>(x)
#define reca_c(x) reinterpret_cast<char*>(x)
#define pak32(q, w, e, r) \
((((q)&0xff) << 0) | (((w)&0xff) << 8) | (((e)&0xff) << 16) | \
(((r)&0xff) << 24))
#define pak32(q, w, e, r) \
((((q) & 0xff) << 0) | (((w) & 0xff) << 8) | (((e) & 0xff) << 16) | \
(((r) & 0xff) << 24))
// Stupid RLE Algorithm
void npi_compress(std::vector<unsigned char>& ret,
@ -116,4 +114,4 @@ void NIMG_Save(nimg image, std::string path) {
// Close stream
fout.close();
}
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,4 +1,3 @@
#include <regex>
#include <renderd7/DrawV2.hpp> // Switch to Draw2
#include <renderd7/Hid.hpp> // Integate HidApi
#include <renderd7/Message.hpp>
@ -12,6 +11,10 @@
#include <renderd7/external/json.hpp>
#include <renderd7/internal_db.hpp>
// C++ includes
#include <filesystem>
#include <random>
static void RD7i_ExitHook() {
C2D_TextBufDelete(rd7i_text_buffer);
C2D_TextBufDelete(rd7i_d2_dimbuf);
@ -599,10 +602,10 @@ void RenderD7::RSettings::Draw(void) const {
// List Bg
for (int i = 0; i < 12; i++) {
if ((i % 2 == 0))
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
RenderD7::StyleColor(RD7Color_List0));
else
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i)*15), R7Vec2(400, 15),
RenderD7::Draw2::RFS(R7Vec2(0, 40 + (i) * 15), R7Vec2(400, 15),
RenderD7::StyleColor(RD7Color_List1));
}
@ -821,4 +824,4 @@ float RenderD7::GetTime() { return rd7i_time; }
std::string RenderD7::GetAppDirectory() {
return "sdmc:/RenderD7/Apps/" + rd7i_app_name;
}
}