├── undo.sh
├── icon.png
├── 3dsfetch.3dsx
├── 3dsfetch.elf
├── 3dsfetch.smdh
├── README.md
├── config.ini
├── source
├── ini.h
├── util.h
├── main.c
└── ini.c
├── ini-LICENSE
├── LICENSE
└── Makefile
/undo.sh:
--------------------------------------------------------------------------------
1 | rm 3dsfetch*
2 | rm -rf build
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/videah/3dsfetch/HEAD/icon.png
--------------------------------------------------------------------------------
/3dsfetch.3dsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/videah/3dsfetch/HEAD/3dsfetch.3dsx
--------------------------------------------------------------------------------
/3dsfetch.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/videah/3dsfetch/HEAD/3dsfetch.elf
--------------------------------------------------------------------------------
/3dsfetch.smdh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/videah/3dsfetch/HEAD/3dsfetch.smdh
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/config.ini:
--------------------------------------------------------------------------------
1 | [config]
2 | username = ruairidh
3 | hostname = @3ds
4 | os = 3DS System Software
5 | firmware = 9.9.0-26E
6 | packages = 7
7 | shell = None
8 | resolution = 800x240 | 320x240
9 | cpu = 4x MPCore & 4x VFPv2
10 | memory = 128MiB
11 | gpu = DMP PICA200 268MHz
--------------------------------------------------------------------------------
/source/ini.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015 rxi
3 | *
4 | * This library is free software; you can redistribute it and/or modify it
5 | * under the terms of the MIT license. See LICENSE for details.
6 | */
7 |
8 | #ifndef INI_H
9 | #define INI_H
10 |
11 | typedef struct ini_t ini_t;
12 |
13 |
14 | ini_t* ini_load(const char *filename);
15 |
16 | void ini_free(ini_t *ini);
17 |
18 | const char* ini_get(ini_t *ini, const char *section, const char *key);
19 |
20 | int ini_sget(ini_t *ini, const char *section, const char *value,
21 | const char *scanfmt, void *dst);
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/ini-LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 rxi
2 |
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | this software and associated documentation files (the "Software"), to deal in
6 | the Software without restriction, including without limitation the rights to
7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | of the Software, and to permit persons to whom the Software is furnished to do
9 | so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all
12 | copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Ruairidh Carmichael - ruairidhcarmichael@live.co.uk
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/source/util.h:
--------------------------------------------------------------------------------
1 | // This code is licensed under the MIT Open Source License.
2 |
3 | // Copyright (c) 2015 Ruairidh Carmichael - ruairidhcarmichael@live.co.uk
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #define COLOR_RED "\x1b[31m"
24 | #define COLOR_CLEAR "\x1b[0m"
--------------------------------------------------------------------------------
/source/main.c:
--------------------------------------------------------------------------------
1 | // This code is licensed under the MIT Open Source License.
2 |
3 | // Copyright (c) 2015 Ruairidh Carmichael - ruairidhcarmichael@live.co.uk
4 |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 |
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | #include
24 | #include
25 | #include
26 | #include <3ds.h>
27 | #include "util.h"
28 | #include "ini.h"
29 |
30 | // Config //
31 |
32 | #define TEXT_COLOR COLOR_RED
33 |
34 | ///////////
35 |
36 | char const *asciiart =
37 | "\n\n\n\n\n\n"
38 | " ######\n"
39 | " #### ####\n"
40 | " ##### #####\n"
41 | " ## ## ## ##\n"
42 | " ## ##\n"
43 | " #### ####\n"
44 | " #### #### ####\n"
45 | " #### ###### ####\n"
46 | " #### ###### ####\n"
47 | " ### ###### ###\n"
48 | " # #### #\n"
49 | " # ########## #\n"
50 | " #### # # ####\n"
51 | " ## # # ## \n"
52 | " # #\n"
53 | " ## ##\n"
54 | " ##########\n";
55 |
56 | void printPos(char* string, int x, int y) {
57 |
58 | printf("%c[%d;%df",0x1B,y,x);
59 |
60 | printf(string);
61 |
62 | return 0;
63 |
64 | }
65 |
66 | void printLine(char* string1, char* string2, int x, int y) {
67 |
68 | printf(TEXT_COLOR); printPos(string1, x, y); printf(COLOR_CLEAR); printf(string2);
69 |
70 | return 0;
71 |
72 | }
73 |
74 | int main() {
75 |
76 | ini_t *config = ini_load("config.ini");
77 |
78 | const char *username = ini_get(config, "config", "username");
79 | const char *hostname = ini_get(config, "config", "hostname");
80 | const char *os = ini_get(config, "config", "os");
81 | const char *firmware = ini_get(config, "config", "firmware");
82 | const char *packages = ini_get(config, "config", "packages");
83 | const char *shell = ini_get(config, "config", "shell");
84 | const char *resolution = ini_get(config, "config", "resolution");
85 | const char *cpu = ini_get(config, "config", "cpu");
86 | const char *memory = ini_get(config, "config", "memory");
87 | const char *gpu = ini_get(config, "config", "gpu");
88 |
89 | gfxInitDefault();
90 |
91 | consoleInit(GFX_TOP, NULL); // Initialize console on top screen.
92 |
93 | int x = 20;
94 |
95 | printf(asciiart, 0, 0);
96 |
97 | while (aptMainLoop()) {
98 |
99 | hidScanInput(); // Scan for inputs
100 |
101 | u32 kDown = hidKeysDown(); // Get keys that are down
102 |
103 | if (kDown & KEY_START) break; // Break and return to the Homebrew Menu
104 |
105 | printLine(username, hostname, x, 6); // username@hostname
106 |
107 | printLine("OS: ", os, x, 8); // Don't have a better name for this
108 |
109 | printLine("Firmware: ", firmware, x, 10); // Detect it somehow?
110 |
111 | printLine("Packages: ", packages, x, 12); // Maybe get number of homebrew somehow?
112 |
113 | printLine("Shell: ", shell, x, 14); // 3DS can't really have a shell but whatever
114 |
115 | printLine("Resolution: ", resolution, x, 16); // Needs changed for 2DS
116 |
117 | printLine("CPU: ", cpu, x, 18); // This also needs changed for 2DS
118 |
119 | printLine("Memory: ", memory, x, 20); // Maybe get RAM usage somehow?
120 |
121 | printLine("GPU: ", gpu, x, 22);
122 |
123 | }
124 |
125 | gfxExit();
126 |
127 | ini_free(config);
128 |
129 | return 0;
130 |
131 | }
--------------------------------------------------------------------------------
/source/ini.c:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015 rxi
3 | *
4 | * This library is free software; you can redistribute it and/or modify it
5 | * under the terms of the MIT license. See LICENSE for details.
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | #include "ini.h"
14 |
15 | struct ini_t {
16 | char *data;
17 | char *end;
18 | };
19 |
20 |
21 | /* Case insensitive string compare */
22 | static int strcmpci(const char *a, const char *b) {
23 | for (;;) {
24 | int d = tolower(*a) - tolower(*b);
25 | if (d != 0 || !*a) {
26 | return d;
27 | }
28 | a++, b++;
29 | }
30 | }
31 |
32 | /* Returns the next string in the split data */
33 | static char* next(ini_t *ini, char *p) {
34 | p += strlen(p);
35 | while (p < ini->end && *p == '\0') {
36 | p++;
37 | }
38 | return p;
39 | }
40 |
41 | /* Splits data in place into strings containing section-headers, keys and
42 | * values using one or more '\0' as a delimiter */
43 | static void split_data(ini_t *ini) {
44 | char *q, *p = ini->data;
45 |
46 | while (p < ini->end) {
47 | switch (*p) {
48 | case '\r':
49 | case '\n':
50 | case '\t':
51 | case ' ':
52 | *p = '\0';
53 | /* Fall through */
54 |
55 | case '\0':
56 | p++;
57 | break;
58 |
59 | case '[':
60 | p += strcspn(p, "]");
61 | *p = '\0';
62 | break;
63 |
64 | case '=':
65 | do {
66 | *p++ = '\0';
67 | } while (*p == ' ' || *p == '\t');
68 | p += strcspn(p, "\n");
69 | goto trim_back;
70 |
71 | case ';':
72 | while (*p && *p != '\n') {
73 | *p++ = '\0';
74 | }
75 | break;
76 |
77 | default:
78 | p += strcspn(p, "=");
79 | trim_back:
80 | q = p - 1;
81 | while (*q == ' ' || *q == '\t' || *q == '\r') {
82 | *q-- = '\0';
83 | }
84 | break;
85 | }
86 | }
87 | }
88 |
89 | /* Unescapes and unquotes all quoted strings in the split data */
90 | static void unescape_quoted_strings(ini_t *ini) {
91 | char *p = ini->data;
92 |
93 | if (*p == '\0') {
94 | p = next(ini, p);
95 | }
96 |
97 | while (p < ini->end) {
98 | if (*p == '"') {
99 | /* Use `q` as write-head and `p` as read-head, `p` is always ahead of `q`
100 | * as escape sequences are always larger than their resultant data */
101 | char *q = p;
102 | p++;
103 | while (*q) {
104 | if (*p == '\\') {
105 | /* Handle escaped char */
106 | p++;
107 | switch (*p) {
108 | case 'r' : *q = '\r'; break;
109 | case 'n' : *q = '\n'; break;
110 | case 't' : *q = '\t'; break;
111 | default : *q = *p; break;
112 | }
113 |
114 | } else if (*p == '"') {
115 | /* Handle end of string */
116 | *q = '\0';
117 | break;
118 |
119 | } else {
120 | /* Handle normal char */
121 | *q = *p;
122 | }
123 | q++, p++;
124 | }
125 | /* Fill gap between read-head and write-head's position with '\0' */
126 | p = next(ini, p);
127 | memset(q, '\0', p - q);
128 | } else {
129 | p = next(ini, p);
130 | }
131 | }
132 | }
133 |
134 |
135 | ini_t* ini_load(const char *filename) {
136 | ini_t *ini = NULL;
137 | FILE *fp = NULL;
138 | int n, sz;
139 |
140 | /* Init ini struct */
141 | ini = malloc(sizeof(*ini));
142 | if (!ini) {
143 | goto fail;
144 | }
145 | memset(ini, 0, sizeof(*ini));
146 |
147 | /* Open file */
148 | fp = fopen(filename, "rb");
149 | if (!fp) {
150 | goto fail;
151 | }
152 |
153 | /* Get file size */
154 | fseek(fp, 0, SEEK_END);
155 | sz = ftell(fp);
156 | rewind(fp);
157 |
158 | /* Load file content into memory, null terminate, init end var */
159 | ini->data = malloc(sz + 1);
160 | ini->data[sz] = '\0';
161 | ini->end = ini->data + sz;
162 | n = fread(ini->data, sz, 1, fp);
163 | if (n != 1) {
164 | goto fail;
165 | }
166 |
167 | /* Prepare data */
168 | split_data(ini);
169 | unescape_quoted_strings(ini);
170 |
171 | /* Clean up and return */
172 | fclose(fp);
173 | return ini;
174 |
175 | fail:
176 | if (fp) fclose(fp);
177 | if (ini) ini_free(ini);
178 | return NULL;
179 | }
180 |
181 |
182 | void ini_free(ini_t *ini) {
183 | free(ini->data);
184 | free(ini);
185 | }
186 |
187 |
188 | const char* ini_get(ini_t *ini, const char *section, const char *key) {
189 | char *current_section = "";
190 | char *val;
191 | char *p = ini->data;
192 |
193 | if (*p == '\0') {
194 | p = next(ini, p);
195 | }
196 |
197 | while (p < ini->end) {
198 | if (*p == '[') {
199 | /* Handle section */
200 | current_section = p + 1;
201 |
202 | } else {
203 | /* Handle key */
204 | val = next(ini, p);
205 | if (!section || !strcmpci(section, current_section)) {
206 | if (!strcmpci(p, key)) {
207 | return val;
208 | }
209 | }
210 | p = val;
211 | }
212 |
213 | p = next(ini, p);
214 | }
215 |
216 | return NULL;
217 | }
218 |
219 |
220 | int ini_sget(
221 | ini_t *ini, const char *section, const char *value,
222 | const char *scanfmt, void *dst
223 | ) {
224 | const char *val = ini_get(ini, section, value);
225 | if (!val) {
226 | return 0;
227 | }
228 | if (scanfmt) {
229 | sscanf(val, scanfmt, dst);
230 | } else {
231 | *((const char**) dst) = val;
232 | }
233 | return 1;
234 | }
235 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #---------------------------------------------------------------------------------
2 | .SUFFIXES:
3 | #---------------------------------------------------------------------------------
4 |
5 | ifeq ($(strip $(DEVKITARM)),)
6 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM")
7 | endif
8 |
9 | TOPDIR ?= $(CURDIR)
10 | include $(DEVKITARM)/3ds_rules
11 |
12 | #---------------------------------------------------------------------------------
13 | # TARGET is the name of the output
14 | # BUILD is the directory where object files & intermediate files will be placed
15 | # SOURCES is a list of directories containing source code
16 | # DATA is a list of directories containing data files
17 | # INCLUDES is a list of directories containing header files
18 | #
19 | # NO_SMDH: if set to anything, no SMDH file is generated.
20 | # APP_TITLE is the name of the app stored in the SMDH file (Optional)
21 | # APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
22 | # APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
23 | # ICON is the filename of the icon (.png), relative to the project folder.
24 | # If not set, it attempts to use one of the following (in this order):
25 | # - .png
26 | # - icon.png
27 | # - /default_icon.png
28 | #---------------------------------------------------------------------------------
29 | TARGET := $(notdir $(CURDIR))
30 | BUILD := build
31 | SOURCES := source
32 | DATA := data
33 | INCLUDES := include
34 |
35 | APP_TITLE := 3dsfetch
36 | APP_AUTHOR := VideahGams
37 | APP_DESCRIPTION := screenfetch for 3DS
38 |
39 | #---------------------------------------------------------------------------------
40 | # options for code generation
41 | #---------------------------------------------------------------------------------
42 | ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
43 |
44 | CFLAGS := -g -Wall -O2 -mword-relocations \
45 | -fomit-frame-pointer -ffast-math \
46 | $(ARCH)
47 |
48 | CFLAGS += $(INCLUDE) -DARM11 -D_3DS
49 |
50 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
51 |
52 | ASFLAGS := -g $(ARCH)
53 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
54 |
55 | LIBS := -lctru -lm
56 |
57 | #---------------------------------------------------------------------------------
58 | # list of directories containing libraries, this must be the top level containing
59 | # include and lib
60 | #---------------------------------------------------------------------------------
61 | LIBDIRS := $(CTRULIB)
62 |
63 |
64 | #---------------------------------------------------------------------------------
65 | # no real need to edit anything past this point unless you need to add additional
66 | # rules for different file extensions
67 | #---------------------------------------------------------------------------------
68 | ifneq ($(BUILD),$(notdir $(CURDIR)))
69 | #---------------------------------------------------------------------------------
70 |
71 | export OUTPUT := $(CURDIR)/$(TARGET)
72 | export TOPDIR := $(CURDIR)
73 |
74 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
75 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
76 |
77 | export DEPSDIR := $(CURDIR)/$(BUILD)
78 |
79 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
80 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
81 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
82 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
83 |
84 | #---------------------------------------------------------------------------------
85 | # use CXX for linking C++ projects, CC for standard C
86 | #---------------------------------------------------------------------------------
87 | ifeq ($(strip $(CPPFILES)),)
88 | #---------------------------------------------------------------------------------
89 | export LD := $(CC)
90 | #---------------------------------------------------------------------------------
91 | else
92 | #---------------------------------------------------------------------------------
93 | export LD := $(CXX)
94 | #---------------------------------------------------------------------------------
95 | endif
96 | #---------------------------------------------------------------------------------
97 |
98 | export OFILES := $(addsuffix .o,$(BINFILES)) \
99 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
100 |
101 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
102 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
103 | -I$(CURDIR)/$(BUILD)
104 |
105 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
106 |
107 | ifeq ($(strip $(ICON)),)
108 | icons := $(wildcard *.png)
109 | ifneq (,$(findstring $(TARGET).png,$(icons)))
110 | export APP_ICON := $(TOPDIR)/$(TARGET).png
111 | else
112 | ifneq (,$(findstring icon.png,$(icons)))
113 | export APP_ICON := $(TOPDIR)/icon.png
114 | endif
115 | endif
116 | else
117 | export APP_ICON := $(TOPDIR)/$(ICON)
118 | endif
119 |
120 | ifeq ($(strip $(NO_SMDH)),)
121 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
122 | endif
123 |
124 | .PHONY: $(BUILD) clean all
125 |
126 | #---------------------------------------------------------------------------------
127 | all: $(BUILD)
128 |
129 | $(BUILD):
130 | @[ -d $@ ] || mkdir -p $@
131 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
132 |
133 | #---------------------------------------------------------------------------------
134 | clean:
135 | @echo clean ...
136 | @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
137 |
138 |
139 | #---------------------------------------------------------------------------------
140 | else
141 |
142 | DEPENDS := $(OFILES:.o=.d)
143 |
144 | #---------------------------------------------------------------------------------
145 | # main targets
146 | #---------------------------------------------------------------------------------
147 | ifeq ($(strip $(NO_SMDH)),)
148 | $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
149 | else
150 | $(OUTPUT).3dsx : $(OUTPUT).elf
151 | endif
152 |
153 | $(OUTPUT).elf : $(OFILES)
154 |
155 | #---------------------------------------------------------------------------------
156 | # you need a rule like this for each extension you use as binary data
157 | #---------------------------------------------------------------------------------
158 | %.bin.o : %.bin
159 | #---------------------------------------------------------------------------------
160 | @echo $(notdir $<)
161 | @$(bin2o)
162 |
163 | # WARNING: This is not the right way to do this! TODO: Do it right!
164 | #---------------------------------------------------------------------------------
165 | %.vsh.o : %.vsh
166 | #---------------------------------------------------------------------------------
167 | @echo $(notdir $<)
168 | @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
169 | @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
170 | @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
171 | @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
172 | @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
173 | @rm ../$(notdir $<).shbin
174 |
175 | -include $(DEPENDS)
176 |
177 | #---------------------------------------------------------------------------------------
178 | endif
179 | #---------------------------------------------------------------------------------------
180 |
--------------------------------------------------------------------------------