Skip to content

Commit 537d1e3

Browse files
committed
Awful first implementation of in app configuration
1 parent 9e6f71a commit 537d1e3

18 files changed

Lines changed: 219 additions & 68 deletions

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ UNIQUE_ID := 0xEDA06
6868
PRODUCT_CODE := CTR-P-LIME
6969
ICON_FLAGS := nosavebackups,visible
7070

71+
NODEBUG := 0
72+
7173
VERSION_MAJOR := 0
7274
VERSION_MINOR := 0
7375
VERSION_BUILD := 8
@@ -90,16 +92,17 @@ CFLAGS := -Wall -mword-relocations \
9092
-fomit-frame-pointer -ffunction-sections \
9193
$(ARCH)
9294

93-
CFLAGS += $(INCLUDE) -DARM11 -D_3DS `arm-none-eabi-pkg-config opusfile --cflags` \
94-
-DLIMEPLAYER_VERSION="$(VERSION_ALL)" \
95-
$(CUSTOMFLAGS)
96-
9795
ifdef RELEASE
9896
CFLAGS += -O3 -g
9997
else
10098
CFLAGS += -Og -ggdb
10199
endif
102100

101+
CFLAGS += $(INCLUDE) -DARM11 -D_3DS `arm-none-eabi-pkg-config opusfile --cflags` \
102+
-DLIMEPLAYER_VERSION=$(VERSION_ALL) \
103+
-DNODEBUG=${NODEBUG} \
104+
${CUSTOMFLAGS}
105+
103106
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17
104107

105108
ASFLAGS := -g $(ARCH)
@@ -225,6 +228,7 @@ ifeq ($(suffix $(BANNER_AUDIO)),.cwav)
225228
else
226229
BANNER_AUDIO_ARG := -a
227230
endif
231+
228232
#---------------------------------------------------------------------------------
229233
all: 3dsx
230234
#---------------------------------------------------------------------------------

gfx/menu_copyright_colored.png

2.71 KB
Loading

gfx/menu_copyright_dark.png

1.21 KB
Loading

gfx/sprites.t3s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ menu_radio.png
1818
menu_globe.png
1919
menu_document.png
2020
menu_copyright.png
21+
menu_copyright_colored.png

src/app.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* You should have received a copy of the GNU General Public License
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
#include <sys/stat.h>
1817
#include <stdio.h>
1918

2019
#include "app.hpp"

src/debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <stdbool.h>
33
#include <stdarg.h>
44

5-
#ifndef NODEBUG
5+
#if !NODEBUG
66
#include "debug.hpp"
77
#include "file.hpp"
88

src/debug.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#ifndef __LP_DEBUG_H__
44
#define __LP_DEBUG_H__
55

6-
#ifndef NODEBUG
6+
#if !NODEBUG
77
#define DEBUG(...) debug_perform("[" __FILE__ "] " STRINGIFY(__LINE__) ": " __VA_ARGS__)
88

99
void debug_init(bool use_file);
@@ -23,5 +23,5 @@ static void debug_exit(void) {};
2323

2424
static void debug_perform(const char* fmt, ...) {};
2525

26-
#endif // ifndef NODEBUG
26+
#endif // if !NODEBUG
2727
#endif // ifndef __LP_DEBUG_H__

src/error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void Error::Add(int err) {
1111
}
1212
}
1313

14-
void Error::Add(int err, std::string& extraInfo) {
14+
void Error::Add(int err, const std::string& extraInfo) {
1515
// Error codes of 0 are not allowed
1616
if (err != 0) {
1717
LimeError_t tmperr;

src/error.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
#define __LIME_ERROR_H__
33

44
/* Errors that can't be explained with errno */
5-
#define NDSP_INIT_FAIL 1000
6-
#define DECODER_INIT_FAIL 1001
7-
#define FILE_NOT_SUPPORTED 1002
8-
#define DECODER_INIT_TIMEOUT 1003
9-
#define UNSUPPORTED_CHANNELS 1004
5+
#define ERRORH_GENERIC 1000
6+
#define NDSP_INIT_FAIL 1001
7+
#define DECODER_INIT_FAIL 1002
8+
#define FILE_NOT_SUPPORTED 1003
9+
#define DECODER_INIT_TIMEOUT 1004
10+
#define UNSUPPORTED_CHANNELS 1005
1011

1112
#include <vector>
1213
#include <string>
@@ -20,7 +21,7 @@ typedef struct {
2021
namespace Error {
2122
void Add(int err);
2223

23-
void Add(int err, std::string& extraInfo);
24+
void Add(int err, const std::string& extraInfo);
2425

2526
void Remove(void);
2627

src/gui/gui.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ void Gui::Update(playbackInfo_t* playbackInfo)
109109
C3D_FrameEnd(0);
110110
C2D_TextBufClear(g_dynamicBuf);
111111

112+
if (Error::IsQuered()) {
113+
if (kDown)
114+
Error::Remove();
115+
return;
116+
}
117+
112118
touchPosition touch;
113119
hidTouchRead(&touch);
114120
menus.top()->doUpdate(&touch);
@@ -147,21 +153,21 @@ C2D_Text Gui::StaticTextGen(std::string str) {
147153
return tmpStaticText;
148154
}
149155

150-
void Gui::PrintColor(const char* text, float xloc, float yloc, float scaleX, float scaleY, u32 color)
156+
void Gui::PrintColor(const std::string& text, float xloc, float yloc, float scaleX, float scaleY, u32 color)
151157
{
152158
// Clear the dynamic text buffer
153159
C2D_TextBufClear(g_dynamicBuf);
154160

155161
// Generate and draw dynamic text
156162
C2D_Text dynText;
157-
C2D_TextParse(&dynText, g_dynamicBuf, text);
163+
C2D_TextParse(&dynText, g_dynamicBuf, text.c_str());
158164
C2D_TextOptimize(&dynText);
159165
C2D_DrawText(&dynText, C2D_WithColor, xloc, yloc, 0.5f, scaleX, scaleY, color);
160166
}
161167

162168
void Gui::Print(const std::string& text, float xloc, float yloc, float scaleX, float scaleY)
163169
{
164-
Gui::PrintColor(text.c_str(), xloc, yloc, scaleX, scaleY, 0xFFFFFFFF);
170+
Gui::PrintColor(text, xloc, yloc, scaleX, scaleY, 0xFFFFFFFF);
165171
}
166172

167173
void Gui::PrintStatic(const std::string &ident, float xloc, float yloc, float scaleX, float scaleY)
@@ -259,6 +265,7 @@ void Gui::DrawError(void) {
259265
else if (errorcode == DECODER_INIT_FAIL){
260266
Gui::Print("ERR: Failed to initalize decoder.", 20.0f, 40.0f, 0.5f, 0.5f);
261267
}
268+
else if (errorcode == ERRORH_GENERIC);
262269
else {
263270
char errstr[30];
264271
snprintf(errstr, 30, "ERR: Undefined error.");

0 commit comments

Comments
 (0)