mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
psp fixes, gamma
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@302 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
f3f1615e5e
commit
93c0d147a1
13 changed files with 237 additions and 55 deletions
|
@ -628,6 +628,13 @@ Additional thanks
|
||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
---------
|
---------
|
||||||
|
1.35b
|
||||||
|
* PSP: mp3 code should no longer fail on 1.5 firmware.
|
||||||
|
+ PSP: added gamma adjustment option.
|
||||||
|
* Fixed a sram bug in memhandlers (fixes Shining in the Darkness saves).
|
||||||
|
* PSP: fixed another bug in memhanlers, which crashed the emu for some games
|
||||||
|
(like NBA Jam).
|
||||||
|
|
||||||
1.35a
|
1.35a
|
||||||
* PSP: fixed a bug which prevented to load any ROMs after testing the BIOS.
|
* PSP: fixed a bug which prevented to load any ROMs after testing the BIOS.
|
||||||
* PSP: fixed incorrect CZ80 memory map setup, which caused Z80 crashes and
|
* PSP: fixed incorrect CZ80 memory map setup, which caused Z80 crashes and
|
||||||
|
|
|
@ -468,7 +468,11 @@ int emu_ReadConfig(int game, int no_defaults)
|
||||||
//scaling_update();
|
//scaling_update();
|
||||||
// some sanity checks
|
// some sanity checks
|
||||||
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
|
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
|
||||||
|
#ifdef PSP
|
||||||
|
if (currentConfig.gamma < -4 || currentConfig.gamma > 16) currentConfig.gamma = 0;
|
||||||
|
#else
|
||||||
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;
|
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;
|
||||||
|
#endif
|
||||||
if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;
|
if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;
|
||||||
#ifdef __GP2X__
|
#ifdef __GP2X__
|
||||||
// if volume keys are unbound, bind them to volume control
|
// if volume keys are unbound, bind them to volume control
|
||||||
|
|
|
@ -74,6 +74,7 @@ typedef enum
|
||||||
MA_OPT3_PRES_FULLSCR,
|
MA_OPT3_PRES_FULLSCR,
|
||||||
MA_OPT3_FILTERING,
|
MA_OPT3_FILTERING,
|
||||||
MA_OPT3_VSYNC,
|
MA_OPT3_VSYNC,
|
||||||
|
MA_OPT3_GAMMAA,
|
||||||
MA_OPT3_DONE,
|
MA_OPT3_DONE,
|
||||||
MA_CDOPT_TESTBIOS_USA,
|
MA_CDOPT_TESTBIOS_USA,
|
||||||
MA_CDOPT_TESTBIOS_EUR,
|
MA_CDOPT_TESTBIOS_EUR,
|
||||||
|
|
|
@ -27,58 +27,62 @@ COPT += `pkg-config --cflags gthread-2.0`
|
||||||
LDFLAGS += `pkg-config --libs gthread-2.0`
|
LDFLAGS += `pkg-config --libs gthread-2.0`
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += ../gp2x/main.o ../gp2x/menu.o ../gp2x/emu.o ../gp2x/usbjoy.o blit.o \
|
OBJS += platform/gp2x/main.o platform/gp2x/menu.o platform/gp2x/emu.o platform/gp2x/usbjoy.o blit.o \
|
||||||
gp2x.o 940ctl_ym2612.o log_io.o
|
gp2x.o 940ctl_ym2612.o log_io.o
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/readpng.o ../common/mp3_helix.o
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o \
|
||||||
|
platform/common/readpng.o platform/common/mp3_helix.o
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \
|
OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o \
|
||||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
|
Pico/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o
|
||||||
../../Pico/Patch.o
|
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
||||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/gfx_cd.o \
|
||||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
Pico/cd/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.o
|
||||||
# Pico - sound
|
# Pico - sound
|
||||||
OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o ../../Pico/sound/mix.o
|
OBJS += Pico/sound/sound.o Pico/sound/sn76496.o Pico/sound/ym2612.o Pico/sound/mix.o
|
||||||
# zlib
|
# zlib
|
||||||
OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \
|
OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
|
||||||
../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o
|
zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o
|
||||||
# unzip
|
# unzip
|
||||||
OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o
|
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
||||||
# CPU cores
|
# CPU cores
|
||||||
ifeq "$(use_musashi)" "1"
|
ifeq "$(use_musashi)" "1"
|
||||||
DEFINC += -DEMU_M68K
|
DEFINC += -DEMU_M68K
|
||||||
OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o
|
OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
|
||||||
endif
|
endif
|
||||||
ifeq "$(use_fame)" "1"
|
ifeq "$(use_fame)" "1"
|
||||||
DEFINC += -DEMU_F68K
|
DEFINC += -DEMU_F68K
|
||||||
OBJS += ../../cpu/fame/famec.o
|
OBJS += cpu/fame/famec.o
|
||||||
endif
|
endif
|
||||||
# z80
|
# z80
|
||||||
ifeq "$(use_mz80)" "1"
|
ifeq "$(use_mz80)" "1"
|
||||||
DEFINC += -D_USE_MZ80
|
DEFINC += -D_USE_MZ80
|
||||||
OBJS += ../../cpu/mz80/mz80.o
|
OBJS += cpu/mz80/mz80.o
|
||||||
else
|
else
|
||||||
DEFINC += -D_USE_CZ80
|
DEFINC += -D_USE_CZ80
|
||||||
OBJS += ../../cpu/cz80/cz80.o
|
OBJS += cpu/cz80/cz80.o
|
||||||
endif
|
endif
|
||||||
# misc
|
# misc
|
||||||
ifeq "$(use_fame)" "1"
|
ifeq "$(use_fame)" "1"
|
||||||
ifeq "$(use_musashi)" "1"
|
ifeq "$(use_musashi)" "1"
|
||||||
OBJS += ../../Pico/Debug.o
|
OBJS += Pico/Debug.o
|
||||||
OBJS += ../../cpu/musashi/m68kdasm.o
|
OBJS += cpu/musashi/m68kdasm.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
vpath %.c = ../..
|
||||||
|
DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/sound zlib unzip \
|
||||||
|
cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
|
||||||
|
|
||||||
all: PicoDrive
|
all: mkdirs PicoDrive
|
||||||
clean: tidy
|
clean: tidy
|
||||||
@$(RM) PicoDrive
|
@$(RM) PicoDrive
|
||||||
tidy:
|
tidy:
|
||||||
@$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
rm -rf $(DIRS)
|
||||||
@make -C ../../cpu/mz80/ clean
|
@make -C ../../cpu/mz80/ clean
|
||||||
@make -C ../common/helix/ X86=1 clean
|
@make -C ../common/helix/ X86=1 clean
|
||||||
|
|
||||||
|
@ -86,11 +90,13 @@ PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(GCC) $(COPT) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
|
$(GCC) $(COPT) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
|
||||||
|
|
||||||
|
mkdirs:
|
||||||
|
mkdir -p $(DIRS)
|
||||||
|
|
||||||
../../cpu/musashi/m68kops.c :
|
../../cpu/musashi/m68kops.c :
|
||||||
@make -C ../../cpu/musashi
|
@make -C ../../cpu/musashi
|
||||||
|
|
||||||
../../cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
|
cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
|
||||||
@echo $@
|
@echo $@
|
||||||
@nasm -f elf $< -o $@
|
@nasm -f elf $< -o $@
|
||||||
|
|
||||||
|
@ -108,11 +114,11 @@ PicoDrive : $(OBJS) ../common/helix/helix_mp3_x86.a
|
||||||
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
../../Pico/sound/ym2612.o : ../../Pico/sound/ym2612.c
|
Pico/sound/ym2612.o : ../../Pico/sound/ym2612.c
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@
|
$(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@
|
||||||
|
|
||||||
../../cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
|
cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
|
||||||
@echo ">>>" $<
|
@echo ">>>" $<
|
||||||
$(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
|
$(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
|
||||||
|
|
||||||
|
|
10
psp/Makefile
10
psp/Makefile
|
@ -6,6 +6,7 @@ PSPSDK = $(shell psp-config --pspsdk-path)
|
||||||
#use_musashi = 1
|
#use_musashi = 1
|
||||||
#use_mz80 = 1
|
#use_mz80 = 1
|
||||||
amalgamate = 0
|
amalgamate = 0
|
||||||
|
for_15fw = 1
|
||||||
|
|
||||||
|
|
||||||
CFLAGS += -I../.. -I. -DNO_SYNC
|
CFLAGS += -I../.. -I. -DNO_SYNC
|
||||||
|
@ -17,10 +18,13 @@ CFLAGS += -O2 -ftracer -fstrength-reduce -ffast-math
|
||||||
else
|
else
|
||||||
CFLAGS += -ggdb
|
CFLAGS += -ggdb
|
||||||
endif
|
endif
|
||||||
|
ifeq "$(for_15fw)" "1"
|
||||||
|
CFLAGS += -DFW15
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# frontend
|
# frontend and stuff
|
||||||
OBJS += main.o emu.o mp3.o menu.o psp.o
|
OBJS += main.o emu.o mp3.o menu.o psp.o asm_utils.o
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/readpng.o
|
OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/readpng.o
|
||||||
|
@ -81,7 +85,9 @@ EXTRA_TARGETS = EBOOT.PBP
|
||||||
PSP_EBOOT_TITLE = PicoDrive
|
PSP_EBOOT_TITLE = PicoDrive
|
||||||
PSP_EBOOT_ICON = data/icon.png
|
PSP_EBOOT_ICON = data/icon.png
|
||||||
#PSP_EBOOT_PIC1 = .png
|
#PSP_EBOOT_PIC1 = .png
|
||||||
|
ifneq "$(for_15fw)" "1"
|
||||||
BUILD_PRX = 1
|
BUILD_PRX = 1
|
||||||
|
endif
|
||||||
|
|
||||||
CUSTOM_CLEAN = myclean
|
CUSTOM_CLEAN = myclean
|
||||||
|
|
||||||
|
|
2
psp/asm_utils.h
Normal file
2
psp/asm_utils.h
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// pointers must be word aligned
|
||||||
|
void do_pal_convert(unsigned short *dest, unsigned short *src, int gammaa_val);
|
122
psp/asm_utils.s
Normal file
122
psp/asm_utils.s
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
# vim:filetype=mips
|
||||||
|
|
||||||
|
# some asm utils
|
||||||
|
# (c) Copyright 2007, Grazvydas "notaz" Ignotas
|
||||||
|
# All Rights Reserved
|
||||||
|
|
||||||
|
.set noreorder
|
||||||
|
.set noat
|
||||||
|
|
||||||
|
.data
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
.byte 0, 1, 6, 11, 16, 21, 26, 31 # -4
|
||||||
|
.byte 0, 2, 7, 12, 16, 21, 26, 31 # -3
|
||||||
|
.byte 0, 3, 7, 12, 17, 22, 26, 31 # -2
|
||||||
|
.byte 0, 4, 8, 13, 17, 22, 26, 31 # -1
|
||||||
|
gmtab:
|
||||||
|
.byte 0, 5, 10, 15, 16, 21, 26, 31 # 0
|
||||||
|
.byte 0, 6, 10, 15, 19, 23, 27, 31
|
||||||
|
.byte 0, 7, 11, 15, 19, 23, 27, 31
|
||||||
|
.byte 0, 8, 12, 16, 19, 23, 27, 31
|
||||||
|
.byte 0, 9, 12, 16, 20, 24, 27, 31
|
||||||
|
.byte 0, 10, 13, 17, 20, 24, 27, 31
|
||||||
|
.byte 0, 10, 14, 17, 21, 24, 28, 31
|
||||||
|
.byte 0, 11, 15, 18, 21, 24, 28, 31
|
||||||
|
.byte 0, 12, 15, 18, 22, 25, 28, 31
|
||||||
|
.byte 0, 13, 16, 19, 22, 25, 28, 31
|
||||||
|
.byte 0, 14, 17, 20, 22, 25, 28, 31 # 10
|
||||||
|
.byte 0, 15, 17, 20, 23, 26, 28, 31
|
||||||
|
.byte 0, 16, 18, 21, 23, 26, 28, 31
|
||||||
|
.byte 0, 16, 19, 21, 24, 26, 29, 31
|
||||||
|
.byte 0, 17, 20, 22, 24, 26, 29, 31
|
||||||
|
.byte 0, 18, 20, 22, 25, 27, 29, 31
|
||||||
|
.byte 0, 19, 21, 23, 25, 27, 29, 31 # 16
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
# bbbb bggg gggr rrrr
|
||||||
|
|
||||||
|
.global do_pal_convert # dest, src, gammaa_val
|
||||||
|
|
||||||
|
do_pal_convert:
|
||||||
|
bnez $a2, dpc_gma
|
||||||
|
li $t0, 64/2
|
||||||
|
lui $t2, 0x00e
|
||||||
|
ori $t2, 0x00e
|
||||||
|
lui $t3, 0x006
|
||||||
|
ori $t3, 0x006
|
||||||
|
lui $t4, 0x0e0
|
||||||
|
ori $t4, 0x0e0
|
||||||
|
lui $t6, 0xe00
|
||||||
|
ori $t6, 0xe00
|
||||||
|
lui $t7, 0x600
|
||||||
|
ori $t7, 0x600
|
||||||
|
|
||||||
|
dpc_loop:
|
||||||
|
lw $v0, 0($a1)
|
||||||
|
addiu $a1, 4
|
||||||
|
and $v1, $v0, $t2 # r
|
||||||
|
sll $v1, 1
|
||||||
|
and $t9, $v0, $t3
|
||||||
|
srl $t9, 1
|
||||||
|
or $v1, $t9 # r
|
||||||
|
and $t9, $v0, $t4 # g
|
||||||
|
sll $t8, $t9, 3
|
||||||
|
or $v1, $t8
|
||||||
|
or $v1, $t9 # g
|
||||||
|
and $t9, $v0, $t6 # b
|
||||||
|
sll $t9, 4
|
||||||
|
or $v1, $t9
|
||||||
|
and $t9, $v0, $t7
|
||||||
|
sll $t9, 2
|
||||||
|
or $v1, $t9 # b
|
||||||
|
sw $v1, 0($a0)
|
||||||
|
addiu $t0, -1
|
||||||
|
bnez $t0, dpc_loop
|
||||||
|
addiu $a0, 4
|
||||||
|
|
||||||
|
jr $ra
|
||||||
|
nop
|
||||||
|
|
||||||
|
dpc_gma:
|
||||||
|
sll $a2, 3
|
||||||
|
lui $t1, %hi(gmtab)
|
||||||
|
addiu $t1, %lo(gmtab)
|
||||||
|
addu $a2, $t1
|
||||||
|
|
||||||
|
dpc_gma_loop:
|
||||||
|
lw $v0, 0($a1)
|
||||||
|
addiu $a1, 4
|
||||||
|
ext $v1, $v0, 1, 3
|
||||||
|
addu $v1, $a2
|
||||||
|
lb $v1, 0($v1)
|
||||||
|
ext $t1, $v0, 5, 3
|
||||||
|
addu $t1, $a2
|
||||||
|
lb $t1, 0($t1)
|
||||||
|
ext $t2, $v0, 9, 3
|
||||||
|
addu $t2, $a2
|
||||||
|
lb $t2, 0($t2)
|
||||||
|
ext $t3, $v0, 17, 3
|
||||||
|
addu $t3, $a2
|
||||||
|
lb $t3, 0($t3)
|
||||||
|
ext $t4, $v0, 21, 3
|
||||||
|
addu $t4, $a2
|
||||||
|
lb $t4, 0($t4)
|
||||||
|
ext $t5, $v0, 25, 3
|
||||||
|
addu $t5, $a2
|
||||||
|
lb $t5, 0($t5)
|
||||||
|
ins $v1, $t1, 6, 5
|
||||||
|
ins $v1, $t2, 11, 5
|
||||||
|
ins $v1, $t3, 16, 5
|
||||||
|
ins $v1, $t4, 22, 5
|
||||||
|
ins $v1, $t5, 27, 5
|
||||||
|
sw $v1, 0($a0)
|
||||||
|
addiu $t0, -1
|
||||||
|
bnez $t0, dpc_gma_loop
|
||||||
|
addiu $a0, 4
|
||||||
|
|
||||||
|
jr $ra
|
||||||
|
nop
|
||||||
|
|
19
psp/emu.c
19
psp/emu.c
|
@ -17,6 +17,7 @@
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "mp3.h"
|
#include "mp3.h"
|
||||||
|
#include "asm_utils.h"
|
||||||
#include "../common/emu.h"
|
#include "../common/emu.h"
|
||||||
#include "../common/lprintf.h"
|
#include "../common/lprintf.h"
|
||||||
#include "../../Pico/PicoInt.h"
|
#include "../../Pico/PicoInt.h"
|
||||||
|
@ -239,25 +240,25 @@ static void set_scaling_params(void)
|
||||||
|
|
||||||
static void do_pal_update(int allow_sh)
|
static void do_pal_update(int allow_sh)
|
||||||
{
|
{
|
||||||
unsigned int *spal=(void *)Pico.cram;
|
|
||||||
unsigned int *dpal=(void *)localPal;
|
unsigned int *dpal=(void *)localPal;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0x3f/2; i >= 0; i--)
|
//for (i = 0x3f/2; i >= 0; i--)
|
||||||
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
// dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
|
||||||
|
do_pal_convert(localPal, Pico.cram, currentConfig.gamma);
|
||||||
|
|
||||||
if (allow_sh && (Pico.video.reg[0xC]&8)) // shadow/hilight?
|
if (allow_sh && (Pico.video.reg[0xC]&8)) // shadow/hilight?
|
||||||
{
|
{
|
||||||
// shadowed pixels
|
// shadowed pixels
|
||||||
for (i = 0x3f/2; i >= 0; i--)
|
for (i = 0x3f/2; i >= 0; i--)
|
||||||
dpal[0x20|i] = dpal[0x60|i] = (dpal[i]>>1)&0x738e738e;
|
dpal[0x20|i] = dpal[0x60|i] = (dpal[i]>>1)&0x7bcf7bcf;
|
||||||
// hilighted pixels
|
// hilighted pixels
|
||||||
for (i = 0x3f; i >= 0; i--) {
|
for (i = 0x3f; i >= 0; i--) {
|
||||||
int t=localPal[i]&0xe71c;t+=0x4208;
|
int t=localPal[i]&0xf79e;t+=0x4208;
|
||||||
if (t&0x20) t|=0x1c;
|
if (t&0x20) t|=0x1e;
|
||||||
if (t&0x800) t|=0x700;
|
if (t&0x800) t|=0x780;
|
||||||
if (t&0x10000) t|=0xe000;
|
if (t&0x10000) t|=0xf000;
|
||||||
t&=0xe71c;
|
t&=0xf79e;
|
||||||
localPal[0x80|i]=(unsigned short)t;
|
localPal[0x80|i]=(unsigned short)t;
|
||||||
}
|
}
|
||||||
localPal[0xe0] = 0;
|
localPal[0xe0] = 0;
|
||||||
|
|
17
psp/main.c
17
psp/main.c
|
@ -13,14 +13,11 @@
|
||||||
#include "../common/lprintf.h"
|
#include "../common/lprintf.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#define GPROF 0
|
#ifdef GPROF
|
||||||
#define GCOV 0
|
|
||||||
|
|
||||||
#if GPROF
|
|
||||||
#include <pspprof.h>
|
#include <pspprof.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GCOV
|
#ifdef GCOV
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -32,7 +29,7 @@ void dummy(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main()
|
int pico_main(void)
|
||||||
{
|
{
|
||||||
lprintf("\nPicoDrive v" VERSION " " __DATE__ " " __TIME__ "\n");
|
lprintf("\nPicoDrive v" VERSION " " __DATE__ " " __TIME__ "\n");
|
||||||
psp_init();
|
psp_init();
|
||||||
|
@ -49,7 +46,7 @@ int main()
|
||||||
switch (engineState)
|
switch (engineState)
|
||||||
{
|
{
|
||||||
case PGS_Menu:
|
case PGS_Menu:
|
||||||
#if !GPROF
|
#ifndef GPROF
|
||||||
menu_loop();
|
menu_loop();
|
||||||
#else
|
#else
|
||||||
strcpy(romFileName, currentConfig.lastRomFile);
|
strcpy(romFileName, currentConfig.lastRomFile);
|
||||||
|
@ -73,7 +70,7 @@ int main()
|
||||||
|
|
||||||
case PGS_Running:
|
case PGS_Running:
|
||||||
emu_Loop();
|
emu_Loop();
|
||||||
#if GPROF
|
#ifdef GPROF
|
||||||
goto endloop;
|
goto endloop;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -91,10 +88,10 @@ int main()
|
||||||
|
|
||||||
mp3_deinit();
|
mp3_deinit();
|
||||||
emu_Deinit();
|
emu_Deinit();
|
||||||
#if GPROF
|
#ifdef GPROF
|
||||||
gprof_cleanup();
|
gprof_cleanup();
|
||||||
#endif
|
#endif
|
||||||
#if !GCOV
|
#ifndef GCOV
|
||||||
psp_finish();
|
psp_finish();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
15
psp/menu.c
15
psp/menu.c
|
@ -1005,7 +1005,8 @@ menu_entry opt3_entries[] =
|
||||||
{ NULL, MB_NONE, MA_OPT3_SCALE, NULL, 0, 0, 0, 1 },
|
{ NULL, MB_NONE, MA_OPT3_SCALE, NULL, 0, 0, 0, 1 },
|
||||||
{ NULL, MB_NONE, MA_OPT3_HSCALE32, NULL, 0, 0, 0, 1 },
|
{ NULL, MB_NONE, MA_OPT3_HSCALE32, NULL, 0, 0, 0, 1 },
|
||||||
{ NULL, MB_NONE, MA_OPT3_HSCALE40, NULL, 0, 0, 0, 1 },
|
{ NULL, MB_NONE, MA_OPT3_HSCALE40, NULL, 0, 0, 0, 1 },
|
||||||
{ NULL, MB_ONOFF, MA_OPT3_FILTERING, ¤tConfig.scaling, 1, 0, 0, 1 },
|
{ NULL, MB_ONOFF, MA_OPT3_FILTERING, ¤tConfig.scaling, 1, 0, 0, 1 },
|
||||||
|
{ NULL, MB_RANGE, MA_OPT3_GAMMAA, ¤tConfig.gamma, 0, -4, 16, 1 },
|
||||||
{ NULL, MB_NONE, MA_OPT3_VSYNC, NULL, 0, 0, 0, 1 },
|
{ NULL, MB_NONE, MA_OPT3_VSYNC, NULL, 0, 0, 0, 1 },
|
||||||
{ "Set to unscaled centered", MB_NONE, MA_OPT3_PRES_NOSCALE, NULL, 0, 0, 0, 1 },
|
{ "Set to unscaled centered", MB_NONE, MA_OPT3_PRES_NOSCALE, NULL, 0, 0, 0, 1 },
|
||||||
{ "Set to 4:3 scaled", MB_NONE, MA_OPT3_PRES_SCALE43, NULL, 0, 0, 0, 1 },
|
{ "Set to 4:3 scaled", MB_NONE, MA_OPT3_PRES_SCALE43, NULL, 0, 0, 0, 1 },
|
||||||
|
@ -1032,6 +1033,9 @@ static void menu_opt3_cust_draw(const menu_entry *entry, int x, int y, void *par
|
||||||
case MA_OPT3_FILTERING:
|
case MA_OPT3_FILTERING:
|
||||||
text_out16(x, y, "Bilinear filtering %s", currentConfig.scaling?"ON":"OFF");
|
text_out16(x, y, "Bilinear filtering %s", currentConfig.scaling?"ON":"OFF");
|
||||||
break;
|
break;
|
||||||
|
case MA_OPT3_GAMMAA:
|
||||||
|
text_out16(x, y, "Gamma adjustment %2i", currentConfig.gamma);
|
||||||
|
break;
|
||||||
case MA_OPT3_VSYNC: {
|
case MA_OPT3_VSYNC: {
|
||||||
char *val = " never";
|
char *val = " never";
|
||||||
if (currentConfig.EmuOpt & 0x2000)
|
if (currentConfig.EmuOpt & 0x2000)
|
||||||
|
@ -1112,10 +1116,11 @@ static void dispmenu_loop_options(void)
|
||||||
int tmp;
|
int tmp;
|
||||||
me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);
|
me_process(opt3_entries, OPT3_ENTRY_COUNT, selected_id, (inp&BTN_RIGHT) ? 1 : 0);
|
||||||
switch (selected_id) {
|
switch (selected_id) {
|
||||||
case MA_OPT3_SCALE: setting = ¤tConfig.scale; break;
|
case MA_OPT3_SCALE: setting = ¤tConfig.scale; break;
|
||||||
case MA_OPT3_HSCALE40: setting = ¤tConfig.hscale40; is_32col = 0; break;
|
case MA_OPT3_HSCALE40: setting = ¤tConfig.hscale40; is_32col = 0; break;
|
||||||
case MA_OPT3_HSCALE32: setting = ¤tConfig.hscale32; is_32col = 1; break;
|
case MA_OPT3_HSCALE32: setting = ¤tConfig.hscale32; is_32col = 1; break;
|
||||||
case MA_OPT3_FILTERING:menu_opt3_preview(is_32col); break;
|
case MA_OPT3_FILTERING:
|
||||||
|
case MA_OPT3_GAMMAA: menu_opt3_preview(is_32col); break;
|
||||||
case MA_OPT3_VSYNC: tmp = ((currentConfig.EmuOpt>>13)&1) | ((currentConfig.EmuOpt>>15)&2);
|
case MA_OPT3_VSYNC: tmp = ((currentConfig.EmuOpt>>13)&1) | ((currentConfig.EmuOpt>>15)&2);
|
||||||
tmp = (inp & BTN_LEFT) ? (tmp>>1) : ((tmp<<1)|1);
|
tmp = (inp & BTN_LEFT) ? (tmp>>1) : ((tmp<<1)|1);
|
||||||
if (tmp > 3) tmp = 3;
|
if (tmp > 3) tmp = 3;
|
||||||
|
|
|
@ -165,7 +165,8 @@ int mp3_init(void)
|
||||||
mod = load_start_module("flash0:/kd/audiocodec.prx");
|
mod = load_start_module("flash0:/kd/audiocodec.prx");
|
||||||
else mod = load_start_module("flash0:/kd/avcodec.prx");
|
else mod = load_start_module("flash0:/kd/avcodec.prx");
|
||||||
if (mod < 0) {
|
if (mod < 0) {
|
||||||
ret = mod = load_start_module("flash0:/kd/audiocodec_260.prx"); // last chance..
|
ret = mod;
|
||||||
|
mod = load_start_module("flash0:/kd/audiocodec_260.prx"); // last chance..
|
||||||
if (mod < 0) goto fail;
|
if (mod < 0) goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +205,9 @@ int mp3_init(void)
|
||||||
goto fail2;
|
goto fail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* use slightly higher prio then main */
|
||||||
thread_exit = 0;
|
thread_exit = 0;
|
||||||
thid = sceKernelCreateThread("mp3decode_thread", decode_thread, 30, 0x2000, 0, 0); /* use slightly higher prio then main */
|
thid = sceKernelCreateThread("mp3decode_thread", decode_thread, 30, 0x2000, 0, NULL);
|
||||||
if (thid < 0) {
|
if (thid < 0) {
|
||||||
lprintf("failed to create decode thread: %08x\n", thid);
|
lprintf("failed to create decode thread: %08x\n", thid);
|
||||||
ret = thid;
|
ret = thid;
|
||||||
|
|
35
psp/psp.c
35
psp/psp.c
|
@ -14,14 +14,43 @@
|
||||||
#include <psppower.h>
|
#include <psppower.h>
|
||||||
#include <psprtc.h>
|
#include <psprtc.h>
|
||||||
#include <pspgu.h>
|
#include <pspgu.h>
|
||||||
|
#include <pspsdk.h>
|
||||||
|
|
||||||
#include "psp.h"
|
#include "psp.h"
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "../common/lprintf.h"
|
#include "../common/lprintf.h"
|
||||||
|
|
||||||
PSP_MODULE_INFO("PicoDrive", 0, 1, 34);
|
extern int pico_main(void);
|
||||||
|
|
||||||
|
#ifndef FW15
|
||||||
|
|
||||||
|
PSP_MODULE_INFO("PicoDrive", 0, 1, 35);
|
||||||
PSP_HEAP_SIZE_MAX();
|
PSP_HEAP_SIZE_MAX();
|
||||||
|
|
||||||
|
int main() { return pico_main(); } /* just a wrapper */
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
PSP_MODULE_INFO("PicoDrive", 0x1000, 1, 35);
|
||||||
|
PSP_MAIN_THREAD_ATTR(0);
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
SceUID thid;
|
||||||
|
|
||||||
|
/* this is the thing we need the kernel mode for */
|
||||||
|
pspSdkInstallNoDeviceCheckPatch();
|
||||||
|
|
||||||
|
thid = sceKernelCreateThread("pico_main", (SceKernelThreadEntry) pico_main, 32, 0x2000, PSP_THREAD_ATTR_USER, NULL);
|
||||||
|
if (thid >= 0)
|
||||||
|
sceKernelStartThread(thid, 0, 0);
|
||||||
|
sceKernelExitDeleteThread(0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE];
|
unsigned int __attribute__((aligned(16))) guCmdList[GU_CMDLIST_SIZE];
|
||||||
|
|
||||||
void *psp_screen = VRAM_FB0;
|
void *psp_screen = VRAM_FB0;
|
||||||
|
@ -47,7 +76,7 @@ static int power_callback(int unknown, int pwrflags, void *common)
|
||||||
lprintf("power_callback: flags: 0x%08X: suspending\n", pwrflags);
|
lprintf("power_callback: flags: 0x%08X: suspending\n", pwrflags);
|
||||||
engineState = PGS_Menu;
|
engineState = PGS_Menu;
|
||||||
}
|
}
|
||||||
sceDisplayWaitVblankStart();
|
//sceDisplayWaitVblankStart();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +108,7 @@ void psp_init(void)
|
||||||
lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
|
lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
|
||||||
sceKernelGetThreadCurrentPriority());
|
sceKernelGetThreadCurrentPriority());
|
||||||
|
|
||||||
thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
|
thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL);
|
||||||
if (thid >= 0)
|
if (thid >= 0)
|
||||||
{
|
{
|
||||||
sceKernelStartThread(thid, 0, 0);
|
sceKernelStartThread(thid, 0, 0);
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define VERSION "1.35a"
|
#define VERSION "1.35b"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue