Commit 8791d241 authored by Donald Haase's avatar Donald Haase
Browse files

Initial commit of Beta 2 source code

parent ace7aae2
USE_CPUASM=1
#USE_CPUASM_MIXTO=1
USE_GL=1
USE_MMU=1
TARGET = snes4all
BACK_KOS_AS=$(KOS_CC_BASE)/bin/$(KOS_CC_PREFIX)-as
KOS_AS = $(KOS_CCPLUS) -ml -m4-single-only -c
OPTFLAGS=-O3 -fomit-frame-pointer -DDREAMCAST -DDATA_PREFIX="/rd/" -ffast-math -g0
#OPTFLAGS=-Os -fomit-frame-pointer -DDREAMCAST -DDATA_PREFIX="/rd/" -ffast-math -g0
#OPTFLAGS+= -falign-functions=32 -falign-labels=32 -falign-loops=32 -falign-jumps=32
OPTFLAGS+= -falign-functions=32 -falign-labels=4 -falign-loops=4 -falign-jumps=4
#OPTFLAGS+= -falign-functions -falign-labels -falign-loops -falign-jumps
DEFS += -DSNES4ALL_MAX_ROM_SIZE=0x600000
#DEFS += -DNORES256
DEFS += -DUSE_RASTER_DIFF
DEFS += -DCPU_SHUTDOWN
DEFS += -DSPC700_SHUTDOWN
DEFS += -DEXECUTE_SUPERFX_PER_LINE
DEFS += -DSPC700_C
DEFS += -DVAR_CYCLES
DEFS += -DSDD1_DECOMP
DEFS += -DUSE_OLD_DSP1
DEFS += -DUSE_NO_WAIT_WHEN_IRQ
DEFS += -DNO_INLINE_SET_GET
#DEFS += -DUSE_MMU_BOUNDARY
#DEFS += -DUSE_MMU_MASK
DEFS += -DUSE_MMU_DIRECT_INDEX
#DEFS += -DUSE_MMU_BASEPOINTER
#DEFS += -DUSE_MEMORY_SPEED
#DEFS += -DUSE_BLOCK_RAM
DEFS += -DUSE_ASM_ALIGN_OPCODES
DEFS += -DUSE_ASM_SMALL
#DEFS += -DUSE_ASM_R5
DEFS += -DUSE_ASM_R12
#DEFS += -DENABLE_ECHO_SOUND
#DEFS += -DENABLE_MASTER_VOLUMEN
#DEFS += -DUSE_SOUND_DESYNC
#DEFS += -DUSE_REAL_SOUND_MUL
#DEFS += -DENABLE_INTERPOLATE_SOUND
DEFS += -DUSE_ALTDECODE=5
#DEFS += -DENABLE_FIX_FREQUENCY
#DEFS += -DUSE_MODE7_INTERPOLATE
DEFS += -DENABLE_GRAPHIC_WINDOWS
DEFS += -DENABLE_HDMA
#DEFS += -DUSE_HDMA_EVENT
#DEFS += -DNEW_COLOUR_BLENDING
#DEFS += -DOLD_COLOUR_BLENDING
#DEFS += -DSNES4ALL_NUM_CHANNELS=6
#DEFS += -DSNES4ALL_STEREO
#DEFS += -DUSE_VIDEOGL_DIRECT_SLOT
#DEFS += -DDIRECT_COLOR_MAP
DEFS += -DTEST_CACHETILE
DEFS += -DTILES_INLINE
DEFS += -DUSE_SETPPU_TABLE
#DEFS += -DUSE_SETPPU_SMALL_TABLE
DEFS += -DUSE_GETPPU_TABLE
DEFS += -DUSE_ASM_GET_SPC
DEFS += -DUSE_ASM_SET_MATRIX
DEFS += -DUSE_ASM_IRQ_INLINE
DEFS += -DUSE_ASM_PREFETCH
DEFS += -DUSE_VIDEOGL_SELECTIVE_CACHE_RESET=4
DEFS += -DVIDEO_GL_MAX_TEX=32768
DEFS += -DVIDEO_GL_RASTER=64
#DEFS += -DUSE_VIDEOGL_EXTEND_TILELIST
#DEFS += -DUSE_VGL_TABLE
#DEFS += -DUSE_VGL_LARGE_TABLE
#DEFS += -DNOSOUND
#DEFS += -DAUTOLOAD="/cd/Aladdin.zip"
#DEFS += -DAUTOLOAD="/cd/smario.zip"
#DEFS += -DAUTOLOAD="/cd/starwars.zip"
#DEFS += -DAUTOLOAD="/cd/turrican.zip"
#DEFS += -DAUTOLOAD="/cd/castlevania.zip"
#DEFS += -DAUTOLOAD="/cd/jamespond.zip"
#DEFS += -DAUTOLOAD="/cd/Parodius.zip"
#DEFS += -DAUTOLOAD="/sd/snes4all/EarthwormJim.zip"
#DEFS += -DAUTOLOAD="/sd/snes4all/KirbySuperstar.zip"
#DEFS += -DAUTOSAVESTATE
#DEFS += -DAUTO_LOADSAVESTATE="jamespond.ssn"
#DEFS += -DAUTO_LOADSAVESTATE="castlevania.ssn"
#DEFS += -DAUTO_LOADSAVESTATE="turrican.ssn"
#DEFS += -DAUTO_LOADSAVESTATE="aladdin.ssn"
#DEFS += -DAUTO_LOADSAVESTATE="smario.ssn"
#DEFS += -DAUTO_LOADSAVESTATE="starwars.ssn"
#DEFS += -DAUTO_EVENTS
#DEFS += -DMAX_AUTO_EVENTS=500
#DEFS += -DSHOW_DMA
#DEFS += -DPROFILER_SNES4ALL
#DEFS += -DDEBUG_FRAMESKIP
#DEFS += -DAUTO_DEBUG_FRAMESKIP=1000
#DEFS += -DDISPLAY_FRAMERATE
#DEFS += -DDEBUG_TILECACHE
#DEFS += -DAUTO_DEBUG_TILECACHE=2000
DEFS += -DREBOOT_DREAMCAST
ifdef USE_GL
DEFS += -DUSE_GL
endif
ifdef USE_CPUASM
DEFS += -DUSE_OPC_ASM
DEFS += -DASMSTRUC_NOP_PATCH
DEFS += -DSA1ADDR_NOP_PATCH
DEFS += -DASMADDR_NOP_PATCH
DEFS += -DUSE_OLD_APUTIMER
#DEFS += -DUSE_OLD_END_REFRESH
#DEFS += -DUSE_OLD_START_REFRESH
#DEFS += -DUSE_OLD_SYNC_SPEED
#DEFS += -DUSE_ALWAYS_APU_SYNC
endif
ifdef USE_CPUASM_MIXTO
DEFS += -DUSE_OPC_ASM_MIXTO
endif
ifdef USE_MMU
KOS_CFLAGS= -Isrc/mmu_handle/kos-patch/kernel/arch/dreamcast/include -O3 -fomit-frame-pointer -ml -m4-single-only -fno-optimize-sibling-calls -I$(KOS_BASE)/include -I$(KOS_BASE)/addons/include -I$(KOS_BASE)/kernel/arch/dreamcast/include -D_arch_dreamcast -D_arch_sub_pristine -Wall -g -fno-builtin -fno-strict-aliasing
KOS_LDFLAGS = -Lsrc/mmu_handle/kos-patch/lib/dreamcast -Lsrc/mmu_handle/kos-patch/addons/lib/dreamcast -ml -m4-single-only -Wl,-Ttext=0x8c010000 -nostartfiles -nostdlib -L$(KOS_BASE)/lib/dreamcast -L$(KOS_BASE)/addons/lib/dreamcast
MORE_CFLAGS = -DUSE_MMU -Isrc/mmu_handle -I$(KOS_BASE)/addons/include/SDL -I$(KOS_BASE)/addons/include $(OPTFLAGS)
else
MORE_CFLAGS = -I$(KOS_BASE)/addons/include/SDL -I$(KOS_BASE)/addons/include $(OPTFLAGS)
endif
MORE_CFLAGS += -Isrc/include -Isrc/unzip -Isrc/menu -Isrc/sh -DMITSHM \
$(DEFS) -DUNZIP_SUPPORT -DZLIB -DHAVE_MKSTEMP \
-DACCEPT_SIZE_T=int
#MORE_CFLAGS += -DNOSOUND
KOS_CFLAGS += $(MORE_CFLAGS)
KOS_CPPFLAGS += $(MORE_CFLAGS)
KOS_AFLAGS = $(MORE_CFLAGS)
all: $(TARGET).bin
include $(KOS_BASE)/Makefile.rules
KOS_CPPFLAGS=-fno-operator-names -fno-exceptions
ifdef USE_CPUASM
ifdef USE_CPUASM_MIXTO
OBJS += \
src/cpuexec.o
endif
OBJS += \
src/sh/cpuexec.o \
src/sh/cpuops.o \
src/sh/cpumem.o
ifdef USE_MMU
OBJS += src/sh/sa1ops.o
else
OBJS += src/sa1cpu.o
endif
else
OBJS += \
src/cpuops.o \
src/cpuexec.o \
src/sa1cpu.o
endif
ifdef USE_MMU
OBJS += src/mmu_handle/mmu_handle.o
endif
OBJS += \
src/globals.o \
src/fxinst.o \
src/c4emu.o \
src/fxemu.o \
src/2xsai.o \
src/apu.o \
src/c4.o \
src/cheats.o \
src/cheats2.o \
src/clip.o \
src/cpu.o \
src/data.o \
src/dma.o \
src/dsp1.o \
src/gfx.o \
src/loadzip.o \
src/memmap.o \
src/netplay.o \
src/obc1.o \
src/ppu.o \
src/sa1.o \
src/screenshot.o \
src/sdd1.o \
src/sdd1emu.o \
src/server.o \
src/seta.o \
src/seta010.o \
src/seta011.o \
src/seta018.o \
src/snaporig.o \
src/snapshot.o \
src/soundux.o \
src/spc700.o \
src/spc7110.o \
src/srtc.o \
src/tile.o \
src/sdl/config.o \
src/sdl/machine.o \
src/sdl/vmu.o \
src/sdl/sdl.o \
src/unzip/explode.o \
src/unzip/unreduce.o \
src/unzip/unshrink.o \
src/unzip/unzip.o \
src/menu/fade.o \
src/menu/menu.o \
src/menu/menu_main.o \
src/menu/menu_save.o \
src/menu/menu_load.o \
romdisk.o
ifdef USE_GL
OBJS += \
src/sdl/videogl.o \
src/tilegl.o
endif
ifdef USE_GL
LIBS= -lSDL_mixer_126 -lSDL_gl_1213 -lkglx -lz_123 -lm
else
LIBS= -lSDL_mixer_126 -lSDL_1213 -lz_123 -lm
endif
clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).bin romdisk.o romdisk.img example.iso offsets.bin offsets.elf src/offsets.o
$(TARGET).elf: $(OBJS)
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET).elf $(KOS_START) \
$(OBJS) $(OBJEXTRA) $(LIBS) $(KOS_LIBS)
offsets.elf: src/offsets.o
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o offsets.elf $(KOS_START) \
src/offsets.o $(OBJEXTRA) -lm $(KOS_LIBS)
$(TARGET).bin: $(TARGET).elf
$(KOS_OBJCOPY) -R .stack -O binary $(TARGET).elf $(TARGET).bin
offsets.bin: offsets.elf
$(KOS_OBJCOPY) -R .stack -O binary offsets.elf offsets.bin
romdisk.o: romdisk.img
KOS_AS=$(BACK_KOS_AS) KOS_AFLAGS=-little $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
# bin2odc romdisk.img romdisk.o
romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d data -v
example.iso: example
mkisofs -joliet-long -l -o example.iso -graft-points /=example/
run: $(TARGET).bin example.iso
$(KOS_LOADER) $(TARGET).bin -i example.iso
# $(KOS_LOADER) $(TARGET).bin
offsets: offsets.bin
$(KOS_LOADER) offsets.bin > offsets.h
#USE_CPUASM=1
#USE_MMX=1
#USE_ZSNES_FX=1
USE_GL=1
NAME = snes4all
O = o
RM = rm -f
CC = gcc
CXX = g++
AS = c++
STRIP = strip
PROG = $(NAME)
DEFS += -DSNES4ALL_MAX_ROM_SIZE=0x600000
ifdef USE_GL
DEFS += -DUSE_GL
else
#DEFS += -DNORES256
endif
#DEFS += -DPLAYBACK_RATE=22050
DEFS += -DCPU_SHUTDOWN
DEFS += -DSPC700_SHUTDOWN
DEFS += -DEXECUTE_SUPERFX_PER_LINE
DEFS += -DSPC700_C
DEFS += -DVAR_CYCLES
DEFS += -DSDD1_DECOMP
DEFS += -DUSE_NO_WAIT_WHEN_IRQ
DEFS += -DNO_INLINE_SET_GET
#DEFS += -DUSE_MEMORY_SPEED
#DEFS += -DUSE_BLOCK_RAM
#DEFS += -DENABLE_ECHO_SOUND
#DEFS += -DENABLE_MASTER_VOLUMEN
#DEFS += -DUSE_SOUND_DESYNC
#DEFS += -DENABLE_INTERPOLATE_SOUND
#DEFS += -DUSE_ALTDECODE=1
#DEFS += -DENABLE_FIX_FREQUENCY
#DEFS += -DUSE_MODE7_INTERPOLATE
DEFS += -DENABLE_GRAPHIC_WINDOWS
DEFS += -DENABLE_HDMA
#DEFS += -DUSE_HDMA_EVENT
DEFS += -DUSE_OLD_DSP1
#DEFS += -DNEW_COLOUR_BLENDING
#DEFS += -DOLD_COLOUR_BLENDING
#DEFS += -DSNES4ALL_NUM_CHANNELS=6
#DEFS += -DSNES4ALL_STEREO
#DEFS += -DDIRECT_COLOR_MAP
#DEFS += -DTEST_CACHETILE
#DEFS += -DTILES_INLINE
DEFS += -DUSE_RASTER_DIFF
DEFS += -DUSE_SETPPU_TABLE
DEFS += -DUSE_GETPPU_TABLE
#DEFS += -DUSE_VIDEOGL_SELECTIVE_CACHE_RESET=1
DEFS += -DUSE_VIDEOGL_SELECTIVE_CACHE_RESET=4
#DEFS += -DUSE_VIDEOGL_EXTEND_TILELIST
#DEFS += -DUSE_VGL_TABLE
#DEFS += -DUSE_VGL_LARGE_TABLE
#DEFS += -DNOSOUND
#DEFS += -DAUTOLOAD=\"example/Super\ Metroid.zip\"
#DEFS += -DAUTOLOAD=\"example/Aladdin.zip\"
#DEFS += -DAUTOLOAD=\"example/castlevania.zip\"
#DEFS += -DAUTOLOAD=\"example/smario.zip\"
#DEFS += -DAUTOLOAD=\"example/fzero.zip\"
#DEFS += -DAUTOLOAD=\"example/rrunner.zip\"
#DEFS += -DAUTOLOAD=\"example/supergoal.zip\"
#DEFS += -DAUTOLOAD=\"example/dkcountry.zip\"
#DEFS += -DAUTOLOAD=\"example/pacintime.zip\"
#DEFS += -DAUTOLOAD=\"example/starwars.zip\"
#DEFS += -DAUTOLOAD=\"example/jurassic.zip\"
#DEFS += -DAUTOLOAD=\"example/jimpower.zip\"
#DEFS += -DAUTOLOAD=\"example/turrican.zip\"
#DEFS += -DAUTOLOAD=\"example/sfighter.zip\"
#DEFS += -DAUTOLOAD=\"example/rtype.zip\"
#DEFS += -DAUTO_LOADSAVESTATE=\"castlevania.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"rtype.1ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"sfighter.2ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"jimpower.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"turrican.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"pacintime.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"jurassic.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"supergoal.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"smario.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"fzero.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"smario.1ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"prueba.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"rrunner.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"Aladdin.ssn\"
#DEFS += -DAUTO_LOADSAVESTATE=\"Super\ Metroid.1ssn\"
#DEFS += -DAUTO_EVENTS
#DEFS += -DMAX_AUTO_EVENTS=50
#DEFS += -DMAX_AUTO_EVENTS=500
#DEFS += -DPROFILER_SNES4ALL
#DEFS += -DDEBUG_FRAMESKIP
#DEFS += -DAUTO_DEBUG_FRAMESKIP=1000
#DEFS += -DDISPLAY_FRAMERATE
#DEFS += -DDEBUG_TILECACHE
#DEFS += -DAUTO_DEBUG_TILECACHE=2000
DEFS += -DLINUX -DUNIX
ifdef USE_CPUASM
DEFS += -DUSE_X86_ASM
endif
ifdef USE_MMX
DEFS += -DMMX
endif
ifdef USE_ZSNES_FX
DEFS += -DZSNES_FX
endif
DEFAULT_CFLAGS = `sdl-config --cflags`
LDFLAGS = `sdl-config --libs` -lSDL_mixer -lz
ifdef USE_GL
LDFLAGS += -lGL
endif
MORE_CFLAGS = -O3 -DDATA_PREFIX=\"data/\"
MORE_CFLAGS += -Isrc/include -Isrc/unzip -Isrc/menu -Isrc/i386 -DMITSHM \
$(DEFS) -DUNZIP_SUPPORT -DZLIB -DHAVE_MKSTEMP -DHAVE_STRINGS_H \
-DHAVE_SYS_IOCTL_H '-DACCEPT_SIZE_T=int'
#MORE_CFLAGS += -DNOSOUND
CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CPPFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
OBJS = \
src/2xsai.o \
src/apu.o \
src/c4.o \
src/cheats.o \
src/cheats2.o \
src/clip.o \
src/cpu.o \
src/data.o \
src/dma.o \
src/dsp1.o \
src/gfx.o \
src/globals.o \
src/loadzip.o \
src/memmap.o \
src/netplay.o \
src/obc1.o \
src/ppu.o \
src/sa1.o \
src/screenshot.o \
src/sdd1.o \
src/sdd1emu.o \
src/server.o \
src/seta.o \
src/seta010.o \
src/seta011.o \
src/seta018.o \
src/snaporig.o \
src/snapshot.o \
src/soundux.o \
src/spc700.o \
src/spc7110.o \
src/srtc.o \
src/tile.o \
src/sdl/config.o \
src/sdl/machine.o \
src/sdl/sdl.o \
src/unzip/explode.o \
src/unzip/unreduce.o \
src/unzip/unshrink.o \
src/unzip/unzip.o \
src/menu/fade.o \
src/menu/menu.o \
src/menu/menu_main.o \
src/menu/menu_save.o \
src/menu/menu_load.o
ifdef USE_GL
OBJS += \
src/sdl/videogl.o \
src/tilegl.o
endif
ifdef USE_CPUASM
OBJS += \
src/i386/cpuexec.o \
src/i386/cpuops.o \
src/i386/sa1ops.o \
src/i386/spc.o
else
OBJS += \
src/cpuexec.o \
src/sa1cpu.o
endif
ifdef USE_MMX
OBJS += \
src/i386/2xsaimmx.o \
src/i386/bilinear.o
endif
ifdef USE_ZSNES_FX
OBJS += \
src/i386/fxemu2.o \
src/i386/fxemu2b.o \
src/i386/fxemu2c.o \
src/i386/fxtable.o \
src/i386/sfxproc.o \
src/i386/zsnes.o \
src/i386/zsnesc4.o \
src/i386/c4.o
else
OBJS += \
src/cpuops.o \
src/fxinst.o \
src/c4emu.o \
src/fxemu.o
endif
$(PROG): $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS)
$(STRIP) $(PROG)
run: $(PROG)
./$(PROG)
clean:
$(RM) $(PROG) $(OBJS)
src/i386/2xsaimmx.o: src/i386/2xsaimmx.asm
nasm -f elf src/i386/2xsaimmx.asm $(DEFS)
src/i386/bilinear.o: src/i386/bilinear.asm
nasm -f elf src/i386/bilinear.asm $(DEFS)
src/i386/c4.o: src/i386/c4.asm
nasm -f elf src/i386/c4.asm $(DEFS)
src/i386/fxemu2.o: src/i386/fxemu2.asm
nasm -f elf src/i386/fxemu2.asm $(DEFS)
src/i386/fxemu2b.o: src/i386/fxemu2b.asm
nasm -f elf src/i386/fxemu2b.asm $(DEFS)
src/i386/fxemu2c.o: src/i386/fxemu2c.asm
nasm -f elf src/i386/fxemu2c.asm $(DEFS)
src/i386/fxtable.o: src/i386/fxtable.asm
nasm -f elf src/i386/fxtable.asm $(DEFS)
src/i386/sfxproc.o: src/i386/sfxproc.asm
nasm -f elf src/i386/sfxproc.asm $(DEFS)
src/i386/spc.o: src/i386/spc.asm
nasm -f elf src/i386/spc.asm $(DEFS)
src/i386/zsnes.o: src/i386/zsnes.asm
nasm -f elf src/i386/zsnes.asm $(DEFS)
src/i386/zsnesc4.o: src/i386/zsnesc4.asm
nasm -f elf src/i386/zsnesc4.asm $(DEFS)
#USE_CPUASM=1
#USE_MMX=1
#USE_ZSNES_FX=1
USE_GL=1
NAME = snes4all
O = o
RM = rm -f
CC = gcc-3
CXX = g++-3
AS = c++-3
STRIP = strip
PROG = $(NAME)
DEFS += -DSNES4ALL_MAX_ROM_SIZE=0x600000
ifdef USE_GL
DEFS += -DUSE_GL
else
#DEFS += -DNORES256
endif
DEFS += -DCPU_SHUTDOWN
DEFS += -DSPC700_SHUTDOWN
DEFS += -DEXECUTE_SUPERFX_PER_LINE
DEFS += -DSPC700_C
DEFS += -DVAR_CYCLES
DEFS += -DSDD1_DECOMP
DEFS += -DUSE_NO_WAIT_WHEN_IRQ
DEFS += -DUSE_OLD_DSP1
#DEFS += -DNO_INLINE_SET_GET
#DEFS += -DENABLE_ECHO_SOUND
#DEFS += -DENABLE_MASTER_VOLUMEN
#DEFS += -DUSE_SOUND_DESYNC
#DEFS += -DENABLE_INTERPOLATE_SOUND
#DEFS += -DUSE_ALTDECODE=1
#DEFS += -DENABLE_FIX_FREQUENCY
#DEFS += -DUSE_MODE7_INTERPOLATE
DEFS += -DENABLE_GRAPHIC_WINDOWS
DEFS += -DENABLE_HDMA
#DEFS += -DUSE_HDMA_EVENT
#DEFS += -DNEW_COLOUR_BLENDING
#DEFS += -DOLD_COLOUR_BLENDING
#DEFS += -DSNES4ALL_NUM_CHANNELS=6
#DEFS += -DSNES4ALL_STEREO
#DEFS += -DDIRECT_COLOR_MAP
#DEFS += -DTEST_CACHETILE
#DEFS += -DTILES_INLINE
DEFS += -DUSE_RASTER_DIFF
DEFS += -DUSE_GETPPU_TABLE
#DEFS += -DNOSOUND
#DEFS += -DAUTOLOAD=\"example/smario.smc\"
#DEFS += -DAUTO_EVENTS
#DEFS += -DMAX_AUTO_EVENTS=1000
#DEFS += -DPROFILER_SNES4ALL
#DEFS += -DDEBUG_FRAMESKIP
#DEFS += -DAUTO_DEBUG_FRAMESKIP=1000
#DEFS += -DDISPLAY_FRAMERATE
#DEFS += -DDEBUG_TILECACHE
#DEFS += -DAUTO_DEBUG_TILECACHE=2000
DEFS += -D__DJGPP__ -D__DJGCC -D_WINDOWS
ifdef USE_CPUASM
DEFS += -DUSE_X86_ASM -DUSE_OPC_ASM
endif
ifdef USE_MMX
DEFS += -DMMX
endif
ifdef USE_ZSNES_FX
DEFS += -DZSNES_FX
endif
DEFAULT_CFLAGS = `sdl-config --cflags`
LDFLAGS = `sdl-config --libs` -lSDL_mixer -lz
MORE_CFLAGS = -O3 -DDATA_PREFIX=\"data/\" -U__WIN32__
MORE_CFLAGS += -Isrc/include -Isrc/unzip -Isrc/menu -Isrc/i386 -DMITSHM \
$(DEFS) -DUNZIP_SUPPORT -DZLIB -DHAVE_MKSTEMP -DHAVE_STRINGS_H \
'-DACCEPT_SIZE_T=int'
CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CPPFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
OBJS = \
src/2xsai.o \
src/memmap.o \
src/apu.o \
src/c4.o \
src/cheats.o \
src/cheats2.o \
src/clip.o \
src/cpu.o \
src/data.o \
src/dma.o \
src/dsp1.o \
src/gfx.o \
src/globals.o \
src/loadzip.o \
src/netplay.o \
src/obc1.o \
src/ppu.o \
src/sa1.o \
src/screenshot.o \
src/sdd1.o \
src/sdd1emu.o \
src/server.o \
src/seta.o \
src/seta010.o \
src/seta011.o \
src/seta018.o \
src/snaporig.o \
src/snapshot.o \
src/soundux.o \
src/spc700.o \
src/spc7110.o \
src/srtc.o \
src/tile.o \
src/sdl/config.o \
src/sdl/machine.o \
src/sdl/sdl.o \
src/unzip/explode.o \
src/unzip/unreduce.o \
src/unzip/unshrink.o \
src/unzip/unzip.o \
src/menu/fade.o \
src/menu/menu.o \
src/menu/menu_main.o \
src/menu/menu_save.o \
src/menu/menu_load.o
ifdef USE_GL
OBJS += \
src/sdl/videogl.o \
src/tilegl.o
endif
ifdef USE_CPUASM
OBJS += \
src/i386/cpuexec.o \
src/i386/cpuops.o \
src/i386/sa1ops.o \
src/i386/spc.o
else
OBJS += \
src/cpuexec.o \
src/sa1cpu.o
endif
ifdef USE_MMX
OBJS += \
src/i386/2xsaimmx.o \
src/i386/bilinear.o
endif
ifdef USE_ZSNES_FX
OBJS += \
src/i386/fxemu2.o \
src/i386/fxemu2b.o \
src/i386/fxemu2c.o \
src/i386/fxtable.o \
src/i386/sfxproc.o \
src/i386/zsnes.o \
src/i386/zsnesc4.o \
src/i386/c4.o
else
OBJS += \
src/cpuops.o \
src/fxinst.o \
src/c4emu.o \
src/fxemu.o
endif
all: $(PROG)
run: $(PROG)
./$(PROG)
clean:
$(RM) $(PROG).exe $(OBJS) stdout.txt stderr.txt
src/i386/2xsaimmx.o: src/i386/2xsaimmx.asm
nasm -f gnuwin32 src/i386/2xsaimmx.asm $(DEFS)
src/i386/bilinear.o: src/i386/bilinear.asm
nasm -f gnuwin32 src/i386/bilinear.asm $(DEFS)
src/i386/c4.o: src/i386/c4.asm
nasm -f gnuwin32 src/i386/c4.asm $(DEFS)
src/i386/fxemu2.o: src/i386/fxemu2.asm
nasm -f gnuwin32 src/i386/fxemu2.asm $(DEFS)
src/i386/fxemu2b.o: src/i386/fxemu2b.asm
nasm -f gnuwin32 src/i386/fxemu2b.asm $(DEFS)
src/i386/fxemu2c.o: src/i386/fxemu2c.asm
nasm -f gnuwin32 src/i386/fxemu2c.asm $(DEFS)
src/i386/fxtable.o: src/i386/fxtable.asm
nasm -f gnuwin32 src/i386/fxtable.asm $(DEFS)
src/i386/sfxproc.o: src/i386/sfxproc.asm
nasm -f gnuwin32 src/i386/sfxproc.asm $(DEFS)
src/i386/spc.o: src/i386/spc.asm
nasm -f gnuwin32 src/i386/spc.asm $(DEFS)
src/i386/zsnes.o: src/i386/zsnes.asm
nasm -f gnuwin32 src/i386/zsnes.asm $(DEFS)
src/i386/zsnesc4.o: src/i386/zsnesc4.asm
nasm -f gnuwin32 src/i386/zsnesc4.asm $(DEFS)
$(PROG): $(OBJS)
ifdef USE_GL
$(CC) -L/usr/lib/mingw -L/usr/local/lib -L/usr/lib/w32api/ -L/usr/X11R6/lib -lglu32 -lopengl32 -o $(PROG) -lmingw32 $(OBJS) -lglu32 -lopengl32 -lSDL_static_1212 -lGL -lpthread -mwindows -mno-cygwin -luser32 -lgdi32 -lwinmm -ldxguid
else
$(CC) -L/usr/lib/mingw -L/usr/local/lib -o $(PROG) -lmingw32 $(OBJS) -lz -lSDL_static_129 -mwindows -mno-cygwin -luser32 -lgdi32 -lwinmm -ldxguid
endif
$(STRIP) $(PROG).exe
# snes4all
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.completext.com/Dreamcast/snes4all.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.completext.com/Dreamcast/snes4all/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
menu_inv_color=0x44,0x22,0x22
menu_win0_color=0x8F,0x5F,0x5F
menu_win1_color=0xCF,0x6F,0x6F
menu_barra0_color=0x45,0x45,0x45
menu_barra1_color=0xff,0xc4,0x5e
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*******************************************************************************
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
Jerremy Koot (jkoot@snes9x.com)
(c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net)
(c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net),
funkyass (funkyass@spam.shaw.ca),
Joel Yliluoma (http://iki.fi/bisqwit/)
Kris Bleakley (codeviolation@hotmail.com),
Matthew Kendora,
Nach (n-a-c-h@users.sourceforge.net),
Peter Bortas (peter@bortas.org) and
zones (kasumitokoduck@yahoo.com)
C4 x86 assembler and some C emulation code
(c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com),
_Demo_ (_demo_@zsnes.com), and Nach
C4 C++ code
(c) Copyright 2003 Brad Jorsch
DSP-1 emulator code
(c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson,
John Weidman, neviksti (neviksti@hotmail.com),
Kris Bleakley, Andreas Naive
DSP-2 emulator code
(c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and
Lord Nightmare (lord_nightmare@users.sourceforge.net
OBC1 emulator code
(c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and
Kris Bleakley
Ported from x86 assembler to C by sanmaiwashi
SPC7110 and RTC C++ emulator code
(c) Copyright 2002 Matthew Kendora with research by
zsKnight, John Weidman, and Dark Force
S-DD1 C emulator code
(c) Copyright 2003 Brad Jorsch with research by
Andreas Naive and John Weidman
S-RTC C emulator code
(c) Copyright 2001 John Weidman
ST010 C++ emulator code
(c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora
Super FX x86 assembler emulator code
(c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault
Super FX C emulator code
(c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman
SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
Specific ports contains the works of other authors. See headers in
individual files.
Snes9x homepage: http://www.snes9x.com
Permission to use, copy, modify and distribute Snes9x in both binary and
source form, for non-commercial purposes, is hereby granted without fee,
providing that this license information and copyright notice appear with
all copies and any derived work.
This software is provided 'as-is', without any express or implied
warranty. In no event shall the authors be held liable for any damages
arising from the use of this software.
Snes9x is freeware for PERSONAL USE only. Commercial users should
seek permission of the copyright holders first. Commercial use includes
charging money for Snes9x or software derived from Snes9x.
The copyright holders request that bug fixes and improvements to the code
should be forwarded to them so everyone can benefit from the modifications
in future versions.
Super NES and Super Nintendo Entertainment System are trademarks of
Nintendo Co., Limited and its subsidiary companies.
*******************************************************************************/
#include <math.h>
#include <stdlib.h>
#include "c4.h"
#include "memmap.h"
extern "C" {
short C4WFXVal;
short C4WFYVal;
short C4WFZVal;
short C4WFX2Val;
short C4WFY2Val;
short C4WFDist;
short C4WFScale;
static double tanval;
static double c4x, c4y, c4z;
static double c4x2, c4y2, c4z2;
void C4TransfWireFrame ()
{
c4x = (double) C4WFXVal;
c4y = (double) C4WFYVal;
c4z = (double) C4WFZVal - 0x95;
// Rotate X
tanval = -(double) C4WFX2Val * 3.14159265 * 2 / 128;
c4y2 = c4y * cos (tanval) - c4z * sin (tanval);
c4z2 = c4y * sin (tanval) + c4z * cos (tanval);
// Rotate Y
tanval = -(double)C4WFY2Val*3.14159265*2/128;
c4x2 = c4x * cos (tanval) + c4z2 * sin (tanval);
c4z = c4x * - sin (tanval) + c4z2 * cos (tanval);
// Rotate Z
tanval = -(double) C4WFDist * 3.14159265*2 / 128;
c4x = c4x2 * cos (tanval) - c4y2 * sin (tanval);
c4y = c4x2 * sin (tanval) + c4y2 * cos (tanval);
// Scale
C4WFXVal = (short) (c4x*(double)C4WFScale/(0x90*(c4z+0x95))*0x95);
C4WFYVal = (short) (c4y*(double)C4WFScale/(0x90*(c4z+0x95))*0x95);
}
void C4TransfWireFrame2 ()
{
c4x = (double)C4WFXVal;
c4y = (double)C4WFYVal;
c4z = (double)C4WFZVal;
// Rotate X
tanval = -(double) C4WFX2Val * 3.14159265 * 2 / 128;
c4y2 = c4y * cos (tanval) - c4z * sin (tanval);
c4z2 = c4y * sin (tanval) + c4z * cos (tanval);
// Rotate Y
tanval = -(double) C4WFY2Val * 3.14159265 * 2 / 128;
c4x2 = c4x * cos (tanval) + c4z2 * sin (tanval);
c4z = c4x * -sin (tanval) + c4z2 * cos (tanval);
// Rotate Z
tanval = -(double)C4WFDist * 3.14159265 * 2 / 128;
c4x = c4x2 * cos (tanval) - c4y2 * sin (tanval);
c4y = c4x2 * sin (tanval) + c4y2 * cos (tanval);
// Scale
C4WFXVal =(short)(c4x * (double)C4WFScale / 0x100);
C4WFYVal =(short)(c4y * (double)C4WFScale / 0x100);
}
void C4CalcWireFrame ()
{
C4WFXVal = C4WFX2Val - C4WFXVal;
C4WFYVal = C4WFY2Val - C4WFYVal;
if (abs (C4WFXVal) > abs (C4WFYVal))
{
C4WFDist = abs (C4WFXVal) + 1;
C4WFYVal = (short) (256 * (double) C4WFYVal / abs (C4WFXVal));
if (C4WFXVal < 0)
C4WFXVal = -256;
else
C4WFXVal = 256;
}
else
{
if (C4WFYVal != 0)
{
C4WFDist = abs(C4WFYVal)+1;
C4WFXVal = (short) (256 * (double)C4WFXVal / abs (C4WFYVal));
if (C4WFYVal < 0)
C4WFYVal = -256;
else
C4WFYVal = 256;
}
else
C4WFDist = 0;
}
}
short C41FXVal;
short C41FYVal;
short C41FAngleRes;
short C41FDist;
short C41FDistVal;
void C4Op1F ()
{
if (C41FXVal == 0)
{
if (C41FYVal > 0)
C41FAngleRes = 0x80;
else
C41FAngleRes = 0x180;
}
else
{
tanval = (double) C41FYVal / C41FXVal;
C41FAngleRes = (short) (atan (tanval) / (3.141592675 * 2) * 512);
C41FAngleRes = C41FAngleRes;
if (C41FXVal< 0)
C41FAngleRes += 0x100;
C41FAngleRes &= 0x1FF;
}
}
void C4Op15()
{
tanval = sqrt ((double) C41FYVal * C41FYVal + (double) C41FXVal * C41FXVal);
C41FDist = (short) tanval;
}
void C4Op0D()
{
tanval = sqrt ((double) C41FYVal * C41FYVal + (double) C41FXVal * C41FXVal);
tanval = C41FDistVal / tanval;
C41FYVal = (short) (C41FYVal * tanval * 0.99);
C41FXVal = (short) (C41FXVal * tanval * 0.98);
}
void C4LoaDMem(char *C4RAM)
{
memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
S9xGetMemPointer(READ_3WORD(C4RAM+0x1f40)),
READ_WORD(C4RAM+0x1f43));
}
}//end extern C
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment