mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
gp2x: various fixes, prepare for release
This commit is contained in:
parent
fcdf2aff9b
commit
31f944ea8c
10 changed files with 61 additions and 98 deletions
|
@ -1,10 +1,24 @@
|
|||
# release packaging makefile
|
||||
|
||||
VER := $(shell head -n 1 ../common/version.h | \
|
||||
sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')
|
||||
BUILD := $(shell git describe HEAD | grep -- - | \
|
||||
sed -e 's/.*\-\(.*\)\-.*/\1/')
|
||||
ifneq "$(BUILD)" ""
|
||||
VER := $(VER)_$(BUILD)
|
||||
endif
|
||||
|
||||
all: rel
|
||||
|
||||
../../tools/textfilter:
|
||||
make -C ../../tools/
|
||||
|
||||
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||
../../tools/textfilter ../base_readme.txt $@ GP2X
|
||||
|
||||
VER ?= $(shell head -n 1 version.h | sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g')
|
||||
CODE940 = code940/pico940_v3.bin
|
||||
|
||||
rel: PicoDrive PicoDrive.gpe $(CODE940) readme.txt ../game_def.cfg \
|
||||
rel: ../../PicoDrive PicoDrive.gpe $(CODE940) readme.txt ../game_def.cfg \
|
||||
PicoDrive.png PicoDrive_s.png PicoDrive_t.png \
|
||||
warm_2.4.25.o warm_2.4.26-open2x.o warm_2.6.24.ko \
|
||||
../../pico/carthw.cfg
|
||||
|
|
6
platform/gp2x/PicoDrive.ini
Normal file
6
platform/gp2x/PicoDrive.ini
Normal file
|
@ -0,0 +1,6 @@
|
|||
[info]
|
||||
name="PicoDrive"
|
||||
path="/PicoDrive/PicoDrive.gpe"
|
||||
icon="/PicoDrive/PicoDrive_s.png"
|
||||
title="/PicoDrive/PicoDrive_t.png"
|
||||
group="GAMES"
|
BIN
platform/gp2x/PicoDrive_s.png
Normal file
BIN
platform/gp2x/PicoDrive_s.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
platform/gp2x/PicoDrive_t.png
Normal file
BIN
platform/gp2x/PicoDrive_t.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
|
@ -407,7 +407,6 @@ void plat_video_flip(void)
|
|||
}
|
||||
|
||||
/* XXX */
|
||||
#ifdef __GP2X__
|
||||
unsigned int plat_get_ticks_ms(void)
|
||||
{
|
||||
return gp2x_get_ticks_ms();
|
||||
|
@ -417,7 +416,6 @@ unsigned int plat_get_ticks_us(void)
|
|||
{
|
||||
return gp2x_get_ticks_us();
|
||||
}
|
||||
#endif
|
||||
|
||||
void plat_wait_till_us(unsigned int us_to)
|
||||
{
|
||||
|
@ -562,7 +560,7 @@ static void vid_reset_mode(void)
|
|||
if (currentConfig.EmuOpt & EOPT_WIZ_TEAR_FIX)
|
||||
gp2x_mode = -gp2x_mode;
|
||||
|
||||
gp2x_video_changemode(gp2x_mode);
|
||||
gp2x_video_changemode(gp2x_mode, Pico.m.pal);
|
||||
|
||||
Pico.m.dirtyPal = 1;
|
||||
|
||||
|
@ -701,47 +699,20 @@ void plat_update_volume(int has_changed, int is_up)
|
|||
|
||||
void pemu_sound_start(void)
|
||||
{
|
||||
gp2x_soc_t soc;
|
||||
|
||||
emu_sound_start();
|
||||
|
||||
plat_target_step_volume(¤tConfig.volume, 0);
|
||||
|
||||
#if 0
|
||||
static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0;
|
||||
|
||||
PsndOut = NULL;
|
||||
|
||||
// prepare sound stuff
|
||||
if (currentConfig.EmuOpt & EOPT_EN_SOUND)
|
||||
{
|
||||
int is_stereo = (PicoOpt & POPT_EN_STEREO) ? 1 : 0;
|
||||
int snd_rate_oss = PsndRate;
|
||||
gp2x_soc_t soc;
|
||||
|
||||
memset(sndBuffer, 0, sizeof(sndBuffer));
|
||||
PsndOut = sndBuffer;
|
||||
PicoWriteSound = oss_write_nonblocking;
|
||||
plat_update_volume(0, 0);
|
||||
|
||||
printf("starting audio: %i len: %i stereo: %i, pal: %i\n",
|
||||
PsndRate, PsndLen, is_stereo, Pico.m.pal);
|
||||
sndout_oss_start(snd_rate_oss, is_stereo, 1);
|
||||
sndout_oss_setvol(currentConfig.volume, currentConfig.volume);
|
||||
|
||||
soc = soc_detect();
|
||||
if (soc == SOCID_POLLUX)
|
||||
if (soc == SOCID_POLLUX) {
|
||||
PsndRate = pollux_get_real_snd_rate(PsndRate);
|
||||
|
||||
#define SOUND_RERATE_FLAGS (POPT_EN_FM|POPT_EN_PSG|POPT_EN_STEREO|POPT_EXT_FM|POPT_EN_MCD_CDDA)
|
||||
if (PsndRate != PsndRate_old || Pico.m.pal != pal_old || ((PicoOpt & POPT_EXT_FM) && crashed_940) ||
|
||||
((PicoOpt ^ PicoOpt_old) & SOUND_RERATE_FLAGS)) {
|
||||
PsndRerate(Pico.m.frame_count ? 1 : 0);
|
||||
}
|
||||
|
||||
PsndRate_old = PsndRate;
|
||||
PicoOpt_old = PicoOpt;
|
||||
pal_old = Pico.m.pal;
|
||||
plat_target_step_volume(¤tConfig.volume, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static const int sound_rates[] = { 44100, 32000, 22050, 16000, 11025, 8000 };
|
||||
|
|
|
@ -24,7 +24,7 @@ void *gp2x_screens[4];
|
|||
|
||||
void (*gp2x_video_flip)(void);
|
||||
void (*gp2x_video_flip2)(void);
|
||||
void (*gp2x_video_changemode_ll)(int bpp);
|
||||
void (*gp2x_video_changemode_ll)(int bpp, int is_pal);
|
||||
void (*gp2x_video_setpalette)(int *pal, int len);
|
||||
void (*gp2x_video_RGB_setscaling)(int ln_offs, int W, int H);
|
||||
void (*gp2x_video_wait_vsync)(void);
|
||||
|
@ -71,9 +71,9 @@ static struct in_default_bind in_gp2x_defbinds[] =
|
|||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
void gp2x_video_changemode(int bpp)
|
||||
void gp2x_video_changemode(int bpp, int is_pal)
|
||||
{
|
||||
gp2x_video_changemode_ll(bpp);
|
||||
gp2x_video_changemode_ll(bpp, is_pal);
|
||||
|
||||
gp2x_current_bpp = bpp < 0 ? -bpp : bpp;
|
||||
}
|
||||
|
@ -131,9 +131,8 @@ void plat_video_menu_enter(int is_rom_loaded)
|
|||
gp2x_video_flip2();
|
||||
|
||||
// switch to 16bpp
|
||||
gp2x_video_changemode_ll(16);
|
||||
gp2x_video_changemode_ll(16, 0);
|
||||
gp2x_video_RGB_setscaling(0, 320, 240);
|
||||
printf("menu_enter\n");
|
||||
}
|
||||
|
||||
void plat_video_menu_begin(void)
|
||||
|
|
|
@ -5,13 +5,13 @@ extern int gp2x_current_bpp;
|
|||
extern void (*gp2x_video_flip)(void);
|
||||
extern void (*gp2x_video_flip2)(void);
|
||||
/* negative bpp means rotated mode (for Wiz) */
|
||||
extern void (*gp2x_video_changemode_ll)(int bpp);
|
||||
extern void (*gp2x_video_changemode_ll)(int bpp, int is_pal);
|
||||
extern void (*gp2x_video_setpalette)(int *pal, int len);
|
||||
extern void (*gp2x_video_RGB_setscaling)(int ln_offs, int W, int H);
|
||||
extern void (*gp2x_video_wait_vsync)(void);
|
||||
|
||||
/* ??? */
|
||||
void gp2x_video_changemode(int bpp);
|
||||
void gp2x_video_changemode(int bpp, int is_pal);
|
||||
void gp2x_memcpy_all_buffers(void *data, int offset, int len);
|
||||
void gp2x_memset_all_buffers(int offset, int byte, int len);
|
||||
|
||||
|
|
|
@ -62,9 +62,8 @@ static void gp2x_video_flip2_(void)
|
|||
g_screen_ptr = gp2x_screens[++screensel&1];
|
||||
}
|
||||
|
||||
static void gp2x_video_changemode_ll_(int bpp)
|
||||
static void gp2x_video_changemode_ll_(int bpp, int is_pal)
|
||||
{
|
||||
printf("changemode %d\n", bpp);
|
||||
memregs[0x28DA>>1] = (((bpp+1)/8)<<9)|0xAB; /*8/15/16/24bpp...*/
|
||||
memregs[0x290C>>1] = 320*((bpp+1)/8); /*line width in bytes*/
|
||||
}
|
||||
|
@ -163,7 +162,7 @@ void vid_mmsp2_init(void)
|
|||
void vid_mmsp2_finish(void)
|
||||
{
|
||||
gp2x_video_RGB_setscaling_(0, 320, 240);
|
||||
gp2x_video_changemode_ll_(16);
|
||||
gp2x_video_changemode_ll_(16, 0);
|
||||
|
||||
memregs[0x290E>>1] = gp2x_screenaddr_old[0];
|
||||
memregs[0x2910>>1] = gp2x_screenaddr_old[1];
|
||||
|
|
|
@ -34,31 +34,21 @@
|
|||
#include "../common/arm_utils.h"
|
||||
#include "plat.h"
|
||||
|
||||
#define fb_buf_count 4
|
||||
static unsigned int fb_paddr[fb_buf_count];
|
||||
#define FB_BUF_COUNT 4
|
||||
#define FB_MEM_SIZE (320*240*2 * FB_BUF_COUNT)
|
||||
|
||||
static unsigned int fb_paddr[FB_BUF_COUNT];
|
||||
static int fb_work_buf;
|
||||
static int fbdev = -1;
|
||||
|
||||
static unsigned short memtimex_old[2];
|
||||
static int last_pal_setting = 0;
|
||||
|
||||
|
||||
/* misc */
|
||||
static void pollux_set_fromenv(const char *env_var)
|
||||
{
|
||||
const char *set_string;
|
||||
set_string = getenv(env_var);
|
||||
if (set_string)
|
||||
pollux_set(memregs, set_string);
|
||||
else
|
||||
printf("env var %s not defined.\n", env_var);
|
||||
}
|
||||
|
||||
/* video stuff */
|
||||
static void pollux_video_flip(int buf_count)
|
||||
{
|
||||
memregl[0x406C>>2] = fb_paddr[fb_work_buf];
|
||||
memregl[0x406C>>2] = memregl[0x446C>>2] = fb_paddr[fb_work_buf];
|
||||
memregl[0x4058>>2] |= 0x10;
|
||||
memregl[0x4458>>2] |= 0x10;
|
||||
|
||||
fb_work_buf++;
|
||||
if (fb_work_buf >= buf_count)
|
||||
fb_work_buf = 0;
|
||||
|
@ -67,7 +57,7 @@ static void pollux_video_flip(int buf_count)
|
|||
|
||||
static void gp2x_video_flip_(void)
|
||||
{
|
||||
pollux_video_flip(fb_buf_count);
|
||||
pollux_video_flip(FB_BUF_COUNT);
|
||||
}
|
||||
|
||||
/* doulblebuffered flip */
|
||||
|
@ -76,7 +66,7 @@ static void gp2x_video_flip2_(void)
|
|||
pollux_video_flip(2);
|
||||
}
|
||||
|
||||
static void gp2x_video_changemode_ll_(int bpp)
|
||||
static void gp2x_video_changemode_ll_(int bpp, int is_pal)
|
||||
{
|
||||
static int prev_bpp = 0;
|
||||
int code = 0, bytes = 2;
|
||||
|
@ -100,8 +90,9 @@ static void gp2x_video_changemode_ll_(int bpp)
|
|||
memregl[0x4000>>2] |= 1 << 3;
|
||||
|
||||
/* the above ioctl resets LCD timings, so set them here */
|
||||
snprintf(buff, sizeof(buff), "POLLUX_LCD_TIMINGS_%s", last_pal_setting ? "PAL" : "NTSC");
|
||||
pollux_set_fromenv(buff);
|
||||
snprintf(buff, sizeof(buff), "POLLUX_LCD_TIMINGS_%s",
|
||||
is_pal ? "PAL" : "NTSC");
|
||||
pollux_set_fromenv(memregs, buff);
|
||||
|
||||
switch (abs(bpp))
|
||||
{
|
||||
|
@ -121,12 +112,18 @@ static void gp2x_video_changemode_ll_(int bpp)
|
|||
return;
|
||||
}
|
||||
|
||||
memregl[0x405c>>2] = bytes;
|
||||
memregl[0x4060>>2] = bytes * (bpp < 0 ? 240 : 320);
|
||||
// program both MLCs so that TV-out works
|
||||
memregl[0x405c>>2] = memregl[0x445c>>2] = bytes;
|
||||
memregl[0x4060>>2] = memregl[0x4460>>2] =
|
||||
bytes * (bpp < 0 ? 240 : 320);
|
||||
|
||||
r = memregl[0x4058>>2];
|
||||
r = (r & 0xffff) | (code << 16) | 0x10;
|
||||
memregl[0x4058>>2] = r;
|
||||
|
||||
r = memregl[0x4458>>2];
|
||||
r = (r & 0xffff) | (code << 16) | 0x10;
|
||||
memregl[0x4458>>2] = r;
|
||||
}
|
||||
|
||||
static void gp2x_video_setpalette_(int *pal, int len)
|
||||
|
@ -153,26 +150,6 @@ static void gp2x_video_wait_vsync_(void)
|
|||
memregl[0x308c>>2] |= 1 << 10;
|
||||
}
|
||||
|
||||
/* RAM timings */
|
||||
static void set_ram_timings_(void)
|
||||
{
|
||||
pollux_set_fromenv("POLLUX_RAM_TIMINGS");
|
||||
}
|
||||
|
||||
static void unset_ram_timings_(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
memregs[0x14802>>1] = memtimex_old[0];
|
||||
memregs[0x14804>>1] = memtimex_old[1] | 0x8000;
|
||||
|
||||
for (i = 0; i < 0x100000; i++)
|
||||
if (!(memregs[0x14804>>1] & 0x8000))
|
||||
break;
|
||||
|
||||
printf("RAM timings reset to startup values.\n");
|
||||
}
|
||||
|
||||
void vid_pollux_init(void)
|
||||
{
|
||||
struct fb_fix_screeninfo fbfix;
|
||||
|
@ -193,17 +170,17 @@ void vid_pollux_init(void)
|
|||
printf("framebuffer: \"%s\" @ %08lx\n", fbfix.id, fbfix.smem_start);
|
||||
fb_paddr[0] = fbfix.smem_start;
|
||||
|
||||
gp2x_screens[0] = mmap(0, 320*240*2*fb_buf_count, PROT_READ|PROT_WRITE,
|
||||
gp2x_screens[0] = mmap(0, FB_MEM_SIZE, PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED, memdev, fb_paddr[0]);
|
||||
if (gp2x_screens[0] == MAP_FAILED)
|
||||
{
|
||||
perror("mmap(gp2x_screens) failed");
|
||||
exit(1);
|
||||
}
|
||||
memset(gp2x_screens[0], 0, 320*240*2*fb_buf_count);
|
||||
memset(gp2x_screens[0], 0, FB_MEM_SIZE);
|
||||
|
||||
printf(" %p -> %08x\n", gp2x_screens[0], fb_paddr[0]);
|
||||
for (i = 1; i < fb_buf_count; i++)
|
||||
for (i = 1; i < FB_BUF_COUNT; i++)
|
||||
{
|
||||
fb_paddr[i] = fb_paddr[i-1] + 320*240*2;
|
||||
gp2x_screens[i] = (char *)gp2x_screens[i-1] + 320*240*2;
|
||||
|
@ -212,8 +189,6 @@ void vid_pollux_init(void)
|
|||
fb_work_buf = 0;
|
||||
g_screen_ptr = gp2x_screens[0];
|
||||
|
||||
set_ram_timings_();
|
||||
|
||||
gp2x_video_flip = gp2x_video_flip_;
|
||||
gp2x_video_flip2 = gp2x_video_flip2_;
|
||||
gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
|
||||
|
@ -224,9 +199,8 @@ void vid_pollux_init(void)
|
|||
|
||||
void vid_pollux_finish(void)
|
||||
{
|
||||
munmap(gp2x_screens[0], 320*240*2 * fb_buf_count);
|
||||
memset(gp2x_screens[0], 0, FB_MEM_SIZE);
|
||||
munmap(gp2x_screens[0], FB_MEM_SIZE);
|
||||
close(fbdev);
|
||||
fbdev = -1;
|
||||
|
||||
unset_ram_timings_();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1bc471ebf1c85cf78f1862f5596a76f051e7112d
|
||||
Subproject commit 39014486f9e50110d23dece007ce4c0ed90d15b1
|
Loading…
Add table
Add a link
Reference in a new issue