video output now works in statically linked builds.
core can't be used as a shared library yet due to the dynarec not working when compiled with -fPIC
This commit is contained in:
		
							parent
							
								
									3cc3944725
								
							
						
					
					
						commit
						b69fee8b31
					
				
					 8 changed files with 31 additions and 17 deletions
				
			
		
							
								
								
									
										12
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
TARGET      := gpsp_libretro.so
 | 
					TARGET   := gpsp_libretro
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CC  = gcc
 | 
					CC  = gcc
 | 
				
			||||||
AR  = psp-ar
 | 
					AR  = psp-ar
 | 
				
			||||||
STATIC_LINKING = 0
 | 
					STATIC_LINKING = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS   += -fPIC -Werror-implicit-function-declaration
 | 
					CFLAGS   += -Werror-implicit-function-declaration
 | 
				
			||||||
CFLAGS   += -DPC_BUILD -Wall -m32
 | 
					CFLAGS   += -DPC_BUILD -Wall -m32
 | 
				
			||||||
CFLAGS   += -D__LIBRETRO__
 | 
					CFLAGS   += -D__LIBRETRO__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,14 +33,18 @@ OBJS += zip.o
 | 
				
			||||||
OBJS += libretro.o
 | 
					OBJS += libretro.o
 | 
				
			||||||
OBJS += libco/libco.o
 | 
					OBJS += libco/libco.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ifeq ($(STATIC_LINKING), 1)
 | 
				
			||||||
 | 
					TARGET := $(TARGET).a
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					TARGET := $(TARGET).so
 | 
				
			||||||
 | 
					CFLAGS += -fPIC
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ASFLAGS = $(CFLAGS)
 | 
					ASFLAGS = $(CFLAGS)
 | 
				
			||||||
INCDIRS := -I.
 | 
					INCDIRS := -I.
 | 
				
			||||||
LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T
 | 
					LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T
 | 
				
			||||||
LDLIBS  += -lz
 | 
					LDLIBS  += -lz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
all: $(TARGET)
 | 
					all: $(TARGET)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(TARGET): $(OBJS)
 | 
					$(TARGET): $(OBJS)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								cpu.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								cpu.c
									
										
									
									
									
								
							| 
						 | 
					@ -4274,7 +4274,7 @@ void function_cc step_debug(u32 pc, u32 cycles)
 | 
				
			||||||
        u16 *current_screen = copy_screen();
 | 
					        u16 *current_screen = copy_screen();
 | 
				
			||||||
        get_savestate_filename_noshot(savestate_slot,
 | 
					        get_savestate_filename_noshot(savestate_slot,
 | 
				
			||||||
         current_savestate_filename);
 | 
					         current_savestate_filename);
 | 
				
			||||||
        save_state(current_savestate_filename, current_screen);
 | 
					        gba_save_state(current_savestate_filename, current_screen);
 | 
				
			||||||
        free(current_screen);
 | 
					        free(current_screen);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								gui.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								gui.c
									
										
									
									
									
								
							| 
						 | 
					@ -1150,7 +1150,7 @@ u32 menu(u16 *original_screen)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      get_savestate_filename_noshot(savestate_slot,
 | 
					      get_savestate_filename_noshot(savestate_slot,
 | 
				
			||||||
       current_savestate_filename);
 | 
					       current_savestate_filename);
 | 
				
			||||||
      save_state(current_savestate_filename, original_screen);
 | 
					      gba_save_state(current_savestate_filename, original_screen);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    menu_change_state();
 | 
					    menu_change_state();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -1159,7 +1159,7 @@ u32 menu(u16 *original_screen)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if(!first_load)
 | 
					    if(!first_load)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      load_state(current_savestate_filename);
 | 
					      gba_load_state(current_savestate_filename);
 | 
				
			||||||
      return_value = 1;
 | 
					      return_value = 1;
 | 
				
			||||||
      repeat = 0;
 | 
					      repeat = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -1171,7 +1171,7 @@ u32 menu(u16 *original_screen)
 | 
				
			||||||
    char load_filename[512];
 | 
					    char load_filename[512];
 | 
				
			||||||
    if(load_file(file_ext, load_filename) != -1)
 | 
					    if(load_file(file_ext, load_filename) != -1)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      load_state(load_filename);
 | 
					      gba_load_state(load_filename);
 | 
				
			||||||
      return_value = 1;
 | 
					      return_value = 1;
 | 
				
			||||||
      repeat = 0;
 | 
					      repeat = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								libretro.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								libretro.c
									
										
									
									
									
								
							| 
						 | 
					@ -227,17 +227,25 @@ bool retro_load_game(const struct retro_game_info *info)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//   strncat(dir_save, "/",sizeof(dir_save));
 | 
					//   strncat(dir_save, "/",sizeof(dir_save));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   strncat(main_path, "/",sizeof(main_path));
 | 
					//   strncat(main_path, "/",sizeof(main_path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if (load_bios(filename_bios) < 0)
 | 
					   if (load_bios(filename_bios) != 0)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
     error_msg("Could not load BIOS image file.\n");
 | 
					     error_msg("Could not load BIOS image file.\n");
 | 
				
			||||||
     return false;
 | 
					     return false;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if(bios_rom[0] != 0x18)
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					     info_msg("You have an incorrect BIOS image.\n");
 | 
				
			||||||
 | 
					     info_msg("While many games will work fine, some will not. It\n");
 | 
				
			||||||
 | 
					     info_msg("is strongly recommended that you obtain the\n");
 | 
				
			||||||
 | 
					     info_msg("correct BIOS file.\n");
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   gamepak_filename[0] = 0;
 | 
					   gamepak_filename[0] = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if (load_gamepak(info->path) < 0)
 | 
					   if (load_gamepak(info->path) != 0)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
     error_msg("Could not load the game file.\n");
 | 
					     error_msg("Could not load the game file.\n");
 | 
				
			||||||
     return false;
 | 
					     return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								main.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								main.c
									
										
									
									
									
								
							| 
						 | 
					@ -439,7 +439,7 @@ void trigger_ext_event()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  get_savestate_filename_noshot(savestate_slot,
 | 
					  get_savestate_filename_noshot(savestate_slot,
 | 
				
			||||||
   current_savestate_filename);
 | 
					   current_savestate_filename);
 | 
				
			||||||
  load_state(current_savestate_filename);
 | 
					  gba_load_state(current_savestate_filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  switch(event_number)
 | 
					  switch(event_number)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								memory.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								memory.c
									
										
									
									
									
								
							| 
						 | 
					@ -3160,7 +3160,7 @@ void bios_region_read_protect()
 | 
				
			||||||
  sound_##type##_savestate(savestate_file);                                   \
 | 
					  sound_##type##_savestate(savestate_file);                                   \
 | 
				
			||||||
  video_##type##_savestate(savestate_file)                                    \
 | 
					  video_##type##_savestate(savestate_file)                                    \
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void load_state(char *savestate_filename)
 | 
					void gba_load_state(char *savestate_filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  file_open(savestate_file, savestate_filename, read);
 | 
					  file_open(savestate_file, savestate_filename, read);
 | 
				
			||||||
  if(file_check_valid(savestate_file))
 | 
					  if(file_check_valid(savestate_file))
 | 
				
			||||||
| 
						 | 
					@ -3196,7 +3196,7 @@ void load_state(char *savestate_filename)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          reset_gba();
 | 
					          reset_gba();
 | 
				
			||||||
          // Okay, so this takes a while, but for now it works.
 | 
					          // Okay, so this takes a while, but for now it works.
 | 
				
			||||||
          load_state(savestate_filename);
 | 
					          gba_load_state(savestate_filename);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -3229,7 +3229,7 @@ void load_state(char *savestate_filename)
 | 
				
			||||||
u8 savestate_write_buffer[506947];
 | 
					u8 savestate_write_buffer[506947];
 | 
				
			||||||
u8 *write_mem_ptr;
 | 
					u8 *write_mem_ptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void save_state(char *savestate_filename, u16 *screen_capture)
 | 
					void gba_save_state(char *savestate_filename, u16 *screen_capture)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  write_mem_ptr = savestate_write_buffer;
 | 
					  write_mem_ptr = savestate_write_buffer;
 | 
				
			||||||
  file_open(savestate_file, savestate_filename, write);
 | 
					  file_open(savestate_file, savestate_filename, write);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								memory.h
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								memory.h
									
										
									
									
									
								
							| 
						 | 
					@ -188,8 +188,8 @@ void bios_region_read_protect();
 | 
				
			||||||
u8 *load_gamepak_page(u32 physical_index);
 | 
					u8 *load_gamepak_page(u32 physical_index);
 | 
				
			||||||
void memory_write_mem_savestate(file_tag_type savestate_file);
 | 
					void memory_write_mem_savestate(file_tag_type savestate_file);
 | 
				
			||||||
void memory_read_savestate(file_tag_type savestate_file);
 | 
					void memory_read_savestate(file_tag_type savestate_file);
 | 
				
			||||||
void load_state(char *savestate_filename);
 | 
					void gba_load_state(char *savestate_filename);
 | 
				
			||||||
void save_state(char *savestate_filename, u16 *screen_capture);
 | 
					void gba_save_state(char *savestate_filename, u16 *screen_capture);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern u8 *gamepak_rom;
 | 
					extern u8 *gamepak_rom;
 | 
				
			||||||
extern u32 gamepak_ram_buffer_size;
 | 
					extern u32 gamepak_ram_buffer_size;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								sound.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								sound.c
									
										
									
									
									
								
							| 
						 | 
					@ -852,6 +852,8 @@ void render_audio(void)
 | 
				
			||||||
   u32 i;
 | 
					   u32 i;
 | 
				
			||||||
   s32 current_sample;
 | 
					   s32 current_sample;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   while (((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) > 512)   {
 | 
					   while (((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) > 512)   {
 | 
				
			||||||
      sound_copy(sound_buffer_base, 512, normal);
 | 
					      sound_copy(sound_buffer_base, 512, normal);
 | 
				
			||||||
      audio_batch_cb(stream_base, 256);
 | 
					      audio_batch_cb(stream_base, 256);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue