From b69fee8b3139eb26405c20aa3adde166f9034b59 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Tue, 9 Dec 2014 05:16:09 +0100 Subject: 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 --- Makefile | 12 ++++++++---- cpu.c | 2 +- gui.c | 6 +++--- libretro.c | 14 +++++++++++--- main.c | 2 +- memory.c | 6 +++--- memory.h | 4 ++-- sound.c | 2 ++ 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 4228d97..0297ace 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -TARGET := gpsp_libretro.so +TARGET := gpsp_libretro CC = gcc AR = psp-ar STATIC_LINKING = 0 -CFLAGS += -fPIC -Werror-implicit-function-declaration +CFLAGS += -Werror-implicit-function-declaration CFLAGS += -DPC_BUILD -Wall -m32 CFLAGS += -D__LIBRETRO__ @@ -33,14 +33,18 @@ OBJS += zip.o OBJS += libretro.o OBJS += libco/libco.o - +ifeq ($(STATIC_LINKING), 1) +TARGET := $(TARGET).a +else +TARGET := $(TARGET).so +CFLAGS += -fPIC +endif ASFLAGS = $(CFLAGS) INCDIRS := -I. LDFLAGS += -shared -m32 -Wl,--no-undefined -Wl,--version-script=link.T LDLIBS += -lz - all: $(TARGET) $(TARGET): $(OBJS) diff --git a/cpu.c b/cpu.c index 4397568..942bb2f 100644 --- a/cpu.c +++ b/cpu.c @@ -4274,7 +4274,7 @@ void function_cc step_debug(u32 pc, u32 cycles) u16 *current_screen = copy_screen(); get_savestate_filename_noshot(savestate_slot, current_savestate_filename); - save_state(current_savestate_filename, current_screen); + gba_save_state(current_savestate_filename, current_screen); free(current_screen); break; } diff --git a/gui.c b/gui.c index d97b0a2..62a48c3 100644 --- a/gui.c +++ b/gui.c @@ -1150,7 +1150,7 @@ u32 menu(u16 *original_screen) { get_savestate_filename_noshot(savestate_slot, current_savestate_filename); - save_state(current_savestate_filename, original_screen); + gba_save_state(current_savestate_filename, original_screen); } menu_change_state(); } @@ -1159,7 +1159,7 @@ u32 menu(u16 *original_screen) { if(!first_load) { - load_state(current_savestate_filename); + gba_load_state(current_savestate_filename); return_value = 1; repeat = 0; } @@ -1171,7 +1171,7 @@ u32 menu(u16 *original_screen) char load_filename[512]; if(load_file(file_ext, load_filename) != -1) { - load_state(load_filename); + gba_load_state(load_filename); return_value = 1; repeat = 0; } diff --git a/libretro.c b/libretro.c index abe130d..875e935 100644 --- a/libretro.c +++ b/libretro.c @@ -227,17 +227,25 @@ bool retro_load_game(const struct retro_game_info *info) // 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"); 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; - if (load_gamepak(info->path) < 0) + if (load_gamepak(info->path) != 0) { error_msg("Could not load the game file.\n"); return false; diff --git a/main.c b/main.c index 0e05f04..f019d21 100644 --- a/main.c +++ b/main.c @@ -439,7 +439,7 @@ void trigger_ext_event() get_savestate_filename_noshot(savestate_slot, current_savestate_filename); - load_state(current_savestate_filename); + gba_load_state(current_savestate_filename); switch(event_number) { diff --git a/memory.c b/memory.c index 033312c..d1966d3 100644 --- a/memory.c +++ b/memory.c @@ -3160,7 +3160,7 @@ void bios_region_read_protect() sound_##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); if(file_check_valid(savestate_file)) @@ -3196,7 +3196,7 @@ void load_state(char *savestate_filename) { reset_gba(); // Okay, so this takes a while, but for now it works. - load_state(savestate_filename); + gba_load_state(savestate_filename); } else { @@ -3229,7 +3229,7 @@ void load_state(char *savestate_filename) u8 savestate_write_buffer[506947]; 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; file_open(savestate_file, savestate_filename, write); diff --git a/memory.h b/memory.h index 5ac599a..4812188 100644 --- a/memory.h +++ b/memory.h @@ -188,8 +188,8 @@ void bios_region_read_protect(); u8 *load_gamepak_page(u32 physical_index); void memory_write_mem_savestate(file_tag_type savestate_file); void memory_read_savestate(file_tag_type savestate_file); -void load_state(char *savestate_filename); -void save_state(char *savestate_filename, u16 *screen_capture); +void gba_load_state(char *savestate_filename); +void gba_save_state(char *savestate_filename, u16 *screen_capture); extern u8 *gamepak_rom; extern u32 gamepak_ram_buffer_size; diff --git a/sound.c b/sound.c index 4794ce2..1683f9f 100644 --- a/sound.c +++ b/sound.c @@ -852,6 +852,8 @@ void render_audio(void) u32 i; s32 current_sample; + return; + while (((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) > 512) { sound_copy(sound_buffer_base, 512, normal); audio_batch_cb(stream_base, 256); -- cgit v1.2.3