Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…I v2
  • Loading branch information
zardam committed Dec 18, 2019
1 parent 2b1166c commit c792837
Show file tree
Hide file tree
Showing 51 changed files with 4,970 additions and 660 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ server.pem
*.tar
api/libapi.a
apps/nofrendo/epsilon/rom.c
apps/KhiCAS/libgiac_simulator.a
2 changes: 1 addition & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OBJCOPY=arm-none-eabi-objcopy
AR=arm-none-eabi-ar
CFLAGS=-Os -mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -fno-common -fdata-sections -ffunction-sections -fno-exceptions

TARGETS=api.o startup.o
TARGETS=extapp_api.o extapp_startup.o

libapi.a: $(TARGETS)
$(AR) rcs $@ $^
Expand Down
152 changes: 0 additions & 152 deletions api/api.c

This file was deleted.

70 changes: 0 additions & 70 deletions api/api.h

This file was deleted.

82 changes: 82 additions & 0 deletions api/extapp_api.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

extern void (* const *_api_base)(void);

uint64_t extapp_millis() {
return ((uint64_t (*)(void))_api_base[0])();
}

void extapp_msleep(uint32_t ms) {
((void (*)(uint32_t))_api_base[1])(ms);
}

uint64_t extapp_scanKeyboard() {
return ((uint64_t (*)(void))_api_base[2])();
}

void extapp_pushRect(int16_t x, int16_t y, uint16_t w, uint16_t h, const uint16_t * pixels) {
((void (*)(int16_t, int16_t, uint16_t, uint16_t, const uint16_t *))_api_base[3])(x, y, w, h, pixels);
}

void extapp_pushRectUniform(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t color) {
((void (*)(int16_t, int16_t, uint16_t, uint16_t, uint16_t))_api_base[4])(x, y, w, h, color);
}

void extapp_pullRect(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t * pixels) {
((void (*)(int16_t, int16_t, uint16_t, uint16_t, uint16_t *))_api_base[5])(x, y, w, h, pixels);
}

int16_t extapp_drawTextLarge(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake) {
return ((int16_t (*)(const char *, int16_t, int16_t, uint16_t, uint16_t, bool))_api_base[6])(text, x, y, fg, bg, fake);
}

int16_t extapp_drawTextSmall(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake) {
return ((int16_t (*)(const char *, int16_t, int16_t, uint16_t, uint16_t, bool))_api_base[7])(text, x, y, fg, bg, fake);
}

bool extapp_waitForVBlank(void) {
return ((bool (*)(void))_api_base[8])();
}

void extapp_clipboardStore(const char *text) {
((void (*)(const char *))_api_base[9])(text);
}

const char * extapp_clipboardText(void) {
return ((const char * (*)(void))_api_base[10])();
}

int extapp_fileListWithExtension(const char ** filenames, int maxrecords, const char * extension, int storage) {
return ((int (*)(const char **, int, const char *, int))_api_base[11])(filenames, maxrecords, extension, storage);
}

bool extapp_fileExists(const char * filename, int storage) {
return ((bool (*)(const char *, int))_api_base[12])(filename, storage);
}

bool extapp_fileErase(const char * filename, int storage) {
return ((bool (*)(const char *, int))_api_base[13])(filename, storage);
}

const char * extapp_fileRead(const char * filename, size_t *len, int storage) {
return ((const char * (*)(const char *, size_t *, int))_api_base[14])(filename, len, storage);
}

bool extapp_fileWrite(const char * filename, const char * content, size_t len, int storage) {
return ((bool (*)(const char *, const char *, size_t, int))_api_base[15])(filename, content, len, storage);
}

void extapp_lockAlpha() {
((void (*)(void))_api_base[16])();
}

void extapp_resetKeyboard() {
((void (*)(void))_api_base[17])();
}

int extapp_getKey(bool allowSuspend, bool *alphaWasActive) {
((int (*)(bool, bool *))_api_base[18])(allowSuspend, alphaWasActive);
}

Loading

0 comments on commit c792837

Please sign in to comment.