From 5c949f38e4fff15002f8ac5b5f63bc02c849055d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 Dec 2014 17:18:45 +0100 Subject: Assume PC_BUILD --- common.h | 5 --- cpu.c | 28 ------------ input.h | 2 - main.c | 154 --------------------------------------------------------------- video.c | 53 ---------------------- 5 files changed, 242 deletions(-) diff --git a/common.h b/common.h index 780351e..474de3a 100644 --- a/common.h +++ b/common.h @@ -239,9 +239,4 @@ typedef u32 fixed8_24; #define printf pspDebugScreenPrintf #endif -#ifdef PC_BUILD - #define STDIO_DEBUG - //#define REGISTER_USAGE_ANALYZE -#endif - #endif diff --git a/cpu.c b/cpu.c index f20b9f0..c1108af 100644 --- a/cpu.c +++ b/cpu.c @@ -4176,35 +4176,7 @@ void function_cc step_debug(u32 pc, u32 cycles) if(current_debug_state != STEP_RUN) { -#ifdef STDIO_DEBUG key = getchar(); -#else - - gui_action_type next_input = CURSOR_NONE; - while(next_input == CURSOR_NONE) - { - next_input = get_gui_input(); - - switch(next_input) - { - case CURSOR_BACK: - key = 'b'; - break; - - case CURSOR_UP: - key = 'r'; - break; - - case CURSOR_EXIT: - key = 'q'; - break; - - default: - key = 'n'; - break; - } - } -#endif } switch(key) diff --git a/input.h b/input.h index d797ef6..cfc23f3 100644 --- a/input.h +++ b/input.h @@ -77,8 +77,6 @@ typedef enum void init_input(); u32 update_input(); -gui_action_type get_gui_input(); -gui_action_type get_gui_input_fs_hold(u32 button_id); void input_write_mem_savestate(file_tag_type savestate_file); void input_read_savestate(file_tag_type savestate_file); diff --git a/main.c b/main.c index 9722609..15bf764 100644 --- a/main.c +++ b/main.c @@ -280,11 +280,6 @@ void trigger_ext_event() event_number++; } -#ifndef __LIBRETRO__ -static u32 fps = 60; -static u32 frames_drawn = 60; -#endif - u32 update_gba() { irq_type irq_raised = IRQ_NONE; @@ -383,7 +378,6 @@ u32 update_gba() dispstat &= ~0x01; frame_ticks++; - #ifdef PC_BUILD /* printf("frame update (%x), %d instructions total, %d RAM flushes\n", reg[REG_PC], instruction_count - last_frame, flush_ram_count); last_frame = instruction_count; @@ -393,7 +387,6 @@ u32 update_gba() gbc_update_count = 0; oam_update_count = 0; flush_ram_count = 0; - #endif #ifdef __LIBRETRO__ switch_to_main_thread(); @@ -406,11 +399,6 @@ u32 update_gba() update_gbc_sound(cpu_ticks); -#if 0 - if(!synchronize_flag) - print_string("-FF-", 0xFFFF, 0x000, 216, 0); -#endif - update_screen(); synchronize(); @@ -545,95 +533,6 @@ void synchronize() print_string(char_buffer, 0xFFFF, 0x0000, 0, 0); */ } - -#elif defined(__LIBRETRO__) - -#else - -u32 real_frame_count = 0; -u32 virtual_frame_count = 0; -u32 num_skipped_frames = 0; -u32 interval_skipped_frames; -u32 frames; - -const u32 frame_interval = 60; - -void synchronize() -{ - u64 new_ticks; - u64 time_delta; - - get_ticks_us(&new_ticks); - - skip_next_frame = 0; - virtual_frame_count++; - - real_frame_count = (new_ticks * 3) / 50000; - - if(real_frame_count >= virtual_frame_count) - { - if((real_frame_count > virtual_frame_count) && - (current_frameskip_type == auto_frameskip) && - (num_skipped_frames < frameskip_value)) - { - skip_next_frame = 1; - num_skipped_frames++; - } - else - { - virtual_frame_count = real_frame_count; - num_skipped_frames = 0; - } - } - else if (synchronize_flag) - { - delay_us((u64)virtual_frame_count * 50000 / 3 - new_ticks + 2); - } - - frames++; - - if(frames == frame_interval) - { - u32 new_fps; - u32 new_frames_drawn; - - time_delta = new_ticks - last_frame_interval_timestamp; - new_fps = (u64)((u64)1000000 * (u64)frame_interval) / time_delta; - new_frames_drawn = - (frame_interval - interval_skipped_frames) * (60 / frame_interval); - - // Left open for rolling averages - fps = new_fps; - frames_drawn = new_frames_drawn; - - last_frame_interval_timestamp = new_ticks; - interval_skipped_frames = 0; - frames = 0; - } - - if(current_frameskip_type == manual_frameskip) - { - frameskip_counter = (frameskip_counter + 1) % - (frameskip_value + 1); - if(random_skip) - { - if(frameskip_counter != (rand() % (frameskip_value + 1))) - skip_next_frame = 1; - } - else - { - if(frameskip_counter) - skip_next_frame = 1; - } - } - - interval_skipped_frames += skip_next_frame; - - char char_buffer[64]; - sprintf(char_buffer, "gpSP: %2d (%2d) fps", fps, frames_drawn); - SDL_WM_SetCaption(char_buffer, "gpSP"); -} - #endif void quit() @@ -642,26 +541,6 @@ void quit() update_backup_force(); sound_exit(); - -#ifndef __LIBRETRO__ - -#ifdef REGISTER_USAGE_ANALYZE - print_register_usage(); -#endif - -#ifdef PSP_BUILD - sceKernelExitGame(); -#else - SDL_Quit(); - -#ifndef PC_BUILD - gpsp_plat_quit(); -#endif - - exit(0); -#endif - -#endif } void reset_gba() @@ -707,39 +586,6 @@ u32 file_length(const char *dummy, FILE *fp) return length; } -#ifdef __LIBRETRO__ - -#elif defined(PC_BUILD) - -void delay_us(u32 us_count) -{ - SDL_Delay(us_count / 1000); -} - -void get_ticks_us(u64 *ticks_return) -{ - *ticks_return = (u64)SDL_GetTicks() * 1000; -} - -#else - -void delay_us(u32 us_count) -{ - //usleep(us_count); - SDL_Delay(us_count / 1000); -} - -void get_ticks_us(u64 *ticks_return) -{ - struct timeval current_time; - gettimeofday(¤t_time, NULL); - - *ticks_return = - (u64)current_time.tv_sec * 1000000 + current_time.tv_usec; -} - -#endif - #endif void change_ext(const char *src, char *buffer, const char *extension) diff --git a/video.c b/video.c index c620a2e..da971af 100644 --- a/video.c +++ b/video.c @@ -3677,8 +3677,6 @@ void blit_to_screen(u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y) u32 debug_cursor_x = 0; u32 debug_cursor_y = 0; -#ifdef STDIO_DEBUG - void debug_screen_clear() { } @@ -3709,57 +3707,6 @@ void debug_screen_newline(u32 count) printf("\n"); } - -#else - -void debug_screen_clear() -{ - debug_cursor_x = 0; - debug_cursor_y = 0; - clear_screen(0x0000); -} - -void debug_screen_start() -{ - video_resolution_large(); - debug_screen_clear(); -} - -void debug_screen_end() -{ - video_resolution_small(); -} - -void debug_screen_update() -{ - flip_screen(); -} - -void debug_screen_printf(const char *format, ...) -{ - char str_buffer[512]; - u32 str_buffer_length; - va_list ap; - - va_start(ap, format); - str_buffer_length = vsnprintf(str_buffer, 512, format, ap); - va_end(ap); - - printf("printing debug string %s at %d %d\n", str_buffer, - debug_cursor_x, debug_cursor_y); - - print_string(str_buffer, 0xFFFF, 0x0000, debug_cursor_x, debug_cursor_y); - debug_cursor_x += FONT_WIDTH * str_buffer_length; -} - -void debug_screen_newline(u32 count) -{ - debug_cursor_x = 0; - debug_cursor_y += FONT_HEIGHT * count; -} - -#endif - void debug_screen_printl(const char *format, ...) { va_list ap; -- cgit v1.2.3