fix undefined referances.

This commit is contained in:
aliaspider 2014-12-09 01:59:02 +01:00
parent 38158f67e2
commit 50df6df600
9 changed files with 72 additions and 2 deletions

View File

@ -31,6 +31,7 @@ OBJS += cheats.o
OBJS += zip.o
OBJS += libretro.o
OBJS += libco/libco.o

View File

@ -110,6 +110,8 @@
#define GBA_SCREEN_HEIGHT (160)
#define GBA_SCREEN_PITCH (240)
void switch_to_main_thread(void);
#else
#include "SDL.h"
#endif

24
input.c
View File

@ -345,7 +345,29 @@ void init_input()
#elif defined(__LIBRETRO__)
/* todo */
static retro_input_state_t input_state_cb;
void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
u32 update_input(void)
{
// return;
unsigned i;
uint32_t new_key = 0;
if (!input_state_cb)
return 0;
for (i = 0; i < sizeof(btn_map) / sizeof(map); i++)
new_key |= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, btn_map[i].retropad) ? btn_map[i].gba : 0;
if ((new_key | key) != key)
trigger_key(new_key);
key = new_key;
io_registers[REG_P1] = (~key) & 0x3FF;
return 0;
}
#elif defined(PC_BUILD)

22
input.h
View File

@ -82,6 +82,28 @@ 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);
#ifdef __LIBRETRO__
#include "libretro.h"
typedef struct
{
unsigned retropad ;
input_buttons_type gba;
} map;
static const map btn_map[] = {
{ RETRO_DEVICE_ID_JOYPAD_L, BUTTON_L },
{ RETRO_DEVICE_ID_JOYPAD_R, BUTTON_R },
{ RETRO_DEVICE_ID_JOYPAD_DOWN, BUTTON_DOWN },
{ RETRO_DEVICE_ID_JOYPAD_UP, BUTTON_UP },
{ RETRO_DEVICE_ID_JOYPAD_LEFT, BUTTON_LEFT },
{ RETRO_DEVICE_ID_JOYPAD_RIGHT, BUTTON_RIGHT },
{ RETRO_DEVICE_ID_JOYPAD_START, BUTTON_START },
{ RETRO_DEVICE_ID_JOYPAD_SELECT, BUTTON_SELECT },
{ RETRO_DEVICE_ID_JOYPAD_B, BUTTON_B },
{ RETRO_DEVICE_ID_JOYPAD_A, BUTTON_A }
};
#endif
extern u32 gamepad_config_map[];
extern u32 global_enable_analog;
extern u32 analog_sensitivity_level;

View File

@ -21,6 +21,15 @@ struct retro_perf_callback perf_cb;
static cothread_t main_thread;
static cothread_t cpu_thread;
/* to be removed */
u32 savestate_slot = 0;
void get_savestate_filename_noshot(u32 slot, char *name_buffer)
{
(void) slot;
sprintf(name_buffer, "dummy.svs");
}
/* ------------ */
void switch_to_main_thread(void)
{
co_switch(main_thread);

10
main.c
View File

@ -214,6 +214,7 @@ void init_main()
flush_translation_cache_bios();
}
#ifndef __LIBRETRO__
int main(int argc, char *argv[])
{
char bios_filename[512];
@ -384,6 +385,7 @@ int main(int argc, char *argv[])
#endif
return 0;
}
#endif
void print_memory_stats(u32 *counter, u32 *region_stats, char *stats_str)
{
@ -625,6 +627,12 @@ u32 update_gba()
flush_ram_count = 0;
#endif
#ifdef __LIBRETRO__
switch_to_main_thread();
update_gbc_sound(cpu_ticks);
gbc_sound_update = 0;
#else
if(update_input())
continue;
@ -645,7 +653,7 @@ u32 update_gba()
if(update_backup_flag)
update_backup();
#endif
process_cheats();
event_cycles++;

View File

@ -2197,7 +2197,9 @@ u32 load_gamepak(const char *name)
gamepak_maker[2] = 0;
load_game_config(gamepak_title, gamepak_code, gamepak_maker);
#ifndef __LIBRETRO__
load_game_config_file();
#endif
change_ext(gamepak_filename, cheats_filename, ".cht");
add_cheats(cheats_filename);

View File

@ -3387,6 +3387,7 @@ void flip_screen()
#endif
#ifndef __LIBRETRO__
u32 frame_to_render;
void update_screen()
@ -3394,6 +3395,7 @@ void update_screen()
if(!skip_next_frame)
flip_screen();
}
#endif
#ifdef PSP_BUILD

View File

@ -21,7 +21,9 @@
#define VIDEO_H
void update_scanline();
#ifndef __LIBRETRO__
void update_screen();
#endif
void init_video();
void video_resolution_large();
void video_resolution_small();