diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d4f168 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +built/IP.BIN +built/1st_read.bin +buildfiles/output.bin +buildfiles/HappyNewYearNewDecade2020.elf +.vscode +main.o +romdisk_boot.img +romdisk_boot.o \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..07ce906 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +TARGET = buildfiles/HappyNewYearNewDecade2020 +all: rm-elf $(TARGET).elf + +include $(KOS_BASE)/Makefile.rules + +OBJS = main.o + +CFLAGS = -Iinclude -Wall +KOS_LOCAL_CFLAGS = -I$(KOS_BASE)/addons/zlib + +clean: + -rm -f $(TARGET).elf $(OBJS) + -rm -f romdisk_boot.* + +dist: + -rm -f $(OBJS) + -rm -f romdisk_boot.* + $(KOS_STRIP) $(TARGET).elf + +rm-elf: + -rm -f $(TARGET).elf + -rm -f romdisk_boot.* + +$(TARGET).elf: $(OBJS) romdisk_boot.o + kos-c++ -o $(TARGET).elf $^ $(CFLAGS) -ltremor -lpng -lz -lm -ldcplib $(KOS_LIBS) + +romdisk_boot.img: + $(KOS_GENROMFS) -f $@ -d romdisk_boot -v + +romdisk_boot.o: romdisk_boot.img + $(KOS_BASE)/utils/bin2o/bin2o $< romdisk_boot $@ + +run: $(TARGET).elf + $(KOS_LOADER) $< \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..db853b3 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +make +sh-elf-objcopy -R .stack -O binary buildfiles/HappyNewYearNewDecade2020.elf buildfiles/output.bin +../../utils/scramble/scramble buildfiles/output.bin built/1st_read.bin \ No newline at end of file diff --git a/buildfiles/KEEP.ME b/buildfiles/KEEP.ME new file mode 100644 index 0000000..e69de29 diff --git a/buildfiles/SuperCoinShooterforDreamcast.elf b/buildfiles/SuperCoinShooterforDreamcast.elf new file mode 100644 index 0000000..94840a3 Binary files /dev/null and b/buildfiles/SuperCoinShooterforDreamcast.elf differ diff --git a/built/KEEP.ME b/built/KEEP.ME new file mode 100644 index 0000000..e69de29 diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..c1ea23d --- /dev/null +++ b/include/common.h @@ -0,0 +1,13 @@ +#ifndef COMMON_H +#define COMMON_H + +#include +#include +#include +#include +#include +#include + +using namespace std; + +#endif diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..89b7f3d --- /dev/null +++ b/main.cpp @@ -0,0 +1,204 @@ +#include "common.h" + +#include +#include +#include + +#include +#include + +using namespace std; + +int t; + +char happy[5] = { + 0, 1, 2, 2, 3 +}; + +char _new[3] = { + 4, 5, 6 +}; + +char year[7] = { + 3, 5, 1, 7, 12 +}; + +char decade[7] = { + 8, 5, 9, 1, 8, 5, 12 +}; + +char twentytwenty[5] = { + 10, 11, 10, 11, 12 +}; + +pvr_ptr_t backgroundTex; +pvr_ptr_t letterTex; + +/* romdisk */ +extern uint8 romdisk_boot[]; +KOS_INIT_ROMDISK(romdisk_boot); + +void drawBackground(){ + pvr_poly_cxt_t cxt; + pvr_poly_hdr_t hdr; + pvr_vertex_t vert; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_RGB565, 512, 512, backgroundTex, PVR_FILTER_BILINEAR); + pvr_poly_compile(&hdr, &cxt); + pvr_prim(&hdr, sizeof(hdr)); + + vert.argb = PVR_PACK_COLOR(1.0f, 1.0f, 1.0f, 1.0f); + vert.oargb = 0; + vert.flags = PVR_CMD_VERTEX; + + vert.x = 0; + vert.y = 0; + vert.z = 1; + vert.u = 0.0; + vert.v = 0.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 640; + vert.y = 0; + vert.z = 1; + vert.u = 1.0; + vert.v = 0.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 0; + vert.y = 480; + vert.z = 1; + vert.u = 0.0; + vert.v = 1.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 640; + vert.y = 480; + vert.z = 1; + vert.u = 1.0; + vert.v = 1.0; + vert.flags = PVR_CMD_VERTEX_EOL; + pvr_prim(&vert, sizeof(vert)); +} + +void drawLetter(int xPos, int yPos, int index, int size){ + pvr_poly_cxt_t cxt; + pvr_poly_hdr_t hdr; + pvr_vertex_t vert; + + float u, v, u2, v2; + int x, y, x2, y2; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY, PVR_TXRFMT_ARGB4444, 64, 64, letterTex, PVR_FILTER_NEAREST); + pvr_poly_compile(&hdr, &cxt); + pvr_prim(&hdr, sizeof(hdr)); + + vert.argb = PVR_PACK_COLOR(1.0f, 1.0f, 1.0f, 1.0f); + vert.oargb = 0; + vert.flags = PVR_CMD_VERTEX; + + u = (float)((index % 4) * 16) / 64; + v = (float)((index / 4) * 16) / 64; + u2 = (float)(((index % 4) * 16) + 16) / 64; + v2 = (float)(((index / 4) * 16) + 16) / 64; + + x = xPos; + y = yPos; + x2 = xPos + size; + y2 = yPos + size; + + vert.x = x; + vert.y = y; + vert.z = 6; + vert.u = (float)u; + vert.v = (float)v; + pvr_prim(&vert, sizeof(vert)); + + vert.x = x2; + vert.y = y; + vert.z = 6; + vert.u = u2; + vert.v = v; + pvr_prim(&vert, sizeof(vert)); + + vert.x = x; + vert.y = y2; + vert.z = 6; + vert.u = u; + vert.v = v2; + pvr_prim(&vert, sizeof(vert)); + + vert.x = x2; + vert.y = y2; + vert.z = 6; + vert.u = u2; + vert.v = v2; + vert.flags = PVR_CMD_VERTEX_EOL; + pvr_prim(&vert, sizeof(vert)); +} + +/* draw one frame */ +void drawFrame() { + pvr_wait_ready(); + pvr_scene_begin(); + + pvr_list_begin(PVR_LIST_OP_POLY); + drawBackground(); + pvr_list_finish(); + + pvr_list_begin(PVR_LIST_TR_POLY); + + //HAPPY NEW YEAR! + for(int i = 0; i < 5; i++){ + drawLetter(25 + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 100 + (5 * cos((i * 5) + t * 0.1f)), happy[i], 32); + } + for(int i = 0; i < 3; i++){ + drawLetter((25 + (5 * 32) + 75) + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 100 + (5 * cos((i * 5) + t * 0.1f)), _new[i], 32); + } + for(int i = 0; i < 5; i++){ + drawLetter(((25 + (5 * 32) + 75) + (3 * 32) + 75) + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 100 + (5 * cos((i * 5) + t * 0.1f)), year[i], 32); + } + + //HAPPY NEW DECADE! + for(int i = 0; i < 5; i++){ + drawLetter(25 + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 150 + (5 * cos((i * 5) + t * 0.1f)), happy[i], 32); + } + for(int i = 0; i < 3; i++){ + drawLetter((25 + (5 * 32) + 50) + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 150 + (5 * cos((i * 5) + t * 0.1f)), _new[i], 32); + } + for(int i = 0; i < 7; i++){ + drawLetter(((25 + (5 * 32) + 50) + (3 * 32) + 50) + (i * 35) + (5 * sin((i * 5) + t * 0.1f)), 150 + (5 * cos((i * 5) + t * 0.1f)), decade[i], 32); + } + + //2020! + for(int i = 0; i < 5; i++){ + drawLetter(150 + (i * 67) + (5 * sin((i * 5) + t * 0.1f)), 300 + (5 * cos((i * 5) + t * 0.1f)), twentytwenty[i], 64); + } + + pvr_list_finish(); + + pvr_scene_finish(); +} + +int main(void) { + snd_stream_init(); + sndoggvorbis_init(); + sndoggvorbis_start("/rd/bgm/bgm.ogg", 1); + + /* init kos */ + pvr_init_defaults(); + + backgroundTex = pvr_mem_malloc(512 * 512 * 2); + png_to_texture("/rd/imgs/background.png", backgroundTex, PNG_NO_ALPHA); + + letterTex = pvr_mem_malloc(16 * 16 * 2); + png_to_texture("/rd/imgs/letters.png", letterTex, PNG_FULL_ALPHA); + + while(1) { + drawFrame(); + + t++; + } + + return 0; +} diff --git a/romdisk_boot/bgm/bgm.ogg b/romdisk_boot/bgm/bgm.ogg new file mode 100644 index 0000000..9de49a6 Binary files /dev/null and b/romdisk_boot/bgm/bgm.ogg differ diff --git a/romdisk_boot/imgs/background.png b/romdisk_boot/imgs/background.png new file mode 100644 index 0000000..ad97f1f Binary files /dev/null and b/romdisk_boot/imgs/background.png differ diff --git a/romdisk_boot/imgs/letters.png b/romdisk_boot/imgs/letters.png new file mode 100644 index 0000000..0e62cd3 Binary files /dev/null and b/romdisk_boot/imgs/letters.png differ