mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
UIQ3 update, some makefile unification, rm old configs, stuff
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@569 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
a6e5aa4181
commit
ca482e5de8
66 changed files with 1748 additions and 1377 deletions
|
@ -1444,7 +1444,7 @@ void PicoDrawSync(int to, int blank_last_line)
|
|||
}
|
||||
|
||||
#if !CAN_HANDLE_240_LINES
|
||||
if (DrawScanline >= 224) DrawScanline = 240, return;
|
||||
if (DrawScanline >= 224) { DrawScanline = 240; return; }
|
||||
#endif
|
||||
|
||||
// last line
|
||||
|
|
|
@ -49,6 +49,7 @@ void PicoExit(void)
|
|||
{
|
||||
if (PicoAHW & PAHW_MCD)
|
||||
PicoExitMCD();
|
||||
PicoCartUnload();
|
||||
z80_exit();
|
||||
|
||||
if (SRam.data) free(SRam.data); SRam.data=0;
|
||||
|
|
|
@ -12,7 +12,7 @@ static int hits, reads;
|
|||
|
||||
void PicoCDBufferInit(void)
|
||||
{
|
||||
void *tmp;
|
||||
void *tmp = NULL;
|
||||
|
||||
prev_lba = 0x80000000;
|
||||
hits = reads = 0;
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#ifdef UIQ3
|
||||
#define snprintf(b,s,...) sprintf(b,##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
static char *mystrip(char *str)
|
||||
{
|
||||
|
|
66
platform/common/common_arm.mak
Normal file
66
platform/common/common_arm.mak
Normal file
|
@ -0,0 +1,66 @@
|
|||
.c.o:
|
||||
@echo ">>>" $<
|
||||
$(CC) $(CFLAGS) $(DEFINC) -c $< -o $@
|
||||
|
||||
.S.o:
|
||||
@echo ">>>" $<
|
||||
$(CC) $(SFLAGS) $(DEFINC) -c $< -o $@
|
||||
|
||||
|
||||
../../tools/textfilter: ../../tools/textfilter.c
|
||||
make -C ../../tools/ textfilter
|
||||
|
||||
clean_prof:
|
||||
find ../.. -name '*.gcno' -delete
|
||||
find ../.. -name '*.gcda' -delete
|
||||
|
||||
mkdirs:
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
# deps
|
||||
Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c
|
||||
Pico/Pico.o Pico/cd/Pico.o : ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h
|
||||
Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h
|
||||
|
||||
# individual rules
|
||||
Pico/draw_asm.o : ../../Pico/Draw.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/draw2_asm.o : ../../Pico/Draw2.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/memory_asm.o : ../../Pico/Memory.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/sound/mix_asm.o : ../../Pico/sound/mix.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/misc_asm.o : ../../Pico/Misc.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
#Pico/carthw/svp/stub_arm.o : ../../Pico/carthw/svp/stub_arm.S
|
||||
# @echo ">>>" $@
|
||||
# $(GCC) $(CFLAGS) $(DEFINC) -c $< -o $@
|
||||
|
||||
# build Cyclone
|
||||
cpu/Cyclone/proj/Cyclone.s:
|
||||
@echo building Cyclone...
|
||||
@make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h
|
||||
|
||||
# build helix libs
|
||||
../common/helix/$(CROSS)helix-mp3.a:
|
||||
make -C ../common/helix clean all
|
||||
|
||||
|
|
@ -1,11 +1,14 @@
|
|||
/*
|
||||
* Human-readable config file management for PicoDrive
|
||||
* (c)
|
||||
* (c) notaz, 2008
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef UIQ3
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "lprintf.h"
|
||||
|
||||
|
@ -205,6 +208,7 @@ static void custom_write(FILE *f, const menu_entry *me, int no_def)
|
|||
}
|
||||
|
||||
|
||||
#if PLAT_HAVE_JOY
|
||||
static const char *joyKeyNames[32] =
|
||||
{
|
||||
"UP", "DOWN", "LEFT", "RIGHT", "b1", "b2", "b3", "b4",
|
||||
|
@ -212,31 +216,40 @@ static const char *joyKeyNames[32] =
|
|||
"b13", "b14", "b15", "b16", "b17", "b19", "b19", "b20",
|
||||
"b21", "b22", "b23", "b24", "b25", "b26", "b27", "b28"
|
||||
};
|
||||
#endif
|
||||
|
||||
static void keys_write(FILE *fn, const char *bind_str, const int binds[32],
|
||||
const int def_binds[32], const char * const names[32], int no_defaults)
|
||||
const int def_binds[32], const char * const names[32], int key_count, int no_defaults)
|
||||
{
|
||||
int t, i;
|
||||
char act[48];
|
||||
char act[48], name[32];
|
||||
|
||||
for (t = 0; t < 32; t++)
|
||||
for (t = 0; t < key_count; t++)
|
||||
{
|
||||
act[0] = act[31] = 0;
|
||||
if (no_defaults && binds[t] == def_binds[t])
|
||||
continue;
|
||||
if (strcmp(names[t], "???") == 0) continue;
|
||||
#ifdef __GP2X__
|
||||
if (strcmp(names[t], "SELECT") == 0) continue;
|
||||
#endif
|
||||
if (t >= 32 || names[t] == NULL || strcmp(names[t], "???") == 0) {
|
||||
if ((t >= '0' && t <= '9') || (t >= 'a' && t <= 'z') || (t >= 'A' && t <= 'Z'))
|
||||
sprintf(name, "%c", t);
|
||||
else
|
||||
sprintf(name, "\\x%02x", t);
|
||||
}
|
||||
else
|
||||
strcpy(name, names[t]);
|
||||
|
||||
if (binds[t] == 0 && def_binds[t] != 0) {
|
||||
fprintf(fn, "%s %s =" NL, bind_str, names[t]); // no binds
|
||||
fprintf(fn, "%s %s =" NL, bind_str, name); // no binds
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(me_ctrl_actions) / sizeof(me_ctrl_actions[0]); i++) {
|
||||
if (me_ctrl_actions[i].mask & binds[t]) {
|
||||
strncpy(act, me_ctrl_actions[i].name, 31);
|
||||
fprintf(fn, "%s %s = player%i %s" NL, bind_str, names[t],
|
||||
fprintf(fn, "%s %s = player%i %s" NL, bind_str, name,
|
||||
((binds[t]>>16)&1)+1, mystrip(act));
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +257,7 @@ static void keys_write(FILE *fn, const char *bind_str, const int binds[32],
|
|||
for (i = 0; emuctrl_actions[i].name != NULL; i++) {
|
||||
if (emuctrl_actions[i].mask & binds[t]) {
|
||||
strncpy(act, emuctrl_actions[i].name, 31);
|
||||
fprintf(fn, "%s %s = %s" NL, bind_str, names[t], mystrip(act));
|
||||
fprintf(fn, "%s %s = %s" NL, bind_str, name, mystrip(act));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,8 +294,9 @@ static int default_var(const menu_entry *me)
|
|||
case MA_CDOPT_LEDS:
|
||||
return defaultConfig.EmuOpt;
|
||||
|
||||
case MA_CTRL_TURBO_RATE:
|
||||
return defaultConfig.turbo_rate;
|
||||
case MA_CTRL_TURBO_RATE: return defaultConfig.turbo_rate;
|
||||
case MA_OPT_SCALING: return defaultConfig.scaling;
|
||||
case MA_OPT_ROTATION: return defaultConfig.rotation;
|
||||
|
||||
case MA_OPT_SAVE_SLOT:
|
||||
default:
|
||||
|
@ -384,11 +398,13 @@ write:
|
|||
}
|
||||
|
||||
// save key config
|
||||
keys_write(fn, "bind", currentConfig.KeyBinds, defaultConfig.KeyBinds, keyNames, no_defaults);
|
||||
keys_write(fn, "bind_joy0", currentConfig.JoyBinds[0], defaultConfig.JoyBinds[0], joyKeyNames, 1);
|
||||
keys_write(fn, "bind_joy1", currentConfig.JoyBinds[1], defaultConfig.JoyBinds[1], joyKeyNames, 1);
|
||||
keys_write(fn, "bind_joy2", currentConfig.JoyBinds[2], defaultConfig.JoyBinds[2], joyKeyNames, 1);
|
||||
keys_write(fn, "bind_joy3", currentConfig.JoyBinds[3], defaultConfig.JoyBinds[3], joyKeyNames, 1);
|
||||
keys_write(fn, "bind", currentConfig.KeyBinds, defaultConfig.KeyBinds, keyNames, PLAT_MAX_KEYS, no_defaults);
|
||||
#if PLAT_HAVE_JOY
|
||||
keys_write(fn, "bind_joy0", currentConfig.JoyBinds[0], defaultConfig.JoyBinds[0], joyKeyNames, 32, 1);
|
||||
keys_write(fn, "bind_joy1", currentConfig.JoyBinds[1], defaultConfig.JoyBinds[1], joyKeyNames, 32, 1);
|
||||
keys_write(fn, "bind_joy2", currentConfig.JoyBinds[2], defaultConfig.JoyBinds[2], joyKeyNames, 32, 1);
|
||||
keys_write(fn, "bind_joy3", currentConfig.JoyBinds[3], defaultConfig.JoyBinds[3], joyKeyNames, 32, 1);
|
||||
#endif
|
||||
|
||||
#ifndef PSP
|
||||
if (section == NULL)
|
||||
|
@ -423,7 +439,7 @@ int config_writelrom(const char *fname)
|
|||
int size;
|
||||
FILE *f;
|
||||
|
||||
if (strlen(lastRomFile) == 0) return -1;
|
||||
if (strlen(loadedRomFName) == 0) return -1;
|
||||
|
||||
f = fopen(fname, "r");
|
||||
if (f != NULL)
|
||||
|
@ -456,7 +472,7 @@ int config_writelrom(const char *fname)
|
|||
fwrite(old_data, 1, optr - old_data, f);
|
||||
free(old_data);
|
||||
}
|
||||
fprintf(f, "LastUsedROM = %s" NL, lastRomFile);
|
||||
fprintf(f, "LastUsedROM = %s" NL, loadedRomFName);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
@ -487,9 +503,9 @@ int config_readlrom(const char *fname)
|
|||
tmp++;
|
||||
mystrip(tmp);
|
||||
|
||||
len = sizeof(lastRomFile);
|
||||
strncpy(lastRomFile, tmp, len);
|
||||
lastRomFile[len-1] = 0;
|
||||
len = sizeof(loadedRomFName);
|
||||
strncpy(loadedRomFName, tmp, len);
|
||||
loadedRomFName[len-1] = 0;
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -686,16 +702,29 @@ static int custom_read(menu_entry *me, const char *var, const char *val)
|
|||
|
||||
static unsigned int keys_encountered = 0;
|
||||
|
||||
static void keys_parse(const char *var, const char *val, int binds[32], const char * const names[32])
|
||||
static void keys_parse(const char *var, const char *val, int binds[32],
|
||||
const char * const names[32], int max_keys)
|
||||
{
|
||||
int t, i;
|
||||
unsigned int player;
|
||||
|
||||
for (t = 0; t < 32; t++)
|
||||
{
|
||||
if (strcmp(names[t], var) == 0) break;
|
||||
if (names[t] && strcmp(names[t], var) == 0) break;
|
||||
}
|
||||
if (t == 32) {
|
||||
if (t == 32)
|
||||
{
|
||||
int len = strlen(var);
|
||||
if (len == 1) t = var[0];
|
||||
else if (len >= 4 && var[0] == '\\' && var[1] == 'x') {
|
||||
char *p;
|
||||
t = (int)strtoul(var + 2, &p, 16);
|
||||
if (*p != 0) t = max_keys; // parse failed
|
||||
}
|
||||
else
|
||||
t = max_keys; // invalid
|
||||
}
|
||||
if (t < 0 || t >= max_keys) {
|
||||
lprintf("unhandled bind \"%s\"\n", var);
|
||||
return;
|
||||
}
|
||||
|
@ -732,7 +761,7 @@ fail:
|
|||
|
||||
#define try_joy_parse(num) { \
|
||||
if (strncasecmp(var, "bind_joy"#num " ", 10) == 0) { \
|
||||
keys_parse(var + 10, val, currentConfig.JoyBinds[num], joyKeyNames); \
|
||||
keys_parse(var + 10, val, currentConfig.JoyBinds[num], joyKeyNames, 32); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
@ -752,13 +781,15 @@ static void parse(const char *var, const char *val)
|
|||
|
||||
// key binds
|
||||
if (strncasecmp(var, "bind ", 5) == 0) {
|
||||
keys_parse(var + 5, val, currentConfig.KeyBinds, keyNames);
|
||||
keys_parse(var + 5, val, currentConfig.KeyBinds, keyNames, PLAT_MAX_KEYS);
|
||||
return;
|
||||
}
|
||||
#if PLAT_HAVE_JOY
|
||||
try_joy_parse(0)
|
||||
try_joy_parse(1)
|
||||
try_joy_parse(2)
|
||||
try_joy_parse(3)
|
||||
#endif
|
||||
|
||||
for (t = 0; t < sizeof(cfg_opts) / sizeof(cfg_opts[0]) && ret == 0; t++)
|
||||
{
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
char *PicoConfigFile = "config.cfg";
|
||||
currentConfig_t currentConfig, defaultConfig;
|
||||
int rom_loaded = 0;
|
||||
char noticeMsg[64];
|
||||
char noticeMsg[64] = { 0, };
|
||||
int state_slot = 0;
|
||||
int config_slot = 0, config_slot_current = 0;
|
||||
char lastRomFile[512];
|
||||
char loadedRomFName[512] = { 0, };
|
||||
int kb_combo_keys = 0, kb_combo_acts = 0; // keys and actions which need button combos
|
||||
int pico_inp_mode = 0;
|
||||
|
||||
|
@ -37,10 +37,8 @@ unsigned char *movie_data = NULL;
|
|||
static int movie_size = 0;
|
||||
|
||||
// provided by platform code:
|
||||
extern char romFileName[];
|
||||
extern void emu_noticeMsgUpdated(void);
|
||||
extern void emu_getMainDir(char *dst, int len);
|
||||
extern void emu_setDefaultConfig(void);
|
||||
extern int emu_getMainDir(char *dst, int len);
|
||||
extern void menu_romload_prepare(const char *rom_name);
|
||||
extern void menu_romload_end(void);
|
||||
|
||||
|
@ -51,17 +49,17 @@ static void strlwr_(char* string)
|
|||
while ( (*string++ = (char)tolower(*string)) );
|
||||
}
|
||||
|
||||
static int try_rfn_cut(void)
|
||||
static int try_rfn_cut(char *fname)
|
||||
{
|
||||
FILE *tmp;
|
||||
char *p;
|
||||
|
||||
p = romFileName + strlen(romFileName) - 1;
|
||||
for (; p > romFileName; p--)
|
||||
p = fname + strlen(fname) - 1;
|
||||
for (; p > fname; p--)
|
||||
if (*p == '.') break;
|
||||
*p = 0;
|
||||
|
||||
if((tmp = fopen(romFileName, "rb"))) {
|
||||
if((tmp = fopen(fname, "rb"))) {
|
||||
fclose(tmp);
|
||||
return 1;
|
||||
}
|
||||
|
@ -147,20 +145,20 @@ static int emu_isBios(const char *name)
|
|||
|
||||
static unsigned char id_header[0x100];
|
||||
|
||||
/* checks if romFileName points to valid MegaCD image
|
||||
/* checks if fname points to valid MegaCD image
|
||||
* if so, checks for suitable BIOS */
|
||||
int emu_cdCheck(int *pregion)
|
||||
int emu_cdCheck(int *pregion, char *fname_in)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
pm_file *cd_f;
|
||||
int region = 4; // 1: Japan, 4: US, 8: Europe
|
||||
char ext[5], *fname = romFileName;
|
||||
char ext[5], *fname = fname_in;
|
||||
cue_track_type type = CT_UNKNOWN;
|
||||
cue_data_t *cue_data = NULL;
|
||||
|
||||
get_ext(romFileName, ext);
|
||||
get_ext(fname_in, ext);
|
||||
if (strcasecmp(ext, ".cue") == 0) {
|
||||
cue_data = cue_parse(romFileName);
|
||||
cue_data = cue_parse(fname_in);
|
||||
if (cue_data != NULL) {
|
||||
fname = cue_data->tracks[1].fname;
|
||||
type = cue_data->tracks[1].type;
|
||||
|
@ -248,7 +246,7 @@ static int extract_text(char *dest, const unsigned char *src, int len, int swab)
|
|||
|
||||
char *emu_makeRomId(void)
|
||||
{
|
||||
static char id_string[3+0x11+0x11+0x30+16];
|
||||
static char id_string[3+0xe*3+0x3*3+0x30*3+3];
|
||||
int pos, swab = 1;
|
||||
|
||||
if (PicoAHW & PAHW_MCD) {
|
||||
|
@ -268,18 +266,36 @@ char *emu_makeRomId(void)
|
|||
return id_string;
|
||||
}
|
||||
|
||||
int emu_ReloadRom(void)
|
||||
// buffer must be at least 150 byte long
|
||||
void emu_getGameName(char *str150)
|
||||
{
|
||||
int ret, swab = (PicoAHW & PAHW_MCD) ? 0 : 1;
|
||||
char *s, *d;
|
||||
|
||||
ret = extract_text(str150, id_header + 0x50, 0x30, swab); // overseas name
|
||||
|
||||
for (s = d = str150 + 1; s < str150+ret; s++)
|
||||
{
|
||||
if (*s == 0) break;
|
||||
if (*s != ' ' || d[-1] != ' ')
|
||||
*d++ = *s;
|
||||
}
|
||||
*d = 0;
|
||||
}
|
||||
|
||||
// note: this function might mangle rom_fname
|
||||
int emu_ReloadRom(char *rom_fname)
|
||||
{
|
||||
unsigned int rom_size = 0;
|
||||
char *used_rom_name = romFileName;
|
||||
char *used_rom_name = rom_fname;
|
||||
unsigned char *rom_data = NULL;
|
||||
char ext[5];
|
||||
pm_file *rom = NULL;
|
||||
int ret, cd_state, cd_region, cfg_loaded = 0;
|
||||
|
||||
lprintf("emu_ReloadRom(%s)\n", romFileName);
|
||||
lprintf("emu_ReloadRom(%s)\n", rom_fname);
|
||||
|
||||
get_ext(romFileName, ext);
|
||||
get_ext(rom_fname, ext);
|
||||
|
||||
// detect wrong extensions
|
||||
if (!strcmp(ext, ".srm") || !strcmp(ext, "s.gz") || !strcmp(ext, ".mds")) { // s.gz ~ .mds.gz
|
||||
|
@ -298,7 +314,7 @@ int emu_ReloadRom(void)
|
|||
{
|
||||
// check for both gmv and rom
|
||||
int dummy;
|
||||
FILE *movie_file = fopen(romFileName, "rb");
|
||||
FILE *movie_file = fopen(rom_fname, "rb");
|
||||
if(!movie_file) {
|
||||
sprintf(menuErrorMsg, "Failed to open movie.");
|
||||
return 0;
|
||||
|
@ -323,29 +339,29 @@ int emu_ReloadRom(void)
|
|||
sprintf(menuErrorMsg, "Invalid GMV file.");
|
||||
return 0;
|
||||
}
|
||||
dummy = try_rfn_cut() || try_rfn_cut();
|
||||
dummy = try_rfn_cut(rom_fname) || try_rfn_cut(rom_fname);
|
||||
if (!dummy) {
|
||||
sprintf(menuErrorMsg, "Could't find a ROM for movie.");
|
||||
return 0;
|
||||
}
|
||||
get_ext(romFileName, ext);
|
||||
get_ext(rom_fname, ext);
|
||||
}
|
||||
else if (!strcmp(ext, ".pat")) {
|
||||
else if (!strcmp(ext, ".pat"))
|
||||
{
|
||||
int dummy;
|
||||
PicoPatchLoad(romFileName);
|
||||
dummy = try_rfn_cut() || try_rfn_cut();
|
||||
PicoPatchLoad(rom_fname);
|
||||
dummy = try_rfn_cut(rom_fname) || try_rfn_cut(rom_fname);
|
||||
if (!dummy) {
|
||||
sprintf(menuErrorMsg, "Could't find a ROM to patch.");
|
||||
return 0;
|
||||
}
|
||||
get_ext(romFileName, ext);
|
||||
get_ext(rom_fname, ext);
|
||||
}
|
||||
|
||||
if ((PicoAHW & PAHW_MCD) && Pico_mcd != NULL)
|
||||
Stop_CD();
|
||||
emu_shutdownMCD();
|
||||
|
||||
// check for MegaCD image
|
||||
cd_state = emu_cdCheck(&cd_region);
|
||||
cd_state = emu_cdCheck(&cd_region, rom_fname);
|
||||
if (cd_state >= 0 && cd_state != CIT_NOT_CD)
|
||||
{
|
||||
PicoAHW |= PAHW_MCD;
|
||||
|
@ -422,7 +438,7 @@ int emu_ReloadRom(void)
|
|||
|
||||
// insert CD if it was detected
|
||||
if (cd_state != CIT_NOT_CD) {
|
||||
ret = Insert_CD(romFileName, cd_state);
|
||||
ret = Insert_CD(rom_fname, cd_state);
|
||||
if (ret != 0) {
|
||||
sprintf(menuErrorMsg, "Insert_CD() failed, invalid CD image?");
|
||||
lprintf("%s\n", menuErrorMsg);
|
||||
|
@ -468,11 +484,11 @@ int emu_ReloadRom(void)
|
|||
emu_noticeMsgUpdated();
|
||||
|
||||
// load SRAM for this ROM
|
||||
if (currentConfig.EmuOpt & 1)
|
||||
if (currentConfig.EmuOpt & EOPT_USE_SRAM)
|
||||
emu_SaveLoadGame(1, 1);
|
||||
|
||||
strncpy(lastRomFile, romFileName, sizeof(lastRomFile)-1);
|
||||
lastRomFile[sizeof(lastRomFile)-1] = 0;
|
||||
strncpy(loadedRomFName, rom_fname, sizeof(loadedRomFName)-1);
|
||||
loadedRomFName[sizeof(loadedRomFName)-1] = 0;
|
||||
rom_loaded = 1;
|
||||
return 1;
|
||||
|
||||
|
@ -484,18 +500,30 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
void emu_shutdownMCD(void)
|
||||
{
|
||||
if ((PicoAHW & PAHW_MCD) && Pico_mcd != NULL)
|
||||
Stop_CD();
|
||||
PicoAHW &= ~PAHW_MCD;
|
||||
}
|
||||
|
||||
static void romfname_ext(char *dst, const char *prefix, const char *ext)
|
||||
{
|
||||
char *p;
|
||||
int prefix_len = 0;
|
||||
|
||||
// make save filename
|
||||
for (p = romFileName+strlen(romFileName)-1; p >= romFileName && *p != '/'; p--); p++;
|
||||
p = loadedRomFName+strlen(loadedRomFName)-1;
|
||||
for (; p >= loadedRomFName && *p != PATH_SEP_C; p--); p++;
|
||||
*dst = 0;
|
||||
if (prefix) {
|
||||
strcpy(dst, prefix);
|
||||
prefix_len = strlen(prefix);
|
||||
int len = emu_getMainDir(dst, 512);
|
||||
strcpy(dst + len, prefix);
|
||||
prefix_len = len + strlen(prefix);
|
||||
}
|
||||
#ifdef UIQ3
|
||||
else p = loadedRomFName; // backward compatibility
|
||||
#endif
|
||||
strncpy(dst + prefix_len, p, 511-prefix_len);
|
||||
dst[511-8] = 0;
|
||||
if (dst[strlen(dst)-4] == '.') dst[strlen(dst)-4] = 0;
|
||||
|
@ -505,7 +533,9 @@ static void romfname_ext(char *dst, const char *prefix, const char *ext)
|
|||
|
||||
static void make_config_cfg(char *cfg)
|
||||
{
|
||||
strncpy(cfg, PicoConfigFile, 511);
|
||||
int len;
|
||||
len = emu_getMainDir(cfg, 512);
|
||||
strncpy(cfg + len, PicoConfigFile, 512-6-1-len);
|
||||
if (config_slot != 0)
|
||||
{
|
||||
char *p = strrchr(cfg, '.');
|
||||
|
@ -515,10 +545,34 @@ static void make_config_cfg(char *cfg)
|
|||
cfg[511] = 0;
|
||||
}
|
||||
|
||||
void emu_packConfig(void)
|
||||
{
|
||||
currentConfig.s_PicoOpt = PicoOpt;
|
||||
currentConfig.s_PsndRate = PsndRate;
|
||||
currentConfig.s_PicoRegion = PicoRegionOverride;
|
||||
currentConfig.s_PicoAutoRgnOrder = PicoAutoRgnOrder;
|
||||
currentConfig.s_PicoCDBuffers = PicoCDBuffers;
|
||||
}
|
||||
|
||||
void emu_unpackConfig(void)
|
||||
{
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
|
||||
}
|
||||
|
||||
static void emu_setDefaultConfig(void)
|
||||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
emu_unpackConfig();
|
||||
}
|
||||
|
||||
|
||||
int emu_ReadConfig(int game, int no_defaults)
|
||||
{
|
||||
char cfg[512];
|
||||
FILE *f;
|
||||
int ret;
|
||||
|
||||
if (!game)
|
||||
|
@ -554,37 +608,7 @@ int emu_ReadConfig(int game, int no_defaults)
|
|||
ret = config_readsect("game_def.cfg", sect);
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
// fall back to old game specific cfg
|
||||
char extbuf[16];
|
||||
if (config_slot != 0)
|
||||
sprintf(extbuf, ".%i.pbcfg", config_slot);
|
||||
else strcpy(extbuf, ".pbcfg");
|
||||
romfname_ext(cfg, "cfg/", extbuf);
|
||||
f = fopen(cfg, "rb");
|
||||
if (!f) {
|
||||
romfname_ext(cfg, NULL, ".pbcfg");
|
||||
f = fopen(cfg, "rb");
|
||||
}
|
||||
if (f) {
|
||||
int bread;
|
||||
fseek(f, 512, SEEK_SET); // skip unused lrom buffer
|
||||
bread = fread(¤tConfig, 1, sizeof(currentConfig), f);
|
||||
lprintf("emu_ReadConfig: %s %s\n", cfg, bread > 0 ? "(ok)" : "(failed)");
|
||||
fclose(f);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
// PicoCDBuffers = currentConfig.s_PicoCDBuffers; // ignore in this case
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ret == 0)
|
||||
{
|
||||
lprintf("loaded cfg from sect \"%s\"\n", sect);
|
||||
}
|
||||
|
@ -618,14 +642,7 @@ int emu_WriteConfig(int is_game)
|
|||
|
||||
if (!is_game)
|
||||
{
|
||||
strncpy(cfg, PicoConfigFile, 511);
|
||||
if (config_slot != 0)
|
||||
{
|
||||
char *p = strrchr(cfg, '.');
|
||||
if (p == NULL) p = cfg + strlen(cfg);
|
||||
sprintf(p, ".%i.cfg", config_slot);
|
||||
}
|
||||
cfg[511] = 0;
|
||||
make_config_cfg(cfg);
|
||||
write_lrom = 1;
|
||||
} else {
|
||||
if (config_slot != 0)
|
||||
|
@ -648,6 +665,7 @@ int emu_WriteConfig(int is_game)
|
|||
}
|
||||
|
||||
|
||||
#ifndef UIQ3
|
||||
void emu_textOut8(int x, int y, const char *text)
|
||||
{
|
||||
int i,l,len=strlen(text);
|
||||
|
@ -694,6 +712,7 @@ void emu_textOut16(int x, int y, const char *text)
|
|||
screen += 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PSP
|
||||
#define MAX_COMBO_KEY 23
|
||||
|
@ -802,7 +821,7 @@ char *emu_GetSaveFName(int load, int is_sram, int slot)
|
|||
|
||||
if (is_sram)
|
||||
{
|
||||
romfname_ext(saveFname, (PicoAHW&1) ? "brm/" : "srm/", (PicoAHW&1) ? ".brm" : ".srm");
|
||||
romfname_ext(saveFname, (PicoAHW&1) ? "brm"PATH_SEP : "srm"PATH_SEP, (PicoAHW&1) ? ".brm" : ".srm");
|
||||
if (load) {
|
||||
if (try_ropen_file(saveFname)) return saveFname;
|
||||
// try in current dir..
|
||||
|
@ -815,19 +834,21 @@ char *emu_GetSaveFName(int load, int is_sram, int slot)
|
|||
{
|
||||
ext[0] = 0;
|
||||
if(slot > 0 && slot < 10) sprintf(ext, ".%i", slot);
|
||||
strcat(ext, (currentConfig.EmuOpt & 8) ? ".mds.gz" : ".mds");
|
||||
strcat(ext, (currentConfig.EmuOpt & EOPT_GZIP_SAVES) ? ".mds.gz" : ".mds");
|
||||
|
||||
romfname_ext(saveFname, "mds/", ext);
|
||||
romfname_ext(saveFname, "mds" PATH_SEP, ext);
|
||||
if (load) {
|
||||
if (try_ropen_file(saveFname)) return saveFname;
|
||||
romfname_ext(saveFname, NULL, ext);
|
||||
if (try_ropen_file(saveFname)) return saveFname;
|
||||
if (currentConfig.EmuOpt & 8) {
|
||||
// no gzipped states, search for non-gzipped
|
||||
if (currentConfig.EmuOpt & EOPT_GZIP_SAVES)
|
||||
{
|
||||
ext[0] = 0;
|
||||
if(slot > 0 && slot < 10) sprintf(ext, ".%i", slot);
|
||||
strcat(ext, ".mds");
|
||||
|
||||
romfname_ext(saveFname, "mds/", ext);
|
||||
romfname_ext(saveFname, "mds"PATH_SEP, ext);
|
||||
if (try_ropen_file(saveFname)) return saveFname;
|
||||
romfname_ext(saveFname, NULL, ext);
|
||||
if (try_ropen_file(saveFname)) return saveFname;
|
||||
|
|
|
@ -3,7 +3,18 @@
|
|||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
typedef struct {
|
||||
#include "port_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EOPT_USE_SRAM (1<<0)
|
||||
#define EOPT_SHOW_FPS (1<<1)
|
||||
#define EOPT_EN_SOUND (1<<2)
|
||||
#define EOPT_GZIP_SAVES (1<<3)
|
||||
|
||||
typedef struct _currentConfig_t {
|
||||
// char lastRomFile[512];
|
||||
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,
|
||||
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
||||
|
@ -13,15 +24,18 @@ typedef struct {
|
|||
int s_PicoOpt; // for old cfg files only
|
||||
int s_PsndRate;
|
||||
int s_PicoRegion;
|
||||
int Frameskip;
|
||||
int CPUclock;
|
||||
int KeyBinds[32];
|
||||
int volume;
|
||||
int gamma;
|
||||
int JoyBinds[4][32];
|
||||
int s_PicoAutoRgnOrder;
|
||||
int s_PicoCDBuffers;
|
||||
int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering
|
||||
int Frameskip;
|
||||
int CPUclock;
|
||||
int KeyBinds[PLAT_MAX_KEYS];
|
||||
int volume;
|
||||
int gamma;
|
||||
#if PLAT_HAVE_JOY
|
||||
int JoyBinds[4][32];
|
||||
#endif
|
||||
int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering
|
||||
int rotation; // for UIQ
|
||||
float scale; // psp: screen scale
|
||||
float hscale32, hscale40; // psp: horizontal scale
|
||||
int gamma2; // psp: black level
|
||||
|
@ -35,12 +49,12 @@ extern char noticeMsg[64];
|
|||
extern int state_slot;
|
||||
extern int config_slot, config_slot_current;
|
||||
extern unsigned char *movie_data;
|
||||
extern char lastRomFile[512];
|
||||
extern char loadedRomFName[512]; // last loaded ROM filename
|
||||
extern int kb_combo_keys, kb_combo_acts; // keys and actions which need button combos
|
||||
extern int pico_inp_mode;
|
||||
|
||||
|
||||
int emu_ReloadRom(void);
|
||||
int emu_ReloadRom(char *rom_fname);
|
||||
int emu_SaveLoadGame(int load, int sram);
|
||||
int emu_ReadConfig(int game, int no_defaults);
|
||||
int emu_WriteConfig(int game);
|
||||
|
@ -48,17 +62,26 @@ char *emu_GetSaveFName(int load, int is_sram, int slot);
|
|||
int emu_checkSaveFile(int slot);
|
||||
void emu_setSaveStateCbs(int gz);
|
||||
void emu_updateMovie(void);
|
||||
int emu_cdCheck(int *pregion);
|
||||
int emu_cdCheck(int *pregion, char *fname_in);
|
||||
int emu_findBios(int region, char **bios_file);
|
||||
void emu_textOut8 (int x, int y, const char *text);
|
||||
void emu_textOut16(int x, int y, const char *text);
|
||||
char *emu_makeRomId(void);
|
||||
void emu_getGameName(char *str150);
|
||||
void emu_findKeyBindCombos(void);
|
||||
void emu_forcedFrame(int opts);
|
||||
void emu_changeFastForward(int set_on);
|
||||
void emu_RunEventsPico(unsigned int events);
|
||||
void emu_DoTurbo(int *pad, int acts);
|
||||
void emu_packConfig(void);
|
||||
void emu_unpackConfig(void);
|
||||
void emu_shutdownMCD(void);
|
||||
|
||||
extern const char * const keyNames[];
|
||||
void emu_prepareDefaultConfig(void);
|
||||
void emu_platformDebugCat(char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ me_bind_action me_ctrl_actions[15] =
|
|||
};
|
||||
|
||||
|
||||
#ifndef UIQ3
|
||||
|
||||
static unsigned char menu_font_data[10240];
|
||||
static int menu_text_color = 0xffff; // default to white
|
||||
static int menu_sel_color = -1; // disabled
|
||||
|
@ -331,28 +333,6 @@ int me_process(menu_entry *entries, int count, menu_id id, int is_next)
|
|||
}
|
||||
}
|
||||
|
||||
const char *me_region_name(unsigned int code, int auto_order)
|
||||
{
|
||||
static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
|
||||
static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
|
||||
int u, i = 0;
|
||||
if (code) {
|
||||
code <<= 1;
|
||||
while((code >>= 1)) i++;
|
||||
if (i > 4) return "unknown";
|
||||
return names[i];
|
||||
} else {
|
||||
static char name[24];
|
||||
strcpy(name, "Auto:");
|
||||
for (u = 0; u < 3; u++) {
|
||||
i = 0; code = ((auto_order >> u*4) & 0xf) << 1;
|
||||
while((code >>= 1)) i++;
|
||||
strcat(name, names_short[i]);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------ debug menu ------------
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@ -472,4 +452,30 @@ void debug_menu_loop(void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif // !UIQ3
|
||||
|
||||
// ------------ util ------------
|
||||
|
||||
const char *me_region_name(unsigned int code, int auto_order)
|
||||
{
|
||||
static const char *names[] = { "Auto", " Japan NTSC", " Japan PAL", " USA", " Europe" };
|
||||
static const char *names_short[] = { "", " JP", " JP", " US", " EU" };
|
||||
int u, i = 0;
|
||||
if (code) {
|
||||
code <<= 1;
|
||||
while((code >>= 1)) i++;
|
||||
if (i > 4) return "unknown";
|
||||
return names[i];
|
||||
} else {
|
||||
static char name[24];
|
||||
strcpy(name, "Auto:");
|
||||
for (u = 0; u < 3; u++) {
|
||||
i = 0; code = ((auto_order >> u*4) & 0xf) << 1;
|
||||
while((code >>= 1)) i++;
|
||||
strcat(name, names_short[i]);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef enum
|
|||
MA_OPT_SAVECFG_GAME,
|
||||
MA_OPT_LOADCFG,
|
||||
MA_OPT_INTERLACED, /* giz */
|
||||
MA_OPT_ROTATION, /* uiq */
|
||||
MA_OPT2_GAMMA,
|
||||
MA_OPT2_A_SN_GAMMA,
|
||||
MA_OPT2_DBLBUFF, /* giz */
|
||||
|
|
|
@ -28,8 +28,9 @@ ifeq "$(profile)" "2"
|
|||
COPT_COMMON += -fprofile-use
|
||||
endif
|
||||
CFLAGS = $(COPT_COMMON) -mcpu=arm920t -mtune=arm920t
|
||||
SFLAGS = $(CFLAGS)
|
||||
ASFLAGS = -mcpu=arm920t -mfloat-abi=soft
|
||||
GCC = $(CROSS)gcc
|
||||
CC = $(CROSS)gcc
|
||||
STRIP = $(CROSS)strip
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
|
@ -115,7 +116,7 @@ all: mkdirs PicoDrive.exe readme.txt
|
|||
|
||||
PicoDrive.exe : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a
|
||||
@echo ">>>" $@
|
||||
$(GCC) -o $@ -static $(CFLAGS) $^ -lm -lpng -Lkgsdk/ -lKGSDK -Wl,-Map=PicoDrive.map \
|
||||
$(CC) -o $@ -static $(CFLAGS) $^ -lm -lpng -Lkgsdk/ -lKGSDK -Wl,-Map=PicoDrive.map \
|
||||
2>&1 | grep -v ".idata$$4" # | grep -v "supports interworking, whereas"
|
||||
ifeq ($(DEBUG),)
|
||||
$(STRIP) $@
|
||||
|
@ -125,66 +126,10 @@ ifeq "$(profile)" "1"
|
|||
endif
|
||||
|
||||
|
||||
.c.o:
|
||||
@echo ">>>" $<
|
||||
$(GCC) $(CFLAGS) $(DEFINC) -c $< -o $@
|
||||
#.s.o:
|
||||
# @echo $<
|
||||
# $(GCC) $(CFLAGS) $(DEFINC) -c $< -o $@
|
||||
|
||||
mkdirs:
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c
|
||||
|
||||
Pico/draw_asm.o : ../../Pico/Draw.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/draw2_asm.o : ../../Pico/Draw2.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/memory_asm.o : ../../Pico/Memory.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/sound/mix_asm.o : ../../Pico/sound/mix.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/misc_asm.o : ../../Pico/Misc.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s
|
||||
@echo ">>>" $@
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
Pico/carthw/svp/stub_arm.o : ../../Pico/carthw/svp/stub_arm.S
|
||||
@echo ">>>" $@
|
||||
$(GCC) $(CFLAGS) $(DEFINC) -c $< -o $@
|
||||
|
||||
# build Cyclone
|
||||
cpu/Cyclone/proj/Cyclone.s:
|
||||
@echo building Cyclone...
|
||||
@make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h
|
||||
|
||||
Pico/Pico.o Pico/cd/Pico.o: ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h
|
||||
Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h
|
||||
|
||||
# build helix libs
|
||||
../common/helix/$(CROSS)helix-mp3.a:
|
||||
make -C ../common/helix clean all
|
||||
|
||||
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||
../../tools/textfilter ../base_readme.txt $@ GIZ
|
||||
|
||||
../../tools/textfilter: ../../tools/textfilter.c
|
||||
make -C ../../tools/ textfilter
|
||||
include ../common/common_arm.mak
|
||||
|
||||
|
||||
# cleanup
|
||||
|
@ -194,10 +139,6 @@ tidy:
|
|||
@$(RM) $(OBJS)
|
||||
|
||||
|
||||
clean_prof:
|
||||
find ../.. -name '*.gcno' -delete
|
||||
find ../.. -name '*.gcda' -delete
|
||||
|
||||
up: PicoDrive.exe
|
||||
synce-pcp -d 3 PicoDrive.exe ":/SD Card/emus/PicoDrive/PicoDrive.exe"
|
||||
|
||||
|
|
|
@ -45,9 +45,11 @@ void emu_noticeMsgUpdated(void)
|
|||
noticeMsgTime = GetTickCount();
|
||||
}
|
||||
|
||||
void emu_getMainDir(char *dst, int len)
|
||||
int emu_getMainDir(char *dst, int len)
|
||||
{
|
||||
if (len > 0) *dst = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void emu_msg_cb(const char *msg)
|
||||
|
@ -143,16 +145,6 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.turbo_rate = 15;
|
||||
}
|
||||
|
||||
void emu_setDefaultConfig(void)
|
||||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
|
||||
}
|
||||
|
||||
|
||||
static int EmuScanBegin16(unsigned int num)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
|
|||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom())
|
||||
if (emu_ReloadRom(romFileName))
|
||||
engineState = PGS_Running;
|
||||
else {
|
||||
lprintf("PGS_ReloadRom == 0\n");
|
||||
|
|
|
@ -813,7 +813,7 @@ menu_entry cdopt_entries[] =
|
|||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
|
||||
|
@ -1438,10 +1438,10 @@ static void menu_loop_root(void)
|
|||
{
|
||||
char curr_path[MAX_PATH], *selfname;
|
||||
FILE *tstf;
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
getcwd(curr_path, MAX_PATH);
|
||||
|
@ -1586,10 +1586,10 @@ int menu_loop_tray(void)
|
|||
|
||||
menu_gfx_prepare();
|
||||
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1613,7 +1613,7 @@ int menu_loop_tray(void)
|
|||
if (selfname) {
|
||||
int ret = -1;
|
||||
cd_img_type cd_type;
|
||||
cd_type = emu_cdCheck(NULL);
|
||||
cd_type = emu_cdCheck(NULL, romFileName);
|
||||
if (cd_type != CIT_NOT_CD)
|
||||
ret = Insert_CD(romFileName, cd_type);
|
||||
if (ret != 0) {
|
||||
|
|
|
@ -24,4 +24,10 @@
|
|||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
|
||||
// platform
|
||||
#define PLAT_MAX_KEYS 32
|
||||
#define PLAT_HAVE_JOY 0
|
||||
#define PATH_SEP "/" // because of cegcc
|
||||
#define PATH_SEP_C '/'
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
|
|
|
@ -44,16 +44,17 @@ endif
|
|||
ifeq "$(profile)" "2"
|
||||
COPT_COMMON += -fprofile-use
|
||||
endif
|
||||
COPT = $(COPT_COMMON) -mtune=arm920t
|
||||
ASOPT = -mcpu=arm920t -mfloat-abi=soft
|
||||
GCC = $(CROSS)gcc
|
||||
CFLAGS = $(COPT_COMMON) -mcpu=arm920t -mtune=arm920t
|
||||
SFLAGS = $(CFLAGS)
|
||||
ASFLAGS = -mcpu=arm920t -mfloat-abi=soft
|
||||
CC = $(CROSS)gcc
|
||||
STRIP = $(CROSS)strip
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
OBJCOPY = $(CROSS)objcopy
|
||||
|
||||
# frontend
|
||||
OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o
|
||||
OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o asm_utils.o
|
||||
# 940 core control
|
||||
OBJS += 940ctl.o
|
||||
|
||||
|
@ -149,7 +150,7 @@ all: mkdirs PicoDrive.gpe
|
|||
|
||||
PicoDrive.gpe : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a
|
||||
@echo ">>>" $@
|
||||
$(GCC) -o $@ $(COPT) $^ -lm -lpng -Wl,-Map=PicoDrive.map
|
||||
$(CC) -o $@ $(CFLAGS) $^ -lm -lpng -Wl,-Map=PicoDrive.map
|
||||
ifeq ($(DEBUG),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
@ -168,75 +169,10 @@ tidy:
|
|||
# @make -C ../../cpu/Cyclone/proj -f Makefile.linux clean
|
||||
|
||||
|
||||
clean_prof:
|
||||
find ../.. -name '*.gcno' -delete
|
||||
find ../.. -name '*.gcda' -delete
|
||||
|
||||
|
||||
mkdirs:
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
.c.o:
|
||||
@echo ">>>" $<
|
||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||
.s.o:
|
||||
@echo ">>>" $<
|
||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||
.S.o:
|
||||
@echo ">>>" $<
|
||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||
|
||||
Pico/carthw/svp/compiler.o : ../../Pico/carthw/svp/ssp16.o ../../Pico/carthw/svp/gen_arm.c
|
||||
|
||||
Pico/draw_asm.o : ../../Pico/Draw.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/draw2_asm.o : ../../Pico/Draw2.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/memory_asm.o : ../../Pico/Memory.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/sound/mix_asm.o : ../../Pico/sound/mix.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/misc_asm.o : ../../Pico/Misc.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
Pico/cd/misc_asm.o : ../../Pico/cd/Misc.s
|
||||
@echo ">>>" $<
|
||||
$(AS) $(ASOPT) $< -o $@
|
||||
|
||||
# build Cyclone
|
||||
../../cpu/Cyclone/proj/Cyclone.s :
|
||||
@echo building Cyclone...
|
||||
@make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h
|
||||
|
||||
../../cpu/musashi/m68kops.c :
|
||||
@make -C ../../cpu/musashi
|
||||
|
||||
Pico/Pico.o Pico/cd/Pico.o: ../../Pico/PicoFrameHints.c ../../Pico/PicoInt.h
|
||||
Pico/Memory.o Pico/cd/Memory.o : ../../Pico/MemoryCmn.c ../../Pico/PicoInt.h
|
||||
|
||||
# build helix libs
|
||||
../common/helix/$(CROSS)helix-mp3.a:
|
||||
make -C ../common/helix clean all
|
||||
|
||||
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||
../../tools/textfilter ../base_readme.txt $@ GP2X
|
||||
|
||||
../../tools/textfilter: ../../tools/textfilter.c
|
||||
make -C ../../tools/ textfilter
|
||||
|
||||
include ../common/common_arm.mak
|
||||
|
||||
# ----------- release -----------
|
||||
ifneq ($(findstring rel,$(MAKECMDGOALS)),)
|
||||
|
|
|
@ -49,7 +49,6 @@ static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
|
|||
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||
static int osd_fps_x;
|
||||
static int gp2x_old_gamma = 100;
|
||||
char noticeMsg[64]; // notice msg to draw
|
||||
unsigned char *PicoDraw2FB = NULL; // temporary buffer for alt renderer
|
||||
int reset_timing = 0;
|
||||
|
||||
|
@ -66,7 +65,7 @@ void emu_noticeMsgUpdated(void)
|
|||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
|
||||
void emu_getMainDir(char *dst, int len)
|
||||
int emu_getMainDir(char *dst, int len)
|
||||
{
|
||||
extern char **g_argv;
|
||||
int j;
|
||||
|
@ -77,6 +76,8 @@ void emu_getMainDir(char *dst, int len)
|
|||
dst[len] = 0;
|
||||
for (j = strlen(dst); j > 0; j--)
|
||||
if (dst[j] == '/') { dst[j+1] = 0; break; }
|
||||
|
||||
return j + 1;
|
||||
}
|
||||
|
||||
void emu_Init(void)
|
||||
|
@ -167,16 +168,6 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.turbo_rate = 15;
|
||||
}
|
||||
|
||||
void emu_setDefaultConfig(void)
|
||||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
|
||||
}
|
||||
|
||||
void osd_text(int x, int y, const char *text)
|
||||
{
|
||||
int len = strlen(text)*8;
|
||||
|
|
|
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (engineState == PGS_ReloadRom)
|
||||
{
|
||||
if (emu_ReloadRom()) {
|
||||
if (emu_ReloadRom(romFileName)) {
|
||||
engineState = PGS_Running;
|
||||
if (load_state_slot >= 0) {
|
||||
state_slot = load_state_slot;
|
||||
|
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom())
|
||||
if (emu_ReloadRom(romFileName))
|
||||
engineState = PGS_Running;
|
||||
else {
|
||||
printf("PGS_ReloadRom == 0\n");
|
||||
|
|
|
@ -901,7 +901,7 @@ menu_entry cdopt_entries[] =
|
|||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
|
||||
|
@ -1551,10 +1551,10 @@ static void menu_loop_root(void)
|
|||
{
|
||||
char curr_path[PATH_MAX], *selfname;
|
||||
FILE *tstf;
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
getcwd(curr_path, PATH_MAX);
|
||||
|
@ -1694,10 +1694,10 @@ int menu_loop_tray(void)
|
|||
gp2x_memset_all_buffers(0, 0, 320*240*2);
|
||||
menu_gfx_prepare();
|
||||
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1721,7 +1721,7 @@ int menu_loop_tray(void)
|
|||
if (selfname) {
|
||||
int ret = -1;
|
||||
cd_img_type cd_type;
|
||||
cd_type = emu_cdCheck(NULL);
|
||||
cd_type = emu_cdCheck(NULL, romFileName);
|
||||
if (cd_type != CIT_NOT_CD)
|
||||
ret = Insert_CD(romFileName, cd_type);
|
||||
if (ret != 0) {
|
||||
|
|
|
@ -24,4 +24,10 @@
|
|||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
|
||||
// platform
|
||||
#define PLAT_MAX_KEYS 32
|
||||
#define PLAT_HAVE_JOY 1
|
||||
#define PATH_SEP "/"
|
||||
#define PATH_SEP_C '/'
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
|
|
|
@ -48,7 +48,6 @@ char romFileName[PATH_MAX];
|
|||
static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
|
||||
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||
static int osd_fps_x;
|
||||
char noticeMsg[64]; // notice msg to draw
|
||||
unsigned char *PicoDraw2FB = NULL; // temporary buffer for alt renderer
|
||||
int reset_timing = 0;
|
||||
|
||||
|
@ -65,7 +64,7 @@ void emu_noticeMsgUpdated(void)
|
|||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
|
||||
void emu_getMainDir(char *dst, int len)
|
||||
int emu_getMainDir(char *dst, int len)
|
||||
{
|
||||
extern char **g_argv;
|
||||
int j;
|
||||
|
@ -76,6 +75,8 @@ void emu_getMainDir(char *dst, int len)
|
|||
dst[len] = 0;
|
||||
for (j = strlen(dst); j > 0; j--)
|
||||
if (dst[j] == '/') { dst[j+1] = 0; break; }
|
||||
|
||||
return j + 1;
|
||||
}
|
||||
|
||||
void emu_Init(void)
|
||||
|
@ -151,16 +152,6 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.turbo_rate = 15;
|
||||
}
|
||||
|
||||
void emu_setDefaultConfig(void)
|
||||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
|
||||
}
|
||||
|
||||
static void textOut16(int x, int y, const char *text)
|
||||
{
|
||||
int i,l,len=strlen(text);
|
||||
|
|
|
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (engineState == PGS_ReloadRom)
|
||||
{
|
||||
if (emu_ReloadRom()) {
|
||||
if (emu_ReloadRom(romFileName)) {
|
||||
engineState = PGS_Running;
|
||||
if (load_state_slot >= 0) {
|
||||
state_slot = load_state_slot;
|
||||
|
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom())
|
||||
if (emu_ReloadRom(romFileName))
|
||||
engineState = PGS_Running;
|
||||
else {
|
||||
printf("PGS_ReloadRom == 0\n");
|
||||
|
|
|
@ -24,4 +24,10 @@
|
|||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
|
||||
// platform
|
||||
#define PLAT_MAX_KEYS 32
|
||||
#define PLAT_HAVE_JOY 1
|
||||
#define PATH_SEP "/"
|
||||
#define PATH_SEP_C '/'
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
|
|
|
@ -54,9 +54,10 @@ void emu_noticeMsgUpdated(void)
|
|||
noticeMsgTime = sceKernelGetSystemTimeLow();
|
||||
}
|
||||
|
||||
void emu_getMainDir(char *dst, int len)
|
||||
int emu_getMainDir(char *dst, int len)
|
||||
{
|
||||
if (len > 0) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void osd_text(int x, const char *text, int is_active, int clear_all)
|
||||
|
@ -155,16 +156,6 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.turbo_rate = 15;
|
||||
}
|
||||
|
||||
void emu_setDefaultConfig(void)
|
||||
{
|
||||
memcpy(¤tConfig, &defaultConfig, sizeof(currentConfig));
|
||||
PicoOpt = currentConfig.s_PicoOpt;
|
||||
PsndRate = currentConfig.s_PsndRate;
|
||||
PicoRegionOverride = currentConfig.s_PicoRegion;
|
||||
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
|
||||
PicoCDBuffers = currentConfig.s_PicoCDBuffers;
|
||||
}
|
||||
|
||||
|
||||
extern void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||
extern void amips_clut_6bit(unsigned short *dst, unsigned char *src, unsigned short *pal, int count);
|
||||
|
|
|
@ -52,13 +52,13 @@ int pico_main(void)
|
|||
#ifndef GPROF
|
||||
menu_loop();
|
||||
#else
|
||||
strcpy(romFileName, lastRomFile);
|
||||
strcpy(romFileName, loadedRomFName);
|
||||
engineState = PGS_ReloadRom;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom()) {
|
||||
if (emu_ReloadRom(romFileName)) {
|
||||
engineState = PGS_Running;
|
||||
if (mp3_last_error != 0)
|
||||
engineState = PGS_Menu; // send to menu to display mp3 error
|
||||
|
|
|
@ -825,7 +825,7 @@ menu_entry cdopt_entries[] =
|
|||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_EUR, NULL, 0, 0, 0, 1, 0 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_TESTBIOS_JAP, NULL, 0, 0, 0, 1, 0 },
|
||||
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "CDDA audio", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
|
||||
|
@ -1632,10 +1632,10 @@ static void menu_loop_root(void)
|
|||
{
|
||||
char curr_path[PATH_MAX], *selfname;
|
||||
FILE *tstf;
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
getcwd(curr_path, PATH_MAX);
|
||||
|
@ -1777,10 +1777,10 @@ int menu_loop_tray(void)
|
|||
|
||||
menu_gfx_prepare();
|
||||
|
||||
if ( (tstf = fopen(lastRomFile, "rb")) )
|
||||
if ( (tstf = fopen(loadedRomFName, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, lastRomFile);
|
||||
strcpy(curr_path, loadedRomFName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1804,7 +1804,7 @@ int menu_loop_tray(void)
|
|||
if (selfname) {
|
||||
int ret = -1;
|
||||
cd_img_type cd_type;
|
||||
cd_type = emu_cdCheck(NULL);
|
||||
cd_type = emu_cdCheck(NULL, romFileName);
|
||||
if (cd_type != CIT_NOT_CD)
|
||||
ret = Insert_CD(romFileName, cd_type);
|
||||
if (ret != 0) {
|
||||
|
|
|
@ -28,4 +28,10 @@ extern void blit1(void);
|
|||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
|
||||
// platform
|
||||
#define PLAT_MAX_KEYS 32
|
||||
#define PLAT_HAVE_JOY 0
|
||||
#define PATH_SEP "/"
|
||||
#define PATH_SEP_C '/'
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
*
|
||||
*******************************************************************/
|
||||
|
||||
#include "app.h"
|
||||
#include "App.h"
|
||||
// #include "picodriven.mbg" // bitmap identifiers
|
||||
#include <PicoDrive.RSG> // resource include
|
||||
#include "rsc/picodrive.rsg" // resource include
|
||||
#include <eikenv.h>
|
||||
#include <qbtselectdlg.h>
|
||||
//#include <gulutil.h>
|
||||
|
@ -25,14 +25,15 @@
|
|||
#include <eikedwin.h>
|
||||
#include <s32strm.h>
|
||||
|
||||
#include <QikAppUi.h>
|
||||
#include <QikEditCategoryObserver.h>
|
||||
#include <QikSelectFileDlg.h>
|
||||
#include <QikCommand.h>
|
||||
#include <qikappui.h>
|
||||
#include <qikeditcategoryobserver.h>
|
||||
#include <qikselectfiledlg.h>
|
||||
#include <qikcommand.h>
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "engine/debug.h"
|
||||
|
||||
#include "../common/emu.h"
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
@ -161,37 +162,37 @@ void CPicolAppView::HandleCommandL(CQikCommand& aCommand)
|
|||
break;
|
||||
|
||||
case EEikCmdPicoFrameskipAuto:
|
||||
iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = -1;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdPicoFrameskip0:
|
||||
iCurrentConfig.iFrameskip = 0;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = 0;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdPicoFrameskip1:
|
||||
iCurrentConfig.iFrameskip = 1;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = 1;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdPicoFrameskip2:
|
||||
iCurrentConfig.iFrameskip = 2;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = 2;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdPicoFrameskip4:
|
||||
iCurrentConfig.iFrameskip = 4;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = 4;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdPicoFrameskip8:
|
||||
iCurrentConfig.iFrameskip = 8;
|
||||
iQikAppUi.Document()->SaveL();
|
||||
currentConfig.Frameskip = 8;
|
||||
emu_WriteConfig(0);
|
||||
break;
|
||||
|
||||
case EEikCmdExit:
|
||||
iQikAppUi.Document()->SaveL();
|
||||
emu_Deinit();
|
||||
CPicoGameSession::freeResources();
|
||||
//break; // this is intentional
|
||||
|
||||
|
@ -214,11 +215,14 @@ void CPicolAppView::DisplayOpenROMDialogL()
|
|||
CleanupStack::PushL(fileArray);
|
||||
_LIT16(KDlgTitle, "Select a ROM file");
|
||||
|
||||
TPtrC8 text8((TUint8*) loadedRomFName);
|
||||
iCurrentConfig.iLastROMFile.Copy(text8);
|
||||
|
||||
if( CQikSelectFileDlg::RunDlgLD( *mimeArray, *fileArray, &KDlgTitle, &iCurrentConfig.iLastROMFile) )
|
||||
{
|
||||
CEikonEnv::Static()->BusyMsgL(_L("Loading ROM"));
|
||||
TPtrC16 file = (*fileArray)[0];
|
||||
iCurrentConfig.iLastROMFile.Copy(file);
|
||||
//iCurrentConfig.iLastROMFile.Copy(file);
|
||||
|
||||
// push the config first
|
||||
CPicoGameSession::Do(PicoMsgSetAppView, this);
|
||||
|
@ -271,7 +275,7 @@ void CPicolAppView::DisplayOpenROMDialogL()
|
|||
CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound."));
|
||||
break;
|
||||
}
|
||||
if(res == 6 || res == 7) iCurrentConfig.iFlags &= ~4;
|
||||
if(res == 6 || res == 7) currentConfig.EmuOpt &= ~EOPT_EN_SOUND;
|
||||
|
||||
if(iROMLoaded) {
|
||||
if(iTitleAdded)
|
||||
|
@ -287,11 +291,13 @@ void CPicolAppView::DisplayOpenROMDialogL()
|
|||
|
||||
void CPicolAppView::DisplayConfigDialogL()
|
||||
{
|
||||
CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(iCurrentConfig);
|
||||
CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(currentConfig);
|
||||
emu_packConfig();
|
||||
configDialog->ExecuteLD(R_PICO_CONFIG);
|
||||
emu_unpackConfig();
|
||||
emu_WriteConfig(0);
|
||||
|
||||
CPicoGameSession::Do(PicoMsgConfigChange, &iCurrentConfig);
|
||||
iQikAppUi.Document()->SaveL();
|
||||
CPicoGameSession::Do(PicoMsgConfigChange, ¤tConfig);
|
||||
}
|
||||
|
||||
|
||||
|
@ -311,13 +317,13 @@ void CPicolAppView::DisplayAboutDialogL()
|
|||
}
|
||||
|
||||
#ifdef __DEBUG_PRINT
|
||||
extern "C" char *debugString();
|
||||
extern "C" char *PDebugMain();
|
||||
#endif
|
||||
|
||||
void CPicolAppView::DisplayDebugDialogL()
|
||||
{
|
||||
#ifdef __DEBUG_PRINT
|
||||
CDebugDialog* dialog = new (ELeave) CDebugDialog(debugString());
|
||||
CDebugDialog* dialog = new (ELeave) CDebugDialog(PDebugMain());
|
||||
|
||||
dialog->PrepareLC(R_PICO_DEBUG);
|
||||
dialog->RunLD();
|
||||
|
@ -348,7 +354,7 @@ void CPicolAppView::UpdateCommandList()
|
|||
cmd_resume->SetDimmed(dimmed);
|
||||
|
||||
// frameskip
|
||||
TInt fs_index = iCurrentConfig.iFrameskip + 1;
|
||||
TInt fs_index = currentConfig.Frameskip + 1;
|
||||
if (fs_index >= 0 && fs_index < 10 && cmd_fs[fs_index])
|
||||
{
|
||||
cmd_fs[fs_index]->SetChecked(ETrue);
|
||||
|
@ -384,7 +390,6 @@ void CPicolAppUi::ConstructL()
|
|||
CPicolDocument::CPicolDocument(CQikApplication& aApp)
|
||||
: CQikDocument(aApp)
|
||||
{
|
||||
iCurrentConfig.SetDefaults();
|
||||
}
|
||||
|
||||
CQikAppUi* CPicolDocument::CreateAppUiL()
|
||||
|
@ -397,6 +402,7 @@ Called by the framework when ::SaveL has been called.
|
|||
*/
|
||||
void CPicolDocument::StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const
|
||||
{
|
||||
#if 0
|
||||
RStoreWriteStream stream;
|
||||
|
||||
TStreamId preferenceId = stream.CreateLC(aStore);
|
||||
|
@ -408,7 +414,7 @@ void CPicolDocument::StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic)
|
|||
// Ensures that any buffered data is written to aStore
|
||||
stream.CommitL();
|
||||
CleanupStack::PopAndDestroy(); // stream
|
||||
|
||||
#endif
|
||||
/*
|
||||
// tmp
|
||||
TInt res;
|
||||
|
@ -427,6 +433,7 @@ Loads the application data from disk, i.e. domain data and preferences.
|
|||
*/
|
||||
void CPicolDocument::RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic)
|
||||
{
|
||||
#if 0
|
||||
// Find the stream ID of the model data from the stream dictionary:
|
||||
TStreamId preferenceId(aStreamDic.At(KUidPicolStore));
|
||||
RStoreReadStream stream;
|
||||
|
@ -438,7 +445,7 @@ void CPicolDocument::RestoreL(const CStreamStore& aStore, const CStreamDictionar
|
|||
}
|
||||
|
||||
CleanupStack::PopAndDestroy(); // stream
|
||||
|
||||
#endif
|
||||
|
||||
// tmp
|
||||
/* TInt res;
|
||||
|
@ -475,9 +482,15 @@ TUid CPicolApplication::AppDllUid() const
|
|||
}
|
||||
|
||||
|
||||
extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32);
|
||||
|
||||
GLDEF_C TInt E32Main()
|
||||
{
|
||||
// doesn't work :(
|
||||
User::SetExceptionHandler(ExceptionHandler, (TUint32) -1);
|
||||
// my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff);
|
||||
|
||||
emu_Init();
|
||||
|
||||
return EikStart::RunApplication(NewApplication);
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include <coemain.h>
|
||||
|
||||
#include <qikappui.h>
|
||||
#include <QikApplication.h>
|
||||
#include <QikViewBase.h>
|
||||
#include <qikapplication.h>
|
||||
#include <qikviewbase.h>
|
||||
//#include <eikapp.h>
|
||||
#include <QikDocument.h>
|
||||
#include <qikdocument.h>
|
||||
|
||||
#include "Engine.h"
|
||||
#include "picodrive.hrh"
|
||||
|
@ -41,11 +41,12 @@ const TUid KUidPicolStore = { 0x00000011 }; // store stream UID
|
|||
//};
|
||||
|
||||
|
||||
extern "C" struct _currentConfig_t;
|
||||
|
||||
class CPicolAppView : public CQikViewBase
|
||||
{
|
||||
public:
|
||||
static CPicolAppView* NewLC(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig);
|
||||
static CPicolAppView* NewLC(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig);
|
||||
~CPicolAppView();
|
||||
|
||||
// from CQikViewBase
|
||||
|
@ -53,12 +54,12 @@ public:
|
|||
void HandleCommandL(CQikCommand& aCommand);
|
||||
void UpdateCommandList();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// from CQikViewBase
|
||||
void ViewConstructL();
|
||||
|
||||
|
||||
private:
|
||||
CPicolAppView(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig);
|
||||
CPicolAppView(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig);
|
||||
void ConstructL();
|
||||
|
||||
protected: // new stuf
|
||||
|
@ -71,7 +72,7 @@ protected: // new stuf
|
|||
void RunGameL();*/
|
||||
|
||||
private:
|
||||
TPicoConfig& iCurrentConfig;
|
||||
TPicoConfig &iCurrentConfig;
|
||||
TBool iROMLoaded;
|
||||
TBool iTitleAdded;
|
||||
};
|
||||
|
@ -95,7 +96,7 @@ public:
|
|||
void StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const;
|
||||
void RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic);
|
||||
|
||||
TPicoConfig iCurrentConfig;
|
||||
TPicoConfig iCurrentConfig;
|
||||
|
||||
private: // from CQikDocument
|
||||
CQikAppUi* CreateAppUiL();
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
#include <qikvertoptionbuttonlist.h> // CEikHorOptionButtonList
|
||||
#include <eikopbut.h> // CEikOptionButton
|
||||
#include <eikedwin.h> // CEikEdwin
|
||||
#include <QuartzKeys.h> // EQuartzKeyTwoWayDown
|
||||
#include <quartzkeys.h> // EQuartzKeyTwoWayDown
|
||||
|
||||
#include <QikCommand.h>
|
||||
#include <qikcommand.h>
|
||||
#include "../common/emu.h"
|
||||
|
||||
|
||||
/************************************************
|
||||
|
@ -35,7 +36,7 @@
|
|||
*
|
||||
************************************************/
|
||||
|
||||
CPicoConfigDialog::CPicoConfigDialog(TPicoConfig &cfg) : config(cfg)
|
||||
CPicoConfigDialog::CPicoConfigDialog(_currentConfig_t &cfg) : config(cfg)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,7 @@ void CPicoConfigDialog::PostLayoutDynInitL()
|
|||
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
|
||||
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
|
||||
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
|
||||
CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
|
||||
// CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
|
||||
CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM );
|
||||
CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS );
|
||||
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
|
||||
|
@ -54,41 +55,59 @@ void CPicoConfigDialog::PostLayoutDynInitL()
|
|||
CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality );
|
||||
CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad );
|
||||
CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates );
|
||||
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion );
|
||||
CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 );
|
||||
CEikCheckBox *chkbox_cdda = (CEikCheckBox*) Control( ECtlOptCDcdda );
|
||||
CEikCheckBox *chkbox_pcm = (CEikCheckBox*) Control( ECtlOptCDpcm );
|
||||
CEikCheckBox *chkbox_ramcart= (CEikCheckBox*) Control( ECtlOptCDramcart );
|
||||
CEikCheckBox *chkbox_sclrot = (CEikCheckBox*) Control( ECtlOptCDscalerot );
|
||||
CEikCheckBox *chkbox_bsync = (CEikCheckBox*) Control( ECtlOptCDbettersync );
|
||||
|
||||
buttons_rot ->SetButtonById(ECtlOptRotation0 + config.iScreenRotation);
|
||||
buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.iScreenMode);
|
||||
chkbox_sram ->SetState(config.iFlags & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_fps ->SetState(config.iFlags & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_sound ->SetState(config.iFlags & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_gzipst ->SetState(config.iFlags & 0x80 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_z80 ->SetState(config.iPicoOpt & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_ym2612 ->SetState(config.iPicoOpt & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_sn76496->SetState(config.iPicoOpt & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_altrend->SetState(config.iPicoOpt & 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_6bpad ->SetState(config.iPicoOpt & 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_acctmng->SetState(config.iPicoOpt & 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_accsprt->SetState(config.iPicoOpt & 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
buttons_rot ->SetButtonById(ECtlOptRotation0 + config.rotation);
|
||||
buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.scaling);
|
||||
chkbox_sram ->SetState(config.EmuOpt & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_fps ->SetState(config.EmuOpt & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_sound ->SetState(config.EmuOpt & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_gzipst ->SetState(config.EmuOpt & 8 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_z80 ->SetState(config.s_PicoOpt& 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_ym2612 ->SetState(config.s_PicoOpt& 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_sn76496->SetState(config.s_PicoOpt& 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_altrend->SetState(config.s_PicoOpt& 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_6bpad ->SetState(config.s_PicoOpt& 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
// chkbox_acctmng->SetState(config.s_PicoOpt& 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
// chkbox_accsprt->SetState(config.s_PicoOpt& 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_cdda ->SetState(config.s_PicoOpt&0x0800?CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_pcm ->SetState(config.s_PicoOpt&0x0400?CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_ramcart->SetState(config.s_PicoOpt&0x8000?CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_sclrot ->SetState(config.s_PicoOpt&0x1000?CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
chkbox_bsync ->SetState(config.s_PicoOpt&0x2000?CEikButtonBase::ESet : CEikButtonBase::EClear);
|
||||
|
||||
// dim "fit2" if we are not in 0 or 180 mode
|
||||
if(config.iScreenRotation != TPicoConfig::PRot0 && config.iScreenRotation != TPicoConfig::PRot180) opt_fit2->SetDimmed(ETrue);
|
||||
if (config.rotation != TPicoConfig::PRot0 && config.rotation != TPicoConfig::PRot180)
|
||||
opt_fit2->SetDimmed(ETrue);
|
||||
// dim some stuff for alternative renderer
|
||||
if(config.iPicoOpt & 0x10) {
|
||||
if (config.s_PicoOpt & 0x10) {
|
||||
// dim accurate sprites
|
||||
chkbox_accsprt->SetState(CEikButtonBase::EClear);
|
||||
chkbox_accsprt->SetDimmed(ETrue);
|
||||
//chkbox_accsprt->SetState(CEikButtonBase::EClear);
|
||||
//chkbox_accsprt->SetDimmed(ETrue);
|
||||
// dim fit
|
||||
if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180)
|
||||
((CEikOptionButton*)(buttons_disp->ComponentControl(TPicoConfig::PMFit)))->SetDimmed(ETrue);
|
||||
}
|
||||
|
||||
TInt sel = (config.iPicoOpt&8) ? 5 : 0;
|
||||
sel+= (config.iFlags>>3)&7;
|
||||
TInt sel = 0;
|
||||
switch (config.s_PsndRate) {
|
||||
case 11025: sel = 1; break;
|
||||
case 16000: sel = 2; break;
|
||||
case 22050: sel = 3; break;
|
||||
case 44100: sel = 4; break;
|
||||
}
|
||||
sel += (config.s_PicoOpt&8) ? 5 : 0;
|
||||
if (sel >= 10) sel = 0;
|
||||
combo_sndq->SetCurrentItem(sel);
|
||||
switch(config.PicoRegion) {
|
||||
|
||||
switch(config.s_PicoRegion) {
|
||||
case 1: sel = 4; break;
|
||||
case 2: sel = 3; break;
|
||||
case 4: sel = 2; break;
|
||||
|
@ -105,7 +124,7 @@ TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)
|
|||
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
|
||||
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
|
||||
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
|
||||
CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
|
||||
// CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming );
|
||||
CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM );
|
||||
CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS );
|
||||
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
|
||||
|
@ -115,35 +134,50 @@ TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)
|
|||
CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality );
|
||||
CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad );
|
||||
CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates );
|
||||
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion );
|
||||
CEikCheckBox *chkbox_cdda = (CEikCheckBox*) Control( ECtlOptCDcdda );
|
||||
CEikCheckBox *chkbox_pcm = (CEikCheckBox*) Control( ECtlOptCDpcm );
|
||||
CEikCheckBox *chkbox_ramcart= (CEikCheckBox*) Control( ECtlOptCDramcart );
|
||||
CEikCheckBox *chkbox_sclrot = (CEikCheckBox*) Control( ECtlOptCDscalerot );
|
||||
CEikCheckBox *chkbox_bsync = (CEikCheckBox*) Control( ECtlOptCDbettersync );
|
||||
|
||||
config.iScreenRotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0);
|
||||
config.iScreenMode = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter);
|
||||
config.rotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0);
|
||||
config.scaling = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter);
|
||||
|
||||
if(chkbox_sram ->State() == CEikButtonBase::ESet) config.iFlags |= 1; else config.iFlags &= ~1;
|
||||
if(chkbox_fps ->State() == CEikButtonBase::ESet) config.iFlags |= 2; else config.iFlags &= ~2;
|
||||
if(chkbox_sound ->State() == CEikButtonBase::ESet) config.iFlags |= 4; else config.iFlags &= ~4;
|
||||
if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.iFlags |= 0x80; else config.iFlags &= ~0x80;
|
||||
if(chkbox_z80 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 4; else config.iPicoOpt &= ~4;
|
||||
if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 1; else config.iPicoOpt &= ~1;
|
||||
if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.iPicoOpt |= 2; else config.iPicoOpt &= ~2;
|
||||
if(chkbox_altrend->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x10;else config.iPicoOpt &= ~0x10;
|
||||
if(chkbox_6bpad ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x20;else config.iPicoOpt &= ~0x20;
|
||||
if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x40;else config.iPicoOpt &= ~0x40;
|
||||
if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x80;else config.iPicoOpt &= ~0x80;
|
||||
if(chkbox_sram ->State() == CEikButtonBase::ESet) config.EmuOpt |= 1; else config.EmuOpt &= ~1;
|
||||
if(chkbox_fps ->State() == CEikButtonBase::ESet) config.EmuOpt |= 2; else config.EmuOpt &= ~2;
|
||||
if(chkbox_sound ->State() == CEikButtonBase::ESet) config.EmuOpt |= 4; else config.EmuOpt &= ~4;
|
||||
if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.EmuOpt |= 8; else config.EmuOpt &= ~8;
|
||||
if(chkbox_z80 ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 4; else config.s_PicoOpt&= ~4;
|
||||
if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 1; else config.s_PicoOpt&= ~1;
|
||||
if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 2; else config.s_PicoOpt&= ~2;
|
||||
if(chkbox_altrend->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x10;else config.s_PicoOpt&= ~0x10;
|
||||
if(chkbox_6bpad ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x20;else config.s_PicoOpt&= ~0x20;
|
||||
// if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x40;else config.s_PicoOpt&= ~0x40;
|
||||
// if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x80;else config.s_PicoOpt&= ~0x80;
|
||||
if(chkbox_cdda ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0800; else config.s_PicoOpt&= ~0x0800;
|
||||
if(chkbox_pcm ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0400; else config.s_PicoOpt&= ~0x0400;
|
||||
if(chkbox_ramcart->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x8000; else config.s_PicoOpt&= ~0x8000;
|
||||
if(chkbox_sclrot ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x1000; else config.s_PicoOpt&= ~0x1000;
|
||||
if(chkbox_bsync ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x2000; else config.s_PicoOpt&= ~0x2000;
|
||||
|
||||
TInt sel = combo_sndq->CurrentItem();
|
||||
if(sel >= 5) { config.iPicoOpt |= 8; sel-=5; } else config.iPicoOpt &= ~8;
|
||||
config.iFlags &= ~0x38;
|
||||
config.iFlags |= (sel<<3)&0x38;
|
||||
if(sel >= 5) { config.s_PicoOpt |= 8; sel-=5; } else config.s_PicoOpt &= ~8;
|
||||
switch (sel) {
|
||||
default:config.s_PsndRate = 8000; break;
|
||||
case 1: config.s_PsndRate = 11025; break;
|
||||
case 2: config.s_PsndRate = 16000; break;
|
||||
case 3: config.s_PsndRate = 22050; break;
|
||||
case 4: config.s_PsndRate = 44100; break;
|
||||
}
|
||||
|
||||
switch(combo_region->CurrentItem()) {
|
||||
case 4: config.PicoRegion = 1; break;
|
||||
case 3: config.PicoRegion = 2; break;
|
||||
case 2: config.PicoRegion = 4; break;
|
||||
case 1: config.PicoRegion = 8; break;
|
||||
default:config.PicoRegion = 0; // auto
|
||||
switch (combo_region->CurrentItem()) {
|
||||
case 4: config.s_PicoRegion = 1; break;
|
||||
case 3: config.s_PicoRegion = 2; break;
|
||||
case 2: config.s_PicoRegion = 4; break;
|
||||
case 1: config.s_PicoRegion = 8; break;
|
||||
default:config.s_PicoRegion = 0; // auto
|
||||
}
|
||||
|
||||
return ETrue;
|
||||
|
@ -152,7 +186,8 @@ TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)
|
|||
// simple GUI stuff needs lots of code
|
||||
void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)
|
||||
{
|
||||
if(aControlId == ECtlOptEnableSound) {
|
||||
if (aControlId == ECtlOptEnableSound)
|
||||
{
|
||||
CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound );
|
||||
CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );
|
||||
CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );
|
||||
|
@ -179,9 +214,11 @@ void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)
|
|||
chkbox_sn76496->DrawDeferred();
|
||||
}
|
||||
}
|
||||
} else if(aControlId == ECtlOptUseAltRend || aControlId == ECtlOptRotation) {
|
||||
}
|
||||
else if(aControlId == ECtlOptUseAltRend || aControlId == ECtlOptRotation)
|
||||
{
|
||||
CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend );
|
||||
CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites );
|
||||
CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation );
|
||||
CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );
|
||||
CEikOptionButton *opt_fit = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit );
|
||||
|
@ -189,14 +226,14 @@ void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)
|
|||
|
||||
TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet;
|
||||
// show/hide more stuff for alternative renderer
|
||||
chkbox_accsprt->SetDimmed(dimmed);
|
||||
// chkbox_accsprt->SetDimmed(dimmed);
|
||||
if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {
|
||||
opt_fit->SetDimmed(dimmed);
|
||||
if(dimmed && buttons_disp->LabeledButtonId() == ECtlOptScreenModeFit)
|
||||
buttons_disp->SetButtonById(ECtlOptScreenModeFit2);
|
||||
}
|
||||
else opt_fit->SetDimmed(EFalse);
|
||||
chkbox_accsprt->DrawDeferred();
|
||||
// chkbox_accsprt->DrawDeferred();
|
||||
buttons_disp->DrawDeferred();
|
||||
|
||||
if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <eikchkbx.h>
|
||||
#include <eikedwob.h>
|
||||
|
||||
#include <QikSimpleDialog.h>
|
||||
#include <qiksimpledialog.h>
|
||||
|
||||
|
||||
/************************************************
|
||||
|
@ -34,19 +34,19 @@
|
|||
*
|
||||
************************************************/
|
||||
|
||||
class TPicoConfig;
|
||||
extern "C" struct _currentConfig_t;
|
||||
|
||||
class CPicoConfigDialog : public CEikDialog
|
||||
{
|
||||
public:
|
||||
CPicoConfigDialog(TPicoConfig &cfg);
|
||||
CPicoConfigDialog(_currentConfig_t &cfg);
|
||||
|
||||
protected: // framework
|
||||
void PostLayoutDynInitL();
|
||||
void HandleControlStateChangeL(TInt aControlId);
|
||||
TBool OkToExitL(TInt aButtonId);
|
||||
|
||||
TPicoConfig &config;
|
||||
_currentConfig_t &config;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,46 +23,48 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "../../pico/picoInt.h"
|
||||
#include <Pico/PicoInt.h>
|
||||
#include "../common/emu.h"
|
||||
#include "engine/debug.h"
|
||||
#include "app.h"
|
||||
#include "App.h"
|
||||
|
||||
// this is where we start to break a bunch of symbian rules
|
||||
extern TInt machineUid;
|
||||
extern int gamestate, gamestate_next;
|
||||
extern TPicoConfig *currentConfig;
|
||||
extern char *loadrom_fname;
|
||||
extern int loadrom_result;
|
||||
extern const char *actionNames[];
|
||||
RSemaphore pauseSemaphore;
|
||||
RSemaphore initSemaphore;
|
||||
const char *RomFileName = 0;
|
||||
RSemaphore pauseSemaphore;
|
||||
RSemaphore loadWaitSemaphore;
|
||||
int pico_was_reset = 0;
|
||||
unsigned char *rom_data = 0;
|
||||
static CPicolAppView *appView = 0;
|
||||
|
||||
|
||||
TInt CPicoGameSession::Do(const TPicoServRqst what, TAny *param)
|
||||
{
|
||||
switch (what) {
|
||||
switch (what)
|
||||
{
|
||||
case PicoMsgLoadState:
|
||||
if(!rom_data) return -1; // no ROM
|
||||
return saveLoadGame(1);
|
||||
if(!rom_loaded) return -1; // no ROM
|
||||
return emu_SaveLoadGame(1, 0);
|
||||
|
||||
case PicoMsgSaveState:
|
||||
if(!rom_data) return -1;
|
||||
return saveLoadGame(0);
|
||||
if(!rom_loaded) return -1;
|
||||
return emu_SaveLoadGame(0, 0);
|
||||
|
||||
case PicoMsgLoadROM:
|
||||
return loadROM((TPtrC16 *)param);
|
||||
|
||||
case PicoMsgResume:
|
||||
DEBUGPRINT(_L("resume with rom %08x"), rom_data);
|
||||
if(rom_data) {
|
||||
DEBUGPRINT(_L("resume"));
|
||||
if(rom_loaded) {
|
||||
return ChangeRunState(PGS_Running);
|
||||
}
|
||||
return 1;
|
||||
|
||||
case PicoMsgReset:
|
||||
if(rom_data) {
|
||||
if(rom_loaded) {
|
||||
PicoReset();
|
||||
pico_was_reset = 1;
|
||||
return ChangeRunState(PGS_Running);
|
||||
|
@ -104,6 +106,8 @@ TInt CPicoGameSession::StartEmuThread()
|
|||
initSemaphore.CreateLocal(0);
|
||||
if (pauseSemaphore.Handle() <= 0)
|
||||
pauseSemaphore.CreateLocal(0);
|
||||
if (loadWaitSemaphore.Handle() <= 0)
|
||||
loadWaitSemaphore.CreateLocal(0);
|
||||
|
||||
RThread thread;
|
||||
if(iThreadWatcher && (res = thread.Open(iThreadWatcher->iTid)) == KErrNone) {
|
||||
|
@ -118,7 +122,6 @@ TInt CPicoGameSession::StartEmuThread()
|
|||
thread.Close();
|
||||
}
|
||||
|
||||
//semaphore.CreateLocal(0); // create a semaphore so we know when thread init is finished
|
||||
res=thread.Create(_L("PicoEmuThread"), // create new server thread
|
||||
EmuThreadFunction, // thread's main function
|
||||
KDefaultStackSize,
|
||||
|
@ -134,7 +137,7 @@ TInt CPicoGameSession::StartEmuThread()
|
|||
iThreadWatcher = CThreadWatcher::NewL(thread.Id());
|
||||
thread.Resume(); // start it going
|
||||
DEBUGPRINT(_L("initSemaphore.Wait()"));
|
||||
res = initSemaphore.Wait(1000*1000); // wait until it's initialized
|
||||
res = initSemaphore.Wait(3*1000*1000); // wait until it's initialized
|
||||
DEBUGPRINT(_L("initSemaphore resume, ExitReason() == %i"), thread.ExitReason());
|
||||
res |= thread.ExitReason();
|
||||
thread.Close(); // we're no longer interested in the other thread
|
||||
|
@ -164,96 +167,34 @@ TInt CPicoGameSession::ChangeRunState(TPicoGameState newstate, TPicoGameState ne
|
|||
|
||||
TInt CPicoGameSession::loadROM(TPtrC16 *pptr)
|
||||
{
|
||||
TInt res, i;
|
||||
char buff[0x31];
|
||||
TInt ret;
|
||||
char buff[150];
|
||||
|
||||
if(rom_data) {
|
||||
// save SRAM for previous ROM
|
||||
if(currentConfig->iFlags & 1)
|
||||
saveLoadGame(0, 1);
|
||||
}
|
||||
|
||||
RomFileName = 0;
|
||||
if(rom_data) {
|
||||
free(rom_data);
|
||||
rom_data = 0;
|
||||
}
|
||||
// make sure emu thread is ok
|
||||
ret = ChangeRunState(PGS_Paused);
|
||||
if(ret) return ret;
|
||||
|
||||
// read the contents of the client pointer into a TPtr.
|
||||
static TBuf8<KMaxFileName> writeBuf;
|
||||
writeBuf.Copy(*pptr);
|
||||
|
||||
// detect wrong extensions (.srm and .mds)
|
||||
TBuf8<5> ext;
|
||||
ext.Copy(writeBuf.Right(4));
|
||||
ext.LowerCase();
|
||||
if(!strcmp((char *)ext.PtrZ(), ".srm") || !strcmp((char *)ext.PtrZ(), "s.gz") || // .mds.gz
|
||||
!strcmp((char *)ext.PtrZ(), ".mds")) {
|
||||
// push the emu thead to a load state. This is done so that it owns all file handles.
|
||||
// If successful, in will enter PGS_Running state by itself.
|
||||
loadrom_fname = (char *)writeBuf.PtrZ();
|
||||
loadrom_result = 0;
|
||||
ret = ChangeRunState(PGS_ReloadRom);
|
||||
if(ret) return ret;
|
||||
|
||||
loadWaitSemaphore.Wait(20*1000*1000);
|
||||
|
||||
if (loadrom_result == 0)
|
||||
return PicoErrNotRom;
|
||||
}
|
||||
|
||||
FILE *rom = fopen((char *) writeBuf.PtrZ(), "rb");
|
||||
if(!rom) {
|
||||
DEBUGPRINT(_L("failed to open rom."));
|
||||
return PicoErrRomOpenFailed;
|
||||
}
|
||||
|
||||
// make sure emu thread is ok
|
||||
res = ChangeRunState(PGS_Paused);
|
||||
if(res) {
|
||||
fclose(rom);
|
||||
return res;
|
||||
}
|
||||
|
||||
unsigned int rom_size = 0;
|
||||
// zipfile support
|
||||
if(!strcmp((char *)ext.PtrZ(), ".zip")) {
|
||||
fclose(rom);
|
||||
res = CartLoadZip((const char *) writeBuf.PtrZ(), &rom_data, &rom_size);
|
||||
if(res) {
|
||||
DEBUGPRINT(_L("CartLoadZip() failed (%i)"), res);
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
if( (res = PicoCartLoad(rom, &rom_data, &rom_size)) ) {
|
||||
DEBUGPRINT(_L("PicoCartLoad() failed (%i)"), res);
|
||||
fclose(rom);
|
||||
return PicoErrOutOfMem;
|
||||
}
|
||||
fclose(rom);
|
||||
}
|
||||
|
||||
// detect wrong files (Pico crashes on very small files), also see if ROM EP is good
|
||||
if(rom_size <= 0x200 || strncmp((char *)rom_data, "Pico", 4) == 0 ||
|
||||
((*(TUint16 *)(rom_data+4)<<16)|(*(TUint16 *)(rom_data+6))) >= (int)rom_size) {
|
||||
free(rom_data);
|
||||
rom_data = 0;
|
||||
return PicoErrNotRom;
|
||||
}
|
||||
|
||||
DEBUGPRINT(_L("PicoCartInsert(0x%08X, %d);"), rom_data, rom_size);
|
||||
if(PicoCartInsert(rom_data, rom_size)) {
|
||||
return PicoErrOutOfMem;
|
||||
}
|
||||
|
||||
pico_was_reset = 1;
|
||||
|
||||
// global ROM file name for later use
|
||||
RomFileName = (const char *) writeBuf.PtrZ();
|
||||
|
||||
// name from the ROM itself
|
||||
for(i = 0; i < 0x30; i++)
|
||||
buff[i] = rom_data[0x150 + (i^1)]; // unbyteswap
|
||||
for(buff[i] = 0, i--; i >= 0; i--) {
|
||||
if(buff[i] != ' ') break;
|
||||
buff[i] = 0;
|
||||
}
|
||||
emu_getGameName(buff);
|
||||
TPtrC8 buff8((TUint8*) buff);
|
||||
iRomInternalName.Copy(buff8);
|
||||
|
||||
// load SRAM for this ROM
|
||||
if(currentConfig->iFlags & 1)
|
||||
saveLoadGame(1, 1);
|
||||
DEBUGPRINT(_L("done waiting for ROM load"));
|
||||
|
||||
// debug
|
||||
#ifdef __DEBUG_PRINT
|
||||
|
@ -262,8 +203,6 @@ TInt CPicoGameSession::loadROM(TPtrC16 *pptr)
|
|||
User::AllocSize(mem);
|
||||
DEBUGPRINT(_L("comm: cels=%d, size=%d KB"), cells, mem/1024);
|
||||
ChangeRunState(PGS_DebugHeap, PGS_Running);
|
||||
#else
|
||||
ChangeRunState(PGS_Running);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -272,23 +211,9 @@ TInt CPicoGameSession::loadROM(TPtrC16 *pptr)
|
|||
|
||||
TInt CPicoGameSession::changeConfig(TPicoConfig *aConfig)
|
||||
{
|
||||
DEBUGPRINT(_L("got new config."));
|
||||
|
||||
currentConfig = aConfig;
|
||||
|
||||
// set PicoOpt and rate
|
||||
PicoRegionOverride = currentConfig->PicoRegion;
|
||||
PicoOpt = currentConfig->iPicoOpt;
|
||||
switch((currentConfig->iFlags>>3)&7) {
|
||||
case 1: PsndRate=11025; break;
|
||||
case 2: PsndRate=16000; break;
|
||||
case 3: PsndRate=22050; break;
|
||||
case 4: PsndRate=44100; break;
|
||||
default: PsndRate= 8000; break;
|
||||
}
|
||||
|
||||
// 6 button pad, enable XYZM config if needed
|
||||
if(PicoOpt & 0x20) {
|
||||
if (PicoOpt & POPT_6BTN_PAD)
|
||||
{
|
||||
actionNames[8] = "Z";
|
||||
actionNames[9] = "Y";
|
||||
actionNames[10] = "X";
|
||||
|
@ -298,16 +223,15 @@ TInt CPicoGameSession::changeConfig(TPicoConfig *aConfig)
|
|||
}
|
||||
|
||||
// if we are in center 90||270 modes, we can bind renderer switcher
|
||||
if(currentConfig->iScreenMode == TPicoConfig::PMFit &&
|
||||
(currentConfig->iScreenRotation == TPicoConfig::PRot0 || currentConfig->iScreenRotation == TPicoConfig::PRot180))
|
||||
actionNames[25] = 0;
|
||||
else actionNames[25] = "RENDERER";
|
||||
if (currentConfig.scaling == TPicoConfig::PMFit &&
|
||||
(currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180))
|
||||
actionNames[25] = 0;
|
||||
else actionNames[25] = "RENDERER";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void MainOldCleanup(); // from main.cpp
|
||||
#ifdef __DEBUG_PRINT_FILE
|
||||
extern RMutex logMutex;
|
||||
#endif
|
||||
|
@ -346,7 +270,7 @@ void CPicoGameSession::freeResources()
|
|||
|
||||
}
|
||||
|
||||
if(iThreadWatcher != NULL)
|
||||
if (iThreadWatcher != NULL)
|
||||
{
|
||||
DEBUGPRINT(_L("delete iThreadWatcher"));
|
||||
delete iThreadWatcher;
|
||||
|
@ -354,12 +278,13 @@ void CPicoGameSession::freeResources()
|
|||
iThreadWatcher = NULL;
|
||||
}
|
||||
|
||||
MainOldCleanup();
|
||||
|
||||
if (initSemaphore.Handle() > 0)
|
||||
initSemaphore.Close();
|
||||
if (pauseSemaphore.Handle() > 0)
|
||||
pauseSemaphore.Close();
|
||||
if (loadWaitSemaphore.Handle() > 0)
|
||||
loadWaitSemaphore.Close();
|
||||
DEBUGPRINT(_L("freeResources() returning"));
|
||||
#ifdef __DEBUG_PRINT_FILE
|
||||
if (logMutex.Handle() > 0)
|
||||
logMutex.Close();
|
||||
|
@ -368,67 +293,7 @@ void CPicoGameSession::freeResources()
|
|||
|
||||
TBool CPicoGameSession::iEmuRunning = EFalse;
|
||||
CThreadWatcher *CPicoGameSession::iThreadWatcher = 0;
|
||||
TBuf<0x30> CPicoGameSession::iRomInternalName;
|
||||
|
||||
|
||||
void TPicoConfig::SetDefaults()
|
||||
{
|
||||
iLastROMFile.SetLength(0);
|
||||
iScreenRotation = PRot270;
|
||||
iScreenMode = PMCenter;
|
||||
iFlags = 1; // use_sram
|
||||
iPicoOpt = 0; // all off
|
||||
iFrameskip = PFSkipAuto;
|
||||
|
||||
Mem::FillZ(iKeyBinds, sizeof(iKeyBinds));
|
||||
Mem::FillZ(iAreaBinds, sizeof(iAreaBinds));
|
||||
iKeyBinds[0xd5] = 1<<26; // bind back
|
||||
}
|
||||
|
||||
// load config
|
||||
void TPicoConfig::InternalizeL(RReadStream &aStream)
|
||||
{
|
||||
TInt32 version, fname_len;
|
||||
version = aStream.ReadInt32L();
|
||||
fname_len = aStream.ReadInt32L();
|
||||
|
||||
// not sure if this is safe
|
||||
iLastROMFile.SetMax();
|
||||
aStream.ReadL((TUint8 *) iLastROMFile.Ptr(), KMaxFileName*2);
|
||||
iLastROMFile.SetLength(fname_len);
|
||||
|
||||
iScreenRotation = aStream.ReadInt32L();
|
||||
iScreenMode = aStream.ReadInt32L();
|
||||
iFlags = aStream.ReadUint32L();
|
||||
iPicoOpt = aStream.ReadInt32L();
|
||||
iFrameskip = aStream.ReadInt32L();
|
||||
|
||||
aStream.ReadL((TUint8 *)iKeyBinds, sizeof(iKeyBinds));
|
||||
aStream.ReadL((TUint8 *)iAreaBinds, sizeof(iAreaBinds));
|
||||
|
||||
PicoRegion = aStream.ReadInt32L();
|
||||
}
|
||||
|
||||
// save config
|
||||
void TPicoConfig::ExternalizeL(RWriteStream &aStream) const
|
||||
{
|
||||
TInt version = (KPicoMajorVersionNumber<<24)+(KPicoMinorVersionNumber<<16);
|
||||
|
||||
aStream.WriteInt32L(version);
|
||||
aStream.WriteInt32L(iLastROMFile.Length());
|
||||
aStream.WriteL((const TUint8 *)iLastROMFile.Ptr(), KMaxFileName*2);
|
||||
|
||||
aStream.WriteInt32L(iScreenRotation);
|
||||
aStream.WriteInt32L(iScreenMode);
|
||||
aStream.WriteUint32L(iFlags);
|
||||
aStream.WriteInt32L(iPicoOpt);
|
||||
aStream.WriteInt32L(iFrameskip);
|
||||
|
||||
aStream.WriteL((const TUint8 *)iKeyBinds, sizeof(iKeyBinds));
|
||||
aStream.WriteL((const TUint8 *)iAreaBinds, sizeof(iAreaBinds));
|
||||
|
||||
aStream.WriteInt32L(PicoRegion);
|
||||
}
|
||||
TBuf<150> CPicoGameSession::iRomInternalName;
|
||||
|
||||
|
||||
// CThreadWatcher
|
||||
|
@ -482,3 +347,10 @@ void CThreadWatcher::DoCancel()
|
|||
thread.Close();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void cache_flush_d_inval_i(const void *start_addr, const void *end_addr)
|
||||
{
|
||||
// TODO
|
||||
User::IMB_Range((TAny *)start_addr, (TAny *)end_addr);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ enum TPicoGameState {
|
|||
PGS_Quit,
|
||||
PGS_KeyConfig,
|
||||
PGS_DebugHeap,
|
||||
PGS_ReloadRom,
|
||||
};
|
||||
|
||||
enum TPicoServRqst {
|
||||
|
@ -81,9 +82,9 @@ struct TPicoKeyConfigEntry
|
|||
class TPicoConfig
|
||||
{
|
||||
public:
|
||||
void SetDefaults();
|
||||
void InternalizeL(RReadStream &aStream);
|
||||
void ExternalizeL(RWriteStream &aStream) const;
|
||||
// void SetDefaults();
|
||||
// void InternalizeL(RReadStream &aStream);
|
||||
// void ExternalizeL(RWriteStream &aStream) const;
|
||||
|
||||
enum TPicoScreenRotation {
|
||||
PRot0,
|
||||
|
@ -102,18 +103,7 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
TFileName iLastROMFile;
|
||||
|
||||
TInt32 iScreenRotation;
|
||||
TInt32 iScreenMode;
|
||||
TUint32 iFlags; // LSb->MSb: use_sram, show_fps, enable_sound, sound_rate(3bits), gzip_saves{=0x40}, dont_use_mot_vol
|
||||
// enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
|
||||
// alt_renderer, 6button_gamepad, accurate_timing
|
||||
TInt32 iPicoOpt;
|
||||
TInt32 iFrameskip;
|
||||
TUint32 iKeyBinds[256]; // a binding for every keycode
|
||||
TUint32 iAreaBinds[19];
|
||||
TInt32 PicoRegion;
|
||||
TFileName iLastROMFile; // used as tmp only
|
||||
};
|
||||
|
||||
|
||||
|
@ -141,7 +131,7 @@ public:
|
|||
static void freeResources();
|
||||
|
||||
static TBool iEmuRunning;
|
||||
static TBuf<0x30> iRomInternalName;
|
||||
static TBuf<150> iRomInternalName;
|
||||
|
||||
private:
|
||||
// services available
|
||||
|
@ -153,7 +143,4 @@ private:
|
|||
static CThreadWatcher *iThreadWatcher;
|
||||
};
|
||||
|
||||
// global
|
||||
int saveLoadGame(int load, int sram=0);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,307 +1,146 @@
|
|||
# makefile for GCCE
|
||||
# makefile for uiq3_patcher_0_2.tar.gz
|
||||
export CROSS = arm-none-symbianelf-
|
||||
APPNAME = PicoDrive
|
||||
VER_MAJ = 1
|
||||
VER_MIN = 51
|
||||
VENDOR = notaz
|
||||
UID3 = A00010F3
|
||||
EPOCROOT = /opt/uiq3/
|
||||
EPOCLIBS = qikdlg.lib etext.lib bafl.lib efsrv.lib eikctl.lib ws32.lib \
|
||||
eikdlg.lib gdi.lib estor.lib hal.lib mediaclient.lib mediaclientaudiostream.lib
|
||||
STACK = 0x3000
|
||||
HEAP = 0x10,0x1000000
|
||||
|
||||
|
||||
# settings
|
||||
#dprint = 1
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
asm_blit = 1
|
||||
use_cyclone = 1
|
||||
#use_musashi = 1
|
||||
#up = 1
|
||||
#sis = 1
|
||||
|
||||
# targets
|
||||
all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe
|
||||
|
||||
clean :
|
||||
@perl -S ermdir.pl _build
|
||||
@erase 2>>nul rsc\*.rsc
|
||||
@erase 2>>nul rsc\*.rsg
|
||||
@erase 2>>nul rsc\PicoDrive.mb?
|
||||
|
||||
|
||||
# paths
|
||||
$(EPOCROOT2)epoc32 :
|
||||
@echo Please set EPOCROOT2 environmental variable to full path to your SDK
|
||||
@echo with ending slash (something like C:\Uiq_21\)
|
||||
@cd : 2> NUL # do something stupid to make it silently fail
|
||||
|
||||
# resource compiler hates drive lettered paths
|
||||
EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2)))
|
||||
EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5
|
||||
|
||||
# C/C++ Compiler
|
||||
CC=arm-none-symbianelf-gcc
|
||||
|
||||
# Linker
|
||||
LD=arm-none-symbianelf-ld
|
||||
|
||||
# Assembler
|
||||
ASM=arm-none-symbianelf-as
|
||||
|
||||
# Archiver
|
||||
AR=arm-none-symbianelf-ar
|
||||
|
||||
# Strip
|
||||
STRIP=arm-none-symbianelf-strip
|
||||
|
||||
# gcc config
|
||||
GCCDEFINES = -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__ \
|
||||
-D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ \
|
||||
-D__MARM_ARMV5__ -D__PRODUCT_INCLUDE__=\"$(EPOCROOT2)epoc32/include/variant/UIQ_3.0.hrh\"
|
||||
|
||||
GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE
|
||||
|
||||
# 'CSL Arm Toolchain' stuff must be specified after Symbian includes
|
||||
GCCINCLUDES = -I "$(EPOCROOT2)epoc32\include\variant" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" \
|
||||
-I "$(EPOCROOT2)\CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3\include" -I.
|
||||
|
||||
# -funit-at-a-time is not compatible with SDK, it either has linker problems or does not start on device
|
||||
GCCCOMMFLAGS = -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -nostdinc -msoft-float \
|
||||
$(GCCINCLUDES) -include "$(EPOCROOT2)EPOC32/INCLUDE/GCCE/GCCE.h" -marm
|
||||
|
||||
GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time
|
||||
GCCCFLAGS = -x c -O3 -fno-unit-at-a-time
|
||||
|
||||
GCCLDFLAGS = -L"$(EPOCROOT2)CSL Arm Toolchain\arm-none-symbianelf\lib" \
|
||||
-L"$(EPOCROOT2)CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3" \
|
||||
--target1-abs --no-undefined -nostdlib -shared -Ttext 0x8000 -Tdata 0x400000 --default-symver
|
||||
|
||||
# libs
|
||||
LIBS = \
|
||||
$(EPOCLIB)\LIB\ESTLIB.dso \
|
||||
$(EPOCLIB)\urel\qikalloc.lib \
|
||||
$(EPOCLIB)\LIB\euser.dso \
|
||||
$(EPOCLIB)\LIB\apparc.dso \
|
||||
$(EPOCLIB)\LIB\cone.dso \
|
||||
$(EPOCLIB)\LIB\eikcore.dso \
|
||||
$(EPOCLIB)\LIB\eikcoctl.dso \
|
||||
$(EPOCLIB)\LIB\qikcore.dso \
|
||||
$(EPOCLIB)\LIB\qikdlg.dso \
|
||||
$(EPOCLIB)\LIB\etext.dso \
|
||||
$(EPOCLIB)\LIB\bafl.dso \
|
||||
$(EPOCLIB)\LIB\efsrv.dso \
|
||||
$(EPOCLIB)\LIB\eikctl.dso \
|
||||
$(EPOCLIB)\LIB\WS32.dso \
|
||||
$(EPOCLIB)\LIB\EIKDLG.dso \
|
||||
$(EPOCLIB)\LIB\GDI.dso \
|
||||
$(EPOCLIB)\LIB\estor.dso \
|
||||
$(EPOCLIB)\LIB\EZLIB.dso \
|
||||
$(EPOCLIB)\LIB\HAL.dso \
|
||||
$(EPOCLIB)\LIB\mediaclient.dso \
|
||||
$(EPOCLIB)\LIB\mediaclientaudiostream.dso
|
||||
|
||||
LIBS += \
|
||||
$(EPOCLIB)\LIB\qikallocdll.dso \
|
||||
$(EPOCLIB)\UREL\usrt2_2.lib \
|
||||
$(EPOCLIB)\LIB\dfpaeabi.dso \
|
||||
$(EPOCLIB)\LIB\dfprvct2_2.dso \
|
||||
$(EPOCLIB)\LIB\drtaeabi.dso \
|
||||
$(EPOCLIB)\LIB\scppnwdl.dso \
|
||||
$(EPOCLIB)\LIB\drtrvct2_2.dso
|
||||
|
||||
|
||||
# objects
|
||||
|
||||
# launcher
|
||||
OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o
|
||||
OBJ += App.o Engine.o Dialogs.o CSimpleTextParser.o emu.o
|
||||
# engine
|
||||
OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o
|
||||
|
||||
OBJ += engine/main.o engine/vid.o engine/polledas.o engine/audio_mediaserver.o engine/debug.o
|
||||
ifeq "$(asm_blit)" "1"
|
||||
OBJ += engine/blit_asm.o
|
||||
else
|
||||
OBJ += engine/blit.o
|
||||
endif
|
||||
# common
|
||||
OBJ += ../common/emu.o ../common/config.o ../common/menu.o ../common/mp3_helix.o
|
||||
# Pico
|
||||
OBJECTS += _build\Area.o _build\Cart.o _build\Utils.o _build\Memory.o _build\Misc.o \
|
||||
_build\Pico.o _build\Sek.o _build\VideoPort.o _build\Draw2.o _build\Draw.o
|
||||
OBJ += 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 - CD
|
||||
OBJ += 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/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.o
|
||||
# Pico - Pico
|
||||
OBJ += Pico/Pico/Pico.o Pico/Pico/Memory.o Pico/Pico/xpcm.o
|
||||
# Pico - carthw
|
||||
OBJ += 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/stub_arm.o
|
||||
|
||||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
GCCDEFINES += -D_ASM_DRAW_C
|
||||
OBJECTS += _build\draw_asm.o _build\draw2_asm.o
|
||||
CFLAGS += -D_ASM_DRAW_C
|
||||
OBJ += Pico/draw_asm.o Pico/draw2_asm.o
|
||||
endif
|
||||
ifeq "$(asm_memory)" "1"
|
||||
GCCDEFINES += -D_ASM_MEMORY_C
|
||||
OBJECTS += _build\memory_asm.o
|
||||
CFLAGS += -D_ASM_MEMORY_C
|
||||
OBJ += Pico/memory_asm.o
|
||||
endif
|
||||
ifeq "$(asm_ym2612)" "1"
|
||||
CFLAGS += -D_ASM_YM2612_C
|
||||
OBJ += Pico/sound/ym2612_asm.o
|
||||
endif
|
||||
ifeq "$(asm_misc)" "1"
|
||||
CFLAGS += -D_ASM_MISC_C
|
||||
OBJ += Pico/misc_asm.o
|
||||
OBJ += Pico/cd/misc_asm.o
|
||||
endif
|
||||
ifeq "$(asm_cdpico)" "1"
|
||||
CFLAGS += -D_ASM_CD_PICO_C
|
||||
OBJ += Pico/cd/pico_asm.o
|
||||
endif
|
||||
ifeq "$(asm_cdmemory)" "1"
|
||||
CFLAGS += -D_ASM_CD_MEMORY_C
|
||||
OBJ += Pico/cd/memory_asm.o
|
||||
endif
|
||||
|
||||
# Pico - sound
|
||||
OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o
|
||||
# misc
|
||||
OBJECTS += _build\unzip.o _build\gzio_symb.o
|
||||
OBJ += Pico/sound/sound.o
|
||||
OBJ += Pico/sound/mix_asm.o
|
||||
OBJ += Pico/sound/sn76496.o Pico/sound/ym2612.o
|
||||
# zlib
|
||||
OBJ += 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
|
||||
# unzip
|
||||
OBJ += unzip/unzip.o unzip/unzip_stream.o
|
||||
# CPU cores
|
||||
ifeq "$(use_musashi)" "1"
|
||||
GCCDEFINES += -DEMU_M68K
|
||||
OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o
|
||||
else
|
||||
GCCDEFINES += -DEMU_C68K
|
||||
OBJECTS += _build\Cyclone.o
|
||||
CFLAGS += -DEMU_M68K
|
||||
OBJ += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
|
||||
endif
|
||||
ifeq "$(asm_blit)" "1"
|
||||
OBJECTS += _build\blit_asm.o
|
||||
else
|
||||
OBJECTS += _build\blit.o
|
||||
ifeq "$(use_cyclone)" "1"
|
||||
CFLAGS += -DEMU_C68K
|
||||
OBJ += cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o
|
||||
endif
|
||||
GCCDEFINES += -D_USE_DRZ80
|
||||
OBJECTS += _build\DrZ80.o
|
||||
GCCDEFINES += -D_ASM_YM2612_C
|
||||
OBJECTS += _build\ym2612_asm.o
|
||||
# drz80
|
||||
CFLAGS += -D_USE_DRZ80
|
||||
OBJ += cpu/DrZ80/drz80.o
|
||||
# helix
|
||||
OBJ += ../common/helix/$(CROSS)helix-mp3.a
|
||||
|
||||
|
||||
vpath %.c = ../..
|
||||
vpath %.s = ../..
|
||||
vpath %.S = ../..
|
||||
DIRS = platform platform/common Pico Pico/cd Pico/Pico Pico/sound Pico/carthw/svp \
|
||||
zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80
|
||||
|
||||
# dprint
|
||||
ifeq "$(dprint)" "1"
|
||||
GCCDEFINES += -D__DEBUG_PRINT
|
||||
endif
|
||||
ICONS := $(shell echo rsc/*.bmp)
|
||||
APPICON = $(NAME).mbm
|
||||
RSCDIR = rsc
|
||||
REGDIR = rsc
|
||||
CFLAGS += -I./ -I../../
|
||||
CFLAGS += -DUIQ3 -DARM -DNO_SYNC
|
||||
CFLAGS += -D__DEBUG_PRINT
|
||||
CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -ftracer \
|
||||
-fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||
SFLAGS = -march=armv5t -msoft-float -nostdinc
|
||||
ASFLAGS = -mcpu=arm926ej-s -mfloat-abi=soft
|
||||
export CFLAGS
|
||||
SRCRES := $(shell echo rsc/*.rss)
|
||||
EPOCRCFLAGS += -I./
|
||||
|
||||
all: mkdirs sis
|
||||
|
||||
include uiq3.mak
|
||||
include ../common/common_arm.mak
|
||||
|
||||
|
||||
define crule
|
||||
@echo * $<
|
||||
@$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@
|
||||
endef
|
||||
|
||||
define cpprule
|
||||
@echo * $<
|
||||
@$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@
|
||||
endef
|
||||
|
||||
define asmrule
|
||||
@echo * $<
|
||||
@$(ASM) -marmv4t -mthumb-interwork -o $@ $^
|
||||
endef
|
||||
|
||||
# object making rules
|
||||
_build\App.o : App.cpp
|
||||
$(cpprule)
|
||||
_build\Engine.o : Engine.cpp
|
||||
$(cpprule)
|
||||
_build\Dialogs.o : Dialogs.cpp
|
||||
$(cpprule)
|
||||
_build\CSimpleTextParser.o : CSimpleTextParser.cpp
|
||||
$(cpprule)
|
||||
|
||||
_build\main.o : engine\main.cpp
|
||||
$(cpprule)
|
||||
_build\vid.o : engine\vid.cpp
|
||||
$(cpprule)
|
||||
_build\polledas.o: engine\polledas.cpp
|
||||
$(cpprule)
|
||||
_build\audio_mediaserver.o : engine\audio_mediaserver.cpp
|
||||
$(cpprule)
|
||||
_build\debug.o : engine\debug.cpp
|
||||
$(cpprule)
|
||||
_build\blit.o : engine\blit.c
|
||||
$(crule)
|
||||
|
||||
_build\Area.o : ..\..\Pico\Area.c
|
||||
$(crule)
|
||||
_build\Cart.o : ..\..\Pico\Cart.c
|
||||
$(crule)
|
||||
_build\Draw.o : ..\..\Pico\Draw.c
|
||||
$(crule)
|
||||
_build\Draw2.o : ..\..\Pico\Draw2.c
|
||||
$(crule)
|
||||
_build\Memory.o : ..\..\Pico\Memory.c
|
||||
$(crule)
|
||||
_build\Misc.o : ..\..\Pico\Misc.c
|
||||
$(crule)
|
||||
_build\Pico.o : ..\..\Pico\Pico.c
|
||||
$(crule)
|
||||
_build\Sek.o : ..\..\Pico\Sek.c
|
||||
$(crule)
|
||||
_build\Utils.o : ..\..\Pico\Utils.c
|
||||
$(crule)
|
||||
_build\VideoPort.o : ..\..\Pico\VideoPort.c
|
||||
$(crule)
|
||||
_build\sound.o : ..\..\Pico\sound\sound.c
|
||||
$(crule)
|
||||
_build\sn76496.o : ..\..\Pico\sound\sn76496.c
|
||||
$(crule)
|
||||
_build\ym2612.o : ..\..\Pico\sound\ym2612.c
|
||||
$(crule)
|
||||
|
||||
_build\unzip.o : ..\..\unzip\unzip.c
|
||||
$(crule)
|
||||
_build\gzio_symb.o : ..\..\zlib\gzio_symb.c
|
||||
$(crule)
|
||||
|
||||
_build\m68kcpu.o : ..\..\musashi\m68kcpu.c
|
||||
$(crule)
|
||||
_build\m68kopac.o : ..\..\musashi\m68kopac.c
|
||||
$(crule)
|
||||
_build\m68kopdm.o : ..\..\musashi\m68kopdm.c
|
||||
$(crule)
|
||||
_build\m68kopnz.o : ..\..\musashi\m68kopnz.c
|
||||
$(crule)
|
||||
_build\m68kops.o : ..\..\musashi\m68kops.c
|
||||
$(crule)
|
||||
|
||||
_build\Cyclone.o : ..\..\cpu\Cyclone\proj\Cyclone.s
|
||||
$(asmrule)
|
||||
_build\DrZ80.o : ..\..\cpu\DrZ80\drz80.s
|
||||
$(asmrule)
|
||||
_build\draw_asm.o : ..\..\Pico\draw.s
|
||||
$(asmrule)
|
||||
_build\draw2_asm.o : ..\..\Pico\draw2.s
|
||||
$(asmrule)
|
||||
_build\memory_asm.o : ..\..\Pico\memory.s
|
||||
$(asmrule)
|
||||
_build\ym2612_asm.o : ..\..\Pico\sound\ym2612.s
|
||||
$(asmrule)
|
||||
_build\blit_asm.o : engine\blit.s
|
||||
$(asmrule)
|
||||
$(NAME).mbg $(NAME).mbm : $(ICONS)
|
||||
@echo "Creating multibitmap file..."
|
||||
$(BMCONV) /h$(NAME).mbg $(NAME).mbm \
|
||||
/c24rsc/pico18x18.bmp /8rsc/pico18x18m.bmp \
|
||||
/c24rsc/pico40x40.bmp /8rsc/pico40x40m.bmp \
|
||||
/c24rsc/pico64x64.bmp /8rsc/pico64x64m.bmp
|
||||
|
||||
|
||||
PicoDrive.exe : $(OBJECTS)
|
||||
@echo * ld
|
||||
@$(LD) $(GCCLDFLAGS) -soname PicoDrive{000a0000}[a00010f3].exe --entry _E32Startup -u _E32Startup \
|
||||
$(EPOCROOT2)EPOC32\RELEASE\ARMV5\UREL\EEXE.LIB -o "_build\PicoDrive_elf.exe" -Map "_build\PicoDrive.exe.map" $(OBJECTS) $(LIBS) -lsupc++ -lgcc
|
||||
# @echo * strip
|
||||
# @$(STRIP) _build\PicoDrive_elf.exe
|
||||
@echo * elf2e32
|
||||
@elf2e32 --sid=0xa00010f3 --heap=0x00000100,0x00800000 --stack=0x00003000 \
|
||||
--uid1=0x1000007a --uid2=0x100039ce --uid3=0xa00010f3 \
|
||||
--capability=none --fpu=softvfp --targettype=EXE --output="$@" \
|
||||
--elfinput="_build\PicoDrive_elf.exe" --linkas=PicoDrive{000a0000}[a00010f3].exe --libpath="$(EPOCLIB)\LIB"
|
||||
ifeq "$(sis)" "1"
|
||||
@make -C _out
|
||||
ifeq "$(up)" "1"
|
||||
@qup.cmd
|
||||
endif
|
||||
endif
|
||||
engine/blit_asm.o : engine/blit.s
|
||||
@echo ">>>" $@
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
MAKEDIRS : _build
|
||||
|
||||
_build :
|
||||
# @echo * making build dir
|
||||
@perl -S emkdir.pl $@
|
||||
|
||||
|
||||
# BitMap PicoDrive.mbm
|
||||
|
||||
RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg
|
||||
|
||||
rsc\PicoDrive.mbg : rsc\PicoDrive.mbm
|
||||
|
||||
rsc\PicoDrive.mbm : rsc\pico18x18.bmp rsc\pico18x18m.bmp rsc\pico40x40.bmp rsc\pico40x40m.bmp rsc\pico64x64.bmp rsc\pico64x64m.bmp
|
||||
@echo * $@
|
||||
@perl -S epocmbm.pl -h"rsc\PicoDrive.mbg" -o"rsc\PicoDrive.mbm" -l"\Z\Resource\Apps\:rsc" \
|
||||
-b"/c24rsc\pico18x18.bmp /8rsc\pico18x18m.bmp /c24rsc\pico40x40.bmp /8rsc\pico40x40m.bmp /c24rsc\pico64x64.bmp /8rsc\pico64x64m.bmp" -l"\Z\Resource\Apps\:rsc"
|
||||
@perl -S ecopyfile.pl "rsc\PicoDrive.mbg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.mbg"
|
||||
|
||||
# Resource Z\Resource\Apps\PicoDrive.RSC
|
||||
|
||||
rsc\PicoDrive.RSC : rsc\PicoDrive.rss picodrive.hrh
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2_NODRV)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive.rss" -o$@ \
|
||||
-h"rsc\PicoDrive.rsg" -t"rsc" -l"Z\Resource\Apps:rsc"
|
||||
@perl -S ecopyfile.pl "rsc\PicoDrive.rsg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.RSG"
|
||||
|
||||
# Resource Z\private\10003a3f\apps\PicoDrive_reg.RSC
|
||||
|
||||
rsc\PicoDrive_reg.RSC : rsc\PicoDrive_reg.rss
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_reg.rss" -o$@ \
|
||||
-t"rsc" -l"Z\private\10003a3f\apps:rsc"
|
||||
|
||||
# Resource Z\Resource\Apps\PicoDrive_loc.RSC
|
||||
|
||||
rsc\PicoDrive_loc.RSC : rsc\PicoDrive_loc.rss
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_loc.rss" -o$@ \
|
||||
-t"rsc" -l"Z\Resource\Apps:rsc"
|
||||
# App.o can't be optimized
|
||||
#App.o : App.cpp
|
||||
# $(CC) $(CXXFLAGS) -O0 -c $< -o $@
|
||||
|
|
307
platform/uiq3/Makefile.old
Normal file
307
platform/uiq3/Makefile.old
Normal file
|
@ -0,0 +1,307 @@
|
|||
# makefile for GCCE
|
||||
|
||||
# settings
|
||||
#dprint = 1
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_blit = 1
|
||||
#use_musashi = 1
|
||||
#up = 1
|
||||
#sis = 1
|
||||
|
||||
# targets
|
||||
all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe
|
||||
|
||||
clean :
|
||||
@perl -S ermdir.pl _build
|
||||
@erase 2>>nul rsc\*.rsc
|
||||
@erase 2>>nul rsc\*.rsg
|
||||
@erase 2>>nul rsc\PicoDrive.mb?
|
||||
|
||||
|
||||
# paths
|
||||
$(EPOCROOT2)epoc32 :
|
||||
@echo Please set EPOCROOT2 environmental variable to full path to your SDK
|
||||
@echo with ending slash (something like C:\Uiq_21\)
|
||||
@cd : 2> NUL # do something stupid to make it silently fail
|
||||
|
||||
# resource compiler hates drive lettered paths
|
||||
EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2)))
|
||||
EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5
|
||||
|
||||
# C/C++ Compiler
|
||||
CC=arm-none-symbianelf-gcc
|
||||
|
||||
# Linker
|
||||
LD=arm-none-symbianelf-ld
|
||||
|
||||
# Assembler
|
||||
ASM=arm-none-symbianelf-as
|
||||
|
||||
# Archiver
|
||||
AR=arm-none-symbianelf-ar
|
||||
|
||||
# Strip
|
||||
STRIP=arm-none-symbianelf-strip
|
||||
|
||||
# gcc config
|
||||
GCCDEFINES = -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__ \
|
||||
-D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ \
|
||||
-D__MARM_ARMV5__ -D__PRODUCT_INCLUDE__=\"$(EPOCROOT2)epoc32/include/variant/UIQ_3.0.hrh\"
|
||||
|
||||
GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE
|
||||
|
||||
# 'CSL Arm Toolchain' stuff must be specified after Symbian includes
|
||||
GCCINCLUDES = -I "$(EPOCROOT2)epoc32\include\variant" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" \
|
||||
-I "$(EPOCROOT2)\CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3\include" -I.
|
||||
|
||||
# -funit-at-a-time is not compatible with SDK, it either has linker problems or does not start on device
|
||||
GCCCOMMFLAGS = -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -nostdinc -msoft-float \
|
||||
$(GCCINCLUDES) -include "$(EPOCROOT2)EPOC32/INCLUDE/GCCE/GCCE.h" -marm
|
||||
|
||||
GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time
|
||||
GCCCFLAGS = -x c -O3 -fno-unit-at-a-time
|
||||
|
||||
GCCLDFLAGS = -L"$(EPOCROOT2)CSL Arm Toolchain\arm-none-symbianelf\lib" \
|
||||
-L"$(EPOCROOT2)CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3" \
|
||||
--target1-abs --no-undefined -nostdlib -shared -Ttext 0x8000 -Tdata 0x400000 --default-symver
|
||||
|
||||
# libs
|
||||
LIBS = \
|
||||
$(EPOCLIB)\LIB\ESTLIB.dso \
|
||||
$(EPOCLIB)\urel\qikalloc.lib \
|
||||
$(EPOCLIB)\LIB\euser.dso \
|
||||
$(EPOCLIB)\LIB\apparc.dso \
|
||||
$(EPOCLIB)\LIB\cone.dso \
|
||||
$(EPOCLIB)\LIB\eikcore.dso \
|
||||
$(EPOCLIB)\LIB\eikcoctl.dso \
|
||||
$(EPOCLIB)\LIB\qikcore.dso \
|
||||
$(EPOCLIB)\LIB\qikdlg.dso \
|
||||
$(EPOCLIB)\LIB\etext.dso \
|
||||
$(EPOCLIB)\LIB\bafl.dso \
|
||||
$(EPOCLIB)\LIB\efsrv.dso \
|
||||
$(EPOCLIB)\LIB\eikctl.dso \
|
||||
$(EPOCLIB)\LIB\WS32.dso \
|
||||
$(EPOCLIB)\LIB\EIKDLG.dso \
|
||||
$(EPOCLIB)\LIB\GDI.dso \
|
||||
$(EPOCLIB)\LIB\estor.dso \
|
||||
$(EPOCLIB)\LIB\EZLIB.dso \
|
||||
$(EPOCLIB)\LIB\HAL.dso \
|
||||
$(EPOCLIB)\LIB\mediaclient.dso \
|
||||
$(EPOCLIB)\LIB\mediaclientaudiostream.dso
|
||||
|
||||
LIBS += \
|
||||
$(EPOCLIB)\LIB\qikallocdll.dso \
|
||||
$(EPOCLIB)\UREL\usrt2_2.lib \
|
||||
$(EPOCLIB)\LIB\dfpaeabi.dso \
|
||||
$(EPOCLIB)\LIB\dfprvct2_2.dso \
|
||||
$(EPOCLIB)\LIB\drtaeabi.dso \
|
||||
$(EPOCLIB)\LIB\scppnwdl.dso \
|
||||
$(EPOCLIB)\LIB\drtrvct2_2.dso
|
||||
|
||||
|
||||
# objects
|
||||
|
||||
# launcher
|
||||
OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o
|
||||
# engine
|
||||
OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o
|
||||
|
||||
# Pico
|
||||
OBJECTS += _build\Area.o _build\Cart.o _build\Utils.o _build\Memory.o _build\Misc.o \
|
||||
_build\Pico.o _build\Sek.o _build\VideoPort.o _build\Draw2.o _build\Draw.o
|
||||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
GCCDEFINES += -D_ASM_DRAW_C
|
||||
OBJECTS += _build\draw_asm.o _build\draw2_asm.o
|
||||
endif
|
||||
ifeq "$(asm_memory)" "1"
|
||||
GCCDEFINES += -D_ASM_MEMORY_C
|
||||
OBJECTS += _build\memory_asm.o
|
||||
endif
|
||||
# Pico - sound
|
||||
OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o
|
||||
# misc
|
||||
OBJECTS += _build\unzip.o _build\gzio_symb.o
|
||||
# CPU cores
|
||||
ifeq "$(use_musashi)" "1"
|
||||
GCCDEFINES += -DEMU_M68K
|
||||
OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o
|
||||
else
|
||||
GCCDEFINES += -DEMU_C68K
|
||||
OBJECTS += _build\Cyclone.o
|
||||
endif
|
||||
ifeq "$(asm_blit)" "1"
|
||||
OBJECTS += _build\blit_asm.o
|
||||
else
|
||||
OBJECTS += _build\blit.o
|
||||
endif
|
||||
GCCDEFINES += -D_USE_DRZ80
|
||||
OBJECTS += _build\DrZ80.o
|
||||
GCCDEFINES += -D_ASM_YM2612_C
|
||||
OBJECTS += _build\ym2612_asm.o
|
||||
|
||||
|
||||
|
||||
# dprint
|
||||
ifeq "$(dprint)" "1"
|
||||
GCCDEFINES += -D__DEBUG_PRINT
|
||||
endif
|
||||
|
||||
|
||||
define crule
|
||||
@echo * $<
|
||||
@$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@
|
||||
endef
|
||||
|
||||
define cpprule
|
||||
@echo * $<
|
||||
@$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@
|
||||
endef
|
||||
|
||||
define asmrule
|
||||
@echo * $<
|
||||
@$(ASM) -marmv4t -mthumb-interwork -o $@ $^
|
||||
endef
|
||||
|
||||
# object making rules
|
||||
_build\App.o : App.cpp
|
||||
$(cpprule)
|
||||
_build\Engine.o : Engine.cpp
|
||||
$(cpprule)
|
||||
_build\Dialogs.o : Dialogs.cpp
|
||||
$(cpprule)
|
||||
_build\CSimpleTextParser.o : CSimpleTextParser.cpp
|
||||
$(cpprule)
|
||||
|
||||
_build\main.o : engine\main.cpp
|
||||
$(cpprule)
|
||||
_build\vid.o : engine\vid.cpp
|
||||
$(cpprule)
|
||||
_build\polledas.o: engine\polledas.cpp
|
||||
$(cpprule)
|
||||
_build\audio_mediaserver.o : engine\audio_mediaserver.cpp
|
||||
$(cpprule)
|
||||
_build\debug.o : engine\debug.cpp
|
||||
$(cpprule)
|
||||
_build\blit.o : engine\blit.c
|
||||
$(crule)
|
||||
|
||||
_build\Area.o : ..\..\Pico\Area.c
|
||||
$(crule)
|
||||
_build\Cart.o : ..\..\Pico\Cart.c
|
||||
$(crule)
|
||||
_build\Draw.o : ..\..\Pico\Draw.c
|
||||
$(crule)
|
||||
_build\Draw2.o : ..\..\Pico\Draw2.c
|
||||
$(crule)
|
||||
_build\Memory.o : ..\..\Pico\Memory.c
|
||||
$(crule)
|
||||
_build\Misc.o : ..\..\Pico\Misc.c
|
||||
$(crule)
|
||||
_build\Pico.o : ..\..\Pico\Pico.c
|
||||
$(crule)
|
||||
_build\Sek.o : ..\..\Pico\Sek.c
|
||||
$(crule)
|
||||
_build\Utils.o : ..\..\Pico\Utils.c
|
||||
$(crule)
|
||||
_build\VideoPort.o : ..\..\Pico\VideoPort.c
|
||||
$(crule)
|
||||
_build\sound.o : ..\..\Pico\sound\sound.c
|
||||
$(crule)
|
||||
_build\sn76496.o : ..\..\Pico\sound\sn76496.c
|
||||
$(crule)
|
||||
_build\ym2612.o : ..\..\Pico\sound\ym2612.c
|
||||
$(crule)
|
||||
|
||||
_build\unzip.o : ..\..\unzip\unzip.c
|
||||
$(crule)
|
||||
_build\gzio_symb.o : ..\..\zlib\gzio_symb.c
|
||||
$(crule)
|
||||
|
||||
_build\m68kcpu.o : ..\..\musashi\m68kcpu.c
|
||||
$(crule)
|
||||
_build\m68kopac.o : ..\..\musashi\m68kopac.c
|
||||
$(crule)
|
||||
_build\m68kopdm.o : ..\..\musashi\m68kopdm.c
|
||||
$(crule)
|
||||
_build\m68kopnz.o : ..\..\musashi\m68kopnz.c
|
||||
$(crule)
|
||||
_build\m68kops.o : ..\..\musashi\m68kops.c
|
||||
$(crule)
|
||||
|
||||
_build\Cyclone.o : ..\..\cpu\Cyclone\proj\Cyclone.s
|
||||
$(asmrule)
|
||||
_build\DrZ80.o : ..\..\cpu\DrZ80\drz80.s
|
||||
$(asmrule)
|
||||
_build\draw_asm.o : ..\..\Pico\draw.s
|
||||
$(asmrule)
|
||||
_build\draw2_asm.o : ..\..\Pico\draw2.s
|
||||
$(asmrule)
|
||||
_build\memory_asm.o : ..\..\Pico\memory.s
|
||||
$(asmrule)
|
||||
_build\ym2612_asm.o : ..\..\Pico\sound\ym2612.s
|
||||
$(asmrule)
|
||||
_build\blit_asm.o : engine\blit.s
|
||||
$(asmrule)
|
||||
|
||||
|
||||
PicoDrive.exe : $(OBJECTS)
|
||||
@echo * ld
|
||||
@$(LD) $(GCCLDFLAGS) -soname PicoDrive{000a0000}[a00010f3].exe --entry _E32Startup -u _E32Startup \
|
||||
$(EPOCROOT2)EPOC32\RELEASE\ARMV5\UREL\EEXE.LIB -o "_build\PicoDrive_elf.exe" -Map "_build\PicoDrive.exe.map" $(OBJECTS) $(LIBS) -lsupc++ -lgcc
|
||||
# @echo * strip
|
||||
# @$(STRIP) _build\PicoDrive_elf.exe
|
||||
@echo * elf2e32
|
||||
@elf2e32 --sid=0xa00010f3 --heap=0x00000100,0x00800000 --stack=0x00003000 \
|
||||
--uid1=0x1000007a --uid2=0x100039ce --uid3=0xa00010f3 \
|
||||
--capability=none --fpu=softvfp --targettype=EXE --output="$@" \
|
||||
--elfinput="_build\PicoDrive_elf.exe" --linkas=PicoDrive{000a0000}[a00010f3].exe --libpath="$(EPOCLIB)\LIB"
|
||||
ifeq "$(sis)" "1"
|
||||
@make -C _out
|
||||
ifeq "$(up)" "1"
|
||||
@qup.cmd
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
MAKEDIRS : _build
|
||||
|
||||
_build :
|
||||
# @echo * making build dir
|
||||
@perl -S emkdir.pl $@
|
||||
|
||||
|
||||
# BitMap PicoDrive.mbm
|
||||
|
||||
RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg
|
||||
|
||||
rsc\PicoDrive.mbg : rsc\PicoDrive.mbm
|
||||
|
||||
rsc\PicoDrive.mbm : rsc\pico18x18.bmp rsc\pico18x18m.bmp rsc\pico40x40.bmp rsc\pico40x40m.bmp rsc\pico64x64.bmp rsc\pico64x64m.bmp
|
||||
@echo * $@
|
||||
@perl -S epocmbm.pl -h"rsc\PicoDrive.mbg" -o"rsc\PicoDrive.mbm" -l"\Z\Resource\Apps\:rsc" \
|
||||
-b"/c24rsc\pico18x18.bmp /8rsc\pico18x18m.bmp /c24rsc\pico40x40.bmp /8rsc\pico40x40m.bmp /c24rsc\pico64x64.bmp /8rsc\pico64x64m.bmp" -l"\Z\Resource\Apps\:rsc"
|
||||
@perl -S ecopyfile.pl "rsc\PicoDrive.mbg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.mbg"
|
||||
|
||||
# Resource Z\Resource\Apps\PicoDrive.RSC
|
||||
|
||||
rsc\PicoDrive.RSC : rsc\PicoDrive.rss picodrive.hrh
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2_NODRV)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive.rss" -o$@ \
|
||||
-h"rsc\PicoDrive.rsg" -t"rsc" -l"Z\Resource\Apps:rsc"
|
||||
@perl -S ecopyfile.pl "rsc\PicoDrive.rsg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.RSG"
|
||||
|
||||
# Resource Z\private\10003a3f\apps\PicoDrive_reg.RSC
|
||||
|
||||
rsc\PicoDrive_reg.RSC : rsc\PicoDrive_reg.rss
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_reg.rss" -o$@ \
|
||||
-t"rsc" -l"Z\private\10003a3f\apps:rsc"
|
||||
|
||||
# Resource Z\Resource\Apps\PicoDrive_loc.RSC
|
||||
|
||||
rsc\PicoDrive_loc.RSC : rsc\PicoDrive_loc.rss
|
||||
@echo * $@
|
||||
@perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_loc.rss" -o$@ \
|
||||
-t"rsc" -l"Z\Resource\Apps:rsc"
|
|
@ -1,7 +0,0 @@
|
|||
all: PicoDrive.SIS
|
||||
|
||||
PicoDrive.SIS: ..\PicoDrive.exe ..\rsc\PicoDrive.rsc ..\rsc\PicoDrive.mbm ..\rsc\PicoDrive_loc.rsc ..\rsc\PicoDrive_reg.rsc
|
||||
makesis PicoDrive.pkg
|
||||
|
||||
clean:
|
||||
@erase 2>>nul PicoDrive.pkg
|
|
@ -1,25 +0,0 @@
|
|||
;
|
||||
|
||||
; List of localised vendor names - one per language. At least one must be provided (English [EN]).
|
||||
; List must correspond to list of languages specified elsewhere in the .pkg
|
||||
%{"notaz"}
|
||||
|
||||
; The non-localised, globally unique vendor name (mandatory)
|
||||
:"notaz"
|
||||
|
||||
; Package header
|
||||
; Name, UID3, Major, Minor, Build, Package-type
|
||||
#{"PicoDrive"}, (0xA00010F3), 0, 96, 0, TYPE=SA
|
||||
|
||||
; ProductID for UIQ 3.0
|
||||
; Product/platform version UID, Major, Minor, Build, Component name
|
||||
(0x101F6300), 3, 0, 0, {"UIQ30ProductID"}
|
||||
|
||||
|
||||
; Files to install for the application
|
||||
; If you move the example to another destination then you also need to change these paths.
|
||||
"..\PicoDrive.exe"-"!:\sys\bin\PicoDrive.exe"
|
||||
"..\rsc\PicoDrive.rsc"-"!:\resource\apps\PicoDrive.rsc"
|
||||
"..\rsc\PicoDrive.mbm"-"!:\resource\apps\PicoDrive.mbm"
|
||||
"..\rsc\PicoDrive_loc.rsc"-"!:\resource\apps\PicoDrive_loc.rsc"
|
||||
"..\rsc\PicoDrive_reg.rsc"-"!:\private\10003a3f\import\apps\PicoDrive_reg.rsc"
|
Binary file not shown.
|
@ -1,25 +0,0 @@
|
|||
;
|
||||
|
||||
; List of localised vendor names - one per language. At least one must be provided (English [EN]).
|
||||
; List must correspond to list of languages specified elsewhere in the .pkg
|
||||
%{"notaz"}
|
||||
|
||||
; The non-localised, globally unique vendor name (mandatory)
|
||||
:"notaz"
|
||||
|
||||
; Package header
|
||||
; Name, UID3, Major, Minor, Build, Package-type
|
||||
#{"PicoDrive"}, (0xA00010F3), 0, 92, 0, TYPE=SA
|
||||
|
||||
; ProductID for UIQ 3.0
|
||||
; Product/platform version UID, Major, Minor, Build, Component name
|
||||
(0x101F6300), 3, 0, 0, {"UIQ30ProductID"}
|
||||
|
||||
|
||||
; Files to install for the application
|
||||
; If you move the example to another destination then you also need to change these paths.
|
||||
"..\..\..\..\..\..\UIQ3SDK\epoc32\release\gcce\urel\PicoDrive.exe"-"!:\sys\bin\PicoDrive.exe"
|
||||
"..\..\..\..\..\..\UIQ3SDK\epoc32\data\Z\Resource\Apps\PicoDrive.rsc"-"!:\resource\apps\PicoDrive.rsc"
|
||||
"..\..\..\..\..\..\UIQ3SDK\epoc32\data\Z\Resource\Apps\PicoDrive_loc.rsc"-"!:\resource\apps\PicoDrive_loc.rsc"
|
||||
"..\..\..\..\..\..\UIQ3SDK\epoc32\data\z\Private\10003a3f\Apps\PicoDrive_reg.rsc"-"!:\private\10003a3f\import\apps\PicoDrive_reg.rsc"
|
||||
"..\..\..\..\..\..\UIQ3SDK\epoc32\data\Z\Resource\Apps\PicoDrive.mbm"-"!:\resource\apps\PicoDrive.mbm"
|
138
platform/uiq3/emu.c
Normal file
138
platform/uiq3/emu.c
Normal file
|
@ -0,0 +1,138 @@
|
|||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "../common/emu.h"
|
||||
#include "../common/config.h"
|
||||
#include "../common/menu.h"
|
||||
#include "Pico/PicoInt.h"
|
||||
|
||||
const char * const keyNames[] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
};
|
||||
|
||||
int emu_getMainDir(char *dst, int len)
|
||||
{
|
||||
strcpy(dst, "D:\\other\\PicoDrive\\");
|
||||
return strlen(dst);
|
||||
}
|
||||
|
||||
void emu_Init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
// make dirs for saves, cfgs, etc.
|
||||
ret = mkdir("D:\\other\\PicoDrive", 0777);
|
||||
if (ret == 0)
|
||||
{
|
||||
mkdir("D:\\other\\PicoDrive\\mds", 0777);
|
||||
mkdir("D:\\other\\PicoDrive\\srm", 0777);
|
||||
mkdir("D:\\other\\PicoDrive\\brm", 0777);
|
||||
}
|
||||
|
||||
emu_prepareDefaultConfig();
|
||||
config_readlrom("D:\\other\\PicoDrive\\config.cfg");
|
||||
emu_ReadConfig(0, 0);
|
||||
//PicoInit();
|
||||
}
|
||||
|
||||
void emu_Deinit(void)
|
||||
{
|
||||
// saves volume and last ROM
|
||||
emu_WriteConfig(0);
|
||||
//PicoExit();
|
||||
}
|
||||
|
||||
void menu_romload_prepare(const char *rom_name)
|
||||
{
|
||||
}
|
||||
|
||||
void menu_romload_end(void)
|
||||
{
|
||||
}
|
||||
|
||||
void emu_prepareDefaultConfig(void)
|
||||
{
|
||||
memset(&defaultConfig, 0, sizeof(defaultConfig));
|
||||
defaultConfig.EmuOpt = 0x1d | 0x680; // | confirm_save, cd_leds, 16bit rend
|
||||
defaultConfig.s_PicoOpt = 0x0f | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES;
|
||||
defaultConfig.s_PsndRate = 22050;
|
||||
defaultConfig.s_PicoRegion = 0; // auto
|
||||
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
|
||||
defaultConfig.s_PicoCDBuffers = 0;
|
||||
defaultConfig.Frameskip = -1; // auto
|
||||
defaultConfig.volume = 80;
|
||||
defaultConfig.scaling = 0;
|
||||
}
|
||||
|
||||
/* used by config engine only, not actual menus */
|
||||
menu_entry opt_entries[] =
|
||||
{
|
||||
{ NULL, MB_NONE, MA_OPT_RENDERER, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "Scaling", MB_RANGE, MA_OPT_SCALING, ¤tConfig.scaling, 0, 0, 2, 1, 1 },
|
||||
{ "Rotation", MB_RANGE, MA_OPT_ROTATION, ¤tConfig.rotation, 0, 0, 3, 1, 1 },
|
||||
{ "Accurate sprites", MB_ONOFF, MA_OPT_ACC_SPRITES, &PicoOpt, 0x080, 0, 0, 0, 1 },
|
||||
{ "Show FPS", MB_ONOFF, MA_OPT_SHOW_FPS, ¤tConfig.EmuOpt, 0x002, 0, 0, 1, 1 },
|
||||
{ NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 },
|
||||
{ "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.EmuOpt, 0x004, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_OPT_REGION, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x001, 0, 0, 1, 1 },
|
||||
};
|
||||
|
||||
#define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0]))
|
||||
const int opt_entry_count = OPT_ENTRY_COUNT;
|
||||
|
||||
menu_entry opt2_entries[] =
|
||||
{
|
||||
{ "Disable sprite limit", MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
|
||||
{ "Emulate Z80", MB_ONOFF, MA_OPT2_ENABLE_Z80, &PicoOpt, 0x00004, 0, 0, 1, 1 },
|
||||
{ "Emulate YM2612 (FM)", MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
|
||||
{ "Emulate SN76496 (PSG)", MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },
|
||||
{ "gzip savestates", MB_ONOFF, MA_OPT2_GZIP_STATES, ¤tConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },
|
||||
{ "SVP dynarec", MB_ONOFF, MA_OPT2_SVP_DYNAREC, &PicoOpt, 0x20000, 0, 0, 1, 1 },
|
||||
{ "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
|
||||
};
|
||||
|
||||
#define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))
|
||||
const int opt2_entry_count = OPT2_ENTRY_COUNT;
|
||||
|
||||
menu_entry cdopt_entries[] =
|
||||
{
|
||||
{ "CD LEDs", MB_ONOFF, MA_CDOPT_LEDS, ¤tConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ "CDDA audio (using mp3s)", MB_ONOFF, MA_CDOPT_CDDA, &PicoOpt, 0x0800, 0, 0, 1, 1 },
|
||||
{ "PCM audio", MB_ONOFF, MA_CDOPT_PCM, &PicoOpt, 0x0400, 0, 0, 1, 1 },
|
||||
{ NULL, MB_NONE, MA_CDOPT_READAHEAD, NULL, 0, 0, 0, 1, 1 },
|
||||
{ "SaveRAM cart", MB_ONOFF, MA_CDOPT_SAVERAM, &PicoOpt, 0x8000, 0, 0, 1, 1 },
|
||||
{ "Scale/Rot. fx (slow)", MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
|
||||
{ "Better sync (slow)", MB_ONOFF, MA_CDOPT_BETTER_SYNC, &PicoOpt, 0x2000, 0, 0, 1, 1 },
|
||||
};
|
||||
|
||||
#define CDOPT_ENTRY_COUNT (sizeof(cdopt_entries) / sizeof(cdopt_entries[0]))
|
||||
const int cdopt_entry_count = CDOPT_ENTRY_COUNT;
|
||||
|
||||
menu_entry ctrlopt_entries[] =
|
||||
{
|
||||
{ "6 button pad", MB_ONOFF, MA_OPT_6BUTTON_PAD, &PicoOpt, 0x020, 0, 0, 1, 1 },
|
||||
{ "Turbo rate", MB_RANGE, MA_CTRL_TURBO_RATE, ¤tConfig.turbo_rate, 0, 1, 30, 1, 1 },
|
||||
};
|
||||
|
||||
#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0]))
|
||||
const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT;
|
||||
|
||||
me_bind_action emuctrl_actions[] =
|
||||
{
|
||||
{ "Load State ", 1<<28 },
|
||||
{ "Save State ", 1<<27 },
|
||||
{ "Pause Emu ", 1<<26 },
|
||||
{ "Switch Renderer", 1<<25 },
|
||||
{ "Prev save slot ", 1<<23 },
|
||||
{ "Next save slot ", 1<<22 },
|
||||
{ "Volume down ", 1<<21 },
|
||||
{ "Volume up ", 1<<20 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
11
platform/uiq3/emu.h
Normal file
11
platform/uiq3/emu.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void emu_Init(void);
|
||||
void emu_Deinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
#include "audio_mediaserver.h"
|
||||
#include "debug.h"
|
||||
|
||||
//#define DEBUG_UNDERFLOWS
|
||||
//#undef DEBUGPRINT
|
||||
//#define DEBUGPRINT(x...)
|
||||
|
||||
|
@ -31,16 +32,16 @@ const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow
|
|||
*
|
||||
*******************************************/
|
||||
|
||||
CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec)
|
||||
: iRate(aRate), iStereo(aStereo), iWritesPerSec(aWritesPerSec)
|
||||
CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume)
|
||||
: iRate(aRate), iStereo(aStereo), iWritesPerSec(aWritesPerSec), iVolume(aVolume)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec)
|
||||
CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume)
|
||||
{
|
||||
DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i)"), aRate, aStereo, aWritesPerSec);
|
||||
CGameAudioMS* self = new(ELeave) CGameAudioMS(aRate, aStereo, aWritesPerSec);
|
||||
DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"), aRate, aStereo, aWritesPerSec, aVolume);
|
||||
CGameAudioMS* self = new(ELeave) CGameAudioMS(aRate, aStereo, aWritesPerSec, aVolume);
|
||||
CleanupStack::PushL(self);
|
||||
self->ConstructL();
|
||||
CleanupStack::Pop(); // self
|
||||
|
@ -85,25 +86,29 @@ void CGameAudioMS::ConstructL()
|
|||
iMdaAudioDataSettings.iCaps = TMdaAudioDataSettings::ESampleRateFixed | iMdaAudioDataSettings.iSampleRate;
|
||||
iMdaAudioDataSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
|
||||
|
||||
int pcmFrames = iRate / iWritesPerSec;
|
||||
pcmFrames += iRate - (iRate / iWritesPerSec) * iWritesPerSec; // add division remainder too for our buffer size
|
||||
iBufferedFrames = iWritesPerSec / KUpdatesPerSec;
|
||||
iMaxWriteSamples = iRate / iWritesPerSec;
|
||||
if (iRate % iWritesPerSec)
|
||||
iMaxWriteSamples++;
|
||||
int bufferedFrames = iWritesPerSec / KUpdatesPerSec;
|
||||
|
||||
TInt bytesPerFrame = pcmFrames << (iStereo?2:1);
|
||||
iBufferSize = iMaxWriteSamples * (iStereo ? 4 : 2);
|
||||
iBufferSize *= bufferedFrames;
|
||||
for (TInt i=0 ; i<KSoundBuffers ; i++)
|
||||
{
|
||||
iSoundBuffers[i] = HBufC8::NewL(bytesPerFrame * iBufferedFrames);
|
||||
iSoundBuffers[i]->Des().FillZ (bytesPerFrame * iBufferedFrames);
|
||||
iSoundBuffers[i] = HBufC8::NewL(iBufferSize);
|
||||
iSoundBuffers[i]->Des().FillZ (iBufferSize);
|
||||
}
|
||||
|
||||
iCurrentBuffer = 0;
|
||||
iCurrentBufferSize = 0;
|
||||
|
||||
DEBUGPRINT(_L("sound: iMaxWriteSamples: %i, iBufferSize: %i"), iMaxWriteSamples, iBufferSize);
|
||||
|
||||
// here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.
|
||||
iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);
|
||||
if(iMdaAudioOutputStream) {
|
||||
iVolume = iMdaAudioOutputStream->MaxVolume();
|
||||
DEBUGPRINT(_L("MaxVolume: %i"), iVolume);
|
||||
if (iMdaAudioOutputStream) {
|
||||
if (iVolume < 0 || iVolume > iMdaAudioOutputStream->MaxVolume())
|
||||
iVolume = iMdaAudioOutputStream->MaxVolume();
|
||||
delete iMdaAudioOutputStream;
|
||||
iMdaAudioOutputStream = 0;
|
||||
}
|
||||
|
@ -113,11 +118,18 @@ void CGameAudioMS::ConstructL()
|
|||
// to be used when iSoundBuffers are used directly
|
||||
TInt16 *CGameAudioMS::NextFrameL(TInt aPcmFrames)
|
||||
{
|
||||
iCurrentPosition += aPcmFrames << (iStereo?1:0);
|
||||
iCurrentBufferSize += aPcmFrames << (iStereo?2:1);
|
||||
TInt mul = iStereo ? 4 : 2;
|
||||
TInt bytes = aPcmFrames * mul;
|
||||
iCurrentPosition += bytes / 2;
|
||||
iCurrentBufferSize += bytes;
|
||||
|
||||
if (++iFrameCount == iBufferedFrames)
|
||||
if (aPcmFrames > iMaxWriteSamples) {
|
||||
DEBUGPRINT(_L("too many samples: %i > %i"), aPcmFrames, iMaxWriteSamples);
|
||||
}
|
||||
|
||||
if (iCurrentBufferSize + iMaxWriteSamples * mul > iBufferSize)
|
||||
{
|
||||
//DEBUGPRINT(_L("write on iCurrentBufferSize %i"), iCurrentBufferSize);
|
||||
WriteBlockL();
|
||||
}
|
||||
|
||||
|
@ -162,9 +174,9 @@ void CGameAudioMS::WriteBlockL()
|
|||
}
|
||||
}
|
||||
|
||||
iFrameCount = 0;
|
||||
if (++iCurrentBuffer == KSoundBuffers)
|
||||
iCurrentBuffer = 0;
|
||||
iSoundBuffers[iCurrentBuffer]->Des().SetMax();
|
||||
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
|
||||
iCurrentBufferSize = 0;
|
||||
}
|
||||
|
@ -189,7 +201,6 @@ TInt16 *CGameAudioMS::ResumeL()
|
|||
iListener.iIsOpen = ETrue;
|
||||
iListener.iUnderflowed = 1;
|
||||
iListener.iLastError = 0;
|
||||
iFrameCount = 0;
|
||||
iCurrentBufferSize = 0;
|
||||
iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();
|
||||
return iCurrentPosition;
|
||||
|
@ -198,7 +209,9 @@ TInt16 *CGameAudioMS::ResumeL()
|
|||
// handles underflow condition
|
||||
void CGameAudioMS::UnderflowedL()
|
||||
{
|
||||
#ifdef DEBUG_UNDERFLOWS
|
||||
DEBUGPRINT(_L("UnderflowedL()"));
|
||||
#endif
|
||||
|
||||
if (iListener.iLastError != KErrUnderflow)
|
||||
{
|
||||
|
@ -243,23 +256,30 @@ void CGameAudioMS::WaitForOpenToCompleteL()
|
|||
User::LeaveIfError(KErrNotSupported);
|
||||
}
|
||||
|
||||
void CGameAudioMS::ChangeVolume(TInt aUp)
|
||||
TInt CGameAudioMS::ChangeVolume(TInt aUp)
|
||||
{
|
||||
//DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp);
|
||||
|
||||
if (iMdaAudioOutputStream) {
|
||||
if (aUp) {
|
||||
if (iVolume < iMdaAudioOutputStream->MaxVolume()) iVolume+=5;
|
||||
iVolume += 5;
|
||||
if (iVolume > iMdaAudioOutputStream->MaxVolume())
|
||||
iVolume = iMdaAudioOutputStream->MaxVolume();
|
||||
} else {
|
||||
if (iVolume > 0) iVolume-=5;
|
||||
iVolume -= 5;
|
||||
if (iVolume < 0) iVolume = 0;
|
||||
}
|
||||
iMdaAudioOutputStream->SetVolume(iVolume);
|
||||
}
|
||||
|
||||
return iVolume;
|
||||
}
|
||||
|
||||
void TGameAudioEventListener::MaoscOpenComplete(TInt aError)
|
||||
{
|
||||
#ifdef DEBUG_UNDERFLOWS
|
||||
DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError);
|
||||
#endif
|
||||
|
||||
iIsOpen = ETrue;
|
||||
if(aError) {
|
||||
|
@ -284,7 +304,9 @@ void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuff
|
|||
|
||||
void TGameAudioEventListener::MaoscPlayComplete(TInt aError)
|
||||
{
|
||||
#ifdef DEBUG_UNDERFLOWS
|
||||
DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError);
|
||||
#endif
|
||||
if(aError) {
|
||||
iLastError = aError;
|
||||
iUnderflowed++; // never happened to me while testing, but just in case
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#ifndef __AUDIO_MEDIASERVER_H
|
||||
#define __AUDIO_MEDIASERVER_H
|
||||
|
||||
#include <Mda\Common\Audio.h>
|
||||
#include <MdaAudioOutputStream.h>
|
||||
#include <mda/common/audio.h>
|
||||
#include <mdaaudiooutputstream.h>
|
||||
|
||||
//#include "audio.h"
|
||||
#include "polledas.h"
|
||||
#include "PolledAS.h"
|
||||
|
||||
const TInt KSoundBuffers = 4;
|
||||
|
||||
|
@ -44,12 +44,12 @@ public: // implements IGameAudio
|
|||
TInt16 *NextFrameL(TInt aPcmFrames);
|
||||
TInt16 *ResumeL();
|
||||
void Pause();
|
||||
void ChangeVolume(TInt aUp);
|
||||
TInt ChangeVolume(TInt aUp);
|
||||
|
||||
public:
|
||||
~CGameAudioMS();
|
||||
CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec);
|
||||
static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec);
|
||||
CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);
|
||||
static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);
|
||||
|
||||
protected:
|
||||
void WriteBlockL();
|
||||
|
@ -70,12 +70,12 @@ protected:
|
|||
CPolledActiveScheduler *iScheduler;
|
||||
|
||||
HBufC8* iSoundBuffers[KSoundBuffers];
|
||||
TInt iWritesPerSec;
|
||||
TInt iBufferedFrames;
|
||||
TInt iWritesPerSec; // fps, may be more actual writes
|
||||
TInt iMaxWriteSamples; // max samples per write
|
||||
TInt16* iCurrentPosition;
|
||||
TInt iCurrentBuffer;
|
||||
TInt iCurrentBufferSize;
|
||||
TInt iFrameCount;
|
||||
TInt iCurrentBuffer; // active buffer
|
||||
TInt iCurrentBufferSize; // bytes filled in buffer
|
||||
TInt iBufferSize;
|
||||
CMdaServer* iServer;
|
||||
|
||||
TInt64 iTime;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@ vim:filetype=armasm
|
||||
@ some color conversion and blitting routines
|
||||
|
||||
@ (c) Copyright 2006, notaz
|
||||
|
@ -693,3 +694,13 @@ vidClear:
|
|||
orr r12, #(240/16-1)<<16
|
||||
b .loopVidClear
|
||||
|
||||
@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
.equ EExecSetExceptionHandler, (90)
|
||||
|
||||
.global my_SetExceptionHandler
|
||||
|
||||
my_SetExceptionHandler:
|
||||
mov ip, lr
|
||||
swi EExecSetExceptionHandler
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include <e32svr.h> // RDebug
|
||||
#include "debug.h"
|
||||
|
||||
//#define LOG_FILE "C:\\logs\\pico.log"
|
||||
#define LOG_FILE _L("D:\\pico.log")
|
||||
|
||||
#ifdef __WINS__
|
||||
|
||||
void ExceptionHandler(TExcType exc) {}
|
||||
|
@ -40,6 +43,7 @@ static const wchar_t * const exception_names[] = {
|
|||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end)
|
||||
{
|
||||
TUint pc, sp;
|
||||
|
@ -63,22 +67,24 @@ static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TU
|
|||
chunk.Close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// tmp
|
||||
#if defined(__DEBUG_PRINT)
|
||||
extern "C" char *debugString();
|
||||
extern "C" char *PDebugMain();
|
||||
#endif
|
||||
|
||||
// our very own exception handler
|
||||
void ExceptionHandler(TExcType exc)
|
||||
{
|
||||
DEBUGPRINT(_L("ExceptionHandler() called!!!")); // this seems to never be called
|
||||
|
||||
#if 0
|
||||
TUint lr, sp, i;
|
||||
TUint stack_end = 0; // ending address of our stack chunk
|
||||
TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk
|
||||
TUint guessed_address = 0;
|
||||
|
||||
DEBUGPRINT(_L("ExceptionHandler()")); // this seems to never be called
|
||||
|
||||
asm volatile ("str lr, %0" : "=m" (lr) );
|
||||
asm volatile ("str sp, %0" : "=m" (sp) );
|
||||
|
||||
|
@ -136,11 +142,11 @@ void ExceptionHandler(TExcType exc)
|
|||
|
||||
// tmp
|
||||
#if defined(__DEBUG_PRINT)
|
||||
char *ps, *cstr = debugString();
|
||||
char *ps, *cstr = PDebugMain();
|
||||
for(ps = cstr; *ps; ps++) {
|
||||
if(*ps == '\n') {
|
||||
*ps = 0;
|
||||
dprintf(cstr);
|
||||
lprintf(cstr);
|
||||
cstr = ps+1;
|
||||
}
|
||||
}
|
||||
|
@ -154,11 +160,34 @@ void ExceptionHandler(TExcType exc)
|
|||
// more descriptive replacement of "KERN-EXEC 3" panic
|
||||
buff1.Format(_L("K-EX3: %S"), &ptrExc);
|
||||
User::Panic(buff1, exc);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ifdef __WINS__
|
||||
|
||||
|
||||
#if 1 // def __DEBUG_PRINT_C
|
||||
#include <stdarg.h> // va_*
|
||||
#include <stdio.h> // vsprintf
|
||||
|
||||
// debug print from c code
|
||||
extern "C" void lprintf(char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[512];
|
||||
int len;
|
||||
|
||||
va_start(args,format);
|
||||
len = vsprintf(buffer,format,args);
|
||||
va_end(args);
|
||||
if (buffer[len-1] == '\n')
|
||||
buffer[len-1] = 0;
|
||||
|
||||
DEBUGPRINT(_L("%S"), DO_CONV(buffer));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__DEBUG_PRINT) || defined(__WINS__)
|
||||
|
||||
#ifndef __DLL__
|
||||
|
@ -172,24 +201,6 @@ void ExceptionHandler(TExcType exc)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DEBUG_PRINT_C
|
||||
#include <stdarg.h> // va_*
|
||||
#include <stdio.h> // vsprintf
|
||||
|
||||
// debug print from c code
|
||||
extern "C" void dprintf(char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[512];
|
||||
|
||||
va_start(args,format);
|
||||
vsprintf(buffer,format,args);
|
||||
va_end(args);
|
||||
|
||||
DEBUGPRINT(_L("%S"), DO_CONV(buffer));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DEBUG_PRINT_FILE
|
||||
#include <f32file.h>
|
||||
|
||||
|
@ -201,12 +212,12 @@ void ExceptionHandler(TExcType exc)
|
|||
{
|
||||
// try to open
|
||||
logMutex.CreateLocal();
|
||||
RFs fserv;
|
||||
/*RFs fserv;
|
||||
fserv.Connect();
|
||||
RFile logFile;
|
||||
logFile.Replace(fserv, _L("C:\\logs\\pico.log"), EFileWrite|EFileShareAny);
|
||||
logFile.Replace(fserv, LOG_FILE, EFileWrite|EFileShareAny);
|
||||
logFile.Close();
|
||||
fserv.Close();
|
||||
fserv.Close();*/
|
||||
}
|
||||
|
||||
// debug print to file
|
||||
|
@ -225,7 +236,7 @@ void ExceptionHandler(TExcType exc)
|
|||
|
||||
RThread thisThread;
|
||||
RFile logFile;
|
||||
res = logFile.Open(fserv, _L("C:\\logs\\pico.log"), EFileWrite|EFileShareAny);
|
||||
res = logFile.Open(fserv, LOG_FILE, EFileWrite|EFileShareAny);
|
||||
if(res) goto fail1;
|
||||
|
||||
logFile.Size(size); logFile.Seek(ESeekStart, size);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
void dprintf(char *format, ...);
|
||||
void lprintf(char *format, ...);
|
||||
#endif
|
||||
#else
|
||||
#define DEBUGPRINT(x...)
|
||||
|
|
|
@ -17,14 +17,16 @@
|
|||
#include "debug.h"
|
||||
#include "../Engine.h"
|
||||
|
||||
#include "../../../pico/picoInt.h"
|
||||
#include <Pico/PicoInt.h>
|
||||
#include "../../common/emu.h"
|
||||
#include "../emu.h"
|
||||
#include "vid.h"
|
||||
#include "polledAS.h"
|
||||
#include "PolledAS.h"
|
||||
//#include "audio.h"
|
||||
#include "audio_mediaserver.h"
|
||||
|
||||
#include <EZlib.h>
|
||||
#include "../../../zlib/gzio_symb.h"
|
||||
//#include <ezlib.h>
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
|
||||
//#define BENCHMARK
|
||||
|
@ -78,21 +80,20 @@ const char *actionNames[] = {
|
|||
// globals are allowed, so why not to (ab)use them?
|
||||
//TInt machineUid = 0;
|
||||
int gamestate = PGS_Paused, gamestate_next = PGS_Paused;
|
||||
TPicoConfig *currentConfig = 0;
|
||||
static char noticeMsg[64]; // notice msg to draw
|
||||
char *loadrom_fname = NULL;
|
||||
int loadrom_result = 0;
|
||||
static timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||
static CGameAudioMS *gameAudio = 0; // the audio object itself
|
||||
static int reset_timing, pico_was_reset;
|
||||
static int state_slot = 0;
|
||||
extern const char *RomFileName;
|
||||
static int reset_timing;
|
||||
extern int pico_was_reset;
|
||||
extern RSemaphore initSemaphore;
|
||||
extern RSemaphore pauseSemaphore;
|
||||
extern RSemaphore loadWaitSemaphore;
|
||||
|
||||
// some forward declarations
|
||||
static void MainInit();
|
||||
static void MainExit();
|
||||
static void DumpMemInfo();
|
||||
void MainOldCleanup();
|
||||
|
||||
|
||||
class TPicoDirectScreenAccess : public MDirectScreenAccess
|
||||
|
@ -128,24 +129,8 @@ public:
|
|||
};
|
||||
|
||||
|
||||
static int snd_excess_add = 0, snd_excess_cnt = 0; // hack
|
||||
|
||||
static void updateSound(void)
|
||||
static void updateSound(int len)
|
||||
{
|
||||
int len = PsndLen;
|
||||
|
||||
snd_excess_cnt += snd_excess_add;
|
||||
if (snd_excess_cnt >= 0x10000) {
|
||||
snd_excess_cnt -= 0x10000;
|
||||
if (PicoOpt&8) {
|
||||
PsndOut[len*2] = PsndOut[len*2-2];
|
||||
PsndOut[len*2+1] = PsndOut[len*2-1];
|
||||
} else {
|
||||
PsndOut[len] = PsndOut[len-1];
|
||||
}
|
||||
len++;
|
||||
}
|
||||
|
||||
PsndOut = gameAudio->NextFrameL(len);
|
||||
if(!PsndOut) { // sound output problems?
|
||||
strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED");
|
||||
|
@ -190,12 +175,16 @@ static void TargetEpocGameL()
|
|||
MainInit();
|
||||
buff[0] = 0;
|
||||
|
||||
PicoInit();
|
||||
|
||||
// just to keep the backlight on (works only on UIQ2)
|
||||
//blevent.Set(TRawEvent::EActive);
|
||||
|
||||
// loop?
|
||||
for(;;) {
|
||||
if(gamestate == PGS_Running) {
|
||||
for(;;)
|
||||
{
|
||||
if (gamestate == PGS_Running)
|
||||
{
|
||||
// switch context to other thread
|
||||
User::After(50000);
|
||||
// prepare window and stuff
|
||||
|
@ -217,15 +206,14 @@ static void TargetEpocGameL()
|
|||
if(!noticeMsgTime.tv_sec && pico_was_reset)
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
|
||||
if (PsndOut) {
|
||||
snd_excess_cnt = 0;
|
||||
snd_excess_add = ((PsndRate - PsndLen*target_fps)<<16) / target_fps;
|
||||
}
|
||||
// prepare CD buffer
|
||||
if (PicoAHW & PAHW_MCD) PicoCDBufferInit();
|
||||
|
||||
pico_was_reset = 0;
|
||||
reset_timing = 1;
|
||||
|
||||
while(gamestate == PGS_Running) {
|
||||
while (gamestate == PGS_Running)
|
||||
{
|
||||
gettimeofday(&tval, 0);
|
||||
if(reset_timing) {
|
||||
reset_timing = 0;
|
||||
|
@ -242,7 +230,8 @@ static void TargetEpocGameL()
|
|||
}
|
||||
|
||||
// second changed?
|
||||
if(thissec != tval.tv_sec) {
|
||||
if (thissec != tval.tv_sec)
|
||||
{
|
||||
#ifdef BENCHMARK
|
||||
static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4];
|
||||
if(++bench == 10) {
|
||||
|
@ -254,14 +243,14 @@ static void TargetEpocGameL()
|
|||
bench_fps += frames_shown;
|
||||
sprintf(buff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);
|
||||
#else
|
||||
if(currentConfig->iFlags & 2)
|
||||
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)
|
||||
sprintf(buff, "%02i/%02i", frames_shown, frames_done);
|
||||
#endif
|
||||
|
||||
|
||||
thissec = tval.tv_sec;
|
||||
|
||||
if(PsndOut == 0 && currentConfig->iFrameskip >= 0) {
|
||||
if(PsndOut == 0 && currentConfig.Frameskip >= 0) {
|
||||
frames_done = frames_shown = 0;
|
||||
} else {
|
||||
// it is quite common for this implementation to leave 1 fame unfinished
|
||||
|
@ -278,8 +267,10 @@ static void TargetEpocGameL()
|
|||
|
||||
|
||||
lim_time = (frames_done+1) * target_frametime;
|
||||
if(currentConfig->iFrameskip >= 0) { // frameskip enabled
|
||||
for(i = 0; i < currentConfig->iFrameskip; i++) {
|
||||
if (currentConfig.Frameskip >= 0) // frameskip enabled
|
||||
{
|
||||
for (i = 0; i < currentConfig.Frameskip && gamestate == PGS_Running; i++)
|
||||
{
|
||||
CGameWindow::DoKeys();
|
||||
SkipFrame(); frames_done++;
|
||||
if (PsndOut) { // do framelimitting if sound is enabled
|
||||
|
@ -291,13 +282,17 @@ static void TargetEpocGameL()
|
|||
}
|
||||
lim_time += target_frametime;
|
||||
}
|
||||
} else if(tval.tv_usec > lim_time) { // auto frameskip
|
||||
}
|
||||
else if(tval.tv_usec > lim_time) { // auto frameskip
|
||||
// no time left for this frame - skip
|
||||
CGameWindow::DoKeys();
|
||||
SkipFrame(); frames_done++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// we might have lost focus already
|
||||
if (gamestate != PGS_Running) break;
|
||||
|
||||
CGameWindow::DoKeys();
|
||||
PicoFrame();
|
||||
|
||||
|
@ -306,7 +301,7 @@ static void TargetEpocGameL()
|
|||
if(thissec != tval.tv_sec) tval.tv_usec+=1000000;
|
||||
|
||||
// sleep if we are still too fast
|
||||
if(PsndOut != 0 || currentConfig->iFrameskip < 0)
|
||||
if(PsndOut != 0 || currentConfig.Frameskip < 0)
|
||||
{
|
||||
// TODO: check if User::After() is accurate
|
||||
gettimeofday(&tval, 0);
|
||||
|
@ -324,18 +319,36 @@ static void TargetEpocGameL()
|
|||
vidDrawFrame(notice, buff, frames_shown);
|
||||
|
||||
frames_done++; frames_shown++;
|
||||
}
|
||||
} // while
|
||||
|
||||
if (PicoAHW & PAHW_MCD) PicoCDBufferFree();
|
||||
|
||||
// save SRAM
|
||||
if((currentConfig->iFlags & 1) && SRam.changed) {
|
||||
saveLoadGame(0, 1);
|
||||
if ((currentConfig.EmuOpt & EOPT_USE_SRAM) && SRam.changed) {
|
||||
emu_SaveLoadGame(0, 1);
|
||||
SRam.changed = 0;
|
||||
}
|
||||
CPolledActiveScheduler::Instance()->Schedule();
|
||||
CGameWindow::FreeResources();
|
||||
} else if(gamestate == PGS_Paused) {
|
||||
}
|
||||
else if(gamestate == PGS_ReloadRom)
|
||||
{
|
||||
loadrom_result = emu_ReloadRom(loadrom_fname);
|
||||
pico_was_reset = 1;
|
||||
if (loadrom_result)
|
||||
gamestate = PGS_Running;
|
||||
else
|
||||
gamestate = PGS_Paused;
|
||||
DEBUGPRINT(_L("done loading ROM, retval=%i"), loadrom_result);
|
||||
loadWaitSemaphore.Signal();
|
||||
User::After(50000);
|
||||
}
|
||||
else if(gamestate == PGS_Paused) {
|
||||
DEBUGPRINT(_L("pausing.."));
|
||||
pauseSemaphore.Wait();
|
||||
} else if(gamestate == PGS_KeyConfig) {
|
||||
}
|
||||
else if(gamestate == PGS_KeyConfig)
|
||||
{
|
||||
// switch context to other thread
|
||||
User::After(50000);
|
||||
// prepare window and stuff
|
||||
|
@ -364,6 +377,10 @@ static void TargetEpocGameL()
|
|||
}
|
||||
}
|
||||
|
||||
// this thread has to close it's own handles,
|
||||
// other one will crash trying to do that
|
||||
PicoExit();
|
||||
|
||||
MainExit();
|
||||
}
|
||||
|
||||
|
@ -373,9 +390,6 @@ static void MainInit()
|
|||
{
|
||||
DEBUGPRINT(_L("\r\n\r\nstarting.."));
|
||||
|
||||
// our thread might have been crashed previously, so many other objects may be still floating around
|
||||
MainOldCleanup();
|
||||
|
||||
DEBUGPRINT(_L("CPolledActiveScheduler::NewL()"));
|
||||
CPolledActiveScheduler::NewL(); // create Polled AS for the sound engine
|
||||
|
||||
|
@ -384,8 +398,7 @@ static void MainInit()
|
|||
DumpMemInfo();
|
||||
|
||||
// try to start pico
|
||||
DEBUGPRINT(_L("PicoInit();"));
|
||||
PicoInit();
|
||||
DEBUGPRINT(_L("PicoInit()"));
|
||||
PicoDrawSetColorFormat(2);
|
||||
PicoWriteSound = updateSound;
|
||||
|
||||
|
@ -403,13 +416,6 @@ static void MainExit()
|
|||
|
||||
DEBUGPRINT(_L("%i: cleaning up.."), (TInt32) thisThread.Id());
|
||||
|
||||
// save SRAM
|
||||
if((currentConfig->iFlags & 1) && SRam.changed) {
|
||||
saveLoadGame(0, 1);
|
||||
SRam.changed = 0;
|
||||
}
|
||||
|
||||
PicoExit();
|
||||
// pauseSemaphore.Close();
|
||||
|
||||
if(gameAudio) delete gameAudio;
|
||||
|
@ -418,20 +424,6 @@ static void MainExit()
|
|||
delete CPolledActiveScheduler::Instance();
|
||||
}
|
||||
|
||||
void MainOldCleanup()
|
||||
{
|
||||
DEBUGPRINT(_L("MainOldCleanup.."));
|
||||
|
||||
// There was previously a handle leak here, so thread stuff was not cleaned
|
||||
// and I thought I would have to do it mself.
|
||||
|
||||
// clean any resources which might be left after a thread crash
|
||||
//CGameWindow::FreeResources(ETrue);
|
||||
|
||||
//if(CPolledActiveScheduler::Instance())
|
||||
// delete CPolledActiveScheduler::Instance();
|
||||
}
|
||||
|
||||
static void DumpMemInfo()
|
||||
{
|
||||
TInt ramSize, ramSizeFree, romSize;
|
||||
|
@ -444,12 +436,20 @@ static void DumpMemInfo()
|
|||
}
|
||||
|
||||
|
||||
extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32);
|
||||
|
||||
TInt EmuThreadFunction(TAny*)
|
||||
{
|
||||
TInt ret;
|
||||
const TUint32 exs = KExceptionAbort|KExceptionKill|KExceptionUserInterrupt|KExceptionFpe|KExceptionFault|KExceptionInteger|KExceptionDebug;
|
||||
|
||||
DEBUGPRINT(_L("EmuThreadFunction()"));
|
||||
User::SetExceptionHandler(ExceptionHandler, exs/*(TUint32) -1*/); // does not work?
|
||||
DEBUGPRINT(_L("EmuThreadFunction(), def ExceptionHandler %08x, my %08x"),
|
||||
User::ExceptionHandler(), ExceptionHandler);
|
||||
User::SetJustInTime(1);
|
||||
ret = User::SetExceptionHandler(ExceptionHandler, exs/*(TUint32) -1*/); // does not work :(
|
||||
// my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff);
|
||||
DEBUGPRINT(_L("SetExceptionHandler %i, %08x"), ret, User::ExceptionHandler());
|
||||
User::ModifyExceptionMask(0, exs);
|
||||
|
||||
//TInt pc, sp;
|
||||
//asm volatile ("str pc, %0" : "=m" (pc) );
|
||||
|
@ -479,7 +479,7 @@ TInt EmuThreadFunction(TAny*)
|
|||
|
||||
TRAPD(error, TargetEpocGameL());
|
||||
|
||||
__ASSERT_ALWAYS(!error, User::Panic(_L("Picosmall"), error));
|
||||
__ASSERT_ALWAYS(!error, User::Panic(_L("PicoDrive"), error));
|
||||
delete cleanup;
|
||||
|
||||
DEBUGPRINT(_L("exitting.."));
|
||||
|
@ -586,17 +586,19 @@ void CGameWindow::ConstructResourcesL()
|
|||
// try to start the audio engine
|
||||
static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0;
|
||||
|
||||
if(gamestate == PGS_Running && (currentConfig->iFlags & 4)) {
|
||||
if (gamestate == PGS_Running && (currentConfig.EmuOpt & EOPT_EN_SOUND))
|
||||
{
|
||||
TInt err = 0;
|
||||
if(PsndRate != PsndRate_old || (PicoOpt&11) != (PicoOpt_old&11) || Pico.m.pal != pal_old) {
|
||||
// if rate changed, reset all enabled chips, else reset only those chips, which were recently enabled
|
||||
//sound_reset(PsndRate != PsndRate_old ? PicoOpt : (PicoOpt&(PicoOpt^PicoOpt_old)));
|
||||
sound_rerate();
|
||||
PsndRerate(1);
|
||||
}
|
||||
if(!gameAudio || PsndRate != PsndRate_old || ((PicoOpt&8) ^ (PicoOpt_old&8)) || Pico.m.pal != pal_old) { // rate or stereo or pal/ntsc changed
|
||||
if(gameAudio) delete gameAudio; gameAudio = 0;
|
||||
DEBUGPRINT(_L("starting audio: %i len: %i stereo: %i, pal: %i"), PsndRate, PsndLen, PicoOpt&8, Pico.m.pal);
|
||||
TRAP(err, gameAudio = CGameAudioMS::NewL(PsndRate, (PicoOpt&8) ? 1 : 0, Pico.m.pal ? 50 : 60));
|
||||
TRAP(err, gameAudio = CGameAudioMS::NewL(PsndRate, (PicoOpt&8) ? 1 : 0,
|
||||
Pico.m.pal ? 50 : 60, currentConfig.volume));
|
||||
}
|
||||
if( gameAudio) {
|
||||
TRAP(err, PsndOut = gameAudio->ResumeL());
|
||||
|
@ -678,11 +680,6 @@ void CGameWindow::FreeResources()
|
|||
}
|
||||
|
||||
vidFree();
|
||||
|
||||
// emu might change renderer by itself, so we may need to sync config
|
||||
if(currentConfig && currentConfig->iPicoOpt != PicoOpt) {
|
||||
currentConfig->iFlags |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,7 +705,7 @@ void CGameWindow::DoKeys(void)
|
|||
const TPicoAreaConfigEntry *e = areaConfig + 1;
|
||||
for(i = 0; !e->rect.IsEmpty(); e++, i++)
|
||||
if(e->rect.Contains(p)) {
|
||||
areaActions = currentConfig->iAreaBinds[i];
|
||||
areaActions = currentConfig.KeyBinds[i+256];
|
||||
break;
|
||||
}
|
||||
//DEBUGPRINT(_L("pointer event: %i %i"), p.iX, p.iY);
|
||||
|
@ -767,7 +764,7 @@ void CGameWindow::DoKeys(void)
|
|||
for(i = 9; i >= 0; i--) {
|
||||
int scan = pressedKeys[i];
|
||||
if(scan) {
|
||||
if(keyFlags[scan] & 1) allActions |= currentConfig->iKeyBinds[scan];
|
||||
if(keyFlags[scan] & 1) allActions |= currentConfig.KeyBinds[scan];
|
||||
if((keyFlags[scan]& 3)==3) forceUpdate = 1;
|
||||
if(keyFlags[scan] & 2) keyFlags[scan] &= ~1;
|
||||
}
|
||||
|
@ -807,7 +804,7 @@ void CGameWindow::DoKeysConfig(TUint &which)
|
|||
const TPicoAreaConfigEntry *e = areaConfig + 1;
|
||||
for(i = 0; e->rect != TRect(0,0,0,0); e++, i++)
|
||||
if(e->rect.Contains(p)) {
|
||||
currentConfig->iAreaBinds[i] ^= currentActCode;
|
||||
currentConfig.KeyBinds[i+256] ^= currentActCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -822,7 +819,7 @@ void CGameWindow::DoKeysConfig(TUint &which)
|
|||
if(which == 31) {
|
||||
gamestate = PGS_Paused;
|
||||
} else if (scan < 256) {
|
||||
if(!(keyFlags[scan]&0x40)) currentConfig->iKeyBinds[scan] ^= currentActCode;
|
||||
if(!(keyFlags[scan]&0x40)) currentConfig.KeyBinds[scan] ^= currentActCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -844,22 +841,22 @@ void CGameWindow::DoKeysConfig(TUint &which)
|
|||
|
||||
void CGameWindow::RunEvents(TUint32 which)
|
||||
{
|
||||
if(which & 0x4000) currentConfig->iFrameskip = -1;
|
||||
if(which & 0x2000) currentConfig->iFrameskip = 8;
|
||||
if(which & 0x1800) { // save or load (but not both)
|
||||
if (which & 0x4000) currentConfig.Frameskip = -1;
|
||||
if (which & 0x2000) currentConfig.Frameskip = 8;
|
||||
if (which & 0x1800) { // save or load (but not both)
|
||||
if(PsndOut) gameAudio->Pause(); // this may take a while, so we pause sound output
|
||||
|
||||
vidDrawNotice((which & 0x1000) ? "LOADING@GAME" : "SAVING@GAME");
|
||||
saveLoadGame(which & 0x1000);
|
||||
emu_SaveLoadGame(which & 0x1000, 0);
|
||||
|
||||
if(PsndOut) PsndOut = gameAudio->ResumeL();
|
||||
reset_timing = 1;
|
||||
}
|
||||
if(which & 0x0400) gamestate = PGS_Paused;
|
||||
if(which & 0x0200) { // switch renderer
|
||||
if(!(currentConfig->iScreenMode == TPicoConfig::PMFit &&
|
||||
(currentConfig->iScreenRotation == TPicoConfig::PRot0 || currentConfig->iScreenRotation == TPicoConfig::PRot180))) {
|
||||
|
||||
if (which & 0x0400) gamestate = PGS_Paused;
|
||||
if (which & 0x0200) { // switch renderer
|
||||
if (!(currentConfig.scaling == TPicoConfig::PMFit &&
|
||||
(currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180)))
|
||||
{
|
||||
PicoOpt^=0x10;
|
||||
vidInit(0, 1);
|
||||
|
||||
|
@ -878,111 +875,20 @@ void CGameWindow::RunEvents(TUint32 which)
|
|||
sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot);
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
if(which & 0x0020) if(gameAudio) gameAudio->ChangeVolume(0);
|
||||
if(which & 0x0010) if(gameAudio) gameAudio->ChangeVolume(1);
|
||||
if(which & 0x0020) if(gameAudio) currentConfig.volume = gameAudio->ChangeVolume(0);
|
||||
if(which & 0x0010) if(gameAudio) currentConfig.volume = gameAudio->ChangeVolume(1);
|
||||
}
|
||||
|
||||
|
||||
// must use wrappers, or else will run into some weird loader error (see pico/area.c)
|
||||
static size_t fRead2(void *p, size_t _s, size_t _n, void *file)
|
||||
extern "C" void emu_noticeMsgUpdated(void)
|
||||
{
|
||||
return fread(p, _s, _n, (FILE *) file);
|
||||
}
|
||||
|
||||
static size_t fWrite2(void *p, size_t _s, size_t _n, void *file)
|
||||
{
|
||||
return fwrite(p, _s, _n, (FILE *) file);
|
||||
}
|
||||
|
||||
static size_t gzRead2(void *p, size_t, size_t _n, void *file)
|
||||
{
|
||||
return gzread(file, p, _n);
|
||||
}
|
||||
|
||||
static size_t gzWrite2(void *p, size_t, size_t _n, void *file)
|
||||
{
|
||||
return gzwrite(file, p, _n);
|
||||
}
|
||||
|
||||
|
||||
// this function is shared between both threads
|
||||
int saveLoadGame(int load, int sram)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if(!RomFileName) return -1;
|
||||
|
||||
// make save filename
|
||||
char saveFname[KMaxFileName];
|
||||
strcpy(saveFname, RomFileName);
|
||||
saveFname[KMaxFileName-8] = 0;
|
||||
if(saveFname[strlen(saveFname)-4] == '.') saveFname[strlen(saveFname)-4] = 0;
|
||||
if(sram) strcat(saveFname, ".srm");
|
||||
else {
|
||||
if(state_slot > 0 && state_slot < 10) sprintf(saveFname, "%s.%i", saveFname, state_slot);
|
||||
strcat(saveFname, ".mds");
|
||||
}
|
||||
|
||||
DEBUGPRINT(_L("saveLoad (%i, %i): %S"), load, sram, DO_CONV(saveFname));
|
||||
|
||||
if(sram) {
|
||||
FILE *sramFile;
|
||||
int sram_size = SRam.end-SRam.start+1;
|
||||
if(SRam.reg_back & 4) sram_size=0x2000;
|
||||
if(!SRam.data) return 0; // SRam forcefully disabled for this game
|
||||
if(load) {
|
||||
sramFile = fopen(saveFname, "rb");
|
||||
if(!sramFile) return -1;
|
||||
fread(SRam.data, 1, sram_size, sramFile);
|
||||
fclose(sramFile);
|
||||
} else {
|
||||
// sram save needs some special processing
|
||||
// see if we have anything to save
|
||||
for(; sram_size > 0; sram_size--)
|
||||
if(SRam.data[sram_size-1]) break;
|
||||
|
||||
if(sram_size) {
|
||||
sramFile = fopen(saveFname, "wb");
|
||||
res = fwrite(SRam.data, 1, sram_size, sramFile);
|
||||
res = (res != sram_size) ? -1 : 0;
|
||||
fclose(sramFile);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
void *PmovFile = NULL;
|
||||
// try gzip first
|
||||
if(currentConfig->iFlags & 0x80) {
|
||||
strcat(saveFname, ".gz");
|
||||
if( (PmovFile = gzopen(saveFname, load ? "rb" : "wb")) ) {
|
||||
areaRead = gzRead2;
|
||||
areaWrite = gzWrite2;
|
||||
if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);
|
||||
} else
|
||||
saveFname[strlen(saveFname)-3] = 0;
|
||||
}
|
||||
if(!PmovFile) { // gzip failed or was disabled
|
||||
if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) {
|
||||
areaRead = fRead2;
|
||||
areaWrite = fWrite2;
|
||||
}
|
||||
}
|
||||
if(PmovFile) {
|
||||
PmovState(load ? 6 : 5, PmovFile); // load/save
|
||||
strcpy(noticeMsg, load ? "GAME@LOADED" : "GAME@SAVED");
|
||||
if(areaRead == gzRead2)
|
||||
gzclose(PmovFile);
|
||||
else fclose ((FILE *) PmovFile);
|
||||
PmovFile = 0;
|
||||
if (load) Pico.m.dirtyPal=1;
|
||||
} else {
|
||||
strcpy(noticeMsg, load ? "LOAD@FAILED" : "SAVE@FAILED");
|
||||
res = -1;
|
||||
}
|
||||
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
return res;
|
||||
char *p = noticeMsg;
|
||||
while (*p) {
|
||||
if (*p == ' ') *p = '@';
|
||||
if (*p < '0' || *p > 'Z') { *p = 0; break; }
|
||||
p++;
|
||||
}
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
|
||||
// static class members
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
|
||||
#include "vid.h"
|
||||
#include "../Engine.h"
|
||||
#include "../../../pico/picoInt.h"
|
||||
#include <Pico/PicoInt.h>
|
||||
#include "../../common/emu.h"
|
||||
#include "blit.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
// global stuff
|
||||
extern TPicoConfig *currentConfig;
|
||||
extern TPicoAreaConfigEntry areaConfig[];
|
||||
extern const char *actionNames[];
|
||||
|
||||
// main framebuffer
|
||||
static void *screenbuff = 0; // pointer to real device video memory
|
||||
//static
|
||||
extern "C" { unsigned char *framebuff = 0; } // temporary buffer
|
||||
extern "C" { unsigned char *PicoDraw2FB = 0; } // temporary buffer
|
||||
const int framebuffsize = (8+320)*(8+240+8)*2+8*2; // actual framebuffer size (in bytes+to support new rendering mode)
|
||||
|
||||
// drawer function pointers
|
||||
|
@ -87,35 +87,25 @@ static const unsigned long mask_numbers[] = {
|
|||
};
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
// Cram functions
|
||||
|
||||
static int EmuCramNull(int cram)
|
||||
{
|
||||
User::Panic(_L("Cram called!!"), 0);
|
||||
return cram;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
// PicoScan functions
|
||||
|
||||
static int EmuScan8(unsigned int num, void *sdata)
|
||||
static int EmuScanBegin8(unsigned int num)
|
||||
{
|
||||
DrawLineDest = framebuff + 328*(num+1) + 328*8 + 8;
|
||||
DrawLineDest = PicoDraw2FB + 328*num + 328*8 + 8;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int EmuScanFit0(unsigned int num, void *sdata)
|
||||
static int EmuScanEndFit0(unsigned int num)
|
||||
{
|
||||
// 0.75, 168 lines
|
||||
|
||||
static int u = 0, num2 = 0;
|
||||
if(!num) u = num2 = 0;
|
||||
|
||||
DrawLineDest = framebuff + 328*(++num2) + 328*8 + 8;
|
||||
DrawLineDest = PicoDraw2FB + 328*(++num2) + 328*8 + 8;
|
||||
|
||||
u += 6666;
|
||||
|
||||
|
@ -136,7 +126,7 @@ static int EmuScanFit0(unsigned int num, void *sdata)
|
|||
|
||||
static void drawTextM2(int x, int y, const char *text)
|
||||
{
|
||||
unsigned char *vidmem = framebuff + 328*8 + 8;
|
||||
unsigned char *vidmem = PicoDraw2FB + 328*8 + 8;
|
||||
int charmask, i, cx = x, cy;
|
||||
unsigned char *l, *le;
|
||||
|
||||
|
@ -164,7 +154,7 @@ static void drawTextM2(int x, int y, const char *text)
|
|||
|
||||
static void drawTextM2Fat(int x, int y, const char *text)
|
||||
{
|
||||
unsigned char *vidmem = framebuff + 328*8 + 8;
|
||||
unsigned char *vidmem = PicoDraw2FB + 328*8 + 8;
|
||||
int charmask, i, cx = x&~1, cy;
|
||||
unsigned short *l, *le;
|
||||
|
||||
|
@ -257,7 +247,7 @@ static void fillLocalPal(void)
|
|||
vidConvCpyRGB32(localPal, Pico.cram, 0x40);
|
||||
vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40);
|
||||
vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40);
|
||||
blockcpy(localPal+0xc0, localPal+0x40, 0x40*4);
|
||||
memcpy32(localPal+0xc0, localPal+0x40, 0x40);
|
||||
localPal[0xe0] = 0x00000000; // reserved pixels for OSD
|
||||
localPal[0xf0] = 0x00ee0000;
|
||||
} else if (rendstatus & 0x20) { // mid-frame palette changes
|
||||
|
@ -273,7 +263,7 @@ static void fillLocalPal(void)
|
|||
// note: the internal 8 pixel border is taken care by asm code
|
||||
static void vidBlit_90(int full)
|
||||
{
|
||||
unsigned char *ps = framebuff+328*8;
|
||||
unsigned char *ps = PicoDraw2FB+328*8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
@ -291,7 +281,7 @@ static void vidBlit_90(int full)
|
|||
|
||||
static void vidBlit_270(int full)
|
||||
{
|
||||
unsigned char *ps = framebuff+328*8;
|
||||
unsigned char *ps = PicoDraw2FB+328*8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
@ -310,7 +300,7 @@ static void vidBlit_270(int full)
|
|||
|
||||
static void vidBlitCenter_0(int full)
|
||||
{
|
||||
unsigned char *ps = framebuff+328*8+8;
|
||||
unsigned char *ps = PicoDraw2FB+328*8+8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
@ -323,7 +313,7 @@ static void vidBlitCenter_0(int full)
|
|||
|
||||
static void vidBlitCenter_180(int full)
|
||||
{
|
||||
unsigned char *ps = framebuff+328*8+8;
|
||||
unsigned char *ps = PicoDraw2FB+328*8+8;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
|
||||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
@ -339,8 +329,8 @@ static void vidBlitFit_0(int full)
|
|||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_0(screenbuff, framebuff+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, framebuff+328*8, localPal, 168);
|
||||
vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
if(full) vidClear((unsigned long *)screenbuff + 168*256, 320-168);
|
||||
}
|
||||
|
||||
|
@ -350,8 +340,8 @@ static void vidBlitFit_180(int full)
|
|||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_180(screenbuff, framebuff+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, framebuff+328*8-64, localPal, 168);
|
||||
vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 168);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 168);
|
||||
if(full) vidClear((unsigned long *)screenbuff + 168*256, 320-168);
|
||||
}
|
||||
|
||||
|
@ -361,8 +351,8 @@ static void vidBlitFit2_0(int full)
|
|||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_0(screenbuff, framebuff+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, framebuff+328*8, localPal, 224);
|
||||
vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
if(full) vidClear((unsigned long *)screenbuff + 224*256, 96);
|
||||
}
|
||||
|
||||
|
@ -372,15 +362,15 @@ static void vidBlitFit2_180(int full)
|
|||
if (Pico.m.dirtyPal) fillLocalPal();
|
||||
|
||||
if(Pico.video.reg[12]&1)
|
||||
vidConvCpy_center2_40c_180(screenbuff, framebuff+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, framebuff+328*8-64, localPal, 224);
|
||||
vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 224);
|
||||
else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 224);
|
||||
if(full) vidClear((unsigned long *)screenbuff + 224*256, 96);
|
||||
}
|
||||
|
||||
|
||||
static void vidBlitCfg(void)
|
||||
{
|
||||
unsigned short *ps = (unsigned short *) framebuff;
|
||||
unsigned short *ps = (unsigned short *) PicoDraw2FB;
|
||||
unsigned long *pd = (unsigned long *) screenbuff;
|
||||
int i;
|
||||
|
||||
|
@ -402,20 +392,17 @@ int vidInit(void *vidmem, int reinit)
|
|||
if(!reinit) {
|
||||
// prepare framebuffer
|
||||
screenbuff = vidmem;
|
||||
framebuff = (unsigned char *) malloc(framebuffsize);
|
||||
PicoDraw2FB = (unsigned char *) malloc(framebuffsize);
|
||||
|
||||
if(!screenbuff) return KErrNotSupported;
|
||||
if(!framebuff) return KErrNoMemory;
|
||||
if(!PicoDraw2FB) return KErrNoMemory;
|
||||
|
||||
memset(framebuff, 0, framebuffsize);
|
||||
|
||||
// Cram function: go and hack Pico so it never gets called
|
||||
PicoCram = EmuCramNull;
|
||||
memset(PicoDraw2FB, 0, framebuffsize);
|
||||
}
|
||||
|
||||
// select suitable blitters
|
||||
vidBlit = vidBlit_270;
|
||||
PicoScan = EmuScan8;
|
||||
PicoScanBegin = EmuScanBegin8;
|
||||
drawTextFps = drawTextFps0;
|
||||
drawTextNotice = drawTextNotice0;
|
||||
|
||||
|
@ -424,12 +411,13 @@ int vidInit(void *vidmem, int reinit)
|
|||
localPal[0xf0] = 0x00ee0000;
|
||||
|
||||
// setup all orientation related stuff
|
||||
if(currentConfig->iScreenRotation == TPicoConfig::PRot0) {
|
||||
if(currentConfig->iScreenMode == TPicoConfig::PMCenter) {
|
||||
if (currentConfig.rotation == TPicoConfig::PRot0)
|
||||
{
|
||||
if (currentConfig.scaling == TPicoConfig::PMCenter) {
|
||||
vidBlit = vidBlitCenter_0;
|
||||
drawTextFps = drawTextFpsCenter0;
|
||||
drawTextNotice = drawTextNoticeCenter0;
|
||||
} else if(currentConfig->iScreenMode == TPicoConfig::PMFit2) {
|
||||
} else if (currentConfig.scaling == TPicoConfig::PMFit2) {
|
||||
vidBlit = vidBlitFit2_0;
|
||||
drawTextFps = drawTextFpsFit2_0;
|
||||
drawTextNotice = drawTextNoticeFit2_0;
|
||||
|
@ -437,16 +425,20 @@ int vidInit(void *vidmem, int reinit)
|
|||
vidBlit = vidBlitFit_0;
|
||||
drawTextFps = drawTextFpsFit0;
|
||||
drawTextNotice = drawTextNoticeFit0;
|
||||
PicoScan = EmuScanFit0;
|
||||
PicoScanEnd = EmuScanEndFit0;
|
||||
}
|
||||
} else if(currentConfig->iScreenRotation == TPicoConfig::PRot90) {
|
||||
} else if (currentConfig.rotation == TPicoConfig::PRot90) {
|
||||
vidBlit = vidBlit_90;
|
||||
} else if(currentConfig->iScreenRotation == TPicoConfig::PRot180) {
|
||||
if(currentConfig->iScreenMode == TPicoConfig::PMCenter) {
|
||||
}
|
||||
else if (currentConfig.rotation == TPicoConfig::PRot180)
|
||||
{
|
||||
if (currentConfig.scaling == TPicoConfig::PMCenter)
|
||||
{
|
||||
vidBlit = vidBlitCenter_180;
|
||||
drawTextFps = drawTextFpsCenter0;
|
||||
drawTextNotice = drawTextNoticeCenter0;
|
||||
} else if(currentConfig->iScreenMode == TPicoConfig::PMFit2) {
|
||||
}
|
||||
else if (currentConfig.scaling == TPicoConfig::PMFit2) {
|
||||
vidBlit = vidBlitFit2_180;
|
||||
drawTextFps = drawTextFpsFit2_0;
|
||||
drawTextNotice = drawTextNoticeFit2_0;
|
||||
|
@ -454,9 +446,10 @@ int vidInit(void *vidmem, int reinit)
|
|||
vidBlit = vidBlitFit_180;
|
||||
drawTextFps = drawTextFpsFit0;
|
||||
drawTextNotice = drawTextNoticeFit0;
|
||||
PicoScan = EmuScanFit0;
|
||||
PicoScanEnd = EmuScanEndFit0;
|
||||
}
|
||||
} else if(currentConfig->iScreenRotation == TPicoConfig::PRot270) {
|
||||
}
|
||||
else if (currentConfig.rotation == TPicoConfig::PRot270) {
|
||||
vidBlit = vidBlit_270;
|
||||
}
|
||||
|
||||
|
@ -469,16 +462,16 @@ int vidInit(void *vidmem, int reinit)
|
|||
|
||||
void vidFree()
|
||||
{
|
||||
free(framebuff);
|
||||
framebuff = 0;
|
||||
free(PicoDraw2FB);
|
||||
PicoDraw2FB = 0;
|
||||
}
|
||||
|
||||
void vidDrawFrame(char *noticeStr, char *fpsStr, int num)
|
||||
{
|
||||
DrawLineDest = framebuff + 328*8 + 8;
|
||||
DrawLineDest = PicoDraw2FB + 328*8 + 8;
|
||||
|
||||
// PicoFrame(); // moved to main loop
|
||||
if(currentConfig->iFlags & 2)
|
||||
if (currentConfig.EmuOpt & EOPT_SHOW_FPS)
|
||||
drawTextFps(fpsStr);
|
||||
drawTextNotice(noticeStr);
|
||||
|
||||
|
@ -489,7 +482,7 @@ void vidDrawFrame(char *noticeStr, char *fpsStr, int num)
|
|||
|
||||
static void drawText0(int x, int y, const char *text, long color)
|
||||
{
|
||||
unsigned short *vidmem=(unsigned short *)framebuff;
|
||||
unsigned short *vidmem=(unsigned short *)PicoDraw2FB;
|
||||
int charmask, i, cx = x, cy;
|
||||
unsigned short *l, *le, dmask=0x0333;
|
||||
|
||||
|
@ -519,7 +512,7 @@ static void drawText0(int x, int y, const char *text, long color)
|
|||
// draws rect with width - 1 and height - 1
|
||||
static void drawRect(const TRect &rc, unsigned short color)
|
||||
{
|
||||
unsigned short *vidmem=(unsigned short *)framebuff;
|
||||
unsigned short *vidmem=(unsigned short *)PicoDraw2FB;
|
||||
|
||||
if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {
|
||||
int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;
|
||||
|
@ -540,7 +533,7 @@ static void drawRect(const TRect &rc, unsigned short color)
|
|||
// draws fullsize filled rect
|
||||
static void drawRectFilled(const TRect rc, unsigned short color)
|
||||
{
|
||||
unsigned short *vidmem=(unsigned short *)framebuff;
|
||||
unsigned short *vidmem=(unsigned short *)PicoDraw2FB;
|
||||
|
||||
if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {
|
||||
int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;
|
||||
|
@ -559,7 +552,7 @@ static void drawRectFilled(const TRect rc, unsigned short color)
|
|||
// direction: -1 left, 1 right
|
||||
static void drawArrow0(TPoint p, int direction, unsigned short color)
|
||||
{
|
||||
unsigned short *vidmem=(unsigned short *)framebuff;
|
||||
unsigned short *vidmem=(unsigned short *)PicoDraw2FB;
|
||||
int width = 15;
|
||||
int x = p.iX;
|
||||
int y = p.iY;
|
||||
|
@ -603,7 +596,7 @@ void vidKeyConfigFrame(const TUint whichAction)
|
|||
int i;
|
||||
char buttonNames[128];
|
||||
buttonNames[0] = 0;
|
||||
memset(framebuff, 0, framebuffsize);
|
||||
memset(PicoDraw2FB, 0, framebuffsize);
|
||||
|
||||
unsigned long currentActCode = 1 << whichAction;
|
||||
|
||||
|
@ -611,7 +604,7 @@ void vidKeyConfigFrame(const TUint whichAction)
|
|||
const TPicoAreaConfigEntry *e = areaConfig + 1; i = 0;
|
||||
while(e->rect != TRect(0,0,0,0)) { e++; i++; }
|
||||
for(e--, i--; e->rect != TRect(0,0,0,0); e--, i--)
|
||||
drawRect(e->rect, (currentConfig->iAreaBinds[i] & currentActCode) ? color_red : color_red_dim);
|
||||
drawRect(e->rect, (currentConfig.KeyBinds[i+256] & currentActCode) ? color_red : color_red_dim);
|
||||
|
||||
// action name control
|
||||
drawRectFilled(TRect(72, 2, 168, 20), color_grey); // 96x14
|
||||
|
@ -621,14 +614,14 @@ void vidKeyConfigFrame(const TUint whichAction)
|
|||
drawText0(86, 9, actionNames[whichAction], color_red);
|
||||
|
||||
// draw active button names if there are any
|
||||
for(i = 0; i < 256; i++) {
|
||||
if(currentConfig->iKeyBinds[i] & currentActCode) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (currentConfig.KeyBinds[i] & currentActCode) {
|
||||
if(buttonNames[0]) strcat(buttonNames, ";@");
|
||||
strcat(buttonNames, vidGetScanName(i));
|
||||
}
|
||||
}
|
||||
|
||||
if(buttonNames[0]) {
|
||||
if (buttonNames[0]) {
|
||||
buttonNames[61] = 0; // only 60 chars fit
|
||||
drawText0(6, 48, buttonNames, color_blue);
|
||||
}
|
||||
|
@ -638,7 +631,7 @@ void vidKeyConfigFrame(const TUint whichAction)
|
|||
|
||||
void vidDrawNotice(const char *txt)
|
||||
{
|
||||
if(framebuff) {
|
||||
if(PicoDraw2FB) {
|
||||
drawTextNotice(txt);
|
||||
vidBlit(1);
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
@cd _out
|
||||
@"C:\Program Files\arch\WinRAR\WinRAR.exe" a PicoDrive.zip PicoDrive.SIS config.txt ..\..\readme.txt
|
||||
@cd..
|
|
@ -31,6 +31,7 @@ enum TAppMenuCommands
|
|||
// pages
|
||||
ECtlOptPageMain,
|
||||
ECtlOptPageSound,
|
||||
ECtlOptPageMCD,
|
||||
ECtlOptPageMisc,
|
||||
// main page
|
||||
ECtlOptRotationLabel,
|
||||
|
@ -45,8 +46,8 @@ enum TAppMenuCommands
|
|||
ECtlOptScreenModeFit,
|
||||
ECtlOptScreenModeFit2,
|
||||
ECtlOptUseAltRend,
|
||||
ECtlOptUseAccTiming,
|
||||
ECtlOptUseAccSprites,
|
||||
// ECtlOptUseAccTiming,
|
||||
// ECtlOptUseAccSprites,
|
||||
ECtlOptShowFPS,
|
||||
// sound page
|
||||
ECtlOptEnableSound,
|
||||
|
@ -56,6 +57,13 @@ enum TAppMenuCommands
|
|||
ECtlOptEmulateSN76496,
|
||||
ECtlOptSndQLabel,
|
||||
ECtlOptSndQuality,
|
||||
// MCD page
|
||||
ECtlOptCDleds,
|
||||
ECtlOptCDcdda,
|
||||
ECtlOptCDpcm,
|
||||
ECtlOptCDramcart,
|
||||
ECtlOptCDscalerot,
|
||||
ECtlOptCDbettersync,
|
||||
// misc page
|
||||
ECtlOpt6ButtonPad,
|
||||
ECtlOptGzipStates,
|
9
platform/uiq3/picodrive.pkg
Normal file
9
platform/uiq3/picodrive.pkg
Normal file
|
@ -0,0 +1,9 @@
|
|||
%{"notaz"}
|
||||
:"notaz"
|
||||
#{"PicoDrive"}, (0xA00010F3), 1, 51, 0, TYPE=SA
|
||||
(0x101F6300), 3, 0, 0, {"UIQ30ProductID"}
|
||||
"picodrive.exe"-"!:\sys\bin\PicoDrive.exe"
|
||||
"rsc/picodrive.rsc"-"!:\resource\apps\PicoDrive.rsc"
|
||||
"picodrive.mbm"-"!:\resource\apps\PicoDrive.mbm"
|
||||
"rsc/picodrive_loc.rsc"-"!:\resource\apps\PicoDrive_loc.rsc"
|
||||
"rsc/picodrive_reg.rsc"-"!:\private\10003a3f\import\apps\PicoDrive_reg.rsc"
|
|
@ -3,21 +3,32 @@
|
|||
#ifndef PORT_CONFIG_H
|
||||
#define PORT_CONFIG_H
|
||||
|
||||
#define CASE_SENSITIVE_FS 0
|
||||
#define DONT_OPEN_MANY_FILES 0
|
||||
#define REDUCE_IO_CALLS 0
|
||||
#define SIMPLE_WRITE_SOUND 0
|
||||
|
||||
// draw.c
|
||||
#define OVERRIDE_HIGHCOL 0
|
||||
|
||||
// draw2.c
|
||||
#define START_ROW 0 // which row of tiles to start rendering at?
|
||||
#define END_ROW 28 // ..end
|
||||
|
||||
// pico.c
|
||||
#define CAN_HANDLE_240_LINES 0 // fow now
|
||||
#define CAN_HANDLE_240_LINES 0 // for now
|
||||
|
||||
//#define dprintf(f,...) printf(f"\n",##__VA_ARGS__)
|
||||
#ifdef __DEBUG_PRINT
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
void dprintf(char *format, ...);
|
||||
#else
|
||||
// logging emu events
|
||||
#define EL_LOGMASK (EL_STATUS|EL_IDLE) // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO|EL_INTS|EL_CDPOLL) // xffff
|
||||
|
||||
//extern void dprintf(char *format, ...);
|
||||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
#endif
|
||||
|
||||
#endif //PORT_CONFIG_H
|
||||
// platform
|
||||
#define PLAT_MAX_KEYS (256+19)
|
||||
#define PLAT_HAVE_JOY 0
|
||||
#define PATH_SEP "\\"
|
||||
#define PATH_SEP_C '\\'
|
||||
|
||||
#endif // PORT_CONFIG_H
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
@ .equiv START_ROW, 1
|
||||
@ .equiv END_ROW, 27
|
||||
@ vim:filetype=armasm
|
||||
|
||||
@ .equiv START_ROW, 1
|
||||
@ .equiv END_ROW, 27
|
||||
@ one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered.
|
||||
.equiv START_ROW, 0
|
||||
.equiv END_ROW, 28
|
||||
.equiv START_ROW, 0
|
||||
.equiv END_ROW, 28
|
||||
|
||||
.equiv OVERRIDE_HIGHCOL, 0
|
||||
.equiv UNALIGNED_DRAWLINEDEST, 0
|
||||
|
||||
@ this should be set to one only for GP2X port
|
||||
.equiv EXTERNAL_YM2612, 0
|
||||
.equiv EXTERNAL_YM2612, 0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr M600i --qc-channel 5 --user qconsole --pass server
|
|
@ -1 +0,0 @@
|
|||
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr M600i --qc-channel 5 --user qconsole --pass server --cmds "cat c:\logs\pico.log" exit
|
|
@ -1 +0,0 @@
|
|||
@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr M600i --qc-channel 5 --user qconsole --pass server --cmds "put c:\Shared\PicoDrive.SIS _out\PicoDrive.SIS" "rundoc c:\Shared\PicoDrive.SIS" exit
|
|
@ -1,20 +0,0 @@
|
|||
#include <AppInfo.rh>
|
||||
|
||||
// This file localise the applications icons and caption
|
||||
RESOURCE LOCALISABLE_APP_INFO
|
||||
{
|
||||
caption_and_icon =
|
||||
{
|
||||
CAPTION_AND_ICON_INFO
|
||||
{
|
||||
caption = "PicoDrive";
|
||||
// Icons are used to represent applications in the
|
||||
// application launcher and application title bar.
|
||||
// The number_of_icons value identifies how many icons
|
||||
// that exist in the icon_file.
|
||||
number_of_icons = 3;
|
||||
// Using the application icons.
|
||||
icon_file = "\\Resource\\Apps\\PicoDrive.mbm";
|
||||
}
|
||||
};
|
||||
}
|
|
@ -3,7 +3,7 @@ NAME PCDR
|
|||
#include <eikon.rh>
|
||||
#include <eikon.rsg>
|
||||
#include <qikon.rh>
|
||||
#include <QikCommand.rh>
|
||||
#include <qikcommand.rh>
|
||||
#include "picodrive.hrh"
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ RESOURCE QIK_COMMAND_LIST r_app_commands
|
|||
QIK_COMMAND { id=EEikCmdPicoSettings; text="Settings"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; },
|
||||
QIK_COMMAND { id=EEikCmdHelpAbout; text="About"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; },
|
||||
|
||||
QIK_COMMAND { id=EEikCmdPicoLoadROM; text="Load new ROM"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },
|
||||
QIK_COMMAND { id=EEikCmdPicoLoadROM; text="Load new ROM/ISO";type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },
|
||||
QIK_COMMAND { id=EEikCmdPicoReset; text="Reset game"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },
|
||||
QIK_COMMAND { id=EEikCmdPicoLoadState; text="Load state"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },
|
||||
QIK_COMMAND { id=EEikCmdPicoSaveState; text="Save state"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },
|
||||
|
@ -137,6 +137,12 @@ RESOURCE ARRAY r_pico_config_pages
|
|||
lines = r_pico_config_page_sound;
|
||||
},
|
||||
PAGE
|
||||
{
|
||||
id = ECtlOptPageMCD;
|
||||
text = "MegaCD";
|
||||
lines = r_pico_config_page_mcd;
|
||||
},
|
||||
PAGE
|
||||
{
|
||||
id = ECtlOptPageMisc;
|
||||
text = "Misc";
|
||||
|
@ -151,7 +157,7 @@ RESOURCE ARRAY r_pico_config_page_main
|
|||
items = {
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptRotationLabel;
|
||||
id = ECtlOptRotationLabel;
|
||||
type = EEikCtLabel;
|
||||
prompt = "Screen Rotation";
|
||||
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
|
||||
|
@ -167,7 +173,7 @@ RESOURCE ARRAY r_pico_config_page_main
|
|||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptScreenModeLabel;
|
||||
id = ECtlOptScreenModeLabel;
|
||||
type = EEikCtLabel;
|
||||
prompt = "Screen Mode";
|
||||
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
|
||||
|
@ -188,18 +194,6 @@ RESOURCE ARRAY r_pico_config_page_main
|
|||
prompt = "Fast renderer (inaccurate)";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptUseAccTiming;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "Accurate timing (slower)";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptUseAccSprites;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "Accurate sprites (slower)";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptShowFPS;
|
||||
type = EEikCtCheckBox;
|
||||
|
@ -220,7 +214,7 @@ RESOURCE ARRAY r_pico_config_page_sound
|
|||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptChipSelLabel;
|
||||
id = ECtlOptChipSelLabel;
|
||||
type = EEikCtLabel;
|
||||
prompt = "Emulate these sound chips:";
|
||||
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
|
||||
|
@ -245,7 +239,7 @@ RESOURCE ARRAY r_pico_config_page_sound
|
|||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptSndQLabel;
|
||||
id = ECtlOptSndQLabel;
|
||||
type = EEikCtLabel;
|
||||
prompt = "Quality (lowest is fastest)";
|
||||
control = LABEL { horiz_align = EEikLabelAlignHLeft; };
|
||||
|
@ -262,6 +256,43 @@ RESOURCE ARRAY r_pico_config_page_sound
|
|||
}
|
||||
|
||||
|
||||
RESOURCE ARRAY r_pico_config_page_mcd
|
||||
{
|
||||
items = {
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptCDcdda;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "CDDA audio";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptCDpcm;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "PCM audio";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptCDramcart;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "SaveRAM cart";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptCDscalerot;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "Scale/Rot. fx (slow)";
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
id = ECtlOptCDbettersync;
|
||||
type = EEikCtCheckBox;
|
||||
prompt = "Better sync (slow)";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
RESOURCE ARRAY r_pico_config_page_misc
|
||||
{
|
||||
items = {
|
||||
|
@ -449,7 +480,7 @@ RESOURCE TBUF r_pico_text_about
|
|||
"<p><s=6> <p><f=Corinna><s=12>Version %S, by notaz."\
|
||||
"<p><s=5> <p><s=10>Port based on UIQ2 version, which is based on PicoDrive 0.030 for Pocket PC by Dave"\
|
||||
"<p><s=5> <p><f=Corinna><s=11><u>Email</u>: notasas@gmail.com"\
|
||||
"<p><f=Corinna><s=10><u>Web</u>: http://notaz.atspace.com"\
|
||||
"<p><f=Corinna><s=10><u>Web</u>: http://notaz.gp2x.de"\
|
||||
"<p><f=Corinna><s=10><u>Dave's Web</u>: http://www.finalburn.com";
|
||||
}
|
||||
|
||||
|
@ -557,17 +588,22 @@ RESOURCE ARRAY r_pico_tbuf_credits
|
|||
LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";},
|
||||
LBUF{txt="Homepage: http://reesy.gp32x.de/";},
|
||||
LBUF{txt="";},
|
||||
LBUF{txt="Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator (MAME) development";},
|
||||
LBUF{txt="MultiArcadeMachineEmulator (MAME) development";},
|
||||
LBUF{txt="- software implementation of Yamaha FM sound generator and";},
|
||||
LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";},
|
||||
LBUF{txt="Homepage: http://www.mame.net/";},
|
||||
LBUF{txt="";},
|
||||
LBUF{txt="Helix community";},
|
||||
LBUF{txt="Helix mp3 decoder";},
|
||||
LBUF{txt="";},
|
||||
LBUF{txt="Additional thanks:";},
|
||||
LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";},
|
||||
LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";},
|
||||
LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";},
|
||||
LBUF{txt="- Tasco Deluxe for his reverse engineering work on SVP and some mappers.";},
|
||||
LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";},
|
||||
LBUF{txt="- Maze for his research (http://haze.mameworld.info).";},
|
||||
LBUF{txt="- Haze for his research (http://haze.mameworld.info).";},
|
||||
LBUF{txt="- Lordus, Exophase and Rokas for various ideas.";},
|
||||
LBUF{txt="- Mark and Jean-loup for zlib library.";},
|
||||
LBUF{txt="- Peter van Sebille for his various open-source Symbian projects to learn from.";},
|
||||
LBUF{txt="- Steve Fischer for his open-source Motorola projects.";},
|
56
platform/uiq3/rsc/picodrive_loc.rss
Normal file
56
platform/uiq3/rsc/picodrive_loc.rss
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <appinfo.rh>
|
||||
#include <qikon.hrh>
|
||||
|
||||
#define EViewIdPrimaryView 1
|
||||
|
||||
// This file localise the applications icons and caption
|
||||
RESOURCE LOCALISABLE_APP_INFO
|
||||
{
|
||||
caption_and_icon =
|
||||
{
|
||||
CAPTION_AND_ICON_INFO
|
||||
{
|
||||
caption = "PicoDrive";
|
||||
// Icons are used to represent applications in the
|
||||
// application launcher and application title bar.
|
||||
// The number_of_icons value identifies how many icons
|
||||
// that exist in the icon_file.
|
||||
number_of_icons = 3;
|
||||
// Using the application icons.
|
||||
icon_file = "\\Resource\\Apps\\PicoDrive.mbm";
|
||||
}
|
||||
};
|
||||
|
||||
view_list =
|
||||
{
|
||||
VIEW_DATA
|
||||
{
|
||||
uid=EViewIdPrimaryView;
|
||||
screen_mode=0;
|
||||
caption_and_icon =
|
||||
{
|
||||
CAPTION_AND_ICON_INFO
|
||||
{
|
||||
caption = "PicoDrive";
|
||||
number_of_icons = 3;
|
||||
icon_file = "\\Resource\\Apps\\PicoDrive.mbm";
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
VIEW_DATA
|
||||
{
|
||||
uid=EViewIdPrimaryView;
|
||||
screen_mode=EQikScreenModeSmallPortrait;
|
||||
caption_and_icon =
|
||||
{
|
||||
CAPTION_AND_ICON_INFO
|
||||
{
|
||||
caption = "PicoDrive";
|
||||
number_of_icons = 3;
|
||||
icon_file = "\\Resource\\Apps\\PicoDrive.mbm";
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
// All registration files need to #include appinfo.rh.
|
||||
#include <AppInfo.rh>
|
||||
#include <appinfo.rh>
|
||||
|
||||
// All registration files must define UID2, which is always
|
||||
// KUidAppRegistrationResourceFile, and UID3, which is the application's UID.
|
||||
UID2 KUidAppRegistrationResourceFile
|
||||
UID3 0xA00010F3 // application UID
|
||||
// ? UID2 KUidAppRegistrationResourceFile
|
||||
// ? UID3 0xA00010F3 // application UID
|
||||
|
||||
// Registration file need to containo an APP_REGISTRATION_INFO resource that
|
||||
// minimally needs to provide the name of the application binary (using the
|
167
platform/uiq3/uiq3.mak
Normal file
167
platform/uiq3/uiq3.mak
Normal file
|
@ -0,0 +1,167 @@
|
|||
#######################################################################
|
||||
### App specific part - this must be defined
|
||||
#NAME="AnimatedStereogram"
|
||||
#VENDOR="Pal Szasz"
|
||||
#UID2=100039CE
|
||||
#UID3=E0004201
|
||||
#EPOCLIBS="euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib"
|
||||
#EPOCROOT=/opt/space/uiq3/
|
||||
#######################################################################
|
||||
|
||||
APPNAME ?= "UIQ3 Program"
|
||||
VENDOR ?= "Somebody"
|
||||
UID2 ?= 100039CE
|
||||
UID3 ?= E0001001
|
||||
VER_MAJ ?= 1
|
||||
VER_MIN ?= 0
|
||||
STACK ?= 0x1000
|
||||
HEAP ?= 0x1000,0x100000
|
||||
EPOCROOT ?= /opt/space/uiq3/
|
||||
GCCPREF ?= arm-none-symbianelf
|
||||
GCCPATH ?= $(EPOCROOT)/gcc
|
||||
GCCVER ?= 3.4.3
|
||||
|
||||
export EPOCROOT
|
||||
|
||||
NAME_ := $(shell echo $(APPNAME) | sed 's: ::g')
|
||||
NAME := $(shell perl -e "print lc(\"$(NAME_)\")")
|
||||
EPOCLIBS += euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib qikallocdll.lib
|
||||
EPOCREL = $(EPOCROOT)/epoc32/release/armv5
|
||||
CC = $(GCCPREF)-gcc
|
||||
CXX = $(GCCPREF)-g++
|
||||
AS = $(GCCPREF)-as
|
||||
LD = $(GCCPREF)-ld
|
||||
ELF2E32 = elf2e32
|
||||
BMCONV = bmconv
|
||||
EPOCRC = EPOCROOT=$(EPOCROOT) epocrc
|
||||
|
||||
PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(GCCPATH)/$(GCCPREF)/bin:$(PATH)
|
||||
|
||||
# TODO: do we really need -mapcs?
|
||||
# -march=armv5t
|
||||
CFLAGS += -Wall -pipe -nostdinc -msoft-float
|
||||
CFLAGS += -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__
|
||||
CFLAGS += -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ -D__MARM_ARMV5__
|
||||
CFLAGS += -D__PRODUCT_INCLUDE__="$(EPOCROOT)/epoc32/include/variant/uiq_3.0.hrh"
|
||||
CFLAGS += -include $(EPOCROOT)/epoc32/include/gcce/gcce.h
|
||||
CFLAGS += -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/libc \
|
||||
-I$(EPOCROOT)/epoc32/include/variant -I$(GCCPATH)/lib/gcc/arm-none-symbianelf/$(GCCVER)/include/
|
||||
# can't optimize .cpp without -fno-unit-at-a-time
|
||||
CXXFLAGS += $(CFLAGS) -c -x c++ -mapcs -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -fexceptions -fno-unit-at-a-time
|
||||
|
||||
LDFLAGS += -L$(GCCPATH)/lib -L$(GCCPATH)/lib/gcc/$(GCCPREF)/$(GCCVER) -L $(GCCPATH)/$(GCCPREF)/lib
|
||||
LDFLAGS += --target1-abs --no-undefined -nostdlib -shared
|
||||
LDFLAGS += -Ttext 0x8000 -Tdata 0x400000 --default-symver
|
||||
LDFLAGS += -soname $(NAME){000a0000}\[$(UID3)\].exe --entry _E32Startup -u _E32Startup
|
||||
LDFLAGS += $(EPOCROOT)/epoc32/release/armv5/urel/eexe.lib
|
||||
LDFLAGS += -o $(NAME).elf.exe -Map $(NAME).exe.map
|
||||
LDFLAGS2 = $(EPOCREL)/urel/qikalloc.lib $(EPOCREL)/lib/euser.dso
|
||||
LDFLAGS2 += $(shell for i in $(EPOCLIBS); do echo -n " $(EPOCREL)/lib/$${i%%.lib}.dso "; done)
|
||||
LDFLAGS2 += $(EPOCREL)/urel/usrt2_2.lib
|
||||
LDFLAGS2 += $(shell for i in dfpaeabi dfprvct2_2 drtaeabi scppnwdl drtrvct2_2; do echo -n " $(EPOCREL)/lib/$$i.dso "; done)
|
||||
LDFLAGS2 += -lsupc++ -lgcc
|
||||
|
||||
E32FLAGS += --sid=0x$(UID3) --uid1=0x1000007a --uid2=0x$(UID2) --uid3=0x$(UID3)
|
||||
E32FLAGS += --capability=none --fpu=softvfp --targettype=EXE
|
||||
E32FLAGS += --output=$(NAME).exe --elfinput=$(NAME).elf.exe
|
||||
E32FLAGS += --stack=$(STACK)
|
||||
E32FLAGS += --heap=$(HEAP)
|
||||
E32FLAGS += --linkas=$(NAME){000a0000}[$(UID3)].exe --libpath=$(EPOCREL)/lib
|
||||
|
||||
EPOCRCFLAGS += -I../inc -I- -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/variant -DLANGUAGE_SC
|
||||
|
||||
ICONS ?= $(shell echo ../data/appicon/*.bmp)
|
||||
APPICON ?= $(NAME)appicon.mbm
|
||||
RSCDIR ?= ../rsc
|
||||
REGDIR ?= ../reg
|
||||
|
||||
SRCH += $(shell echo ../inc/*.h)
|
||||
SRC += $(shell echo ../src/*.cpp)
|
||||
SRCRES ?= $(shell echo $(RSCDIR)/*.rss $(RSCDIR)/*.rls $(REGDIR)/*.rss $(REGDIR)/*.rls)
|
||||
OBJ ?= $(SRC:.cpp=.o)
|
||||
|
||||
.PHONY : all mbm icon_mbm rsc reg loc bin sis run
|
||||
|
||||
#all : sis
|
||||
|
||||
sis : $(NAME).sis
|
||||
|
||||
icon_mbm : $(APPICON)
|
||||
|
||||
mbm :
|
||||
|
||||
$(NAME)appicon.mbg $(NAME)appicon.mbm : $(ICONS)
|
||||
@echo "Creating multibitmap file..."
|
||||
$(BMCONV) /h$(NAME)appicon.mbg $(NAME)appicon.mbm \
|
||||
/c24../data/appicon/icon_small.bmp\
|
||||
/8../data/appicon/icon_small_mask.bmp\
|
||||
/c24../data/appicon/icon_large.bmp\
|
||||
/8../data/appicon/icon_large_mask.bmp\
|
||||
/c24../data/appicon/icon_xlarge.bmp\
|
||||
/8../data/appicon/icon_xlarge_mask.bmp
|
||||
|
||||
rsc : $(RSCDIR)/$(NAME).rsc
|
||||
|
||||
$(RSCDIR)/$(NAME).rsc : $(RSCDIR)/$(NAME).rss # $(RSCDIR)/$(NAME).rls
|
||||
@echo "Creating $@ ..."
|
||||
$(EPOCRC) $(EPOCRCFLAGS) -I$(RSCDIR) -u $(RSCDIR)/$(NAME).rss \
|
||||
-o$(RSCDIR)/$(NAME).rsc -h$(RSCDIR)/$(NAME).rsg -t/tmp -l$(RSCDIR)
|
||||
|
||||
reg : $(REGDIR)/$(NAME)_reg.rsc
|
||||
|
||||
$(REGDIR)/$(NAME)_reg.rsc : $(REGDIR)/$(NAME)_reg.rss
|
||||
@echo "Creating $@ ..."
|
||||
RC_UID2=0x101f8021 RC_UID3=0x$(UID3) $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
|
||||
-u $(REGDIR)/$(NAME)_reg.rss -o$(REGDIR)/$(NAME)_reg.rsc -h$(REGDIR)/$(NAME)_reg.rsg -t/tmp -l$(REGDIR)
|
||||
|
||||
loc : $(REGDIR)/$(NAME)_loc.rsc
|
||||
|
||||
$(REGDIR)/$(NAME)_loc.rsc : $(REGDIR)/$(NAME)_loc.rss
|
||||
@echo "Creating $@ ..."
|
||||
$(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
|
||||
-u $(REGDIR)/$(NAME)_loc.rss -o$(REGDIR)/$(NAME)_loc.rsc -h$(REGDIR)/$(NAME)_loc.rsg -t/tmp -l$(REGDIR)
|
||||
|
||||
bin : bin_elf
|
||||
@echo "Elf -> E32"
|
||||
$(ELF2E32) $(E32FLAGS)
|
||||
|
||||
bin_elf : $(NAME).elf.exe
|
||||
|
||||
$(NAME).elf.exe : $(OBJ) $(EXTRALIB)
|
||||
@echo "Linking..."
|
||||
$(LD) $(LDFLAGS) $(OBJ) $(EXTRALIB) $(LDFLAGS2)
|
||||
|
||||
.cpp.o :
|
||||
@echo "Compiling $< ..."
|
||||
$(CXX) $(CXXFLAGS) -o $@ $<
|
||||
|
||||
$(NAME).sis : icon_mbm mbm rsc reg loc bin
|
||||
rm -f $(NAME).sis
|
||||
makesis $(NAME).pkg
|
||||
mv $(NAME).SIS $(NAME).sis
|
||||
|
||||
#cat $(EPOCROOT)/extra/in.pkg extra.pkg | \
|
||||
# sed "s:APPNAME:$(APPNAME):g" | \
|
||||
# sed "s:NAME:$(NAME):g" | \
|
||||
# sed "s:VER_MAJ:$(VER_MAJ):g" | \
|
||||
# sed "s:VER_MIN:$(VER_MIN):g" | \
|
||||
# sed "s:UID3:$(UID3):g" | \
|
||||
# sed "s:VENDOR:$(VENDOR):g" > $(NAME).pkg
|
||||
|
||||
run : sis
|
||||
xterm -e "to-phone m600 $(NAME).sis"
|
||||
|
||||
-include .deps
|
||||
|
||||
.deps : $(SRC) $(SRCH)
|
||||
echo > $@
|
||||
$(CXX) -M -DDEPS $(SRC) $(CXXFLAGS) >> $@
|
||||
|
||||
clean :
|
||||
rm -f $(NAME).exe $(NAME).elf.exe $(OBJ) tags .deps $(NAME).exe.map
|
||||
rm -f *.bkp ../src/*.bkp ../inc/*.bkp $(RSCDIR)/*.bkp $(REGDIR)/*.bkp
|
||||
rm -f $(RSCDIR)/*.rsc $(RSCDIR)/*.rsg
|
||||
rm -f $(REGDIR)/*.rsc $(REGDIR)/*.rsg
|
||||
rm -f $(APPICON) $(NAME)appicon.mbg $(NAME).mbg
|
||||
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define KPicoMajorVersionNumber 0
|
||||
#define KPicoMinorVersionNumber 96
|
||||
#define KPicoMajorVersionNumber 1
|
||||
#define KPicoMinorVersionNumber 51
|
||||
#define KPicoBuildNumber 0
|
||||
|
||||
#endif /* __VERSION_H */
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <ezlib.h>
|
||||
#else
|
||||
#include "zlib/zlib.h"
|
||||
#endif
|
||||
|
||||
/* public globals */
|
||||
//int gUnzipQuiet = 0; /* flag controls error messages */
|
||||
|
|
|
@ -6,11 +6,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <ezlib.h>
|
||||
#else
|
||||
#include "zlib/zlib.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define errormsg(str1,def,fname) printf("%s: " #def ": " str1 "\n", fname);
|
||||
|
|
|
@ -305,6 +305,10 @@ typedef uLong FAR uLongf;
|
|||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__EPOC32__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue