summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2014-12-09 00:17:28 +0100
committeraliaspider2014-12-09 00:17:28 +0100
commit8f9b841f721bbfbc74590267e57e0bb4744ae63f (patch)
tree568cffe5287aeb3bb907de99681e7d881d5f0277
parent365077772d3d8d5d479febd0388d7e74ef08d508 (diff)
downloadpicogpsp-8f9b841f721bbfbc74590267e57e0bb4744ae63f.tar.gz
picogpsp-8f9b841f721bbfbc74590267e57e0bb4744ae63f.tar.bz2
picogpsp-8f9b841f721bbfbc74590267e57e0bb4744ae63f.zip
can compile
-rw-r--r--Makefile4
-rw-r--r--common.h10
-rw-r--r--cpu.c4
-rw-r--r--input.c5
-rw-r--r--libretro.c62
-rw-r--r--main.c13
-rw-r--r--main.h6
-rw-r--r--memory.c24
-rw-r--r--memory.h3
-rw-r--r--sound.c51
-rw-r--r--sound.h111
-rw-r--r--video.c14
-rw-r--r--video.h4
-rw-r--r--zip.c2
-rw-r--r--zip.h2
15 files changed, 228 insertions, 87 deletions
diff --git a/Makefile b/Makefile
index 3be6a1e..a9aab37 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ CC = gcc
AR = psp-ar
STATIC_LINKING = 0
-CFLAGS += -fPIC
+CFLAGS += -fPIC -Werror-implicit-function-declaration
CFLAGS += -DPC_BUILD -Wall -m32
CFLAGS += -D__LIBRETRO__
@@ -26,7 +26,7 @@ OBJS += input.o
OBJS += sound.o
OBJS += cpu_threaded.o
-OBJS += x86_stub.o
+OBJS += x86/x86_stub.o
OBJS += cheats.o
OBJS += zip.o
diff --git a/common.h b/common.h
index 5e4be0d..24f99bd 100644
--- a/common.h
+++ b/common.h
@@ -104,7 +104,15 @@
#include <time.h>
#include <stdio.h>
#else
+#ifdef __LIBRETRO__
+
+#define GBA_SCREEN_WIDTH (240)
+#define GBA_SCREEN_HEIGHT (160)
+#define GBA_SCREEN_PITCH (240)
+
+#else
#include "SDL.h"
+#endif
#ifdef ARM_ARCH
#define function_cc
@@ -210,7 +218,9 @@ typedef u32 fixed8_24;
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#ifndef __LIBRETRO__
#include "SDL.h"
+#endif
#include "cpu.h"
#include "memory.h"
#include "video.h"
diff --git a/cpu.c b/cpu.c
index d8ea5db..4397568 100644
--- a/cpu.c
+++ b/cpu.c
@@ -4146,8 +4146,10 @@ void function_cc step_debug(u32 pc, u32 cycles)
{
u32 key = 0;
+#ifndef __LIBRETRO__
SDL_LockMutex(sound_mutex);
SDL_PauseAudio(1);
+#endif
if(output_field >= num_output_fields)
{
@@ -4281,8 +4283,10 @@ void function_cc step_debug(u32 pc, u32 cycles)
quit();
}
+#ifndef __LIBRETRO__
SDL_PauseAudio(0);
SDL_UnlockMutex(sound_mutex);
+#endif
}
last_instruction = reg[REG_PC];
diff --git a/input.c b/input.c
index 06a8f8a..a2f147f 100644
--- a/input.c
+++ b/input.c
@@ -343,10 +343,11 @@ void init_input()
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
}
-#endif
+#elif defined(__LIBRETRO__)
+/* todo */
-#if defined(PC_BUILD)
+#elif defined(PC_BUILD)
u32 key_map(SDLKey key_sym)
{
diff --git a/libretro.c b/libretro.c
index 56a4ccf..ae427e6 100644
--- a/libretro.c
+++ b/libretro.c
@@ -5,6 +5,11 @@
#include <stdint.h>
#include "common.h"
#include "libco.h"
+#include "libretro.h"
+
+#ifndef MAX_PATH
+#define MAX_PATH (512)
+#endif
static retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
@@ -28,7 +33,7 @@ static inline void switch_to_cpu_thread(void)
static void cpu_thread_entry(void)
{
- execute_arm_translate(reg[EXECUTE_CYCLES]);
+ execute_arm_translate(execute_cycles);
}
static inline void init_context_switch(void)
@@ -42,6 +47,26 @@ static inline void deinit_context_switch(void)
co_delete(cpu_thread);
}
+#ifdef PERF_TEST
+
+extern struct retro_perf_callback perf_cb;
+
+#define RETRO_PERFORMANCE_INIT(X) \
+ static struct retro_perf_counter X = {#X}; \
+ do { \
+ if (!(X).registered) \
+ perf_cb.perf_register(&(X)); \
+ } while(0)
+
+#define RETRO_PERFORMANCE_START(X) perf_cb.perf_start(&(X))
+#define RETRO_PERFORMANCE_STOP(X) perf_cb.perf_stop(&(X))
+#else
+#define RETRO_PERFORMANCE_INIT(X)
+#define RETRO_PERFORMANCE_START(X)
+#define RETRO_PERFORMANCE_STOP(X)
+
+#endif
+
void retro_get_system_info(struct retro_system_info *info)
{
info->library_name = "TempGBA";
@@ -59,8 +84,8 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.max_width = GBA_SCREEN_WIDTH;
info->geometry.max_height = GBA_SCREEN_HEIGHT;
info->geometry.aspect_ratio = 0;
- info->timing.fps = ((float) CPU_FREQUENCY) / (308 * 228 * 4); // 59.72750057 hz
- info->timing.sample_rate = SOUND_FREQUENCY;
+ info->timing.fps = ((float) (16* 1024 * 1024)) / (308 * 228 * 4); // 59.72750057 hz
+ info->timing.sample_rate = 44100;
// info->timing.sample_rate = 32 * 1024;
}
@@ -68,13 +93,13 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
void retro_init()
{
init_gamepak_buffer();
- init_sound();
+ init_sound(1);
}
void retro_deinit()
{
perf_cb.perf_log();
- quit_gba();
+ memory_term();
}
void retro_set_environment(retro_environment_t cb)
@@ -110,27 +135,28 @@ void retro_reset()
size_t retro_serialize_size()
{
- return SAVESTATE_SIZE;
+// return SAVESTATE_SIZE;
+ return 0;
}
bool retro_serialize(void *data, size_t size)
{
- if (size < SAVESTATE_SIZE)
+// if (size < SAVESTATE_SIZE)
return false;
- gba_save_state(data);
+// gba_save_state(data);
- return true;
+// return true;
}
bool retro_unserialize(const void *data, size_t size)
{
- if (size < SAVESTATE_SIZE)
+// if (size < SAVESTATE_SIZE)
return false;
- gba_load_state(data);
+// gba_load_state(data);
- return true;
+// return true;
}
void retro_cheat_reset() {}
@@ -184,12 +210,12 @@ bool retro_load_game(const struct retro_game_info *info)
strncat(filename_bios, "/gba_bios.bin",sizeof(filename_bios));
- if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir)
- strncpy(dir_save, dir, sizeof(dir_save));
- else
- strncpy(dir_save, main_path, sizeof(dir_save));
+// if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir)
+// strncpy(dir_save, dir, sizeof(dir_save));
+// else
+// strncpy(dir_save, main_path, sizeof(dir_save));
- strncat(dir_save, "/",sizeof(dir_save));
+// strncat(dir_save, "/",sizeof(dir_save));
strncat(main_path, "/",sizeof(main_path));
@@ -281,7 +307,7 @@ void retro_run()
render_audio();
- video_cb(GBA_FRAME_TEXTURE, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, 512);
+ video_cb(gba_screen_pixels, GBA_SCREEN_WIDTH, GBA_SCREEN_HEIGHT, GBA_SCREEN_PITCH * 2);
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
check_variables();
diff --git a/main.c b/main.c
index b09f472..b6729ed 100644
--- a/main.c
+++ b/main.c
@@ -18,6 +18,7 @@
*/
#include "common.h"
+#include <ctype.h>
#ifdef PSP_BUILD
@@ -773,6 +774,8 @@ void synchronize()
*/
}
+#elif defined(__LIBRETRO__)
+
#else
u32 real_frame_count = 0;
@@ -870,6 +873,8 @@ void quit()
sound_exit();
+#ifndef __LIBRETRO__
+
#ifdef REGISTER_USAGE_ANALYZE
print_register_usage();
#endif
@@ -885,6 +890,8 @@ void quit()
exit(0);
#endif
+
+#endif
}
void reset_gba()
@@ -919,7 +926,7 @@ void get_ticks_us(u64 *tick_return)
#else
-u32 file_length(char *dummy, FILE *fp)
+u32 file_length(const char *dummy, FILE *fp)
{
u32 length;
@@ -930,7 +937,9 @@ u32 file_length(char *dummy, FILE *fp)
return length;
}
-#ifdef PC_BUILD
+#ifdef __LIBRETRO__
+
+#elif defined(PC_BUILD)
void delay_us(u32 us_count)
{
diff --git a/main.h b/main.h
index 96739dc..ab57067 100644
--- a/main.h
+++ b/main.h
@@ -90,7 +90,11 @@ extern u32 clock_speed;
u32 update_gba();
void reset_gba();
+#ifdef __LIBRETRO__
+#define synchronize()
+#else
void synchronize();
+#endif
void quit();
void delay_us(u32 us_count);
void get_ticks_us(u64 *tick_return);
@@ -105,7 +109,7 @@ u32 file_length(char *filename, s32 dummy);
#else
-u32 file_length(char *dummy, FILE *fp);
+u32 file_length(const char *dummy, FILE *fp);
#endif
diff --git a/memory.c b/memory.c
index 5e5752a..56e0fbc 100644
--- a/memory.c
+++ b/memory.c
@@ -2115,7 +2115,7 @@ s32 load_game_config(char *gamepak_title, char *gamepak_code, char *gamepak_make
return -1;
}
-s32 load_gamepak_raw(char *name)
+s32 load_gamepak_raw(const char *name)
{
file_open(gamepak_file, name, read);
@@ -2160,7 +2160,7 @@ char gamepak_code[5];
char gamepak_maker[3];
char gamepak_filename[512];
-u32 load_gamepak(char *name)
+u32 load_gamepak(const char *name)
{
char *dot_position = strrchr(name, '.');
s32 file_size;
@@ -3119,6 +3119,26 @@ void init_memory()
bios_read_protect = 0xe129f000;
}
+void memory_term(void)
+{
+ if (file_check_valid(gamepak_file_large))
+ {
+ file_close(gamepak_file_large);
+ }
+
+ if (gamepak_memory_map != NULL)
+ {
+ free(gamepak_memory_map);
+ gamepak_memory_map = NULL;
+ }
+
+ if (gamepak_rom != NULL)
+ {
+ free(gamepak_rom);
+ gamepak_rom = NULL;
+ }
+}
+
void bios_region_read_allow()
{
memory_map_read[0] = bios_rom;
diff --git a/memory.h b/memory.h
index 5e65821..5ac599a 100644
--- a/memory.h
+++ b/memory.h
@@ -175,13 +175,14 @@ extern char gamepak_filename[512];
cpu_alert_type dma_transfer(dma_transfer_type *dma);
u8 *memory_region(u32 address, u32 *memory_limit);
-u32 load_gamepak(char *name);
+u32 load_gamepak(const char *name);
u32 load_backup(char *name);
s32 load_bios(char *name);
void update_backup();
void update_backup_force();
void init_memory();
void init_gamepak_buffer();
+void memory_term(void);
void bios_region_read_allow();
void bios_region_read_protect();
u8 *load_gamepak_page(u32 physical_index);
diff --git a/sound.c b/sound.c
index 5593bbe..4794ce2 100644
--- a/sound.c
+++ b/sound.c
@@ -19,7 +19,9 @@
#include "common.h"
+#ifndef __LIBRETRO__
#include <SDL.h>
+#endif
u32 global_enable_audio = 1;
direct_sound_struct direct_sound_channel[2];
@@ -27,8 +29,10 @@ gbc_sound_struct gbc_sound_channel[4];
u32 sound_frequency = 44100;
+#ifndef __LIBRETRO__
SDL_mutex *sound_mutex;
static SDL_cond *sound_cv;
+#endif
#ifdef PSP_BUILD
u32 audio_buffer_size_number = 1;
@@ -44,7 +48,9 @@ static u32 sound_buffer_base;
static u32 sound_last_cpu_ticks;
static fixed16_16 gbc_sound_tick_step;
+#ifndef __LIBRETRO__
static u32 sound_exit_flag;
+#endif
// Queue 1, 2, or 4 samples to the top of the DS FIFO, wrap around circularly
@@ -447,6 +453,7 @@ void update_gbc_sound(u32 cpu_ticks)
gbc_sound_partial_ticks &= 0xFFFF;
}
+#ifndef __LIBRETRO__
SDL_LockMutex(sound_mutex);
if(synchronize_flag)
{
@@ -487,6 +494,7 @@ void update_gbc_sound(u32 cpu_ticks)
}
}
+#endif
if(sound_on == 1)
{
gs = gbc_sound_channel + 0;
@@ -562,9 +570,11 @@ void update_gbc_sound(u32 cpu_ticks)
gbc_sound_buffer_index =
(gbc_sound_buffer_index + (buffer_ticks * 2)) % BUFFER_SIZE;
+#ifndef __LIBRETRO__
SDL_UnlockMutex(sound_mutex);
SDL_CondSignal(sound_cv);
+#endif
}
#define sound_copy_normal() \
@@ -595,7 +605,7 @@ void update_gbc_sound(u32 cpu_ticks)
} \
-void sound_callback(void *userdata, Uint8 *stream, int length)
+void sound_callback(void *userdata, u8 *stream, int length)
{
u32 sample_length = length / 2;
u32 _length;
@@ -604,6 +614,7 @@ void sound_callback(void *userdata, Uint8 *stream, int length)
s16 *source;
s32 current_sample;
+#ifndef __LIBRETRO__
SDL_LockMutex(sound_mutex);
while(((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) <
@@ -611,6 +622,7 @@ void sound_callback(void *userdata, Uint8 *stream, int length)
{
SDL_CondWait(sound_cv, sound_mutex);
}
+#endif
if(global_enable_audio)
{
@@ -645,9 +657,11 @@ void sound_callback(void *userdata, Uint8 *stream, int length)
}
}
+#ifndef __LIBRETRO__
SDL_CondSignal(sound_cv);
SDL_UnlockMutex(sound_mutex);
+#endif
}
// Special thanks to blarrg for the LSFR frequency used in Meridian, as posted
@@ -689,7 +703,9 @@ void reset_sound()
gbc_sound_struct *gs = gbc_sound_channel;
u32 i;
+#ifndef __LIBRETRO__
SDL_LockMutex(sound_mutex);
+#endif
sound_on = 0;
sound_buffer_base = 0;
@@ -723,13 +739,16 @@ void reset_sound()
gs->active_flag = 0;
}
+#ifndef __LIBRETRO__
SDL_UnlockMutex(sound_mutex);
+#endif
}
void sound_exit()
{
gbc_sound_buffer_index =
(sound_buffer_base + audio_buffer_size) % BUFFER_SIZE;
+#ifndef __LIBRETRO__
SDL_PauseAudio(1);
sound_exit_flag = 1;
SDL_CondSignal(sound_cv);
@@ -739,10 +758,12 @@ void sound_exit()
sound_mutex = NULL;
SDL_DestroyCond(sound_cv);
sound_cv = NULL;
+#endif
}
void init_sound(int need_reset)
{
+#ifndef __LIBRETRO__
SDL_AudioSpec sound_settings;
sound_exit_flag = 0;
@@ -779,6 +800,8 @@ void init_sound(int need_reset)
printf("audio: freq %d, size %d\n", sound_frequency, audio_buffer_size);
#endif
+#endif
+
gbc_sound_tick_step =
float_to_fp16_16(256.0f / sound_frequency);
@@ -788,7 +811,9 @@ void init_sound(int need_reset)
if (need_reset)
reset_sound();
+#ifndef __LIBRETRO__
SDL_PauseAudio(0);
+#endif
}
#define sound_savestate_builder(type) \
@@ -811,3 +836,27 @@ void sound_##type##_savestate(file_tag_type savestate_file) \
sound_savestate_builder(read);
sound_savestate_builder(write_mem);
+
+#ifdef __LIBRETRO__
+#include "libretro.h"
+
+static retro_audio_sample_batch_t audio_batch_cb;
+void retro_set_audio_sample(retro_audio_sample_t cb) { }
+void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; }
+
+void render_audio(void)
+{
+ static s16 stream_base[1024];
+ u32 _length;
+ s16 *source;
+ u32 i;
+ s32 current_sample;
+
+ while (((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) > 512) {
+ sound_copy(sound_buffer_base, 512, normal);
+ audio_batch_cb(stream_base, 256);
+ sound_buffer_base += 512;
+ }
+}
+#endif
+
diff --git a/sound.h b/sound.h
index 5b76e53..72c84ba 100644
--- a/sound.h
+++ b/sound.h
@@ -25,79 +25,79 @@
#define GBA_XTAL 16777216.0f
#define GBA_60HZ_RATE 16853760.0f /* 228*(272+960)*60 */
-#if !defined(PSP_BUILD)
- // run GBA at 60Hz (~0.5% faster) to better match host display
- #define GBC_BASE_RATE GBA_60HZ_RATE
+#if !defined(PSP_BUILD) && !defined(__LIBRETRO__)
+// run GBA at 60Hz (~0.5% faster) to better match host display
+#define GBC_BASE_RATE GBA_60HZ_RATE
#else
- #define GBC_BASE_RATE GBA_XTAL
+#define GBC_BASE_RATE GBA_XTAL
#endif
typedef enum
{
- DIRECT_SOUND_INACTIVE,
- DIRECT_SOUND_RIGHT,
- DIRECT_SOUND_LEFT,
- DIRECT_SOUND_LEFTRIGHT
+ DIRECT_SOUND_INACTIVE,
+ DIRECT_SOUND_RIGHT,
+ DIRECT_SOUND_LEFT,
+ DIRECT_SOUND_LEFTRIGHT
} direct_sound_status_type;
typedef enum
{
- DIRECT_SOUND_VOLUME_50,
- DIRECT_SOUND_VOLUME_100
+ DIRECT_SOUND_VOLUME_50,
+ DIRECT_SOUND_VOLUME_100
} direct_sound_volume_type;
typedef struct
{
- s8 fifo[32];
- u32 fifo_base;
- u32 fifo_top;
- fixed8_24 fifo_fractional;
- // The + 1 is to give some extra room for linear interpolation
- // when wrapping around.
- u32 buffer_index;
- direct_sound_status_type status;
- direct_sound_volume_type volume;
- u32 last_cpu_ticks;
+ s8 fifo[32];
+ u32 fifo_base;
+ u32 fifo_top;
+ fixed8_24 fifo_fractional;
+ // The + 1 is to give some extra room for linear interpolation
+ // when wrapping around.
+ u32 buffer_index;
+ direct_sound_status_type status;
+ direct_sound_volume_type volume;
+ u32 last_cpu_ticks;
} direct_sound_struct;
typedef enum
{
- GBC_SOUND_INACTIVE,
- GBC_SOUND_RIGHT,
- GBC_SOUND_LEFT,
- GBC_SOUND_LEFTRIGHT
+ GBC_SOUND_INACTIVE,
+ GBC_SOUND_RIGHT,
+ GBC_SOUND_LEFT,
+ GBC_SOUND_LEFTRIGHT
} gbc_sound_status_type;
typedef struct
{
- u32 rate;
- fixed16_16 frequency_step;
- fixed16_16 sample_index;
- fixed16_16 tick_counter;
- u32 total_volume;
- u32 envelope_initial_volume;
- u32 envelope_volume;
- u32 envelope_direction;
- u32 envelope_status;
- u32 envelope_step;
- u32 envelope_ticks;
- u32 envelope_initial_ticks;
- u32 sweep_status;
- u32 sweep_direction;
- u32 sweep_ticks;
- u32 sweep_initial_ticks;
- u32 sweep_shift;
- u32 length_status;
- u32 length_ticks;
- u32 noise_type;
- u32 wave_type;
- u32 wave_bank;
- u32 wave_volume;
- gbc_sound_status_type status;
- u32 active_flag;
- u32 master_enable;
- s8 *sample_data;
+ u32 rate;
+ fixed16_16 frequency_step;
+ fixed16_16 sample_index;
+ fixed16_16 tick_counter;
+ u32 total_volume;
+ u32 envelope_initial_volume;
+ u32 envelope_volume;
+ u32 envelope_direction;
+ u32 envelope_status;
+ u32 envelope_step;
+ u32 envelope_ticks;
+ u32 envelope_initial_ticks;
+ u32 sweep_status;
+ u32 sweep_direction;
+ u32 sweep_ticks;
+ u32 sweep_initial_ticks;
+ u32 sweep_shift;
+ u32 length_status;
+ u32 length_ticks;
+ u32 noise_type;
+ u32 wave_type;
+ u32 wave_bank;
+ u32 wave_volume;
+ gbc_sound_status_type status;
+ u32 active_flag;
+ u32 master_enable;
+ s8* sample_data;
} gbc_sound_struct;
extern direct_sound_struct direct_sound_channel[2];
@@ -116,7 +116,9 @@ extern u32 global_enable_audio;
extern u32 enable_low_pass_filter;
extern u32 audio_buffer_size_number;
-extern SDL_mutex *sound_mutex;
+#ifndef __LIBRETRO__
+extern SDL_mutex* sound_mutex;
+#endif
void sound_timer_queue8(u32 channel, u8 value);
void sound_timer_queue16(u32 channel, u16 value);
@@ -128,6 +130,11 @@ void init_sound(int need_reset);
void sound_write_mem_savestate(file_tag_type savestate_file);
void sound_read_savestate(file_tag_type savestate_file);
+#ifdef __LIBRETRO__
+void render_audio(void);
+#endif
+
+
#ifdef IN_MEMORY_C
#define gbc_sound_tone_control_low(channel, address) \
diff --git a/video.c b/video.c
index c89ebbe..3df1532 100644
--- a/video.c
+++ b/video.c
@@ -86,8 +86,13 @@ static void Ge_Finish_Callback(int id, void *arg)
#define get_screen_pitch() \
screen_pitch \
-#else
+#elif defined(__LIBRETRO__)
+u16 gba_screen_pixels[GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT];
+
+#define get_screen_pixels() gba_screen_pixels
+#define get_screen_pitch() GBA_SCREEN_PITCH
+#else
SDL_Surface *screen;
const u32 video_scale = 1;
@@ -96,6 +101,7 @@ const u32 video_scale = 1;
#define get_screen_pitch() \
(screen->pitch / 2) \
+#endif
#endif
@@ -3303,7 +3309,7 @@ void flip_screen()
}
}
-#else
+#elif !defined(__LIBRETRO__)
#define integer_scale_copy_2() \
current_scanline_ptr[x2] = current_pixel; \
@@ -3476,7 +3482,7 @@ void init_video()
GE_CMD(NOP, 0);
}
-#else
+#elif !defined(__LIBRETRO__)
void init_video()
{
@@ -3593,7 +3599,7 @@ void clear_screen(u16 color)
sceGuSync(0, 0); */
}
-#else
+#elif !defined(__LIBRETRO__)
void video_resolution_large()
{
diff --git a/video.h b/video.h
index 9831e8c..c54682f 100644
--- a/video.h
+++ b/video.h
@@ -103,4 +103,8 @@ extern video_filter_type2 screen_filter2;
void set_gba_resolution(video_scale_type scale);
+#ifdef __LIBRETRO__
+extern u16 gba_screen_pixels[GBA_SCREEN_PITCH * GBA_SCREEN_HEIGHT];
+#endif
+
#endif
diff --git a/zip.c b/zip.c
index 6e52d49..2025b35 100644
--- a/zip.c
+++ b/zip.c
@@ -43,7 +43,7 @@ struct SZIPFileHeader
s16 ExtraFieldLength;
} __attribute__((packed));
-u32 load_file_zip(char *filename)
+u32 load_file_zip(const char *filename)
{
struct SZIPFileHeader data;
char tmp[1024];
diff --git a/zip.h b/zip.h
index c562ece..12a51ee 100644
--- a/zip.h
+++ b/zip.h
@@ -20,7 +20,7 @@
#ifndef ZIP_H
#define ZIP_H
-u32 load_file_zip(char *filename);
+u32 load_file_zip(const char *filename);
#endif