Remove unused stuff and fix const variables
Trying to figure out what needs to be part of a savestate :)
This commit is contained in:
		
							parent
							
								
									b61bec202f
								
							
						
					
					
						commit
						1e976fb312
					
				
					 9 changed files with 14 additions and 41 deletions
				
			
		
							
								
								
									
										11
									
								
								cpu.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								cpu.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -696,10 +696,6 @@ void print_register_usage(void)
 | 
			
		|||
      pc_address_block = load_gamepak_page(pc_region & 0x3FF);                \
 | 
			
		||||
  }                                                                           \
 | 
			
		||||
 | 
			
		||||
u32 branch_targets = 0;
 | 
			
		||||
u32 high_frequency_branch_targets = 0;
 | 
			
		||||
 | 
			
		||||
#define BRANCH_ACTIVITY_THRESHOLD 50
 | 
			
		||||
 | 
			
		||||
#define arm_update_pc()                                                       \
 | 
			
		||||
  pc = reg[REG_PC]                                                            \
 | 
			
		||||
| 
						 | 
				
			
			@ -1532,13 +1528,6 @@ const u32 cpu_modes[32] =
 | 
			
		|||
 | 
			
		||||
u32 instruction_count = 0;
 | 
			
		||||
 | 
			
		||||
u32 output_field = 0;
 | 
			
		||||
const u32 num_output_fields = 2;
 | 
			
		||||
 | 
			
		||||
u32 last_instruction = 0;
 | 
			
		||||
 | 
			
		||||
u32 in_interrupt = 0;
 | 
			
		||||
 | 
			
		||||
void set_cpu_mode(cpu_mode_type new_mode)
 | 
			
		||||
{
 | 
			
		||||
  u32 i;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								cpu.h
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								cpu.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -103,7 +103,6 @@ typedef enum
 | 
			
		|||
} translation_region_type;
 | 
			
		||||
 | 
			
		||||
extern u32 instruction_count;
 | 
			
		||||
extern u32 last_instruction;
 | 
			
		||||
 | 
			
		||||
void execute_arm(u32 cycles);
 | 
			
		||||
void raise_interrupt(irq_type irq_raised);
 | 
			
		||||
| 
						 | 
				
			
			@ -157,8 +156,6 @@ extern u32 iwram_stack_optimize;
 | 
			
		|||
extern u32 translation_gate_targets;
 | 
			
		||||
extern u32 translation_gate_target_pc[MAX_TRANSLATION_GATES];
 | 
			
		||||
 | 
			
		||||
extern u32 in_interrupt;
 | 
			
		||||
 | 
			
		||||
extern u32 *rom_branch_hash[ROM_BRANCH_HASH_SIZE];
 | 
			
		||||
 | 
			
		||||
void flush_translation_cache_rom(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2660,10 +2660,7 @@ u8 function_cc *block_lookup_address_##type(u32 pc)                           \
 | 
			
		|||
         should never be hit) */                                              \
 | 
			
		||||
      if(translation_recursion_level == 0)                                    \
 | 
			
		||||
      {                                                                       \
 | 
			
		||||
        char buffer[256];                                                     \
 | 
			
		||||
        sprintf(buffer, "bad jump %x (%x) (%x)\n", pc, reg[REG_PC],           \
 | 
			
		||||
         last_instruction);                                                   \
 | 
			
		||||
        printf("%s", buffer);                                                 \
 | 
			
		||||
        printf("bad jump %x (%x)\n", pc, reg[REG_PC]);                        \
 | 
			
		||||
      }                                                                       \
 | 
			
		||||
      block_address = (u8 *)(-1);                                             \
 | 
			
		||||
      break;                                                                  \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								gba_memory.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								gba_memory.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -82,7 +82,7 @@
 | 
			
		|||
  write_ioreg(REG_SOUND3CNT_L, value);                                        \
 | 
			
		||||
}                                                                             \
 | 
			
		||||
 | 
			
		||||
static u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 };
 | 
			
		||||
static const u32 gbc_sound_wave_volume[4] = { 0, 16384, 8192, 4096 };
 | 
			
		||||
 | 
			
		||||
#define gbc_sound_tone_control_low_wave()                                     \
 | 
			
		||||
{                                                                             \
 | 
			
		||||
| 
						 | 
				
			
			@ -206,7 +206,7 @@ static void sound_control_x(u32 value)
 | 
			
		|||
 | 
			
		||||
/* Main */
 | 
			
		||||
extern timer_type timer[4];
 | 
			
		||||
static u32 prescale_table[] = { 0, 6, 8, 10 };
 | 
			
		||||
static const u32 prescale_table[] = { 0, 6, 8, 10 };
 | 
			
		||||
 | 
			
		||||
#define count_timer(timer_number)                                             \
 | 
			
		||||
  timer[timer_number].reload = 0x10000 - value;                               \
 | 
			
		||||
| 
						 | 
				
			
			@ -273,7 +273,7 @@ static void trigger_timer(u32 timer_number, u32 value)
 | 
			
		|||
 | 
			
		||||
// This table is configured for sequential access on system defaults
 | 
			
		||||
 | 
			
		||||
u32 waitstate_cycles_sequential[16][3] =
 | 
			
		||||
const u32 waitstate_cycles_sequential[16][3] =
 | 
			
		||||
{
 | 
			
		||||
  { 1, 1, 1 }, // BIOS
 | 
			
		||||
  { 1, 1, 1 }, // Invalid
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +293,7 @@ u32 waitstate_cycles_sequential[16][3] =
 | 
			
		|||
 | 
			
		||||
// Different settings for gamepak ws0-2 sequential (2nd) access
 | 
			
		||||
 | 
			
		||||
u32 gamepak_waitstate_sequential[2][3][3] =
 | 
			
		||||
const u32 gamepak_waitstate_sequential[2][3][3] =
 | 
			
		||||
{
 | 
			
		||||
  {
 | 
			
		||||
    { 3, 3, 6 },
 | 
			
		||||
| 
						 | 
				
			
			@ -2328,7 +2328,7 @@ typedef enum
 | 
			
		|||
  DMA_REGION_NULL
 | 
			
		||||
} dma_region_type;
 | 
			
		||||
 | 
			
		||||
dma_region_type dma_region_map[16] =
 | 
			
		||||
const dma_region_type dma_region_map[16] =
 | 
			
		||||
{
 | 
			
		||||
  DMA_REGION_BIOS,          // 0x00 - BIOS
 | 
			
		||||
  DMA_REGION_NULL,          // 0x01 - Nothing
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -205,7 +205,7 @@ void function_cc write_backup(u32 address, u32 value);
 | 
			
		|||
void function_cc write_rtc(u32 address, u32 value);
 | 
			
		||||
 | 
			
		||||
/* EDIT: Shouldn't this be extern ?! */
 | 
			
		||||
extern u32 waitstate_cycles_sequential[16][3];
 | 
			
		||||
extern const u32 waitstate_cycles_sequential[16][3];
 | 
			
		||||
 | 
			
		||||
extern u32 gamepak_size;
 | 
			
		||||
extern char gamepak_title[13];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								main.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								main.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -22,18 +22,14 @@
 | 
			
		|||
 | 
			
		||||
timer_type timer[4];
 | 
			
		||||
 | 
			
		||||
u32 global_cycles_per_instruction = 1;
 | 
			
		||||
const u32 global_cycles_per_instruction = 1;
 | 
			
		||||
 | 
			
		||||
u32 cpu_ticks = 0;
 | 
			
		||||
 | 
			
		||||
u32 execute_cycles = 960;
 | 
			
		||||
s32 video_count = 960;
 | 
			
		||||
u32 ticks;
 | 
			
		||||
 | 
			
		||||
u32 arm_frame = 0;
 | 
			
		||||
u32 thumb_frame = 0;
 | 
			
		||||
u32 last_frame = 0;
 | 
			
		||||
 | 
			
		||||
u32 flush_ram_count = 0;
 | 
			
		||||
u32 gbc_update_count = 0;
 | 
			
		||||
u32 oam_update_count = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								main.h
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								main.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -78,13 +78,11 @@ typedef enum
 | 
			
		|||
 | 
			
		||||
extern u32 cpu_ticks;
 | 
			
		||||
extern u32 execute_cycles;
 | 
			
		||||
extern u32 global_cycles_per_instruction;
 | 
			
		||||
extern const u32 global_cycles_per_instruction;
 | 
			
		||||
extern u32 skip_next_frame;
 | 
			
		||||
 | 
			
		||||
extern u32 flush_ram_count;
 | 
			
		||||
 | 
			
		||||
extern u64 base_timestamp;
 | 
			
		||||
 | 
			
		||||
extern char main_path[512];
 | 
			
		||||
extern char save_path[512];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								sound.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								sound.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -19,12 +19,11 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
u32 global_enable_audio = 1;
 | 
			
		||||
 | 
			
		||||
direct_sound_struct direct_sound_channel[2];
 | 
			
		||||
gbc_sound_struct gbc_sound_channel[4];
 | 
			
		||||
 | 
			
		||||
u32 sound_frequency = GBA_SOUND_FREQUENCY;
 | 
			
		||||
const u32 sound_frequency = GBA_SOUND_FREQUENCY;
 | 
			
		||||
 | 
			
		||||
u32 sound_on;
 | 
			
		||||
static s16 sound_buffer[BUFFER_SIZE];
 | 
			
		||||
| 
						 | 
				
			
			@ -202,9 +201,9 @@ s8 wave_samples[64];
 | 
			
		|||
u32 noise_table15[1024];
 | 
			
		||||
u32 noise_table7[4];
 | 
			
		||||
 | 
			
		||||
u32 gbc_sound_master_volume_table[4] = { 1, 2, 4, 0 };
 | 
			
		||||
const u32 gbc_sound_master_volume_table[4] = { 1, 2, 4, 0 };
 | 
			
		||||
 | 
			
		||||
u32 gbc_sound_channel_volume_table[8] =
 | 
			
		||||
const u32 gbc_sound_channel_volume_table[8] =
 | 
			
		||||
{
 | 
			
		||||
  fixed_div(0, 7, 12),
 | 
			
		||||
  fixed_div(1, 7, 12),
 | 
			
		||||
| 
						 | 
				
			
			@ -216,7 +215,7 @@ u32 gbc_sound_channel_volume_table[8] =
 | 
			
		|||
  fixed_div(7, 7, 12)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
u32 gbc_sound_envelope_volume_table[16] =
 | 
			
		||||
const u32 gbc_sound_envelope_volume_table[16] =
 | 
			
		||||
{
 | 
			
		||||
  fixed_div(0, 15, 14),
 | 
			
		||||
  fixed_div(1, 15, 14),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								sound.h
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								sound.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -104,12 +104,9 @@ extern u32 gbc_sound_master_volume;
 | 
			
		|||
extern u32 gbc_sound_buffer_index;
 | 
			
		||||
extern u32 gbc_sound_last_cpu_ticks;
 | 
			
		||||
 | 
			
		||||
extern u32 sound_frequency;
 | 
			
		||||
extern const u32 sound_frequency;
 | 
			
		||||
extern u32 sound_on;
 | 
			
		||||
 | 
			
		||||
extern u32 global_enable_audio;
 | 
			
		||||
extern u32 enable_low_pass_filter;
 | 
			
		||||
 | 
			
		||||
void sound_timer_queue8(u32 channel, u8 value);
 | 
			
		||||
void sound_timer_queue16(u32 channel, u16 value);
 | 
			
		||||
void sound_timer_queue32(u32 channel, u32 value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue