mirror of
https://github.com/extremscorner/not64.git
synced 2024-05-15 02:29:42 -04:00
Added hardware scaling of framebuffer to the soft_gfx plugin.
This commit is contained in:
parent
45e41522b7
commit
33e2adb2e9
|
@ -1,249 +1,249 @@
|
|||
#Makefile MUPEN64 for Linux
|
||||
|
||||
CC =powerpc-gekko-gcc
|
||||
CXX =powerpc-gekko-g++
|
||||
AS =powerpc-gekko-as
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN -DVAR_CYCLES -DSOUND \
|
||||
-DNOASM -DNGC -DNOASM -DPIXEL_FORMAT=RGB565 \
|
||||
-fno-exceptions -Wno-unused-parameter -pipe \
|
||||
-DUSE_GUI -DSHOW_DEBUG -DTHREADED_AUDIO -DWII -DUSE_TLB_CACHE
|
||||
# -DPRINTGECKO
|
||||
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
LDFLAGS = $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
INCLUDE = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libfat/libogc/include
|
||||
LIBPATHS = -L$(DEVKITPRO)/libogc/lib/wii -L$(DEVKITPRO)/libfat/libogc/lib/wii
|
||||
|
||||
CXXFLAGS =$(CFLAGS)
|
||||
|
||||
#GL_PATH =-I/usr/X11R6/include
|
||||
|
||||
OBJ =main/rom_gc.o \
|
||||
main/main_gc-menu.o \
|
||||
main/gc_dvd.o \
|
||||
main/gczip.o \
|
||||
main/ROM-Cache-MEM2.o \
|
||||
fileBrowser/fileBrowser-DVD.o \
|
||||
fileBrowser/fileBrowser-libfat.o \
|
||||
fileBrowser/fileBrowser-WiiFS.o \
|
||||
fileBrowser/HW64/customTitle.o \
|
||||
fileBrowser/HW64/workaround.o \
|
||||
fileBrowser/fileBrowser-CARD.o \
|
||||
fileBrowser/fileBrowser.o \
|
||||
gui/menu.o \
|
||||
gui/menuFileBrowser.o \
|
||||
gui/background_tex.o \
|
||||
gui/gui_GX-menu.o \
|
||||
gui/GUI.o \
|
||||
gui/DEBUG.o \
|
||||
gui/TEXT.o \
|
||||
gui/font.o \
|
||||
r4300/r4300.o \
|
||||
r4300/cop0.o \
|
||||
r4300/special.o \
|
||||
r4300/regimm.o \
|
||||
r4300/exception.o \
|
||||
r4300/Invalid_Code.o \
|
||||
gc_memory/ARAM.o \
|
||||
gc_memory/tlb.o \
|
||||
gc_memory/TLB-Cache-hash.o \
|
||||
gc_memory/memory.o \
|
||||
gc_memory/dma.o \
|
||||
r4300/interupt.o \
|
||||
r4300/cop1.o \
|
||||
r4300/tlb.o \
|
||||
r4300/cop1_w.o \
|
||||
r4300/cop1_s.o \
|
||||
r4300/cop1_d.o \
|
||||
r4300/recomp.o \
|
||||
gc_memory/pif.o \
|
||||
r4300/bc.o \
|
||||
r4300/cop1_l.o \
|
||||
r4300/pure_interp.o \
|
||||
r4300/compare_core.o \
|
||||
gc_memory/flashram.o \
|
||||
main/md5.o \
|
||||
main/savestates_gc.o \
|
||||
r4300/profile.o \
|
||||
main/adler32.o main/KillWiimote.o
|
||||
|
||||
OBJ_PPC =r4300/ppc/MIPS-to-PPC.o \
|
||||
r4300/ppc/Recompile.o \
|
||||
r4300/ppc/Wrappers.o \
|
||||
r4300/ppc/ppc_disasm.o
|
||||
|
||||
OBJ_X86 =r4300/x86/gr4300.o \
|
||||
r4300/x86/gcop0.o \
|
||||
r4300/x86/assemble.o \
|
||||
r4300/x86/gcop1.o \
|
||||
r4300/x86/gcop1_s.o \
|
||||
r4300/x86/gcop1_d.o \
|
||||
r4300/x86/gtlb.o \
|
||||
r4300/x86/gregimm.o \
|
||||
r4300/x86/gspecial.o \
|
||||
r4300/x86/gcop1_w.o \
|
||||
r4300/x86/debug.o \
|
||||
r4300/x86/rjump.o \
|
||||
r4300/x86/gbc.o \
|
||||
r4300/x86/gcop1_l.o \
|
||||
r4300/x86/regcache.o
|
||||
|
||||
OBJ_GTK_GUI =main/gui_gtk/main_gtk.o \
|
||||
main/gui_gtk/translate.o \
|
||||
main/gui_gtk/messagebox.o \
|
||||
main/gui_gtk/aboutdialog.o \
|
||||
main/gui_gtk/configdialog.o \
|
||||
main/gui_gtk/support.o \
|
||||
main/gui_gtk/rombrowser.o \
|
||||
main/gui_gtk/romproperties.o \
|
||||
main/gui_gtk/config.o \
|
||||
main/gui_gtk/dirbrowser.o
|
||||
|
||||
OBJ_INPUT =gc_input/main.o \
|
||||
gc_input/controller-GC.o \
|
||||
gc_input/controller-Classic.o
|
||||
|
||||
OBJ_RSPHLE =rsp_hle-ppc/main.o \
|
||||
rsp_hle-ppc/jpeg.o \
|
||||
rsp_hle-ppc/ucode3.o \
|
||||
rsp_hle-ppc/ucode2.o \
|
||||
rsp_hle-ppc/ucode1.o
|
||||
|
||||
OBJ_AUDIO =gc_audio/main.o
|
||||
|
||||
OBJ_SOFT_GFX =mupen64_soft_gfx/main.o \
|
||||
mupen64_soft_gfx/rsp.o \
|
||||
mupen64_soft_gfx/vi_GX.o \
|
||||
mupen64_soft_gfx/vi.o \
|
||||
mupen64_soft_gfx/rdp.o \
|
||||
mupen64_soft_gfx/tx.o \
|
||||
mupen64_soft_gfx/rs.o \
|
||||
mupen64_soft_gfx/tf.o \
|
||||
mupen64_soft_gfx/cc.o \
|
||||
mupen64_soft_gfx/bl.o
|
||||
# mupen64_soft_gfx/font.o
|
||||
|
||||
HEADER =main/rom.h \
|
||||
r4300/r4300.h \
|
||||
r4300/ops.h \
|
||||
r4300/macros.h \
|
||||
r4300/exception.h \
|
||||
gc_memory/memory.h \
|
||||
gc_memory/tlb.h \
|
||||
gc_memory/dma.h \
|
||||
r4300/interupt.h \
|
||||
r4300/recomp.h \
|
||||
gc_memory/pif.h
|
||||
|
||||
LIB = -ldi -lm -lfat -ldb -lwiiuse -lbte -logc -lz
|
||||
|
||||
ifeq ($(strip mupen64_soft_gfx/main.cpp),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
all: wii64-sft.elf
|
||||
|
||||
r4300/interupt.o: r4300/interupt.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/main.o: main/main.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/main_gtk.o: main/main_gtk.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/main_gtk.o: main/gui_gtk/main_gtk.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/translate.o: main/gui_gtk/translate.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/messagebox.o: main/gui_gtk/messagebox.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/aboutdialog.o: main/gui_gtk/aboutdialog.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/configdialog.o: main/gui_gtk/configdialog.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/support.o: main/gui_gtk/support.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/rombrowser.o: main/gui_gtk/rombrowser.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/romproperties.o: main/gui_gtk/romproperties.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/config.o: main/gui_gtk/config.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/dirbrowser.o: main/gui_gtk/dirbrowser.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gui/background_tex.o: gui/background_tex.s
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gc_input/main.o: gc_input/input.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
rsp_hle-ppc/main.o: rsp_hle-ppc/main.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gc_audio/main.o: gc_audio/audio.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#GX_gfx/main.o: GX_gfx/main.cpp
|
||||
# $(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#GX_gfx/vi_GX.o: GX_gfx/vi_GX.cpp
|
||||
# $(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
mupen64_soft_gfx/main.o: mupen64_soft_gfx/main.cpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
mupen64_soft_gfx/vi_GX.o: mupen64_soft_gfx/vi_GX.cpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
r4300/ppc/Wrappers.o: r4300/ppc/Wrappers.s
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
wii64-sft.elf: $(OBJ) $(OBJ_INPUT) $(OBJ_SOFT_GFX) $(OBJ_AUDIO) $(OBJ_RSPHLE) main/main_gc-menu.o #$(OBJ_PPC)
|
||||
$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIB) -Wl -o $@
|
||||
powerpc-gekko-objcopy -O binary $@ wii64-sft.dol
|
||||
powerpc-gekko-objcopy -O binary $@ mupen64.dol
|
||||
dollz3 wii64-sft.dol wii64z.dol
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
install:
|
||||
cp mupen64 "$(PREFIX)bin"
|
||||
cp mupen64_nogui "$(PREFIX)bin"
|
||||
mkdir "$(SHARE)" | echo
|
||||
cp -rv mupen64.ini "$(SHARE)"
|
||||
cp -rv lang "$(SHARE)"
|
||||
cp -rv plugins "$(SHARE)"
|
||||
cp -rv doc "$(SHARE)"
|
||||
|
||||
clean:
|
||||
find . -name '*.o' -print0 | xargs -0r rm -f
|
||||
# rm mupen64 mupen64_nogui mupen64_dbg
|
||||
# rm plugins/mupen64_input.so blight_input/arial.ttf.c blight_input/ttftoh plugins/blight_input.so plugins/mupen64_hle_rsp_azimer.so plugins/dummyaudio.so plugins/mupen64_audio.so plugins/jttl_audio.so plugins/mupen64_GX_gfx.so plugins/mupen64_soft_gfx.so plugins/glN64.so
|
||||
|
||||
clean_o:
|
||||
find . -name '*.o' -print0 | xargs -0r rm -f
|
||||
|
||||
clean_jed:
|
||||
find . -name '*~' -print0 | xargs -0r rm -f
|
||||
|
||||
gprof:
|
||||
gprof mupen64_nogui > stat.txt
|
||||
#Makefile MUPEN64 for Linux
|
||||
|
||||
CC =powerpc-gekko-gcc
|
||||
CXX =powerpc-gekko-g++
|
||||
AS =powerpc-gekko-as
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
|
||||
-DCPU_SHUTDOWN -DSPC700_SHUTDOWN -DVAR_CYCLES -DSOUND \
|
||||
-DNOASM -DNGC -DNOASM -DPIXEL_FORMAT=RGB565 \
|
||||
-fno-exceptions -Wno-unused-parameter -pipe \
|
||||
-DUSE_GUI -DSHOW_DEBUG -DTHREADED_AUDIO -DWII -DUSE_TLB_CACHE
|
||||
# -DPRINTGECKO -DDEBUGON
|
||||
|
||||
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
|
||||
LDFLAGS = $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
|
||||
|
||||
INCLUDE = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libfat/libogc/include
|
||||
LIBPATHS = -L$(DEVKITPRO)/libogc/lib/wii -L$(DEVKITPRO)/libfat/libogc/lib/wii
|
||||
|
||||
CXXFLAGS =$(CFLAGS)
|
||||
|
||||
#GL_PATH =-I/usr/X11R6/include
|
||||
|
||||
OBJ =main/rom_gc.o \
|
||||
main/main_gc-menu.o \
|
||||
main/gc_dvd.o \
|
||||
main/gczip.o \
|
||||
main/ROM-Cache-MEM2.o \
|
||||
fileBrowser/fileBrowser-DVD.o \
|
||||
fileBrowser/fileBrowser-libfat.o \
|
||||
fileBrowser/fileBrowser-WiiFS.o \
|
||||
fileBrowser/HW64/customTitle.o \
|
||||
fileBrowser/HW64/workaround.o \
|
||||
fileBrowser/fileBrowser-CARD.o \
|
||||
fileBrowser/fileBrowser.o \
|
||||
gui/menu.o \
|
||||
gui/menuFileBrowser.o \
|
||||
gui/background_tex.o \
|
||||
gui/gui_GX-menu.o \
|
||||
gui/GUI.o \
|
||||
gui/DEBUG.o \
|
||||
gui/TEXT.o \
|
||||
gui/font.o \
|
||||
r4300/r4300.o \
|
||||
r4300/cop0.o \
|
||||
r4300/special.o \
|
||||
r4300/regimm.o \
|
||||
r4300/exception.o \
|
||||
r4300/Invalid_Code.o \
|
||||
gc_memory/ARAM.o \
|
||||
gc_memory/tlb.o \
|
||||
gc_memory/TLB-Cache-hash.o \
|
||||
gc_memory/memory.o \
|
||||
gc_memory/dma.o \
|
||||
r4300/interupt.o \
|
||||
r4300/cop1.o \
|
||||
r4300/tlb.o \
|
||||
r4300/cop1_w.o \
|
||||
r4300/cop1_s.o \
|
||||
r4300/cop1_d.o \
|
||||
r4300/recomp.o \
|
||||
gc_memory/pif.o \
|
||||
r4300/bc.o \
|
||||
r4300/cop1_l.o \
|
||||
r4300/pure_interp.o \
|
||||
r4300/compare_core.o \
|
||||
gc_memory/flashram.o \
|
||||
main/md5.o \
|
||||
main/savestates_gc.o \
|
||||
r4300/profile.o \
|
||||
main/adler32.o main/KillWiimote.o
|
||||
|
||||
OBJ_PPC =r4300/ppc/MIPS-to-PPC.o \
|
||||
r4300/ppc/Recompile.o \
|
||||
r4300/ppc/Wrappers.o \
|
||||
r4300/ppc/ppc_disasm.o
|
||||
|
||||
OBJ_X86 =r4300/x86/gr4300.o \
|
||||
r4300/x86/gcop0.o \
|
||||
r4300/x86/assemble.o \
|
||||
r4300/x86/gcop1.o \
|
||||
r4300/x86/gcop1_s.o \
|
||||
r4300/x86/gcop1_d.o \
|
||||
r4300/x86/gtlb.o \
|
||||
r4300/x86/gregimm.o \
|
||||
r4300/x86/gspecial.o \
|
||||
r4300/x86/gcop1_w.o \
|
||||
r4300/x86/debug.o \
|
||||
r4300/x86/rjump.o \
|
||||
r4300/x86/gbc.o \
|
||||
r4300/x86/gcop1_l.o \
|
||||
r4300/x86/regcache.o
|
||||
|
||||
OBJ_GTK_GUI =main/gui_gtk/main_gtk.o \
|
||||
main/gui_gtk/translate.o \
|
||||
main/gui_gtk/messagebox.o \
|
||||
main/gui_gtk/aboutdialog.o \
|
||||
main/gui_gtk/configdialog.o \
|
||||
main/gui_gtk/support.o \
|
||||
main/gui_gtk/rombrowser.o \
|
||||
main/gui_gtk/romproperties.o \
|
||||
main/gui_gtk/config.o \
|
||||
main/gui_gtk/dirbrowser.o
|
||||
|
||||
OBJ_INPUT =gc_input/main.o \
|
||||
gc_input/controller-GC.o \
|
||||
gc_input/controller-Classic.o
|
||||
|
||||
OBJ_RSPHLE =rsp_hle-ppc/main.o \
|
||||
rsp_hle-ppc/jpeg.o \
|
||||
rsp_hle-ppc/ucode3.o \
|
||||
rsp_hle-ppc/ucode2.o \
|
||||
rsp_hle-ppc/ucode1.o
|
||||
|
||||
OBJ_AUDIO =gc_audio/main.o
|
||||
|
||||
OBJ_SOFT_GFX =mupen64_soft_gfx/main.o \
|
||||
mupen64_soft_gfx/rsp.o \
|
||||
mupen64_soft_gfx/vi_GX.o \
|
||||
mupen64_soft_gfx/vi.o \
|
||||
mupen64_soft_gfx/rdp.o \
|
||||
mupen64_soft_gfx/tx.o \
|
||||
mupen64_soft_gfx/rs.o \
|
||||
mupen64_soft_gfx/tf.o \
|
||||
mupen64_soft_gfx/cc.o \
|
||||
mupen64_soft_gfx/bl.o
|
||||
# mupen64_soft_gfx/font.o
|
||||
|
||||
HEADER =main/rom.h \
|
||||
r4300/r4300.h \
|
||||
r4300/ops.h \
|
||||
r4300/macros.h \
|
||||
r4300/exception.h \
|
||||
gc_memory/memory.h \
|
||||
gc_memory/tlb.h \
|
||||
gc_memory/dma.h \
|
||||
r4300/interupt.h \
|
||||
r4300/recomp.h \
|
||||
gc_memory/pif.h
|
||||
|
||||
LIB = -ldi -lm -lfat -ldb -lwiiuse -lbte -logc -lz
|
||||
|
||||
ifeq ($(strip mupen64_soft_gfx/main.cpp),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
all: wii64-sft.elf
|
||||
|
||||
r4300/interupt.o: r4300/interupt.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/main.o: main/main.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/main_gtk.o: main/main_gtk.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/main_gtk.o: main/gui_gtk/main_gtk.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/translate.o: main/gui_gtk/translate.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/messagebox.o: main/gui_gtk/messagebox.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/aboutdialog.o: main/gui_gtk/aboutdialog.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/configdialog.o: main/gui_gtk/configdialog.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/support.o: main/gui_gtk/support.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/rombrowser.o: main/gui_gtk/rombrowser.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/romproperties.o: main/gui_gtk/romproperties.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/config.o: main/gui_gtk/config.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
main/gui_gtk/dirbrowser.o: main/gui_gtk/dirbrowser.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gui/background_tex.o: gui/background_tex.s
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gc_input/main.o: gc_input/input.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
rsp_hle-ppc/main.o: rsp_hle-ppc/main.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
gc_audio/main.o: gc_audio/audio.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#GX_gfx/main.o: GX_gfx/main.cpp
|
||||
# $(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
#GX_gfx/vi_GX.o: GX_gfx/vi_GX.cpp
|
||||
# $(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
mupen64_soft_gfx/main.o: mupen64_soft_gfx/main.cpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
mupen64_soft_gfx/vi_GX.o: mupen64_soft_gfx/vi_GX.cpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
r4300/ppc/Wrappers.o: r4300/ppc/Wrappers.s
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
wii64-sft.elf: $(OBJ) $(OBJ_INPUT) $(OBJ_SOFT_GFX) $(OBJ_AUDIO) $(OBJ_RSPHLE) main/main_gc-menu.o #$(OBJ_PPC)
|
||||
$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIB) -Wl -o $@
|
||||
powerpc-gekko-objcopy -O binary $@ wii64-sft.dol
|
||||
powerpc-gekko-objcopy -O binary $@ mupen64.dol
|
||||
dollz3 wii64-sft.dol wii64z.dol
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
install:
|
||||
cp mupen64 "$(PREFIX)bin"
|
||||
cp mupen64_nogui "$(PREFIX)bin"
|
||||
mkdir "$(SHARE)" | echo
|
||||
cp -rv mupen64.ini "$(SHARE)"
|
||||
cp -rv lang "$(SHARE)"
|
||||
cp -rv plugins "$(SHARE)"
|
||||
cp -rv doc "$(SHARE)"
|
||||
|
||||
clean:
|
||||
find . -name '*.o' -print0 | xargs -0r rm -f
|
||||
# rm mupen64 mupen64_nogui mupen64_dbg
|
||||
# rm plugins/mupen64_input.so blight_input/arial.ttf.c blight_input/ttftoh plugins/blight_input.so plugins/mupen64_hle_rsp_azimer.so plugins/dummyaudio.so plugins/mupen64_audio.so plugins/jttl_audio.so plugins/mupen64_GX_gfx.so plugins/mupen64_soft_gfx.so plugins/glN64.so
|
||||
|
||||
clean_o:
|
||||
find . -name '*.o' -print0 | xargs -0r rm -f
|
||||
|
||||
clean_jed:
|
||||
find . -name '*~' -print0 | xargs -0r rm -f
|
||||
|
||||
gprof:
|
||||
gprof mupen64_nogui > stat.txt
|
||||
|
|
|
@ -276,8 +276,8 @@ void write_font(int x, int y, char *string, float scale)
|
|||
int i;
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT1, 4);
|
||||
for (i=0; i<4; i++) {
|
||||
int s = (i & 1) ^ ((i & 2) >> 1) ? fontChars.font_size[c] : 0;
|
||||
int t = (i & 2) ? fontChars.fheight : 0;
|
||||
int s = (i & 1) ^ ((i & 2) >> 1) ? fontChars.font_size[c] : 1;
|
||||
int t = (i & 2) ? fontChars.fheight : 1;
|
||||
float s0 = ((float) (fontChars.s[c] + s))/512;
|
||||
float t0 = ((float) (fontChars.t[c] + t))/512;
|
||||
s = (int) s * scale;
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
font functions
|
||||
*/
|
||||
|
||||
#include <gccore.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ogcsys.h>
|
||||
#include <string.h>
|
||||
#include "font.h"
|
||||
#include <ogc/color.h>
|
||||
|
||||
/* Backdrop Frame Width (to avoid writing outside of the background frame) */
|
||||
u16 back_framewidth = 640;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short font_type, first_char, last_char, subst_char, ascent_units, descent_units, widest_char_width,
|
||||
leading_space, cell_width, cell_height;
|
||||
unsigned long texture_size;
|
||||
unsigned short texture_format, texture_columns, texture_rows, texture_width, texture_height, offset_charwidth;
|
||||
unsigned long offset_tile, size_tile;
|
||||
} FONT_HEADER;
|
||||
|
||||
static unsigned char fontFont[ 0x40000 ] __attribute__((aligned(32)));
|
||||
|
||||
/****************************************************************************
|
||||
* YAY0 Decoding
|
||||
****************************************************************************/
|
||||
/* Yay0 decompression */
|
||||
void yay0_decode(unsigned char *s, unsigned char *d)
|
||||
{
|
||||
int i, j, k, p, q, cnt;
|
||||
|
||||
i = *(unsigned long *)(s + 4); // size of decoded data
|
||||
j = *(unsigned long *)(s + 8); // link table
|
||||
k = *(unsigned long *)(s + 12); // byte chunks and count modifiers
|
||||
|
||||
q = 0; // current offset in dest buffer
|
||||
cnt = 0; // mask bit counter
|
||||
p = 16; // current offset in mask table
|
||||
|
||||
unsigned long r22 = 0, r5;
|
||||
|
||||
do
|
||||
{
|
||||
// if all bits are done, get next mask
|
||||
if(cnt == 0)
|
||||
{
|
||||
// read word from mask data block
|
||||
r22 = *(unsigned long *)(s + p);
|
||||
p += 4;
|
||||
cnt = 32; // bit counter
|
||||
}
|
||||
// if next bit is set, chunk is non-linked
|
||||
if(r22 & 0x80000000)
|
||||
{
|
||||
// get next byte
|
||||
*(unsigned char *)(d + q) = *(unsigned char *)(s + k);
|
||||
k++, q++;
|
||||
}
|
||||
// do copy, otherwise
|
||||
else
|
||||
{
|
||||
// read 16-bit from link table
|
||||
int r26 = *(unsigned short *)(s + j);
|
||||
j += 2;
|
||||
// 'offset'
|
||||
int r25 = q - (r26 & 0xfff);
|
||||
// 'count'
|
||||
int r30 = r26 >> 12;
|
||||
if(r30 == 0)
|
||||
{
|
||||
// get 'count' modifier
|
||||
r5 = *(unsigned char *)(s + k);
|
||||
k++;
|
||||
r30 = r5 + 18;
|
||||
}
|
||||
else r30 += 2;
|
||||
// do block copy
|
||||
unsigned char *pt = ((unsigned char*)d) + r25;
|
||||
int i;
|
||||
for(i=0; i<r30; i++)
|
||||
{
|
||||
*(unsigned char *)(d + q) = *(unsigned char *)(pt - 1);
|
||||
q++, pt++;
|
||||
}
|
||||
}
|
||||
// next bit in mask
|
||||
r22 <<= 1;
|
||||
cnt--;
|
||||
|
||||
} while(q < i);
|
||||
}
|
||||
|
||||
void untile(unsigned char *dst, unsigned char *src, int xres, int yres)
|
||||
{
|
||||
// 8x8 tiles
|
||||
int x, y;
|
||||
int t=0;
|
||||
for (y = 0; y < yres; y += 8)
|
||||
for (x = 0; x < xres; x += 8)
|
||||
{
|
||||
t = !t;
|
||||
int iy, ix;
|
||||
for (iy = 0; iy < 8; ++iy, src+=2)
|
||||
{
|
||||
unsigned char *d = dst + (y + iy) * xres + x;
|
||||
for (ix = 0; ix < 2; ++ix)
|
||||
{
|
||||
int v = src[ix];
|
||||
*d++ = ((v>>6)&3);
|
||||
*d++ = ((v>>4)&3);
|
||||
*d++ = ((v>>2)&3);
|
||||
*d++ = ((v)&3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int font_offset[256], font_size[256], fheight;
|
||||
extern void __SYS_ReadROM(void *buf,u32 len,u32 offset);
|
||||
|
||||
void init_font(void)
|
||||
{
|
||||
static unsigned char fontWork[ 0x20000 ] __attribute__((aligned(32)));
|
||||
int i;
|
||||
|
||||
// dont read system rom fonts because this breaks on qoob modchip
|
||||
__SYS_ReadROM((unsigned char *)&fontFont,0x3000,0x1FCF00);
|
||||
//memcpy(&fontFont, &arial, sizeof(arial));
|
||||
yay0_decode((unsigned char *)&fontFont, (unsigned char *)&fontWork);
|
||||
FONT_HEADER *fnt;
|
||||
|
||||
fnt = ( FONT_HEADER * )&fontWork;
|
||||
|
||||
untile((unsigned char*)&fontFont, (unsigned char*)&fontWork[fnt->offset_tile], fnt->texture_width, fnt->texture_height);
|
||||
|
||||
for (i=0; i<256; ++i)
|
||||
{
|
||||
int c = i;
|
||||
|
||||
if ((c < fnt->first_char) || (c > fnt->last_char)) c = fnt->subst_char;
|
||||
else c -= fnt->first_char;
|
||||
|
||||
font_size[i] = ((unsigned char*)fnt)[fnt->offset_charwidth + c];
|
||||
|
||||
int r = c / fnt->texture_columns;
|
||||
c %= fnt->texture_columns;
|
||||
font_offset[i] = (r * fnt->cell_height) * fnt->texture_width + (c * fnt->cell_width);
|
||||
}
|
||||
|
||||
fheight = fnt->cell_height;
|
||||
}
|
||||
|
||||
#define TRANSPARENCY (COLOR_WHITE)
|
||||
|
||||
unsigned int blit_lookup_inv[4] = {COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE};
|
||||
unsigned int blit_lookup[4] = {COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE};
|
||||
unsigned int blit_lookup_norm[4] = {COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE};
|
||||
|
||||
void blit_char(u32 **axfb,int whichfb,int x, int y, unsigned char c, unsigned int *lookup)
|
||||
{
|
||||
unsigned char *fnt = ((unsigned char*)fontFont) + font_offset[c];
|
||||
int ay, ax;
|
||||
unsigned int llookup;
|
||||
|
||||
for (ay=0; ay<fheight; ++ay)
|
||||
{
|
||||
int h = (ay + y) * 320;
|
||||
|
||||
for (ax=0; ax<font_size[c]; ax++)
|
||||
{
|
||||
int v0 = fnt[ax];
|
||||
int p = h + (( ax + x ) >> 1);
|
||||
unsigned long o = axfb[whichfb][p];
|
||||
|
||||
llookup = lookup[v0];
|
||||
|
||||
if ((v0== 0) && (llookup == TRANSPARENCY))
|
||||
llookup = o;
|
||||
|
||||
if ((ax+x) & 1)
|
||||
{
|
||||
o &= ~0x00FFFFFF;
|
||||
o |= llookup & 0x00FFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
o &= ~0xFF000000;
|
||||
o |= llookup & 0xFF000000;
|
||||
}
|
||||
|
||||
axfb[whichfb][p] = o;
|
||||
}
|
||||
|
||||
fnt += 512;
|
||||
}
|
||||
}
|
||||
|
||||
u8 norm_blit = 1;
|
||||
|
||||
void write_font(int x, int y, char *string,u32 **axfb,int whichfb)
|
||||
{
|
||||
int ox = x;
|
||||
while (*string && (x < (ox + back_framewidth)))
|
||||
{
|
||||
blit_char(axfb,whichfb,x, y, *string, norm_blit ? blit_lookup_norm : blit_lookup);
|
||||
x += font_size[*string];
|
||||
string++;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* font.h
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void init_font(void);
|
||||
void write_font(int x, int y, char *string,u32 **axfb,int whichfb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -27,13 +27,16 @@ static GFX_INFO gfxInfo;
|
|||
|
||||
VI *vi;
|
||||
|
||||
void gfx_PreRetraceCallback(u32 retraceCnt) {
|
||||
vi->PreRetraceCallback(retraceCnt);
|
||||
}
|
||||
|
||||
void gfx_set_fb(unsigned int* fb1, unsigned int* fb2){
|
||||
vi->setFB(fb1, fb2);
|
||||
}
|
||||
|
||||
void showLoadProgress(float percent){
|
||||
//This function is implemented in the GX_gfx plugin
|
||||
//vi->showLoadProg(percent);
|
||||
vi->showLoadProg(percent);
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -190,7 +193,12 @@ EXPORT void CALL MoveScreen (int xpos, int ypos)
|
|||
*******************************************************************/
|
||||
EXPORT void CALL ProcessDList(void)
|
||||
{
|
||||
// GX_SetCopyClear ((GXColor){0,0,0,255}, 0x000000);
|
||||
GX_SetCopyClear ((GXColor){0,0,0,255}, 0xFFFFFF);
|
||||
GX_CopyDisp (vi->getScreenPointer(), GX_TRUE); //clear the EFB before executing new Dlist
|
||||
GX_DrawDone ();
|
||||
RSP rsp(gfxInfo);
|
||||
vi->updateDEBUG();
|
||||
/*static int firstTime=0;
|
||||
|
||||
if(firstTime< 1)
|
||||
|
@ -250,6 +258,7 @@ EXPORT void CALL ProcessRDPList(void)
|
|||
EXPORT void CALL RomClosed (void)
|
||||
{
|
||||
//vi->setGamma(1.0);
|
||||
VIDEO_SetPreRetraceCallback(NULL);
|
||||
delete vi;
|
||||
}
|
||||
|
||||
|
@ -264,6 +273,7 @@ EXPORT void CALL RomOpen (void)
|
|||
{
|
||||
#ifdef __PPC__
|
||||
vi = new VI_GX(gfxInfo);
|
||||
VIDEO_SetPreRetraceCallback(gfx_PreRetraceCallback);
|
||||
#else // __PPC__
|
||||
#ifndef _WIN32
|
||||
vi = new VI_SDL(gfxInfo);
|
||||
|
|
|
@ -74,9 +74,9 @@ template<class T, int s> class Matrix
|
|||
return temp;
|
||||
}
|
||||
|
||||
Vector<T,s> operator*(Vector<T,s>& v) const
|
||||
Vektor<T,s> operator*(Vektor<T,s>& v) const
|
||||
{
|
||||
Vector<T,s> temp;
|
||||
Vektor<T,s> temp;
|
||||
for (int i=0; i<s; i++)
|
||||
{
|
||||
temp[i] = 0;
|
||||
|
@ -86,9 +86,9 @@ template<class T, int s> class Matrix
|
|||
return temp;
|
||||
}
|
||||
|
||||
friend Vector<T,s> operator*(Vector<T,s>& v, Matrix<T,s>& m)
|
||||
friend Vektor<T,s> operator*(Vektor<T,s>& v, Matrix<T,s>& m)
|
||||
{
|
||||
Vector<T,s> temp;
|
||||
Vektor<T,s> temp;
|
||||
for (int i=0; i<s; i++)
|
||||
{
|
||||
temp[i] = 0;
|
||||
|
|
|
@ -195,18 +195,18 @@ void RDP::loadTile(int tile, float uls, float ult, float lrs, float lrt)
|
|||
tx->loadTile(tile, uls, ult, lrs, lrt);
|
||||
}
|
||||
|
||||
void RDP::debug_tri(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2)
|
||||
void RDP::debug_tri(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2)
|
||||
{
|
||||
rs->debug_tri(v0, v1, v2, this);
|
||||
}
|
||||
|
||||
void RDP::tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RDP::tri_shade_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, float z0, float z1, float z2)
|
||||
{
|
||||
rs->tri_shade_zbuff(v0, v1, v2, c0, c1, c2, z0, z1, z2, this);
|
||||
}
|
||||
|
||||
void RDP::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RDP::tri_shade_txtr_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile,
|
||||
float w0, float w1, float w2, float z0, float z1, float z2)
|
||||
|
@ -214,14 +214,14 @@ void RDP::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<
|
|||
rs->tri_shade_txtr_zbuff(v0, v1, v2, c0, c1, c2, s0, t0, s1, t1, s2, t2, tile, w0, w1, w2, z0, z1, z2, this);
|
||||
}
|
||||
|
||||
void RDP::tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RDP::tri_shade_txtr(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile, float w0, float w1, float w2)
|
||||
{
|
||||
rs->tri_shade_txtr(v0, v1, v2, c0, c1, c2, s0, t0, s1, t1, s2, t2, tile, w0, w1, w2, this);
|
||||
}
|
||||
|
||||
void RDP::tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RDP::tri_shade(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2)
|
||||
{
|
||||
rs->tri_shade(v0, v1, v2, c0, c1, c2, this);
|
||||
|
|
|
@ -73,33 +73,33 @@ class RDP
|
|||
void texRect(int tile, float ulx, float uly, float lrx, float lry, float s, float t, float dsdx, float dtdy);
|
||||
void loadTLUT(int tile, int count);
|
||||
void loadTile(int tile, float uls, float ult, float lrs, float lrt);
|
||||
void debug_tri(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2);
|
||||
void tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void debug_tri(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2);
|
||||
void tri_shade_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, float z0, float z1, float z2);
|
||||
void tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade_txtr_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile,
|
||||
float w0, float w1, float w2, float z0, float z1, float z2);
|
||||
void tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade_txtr(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile, float w0, float w1, float w2);
|
||||
void tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2);
|
||||
|
||||
// friend rasterizer functions
|
||||
friend void RS::fillRect(float ulx, float uly, float lrx, float lry, RDP* rdp);
|
||||
friend void RS::texRect(int tile, float ulx, float uly, float lrx, float lry, float s, float t, float dsdx, float dtdy, RDP* rdp);
|
||||
friend void RS::debug_tri(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2, RDP* rdp);
|
||||
friend void RS::tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
friend void RS::debug_tri(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2, RDP* rdp);
|
||||
friend void RS::tri_shade_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, float z0, float z1, float z2, RDP* rdp);
|
||||
friend void RS::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
friend void RS::tri_shade_txtr_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile,
|
||||
float w0, float w1, float w2, float z0, float z1, float z2, RDP* rdp);
|
||||
friend void RS::tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
friend void RS::tri_shade_txtr(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile, float w0, float w1, float w2, RDP* rdp);
|
||||
friend void RS::tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
friend void RS::tri_shade(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, RDP* rdp);
|
||||
};
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void RS::texRect(int tile, float ux, float uy, float lx, float ly, float s, floa
|
|||
printf("RS:unknown cycle type in texRect:%d\n", rdp->cycleType);
|
||||
}
|
||||
|
||||
void RS::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RS::tri_shade_txtr_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile,
|
||||
float w0, float w1, float w2, float z0, float z1, float z2, RDP *rdp)
|
||||
|
@ -139,13 +139,13 @@ void RS::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<f
|
|||
if (rdp->cycleType == 0)
|
||||
{
|
||||
// sorting vertex by y values
|
||||
Vector<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Vektor<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Color32* c[3];
|
||||
float* z[3];
|
||||
float* s[3];
|
||||
float* t[3];
|
||||
float* w[3];
|
||||
Vector<float,4> *temp;
|
||||
Vektor<float,4> *temp;
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
if ((*v[1])[1] > (*v[2])[1]) { temp = v[1]; v[1] = v[2]; v[2] = temp; }
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
|
@ -367,13 +367,13 @@ void RS::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<f
|
|||
else if (rdp->cycleType == 1)
|
||||
{
|
||||
// sorting vertex by y values
|
||||
Vector<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Vektor<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Color32* c[3];
|
||||
float* z[3];
|
||||
float* s[3];
|
||||
float* t[3];
|
||||
float* w[3];
|
||||
Vector<float,4> *temp;
|
||||
Vektor<float,4> *temp;
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
if ((*v[1])[1] > (*v[2])[1]) { temp = v[1]; v[1] = v[2]; v[2] = temp; }
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
|
@ -598,16 +598,16 @@ void RS::tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<f
|
|||
printf("RS:unknown cycle type in tri_shade_txtr_zbuff:%d\n", rdp->cycleType);
|
||||
}
|
||||
|
||||
void RS::tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RS::tri_shade_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, float z0, float z1, float z2, RDP *rdp)
|
||||
{
|
||||
if (rdp->cycleType == 0)
|
||||
{
|
||||
// sorting vertex by y values
|
||||
Vector<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Vektor<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Color32* c[3];
|
||||
float* z[3];
|
||||
Vector<float,4> *temp;
|
||||
Vektor<float,4> *temp;
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
if ((*v[1])[1] > (*v[2])[1]) { temp = v[1]; v[1] = v[2]; v[2] = temp; }
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
|
@ -775,19 +775,19 @@ void RS::tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,
|
|||
printf("RS:unknown cycle type in tri_shade_zbuff:%d\n", rdp->cycleType);
|
||||
}
|
||||
|
||||
void RS::tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RS::tri_shade_txtr(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile, float w0, float w1, float w2, RDP *rdp)
|
||||
{
|
||||
if (rdp->cycleType == 0)
|
||||
{
|
||||
// sorting vertex by y values
|
||||
Vector<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Vektor<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Color32* c[3];
|
||||
float* s[3];
|
||||
float* t[3];
|
||||
float* w[3];
|
||||
Vector<float,4> *temp;
|
||||
Vektor<float,4> *temp;
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
if ((*v[1])[1] > (*v[2])[1]) { temp = v[1]; v[1] = v[2]; v[2] = temp; }
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
|
@ -992,15 +992,15 @@ void RS::tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4
|
|||
printf("RS:unknown cycle type in tri_shade_txtr_zbuff:%d\n", rdp->cycleType);
|
||||
}
|
||||
|
||||
void RS::tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void RS::tri_shade(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, RDP *rdp)
|
||||
{
|
||||
if (rdp->cycleType == 0)
|
||||
{
|
||||
// sorting vertex by y values
|
||||
Vector<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Vektor<float,4>* v[3] = { &v0, &v1, &v2 };
|
||||
Color32* c[3];
|
||||
Vector<float,4> *temp;
|
||||
Vektor<float,4> *temp;
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
if ((*v[1])[1] > (*v[2])[1]) { temp = v[1]; v[1] = v[2]; v[2] = temp; }
|
||||
if ((*v[0])[1] > (*v[1])[1]) { temp = v[0]; v[0] = v[1]; v[1] = temp; }
|
||||
|
@ -1148,7 +1148,7 @@ void RS::tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2
|
|||
printf("RS:unknown cycle type in tri_shade_txtr_zbuff:%d\n", rdp->cycleType);
|
||||
}
|
||||
|
||||
void RS::debug_tri(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2, RDP *rdp)
|
||||
void RS::debug_tri(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2, RDP *rdp)
|
||||
{
|
||||
// 0 -> 1
|
||||
if (v0[1] == v1[1])
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define RS_H
|
||||
|
||||
#include "color.h"
|
||||
#include "vector.h"
|
||||
#include "vektor.h"
|
||||
|
||||
class RDP;
|
||||
|
||||
|
@ -48,17 +48,17 @@ class RS
|
|||
void setScissor(float ulx, float uly, float lrx, float lry, int mode);
|
||||
void fillRect(float ulx, float uly, float lrx, float lry, RDP *rdp);
|
||||
void texRect(int tile, float ulx, float uly, float lrx, float lry, float s, float t, float dsdx, float dtdy, RDP *rdp);
|
||||
void debug_tri(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2, RDP *rdp);
|
||||
void tri_shade_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void debug_tri(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2, RDP *rdp);
|
||||
void tri_shade_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, float z0, float z1, float z2, RDP *rdp);
|
||||
void tri_shade_txtr_zbuff(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade_txtr_zbuff(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile,
|
||||
float w0, float w1, float w2, float z0, float z1, float z2, RDP *rdp);
|
||||
void tri_shade_txtr(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade_txtr(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2,
|
||||
float s0, float t0, float s1, float t1, float s2, float t2, int tile, float w0, float w1, float w2, RDP *rdp);
|
||||
void tri_shade(Vector<float,4>& v0, Vector<float,4>& v1, Vector<float,4>& v2,
|
||||
void tri_shade(Vektor<float,4>& v0, Vektor<float,4>& v1, Vektor<float,4>& v2,
|
||||
Color32& c0, Color32& c1, Color32& c2, RDP *rdp);
|
||||
};
|
||||
|
||||
|
|
|
@ -520,14 +520,14 @@ void RSP::TRI1()
|
|||
int v1 = ((*(currentCommand+1) >> 8) & 0xFF) / 10;
|
||||
int v2 = (*(currentCommand+1) & 0xFF) / 10;
|
||||
|
||||
Vtx cache[140];
|
||||
Vertex cache[140];
|
||||
int cache_size = 0;
|
||||
|
||||
cache[cache_size++] = vtx[v0];
|
||||
cache[cache_size++] = vtx[v1];
|
||||
cache[cache_size++] = vtx[v2];
|
||||
|
||||
Vtx copy[140];
|
||||
Vertex copy[140];
|
||||
int copy_size = 0;
|
||||
|
||||
// clip w
|
||||
|
@ -912,7 +912,7 @@ void RSP::TRI1()
|
|||
|
||||
for(int i=2; i<cache_size; i++)
|
||||
{
|
||||
Vector<float,4> vx0, vx1, vx2;
|
||||
Vektor<float,4> vx0, vx1, vx2;
|
||||
vx0[0] = cache[a].v[0];
|
||||
vx0[1] = cache[a].v[1];
|
||||
vx1[0] = cache[b].v[0];
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "Gfx_#1.3.h"
|
||||
#include "rdp.h"
|
||||
#include "color.h"
|
||||
#include "vector.h"
|
||||
#include "vektor.h"
|
||||
#include "matrix.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -83,7 +83,7 @@ typedef struct
|
|||
{
|
||||
Color32 col; /* Diffuse light value (RGBA) */
|
||||
Color32 colc;/* Copy of diffuse light value (RGBA) */
|
||||
Vector<float,4> dir; /* Direction toward light source (normalized) */
|
||||
Vektor<float,4> dir; /* Direction toward light source (normalized) */
|
||||
/* Important: the size of "dir" must not exceed 127 */
|
||||
} Light_t;
|
||||
|
||||
|
@ -95,13 +95,13 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
Vector<float,4> v;
|
||||
Vektor<float,4> v;
|
||||
float s;
|
||||
float t;
|
||||
Color32 c;
|
||||
Vector<float,4> n;
|
||||
Vektor<float,4> n;
|
||||
int alpha;
|
||||
} Vtx;
|
||||
} Vertex;
|
||||
|
||||
class RSP;
|
||||
typedef void (RSP::*COMMANDS)();
|
||||
|
@ -132,7 +132,7 @@ class RSP
|
|||
Matrix<float, 4> modelView;
|
||||
Matrix<float, 4> projection;
|
||||
Matrix<float, 4> MP;
|
||||
Vtx vtx[16];
|
||||
Vertex vtx[16];
|
||||
int fm;
|
||||
int fo;
|
||||
|
||||
|
|
|
@ -27,31 +27,31 @@
|
|||
*
|
||||
**/
|
||||
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
#ifndef VEKTOR_H
|
||||
#define VEKTOR_H
|
||||
|
||||
template<class T, int s> class Vector
|
||||
template<class T, int s> class Vektor
|
||||
{
|
||||
T element[s];
|
||||
|
||||
public:
|
||||
Vector() {}
|
||||
~Vector() {}
|
||||
Vektor() {}
|
||||
~Vektor() {}
|
||||
|
||||
Vector(const Vector<T,s>& v)
|
||||
Vektor(const Vektor<T,s>& v)
|
||||
{
|
||||
for (int i=0; i<s; i++)
|
||||
element[i] = v.element[i];
|
||||
}
|
||||
|
||||
Vector<T,s>& operator= (const Vector<T,s>& v)
|
||||
Vektor<T,s>& operator= (const Vektor<T,s>& v)
|
||||
{
|
||||
for (int i=0; i<s; i++)
|
||||
element[i] = v.element[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
T scalar(const Vector<T,s>& v) const
|
||||
T scalar(const Vektor<T,s>& v) const
|
||||
{
|
||||
T res = 0;
|
||||
for (int i=0; i<s; i++)
|
||||
|
@ -67,7 +67,7 @@ template<class T, int s> class Vector
|
|||
for(int i=0; i<s; i++) element[i] = element[i] / norm;
|
||||
}
|
||||
|
||||
void setVector(T* array)
|
||||
void setVektor(T* array)
|
||||
{
|
||||
for (int i=0; i<s; i++)
|
||||
element[i] = array[i];
|
|
@ -29,17 +29,24 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "vi.h"
|
||||
#include "global.h"
|
||||
#include "color.h"
|
||||
#ifdef DEBUGON
|
||||
# include <debug.h>
|
||||
#endif
|
||||
|
||||
|
||||
VI::VI(GFX_INFO info) : gfxInfo(info), bpp(0)
|
||||
{
|
||||
FBtex = (u16*) memalign(32,640*480*2);
|
||||
}
|
||||
|
||||
VI::~VI()
|
||||
{
|
||||
free(FBtex);
|
||||
}
|
||||
|
||||
void VI::statusChanged()
|
||||
|
@ -121,20 +128,25 @@ void VI::updateScreen()
|
|||
|
||||
short *im16 = (short*)((char*)gfxInfo.RDRAM +
|
||||
(*gfxInfo.VI_ORIGIN_REG & 0x7FFFFF));
|
||||
int *buf16 = (int*)getScreenPointer();
|
||||
int minx = 0;//(640-(h_end-h_start))/2;
|
||||
// int *buf16 = (int*)getScreenPointer();
|
||||
int minx = (640-(h_end-h_start))/2;
|
||||
int maxx = 640-minx;
|
||||
int miny = 0;//(480-(v_end-v_start))/2;
|
||||
int miny = (480-(v_end-v_start))/2;
|
||||
int maxy = 480-miny;
|
||||
int ind = 0;
|
||||
float px, py;
|
||||
py=0.0f;
|
||||
|
||||
#ifdef DEBUGON
|
||||
_break();
|
||||
#endif
|
||||
//printf("Beginning to copy framebuffer... N64FB offset = %08x", *gfxInfo.VI_ORIGIN_REG & 0x7FFFFF);
|
||||
//printf("\nmin: (%d,%d) max: (%d,%d), GCFB = %08x, N64FB = %08x\n",
|
||||
// minx, miny, maxx, maxy, buf16, im16);
|
||||
//printf("scale_x = %f, scale_y = %f\n", scale_x, scale_y);
|
||||
//fflush(stdout);
|
||||
// Here I'm disabling antialiasing to try to track down the bug
|
||||
if (TRUE || (*gfxInfo.VI_STATUS_REG & 0x30) == 0x30) // not antialiased
|
||||
/* if (TRUE || (*gfxInfo.VI_STATUS_REG & 0x30) == 0x30) // not antialiased
|
||||
{
|
||||
//printf(" Not antialiased ");
|
||||
//fflush(stdout);
|
||||
|
@ -225,7 +237,90 @@ void VI::updateScreen()
|
|||
py += scale_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//N64 Framebuffer is in RGB5A1 format, so shift by 1 and retile.
|
||||
for (int j=0; j<480; j+=4)
|
||||
{
|
||||
for (int i=0; i<640; i+=4)
|
||||
{
|
||||
for (int jj=0; jj<4; jj++)
|
||||
{
|
||||
if (j+jj < miny || j+jj > maxy)
|
||||
{
|
||||
FBtex[ind++] = 0;
|
||||
FBtex[ind++] = 0;
|
||||
FBtex[ind++] = 0;
|
||||
FBtex[ind++] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
px = scale_x*i;
|
||||
py = scale_y*(j+jj);
|
||||
for (int ii=0; ii<4; ii++)
|
||||
{
|
||||
if (i+ii < minx || i+ii > maxx)
|
||||
FBtex[ind++] = 0;
|
||||
else
|
||||
FBtex[ind++] = 0x8000 | (im16[((int)py*(*gfxInfo.VI_WIDTH_REG)+(int)px)]>>1);
|
||||
px += scale_x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Initialize texture
|
||||
GX_InitTexObj(&FBtexObj, FBtex, 640, 480, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
DCFlushRange(FBtex, 640*480*2);
|
||||
GX_InvalidateTexAll();
|
||||
GX_LoadTexObj(&FBtexObj, GX_TEXMAP0);
|
||||
|
||||
GX_SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
GX_SetAlphaCompare(GX_ALWAYS,0,GX_AOP_AND,GX_ALWAYS,0);
|
||||
GX_SetZMode(GX_DISABLE,GX_ALWAYS,GX_FALSE);
|
||||
GX_SetCullMode (GX_CULL_NONE);
|
||||
GX_SetFog(GX_FOG_NONE,0.1,1.0,0.0,1.0,(GXColor) {0,0,0,255});
|
||||
|
||||
Mtx44 GXprojection;
|
||||
guMtxIdentity(GXprojection);
|
||||
guOrtho(GXprojection, 0, 480, 0, 640, 0.0f, 1.0f);
|
||||
GX_LoadProjectionMtx(GXprojection, GX_ORTHOGRAPHIC);
|
||||
Mtx GXmodelViewIdent;
|
||||
guMtxIdentity(GXmodelViewIdent);
|
||||
GX_LoadPosMtxImm(GXmodelViewIdent,GX_PNMTX0);
|
||||
GX_SetViewport((f32) 0,(f32) 0,(f32) 640,(f32) 480, 0.0f, 1.0f);
|
||||
GX_SetScissor((u32) 0,(u32) 0,(u32) 640,(u32) 480); //Set to the same size as the viewport.
|
||||
//set vertex description
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_PTNMTXIDX, GX_PNMTX0);
|
||||
GX_SetVtxDesc(GX_VA_TEX0MTXIDX, GX_TEXMTX0);
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
//set vertex attribute formats
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
|
||||
//enable textures
|
||||
GX_SetNumChans (0);
|
||||
GX_SetNumTexGens (1);
|
||||
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GX_SetNumTevStages (1);
|
||||
GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE);
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GX_Position2f32( 0.0f, 0.0f );
|
||||
GX_TexCoord2f32( 0.0f, 0.0f );
|
||||
GX_Position2f32( 640.0f, 0.0f );
|
||||
GX_TexCoord2f32( 1.0f, 0.0f );
|
||||
GX_Position2f32( 640.0f, 480.0f );
|
||||
GX_TexCoord2f32( 1.0f, 1.0f );
|
||||
GX_Position2f32( 0.0f, 480.0f );
|
||||
GX_TexCoord2f32( 0.0f, 1.0f );
|
||||
GX_End();
|
||||
GX_DrawDone();
|
||||
|
||||
//printf(" done.\nBlitting...");
|
||||
//fflush(stdout);
|
||||
blit();
|
||||
|
|
|
@ -32,27 +32,34 @@
|
|||
|
||||
#include "../main/winlnxdefs.h"
|
||||
#include "Gfx_#1.3.h"
|
||||
#include <gccore.h>
|
||||
|
||||
class VI
|
||||
{
|
||||
GFX_INFO gfxInfo;
|
||||
int bpp;
|
||||
u16* FBtex;
|
||||
GXTexObj FBtexObj;
|
||||
|
||||
// the plugin assume the class that's implementing these functions
|
||||
// accept 16bpp 5551 mode, maybe conversion is needed on some systems
|
||||
// it's also assumed that it's initialized in window mode by default
|
||||
virtual void setVideoMode(int w, int h) = 0;
|
||||
virtual void* getScreenPointer() = 0;
|
||||
// virtual void* getScreenPointer() = 0;
|
||||
virtual void blit() = 0;
|
||||
|
||||
public:
|
||||
VI(GFX_INFO);
|
||||
virtual ~VI();
|
||||
|
||||
virtual unsigned int* getScreenPointer() = 0;
|
||||
virtual void setFB(unsigned int*, unsigned int*) = 0;
|
||||
virtual void switchFullScreenMode() = 0;
|
||||
virtual void switchWindowMode() = 0;
|
||||
virtual void setGamma(float gamma) = 0;
|
||||
virtual void showLoadProg(float) = 0;
|
||||
virtual void updateDEBUG() = 0;
|
||||
virtual void PreRetraceCallback(u32) = 0;
|
||||
void statusChanged();
|
||||
void widthChanged();
|
||||
void updateScreen();
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include <ogc/system.h>
|
||||
#include <ogc/video.h>
|
||||
#include "vi_GX.h"
|
||||
#include "font.h" //This file is outdated
|
||||
//#include "font.h" //This file is outdated
|
||||
#include "../gui/font.h"
|
||||
#include "../gui/DEBUG.h"
|
||||
|
||||
|
||||
//Global variables set by menu
|
||||
|
@ -17,9 +19,8 @@ char showFPSonScreen;
|
|||
|
||||
VI_GX::VI_GX(GFX_INFO info) : VI(info), width(0), height(0), which_fb(1){
|
||||
init_font();
|
||||
// FIXME: Instead of creating our own fb, we should use main's
|
||||
//xfb[0] = (unsigned int*) MEM_K0_TO_K1(SYS_AllocateFramebuffer(&TVNtsc480IntDf));
|
||||
//xfb[1] = (unsigned int*) MEM_K0_TO_K1(SYS_AllocateFramebuffer(&TVNtsc480IntDf));
|
||||
updateOSD = true;
|
||||
copy_fb = false;
|
||||
}
|
||||
|
||||
void VI_GX::setFB(unsigned int* fb1, unsigned int* fb2){
|
||||
|
@ -28,7 +29,6 @@ void VI_GX::setFB(unsigned int* fb1, unsigned int* fb2){
|
|||
}
|
||||
|
||||
VI_GX::~VI_GX(){
|
||||
// FIXME: If we create our own fb, we need to free it somehow
|
||||
}
|
||||
|
||||
void VI_GX::setVideoMode(int w, int h){
|
||||
|
@ -40,15 +40,26 @@ void VI_GX::switchFullScreenMode(){ }
|
|||
|
||||
void VI_GX::switchWindowMode(){ }
|
||||
|
||||
void* VI_GX::getScreenPointer(){ return xfb[which_fb]; }
|
||||
unsigned int* VI_GX::getScreenPointer(){ return xfb[which_fb]; }
|
||||
|
||||
void VI_GX::blit(){
|
||||
//printf("Should be blitting.");
|
||||
// showFPS(); //Doesn't work with the GX font setup
|
||||
VIDEO_SetNextFramebuffer(xfb[which_fb]);
|
||||
VIDEO_Flush();
|
||||
which_fb ^= 1;
|
||||
VIDEO_WaitVSync();
|
||||
showFPS();
|
||||
showDEBUG();
|
||||
if(updateOSD)
|
||||
{
|
||||
if(copy_fb)
|
||||
VIDEO_WaitVSync();
|
||||
GX_CopyDisp (xfb[which_fb], GX_FALSE);
|
||||
GX_DrawDone();
|
||||
// doCaptureScreen();
|
||||
updateOSD = false;
|
||||
copy_fb = true;
|
||||
}
|
||||
//The following has been moved to the Pre-Retrace callback
|
||||
/* VIDEO_SetNextFramebuffer(xfb[which_fb]);
|
||||
VIDEO_Flush();
|
||||
which_fb ^= 1;
|
||||
VIDEO_WaitVSync();*/
|
||||
}
|
||||
|
||||
void VI_GX::setGamma(float gamma){ }
|
||||
|
@ -59,17 +70,132 @@ extern unsigned int diff_sec(long long start,long long end);
|
|||
};
|
||||
|
||||
void VI_GX::showFPS(){
|
||||
static long long lastTick=0;
|
||||
static int frames=0;
|
||||
static char caption[16];
|
||||
|
||||
long long nowTick = gettime();
|
||||
frames++;
|
||||
if (diff_sec(lastTick,nowTick)>=1) {
|
||||
sprintf(caption, "%02d FPS",frames);
|
||||
frames = 0;
|
||||
lastTick = nowTick;
|
||||
}
|
||||
|
||||
write_font(10,10,caption,xfb,which_fb);
|
||||
static long long lastTick=0;
|
||||
static int frames=0;
|
||||
static int VIs=0;
|
||||
static char caption[20];
|
||||
|
||||
long long nowTick = gettime();
|
||||
VIs++;
|
||||
if (updateOSD)
|
||||
frames++;
|
||||
if (diff_sec(lastTick,nowTick)>=1) {
|
||||
sprintf(caption, "%02d VI/s, %02d FPS",VIs,frames);
|
||||
frames = 0;
|
||||
VIs = 0;
|
||||
lastTick = nowTick;
|
||||
}
|
||||
|
||||
if (updateOSD)
|
||||
{
|
||||
GXColor fontColor = {150,255,150,255};
|
||||
write_font_init_GX(fontColor);
|
||||
if(showFPSonScreen)
|
||||
write_font(10,35,caption, 1.0);
|
||||
|
||||
//reset swap table from GUI/DEBUG
|
||||
GX_SetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
|
||||
GX_SetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
}
|
||||
}
|
||||
|
||||
void VI_GX::showLoadProg(float percent)
|
||||
{
|
||||
GXColor GXcol1 = {0,128,255,255};
|
||||
GXColor GXcol2 = {0,64,128,255};
|
||||
float xbar[3] = {425,425,550};
|
||||
float ybar[2] = {75,90};
|
||||
|
||||
xbar[1] = xbar[0] + (xbar[2]-xbar[0])*percent;
|
||||
|
||||
guMtxIdentity(GXmodelView2D);
|
||||
GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX2);
|
||||
guOrtho(GXprojection2D, 0, 480, 0, 640, 0, 1);
|
||||
GX_LoadProjectionMtx(GXprojection2D, GX_ORTHOGRAPHIC); //load current 2D projection matrix
|
||||
//draw rectangle from ulx,uly to lrx,lry
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_PTNMTXIDX, GX_PNMTX2);
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
//set vertex attribute formats here
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT1, GX_VA_POS, GX_POS_XY, GX_F32, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT1, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
|
||||
//disable textures
|
||||
GX_SetNumChans (1);
|
||||
GX_SetNumTexGens (0);
|
||||
GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
//set blend mode
|
||||
GX_SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR); //Fix src alpha
|
||||
GX_SetColorUpdate(GX_ENABLE);
|
||||
GX_SetAlphaUpdate(GX_ENABLE);
|
||||
GX_SetDstAlpha(GX_DISABLE, 0xFF);
|
||||
//set cull mode
|
||||
GX_SetCullMode (GX_CULL_NONE);
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT1, 8);
|
||||
// background rectangle
|
||||
GX_Position2f32(xbar[0], ybar[0]);
|
||||
GX_Color4u8(GXcol2.r, GXcol2.g, GXcol2.b, GXcol2.a);
|
||||
GX_Position2f32(xbar[2], ybar[0]);
|
||||
GX_Color4u8(GXcol2.r, GXcol2.g, GXcol2.b, GXcol2.a);
|
||||
GX_Position2f32(xbar[2], ybar[1]);
|
||||
GX_Color4u8(GXcol2.r, GXcol2.g, GXcol2.b, GXcol2.a);
|
||||
GX_Position2f32(xbar[0], ybar[1]);
|
||||
GX_Color4u8(GXcol2.r, GXcol2.g, GXcol2.b, GXcol2.a);
|
||||
// progress rectangle
|
||||
GX_Position2f32(xbar[0], ybar[0]);
|
||||
GX_Color4u8(GXcol1.r, GXcol1.g, GXcol1.b, GXcol1.a);
|
||||
GX_Position2f32(xbar[1], ybar[0]);
|
||||
GX_Color4u8(GXcol1.r, GXcol1.g, GXcol1.b, GXcol1.a);
|
||||
GX_Position2f32(xbar[1], ybar[1]);
|
||||
GX_Color4u8(GXcol1.r, GXcol1.g, GXcol1.b, GXcol1.a);
|
||||
GX_Position2f32(xbar[0], ybar[1]);
|
||||
GX_Color4u8(GXcol1.r, GXcol1.g, GXcol1.b, GXcol1.a);
|
||||
GX_End();
|
||||
|
||||
// GX_DrawDone ();
|
||||
GX_CopyDisp (xfb[which_fb], GX_FALSE);
|
||||
GX_Flush ();
|
||||
VIDEO_SetNextFramebuffer(xfb[which_fb]);
|
||||
VIDEO_Flush();
|
||||
which_fb ^= 1;
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
void VI_GX::updateDEBUG()
|
||||
{
|
||||
updateOSD = true;
|
||||
}
|
||||
|
||||
extern char text[DEBUG_TEXT_HEIGHT][DEBUG_TEXT_WIDTH];
|
||||
|
||||
void VI_GX::showDEBUG()
|
||||
{
|
||||
if (updateOSD)
|
||||
{
|
||||
int i = 0;
|
||||
GXColor fontColor = {150, 255, 150, 255};
|
||||
DEBUG_update();
|
||||
write_font_init_GX(fontColor);
|
||||
if(printToScreen)
|
||||
for (i=0;i<DEBUG_TEXT_HEIGHT;i++)
|
||||
write_font(10,(10*i+60),text[i], 0.5);
|
||||
|
||||
//reset swap table from GUI/DEBUG
|
||||
GX_SetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
|
||||
GX_SetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
}
|
||||
}
|
||||
|
||||
void VI_GX::PreRetraceCallback(u32 retraceCnt)
|
||||
{
|
||||
if(copy_fb)
|
||||
{
|
||||
VIDEO_SetNextFramebuffer(xfb[which_fb]);
|
||||
VIDEO_Flush();
|
||||
which_fb ^= 1;
|
||||
copy_fb = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,15 +9,20 @@
|
|||
|
||||
class VI_GX : public VI
|
||||
{
|
||||
bool updateOSD;
|
||||
bool copy_fb;
|
||||
unsigned int* xfb[2];
|
||||
int which_fb;
|
||||
int width;
|
||||
int height;
|
||||
Mtx44 GXprojection2D;
|
||||
Mtx GXmodelView2D;
|
||||
|
||||
void setFB(unsigned int*, unsigned int*);
|
||||
void showFPS();
|
||||
void showDEBUG();
|
||||
virtual void setVideoMode(int w, int h);
|
||||
virtual void* getScreenPointer();
|
||||
// virtual void* getScreenPointer();
|
||||
virtual void blit();
|
||||
|
||||
public:
|
||||
|
@ -27,6 +32,10 @@ class VI_GX : public VI
|
|||
virtual void switchFullScreenMode();
|
||||
virtual void switchWindowMode();
|
||||
virtual void setGamma(float gamma);
|
||||
unsigned int* getScreenPointer();
|
||||
void showLoadProg(float);
|
||||
void updateDEBUG();
|
||||
void PreRetraceCallback(u32 retraceCnt);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue