aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author浅倉麗子2020-08-13 00:58:50 -0400
committer浅倉麗子2020-08-13 00:58:50 -0400
commit53274e0ee60028c04f16f4b0ad73cc88e522eaa8 (patch)
treec56881ef4e4e1ff92af7191d51a499f216e9ab27
parentMove header files into subdirectory (diff)
downloadsharpscale-53274e0ee60028c04f16f4b0ad73cc88e522eaa8.tar.gz
Move common macros into separate header
-rw-r--r--config-app/main.c2
-rw-r--r--include/common.h29
-rw-r--r--main.c7
-rw-r--r--scaling-test/main.c8
4 files changed, 35 insertions, 11 deletions
diff --git a/config-app/main.c b/config-app/main.c
index eccc4ba..771f7a5 100644
--- a/config-app/main.c
+++ b/config-app/main.c
@@ -32,7 +32,7 @@ void *memset(void *dest, int ch, size_t count) {
return sceClibMemset(dest, ch, count);
}
-#define CLIB_HEAP_SIZE 256 * 1024
+#define CLIB_HEAP_SIZE SCE_KERNEL_256KiB
#define BG_COLOUR 0xFFDFDFDF
#define TEXT_BLACK 0xFF202020
diff --git a/include/common.h b/include/common.h
new file mode 100644
index 0000000..121222e
--- /dev/null
+++ b/include/common.h
@@ -0,0 +1,29 @@
+/*
+This file is part of Sharpscale
+Copyright © 2020 浅倉麗子
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#define GLZ(x) do {\
+ if ((x) < 0) { goto fail; }\
+} while (0)
+
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+
+#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
+
+#endif
diff --git a/main.c b/main.c
index 23aefba..dfdf23b 100644
--- a/main.c
+++ b/main.c
@@ -28,16 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <psp2dbg.h>
#include <taihen.h>
+#include "common.h"
#include "config.h"
#include "scedisplay.h"
#include "sharpscale_internal.h"
-#define GLZ(x) do {\
- if ((x) < 0) { goto fail; }\
-} while (0)
-
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-
#define N_INJECT 9
static SceUID inject_id[N_INJECT];
diff --git a/scaling-test/main.c b/scaling-test/main.c
index 68a421b..1976877 100644
--- a/scaling-test/main.c
+++ b/scaling-test/main.c
@@ -28,9 +28,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <fnblit.h>
#include <psp2dbg.h>
-extern char _binary_unifont_sfn_start[];
+#include "common.h"
-#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
+extern char _binary_unifont_sfn_start[];
#define WHITE 0xFFFFFFFF
#define BLACK 0x00000000
@@ -116,7 +116,7 @@ void _start(int args, void *argp) { (void)args; (void)argp;
SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW,
ALIGN(FB_LEN, SCE_KERNEL_1MiB),
NULL);
- if (fb_mem_id < 0) { goto done; }
+ GLZ(fb_mem_id);
int *fb_base;
sceKernelGetMemBlockBase(fb_mem_id, (void**)&fb_base);
@@ -182,7 +182,7 @@ void _start(int args, void *argp) { (void)args; (void)argp;
sceDisplayWaitVblankStartMulti(2);
}
-done:
+fail:
SCE_DBG_FILELOG_TERM();
sceKernelExitProcess(0);
}