mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
linux port fixed; some cleanups
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@706 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
ee2a3bdfa5
commit
bcd94522e8
21 changed files with 150 additions and 486 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "../../pico_int.h"
|
#include "../../pico_int.h"
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#ifdef __GP2X__
|
#ifdef __linux__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsig
|
||||||
|
|
||||||
void PicoSVPInit(void)
|
void PicoSVPInit(void)
|
||||||
{
|
{
|
||||||
#ifdef __GP2X__
|
#ifdef __linux__
|
||||||
int ret;
|
int ret;
|
||||||
ret = munmap(tcache, SSP_DRC_SIZE);
|
ret = munmap(tcache, SSP_DRC_SIZE);
|
||||||
printf("munmap tcache: %i\n", ret);
|
printf("munmap tcache: %i\n", ret);
|
||||||
|
@ -110,7 +110,7 @@ void PicoSVPInit(void)
|
||||||
|
|
||||||
static void PicoSVPShutdown(void)
|
static void PicoSVPShutdown(void)
|
||||||
{
|
{
|
||||||
#ifdef __GP2X__
|
#ifdef __linux__
|
||||||
// also unmap tcache
|
// also unmap tcache
|
||||||
PicoSVPInit();
|
PicoSVPInit();
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,7 +135,7 @@ void PicoSVPStartup(void)
|
||||||
svp = (void *) ((char *)tmp + 0x200000);
|
svp = (void *) ((char *)tmp + 0x200000);
|
||||||
memset(svp, 0, sizeof(*svp));
|
memset(svp, 0, sizeof(*svp));
|
||||||
|
|
||||||
#ifdef __GP2X__
|
#ifdef __linux__
|
||||||
tmp = mmap(tcache, SSP_DRC_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
tmp = mmap(tcache, SSP_DRC_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
||||||
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,13 +8,12 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#include "../common/menu.h"
|
#include "menu.h"
|
||||||
#include "../common/emu.h"
|
|
||||||
#include "../common/config.h"
|
|
||||||
#include "../common/input.h"
|
|
||||||
#include "../common/plat.h"
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "version.h"
|
#include "config.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "plat.h"
|
||||||
|
#include <version.h>
|
||||||
|
|
||||||
|
|
||||||
extern char *PicoConfigFile;
|
extern char *PicoConfigFile;
|
|
@ -16,6 +16,7 @@
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "plat.h"
|
#include "plat.h"
|
||||||
#include "posix.h"
|
#include "posix.h"
|
||||||
|
#include <version.h>
|
||||||
|
|
||||||
#include <pico/pico_int.h>
|
#include <pico/pico_int.h>
|
||||||
#include <pico/patch.h>
|
#include <pico/patch.h>
|
||||||
|
|
|
@ -13,6 +13,9 @@ void emu_startSound(void);
|
||||||
void emu_endSound(void);
|
void emu_endSound(void);
|
||||||
void emu_waitSound(void);
|
void emu_waitSound(void);
|
||||||
void emu_ResetGame(void); // TODO mv rm?
|
void emu_ResetGame(void); // TODO mv rm?
|
||||||
|
void emu_Init(void);
|
||||||
|
void emu_Deinit(void);
|
||||||
|
void emu_Loop(void);
|
||||||
|
|
||||||
void emu_noticeMsgUpdated(void);
|
void emu_noticeMsgUpdated(void);
|
||||||
int emu_getMainDir(char *dst, int len);
|
int emu_getMainDir(char *dst, int len);
|
||||||
|
|
|
@ -5,10 +5,5 @@
|
||||||
|
|
||||||
extern unsigned char gfx_buffer[321*240*2*2];
|
extern unsigned char gfx_buffer[321*240*2*2];
|
||||||
|
|
||||||
void emu_Init(void);
|
|
||||||
void emu_Deinit(void);
|
|
||||||
void emu_Loop(void);
|
|
||||||
void emu_ResetGame(void);
|
|
||||||
|
|
||||||
void emu_stateCb(const char *str);
|
void emu_stateCb(const char *str);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "code940/940shared.h"
|
#include "code940/940shared.h"
|
||||||
#include "soc_mmsp2.h"
|
#include "soc_mmsp2.h"
|
||||||
#include "soc.h"
|
#include "soc.h"
|
||||||
#include "emu.h"
|
|
||||||
#include "../common/mp3.h"
|
#include "../common/mp3.h"
|
||||||
#include "../common/arm_utils.h"
|
#include "../common/arm_utils.h"
|
||||||
#include "../common/menu.h"
|
#include "../common/menu.h"
|
||||||
|
|
|
@ -55,14 +55,14 @@ LD = $(CROSS)ld
|
||||||
OBJCOPY = $(CROSS)objcopy
|
OBJCOPY = $(CROSS)objcopy
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += main.o soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o
|
OBJS += soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o
|
||||||
# 940 core control
|
# 940 core control
|
||||||
OBJS += 940ctl.o
|
OBJS += 940ctl.o
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||||
platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \
|
platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \
|
||||||
platform/common/mp3_helix.o platform/common/input.o \
|
platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \
|
||||||
platform/linux/sndout_oss.o platform/linux/plat.o
|
platform/linux/sndout_oss.o platform/linux/plat.o
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
// (c) Copyright 2006-2009 notaz, All rights reserved.
|
||||||
// Free for non-commercial use.
|
// Free for non-commercial use.
|
||||||
|
|
||||||
// For commercial use, separate licencing terms must be obtained.
|
// For commercial use, separate licencing terms must be obtained.
|
||||||
|
@ -8,15 +8,11 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <linux/limits.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "emu.h"
|
|
||||||
#include "plat_gp2x.h"
|
#include "plat_gp2x.h"
|
||||||
#include "soc.h"
|
#include "soc.h"
|
||||||
|
#include "../common/plat.h"
|
||||||
#include "../common/menu.h"
|
#include "../common/menu.h"
|
||||||
#include "../common/arm_utils.h"
|
#include "../common/arm_utils.h"
|
||||||
#include "../common/fonts.h"
|
#include "../common/fonts.h"
|
||||||
|
@ -158,7 +154,7 @@ void emu_prepareDefaultConfig(void)
|
||||||
defaultConfig.s_PicoOpt |= POPT_EXT_FM;
|
defaultConfig.s_PicoOpt |= POPT_EXT_FM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void osd_text(int x, int y, const char *text)
|
static void osd_text(int x, int y, const char *text)
|
||||||
{
|
{
|
||||||
int len = strlen(text)*8;
|
int len = strlen(text)*8;
|
||||||
int *p, i, h, offs;
|
int *p, i, h, offs;
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
|
||||||
// Free for non-commercial use.
|
|
||||||
|
|
||||||
// For commercial use, separate licencing terms must be obtained.
|
|
||||||
|
|
||||||
|
|
||||||
void emu_Init(void);
|
|
||||||
void emu_Deinit(void);
|
|
||||||
void emu_Loop(void);
|
|
||||||
|
|
||||||
void osd_text(int x, int y, const char *text);
|
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#ifndef PORT_CONFIG_H
|
#ifndef PORT_CONFIG_H
|
||||||
#define PORT_CONFIG_H
|
#define PORT_CONFIG_H
|
||||||
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
||||||
#define DONT_OPEN_MANY_FILES 0
|
#define DONT_OPEN_MANY_FILES 0
|
||||||
#define REDUCE_IO_CALLS 0
|
#define REDUCE_IO_CALLS 0
|
||||||
|
|
|
@ -1,213 +0,0 @@
|
||||||
/* faked 940 code just uses local copy of ym2612 */
|
|
||||||
/* TODO: rm this */
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "../../pico/sound/ym2612.h"
|
|
||||||
//#include "../gp2x/gp2x.h"
|
|
||||||
#include "../gp2x/emu.h"
|
|
||||||
#include "../gp2x/code940/940shared.h"
|
|
||||||
#include "../common/helix/pub/mp3dec.h"
|
|
||||||
#include "../../pico/pico_int.h"
|
|
||||||
|
|
||||||
|
|
||||||
// static _940_data_t shared_data_;
|
|
||||||
static _940_ctl_t shared_ctl_;
|
|
||||||
// static _940_data_t *shared_data = &shared_data_;
|
|
||||||
_940_ctl_t *shared_ctl = &shared_ctl_;
|
|
||||||
|
|
||||||
unsigned char *mp3_mem = 0;
|
|
||||||
|
|
||||||
#define MP3_SIZE_MAX (0x1000000 - 4*640*480)
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
int YM2612Write_940(unsigned int a, unsigned int v, int scanline)
|
|
||||||
{
|
|
||||||
YM2612Write_(a, v);
|
|
||||||
|
|
||||||
return 0; // cause the engine to do updates once per frame only
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void YM2612PicoStateLoad_940(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
YM2612PicoStateLoad_();
|
|
||||||
|
|
||||||
for(i = 0; i < 0x100; i++) {
|
|
||||||
YM2612Write_(0, i);
|
|
||||||
YM2612Write_(1, ym2612.REGS[i]);
|
|
||||||
}
|
|
||||||
for(i = 0; i < 0x100; i++) {
|
|
||||||
YM2612Write_(2, i);
|
|
||||||
YM2612Write_(3, ym2612.REGS[i|0x100]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void YM2612PicoStateSave2_940(int tat, int tbt)
|
|
||||||
{
|
|
||||||
YM2612PicoStateSave2(tat, tbt);
|
|
||||||
}
|
|
||||||
|
|
||||||
int YM2612PicoStateLoad2_940(int *tat, int *tbt)
|
|
||||||
{
|
|
||||||
return YM2612PicoStateLoad2(tat, tbt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void sharedmem_init(void)
|
|
||||||
{
|
|
||||||
mp3_mem = malloc(MP3_SIZE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void sharedmem_deinit(void)
|
|
||||||
{
|
|
||||||
free(mp3_mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
void YM2612Init_940(int baseclock, int rate)
|
|
||||||
{
|
|
||||||
YM2612Init_(baseclock, rate);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void YM2612ResetChip_940(void)
|
|
||||||
{
|
|
||||||
YM2612ResetChip_();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void local_decode(void)
|
|
||||||
{
|
|
||||||
int mp3_offs = shared_ctl->mp3_offs;
|
|
||||||
unsigned char *readPtr = mp3_mem + mp3_offs;
|
|
||||||
int bytesLeft = shared_ctl->mp3_len - mp3_offs;
|
|
||||||
int offset; // frame offset from readPtr
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
if (bytesLeft <= 0) return; // EOF, nothing to do
|
|
||||||
|
|
||||||
offset = MP3FindSyncWord(readPtr, bytesLeft);
|
|
||||||
if (offset < 0) {
|
|
||||||
shared_ctl->mp3_offs = shared_ctl->mp3_len;
|
|
||||||
return; // EOF
|
|
||||||
}
|
|
||||||
readPtr += offset;
|
|
||||||
bytesLeft -= offset;
|
|
||||||
|
|
||||||
err = MP3Decode(shared_data->mp3dec, &readPtr, &bytesLeft,
|
|
||||||
shared_data->mp3_buffer[shared_ctl->mp3_buffsel], 0);
|
|
||||||
if (err) {
|
|
||||||
if (err == ERR_MP3_INDATA_UNDERFLOW) {
|
|
||||||
shared_ctl->mp3_offs = shared_ctl->mp3_len; // EOF
|
|
||||||
return;
|
|
||||||
} else if (err <= -6 && err >= -12) {
|
|
||||||
// ERR_MP3_INVALID_FRAMEHEADER, ERR_MP3_INVALID_*
|
|
||||||
// just try to skip the offending frame..
|
|
||||||
readPtr++;
|
|
||||||
}
|
|
||||||
shared_ctl->mp3_errors++;
|
|
||||||
shared_ctl->mp3_lasterr = err;
|
|
||||||
}
|
|
||||||
shared_ctl->mp3_offs = readPtr - mp3_mem;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FILE *loaded_mp3 = 0;
|
|
||||||
|
|
||||||
int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
int cdda_on, *ym_buffer = mix_buffer;
|
|
||||||
static int mp3_samples_ready = 0, mp3_buffer_offs = 0;
|
|
||||||
static int mp3_play_bufsel = 1;
|
|
||||||
|
|
||||||
|
|
||||||
YM2612UpdateOne_(buffer, length, stereo); // really writes to mix_buffer
|
|
||||||
|
|
||||||
// emulatind MCD, not data track, CDC is reading, playback was started, track not ended
|
|
||||||
cdda_on = (PicoMCD & 1) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1)
|
|
||||||
&& loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len;
|
|
||||||
|
|
||||||
/* mix data from previous go */
|
|
||||||
if (cdda_on && mp3_samples_ready >= length)
|
|
||||||
{
|
|
||||||
if (1152 - mp3_buffer_offs >= length) {
|
|
||||||
mix_samples(buffer, ym_buffer, shared_data->mp3_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, length, stereo);
|
|
||||||
|
|
||||||
mp3_buffer_offs += length;
|
|
||||||
} else {
|
|
||||||
// collect from both buffers..
|
|
||||||
int left = 1152 - mp3_buffer_offs;
|
|
||||||
mix_samples(buffer, ym_buffer, shared_data->mp3_buffer[mp3_play_bufsel] + mp3_buffer_offs*2, left, stereo);
|
|
||||||
mp3_play_bufsel ^= 1;
|
|
||||||
mp3_buffer_offs = length - left;
|
|
||||||
mix_samples(buffer + left * 2, ym_buffer + left * 2,
|
|
||||||
shared_data->mp3_buffer[mp3_play_bufsel], mp3_buffer_offs, stereo);
|
|
||||||
}
|
|
||||||
mp3_samples_ready -= length;
|
|
||||||
} else {
|
|
||||||
mix_samples(buffer, ym_buffer, 0, length, stereo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we will have enough mp3 samples next frame
|
|
||||||
if (cdda_on && mp3_samples_ready < length)
|
|
||||||
{
|
|
||||||
shared_ctl->mp3_buffsel ^= 1;
|
|
||||||
local_decode();
|
|
||||||
mp3_samples_ready += 1152;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return YM2612UpdateOne_(buffer, length, stereo, is_buf_empty);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mp3_update(int *buffer, int length, int stereo)
|
|
||||||
{
|
|
||||||
// nothing..
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
void mp3_start_play(FILE *f, int pos) // pos is 0-1023
|
|
||||||
{
|
|
||||||
int byte_offs = 0;
|
|
||||||
|
|
||||||
if (loaded_mp3 != f)
|
|
||||||
{
|
|
||||||
printf("loading mp3... "); fflush(stdout);
|
|
||||||
fseek(f, 0, SEEK_SET);
|
|
||||||
fread(mp3_mem, 1, MP3_SIZE_MAX, f);
|
|
||||||
if (feof(f)) printf("done.\n");
|
|
||||||
else printf("done. mp3 too large, not all data loaded.\n");
|
|
||||||
shared_ctl->mp3_len = ftell(f);
|
|
||||||
loaded_mp3 = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// seek..
|
|
||||||
if (pos) {
|
|
||||||
byte_offs = (shared_ctl->mp3_len << 6) >> 10;
|
|
||||||
byte_offs *= pos;
|
|
||||||
byte_offs >>= 6;
|
|
||||||
}
|
|
||||||
printf("mp3 pos1024: %i, byte_offs %i/%i\n", pos, byte_offs, shared_ctl->mp3_len);
|
|
||||||
|
|
||||||
shared_ctl->mp3_offs = byte_offs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ CFLAGS += -fprofile-generate
|
||||||
else
|
else
|
||||||
CFLAGS = -ggdb -Wall
|
CFLAGS = -ggdb -Wall
|
||||||
endif
|
endif
|
||||||
DEFINES = __GP2X__ _UNZIP_SUPPORT IO_STATS IN_EVDEV
|
DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV
|
||||||
CFLAGS += -I../.. -I.
|
CFLAGS += -I../.. -I.
|
||||||
|
|
||||||
# gtk
|
# gtk
|
||||||
|
@ -24,12 +24,12 @@ CFLAGS += `pkg-config --cflags gthread-2.0`
|
||||||
LDFLAGS += `pkg-config --libs gthread-2.0`
|
LDFLAGS += `pkg-config --libs gthread-2.0`
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += platform/gp2x/main.o platform/gp2x/emu.o platform/gp2x/plat.o blit.o \
|
OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o
|
||||||
in_evdev.o plat.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
|
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \
|
OBJS += platform/common/main.o platform/common/emu.o platform/common/menu.o \
|
||||||
platform/common/readpng.o platform/common/input.o platform/common/mp3_helix.o
|
platform/common/config.o platform/common/fonts.o platform/common/readpng.o \
|
||||||
|
platform/common/input.o
|
||||||
|
|
||||||
ifeq "$(fake_in_gp2x)" "1"
|
ifeq "$(fake_in_gp2x)" "1"
|
||||||
DEFINES += IN_GP2X FAKE_IN_GP2X
|
DEFINES += IN_GP2X FAKE_IN_GP2X
|
||||||
|
@ -38,18 +38,18 @@ endif
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
|
OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \
|
||||||
pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
|
pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
|
OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
|
||||||
pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \
|
pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \
|
||||||
pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o
|
pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o
|
||||||
# Pico - Pico
|
# Pico - Pico
|
||||||
OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o
|
OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o
|
||||||
# Pico - sound
|
# Pico - sound
|
||||||
OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o
|
OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o
|
||||||
# Pico - carthw
|
# Pico - carthw
|
||||||
OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
|
OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
|
||||||
pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o
|
pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o
|
||||||
# zlib
|
# zlib
|
||||||
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
|
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
|
||||||
zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
|
zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "../gp2x/emu.h"
|
|
||||||
//#include "../gp2x/gp2x.h"
|
|
||||||
#include "../gp2x/version.h"
|
#include "../gp2x/version.h"
|
||||||
#include "../common/emu.h"
|
#include "../common/emu.h"
|
||||||
|
#include "../common/menu.h"
|
||||||
|
#include "../common/readpng.h"
|
||||||
#include "sndout_oss.h"
|
#include "sndout_oss.h"
|
||||||
|
|
||||||
#include "log_io.h"
|
#include "log_io.h"
|
||||||
|
@ -28,6 +28,8 @@ static int scr_changed = 0, scr_w = SCREEN_WIDTH, scr_h = SCREEN_HEIGHT;
|
||||||
|
|
||||||
// dummies
|
// dummies
|
||||||
int mix_32_to_16l_level;
|
int mix_32_to_16l_level;
|
||||||
|
int crashed_940 = 0;
|
||||||
|
int default_cpu_clock = 123;
|
||||||
|
|
||||||
/* gtk */
|
/* gtk */
|
||||||
struct gtk_global_struct
|
struct gtk_global_struct
|
||||||
|
@ -210,29 +212,8 @@ static void realloc_screen(void)
|
||||||
scr_changed = 0;
|
scr_changed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void plat_init(void)
|
/* gp2x/emu.c stuff, most to be rm'd */
|
||||||
{
|
static void gp2x_video_flip_(void)
|
||||||
printf("entering init()\n"); fflush(stdout);
|
|
||||||
|
|
||||||
realloc_screen();
|
|
||||||
memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
|
|
||||||
|
|
||||||
// snd
|
|
||||||
sndout_oss_init();
|
|
||||||
|
|
||||||
gtk_initf();
|
|
||||||
|
|
||||||
printf("exitting init()\n"); fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void plat_finish(void)
|
|
||||||
{
|
|
||||||
free(g_screen_ptr);
|
|
||||||
sndout_oss_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* video */
|
|
||||||
void gp2x_video_flip(void)
|
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
unsigned char *image;
|
unsigned char *image;
|
||||||
|
@ -288,27 +269,17 @@ void gp2x_video_flip(void)
|
||||||
realloc_screen();
|
realloc_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_video_flip2(void)
|
static void gp2x_video_changemode_ll_(int bpp)
|
||||||
{
|
|
||||||
gp2x_video_flip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp2x_video_changemode(int bpp)
|
|
||||||
{
|
{
|
||||||
current_bpp = bpp;
|
current_bpp = bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_video_changemode2(int bpp)
|
static void gp2x_video_setpalette_(int *pal, int len)
|
||||||
{
|
|
||||||
current_bpp = bpp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp2x_video_setpalette(int *pal, int len)
|
|
||||||
{
|
{
|
||||||
memcpy(current_pal, pal, len*4);
|
memcpy(current_pal, pal, len*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_video_RGB_setscaling(int v_offs, int W, int H)
|
void gp2x_memcpy_all_buffers(void *data, int offset, int len)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,44 +288,126 @@ void gp2x_memset_all_buffers(int offset, int byte, int len)
|
||||||
memset((char *)g_screen_ptr + offset, byte, len);
|
memset((char *)g_screen_ptr + offset, byte, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gp2x_video_changemode(int bpp)
|
||||||
|
{
|
||||||
|
gp2x_video_changemode_ll_(bpp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gp2x_make_fb_bufferable(int yes)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int soc_detect(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* plat */
|
||||||
|
static char menu_bg_buffer[320*240*2];
|
||||||
|
char cpu_clk_name[16] = "GP2X CPU clocks";
|
||||||
|
|
||||||
|
void plat_video_menu_enter(int is_rom_loaded)
|
||||||
|
{
|
||||||
|
if (is_rom_loaded)
|
||||||
|
{
|
||||||
|
// darken the active framebuffer
|
||||||
|
memset(g_screen_ptr, 0, 320*8*2);
|
||||||
|
menu_darken_bg((char *)g_screen_ptr + 320*8*2, 320*224, 1);
|
||||||
|
memset((char *)g_screen_ptr + 320*232*2, 0, 320*8*2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// should really only happen once, on startup..
|
||||||
|
readpng(g_screen_ptr, "skin/background.png", READPNG_BG);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(menu_bg_buffer, g_screen_ptr, 320*240*2);
|
||||||
|
|
||||||
|
// switch to 16bpp
|
||||||
|
gp2x_video_changemode_ll_(16);
|
||||||
|
gp2x_video_flip_();
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_video_menu_begin(void)
|
||||||
|
{
|
||||||
|
memcpy(g_screen_ptr, menu_bg_buffer, 320*240*2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_video_menu_end(void)
|
||||||
|
{
|
||||||
|
gp2x_video_flip_();
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_validate_config(void)
|
||||||
|
{
|
||||||
|
// PicoOpt &= ~POPT_EXT_FM;
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_early_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_init(void)
|
||||||
|
{
|
||||||
|
realloc_screen();
|
||||||
|
memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2);
|
||||||
|
|
||||||
|
// snd
|
||||||
|
sndout_oss_init();
|
||||||
|
|
||||||
|
gtk_initf();
|
||||||
|
}
|
||||||
|
|
||||||
|
void plat_finish(void)
|
||||||
|
{
|
||||||
|
free(g_screen_ptr);
|
||||||
|
sndout_oss_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* nasty */
|
||||||
|
static void do_nothing()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void *gp2x_video_flip = gp2x_video_flip_;
|
||||||
|
void *gp2x_video_flip2 = gp2x_video_flip_;
|
||||||
|
void *gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
|
||||||
|
void *gp2x_video_setpalette = gp2x_video_setpalette_;
|
||||||
|
|
||||||
|
void *gp2x_video_RGB_setscaling = do_nothing;
|
||||||
|
void *gp2x_video_wait_vsync = do_nothing;
|
||||||
|
void *gp2x_set_cpuclk = do_nothing;
|
||||||
|
void *set_lcd_custom_rate = do_nothing;
|
||||||
|
void *unset_lcd_custom_rate = do_nothing;
|
||||||
|
void *set_lcd_gamma = do_nothing;
|
||||||
|
void *set_ram_timings = do_nothing;
|
||||||
|
void *unset_ram_timings = do_nothing;
|
||||||
|
|
||||||
/* joy */
|
/* joy */
|
||||||
int gp2x_touchpad_read(int *x, int *y)
|
int gp2x_touchpad_read(int *x, int *y)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 940 */
|
|
||||||
int crashed_940 = 0;
|
|
||||||
void pause940(int yes)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset940(int yes, int bank)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp2x_video_wait_vsync(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_gamma(int g100, int A_SNs_curve)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_lcd_custom_rate(int rate)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void unset_lcd_custom_rate(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
void spend_cycles(int c)
|
void spend_cycles(int c)
|
||||||
{
|
{
|
||||||
usleep(c/200);
|
usleep(c/200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mp3_get_bitrate(FILE *f, int size)
|
||||||
|
{
|
||||||
|
return 128;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mp3_start_play(FILE *f, int pos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void mp3_update(int *buffer, int length, int stereo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/* lprintf */
|
/* lprintf */
|
||||||
void lprintf(const char *fmt, ...)
|
void lprintf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#ifndef PORT_CONFIG_H
|
#ifndef PORT_CONFIG_H
|
||||||
#define PORT_CONFIG_H
|
#define PORT_CONFIG_H
|
||||||
|
|
||||||
#include "../gp2x/version.h" /* FIXME */
|
|
||||||
|
|
||||||
#define NO_SYNC
|
#define NO_SYNC
|
||||||
|
|
||||||
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
||||||
|
|
2
platform/linux/version.h
Normal file
2
platform/linux/version.h
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#include "../gp2x/version.h"
|
||||||
|
|
|
@ -52,13 +52,13 @@ LD = $(CROSS)ld
|
||||||
OBJCOPY = $(CROSS)objcopy
|
OBJCOPY = $(CROSS)objcopy
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += pandora.o main.o emu.o asm_utils.o plat.o
|
OBJS += pandora.o emu.o asm_utils.o plat.o
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||||
platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \
|
platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o \
|
||||||
platform/common/readpng.o platform/common/input.o platform/linux/in_evdev.o \
|
platform/common/readpng.o platform/common/input.o platform/common/main.o \
|
||||||
platform/linux/sndout_oss.o platform/linux/plat.o
|
platform/linux/in_evdev.o platform/linux/sndout_oss.o platform/linux/plat.o
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
ifeq "$(amalgamate)" "1"
|
ifeq "$(amalgamate)" "1"
|
||||||
|
|
|
@ -168,7 +168,7 @@ static void textOut16(int x, int y, const char *text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void osd_text(int x, int y, const char *text)
|
static void osd_text(int x, int y, const char *text)
|
||||||
{
|
{
|
||||||
int len = strlen(text)*8;
|
int len = strlen(text)*8;
|
||||||
|
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
// (c) Copyright 2006 notaz, All rights reserved.
|
|
||||||
// Free for non-commercial use.
|
|
||||||
|
|
||||||
// For commercial use, separate licencing terms must be obtained.
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <strings.h>
|
|
||||||
#include <linux/limits.h>
|
|
||||||
|
|
||||||
#include "../gp2x/emu.h" // TODO rm
|
|
||||||
#include "../common/menu.h"
|
|
||||||
#include "../common/emu.h"
|
|
||||||
#include "../common/config.h"
|
|
||||||
#include "../common/input.h"
|
|
||||||
#include "../gp2x/version.h"
|
|
||||||
#include "pandora.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern char *PicoConfigFile;
|
|
||||||
static int load_state_slot = -1;
|
|
||||||
char **g_argv;
|
|
||||||
|
|
||||||
void parse_cmd_line(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int x, unrecognized = 0;
|
|
||||||
|
|
||||||
for(x = 1; x < argc; x++)
|
|
||||||
{
|
|
||||||
if(argv[x][0] == '-')
|
|
||||||
{
|
|
||||||
if(strcasecmp(argv[x], "-config") == 0) {
|
|
||||||
if(x+1 < argc) { ++x; PicoConfigFile = argv[x]; }
|
|
||||||
}
|
|
||||||
else if(strcasecmp(argv[x], "-loadstate") == 0) {
|
|
||||||
if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); }
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
unrecognized = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* External Frontend: ROM Name */
|
|
||||||
FILE *f;
|
|
||||||
strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload));
|
|
||||||
rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0;
|
|
||||||
f = fopen(rom_fname_reload, "rb");
|
|
||||||
if (f) fclose(f);
|
|
||||||
else unrecognized = 1;
|
|
||||||
engineState = PGS_ReloadRom;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unrecognized) {
|
|
||||||
printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n");
|
|
||||||
printf("usage: %s [options] [romfile]\n", argv[0]);
|
|
||||||
printf( "options:\n"
|
|
||||||
"-config <file> use specified config file instead of default 'picoconfig.bin'\n"
|
|
||||||
" see currentConfig_t structure in emu.h for the file format\n"
|
|
||||||
"-loadstate <num> if ROM is specified, try loading slot <num>\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
g_argv = argv;
|
|
||||||
|
|
||||||
in_init();
|
|
||||||
emu_prepareDefaultConfig();
|
|
||||||
emu_ReadConfig(0, 0);
|
|
||||||
config_readlrom(PicoConfigFile);
|
|
||||||
|
|
||||||
in_probe();
|
|
||||||
in_debug_dump();
|
|
||||||
pnd_init();
|
|
||||||
emu_Init();
|
|
||||||
menu_init();
|
|
||||||
|
|
||||||
engineState = PGS_Menu;
|
|
||||||
|
|
||||||
if (argc > 1)
|
|
||||||
parse_cmd_line(argc, argv);
|
|
||||||
|
|
||||||
if (engineState == PGS_ReloadRom)
|
|
||||||
{
|
|
||||||
if (emu_ReloadRom(rom_fname_reload)) {
|
|
||||||
engineState = PGS_Running;
|
|
||||||
if (load_state_slot >= 0) {
|
|
||||||
state_slot = load_state_slot;
|
|
||||||
emu_SaveLoadGame(1, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
switch (engineState)
|
|
||||||
{
|
|
||||||
case PGS_Menu:
|
|
||||||
menu_loop();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PGS_ReloadRom:
|
|
||||||
if (emu_ReloadRom(rom_fname_reload))
|
|
||||||
engineState = PGS_Running;
|
|
||||||
else {
|
|
||||||
printf("PGS_ReloadRom == 0\n");
|
|
||||||
engineState = PGS_Menu;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PGS_RestartRun:
|
|
||||||
engineState = PGS_Running;
|
|
||||||
|
|
||||||
case PGS_Running:
|
|
||||||
emu_Loop();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PGS_Quit:
|
|
||||||
goto endloop;
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf("engine got into unknown state (%i), exitting\n", engineState);
|
|
||||||
goto endloop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
endloop:
|
|
||||||
|
|
||||||
emu_Deinit();
|
|
||||||
pnd_exit();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -3,8 +3,6 @@
|
||||||
#ifndef PORT_CONFIG_H
|
#ifndef PORT_CONFIG_H
|
||||||
#define PORT_CONFIG_H
|
#define PORT_CONFIG_H
|
||||||
|
|
||||||
#include "../gp2x/version.h" /* FIXME */
|
|
||||||
|
|
||||||
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
||||||
#define DONT_OPEN_MANY_FILES 0
|
#define DONT_OPEN_MANY_FILES 0
|
||||||
#define REDUCE_IO_CALLS 0
|
#define REDUCE_IO_CALLS 0
|
||||||
|
|
|
@ -6,10 +6,6 @@
|
||||||
|
|
||||||
extern int engineStateSuspend;
|
extern int engineStateSuspend;
|
||||||
|
|
||||||
void emu_Init(void);
|
|
||||||
void emu_Deinit(void);
|
|
||||||
void emu_Loop(void);
|
|
||||||
void emu_ResetGame(void);
|
|
||||||
void emu_HandleResume(void);
|
void emu_HandleResume(void);
|
||||||
|
|
||||||
void emu_msg_cb(const char *msg);
|
void emu_msg_cb(const char *msg);
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void emu_Init(void);
|
|
||||||
void emu_Deinit(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue