{
u32 store_count = 0;
u32 left_shift = 0;
- u32 i;
// Otherwise it'll return 0 things to store because it'll never
// find anything.
{
// Then we can throw out the last bit and tack it on
// to the first bit.
- u32 initial_bits = rotations[0];
stores[0] =
(stores[0] << ((top_bits + (32 - rotations[0])) & 0x1F)) |
((imm >> left_shift) & 0xFF);
void decrypt_gsa_code(u32 *address_ptr, u32 *value_ptr, cheat_variant_enum
cheat_variant)
{
- u32 i, i2, code_position;
+ u32 i;
u32 address = *address_ptr;
u32 value = *value_ptr;
u32 r = 0xc6ef3720;
*value_ptr = value;
}
-void add_cheats(u8 *cheats_filename)
+void add_cheats(char *cheats_filename)
{
FILE *cheats_file;
- u8 current_line[256];
- u8 *name_ptr;
+ char current_line[256];
+ char *name_ptr;
u32 *cheat_code_ptr;
u32 address, value;
u32 num_cheat_lines;
cheats[num_cheats].cheat_name[CHEAT_NAME_LENGTH - 1] = 0;
cheat_name_length = strlen(cheats[num_cheats].cheat_name);
if(cheat_name_length &&
- (cheats[num_cheats].cheat_name[cheat_name_length - 1] == '\n') ||
- (cheats[num_cheats].cheat_name[cheat_name_length - 1] == '\r'))
+ ((cheats[num_cheats].cheat_name[cheat_name_length - 1] == '\n') ||
+ (cheats[num_cheats].cheat_name[cheat_name_length - 1] == '\r')))
{
cheats[num_cheats].cheat_name[cheat_name_length - 1] = 0;
cheat_name_length--;
case CHEAT_TYPE_GAMESHARK_V3:
process_cheat_gs3(cheats + i);
break;
+
+ default:
+ break;
}
}
}
typedef struct
{
- u8 cheat_name[CHEAT_NAME_LENGTH];
+ char cheat_name[CHEAT_NAME_LENGTH];
u32 cheat_active;
u32 cheat_codes[256];
u32 num_cheat_lines;
} cheat_type;
void process_cheats();
-void add_cheats(u8 *cheats_filename);
+void add_cheats(char *cheats_filename);
#define MAX_CHEATS 16
#define calculate_reg_sh() \
- u32 reg_sh; \
+ u32 reg_sh = 0; \
switch((opcode >> 4) & 0x07) \
{ \
/* LSL imm */ \
} \
#define calculate_reg_sh_flags() \
- u32 reg_sh; \
+ u32 reg_sh = 0; \
switch((opcode >> 4) & 0x07) \
{ \
/* LSL imm */ \
} \
#define calculate_reg_offset() \
- u32 reg_offset; \
+ u32 reg_offset = 0; \
switch((opcode >> 5) & 0x03) \
{ \
/* LSL imm */ \
else \
\
if(((_address & aligned_address_mask##size) == 0) && \
- (map = memory_map_read[address >> 15])) \
+ (map = memory_map_read[_address >> 15])) \
{ \
dest = *((type *)((u8 *)map + (_address & 0x7FFF))); \
} \
#define load_aligned32(address, dest) \
{ \
- u8 *map = memory_map_read[address >> 15]; \
- if(address < 0x10000000) \
+ u32 _address = address; \
+ u8 *map = memory_map_read[_address >> 15]; \
+ if(_address < 0x10000000) \
{ \
- memory_region_access_read_u32[address >> 24]++; \
+ memory_region_access_read_u32[_address >> 24]++; \
memory_reads_u32++; \
} \
if(map) \
{ \
- dest = address32(map, address & 0x7FFF); \
+ dest = address32(map, _address & 0x7FFF); \
} \
else \
{ \
- dest = read_memory32(address); \
+ dest = read_memory32(_address); \
} \
} \
#define store_aligned32(address, value) \
{ \
- u8 *map = memory_map_write[address >> 15]; \
- if(address < 0x10000000) \
+ u32 _address = address; \
+ u8 *map = memory_map_write[_address >> 15]; \
+ if(_address < 0x10000000) \
{ \
- memory_region_access_write_u32[address >> 24]++; \
+ memory_region_access_write_u32[_address >> 24]++; \
memory_writes_u32++; \
} \
if(map) \
{ \
- address32(map, address & 0x7FFF) = value; \
+ address32(map, _address & 0x7FFF) = value; \
} \
else \
{ \
- cpu_alert = write_memory32(address, value); \
+ cpu_alert = write_memory32(_address, value); \
if(cpu_alert) \
goto alert; \
} \
const u32 _sa = src_a; \
const u32 _sb = src_b; \
u32 dest = _sa + _sb; \
- calculate_flags_add(dest, src_a, src_b); \
+ calculate_flags_add(dest, _sa, _sb); \
reg[dest_reg] = dest; \
thumb_pc_offset(2); \
} \
#define thumb_add_noflags(type, dest_reg, src_a, src_b) \
{ \
thumb_decode_##type(); \
- u32 dest = src_a + src_b; \
+ u32 dest = (src_a) + (src_b); \
reg[dest_reg] = dest; \
thumb_pc_offset(2); \
} \
const u32 _sa = src_a; \
const u32 _sb = src_b; \
u32 dest = _sa - _sb; \
- calculate_flags_sub(dest, src_a, src_b); \
+ calculate_flags_sub(dest, _sa, _sb); \
reg[dest_reg] = dest; \
thumb_pc_offset(2); \
} \
u32 in_interrupt = 0;
-u32 debug_on()
+void debug_on()
{
current_debug_state = STEP;
debug_screen_start();
}
-u32 debug_off(debug_state new_debug_state)
+void debug_off(debug_state new_debug_state)
{
current_debug_state = new_debug_state;
debug_screen_end();
}
-u32 function_cc step_debug(u32 pc, u32 cycles)
+void function_cc step_debug(u32 pc, u32 cycles)
{
u32 thumb = 0;
break;
}
+
+ default:
+ break;
}
if((current_debug_state == STEP) ||
case 'a':
{
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
u16 *current_screen = copy_screen();
get_savestate_filename_noshot(savestate_slot,
current_savestate_filename);
reg[REG_PC] = pc + 2;
else
reg[REG_PC] = pc + 4;
-
- return 0;
}
void set_cpu_mode(cpu_mode_type new_mode)
}
}
-u32 execute_arm(u32 cycles)
+void execute_arm(u32 cycles)
{
u32 pc = reg[REG_PC];
u32 opcode;
extern u32 instruction_count;
extern u32 last_instruction;
-u32 function_cc step_debug(u32 pc, u32 cycles);
-u32 execute_arm(u32 cycles);
+void execute_arm(u32 cycles);
void raise_interrupt(irq_type irq_raised);
void set_cpu_mode(cpu_mode_type new_mode);
+void debug_on();
+void debug_off(debug_state new_debug_state);
+
u32 function_cc execute_load_u8(u32 address);
u32 function_cc execute_load_u16(u32 address);
u32 function_cc execute_load_u32(u32 address);
s32 translate_block_##type(u32 pc, translation_region_type \
translation_region, u32 smc_enable) \
{ \
- u32 opcode; \
+ u32 opcode = 0; \
u32 last_opcode; \
u32 condition; \
u32 last_condition; \
u32 branch_target; \
u32 cycle_count = 0; \
u8 *translation_target; \
- u8 *backpatch_address; \
- u8 *translation_ptr; \
- u8 *translation_cache_limit; \
+ u8 *backpatch_address = NULL; \
+ u8 *translation_ptr = NULL; \
+ u8 *translation_cache_limit = NULL; \
s32 i; \
u32 flag_status; \
block_exit_type external_block_exits[MAX_EXITS]; \
#define FONT_WIDTH 6
#define FONT_HEIGHT 10
+#ifdef WANT_FONT_BITS
+
/* Font information:
name: 6x10
facename: -Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO8859-1
2210, /* (0xfe) */
2220 /* (0xff) */
};
+
+#endif /* WANT_FONT_BITS */
endif
# NOTE: -funroll-loops will slow down compiling considerably
CFLAGS += -O3 -std=c99 -msoft-float -funsigned-char -fno-common \
- -fno-builtin \
+ -fno-builtin -Wall \
INCLUDES = `$(PREFIX)/bin/sdl-config --cflags` -I$(PREFIX)/include
LIBS = `$(PREFIX)/bin/sdl-config --libs` \
.SUFFIXES: .c
+all: $(BIN)
+
+cpu.o cpu_threaded.z: CFLAGS += -Wno-unused-variable -Wno-unused-label
+
%.z: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
%.o: %.s
$(CC) $(ASFLAGS) $(INCLUDES) -c -o $@ $<
-all: $(OBJS)
+$(BIN): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $(BIN)
$(STRIP) $(BIN)
static u32 gpsp_gp2x_dev_audio;
static u32 gpsp_gp2x_dev;
+#ifdef WIZ_BUILD
static u32 gpsp_gp2x_gpiodev;
+#endif
static u32 gp2x_audio_volume = 74/2;
#define COLOR_HELP_TEXT color16(16, 40, 24)
#ifdef PSP_BUILD
- u8 *clock_speed_options[] =
+ static const char *clock_speed_options[] =
{
"33MHz", "66MHz", "100MHz", "133MHz", "166MHz", "200MHz", "233MHz",
"266MHz", "300MHz", "333MHz"
#define get_clock_speed_number() \
clock_speed_number = (clock_speed / 33) - 1
#elif defined(WIZ_BUILD)
- u8 *clock_speed_options[] =
+ static const char *clock_speed_options[] =
{
"300MHz", "333MHz", "366MHz", "400MHz", "433MHz",
"466MHz", "500MHz", "533MHz", "566MHz", "600MHz",
#define get_clock_speed_number() \
clock_speed_number = (clock_speed - 300) / 33
#elif defined(GP2X_BUILD)
- u8 *clock_speed_options[] =
+ static const char *clock_speed_options[] =
{
"150MHz", "160MHz", "170MHz", "180MHz", "190MHz",
"200MHz", "210MHz", "220MHz", "230MHz", "240MHz",
#define get_clock_speed_number() \
clock_speed_number = (clock_speed - 150) / 10
#else
- u8 *clock_speed_options[] =
+ static const char *clock_speed_options[] =
{
"0"
};
- #define menu_get_clock_speed() 0
- #define get_clock_speed_number() 0
+ #define menu_get_clock_speed()
+ #define get_clock_speed_number()
#endif
return strcasecmp(dest_str, src_str);
}
-s32 load_file(u8 **wildcards, u8 *result)
+s32 load_file(const char **wildcards, char *result)
{
DIR *current_dir;
struct dirent *current_file;
struct stat file_info;
- u8 current_dir_name[MAX_PATH];
- u8 current_dir_short[81];
+ char current_dir_name[MAX_PATH];
+ char current_dir_short[81];
u32 current_dir_length;
u32 total_filenames_allocated;
u32 total_dirnames_allocated;
- u8 **file_list;
- u8 **dir_list;
+ char **file_list;
+ char **dir_list;
u32 num_files;
u32 num_dirs;
- u8 *file_name;
+ char *file_name;
u32 file_name_length;
u32 ext_pos = -1;
u32 chosen_file, chosen_dir;
- u32 dialog_result = 1;
s32 return_value = 1;
s32 current_file_selection;
s32 current_file_scroll_value;
total_filenames_allocated = 32;
total_dirnames_allocated = 32;
- file_list = (u8 **)malloc(sizeof(u8 *) * 32);
- dir_list = (u8 **)malloc(sizeof(u8 *) * 32);
- memset(file_list, 0, sizeof(u8 *) * 32);
- memset(dir_list, 0, sizeof(u8 *) * 32);
+ file_list = (char **)malloc(sizeof(char *) * 32);
+ dir_list = (char **)malloc(sizeof(char *) * 32);
+ memset(file_list, 0, sizeof(char *) * 32);
+ memset(dir_list, 0, sizeof(char *) * 32);
num_files = 0;
num_dirs = 0;
{
if(S_ISDIR(file_info.st_mode))
{
- dir_list[num_dirs] =
- (u8 *)malloc(file_name_length + 1);
+ dir_list[num_dirs] = malloc(file_name_length + 1);
sprintf(dir_list[num_dirs], "%s", file_name);
wildcards[i]))
{
file_list[num_files] =
- (u8 *)malloc(file_name_length + 1);
+ malloc(file_name_length + 1);
sprintf(file_list[num_files], "%s", file_name);
if(num_files == total_filenames_allocated)
{
- file_list = (u8 **)realloc(file_list, sizeof(u8 *) *
+ file_list = (char **)realloc(file_list, sizeof(char *) *
total_filenames_allocated * 2);
memset(file_list + total_filenames_allocated, 0,
- sizeof(u8 *) * total_filenames_allocated);
+ sizeof(char *) * total_filenames_allocated);
total_filenames_allocated *= 2;
}
if(num_dirs == total_dirnames_allocated)
{
- dir_list = (u8 **)realloc(dir_list, sizeof(u8 *) *
+ dir_list = (char **)realloc(dir_list, sizeof(char *) *
total_dirnames_allocated * 2);
memset(dir_list + total_dirnames_allocated, 0,
- sizeof(u8 *) * total_dirnames_allocated);
+ sizeof(char *) * total_dirnames_allocated);
total_dirnames_allocated *= 2;
}
}
} while(current_file);
- qsort((void *)file_list, num_files, sizeof(u8 *), sort_function);
- qsort((void *)dir_list, num_dirs, sizeof(u8 *), sort_function);
+ qsort((void *)file_list, num_files, sizeof(char *), sort_function);
+ qsort((void *)dir_list, num_dirs, sizeof(char *), sort_function);
closedir(current_dir);
clear_screen(COLOR_BG);
{
- u8 print_buffer[81];
-
while(repeat)
{
flip_screen();
return_value = -1;
repeat = 0;
break;
+
+ default:
+ break;
}
}
}
#endif
-u8 *scale_options[] =
+static const char *scale_options[] =
{
#ifdef PSP_BUILD
"unscaled 3:2", "scaled 3:2", "fullscreen 16:9"
s32 load_game_config_file()
{
- u8 game_config_filename[512];
+ char game_config_filename[512];
u32 file_loaded = 0;
u32 i;
change_ext(gamepak_filename, game_config_filename, ".cfg");
s32 load_config_file()
{
- u8 config_path[512];
+ char config_path[512];
#if defined(_WIN32) || defined(_WIN32_WCE)
sprintf(config_path, "%s\\%s", main_path, GPSP_CONFIG_FILENAME);
if(file_size == 92)
{
u32 file_options[file_size / 4];
- u32 i;
- s32 menu_button = -1;
file_read_array(config_file, file_options);
screen_scale = file_options[0] %
// key, if not assign to triangle
#ifndef PC_BUILD
+ u32 i;
+ s32 menu_button = -1;
for(i = 0; i < 16; i++)
{
gamepad_config_map[i] = file_options[7 + i] %
s32 save_game_config_file()
{
- u8 game_config_filename[512];
+ char game_config_filename[512];
u32 i;
change_ext(gamepak_filename, game_config_filename, ".cfg");
s32 save_config_file()
{
- u8 config_path[512];
+ char config_path[512];
#if (defined(PSP_BUILD) || defined(ARM_ARCH)) && !defined(_WIN32_WCE)
sprintf(config_path, "%s/%s", main_path, GPSP_CONFIG_FILENAME);
if(file_check_valid(config_file))
{
u32 file_options[23];
- u32 i;
file_options[0] = screen_scale;
file_options[1] = screen_filter;
file_options[6] = analog_sensitivity_level;
#ifndef PC_BUILD
+ u32 i;
for(i = 0; i < 16; i++)
{
file_options[7 + i] = gamepad_config_map[i];
u32 savestate_slot = 0;
-void get_savestate_snapshot(u8 *savestate_filename)
+void get_savestate_snapshot(char *savestate_filename)
{
u16 snapshot_buffer[240 * 160];
- u8 savestate_timestamp_string[80];
+ char savestate_timestamp_string[80];
file_open(savestate_file, savestate_filename, read);
if(file_check_valid(savestate_file))
{
- u8 weekday_strings[7][11] =
+ const char weekday_strings[7][11] =
{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
#endif
}
-void get_savestate_filename(u32 slot, u8 *name_buffer)
+void get_savestate_filename(u32 slot, char *name_buffer)
{
- u8 savestate_ext[16];
+ char savestate_ext[16];
sprintf(savestate_ext, "%d.svs", slot);
change_ext(gamepak_filename, name_buffer, savestate_ext);
get_savestate_snapshot(name_buffer);
}
-void get_savestate_filename_noshot(u32 slot, u8 *name_buffer)
+void get_savestate_filename_noshot(u32 slot, char *name_buffer)
{
- u8 savestate_ext[16];
+ char savestate_ext[16];
sprintf(savestate_ext, "%d.svs", slot);
change_ext(gamepak_filename, name_buffer, savestate_ext);
u32 menu(u16 *original_screen)
{
- u8 print_buffer[81];
+ char print_buffer[81];
u32 clock_speed_number;
- u32 _current_option = 0;
gui_action_type gui_action;
- menu_enum _current_menu = MAIN_MENU;
u32 i;
u32 repeat = 1;
u32 return_value = 0;
u32 first_load = 0;
- u8 savestate_ext[16];
- u8 current_savestate_filename[512];
- u8 line_buffer[80];
- u8 cheat_format_str[10][41];
+ char current_savestate_filename[512];
+ char line_buffer[80];
+ char cheat_format_str[10][41];
menu_type *current_menu;
menu_option_type *current_option;
auto void choose_menu();
auto void clear_help();
- static const u8 * const gamepad_help[] =
+#ifndef PC_BUILD
+ static const char * const gamepad_help[] =
{
"Up button on GBA d-pad.",
"Down button on GBA d-pad.",
"Does nothing."
};
+ static const char *gamepad_config_buttons[] =
+ {
+ "UP",
+ "DOWN",
+ "LEFT",
+ "RIGHT",
+ "A",
+ "B",
+ "L",
+ "R",
+ "START",
+ "SELECT",
+ "MENU",
+ "FASTFORWARD",
+ "LOAD STATE",
+ "SAVE STATE",
+ "RAPIDFIRE A",
+ "RAPIDFIRE B",
+ "RAPIDFIRE L",
+ "RAPIDFIRE R",
+ "VOLUME UP",
+ "VOLUME DOWN",
+ "DISPLAY FPS",
+ "NOTHING"
+ };
+#endif
+
void menu_update_clock()
{
get_clock_speed_number();
void menu_load()
{
- u8 *file_ext[] = { ".gba", ".bin", ".zip", NULL };
- u8 load_filename[512];
+ const char *file_ext[] = { ".gba", ".bin", ".zip", NULL };
+ char load_filename[512];
save_game_config_file();
if(load_file(file_ext, load_filename) != -1)
{
void menu_load_state_file()
{
- u8 *file_ext[] = { ".svs", NULL };
- u8 load_filename[512];
+ const char *file_ext[] = { ".svs", NULL };
+ char load_filename[512];
if(load_file(file_ext, load_filename) != -1)
{
load_state(load_filename);
current_savestate_filename);
}
- u8 *yes_no_options[] = { "no", "yes" };
- u8 *enable_disable_options[] = { "disabled", "enabled" };
+ const char *yes_no_options[] = { "no", "yes" };
+ const char *enable_disable_options[] = { "disabled", "enabled" };
- u8 *frameskip_options[] = { "automatic", "manual", "off" };
- u8 *frameskip_variation_options[] = { "uniform", "random" };
+ const char *frameskip_options[] = { "automatic", "manual", "off" };
+ const char *frameskip_variation_options[] = { "uniform", "random" };
#ifndef PSP_BUILD
- u8 *audio_buffer_options[] =
+ static const char *audio_buffer_options[] =
{
"16 bytes", "32 bytes", "64 bytes",
"128 bytes", "256 bytes", "512 bytes", "1024 bytes", "2048 bytes",
"4096 bytes", "8192 bytes", "16284 bytes"
};
#else
- u8 *audio_buffer_options[] =
+ const char *audio_buffer_options[] =
{
"3072 bytes", "4096 bytes", "5120 bytes", "6144 bytes", "7168 bytes",
"8192 bytes", "9216 bytes", "10240 bytes", "11264 bytes", "12288 bytes"
};
-
#endif
- u8 *update_backup_options[] = { "Exit only", "Automatic" };
-
- u8 *gamepad_config_buttons[] =
- {
- "UP",
- "DOWN",
- "LEFT",
- "RIGHT",
- "A",
- "B",
- "L",
- "R",
- "START",
- "SELECT",
- "MENU",
- "FASTFORWARD",
- "LOAD STATE",
- "SAVE STATE",
- "RAPIDFIRE A",
- "RAPIDFIRE B",
- "RAPIDFIRE L",
- "RAPIDFIRE R",
- "VOLUME UP",
- "VOLUME DOWN",
- "DISPLAY FPS",
- "NOTHING"
- };
+ static const char *update_backup_options[] = { "Exit only", "Automatic" };
// Marker for help information, don't go past this mark (except \n)------*
menu_option_type graphics_sound_options[] =
if(current_option->option_type & SUBMENU_OPTION)
choose_menu(current_option->sub_menu);
break;
+
+ default:
+ break;
}
}
#define GPSP_CONFIG_FILENAME "gpsp.cfg"
-s32 load_file(u8 **wildcards, u8 *result);
+s32 load_file(const char **wildcards, char *result);
u32 adjust_frameskip(u32 button_id);
s32 load_game_config_file();
s32 load_config_file();
extern u32 savestate_slot;
-void get_savestate_filename_noshot(u32 slot, u8 *name_buffer);
-void get_savestate_filename(u32 slot, u8 *name_buffer);
-void get_savestate_snapshot(u8 *savestate_filename);
+void get_savestate_filename_noshot(u32 slot, char *name_buffer);
+void get_savestate_filename(u32 slot, char *name_buffer);
+void get_savestate_snapshot(char *savestate_filename);
#ifdef WIZ_BUILD
#define default_clock_speed 533
void trigger_key(u32 key)
{
u32 p1_cnt = io_registers[REG_P1CNT];
- u32 p1;
if((p1_cnt >> 14) & 0x01)
{
case BUTTON_ID_LOADSTATE:
{
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
get_savestate_filename_noshot(savestate_slot,
current_savestate_filename);
load_state(current_savestate_filename);
case BUTTON_ID_SAVESTATE:
{
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
u16 *current_screen = copy_screen();
get_savestate_filename_noshot(savestate_slot,
current_savestate_filename);
case SDLK_BACKSPACE:
gui_action = CURSOR_BACK;
break;
+
+ default:
+ break;
}
break;
}
if(event.key.keysym.sym == SDLK_F5)
{
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
u16 *current_screen = copy_screen();
get_savestate_filename_noshot(savestate_slot,
current_savestate_filename);
if(event.key.keysym.sym == SDLK_F7)
{
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
get_savestate_filename_noshot(savestate_slot,
current_savestate_filename);
load_state(current_savestate_filename);
#else
u32 clock_speed = 333;
#endif
-u8 main_path[512];
+char main_path[512];
void trigger_ext_event();
} \
} \
-u8 *file_ext[] = { ".gba", ".bin", ".zip", NULL };
+static const char *file_ext[] = { ".gba", ".bin", ".zip", NULL };
#ifdef ARM_ARCH
void ChangeWorkingDirectory(char *exe)
int main(int argc, char *argv[])
{
- u32 i;
- u32 vcount = 0;
- u32 ticks;
- u32 dispstat;
- u8 load_filename[512];
- u8 bios_filename[512];
-
#ifdef PSP_BUILD
sceKernelRegisterSubIntrHandler(PSP_VBLANK_INT, 0,
vblank_interrupt_handler, NULL);
sceKernelEnableSubIntr(PSP_VBLANK_INT, 0);
#endif
- extern char *cpu_mode_names[];
-
init_gamepak_buffer();
// Copy the directory path of the executable into main_path
init_video();
#ifdef GP2X_BUILD
+ char bios_filename[512];
sprintf(bios_filename, "%s/%s", main_path, "gba_bios.bin");
if(load_bios(bios_filename) == -1)
#else
if(load_gamepak(argv[1]) == -1)
{
#ifndef PSP_BUILD
- printf("Failed to load gamepak %s, exiting.\n", load_filename);
+ printf("Failed to load gamepak %s, exiting.\n", argv[1]);
#endif
exit(-1);
}
}
else
{
+ char load_filename[512];
if(load_file(file_ext, load_filename) == -1)
{
menu(copy_screen());
static u32 event_number = 0;
static u64 benchmark_ticks[16];
u64 new_ticks;
- u8 current_savestate_filename[512];
+ char current_savestate_filename[512];
return;
#ifdef PSP_BUILD
-u32 file_length(u8 *filename, s32 dummy)
+u32 file_length(char *filename, s32 dummy)
{
SceIoStat stats;
sceIoGetstat(filename, &stats);
#else
-u32 file_length(u8 *dummy, FILE *fp)
+u32 file_length(char *dummy, FILE *fp)
{
u32 length;
#endif
-void change_ext(u8 *src, u8 *buffer, u8 *extension)
+void change_ext(const char *src, char *buffer, const char *extension)
{
- u8 *dot_position;
+ char *dot_position;
strcpy(buffer, src);
dot_position = strrchr(buffer, '.');
extern u32 synchronize_flag;
extern u32 skip_next_frame;
-extern timer_type timer[4];
-static u32 prescale_table[] = { 0, 6, 8, 10 };
-
extern u32 cycle_memory_access;
extern u32 cycle_pc_relative_access;
extern u32 cycle_sp_relative_access;
extern u64 base_timestamp;
-extern u8 main_path[512];
+extern char main_path[512];
extern u32 update_backup_flag;
extern u32 clock_speed;
void quit();
void delay_us(u32 us_count);
void get_ticks_us(u64 *tick_return);
-void game_name_ext(u8 *src, u8 *buffer, u8 *extension);
+void game_name_ext(char *src, char *buffer, char *extension);
void main_write_mem_savestate(file_tag_type savestate_file);
void main_read_savestate(file_tag_type savestate_file);
#ifdef PSP_BUILD
-u32 file_length(u8 *filename, s32 dummy);
+u32 file_length(char *filename, s32 dummy);
#else
-u32 file_length(u8 *dummy, FILE *fp);
+u32 file_length(char *dummy, FILE *fp);
#endif
extern u32 max_frameskip;
extern u32 num_skipped_frames;
+#ifdef IN_MEMORY_C
+
+extern timer_type timer[4];
+static u32 prescale_table[] = { 0, 6, 8, 10 };
+
#define count_timer(timer_number) \
timer[timer_number].reload = 0x10000 - value; \
if(timer_number < 2) \
} \
address16(io_registers, 0x102 + (timer_number * 4)) = value; \
-void change_ext(u8 *src, u8 *buffer, u8 *extension);
+#endif // IN_MEMORY_C
+
+void change_ext(const char *src, char *buffer, const char *extension);
void set_clock_speed();
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#define IN_MEMORY_C
#include "common.h"
// This table is configured for sequential access on system defaults
u8 read_backup(u32 address)
{
- u8 value;
+ u8 value = 0;
if(backup_type == BACKUP_NONE)
backup_type = BACKUP_SRAM;
eeprom_mode = EEPROM_BASE_MODE;
}
break;
+
+ default:
+ break;
}
}
case RTC_WRITE_STATUS:
rtc_status = rtc_data[0];
break;
+
+ default:
+ break;
}
}
}
}
}
break;
+
+ default:
+ break;
}
}
}
if(file_check_valid(backup_file))
{
- u32 backup_size;
+ u32 backup_size = 0;
switch(backup_type)
{
else
backup_size = 0x2000;
break;
+
+ default:
+ break;
}
file_write(backup_file, gamepak_backup, backup_size);
#define CONFIG_FILENAME "game_config.txt"
-u8 *skip_spaces(u8 *line_ptr)
+char *skip_spaces(char *line_ptr)
{
while(*line_ptr == ' ')
line_ptr++;
return line_ptr;
}
-s32 parse_config_line(u8 *current_line, u8 *current_variable, u8 *current_value)
+s32 parse_config_line(char *current_line, char *current_variable, char *current_value)
{
- u8 *line_ptr = current_line;
- u8 *line_ptr_new;
+ char *line_ptr = current_line;
+ char *line_ptr_new;
if((current_line[0] == 0) || (current_line[0] == '#'))
return -1;
return 0;
}
-s32 load_game_config(u8 *gamepak_title, u8 *gamepak_code, u8 *gamepak_maker)
+s32 load_game_config(char *gamepak_title, char *gamepak_code, char *gamepak_maker)
{
- u8 current_line[256];
- u8 current_variable[256];
- u8 current_value[256];
- u8 config_path[512];
- u8 *line_ptr;
- u32 fgets_value;
+ char current_line[256];
+ char current_variable[256];
+ char current_value[256];
+ char config_path[512];
FILE *config_file;
idle_loop_target_pc = 0xFFFFFFFF;
}
if(!strcmp(current_variable, "iwram_stack_optimize") &&
- !strcmp(current_value, "no"))
+ !strcmp(current_value, "no\0")) /* \0 for broken toolchain workaround */
{
iwram_stack_optimize = 0;
}
return -1;
}
-u8 gamepak_title[13];
-u8 gamepak_code[5];
-u8 gamepak_maker[3];
-u8 gamepak_filename[512];
+char gamepak_title[13];
+char gamepak_code[5];
+char gamepak_maker[3];
+char gamepak_filename[512];
u32 load_gamepak(char *name)
{
char *dot_position = strrchr(name, '.');
s32 file_size;
- u8 cheats_filename[256];
+ char cheats_filename[256];
#ifdef WIZ_BUILD
file_size = wiz_load_gamepak(name);
void init_memory()
{
- u32 i;
u32 map_offset = 0;
memory_regions[0x00] = (u8 *)bios_rom;
if(file_check_valid(savestate_file))
{
char current_gamepak_filename[512];
- char savestate_gamepak_filename[512];
u32 i;
u32 current_color;
extern u32 waitstate_cycles_sequential[16][3];
extern u32 gamepak_size;
-extern u8 gamepak_title[13];
-extern u8 gamepak_code[5];
-extern u8 gamepak_maker[3];
-extern u8 gamepak_filename[512];
+extern char gamepak_title[13];
+extern char gamepak_code[5];
+extern char gamepak_maker[3];
+extern char gamepak_filename[512];
cpu_alert_type dma_transfer(dma_transfer_type *dma);
u8 *memory_region(u32 address, u32 *memory_limit);
# Platform specific definitions
VPATH += .. ../arm
-CFLAGS += -DARM_ARCH -DPND_BUILD
-CFLAGS += -funsigned-char
+CFLAGS += -DARM_ARCH -DPND_BUILD -Wall
CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
-CFLAGS += -fno-common -fno-builtin
+CFLAGS += -fno-common
CFLAGS += -ggdb
CFLAGS += -O2
# Compilation:
+all: $(BIN)
+
%.o: %.S
$(CC) $(CFLAGS) -c -o $@ $<
-all: $(BIN)
+cpu.o cpu_threaded.o: CFLAGS += -Wno-unused-variable -Wno-unused-label
$(BIN): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $(BIN)
u32 sound_frequency = 44100;
-SDL_AudioSpec sound_settings;
SDL_mutex *sound_mutex;
-SDL_cond *sound_cv;
+static SDL_cond *sound_cv;
#ifdef PSP_BUILD
u32 audio_buffer_size_number = 1;
u32 audio_buffer_size_number = 8;
#endif
-u32 audio_buffer_size;
-u32 sound_on = 0;
-s16 sound_buffer[BUFFER_SIZE];
-u32 sound_buffer_base = 0;
+u32 sound_on;
+static u32 audio_buffer_size;
+static s16 sound_buffer[BUFFER_SIZE];
+static u32 sound_buffer_base;
-u32 sound_last_cpu_ticks = 0;
-fixed16_16 gbc_sound_tick_step;
+static u32 sound_last_cpu_ticks;
+static fixed16_16 gbc_sound_tick_step;
-u32 sound_exit_flag;
+static u32 sound_exit_flag;
// Queue 1, 2, or 4 samples to the top of the DS FIFO, wrap around circularly
void init_sound()
{
+ SDL_AudioSpec sound_settings;
+
#ifdef PSP_BUILD
audio_buffer_size = (audio_buffer_size_number * 1024) + 3072;
#else
extern u32 audio_buffer_size_number;
extern SDL_mutex *sound_mutex;
-extern SDL_cond *sound_cv;
void sound_timer_queue8(u32 channel, u8 value);
void sound_timer_queue16(u32 channel, u16 value);
void sound_write_mem_savestate(file_tag_type savestate_file);
void sound_read_savestate(file_tag_type savestate_file);
+#ifdef IN_MEMORY_C
+
#define gbc_sound_tone_control_low(channel, address) \
{ \
u32 initial_volume = (value >> 12) & 0x0F; \
timer[timer_number].frequency_step = \
float_to_fp16_16(16777216.0 / (timer_reload * sound_frequency)) \
+#endif // IN_MEMORY_C
void reset_sound();
void sound_exit();
*/
#include "common.h"
+#define WANT_FONT_BITS
#include "font.h"
#ifdef PSP_BUILD
#endif
-void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
- u32 enable_flags, u32 dispcnt, u32 bldcnt, tile_layer_render_struct
+static void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
+ u32 enable_flags, u32 dispcnt, u32 bldcnt, const tile_layer_render_struct
*layer_renderers);
-void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
- u32 enable_flags, u32 dispcnt, u32 bldcnt, bitmap_layer_render_struct
+static void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
+ u32 enable_flags, u32 dispcnt, u32 bldcnt, const bitmap_layer_render_struct
*layer_renderers);
#define no_op \
-
-// Map widths and heights
-
-u32 map_widths[] = { 256, 512, 256, 512 };
-u32 map_heights[] = { 256, 256, 512, 512 };
+static const u32 map_widths[] = { 256, 512, 256, 512 };
// Build text scanline rendering functions.
#define render_scanline_text_builder(combine_op, alpha_op) \
-void render_scanline_text_##combine_op##_##alpha_op(u32 layer, \
+static void render_scanline_text_##combine_op##_##alpha_op(u32 layer, \
u32 start, u32 end, void *scanline) \
{ \
render_scanline_extra_variables_##combine_op##_##alpha_op(text); \
u32 bg_control = io_registers[REG_BG0CNT + layer]; \
u32 map_size = (bg_control >> 14) & 0x03; \
u32 map_width = map_widths[map_size]; \
- u32 map_height = map_heights[map_size]; \
u32 horizontal_offset = \
(io_registers[REG_BG0HOFS + (layer * 2)] + start) % 512; \
u32 vertical_offset = (io_registers[REG_VCOUNT] + \
u32 bg_control = io_registers[REG_BG0CNT + layer]; \
u32 current_pixel; \
s32 source_x, source_y; \
- u32 vcount = io_registers[REG_VCOUNT]; \
u32 pixel_x, pixel_y; \
u32 layer_offset = (layer - 2) * 8; \
s32 dx, dy; \
u32 map_pitch = map_size + 4; \
u8 *map_base = vram + (((bg_control >> 8) & 0x1F) * (1024 * 2)); \
u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)); \
- u8 *tile_ptr; \
+ u8 *tile_ptr = NULL; \
u32 map_offset, last_map_offset = (u32)-1; \
u32 i; \
render_scanline_dest_##alpha_op *dest_ptr = \
// Build bitmap scanline rendering functions.
#define render_scanline_bitmap_builder(type, alpha_op, width, height) \
-void render_scanline_bitmap_##type##_##alpha_op(u32 start, u32 end, \
+static void render_scanline_bitmap_##type##_##alpha_op(u32 start, u32 end, \
void *scanline) \
{ \
- u32 bg_control = io_registers[REG_BG2CNT]; \
u32 current_pixel; \
s32 source_x, source_y; \
- u32 vcount = io_registers[REG_VCOUNT]; \
s32 pixel_x, pixel_y; \
\
s32 dx = (s16)io_registers[REG_BG2PA]; \
// Structs containing functions to render the layers for each mode, for
// each render type.
-tile_layer_render_struct tile_mode_renderers[3][4] =
+static const tile_layer_render_struct tile_mode_renderers[3][4] =
{
{
tile_layer_render_functions(text), tile_layer_render_functions(text),
}
};
-bitmap_layer_render_struct bitmap_mode_renderers[3] =
+static const bitmap_layer_render_struct bitmap_mode_renderers[3] =
{
bitmap_layer_render_functions(mode3),
bitmap_layer_render_functions(mode4),
#define render_scanline_layer_functions_tile() \
- tile_layer_render_struct *layer_renderers = \
+ const tile_layer_render_struct *layer_renderers = \
tile_mode_renderers[dispcnt & 0x07] \
#define render_scanline_layer_functions_bitmap() \
- bitmap_layer_render_struct *layer_renderers = \
+ const bitmap_layer_render_struct *layer_renderers = \
bitmap_mode_renderers + ((dispcnt & 0x07) - 3) \
+ (tile_size_##color_depth * ((obj_width - 8) / 8)) \
-// Adjust the obj's starting point if it goes too far off the left edge of \
-// the screen. \
+// Adjust the obj's starting point if it goes too far off the left edge of
+// the screen.
#define obj_tile_right_offset_noflip(color_depth) \
tile_ptr += (partial_tile_offset / 8) * tile_size_##color_depth \
#define obj_render_affine(combine_op, color_depth, alpha_op, map_space) \
{ \
- s16 *params = oam_ram + (((obj_attribute_1 >> 9) & 0x1F) * 16); \
+ s16 *params = (s16 *)oam_ram + (((obj_attribute_1 >> 9) & 0x1F) * 16); \
s32 dx = params[3]; \
s32 dmx = params[7]; \
s32 dy = params[11]; \
s32 dmy = params[15]; \
s32 source_x, source_y; \
s32 tile_x, tile_y; \
- u32 tile_offset; \
u32 tile_map_offset; \
s32 middle_x; \
s32 middle_y; \
} \
} \
-u32 obj_width_table[] = { 8, 16, 32, 64, 16, 32, 32, 64, 8, 8, 16, 32 };
-u32 obj_height_table[] = { 8, 16, 32, 64, 8, 8, 16, 32, 16, 32, 32, 64 };
+static const u32 obj_width_table[] =
+ { 8, 16, 32, 64, 16, 32, 32, 64, 8, 8, 16, 32 };
+static const u32 obj_height_table[] =
+ { 8, 16, 32, 64, 8, 8, 16, 32, 16, 32, 32, 64 };
-u8 obj_priority_list[5][160][128];
-u32 obj_priority_count[5][160];
-u32 obj_alpha_count[160];
+static u8 obj_priority_list[5][160][128];
+static u32 obj_priority_count[5][160];
+static u32 obj_alpha_count[160];
// Build obj rendering functions
#define render_scanline_obj_extra_variables_color() \
- u32 dest; \
u32 pixel_combine = color_combine_mask(4) | (1 << 8) \
#define render_scanline_obj_extra_variables_alpha_obj(map_space) \
render_scanline_obj_extra_variables_color(); \
+ u32 dest; \
if((pixel_combine & 0x00000200) == 0) \
{ \
render_scanline_obj_color32_##map_space(priority, start, end, scanline); \
#define render_scanline_obj_extra_variables_partial_alpha(map_space) \
render_scanline_obj_extra_variables_color(); \
- u32 base_pixel_combine = pixel_combine \
+ u32 base_pixel_combine = pixel_combine; \
+ u32 dest \
#define render_scanline_obj_extra_variables_copy(type) \
u32 bldcnt = io_registers[REG_BLDCNT]; \
#define render_scanline_obj_builder(combine_op, alpha_op, map_space, \
partial_alpha_op) \
-void render_scanline_obj_##alpha_op##_##map_space(u32 priority, \
+static void render_scanline_obj_##alpha_op##_##map_space(u32 priority, \
u32 start, u32 end, render_scanline_dest_##alpha_op *scanline) \
{ \
render_scanline_obj_extra_variables_##alpha_op(map_space); \
-void order_obj(u32 video_mode)
+static void order_obj(u32 video_mode)
{
s32 obj_num, priority, row;
s32 obj_x, obj_y;
s32 obj_width, obj_height;
u32 obj_priority;
u32 obj_attribute_0, obj_attribute_1, obj_attribute_2;
- s32 vcount = io_registers[REG_VCOUNT];
- u32 partial_tile_run, partial_tile_offset;
- u32 pixel_run;
u32 current_count;
u16 *oam_ptr = oam_ram + 508;
- u16 *dest_ptr;
- u8 *tile_base = vram + 0x10000;
- u8 *tile_ptr;
for(priority = 0; priority < 5; priority++)
{
u32 layer_order[16];
u32 layer_count;
-u32 order_layers(u32 layer_flags)
+static void order_layers(u32 layer_flags)
{
s32 priority, layer_number;
layer_count = 0;
#define fill_line_color_color32() \
#define fill_line_builder(type) \
-void fill_line_##type(u16 color, render_scanline_dest_##type *dest_ptr, \
+static void fill_line_##type(u16 color, render_scanline_dest_##type *dest_ptr,\
u32 start, u32 end) \
{ \
fill_line_color_##type(); \
// Blend scanline with white.
-void expand_darken(u16 *screen_src_ptr, u16 *screen_dest_ptr,
+static void expand_darken(u16 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
u32 pixel_top;
// Blend scanline with black.
-void expand_brighten(u16 *screen_src_ptr, u16 *screen_dest_ptr,
+static void expand_brighten(u16 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
u32 pixel_top;
// Expand scanline such that if both top and bottom pass it's alpha,
// if only top passes it's as specified, and if neither pass it's normal.
-void expand_darken_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
+static void expand_darken_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
s32 blend = 16 - (io_registers[REG_BLDY] & 0x1F);
}
-void expand_brighten_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
+static void expand_brighten_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
s32 blend = io_registers[REG_BLDY] & 0x1F;
// Renders an entire scanline from 0 to 240, based on current color mode.
-void render_scanline_tile(u16 *scanline, u32 dispcnt)
+static void render_scanline_tile(u16 *scanline, u32 dispcnt)
{
u32 current_layer;
u32 layer_order_pos;
render_condition_alpha, render_condition_fade, 0, 240);
}
-void render_scanline_bitmap(u16 *scanline, u32 dispcnt)
+static void render_scanline_bitmap(u16 *scanline, u32 dispcnt)
{
- u32 bldcnt = io_registers[REG_BLDCNT];
render_scanline_layer_functions_bitmap();
u32 current_layer;
u32 layer_order_pos;
// Render all of the BG and OBJ in a tiled scanline from start to end ONLY if
// enable_flag allows that layer/OBJ. Also conditionally render color effects.
-void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
- u32 enable_flags, u32 dispcnt, u32 bldcnt, tile_layer_render_struct
+static void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
+ u32 enable_flags, u32 dispcnt, u32 bldcnt, const tile_layer_render_struct
*layer_renderers)
{
u32 current_layer;
// Render the BG and OBJ in a bitmap scanline from start to end ONLY if
// enable_flag allows that layer/OBJ. Also conditionally render color effects.
-void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
- u32 enable_flags, u32 dispcnt, u32 bldcnt, bitmap_layer_render_struct
+static void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
+ u32 enable_flags, u32 dispcnt, u32 bldcnt, const bitmap_layer_render_struct
*layer_renderers)
{
u32 current_layer;
#define window_coords(window_number) \
u32 window_##window_number##_x1, window_##window_number##_x2; \
u32 window_##window_number##_y1, window_##window_number##_y2; \
- u32 window_##window_number##_enable; \
+ u32 window_##window_number##_enable = 0; \
window_##window_number##_y1 = \
io_registers[REG_WIN##window_number##V] >> 8; \
window_##window_number##_y2 = \
} \
#define render_scanline_window_builder(type) \
-void render_scanline_window_##type(u16 *scanline, u32 dispcnt) \
+static void render_scanline_window_##type(u16 *scanline, u32 dispcnt) \
{ \
u32 vcount = io_registers[REG_VCOUNT]; \
u32 winout = io_registers[REG_WINOUT]; \
/* Just OBJ windows */ \
case 0x04: \
{ \
- u32 window_obj_enable = winout >> 8; \
render_window_clip_obj(type, 0, 240); \
break; \
} \
/* Window 0 and OBJ window */ \
case 0x05: \
{ \
- u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(0); \
render_window_multi(type, 0, obj); \
/* Window 1 and OBJ window */ \
case 0x06: \
{ \
- u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(1); \
render_window_multi(type, 1, obj); \
/* Window 0, 1, and OBJ window */ \
case 0x07: \
{ \
- u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(0); \
window_coords(1); \
render_scanline_window_builder(tile);
render_scanline_window_builder(bitmap);
-u32 active_layers[6] = { 0x1F, 0x17, 0x1C, 0x14, 0x14, 0x14 };
+static const u32 active_layers[6] = { 0x1F, 0x17, 0x1C, 0x14, 0x14, 0x14 };
u32 small_resolution_width = 240;
u32 small_resolution_height = 160;
{
u32 pitch = get_screen_pitch();
u32 dispcnt = io_registers[REG_DISPCNT];
- u32 display_flags = (dispcnt >> 8) & 0x1F;
u32 vcount = io_registers[REG_VCOUNT];
u16 *screen_offset = get_screen_pixels() + (vcount * pitch);
u32 video_mode = dispcnt & 0x07;
- u32 current_layer;
// If OAM has been modified since the last scanline has been updated then
// reorder and reprofile the OBJ lists.
{
switch(screen_scale)
{
+ case unscaled:
+ break;
case scaled_aspect:
upscale_aspect(gpsp_gp2x_screen, screen_pixels);
break;
if(screen_scale != scale)
{
screen_scale = scale;
- switch(scale)
- {
- case unscaled:
- case scaled_aspect:
- case fullscreen:
- small_resolution_width = 240 * video_scale;
- small_resolution_height = 160 * video_scale;
- break;
- }
+ small_resolution_width = 240 * video_scale;
+ small_resolution_height = 160 * video_scale;
}
}
# Platform specific definitions
VPATH += ..
-CFLAGS += -DPC_BUILD -m32
+CFLAGS += -DPC_BUILD -Wall -m32
INCLUDES = -I${PREFIX}/include `sdl-config --cflags`
LIBS = -L${PREFIX}/lib `sdl-config --libs` -mconsole -lz -m32
.SUFFIXES: .c .S
+all: ${BIN}
+
%.o: %.c
${CC} ${CFLAGS} ${INCLUDES} -c -o $@ $<
%.o: %.S
${CC} ${CFLAGS} -c -o $@ $<
-all: ${OBJS}
+cpu.o cpu_threaded.o: CFLAGS += -Wno-unused-variable -Wno-unused-label
+
+${BIN}: ${OBJS}
${CC} ${OBJS} ${LIBS} -o ${BIN}
- ${STRIP} ${BIN}
+# ${STRIP} ${BIN}
clean:
rm -f *.o ${BIN}
#define collapse_flags() \
reg[REG_CPSR] = (reg[REG_N_FLAG] << 31) | (reg[REG_Z_FLAG] << 30) | \
(reg[REG_C_FLAG] << 29) | (reg[REG_V_FLAG] << 28) | \
- reg[REG_CPSR] & 0xFF \
+ (reg[REG_CPSR] & 0xFF) \
// It should be okay to still generate result flags, spsr will overwrite them.
// This is pretty infrequent (returning from interrupt handlers, et al) so
generate_store_reg_pc_no_flags(a0, rd); \
} \
-u32 function_cc execute_mul_flags(u32 dest)
+static void function_cc execute_mul_flags(u32 dest)
{
calculate_z_flag(dest);
calculate_n_flag(dest);
arm_multiply_flags_##flags(); \
} \
-u32 function_cc execute_mul_long_flags(u32 dest_lo, u32 dest_hi)
+static void function_cc execute_mul_long_flags(u32 dest_lo, u32 dest_hi)
{
reg[REG_Z_FLAG] = (dest_lo == 0) & (dest_hi == 0);
calculate_n_flag(dest_hi);
#define thumb_conditional_branch(condition) \
{ \
- condition_check_type condition_check; \
+ condition_check_type condition_check = CONDITION_TRUE; \
generate_cycle_update(); \
generate_condition_##condition(a0, a1); \
generate_conditional_branch_type(a0, a1); \
data_proc_generate_sub_test_function(cmp, rn, rm);
data_proc_generate_add_test_function(cmn, rn, rm);
-u32 function_cc execute_swi(u32 pc)
+static void function_cc execute_swi(u32 pc)
{
reg_mode[MODE_SUPERVISOR][6] = pc;
collapse_flags();
#define arm_conditional_block_header() \
{ \
- condition_check_type condition_check; \
+ condition_check_type condition_check = CONDITION_TRUE; \
generate_condition(a0, a1); \
generate_conditional_branch_type(a0, a1); \
}
u32 load_file_zip(char *filename)
{
struct SZIPFileHeader data;
- u8 tmp[1024];
+ char tmp[1024];
s32 retval = -1;
u8 *buffer = NULL;
u8 *cbuffer;
- u8 *ext;
+ char *ext;
file_open(fd, filename, read);