diff options
author | twinaphex | 2014-12-10 15:47:19 +0100 |
---|---|---|
committer | twinaphex | 2014-12-10 15:47:19 +0100 |
commit | 7a0b0cba45912646677539ad905ba4db83d6936b (patch) | |
tree | a7a70464e6c3bbbef46fa3b8221e011b3494ae4a | |
parent | 1cd8bb5235dfb8e73d10033ab56ea5c35270a413 (diff) | |
download | picogpsp-7a0b0cba45912646677539ad905ba4db83d6936b.tar.gz picogpsp-7a0b0cba45912646677539ad905ba4db83d6936b.tar.bz2 picogpsp-7a0b0cba45912646677539ad905ba4db83d6936b.zip |
Style nits
-rw-r--r-- | cheats.c | 2 | ||||
-rw-r--r-- | cheats.h | 2 | ||||
-rw-r--r-- | cpu.c | 58 | ||||
-rw-r--r-- | cpu_threaded.c | 12 | ||||
-rw-r--r-- | gba_memory.c | 49 | ||||
-rw-r--r-- | gba_memory.h | 10 | ||||
-rw-r--r-- | main.c | 8 | ||||
-rw-r--r-- | main.h | 6 | ||||
-rw-r--r-- | sound.c | 4 | ||||
-rw-r--r-- | sound.h | 2 | ||||
-rw-r--r-- | video.c | 2 |
11 files changed, 60 insertions, 95 deletions
@@ -365,7 +365,7 @@ void process_cheat_gs3(cheat_type *cheat) } -void process_cheats() +void process_cheats(void) { u32 i; @@ -35,7 +35,7 @@ typedef struct cheat_variant_enum cheat_variant; } cheat_type; -void process_cheats(); +void process_cheats(void); void add_cheats(char *cheats_filename); #define MAX_CHEATS 16 @@ -99,7 +99,7 @@ int sort_tagged_element(const void *_a, const void *_b) return (int)(b[1] - a[1]); } -void print_register_usage() +void print_register_usage(void) { u32 i; u64 arm_reg_freq_tagged[32]; @@ -4001,36 +4001,32 @@ void set_cpu_mode(cpu_mode_type new_mode) u32 i; cpu_mode_type cpu_mode = reg[CPU_MODE]; - if(cpu_mode != new_mode) + if(cpu_mode == new_mode) + return; + + if(new_mode == MODE_FIQ) { - if(new_mode == MODE_FIQ) - { - for(i = 8; i < 15; i++) - { + for(i = 8; i < 15; i++) reg_mode[cpu_mode][i - 8] = reg[i]; - } - } - else - { - reg_mode[cpu_mode][5] = reg[REG_SP]; - reg_mode[cpu_mode][6] = reg[REG_LR]; - } + } + else + { + reg_mode[cpu_mode][5] = reg[REG_SP]; + reg_mode[cpu_mode][6] = reg[REG_LR]; + } - if(cpu_mode == MODE_FIQ) - { - for(i = 8; i < 15; i++) - { + if(cpu_mode == MODE_FIQ) + { + for(i = 8; i < 15; i++) reg[i] = reg_mode[new_mode][i - 8]; - } - } - else - { - reg[REG_SP] = reg_mode[new_mode][5]; - reg[REG_LR] = reg_mode[new_mode][6]; - } - - reg[CPU_MODE] = new_mode; } + else + { + reg[REG_SP] = reg_mode[new_mode][5]; + reg[REG_LR] = reg_mode[new_mode][6]; + } + + reg[CPU_MODE] = new_mode; } void raise_interrupt(irq_type irq_raised) @@ -4119,29 +4115,23 @@ void execute_arm(u32 cycles) alert: if(cpu_alert == CPU_ALERT_IRQ) - { cycles = cycles_remaining; - } else { collapse_flags(); while(reg[CPU_HALT_STATE] != CPU_ACTIVE) - { cycles = update_gba(); - } } } } -void init_cpu() +void init_cpu(void) { u32 i; for(i = 0; i < 16; i++) - { reg[i] = 0; - } reg[REG_SP] = 0x03007F00; reg[REG_PC] = 0x08000000; @@ -4161,9 +4151,7 @@ void move_reg(u32 *new_reg) u32 i; for(i = 0; i < 32; i++) - { new_reg[i] = reg[i]; - } reg = new_reg; } diff --git a/cpu_threaded.c b/cpu_threaded.c index 5c73d9b..0c75fb9 100644 --- a/cpu_threaded.c +++ b/cpu_threaded.c @@ -3612,10 +3612,10 @@ s32 translate_block_thumb(u32 pc, translation_region_type external_block_exits[i].branch_source, translation_target); } - return 0; -} + return 0; +} -void flush_translation_cache_ram() +void flush_translation_cache_ram(void) { flush_ram_count++; /* printf("ram flush %d (pc %x), %x to %x, %x to %x\n", @@ -3677,7 +3677,7 @@ void flush_translation_cache_ram() ewram_code_max = 0xFFFFFFFF; } -void flush_translation_cache_rom() +void flush_translation_cache_rom(void) { #ifndef PC_BUILD invalidate_icache_region(rom_translation_cache, @@ -3691,7 +3691,7 @@ void flush_translation_cache_rom() memset(rom_branch_hash, 0, sizeof(rom_branch_hash)); } -void flush_translation_cache_bios() +void flush_translation_cache_bios(void) { #ifndef PC_BUILD invalidate_icache_region(bios_translation_cache, @@ -3708,7 +3708,7 @@ void flush_translation_cache_bios() #define cache_dump_prefix "" -void dump_translation_cache() +void dump_translation_cache(void) { file_open(ram_cache, cache_dump_prefix "ram_cache.bin", write); file_write(ram_cache, ram_translation_cache, diff --git a/gba_memory.c b/gba_memory.c index 8c5541c..106a342 100644 --- a/gba_memory.c +++ b/gba_memory.c @@ -75,14 +75,9 @@ { \ gbc_sound_channel[2].wave_type = (value >> 5) & 0x01; \ gbc_sound_channel[2].wave_bank = (value >> 6) & 0x01; \ + gbc_sound_channel[2].master_enable = 0; \ if(value & 0x80) \ - { \ gbc_sound_channel[2].master_enable = 1; \ - } \ - else \ - { \ - gbc_sound_channel[2].master_enable = 0; \ - } \ \ gbc_sound_update = 1; \ address16(io_registers, 0x70) = value; \ @@ -94,14 +89,10 @@ static u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 }; { \ gbc_sound_channel[2].length_ticks = 256 - (value & 0xFF); \ if((value >> 15) & 0x01) \ - { \ gbc_sound_channel[2].wave_volume = 12288; \ - } \ else \ - { \ gbc_sound_channel[2].wave_volume = \ gbc_sound_wave_volume[(value >> 13) & 0x03]; \ - } \ gbc_sound_update = 1; \ address16(io_registers, 0x72) = value; \ } \ @@ -191,17 +182,13 @@ static u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 }; if(value & 0x80) \ { \ if(sound_on != 1) \ - { \ sound_on = 1; \ - } \ } \ else \ { \ u32 i; \ for(i = 0; i < 4; i++) \ - { \ gbc_sound_channel[i].active_flag = 0; \ - } \ sound_on = 0; \ } \ address16(io_registers, 0x84) = \ @@ -588,7 +575,7 @@ void function_cc write_eeprom(u32 address, u32 value) u32 gamepak_index = address >> 15; \ u8 *map = memory_map_read[gamepak_index]; \ \ - if(map == NULL) \ + if(!map) \ map = load_gamepak_page(gamepak_index & 0x3FF); \ \ value = address##type(map, address & 0x7FFF) \ @@ -724,9 +711,7 @@ u32 function_cc read_eeprom() read_memory_gamepak(type); \ } \ else \ - { \ value = read_eeprom(); \ - } \ \ break; \ \ @@ -1734,7 +1719,7 @@ u32 encode_bcd(u8 value) rtc_page_index = update_address >> 15; \ map = memory_map_read[rtc_page_index]; \ \ - if(map == NULL) \ + if(!map) \ map = load_gamepak_page(rtc_page_index & 0x3FF); \ \ address16(map, update_address & 0x7FFF) = _value \ @@ -2215,7 +2200,7 @@ s32 parse_config_line(char *current_line, char *current_variable, char *current_ return -1; line_ptr_new = strchr(line_ptr, ' '); - if(line_ptr_new == NULL) + if(!line_ptr_new) return -1; *line_ptr_new = 0; @@ -2410,12 +2395,12 @@ u32 load_gamepak(const char *name) gamepak_filename[sizeof(gamepak_filename) - 1] = 0; p = strrchr(gamepak_filename, PATH_SEPARATOR_CHAR); - if (p == NULL) + if (!p) p = gamepak_filename; snprintf(backup_filename, sizeof(backup_filename), "%s/%s", save_path, p); p = strrchr(backup_filename, '.'); - if (p != NULL) + if (p) strcpy(p, ".sav"); load_backup(backup_filename); @@ -3088,9 +3073,7 @@ cpu_alert_type dma_transfer(dma_transfer_type *dma) #define map_null(type, start, end) \ for(map_offset = start / 0x8000; map_offset < (end / 0x8000); \ map_offset++) \ - { \ memory_map_##type[map_offset] = NULL; \ - } \ #define map_ram_region(type, start, end, mirror_blocks, region) \ for(map_offset = (start) / 0x8000; map_offset < \ @@ -3171,9 +3154,7 @@ u8 *load_gamepak_page(u32 physical_index) // If RTC is active page the RTC register bytes so they can be read if((rtc_state != RTC_DISABLED) && (physical_index == 0)) - { memcpy(swap_location + 0xC4, rtc_registers, sizeof(rtc_registers)); - } return swap_location; } @@ -3206,7 +3187,7 @@ void init_memory_gamepak() } } -void init_gamepak_buffer() +void init_gamepak_buffer(void) { // Try to initialize 32MB (this is mainly for non-PSP platforms) gamepak_rom = NULL; @@ -3214,13 +3195,13 @@ void init_gamepak_buffer() gamepak_ram_buffer_size = 32 * 1024 * 1024; gamepak_rom = malloc(gamepak_ram_buffer_size); - if(gamepak_rom == NULL) + if(!gamepak_rom) { // Try 16MB, for PSP, then lower in 2MB increments gamepak_ram_buffer_size = 16 * 1024 * 1024; gamepak_rom = malloc(gamepak_ram_buffer_size); - while(gamepak_rom == NULL) + while(!gamepak_rom) { gamepak_ram_buffer_size -= (2 * 1024 * 1024); gamepak_rom = malloc(gamepak_ram_buffer_size); @@ -3234,7 +3215,7 @@ void init_gamepak_buffer() gamepak_ram_pages); } -void init_memory() +void init_memory(void) { u32 map_offset = 0; @@ -3356,25 +3337,25 @@ void memory_term(void) file_close(gamepak_file_large); } - if (gamepak_memory_map != NULL) + if (gamepak_memory_map) { free(gamepak_memory_map); gamepak_memory_map = NULL; } - if (gamepak_rom != NULL) + if (gamepak_rom) { free(gamepak_rom); gamepak_rom = NULL; } } -void bios_region_read_allow() +void bios_region_read_allow(void) { memory_map_read[0] = bios_rom; } -void bios_region_read_protect() +void bios_region_read_protect(void) { memory_map_read[0] = NULL; } @@ -3472,9 +3453,7 @@ void memory_##type##_savestate(void) \ /* This is a hack, for now. */ \ if((flash_bank_ptr < gamepak_backup) || \ (flash_bank_ptr > (gamepak_backup + (1024 * 64)))) \ - { \ flash_bank_ptr = gamepak_backup; \ - } \ } memory_savestate_builder(read) diff --git a/gba_memory.h b/gba_memory.h index d39220e..4405547 100644 --- a/gba_memory.h +++ b/gba_memory.h @@ -178,12 +178,12 @@ u8 *memory_region(u32 address, u32 *memory_limit); u32 load_gamepak(const char *name); u32 load_backup(char *name); s32 load_bios(char *name); -void update_backup(); -void init_memory(); -void init_gamepak_buffer(); +void update_backup(void); +void init_memory(void); +void init_gamepak_buffer(void); void memory_term(void); -void bios_region_read_allow(); -void bios_region_read_protect(); +void bios_region_read_allow(void); +void bios_region_read_protect(void); u8 *load_gamepak_page(u32 physical_index); extern u8 *gamepak_rom; @@ -49,7 +49,7 @@ u32 oam_update_count = 0; char main_path[512]; char save_path[512]; -void trigger_ext_event(); +void trigger_ext_event(void); #define check_count(count_var) \ if(count_var < execute_cycles) \ @@ -96,7 +96,7 @@ void trigger_ext_event(); } \ } \ -void init_main() +void init_main(void) { u32 i; @@ -124,7 +124,7 @@ void init_main() u32 no_alpha = 0; -u32 update_gba() +u32 update_gba(void) { irq_type irq_raised = IRQ_NONE; @@ -274,7 +274,7 @@ u32 update_gba() return execute_cycles; } -void reset_gba() +void reset_gba(void) { init_main(); init_memory(); @@ -73,10 +73,10 @@ extern u64 base_timestamp; extern char main_path[512]; extern char save_path[512]; -u32 update_gba(); -void reset_gba(); +u32 update_gba(void); +void reset_gba(void); -void init_main(); +void init_main(void); void game_name_ext(char *src, char *buffer, char *extension); void main_write_savestate(void); @@ -301,9 +301,7 @@ u32 gbc_sound_master_volume; gs->envelope_ticks = gs->envelope_initial_ticks; \ } \ else \ - { \ gs->envelope_ticks = envelope_ticks; \ - } \ } \ #define update_tone_noenvelope() \ @@ -547,7 +545,7 @@ void init_noise_table(u32 *table, u32 period, u32 bit_length) } } -void reset_sound() +void reset_sound(void) { direct_sound_struct *ds = direct_sound_channel; gbc_sound_struct *gs = gbc_sound_channel; @@ -122,6 +122,6 @@ void sound_read_savestate(void); void render_audio(void); -void reset_sound(); +void reset_sound(void); #endif @@ -3140,7 +3140,7 @@ render_scanline_window_builder(bitmap); static const u32 active_layers[6] = { 0x1F, 0x17, 0x1C, 0x14, 0x14, 0x14 }; -void update_scanline() +void update_scanline(void) { u32 pitch = get_screen_pitch(); u32 dispcnt = io_registers[REG_DISPCNT]; |