notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eliminate texrels, part 3
[picodrive.git]
/
platform
/
libretro.c
diff --git
a/platform/libretro.c
b/platform/libretro.c
index
f3252ab
..
23f0694
100644
(file)
--- a/
platform/libretro.c
+++ b/
platform/libretro.c
@@
-39,7
+39,7
@@
static FILE *emu_log;
#define VOUT_MAX_WIDTH 320
#define VOUT_MAX_HEIGHT 240
static void *vout_buf;
#define VOUT_MAX_WIDTH 320
#define VOUT_MAX_HEIGHT 240
static void *vout_buf;
-static int vout_width, vout_height;
+static int vout_width, vout_height
, vout_offset
;
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
@@
-251,6
+251,9
@@
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
memset(vout_buf, 0, 320 * 240 * 2);
vout_width = is_32cols ? 256 : 320;
PicoDrawSetOutBuf(vout_buf, vout_width * 2);
memset(vout_buf, 0, 320 * 240 * 2);
vout_width = is_32cols ? 256 : 320;
PicoDrawSetOutBuf(vout_buf, vout_width * 2);
+
+ vout_height = line_count;
+ vout_offset = vout_width * start_line;
}
void emu_32x_startup(void)
}
void emu_32x_startup(void)
@@
-335,10
+338,10
@@
void retro_get_system_av_info(struct retro_system_av_info *info)
info->timing.fps = Pico.m.pal ? 50 : 60;
info->timing.sample_rate = 44100;
info->geometry.base_width = 320;
info->timing.fps = Pico.m.pal ? 50 : 60;
info->timing.sample_rate = 44100;
info->geometry.base_width = 320;
- info->geometry.base_height =
240
;
+ info->geometry.base_height =
vout_height
;
info->geometry.max_width = VOUT_MAX_WIDTH;
info->geometry.max_height = VOUT_MAX_HEIGHT;
info->geometry.max_width = VOUT_MAX_WIDTH;
info->geometry.max_height = VOUT_MAX_HEIGHT;
- info->geometry.aspect_ratio =
4.0 / 3.0
;
+ info->geometry.aspect_ratio =
0.0f
;
}
/* savestates */
}
/* savestates */
@@
-497,7
+500,7
@@
static unsigned int disk_get_image_index(void)
static bool disk_set_image_index(unsigned int index)
{
static bool disk_set_image_index(unsigned int index)
{
- cd_img_type cd_type;
+
enum
cd_img_type cd_type;
int ret;
if (index >= sizeof(disks) / sizeof(disks[0]))
int ret;
if (index >= sizeof(disks) / sizeof(disks[0]))
@@
-518,7
+521,7
@@
static bool disk_set_image_index(unsigned int index)
ret = -1;
cd_type = PicoCdCheck(disks[index].fname, NULL);
if (cd_type != CIT_NOT_CD)
ret = -1;
cd_type = PicoCdCheck(disks[index].fname, NULL);
if (cd_type != CIT_NOT_CD)
- ret =
Insert_CD
(disks[index].fname, cd_type);
+ ret =
cdd_load
(disks[index].fname, cd_type);
if (ret != 0) {
lprintf("Load failed, invalid CD image?\n");
return 0;
if (ret != 0) {
lprintf("Load failed, invalid CD image?\n");
return 0;
@@
-738,14
+741,25
@@
void *retro_get_memory_data(unsigned id)
size_t retro_get_memory_size(unsigned id)
{
size_t retro_get_memory_size(unsigned id)
{
+ unsigned int i;
+ int sum;
+
if (id != RETRO_MEMORY_SAVE_RAM)
return 0;
if (PicoAHW & PAHW_MCD)
// bram
return 0x2000;
if (id != RETRO_MEMORY_SAVE_RAM)
return 0;
if (PicoAHW & PAHW_MCD)
// bram
return 0x2000;
- else
+
+ if (Pico.m.frame_count == 0)
return SRam.size;
return SRam.size;
+
+ // if game doesn't write to sram, don't report it to
+ // libretro so that RA doesn't write out zeroed .srm
+ for (i = 0, sum = 0; i < SRam.size; i++)
+ sum |= SRam.data[i];
+
+ return (sum != 0) ? SRam.size : 0;
}
void retro_reset(void)
}
void retro_reset(void)
@@
-849,7
+863,8
@@
void retro_run(void)
PicoFrame();
PicoFrame();
- video_cb(vout_buf, vout_width, vout_height, vout_width * 2);
+ video_cb((short *)vout_buf + vout_offset,
+ vout_width, vout_height, vout_width * 2);
}
void retro_init(void)
}
void retro_init(void)
@@
-878,7
+893,6
@@
void retro_init(void)
#endif
PsndRate = 44100;
PicoAutoRgnOrder = 0x184; // US, EU, JP
#endif
PsndRate = 44100;
PicoAutoRgnOrder = 0x184; // US, EU, JP
- PicoCDBuffers = 0;
vout_width = 320;
vout_height = 240;
vout_width = 320;
vout_height = 240;