diff --git a/software/mpeg/main.c b/software/mpeg/main.c index d3fc64e148ac7a7b2fc49b9e1d0eaf91f7e0ac19..e99d0d29065a14d91f68afe016e2fab324bc90e2 100644 --- a/software/mpeg/main.c +++ b/software/mpeg/main.c @@ -171,6 +171,7 @@ int main() { goto PROBE; IMG: + printf("Trying to cache %x (%dx%d) into %x...\n", mpeg_img_addr, mpeg_img_width, mpeg_img_height, mpeg_img_dest); temp_dest = mpeg_img_dest; bg_ptr = mpeg_img_addr; bptr = 256; diff --git a/software/osu_main/src/gl/gl.h b/software/osu_main/src/gl/gl.h index 6ee1558a5a6fd337193345547ab7e2865c379468..4d00f8dc8598ac04c75f78cf7d1cba6cf70feded 100644 --- a/software/osu_main/src/gl/gl.h +++ b/software/osu_main/src/gl/gl.h @@ -1,9 +1,10 @@ #ifndef GL_H_ #define GL_H_ -#include "painters.h" -#include "util.h" #include "regs.h" +#include "util.h" +#include "painters.h" +#include "font.h" #define GL_CMD_NOOP 0x0 #define GL_CMD_RECT 0x1 diff --git a/software/osu_main/src/gl/painters.h b/software/osu_main/src/gl/painters.h index 975ae1c8a93c9a09a3490ce83cb799d704ff254c..9e218a7ef3dc90f54266c0b89673649d3a7fd312 100644 --- a/software/osu_main/src/gl/painters.h +++ b/software/osu_main/src/gl/painters.h @@ -11,6 +11,8 @@ void gl_circle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color0, uint16_t color1, uint16_t stroke, uint8_t gradient_direction); +void gl_ring(uint16_t x0, uint16_t y0, uint16_t r, uint16_t w, uint16_t stroke); + void gl_polygon(uint16_t x_top, uint16_t y_top, uint16_t x_bot, uint16_t y_bot, uint16_t x_left, uint16_t y_left, diff --git a/software/osu_main_process/main.c b/software/osu_main_process/main.c deleted file mode 100644 index 2ccaa9b29a2fe899c5c26dc34d0b1fdb09005a57..0000000000000000000000000000000000000000 --- a/software/osu_main_process/main.c +++ /dev/null @@ -1,20 +0,0 @@ -#include"osu_process.h" - -int main(){ - //initialization - osu_session global; - - osu_init(&global); - - //Title Page - title_process(&global); - - //Selection Page - song_select_process(&global); - - //song play, scoring also handled - song_play_process(&global); - - // - song_score_process(&global); -} \ No newline at end of file diff --git a/software/osu_main_process/osu_draw.c b/software/osu_main_process/osu_draw.c deleted file mode 100644 index 257139fa596a8ede231b38727804ff6235f87975..0000000000000000000000000000000000000000 --- a/software/osu_main_process/osu_draw.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "osu_draw.h" - -void osu_draw_frame(osu_session* global){ - //wait until vertical sync - gl_finalize_wait(); - - uint8_t temp_queue_end; - char object_label; - //void* temp_p; - while(temp_queue_end!=(global->draw_queue_start)){ - object_label = *((char*)((global->draw_dynamic_queue)[temp_queue_end])); - switch (object_label){ - case 'h': // hit circle - osu_draw_hit_circle((global->draw_dynamic_queue)[temp_queue_end],global->current_time); - break; - case 's': - osu_draw_spin(draw_dynamic_queue[temp_queue_end]); - break; -/* case 'l': // slider - osu_draw_slider(draw_dynamic_queue[temp_queue_end]); - break; - */ - } - --temp_queue_end; - temp_queue_end &= DRAW_QUEUE_SIZE_MODE; - } - - //hard draw part - - gl_finalize_frame(); -} - -void osu_draw_hit_circle(elem_hit_circle* circle,clock_t current_time){ - if (current_time<check_timing){ - gl_ring( - circle->x, - circle->y, - circle->approach_radius, - 4, - circle->gradient_color1 - ); - gl_circle( - circle->x, - circle->y, - circle->hit_radius, - circle->gradient_color1, - circle->gradient_color2, - circle->stroke_color, - circle->gradient_direction - ); - gl_ring( - circle->x, - circle->y, - circle->hit_radius, - 3, - 0xFFFFFFFF - ); - circle->approach_radius -= circle->approach_rate; - - } else if (current_time < end_timing){ - gl_circle( - circle->x, - circle->y, - circle->hit_radius, - circle->gradient_color1, - circle->gradient_color2, - circle->stroke_color, - circle->gradient_direction - ); - } -} \ No newline at end of file diff --git a/software/osu_main_process/osu_draw.h b/software/osu_main_process/osu_draw.h deleted file mode 100644 index cb40d8f534d9baa74ef89553f590f259eb46e24f..0000000000000000000000000000000000000000 --- a/software/osu_main_process/osu_draw.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OSU_DRAW_H_ - -#define OSU_DRAW_H_ - -#include <inttypes> -#include "osu_process.h" -#include "osu_object_includes.h" - - -osu_draw_frame(); - -#endif \ No newline at end of file diff --git a/software/osu_main_process/osu_object_includes.h b/software/osu_main_process/osu_object_includes.h deleted file mode 100644 index 62e97acd6204b55ce50077bce72629d85d03145a..0000000000000000000000000000000000000000 --- a/software/osu_main_process/osu_object_includes.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef OSU_OBJECT_INCLUDES_H_ - -#define OSU_OBJECT_INCLUDES_H_ - -#include<inttypes> - -typedef struct __attribute__((__packed__)) hit_circle_t{ - //32 Byte - char type, - uint_16t x,y, - uint_32t start_timing, - uint_32t check_timing, - uint_32t disappear_timing, - //uint_32t end_timing, - uint_16t hit_radius, - uint_16t approach_radius, - uint_16t gradient_color1, - uint_16t gradient_color2, - uint_16t stroke_color, - uint_8t gradient_direction, - uint_32t reserved - -}elem_hit_circle; - -typedef struct __attribute__((__packed__)) hit_circle_t{ - //32 Byte - char type, - uint_16t x,y, - uint_32t start_timing, - uint_32t disappear_timing, - uint_16t radius, - uint_16t gradient_color1, - uint_16t gradient_color2, - uint_16t stroke_color, - uint_8t gradient_direction, - char padding[10] - -}elem_spinner; - -/*typedef struct __attribute__((__packed__)) rect_slider_t{ - char type; - uint_32t start_timing, - uint_32t check_timing, - uint_32t disappear_timing, - //uint_32t end_timing, - uint_16t hit_radius, - uint_16t approach_radius, - uint_16t x1,y1,x2,y2,x3,y3,x4,y4, - uint_8t gradient_direction, - uint_32t reserved -}elem_rect_slider;*/ - -#endif \ No newline at end of file diff --git a/software/osu_main_process/osu_process.c b/software/osu_main_process/osu_process.c deleted file mode 100644 index 81a9f27a2e29a51129f39013383fe294eeb61218..0000000000000000000000000000000000000000 --- a/software/osu_main_process/osu_process.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "osu_process.h" - -void init_process(osu_session* global){ - - global->draw_queue = malloc(sizeof(void*)*DRAW_QUEUE_SIZE); - global->buff = malloc(512); - global->play_timeline = malloc(65536); - //set to nearest 32 address - mpeg_read(0,1,global->buff); - global->total_song_count = ((osu_meta*)global->buff) -> songs; -} - -void loading_process(osu_session* global){ - uint32_t i; - //scene start TBD - - //send loading command to sd-card core - mpeg_read(global->song_number,1,&(global->playing_song)); - - mpeg_set_bg(global->playing_song.cover_begin); - - //beat map reading - mpeg_read( - global->playing_song.beatmap_begin, - global->playing_song.beatmap_len, - *(global->play_timeline)); - //beat map parsing - uint32_t* p_temp = *(global->play_timeline); - if ((*p_temp)!= 0b01110010011001010110000101101100){ - printf("parsing magic failed!"); - return; - } - ++p_temp; - global->play_timeline_count = *((uint32_t*)p_temp); - global->play_timeline = malloc(4*(global->play_timeline_count)); - //locate the real data address - - - ++p_temp; - for (i=0;i<global->play_timeline_count;++i){ - global->play_timeline[i] = p_temp; - //jump 32 bytes - p_temp =((void*)p_temp + ELEMENT_LENGTH); - } -} - -/*void title_process(){ - scene_start(); - //timing - clock_t start_time= clock(); - //send loading command to sd-card core - clock_t current_time; - //loop start - while(1){ - - //get current time - current_time = clock()-start_time; - //check mouse press - - //specify the title elements - - - //draw the frame - osu_draw_frame(); - } - - //end handle - scene_end(); -}*/ -void play_process(osu_session* global){ - //scene_start(global); - //timing - clock_t start_time= clock(); - //send loading command to sd-card core - - global->play_timeline_start = 0; - - //loop start - while(1){ - //get current time - current_time = clock()-start_time; - if (global->current_time > (global->playing_song.play_time)) break; - //update the drawing elements first - osu_draw_queue_update(global); - //then get keyboard/mouse input and handle - //HInput(); - //draw the frame - osu_draw_frame(global); - - } - - //end handle - scene_end(global); -} - -void osu_draw_queue_update(osu_session* global){ - - - //clear existing elements - queue_temp_start = global->draw_dynamic_queue_start; - elem_hit_circle* element_temp_p = (global->draw_dynamic_queue)[queue_temp_start]; - while (queue_temp_start!=global->draw_dynamic_queue_end){ - if (global->current_time >= (element_temp_p->disappear_timing)){ - //pop draw element from front - (global->draw_dynamic_queue)[queue_temp_start] = NULL; - ++(global->draw_dynamic_queue_start); - } else break; - ++temp_queue_start; - temp_queue_start &= DRAW_QUEUE_SIZE_MODE; - element_temp_p = (global->draw_dynamic_queue)[queue_temp_start]; - } - //add new element - if (global->play_timeline_start>=global->play_timeline_count) return; - - elem_hit_circle* element_temp_p=(global->play_timeline)[play_timeline_start]; - - while(global->play_timeline_start<global->play_timeline_count){ - if ((element_temp_p->start_timing)<= global->current_time){ - //add draw element at queue end - ++(global->draw_dynamic_queue_end); - global->draw_dynamic_queue_end &= DRAW_QUEUE_SIZE_MODE; - (global->draw_dynamic_queue)[global->draw_dynamic_queue_end] = (void*)element_temp_p; - } else break; - ++(global->play_timeline_start); - element_temp_p=(global->play_timeline)[global->play_timeline_start]; - } -} - -void scene_end(osu_session* global){ - //clear the global draw queue - int i; - for (i=0;i<DRAW_QUEUE_SIZE;++i){ - (global->draw_queue)[i] = NULL; - } - //dim the background - for (i=0;i<128;i+=4){ - gl_background_dim(i); - osu_draw_frame(); - } - global->draw_dynamic_queue_start=0; - global->draw_dynamic_queue_end=0; -} -/* -void scene_start(){ - //show the background - -}*/ - -/*void HInput(){ - get_mouse_input(); - if (mouse_left_click){ - //check if it hits anything - } -}*/ - diff --git a/software/osu_main_process/osu_process.h b/software/osu_main_process/osu_process.h deleted file mode 100644 index 5ebde775cc556e6ea665cf99154a488bc0926d68..0000000000000000000000000000000000000000 --- a/software/osu_main_process/osu_process.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef OSU_PROCESS_H - -#define OSU_PROCESS_H - -#include"../interprocess/interprocess.h" -#include"osu_draw.h" -#include "osufs.h" - -#define DRAW_QUEUE_SIZE 128 -#define DRAW_QUEUE_SIZE_MOD 0b01111111 -//counted by 4 bytes a time -#define ELEMENT_LENGTH 32 -//#define PLAY_TIMELINE_START -//declare the global - - -typedef struct osu_t{ - void** draw_dynamic_queue, - void** play_timeline, //= PLAY_TIMELINE_START, - uint8_t draw_dynamic_queue_start, - uint8_t draw_dynamic_queue_end, - - uint32_t play_timeline_start, - uint32_t play_timeline_count, - void** draw_hard_list, - - - uint32_t current_time, - - uint16_t total_song_count, - - void* buff, - - uint16_t song_number, - - osu_song playing_song -}osu_session; - - - -void title_process(){ - // -} - -void loading_process(); - -#endif \ No newline at end of file