From: notaz Date: Fri, 2 Sep 2011 21:55:13 +0000 (+0300) Subject: get rid of GP2X_BUILD checks where they are not really needed X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=gpsp.git;a=commitdiff_plain;h=ee0a3871f9982215361cd6bb4758eb9a7c7d8413 get rid of GP2X_BUILD checks where they are not really needed --- diff --git a/common.h b/common.h index 0f800d6..6b1cf95 100644 --- a/common.h +++ b/common.h @@ -157,30 +157,6 @@ #define file_tag_type FILE * - // The ARM arch uses SDL, and SDL requires you to know what resolution - // you want. Define the resolution for ARM arch builds here. - // Placed in common.h for use with video.c and gui.c. - - #ifndef PC_BUILD - - #define GP2X_SCREEN_WIDTH 320 - #define GP2X_SCREEN_HEIGHT 240 - - #define GIZ_SCREEN_WIDTH 320 - #define GIZ_SCREEN_HEIGHT 240 - - #ifdef GP2X_BUILD - #define SDL_SCREEN_WIDTH GP2X_SCREEN_WIDTH - #define SDL_SCREEN_HEIGHT GP2X_SCREEN_HEIGHT - - #elif defined(GIZ_BUILD) - - #define SDL_SCREEN_WIDTH GIZ_SCREEN_WIDTH - #define SDL_SCREEN_HEIGHT GIZ_SCREEN_HEIGHT - #endif - - #endif - #endif // These must be variables, not constants. diff --git a/cpu.h b/cpu.h index bebe773..22ed2d3 100644 --- a/cpu.h +++ b/cpu.h @@ -133,19 +133,20 @@ s32 translate_block_arm(u32 pc, translation_region_type translation_region, s32 translate_block_thumb(u32 pc, translation_region_type translation_region, u32 smc_enable); -#ifdef GP2X_BUILD -#define ROM_TRANSLATION_CACHE_SIZE (1024 * 512 * 4 * 5) -#define RAM_TRANSLATION_CACHE_SIZE (1024 * 384 * 2) -#define BIOS_TRANSLATION_CACHE_SIZE (1024 * 128 * 2) -#define TRANSLATION_CACHE_LIMIT_THRESHOLD (1024 * 32) - -#else +#ifdef PSP_BUILD #define ROM_TRANSLATION_CACHE_SIZE (1024 * 512 * 4) #define RAM_TRANSLATION_CACHE_SIZE (1024 * 384) #define BIOS_TRANSLATION_CACHE_SIZE (1024 * 128) #define TRANSLATION_CACHE_LIMIT_THRESHOLD (1024) +#else + +#define ROM_TRANSLATION_CACHE_SIZE (1024 * 512 * 4 * 5) +#define RAM_TRANSLATION_CACHE_SIZE (1024 * 384 * 2) +#define BIOS_TRANSLATION_CACHE_SIZE (1024 * 128 * 2) +#define TRANSLATION_CACHE_LIMIT_THRESHOLD (1024 * 32) + #endif extern u8 rom_translation_cache[ROM_TRANSLATION_CACHE_SIZE]; diff --git a/cpu_threaded.c b/cpu_threaded.c index 377fb9d..62e2991 100644 --- a/cpu_threaded.c +++ b/cpu_threaded.c @@ -3481,11 +3481,7 @@ void flush_translation_cache_bios() memset(bios_rom + 0x4000, 0, 0x4000); } -#ifdef GP2X_BUILD - #define cache_dump_prefix "/mnt/nand/" -#else - #define cache_dump_prefix "" -#endif +#define cache_dump_prefix "" void dump_translation_cache() { diff --git a/gui.c b/gui.c index a2ae99e..165c669 100644 --- a/gui.c +++ b/gui.c @@ -25,10 +25,6 @@ #endif -#ifndef GP2X_BUILD -#include "gp2x/cpuctrl.h" -#endif - #include "common.h" #include "font.h" @@ -38,7 +34,7 @@ #ifdef GP2X_BUILD -#define FILE_LIST_ROWS ((int)((SDL_SCREEN_HEIGHT - 40) / FONT_HEIGHT)) +#define FILE_LIST_ROWS 20 #define FILE_LIST_POSITION 5 #define DIR_LIST_POSITION 260 @@ -52,23 +48,17 @@ #ifdef PSP_BUILD +#define COLOR_BG color16(2, 8, 10) + #define color16(red, green, blue) \ (blue << 11) | (green << 5) | red \ #else -#define color16(red, green, blue) \ - (red << 11) | (green << 5) | blue \ - -#endif - -#ifdef GP2X_BUILD - #define COLOR_BG color16(0, 0, 0) -#else - -#define COLOR_BG color16(2, 8, 10) +#define color16(red, green, blue) \ + (red << 11) | (green << 5) | blue \ #endif diff --git a/input.c b/input.c index 94c561d..e4c48fd 100644 --- a/input.c +++ b/input.c @@ -374,7 +374,7 @@ u32 gamepad_config_map[16] = BUTTON_ID_MENU // Vol middle }; -extern u32 gp2x_fps_debug; +extern u32 fps_debug; extern u32 gpsp_gp2x_joystick_read(void); gui_action_type get_gui_input() @@ -577,7 +577,7 @@ u32 update_input() break; case BUTTON_ID_FPS: - gp2x_fps_debug ^= 1; + fps_debug ^= 1; break; } diff --git a/main.c b/main.c index 85ef978..bd66c06 100644 --- a/main.c +++ b/main.c @@ -41,13 +41,13 @@ debug_state current_debug_state = RUN; frameskip_type current_frameskip_type = auto_frameskip; u32 global_cycles_per_instruction = 1; u32 random_skip = 0; +u32 fps_debug = 0; #ifdef GP2X_BUILD u32 frameskip_value = 2; u64 frame_count_initial_timestamp = 0; u64 last_frame_interval_timestamp; -u32 gp2x_fps_debug = 0; void gp2x_init(void); void gp2x_quit(void); @@ -197,8 +197,6 @@ int main(int argc, char *argv[]) sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0, vblank_interrupt_handler, NULL); sceKernelEnableSubIntr(PSP_VBLANK_INT, 0); -#elif !defined(GP2X_BUILD) - freopen("CON", "wb", stdout); #endif extern char *cpu_mode_names[]; @@ -613,7 +611,7 @@ u32 update_gba() update_gbc_sound(cpu_ticks); - if(gp2x_fps_debug) + if(fps_debug) { char print_buffer[32]; sprintf(print_buffer, "%d (%d)", fps, frames_drawn); diff --git a/main.h b/main.h index bfa35f8..c5725b3 100644 --- a/main.h +++ b/main.h @@ -111,6 +111,10 @@ extern u32 virtual_frame_count; extern u32 max_frameskip; extern u32 num_skipped_frames; +#else + +u32 file_length(u8 *dummy, FILE *fp); + #endif @@ -125,12 +129,6 @@ extern u32 num_skipped_frames; #endif -#ifdef PC_BUILD - -u32 file_length(u8 *dummy, FILE *fp); - -#endif - #define count_timer(timer_number) \ timer[timer_number].reload = 0x10000 - value; \ if(timer_number < 2) \ diff --git a/memory.c b/memory.c index 9a08df0..c0d4f11 100644 --- a/memory.c +++ b/memory.c @@ -3115,9 +3115,7 @@ void bios_region_read_allow() void bios_region_read_protect() { -#ifdef GP2X_BUILD memory_map_read[0] = NULL; -#endif } diff --git a/sound.c b/sound.c index 44177ff..81a0a8d 100644 --- a/sound.c +++ b/sound.c @@ -25,11 +25,7 @@ u32 global_enable_audio = 1; direct_sound_struct direct_sound_channel[2]; gbc_sound_struct gbc_sound_channel[4]; -#if defined(GP2X_BUILD) || defined(TAVI_BUILD) u32 sound_frequency = 44100; -#else -u32 sound_frequency = 44100; -#endif SDL_AudioSpec sound_settings; SDL_mutex *sound_mutex; diff --git a/video.c b/video.c index ffc6c7c..d3dd399 100644 --- a/video.c +++ b/video.c @@ -2432,6 +2432,9 @@ void expand_normal(u16 *screen_ptr, u32 start, u32 end) #endif +void expand_blend(u32 *screen_src_ptr, u16 *screen_dest_ptr, + u32 start, u32 end); + #ifndef ARM_ARCH void expand_blend(u32 *screen_src_ptr, u16 *screen_dest_ptr,